diff mbox series

[ovs-dev,v3] netdev_offload_dpdk: Support icmpv6 offload.

Message ID 20241112114528.584-1-allen.chen@jaguarmicro.com
State New
Delegated to: Kevin Traynor
Headers show
Series [ovs-dev,v3] netdev_offload_dpdk: Support icmpv6 offload. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Allen Chen Nov. 12, 2024, 11:45 a.m. UTC
Support icmpv6 offload

Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>

---
//add ovs flow table
[root@localhost ~]# ovs-ofctl add-flow br-jmnd in_port=dpdk0,dl_type=0x86dd,nw_proto=58,action=output:net0

//dump ovs flow table
[root@localhost ~]# ovs-ofctl dump-flows br-jmnd
 cookie=0x0, duration=759.207s, table=0, n_packets=303, n_bytes=37572, icmp6,in_port=dpdk0 actions=output:net0
 cookie=0x0, duration=732.399s, table=0, n_packets=0, n_bytes=0, icmp6,in_port=net0 actions=output:dpdk0

//set 'ovs-appctl vlog/set netdev_offload_dpdk:dbg' and cat ovs-vswitchd.log
2018-06-22T20:02:10.744Z|00003|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0: rte_flow 0x10037b0c0   flow create 0 priority 0 group 0 transfer pattern eth type is 0x86dd has_vlan is 0 / ipv6 proto is 58 has_frag_ext is 0 / icmp6 / end actions count / port_id original 0 id 2 / end
2018-06-22T20:02:10.744Z|00004|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: installed flow 0x10037b0c0 by ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
2018-06-22T20:02:50.968Z|00005|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: rte_flow 0x10037b0c0 flow destroy 0 ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
2018-06-22T20:09:01.696Z|00006|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0: rte_flow 0x10037b200   flow create 0 priority 0 group 0 transfer pattern eth type is 0x86dd has_vlan is 0 / ipv6 proto is 58 has_frag_ext is 0 / icmp6 / end actions count / port_id original 0 id 2 / end
2018-06-22T20:09:01.696Z|00007|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: installed flow 0x10037b200 by ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
2018-06-22T20:11:21.904Z|00008|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: rte_flow 0x10037b200 flow destroy 0 ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f

//confirm the flow is offloaded
[root@localhost ~]# ovs-appctl dpctl/dump-flows -m | grep offloaded
ufid:51a14f16-7adc-4c5d-b97d-0c5487ef9777, mega_ufid:0ef1818a-eca1-40fc-a105-97046fcbbc3f, skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),       dp_hash(0/0),in_port(dpdk0),packet_type(ns=0,id=0),eth(src=00:00:00:12:30:10/00:00:00:00:00:00,dst=00:00:00:13:40:20/00:00:00:00:00:00),eth_type(0x86dd),ipv6(src=2001::2/::,dst=2001::1:f1:11/::,label=0/0,proto=58,tclass=0/0,hlimit=255/0,frag=no),icmpv6(type=129/0,code=0/0), packets:57, bytes:7068, dpe_packets:57, dpe_bytes:7068,used:0.000s, offloaded:yes, dp:dpdk, actions:net0,dp-extra-info:miniflow_bits(4,1)

//gdb offload process
(gdb)
    at ../drivers/net/jmnd/jmnd_flow/jmnd_flow.c:622
    at ../drivers/net/jmnd/jmnd_flow/jmnd_flow.c:1765
    at lib/netdev-offload-dpdk.c:1277
    act_vars=0xfffe7fffb818) at lib/netdev-offload-dpdk.c:2823
    at lib/netdev-offload-dpdk.c:2868
    at lib/netdev-offload-dpdk.c:3002
    at lib/netdev-offload.c:264
