* [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16
@ 2013-01-24 11:54 Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 1/6] net/mlx4_en: Issue the dump eth statistics command under lock Amir Vadai
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Or Gerlitz, Amir Vadai
Hi Dave,
These are all small bug fixes to the Mellanox mlx4 driver, patches done against
net-next commit d59577b "sk-filter: Add ability to lock a socket filter program"
Changes from V1:
- added memory barrier to "Fix a race when closing TX queue"
- Fixed indentation
Changes from V0:
- Removed patch "Set carrier to off when a port is stopped"
Need some time to make sure using netif_device_detach instead of
netif_carrier_off, as suggested by Ben, won't break anything.
Thanks,
Amir
Amir Vadai (2):
net/mlx4_en: Fix a race when closing TX queue
net/mlx4_en: Initialize RFS filters lock and list in init_netdev
Aviad Yehezkel (1):
net/mlx4_en: Fix traffic loss under promiscuous mode
Eugenia Emantayev (2):
net/mlx4_en: Issue the dump eth statistics command under lock
net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode
Jack Morgenstein (1):
net/mlx4_core: Return proper error code when __mlx4_add_one fails
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 55 ++++++++++++++++--------
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 16 ++++++-
drivers/net/ethernet/mellanox/mlx4/main.c | 7 ++-
3 files changed, 57 insertions(+), 21 deletions(-)
--
1.7.8.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next V2 1/6] net/mlx4_en: Issue the dump eth statistics command under lock
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 2/6] net/mlx4_en: Fix traffic loss under promiscuous mode Amir Vadai
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Or Gerlitz, Amir Vadai, Eugenia Emantayev
From: Eugenia Emantayev <eugenia@mellanox.com>
Performing the DUMP_ETH_STATS firmware command outside the lock leads to kernel
panic when data structures such as RX/TX rings are freed in parallel, e.g when
one changes the mtu or ring sizes.
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index b467513..b6c645f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -977,12 +977,12 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
struct mlx4_en_dev *mdev = priv->mdev;
int err;
- err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
- if (err)
- en_dbg(HW, priv, "Could not update stats\n");
-
mutex_lock(&mdev->state_lock);
if (mdev->device_up) {
+ err = mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 0);
+ if (err)
+ en_dbg(HW, priv, "Could not update stats\n");
+
if (priv->port_up)
mlx4_en_auto_moderation(priv);
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 2/6] net/mlx4_en: Fix traffic loss under promiscuous mode
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 1/6] net/mlx4_en: Issue the dump eth statistics command under lock Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 3/6] net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode Amir Vadai
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Amir Vadai, Aviad Yehezkel, Eugenia Emantayev,
Hadar Hen Zion
From: Aviad Yehezkel <aviadye@mellanox.com>
When port is stopped and flow steering mode is not device managed: promisc QP
rule wasn't removed from MCG table.
Added code to remove it in all flow steering modes.
In addition, promsic rule removal should be in stop port and not in start
port - moved it accordingly.
Signed-off-by: Aviad Yehezkel <aviadye@mellanox.com>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 35 +++++++++++++++++------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index b6c645f..bab8cec 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1167,15 +1167,6 @@ int mlx4_en_start_port(struct net_device *dev)
/* Must redo promiscuous mode setup. */
priv->flags &= ~(MLX4_EN_FLAG_PROMISC | MLX4_EN_FLAG_MC_PROMISC);
- if (mdev->dev->caps.steering_mode ==
- MLX4_STEERING_MODE_DEVICE_MANAGED) {
- mlx4_flow_steer_promisc_remove(mdev->dev,
- priv->port,
- MLX4_FS_PROMISC_UPLINK);
- mlx4_flow_steer_promisc_remove(mdev->dev,
- priv->port,
- MLX4_FS_PROMISC_ALL_MULTI);
- }
/* Schedule multicast task to populate multicast list */
queue_work(mdev->workqueue, &priv->mcast_task);
@@ -1227,6 +1218,32 @@ void mlx4_en_stop_port(struct net_device *dev)
/* Set port as not active */
priv->port_up = false;
+ /* Promsicuous mode */
+ if (mdev->dev->caps.steering_mode ==
+ MLX4_STEERING_MODE_DEVICE_MANAGED) {
+ priv->flags &= ~(MLX4_EN_FLAG_PROMISC |
+ MLX4_EN_FLAG_MC_PROMISC);
+ mlx4_flow_steer_promisc_remove(mdev->dev,
+ priv->port,
+ MLX4_FS_PROMISC_UPLINK);
+ mlx4_flow_steer_promisc_remove(mdev->dev,
+ priv->port,
+ MLX4_FS_PROMISC_ALL_MULTI);
+ } else if (priv->flags & MLX4_EN_FLAG_PROMISC) {
+ priv->flags &= ~MLX4_EN_FLAG_PROMISC;
+
+ /* Disable promiscouos mode */
+ mlx4_unicast_promisc_remove(mdev->dev, priv->base_qpn,
+ priv->port);
+
+ /* Disable Multicast promisc */
+ if (priv->flags & MLX4_EN_FLAG_MC_PROMISC) {
+ mlx4_multicast_promisc_remove(mdev->dev, priv->base_qpn,
+ priv->port);
+ priv->flags &= ~MLX4_EN_FLAG_MC_PROMISC;
+ }
+ }
+
/* Detach All multicasts */
memset(&mc_list[10], 0xff, ETH_ALEN);
mc_list[5] = priv->port; /* needed for B0 steering support */
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 3/6] net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 1/6] net/mlx4_en: Issue the dump eth statistics command under lock Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 2/6] net/mlx4_en: Fix traffic loss under promiscuous mode Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 4/6] net/mlx4_core: Return proper error code when __mlx4_add_one fails Amir Vadai
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Or Gerlitz, Amir Vadai, Eugenia Emantayev
From: Eugenia Emantayev <eugenia@mellanox.com>
The device multicast list is protected by netif_addr_lock_bh in the networking core, we should
use this locking practice in mlx4_en too.
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Reviewed-by: Yevgeny Petrilin <yevgenyp@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index bab8cec..805e242 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -767,9 +767,9 @@ static void mlx4_en_do_set_multicast(struct work_struct *work)
/* Update multicast list - we cache all addresses so they won't
* change while HW is updated holding the command semaphor */
- netif_tx_lock_bh(dev);
+ netif_addr_lock_bh(dev);
mlx4_en_cache_mclist(dev);
- netif_tx_unlock_bh(dev);
+ netif_addr_unlock_bh(dev);
list_for_each_entry(mclist, &priv->mc_list, list) {
mcast_addr = mlx4_en_mac_to_u64(mclist->addr);
mlx4_SET_MCAST_FLTR(mdev->dev, priv->port,
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 4/6] net/mlx4_core: Return proper error code when __mlx4_add_one fails
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
` (2 preceding siblings ...)
2013-01-24 11:54 ` [PATCH net-next V2 3/6] net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 5/6] net/mlx4_en: Fix a race when closing TX queue Amir Vadai
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Amir Vadai, Jack Morgenstein,
Eugenia Emantayev
From: Jack Morgenstein <jackm@dev.mellanox.co.il>
Returning 0 (success) when in fact we are aborting the load, leads to kernel
panic when unloading the module. Fix that by returning the actual error code.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/main.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index e1bafff..983fd3d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2169,7 +2169,8 @@ slave_start:
dev->num_slaves = MLX4_MAX_NUM_SLAVES;
else {
dev->num_slaves = 0;
- if (mlx4_multi_func_init(dev)) {
+ err = mlx4_multi_func_init(dev);
+ if (err) {
mlx4_err(dev, "Failed to init slave mfunc"
" interface, aborting.\n");
goto err_cmd;
@@ -2193,7 +2194,8 @@ slave_start:
/* In master functions, the communication channel must be initialized
* after obtaining its address from fw */
if (mlx4_is_master(dev)) {
- if (mlx4_multi_func_init(dev)) {
+ err = mlx4_multi_func_init(dev);
+ if (err) {
mlx4_err(dev, "Failed to init master mfunc"
"interface, aborting.\n");
goto err_close;
@@ -2210,6 +2212,7 @@ slave_start:
mlx4_enable_msi_x(dev);
if ((mlx4_is_mfunc(dev)) &&
!(dev->flags & MLX4_FLAG_MSI_X)) {
+ err = -ENOSYS;
mlx4_err(dev, "INTx is not supported in multi-function mode."
" aborting.\n");
goto err_free_eq;
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 5/6] net/mlx4_en: Fix a race when closing TX queue
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
` (3 preceding siblings ...)
2013-01-24 11:54 ` [PATCH net-next V2 4/6] net/mlx4_core: Return proper error code when __mlx4_add_one fails Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 6/6] net/mlx4_en: Initialize RFS filters lock and list in init_netdev Amir Vadai
2013-01-28 5:16 ` [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Or Gerlitz, Amir Vadai, Eric Dumazet, Yevgeny Petrilin,
Eugenia Emantayev
There is a possible race where the TX completion handler can clean the
entire TX queue between the decision that the queue is full and actually
closing it. To avoid this situation, check again if the queue is really
full, if not, reopen the transmit and continue with sending the packet.
CC: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.com>
Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_tx.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 16af338..1e793e3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -588,7 +588,21 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
netif_tx_stop_queue(ring->tx_queue);
priv->port_stats.queue_stopped++;
- return NETDEV_TX_BUSY;
+ /* If queue was emptied after the if, and before the
+ * stop_queue - need to wake the queue, or else it will remain
+ * stopped forever.
+ * Need a memory barrier to make sure ring->cons was not
+ * updated before queue was stopped.
+ */
+ wmb();
+
+ if (unlikely(((int)(ring->prod - ring->cons)) <=
+ ring->size - HEADROOM - MAX_DESC_TXBBS)) {
+ netif_tx_wake_queue(ring->tx_queue);
+ priv->port_stats.wake_queue++;
+ } else {
+ return NETDEV_TX_BUSY;
+ }
}
/* Track current inflight packets for performance analysis */
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next V2 6/6] net/mlx4_en: Initialize RFS filters lock and list in init_netdev
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
` (4 preceding siblings ...)
2013-01-24 11:54 ` [PATCH net-next V2 5/6] net/mlx4_en: Fix a race when closing TX queue Amir Vadai
@ 2013-01-24 11:54 ` Amir Vadai
2013-01-28 5:16 ` [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 David Miller
6 siblings, 0 replies; 8+ messages in thread
From: Amir Vadai @ 2013-01-24 11:54 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Or Gerlitz, Amir Vadai
filters_lock might have been used while it was re-initialized.
Moved filters_lock and filters_list initialization to init_netdev instead of
alloc_resources which is called every time the device is configured.
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 805e242..9c42812 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1454,9 +1454,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->rx_ring_num);
if (!priv->dev->rx_cpu_rmap)
goto err;
-
- INIT_LIST_HEAD(&priv->filters);
- spin_lock_init(&priv->filters_lock);
#endif
return 0;
@@ -1651,6 +1648,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
if (err)
goto out;
+#ifdef CONFIG_RFS_ACCEL
+ INIT_LIST_HEAD(&priv->filters);
+ spin_lock_init(&priv->filters_lock);
+#endif
+
/* Allocate page for receive rings */
err = mlx4_alloc_hwq_res(mdev->dev, &priv->res,
MLX4_EN_PAGE_SIZE, MLX4_EN_PAGE_SIZE);
--
1.7.8.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
` (5 preceding siblings ...)
2013-01-24 11:54 ` [PATCH net-next V2 6/6] net/mlx4_en: Initialize RFS filters lock and list in init_netdev Amir Vadai
@ 2013-01-28 5:16 ` David Miller
6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-01-28 5:16 UTC (permalink / raw)
To: amirv; +Cc: netdev, ogerlitz
From: Amir Vadai <amirv@mellanox.com>
Date: Thu, 24 Jan 2013 13:54:13 +0200
> These are all small bug fixes to the Mellanox mlx4 driver, patches done against
> net-next commit d59577b "sk-filter: Add ability to lock a socket filter program"
All applied to net-next, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-28 5:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-24 11:54 [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 1/6] net/mlx4_en: Issue the dump eth statistics command under lock Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 2/6] net/mlx4_en: Fix traffic loss under promiscuous mode Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 3/6] net/mlx4_en: Use the correct netif lock on ndo_set_rx_mode Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 4/6] net/mlx4_core: Return proper error code when __mlx4_add_one fails Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 5/6] net/mlx4_en: Fix a race when closing TX queue Amir Vadai
2013-01-24 11:54 ` [PATCH net-next V2 6/6] net/mlx4_en: Initialize RFS filters lock and list in init_netdev Amir Vadai
2013-01-28 5:16 ` [PATCH net-next V2 0/6] Mellanox Ethernet driver updates 2013-01-16 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).