| 2243 | } |
| 2244 | |
| 2245 | static int |
| 2246 | sfc_representor_info_get(struct rte_eth_dev *dev, |
| 2247 | struct rte_eth_representor_info *info) |
| 2248 | { |
| 2249 | struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); |
| 2250 | struct sfc_get_representors_ctx get_repr_ctx; |
| 2251 | const efx_nic_cfg_t *nic_cfg; |
| 2252 | uint16_t switch_domain_id; |
| 2253 | uint32_t nb_repr; |
| 2254 | int controller; |
| 2255 | int rc; |
| 2256 | |
| 2257 | sfc_adapter_lock(sa); |
| 2258 | |
| 2259 | if (sa->mae.status != SFC_MAE_STATUS_ADMIN) { |
| 2260 | sfc_adapter_unlock(sa); |
| 2261 | return -ENOTSUP; |
| 2262 | } |
| 2263 | |
| 2264 | rc = sfc_process_mport_journal(sa); |
| 2265 | if (rc != 0) { |
| 2266 | sfc_adapter_unlock(sa); |
| 2267 | SFC_ASSERT(rc > 0); |
| 2268 | return -rc; |
| 2269 | } |
| 2270 | |
| 2271 | switch_domain_id = sa->mae.switch_domain_id; |
| 2272 | |
| 2273 | nb_repr = 0; |
| 2274 | rc = sfc_mae_switch_ports_iterate(switch_domain_id, |
| 2275 | sfc_count_representors_cb, |
| 2276 | &nb_repr); |
| 2277 | if (rc != 0) { |
| 2278 | sfc_adapter_unlock(sa); |
| 2279 | SFC_ASSERT(rc > 0); |
| 2280 | return -rc; |
| 2281 | } |
| 2282 | |
| 2283 | if (info == NULL) { |
| 2284 | sfc_adapter_unlock(sa); |
| 2285 | return nb_repr; |
| 2286 | } |
| 2287 | |
| 2288 | rc = sfc_mae_switch_domain_controllers(switch_domain_id, |
| 2289 | &get_repr_ctx.controllers, |
| 2290 | &get_repr_ctx.nb_controllers); |
| 2291 | if (rc != 0) { |
| 2292 | sfc_adapter_unlock(sa); |
| 2293 | SFC_ASSERT(rc > 0); |
| 2294 | return -rc; |
| 2295 | } |
| 2296 | |
| 2297 | nic_cfg = efx_nic_cfg_get(sa->nic); |
| 2298 | |
| 2299 | rc = sfc_mae_switch_domain_get_controller(switch_domain_id, |
| 2300 | nic_cfg->enc_intf, |
| 2301 | &controller); |
| 2302 | if (rc != 0) { |
nothing calls this directly
no test coverage detected