[ovs-dev,v3] netdev-offload-dpdk : add ipv6 rte flow item support
diff mbox series

Message ID 2019091616324527354544@cmss.chinamobile.com
State New
Headers show
Series
  • [ovs-dev,v3] netdev-offload-dpdk : add ipv6 rte flow item support
Related show

Commit Message

Timo_Liu Sept. 16, 2019, 8:32 a.m. UTC
v2->v3: reformat patch from git record


Signed-off-by: Liu Chang <liuchang@cmss.chinamobile.com>

Patch
diff mbox series

diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 01e9004..ab3f82b 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -433,7 +433,10 @@  netdev_offload_dpdk_add_flow(struct netdev *netdev,
     struct flow_items {
         struct rte_flow_item_eth  eth;
         struct rte_flow_item_vlan vlan;
-        struct rte_flow_item_ipv4 ipv4;
+        union {
+            struct rte_flow_item_ipv4 ipv4;
+            struct rte_flow_item_ipv6 ipv6;
+        };
         union {
             struct rte_flow_item_tcp  tcp;
             struct rte_flow_item_udp  udp;
@@ -503,6 +506,31 @@  netdev_offload_dpdk_add_flow(struct netdev *netdev,
                 mask.ipv4.hdr.next_proto_id;
     }
 
+    /* IP v6 */
+    if (match->flow.dl_type == htons(ETH_TYPE_IPV6)) {
+        int i =0;
+
+        spec.ipv6.hdr.vtc_flow   = match->flow.ipv6_label;
+        spec.ipv6.hdr.proto      = match->flow.nw_proto;
+        spec.ipv6.hdr.hop_limits = match->flow.nw_ttl;
+
+        mask.ipv6.hdr.vtc_flow   = match->wc.masks.ipv6_label;
+        mask.ipv6.hdr.proto      = match->wc.masks.nw_proto;
+        mask.ipv6.hdr.hop_limits = match->wc.masks.nw_ttl;
+
+        for (i = 0; i < 16; i++) {
+            spec.ipv6.hdr.src_addr[i] = match->flow.ipv6_src.s6_addr[i];
+            spec.ipv6.hdr.dst_addr[i] = match->flow.ipv6_dst.s6_addr[i];
+
+            mask.ipv6.hdr.src_addr[i] = match->wc.masks.ipv6_src.s6_addr[i];
+            mask.ipv6.hdr.dst_addr[i] = match->wc.masks.ipv6_dst.s6_addr[i];
+        }
+
+        add_flow_pattern(&amp;patterns, RTE_FLOW_ITEM_TYPE_IPV6,
+                         &amp;spec.ipv6, &amp;mask.ipv6);
+
+    }
+
     if (proto != IPPROTO_ICMP &amp;&amp; proto != IPPROTO_UDP  &amp;&amp;
         proto != IPPROTO_SCTP &amp;&amp; proto != IPPROTO_TCP  &amp;&amp;
         (match->wc.masks.tp_src ||