netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/5] ionic: locking and filter fixes
@ 2020-07-20 23:00 Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 1/5] ionic: use offset for ethtool regs data Shannon Nelson
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

These patches address an ethtool show regs problem, some locking sightings,
and issues with RSS hash and filter_id tracking after a managed FW update.

Shannon Nelson (5):
  ionic: use offset for ethtool regs data
  ionic: fix up filter locks and debug msgs
  ionic: update filter id after replay
  ionic: keep rss hash after fw update
  ionic: use mutex to protect queue operations

 .../ethernet/pensando/ionic/ionic_ethtool.c   |  7 ++-
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 50 +++++++++----------
 .../net/ethernet/pensando/ionic/ionic_lif.h   |  8 +--
 .../ethernet/pensando/ionic/ionic_rx_filter.c | 29 +++++++++++
 .../net/ethernet/pensando/ionic/ionic_txrx.c  |  6 ---
 5 files changed, 60 insertions(+), 40 deletions(-)

-- 
2.17.1


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

* [PATCH net 1/5] ionic: use offset for ethtool regs data
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
@ 2020-07-20 23:00 ` Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 2/5] ionic: fix up filter locks and debug msgs Shannon Nelson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

Use an offset to write the second half of the regs data into the
second half of the buffer instead of overwriting the first half.

Fixes: 4d03e00a2140 ("ionic: Add initial ethtool support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
index e03ea9b18f95..095561924bdc 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c
@@ -103,15 +103,18 @@ static void ionic_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
 			   void *p)
 {
 	struct ionic_lif *lif = netdev_priv(netdev);
+	unsigned int offset;
 	unsigned int size;
 
 	regs->version = IONIC_DEV_CMD_REG_VERSION;
 
+	offset = 0;
 	size = IONIC_DEV_INFO_REG_COUNT * sizeof(u32);
-	memcpy_fromio(p, lif->ionic->idev.dev_info_regs->words, size);
+	memcpy_fromio(p + offset, lif->ionic->idev.dev_info_regs->words, size);
 
+	offset += size;
 	size = IONIC_DEV_CMD_REG_COUNT * sizeof(u32);
-	memcpy_fromio(p, lif->ionic->idev.dev_cmd_regs->words, size);
+	memcpy_fromio(p + offset, lif->ionic->idev.dev_cmd_regs->words, size);
 }
 
 static int ionic_get_link_ksettings(struct net_device *netdev,
-- 
2.17.1


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

* [PATCH net 2/5] ionic: fix up filter locks and debug msgs
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 1/5] ionic: use offset for ethtool regs data Shannon Nelson
@ 2020-07-20 23:00 ` Shannon Nelson
  2020-07-21  0:03   ` Jakub Kicinski
  2020-07-20 23:00 ` [PATCH net 3/5] ionic: update filter id after replay Shannon Nelson
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

Add in a couple of forgotten spinlocks and fix up some of
the debug messages around filter management.

Fixes: c1e329ebec8d ("ionic: Add management of rx filters")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 17 +++++++----------
 .../ethernet/pensando/ionic/ionic_rx_filter.c   |  5 +++++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index f49486b6d04d..41e86d6b76b6 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -863,8 +863,7 @@ static int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr)
 	if (f)
 		return 0;
 
-	netdev_dbg(lif->netdev, "rx_filter add ADDR %pM (id %d)\n", addr,
-		   ctx.comp.rx_filter_add.filter_id);
+	netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr);
 
 	memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN);
 	err = ionic_adminq_post_wait(lif, &ctx);
@@ -893,6 +892,9 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr)
 		return -ENOENT;
 	}
 
+	netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n",
+		   addr, f->filter_id);
+
 	ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id);
 	ionic_rx_filter_free(lif, f);
 	spin_unlock_bh(&lif->rx_filters.lock);
@@ -901,9 +903,6 @@ static int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr)
 	if (err && err != -EEXIST)
 		return err;
 
