Skip to contentSkip to conversation

mlx5 updates 2021-02-01

GIT PULL Applied Saeed Mahameed 2 participants 16 messages Feb 2, 2021 – Feb 3, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

From: Saeed Mahameed <[email protected]>

Hi Jakub, Dave,

This series adds misc updates to mlx5 driver.
For more information please see tag log below.

Please pull and let me know if there is any problem.

Thanks,
Saeed.

---
The following changes since commit 9ae4bdc6e4c1281ddf8d6335bea35864d086cbf9:

Merge branch 'rework-the-memory-barrier-for-scrq-entry' (2021-02-01 20:21:14 -0800)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-02-01

for you to fetch changes up to a283ea1b97163d21e0f1a3df387b71787042b990:

net/mlx5: DR, Avoid unnecessary csum recalculation on supporting devices (2021-02-01 22:52:36 -0800)

----------------------------------------------------------------
mlx5-updates-2021-02-01

mlx5 netdev updates:

1) Trivial refactoring ahead of the upcoming uplink representor series.
2) Increased RSS table size to 256, for better results
3) Misc. Cleanup and very trivial improvements

----------------------------------------------------------------
Noam Stolero (1):
net/mlx5e: Increase indirection RQ table size to 256

Roi Dayan (5):
net/mlx5e: Refactor mlx5e_netdev_init/cleanup to mlx5e_priv_init/cleanup net/mlx5e: Move netif_carrier_off() out of mlx5e_priv_init() net/mlx5e: Move set vxlan nic info to profile init net/mlx5e: Avoid false lock depenency warning on tc_ht net/mlx5e: Move representor neigh init into profile enable

Saeed Mahameed (4):
net/mlx5e: Separate between netdev objects and mlx5e profiles initialization net/mxl5e: Add change profile method
net/mlx5e: accel, remove redundant space
net/mlx5e: CT: remove useless conversion to PTR_ERR then ERR_PTR

Tariq Toukan (2):
net/mlx5e: Enable napi in channel's activation stage net/mlx5e: kTLS, Improve TLS RX workqueue scope

Tom Rix (1):
net/mlx5e: remove h from printk format specifier

Yevgeny Kliteynik (1):
net/mlx5: DR, Avoid unnecessary csum recalculation on supporting devices

 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  36 ++--
 .../net/ethernet/mellanox/mlx5/core/en/params.c    |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c   |  12 +-
 .../net/ethernet/mellanox/mlx5/core/en/rep/neigh.c |  18 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c |   7 +-
 .../mellanox/mlx5/core/en_accel/en_accel.h         |   2 +-
 .../ethernet/mellanox/mlx5/core/en_accel/ktls.c    |  24 ++-
 .../net/ethernet/mellanox/mlx5/core/en_accel/tls.c |   7 -
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 226 ++++++++++++++-------
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |  90 ++++----
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    |  12 ++
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c  |  26 +--
 .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h  |   5 +-
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c |   6 +-
 .../mellanox/mlx5/core/steering/dr_action.c        |   9 +-
 .../ethernet/mellanox/mlx5/core/steering/dr_ste.c  |   5 +
 .../mellanox/mlx5/core/steering/dr_types.h         |   2 +
 17 files changed, 304 insertions(+), 185 deletions(-)
#1 lore raw

PATCH 1/14 net/mlx5e: Separate between netdev objects and mlx5e profiles initialization

From: Saeed Mahameed <[email protected]>

1) Initialize netdevice features and structures on netdevice allocation and outside of the mlx5e profile.

2) As now mlx5e netdevice private params will be setup on profile init only after netdevice features are already set, we add a call to netde_update_features() to resolve any conflict.
This is nice since we reuse the fix_features ndo code if a profile wants different default features, instead of duplicating features conflict resolution code on profile initialization.

3) With this we achieve total separation between mlx5e profiles and netdevices, and will allow replacing mlx5e profiles on the fly to reuse the same netdevice for multiple profiles.
e.g. for uplink representor profile as shown in the following patch

4) Profile callbacks are not allowed to touch netdev->features directly anymore, since in downstream patch we will detach/attach netdev dynamically to profile, hence we move the code dealing with netdev->features from profile->init() to fix_features ndo, and we will call netdev_update_features() on mlx5e_attach_netdev(profile, netdev);

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  23 ++--
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 127 +++++++++---------
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  |  51 ++++---
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c |  23 ++--
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib.h |   5 +-
 .../mellanox/mlx5/core/ipoib/ipoib_vlan.c     |   6 +-
 6 files changed, 121 insertions(+), 114 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +10 -13
index 39f389cc40fc..bf5de1e79134 100644
@@ -895,8 +895,7 @@ extern const struct mlx5e_rx_handlers mlx5e_rx_handlers_nic;
 
 struct mlx5e_profile {
 	int	(*init)(struct mlx5_core_dev *mdev,
-			struct net_device *netdev,
-			const struct mlx5e_profile *profile, void *ppriv);
+			struct net_device *netdev);
 	void	(*cleanup)(struct mlx5e_priv *priv);
 	int	(*init_rx)(struct mlx5e_priv *priv);
 	void	(*cleanup_rx)(struct mlx5e_priv *priv);
@@ -1155,24 +1154,22 @@ int mlx5e_ethtool_set_pauseparam(struct mlx5e_priv *priv,
 				 struct ethtool_pauseparam *pauseparam);
 
 /* mlx5e generic netdev management API */
+static inline unsigned int mlx5e_calc_max_nch(struct mlx5e_priv *priv)
+{
+	return priv->netdev->num_rx_queues / max_t(u8, priv->profile->rq_groups, 1);
+}
+
 int mlx5e_netdev_init(struct net_device *netdev,
 		      struct mlx5e_priv *priv,
-		      struct mlx5_core_dev *mdev,
-		      const struct mlx5e_profile *profile,
-		      void *ppriv);
+		      struct mlx5_core_dev *mdev);
 void mlx5e_netdev_cleanup(struct net_device *netdev, struct mlx5e_priv *priv);
-struct net_device*
-mlx5e_create_netdev(struct mlx5_core_dev *mdev, const struct mlx5e_profile *profile,
-		    int nch, void *ppriv);
+struct net_device *
+mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int rxqs);
 int mlx5e_attach_netdev(struct mlx5e_priv *priv);
 void mlx5e_detach_netdev(struct mlx5e_priv *priv);
 void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
 void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv);
