netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver
@ 2012-08-03 10:38 Yevgeny Petrilin
  2012-08-03 10:38 ` [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC Yevgeny Petrilin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yevgeny Petrilin @ 2012-08-03 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yevgeny Petrilin

Hello Dave,

This is a patchset of 3 fixes and additional change that removes
a port Link layer type restriction that is no longer relevant.

Thanks,
Yevgeny
---
Diff from V0:
 -Removed the NETIF_F_GRO patch

Yevgeny Petrilin (2):
  net/mlx4_en: Fixing TX queue stop/wake flow
  net/mlx4_core: Remove port type restrictions

Amir Vadai (1):
  net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC

 drivers/net/ethernet/mellanox/mlx4/en_rx.c     |    4 ++--
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     |   17 +++++++----------
 drivers/net/ethernet/mellanox/mlx4/main.c      |    3 ---
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |    1 -
 drivers/net/ethernet/mellanox/mlx4/sense.c     |   14 --------------
 5 files changed, 9 insertions(+), 30 deletions(-) 

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

* [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC
  2012-08-03 10:38 [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver Yevgeny Petrilin
@ 2012-08-03 10:38 ` Yevgeny Petrilin
  2012-08-03 23:49   ` David Miller
  2012-08-03 10:38 ` [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow Yevgeny Petrilin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Yevgeny Petrilin @ 2012-08-03 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, Amir Vadai

From: Amir Vadai <amirv@mellanox.com>

Should NOT check SMAC=DMAC when:
1. loopback is turned on
2. validate_loopback is true.

Fixed it accordingly.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index f32e703..5aba5ec 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -614,8 +614,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 		/* If source MAC is equal to our own MAC and not performing
 		 * the selftest or flb disabled - drop the packet */
 		if (s_mac == priv->mac &&
-			(!(dev->features & NETIF_F_LOOPBACK) ||
-			 !priv->validate_loopback))
+		    !((dev->features & NETIF_F_LOOPBACK) ||
+		      priv->validate_loopback))
 			goto next;
 
 		/*
-- 
1.7.7

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

* [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow
  2012-08-03 10:38 [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver Yevgeny Petrilin
  2012-08-03 10:38 ` [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC Yevgeny Petrilin
@ 2012-08-03 10:38 ` Yevgeny Petrilin
  2012-08-03 23:49   ` David Miller
  2012-08-03 10:38 ` [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions Yevgeny Petrilin
  2012-08-03 10:56 ` [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Yevgeny Petrilin @ 2012-08-03 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yevgeny Petrilin

Removing the ring->blocked flag, it is redundant and leads to a race:

We close the TX queue and then set the "blocked" flag.
Between those 2 operations the completion function can check the "blocked"
flag, sees that it is 0, and wouldn't open the TX queue.

Using netif_tx_queue_stopped to check the state of the queue to avoid this race.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c   |   17 +++++++----------
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h |    1 -
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 019d856..10bba09 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -164,7 +164,6 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
 	ring->cons = 0xffffffff;
 	ring->last_nr_txbb = 1;
 	ring->poll_cnt = 0;
-	ring->blocked = 0;
 	memset(ring->tx_info, 0, ring->size * sizeof(struct mlx4_en_tx_info));
 	memset(ring->buf, 0, ring->buf_size);
 
@@ -365,14 +364,13 @@ static void mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq)
 	ring->cons += txbbs_skipped;
 	netdev_tx_completed_queue(ring->tx_queue, packets, bytes);
 
-	/* Wakeup Tx queue if this ring stopped it */
-	if (unlikely(ring->blocked)) {
-		if ((u32) (ring->prod - ring->cons) <=
-		     ring->size - HEADROOM - MAX_DESC_TXBBS) {
-			ring->blocked = 0;
-			netif_tx_wake_queue(ring->tx_queue);
-			priv->port_stats.wake_queue++;
-		}
+	/*
+	 * Wakeup Tx queue if this stopped, and at least 1 packet
+	 * was completed
+	 */
+	if (netif_tx_queue_stopped(ring->tx_queue) && txbbs_skipped > 0) {
+		netif_tx_wake_queue(ring->tx_queue);
+		priv->port_stats.wake_queue++;
 	}
 }
 
