All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07
@ 2016-09-07 16:07 Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 1/5] net/mlx5e: Fix xmit_more counter race issue Saeed Mahameed
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:07 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Saeed Mahameed

Hi Dave,

The following series contains bug fixes for the mlx5e driver.

from Gal,
	- Static code checker cleanup (casting overflow)
	- Fix global PFC counter statistics reading
	- Fix HW LRO when vlan stripping is off

>From Bodong,
	- Deprecate old autoneg capability bit and use new one.

>From Tariq,
	- Fix xmit more counter race condition


For -stable:
('net/mlx5e: Fix parsing of vlan packets when updating lro header')

No conflicts are introduced with the mlx5 ongoing net-next submission.

Thanks,
Saeed.

Bodong Wang (1):
  net/mlx5e: Move an_disable_cap bit to a new position

Gal Pressman (3):
  net/mlx5e: Prevent casting overflow
  net/mlx5e: Fix global PFC counters replication
  net/mlx5e: Fix parsing of vlan packets when updating lro header

Tariq Toukan (1):
  net/mlx5e: Fix xmit_more counter race issue

 .../net/ethernet/mellanox/mlx5/core/en_ethtool.c   |  8 +++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    | 22 +++++++++++++++-------
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |  2 +-
 include/linux/mlx5/mlx5_ifc.h                      |  5 +++--
 4 files changed, 24 insertions(+), 13 deletions(-)

-- 
2.7.4

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

* [PATCH net 1/5] net/mlx5e: Fix xmit_more counter race issue
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
@ 2016-09-07 16:07 ` Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 2/5] net/mlx5e: Move an_disable_cap bit to a new position Saeed Mahameed
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:07 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tariq Toukan, Saeed Mahameed

From: Tariq Toukan <tariqt@mellanox.com>

Update the xmit_more counter before notifying the HW,
to prevent a possible use-after-free of the skb.

Fixes: c8cf78fe100b ("net/mlx5e: Add ethtool counter for TX xmit_more")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 988eca9..eb0e725 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -356,6 +356,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 		sq->stats.stopped++;
 	}
 
+	sq->stats.xmit_more += skb->xmit_more;
 	if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) {
 		int bf_sz = 0;
 
@@ -375,7 +376,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
 
 	sq->stats.packets++;
 	sq->stats.bytes += num_bytes;
-	sq->stats.xmit_more += skb->xmit_more;
 	return NETDEV_TX_OK;
 
 dma_unmap_wqe_err:
-- 
2.7.4

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

* [PATCH net 2/5] net/mlx5e: Move an_disable_cap bit to a new position
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 1/5] net/mlx5e: Fix xmit_more counter race issue Saeed Mahameed
@ 2016-09-07 16:07 ` Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 3/5] net/mlx5e: Prevent casting overflow Saeed Mahameed
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:07 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Bodong Wang, Saeed Mahameed

From: Bodong Wang <bodong@mellanox.com>

Previous an_disable_cap position bit31 is deprecated to be use in driver
with newer firmware.  New firmware will advertise the same capability
in bit29.

Old capability didn't allow setting more than one protocol for a
specific speed when autoneg is off, while newer firmware will allow
this and it is indicated in the new capability location.