-void mlx5e_build_nic_params(struct mlx5e_priv *priv,
-			    struct mlx5e_xsk *xsk,
-			    struct mlx5e_rss_params *rss_params,
-			    struct mlx5e_params *params,
-			    u16 mtu);
+void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu);
 void mlx5e_build_rq_params(struct mlx5_core_dev *mdev,
 			   struct mlx5e_params *params);
 void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +67 -60

279 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +30 -21

125 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +11 -12
index 97b5fcb1f406..5889029c2adf 100644
@@ -72,23 +72,14 @@ static void mlx5i_build_nic_params(struct mlx5_core_dev *mdev,
 }
 
 /* Called directly after IPoIB netdevice was created to initialize SW structs */
-int mlx5i_init(struct mlx5_core_dev *mdev,
-	       struct net_device *netdev,
-	       const struct mlx5e_profile *profile,
-	       void *ppriv)
+int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev)
 {
 	struct mlx5e_priv *priv  = mlx5i_epriv(netdev);
-	int err;
-
-	err = mlx5e_netdev_init(netdev, priv, mdev, profile, ppriv);
-	if (err)
-		return err;
 
 	mlx5e_set_netdev_mtu_boundaries(priv);
 	netdev->mtu = netdev->max_mtu;
 
-	mlx5e_build_nic_params(priv, NULL, &priv->rss_params, &priv->channels.params,
-			       netdev->mtu);
+	mlx5e_build_nic_params(priv, NULL, netdev->mtu);
 	mlx5i_build_nic_params(mdev, &priv->channels.params);
 
 	mlx5e_timestamp_init(priv);
@@ -753,7 +744,14 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 			goto destroy_ht;
 	}
 
-	prof->init(mdev, netdev, prof, ipriv);
+	err = mlx5e_netdev_init(netdev, epriv, mdev);
+	if (err)
+		goto destroy_mdev_resources;
+
+	epriv->profile = prof;
+	epriv->ppriv = ipriv;
+
+	prof->init(mdev, netdev);
 
 	err = mlx5e_attach_netdev(epriv);
 	if (err)
@@ -777,6 +775,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 	prof->cleanup(epriv);
 	if (ipriv->sub_interface)
 		return err;
+destroy_mdev_resources:
 	mlx5e_destroy_mdev_resources(mdev);
 destroy_ht:
 	mlx5i_pkey_qpn_ht_cleanup(netdev);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.h +1 -4
index b79dc1e28c41..99d46fda9f82 100644
@@ -87,10 +87,7 @@ void mlx5i_dev_cleanup(struct net_device *dev);
 int mlx5i_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 
 /* Parent profile functions */
-int mlx5i_init(struct mlx5_core_dev *mdev,
-	       struct net_device *netdev,
-	       const struct mlx5e_profile *profile,
-	       void *ppriv);
+int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev);
 void mlx5i_cleanup(struct mlx5e_priv *priv);
 
 int mlx5i_update_nic_rx(struct mlx5e_priv *priv);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c +2 -4
index 7163d9f6c4a6..3d0a18a0bed4 100644
@@ -276,14 +276,12 @@ static int mlx5i_pkey_change_mtu(struct net_device *netdev, int new_mtu)
 
 /* Called directly after IPoIB netdevice was created to initialize SW structs */
 static int mlx5i_pkey_init(struct mlx5_core_dev *mdev,
-			   struct net_device *netdev,
-			   const struct mlx5e_profile *profile,
-			   void *ppriv)
+			   struct net_device *netdev)
 {
 	struct mlx5e_priv *priv  = mlx5i_epriv(netdev);
 	int err;
 
-	err = mlx5i_init(mdev, netdev, profile, ppriv);
+	err = mlx5i_init(mdev, netdev);
 	if (err)
 		return err;
 
Signature · 1 line
2.29.2
#2 lore raw

Re: [net-next 01/14] net/mlx5e: Separate between netdev objects and mlx5e profiles initialization

This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 5 lines · On Mon, 1 Feb 2021 22:54:44 -0800 you wrote:

From: Saeed Mahameed <[email protected]>

1) Initialize netdevice features and structures on netdevice allocation and outside of the mlx5e profile.

Quoted 8 lines

2) As now mlx5e netdevice private params will be setup on profile init only after netdevice features are already set, we add a call to netde_update_features() to resolve any conflict.
This is nice since we reuse the fix_features ndo code if a profile wants different default features, instead of duplicating features conflict resolution code on profile initialization.

[...]

Here is the summary with links:
- [net-next,01/14] net/mlx5e: Separate between netdev objects and mlx5e profiles initialization

    https://git.kernel.org/netdev/net-next/c/3ef14e463f6e
  - [net-next,02/14] net/mxl5e: Add change profile method
    https://git.kernel.org/netdev/net-next/c/c4d7eb57687f
  - [net-next,03/14] net/mlx5e: Refactor mlx5e_netdev_init/cleanup to mlx5e_priv_init/cleanup
    https://git.kernel.org/netdev/net-next/c/c9fd1e33e989
  - [net-next,04/14] net/mlx5e: Move netif_carrier_off() out of mlx5e_priv_init()
    https://git.kernel.org/netdev/net-next/c/1227bbc5d09e
  - [net-next,05/14] net/mlx5e: Move set vxlan nic info to profile init
    https://git.kernel.org/netdev/net-next/c/84db66124714
  - [net-next,06/14] net/mlx5e: Avoid false lock depenency warning on tc_ht
    https://git.kernel.org/netdev/net-next/c/9ba33339c043
  - [net-next,07/14] net/mlx5e: Move representor neigh init into profile enable
    https://git.kernel.org/netdev/net-next/c/6b424e13b010
  - [net-next,08/14] net/mlx5e: Enable napi in channel's activation stage
    https://git.kernel.org/netdev/net-next/c/7637e499e219
  - [net-next,09/14] net/mlx5e: Increase indirection RQ table size to 256
    https://git.kernel.org/netdev/net-next/c/1dd55ba2fb70
  - [net-next,10/14] net/mlx5e: remove h from printk format specifier
    https://git.kernel.org/netdev/net-next/c/1d3a3f3bfe3c
  - [net-next,11/14] net/mlx5e: kTLS, Improve TLS RX workqueue scope
    https://git.kernel.org/netdev/net-next/c/26432001b5c4
  - [net-next,12/14] net/mlx5e: accel, remove redundant space
    https://git.kernel.org/netdev/net-next/c/8271e341ed63
  - [net-next,13/14] net/mlx5e: CT: remove useless conversion to PTR_ERR then ERR_PTR
    https://git.kernel.org/netdev/net-next/c/902c02458925
  - [net-next,14/14] net/mlx5: DR, Avoid unnecessary csum recalculation on supporting devices
    https://git.kernel.org/netdev/net-next/c/a283ea1b9716

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