-	netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", addr,
-		   ctx.cmd.rx_filter_del.filter_id);
-
 	return 0;
 }
 
@@ -1351,13 +1350,11 @@ static int ionic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto,
 	};
 	int err;
 
+	netdev_dbg(netdev, "rx_filter add VLAN %d\n", vid);
 	err = ionic_adminq_post_wait(lif, &ctx);
 	if (err)
 		return err;
 
-	netdev_dbg(netdev, "rx_filter add VLAN %d (id %d)\n", vid,
-		   ctx.comp.rx_filter_add.filter_id);
-
 	return ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx);
 }
 
@@ -1382,8 +1379,8 @@ static int ionic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto,
 		return -ENOENT;
 	}
 
-	netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", vid,
-		   le32_to_cpu(ctx.cmd.rx_filter_del.filter_id));
+	netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n",
+		   vid, f->filter_id);
 
 	ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id);
 	ionic_rx_filter_free(lif, f);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
index 80eeb7696e01..fb9d828812bd 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
@@ -69,10 +69,12 @@ int ionic_rx_filters_init(struct ionic_lif *lif)
 
 	spin_lock_init(&lif->rx_filters.lock);
 
+	spin_lock_bh(&lif->rx_filters.lock);
 	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
 		INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]);
 		INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]);
 	}
+	spin_unlock_bh(&lif->rx_filters.lock);
 
 	return 0;
 }
@@ -84,11 +86,13 @@ void ionic_rx_filters_deinit(struct ionic_lif *lif)
 	struct hlist_node *tmp;
 	unsigned int i;
 
+	spin_lock_bh(&lif->rx_filters.lock);
 	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
 		head = &lif->rx_filters.by_id[i];
 		hlist_for_each_entry_safe(f, tmp, head, by_id)
 			ionic_rx_filter_free(lif, f);
 	}
+	spin_unlock_bh(&lif->rx_filters.lock);
 }
 
 int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index,
@@ -124,6 +128,7 @@ int ionic_rx_filter_save(struct ionic_lif *lif, u32 flow_id, u16 rxq_index,
 	f->filter_id = le32_to_cpu(ctx->comp.rx_filter_add.filter_id);
 	f->rxq_index = rxq_index;
 	memcpy(&f->cmd, ac, sizeof(f->cmd));
+	netdev_dbg(lif->netdev, "rx_filter add filter_id %d\n", f->filter_id);
 
 	INIT_HLIST_NODE(&f->by_hash);
 	INIT_HLIST_NODE(&f->by_id);
-- 
2.17.1


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

* [PATCH net 3/5] ionic: update filter id after replay
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 1/5] ionic: use offset for ethtool regs data Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 2/5] ionic: fix up filter locks and debug msgs Shannon Nelson
@ 2020-07-20 23:00 ` Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 4/5] ionic: keep rss hash after fw update Shannon Nelson
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

When we replay the rx filters after a fw-upgrade we get new
filter_id values from the FW, which we need to save and update
in our local filter list.  This allows us to delete the filters
with the correct filter_id when we're done.

Fixes: 7e4d47596b68 ("ionic: replay filters after fw upgrade")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 .../ethernet/pensando/ionic/ionic_rx_filter.c | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
index fb9d828812bd..cd0076fc3044 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
@@ -21,13 +21,16 @@ void ionic_rx_filter_free(struct ionic_lif *lif, struct ionic_rx_filter *f)
 void ionic_rx_filter_replay(struct ionic_lif *lif)
 {
 	struct ionic_rx_filter_add_cmd *ac;
+	struct hlist_head new_id_list;
 	struct ionic_admin_ctx ctx;
 	struct ionic_rx_filter *f;
 	struct hlist_head *head;
 	struct hlist_node *tmp;
+	unsigned int key;
 	unsigned int i;
 	int err;
 
+	INIT_HLIST_HEAD(&new_id_list);
 	ac = &ctx.cmd.rx_filter_add;
 
 	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
@@ -58,9 +61,30 @@ void ionic_rx_filter_replay(struct ionic_lif *lif)
 						    ac->mac.addr);
 					break;
 				}
+				spin_lock_bh(&lif->rx_filters.lock);
+				ionic_rx_filter_free(lif, f);
+				spin_unlock_bh(&lif->rx_filters.lock);
+
+				continue;
 			}
+
+			/* remove from old id list, save new id in tmp list */
+			spin_lock_bh(&lif->rx_filters.lock);
+			hlist_del(&f->by_id);
+			spin_unlock_bh(&lif->rx_filters.lock);
+			f->filter_id = le32_to_cpu(ctx.comp.rx_filter_add.filter_id);
+			hlist_add_head(&f->by_id, &new_id_list);
 		}
 	}
+
+	/* rebuild the by_id hash lists with the new filter ids */
+	spin_lock_bh(&lif->rx_filters.lock);
+	hlist_for_each_entry_safe(f, tmp, &new_id_list, by_id) {
+		key = f->filter_id & IONIC_RX_FILTER_HLISTS_MASK;
+		head = &lif->rx_filters.by_id[key];
+		hlist_add_head(&f->by_id, head);
+	}
+	spin_unlock_bh(&lif->rx_filters.lock);
 }
 
 int ionic_rx_filters_init(struct ionic_lif *lif)
-- 
2.17.1


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

* [PATCH net 4/5] ionic: keep rss hash after fw update
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
                   ` (2 preceding siblings ...)
  2020-07-20 23:00 ` [PATCH net 3/5] ionic: update filter id after replay Shannon Nelson
@ 2020-07-20 23:00 ` Shannon Nelson
  2020-07-20 23:00 ` [PATCH net 5/5] ionic: use mutex to protect queue operations Shannon Nelson
  2020-07-21  1:09 ` [PATCH net 0/5] ionic: locking and filter fixes David Miller
  5 siblings, 0 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

