[v3,1/1] usertools/rss: add CNXK RSS key

Message ID 20231018072949.69094-1-skori@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v3,1/1] usertools/rss: add CNXK RSS key |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Sunil Kumar Kori Oct. 18, 2023, 7:29 a.m. UTC
  From: Sunil Kumar Kori <skori@marvell.com>

This patch adds RSS key for CNXK platforms. CNXK platform uses
48 bytes long key for hash calculations.

For the same patch also updates help mesaages to provide range
information for supporting NICs/platforms.

Also CNXK uses reta size as 64 so to get correct offset to retrieve
queue index, user must pass reta_size option as 64 i.e. -t 64.

Examples:
$ ./dpdk-rss-flows.py -k cnxk 8 28.0.0.0/24 40.0.0.0/24 -t 64
SRC_IP      DST_IP       QUEUE
28.0.0.1    40.0.0.1     7
28.0.0.1    40.0.0.2     2
28.0.0.1    40.0.0.3     4
28.0.0.1    40.0.0.7     1
28.0.0.1    40.0.0.8     3
28.0.0.1    40.0.0.9     5
28.0.0.1    40.0.0.10    0
28.0.0.1    40.0.0.11    6

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
v2..v3:
 - Fix key size range check.
 - Fix default key size file name.

v1..v2:
 - Fix checkpatch errors.

 usertools/dpdk-rss-flows.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
  

Patch

diff --git a/usertools/dpdk-rss-flows.py b/usertools/dpdk-rss-flows.py
index 73821eb471..937f9e1927 100755
--- a/usertools/dpdk-rss-flows.py
+++ b/usertools/dpdk-rss-flows.py
@@ -188,11 +188,24 @@  def balanced_traffic(
         0x81, 0x15, 0x03, 0x66,
     )
 )
+# default_key, see drivers/common/cnxk/roc_nix_rss.c
+# Marvell's cnxk NICs take 48 bytes keys
+RSS_KEY_CNXK = bytes(
+    (
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+        0xfe, 0xed, 0x0b, 0xad, 0xfe, 0xed, 0x0b, 0xad,
+    )
+)
 # fmt: on
 DEFAULT_DRIVER_KEYS = {
     "intel": RSS_KEY_INTEL,
     "mlx": RSS_KEY_MLX,
     "i40e": RSS_KEY_I40E,
+    "cnxk": RSS_KEY_CNXK,
 }
 
 
@@ -201,8 +214,8 @@  def rss_key(value):
         return DEFAULT_DRIVER_KEYS[value]
     try:
         key = binascii.unhexlify(value)
-        if len(key) not in (40, 52):
-            raise argparse.ArgumentTypeError("The key must be 40 or 52 bytes long")
+        if len(key) not in range(40, 52):
+            raise argparse.ArgumentTypeError("The key must be 40 to 52 bytes long")
         return key
     except (TypeError, ValueError) as e:
         raise argparse.ArgumentTypeError(str(e)) from e
@@ -299,7 +312,7 @@  def parse_args():
         default=RSS_KEY_INTEL,
         type=rss_key,
         help="""
-        The random 40-bytes key used to compute the RSS hash. This option
+        The random 40 to 52 bytes key used to compute the RSS hash. This option
         supports either a well-known name or the hex value of the key
         (well-known names: "intel", "mlx", default: "intel").
         """,