#3 lore raw

PATCH 2/14 net/mxl5e: Add change profile method

In reply to Saeed Mahameed

From: Saeed Mahameed <[email protected]>

Port nic netdevice will be used as uplink representor in downstream patches. Add change profile method to allow changing a mlx5e netdevice profile dynamically.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  7 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 68 ++++++++++++++++++-
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  |  2 +-
 3 files changed, 73 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +5 -2
index bf5de1e79134..fa461cfd6410 100644
@@ -1154,9 +1154,10 @@ int mlx5e_ethtool_set_pauseparam(struct mlx5e_priv *priv,
 				 struct ethtool_pauseparam *pauseparam);
 
 /* mlx5e generic netdev management API */
-static inline unsigned int mlx5e_calc_max_nch(struct mlx5e_priv *priv)
+static inline unsigned int
+mlx5e_calc_max_nch(struct mlx5e_priv *priv, const struct mlx5e_profile *profile)
 {
-	return priv->netdev->num_rx_queues / max_t(u8, priv->profile->rq_groups, 1);
+	return priv->netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1);
 }
 
 int mlx5e_netdev_init(struct net_device *netdev,
@@ -1168,6 +1169,8 @@ mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int
 int mlx5e_attach_netdev(struct mlx5e_priv *priv);
 void mlx5e_detach_netdev(struct mlx5e_priv *priv);
 void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
+int mlx5e_netdev_change_profile(struct mlx5e_priv *priv,
+				const struct mlx5e_profile *new_profile, void *new_ppriv);
 void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv);
 void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16 mtu);
 void mlx5e_build_rq_params(struct mlx5_core_dev *mdev,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +67 -1

86 lines not on this page · raw message

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +1 -1
index d94d2ff9d312..c8a0f4c88d4b 100644
@@ -684,7 +684,7 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
 					 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
 					 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
 
-	priv->max_nch = mlx5e_calc_max_nch(priv);
+	priv->max_nch = mlx5e_calc_max_nch(priv, priv->profile);
 	params = &priv->channels.params;
 
 	params->num_channels = MLX5E_REP_PARAMS_DEF_NUM_CHANNELS;
Signature · 1 line
2.29.2
#4 lore raw

PATCH 3/14 net/mlx5e: Refactor mlx5e_netdev_init/cleanup to mlx5e_priv_init/cleanup

In reply to Saeed Mahameed

From: Roi Dayan <[email protected]>

We actually initialize priv and not netdev. The only call to set netdev carrier will be moved in the following commit.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h  |  8 ++++----
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 20 +++++++++----------
 .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c |  4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +4 -4
index fa461cfd6410..8cc80c31341f 100644
@@ -1160,10 +1160,10 @@ mlx5e_calc_max_nch(struct mlx5e_priv *priv, const struct mlx5e_profile *profile)
 	return priv->netdev->num_rx_queues / max_t(u8, profile->rq_groups, 1);
 }
 
-int mlx5e_netdev_init(struct net_device *netdev,
-		      struct mlx5e_priv *priv,
-		      struct mlx5_core_dev *mdev);
-void mlx5e_netdev_cleanup(struct net_device *netdev, struct mlx5e_priv *priv);
+int mlx5e_priv_init(struct mlx5e_priv *priv,
+		    struct net_device *netdev,
+		    struct mlx5_core_dev *mdev);
+void mlx5e_priv_cleanup(struct mlx5e_priv *priv);
 struct net_device *
 mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int rxqs);
 int mlx5e_attach_netdev(struct mlx5e_priv *priv);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +10 -10
index 91f23871ded5..177e076f6cce 100644
@@ -5457,9 +5457,9 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
 };
 
 /* mlx5e generic netdev management API (move to en_common.c) */
-int mlx5e_netdev_init(struct net_device *netdev,
-		      struct mlx5e_priv *priv,
-		      struct mlx5_core_dev *mdev)
+int mlx5e_priv_init(struct mlx5e_priv *priv,
+		    struct net_device *netdev,
+		    struct mlx5_core_dev *mdev)
 {
 	memset(priv, 0, sizeof(*priv));
 
@@ -5494,7 +5494,7 @@ int mlx5e_netdev_init(struct net_device *netdev,
 	return -ENOMEM;
 }
 
-void mlx5e_netdev_cleanup(struct net_device *netdev, struct mlx5e_priv *priv)
+void mlx5e_priv_cleanup(struct mlx5e_priv *priv)
 {
 	int i;
 
@@ -5518,9 +5518,9 @@ mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int
 		return NULL;
 	}
 
-	err = mlx5e_netdev_init(netdev, netdev_priv(netdev), mdev);
+	err = mlx5e_priv_init(netdev_priv(netdev), netdev, mdev);
 	if (err) {
-		mlx5_core_err(mdev, "mlx5e_netdev_init failed, err=%d\n", err);
+		mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
 		goto err_free_netdev;
 	}
 	dev_net_set(netdev, mlx5_core_net(mdev));
@@ -5625,9 +5625,9 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv,
 	struct mlx5_core_dev *mdev = priv->mdev;
 	int err;
 
-	err = mlx5e_netdev_init(netdev, priv, mdev);
+	err = mlx5e_priv_init(priv, netdev, mdev);
 	if (err) {
-		mlx5_core_err(mdev, "mlx5e_netdev_init failed, err=%d\n", err);
+		mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
 		return err;
 	}
 	priv->profile = new_profile;
@@ -5660,7 +5660,7 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv,
 	/* cleanup old profile */
 	mlx5e_detach_netdev(priv);
 	priv->profile->cleanup(priv);
-	mlx5e_netdev_cleanup(priv->netdev, priv);
+	mlx5e_priv_cleanup(priv);
 
 	err = mlx5e_netdev_attach_profile(priv, new_profile, new_ppriv);
 	if (err) { /* roll back to original profile */
@@ -5685,7 +5685,7 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv)
 {
 	struct net_device *netdev = priv->netdev;
 
-	mlx5e_netdev_cleanup(netdev, priv);
+	mlx5e_priv_cleanup(priv);
 	free_netdev(netdev);
 }
 
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +2 -2
index 5889029c2adf..8641bd9bbb53 100644
@@ -103,7 +103,7 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev)
 /* Called directly before IPoIB netdevice is destroyed to cleanup SW structs */
 void mlx5i_cleanup(struct mlx5e_priv *priv)
 {
-	mlx5e_netdev_cleanup(priv->netdev, priv);
+	mlx5e_priv_cleanup(priv);
 }
 
 static void mlx5i_grp_sw_update_stats(struct mlx5e_priv *priv)
@@ -744,7 +744,7 @@ static int mlx5_rdma_setup_rn(struct ib_device *ibdev, u8 port_num,
 			goto destroy_ht;
 	}
 
-	err = mlx5e_netdev_init(netdev, epriv, mdev);
+	err = mlx5e_priv_init(epriv, netdev, mdev);
 	if (err)
 		goto destroy_mdev_resources;
 
Signature · 1 line
2.29.2
#5 lore raw

PATCH 4/14 net/mlx5e: Move netif_carrier_off() out of mlx5e_priv_init()

In reply to Saeed Mahameed

From: Roi Dayan <[email protected]>

It's not part of priv initialization.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c     | 6 +++---
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -3
index 177e076f6cce..e468d8329c2a 100644
@@ -5483,9 +5483,6 @@ int mlx5e_priv_init(struct mlx5e_priv *priv,
 	if (!priv->wq)
 		goto err_free_cpumask;
 
-	/* netdev init */
-	netif_carrier_off(netdev);
-
 	return 0;
 
 err_free_cpumask:
@@ -5523,6 +5520,8 @@ mlx5e_create_netdev(struct mlx5_core_dev *mdev, unsigned int txqs, unsigned int
 		mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
 		goto err_free_netdev;
 	}
+
+	netif_carrier_off(netdev);
 	dev_net_set(netdev, mlx5_core_net(mdev));
 
 	return netdev;
@@ -5630,6 +5629,7 @@ mlx5e_netdev_attach_profile(struct mlx5e_priv *priv,
 		mlx5_core_err(mdev, "mlx5e_priv_init failed, err=%d\n", err);
 		return err;
 	}
+	netif_carrier_off(netdev);
 	priv->profile = new_profile;
 	priv->ppriv = new_ppriv;
 	err = new_profile->init(priv->mdev, priv->netdev);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +1 -0
index 8641bd9bbb53..1eeca45cfcdf 100644
@@ -76,6 +76,7 @@ int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev)
 {
 	struct mlx5e_priv *priv  = mlx5i_epriv(netdev);
 
+	netif_carrier_off(netdev);
 	mlx5e_set_netdev_mtu_boundaries(priv);
 	netdev->mtu = netdev->max_mtu;
 
Signature · 1 line
2.29.2
#6 lore raw

PATCH 5/14 net/mlx5e: Move set vxlan nic info to profile init

In reply to Saeed Mahameed

From: Roi Dayan <[email protected]>

Since its profile dependent let's init the vxlan info as part of profile initialization.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c |  3 +--
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c  | 14 ++++++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -2
index e468d8329c2a..b9d2cb6f178d 100644
@@ -5101,8 +5101,6 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
 	netdev->hw_features      |= NETIF_F_HW_VLAN_CTAG_FILTER;
 	netdev->hw_features      |= NETIF_F_HW_VLAN_STAG_TX;
 
-	mlx5e_vxlan_set_netdev_info(priv);
-
 	if (mlx5e_tunnel_any_tx_proto_supported(mdev)) {
 		netdev->hw_enc_features |= NETIF_F_HW_CSUM;
 		netdev->hw_enc_features |= NETIF_F_TSO;
@@ -5229,6 +5227,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
 	int err;
 
 	mlx5e_build_nic_params(priv, &priv->xsk, netdev->mtu);
+	mlx5e_vxlan_set_netdev_info(priv);
 
 	mlx5e_timestamp_init(priv);
 
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +10 -4
index c8a0f4c88d4b..45669a1db426 100644
@@ -717,15 +717,12 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev,
 				   struct mlx5_core_dev *mdev,
 				   struct mlx5_eswitch_rep *rep)
 {
-	struct mlx5e_priv *priv = netdev_priv(netdev);
-
 	SET_NETDEV_DEV(netdev, mdev->device);
 	if (rep->vport == MLX5_VPORT_UPLINK) {
 		netdev->netdev_ops = &mlx5e_netdev_ops_uplink_rep;
 		/* we want a persistent mac for the uplink rep */
 		mlx5_query_mac_address(mdev, netdev->dev_addr);
 		netdev->ethtool_ops = &mlx5e_uplink_rep_ethtool_ops;
-		mlx5e_vxlan_set_netdev_info(priv);
 		mlx5e_dcbnl_build_rep_netdev(netdev);
 	} else {
 		netdev->netdev_ops = &mlx5e_netdev_ops_rep;
@@ -767,6 +764,15 @@ static int mlx5e_init_rep(struct mlx5_core_dev *mdev,
 	return 0;
 }
 
+static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,
+			     struct net_device *netdev)
+{
+	struct mlx5e_priv *priv = netdev_priv(netdev);
+
+	mlx5e_vxlan_set_netdev_info(priv);
+	return mlx5e_init_rep(mdev, netdev);
+}
+
 static void mlx5e_cleanup_rep(struct mlx5e_priv *priv)
 {
 }
@@ -1165,7 +1171,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
 };
 
 static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
-	.init			= mlx5e_init_rep,
+	.init			= mlx5e_init_ul_rep,
 	.cleanup		= mlx5e_cleanup_rep,
 	.init_rx		= mlx5e_init_ul_rep_rx,
 	.cleanup_rx		= mlx5e_cleanup_ul_rep_rx,
Signature · 1 line
2.29.2
#7 lore raw

PATCH 6/14 net/mlx5e: Avoid false lock depenency warning on tc_ht

In reply to Saeed Mahameed

From: Roi Dayan <[email protected]>

To avoid false lock dependency warning set the tc_ht lock
class different than the lock class of the ht being used when deleting last flow from a group and then deleting a group, we get into del_sw_flow_group() which call rhashtable_destroy on fg->ftes_hash which will take ht->mutex but it's different than the ht->mutex here.

======================================================
WARNING: possible circular locking dependency detected 5.11.0-rc4_net_next_mlx5_949fdcc #1 Not tainted
------------------------------------------------------
modprobe/12950 is trying to acquire lock:
ffff88816510f910 (&node->lock){++++}-{3:3}, at: mlx5_del_flow_rules+0x2a/0x210 [mlx5_core]

but task is already holding lock:
ffff88815834e3e8 (&ht->mutex){+.+.}-{3:3}, at: rhashtable_free_and_destroy+0x37/0x340

which lock already depends on the new lock.

---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +12 -0
index 8fd38ad8113b..280ea1e1e039 100644
@@ -190,6 +190,14 @@ struct mlx5e_tc_attr_to_reg_mapping mlx5e_tc_attr_to_reg_mappings[] = {
 	[NIC_ZONE_RESTORE_TO_REG] = nic_zone_restore_to_reg_ct,
 };
 
+/* To avoid false lock dependency warning set the tc_ht lock
+ * class different than the lock class of the ht being used when deleting
+ * last flow from a group and then deleting a group, we get into del_sw_flow_group()
+ * which call rhashtable_destroy on fg->ftes_hash which will take ht->mutex but
+ * it's different than the ht->mutex here.
+ */
+static struct lock_class_key tc_ht_lock_key;
+
 static void mlx5e_put_flow_tunnel_id(struct mlx5e_tc_flow *flow);
 
 void
@@ -5215,6 +5223,8 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
 	if (err)
 		return err;
 
+	lockdep_set_class(&tc->ht.mutex, &tc_ht_lock_key);
+
 	if (MLX5_CAP_FLOWTABLE_NIC_RX(priv->mdev, ignore_flow_level)) {
 		attr.flags = MLX5_CHAINS_AND_PRIOS_SUPPORTED |
 			MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED;
@@ -5333,6 +5343,8 @@ int mlx5e_tc_esw_init(struct rhashtable *tc_ht)
 	if (err)
 		goto err_ht_init;
 
+	lockdep_set_class(&tc_ht->mutex, &tc_ht_lock_key);
+
 	return err;
 
 err_ht_init:
Signature · 1 line
2.29.2
#8 lore raw

PATCH 7/14 net/mlx5e: Move representor neigh init into profile enable

In reply to Saeed Mahameed

From: Roi Dayan <[email protected]>

Also cleanup neigh in profile disable.
This is for logical separation.

---
 .../mellanox/mlx5/core/en/rep/neigh.c         | 18 ++++++++----
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 29 ++++++++++---------
 2 files changed, 29 insertions(+), 18 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c +13 -5
index 58e27038c947..616ee585a985 100644
@@ -279,7 +279,7 @@ int mlx5e_rep_neigh_init(struct mlx5e_rep_priv *rpriv)
 
 	err = rhashtable_init(&neigh_update->neigh_ht, &mlx5e_neigh_ht_params);
 	if (err)
-		return err;
+		goto out_err;
 
 	INIT_LIST_HEAD(&neigh_update->neigh_list);
 	mutex_init(&neigh_update->encap_lock);
@@ -287,14 +287,19 @@ int mlx5e_rep_neigh_init(struct mlx5e_rep_priv *rpriv)
 			  mlx5e_rep_neigh_stats_work);
 	mlx5e_rep_neigh_update_init_interval(rpriv);
 
-	rpriv->neigh_update.netevent_nb.notifier_call = mlx5e_rep_netevent_event;
-	err = register_netevent_notifier(&rpriv->neigh_update.netevent_nb);
+	neigh_update->netevent_nb.notifier_call = mlx5e_rep_netevent_event;
+	err = register_netevent_notifier(&neigh_update->netevent_nb);
 	if (err)
-		goto out_err;
+		goto out_notifier;
 	return 0;
 
-out_err:
+out_notifier:
+	neigh_update->netevent_nb.notifier_call = NULL;
 	rhashtable_destroy(&neigh_update->neigh_ht);
+out_err:
+	netdev_warn(rpriv->netdev,
+		    "Failed to initialize neighbours handling for vport %d\n",
+		    rpriv->rep->vport);
 	return err;
 }
 