Signed-off-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/linux/mlx5/mlx5_ifc.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 21bc455..d1f9a58 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -6710,9 +6710,10 @@ struct mlx5_ifc_pude_reg_bits {
 };
 
 struct mlx5_ifc_ptys_reg_bits {
-	u8         an_disable_cap[0x1];
+	u8         reserved_at_0[0x1];
 	u8         an_disable_admin[0x1];
-	u8         reserved_at_2[0x6];
+	u8         an_disable_cap[0x1];
+	u8         reserved_at_3[0x5];
 	u8         local_port[0x8];
 	u8         reserved_at_10[0xd];
 	u8         proto_mask[0x3];
-- 
2.7.4

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

* [PATCH net 3/5] net/mlx5e: Prevent casting overflow
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 1/5] net/mlx5e: Fix xmit_more counter race issue Saeed Mahameed
  2016-09-07 16:07 ` [PATCH net 2/5] net/mlx5e: Move an_disable_cap bit to a new position Saeed Mahameed
@ 2016-09-07 16:07 ` Saeed Mahameed
  2016-09-07 16:08 ` [PATCH net 4/5] net/mlx5e: Fix global PFC counters replication Saeed Mahameed
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:07 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

On 64 bits architectures unsigned long is longer than u32,
casting to unsigned long will result in overflow.
We need to first allocate an unsigned long variable, then assign the
wanted value.

Fixes: 665bc53969d7 ('net/mlx5e: Use new ethtool get/set link ksettings API')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index d0cf8fa..98e1a4a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -659,9 +659,10 @@ out:
 static void ptys2ethtool_supported_link(unsigned long *supported_modes,
 					u32 eth_proto_cap)
 {
+	unsigned long proto_cap = eth_proto_cap;
 	int proto;
 
-	for_each_set_bit(proto, (unsigned long *)&eth_proto_cap, MLX5E_LINK_MODES_NUMBER)
+	for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER)
 		bitmap_or(supported_modes, supported_modes,
 			  ptys2ethtool_table[proto].supported,
 			  __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -670,9 +671,10 @@ static void ptys2ethtool_supported_link(unsigned long *supported_modes,
 static void ptys2ethtool_adver_link(unsigned long *advertising_modes,
 				    u32 eth_proto_cap)
 {
+	unsigned long proto_cap = eth_proto_cap;
 	int proto;
 
-	for_each_set_bit(proto, (unsigned long *)&eth_proto_cap, MLX5E_LINK_MODES_NUMBER)
+	for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER)
 		bitmap_or(advertising_modes, advertising_modes,
 			  ptys2ethtool_table[proto].advertised,
 			  __ETHTOOL_LINK_MODE_MASK_NBITS);
-- 
2.7.4

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

* [PATCH net 4/5] net/mlx5e: Fix global PFC counters replication
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
                   ` (2 preceding siblings ...)
  2016-09-07 16:07 ` [PATCH net 3/5] net/mlx5e: Prevent casting overflow Saeed Mahameed
@ 2016-09-07 16:08 ` Saeed Mahameed
  2016-09-07 16:08 ` [PATCH net 5/5] net/mlx5e: Fix parsing of vlan packets when updating lro header Saeed Mahameed
  2016-09-08 23:16 ` [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:08 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

Currently when reading global PFC statistics we left the counter
iterator out of the equation and we ended up reading the same counter
over and over again.

Instead of reading the counter at index 0 on every iteration we now read
the counter at index (i).

Fixes: e989d5a532ce ('net/mlx5e: Expose flow control counters to ethtool')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 98e1a4a..7a346bb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -331,7 +331,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
 	if (mlx5e_query_global_pause_combined(priv)) {
 		for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
 			data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0],
-							  pport_per_prio_pfc_stats_desc, 0);
+							  pport_per_prio_pfc_stats_desc, i);
 		}
 	}
 
-- 
2.7.4

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

* [PATCH net 5/5] net/mlx5e: Fix parsing of vlan packets when updating lro header
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
                   ` (3 preceding siblings ...)
  2016-09-07 16:08 ` [PATCH net 4/5] net/mlx5e: Fix global PFC counters replication Saeed Mahameed
@ 2016-09-07 16:08 ` Saeed Mahameed
  2016-09-08 23:16 ` [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Saeed Mahameed @ 2016-09-07 16:08 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Gal Pressman, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

Currently vlan tagged packets were not parsed correctly
and assumed to be regular IPv4/IPv6 packets.
We should check for 802.1Q/802.1ad tags and update the lro header
accordingly.
This fixes the use case where LRO is on and rxvlan is off
(vlan stripping is off).

Fixes: e586b3b0baee ('net/mlx5: Ethernet Datapath files')
Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 22 +++++++++++++++-------
 1 file changed, 15 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 b6f8ebb..e7c969d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -637,24 +637,32 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq)
 static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe,
 				 u32 cqe_bcnt)
 {
-	struct ethhdr	*eth	= (struct ethhdr *)(skb->data);
-	struct iphdr	*ipv4	= (struct iphdr *)(skb->data + ETH_HLEN);
-	struct ipv6hdr	*ipv6	= (struct ipv6hdr *)(skb->data + ETH_HLEN);
+	struct ethhdr	*eth = (struct ethhdr *)(skb->data);
+	struct iphdr	*ipv4;
+	struct ipv6hdr	*ipv6;
 	struct tcphdr	*tcp;
+	int network_depth = 0;
+	__be16 proto;
+	u16 tot_len;
 
 	u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe);
 	int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA  == l4_hdr_type) ||
 		       (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type));
 
-	u16 tot_len = cqe_bcnt - ETH_HLEN;
+	skb->mac_len = ETH_HLEN;
+	proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth);
 
-	if (eth->h_proto == htons(ETH_P_IP)) {
-		tcp = (struct tcphdr *)(skb->data + ETH_HLEN +
+	ipv4 = (struct iphdr *)(skb->data + network_depth);
+	ipv6 = (struct ipv6hdr *)(skb->data + network_depth);
+	tot_len = cqe_bcnt - network_depth;
+
+	if (proto == htons(ETH_P_IP)) {
+		tcp = (struct tcphdr *)(skb->data + network_depth +
 					sizeof(struct iphdr));
 		ipv6 = NULL;
 		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 	} else {
-		tcp = (struct tcphdr *)(skb->data + ETH_HLEN +
+		tcp = (struct tcphdr *)(skb->data + network_depth +
 					sizeof(struct ipv6hdr));
 		ipv4 = NULL;
 		skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
-- 
2.7.4

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

* Re: [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07
  2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
                   ` (4 preceding siblings ...)
  2016-09-07 16:08 ` [PATCH net 5/5] net/mlx5e: Fix parsing of vlan packets when updating lro header Saeed Mahameed
@ 2016-09-08 23:16 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2016-09-08 23:16 UTC (permalink / raw)
  To: saeedm; +Cc: netdev

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Wed,  7 Sep 2016 19:07:56 +0300

> The following series contains bug fixes for the mlx5e driver.
> 
> from Gal,
> 	- Static code checker cleanup (casting overflow)
> 	- Fix global PFC counter statistics reading
> 	- Fix HW LRO when vlan stripping is off
> 
> From Bodong,
> 	- Deprecate old autoneg capability bit and use new one.
> 
> From Tariq,
> 	- Fix xmit more counter race condition

Series applied, thanks.


> For -stable:
> ('net/mlx5e: Fix parsing of vlan packets when updating lro header')

Queued up.

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

end of thread, other threads:[~2016-09-08 23:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 16:07 [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 Saeed Mahameed
2016-09-07 16:07 ` [PATCH net 1/5] net/mlx5e: Fix xmit_more counter race issue Saeed Mahameed
2016-09-07 16:07 ` [PATCH net 2/5] net/mlx5e: Move an_disable_cap bit to a new position Saeed Mahameed
2016-09-07 16:07 ` [PATCH net 3/5] net/mlx5e: Prevent casting overflow Saeed Mahameed
2016-09-07 16:08 ` [PATCH net 4/5] net/mlx5e: Fix global PFC counters replication Saeed Mahameed
2016-09-07 16:08 ` [PATCH net 5/5] net/mlx5e: Fix parsing of vlan packets when updating lro header Saeed Mahameed
2016-09-08 23:16 ` [PATCH net 0/5] Mellanox 100G mlx5 fixes 2016-09-07 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.