[2/2] usertools/rss: add --info flag

Message ID 20231023080710.240402-4-rjarry@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/2] usertools/rss: add driver abstractions |

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/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Robin Jarry Oct. 23, 2023, 8:07 a.m. UTC
  Add a flag to print the RSS key and RETA size that are used to compute
balanced traffic. Example:

 $ usertools/dpdk-rss-flows.py 4 1.0.0.0 2.2.0.0/24 -k mlx --info
 RSS key:     2cc681d15bdbf4f7fca28319db1a3e946b9e38d92c9c03d1ad9944a7d…
 RETA size:   4

 SRC_IP     DST_IP     QUEUE
 1.0.0.0    2.2.0.1    2
 1.0.0.0    2.2.0.2    0
 1.0.0.0    2.2.0.4    1
 1.0.0.0    2.2.0.6    3

The flag is only available with the default text output.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 usertools/dpdk-rss-flows.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Patch

diff --git a/usertools/dpdk-rss-flows.py b/usertools/dpdk-rss-flows.py
index dfdad33dde8a..cc5d4d22096f 100755
--- a/usertools/dpdk-rss-flows.py
+++ b/usertools/dpdk-rss-flows.py
@@ -351,6 +351,14 @@  def parse_args():
         Output in parseable JSON format.
         """,
     )
+    parser.add_argument(
+        "-i",
+        "--info",
+        action="store_true",
+        help="""
+        Print RETA size and RSS key above the results. Not available with --json.
+        """,
+    )
 
     args = parser.parse_args()
 
@@ -359,6 +367,9 @@  def parse_args():
             f"{args.ip_src} and {args.ip_dst} don't have the same protocol version"
         )
 
+    if args.json and args.info:
+        parser.error("--json and --info are mutually exclusive")
+
     if args.rss_key in DEFAULT_DRIVERS:
         driver_info = DEFAULT_DRIVERS[args.rss_key]
     else:
@@ -441,6 +452,11 @@  def main():
             cells.append(r)
         rows.append(tuple(cells))
 
+    if args.info:
+        print(f"RSS key:     {binascii.hexlify(args.rss_key).decode()}")
+        print(f"RETA size:   {args.reta_size}")
+        print()
+
     fmt = [f"%-{w}s" for w in widths]
     fmt[-1] = "%s"  # avoid trailing whitespace
     fmt = "    ".join(fmt)