Make sure the RSS hash key is kept across a fw update by not
de-initing it when an update is happening.

Fixes: c672412f6172 ("ionic: remove lifs on fw reset")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 41e86d6b76b6..ddb9ad5b294c 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -2277,11 +2277,10 @@ static void ionic_lif_deinit(struct ionic_lif *lif)
 		cancel_work_sync(&lif->deferred.work);
 		cancel_work_sync(&lif->tx_timeout_work);
 		ionic_rx_filters_deinit(lif);
+		if (lif->netdev->features & NETIF_F_RXHASH)
+			ionic_lif_rss_deinit(lif);
 	}
 
-	if (lif->netdev->features & NETIF_F_RXHASH)
-		ionic_lif_rss_deinit(lif);
-
 	napi_disable(&lif->adminqcq->napi);
 	ionic_lif_qcq_deinit(lif, lif->notifyqcq);
 	ionic_lif_qcq_deinit(lif, lif->adminqcq);
-- 
2.17.1


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

* [PATCH net 5/5] ionic: use mutex to protect queue operations
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
                   ` (3 preceding siblings ...)
  2020-07-20 23:00 ` [PATCH net 4/5] ionic: keep rss hash after fw update Shannon Nelson
@ 2020-07-20 23:00 ` Shannon Nelson
  2020-07-21  1:09 ` [PATCH net 0/5] ionic: locking and filter fixes David Miller
  5 siblings, 0 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-20 23:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shannon Nelson

The ionic_wait_on_bit_lock() was a open-coded mutex knock-off
used only for protecting the queue reset operations, and there
was no reason not to use the real thing.  We can use the lock
more correctly and to better protect the queue stop and start
operations from cross threading.  We can also remove a useless
and expensive bit operation from the Rx path.

This fixes a case found where the link_status_check from a link
flap could run into an MTU change and cause a crash.

