netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7
@ 2015-10-27 15:36 Or Gerlitz
  2015-10-27 15:36 ` [PATCH net 1/2] net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no vlan is present Or Gerlitz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Or Gerlitz @ 2015-10-27 15:36 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Or Gerlitz

Hi Dave,

Jack's fix is for a regression introduced in 4.3-rc1

Carol's fix addresses an issue which exists for while and 
turns to beat us hard on PPC, please queue for -stable. 

Or.

Carol L Soto (1):
  net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes

Jack Morgenstein (1):
  net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no
    vlan is present

 drivers/net/ethernet/mellanox/mlx4/cmd.c   | 2 +-
 drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 ++
 drivers/net/ethernet/mellanox/mlx4/eq.c    | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.3.7

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

* [PATCH net 1/2] net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no vlan is present
  2015-10-27 15:36 [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 Or Gerlitz
@ 2015-10-27 15:36 ` Or Gerlitz
  2015-10-27 15:36 ` [PATCH net 2/2] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes Or Gerlitz
  2015-10-28  3:29 ` [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2015-10-27 15:36 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Jack Morgenstein, Or Gerlitz

From: Jack Morgenstein <jackm@dev.mellanox.co.il>

We do not set the ins_vlan field to zero when no vlan id is present in the packet.

Since WQEs in the TX ring are not zeroed out between uses, this oversight
could result in having vlan flags present in the WQE ctrl segment when no
vlan is preset.

Fixes: e38af4faf01d ('net/mlx4_en: Add support for hardware accelerated 802.1ad vlan')
Reported-by: Gideon Naim <gideonn@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 494e776..4421bf5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -964,6 +964,8 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 			tx_desc->ctrl.ins_vlan = MLX4_WQE_CTRL_INS_SVLAN;
 		else if (vlan_proto == ETH_P_8021Q)
 			tx_desc->ctrl.ins_vlan = MLX4_WQE_CTRL_INS_CVLAN;
+		else
+			tx_desc->ctrl.ins_vlan = 0;
 
 		tx_desc->ctrl.fence_size = real_size;
 
-- 
2.3.7

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

* [PATCH net 2/2] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes
  2015-10-27 15:36 [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 Or Gerlitz
  2015-10-27 15:36 ` [PATCH net 1/2] net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no vlan is present Or Gerlitz
@ 2015-10-27 15:36 ` Or Gerlitz
  2015-10-28  3:29 ` [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2015-10-27 15:36 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Carol L Soto, Jack Morgenstein, Or Gerlitz

From: Carol L Soto <clsoto@linux.vnet.ibm.com>

When doing memcpy/memset of EQEs, we should use sizeof struct
mlx4_eqe as the base size and not caps.eqe_size which could be bigger.

If caps.eqe_size is bigger than the struct mlx4_eqe then we corrupt
data in the master context.

When using a 64 byte stride, the memcpy copied over 63 bytes to the
slave_eq structure.  This resulted in copying over the entire eqe of
interest, including its ownership bit -- and also 31 bytes of garbage
into the next WQE in the slave EQ -- which did NOT include the ownership
bit (and therefore had no impact).

However, once the stride is increased to 128, we are overwriting the
ownership bits of *three* eqes in the slave_eq struct.  This results
in an incorrect ownership bit for those eqes, which causes the eq to
seem to be full. The issue therefore surfaced only once 128-byte EQEs
started being used in SRIOV and (overarchitectures that have 128/256
byte cache-lines such as PPC) - e.g after commit 77507aa249ae
"net/mlx4_core: Enable CQE/EQE stride support".

Fixes: 08ff32352d6f ('mlx4: 64-byte CQE/EQE support')
Signed-off-by: Carol L Soto <clsoto@linux.vnet.ibm.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/cmd.c | 2 +-
 drivers/net/ethernet/mellanox/mlx4/eq.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 0a32020..2177e56 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2398,7 +2398,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
 			}
 		}
 
-		memset(&priv->mfunc.master.cmd_eqe, 0, dev->caps.eqe_size);
+		memset(&priv->mfunc.master.cmd_eqe, 0, sizeof(struct mlx4_eqe));
 		priv->mfunc.master.cmd_eqe.type = MLX4_EVENT_TYPE_CMD;
 		INIT_WORK(&priv->mfunc.master.comm_work,
 			  mlx4_master_comm_channel);
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index c344884..603d1c3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -196,7 +196,7 @@ static void slave_event(struct mlx4_dev *dev, u8 slave, struct mlx4_eqe *eqe)
 		return;
 	}
 
-	memcpy(s_eqe, eqe, dev->caps.eqe_size - 1);
+	memcpy(s_eqe, eqe, sizeof(struct mlx4_eqe) - 1);
 	s_eqe->slave_id = slave;
 	/* ensure all information is written before setting the ownersip bit */
 	dma_wmb();
-- 
2.3.7

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

* Re: [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7
  2015-10-27 15:36 [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 Or Gerlitz
  2015-10-27 15:36 ` [PATCH net 1/2] net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no vlan is present Or Gerlitz
  2015-10-27 15:36 ` [PATCH net 2/2] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes Or Gerlitz
@ 2015-10-28  3:29 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-10-28  3:29 UTC (permalink / raw)
  To: ogerlitz; +Cc: netdev

From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Tue, 27 Oct 2015 17:36:18 +0200

> Jack's fix is for a regression introduced in 4.3-rc1
> 
> Carol's fix addresses an issue which exists for while and 
> turns to beat us hard on PPC, please queue for -stable. 

Series applied, and patch #2 queued up for -stable.

Thanks.

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

end of thread, other threads:[~2015-10-28  3:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-27 15:36 [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 Or Gerlitz
2015-10-27 15:36 ` [PATCH net 1/2] net/mlx4_en: Explicitly set no vlan tags in WQE ctrl segment when no vlan is present Or Gerlitz
2015-10-27 15:36 ` [PATCH net 2/2] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes Or Gerlitz
2015-10-28  3:29 ` [PATCH net 0/2] Mellanox mlx4 driver fixes for 4.3-rc7 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).