From fd7bac0f2df49f34ee3e19b7aee60b1eb1d53b12 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 26 Jun 2012 09:41:45 +0900 Subject: [PATCH] nxm: fix NXM_NX_REG Needs to handle NXM_NX_REG_W. Signed-off-by: FUJITA Tomonori --- ryu/ofproto/nx_match.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index 12453c78..c9f2834e 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