On Thu, 25 Jun 2015 14:55:15 +0300
Eran Gampel <[email protected]> wrote:

>>From d8379f6b146dbf98a12ffbc9dc95ba595f074509 Mon Sep 17 00:00:00 2001
> From: Eran Gampel <[email protected]>
> Date: Thu, 25 Jun 2015 14:25:45 +0300
> Subject: [PATCH] Add support for the nicira extension mark (NXM_NX_PKT_MARK)
> 
> Add support for match and set for the pkt_mark nicira ext (NXM_NX_PKT_MARK)
> This extension is important as it is the only mark that stay persistence
> across
>  virtual switches
> Signed-off-by: Eran Gampel [email protected]

The patch is malformed. Can you resent it as an attachment?

Here are some comments.

> ---
>  ryu/app/ofctl_rest.py       |  1 -
>  ryu/base/app_manager.py     |  1 -
>  ryu/ofproto/nx_match.py     | 24 ++++++++++++++++++++++++
>  ryu/ofproto/ofproto_v1_0.py |  3 +++
>  ryu/ofproto/ofproto_v1_3.py |  1 +
>  ryu/ofproto/ofproto_v1_4.py |  1 +
>  ryu/ofproto/ofproto_v1_5.py |  1 +
>  7 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py
> index e134cb1..a79788d 100644
> --- a/ryu/app/ofctl_rest.py
> +++ b/ryu/app/ofctl_rest.py
> @@ -32,7 +32,6 @@ from ryu.lib import ofctl_v1_2
>  from ryu.lib import ofctl_v1_3
>  from ryu.app.wsgi import ControllerBase, WSGIApplication
> 
> -

Why?

>  LOG = logging.getLogger('ryu.app.ofctl_rest')
> 
>  # supported ofctl versions in this restful app
> diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
> index b81e59c..d22a191 100644
> --- a/ryu/base/app_manager.py
> +++ b/ryu/base/app_manager.py
> @@ -281,7 +281,6 @@ class RyuApp(object):
>          """
>          Send the specified event to the RyuApp instance specified by name.
>          """
> -

Why?