(gdb) p patterns[0]
$1 = {type = RTE_FLOW_ITEM_TYPE_ETH, spec = 0xfffe74003300, last = 0x0, mask = 0xfffe74003250}
(gdb) p patterns[1]
$2 = {type = RTE_FLOW_ITEM_TYPE_IPV6, spec = 0xfffe740035b0, last = 0x0, mask = 0xfffe740035f0}
(gdb) p patterns[2]
$3 = {type = RTE_FLOW_ITEM_TYPE_ICMP6, spec = 0xfffe74002a50, last = 0x0, mask = 0xfffe74002ce0}
(gdb) p patterns[3]
$4 = {type = RTE_FLOW_ITEM_TYPE_END, spec = 0x0, last = 0x0, mask = 0x0}
(gdb) p action[0]
Structure has no component named operator[].
(gdb) p actions[0]
$5 = {type = RTE_FLOW_ACTION_TYPE_COUNT, conf = 0xfffe740037c0}
(gdb) p actions[1]
$6 = {type = RTE_FLOW_ACTION_TYPE_PORT_ID, conf = 0xfffe74003870}
(gdb) p actions[2]
$7 = {type = RTE_FLOW_ACTION_TYPE_END, conf = 0x0}
(gdb) p/x *(struct rte_flow_item_icmp6 *)0xfffe74002a50
$8 = {type = 0x81, code = 0x0, checksum = 0x0}
(gdb) p/x *(struct rte_flow_item_icmp6 *)0xfffe74002ce0
$9 = {type = 0x0, code = 0x0, checksum = 0x0}
---
 NEWS                      |  5 +++++
 lib/netdev-offload-dpdk.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

Comments

Eelco Chaudron Nov. 14, 2024, 1:57 p.m. UTC | #1
On 12 Nov 2024, at 12:45, Allen Chen via dev wrote:

> Support icmpv6 offload
>
> Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>

Recheck-request: github-robot