Fixes: beead698b173 ("ionic: Add the basic NDO callbacks for netdev support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 28 +++++++++++--------
 .../net/ethernet/pensando/ionic/ionic_lif.h   |  8 +-----
 .../net/ethernet/pensando/ionic/ionic_txrx.c  |  6 ----
 3 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index ddb9ad5b294c..5fd31ba56937 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -96,8 +96,7 @@ static void ionic_link_status_check(struct ionic_lif *lif)
 	u16 link_status;
 	bool link_up;
 
-	if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state) ||
-	    test_bit(IONIC_LIF_F_QUEUE_RESET, lif->state))
+	if (!test_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state))
 		return;
 
 	link_status = le16_to_cpu(lif->info->status.link_status);
@@ -114,16 +113,22 @@ static void ionic_link_status_check(struct ionic_lif *lif)
 			netif_carrier_on(netdev);
 		}
 
-		if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev))
+		if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) {
+			mutex_lock(&lif->queue_lock);
 			ionic_start_queues(lif);
+			mutex_unlock(&lif->queue_lock);
+		}
 	} else {
 		if (netif_carrier_ok(netdev)) {
 			netdev_info(netdev, "Link down\n");
 			netif_carrier_off(netdev);
 		}
 
-		if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev))
+		if (lif->netdev->flags & IFF_UP && netif_running(lif->netdev)) {
+			mutex_lock(&lif->queue_lock);
 			ionic_stop_queues(lif);
+			mutex_unlock(&lif->queue_lock);
+		}
 	}
 
 	clear_bit(IONIC_LIF_F_LINK_CHECK_REQUESTED, lif->state);
@@ -1990,16 +1995,13 @@ int ionic_reset_queues(struct ionic_lif *lif, ionic_reset_cb cb, void *arg)
 	bool running;
 	int err = 0;
 
-	err = ionic_wait_for_bit(lif, IONIC_LIF_F_QUEUE_RESET);
-	if (err)
-		return err;
-
+	mutex_lock(&lif->queue_lock);
 	running = netif_running(lif->netdev);
 	if (running) {
 		netif_device_detach(lif->netdev);
 		err = ionic_stop(lif->netdev);
 		if (err)
-			goto reset_out;
+			return err;
 	}
 
 	if (cb)
@@ -2009,9 +2011,7 @@ int ionic_reset_queues(struct ionic_lif *lif, ionic_reset_cb cb, void *arg)
 		err = ionic_open(lif->netdev);
 		netif_device_attach(lif->netdev);
 	}
-
-reset_out:
-	clear_bit(IONIC_LIF_F_QUEUE_RESET, lif->state);
+	mutex_unlock(&lif->queue_lock);
 
 	return err;
 }
@@ -2158,7 +2158,9 @@ static void ionic_lif_handle_fw_down(struct ionic_lif *lif)
 
 	if (test_bit(IONIC_LIF_F_UP, lif->state)) {
 		dev_info(ionic->dev, "Surprise FW stop, stopping queues\n");
+		mutex_lock(&lif->queue_lock);
 		ionic_stop_queues(lif);
+		mutex_unlock(&lif->queue_lock);
 	}
 
 	if (netif_running(lif->netdev)) {
@@ -2285,6 +2287,7 @@ static void ionic_lif_deinit(struct ionic_lif *lif)
 	ionic_lif_qcq_deinit(lif, lif->notifyqcq);
 	ionic_lif_qcq_deinit(lif, lif->adminqcq);
 
+	mutex_destroy(&lif->queue_lock);
 	ionic_lif_reset(lif);
 }
 
@@ -2461,6 +2464,7 @@ static int ionic_lif_init(struct ionic_lif *lif)
 		return err;
 
 	lif->hw_index = le16_to_cpu(comp.hw_index);
+	mutex_init(&lif->queue_lock);
 
 	/* now that we have the hw_index we can figure out our doorbell page */
 	lif->dbid_count = le32_to_cpu(lif->ionic->ident.dev.ndbpgs_per_lif);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
index ed126dd74e01..8dc2c5d77424 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h
@@ -135,7 +135,6 @@ enum ionic_lif_state_flags {
 	IONIC_LIF_F_SW_DEBUG_STATS,
 	IONIC_LIF_F_UP,
 	IONIC_LIF_F_LINK_CHECK_REQUESTED,
-	IONIC_LIF_F_QUEUE_RESET,
 	IONIC_LIF_F_FW_RESET,
 
 	/* leave this as last */
@@ -165,6 +164,7 @@ struct ionic_lif {
 	unsigned int hw_index;
 	unsigned int kern_pid;
 	u64 __iomem *kern_dbpage;
+	struct mutex queue_lock;	/* lock for queue structures */
 	spinlock_t adminq_lock;		/* lock for AdminQ operations */
 	struct ionic_qcq *adminqcq;
 	struct ionic_qcq *notifyqcq;
@@ -213,12 +213,6 @@ struct ionic_lif {
 #define lif_to_txq(lif, i)	(&lif_to_txqcq((lif), i)->q)
 #define lif_to_rxq(lif, i)	(&lif_to_txqcq((lif), i)->q)
 
-/* return 0 if successfully set the bit, else non-zero */
-static inline int ionic_wait_for_bit(struct ionic_lif *lif, int bitname)
-{
-	return wait_on_bit_lock(lif->state, bitname, TASK_INTERRUPTIBLE);
-}
-
 static inline u32 ionic_coal_usec_to_hw(struct ionic *ionic, u32 usecs)
 {
 	u32 mult = le32_to_cpu(ionic->ident.dev.intr_coal_mult);
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index b7f900c11834..85eb8f276a37 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -161,12 +161,6 @@ static void ionic_rx_clean(struct ionic_queue *q,
 		return;
 	}
 
-	/* no packet processing while resetting */
-	if (unlikely(test_bit(IONIC_LIF_F_QUEUE_RESET, q->lif->state))) {
-		stats->dropped++;
-		return;
-	}
-
 	stats->pkts++;
 	stats->bytes += le16_to_cpu(comp->len);
 
-- 
2.17.1


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

* Re: [PATCH net 2/5] ionic: fix up filter locks and debug msgs
  2020-07-20 23:00 ` [PATCH net 2/5] ionic: fix up filter locks and debug msgs Shannon Nelson
@ 2020-07-21  0:03   ` Jakub Kicinski
  2020-07-21  1:05     ` Shannon Nelson
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2020-07-21  0:03 UTC (permalink / raw)
  To: Shannon Nelson; +Cc: netdev, davem

On Mon, 20 Jul 2020 16:00:14 -0700 Shannon Nelson wrote:
> Add in a couple of forgotten spinlocks and fix up some of
> the debug messages around filter management.

Aren't these independent changes?

> Fixes: c1e329ebec8d ("ionic: Add management of rx filters")
> Signed-off-by: Shannon Nelson <snelson@pensando.io>

> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
> index 80eeb7696e01..fb9d828812bd 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
> @@ -69,10 +69,12 @@ int ionic_rx_filters_init(struct ionic_lif *lif)
>  
>  	spin_lock_init(&lif->rx_filters.lock);
>  
> +	spin_lock_bh(&lif->rx_filters.lock);
>  	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
>  		INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]);
>  		INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]);
>  	}
> +	spin_unlock_bh(&lif->rx_filters.lock);
>  
>  	return 0;
>  }
> @@ -84,11 +86,13 @@ void ionic_rx_filters_deinit(struct ionic_lif *lif)
>  	struct hlist_node *tmp;
>  	unsigned int i;
>  
> +	spin_lock_bh(&lif->rx_filters.lock);
>  	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
>  		head = &lif->rx_filters.by_id[i];
>  		hlist_for_each_entry_safe(f, tmp, head, by_id)
>  			ionic_rx_filter_free(lif, f);
>  	}
> +	spin_unlock_bh(&lif->rx_filters.lock);
>  }

Taking a lock around init/deinit is a little strange, is this fixing 
a possible issue or just for "completeness"? If the like head can be
modified before it's initialized or after its flushed - that's a more
serious problem to address..

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

* Re: [PATCH net 2/5] ionic: fix up filter locks and debug msgs
  2020-07-21  0:03   ` Jakub Kicinski
@ 2020-07-21  1:05     ` Shannon Nelson
  0 siblings, 0 replies; 9+ messages in thread
From: Shannon Nelson @ 2020-07-21  1:05 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem

On 7/20/20 5:03 PM, Jakub Kicinski wrote:
> On Mon, 20 Jul 2020 16:00:14 -0700 Shannon Nelson wrote:
>> Add in a couple of forgotten spinlocks and fix up some of
>> the debug messages around filter management.
> Aren't these independent changes?

They can be... they went together in my head as a cleanup that was done 
before the filter_id patch that follows.

>
>> Fixes: c1e329ebec8d ("ionic: Add management of rx filters")
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
>> index 80eeb7696e01..fb9d828812bd 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c
>> @@ -69,10 +69,12 @@ int ionic_rx_filters_init(struct ionic_lif *lif)
>>   
>>   	spin_lock_init(&lif->rx_filters.lock);
>>   
>> +	spin_lock_bh(&lif->rx_filters.lock);
>>   	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
>>   		INIT_HLIST_HEAD(&lif->rx_filters.by_hash[i]);
>>   		INIT_HLIST_HEAD(&lif->rx_filters.by_id[i]);
>>   	}
>> +	spin_unlock_bh(&lif->rx_filters.lock);
>>   
>>   	return 0;
>>   }
>> @@ -84,11 +86,13 @@ void ionic_rx_filters_deinit(struct ionic_lif *lif)
>>   	struct hlist_node *tmp;
>>   	unsigned int i;
>>   
>> +	spin_lock_bh(&lif->rx_filters.lock);
>>   	for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) {
>>   		head = &lif->rx_filters.by_id[i];
>>   		hlist_for_each_entry_safe(f, tmp, head, by_id)
>>   			ionic_rx_filter_free(lif, f);
>>   	}
>> +	spin_unlock_bh(&lif->rx_filters.lock);
>>   }
> Taking a lock around init/deinit is a little strange, is this fixing
> a possible issue or just for "completeness"? If the like head can be
> modified before it's initialized or after its flushed - that's a more
> serious problem to address..

Yes, this is a completeness thing.

sln



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

* Re: [PATCH net 0/5] ionic: locking and filter fixes
  2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
                   ` (4 preceding siblings ...)
  2020-07-20 23:00 ` [PATCH net 5/5] ionic: use mutex to protect queue operations Shannon Nelson
@ 2020-07-21  1:09 ` David Miller
  5 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2020-07-21  1:09 UTC (permalink / raw)
  To: snelson; +Cc: netdev

From: Shannon Nelson <snelson@pensando.io>
Date: Mon, 20 Jul 2020 16:00:12 -0700

> These patches address an ethtool show regs problem, some locking sightings,
> and issues with RSS hash and filter_id tracking after a managed FW update.

Series applied, thank you.

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

end of thread, other threads:[~2020-07-21  1:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 23:00 [PATCH net 0/5] ionic: locking and filter fixes Shannon Nelson
2020-07-20 23:00 ` [PATCH net 1/5] ionic: use offset for ethtool regs data Shannon Nelson
2020-07-20 23:00 ` [PATCH net 2/5] ionic: fix up filter locks and debug msgs Shannon Nelson
2020-07-21  0:03   ` Jakub Kicinski
2020-07-21  1:05     ` Shannon Nelson
2020-07-20 23:00 ` [PATCH net 3/5] ionic: update filter id after replay Shannon Nelson
2020-07-20 23:00 ` [PATCH net 4/5] ionic: keep rss hash after fw update Shannon Nelson
2020-07-20 23:00 ` [PATCH net 5/5] ionic: use mutex to protect queue operations Shannon Nelson
2020-07-21  1:09 ` [PATCH net 0/5] ionic: locking and filter fixes 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).