On Sat, 23 Jun 2012 16:11:46 +0900
Simon Horman <[email protected]> wrote:

> On Sat, Jun 23, 2012 at 03:59:10PM +0900, FUJITA Tomonori wrote:
> > On Sat, 23 Jun 2012 15:04:42 +0900
> > Simon Horman <[email protected]> wrote:
> > 
> > > On Fri, Jun 22, 2012 at 02:44:20PM +0900, FUJITA Tomonori wrote:
> > > > I think that we complete nx_match except for NXM_NX_COOKIE that I've
> > > > not tested. I might miss something though.
> > > 
> > > It may be worth considering splitting out adding the header parameter
> > > to the initialiser of MFField into a separate patch. I think that would
> > > make the NXM_NX_REG changes more obvious.
> > 
> > Yeah, you are right. I should have done so. Sorry, I've already merged
> > it though.
> 
> No problem.
> 
> I am, however, concerned that the last parameter of set_reg_masked() in
> set_reg() should be UINT32_MAX instead of 0. If so the put method of

Why? What problem could we hit with the current code?

btw, the current code is totally broken. We need to handle
ofproto_v1_0.nxm_nx_reg_w().

diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
index 12453c7..c9f2834 100644
--- a/ryu/ofproto/nx_match.py
+++ b/ryu/ofproto/nx_match.py
@@ -704,7 +704,8 @@ class MFICMPV6Label(MFField):
 
 
 @_register_make
-@_set_nxm_headers([ofproto_v1_0.nxm_nx_reg(i) for i in range(FLOW_N_REGS)])
+@_set_nxm_headers([ofproto_v1_0.nxm_nx_reg(i) for i in range(FLOW_N_REGS)]
+                  + [ofproto_v1_0.nxm_nx_reg_w(i) for i in range(FLOW_N_REGS)])
 class MFRegister(MFField):
     @classmethod
     def make(cls, header):
@@ -712,7 +713,8 @@ class MFRegister(MFField):
 
     def put(self, buf, offset, rule):
         for i in range(FLOW_N_REGS):
-            if ofproto_v1_0.nxm_nx_reg(i) == self.nxm_header:
+            if (ofproto_v1_0.nxm_nx_reg(i) == self.nxm_header or
+                ofproto_v1_0.nxm_nx_reg_w(i) == self.nxm_header):
                 if rule.wc.regs_mask[i]:
                     return self.putm(buf, offset, rule.flow.regs[i],
                                      rule.wc.regs_mask[i])
@@ -889,7 +891,10 @@ def serialize_nxm_match(rule, buf, offset):
 
     for i in range(FLOW_N_REGS):
         if rule.wc.regs_bits & (1 << i):
-            header = ofproto_v1_0.nxm_nx_reg(i)
+            if rule.wc.regs_mask[i]:
+                header = ofproto_v1_0.nxm_nx_reg_w(i)
+            else:
+                header = ofproto_v1_0.nxm_nx_reg(i)
             offset += nxm_put(buf, offset, header, rule)
 
     # Pad






------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to