Skip to content

Commit

Permalink
netdev-offload-dpdk: Support ICMPv6 offload.
Browse files Browse the repository at this point in the history
Add support for offloading packet match on ICMPv6 header
using rte_flow API.

Signed-off-by: Allen Chen <allen.chen@jaguarmicro.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
  • Loading branch information
Allen Chen authored and kevintraynor committed Dec 12, 2024
1 parent b272282 commit 6f075ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Post-v3.4.0
formats.
- DPDK:
* OVS validated with DPDK 23.11.2.
* Add hardware offload support for matching ICMPv6 protocol
(experimental).
- Tunnels:
* LISP and STT tunnel port types are deprecated and will be removed in
the next release.
Expand Down
34 changes: 34 additions & 0 deletions lib/netdev-offload-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,23 @@ 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);
}
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;
Expand Down Expand Up @@ -1608,6 +1625,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)) {
Expand Down Expand Up @@ -1684,6 +1702,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);
Expand Down

0 comments on commit 6f075ae

Please sign in to comment.