@@ -303,6 +308,9 @@ void mlx5e_rep_neigh_cleanup(struct mlx5e_rep_priv *rpriv)
 	struct mlx5e_neigh_update_table *neigh_update = &rpriv->neigh_update;
 	struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
 
+	if (!rpriv->neigh_update.netevent_nb.notifier_call)
+		return;
+
 	unregister_netevent_notifier(&neigh_update->netevent_nb);
 
 	flush_workqueue(priv->wq); /* flush neigh update works */
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +16 -13
index 45669a1db426..84eeaa33033f 100644
@@ -1051,7 +1051,17 @@ static void mlx5e_cleanup_rep_tx(struct mlx5e_priv *priv)
 
 static void mlx5e_rep_enable(struct mlx5e_priv *priv)
 {
+	struct mlx5e_rep_priv *rpriv = priv->ppriv;
+
 	mlx5e_set_netdev_mtu_boundaries(priv);
+	mlx5e_rep_neigh_init(rpriv);
+}
+
+static void mlx5e_rep_disable(struct mlx5e_priv *priv)
+{
+	struct mlx5e_rep_priv *rpriv = priv->ppriv;
+
+	mlx5e_rep_neigh_cleanup(rpriv);
 }
 
 static int mlx5e_update_rep_rx(struct mlx5e_priv *priv)
