ice: Fix ASSERT_RTNL() warning during certain scenarios
authorAmritha Nambiar <amritha.nambiar@intel.com>
Tue, 13 Feb 2024 19:48:50 +0000 (11:48 -0800)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 20 Feb 2024 21:30:26 +0000 (13:30 -0800)
commit080b0c8d6d261b400f24bb1075fbab8c6daaf69e
treeb7cbc814ff5a9309fe6506eff7a8397ee5bcef7f
parentee89921da471edcb4b1e67f5bbfedddf39749782
ice: Fix ASSERT_RTNL() warning during certain scenarios

Commit 91fdbce7e8d6 ("ice: Add support in the driver for associating
queue with napi") invoked the netif_queue_set_napi() call. This
kernel function requires to be called with rtnl_lock taken,
otherwise ASSERT_RTNL() warning will be triggered. ice_vsi_rebuild()
initiating this call is under rtnl_lock when the rebuild is in
response to configuration changes from external interfaces (such as
tc, ethtool etc. which holds the lock). But, the VSI rebuild
generated from service tasks and resets (PFR/CORER/GLOBR) is not
under rtnl lock protection. Handle these cases as well to hold lock
before the kernel call (by setting the 'locked' boolean to false).

netif_queue_set_napi() is also used to clear previously set napi
in the q_vector unroll flow. Handle this for locked/lockless execution
paths.

Fixes: 91fdbce7e8d6 ("ice: Add support in the driver for associating queue with napi")
Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_base.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_lib.h
drivers/net/ethernet/intel/ice/ice_main.c