|
Jiri Slaby |
ba7816 |
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
|
Jiri Slaby |
ba7816 |
Date: Thu, 23 Mar 2023 09:34:17 +0100
|
|
Jiri Slaby |
ba7816 |
Subject: [PATCH] sfc: ef10: don't overwrite offload features at NIC reset
|
|
Jiri Slaby |
ba7816 |
MIME-Version: 1.0
|
|
Jiri Slaby |
ba7816 |
Content-Type: text/plain; charset=UTF-8
|
|
Jiri Slaby |
ba7816 |
Content-Transfer-Encoding: 8bit
|
|
Jiri Slaby |
ba7816 |
References: bsc#1012628
|
|
Jiri Slaby |
ba7816 |
Patch-mainline: 6.2.10
|
|
Jiri Slaby |
ba7816 |
Git-commit: ca4a80e4bb7e87daf33b27d2ab9e4f5311018a89
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
[ Upstream commit ca4a80e4bb7e87daf33b27d2ab9e4f5311018a89 ]
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
At NIC reset, some offload features related to encapsulated traffic
|
|
Jiri Slaby |
ba7816 |
might have changed (this mainly happens if the firmware-variant is
|
|
Jiri Slaby |
ba7816 |
changed with the sfboot userspace tool). Because of this, features are
|
|
Jiri Slaby |
ba7816 |
checked and set again at reset time.
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
However, this was not done right, and some features were improperly
|
|
Jiri Slaby |
ba7816 |
overwritten at NIC reset:
|
|
Jiri Slaby |
ba7816 |
- Tunneled IPv6 segmentation was always disabled
|
|
Jiri Slaby |
ba7816 |
- Features disabled with ethtool were reenabled
|
|
Jiri Slaby |
ba7816 |
- Features that becomes unsupported after the reset were not disabled
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
Also, checking if the device supports IPV6_CSUM to enable TSO6 is no
|
|
Jiri Slaby |
ba7816 |
longer necessary because all currently supported devices support it.
|
|
Jiri Slaby |
ba7816 |
Additionally, move the assignment of some other features to the
|
|
Jiri Slaby |
ba7816 |
EF10_OFFLOAD_FEATURES macro, like it is done in ef100, leaving the
|
|
Jiri Slaby |
ba7816 |
selection of features in efx_pci_probe_post_io a bit cleaner.
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
Fixes: ffffd2454a7a ("sfc: correctly advertise tunneled IPv6 segmentation")
|
|
Jiri Slaby |
ba7816 |
Fixes: 24b2c3751aa3 ("sfc: advertise encapsulated offloads on EF10")
|
|
Jiri Slaby |
ba7816 |
Reported-by: Tianhao Zhao <tizhao@redhat.com>
|
|
Jiri Slaby |
ba7816 |
Suggested-by: Jonathan Cooper <jonathan.s.cooper@amd.com>
|
|
Jiri Slaby |
ba7816 |
Tested-by: Jonathan Cooper <jonathan.s.cooper@amd.com>
|
|
Jiri Slaby |
ba7816 |
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
|
Jiri Slaby |
ba7816 |
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
|
|
Jiri Slaby |
ba7816 |
Link: https://lore.kernel.org/r/20230323083417.7345-1-ihuguet@redhat.com
|
|
Jiri Slaby |
ba7816 |
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
Jiri Slaby |
ba7816 |
Signed-off-by: Sasha Levin <sashal@kernel.org>
|
|
Jiri Slaby |
ba7816 |
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
|
Jiri Slaby |
ba7816 |
---
|
|
Jiri Slaby |
ba7816 |
drivers/net/ethernet/sfc/ef10.c | 38 ++++++++++++++++++++++-----------
|
|
Jiri Slaby |
ba7816 |
drivers/net/ethernet/sfc/efx.c | 17 ++++++---------
|
|
Jiri Slaby |
ba7816 |
2 files changed, 33 insertions(+), 22 deletions(-)
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
|
|
Jiri Slaby |
ba7816 |
index 7022fb20..d30459db 100644
|
|
Jiri Slaby |
ba7816 |
--- a/drivers/net/ethernet/sfc/ef10.c
|
|
Jiri Slaby |
ba7816 |
+++ b/drivers/net/ethernet/sfc/ef10.c
|
|
Jiri Slaby |
ba7816 |
@@ -1304,7 +1304,8 @@ static void efx_ef10_fini_nic(struct efx_nic *efx)
|
|
Jiri Slaby |
ba7816 |
static int efx_ef10_init_nic(struct efx_nic *efx)
|
|
Jiri Slaby |
ba7816 |
{
|
|
Jiri Slaby |
ba7816 |
struct efx_ef10_nic_data *nic_data = efx->nic_data;
|
|
Jiri Slaby |
ba7816 |
- netdev_features_t hw_enc_features = 0;
|
|
Jiri Slaby |
ba7816 |
+ struct net_device *net_dev = efx->net_dev;
|
|
Jiri Slaby |
ba7816 |
+ netdev_features_t tun_feats, tso_feats;
|
|
Jiri Slaby |
ba7816 |
int rc;
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
if (nic_data->must_check_datapath_caps) {
|
|
Jiri Slaby |
ba7816 |
@@ -1349,20 +1350,30 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
|
|
Jiri Slaby |
ba7816 |
nic_data->must_restore_piobufs = false;
|
|
Jiri Slaby |
ba7816 |
}
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
- /* add encapsulated checksum offload features */
|
|
Jiri Slaby |
ba7816 |
+ /* encap features might change during reset if fw variant changed */
|
|
Jiri Slaby |
ba7816 |
if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx))
|
|
Jiri Slaby |
ba7816 |
- hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
|
|
Jiri Slaby |
ba7816 |
- /* add encapsulated TSO features */
|
|
Jiri Slaby |
ba7816 |
- if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) {
|
|
Jiri Slaby |
ba7816 |
- netdev_features_t encap_tso_features;
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
|
|
Jiri Slaby |
ba7816 |
+ else
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
- encap_tso_features = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
|
|
Jiri Slaby |
ba7816 |
- NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
|
|
Jiri Slaby |
ba7816 |
+ tun_feats = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
|
|
Jiri Slaby |
ba7816 |
+ NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
|
|
Jiri Slaby |
ba7816 |
+ tso_feats = NETIF_F_TSO | NETIF_F_TSO6;
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
- hw_enc_features |= encap_tso_features | NETIF_F_TSO;
|
|
Jiri Slaby |
ba7816 |
- efx->net_dev->features |= encap_tso_features;
|
|
Jiri Slaby |
ba7816 |
+ if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) {
|
|
Jiri Slaby |
ba7816 |
+ /* If this is first nic_init, or if it is a reset and a new fw
|
|
Jiri Slaby |
ba7816 |
+ * variant has added new features, enable them by default.
|
|
Jiri Slaby |
ba7816 |
+ * If the features are not new, maintain their current value.
|
|
Jiri Slaby |
ba7816 |
+ */
|
|
Jiri Slaby |
ba7816 |
+ if (!(net_dev->hw_features & tun_feats))
|
|
Jiri Slaby |
ba7816 |
+ net_dev->features |= tun_feats;
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_enc_features |= tun_feats | tso_feats;
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_features |= tun_feats;
|
|
Jiri Slaby |
ba7816 |
+ } else {
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_enc_features &= ~(tun_feats | tso_feats);
|
|
Jiri Slaby |
ba7816 |
+ net_dev->hw_features &= ~tun_feats;
|
|
Jiri Slaby |
ba7816 |
+ net_dev->features &= ~tun_feats;
|
|
Jiri Slaby |
ba7816 |
}
|
|
Jiri Slaby |
ba7816 |
- efx->net_dev->hw_enc_features = hw_enc_features;
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
/* don't fail init if RSS setup doesn't work */
|
|
Jiri Slaby |
ba7816 |
rc = efx->type->rx_push_rss_config(efx, false,
|
|
Jiri Slaby |
ba7816 |
@@ -4021,7 +4032,10 @@ static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
|
|
Jiri Slaby |
ba7816 |
NETIF_F_HW_VLAN_CTAG_FILTER | \
|
|
Jiri Slaby |
ba7816 |
NETIF_F_IPV6_CSUM | \
|
|
Jiri Slaby |
ba7816 |
NETIF_F_RXHASH | \
|
|
Jiri Slaby |
ba7816 |
- NETIF_F_NTUPLE)
|
|
Jiri Slaby |
ba7816 |
+ NETIF_F_NTUPLE | \
|
|
Jiri Slaby |
ba7816 |
+ NETIF_F_SG | \
|
|
Jiri Slaby |
ba7816 |
+ NETIF_F_RXCSUM | \
|
|
Jiri Slaby |
ba7816 |
+ NETIF_F_RXALL)
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
|
|
Jiri Slaby |
ba7816 |
.is_vf = true,
|
|
Jiri Slaby |
ba7816 |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
|
|
Jiri Slaby |
ba7816 |
index 3a86f121..6a1bff54 100644
|
|
Jiri Slaby |
ba7816 |
--- a/drivers/net/ethernet/sfc/efx.c
|
|
Jiri Slaby |
ba7816 |
+++ b/drivers/net/ethernet/sfc/efx.c
|
|
Jiri Slaby |
ba7816 |
@@ -1001,21 +1001,18 @@ static int efx_pci_probe_post_io(struct efx_nic *efx)
|
|
Jiri Slaby |
ba7816 |
}
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
/* Determine netdevice features */
|
|
Jiri Slaby |
ba7816 |
- net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
|
|
Jiri Slaby |
ba7816 |
- NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL);
|
|
Jiri Slaby |
ba7816 |
- if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) {
|
|
Jiri Slaby |
ba7816 |
- net_dev->features |= NETIF_F_TSO6;
|
|
Jiri Slaby |
ba7816 |
- if (efx_has_cap(efx, TX_TSO_V2_ENCAP))
|
|
Jiri Slaby |
ba7816 |
- net_dev->hw_enc_features |= NETIF_F_TSO6;
|
|
Jiri Slaby |
ba7816 |
- }
|
|
Jiri Slaby |
ba7816 |
- /* Check whether device supports TSO */
|
|
Jiri Slaby |
ba7816 |
- if (!efx->type->tso_versions || !efx->type->tso_versions(efx))
|
|
Jiri Slaby |
ba7816 |
- net_dev->features &= ~NETIF_F_ALL_TSO;
|
|
Jiri Slaby |
ba7816 |
+ net_dev->features |= efx->type->offload_features;
|
|
Jiri Slaby |
ba7816 |
+
|
|
Jiri Slaby |
ba7816 |
+ /* Add TSO features */
|
|
Jiri Slaby |
ba7816 |
+ if (efx->type->tso_versions && efx->type->tso_versions(efx))
|
|
Jiri Slaby |
ba7816 |
+ net_dev->features |= NETIF_F_TSO | NETIF_F_TSO6;
|
|
Jiri Slaby |
ba7816 |
+
|
|
Jiri Slaby |
ba7816 |
/* Mask for features that also apply to VLAN devices */
|
|
Jiri Slaby |
ba7816 |
net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
|
|
Jiri Slaby |
ba7816 |
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
|
|
Jiri Slaby |
ba7816 |
NETIF_F_RXCSUM);
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
+ /* Determine user configurable features */
|
|
Jiri Slaby |
ba7816 |
net_dev->hw_features |= net_dev->features & ~efx->fixed_features;
|
|
Jiri Slaby |
ba7816 |
|
|
Jiri Slaby |
ba7816 |
/* Disable receiving frames with bad FCS, by default. */
|
|
Jiri Slaby |
ba7816 |
--
|
|
Jiri Slaby |
ba7816 |
2.35.3
|
|
Jiri Slaby |
ba7816 |
|