| 102 | } |
| 103 | |
| 104 | int |
| 105 | sfc_sriov_vswitch_create(struct sfc_adapter *sa) |
| 106 | { |
| 107 | struct sfc_sriov *sriov = &sa->sriov; |
| 108 | efx_vport_config_t *vport_config = sriov->vport_config; |
| 109 | int rc; |
| 110 | |
| 111 | sfc_log_init(sa, "entry"); |
| 112 | |
| 113 | if (sa->switchdev) { |
| 114 | sfc_log_init(sa, "don't create vswitch in switchdev mode"); |
| 115 | goto done; |
| 116 | } |
| 117 | |
| 118 | if (sriov->num_vfs == 0) { |
| 119 | sfc_log_init(sa, "no VFs enabled"); |
| 120 | goto done; |
| 121 | } |
| 122 | |
| 123 | rc = efx_evb_init(sa->nic); |
| 124 | if (rc != 0) { |
| 125 | sfc_err(sa, "EVB init failed %d", rc); |
| 126 | goto fail_evb_init; |
| 127 | } |
| 128 | |
| 129 | RTE_BUILD_BUG_ON(sizeof(sa->port.default_mac_addr) != |
| 130 | sizeof(vport_config[0].evc_mac_addr)); |
| 131 | rte_ether_addr_copy(&sa->port.default_mac_addr, |
| 132 | (struct rte_ether_addr *)vport_config[0].evc_mac_addr); |
| 133 | |
| 134 | rc = efx_evb_vswitch_create(sa->nic, sriov->num_vfs + 1, |
| 135 | vport_config, &sriov->vswitch); |
| 136 | if (rc != 0) { |
| 137 | sfc_err(sa, "EVB vSwitch create failed %d", rc); |
| 138 | goto fail_evb_vswitch_create; |
| 139 | } |
| 140 | |
| 141 | done: |
| 142 | sfc_log_init(sa, "done"); |
| 143 | return 0; |
| 144 | |
| 145 | fail_evb_vswitch_create: |
| 146 | efx_evb_fini(sa->nic); |
| 147 | |
| 148 | fail_evb_init: |
| 149 | return rc; |
| 150 | } |
| 151 | |
| 152 | void |
| 153 | sfc_sriov_vswitch_destroy(struct sfc_adapter *sa) |
no test coverage detected