[Intel-wired-lan] [PATCH iwl-next v2] ice: Implement ethtool reset support

Przemek Kitszel przemyslaw.kitszel at intel.com
Mon Aug 5 13:49:23 UTC 2024


On 8/5/24 14:46, Wojciech Drewek wrote:
> Enable ethtool reset support. Ethtool reset flags are mapped to the
> E810 reset type:
> PF reset:
>    $ ethtool --reset <ethX> irq dma filter offload
> CORE reset:
>    $ ethtool --reset <ethX> irq-shared dma-shared filter-shared \
>      offload-shared ram-shared
> GLOBAL reset:
>    $ ethtool --reset <ethX> irq-shared dma-shared filter-shared \
>      offload-shared mac-shared phy-shared ram-shared
> 
> Calling the same set of flags as in PF reset case on port representor
> triggers VF reset.
> 
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski at linux.intel.com>
> Reviewed-by: Marcin Szycik <marcin.szycik at linux.intel.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek at intel.com>

> +/**
> + * ice_repr_ethtool_reset - triggers a VF reset
> + * @dev: network interface device structure
> + * @flags: set of reset flags
> + *
> + * Return: 0 on success,
> + * -EOPNOTSUPP when using unsupported set of flags
> + * -EBUSY when VF is not ready for reset.

nit: technically it could return also -EIO, -EINVAL, or -EFAULT if VF 
reset fails
I don't know if this list needs to be exhaustive though

> + */
> +static int ice_repr_ethtool_reset(struct net_device *dev, u32 *flags)
> +{
> +	struct ice_repr *repr = ice_netdev_to_repr(dev);
> +	struct ice_vf *vf;
> +
> +	if (repr->type != ICE_REPR_TYPE_VF ||
> +	    *flags != ICE_ETHTOOL_VFR)
> +		return -EOPNOTSUPP;
> +
> +	vf = repr->vf;
> +
> +	if (ice_check_vf_ready_for_cfg(vf))
> +		return -EBUSY;
> +
> +	*flags = 0;

I'm fine with zeroing the flags here even if the reset fails afterwards

> +
> +	return ice_reset_vf(vf, ICE_VF_RESET_VFLR | ICE_VF_RESET_LOCK);
> +}

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel at intel.com>



More information about the Intel-wired-lan mailing list