>          if name in SERVICE_BRICKS:
>              if isinstance(ev, EventRequestBase):
>                  ev.src = self.name
> diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
> index 47fc8f3..c2af35b 100644
> --- a/ryu/ofproto/nx_match.py
> +++ b/ryu/ofproto/nx_match.py
> @@ -90,6 +90,7 @@ class Flow(object):
>          self.nw_frag = 0
>          self.regs = [0] * FLOW_N_REGS
>          self.ipv6_label = 0
> +        self.pkt_mark = 0
>  From d8379f6b146dbf98a12ffbc9dc95ba595f074509 Mon Sep 17 00:00:00 2001
> From: Eran Gampel <[email protected]>
> Date: Thu, 25 Jun 2015 14:25:45 +0300
> Subject: [PATCH] Add support for the nicira extension mark (NXM_NX_PKT_MARK)
> 
> Add support for match and set for the pkt_mark nicira ext (NXM_NX_PKT_MARK)
> This extension is important as it is the only mark that stay persistence
> across
>  virtual switches
> Signed-off-by: Eran Gampel [email protected]
> 
> ---
>  ryu/app/ofctl_rest.py       |  1 -
>  ryu/base/app_manager.py     |  1 -
>  ryu/ofproto/nx_match.py     | 24 ++++++++++++++++++++++++
>  ryu/ofproto/ofproto_v1_0.py |  3 +++
>  ryu/ofproto/ofproto_v1_3.py |  1 +
>  ryu/ofproto/ofproto_v1_4.py |  1 +
>  ryu/ofproto/ofproto_v1_5.py |  1 +
>  7 files changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py
> index e134cb1..a79788d 100644
> --- a/ryu/app/ofctl_rest.py
> +++ b/ryu/app/ofctl_rest.py
> @@ -32,7 +32,6 @@ from ryu.lib import ofctl_v1_2
>  from ryu.lib import ofctl_v1_3
>  from ryu.app.wsgi import ControllerBase, WSGIApplication
> 
> -
>  LOG = logging.getLogger('ryu.app.ofctl_rest')
> 
>  # supported ofctl versions in this restful app
> diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py
> index b81e59c..d22a191 100644
> --- a/ryu/base/app_manager.py
> +++ b/ryu/base/app_manager.py
> @@ -281,7 +281,6 @@ class RyuApp(object):
>          """
>          Send the specified event to the RyuApp instance specified by name.
>          """
> -
>          if name in SERVICE_BRICKS:
>              if isinstance(ev, EventRequestBase):
>                  ev.src = self.name
> diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py
> index 47fc8f3..c2af35b 100644
> --- a/ryu/ofproto/nx_match.py
> +++ b/ryu/ofproto/nx_match.py
> @@ -90,6 +90,7 @@ class Flow(object):
>          self.nw_frag = 0
>          self.regs = [0] * FLOW_N_REGS
>          self.ipv6_label = 0
> +        self.pkt_mark = 0
> 
> 
>  class FlowWildcards(object):
> @@ -111,6 +112,7 @@ class FlowWildcards(object):
>          self.regs_bits = 0
>          self.regs_mask = [0] * FLOW_N_REGS
>          self.wildcards = ofproto_v1_0.OFPFW_ALL
> +        self.pkt_mark_mask = 0
> 
> 
>  class ClsRule(object):
> @@ -291,6 +293,10 @@ class ClsRule(object):
>          self.flow.regs[reg_idx] = value
>          self.wc.regs_bits |= (1 << reg_idx)
> 
> +    def set_pkt_mark_masked(self, pkt_mark, mask):
> +        self.flow.pkt_mark = pkt_mark
> +        self.wc.pkt_mark_mask = mask
> +
>      def flow_format(self):
>          # Tunnel ID is only supported by NXM
>          if self.wc.tun_id_mask != 0:
> @@ -914,6 +920,17 @@ class MFRegister(MFField):
>                      return self._put(buf, offset, rule.flow.regs[i])
> 
> 
> +@_register_make
> +@_set_nxm_headers([ofproto_v1_0.NXM_NX_PKT_MARK,
> ofproto_v1_0.NXM_NX_PKT_MARK_W])
> +class MFPktMark(MFField):
> +    @classmethod
> +    def make(cls, header):
> +        return cls(header, MF_PACK_STRING_BE32)
> +
> +    def put(self, buf, offset, rule):
> +        return self.putm(buf, offset, rule.flow.pkt_mark,
> rule.wc.pkt_mark_mask)
> +
> +
>  def serialize_nxm_match(rule, buf, offset):
>      old_offset = offset
> 
> @@ -1071,6 +1088,13 @@ def serialize_nxm_match(rule, buf, offset):
>              header = ofproto_v1_0.NXM_NX_IP_FRAG_W
>          offset += nxm_put(buf, offset, header, rule)
> 
> +    if rule.flow.pkt_mark != 0:
> +        if rule.wc.pkt_mark_mask == UINT32_MAX:
> +            header = ofproto_v1_0.NXM_NX_PKT_MARK
> +        else:
> +            header = ofproto_v1_0.NXM_NX_PKT_MARK_W
> +        offset += nxm_put(buf, offset, header, rule)
> +
>      # Tunnel Id
>      if rule.wc.tun_id_mask != 0:
>          if rule.wc.tun_id_mask == UINT64_MAX:
> diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
> index 8da9970..2b0e052 100644
> --- a/ryu/ofproto/ofproto_v1_0.py
> +++ b/ryu/ofproto/ofproto_v1_0.py
> @@ -582,6 +582,9 @@ NXM_NX_IP_ECN = nxm_header(0x0001, 28, 1)
> 
>  NXM_NX_IP_TTL = nxm_header(0x0001, 29, 1)
> 
> +NXM_NX_PKT_MARK = nxm_header(0x0001, 33, 4)
> +NXM_NX_PKT_MARK_W = nxm_header_w(0x0001, 33, 4)
> +
> 
>  def nxm_nx_reg(idx):
>      return nxm_header(0x0001, idx, 4)
> diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py
> index a06c305..80916ec 100644
> --- a/ryu/ofproto/ofproto_v1_3.py
> +++ b/ryu/ofproto/ofproto_v1_3.py
> @@ -1192,6 +1192,7 @@ oxm_types = [
>      oxm_fields.ONFExperimenter('actset_output', 43, type_desc.Int4),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>      oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
> 
>      # The following definition is merely for testing 64-bit experimenter
> OXMs.
> diff --git a/ryu/ofproto/ofproto_v1_4.py b/ryu/ofproto/ofproto_v1_4.py
> index 7fcdf51..534c6b2 100644
> --- a/ryu/ofproto/ofproto_v1_4.py
> +++ b/ryu/ofproto/ofproto_v1_4.py
> @@ -391,6 +391,7 @@ oxm_types = [
>      oxm_fields.OpenFlowBasic('pbb_uca', 41, type_desc.Int1),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>  ]
> 
>  oxm_fields.generate(__name__)
> diff --git a/ryu/ofproto/ofproto_v1_5.py b/ryu/ofproto/ofproto_v1_5.py
> index 1ec4b97..753b951 100644
> --- a/ryu/ofproto/ofproto_v1_5.py
> +++ b/ryu/ofproto/ofproto_v1_5.py
> @@ -434,6 +434,7 @@ oxm_types = [
>      oxm_fields.OpenFlowBasic('packet_type', 44, type_desc.Int4),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>      oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
>  ]
> 
> -- 
> 1.9.1
> 
> 
>  class FlowWildcards(object):
> @@ -111,6 +112,7 @@ class FlowWildcards(object):
>          self.regs_bits = 0
>          self.regs_mask = [0] * FLOW_N_REGS
>          self.wildcards = ofproto_v1_0.OFPFW_ALL
> +        self.pkt_mark_mask = 0
> 
> 
>  class ClsRule(object):
> @@ -291,6 +293,10 @@ class ClsRule(object):
>          self.flow.regs[reg_idx] = value
>          self.wc.regs_bits |= (1 << reg_idx)
> 
> +    def set_pkt_mark_masked(self, pkt_mark, mask):
> +        self.flow.pkt_mark = pkt_mark
> +        self.wc.pkt_mark_mask = mask
> +
>      def flow_format(self):
>          # Tunnel ID is only supported by NXM
>          if self.wc.tun_id_mask != 0:
> @@ -914,6 +920,17 @@ class MFRegister(MFField):
>                      return self._put(buf, offset, rule.flow.regs[i])
> 
> 
> +@_register_make
> +@_set_nxm_headers([ofproto_v1_0.NXM_NX_PKT_MARK,
> ofproto_v1_0.NXM_NX_PKT_MARK_W])
> +class MFPktMark(MFField):
> +    @classmethod
> +    def make(cls, header):
> +        return cls(header, MF_PACK_STRING_BE32)
> +
> +    def put(self, buf, offset, rule):
> +        return self.putm(buf, offset, rule.flow.pkt_mark,
> rule.wc.pkt_mark_mask)
> +
> +
>  def serialize_nxm_match(rule, buf, offset):
>      old_offset = offset
> 
> @@ -1071,6 +1088,13 @@ def serialize_nxm_match(rule, buf, offset):
>              header = ofproto_v1_0.NXM_NX_IP_FRAG_W
>          offset += nxm_put(buf, offset, header, rule)
> 
> +    if rule.flow.pkt_mark != 0:
> +        if rule.wc.pkt_mark_mask == UINT32_MAX:
> +            header = ofproto_v1_0.NXM_NX_PKT_MARK
> +        else:
> +            header = ofproto_v1_0.NXM_NX_PKT_MARK_W
> +        offset += nxm_put(buf, offset, header, rule)
> +
>      # Tunnel Id
>      if rule.wc.tun_id_mask != 0:
>          if rule.wc.tun_id_mask == UINT64_MAX:
> diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py
> index 8da9970..2b0e052 100644
> --- a/ryu/ofproto/ofproto_v1_0.py
> +++ b/ryu/ofproto/ofproto_v1_0.py
> @@ -582,6 +582,9 @@ NXM_NX_IP_ECN = nxm_header(0x0001, 28, 1)
> 
>  NXM_NX_IP_TTL = nxm_header(0x0001, 29, 1)
> 
> +NXM_NX_PKT_MARK = nxm_header(0x0001, 33, 4)
> +NXM_NX_PKT_MARK_W = nxm_header_w(0x0001, 33, 4)
> +
> 
>  def nxm_nx_reg(idx):
>      return nxm_header(0x0001, idx, 4)
> diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py
> index a06c305..80916ec 100644
> --- a/ryu/ofproto/ofproto_v1_3.py
> +++ b/ryu/ofproto/ofproto_v1_3.py
> @@ -1192,6 +1192,7 @@ oxm_types = [
>      oxm_fields.ONFExperimenter('actset_output', 43, type_desc.Int4),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>      oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
> 
>      # The following definition is merely for testing 64-bit experimenter
> OXMs.
> diff --git a/ryu/ofproto/ofproto_v1_4.py b/ryu/ofproto/ofproto_v1_4.py
> index 7fcdf51..534c6b2 100644
> --- a/ryu/ofproto/ofproto_v1_4.py
> +++ b/ryu/ofproto/ofproto_v1_4.py
> @@ -391,6 +391,7 @@ oxm_types = [
>      oxm_fields.OpenFlowBasic('pbb_uca', 41, type_desc.Int1),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>  ]
> 
>  oxm_fields.generate(__name__)
> diff --git a/ryu/ofproto/ofproto_v1_5.py b/ryu/ofproto/ofproto_v1_5.py
> index 1ec4b97..753b951 100644
> --- a/ryu/ofproto/ofproto_v1_5.py
> +++ b/ryu/ofproto/ofproto_v1_5.py
> @@ -434,6 +434,7 @@ oxm_types = [
>      oxm_fields.OpenFlowBasic('packet_type', 44, type_desc.Int4),
>      oxm_fields.NiciraExtended1('tun_ipv4_src', 31, type_desc.IPv4Addr),
>      oxm_fields.NiciraExtended1('tun_ipv4_dst', 32, type_desc.IPv4Addr),
> +    oxm_fields.NiciraExtended1('pkt_mark', 33, type_desc.Int4),
>      oxm_fields.NiciraExtended1('conj_id', 37, type_desc.Int4),
>  ]
> 
> -- 
> 1.9.1

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to