.. | .. |
---|
105 | 105 | static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs, |
---|
106 | 106 | u32 flags); |
---|
107 | 107 | |
---|
108 | | -#define EFX_ASSERT_RESET_SERIALISED(efx) \ |
---|
109 | | - do { \ |
---|
110 | | - if ((efx->state == STATE_READY) || \ |
---|
111 | | - (efx->state == STATE_RECOVERY) || \ |
---|
112 | | - (efx->state == STATE_DISABLED)) \ |
---|
113 | | - ASSERT_RTNL(); \ |
---|
114 | | - } while (0) |
---|
115 | | - |
---|
116 | 108 | /************************************************************************** |
---|
117 | 109 | * |
---|
118 | 110 | * Port handling |
---|
.. | .. |
---|
377 | 369 | if (rc) |
---|
378 | 370 | goto fail5; |
---|
379 | 371 | |
---|
| 372 | + efx->state = STATE_NET_DOWN; |
---|
| 373 | + |
---|
380 | 374 | return 0; |
---|
381 | 375 | |
---|
382 | 376 | fail5: |
---|
.. | .. |
---|
543 | 537 | efx_start_all(efx); |
---|
544 | 538 | if (efx->state == STATE_DISABLED || efx->reset_pending) |
---|
545 | 539 | netif_device_detach(efx->net_dev); |
---|
546 | | - efx_selftest_async_start(efx); |
---|
| 540 | + else |
---|
| 541 | + efx->state = STATE_NET_UP; |
---|
| 542 | + |
---|
547 | 543 | return 0; |
---|
548 | 544 | } |
---|
549 | 545 | |
---|
.. | .. |
---|
721 | 717 | * already requested. If so, the NIC is probably hosed so we |
---|
722 | 718 | * abort. |
---|
723 | 719 | */ |
---|
724 | | - efx->state = STATE_READY; |
---|
725 | | - smp_mb(); /* ensure we change state before checking reset_pending */ |
---|
726 | 720 | if (efx->reset_pending) { |
---|
727 | 721 | netif_err(efx, probe, efx->net_dev, |
---|
728 | 722 | "aborting probe due to scheduled reset\n"); |
---|
.. | .. |
---|
749 | 743 | } |
---|
750 | 744 | |
---|
751 | 745 | efx_associate(efx); |
---|
| 746 | + |
---|
| 747 | + efx->state = STATE_NET_DOWN; |
---|
752 | 748 | |
---|
753 | 749 | rtnl_unlock(); |
---|
754 | 750 | |
---|
.. | .. |
---|
851 | 847 | /* Flush reset_work. It can no longer be scheduled since we |
---|
852 | 848 | * are not READY. |
---|
853 | 849 | */ |
---|
854 | | - BUG_ON(efx->state == STATE_READY); |
---|
| 850 | + WARN_ON(efx_net_active(efx->state)); |
---|
855 | 851 | efx_flush_reset_workqueue(efx); |
---|
856 | 852 | |
---|
857 | 853 | efx_disable_interrupts(efx); |
---|
.. | .. |
---|
1045 | 1041 | } |
---|
1046 | 1042 | |
---|
1047 | 1043 | /* Determine netdevice features */ |
---|
1048 | | - net_dev->features |= (efx->type->offload_features | NETIF_F_SG | |
---|
1049 | | - NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL); |
---|
1050 | | - if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) |
---|
1051 | | - net_dev->features |= NETIF_F_TSO6; |
---|
1052 | | - /* Check whether device supports TSO */ |
---|
1053 | | - if (!efx->type->tso_versions || !efx->type->tso_versions(efx)) |
---|
1054 | | - net_dev->features &= ~NETIF_F_ALL_TSO; |
---|
| 1044 | + net_dev->features |= efx->type->offload_features; |
---|
| 1045 | + |
---|
| 1046 | + /* Add TSO features */ |
---|
| 1047 | + if (efx->type->tso_versions && efx->type->tso_versions(efx)) |
---|
| 1048 | + net_dev->features |= NETIF_F_TSO | NETIF_F_TSO6; |
---|
| 1049 | + |
---|
1055 | 1050 | /* Mask for features that also apply to VLAN devices */ |
---|
1056 | 1051 | net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG | |
---|
1057 | 1052 | NETIF_F_HIGHDMA | NETIF_F_ALL_TSO | |
---|
1058 | 1053 | NETIF_F_RXCSUM); |
---|
1059 | 1054 | |
---|
| 1055 | + /* Determine user configurable features */ |
---|
1060 | 1056 | net_dev->hw_features |= net_dev->features & ~efx->fixed_features; |
---|
1061 | 1057 | |
---|
1062 | 1058 | /* Disable receiving frames with bad FCS, by default. */ |
---|
.. | .. |
---|
1196 | 1192 | |
---|
1197 | 1193 | rtnl_lock(); |
---|
1198 | 1194 | |
---|
1199 | | - if (efx->state != STATE_DISABLED) { |
---|
1200 | | - efx->state = STATE_UNINIT; |
---|
1201 | | - |
---|
| 1195 | + if (efx_net_active(efx->state)) { |
---|
1202 | 1196 | efx_device_detach_sync(efx); |
---|
1203 | 1197 | |
---|
1204 | 1198 | efx_stop_all(efx); |
---|
1205 | 1199 | efx_disable_interrupts(efx); |
---|
| 1200 | + |
---|
| 1201 | + efx->state = efx_freeze(efx->state); |
---|
1206 | 1202 | } |
---|
1207 | 1203 | |
---|
1208 | 1204 | rtnl_unlock(); |
---|
.. | .. |
---|
1217 | 1213 | |
---|
1218 | 1214 | rtnl_lock(); |
---|
1219 | 1215 | |
---|
1220 | | - if (efx->state != STATE_DISABLED) { |
---|
| 1216 | + if (efx_frozen(efx->state)) { |
---|
1221 | 1217 | rc = efx_enable_interrupts(efx); |
---|
1222 | 1218 | if (rc) |
---|
1223 | 1219 | goto fail; |
---|
.. | .. |
---|
1230 | 1226 | |
---|
1231 | 1227 | efx_device_attach_if_not_resetting(efx); |
---|
1232 | 1228 | |
---|
1233 | | - efx->state = STATE_READY; |
---|
| 1229 | + efx->state = efx_thaw(efx->state); |
---|
1234 | 1230 | |
---|
1235 | 1231 | efx->type->resume_wol(efx); |
---|
1236 | 1232 | } |
---|