@@ -1086,6 +1096,7 @@ static int uplink_rep_async_event(struct notifier_block *nb, unsigned long event
 
 static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
 {
+	struct mlx5e_rep_priv *rpriv = priv->ppriv;
 	struct net_device *netdev = priv->netdev;
 	struct mlx5_core_dev *mdev = priv->mdev;
 	u16 max_mtu;
@@ -1104,12 +1115,15 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)
 	mlx5_notifier_register(mdev, &priv->events_nb);
 	mlx5e_dcbnl_initialize(priv);
 	mlx5e_dcbnl_init_app(priv);
+	mlx5e_rep_neigh_init(rpriv);
 }
 
 static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)
 {
+	struct mlx5e_rep_priv *rpriv = priv->ppriv;
 	struct mlx5_core_dev *mdev = priv->mdev;
 
+	mlx5e_rep_neigh_cleanup(rpriv);
 	mlx5e_dcbnl_delete_app(priv);
 	mlx5_notifier_unregister(mdev, &priv->events_nb);
 	mlx5e_rep_tc_disable(priv);
@@ -1161,6 +1175,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
 	.init_tx		= mlx5e_init_rep_tx,
 	.cleanup_tx		= mlx5e_cleanup_rep_tx,
 	.enable		        = mlx5e_rep_enable,
+	.disable	        = mlx5e_rep_disable,
 	.update_rx		= mlx5e_update_rep_rx,
 	.update_stats           = mlx5e_stats_update_ndo_stats,
 	.rx_handlers            = &mlx5e_rx_handlers_rep,
@@ -1252,20 +1267,12 @@ mlx5e_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 		goto err_cleanup_profile;
 	}
 
-	err = mlx5e_rep_neigh_init(rpriv);
-	if (err) {
-		netdev_warn(netdev,
-			    "Failed to initialized neighbours handling for vport %d\n",
-			    rep->vport);
-		goto err_detach_netdev;
-	}
-
 	err = register_netdev(netdev);
 	if (err) {
 		netdev_warn(netdev,
 			    "Failed to register representor netdev for vport %d\n",
 			    rep->vport);
-		goto err_neigh_cleanup;
+		goto err_detach_netdev;
 	}
 
 	dl_port = mlx5_esw_offloads_devlink_port(dev->priv.eswitch, rpriv->rep->vport);
@@ -1273,9 +1280,6 @@ mlx5e_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 		devlink_port_type_eth_set(dl_port, netdev);
 	return 0;
 
-err_neigh_cleanup:
-	mlx5e_rep_neigh_cleanup(rpriv);
-
 err_detach_netdev:
 	mlx5e_detach_netdev(netdev_priv(netdev));
 
@@ -1306,7 +1310,6 @@ mlx5e_vport_rep_unload(struct mlx5_eswitch_rep *rep)
 	if (dl_port)
 		devlink_port_type_clear(dl_port);
 	unregister_netdev(netdev);
-	mlx5e_rep_neigh_cleanup(rpriv);
 	mlx5e_detach_netdev(priv);
 	priv->profile->cleanup(priv);
 	if (rep->vport == MLX5_VPORT_UPLINK)
Signature · 1 line
2.29.2
#9 lore raw

PATCH 8/14 net/mlx5e: Enable napi in channel's activation stage

In reply to Saeed Mahameed

From: Tariq Toukan <[email protected]>

The channel's napi is first needed upon activation, not creation. Minimize its enabled scope by moving it from the channel's open/close stage into the activate/deactivate stage.

---
 drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c  | 12 ++++++------
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++++--------
 2 files changed, 12 insertions(+), 14 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +6 -6
index eeddd1137dda..a76cfefec708 100644
@@ -428,16 +428,13 @@ static int mlx5e_ptp_open_queues(struct mlx5e_port_ptp *c,
 	if (err)
 		return err;
 
-	napi_enable(&c->napi);
-
 	err = mlx5e_ptp_open_txqsqs(c, cparams);
 	if (err)
-		goto disable_napi;
+		goto close_cqs;
 
 	return 0;
 
-disable_napi:
-	napi_disable(&c->napi);
+close_cqs:
 	mlx5e_ptp_close_cqs(c);
 
 	return err;
@@ -446,7 +443,6 @@ static int mlx5e_ptp_open_queues(struct mlx5e_port_ptp *c,
 static void mlx5e_ptp_close_queues(struct mlx5e_port_ptp *c)
 {
 	mlx5e_ptp_close_txqsqs(c);
-	napi_disable(&c->napi);
 	mlx5e_ptp_close_cqs(c);
 }
 
@@ -515,6 +511,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_port_ptp *c)
 {
 	int tc;
 
+	napi_enable(&c->napi);
+
 	for (tc = 0; tc < c->num_tc; tc++)
 		mlx5e_activate_txqsq(&c->ptpsq[tc].txqsq);
 }
@@ -525,4 +523,6 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_port_ptp *c)
 
 	for (tc = 0; tc < c->num_tc; tc++)
 		mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq);
+
+	napi_disable(&c->napi);
 }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +6 -8
index b9d2cb6f178d..41c611197211 100644
@@ -1892,13 +1892,11 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
 	if (err)
 		goto err_close_rx_cq;
 
-	napi_enable(&c->napi);
-
 	spin_lock_init(&c->async_icosq_lock);
 
 	err = mlx5e_open_icosq(c, params, &cparam->async_icosq, &c->async_icosq);
 	if (err)
-		goto err_disable_napi;
+		goto err_close_xdpsq_cq;
 
 	err = mlx5e_open_icosq(c, params, &cparam->icosq, &c->icosq);
 	if (err)
