mlx5 fixes 2024-09-09
Subsystems (5)
From: Saeed Mahameed <[email protected]>
This series provides bug fixes to mlx5 driver. Please pull and let me know if there is any problem.
Thanks,
Saeed.
The following changes since commit b3c9e65eb227269ed72a115ba22f4f51b4e62b4d:
net: hsr: remove seqnr_lock (2024-09-09 10:25:01 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2024-09-09
for you to fetch changes up to b1d305abef4640af1b4f1b4774d513cd81b10cfc:
net/mlx5: Fix bridge mode operations when there are no VFs (2024-09-09 12:39:57 -0700)
----------------------------------------------------------------
mlx5-fixes-2024-09-09
----------------------------------------------------------------
Benjamin Poirier (1):
net/mlx5: Fix bridge mode operations when there are no VFs
Carolina Jubran (3):
net/mlx5: Explicitly set scheduling element and TSAR type net/mlx5: Add missing masks and QoS bit masks for scheduling elements net/mlx5: Verify support for scheduling element and TSAR type
Maher Sanalla (1):
net/mlx5: Update the list of the PCI supported devices
Shahar Shitrit (2):
net/mlx5e: Add missing link modes to ptys2ethtool_map net/mlx5e: Add missing link mode to ptys2ext_ethtool_map
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 +++++ .../net/ethernet/mellanox/mlx5/core/esw/legacy.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 51 +++++++++++++--------- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/qos.c | 7 +++ include/linux/mlx5/mlx5_ifc.h | 10 ++++- 6 files changed, 60 insertions(+), 23 deletions(-)
PATCH 1/7 net/mlx5: Update the list of the PCI supported devices
From: Maher Sanalla <[email protected]>
Add the upcoming ConnectX-9 device ID to the table of supported PCI device IDs.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -0
@@ -2217,6 +2217,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */ { PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */ { PCI_VDEVICE(MELLANOX, 0x1023) }, /* ConnectX-8 */ + { PCI_VDEVICE(MELLANOX, 0x1025) }, /* ConnectX-9 */ { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */ { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */
Signature · 1 line
2.46.0
Re: [net 1/7] net/mlx5: Update the list of the PCI supported devices
This series was applied to netdev/net.git (main) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Saeed Mahameed <[email protected]>:
Quoted 11 lines · On Mon, 9 Sep 2024 12:44:59 -0700 you wrote:
From: Maher Sanalla <[email protected]>
Add the upcoming ConnectX-9 device ID to the table of supported PCI device IDs.
Fixes f908a35b2218 ("net/mlx5: Update the list of the PCI supported devices")Signed-off-by Maher Sanalla <[email protected]>Reviewed-by Tariq Toukan <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>[...]
Here is the summary with links:
- [net,1/7] net/mlx5: Update the list of the PCI supported devices
https://git.kernel.org/netdev/net/c/7472d157cb80 - [net,2/7] net/mlx5e: Add missing link modes to ptys2ethtool_map https://git.kernel.org/netdev/net/c/7617d62cba4a - [net,3/7] net/mlx5e: Add missing link mode to ptys2ext_ethtool_map https://git.kernel.org/netdev/net/c/80bf474242b2 - [net,4/7] net/mlx5: Explicitly set scheduling element and TSAR type https://git.kernel.org/netdev/net/c/c88146abe4d0 - [net,5/7] net/mlx5: Add missing masks and QoS bit masks for scheduling elements https://git.kernel.org/netdev/net/c/452ef7f86036 - [net,6/7] net/mlx5: Verify support for scheduling element and TSAR type https://git.kernel.org/netdev/net/c/861cd9b9cb62 - [net,7/7] net/mlx5: Fix bridge mode operations when there are no VFs https://git.kernel.org/netdev/net/c/b1d305abef46
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/7 net/mlx5e: Add missing link modes to ptys2ethtool_map
In reply to Saeed MahameedFrom: Shahar Shitrit <[email protected]>
Add MLX5E_1000BASE_T and MLX5E_100BASE_TX to the legacy modes in ptys2legacy_ethtool_table, since they were missing.
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -0
@@ -139,6 +139,10 @@ void mlx5e_build_ptys2ethtool_map(void) ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT);MLX5_BUILD_PTYS2ETHTOOL_CONFIG (MLX5E_100GBASE_LR4 , legacy, ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT); +MLX5_BUILD_PTYS2ETHTOOL_CONFIG (MLX5E_100BASE_TX , legacy, + ETHTOOL_LINK_MODE_100baseT_Full_BIT); +MLX5_BUILD_PTYS2ETHTOOL_CONFIG (MLX5E_1000BASE_T , legacy, + ETHTOOL_LINK_MODE_1000baseT_Full_BIT);MLX5_BUILD_PTYS2ETHTOOL_CONFIG (MLX5E_10GBASE_T , legacy, ETHTOOL_LINK_MODE_10000baseT_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_25GBASE_CR, legacy,
Signature · 1 line
2.46.0
PATCH 3/7 net/mlx5e: Add missing link mode to ptys2ext_ethtool_map
In reply to Saeed MahameedFrom: Shahar Shitrit <[email protected]>
Add MLX5E_400GAUI_8_400GBASE_CR8 to the extended modes in ptys2ext_ethtool_table, since it was missing.
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +6 -0
@@ -208,6 +208,12 @@ void mlx5e_build_ptys2ethtool_map(void) ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT, ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT, ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT); +MLX5_BUILD_PTYS2ETHTOOL_CONFIG (MLX5E_400GAUI_8_400GBASE_CR8 , ext, + ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT, + ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT); MLX5_BUILD_PTYS2ETHTOOL_CONFIG(MLX5E_100GAUI_1_100GBASE_CR_KR, ext, ETHTOOL_LINK_MODE_100000baseKR_Full_BIT, ETHTOOL_LINK_MODE_100000baseSR_Full_BIT,
Signature · 1 line
2.46.0
PATCH 4/7 net/mlx5: Explicitly set scheduling element and TSAR type
In reply to Saeed MahameedFrom: Carolina Jubran <[email protected]>
Ensure the scheduling element type and TSAR type are explicitly initialized in the QoS rate group creation.
This prevents potential issues due to default values.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +7 -0
@@ -421,6 +421,7 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *ex {u32 tsar_ctx[MLX5_ST_SZ_DW (scheduling_context)] = {};struct mlx5_esw_rate_group *group; +__be32 *attr;u32 divider;int err;
@@ -428,6 +429,12 @@ __esw_qos_create_rate_group(struct mlx5_eswitch *esw, struct netlink_ext_ack *exif (!group)return ERR_PTR (-ENOMEM ); +MLX5_SET (scheduling_context, tsar_ctx, element_type, +SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR ); + + attr =MLX5_ADDR_OF (scheduling_context, tsar_ctx, element_attributes); + *attr =cpu_to_be32 (TSAR_ELEMENT_TSAR_TYPE_DWRR <<16 ); +MLX5_SET (scheduling_context, tsar_ctx, parent_element_id, esw->qos.root_tsar_ix); err = mlx5_create_scheduling_element_cmd(esw->dev,
Signature · 1 line
2.46.0
PATCH 5/7 net/mlx5: Add missing masks and QoS bit masks for scheduling elements
In reply to Saeed MahameedFrom: Carolina Jubran <[email protected]>
Add the missing masks for supported element types and Transmit Scheduling Arbiter (TSAR) types in scheduling elements.
Also, add the corresponding bit masks for these types in the QoS capabilities of a NIC scheduler.
--- include/linux/mlx5/mlx5_ifc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
include/linux/mlx5/mlx5_ifc.h +9 -1
@@ -1027,7 +1027,8 @@ struct mlx5_ifc_qos_cap_bits {u8 max_tsar_bw_share[0x20 ]; -u8 reserved_at_100[0x20 ]; +u8 nic_element_type[0x10 ]; +u8 nic_tsar_type[0x10 ];u8 reserved_at_120[0x3 ];u8 log_meter_aso_granularity[0x5 ];
@@ -3966,6 +3967,7 @@ enum {ELEMENT_TYPE_CAP_MASK_VPORT =1 <<1 ,ELEMENT_TYPE_CAP_MASK_VPORT_TC =1 <<2 ,ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC =1 <<3 , + ELEMENT_TYPE_CAP_MASK_QUEUE_GROUP = 1 << 4, }; struct mlx5_ifc_scheduling_context_bits {
@@ -4675,6 +4677,12 @@ enum { TSAR_ELEMENT_TSAR_TYPE_ETS = 0x2, }; +enum { +TSAR_TYPE_CAP_MASK_DWRR =1 <<0 , +TSAR_TYPE_CAP_MASK_ROUND_ROBIN =1 <<1 , +TSAR_TYPE_CAP_MASK_ETS =1 <<2 , +}; +struct mlx5_ifc_tsar_element_bits {u8 reserved_at_0[0x8 ];u8 tsar_type[0x8 ];
Signature · 1 line
2.46.0
PATCH 6/7 net/mlx5: Verify support for scheduling element and TSAR type
In reply to Saeed MahameedFrom: Carolina Jubran <[email protected]>
Before creating a scheduling element in a NIC or E-Switch scheduler, ensure that the requested element type is supported. If the element is of type Transmit Scheduling Arbiter (TSAR), also verify that the specific TSAR type is supported.
--- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 44 ++++++++++--------- drivers/net/ethernet/mellanox/mlx5/core/qos.c | 7 +++ 2 files changed, 31 insertions(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +24 -20
@@ -312,6 +312,25 @@ static int esw_qos_set_group_max_rate(struct mlx5_eswitch *esw,return err; } +static bool esw_qos_element_type_supported (struct mlx5_core_dev *dev,int type) +{ +switch (type) { +case SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR : +return MLX5_CAP_QOS (dev, esw_element_type) & +ELEMENT_TYPE_CAP_MASK_TSAR ; +case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT : +return MLX5_CAP_QOS (dev, esw_element_type) & +ELEMENT_TYPE_CAP_MASK_VPORT ; +case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC : +return MLX5_CAP_QOS (dev, esw_element_type) & +ELEMENT_TYPE_CAP_MASK_VPORT_TC ; +case SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC : +return MLX5_CAP_QOS (dev, esw_element_type) & +ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC ; + } +return false; +} +static int esw_qos_vport_create_sched_element (struct mlx5_eswitch *esw,struct mlx5_vport *vport,u32 max_rate,u32 bw_share)
@@ -323,6 +342,9 @@ static int esw_qos_vport_create_sched_element(struct mlx5_eswitch *esw,void *vport_elem;int err; +if (!esw_qos_element_type_supported (dev,SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT )) +return -EOPNOTSUPP ; + parent_tsar_ix = group ? group->tsar_ix : esw->qos.root_tsar_ix;MLX5_SET (scheduling_context, sched_ctx, element_type,SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT );
@@ -533,25 +555,6 @@ static int esw_qos_destroy_rate_group(struct mlx5_eswitch *esw,return err; } -static bool esw_qos_element_type_supported (struct mlx5_core_dev *dev,int type) -{ -switch (type) { -case SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR : -return MLX5_CAP_QOS (dev, esw_element_type) & -ELEMENT_TYPE_CAP_MASK_TSAR ; -case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT : -return MLX5_CAP_QOS (dev, esw_element_type) & -ELEMENT_TYPE_CAP_MASK_VPORT ; -case SCHEDULING_CONTEXT_ELEMENT_TYPE_VPORT_TC : -return MLX5_CAP_QOS (dev, esw_element_type) & -ELEMENT_TYPE_CAP_MASK_VPORT_TC ; -case SCHEDULING_CONTEXT_ELEMENT_TYPE_PARA_VPORT_TC : -return MLX5_CAP_QOS (dev, esw_element_type) & -ELEMENT_TYPE_CAP_MASK_PARA_VPORT_TC ; - } -return false; -} -static int esw_qos_create (struct mlx5_eswitch *esw,struct netlink_ext_ack *extack) {u32 tsar_ctx[MLX5_ST_SZ_DW (scheduling_context)] = {};
@@ -562,7 +565,8 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *extaif (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, esw_scheduling))return -EOPNOTSUPP ; -if (!esw_qos_element_type_supported (dev,SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR )) +if (!esw_qos_element_type_supported (dev,SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR ) || + !(MLX5_CAP_QOS (dev, esw_tsar_type) &TSAR_TYPE_CAP_MASK_DWRR ))return -EOPNOTSUPP ; MLX5_SET(scheduling_context, tsar_ctx, element_type,
drivers/net/ethernet/mellanox/mlx5/core/qos.c +7 -0
@@ -28,6 +28,9 @@ int mlx5_qos_create_leaf_node(struct mlx5_core_dev *mdev, u32 parent_id, {u32 sched_ctx[MLX5_ST_SZ_DW (scheduling_context)] = {0 }; +if (!(MLX5_CAP_QOS (mdev, nic_element_type) &ELEMENT_TYPE_CAP_MASK_QUEUE_GROUP )) +return -EOPNOTSUPP ; +MLX5_SET (scheduling_context, sched_ctx, parent_element_id, parent_id);MLX5_SET (scheduling_context, sched_ctx, element_type,SCHEDULING_CONTEXT_ELEMENT_TYPE_QUEUE_GROUP );
@@ -44,6 +47,10 @@ int mlx5_qos_create_inner_node(struct mlx5_core_dev *mdev, u32 parent_id,u32 sched_ctx[MLX5_ST_SZ_DW (scheduling_context)] = {0 };void *attr; +if (!(MLX5_CAP_QOS (mdev, nic_element_type) &ELEMENT_TYPE_CAP_MASK_TSAR ) || + !(MLX5_CAP_QOS (mdev, nic_tsar_type) &TSAR_TYPE_CAP_MASK_DWRR )) +return -EOPNOTSUPP ; +MLX5_SET (scheduling_context, sched_ctx, parent_element_id, parent_id);MLX5_SET (scheduling_context, sched_ctx, element_type,SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR );
Signature · 1 line
2.46.0
PATCH 7/7 net/mlx5: Fix bridge mode operations when there are no VFs
In reply to Saeed MahameedFrom: Benjamin Poirier <[email protected]>
Currently, trying to set the bridge mode attribute when numvfs=0 leads to a crash:
bridge link set dev eth2 hwmode vepa
[ 168.967392] BUG: kernel NULL pointer dereference, address: 0000000000000030 [...] [ 168.969989] RIP: 0010:mlx5_add_flow_rules+0x1f/0x300 [mlx5_core] [...] [ 168.976037] Call Trace: [ 168.976188] <TASK> [ 168.978620] _mlx5_eswitch_set_vepa_locked+0x113/0x230 [mlx5_core] [ 168.979074] mlx5_eswitch_set_vepa+0x7f/0xa0 [mlx5_core] [ 168.979471] rtnl_bridge_setlink+0xe9/0x1f0 [ 168.979714] rtnetlink_rcv_msg+0x159/0x400 [ 168.980451] netlink_rcv_skb+0x54/0x100 [ 168.980675] netlink_unicast+0x241/0x360 [ 168.980918] netlink_sendmsg+0x1f6/0x430 [ 168.981162] ____sys_sendmsg+0x3bb/0x3f0 [ 168.982155] ___sys_sendmsg+0x88/0xd0 [ 168.985036] __sys_sendmsg+0x59/0xa0 [ 168.985477] do_syscall_64+0x79/0x150 [ 168.987273] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 168.987773] RIP: 0033:0x7f8f7950f917
(esw->fdb_table.legacy.vepa_fdb is null)
The bridge mode is only relevant when there are multiple functions per port. Therefore, prevent setting and getting this setting when there are no VFs.
Note that after this change, there are no settings to change on the PF interface using bridge link when there are no VFs, so the interface no longer appears in the bridge link output.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c +2 -2
@@ -319,7 +319,7 @@ int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting)return -EPERM ;mutex_lock (&esw->state_lock); -if (esw->mode !=MLX5_ESWITCH_LEGACY ) { +if (esw->mode !=MLX5_ESWITCH_LEGACY || !mlx5_esw_is_fdb_created (esw)) { err = -EOPNOTSUPP ; goto out; }
@@ -339,7 +339,7 @@ int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting)if (!mlx5_esw_allowed (esw))return -EPERM ; -if (esw->mode !=MLX5_ESWITCH_LEGACY ) +if (esw->mode !=MLX5_ESWITCH_LEGACY || !mlx5_esw_is_fdb_created (esw))return -EOPNOTSUPP ; *setting = esw->fdb_table.legacy.vepa_uplink_rule ?1 :0 ;
Signature · 1 line
2.46.0