add new PHY affinity support in MLX5 PMD
cover add new PHY affinity support in MLX5 PMD
This patch series implement PHY affinity item support in MLX5 PMD and the support for TIS creation with tx_phy_affinity value of Tx queue.
This patch series relies on the preceding ethdev API:
http://patches.dpdk.org/project/dpdk/patch/[email protected]/
Jiawei Wang (3):
drivers: add lag Rx port affinity in PRM
net/mlx5: add PHY affinity item support
drivers: enhance the Tx queue affinity
doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 8 ++- drivers/common/mlx5/mlx5_devx_cmds.c | 3 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 15 ++-- drivers/net/mlx5/linux/mlx5_os.c | 6 ++ drivers/net/mlx5/mlx5.c | 43 +++++------- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_devx.c | 24 ++++--- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_flow.h | 3 + drivers/net/mlx5/mlx5_flow_dv.c | 100 ++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++ drivers/net/mlx5/mlx5_tx.h | 1 + drivers/net/mlx5/mlx5_txq.c | 8 +++ 16 files changed, 184 insertions(+), 48 deletions(-)
Signature · 1 line
2.18.1
PATCH 1/3 drivers: add lag Rx port affinity in PRM
This patch adds function to query hca capability via Devx for lag_rx_port_affinity.
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 7 +++++-- drivers/net/mlx5/linux/mlx5_os.c | 4 ++++ drivers/net/mlx5/mlx5.h | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1141,6 +1141,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->outer_ipv4_ihl =MLX5_GET (flow_table_nic_cap, hcattr, ft_field_support_2_nic_receive.outer_ipv4_ihl); + attr->lag_rx_port_affinity =MLX5_GET + (flow_table_nic_cap, hcattr, + ft_field_support_2_nic_receive.lag_rx_port_affinity);/* Query HCA offloads for Ethernet protocol. */ hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc, MLX5_GET_HCA_CAP_OP_MOD_ETHERNET_OFFLOAD_CAPS |
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -288,6 +288,7 @@ struct mlx5_hca_attr { uint32_t alloc_flow_counter_pd:1; uint32_t flow_counter_access_aso:1; uint32_t flow_access_aso_opc_mod:8; + uint32_t lag_rx_port_affinity:1; };/* LAG Context. */
drivers/common/mlx5/mlx5_prm.h +5 -2
@@ -905,7 +905,8 @@ struct mlx5_ifc_fte_match_set_misc_bits {u8 vxlan_vni[0x18 ];u8 reserved_at_b8[0x8 ];u8 geneve_vni[0x18 ]; -u8 reserved_at_e4[0x6 ]; +u8 lag_rx_port_affinity[0x4 ]; +u8 reserved_at_e8[0x2 ];u8 geneve_tlv_option_0_exist[0x1 ];u8 geneve_oam[0x1 ];u8 reserved_at_e0[0xc ];
@@ -2044,7 +2045,9 @@ struct mlx5_ifc_ft_fields_support_bits {* Table 1872 - Flow Table Fields Supported 2 Format */ struct mlx5_ifc_ft_fields_support_2_bits { -u8 reserved_at_0[0xd ]; +u8 reserved_at_0[0xa ]; +u8 lag_rx_port_affinity[0x1 ]; +u8 reserved_at_c[0x2 ];u8 hash_result[0x1 ];u8 reserved_at_e[0x1 ];u8 tunnel_header_2_3[0x1 ];
drivers/net/mlx5/linux/mlx5_os.c +4 -0
@@ -1390,6 +1390,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(DEBUG, "DV flow is not supported!"); }#endif +if (hca_attr->lag_rx_port_affinity) { + sh->lag_rx_port_affinity_en =1 ; +DRV_LOG (DEBUG ,"LAG Rx Port Affinity enabled" ); + } }/* Process parameters and store port configuration on priv structure. */ err =mlx5_port_args_config (priv, mkvlist, &priv->config);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1374,6 +1374,8 @@ struct mlx5_dev_ctx_shared { uint32_t hws_tags:1; /* Check if tags info for HWS initialized. */ uint32_t shared_mark_enabled:1;/* If mark action is enabled on Rxqs (shared E-Switch domain). */ + uint32_t lag_rx_port_affinity_en:1; +/* lag_rx_port_affinity is supported. */ uint32_t hws_max_log_bulk_sz:5;/* Log of minimal HWS counters created hard coded. */ uint32_t hws_max_nb_counters;/* Maximal number for HWS counters. */
Signature · 1 line
2.18.1
PATCH 2/3 net/mlx5: add PHY affinity item support
In reply to Jiawei WangThis patch adds the new phy affinity item support in PMD:RTE_FLOW_ITEM_TYPE_PHY_AFFINITY.
This patch adds the validation function for the new item, it works for NIC-RX and FDB rule on ROOT-table only.
--- doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 8 ++- drivers/net/mlx5/linux/mlx5_os.c | 2 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 3 + drivers/net/mlx5/mlx5_flow_dv.c | 100 ++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++ 8 files changed, 127 insertions(+), 3 deletions(-)
doc/guides/nics/features/default.ini +1 -0
@@ -141,6 +141,7 @@ udp = vlan = vxlan = vxlan_gpe = +phy_affinity = [rte_flow actions] age =
doc/guides/nics/features/mlx5.ini +1 -0
@@ -87,6 +87,7 @@ vlan = Y vxlan = Y vxlan_gpe = Y represented_port = Y +phy_affinity = Y [rte_flow actions] age = I
doc/guides/nics/mlx5.rst +7 -1
@@ -106,6 +106,7 @@ Features - Sub-Function representors. - Sub-Function. - Matching on represented port. +- Matching on phy affinity. Limitations
@@ -595,13 +596,18 @@ Limitations - key - sequence - Matching on checksum and sequence needs MLNX_OFED 5.6+. +- Matching on checksum and sequence needs MLNX_OFED 5.6+. - The NIC egress flow rules on representor port are not supported. - When using DV/verbs flow engine (``dv_flow_en`` = 1/0 respectively), Match on SPI field in ESP header for group 0 needs MLNX_OFED 5.6+. +- Match on phy affinity: + + - Supports NIC ingress flow in group 0. + - Supports E-Switch flow in group 0 and depends on + device-managed flow steering (DMFS) mode. Statistics ----------
drivers/net/mlx5/linux/mlx5_os.c +2 -0
@@ -1394,6 +1394,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, sh->lag_rx_port_affinity_en =1 ;DRV_LOG (DEBUG ,"LAG Rx Port Affinity enabled" ); } + priv->num_lag_ports = hca_attr->num_lag_ports; +DRV_LOG (DEBUG ,"The number of lag ports is %d" , priv->num_lag_ports); }/* Process parameters and store port configuration on priv structure. */ err =mlx5_port_args_config (priv, mkvlist, &priv->config);
drivers/net/mlx5/mlx5.h +1 -0
@@ -1668,6 +1668,7 @@ struct mlx5_priv { unsigned int mtr_reg_share:1; /* Whether support meter REG_C share. */ unsigned int lb_used:1; /* Loopback queue is referred to. */ uint32_t mark_enabled:1; /* If mark action is enabled on rxqs. */ + uint32_t num_lag_ports:4; /* Number of ports can be bonded. */uint16_t domain_id;/* Switch domain identifier. */ uint16_t vport_id;/* Associated VF vport index (if any). */ uint32_t vport_meta_tag;/* Used for vport index match ove VF LAG. */
drivers/net/mlx5/mlx5_flow.h +3 -0
@@ -219,6 +219,9 @@ enum mlx5_feature_name {/* Meter color item */ #define MLX5_FLOW_ITEM_METER_COLOR (UINT64_C(1) << 44) +/* PHY affinity item */ +#define MLX5_FLOW_ITEM_PHY_AFFINITY (UINT64_C(1) << 49) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
drivers/net/mlx5/mlx5_flow_dv.c +98 -2
136 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +14 -0
@@ -4715,6 +4715,20 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, "Unsupported meter color register");break ; } +case RTE_FLOW_ITEM_TYPE_PHY_AFFINITY : + { +if (!priv->sh->lag_rx_port_affinity_en) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Unsupported phy affinity with Older FW" ); +if ((attr->transfer && priv->fdb_def_rule) || attr->egress) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Phy affinity item not supported" +" with egress or transfer" +" attribute" ); +break ; + }case RTE_FLOW_ITEM_TYPE_VOID :case RTE_FLOW_ITEM_TYPE_ETH :case RTE_FLOW_ITEM_TYPE_VLAN :
Signature · 1 line
2.18.1
PATCH 3/3 drivers: enhance the Tx queue affinity
In reply to Jiawei WangPrevious patch supports the tx phy affinity configuration in the Tx queue API, it supports to set the affinity value per Queue.
This patch updates TIS creation with tx_phy_affinity value of Tx queue, TIS index 1 goes to hardware port 0, TIS index 2 goes to hardware port 1, and TIS index 0 is reserved for default HWS hash mode.
--- drivers/common/mlx5/mlx5_prm.h | 8 ------- drivers/net/mlx5/mlx5.c | 43 +++++++++++++++------------------- drivers/net/mlx5/mlx5_devx.c | 24 ++++++++++--------- drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/mlx5/mlx5_tx.h | 1 + drivers/net/mlx5/mlx5_txq.c | 8 +++++++ 6 files changed, 42 insertions(+), 43 deletions(-)
drivers/common/mlx5/mlx5_prm.h +0 -8
@@ -2331,14 +2331,6 @@ struct mlx5_ifc_query_nic_vport_context_in_bits {u8 reserved_at_68[0x18 ]; }; -/* -* lag_tx_port_affinity: 0 auto-selection, 1 PF1, 2 PF2 vice versa. -* Each TIS binds to one PF by setting lag_tx_port_affinity (>0). -* Once LAG enabled, we create multiple TISs and bind each one to -* different PFs, then TIS[i] gets affinity i+1 and goes to PF i+1. -*/ -#define MLX5_IFC_LAG_MAP_TIS_AFFINITY (index, num) ((num) ? \ - (index) % (num) + 1 : 0)struct mlx5_ifc_tisc_bits {u8 strict_lag_tx_port_affinity[0x1 ];u8 reserved_at_1[0x3 ];
drivers/net/mlx5/mlx5.c +19 -24
63 lines not on this page · raw message
drivers/net/mlx5/mlx5_devx.c +13 -11
@@ -1190,17 +1190,19 @@ static uint32_t mlx5_get_txq_tis_num(struct rte_eth_dev *dev, uint16_t queue_idx) {struct mlx5_priv *priv = dev->data->dev_private; -int tis_idx; - -if (priv->sh->bond.n_port && priv->sh->lag.affinity_mode == -MLX5_LAG_MODE_TIS ) { - tis_idx = (priv->lag_affinity_idx + queue_idx) % - priv->sh->bond.n_port; -DRV_LOG (INFO ,"port %d txq %d gets affinity %d and maps to PF %d." , - dev->data->port_id, queue_idx, tis_idx +1 , - priv->sh->lag.tx_remap_affinity[tis_idx]); - }else { - tis_idx =0 ; +struct mlx5_txq_data *txq_data = (*priv->txqs)[queue_idx]; +int tis_idx =0 ; + +if (priv->sh->bond.n_port) { +if (txq_data->tx_phy_affinity) { + tis_idx = txq_data->tx_phy_affinity; + }else if (priv->sh->lag.affinity_mode ==MLX5_LAG_MODE_TIS ) { + tis_idx = (priv->lag_affinity_idx + queue_idx) % + priv->sh->bond.n_port +1 ; +DRV_LOG (INFO ,"port %d txq %d gets affinity %d and maps to PF %d." , + dev->data->port_id, queue_idx, tis_idx, + priv->sh->lag.tx_remap_affinity[tis_idx -1 ]); + } }MLX5_ASSERT (priv->sh->tis[tis_idx]);return priv->sh->tis[tis_idx]->id;
drivers/net/mlx5/mlx5_ethdev.c +1 -0
@@ -352,6 +352,7 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->switch_info.domain_id = priv->domain_id; info->switch_info.port_id = priv->representor_id; info->switch_info.rx_domain =0 ;/* No sub Rx domains. */ + info->nb_phy_ports = priv->sh->bond.n_port;if (priv->representor) {uint16_t port_id;
drivers/net/mlx5/mlx5_tx.h +1 -0
@@ -144,6 +144,7 @@ struct mlx5_txq_data {uint16_t inlen_send;/* Ordinary send data inline size. */ uint16_t inlen_empw;/* eMPW max packet size to inline. */ uint16_t inlen_mode;/* Minimal data length to inline. */ +uint8_t tx_phy_affinity;/* TxQ affinity configuration. */ uint32_t qp_num_8s;/* QP number shifted by 8. */ uint64_t offloads;/* Offloads for Tx Queue. */ struct mlx5_mr_ctrl mr_ctrl;/* MR control descriptor. */
drivers/net/mlx5/mlx5_txq.c +8 -0
@@ -392,6 +392,13 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, container_of(txq, struct mlx5_txq_ctrl, txq);int res; +if (conf->tx_phy_affinity > priv->num_lag_ports) { + rte_errno =EINVAL ; +DRV_LOG (ERR ,"port %u unable to setup Tx queue index %u" +" affinity is %u exceeds the maximum %u" , dev->data->port_id, + idx, conf->tx_phy_affinity, priv->num_lag_ports); +return -rte_errno; + } res =mlx5_tx_queue_pre_setup (dev, idx, &desc);if (res)return res;
@@ -1095,6 +1102,7 @@ mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, tmpl->txq.elts_m = desc -1 ; tmpl->txq.port_id = dev->data->port_id; tmpl->txq.idx = idx; + tmpl->txq.tx_phy_affinity = conf->tx_phy_affinity;txq_set_params (tmpl);if (txq_adjust_params (tmpl)) goto error;
Signature · 1 line
2.18.1
v2 cover Add Tx queue mapping of aggregated ports in MLX5 PMD
In reply to Jiawei WangThis patch implements RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY support in MLX5 PMD.
This patch adds the MLX5 PMD support for two device ops:
- map_aggr_tx_affinity
- count_aggr_ports
This patch series relies on the preceding RTE API:
http://patches.dpdk.org/project/dpdk/list/?series=27064
v2:
* update the PMD code based on the new RTE API.
Jiawei Wang (3):
net/mlx5: add lag Rx port affinity in PRM
net/mlx5: add aggregated affinity item support
net/mlx5: enhance the Tx queue affinity
doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 6 ++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 15 ++-- drivers/net/mlx5/linux/mlx5_os.c | 6 ++ drivers/net/mlx5/mlx5.c | 49 ++++++------- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_devx.c | 24 ++++--- drivers/net/mlx5/mlx5_flow.h | 3 + drivers/net/mlx5/mlx5_flow_dv.c | 100 ++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++ drivers/net/mlx5/mlx5_tx.h | 4 ++ drivers/net/mlx5/mlx5_txq.c | 38 ++++++++++ 15 files changed, 221 insertions(+), 47 deletions(-)
Signature · 1 line
2.18.1
PATCH v2 1/3 net/mlx5: add lag Rx port affinity in PRM
This patch adds function to query hca capability via Devx for lag_rx_port_affinity.
--- drivers/common/mlx5/mlx5_devx_cmds.c | 3 +++ drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 7 +++++-- drivers/net/mlx5/linux/mlx5_os.c | 4 ++++ drivers/net/mlx5/mlx5.h | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_devx_cmds.c +3 -0
@@ -1163,6 +1163,9 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->outer_ipv4_ihl =MLX5_GET (flow_table_nic_cap, hcattr, ft_field_support_2_nic_receive.outer_ipv4_ihl); + attr->lag_rx_port_affinity =MLX5_GET + (flow_table_nic_cap, hcattr, + ft_field_support_2_nic_receive.lag_rx_port_affinity);/* Query HCA offloads for Ethernet protocol. */ hcattr = mlx5_devx_get_hca_cap(ctx, in, out, &rc, MLX5_GET_HCA_CAP_OP_MOD_ETHERNET_OFFLOAD_CAPS |
drivers/common/mlx5/mlx5_devx_cmds.h +1 -0
@@ -293,6 +293,7 @@ struct mlx5_hca_attr { uint32_t flow_counter_access_aso:1; uint32_t flow_access_aso_opc_mod:8; uint32_t cross_vhca:1; + uint32_t lag_rx_port_affinity:1; };/* LAG Context. */
drivers/common/mlx5/mlx5_prm.h +5 -2
@@ -906,7 +906,8 @@ struct mlx5_ifc_fte_match_set_misc_bits {u8 vxlan_vni[0x18 ];u8 reserved_at_b8[0x8 ];u8 geneve_vni[0x18 ]; -u8 reserved_at_e4[0x6 ]; +u8 lag_rx_port_affinity[0x4 ]; +u8 reserved_at_e8[0x2 ];u8 geneve_tlv_option_0_exist[0x1 ];u8 geneve_oam[0x1 ];u8 reserved_at_e0[0xc ];
@@ -2069,7 +2070,9 @@ struct mlx5_ifc_ft_fields_support_bits {* Table 1872 - Flow Table Fields Supported 2 Format */ struct mlx5_ifc_ft_fields_support_2_bits { -u8 reserved_at_0[0xd ]; +u8 reserved_at_0[0xa ]; +u8 lag_rx_port_affinity[0x1 ]; +u8 reserved_at_c[0x2 ];u8 hash_result[0x1 ];u8 reserved_at_e[0x1 ];u8 tunnel_header_2_3[0x1 ];
drivers/net/mlx5/linux/mlx5_os.c +4 -0
@@ -1390,6 +1390,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, DRV_LOG(DEBUG, "DV flow is not supported!"); }#endif +if (hca_attr->lag_rx_port_affinity) { + sh->lag_rx_port_affinity_en =1 ; +DRV_LOG (DEBUG ,"LAG Rx Port Affinity enabled" ); + } }/* Process parameters and store port configuration on priv structure. */ err =mlx5_port_args_config (priv, mkvlist, &priv->config);
drivers/net/mlx5/mlx5.h +2 -0
@@ -1386,6 +1386,8 @@ struct mlx5_dev_ctx_shared { uint32_t hws_tags:1; /* Check if tags info for HWS initialized. */ uint32_t shared_mark_enabled:1;/* If mark action is enabled on Rxqs (shared E-Switch domain). */ + uint32_t lag_rx_port_affinity_en:1; +/* lag_rx_port_affinity is supported. */ uint32_t hws_max_log_bulk_sz:5;/* Log of minimal HWS counters created hard coded. */ uint32_t hws_max_nb_counters;/* Maximal number for HWS counters. */
Signature · 1 line
2.18.1
PATCH v2 2/3 net/mlx5: add aggregated affinity item support
In reply to Jiawei WangThis patch adds the new aggregated affinity item support in PMD:RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY.
This patch adds the validation function for the new item, it works for NIC-RX and FDB rule on ROOT-table only.
--- doc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 6 ++ drivers/net/mlx5/linux/mlx5_os.c | 2 + drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_flow.h | 3 + drivers/net/mlx5/mlx5_flow_dv.c | 100 ++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++ 8 files changed, 126 insertions(+), 2 deletions(-)
doc/guides/nics/features/default.ini +1 -0
@@ -145,6 +145,7 @@ udp = vlan = vxlan = vxlan_gpe = +aggr_affinity = [rte_flow actions] age =
doc/guides/nics/features/mlx5.ini +1 -0
@@ -90,6 +90,7 @@ vlan = Y vxlan = Y vxlan_gpe = Y represented_port = Y +aggr_affinity = Y [rte_flow actions] age = I
doc/guides/nics/mlx5.rst +6 -0
@@ -107,6 +107,7 @@ Features - Sub-Function representors. - Sub-Function. - Matching on represented port. +- Matching on aggregated affinity. Limitations
@@ -615,6 +616,11 @@ Limitations - The NIC egress flow rules on representor port are not supported. +- Match on aggregated affinity: + + - Supports NIC ingress flow in group 0. + - Supports E-Switch flow in group 0 and depends on + device-managed flow steering (DMFS) mode. Statistics ----------
drivers/net/mlx5/linux/mlx5_os.c +2 -0
@@ -1394,6 +1394,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, sh->lag_rx_port_affinity_en =1 ;DRV_LOG (DEBUG ,"LAG Rx Port Affinity enabled" ); } + priv->num_lag_ports = hca_attr->num_lag_ports; +DRV_LOG (DEBUG ,"The number of lag ports is %d" , priv->num_lag_ports); }/* Process parameters and store port configuration on priv structure. */ err =mlx5_port_args_config (priv, mkvlist, &priv->config);
drivers/net/mlx5/mlx5.h +1 -0
@@ -1681,6 +1681,7 @@ struct mlx5_priv { unsigned int mtr_reg_share:1; /* Whether support meter REG_C share. */ unsigned int lb_used:1; /* Loopback queue is referred to. */ uint32_t mark_enabled:1; /* If mark action is enabled on rxqs. */ + uint32_t num_lag_ports:4; /* Number of ports can be bonded. */uint16_t domain_id;/* Switch domain identifier. */ uint16_t vport_id;/* Associated VF vport index (if any). */ uint32_t vport_meta_tag;/* Used for vport index match ove VF LAG. */
drivers/net/mlx5/mlx5_flow.h +3 -0
@@ -223,6 +223,9 @@ enum mlx5_feature_name {#define MLX5_FLOW_ITEM_OUTER_IPV6_ROUTING_EXT (UINT64_C(1) << 45)#define MLX5_FLOW_ITEM_INNER_IPV6_ROUTING_EXT (UINT64_C(1) << 46) +/* Aggregated affinity item */ +#define MLX5_FLOW_ITEM_AGGR_AFFINITY (UINT64_C(1) << 49) +/* Outer Masks. */ #define MLX5_FLOW_LAYER_OUTER_L3 \ (MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
drivers/net/mlx5/mlx5_flow_dv.c +98 -2
136 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +14 -0
@@ -4723,6 +4723,20 @@ flow_hw_pattern_validate(struct rte_eth_dev *dev, "Unsupported meter color register");break ; } +case RTE_FLOW_ITEM_TYPE_AGGR_AFFINITY : + { +if (!priv->sh->lag_rx_port_affinity_en) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Unsupported aggregated affinity with Older FW" ); +if ((attr->transfer && priv->fdb_def_rule) || attr->egress) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM ,NULL , +"Aggregated affinity item not supported" +" with egress or transfer" +" attribute" ); +break ; + }case RTE_FLOW_ITEM_TYPE_VOID :case RTE_FLOW_ITEM_TYPE_ETH :case RTE_FLOW_ITEM_TYPE_VLAN :
Signature · 1 line
2.18.1
PATCH v2 3/3 net/mlx5: enhance the Tx queue affinity
In reply to Jiawei WangThe rte_eth_dev_map_aggr_tx_affinity() was introduced in ethdev lib, it was used to set the affinity value per Tx queue.
This patch adds the MLX5 PMD support for two device ops:
- map_aggr_tx_affinity
- count_aggr_ports
After maps a Tx queue with an aggregated port by call map_aggr_tx_affinity() and starts sending traffic, the MLX5 PMD updates TIS creation with tx_aggr_affinity value of Tx queue. TIS index 1 goes to first physical port, TIS index 2 goes to second physical port, and so on, TIS index 0 is reserved for default HW hash mode.
--- drivers/common/mlx5/mlx5_prm.h | 8 ------ drivers/net/mlx5/mlx5.c | 49 +++++++++++++++++----------------- drivers/net/mlx5/mlx5_devx.c | 24 +++++++++-------- drivers/net/mlx5/mlx5_tx.h | 4 +++ drivers/net/mlx5/mlx5_txq.c | 38 ++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 43 deletions(-)
drivers/common/mlx5/mlx5_prm.h +0 -8
@@ -2363,14 +2363,6 @@ struct mlx5_ifc_query_nic_vport_context_in_bits {u8 reserved_at_68[0x18 ]; }; -/* -* lag_tx_port_affinity: 0 auto-selection, 1 PF1, 2 PF2 vice versa. -* Each TIS binds to one PF by setting lag_tx_port_affinity (>0). -* Once LAG enabled, we create multiple TISs and bind each one to -* different PFs, then TIS[i] gets affinity i+1 and goes to PF i+1. -*/ -#define MLX5_IFC_LAG_MAP_TIS_AFFINITY (index, num) ((num) ? \ - (index) % (num) + 1 : 0)struct mlx5_ifc_tisc_bits {u8 strict_lag_tx_port_affinity[0x1 ];u8 reserved_at_1[0x3 ];
drivers/net/mlx5/mlx5.c +25 -24
87 lines not on this page · raw message
drivers/net/mlx5/mlx5_devx.c +13 -11
@@ -1190,17 +1190,19 @@ static uint32_t mlx5_get_txq_tis_num(struct rte_eth_dev *dev, uint16_t queue_idx) {struct mlx5_priv *priv = dev->data->dev_private; -int tis_idx; - -if (priv->sh->bond.n_port && priv->sh->lag.affinity_mode == -MLX5_LAG_MODE_TIS ) { - tis_idx = (priv->lag_affinity_idx + queue_idx) % - priv->sh->bond.n_port; -DRV_LOG (INFO ,"port %d txq %d gets affinity %d and maps to PF %d." , - dev->data->port_id, queue_idx, tis_idx +1 , - priv->sh->lag.tx_remap_affinity[tis_idx]); - }else { - tis_idx =0 ; +struct mlx5_txq_data *txq_data = (*priv->txqs)[queue_idx]; +int tis_idx =0 ; + +if (priv->sh->bond.n_port) { +if (txq_data->tx_aggr_affinity) { + tis_idx = txq_data->tx_aggr_affinity; + }else if (priv->sh->lag.affinity_mode ==MLX5_LAG_MODE_TIS ) { + tis_idx = (priv->lag_affinity_idx + queue_idx) % + priv->sh->bond.n_port +1 ; +DRV_LOG (INFO ,"port %d txq %d gets affinity %d and maps to PF %d." , + dev->data->port_id, queue_idx, tis_idx, + priv->sh->lag.tx_remap_affinity[tis_idx -1 ]); + } }MLX5_ASSERT (priv->sh->tis[tis_idx]);return priv->sh->tis[tis_idx]->id;
drivers/net/mlx5/mlx5_tx.h +4 -0
@@ -144,6 +144,7 @@ struct mlx5_txq_data {uint16_t inlen_send;/* Ordinary send data inline size. */ uint16_t inlen_empw;/* eMPW max packet size to inline. */ uint16_t inlen_mode;/* Minimal data length to inline. */ +uint8_t tx_aggr_affinity;/* TxQ affinity configuration. */ uint32_t qp_num_8s;/* QP number shifted by 8. */ uint64_t offloads;/* Offloads for Tx Queue. */ struct mlx5_mr_ctrl mr_ctrl;/* MR control descriptor. */
@@ -218,6 +219,9 @@ void txq_alloc_elts(struct mlx5_txq_ctrl *txq_ctrl);void txq_free_elts (struct mlx5_txq_ctrl *txq_ctrl);uint64_t mlx5_get_tx_port_offloads (struct rte_eth_dev *dev);void mlx5_txq_dynf_timestamp_set (struct rte_eth_dev *dev); +int mlx5_count_aggr_ports (struct rte_eth_dev *dev); +int mlx5_map_aggr_tx_affinity (struct rte_eth_dev *dev,uint16_t tx_queue_id, +uint8_t affinity);/* mlx5_tx.c */
drivers/net/mlx5/mlx5_txq.c +38 -0
@@ -1365,3 +1365,41 @@ mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev) ts_mask :0 ; } } + +int mlx5_count_aggr_ports (struct rte_eth_dev *dev) +{ +struct mlx5_priv *priv = dev->data->dev_private; + +return priv->sh->bond.n_port; +} + +int mlx5_map_aggr_tx_affinity (struct rte_eth_dev *dev,uint16_t tx_queue_id, +uint8_t affinity) +{ +struct mlx5_txq_ctrl *txq_ctrl; +struct mlx5_txq_data *txq; +struct mlx5_priv *priv; + + priv = dev->data->dev_private; + txq = (*priv->txqs)[tx_queue_id]; +if (!txq) +return -1 ; + txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq); +if (tx_queue_id >= priv->txqs_n) { +DRV_LOG (ERR ,"port %u Tx queue index out of range (%u >= %u)" , + dev->data->port_id, tx_queue_id, priv->txqs_n); + rte_errno =EOVERFLOW ; +return -rte_errno; + } +if (affinity > priv->num_lag_ports) { +DRV_LOG (ERR ,"port %u unable to setup Tx queue index %u" +" affinity is %u exceeds the maximum %u" , dev->data->port_id, + tx_queue_id, affinity, priv->num_lag_ports); + rte_errno =EINVAL ; +return -rte_errno; + } +DRV_LOG (DEBUG ,"port %u configuring queue %u for aggregated affinity %u" , + dev->data->port_id, tx_queue_id, affinity); + txq_ctrl->txq.tx_aggr_affinity = affinity; +return 0 ; +}
Signature · 1 line
2.18.1
RE: [PATCH v2 0/3] Add Tx queue mapping of aggregated ports in MLX5 PMD
In reply to Jiawei WangHi,
Quoted 44 lines
-----Original Message-----
From: Jiawei(Jonny) Wang <[email protected]>
Sent: Wednesday, February 22, 2023 2:26 PM
To: Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH v2 0/3] Add Tx queue mapping of aggregated ports in MLX5 PMDThis patch implements
RTE_FLOW_ITEM_TYPE_AGGR_AFFINITYsupport in MLX5 PMD.This patch adds the MLX5 PMD support for two device ops:
-map_aggr_tx_affinity
-count_aggr_portsThis patch series relies on the preceding RTE API:
http://patches.dpdk.org/project/dpdk/list/?series=27064v2:
* update the PMD code based on the new RTE API.Jiawei Wang (3):
net/mlx5: add lag Rx port affinity in PRM
net/mlx5: add aggregated affinity item support
net/mlx5: enhance the Tx queue affinitydoc/guides/nics/features/default.ini | 1 + doc/guides/nics/features/mlx5.ini | 1 + doc/guides/nics/mlx5.rst | 6 ++ drivers/common/mlx5/mlx5_devx_cmds.c | 3 + drivers/common/mlx5/mlx5_devx_cmds.h | 1 + drivers/common/mlx5/mlx5_prm.h | 15 ++-- drivers/net/mlx5/linux/mlx5_os.c | 6 ++ drivers/net/mlx5/mlx5.c | 49 ++++++------- drivers/net/mlx5/mlx5.h | 3 + drivers/net/mlx5/mlx5_devx.c | 24 ++++--- drivers/net/mlx5/mlx5_flow.h | 3 + drivers/net/mlx5/mlx5_flow_dv.c | 100 ++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++ drivers/net/mlx5/mlx5_tx.h | 4 ++ drivers/net/mlx5/mlx5_txq.c | 38 ++++++++++ 15 files changed, 221 insertions(+), 47 deletions(-)
Quoted 2 lines
--
2.18.1
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh