Skip to contentSkip to conversation

mlx5 misc patches

PATCH Applied Tariq Toukan 4 participants 9 messages May 12, 2024 – May 14, 2024

Subsystems (5)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

cover mlx5 misc patches

Hi,

This series includes patches for the mlx5 driver.

Patch 1 by Shay enables LAG with HCAs of 8 ports.

Patch 2 by Carolina optimizes the safe switch channels operation for the TX-only changes.

Patch 3 by Parav cleans up some unused code.

Series generated against:
commit cddd2dc6390b ("Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue")

Thanks,
Tariq.

Carolina Jubran (1):
net/mlx5e: Modifying channels number and updating TX queues

Parav Pandit (1):
net/mlx5: Remove unused msix related exported APIs

Shay Drory (1):
net/mlx5: Enable 8 ports LAG

 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  1 +
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 95 +++++++++----------
 .../net/ethernet/mellanox/mlx5/core/lag/lag.c |  3 -
 .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 52 ----------
 include/linux/mlx5/driver.h                   |  9 +-
 6 files changed, 48 insertions(+), 114 deletions(-)
Signature · 1 line
2.44.0
author maintainer
#1 lore raw

PATCH 1/3 net/mlx5: Enable 8 ports LAG

From: Shay Drory <[email protected]>

This patch adds to mlx5 drivers support for 8 ports HCAs. Starting with ConnectX-8 HCAs with 8 ports are possible.

As most driver parts aren't affected by such configuration most driver code is unchanged.

Specially the only affected areas are:
- Lag
- Multiport E-Switch
- Single FDB E-Switch

All of the above are already factored in generic way, and LAG and VF LAG are tested, so all that left is to change a #define and remove checks which are no longer needed.
However, Multiport E-Switch is not tested yet, so it is left untouched.

This patch will allow to create hardware LAG/VF LAG when all 8 ports are added to the same bond device.

for example, In order to activate the hardware lag a user can execute the following:

ip link add bond0 type bond
ip link set bond0 type bond miimon 100 mode 2
ip link set eth2 master bond0
ip link set eth3 master bond0
ip link set eth4 master bond0
ip link set eth5 master bond0
ip link set eth6 master bond0
ip link set eth7 master bond0
ip link set eth8 master bond0
ip link set eth9 master bond0

Where eth2, eth3, eth4, eth5, eth6, eth7, eth8 and eth9 are the PFs of the same HCA.

---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 3 ---
 include/linux/mlx5/driver.h                       | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +0 -3
index 69d482f7c5a2..5e2171ff0a89 100644
@@ -713,7 +713,6 @@ int mlx5_deactivate_lag(struct mlx5_lag *ldev)
 	return 0;
 }
 
-#define MLX5_LAG_OFFLOADS_SUPPORTED_PORTS 4
 bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
 {
 #ifdef CONFIG_MLX5_ESWITCH
@@ -739,8 +738,6 @@ bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
 		if (mlx5_eswitch_mode(ldev->pf[i].dev) != mode)
 			return false;
 
-	if (mode == MLX5_ESWITCH_OFFLOADS && ldev->ports > MLX5_LAG_OFFLOADS_SUPPORTED_PORTS)
-		return false;
 #else
 	for (i = 0; i < ldev->ports; i++)
 		if (mlx5_sriov_is_enabled(ldev->pf[i].dev))
include/linux/mlx5/driver.h +1 -1
index bf9324a31ae9..8218588688b5 100644
@@ -85,7 +85,7 @@ enum mlx5_sqp_t {
 };
 
 enum {
-	MLX5_MAX_PORTS	= 4,
+	MLX5_MAX_PORTS	= 8,
 };
 
 enum {
Signature · 1 line
2.44.0
reviewer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] net/mlx5: Enable 8 ports LAG

Quoted 35 lines · Tariq Toukan

From: Shay Drory <[email protected]>

This patch adds to mlx5 drivers support for 8 ports HCAs. Starting with ConnectX-8 HCAs with 8 ports are possible.

As most driver parts aren't affected by such configuration most driver code is unchanged.

Specially the only affected areas are:
- Lag
- Multiport E-Switch
- Single FDB E-Switch

All of the above are already factored in generic way, and LAG and VF LAG are tested, so all that left is to change a #define and remove checks which are no longer needed.
However, Multiport E-Switch is not tested yet, so it is left untouched.

This patch will allow to create hardware LAG/VF LAG when all 8 ports are added to the same bond device.

for example, In order to activate the hardware lag a user can execute the following:

ip link add bond0 type bond
ip link set bond0 type bond miimon 100 mode 2
ip link set eth2 master bond0
ip link set eth3 master bond0
ip link set eth4 master bond0
ip link set eth5 master bond0
ip link set eth6 master bond0
ip link set eth7 master bond0
ip link set eth8 master bond0
ip link set eth9 master bond0

Quoted 6 lines

Where eth2, eth3, eth4, eth5, eth6, eth7, eth8 and eth9 are the PFs of the same HCA.

author maintainer
#3 lore raw

PATCH 2/3 net/mlx5e: Modifying channels number and updating TX queues

In reply to Tariq Toukan

From: Carolina Jubran <[email protected]>

It is not appropriate for the mlx5e_num_channels_changed function to be called solely for updating the TX queues, even if the channels number has not been changed.

Move the code responsible for updating the TC and TX queues from mlx5e_num_channels_changed and produce a new function called mlx5e_update_tc_and_tx_queues. This new function should only be called when the channels number remains unchanged.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  1 +
 .../ethernet/mellanox/mlx5/core/en_ethtool.c  |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 95 +++++++++----------
 3 files changed, 47 insertions(+), 51 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
index f8bd9dbf59cd..e85fb71bf0b4 100644
@@ -1102,6 +1102,7 @@ int mlx5e_safe_switch_params(struct mlx5e_priv *priv,
 			     void *context, bool reset);
 int mlx5e_update_tx_netdev_queues(struct mlx5e_priv *priv);
 int mlx5e_num_channels_changed_ctx(struct mlx5e_priv *priv, void *context);
+int mlx5e_update_tc_and_tx_queues_ctx(struct mlx5e_priv *priv, void *context);
 void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
 void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
 int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -1
index 1eb3a712930b..3320f12ba2db 100644
@@ -2292,7 +2292,7 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable)
 	 */
 
 	err = mlx5e_safe_switch_params(priv, &new_params,
-				       mlx5e_num_channels_changed_ctx, NULL, true);
+				       mlx5e_update_tc_and_tx_queues_ctx, NULL, true);
 	if (!err)
 		priv->tx_ptp_opened = true;
 
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +45 -50

143 lines not on this page · raw message

Signature · 1 line
2.44.0
reviewer Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH net-next 2/3] net/mlx5e: Modifying channels number and updating TX queues

Quoted 6 lines · Tariq Toukan

From: Carolina Jubran <[email protected]>

It is not appropriate for the mlx5e_num_channels_changed function to be called solely for updating the TX queues, even if the channels number has not been changed.

Quoted 7 lines

Move the code responsible for updating the TC and TX queues from mlx5e_num_channels_changed and produce a new function called mlx5e_update_tc_and_tx_queues. This new function should only be called when the channels number remains unchanged.

author maintainer
#5 lore raw

PATCH 3/3 net/mlx5: Remove unused msix related exported APIs

In reply to Tariq Toukan

From: Parav Pandit <[email protected]>

MSIX irq allocation and free APIs are no longer in use. Hence, remove the dead code.

---
 .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 52 -------------------
 include/linux/mlx5/driver.h                   |  7 ---
 2 files changed, 59 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +0 -52
index 6bac8ad70ba6..fb8787e30d3f 100644
@@ -507,58 +507,6 @@ struct mlx5_irq *mlx5_irq_request(struct mlx5_core_dev *dev, u16 vecidx,
 	return irq;
 }
 
-/**
- * mlx5_msix_alloc - allocate msix interrupt
- * @dev: mlx5 device from which to request
- * @handler: interrupt handler
- * @affdesc: affinity descriptor
- * @name: interrupt name
- *
- * Returns: struct msi_map with result encoded.
- * Note: the caller must make sure to release the irq by calling
- *       mlx5_msix_free() if shutdown was initiated.
- */
-struct msi_map mlx5_msix_alloc(struct mlx5_core_dev *dev,
-			       irqreturn_t (*handler)(int, void *),
-			       const struct irq_affinity_desc *affdesc,
-			       const char *name)
-{
-	struct msi_map map;
-	int err;
-
-	if (!dev->pdev) {
-		map.virq = 0;
-		map.index = -EINVAL;
-		return map;
-	}
-
-	map = pci_msix_alloc_irq_at(dev->pdev, MSI_ANY_INDEX, affdesc);
-	if (!map.virq)
-		return map;
-
-	err = request_irq(map.virq, handler, 0, name, NULL);
-	if (err) {
-		mlx5_core_warn(dev, "err %d\n", err);
-		pci_msix_free_irq(dev->pdev, map);
-		map.virq = 0;
-		map.index = -ENOMEM;
-	}
-	return map;
-}
-EXPORT_SYMBOL(mlx5_msix_alloc);
-
-/**
- * mlx5_msix_free - free a previously allocated msix interrupt
- * @dev: mlx5 device associated with interrupt
- * @map: map previously returned by mlx5_msix_alloc()
- */
-void mlx5_msix_free(struct mlx5_core_dev *dev, struct msi_map map)
-{
-	free_irq(map.virq, NULL);
-	pci_msix_free_irq(dev->pdev, map);
-}
-EXPORT_SYMBOL(mlx5_msix_free);
-
 /**
  * mlx5_irq_release_vector - release one IRQ back to the system.
  * @irq: the irq to release.
include/linux/mlx5/driver.h +0 -7
index 8218588688b5..0aa15cac0308 100644
@@ -1374,11 +1374,4 @@ static inline bool mlx5_is_macsec_roce_supported(struct mlx5_core_dev *mdev)
 enum {
 	MLX5_OCTWORD = 16,
 };
-
-struct msi_map mlx5_msix_alloc(struct mlx5_core_dev *dev,
-			       irqreturn_t (*handler)(int, void *),
-			       const struct irq_affinity_desc *affdesc,
-			       const char *name);
-void mlx5_msix_free(struct mlx5_core_dev *dev, struct msi_map map);
-
 #endif /* MLX5_DRIVER_H */
Signature · 1 line
2.44.0
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH net-next 3/3] net/mlx5: Remove unused msix related exported APIs

In reply to Tariq Toukan
Quoted 9 lines · Tariq Toukan

From: Parav Pandit <[email protected]>

MSIX irq allocation and free APIs are no longer in use. Hence, remove the dead code.

Looks good to me.

Quoted 88 lines
---
 .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 52 -------------------
 include/linux/mlx5/driver.h                   |  7 ---
 2 files changed, 59 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +0 -52
index 6bac8ad70ba6..fb8787e30d3f 100644
@@ -507,58 +507,6 @@ struct mlx5_irq *mlx5_irq_request(struct mlx5_core_dev *dev, u16 vecidx,
        return irq;
 }
 
-/**
- * mlx5_msix_alloc - allocate msix interrupt
- * @dev: mlx5 device from which to request
- * @handler: interrupt handler
- * @affdesc: affinity descriptor
- * @name: interrupt name
- *
- * Returns: struct msi_map with result encoded.
- * Note: the caller must make sure to release the irq by calling
- *       mlx5_msix_free() if shutdown was initiated.
- */
-struct msi_map mlx5_msix_alloc(struct mlx5_core_dev *dev,
-                              irqreturn_t (*handler)(int, void *),
-                              const struct irq_affinity_desc *affdesc,
-                              const char *name)
-{
-       struct msi_map map;
-       int err;
-
-       if (!dev->pdev) {
-               map.virq = 0;
-               map.index = -EINVAL;
-               return map;
-       }
-
-       map = pci_msix_alloc_irq_at(dev->pdev, MSI_ANY_INDEX, affdesc);
-       if (!map.virq)
-               return map;
-
-       err = request_irq(map.virq, handler, 0, name, NULL);
-       if (err) {
-               mlx5_core_warn(dev, "err %d\n", err);
-               pci_msix_free_irq(dev->pdev, map);
-               map.virq = 0;
-               map.index = -ENOMEM;
-       }
-       return map;
-}
-EXPORT_SYMBOL(mlx5_msix_alloc);
-
-/**
- * mlx5_msix_free - free a previously allocated msix interrupt
- * @dev: mlx5 device associated with interrupt
- * @map: map previously returned by mlx5_msix_alloc()
- */
-void mlx5_msix_free(struct mlx5_core_dev *dev, struct msi_map map)
-{
-       free_irq(map.virq, NULL);
-       pci_msix_free_irq(dev->pdev, map);
-}
-EXPORT_SYMBOL(mlx5_msix_free);
-
 /**
  * mlx5_irq_release_vector - release one IRQ back to the system.
  * @irq: the irq to release.
include/linux/mlx5/driver.h +0 -8
index 8218588688b5..0aa15cac0308 100644
@@ -1374,11 +1374,4 @@ static inline bool mlx5_is_macsec_roce_supported(struct mlx5_core_dev *mdev)
 enum {
        MLX5_OCTWORD = 16,
 };
-
-struct msi_map mlx5_msix_alloc(struct mlx5_core_dev *dev,
-                              irqreturn_t (*handler)(int, void *),
-                              const struct irq_affinity_desc *affdesc,
-                              const char *name);
-void mlx5_msix_free(struct mlx5_core_dev *dev, struct msi_map map);
-
 #endif /* MLX5_DRIVER_H */
--

2.44.0

Signature · 2 lines
Regards,
Kalesh A P
#8 lore raw
In reply to Tariq Toukan
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Sun, 12 May 2024 15:43:02 +0300 you wrote:

Hi,

This series includes patches for the mlx5 driver.

Patch 1 by Shay enables LAG with HCAs of 8 ports.

Patch 2 by Carolina optimizes the safe switch channels operation for the TX-only changes.

[...]

Here is the summary with links:
- [net-next,1/3] net/mlx5: Enable 8 ports LAG

    https://git.kernel.org/netdev/net-next/c/e0e6adfe8c20
  - [net-next,2/3] net/mlx5e: Modifying channels number and updating TX queues
    https://git.kernel.org/netdev/net-next/c/bcee093751f8
  - [net-next,3/3] net/mlx5: Remove unused msix related exported APIs
    https://git.kernel.org/netdev/net-next/c/db5944e16cd8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html