| 879 | } |
| 880 | |
| 881 | int |
| 882 | sfc_attach(struct sfc_adapter *sa) |
| 883 | { |
| 884 | const efx_nic_cfg_t *encp; |
| 885 | efx_nic_t *enp = sa->nic; |
| 886 | int rc; |
| 887 | |
| 888 | sfc_log_init(sa, "entry"); |
| 889 | |
| 890 | SFC_ASSERT(sfc_adapter_is_locked(sa)); |
| 891 | |
| 892 | efx_mcdi_new_epoch(enp); |
| 893 | |
| 894 | sfc_log_init(sa, "reset nic"); |
| 895 | rc = efx_nic_reset(enp); |
| 896 | if (rc != 0) |
| 897 | goto fail_nic_reset; |
| 898 | |
| 899 | rc = sfc_sriov_attach(sa); |
| 900 | if (rc != 0) |
| 901 | goto fail_sriov_attach; |
| 902 | |
| 903 | /* |
| 904 | * Probed NIC is sufficient for tunnel init. |
| 905 | * Initialize tunnel support to be able to use libefx |
| 906 | * efx_tunnel_config_udp_{add,remove}() in any state and |
| 907 | * efx_tunnel_reconfigure() on start up. |
| 908 | */ |
| 909 | rc = efx_tunnel_init(enp); |
| 910 | if (rc != 0) |
| 911 | goto fail_tunnel_init; |
| 912 | |
| 913 | encp = efx_nic_cfg_get(sa->nic); |
| 914 | |
| 915 | /* |
| 916 | * Make a copy of supported tunnel encapsulations in shared |
| 917 | * memory to be used on supported Rx packet type classes get. |
| 918 | */ |
| 919 | sa->priv.shared->tunnel_encaps = |
| 920 | encp->enc_tunnel_encapsulations_supported; |
| 921 | |
| 922 | if (sfc_dp_tx_offload_capa(sa->priv.dp_tx) & RTE_ETH_TX_OFFLOAD_TCP_TSO) { |
| 923 | sa->tso = encp->enc_fw_assisted_tso_v2_enabled || |
| 924 | encp->enc_tso_v3_enabled; |
| 925 | if (!sa->tso) |
| 926 | sfc_info(sa, "TSO support isn't available on this adapter"); |
| 927 | } |
| 928 | |
| 929 | if (sa->tso && |
| 930 | (sfc_dp_tx_offload_capa(sa->priv.dp_tx) & |
| 931 | (RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | |
| 932 | RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO)) != 0) { |
| 933 | sa->tso_encap = encp->enc_fw_assisted_tso_v2_encap_enabled || |
| 934 | encp->enc_tso_v3_enabled; |
| 935 | if (!sa->tso_encap) |
| 936 | sfc_info(sa, "Encapsulated TSO support isn't available on this adapter"); |
| 937 | } |
| 938 |
no test coverage detected