All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1
@ 2017-02-22 15:20 Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 1/6] net/mlx5e: s390 system compilation fix Saeed Mahameed
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed

Hi Dave,

This series includes some important bug fixes for mlx5e driver.

Three misc fixes:
>From Mohamad, compilation fix on s390 system
>From Me, A fix for driver unload when switchdev mode is on. 
>From Tariq, HW LRO frag size optimization for when build_skb is not used
(striding RQ mode).

Three CQE compression related fixes:
Two fixes from Tariq and I, to correctly setup CQE compression
parameters on driver load and on arbitrary user modifications.
Last patch, fixes a very critical issue that was originally reported
by Tom, where the driver reported csum errors or even page ref issues
for when cqe compression is enabled and rapidly active.

For your convenience this series was generated on top of net-next branch:
005c3490e9db ('Revert "ath10k: Search SMBIOS for OEM board file extension"')

for -stable:
net/mlx5e: Register/unregister vport representors on interface (for kernel >= 4.9)
net/mlx5e: Do not reduce LRO WQE size when not using build_skb (for kernel >= 4.9)
net/mlx5e: Fix broken CQE compression initialization (for kernel >= 4.9)
net/mlx5e: Update MPWQE stride size when modifying CQE compress state (for kernel >= 4.7)
net/mlx5e: Fix wrong CQE decompression (for kernel >= 4.7)

Thanks,
Saeed.

Mohamad Haj Yahia (1):
  net/mlx5e: s390 system compilation fix

Saeed Mahameed (2):
  net/mlx5e: Register/unregister vport representors on interface
    attach/detach
  net/mlx5e: Update MPWQE stride size when modifying CQE compress state

Tariq Toukan (3):
  net/mlx5e: Do not reduce LRO WQE size when not using build_skb
  net/mlx5e: Fix broken CQE compression initialization
  net/mlx5e: Fix wrong CQE decompression

 drivers/net/ethernet/mellanox/mlx5/core/en.h       |  1 +
 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  | 40 +++++++++++++---------
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    | 15 ++++----
 .../net/ethernet/mellanox/mlx5/core/en_selftest.c  |  1 +
 5 files changed, 35 insertions(+), 23 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net 1/6] net/mlx5e: s390 system compilation fix
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 2/6] net/mlx5e: Register/unregister vport representors on interface attach/detach Saeed Mahameed
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Mohamad Haj Yahia, Saeed Mahameed

From: Mohamad Haj Yahia <mohamad@mellanox.com>

Add necessary headers include for s390 arch compilation.

Fixes: e586b3b0baee ("net/mlx5: Ethernet Datapath files")
Fixes: d605d6686dc7 ("net/mlx5e: Add support for ethtool self..")
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c       | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index b039b87742a6..9fad22768aab 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  */
 
+#include <linux/prefetch.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/tcp.h>
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
index 65442c36a6e1..31e3cb7ee5fe 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
@@ -30,6 +30,7 @@
  * SOFTWARE.
  */
 
+#include <linux/prefetch.h>
 #include <linux/ip.h>
 #include <linux/udp.h>
 #include <net/udp.h>
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 2/6] net/mlx5e: Register/unregister vport representors on interface attach/detach
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 1/6] net/mlx5e: s390 system compilation fix Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb Saeed Mahameed
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed

Currently vport representors are added only on driver load and removed on
driver unload.  Apparently we forgot to handle them when we added the
seamless reset flow feature.  This caused to leave the representors
netdevs alive and active with open HW resources on pci shutdown and on
error reset flows.

To overcome this we move their handling to interface attach/detach, so
they would be cleaned up on shutdown and recreated on reset flows.

Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 3cce6281e075..c24366868b39 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3970,6 +3970,19 @@ static void mlx5e_register_vport_rep(struct mlx5_core_dev *mdev)
 	}
 }
 