@@ -592,7 +590,6 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 		     ring->size - HEADROOM - MAX_DESC_TXBBS)) {
 		/* every full Tx ring stops queue */
 		netif_tx_stop_queue(ring->tx_queue);
-		ring->blocked = 1;
 		priv->port_stats.queue_stopped++;
 
 		return NETDEV_TX_BUSY;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 5f1ab10..9d27e42 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -248,7 +248,6 @@ struct mlx4_en_tx_ring {
 	u32 doorbell_qpn;
 	void *buf;
 	u16 poll_cnt;
-	int blocked;
 	struct mlx4_en_tx_info *tx_info;
 	u8 *bounce_buf;
 	u32 last_nr_txbb;
-- 
1.7.7

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

* [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions
  2012-08-03 10:38 [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver Yevgeny Petrilin
  2012-08-03 10:38 ` [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC Yevgeny Petrilin
  2012-08-03 10:38 ` [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow Yevgeny Petrilin
@ 2012-08-03 10:38 ` Yevgeny Petrilin
  2012-08-03 23:50   ` David Miller
  2012-08-03 10:56 ` [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Yevgeny Petrilin @ 2012-08-03 10:38 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yevgeny Petrilin

Port1=Eth, Port2=IB restriction is no longer required.
Having RoCE, there will always rdma port initialized over ConnectX
physical port, no matter whether the link layer is IB or Ethernet.
So we always have dual port IB device.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
---
 drivers/net/ethernet/mellanox/mlx4/main.c  |    3 ---
 drivers/net/ethernet/mellanox/mlx4/sense.c |   14 --------------
 2 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 48d0e90..827b72d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -157,9 +157,6 @@ int mlx4_check_port_params(struct mlx4_dev *dev,
 					 "on this HCA, aborting.\n");
 				return -EINVAL;
 			}
-			if (port_type[i] == MLX4_PORT_TYPE_ETH &&
-			    port_type[i + 1] == MLX4_PORT_TYPE_IB)
-				return -EINVAL;
 		}
 	}
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/sense.c b/drivers/net/ethernet/mellanox/mlx4/sense.c
index 8024982..34ee09b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/sense.c
+++ b/drivers/net/ethernet/mellanox/mlx4/sense.c
@@ -81,20 +81,6 @@ void mlx4_do_sense_ports(struct mlx4_dev *dev,
 	}
 
 	/*
-	 * Adjust port configuration:
-	 * If port 1 sensed nothing and port 2 is IB, set both as IB
-	 * If port 2 sensed nothing and port 1 is Eth, set both as Eth
-	 */
-	if (stype[0] == MLX4_PORT_TYPE_ETH) {
-		for (i = 1; i < dev->caps.num_ports; i++)
-			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_ETH;
-	}
-	if (stype[dev->caps.num_ports - 1] == MLX4_PORT_TYPE_IB) {
-		for (i = 0; i < dev->caps.num_ports - 1; i++)
-			stype[i] = stype[i] ? stype[i] : MLX4_PORT_TYPE_IB;
-	}
-
-	/*
 	 * If sensed nothing, remain in current configuration.
 	 */
 	for (i = 0; i < dev->caps.num_ports; i++)
-- 
1.7.7

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

* Re: [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver
  2012-08-03 10:38 [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver Yevgeny Petrilin
                   ` (2 preceding siblings ...)
  2012-08-03 10:38 ` [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions Yevgeny Petrilin
@ 2012-08-03 10:56 ` David Miller
  3 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-08-03 10:56 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev


"0/4" eh?

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

* Re: [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC
  2012-08-03 10:38 ` [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC Yevgeny Petrilin
@ 2012-08-03 23:49   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-08-03 23:49 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev, amirv

From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Fri,  3 Aug 2012 13:38:36 +0300

> From: Amir Vadai <amirv@mellanox.com>
> 
> Should NOT check SMAC=DMAC when:
> 1. loopback is turned on
> 2. validate_loopback is true.
> 
> Fixed it accordingly.
> 
> Signed-off-by: Amir Vadai <amirv@mellanox.com>

Applied.

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

* Re: [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow
  2012-08-03 10:38 ` [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow Yevgeny Petrilin
@ 2012-08-03 23:49   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-08-03 23:49 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev

From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Fri,  3 Aug 2012 13:38:37 +0300

> Removing the ring->blocked flag, it is redundant and leads to a race:
> 
> We close the TX queue and then set the "blocked" flag.
> Between those 2 operations the completion function can check the "blocked"
> flag, sees that it is 0, and wouldn't open the TX queue.
> 
> Using netif_tx_queue_stopped to check the state of the queue to avoid this race.
> 
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>

Applied.

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

* Re: [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions
  2012-08-03 10:38 ` [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions Yevgeny Petrilin
@ 2012-08-03 23:50   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2012-08-03 23:50 UTC (permalink / raw)
  To: yevgenyp; +Cc: netdev

From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Fri,  3 Aug 2012 13:38:38 +0300

> Port1=Eth, Port2=IB restriction is no longer required.
> Having RoCE, there will always rdma port initialized over ConnectX
> physical port, no matter whether the link layer is IB or Ethernet.
> So we always have dual port IB device.
> 
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>

Applied.

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

end of thread, other threads:[~2012-08-03 23:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03 10:38 [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver Yevgeny Petrilin
2012-08-03 10:38 ` [PATCH V1 1/3] net/mlx4_en: loopbacked packets are dropped when SMAC=DMAC Yevgeny Petrilin
2012-08-03 23:49   ` David Miller
2012-08-03 10:38 ` [PATCH V1 2/3] net/mlx4_en: Fixing TX queue stop/wake flow Yevgeny Petrilin
2012-08-03 23:49   ` David Miller
2012-08-03 10:38 ` [PATCH V1 3/3] net/mlx4_core: Remove port type restrictions Yevgeny Petrilin
2012-08-03 23:50   ` David Miller
2012-08-03 10:56 ` [PATCH V1 0/4] net/mlx4: Fixes to mlx4 driver 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).