All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/4] mlx4 driver fixes, June 24, 2015
@ 2015-06-24 15:21 Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 1/4] net/mlx4_en: Release TX QP when destroying TX ring Or Gerlitz
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-06-24 15:21 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Ido Shamay, Or Gerlitz

Hi Dave,

Some fixes that we made recently, all need to go into stable.

patch #1 "net/mlx4_en: Release TX QP when destroying TX ring" and patch #3 
"Fix wrong csum complete report when rxvlan offload is disabled" to >= 3.19

patch #2 "Wake TX queues only when there's enough room" addressing a bug 
which is there from day one... should go to whatever kernels it's still applicable

patch #4 "mlx4: Disable HA for SRIOV PF RoCE devices" to >= 4.0

The patches are marked with net but are made against net-next,
as the net tree still doesn't contain all the net-next bits.

thanks,

Or.

Eran Ben Elisha (1):
  net/mlx4_en: Release TX QP when destroying TX ring

Ido Shamay (2):
  net/mlx4_en: Wake TX queues only when there's enough room
  net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled

Or Gerlitz (1):
  mlx4: Disable HA for SRIOV PF RoCE devices

 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |  4 ----
 drivers/net/ethernet/mellanox/mlx4/en_rx.c     | 17 ++++++-----------
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     | 20 ++++++++++++--------
 drivers/net/ethernet/mellanox/mlx4/intf.c      |  8 +++++++-
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |  2 +-
 5 files changed, 26 insertions(+), 25 deletions(-)

-- 
2.3.7

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

* [PATCH net 1/4] net/mlx4_en: Release TX QP when destroying TX ring
  2015-06-24 15:21 [PATCH net 0/4] mlx4 driver fixes, June 24, 2015 Or Gerlitz
@ 2015-06-24 15:22 ` Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 2/4] net/mlx4_en: Wake TX queues only when there's enough room Or Gerlitz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-06-24 15:22 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Amir Vadai, Ido Shamay, Eran Ben Elisha, Or Gerlitz

From: Eran Ben Elisha <eranbe@mellanox.com>

TX ring QP wasn't released at mlx4_en_destroy_tx_ring. Instead, the code
used the deprecated base_tx_qpn field. Move TX QP release to
mlx4_en_destroy_tx_ring and remove the base_tx_qpn field.

Fixes: ddae0349fdb7 ('net/mlx4: Change QP allocation scheme')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ----
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     | 1 +
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   | 1 -
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 77179d7..e0de2fd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1977,10 +1977,6 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv)
 			mlx4_en_destroy_cq(priv, &priv->rx_cq[i]);
 	}
 
-	if (priv->base_tx_qpn) {
-		mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num);
-		priv->base_tx_qpn = 0;
-	}
 }
 
 int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 7bed3a8..0ab298f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -180,6 +180,7 @@ void mlx4_en_destroy_tx_ring(struct mlx4_en_priv *priv,
 		mlx4_bf_free(mdev->dev, &ring->bf);
 	mlx4_qp_remove(mdev->dev, &ring->qp);
 	mlx4_qp_free(mdev->dev, &ring->qp);
+	mlx4_qp_release_range(priv->mdev->dev, ring->qpn, 1);
 	mlx4_en_unmap_buffer(&ring->wqres.buf);
 	mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size);
 	kfree(ring->bounce_buf);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index d5f9adb..32134bd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -580,7 +580,6 @@ struct mlx4_en_priv {
 	int vids[128];
 	bool wol;
 	struct device *ddev;
-	int base_tx_qpn;
 	struct hlist_head mac_hash[MLX4_EN_MAC_HASH_SIZE];
 	struct hwtstamp_config hwtstamp_config;
 	u32 counter_index;
-- 
2.3.7

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

* [PATCH net 2/4] net/mlx4_en: Wake TX queues only when there's enough room
  2015-06-24 15:21 [PATCH net 0/4] mlx4 driver fixes, June 24, 2015 Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 1/4] net/mlx4_en: Release TX QP when destroying TX ring Or Gerlitz
@ 2015-06-24 15:22 ` Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 4/4] mlx4: Disable HA for SRIOV PF RoCE devices Or Gerlitz
  3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-06-24 15:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Ido Shamay, Or Gerlitz

