6.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Przemek Kitszel przemyslaw.kitszel@intel.com
[ Upstream commit 05702b5c949bd46243181833d4726f4c5e95f5e3 ]
Lockdep annotations help in general, but here it is extra good, as next commit will remove crit lock.
Reviewed-by: Jacob Keller jacob.e.keller@intel.com Signed-off-by: Przemek Kitszel przemyslaw.kitszel@intel.com Tested-by: Rafal Romanowski rafal.romanowski@intel.com Signed-off-by: Tony Nguyen anthony.l.nguyen@intel.com Stable-dep-of: 120f28a6f314 ("iavf: get rid of the crit lock") Signed-off-by: Sasha Levin sashal@kernel.org --- drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 6 ++++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 10 ++++++++++ 2 files changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c index 288bb5b2e72ef..03d86fe80ad91 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c +++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c @@ -4,6 +4,8 @@ #include <linux/bitfield.h> #include <linux/uaccess.h>
+#include <net/netdev_lock.h> + /* ethtool support for iavf */ #include "iavf.h"
@@ -1259,6 +1261,8 @@ static int iavf_add_fdir_ethtool(struct iavf_adapter *adapter, struct ethtool_rx int count = 50; int err;
+ netdev_assert_locked(adapter->netdev); + if (!(adapter->flags & IAVF_FLAG_FDIR_ENABLED)) return -EOPNOTSUPP;
@@ -1440,6 +1444,8 @@ iavf_set_adv_rss_hash_opt(struct iavf_adapter *adapter, u64 hash_flds; u32 hdrs;
+ netdev_assert_locked(adapter->netdev); + if (!ADV_RSS_SUPPORT(adapter)) return -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 4b6963ffaba5f..bf8c7baf2ab8a 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1292,6 +1292,8 @@ static void iavf_configure(struct iavf_adapter *adapter) **/ static void iavf_up_complete(struct iavf_adapter *adapter) { + netdev_assert_locked(adapter->netdev); + iavf_change_state(adapter, __IAVF_RUNNING); clear_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
@@ -1417,6 +1419,8 @@ void iavf_down(struct iavf_adapter *adapter) { struct net_device *netdev = adapter->netdev;
+ netdev_assert_locked(netdev); + if (adapter->state <= __IAVF_DOWN_PENDING) return;
@@ -3078,6 +3082,8 @@ static void iavf_disable_vf(struct iavf_adapter *adapter) struct iavf_vlan_filter *fv, *fvtmp; struct iavf_cloud_filter *cf, *cftmp;
+ netdev_assert_locked(adapter->netdev); + adapter->flags |= IAVF_FLAG_PF_COMMS_FAILED;
/* We don't use netif_running() because it may be true prior to @@ -5194,6 +5200,8 @@ iavf_shaper_set(struct net_shaper_binding *binding, struct iavf_ring *tx_ring; int ret = 0;
+ netdev_assert_locked(adapter->netdev); + mutex_lock(&adapter->crit_lock); if (handle->id >= adapter->num_active_queues) goto unlock; @@ -5222,6 +5230,8 @@ static int iavf_shaper_del(struct net_shaper_binding *binding, struct iavf_adapter *adapter = netdev_priv(binding->netdev); struct iavf_ring *tx_ring;
+ netdev_assert_locked(adapter->netdev); + mutex_lock(&adapter->crit_lock); if (handle->id >= adapter->num_active_queues) goto unlock;