Subject: Re: [PATCH net v3 1/2] ice: Prevent set_channel from changing queues while RDMA active

From: Leon Romanovsky <[email-masked]>
Date: Sun, 22 Jan 2023 14:37:09 +0200

On Fri, Jan 20, 2023 at 01:12:30PM -0800, Tony Nguyen wrote:
> From: Dave Ertman <[email-masked]>
> 
> The PF controls the set of queues that the RDMA auxiliary_driver requests
> resources from.  The set_channel command will alter that pool and trigger a
> reconfiguration of the VSI, which breaks RDMA functionality.
> 
> Prevent set_channel from executing when RDMA driver bound to auxiliary
> device.
> 
> Fixes: 348048e724a0 ("ice: Implement iidc operations")
> Co-developed-by: Michal Swiatkowski <[email-masked]>
> Signed-off-by: Michal Swiatkowski <[email-masked]>
> Signed-off-by: Dave Ertman <[email-masked]>
> Tested-by: Gurucharan G <[email-masked]> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <[email-masked]>
> ---
>  drivers/net/ethernet/intel/ice/ice_ethtool.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index 4191994d8f3a..16006eedfceb 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -3705,6 +3705,14 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
>  		return -EINVAL;
>  	}
>  
> +	mutex_lock(&pf->adev_mutex);
> +	if (pf->adev && pf->adev->dev.driver) {

adev_mutex protects pf->adev, but not .driver, isn't it?

> +		netdev_err(dev, "Cannot change channels when RDMA is active\n");
> +		mutex_unlock(&pf->adev_mutex);
> +		return -EINVAL;
> +	}
> +	mutex_unlock(&pf->adev_mutex);
> +
>  	ice_vsi_recfg_qs(vsi, new_rx, new_tx);
>  
>  	if (!netif_is_rxfh_configured(dev))
> -- 
> 2.38.1
>