* [PATCH iwl-next v2] ice: Implement ethtool reset support
@ 2024-08-05 12:46 Wojciech Drewek
2024-08-05 13:49 ` Przemek Kitszel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Wojciech Drewek @ 2024-08-05 12:46 UTC (permalink / raw)
To: netdev
Cc: intel-wired-lan, horms, anthony.l.nguyen, edumazet, kuba, pabeni,
przemyslaw.kitszel
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@linux.intel.com>
Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
---
.../device_drivers/ethernet/intel/ice.rst | 28 +++++++
drivers/net/ethernet/intel/ice/ice_ethtool.c | 77 +++++++++++++++++++
2 files changed, 105 insertions(+)
diff --git a/Documentation/networking/device_drivers/ethernet/intel/ice.rst b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
index 934752f675ba..c043164bfacc 100644
--- a/Documentation/networking/device_drivers/ethernet/intel/ice.rst
+++ b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
@@ -102,6 +102,34 @@ rx_bytes as "X", then ethtool (hardware statistics) will display rx_bytes as
"X+40" (4 bytes CRC x 10 packets).
+ethtool reset
+-------------
+The driver supports 3 types of resets:
+- PF reset - resets only components associated with the given PF, does not
+ impact other PFs
+- CORE reset - whole adapter is affected, reset all PFs
+- GLOBAL reset - same as CORE but mac and phy components are also reinitialized
+
+These are mapped to ethtool reset flags as follow:
+- 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
+
+In switchdev mode you can reset a VF using port representor:
+
+ # ethtool --reset <repr> irq dma filter offload
+
+
Viewing Link Messages
---------------------
Link messages will not be displayed to the console if the distribution is
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 39d2652c3ee1..14f4bd9397c5 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -4794,6 +4794,81 @@ static void ice_get_ts_stats(struct net_device *netdev,
ts_stats->lost = ptp->tx_hwtstamp_timeouts;
}
+#define ICE_ETHTOOL_PFR (ETH_RESET_IRQ | ETH_RESET_DMA | \
+ ETH_RESET_FILTER | ETH_RESET_OFFLOAD)
+
+#define ICE_ETHTOOL_CORER ((ICE_ETHTOOL_PFR | ETH_RESET_RAM) << \
+ ETH_RESET_SHARED_SHIFT)
+
+#define ICE_ETHTOOL_GLOBR (ICE_ETHTOOL_CORER | \
+ (ETH_RESET_MAC << ETH_RESET_SHARED_SHIFT) | \
+ (ETH_RESET_PHY << ETH_RESET_SHARED_SHIFT))
+
+#define ICE_ETHTOOL_VFR ICE_ETHTOOL_PFR
+
+/**
+ * ice_ethtool_reset - triggers a given type of reset
+ * @dev: network interface device structure
+ * @flags: set of reset flags
+ *
+ * Return: 0 on success, -EOPNOTSUPP when using unsupported set of flags.
+ */
+static int ice_ethtool_reset(struct net_device *dev, u32 *flags)
+{
+ struct ice_netdev_priv *np = netdev_priv(dev);
+ struct ice_pf *pf = np->vsi->back;
+ enum ice_reset_req reset;
+
+ switch (*flags) {
+ case ICE_ETHTOOL_CORER:
+ reset = ICE_RESET_CORER;
+ break;
+ case ICE_ETHTOOL_GLOBR:
+ reset = ICE_RESET_GLOBR;
+ break;
+ case ICE_ETHTOOL_PFR:
+ reset = ICE_RESET_PFR;
+ break;
+ default:
+ netdev_info(dev, "Unsupported set of ethtool flags");
+ return -EOPNOTSUPP;
+ }
+
+ ice_schedule_reset(pf, reset);
+
+ *flags = 0;
+
+ return 0;
+}
+
+/**
+ * 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.
+ */
+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;
+
+ return ice_reset_vf(vf, ICE_VF_RESET_VFLR | ICE_VF_RESET_LOCK);
+}
+
static const struct ethtool_ops ice_ethtool_ops = {
.cap_rss_ctx_supported = true,
.supported_coalesce_params = ETHTOOL_COALESCE_USECS |
@@ -4829,6 +4904,7 @@ static const struct ethtool_ops ice_ethtool_ops = {
.nway_reset = ice_nway_reset,
.get_pauseparam = ice_get_pauseparam,
.set_pauseparam = ice_set_pauseparam,
+ .reset = ice_ethtool_reset,
.get_rxfh_key_size = ice_get_rxfh_key_size,
.get_rxfh_indir_size = ice_get_rxfh_indir_size,
.get_rxfh = ice_get_rxfh,
@@ -4885,6 +4961,7 @@ static const struct ethtool_ops ice_ethtool_repr_ops = {
.get_strings = ice_repr_get_strings,
.get_ethtool_stats = ice_repr_get_ethtool_stats,
.get_sset_count = ice_repr_get_sset_count,
+ .reset = ice_repr_ethtool_reset,
};
/**
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iwl-next v2] ice: Implement ethtool reset support
2024-08-05 12:46 [PATCH iwl-next v2] ice: Implement ethtool reset support Wojciech Drewek
@ 2024-08-05 13:49 ` Przemek Kitszel
2024-08-05 21:01 ` Jakub Kicinski
2024-08-06 14:55 ` Simon Horman
2 siblings, 0 replies; 5+ messages in thread
From: Przemek Kitszel @ 2024-08-05 13:49 UTC (permalink / raw)
To: Wojciech Drewek
Cc: intel-wired-lan, horms, netdev, anthony.l.nguyen, edumazet, kuba,
pabeni
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@linux.intel.com>
> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek@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@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iwl-next v2] ice: Implement ethtool reset support
2024-08-05 12:46 [PATCH iwl-next v2] ice: Implement ethtool reset support Wojciech Drewek
2024-08-05 13:49 ` Przemek Kitszel
@ 2024-08-05 21:01 ` Jakub Kicinski
2024-08-06 14:55 ` Simon Horman
2 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-05 21:01 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, intel-wired-lan, horms, anthony.l.nguyen, edumazet,
pabeni, przemyslaw.kitszel
On Mon, 5 Aug 2024 14:46:51 +0200 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.
Acked-by: Jakub Kicinski <kuba@kernel.org>
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iwl-next v2] ice: Implement ethtool reset support
2024-08-05 12:46 [PATCH iwl-next v2] ice: Implement ethtool reset support Wojciech Drewek
2024-08-05 13:49 ` Przemek Kitszel
2024-08-05 21:01 ` Jakub Kicinski
@ 2024-08-06 14:55 ` Simon Horman
2024-08-07 10:42 ` Wojciech Drewek
2 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2024-08-06 14:55 UTC (permalink / raw)
To: Wojciech Drewek
Cc: netdev, intel-wired-lan, anthony.l.nguyen, edumazet, kuba, pabeni,
przemyslaw.kitszel
On Mon, Aug 05, 2024 at 02:46:51PM +0200, 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@linux.intel.com>
> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
> ---
> .../device_drivers/ethernet/intel/ice.rst | 28 +++++++
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 77 +++++++++++++++++++
> 2 files changed, 105 insertions(+)
>
> diff --git a/Documentation/networking/device_drivers/ethernet/intel/ice.rst b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
> index 934752f675ba..c043164bfacc 100644
> --- a/Documentation/networking/device_drivers/ethernet/intel/ice.rst
> +++ b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
> @@ -102,6 +102,34 @@ rx_bytes as "X", then ethtool (hardware statistics) will display rx_bytes as
> "X+40" (4 bytes CRC x 10 packets).
>
>
> +ethtool reset
> +-------------
> +The driver supports 3 types of resets:
> +- PF reset - resets only components associated with the given PF, does not
> + impact other PFs
> +- CORE reset - whole adapter is affected, reset all PFs
> +- GLOBAL reset - same as CORE but mac and phy components are also reinitialized
Hi Wojciech,
I'm not sure, but I think that Sphinx wants blank likes between these list
items.
Flagged by make: htmldocs SPHINXDIRS=networking
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iwl-next v2] ice: Implement ethtool reset support
2024-08-06 14:55 ` Simon Horman
@ 2024-08-07 10:42 ` Wojciech Drewek
0 siblings, 0 replies; 5+ messages in thread
From: Wojciech Drewek @ 2024-08-07 10:42 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, intel-wired-lan, anthony.l.nguyen, edumazet, kuba, pabeni,
przemyslaw.kitszel
On 06.08.2024 16:55, Simon Horman wrote:
> On Mon, Aug 05, 2024 at 02:46:51PM +0200, 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@linux.intel.com>
>> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
>> Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
>> ---
>> .../device_drivers/ethernet/intel/ice.rst | 28 +++++++
>> drivers/net/ethernet/intel/ice/ice_ethtool.c | 77 +++++++++++++++++++
>> 2 files changed, 105 insertions(+)
>>
>> diff --git a/Documentation/networking/device_drivers/ethernet/intel/ice.rst b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
>> index 934752f675ba..c043164bfacc 100644
>> --- a/Documentation/networking/device_drivers/ethernet/intel/ice.rst
>> +++ b/Documentation/networking/device_drivers/ethernet/intel/ice.rst
>> @@ -102,6 +102,34 @@ rx_bytes as "X", then ethtool (hardware statistics) will display rx_bytes as
>> "X+40" (4 bytes CRC x 10 packets).
>>
>>
>> +ethtool reset
>> +-------------
>> +The driver supports 3 types of resets:
>> +- PF reset - resets only components associated with the given PF, does not
>> + impact other PFs
>> +- CORE reset - whole adapter is affected, reset all PFs
>> +- GLOBAL reset - same as CORE but mac and phy components are also reinitialized
>
> Hi Wojciech,
>
> I'm not sure, but I think that Sphinx wants blank likes between these list
> items.
Thanks, I fixed that in v3
>
> Flagged by make: htmldocs SPHINXDIRS=networking
>
> ...
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-07 10:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-05 12:46 [PATCH iwl-next v2] ice: Implement ethtool reset support Wojciech Drewek
2024-08-05 13:49 ` Przemek Kitszel
2024-08-05 21:01 ` Jakub Kicinski
2024-08-06 14:55 ` Simon Horman
2024-08-07 10:42 ` Wojciech Drewek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).