@@ -1941,9 +1939,7 @@ static int mlx5e_open_queues(struct mlx5e_channel *c,
 err_close_async_icosq:
 	mlx5e_close_icosq(&c->async_icosq);
 
-err_disable_napi:
-	napi_disable(&c->napi);
-
+err_close_xdpsq_cq:
 	if (c->xdp)
 		mlx5e_close_cq(&c->rq_xdpsq.cq);
 
@@ -1974,7 +1970,6 @@ static void mlx5e_close_queues(struct mlx5e_channel *c)
 	mlx5e_close_sqs(c);
 	mlx5e_close_icosq(&c->icosq);
 	mlx5e_close_icosq(&c->async_icosq);
-	napi_disable(&c->napi);
 	if (c->xdp)
 		mlx5e_close_cq(&c->rq_xdpsq.cq);
 	mlx5e_close_cq(&c->rq.cq);
@@ -2059,6 +2054,8 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
 {
 	int tc;
 
+	napi_enable(&c->napi);
+
 	for (tc = 0; tc < c->num_tc; tc++)
 		mlx5e_activate_txqsq(&c->sq[tc]);
 	mlx5e_activate_icosq(&c->icosq);
@@ -2081,8 +2078,9 @@ static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
 	mlx5e_deactivate_icosq(&c->icosq);
 	for (tc = 0; tc < c->num_tc; tc++)
 		mlx5e_deactivate_txqsq(&c->sq[tc]);
-
 	mlx5e_qos_deactivate_queues(c);
+
+	napi_disable(&c->napi);
 }
 
 static void mlx5e_close_channel(struct mlx5e_channel *c)
Signature · 1 line
2.29.2
#10 lore raw

PATCH 9/14 net/mlx5e: Increase indirection RQ table size to 256

In reply to Saeed Mahameed

From: Noam Stolero <[email protected]>

Increasing the indirection RQ table size from 128 to 256 improves the packet distribution over the NIC HW queues for various cases.

Let's take a look at the following scenario:
Assuming RSS result distributed uniformly and indirection table is filled with queues in a cyclic manner.
Let N be the number of queues on a given setup.
If 256%N = 128%N = 0, then all queues have the same probability to be chosen for a given RSS result.
This case doesn't improves nor degrade by this change.

If 256%N != 0 and 128%N != 0, there is a remainder which will favor some queues. Increasing the indirection RQ table size to 256 reduce the ratio between the favored queues probability to be selected to the rest of the queues and improves the distribution.

For example, let's assume the number of queues is 56.
For a table size of 128, we have 128%56=16 queues which will have a 3/128 probability to be chosen and 2/128 for the rest 40.
16 queues have 1.5 times the probability to be chosen over the other 40.

For a table size of 256, we have 256%56=32 queues which will have a 5/256 probability to be chosen and 4/256 probability for the rest 24 queues. Here 32 queues have 1.25 more probability to be chosen over the other 24.

This shows that the larger indirection table size would more likely cause an even distribution.

This change also aligns our mlx5 driver's indirection table size with other vendors.

---
 drivers/net/ethernet/mellanox/mlx5/core/en.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +2 -2
index 8cc80c31341f..a8e31cdd4a4e 100644
@@ -137,10 +137,10 @@ struct page_pool;
 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES                0x80
 #define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW            0x2
 
-#define MLX5E_LOG_INDIR_RQT_SIZE       0x7
+#define MLX5E_LOG_INDIR_RQT_SIZE       0x8
 #define MLX5E_INDIR_RQT_SIZE           BIT(MLX5E_LOG_INDIR_RQT_SIZE)
 #define MLX5E_MIN_NUM_CHANNELS         0x1
-#define MLX5E_MAX_NUM_CHANNELS         MLX5E_INDIR_RQT_SIZE
+#define MLX5E_MAX_NUM_CHANNELS         (MLX5E_INDIR_RQT_SIZE / 2)
 #define MLX5E_MAX_NUM_SQS              (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC)
 #define MLX5E_TX_CQ_POLL_BUDGET        128
 #define MLX5E_TX_XSK_POLL_BUDGET       64
Signature · 1 line
2.29.2
#11 lore raw

PATCH 10/14 net/mlx5e: remove h from printk format specifier

In reply to Saeed Mahameed

From: Tom Rix <[email protected]>

This change fixes the checkpatch warning described in this commit
commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]")

Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi].

---
 drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 -1
index 43271a3856ca..36381a2ed5a5 100644
@@ -179,7 +179,7 @@ int mlx5e_validate_params(struct mlx5e_priv *priv, struct mlx5e_params *params)
 
 	stop_room = mlx5e_calc_sq_stop_room(priv->mdev, params);
 	if (stop_room >= sq_size) {
-		netdev_err(priv->netdev, "Stop room %hu is bigger than the SQ size %zu\n",
+		netdev_err(priv->netdev, "Stop room %u is bigger than the SQ size %zu\n",
 			   stop_room, sq_size);
 		return -EINVAL;
 	}
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
index 41c611197211..2a6f9d042f51 100644
@@ -3888,7 +3888,7 @@ static int set_feature_lro(struct net_device *netdev, bool enable)
 	mutex_lock(&priv->state_lock);
 
 	if (enable && priv->xsk.refcnt) {
-		netdev_warn(netdev, "LRO is incompatible with AF_XDP (%hu XSKs are active)\n",
+		netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n",
 			    priv->xsk.refcnt);
 		err = -EINVAL;
 		goto out;
@@ -4139,7 +4139,7 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,
 			max_mtu_page = mlx5e_xdp_max_mtu(new_params, &xsk);
 			max_mtu = min(max_mtu_frame, max_mtu_page);
 
-			netdev_err(netdev, "MTU %d is too big for an XSK running on channel %hu. Try MTU <= %d\n",
+			netdev_err(netdev, "MTU %d is too big for an XSK running on channel %u. Try MTU <= %d\n",
 				   new_params->sw_mtu, ix, max_mtu);
 			return false;
 		}
Signature · 1 line
2.29.2
#12 lore raw

PATCH 11/14 net/mlx5e: kTLS, Improve TLS RX workqueue scope

In reply to Saeed Mahameed

From: Tariq Toukan <[email protected]>

The TLS RX workqueue is needed only when kTLS RX device offload is supported.

Move its creation from the general TLS init function to the kTLS RX init.
Create it once at init time if supported, avoid creation/destroy everytime the feature bit is toggled.

---
 .../mellanox/mlx5/core/en_accel/ktls.c        | 24 ++++++++++++++++---
 .../mellanox/mlx5/core/en_accel/tls.c         |  7 ------
 2 files changed, 21 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +21 -3
index 1b392696280d..95293ee0d38d 100644
@@ -2,6 +2,7 @@
 // Copyright (c) 2019 Mellanox Technologies.
 
 #include "en.h"
+#include "en_accel/tls.h"
 #include "en_accel/ktls.h"
 #include "en_accel/ktls_utils.h"
 #include "en_accel/fs_tcp.h"
@@ -86,16 +87,33 @@ int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable)
 
 int mlx5e_ktls_init_rx(struct mlx5e_priv *priv)
 {
-	int err = 0;
+	int err;
 
-	if (priv->netdev->features & NETIF_F_HW_TLS_RX)
+	if (!mlx5_accel_is_ktls_rx(priv->mdev))
+		return 0;
+
+	priv->tls->rx_wq = create_singlethread_workqueue("mlx5e_tls_rx");
+	if (!priv->tls->rx_wq)
+		return -ENOMEM;
+
+	if (priv->netdev->features & NETIF_F_HW_TLS_RX) {
 		err = mlx5e_accel_fs_tcp_create(priv);
+		if (err) {
+			destroy_workqueue(priv->tls->rx_wq);
+			return err;
+		}
+	}
 
-	return err;
+	return 0;
 }
 
 void mlx5e_ktls_cleanup_rx(struct mlx5e_priv *priv)
 {
+	if (!mlx5_accel_is_ktls_rx(priv->mdev))
+		return;
+
 	if (priv->netdev->features & NETIF_F_HW_TLS_RX)
 		mlx5e_accel_fs_tcp_destroy(priv);
+
+	destroy_workqueue(priv->tls->rx_wq);
 }
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c +0 -7
index fee991f5ee7c..d6b21b899dbc 100644
@@ -231,12 +231,6 @@ int mlx5e_tls_init(struct mlx5e_priv *priv)
 	if (!tls)
 		return -ENOMEM;
 
-	tls->rx_wq = create_singlethread_workqueue("mlx5e_tls_rx");
-	if (!tls->rx_wq) {
-		kfree(tls);
-		return -ENOMEM;
-	}
-
 	priv->tls = tls;
 	return 0;
 }
