| 139 | } |
| 140 | |
| 141 | int |
| 142 | sfc_mae_attach(struct sfc_adapter *sa) |
| 143 | { |
| 144 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 145 | struct sfc_mae_switch_port_request switch_port_request = {0}; |
| 146 | const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); |
| 147 | efx_mport_sel_t ethdev_mport; |
| 148 | efx_mport_sel_t entity_mport; |
| 149 | struct sfc_mae *mae = &sa->mae; |
| 150 | struct sfc_mae_bounce_eh *bounce_eh = &mae->bounce_eh; |
| 151 | efx_mae_limits_t limits; |
| 152 | int rc; |
| 153 | |
| 154 | sfc_log_init(sa, "entry"); |
| 155 | |
| 156 | if (!encp->enc_mae_supported) { |
| 157 | mae->status = SFC_MAE_STATUS_UNSUPPORTED; |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | if (encp->enc_mae_admin) { |
| 162 | sfc_log_init(sa, "init MAE"); |
| 163 | rc = efx_mae_init(sa->nic); |
| 164 | if (rc != 0) |
| 165 | goto fail_mae_init; |
| 166 | |
| 167 | sfc_log_init(sa, "get MAE limits"); |
| 168 | rc = efx_mae_get_limits(sa->nic, &limits); |
| 169 | if (rc != 0) |
| 170 | goto fail_mae_get_limits; |
| 171 | |
| 172 | sfc_log_init(sa, "init MAE counter record registry"); |
| 173 | rc = sfc_mae_counter_registry_init(&mae->counter_registry, |
| 174 | limits.eml_max_n_action_counters, |
| 175 | limits.eml_max_n_conntrack_counters); |
| 176 | if (rc != 0) { |
| 177 | sfc_err(sa, "failed to init record registry for %u AR and %u CT counters: %s", |
| 178 | limits.eml_max_n_action_counters, |
| 179 | limits.eml_max_n_conntrack_counters, |
| 180 | rte_strerror(rc)); |
| 181 | goto fail_counter_registry_init; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | sfc_log_init(sa, "assign ethdev MPORT"); |
| 186 | rc = sfc_mae_assign_ethdev_mport(sa, ðdev_mport); |
| 187 | if (rc != 0) |
| 188 | goto fail_mae_assign_ethdev_mport; |
| 189 | |
| 190 | sfc_log_init(sa, "assign entity MPORT"); |
| 191 | rc = sfc_mae_assign_entity_mport(sa, &entity_mport); |
| 192 | if (rc != 0) |
| 193 | goto fail_mae_assign_entity_mport; |
| 194 | |
| 195 | sfc_log_init(sa, "assign RTE switch domain"); |
| 196 | rc = sfc_mae_assign_switch_domain(sa, &mae->switch_domain_id); |
| 197 | if (rc != 0) |
| 198 | goto fail_mae_assign_switch_domain; |
no test coverage detected