From: Ido Shamay <idos@mellanox.com>

Indication of a single completed packet, marked by txbbs_skipped
being bigger then zero, in not enough in order to wake up a
stopped TX queue. The completed packet may contain a single TXBB,
while next packet to be sent (after the wake up) may have multiple
TXBBs (LSO/TSO packets for example), causing overflow in queue followed
by WQE corruption and TX queue timeout.
Instead, wake the stopped queue only when there's enough room for the
worst case (maximum sized WQE) packet that we should need to handle after
the queue is opened again.

Also created an helper routine - mlx4_en_is_tx_ring_full, which checks
if the current TX ring is full or not. It provides better code readability
and removes code duplication.

Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c   | 19 +++++++++++--------
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h |  1 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 0ab298f..c10d98f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -66,6 +66,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
 	ring->size = size;
 	ring->size_mask = size - 1;
 	ring->stride = stride;
+	ring->full_size = ring->size - HEADROOM - MAX_DESC_TXBBS;
 
 	tmp = size * sizeof(struct mlx4_en_tx_info);
 	ring->tx_info = kmalloc_node(tmp, GFP_KERNEL | __GFP_NOWARN, node);
@@ -232,6 +233,11 @@ void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv,
 		       MLX4_QP_STATE_RST, NULL, 0, 0, &ring->qp);
 }
 
+static inline bool mlx4_en_is_tx_ring_full(struct mlx4_en_tx_ring *ring)
+{
+	return ring->prod - ring->cons > ring->full_size;
+}
+
 static void mlx4_en_stamp_wqe(struct mlx4_en_priv *priv,
 			      struct mlx4_en_tx_ring *ring, int index,
 			      u8 owner)
@@ -474,11 +480,10 @@ static bool mlx4_en_process_tx_cq(struct net_device *dev,
 
 	netdev_tx_completed_queue(ring->tx_queue, packets, bytes);
 
-	/*
-	 * Wakeup Tx queue if this stopped, and at least 1 packet
-	 * was completed
+	/* Wakeup Tx queue if this stopped, and ring is not full.
 	 */
-	if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) {
+	if (netif_tx_queue_stopped(ring->tx_queue) &&
+	    !mlx4_en_is_tx_ring_full(ring)) {
 		netif_tx_wake_queue(ring->tx_queue);
 		ring->wake_queue++;
 	}
@@ -922,8 +927,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 	skb_tx_timestamp(skb);
 
 	/* Check available TXBBs And 2K spare for prefetch */
-	stop_queue = (int)(ring->prod - ring_cons) >
-		      ring->size - HEADROOM - MAX_DESC_TXBBS;
+	stop_queue = mlx4_en_is_tx_ring_full(ring);
 	if (unlikely(stop_queue)) {
 		netif_tx_stop_queue(ring->tx_queue);
 		ring->queue_stopped++;
@@ -992,8 +996,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 		smp_rmb();
 
 		ring_cons = ACCESS_ONCE(ring->cons);
-		if (unlikely(((int)(ring->prod - ring_cons)) <=
-			     ring->size - HEADROOM - MAX_DESC_TXBBS)) {
+		if (unlikely(!mlx4_en_is_tx_ring_full(ring))) {
 			netif_tx_wake_queue(ring->tx_queue);
 			ring->wake_queue++;
 		}
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 32134bd..666d166 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -279,6 +279,7 @@ struct mlx4_en_tx_ring {
 	u32			size; /* number of TXBBs */
 	u32			size_mask;
 	u16			stride;
+	u32			full_size;
 	u16			cqn;	/* index of port CQ associated with this ring */
 	u32			buf_size;
 	__be32			doorbell_qpn;
-- 
2.3.7

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

* [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled
  2015-06-24 15:21 [PATCH net 0/4] mlx4 driver fixes, June 24, 2015 Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 1/4] net/mlx4_en: Release TX QP when destroying TX ring Or Gerlitz
  2015-06-24 15:22 ` [PATCH net 2/4] net/mlx4_en: Wake TX queues only when there's enough room Or Gerlitz
@ 2015-06-24 15:22 ` Or Gerlitz
  2015-06-24 22:01   ` Eric Dumazet
  2015-06-24 15:22 ` [PATCH net 4/4] mlx4: Disable HA for SRIOV PF RoCE devices Or Gerlitz
  3 siblings, 1 reply; 7+ messages in thread
From: Or Gerlitz @ 2015-06-24 15:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Ido Shamay, Or Gerlitz

From: Ido Shamay <idos@mellanox.com>

The check_csum() function relied on hwtstamp_rx_filter to know if rxvlan
offload is disabled. This is wrong since rxvlan offload can be switched
on/off regardless of hwtstamp_rx_filter.

Also moved check_csum to query CQE information to identify VLAN packets
and removed the check of IP packets, since it has been validated before.

Fixes: f8c6455bb04b ('net/mlx4_en: Extend checksum offloading by CHECKSUM COMPLETE')
Signed-off-by: Ido Shamay <idos@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 35f726c..580dd59 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -718,7 +718,7 @@ static int get_fixed_ipv6_csum(__wsum hw_checksum, struct sk_buff *skb,
 }
 #endif
 static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
-		      int hwtstamp_rx_filter)
+		      netdev_features_t dev_features)
 {
 	__wsum hw_checksum = 0;
 
@@ -726,14 +726,8 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
 
 	hw_checksum = csum_unfold((__force __sum16)cqe->checksum);
 
-	if (((struct ethhdr *)va)->h_proto == htons(ETH_P_8021Q) &&
-	    hwtstamp_rx_filter != HWTSTAMP_FILTER_NONE) {
-		/* next protocol non IPv4 or IPv6 */
-		if (((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
-		    != htons(ETH_P_IP) &&
-		    ((struct vlan_hdr *)hdr)->h_vlan_encapsulated_proto
-		    != htons(ETH_P_IPV6))
-			return -1;
+	if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_VLAN_PRESENT_MASK &&
+	    !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) {
 		hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr);
 		hdr += sizeof(struct vlan_hdr);
 	}
@@ -896,7 +890,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 
 			if (ip_summed == CHECKSUM_COMPLETE) {
 				void *va = skb_frag_address(skb_shinfo(gro_skb)->frags);
-				if (check_csum(cqe, gro_skb, va, ring->hwtstamp_rx_filter)) {
+				if (check_csum(cqe, gro_skb, va,
+					       dev->features)) {
 					ip_summed = CHECKSUM_NONE;
 					ring->csum_none++;
 					ring->csum_complete--;
@@ -951,7 +946,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 		}
 
 		if (ip_summed == CHECKSUM_COMPLETE) {
-			if (check_csum(cqe, skb, skb->data, ring->hwtstamp_rx_filter)) {
+			if (check_csum(cqe, skb, skb->data, dev->features)) {
 				ip_summed = CHECKSUM_NONE;
 				ring->csum_complete--;
 				ring->csum_none++;
-- 
2.3.7

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

* [PATCH net 4/4] mlx4: Disable HA for SRIOV PF RoCE devices
  2015-06-24 15:21 [PATCH net 0/4] mlx4 driver fixes, June 24, 2015 Or Gerlitz
                   ` (2 preceding siblings ...)
  2015-06-24 15:22 ` [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled Or Gerlitz
@ 2015-06-24 15:22 ` Or Gerlitz
  3 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-06-24 15:22 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Amir Vadai, Ido Shamay, Or Gerlitz

When in HA mode, the driver exposes an IB (RoCE) device instance with only
one port. Under SRIOV, the existing implementation doesn't go well with
the PF RoCE driver's role of Special QPs Para-Virtualization and such.

As such, disable HA for the mlx4 PF RoCE device in SRIOV mode.

Fixes: a57500903093 ('IB/mlx4: Add port aggregation support')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/intf.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c
index 6fce587..0d80aed 100644
--- a/drivers/net/ethernet/mellanox/mlx4/intf.c
+++ b/drivers/net/ethernet/mellanox/mlx4/intf.c
@@ -93,8 +93,14 @@ int mlx4_register_interface(struct mlx4_interface *intf)
 	mutex_lock(&intf_mutex);
 
 	list_add_tail(&intf->list, &intf_list);
-	list_for_each_entry(priv, &dev_list, dev_list)
+	list_for_each_entry(priv, &dev_list, dev_list) {
+		if (mlx4_is_mfunc(&priv->dev) && (intf->flags & MLX4_INTFF_BONDING)) {
+			mlx4_dbg(&priv->dev,
+				 "SRIOV, disabling HA mode for intf proto %d\n", intf->protocol);
+			intf->flags &= ~MLX4_INTFF_BONDING;
+		}
 		mlx4_add_device(intf, priv);
+	}
 
 	mutex_unlock(&intf_mutex);
 
-- 
2.3.7

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

* Re: [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled
  2015-06-24 15:22 ` [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled Or Gerlitz
@ 2015-06-24 22:01   ` Eric Dumazet
  2015-06-25  6:36     ` Or Gerlitz
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2015-06-24 22:01 UTC (permalink / raw)
  To: Or Gerlitz; +Cc: David S. Miller, netdev, Amir Vadai, Ido Shamay

On Wed, 2015-06-24 at 18:22 +0300, Or Gerlitz wrote:
> From: Ido Shamay <idos@mellanox.com>
> 

> +	if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_VLAN_PRESENT_MASK &&
> +	    !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) {
>  		hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr);
>  		hdr += sizeof(struct vlan_hdr);

This is faster to use 

if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK) &&

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

* Re: [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled
  2015-06-24 22:01   ` Eric Dumazet
@ 2015-06-25  6:36     ` Or Gerlitz
  0 siblings, 0 replies; 7+ messages in thread
From: Or Gerlitz @ 2015-06-25  6:36 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, netdev, Amir Vadai, Ido Shamay

On 6/25/2015 1:01 AM, Eric Dumazet wrote:
> On Wed, 2015-06-24 at 18:22 +0300, Or Gerlitz wrote:
>> From: Ido Shamay <idos@mellanox.com>
>>
>> +	if (be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_VLAN_PRESENT_MASK &&
>> +	    !(dev_features & NETIF_F_HW_VLAN_CTAG_RX)) {
>>   		hw_checksum = get_fixed_vlan_csum(hw_checksum, hdr);
>>   		hdr += sizeof(struct vlan_hdr);
> This is faster to use
>
> if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK) &&
>
>
>
sure, will fix that and re-spin the series

Or.

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

end of thread, other threads:[~2015-06-25  6:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 15:21 [PATCH net 0/4] mlx4 driver fixes, June 24, 2015 Or Gerlitz
2015-06-24 15:22 ` [PATCH net 1/4] net/mlx4_en: Release TX QP when destroying TX ring Or Gerlitz
2015-06-24 15:22 ` [PATCH net 2/4] net/mlx4_en: Wake TX queues only when there's enough room Or Gerlitz
2015-06-24 15:22 ` [PATCH net 3/4] net/mlx4_en: Fix wrong csum complete report when rxvlan offload is disabled Or Gerlitz
2015-06-24 22:01   ` Eric Dumazet
2015-06-25  6:36     ` Or Gerlitz
2015-06-24 15:22 ` [PATCH net 4/4] mlx4: Disable HA for SRIOV PF RoCE devices Or Gerlitz

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.