net/mlx5: update RSS action handling
cover net/mlx5: update RSS action handling
This series includes 2 patches updating the RSS action handling. The first patch fixes an error in existing code.
The second patch implements additional functionality.
Dekel Peled (2):
net/mlx5: fix setting of Rx hash fields
net/mlx5: support RSS on SRC or DST fields only
doc/guides/nics/mlx5.rst | 2 + doc/guides/rel_notes/release_20_02.rst | 6 +++ drivers/net/mlx5/mlx5_defs.h | 7 ++- drivers/net/mlx5/mlx5_flow.c | 12 +++++ drivers/net/mlx5/mlx5_flow.h | 21 ++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 91 ++++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5_rxq.c | 29 ++++++++++- 7 files changed, 145 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 net/mlx5: fix setting of Rx hash fields
Rx hash fields were copied from input parameter into TIR attributes directly, with no translation. As result the copied value was wrong.
This patch adds translation of value from input bitmap to the appropriate format.
--- drivers/net/mlx5/mlx5_flow.h | 21 +++++++++++++++++++++ drivers/net/mlx5/mlx5_rxq.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.h +21 -0
@@ -288,6 +288,27 @@ enum mlx5_feature_name {/* IBV hash source bits for IPV6. */ #define MLX5_IPV6_IBV_RX_HASH (IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6) +/* IBV hash bits for L3 SRC. */ +#define MLX5_L3_SRC_IBV_RX_HASH (IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_SRC_IPV6) + +/* IBV hash bits for L3 DST. */ +#define MLX5_L3_DST_IBV_RX_HASH (IBV_RX_HASH_DST_IPV4 | IBV_RX_HASH_DST_IPV6) + +/* IBV hash bits for TCP. */ +#define MLX5_TCP_IBV_RX_HASH (IBV_RX_HASH_SRC_PORT_TCP | \ + IBV_RX_HASH_DST_PORT_TCP) + +/* IBV hash bits for UDP. */ +#define MLX5_UDP_IBV_RX_HASH (IBV_RX_HASH_SRC_PORT_UDP | \ + IBV_RX_HASH_DST_PORT_UDP) + +/* IBV hash bits for L4 SRC. */ +#define MLX5_L4_SRC_IBV_RX_HASH (IBV_RX_HASH_SRC_PORT_TCP | \ + IBV_RX_HASH_SRC_PORT_UDP) + +/* IBV hash bits for L4 DST. */ +#define MLX5_L4_DST_IBV_RX_HASH (IBV_RX_HASH_DST_PORT_TCP | \ + IBV_RX_HASH_DST_PORT_UDP)/* Geneve header first 16Bit */ #define MLX5_GENEVE_VER_MASK 0x3
drivers/net/mlx5/mlx5_rxq.c +27 -2
@@ -36,6 +36,7 @@#include "mlx5_autoconf.h" #include "mlx5_defs.h" #include "mlx5_glue.h" +#include "mlx5_flow.h" /* Default RSS hash key also used for ConnectX-3. */ uint8_t rss_hash_default_key[] = {
@@ -2452,6 +2453,7 @@ struct mlx5_hrxq * } }else {/* ind_tbl->type == MLX5_IND_TBL_TYPE_DEVX */ struct mlx5_devx_tir_attr tir_attr; +struct mlx5_rx_hash_field_select *rx_hash_field_select;uint32_t i;uint32_t lro =1 ;
@@ -2465,8 +2467,31 @@ struct mlx5_hrxq *memset (&tir_attr,0 ,sizeof (tir_attr)); tir_attr.disp_type =MLX5_TIRC_DISP_TYPE_INDIRECT ; tir_attr.rx_hash_fn =MLX5_RX_HASH_FN_TOEPLITZ ; -memcpy (&tir_attr.rx_hash_field_selector_outer, &hash_fields, -sizeof (uint64_t )); +#ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT + tir_attr.tunneled_offload_en = !!tunnel; +/* Translate hash_fields bitmap to PRM format. */ + rx_hash_field_select = hash_fields &IBV_RX_HASH_INNER ? + &tir_attr.rx_hash_field_selector_inner : + &tir_attr.rx_hash_field_selector_outer; +#else + rx_hash_field_select = &tir_attr.rx_hash_field_selector_outer; +#endif +/* 1 bit: 0: IPv4, 1: IPv6. */ + rx_hash_field_select->l3_prot_type = + !!(hash_fields &MLX5_IPV6_IBV_RX_HASH ); +/* 1 bit: 0: TCP, 1: UDP. */ + rx_hash_field_select->l4_prot_type = + !!(hash_fields &MLX5_UDP_IBV_RX_HASH ); +/* Bitmask which sets which fields to use in RX Hash. */ + rx_hash_field_select->selected_fields = + ((!!(hash_fields &MLX5_L3_SRC_IBV_RX_HASH )) << +MLX5_RX_HASH_FIELD_SELECT_SELECTED_FIELDS_SRC_IP ) | + (!!(hash_fields &MLX5_L3_DST_IBV_RX_HASH )) << +MLX5_RX_HASH_FIELD_SELECT_SELECTED_FIELDS_DST_IP | + (!!(hash_fields &MLX5_L4_SRC_IBV_RX_HASH )) << +MLX5_RX_HASH_FIELD_SELECT_SELECTED_FIELDS_L4_SPORT | + (!!(hash_fields &MLX5_L4_DST_IBV_RX_HASH )) << +MLX5_RX_HASH_FIELD_SELECT_SELECTED_FIELDS_L4_DPORT ;if (rxq_ctrl->obj->type ==MLX5_RXQ_OBJ_TYPE_DEVX_HAIRPIN ) tir_attr.transport_domain = priv->sh->td->id;else
Signature · 1 line
1.8.3.1
PATCH 2/2 net/mlx5: support RSS on SRC or DST fields only
In reply to Dekel PeledThis patch implements the feature described in RFC [1], adding support of RSS action on L3 and/or L4 source or destination only.
[1] http://mails.dpdk.org/archives/dev/2019-December/152796.html
--- doc/guides/nics/mlx5.rst | 2 + doc/guides/rel_notes/release_20_02.rst | 6 +++ drivers/net/mlx5/mlx5_defs.h | 7 ++- drivers/net/mlx5/mlx5_flow.c | 12 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 91 ++++++++++++++++++++++++++-------- 5 files changed, 97 insertions(+), 21 deletions(-)
doc/guides/nics/mlx5.rst +2 -0
@@ -64,6 +64,8 @@ Features - Multiple TX and RX queues. - Support for scattered TX and RX frames. - IPv4, IPv6, TCPv4, TCPv6, UDPv4 and UDPv6 RSS on any number of queues. +- RSS using different combinations of fields: L3 only, L4 only or both, + and source only, destination only or both. - Several RSS hash keys, one for each flow type. - Default RSS operation with no hash key specification. - Configurable RETA table.
doc/guides/rel_notes/release_20_02.rst +6 -0
@@ -56,6 +56,12 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Updated Mellanox mlx5 driver.** + + Updated Mellanox mlx5 driver with new features and improvements, including: + + * Added support for RSS using L3/L4 source/destination only. + Removed Items -------------
drivers/net/mlx5/mlx5_defs.h +6 -1
@@ -104,8 +104,13 @@/* Number of packets vectorized Rx can simultaneously process in a loop. */ #define MLX5_VPMD_DESCS_PER_LOOP 4 +/* Mask of RSS on source only or destination only. */ +#define MLX5_RSS_SRC_DST_ONLY (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY | \ + ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY) +/* Supported RSS */ -#define MLX5_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP)) +#define MLX5_RSS_HF_MASK (~(ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP | \ + MLX5_RSS_SRC_DST_ONLY))/* Timeout in seconds to get a valid link status. */ #define MLX5_LINK_STATUS_TIMEOUT 10
drivers/net/mlx5/mlx5_flow.c +12 -0
@@ -1150,6 +1150,18 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, &rss->types,"some RSS protocols are not" " supported"); +if ((rss->types & (ETH_RSS_L3_SRC_ONLY |ETH_RSS_L3_DST_ONLY )) && + !(rss->types Ð_RSS_IP )) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION_CONF ,NULL , +"L3 partial RSS requested but L3 RSS" +" type not specified" ); +if ((rss->types & (ETH_RSS_L4_SRC_ONLY |ETH_RSS_L4_DST_ONLY )) && + !(rss->types & (ETH_RSS_UDP |ETH_RSS_TCP ))) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ACTION_CONF ,NULL , +"L4 partial RSS requested but L4 RSS" +" type not specified" );if (!priv->rxqs_n) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF,
drivers/net/mlx5/mlx5_flow_dv.c +71 -20
127 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Hi,
Quoted 26 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Dekel Peled
Sent: Wednesday, December 18, 2019 12:06 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Shahaf Shuler <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 0/2] net/mlx5: update RSS action handlingThis series includes 2 patches updating the RSS action handling. The first patch fixes an error in existing code.
The second patch implements additional functionality.Dekel Peled (2):
net/mlx5: fix setting of Rx hash fields
net/mlx5: support RSS on SRC or DST fields onlydoc/guides/nics/mlx5.rst | 2 + doc/guides/rel_notes/release_20_02.rst | 6 +++ drivers/net/mlx5/mlx5_defs.h | 7 ++- drivers/net/mlx5/mlx5_flow.c | 12 +++++ drivers/net/mlx5/mlx5_flow.h | 21 ++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 91 ++++++++++++++++++++++++++-------- drivers/net/mlx5/mlx5_rxq.c | 29 ++++++++++- 7 files changed, 145 insertions(+), 23 deletions(-)
Quoted 2 lines
--
1.8.3.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh