[ovs-dev] [PATCH V2 4/4] netdev-tc-offloads: Add support for action set

Simon Horman simon.horman at netronome.com
Wed Sep 27 08:55:57 UTC 2017


On Mon, Sep 25, 2017 at 05:48:49PM +0300, Paul Blakey wrote:
> 
> 
> On 18/09/2017 18:05, Simon Horman wrote:
> >On Mon, Sep 18, 2017 at 07:16:04AM +0300, Roi Dayan wrote:
> >>From: Paul Blakey <paulb at mellanox.com>
> >>
> >>Implement support for offloading ovs action set using
> >>tc header rewrite action.
> >>
> >>Signed-off-by: Paul Blakey <paulb at mellanox.com>
> >>Reviewed-by: Roi Dayan <roid at mellanox.com>
> >>---
> >>  lib/netdev-tc-offloads.c | 201 +++++++++++++++++++++++++++++++++++++++++++++--
> >>  1 file changed, 195 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
> >>index 3c145c2..4044a77 100644
> >>--- a/lib/netdev-tc-offloads.c
> >>+++ b/lib/netdev-tc-offloads.c
> >>@@ -27,11 +27,13 @@
> >>  #include "openvswitch/ofpbuf.h"
> >>  #include "openvswitch/thread.h"
> >>  #include "openvswitch/types.h"
> >>+#include "openvswitch/util.h"
> >>  #include "openvswitch/vlog.h"
> >>  #include "netdev-linux.h"
> >>  #include "netlink.h"
> >>  #include "netlink-socket.h"
> >>  #include "odp-netlink.h"
> >>+#include "odp-util.h"
> >>  #include "tc.h"
> >>  #include "unaligned.h"
> >>  #include "util.h"
> >>@@ -41,6 +43,76 @@ VLOG_DEFINE_THIS_MODULE(netdev_tc_offloads);
> >>  static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(60, 5);
> >>  static struct hmap ufid_tc = HMAP_INITIALIZER(&ufid_tc);
> >>+
> >>+struct netlink_field {
> >>+    int offset;
> >>+    int flower_offset;
> >>+    int size;
> >>+};
> >>+
> >>+static struct netlink_field set_flower_map[][3] = {
> >>+    [OVS_KEY_ATTR_IPV4] = {
> >>+        { offsetof(struct ovs_key_ipv4, ipv4_src),
> >>+          offsetof(struct tc_flower_key, ipv4.ipv4_src),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, ipv4.ipv4_src)
> >>+        },
> >>+        { offsetof(struct ovs_key_ipv4, ipv4_dst),
> >>+          offsetof(struct tc_flower_key, ipv4.ipv4_dst),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, ipv4.ipv4_dst)
> >>+        },
> >>+        { offsetof(struct ovs_key_ipv4, ipv4_ttl),
> >>+          offsetof(struct tc_flower_key, ipv4.rewrite_ttl),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, ipv4.rewrite_ttl)
> >>+        },
> >>+    },
> >>+    [OVS_KEY_ATTR_IPV6] = {
> >>+        { offsetof(struct ovs_key_ipv6, ipv6_src),
> >>+          offsetof(struct tc_flower_key, ipv6.ipv6_src),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, ipv6.ipv6_src)
> >>+        },
> >>+        { offsetof(struct ovs_key_ipv6, ipv6_dst),
> >>+          offsetof(struct tc_flower_key, ipv6.ipv6_dst),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, ipv6.ipv6_dst)
> >>+        },
> >>+    },
> >>+    [OVS_KEY_ATTR_ETHERNET] = {
> >>+        { offsetof(struct ovs_key_ethernet, eth_src),
> >>+          offsetof(struct tc_flower_key, src_mac),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, src_mac)
> >>+        },
> >>+        { offsetof(struct ovs_key_ethernet, eth_dst),
> >>+          offsetof(struct tc_flower_key, dst_mac),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, dst_mac)
> >>+        },
> >>+    },
> >>+    [OVS_KEY_ATTR_ETHERTYPE] = {
> >>+        { 0,
> >>+          offsetof(struct tc_flower_key, eth_type),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, eth_type)
> >>+        },
> >>+    },
> >>+    [OVS_KEY_ATTR_TCP] = {
> >>+        { offsetof(struct ovs_key_tcp, tcp_src),
> >>+          offsetof(struct tc_flower_key, tcp_src),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, tcp_src)
> >>+        },
> >>+        { offsetof(struct ovs_key_tcp, tcp_dst),
> >>+          offsetof(struct tc_flower_key, tcp_dst),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, tcp_dst)
> >>+        },
> >>+    },
> >>+    [OVS_KEY_ATTR_UDP] = {
> >>+        { offsetof(struct ovs_key_udp, udp_src),
> >>+          offsetof(struct tc_flower_key, udp_src),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, udp_src)
> >>+        },
> >>+        { offsetof(struct ovs_key_udp, udp_dst),
> >>+          offsetof(struct tc_flower_key, udp_dst),
> >>+          MEMBER_SIZEOF(struct tc_flower_key, udp_dst)
> >>+        },
> >>+    },
> >>+};
> >
> >Do you have any plans to add the following?
> >
> >	OVS_KEY_ATTR_ICMP
> >	OVS_KEY_ATTR_ICMPV6
> >	OVS_KEY_ATTR_ARP
> >	OVS_KEY_ATTR_ND
> >	OVS_KEY_ATTR_SCTP
> >	OVS_KEY_ATTR_TCP_FLAGS
> >
> >...
> >
> 
> 
> Yes, if pedit supports them (which I think it should). do you want it me to
> add it to this patchset, for us it would be faster to add those later after
> this is accepted as we have some inside testsuite for the currently
> supported ones and will need to come up with new ones for these.

Later is fine by me.


More information about the dev mailing list