[PATCH] usertools: add tool to generate balanced rss traffic flows

Burakov, Anatoly anatoly.burakov at intel.com
Thu May 18 15:33:03 CEST 2023


On 4/13/2023 9:30 PM, Robin Jarry wrote:
> From: 6WIND <grumly at 6wind.com>
> 
> usage: dpdk-rss-flows.py [-h] [-s SPORT_RANGE] [-d DPORT_RANGE] [-r]
>                           [-k RSS_KEY] [-t RETA_SIZE] [-j]
>                           RX_QUEUES SRC DST
> 
> Craft IP{v6}/{TCP/UDP} traffic flows that will evenly spread over a
> given number of RX queues according to the RSS algorithm.
> 
> positional arguments:
>    RX_QUEUES             The number of RX queues to fill.
>    SRC                   The source IP network/address.
>    DST                   The destination IP network/address.
> 
> options:
>    -h, --help            show this help message and exit
>    -s SPORT_RANGE, --sport-range SPORT_RANGE
>                          The layer 4 (TCP/UDP) source port range. Can
>                          be a single fixed value or a range
>                          <start>-<end>.
>    -d DPORT_RANGE, --dport-range DPORT_RANGE
>                          The layer 4 (TCP/UDP) destination port range.
>                          Can be a single fixed value or a range
>                          <start>-<end>.
>    -r, --check-reverse-traffic
>                          The reversed traffic (source <-> dest) should
>                          also be evenly balanced in the queues.
>    -k RSS_KEY, --rss-key RSS_KEY
>                          The random key byte-stream used to compute the
>                          RSS hash. This option supports either a
>                          supported driver name or the hex value of the
>                          key (default: intel).
>    -t RETA_SIZE, --reta-size RETA_SIZE
>                          Size of the redirection table or "RETA"
>                          (default: 128).
>    -j, --json            Output in parseable JSON format.
> 
> Examples:
> 
>    ~$ dpdk-rss-flows.py 8 28.0.0.0/24 40.0.0.0/24
>    SRC_IP      DST_IP       QUEUE
>    28.0.0.1    40.0.0.1     5
>    28.0.0.1    40.0.0.2     4
>    28.0.0.1    40.0.0.3     2
>    28.0.0.1    40.0.0.6     3
>    28.0.0.1    40.0.0.8     0
>    28.0.0.1    40.0.0.9     6
>    28.0.0.1    40.0.0.10    7
>    28.0.0.1    40.0.0.11    1
> 
>    ~$ dpdk-rss-flows.py 8 28.0.0.0/24 40.0.0.0/24 -r
>    SRC_IP      DST_IP       QUEUE    QUEUE_REVERSE
>    28.0.0.1    40.0.0.1     5        3
>    28.0.0.1    40.0.0.2     4        2
>    28.0.0.1    40.0.0.8     0        6
>    28.0.0.1    40.0.0.9     6        7
>    28.0.0.1    40.0.0.16    2        4
>    28.0.0.1    40.0.0.19    3        5
>    28.0.0.1    40.0.0.24    1        0
>    28.0.0.1    40.0.0.25    7        1
> 
>    ~$ dpdk-rss-flows.py 8 28.0.0.0/24 40.0.0.0/24 -s 32000-64000 -d 53
>    SRC_IP      SPORT    DST_IP      DPORT    QUEUE
>    28.0.0.1    32000    40.0.0.1    53       0
>    28.0.0.1    32001    40.0.0.1    53       1
>    28.0.0.1    32004    40.0.0.1    53       4
>    28.0.0.1    32005    40.0.0.1    53       5
>    28.0.0.1    32008    40.0.0.1    53       2
>    28.0.0.1    32009    40.0.0.1    53       3
>    28.0.0.1    32012    40.0.0.1    53       6
>    28.0.0.1    32013    40.0.0.1    53       7
> 
>    ~$ dpdk-rss-flows.py 4 2a01:cb00:f8b:9700::/64 2620:52:0:2592::/64 -rj
>    [
>      {
>        "queue": 0,
>        "queue_reverse": 3,
>        "src_ip": "2a01:cb00:f8b:9700::1",
>        "dst_ip": "2620:52:0:2592::1",
>        "src_port": 0,
>        "dst_port": 0
>      },
>      {
>        "queue": 3,
>        "queue_reverse": 0,
>        "src_ip": "2a01:cb00:f8b:9700::1",
>        "dst_ip": "2620:52:0:2592::2",
>        "src_port": 0,
>        "dst_port": 0
>      },
>      {
>        "queue": 2,
>        "queue_reverse": 1,
>        "src_ip": "2a01:cb00:f8b:9700::1",
>        "dst_ip": "2620:52:0:2592::3",
>        "src_port": 0,
>        "dst_port": 0
>      },
>      {
>        "queue": 1,
>        "queue_reverse": 2,
>        "src_ip": "2a01:cb00:f8b:9700::1",
>        "dst_ip": "2620:52:0:2592::1a",
>        "src_port": 0,
>        "dst_port": 0
>      }
>    ]
> 
> Cc: Olivier Matz <olivier.matz at 6wind.com>
> Cc: Jean-Mickael Guerin <jean-mickael.guerin at 6wind.com>
> Signed-off-by: Robin Jarry <rjarry at redhat.com>
> ---

I won't comment on the merits of inclusion of this into DPDK, but as far 
as code itself, this script makes me feel insecure about my Python 
skills! Can't really offer any constructive criticism, also learned a 
few new tricks.

So, for the code,

Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>

-- 
Thanks,
Anatoly



More information about the dev mailing list