DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	<andrew.rybchenko@oktetlabs.ru>, <orika@nvidia.com>
Subject: [PATCH 2/4] ethdev: add template table hash calculation function
Date: Sat, 21 Jan 2023 07:21:56 +0200	[thread overview]
Message-ID: <20230121052158.2928238-3-akozyrev@nvidia.com> (raw)
In-Reply-To: <20230121052158.2928238-1-akozyrev@nvidia.com>

Allow user to specify hash calculation function used in template tables.
The hash calculation type is responsible for the calculation of the flow
rule index a packet would hit upon arrival at the table.

Control over this is useful for applications with custom RSS algorithms,
for example. An application can select various packet fields to serve as
a hash calculation source and jump to the appropriate flow rule location.
The RSS hash result will be used as the index in the table. For the linear
hash function, the mapping is one-to-one and the hash result is the index.
For other hash functions, the index is the hash result module table size.
The RSS hash result can be retrieved via modify_field API: HASH_RESULT.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 doc/guides/rel_notes/release_23_03.rst |  4 ++++
 lib/ethdev/rte_flow.h                  | 30 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst
index 13dd368f2e..0535205c8b 100644
--- a/doc/guides/rel_notes/release_23_03.rst
+++ b/doc/guides/rel_notes/release_23_03.rst
@@ -63,6 +63,10 @@ New Features
   Introduced new function ``rte_flow_async_create_by_index()``
   to insert rules by index into index-based template tables.
 
+* **Added index-based rules insertion in flow API.**
+  Added hash calculation function used in template tables
+  to allow control over the calculation of the rule index for a packet.
+
 Removed Items
 -------------
 
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 88d0c6a724..0c793bce8a 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3528,6 +3528,7 @@ enum rte_flow_field_id {
 	RTE_FLOW_FIELD_IPV6_ECN,	/**< IPv6 ECN. */
 	RTE_FLOW_FIELD_GTP_PSC_QFI,	/**< GTP QFI. */
 	RTE_FLOW_FIELD_METER_COLOR,	/**< Meter color marker. */
+	RTE_FLOW_FIELD_HASH_RESULT,	/**< Hash result. */
 };
 
 /**
@@ -5204,6 +5205,31 @@ enum rte_flow_table_insertion_type {
 	RTE_FLOW_TABLE_INSERTION_TYPE_INDEX,
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Template table hash index calculation function.
+ */
+enum rte_flow_table_hash_func {
+	/**
+	 * Default hash calculation.
+	 */
+	RTE_FLOW_TABLE_HASH_FUNC_DEFAULT,
+	/**
+	 * Linear hash calculation.
+	 */
+	RTE_FLOW_TABLE_HASH_FUNC_LINEAR,
+	/**
+	 * 32-bit checksum hash calculation.
+	 */
+	RTE_FLOW_TABLE_HASH_FUNC_CRC32,
+	/**
+	 * 16-bit checksum hash calculation.
+	 */
+	RTE_FLOW_TABLE_HASH_FUNC_CRC16,
+};
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
@@ -5223,6 +5249,10 @@ struct rte_flow_template_table_attr {
 	 * Insertion type for flow rules.
 	 */
 	enum rte_flow_table_insertion_type insertion_type;
+	/**
+	 * Hash calculation function for the packet matching.
+	 */
+	enum rte_flow_table_hash_func hash_func;
 };
 
 /**
-- 
2.18.2


  parent reply	other threads:[~2023-01-21  5:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  2:21 [RFC] ethdev: add template table insertion and matching types Alexander Kozyrev
2023-01-08 14:22 ` Ori Kam
2023-01-18  8:50 ` Thomas Monjalon
2023-01-20 23:06   ` Alexander Kozyrev
2023-01-22 20:55     ` Thomas Monjalon
2023-01-23 22:02       ` Alexander Kozyrev
2023-01-30 14:47         ` Thomas Monjalon
2023-01-21  5:21 ` [PATCH 0/4] " Alexander Kozyrev
2023-01-21  5:21   ` [PATCH 1/4] ethdev: add template table insertion type Alexander Kozyrev
2023-01-21  5:21   ` Alexander Kozyrev [this message]
2023-01-21  5:21   ` [PATCH 3/4] app/testpmd: " Alexander Kozyrev
2023-01-21  5:21   ` [PATCH 4/4] app/testpmd: add template table hash calculation function Alexander Kozyrev
2023-01-26 23:27   ` [PATCH v2 0/4] ethdev: add template table insertion and matching types Alexander Kozyrev
2023-01-26 23:27     ` [PATCH v2 1/4] ethdev: add template table insertion type Alexander Kozyrev
2023-02-02 10:57       ` Andrew Rybchenko
2023-02-07 15:06         ` Alexander Kozyrev
2023-01-26 23:28     ` [PATCH v2 2/4] ethdev: add template table hash calculation function Alexander Kozyrev
2023-01-26 23:28     ` [PATCH v2 3/4] app/testpmd: add template table insertion type Alexander Kozyrev
2023-01-26 23:28     ` [PATCH v2 4/4] app/testpmd: add template table hash calculation function Alexander Kozyrev
2023-02-01 16:09     ` [PATCH v2 0/4] ethdev: add template table insertion and matching types Ori Kam
2023-02-08  2:47     ` [PATCH v3 " Alexander Kozyrev
2023-02-08  2:47       ` [PATCH v3 1/4] ethdev: add template table insertion type Alexander Kozyrev
2023-02-08  2:47       ` [PATCH v3 2/4] ethdev: add template table hash calculation function Alexander Kozyrev
2023-02-08  2:47       ` [PATCH v3 3/4] app/testpmd: add template table insertion type Alexander Kozyrev
2023-02-08  2:47       ` [PATCH v3 4/4] app/testpmd: add template table hash calculation function Alexander Kozyrev
2023-02-08  3:06       ` [PATCH v4 0/4] ethdev: add template table insertion and matching types Alexander Kozyrev
2023-02-08  3:06         ` [PATCH v4 1/4] ethdev: add template table insertion type Alexander Kozyrev
2023-02-08  3:06         ` [PATCH v4 2/4] ethdev: add template table hash calculation function Alexander Kozyrev
2023-02-08  3:06         ` [PATCH v4 3/4] app/testpmd: add template table insertion type Alexander Kozyrev
2023-02-08  3:06         ` [PATCH v4 4/4] app/testpmd: add template table hash calculation function Alexander Kozyrev
2023-02-10 17:42         ` [PATCH v4 0/4] ethdev: add template table insertion and matching types Ferruh Yigit

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=20230121052158.2928238-3-akozyrev@nvidia.com \
    --to=akozyrev@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=orika@nvidia.com \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).