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 <snel...@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