@@ -248,7 +242,6 @@ void mlx5e_tls_cleanup(struct mlx5e_priv *priv)
 	if (!tls)
 		return;
 
-	destroy_workqueue(tls->rx_wq);
 	kfree(tls);
 	priv->tls = NULL;
 }
Signature · 1 line
2.29.2
#13 lore raw

PATCH 12/14 net/mlx5e: accel, remove redundant space

In reply to Saeed Mahameed

From: Saeed Mahameed <[email protected]>

---
 drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h +1 -1
index 6488098d2700..959bb6cd7203 100644
@@ -85,7 +85,7 @@ mlx5e_tx_tunnel_accel(struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg, u16 ih
 	}
 
 	mlx5e_set_eseg_swp(skb, eseg, &swp_spec);
-	if (skb_vlan_tag_present(skb) &&  ihs)
+	if (skb_vlan_tag_present(skb) && ihs)
 		mlx5e_eseg_swp_offsets_add_vlan(eseg);
 }
 
Signature · 1 line
2.29.2
#14 lore raw

PATCH 13/14 net/mlx5e: CT: remove useless conversion to PTR_ERR then ERR_PTR

In reply to Saeed Mahameed

From: Saeed Mahameed <[email protected]>

Just return the ptr directly.

---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +2 -5
index e417904ae17f..40aaa105b2fc 100644
@@ -770,7 +770,6 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
 	struct mlx5_ct_counter *shared_counter;
 	struct mlx5_ct_entry *rev_entry;
 	__be16 tmp_port;
-	int ret;
 
 	/* get the reversed tuple */
 	tmp_port = rev_tuple.port.src;
@@ -804,10 +803,8 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv,
 	mutex_unlock(&ct_priv->shared_counter_lock);
 
 	shared_counter = mlx5_tc_ct_counter_create(ct_priv);
-	if (IS_ERR(shared_counter)) {
-		ret = PTR_ERR(shared_counter);
-		return ERR_PTR(ret);
-	}
+	if (IS_ERR(shared_counter))
+		return shared_counter;
 
 	shared_counter->is_shared = true;
 	refcount_set(&shared_counter->refcount, 1);
Signature · 1 line
2.29.2
#15 lore raw

PATCH 14/14 net/mlx5: DR, Avoid unnecessary csum recalculation on supporting devices

In reply to Saeed Mahameed

From: Yevgeny Kliteynik <[email protected]>

If as part of the actions the TTL of the packet is modified, the packet's checksum needs to be recalculated. Connect-X6DX can handle this csum recalculation natively. Older devices require this additional recalculation.

---
 .../net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 9 +++++----
 .../net/ethernet/mellanox/mlx5/core/steering/dr_ste.c    | 5 +++++
 .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h  | 2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +5 -4
index 27c2b8416d02..28a7971cac6a 100644
@@ -447,7 +447,8 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
 		case DR_ACTION_TYP_MODIFY_HDR:
 			attr.modify_index = action->rewrite.index;
 			attr.modify_actions = action->rewrite.num_of_actions;
-			recalc_cs_required = action->rewrite.modify_ttl;
+			recalc_cs_required = action->rewrite.modify_ttl &&
+					     !mlx5dr_ste_supp_ttl_cs_recalc(&dmn->info.caps);
 			break;
 		case DR_ACTION_TYP_L2_TO_TNL_L2:
 		case DR_ACTION_TYP_L2_TO_TNL_L3:
@@ -501,9 +502,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
 	*new_hw_ste_arr_sz = nic_matcher->num_of_builders;
 	last_ste = ste_arr + DR_STE_SIZE * (nic_matcher->num_of_builders - 1);
 
-	/* Due to a HW bug, modifying TTL on RX flows will cause an incorrect
-	 * checksum calculation. In this case we will use a FW table to
-	 * recalculate.
+	/* Due to a HW bug in some devices, modifying TTL on RX flows will
+	 * cause an incorrect checksum calculation. In this case we will
+	 * use a FW table to recalculate.
 	 */
 	if (dmn->type == MLX5DR_DOMAIN_TYPE_FDB &&
 	    rx_rule && recalc_cs_required && dest_action) {
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +5 -0
index 9cd5c50c5d42..f49abc7a4b9b 100644
@@ -18,6 +18,11 @@ static u32 dr_ste_crc32_calc(const void *input_data, size_t length)
 	return (__force u32)htonl(crc);
 }
 
+bool mlx5dr_ste_supp_ttl_cs_recalc(struct mlx5dr_cmd_caps *caps)
+{
+	return caps->sw_format_ver > MLX5_STEERING_FORMAT_CONNECTX_5;
+}
+
 u32 mlx5dr_ste_calc_hash_index(u8 *hw_ste_p, struct mlx5dr_ste_htbl *htbl)
 {
 	struct dr_hw_ste_format *hw_ste = (struct dr_hw_ste_format *)hw_ste_p;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +2 -0
index a8b497cbb844..4af0e4e6a13c 100644
@@ -1211,6 +1211,8 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev,
 		       u32 group_id,
 		       struct mlx5dr_cmd_fte_info *fte);
 
+bool mlx5dr_ste_supp_ttl_cs_recalc(struct mlx5dr_cmd_caps *caps);
+
 struct mlx5dr_fw_recalc_cs_ft {
 	u64 rx_icm_addr;
 	u32 table_id;
Signature · 1 line
2.29.2