Skip to content

Commit

Permalink
app/testpmd: add IP length field matching
Browse files Browse the repository at this point in the history
Added support of parsing IPv4 total length and IPv6 payload length
in the command line. The value of L3 length can be passed to the
rte_flow API for testing.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
  • Loading branch information
zorrohahaha authored and ferruhy committed Jul 6, 2023
1 parent d7d802d commit d55e47b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/test-pmd/cmdline_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ enum index {
ITEM_IPV4,
ITEM_IPV4_VER_IHL,
ITEM_IPV4_TOS,
ITEM_IPV4_LENGTH,
ITEM_IPV4_ID,
ITEM_IPV4_FRAGMENT_OFFSET,
ITEM_IPV4_TTL,
Expand All @@ -326,6 +327,7 @@ enum index {
ITEM_IPV6,
ITEM_IPV6_TC,
ITEM_IPV6_FLOW,
ITEM_IPV6_LEN,
ITEM_IPV6_PROTO,
ITEM_IPV6_HOP,
ITEM_IPV6_SRC,
Expand Down Expand Up @@ -1621,6 +1623,7 @@ static const enum index item_vlan[] = {
static const enum index item_ipv4[] = {
ITEM_IPV4_VER_IHL,
ITEM_IPV4_TOS,
ITEM_IPV4_LENGTH,
ITEM_IPV4_ID,
ITEM_IPV4_FRAGMENT_OFFSET,
ITEM_IPV4_TTL,
Expand All @@ -1634,6 +1637,7 @@ static const enum index item_ipv4[] = {
static const enum index item_ipv6[] = {
ITEM_IPV6_TC,
ITEM_IPV6_FLOW,
ITEM_IPV6_LEN,
ITEM_IPV6_PROTO,
ITEM_IPV6_HOP,
ITEM_IPV6_SRC,
Expand Down Expand Up @@ -4270,6 +4274,14 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
hdr.type_of_service)),
},
[ITEM_IPV4_LENGTH] = {
.name = "length",
.help = "total length",
.next = NEXT(item_ipv4, NEXT_ENTRY(COMMON_UNSIGNED),
item_param),
.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
hdr.total_length)),
},
[ITEM_IPV4_ID] = {
.name = "packet_id",
.help = "fragment packet id",
Expand Down Expand Up @@ -4343,6 +4355,14 @@ static const struct token token_list[] = {
hdr.vtc_flow,
"\x00\x0f\xff\xff")),
},
[ITEM_IPV6_LEN] = {
.name = "length",
.help = "payload length",
.next = NEXT(item_ipv6, NEXT_ENTRY(COMMON_UNSIGNED),
item_param),
.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
hdr.payload_len)),
},
[ITEM_IPV6_PROTO] = {
.name = "proto",
.help = "protocol (next header)",
Expand Down

0 comments on commit d55e47b

Please sign in to comment.