> ---
> //add ovs flow table
> [root@localhost ~]# ovs-ofctl add-flow br-jmnd in_port=dpdk0,dl_type=0x86dd,nw_proto=58,action=output:net0
>
> //dump ovs flow table
> [root@localhost ~]# ovs-ofctl dump-flows br-jmnd
>  cookie=0x0, duration=759.207s, table=0, n_packets=303, n_bytes=37572, icmp6,in_port=dpdk0 actions=output:net0
>  cookie=0x0, duration=732.399s, table=0, n_packets=0, n_bytes=0, icmp6,in_port=net0 actions=output:dpdk0
>
> //set 'ovs-appctl vlog/set netdev_offload_dpdk:dbg' and cat ovs-vswitchd.log
> 2018-06-22T20:02:10.744Z|00003|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0: rte_flow 0x10037b0c0   flow create 0 priority 0 group 0 transfer pattern eth type is 0x86dd has_vlan is 0 / ipv6 proto is 58 has_frag_ext is 0 / icmp6 / end actions count / port_id original 0 id 2 / end
> 2018-06-22T20:02:10.744Z|00004|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: installed flow 0x10037b0c0 by ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
> 2018-06-22T20:02:50.968Z|00005|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: rte_flow 0x10037b0c0 flow destroy 0 ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
> 2018-06-22T20:09:01.696Z|00006|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0: rte_flow 0x10037b200   flow create 0 priority 0 group 0 transfer pattern eth type is 0x86dd has_vlan is 0 / ipv6 proto is 58 has_frag_ext is 0 / icmp6 / end actions count / port_id original 0 id 2 / end
> 2018-06-22T20:09:01.696Z|00007|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: installed flow 0x10037b200 by ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
> 2018-06-22T20:11:21.904Z|00008|netdev_offload_dpdk(hw_offload5)|DBG|dpdk0/dpdk0: rte_flow 0x10037b200 flow destroy 0 ufid 0ef1818a-eca1-40fc-a105-97046fcbbc3f
>
> //confirm the flow is offloaded
> [root@localhost ~]# ovs-appctl dpctl/dump-flows -m | grep offloaded
> ufid:51a14f16-7adc-4c5d-b97d-0c5487ef9777, mega_ufid:0ef1818a-eca1-40fc-a105-97046fcbbc3f, skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),       dp_hash(0/0),in_port(dpdk0),packet_type(ns=0,id=0),eth(src=00:00:00:12:30:10/00:00:00:00:00:00,dst=00:00:00:13:40:20/00:00:00:00:00:00),eth_type(0x86dd),ipv6(src=2001::2/::,dst=2001::1:f1:11/::,label=0/0,proto=58,tclass=0/0,hlimit=255/0,frag=no),icmpv6(type=129/0,code=0/0), packets:57, bytes:7068, dpe_packets:57, dpe_bytes:7068,used:0.000s, offloaded:yes, dp:dpdk, actions:net0,dp-extra-info:miniflow_bits(4,1)
>
> //gdb offload process
> (gdb)
>     at ../drivers/net/jmnd/jmnd_flow/jmnd_flow.c:622
>     at ../drivers/net/jmnd/jmnd_flow/jmnd_flow.c:1765
>     at lib/netdev-offload-dpdk.c:1277
>     act_vars=0xfffe7fffb818) at lib/netdev-offload-dpdk.c:2823
>     at lib/netdev-offload-dpdk.c:2868
>     at lib/netdev-offload-dpdk.c:3002
>     at lib/netdev-offload.c:264
> (gdb) p patterns[0]
> $1 = {type = RTE_FLOW_ITEM_TYPE_ETH, spec = 0xfffe74003300, last = 0x0, mask = 0xfffe74003250}
> (gdb) p patterns[1]
> $2 = {type = RTE_FLOW_ITEM_TYPE_IPV6, spec = 0xfffe740035b0, last = 0x0, mask = 0xfffe740035f0}
> (gdb) p patterns[2]
> $3 = {type = RTE_FLOW_ITEM_TYPE_ICMP6, spec = 0xfffe74002a50, last = 0x0, mask = 0xfffe74002ce0}
> (gdb) p patterns[3]
> $4 = {type = RTE_FLOW_ITEM_TYPE_END, spec = 0x0, last = 0x0, mask = 0x0}
> (gdb) p action[0]
> Structure has no component named operator[].
> (gdb) p actions[0]
> $5 = {type = RTE_FLOW_ACTION_TYPE_COUNT, conf = 0xfffe740037c0}
> (gdb) p actions[1]
> $6 = {type = RTE_FLOW_ACTION_TYPE_PORT_ID, conf = 0xfffe74003870}
> (gdb) p actions[2]
> $7 = {type = RTE_FLOW_ACTION_TYPE_END, conf = 0x0}
> (gdb) p/x *(struct rte_flow_item_icmp6 *)0xfffe74002a50
> $8 = {type = 0x81, code = 0x0, checksum = 0x0}
> (gdb) p/x *(struct rte_flow_item_icmp6 *)0xfffe74002ce0
> $9 = {type = 0x0, code = 0x0, checksum = 0x0}
> ---
>  NEWS                      |  5 +++++
>  lib/netdev-offload-dpdk.c | 37 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 42 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index c2443a999..2a9099851 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,3 +1,8 @@
> +v3.4.0 - 12 Nov 2024
> +---------------------
> +    - Add support for ICMPV6 offload.
> +
> +
>  Post-v3.4.0
>  --------------------
>     - Userspace datapath:
> diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
> index 1a6e100ff..1ec5d175b 100644
> --- a/lib/netdev-offload-dpdk.c
> +++ b/lib/netdev-offload-dpdk.c
> @@ -495,6 +495,26 @@ dump_flow_pattern(struct ds *s,
>                                icmp_mask->hdr.icmp_code, 0);
>          }
>          ds_put_cstr(s, "/ ");
> +    } else if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6) {
> +        const struct rte_flow_item_icmp6 *icmp6_spec = item->spec;
> +        const struct rte_flow_item_icmp6 *icmp6_mask = item->mask;
> +
> +        ds_put_cstr(s, "icmpv6 ");
> +        if (icmp6_spec) {
> +            if (!icmp6_mask) {
> +                icmp6_mask = &rte_flow_item_icmp6_mask;
> +            }
> +            DUMP_PATTERN_ITEM(icmp6_mask->type, false, "type",
> +                              "%"PRIu8, icmp6_spec->type,
> +                              icmp6_mask->type, 0);
> +            DUMP_PATTERN_ITEM(icmp6_mask->code, false, "code",
> +                              "%"PRIu8, icmp6_spec->code,
> +                              icmp6_mask->code, 0);
> +            DUMP_PATTERN_ITEM(icmp6_mask->checksum, false, "checksum",
> +                          "%"PRIu8, icmp6_spec->checksum,
> +                          icmp6_mask->checksum, 0);
> +        }
> +        ds_put_cstr(s, "/ ");
>      } else if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
>          const struct rte_flow_item_tcp *tcp_spec = item->spec;
>          const struct rte_flow_item_tcp *tcp_mask = item->mask;
> @@ -1608,6 +1628,7 @@ parse_flow_match(struct netdev *netdev,
>
>      if (proto != IPPROTO_ICMP && proto != IPPROTO_UDP  &&
>          proto != IPPROTO_SCTP && proto != IPPROTO_TCP  &&
> +        proto != IPPROTO_ICMPV6 &&
>          (match->wc.masks.tp_src ||
>           match->wc.masks.tp_dst ||
>           match->wc.masks.tcp_flags)) {
> @@ -1684,6 +1705,22 @@ parse_flow_match(struct netdev *netdev,
>          consumed_masks->tp_dst = 0;
>
>          add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_ICMP, spec, mask, NULL);
> +    } else if (proto == IPPROTO_ICMPV6) {
> +        struct rte_flow_item_icmp6 *spec, *mask;
> +
> +        spec = xzalloc(sizeof *spec);
> +        mask = xzalloc(sizeof *mask);
> +
> +        spec->type = (uint8_t) ntohs(match->flow.tp_src);
> +        spec->code = (uint8_t) ntohs(match->flow.tp_dst);
> +
> +        mask->type = (uint8_t) ntohs(match->wc.masks.tp_src);
> +        mask->code = (uint8_t) ntohs(match->wc.masks.tp_dst);
> +
> +        consumed_masks->tp_src = 0;
> +        consumed_masks->tp_dst = 0;
> +
> +        add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_ICMP6, spec, mask, NULL);
>      }
>
>      add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_END, NULL, NULL, NULL);
> -- 
> 2.33.0.windows.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index c2443a999..2a9099851 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@ 
+v3.4.0 - 12 Nov 2024
+---------------------
+    - Add support for ICMPV6 offload.
+
+
 Post-v3.4.0
 --------------------
    - Userspace datapath:
diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
index 1a6e100ff..1ec5d175b 100644
--- a/lib/netdev-offload-dpdk.c
+++ b/lib/netdev-offload-dpdk.c
@@ -495,6 +495,26 @@  dump_flow_pattern(struct ds *s,
                               icmp_mask->hdr.icmp_code, 0);
         }
         ds_put_cstr(s, "/ ");
+    } else if (item->type == RTE_FLOW_ITEM_TYPE_ICMP6) {
+        const struct rte_flow_item_icmp6 *icmp6_spec = item->spec;
+        const struct rte_flow_item_icmp6 *icmp6_mask = item->mask;
+
+        ds_put_cstr(s, "icmpv6 ");
+        if (icmp6_spec) {
+            if (!icmp6_mask) {
+                icmp6_mask = &rte_flow_item_icmp6_mask;
+            }
+            DUMP_PATTERN_ITEM(icmp6_mask->type, false, "type",
+                              "%"PRIu8, icmp6_spec->type,
+                              icmp6_mask->type, 0);
+            DUMP_PATTERN_ITEM(icmp6_mask->code, false, "code",
+                              "%"PRIu8, icmp6_spec->code,
+                              icmp6_mask->code, 0);
+            DUMP_PATTERN_ITEM(icmp6_mask->checksum, false, "checksum",
+                          "%"PRIu8, icmp6_spec->checksum,
+                          icmp6_mask->checksum, 0);
+        }
+        ds_put_cstr(s, "/ ");
     } else if (item->type == RTE_FLOW_ITEM_TYPE_TCP) {
         const struct rte_flow_item_tcp *tcp_spec = item->spec;
         const struct rte_flow_item_tcp *tcp_mask = item->mask;
@@ -1608,6 +1628,7 @@  parse_flow_match(struct netdev *netdev,
 
     if (proto != IPPROTO_ICMP && proto != IPPROTO_UDP  &&
         proto != IPPROTO_SCTP && proto != IPPROTO_TCP  &&
+        proto != IPPROTO_ICMPV6 &&
         (match->wc.masks.tp_src ||
          match->wc.masks.tp_dst ||
          match->wc.masks.tcp_flags)) {
@@ -1684,6 +1705,22 @@  parse_flow_match(struct netdev *netdev,
         consumed_masks->tp_dst = 0;
 
         add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_ICMP, spec, mask, NULL);
+    } else if (proto == IPPROTO_ICMPV6) {
+        struct rte_flow_item_icmp6 *spec, *mask;
+
+        spec = xzalloc(sizeof *spec);
+        mask = xzalloc(sizeof *mask);
+
+        spec->type = (uint8_t) ntohs(match->flow.tp_src);
+        spec->code = (uint8_t) ntohs(match->flow.tp_dst);
+
+        mask->type = (uint8_t) ntohs(match->wc.masks.tp_src);
+        mask->code = (uint8_t) ntohs(match->wc.masks.tp_dst);
+
+        consumed_masks->tp_src = 0;
+        consumed_masks->tp_dst = 0;
+
+        add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_ICMP6, spec, mask, NULL);
     }
 
     add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_END, NULL, NULL, NULL);