All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Etelson <getelson@nvidia.com>
To: <dev@dpdk.org>
Cc: <getelson@nvidia.com>, <matan@nvidia.com>, <rasland@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Xiaoyun Li <xiaoyun.li@intel.com>
Subject: [dpdk-dev] [PATCH 3/3] app/testpmd: add flow item to match on IPv4 version_ihl field
Date: Wed, 30 Jun 2021 10:04:52 +0300	[thread overview]
Message-ID: <20210630070452.14055-4-getelson@nvidia.com> (raw)
In-Reply-To: <20210630070452.14055-1-getelson@nvidia.com>

The new flow item allows PMD to offload IPv4 IHL field for matching,
if hardware supports that operation.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 1c587bb7b8..c1c7b9a9f9 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -173,6 +173,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_VLAN_HAS_MORE_VLAN,
 	ITEM_IPV4,
+	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
@@ -1071,6 +1072,7 @@ static const enum index item_vlan[] = {
 };
 
 static const enum index item_ipv4[] = {
+	ITEM_IPV4_VER_IHL,
 	ITEM_IPV4_TOS,
 	ITEM_IPV4_ID,
 	ITEM_IPV4_FRAGMENT_OFFSET,
@@ -2567,6 +2569,13 @@ static const struct token token_list[] = {
 		.next = NEXT(item_ipv4),
 		.call = parse_vc,
 	},
+	[ITEM_IPV4_VER_IHL] = {
+		.name = "version_ihl",
+		.help = "match header length",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv4,
+				     hdr.version_ihl)),
+	},
 	[ITEM_IPV4_TOS] = {
 		.name = "tos",
 		.help = "type of service",
@@ -8123,7 +8132,8 @@ update_fields(uint8_t *buf, struct rte_flow_item *item, uint16_t next_proto)
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 		ipv4 = (struct rte_ipv4_hdr *)buf;
-		ipv4->version_ihl = 0x45;
+		if (!ipv4->version_ihl)
+			ipv4->version_ihl = RTE_IPV4_VHL_DEF;
 		if (next_proto && ipv4->next_proto_id == 0)
 			ipv4->next_proto_id = (uint8_t)next_proto;
 		break;
-- 
2.31.1


  parent reply	other threads:[~2021-06-30  7:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  7:04 [dpdk-dev] [PATCH 0/3] net/mlx5: add flow rule match for IPv4 IHL field Gregory Etelson
2021-06-30  7:04 ` [dpdk-dev] [PATCH 1/3] common/mlx5: query for hardware capability to offload " Gregory Etelson
2021-06-30  7:04 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add flow rule match for " Gregory Etelson
2021-06-30  7:04 ` Gregory Etelson [this message]
2021-07-05 11:40 ` [dpdk-dev] [PATCH v2 0/2] " Gregory Etelson
2021-07-05 11:40   ` [dpdk-dev] [PATCH v2 1/2] common/mlx5: query for hardware capability to offload " Gregory Etelson
2021-07-05 11:40   ` [dpdk-dev] [PATCH v2 2/2] net/mlx5: add flow rule match for " Gregory Etelson
2021-07-13 19:09   ` [dpdk-dev] [PATCH v2 0/2] " Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210630070452.14055-4-getelson@nvidia.com \
    --to=getelson@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=xiaoyun.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.