+static void mlx5e_unregister_vport_rep(struct mlx5_core_dev *mdev)
+{
+	struct mlx5_eswitch *esw = mdev->priv.eswitch;
+	int total_vfs = MLX5_TOTAL_VPORTS(mdev);
+	int vport;
+
+	if (!MLX5_CAP_GEN(mdev, vport_group_manager))
+		return;
+
+	for (vport = 1; vport < total_vfs; vport++)
+		mlx5_eswitch_unregister_vport_rep(esw, vport);
+}
+
 void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
 {
 	struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4016,6 +4029,7 @@ static int mlx5e_attach(struct mlx5_core_dev *mdev, void *vpriv)
 		return err;
 	}
 
+	mlx5e_register_vport_rep(mdev);
 	return 0;
 }
 
@@ -4027,6 +4041,7 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
 	if (!netif_device_present(netdev))
 		return;
 
+	mlx5e_unregister_vport_rep(mdev);
 	mlx5e_detach_netdev(mdev, netdev);
 	mlx5e_destroy_mdev_resources(mdev);
 }
@@ -4045,8 +4060,6 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
 	if (err)
 		return NULL;
 
-	mlx5e_register_vport_rep(mdev);
-
 	if (MLX5_CAP_GEN(mdev, vport_group_manager))
 		ppriv = &esw->offloads.vport_reps[0];
 
@@ -4098,13 +4111,7 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv)
 
 static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
 {
-	struct mlx5_eswitch *esw = mdev->priv.eswitch;
-	int total_vfs = MLX5_TOTAL_VPORTS(mdev);
 	struct mlx5e_priv *priv = vpriv;
-	int vport;
-
-	for (vport = 1; vport < total_vfs; vport++)
-		mlx5_eswitch_unregister_vport_rep(esw, vport);
 
 	unregister_netdev(priv->netdev);
 	mlx5e_detach(mdev, vpriv);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 1/6] net/mlx5e: s390 system compilation fix Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 2/6] net/mlx5e: Register/unregister vport representors on interface attach/detach Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-22 19:45   ` Alexei Starovoitov
  2017-02-22 15:20 ` [PATCH net 4/6] net/mlx5e: Fix broken CQE compression initialization Saeed Mahameed
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

When rq_type is Striding RQ, no room of SKB_RESERVE is needed
as SKB allocation is not done via build_skb.

