| 2107 | } |
| 2108 | |
| 2109 | static int |
| 2110 | sfc_process_mport_journal(struct sfc_adapter *sa) |
| 2111 | { |
| 2112 | struct sfc_mport_journal_ctx ctx; |
| 2113 | const efx_pcie_interface_t *controllers; |
| 2114 | size_t nb_controllers; |
| 2115 | efx_rc_t efx_rc; |
| 2116 | int rc; |
| 2117 | |
| 2118 | memset(&ctx, 0, sizeof(ctx)); |
| 2119 | ctx.sa = sa; |
| 2120 | ctx.switch_domain_id = sa->mae.switch_domain_id; |
| 2121 | |
| 2122 | efx_rc = efx_mcdi_get_own_client_handle(sa->nic, &ctx.mcdi_handle); |
| 2123 | if (efx_rc != 0) { |
| 2124 | sfc_err(sa, "failed to get own MCDI handle"); |
| 2125 | SFC_ASSERT(efx_rc > 0); |
| 2126 | return efx_rc; |
| 2127 | } |
| 2128 | |
| 2129 | rc = sfc_mae_switch_domain_controllers(ctx.switch_domain_id, |
| 2130 | &controllers, &nb_controllers); |
| 2131 | if (rc != 0) { |
| 2132 | sfc_err(sa, "failed to get controller mapping"); |
| 2133 | return rc; |
| 2134 | } |
| 2135 | |
| 2136 | ctx.controllers_assigned = controllers != NULL; |
| 2137 | ctx.controllers = NULL; |
| 2138 | ctx.nb_controllers = 0; |
| 2139 | |
| 2140 | efx_rc = efx_mae_read_mport_journal(sa->nic, |
| 2141 | sfc_process_mport_journal_cb, &ctx); |
| 2142 | if (efx_rc != 0) { |
| 2143 | sfc_err(sa, "failed to process MAE mport journal"); |
| 2144 | SFC_ASSERT(efx_rc > 0); |
| 2145 | return efx_rc; |
| 2146 | } |
| 2147 | |
| 2148 | if (controllers == NULL) { |
| 2149 | rc = sfc_mae_switch_domain_map_controllers(ctx.switch_domain_id, |
| 2150 | ctx.controllers, |
| 2151 | ctx.nb_controllers); |
| 2152 | if (rc != 0) |
| 2153 | return rc; |
| 2154 | } |
| 2155 | |
| 2156 | return 0; |
| 2157 | } |
| 2158 | |
| 2159 | static void |
| 2160 | sfc_count_representors_cb(enum sfc_mae_switch_port_type type, |
no test coverage detected