ice: Correctly handle aux device when num channels change
Subsystems (2)
PATCH v2 1/1 ice: Correctly handle aux device when num channels change
When the number of channels/queues changes on an interface, it is necessary to change how those resources are distributed to the auxiliary device for maintaining RDMA functionality. To do this, the best way is to unplug, and then re-plug the auxiliary device. This will cause all current resource allocation to be released, and then re-requested under the new state.
Since the set_channel command from ethtool comes in while holding the RTNL lock, it is necessary to offset the plugging and unplugging of auxiliary device to another context. For this purpose, set the flags for UNPLUG and PLUG in the PF state, then respond to them in the service task.
Also, since the auxiliary device will be unplugged/plugged at the end of the flow, it is better to not send the event for TCs changing in the middle of the flow. This will prevent a timing issue between the events and the probe/release calls conflicting.
--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 ++++++ drivers/net/ethernet/intel/ice/ice_idc.c | 3 +++ drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 4 files changed, 14 insertions(+)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -281,6 +281,7 @@ enum ice_pf_state {ICE_FLTR_OVERFLOW_PROMISC ,ICE_VF_DIS ,ICE_CFG_BUSY , +ICE_SET_CHANNELS ,ICE_SERVICE_SCHED ,ICE_SERVICE_DIS , ICE_FD_FLUSH_REQ,
@@ -485,6 +486,7 @@ enum ice_pf_flags {ICE_FLAG_VF_VLAN_PRUNING ,ICE_FLAG_LINK_LENIENT_MODE_ENA ,ICE_FLAG_PLUG_AUX_DEV , +ICE_FLAG_UNPLUG_AUX_DEV ,ICE_FLAG_MTU_CHANGED ,ICE_FLAG_GNSS ,/* GNSS successfully initialized */ ICE_PF_FLAGS_NBITS /* must be last */
drivers/net/ethernet/intel/ice/ice_ethtool.c +6 -0
@@ -3536,6 +3536,8 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)return -EINVAL ; } +set_bit (ICE_SET_CHANNELS , pf->state); +ice_vsi_recfg_qs (vsi, new_rx, new_tx);if (!netif_is_rxfh_configured (dev))
@@ -3543,6 +3545,10 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)/* Update rss_size due to change in Rx queues */ vsi->rss_size =ice_get_valid_rss_size (&pf->hw, new_rx); +clear_bit (ICE_SET_CHANNELS , pf->state); + +set_bit (ICE_FLAG_UNPLUG_AUX_DEV , pf->flags); +set_bit (ICE_FLAG_PLUG_AUX_DEV , pf->flags);return 0 ; }
drivers/net/ethernet/intel/ice/ice_idc.c +3 -0
@@ -37,6 +37,9 @@ void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_event *event)if (WARN_ON_ONCE (!in_task ()))return ; +if (test_bit (ICE_SET_CHANNELS , pf->state)) +return ; +mutex_lock (&pf->adev_mutex);if (!pf->adev) goto finish;
drivers/net/ethernet/intel/ice/ice_main.c +3 -0
@@ -2300,6 +2300,9 @@ static void ice_service_task(struct work_struct *work) } } +if (test_and_clear_bit (ICE_FLAG_UNPLUG_AUX_DEV , pf->flags)) +ice_unplug_aux_dev (pf); +if (test_bit (ICE_FLAG_PLUG_AUX_DEV , pf->flags)) {/* Plug aux device per request */ ice_plug_aux_dev (pf);
Signature · 6 lines
2.37.3 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Quoted 27 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dave Ertman
Sent: Monday, November 14, 2022 11:00 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH net v2] ice: Correctly handle aux device when num channels changeWhen the number of channels/queues changes on an interface, it is necessary to change how those resources are distributed to the auxiliary device for maintaining RDMA functionality. To do this, the best way is to unplug, and then re-plug the auxiliary device. This will cause all current resource allocation to be released, and then re-requested under the new state.
Since the
set_channelcommand from ethtool comes in while holding the RTNL lock, it is necessary to offset the plugging and unplugging of auxiliary device to another context. For this purpose, set the flags for UNPLUG and PLUG in the PF state, then respond to them in the service task.Also, since the auxiliary device will be unplugged/plugged at the end of the flow, it is better to not send the event for TCs changing in the middle of the flow. This will prevent a timing issue between the events and the probe/release calls conflicting.
Quoted 9 lines
Fixes 348048e724a0 ("ice: Implement iidc operations")Signed-off-by Dave Ertman <[email protected]>--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_ethtool.c | 6 ++++++ drivers/net/ethernet/intel/ice/ice_idc.c | 3 +++ drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 4 files changed, 14 insertions(+)
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan