hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/net/ethernet/sfc/ef10.c
....@@ -1297,14 +1297,17 @@
12971297 {
12981298 struct efx_ef10_nic_data *nic_data = efx->nic_data;
12991299
1300
+ spin_lock_bh(&efx->stats_lock);
13001301 kfree(nic_data->mc_stats);
13011302 nic_data->mc_stats = NULL;
1303
+ spin_unlock_bh(&efx->stats_lock);
13021304 }
13031305
13041306 static int efx_ef10_init_nic(struct efx_nic *efx)
13051307 {
13061308 struct efx_ef10_nic_data *nic_data = efx->nic_data;
1307
- netdev_features_t hw_enc_features = 0;
1309
+ struct net_device *net_dev = efx->net_dev;
1310
+ netdev_features_t tun_feats, tso_feats;
13081311 int rc;
13091312
13101313 if (nic_data->must_check_datapath_caps) {
....@@ -1349,20 +1352,30 @@
13491352 nic_data->must_restore_piobufs = false;
13501353 }
13511354
1352
- /* add encapsulated checksum offload features */
1355
+ /* encap features might change during reset if fw variant changed */
13531356 if (efx_has_cap(efx, VXLAN_NVGRE) && !efx_ef10_is_vf(efx))
1354
- hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
1355
- /* add encapsulated TSO features */
1357
+ net_dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
1358
+ else
1359
+ net_dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
1360
+
1361
+ tun_feats = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
1362
+ NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
1363
+ tso_feats = NETIF_F_TSO | NETIF_F_TSO6;
1364
+
13561365 if (efx_has_cap(efx, TX_TSO_V2_ENCAP)) {
1357
- netdev_features_t encap_tso_features;
1358
-
1359
- encap_tso_features = NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
1360
- NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM;
1361
-
1362
- hw_enc_features |= encap_tso_features | NETIF_F_TSO;
1363
- efx->net_dev->features |= encap_tso_features;
1366
+ /* If this is first nic_init, or if it is a reset and a new fw
1367
+ * variant has added new features, enable them by default.
1368
+ * If the features are not new, maintain their current value.
1369
+ */
1370
+ if (!(net_dev->hw_features & tun_feats))
1371
+ net_dev->features |= tun_feats;
1372
+ net_dev->hw_enc_features |= tun_feats | tso_feats;
1373
+ net_dev->hw_features |= tun_feats;
1374
+ } else {
1375
+ net_dev->hw_enc_features &= ~(tun_feats | tso_feats);
1376
+ net_dev->hw_features &= ~tun_feats;
1377
+ net_dev->features &= ~tun_feats;
13641378 }
1365
- efx->net_dev->hw_enc_features = hw_enc_features;
13661379
13671380 /* don't fail init if RSS setup doesn't work */
13681381 rc = efx->type->rx_push_rss_config(efx, false,
....@@ -1825,9 +1838,14 @@
18251838
18261839 efx_ef10_get_stat_mask(efx, mask);
18271840
1828
- efx_nic_copy_stats(efx, nic_data->mc_stats);
1829
- efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT,
1830
- mask, stats, nic_data->mc_stats, false);
1841
+ /* If NIC was fini'd (probably resetting), then we can't read
1842
+ * updated stats right now.
1843
+ */
1844
+ if (nic_data->mc_stats) {
1845
+ efx_nic_copy_stats(efx, nic_data->mc_stats);
1846
+ efx_nic_update_stats(efx_ef10_stat_desc, EF10_STAT_COUNT,
1847
+ mask, stats, nic_data->mc_stats, false);
1848
+ }
18311849
18321850 /* Update derived statistics */
18331851 efx_nic_fix_nodesc_drop_stat(efx,
....@@ -3977,7 +3995,10 @@
39773995 NETIF_F_HW_VLAN_CTAG_FILTER | \
39783996 NETIF_F_IPV6_CSUM | \
39793997 NETIF_F_RXHASH | \
3980
- NETIF_F_NTUPLE)
3998
+ NETIF_F_NTUPLE | \
3999
+ NETIF_F_SG | \
4000
+ NETIF_F_RXCSUM | \
4001
+ NETIF_F_RXALL)
39814002
39824003 const struct efx_nic_type efx_hunt_a0_vf_nic_type = {
39834004 .is_vf = true,