Fixes: e4b85508072b ("net/mlx5e: Slightly reduce hardware LRO size")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index c24366868b39..0d58729b42ae 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -82,6 +82,7 @@ static bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev)
 static void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
 {
 	priv->params.rq_wq_type = rq_type;
+	priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
 	switch (priv->params.rq_wq_type) {
 	case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
 		priv->params.log_rq_size = is_kdump_kernel() ?
@@ -98,6 +99,10 @@ static void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
 		priv->params.log_rq_size = is_kdump_kernel() ?
 			MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE :
 			MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE;
+
+		/* Extra room needed for build_skb */
+		priv->params.lro_wqe_sz -= MLX5_RX_HEADROOM +
+			SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 	}
 	priv->params.min_rx_wqes = mlx5_min_rx_wqes(priv->params.rq_wq_type,
 					       BIT(priv->params.log_rq_size));
@@ -3547,12 +3552,6 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
 	mlx5e_build_default_indir_rqt(mdev, priv->params.indirection_rqt,
 				      MLX5E_INDIR_RQT_SIZE, profile->max_nch(mdev));
 
-	priv->params.lro_wqe_sz =
-		MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ -
-		/* Extra room needed for build_skb */
-		MLX5_RX_HEADROOM -
-		SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
-
 	/* Initialize pflags */
 	MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER,
 			priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 4/6] net/mlx5e: Fix broken CQE compression initialization
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2017-02-22 15:20 ` [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 5/6] net/mlx5e: Update MPWQE stride size when modifying CQE compress state Saeed Mahameed
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, kernel-team, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

Some of RQ type parameters are derived from CQE compression state flag,
CQE compression flag was initialized only after RQ type parameters
setup. This leads to load RQ with stride size smaller than what we
want for when CQE compression is on.

This bug introduces no functional damage, it only makes CQE compression
occur less often, since in ConnectX4-LX CQE compression is performed
only on packets smaller than stride size.

Fix this by marking default status of CQE compression in PFLAG prior to
calling mlx5e_set_rq_priv_params(), as it inits some fields based on it.

Tested:
 load driver on systems where rx CQE compress will be on (MH)
 pktgen with  64 < pkt size < 256 and netperf TCP_STREAM (IPv4/IPv6)
 verify `ethtool -S ethxx | grep compress` are advancing more often
 (rapidly)

Fixes: 2fc4bfb7250d ("net/mlx5e: Dynamic RQ type infrastructure")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Cc: kernel-team@fb.com
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 0d58729b42ae..dc621bc4e173 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3526,6 +3526,9 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
 			cqe_compress_heuristic(link_speed, pci_bw);
 	}
 
+	MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS,
+			priv->params.rx_cqe_compress_def);
+
 	mlx5e_set_rq_priv_params(priv);
 	if (priv->params.rq_wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
 		priv->params.lro_en = true;
@@ -3555,7 +3558,6 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
 	/* Initialize pflags */
 	MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER,
 			priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
-	MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS, priv->params.rx_cqe_compress_def);
 
 	mutex_init(&priv->state_lock);
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 5/6] net/mlx5e: Update MPWQE stride size when modifying CQE compress state
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2017-02-22 15:20 ` [PATCH net 4/6] net/mlx5e: Fix broken CQE compression initialization Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-22 15:20 ` [PATCH net 6/6] net/mlx5e: Fix wrong CQE decompression Saeed Mahameed
  2017-02-23 15:44 ` [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 David Miller
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed, kernel-team

When the admin enables/disables cqe compression, updating
mpwqe stride size is required:
    CQE compress ON  ==> stride size = 256B
    CQE compress OFF ==> stride size = 64B

This is already done on driver load via mlx5e_set_rq_type_params, all we
need is just to call it on arbitrary admin changes of cqe compression
state via priv flags or when changing timestamping state
(as it is mutually exclusive with cqe compression).

This bug introduces no functional damage, it only makes cqe compression
occur less often, since in ConnectX4-LX CQE compression is performed
only on packets smaller than stride size.

Tested:
 ethtool --set-priv-flags ethxx rx_cqe_compress on
 pktgen with  64 < pkt size < 256 and netperf TCP_STREAM (IPv4/IPv6)
 verify `ethtool -S ethxx | grep compress` are advancing more often
 (rapidly)

Fixes: 7219ab34f184 ("net/mlx5e: CQE compression")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Cc: kernel-team@fb.com
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h         | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 +
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c    | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c      | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index 95ca03c0d9f5..f6a6ded204f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -816,6 +816,7 @@ int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
 
 void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
 				 u8 cq_period_mode);
+void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type);
 
 static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
 				      struct mlx5_wqe_ctrl_seg *ctrl, int bf_sz)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc80522b5854..a004a5a1a4c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1487,6 +1487,7 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,
 
 	mlx5e_modify_rx_cqe_compression_locked(priv, enable);
 	priv->params.rx_cqe_compress_def = enable;
+	mlx5e_set_rq_type_params(priv, priv->params.rq_wq_type);
 
 	return 0;
 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index dc621bc4e173..8ef64c4db2c2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -79,7 +79,7 @@ static bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev)
 		MLX5_CAP_ETH(mdev, reg_umr_sq);
 }
 
-static void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
+void mlx5e_set_rq_type_params(struct mlx5e_priv *priv, u8 rq_type)
 {
 	priv->params.rq_wq_type = rq_type;
 	priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 9fad22768aab..d5ce20db3f0b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -172,6 +172,7 @@ void mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val)
 		mlx5e_close_locked(priv->netdev);
 
 	MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_COMPRESS, val);
+	mlx5e_set_rq_type_params(priv, priv->params.rq_wq_type);
 
 	if (was_opened)
 		mlx5e_open_locked(priv->netdev);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net 6/6] net/mlx5e: Fix wrong CQE decompression
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2017-02-22 15:20 ` [PATCH net 5/6] net/mlx5e: Update MPWQE stride size when modifying CQE compress state Saeed Mahameed
@ 2017-02-22 15:20 ` Saeed Mahameed
  2017-02-23 15:44 ` [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 David Miller
  6 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-22 15:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, kernel-team, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

In cqe compression with striding RQ, the decompression of the CQE field
wqe_counter was done with a wrong wraparound value.
This caused handling cqes with a wrong pointer to wqe (rx descriptor)
and creating SKBs with wrong data, pointing to wrong (and already consumed)
strides/pages.

The meaning of the CQE field wqe_counter in striding RQ holds the
stride index instead of the WQE index. Hence, when decompressing
a CQE, wqe_counter should have wrapped-around the number of strides
in a single multi-packet WQE.

We dropped this wrap-around mask at all in CQE decompression of striding
RQ. It is not needed as in such cases the CQE compression session would
break because of different value of wqe_id field, starting a new
compression session.

Tested:
 ethtool -K ethxx lro off/on
 ethtool --set-priv-flags ethxx rx_cqe_compress on
 super_netperf 16 {ipv4,ipv6} -t TCP_STREAM -m 50 -D
 verified no csum errors and no page refcount issues.

Fixes: 7219ab34f184 ("net/mlx5e: CQE compression")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reported-by: Tom Herbert <tom@herbertland.com>
Cc: kernel-team@fb.com
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index d5ce20db3f0b..3d371688fbbb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -94,19 +94,18 @@ static inline void mlx5e_cqes_update_owner(struct mlx5e_cq *cq, u32 cqcc, int n)
 static inline void mlx5e_decompress_cqe(struct mlx5e_rq *rq,
 					struct mlx5e_cq *cq, u32 cqcc)
 {
-	u16 wqe_cnt_step;
-
 	cq->title.byte_cnt     = cq->mini_arr[cq->mini_arr_idx].byte_cnt;
 	cq->title.check_sum    = cq->mini_arr[cq->mini_arr_idx].checksum;
 	cq->title.op_own      &= 0xf0;
 	cq->title.op_own      |= 0x01 & (cqcc >> cq->wq.log_sz);
 	cq->title.wqe_counter  = cpu_to_be16(cq->decmprs_wqe_counter);
 
-	wqe_cnt_step =
-		rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ?
-		mpwrq_get_cqe_consumed_strides(&cq->title) : 1;
-	cq->decmprs_wqe_counter =
-		(cq->decmprs_wqe_counter + wqe_cnt_step) & rq->wq.sz_m1;
+	if (rq->wq_type == MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ)
+		cq->decmprs_wqe_counter +=
+			mpwrq_get_cqe_consumed_strides(&cq->title);
+	else
+		cq->decmprs_wqe_counter =
+			(cq->decmprs_wqe_counter + 1) & rq->wq.sz_m1;
 }
 
 static inline void mlx5e_decompress_cqe_no_hash(struct mlx5e_rq *rq,
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb
  2017-02-22 15:20 ` [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb Saeed Mahameed
@ 2017-02-22 19:45   ` Alexei Starovoitov
  2017-02-23 11:37     ` Saeed Mahameed
  0 siblings, 1 reply; 10+ messages in thread
From: Alexei Starovoitov @ 2017-02-22 19:45 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: David S. Miller, netdev, Tariq Toukan

On Wed, Feb 22, 2017 at 7:20 AM, Saeed Mahameed <saeedm@mellanox.com> wrote:
> From: Tariq Toukan <tariqt@mellanox.com>
>
> When rq_type is Striding RQ, no room of SKB_RESERVE is needed
> as SKB allocation is not done via build_skb.
>
> Fixes: e4b85508072b ("net/mlx5e: Slightly reduce hardware LRO size")
> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>

why this one is a bug fix?
Sound like an optimization from commit log.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb
  2017-02-22 19:45   ` Alexei Starovoitov
@ 2017-02-23 11:37     ` Saeed Mahameed
  0 siblings, 0 replies; 10+ messages in thread
From: Saeed Mahameed @ 2017-02-23 11:37 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: Saeed Mahameed, David S. Miller, netdev, Tariq Toukan

On Wed, Feb 22, 2017 at 9:45 PM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Wed, Feb 22, 2017 at 7:20 AM, Saeed Mahameed <saeedm@mellanox.com> wrote:
>> From: Tariq Toukan <tariqt@mellanox.com>
>>
>> When rq_type is Striding RQ, no room of SKB_RESERVE is needed
>> as SKB allocation is not done via build_skb.
>>
>> Fixes: e4b85508072b ("net/mlx5e: Slightly reduce hardware LRO size")
>> Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
>> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
>
> why this one is a bug fix?
> Sound like an optimization from commit log.

It is a regression since  ("net/mlx5e: Slightly reduce hardware LRO size").
And we see due to this a small drop in HW LRO performance.
We just fixed the LRO size to be the same as it was before the
offending patch for striding RQ case.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1
  2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
                   ` (5 preceding siblings ...)
  2017-02-22 15:20 ` [PATCH net 6/6] net/mlx5e: Fix wrong CQE decompression Saeed Mahameed
@ 2017-02-23 15:44 ` David Miller
  6 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2017-02-23 15:44 UTC (permalink / raw)
  To: saeedm; +Cc: netdev, tariqt

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Wed, 22 Feb 2017 17:20:10 +0200

> This series includes some important bug fixes for mlx5e driver.
> 
> Three misc fixes:
> From Mohamad, compilation fix on s390 system
> From Me, A fix for driver unload when switchdev mode is on. 
> From Tariq, HW LRO frag size optimization for when build_skb is not used
> (striding RQ mode).
> 
> Three CQE compression related fixes:
> Two fixes from Tariq and I, to correctly setup CQE compression
> parameters on driver load and on arbitrary user modifications.
> Last patch, fixes a very critical issue that was originally reported
> by Tom, where the driver reported csum errors or even page ref issues
> for when cqe compression is enabled and rapidly active.
> 
> For your convenience this series was generated on top of net-next branch:
> 005c3490e9db ('Revert "ath10k: Search SMBIOS for OEM board file extension"')

Series applied.

> for -stable:
> net/mlx5e: Register/unregister vport representors on interface (for kernel >= 4.9)
> net/mlx5e: Do not reduce LRO WQE size when not using build_skb (for kernel >= 4.9)
> net/mlx5e: Fix broken CQE compression initialization (for kernel >= 4.9)
> net/mlx5e: Update MPWQE stride size when modifying CQE compress state (for kernel >= 4.7)
> net/mlx5e: Fix wrong CQE decompression (for kernel >= 4.7)

Queued up, thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-02-23 15:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-22 15:20 [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 1/6] net/mlx5e: s390 system compilation fix Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 2/6] net/mlx5e: Register/unregister vport representors on interface attach/detach Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 3/6] net/mlx5e: Do not reduce LRO WQE size when not using build_skb Saeed Mahameed
2017-02-22 19:45   ` Alexei Starovoitov
2017-02-23 11:37     ` Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 4/6] net/mlx5e: Fix broken CQE compression initialization Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 5/6] net/mlx5e: Update MPWQE stride size when modifying CQE compress state Saeed Mahameed
2017-02-22 15:20 ` [PATCH net 6/6] net/mlx5e: Fix wrong CQE decompression Saeed Mahameed
2017-02-23 15:44 ` [PATCH net 0/6] Mellanox mlx5e fixes for 4.11-rc1 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.