| 1176 | } |
| 1177 | |
| 1178 | void |
| 1179 | sfc_repr_proxy_stop(struct sfc_adapter *sa) |
| 1180 | { |
| 1181 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 1182 | struct sfc_repr_proxy *rp = &sa->repr_proxy; |
| 1183 | struct sfc_repr_proxy_port *port; |
| 1184 | const unsigned int wait_ms_total = |
| 1185 | SFC_REPR_PROXY_ROUTINE_TERMINATE_TIMEOUT_MS; |
| 1186 | unsigned int i; |
| 1187 | int rc; |
| 1188 | |
| 1189 | sfc_log_init(sa, "entry"); |
| 1190 | |
| 1191 | if (!sfc_repr_available(sas)) { |
| 1192 | sfc_log_init(sa, "representors not supported - skip"); |
| 1193 | return; |
| 1194 | } |
| 1195 | |
| 1196 | if (sfc_repr_proxy_ports_disabled(rp)) { |
| 1197 | sfc_log_init(sa, "no started representor ports - skip"); |
| 1198 | return; |
| 1199 | } |
| 1200 | |
| 1201 | TAILQ_FOREACH(port, &rp->ports, entries) { |
| 1202 | if (sfc_repr_proxy_port_enabled(port)) { |
| 1203 | rc = sfc_repr_proxy_do_stop_port(sa, port); |
| 1204 | if (rc != 0) { |
| 1205 | sfc_err(sa, |
| 1206 | "failed to stop representor proxy port %u: %s", |
| 1207 | port->repr_id, rte_strerror(rc)); |
| 1208 | } |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | sfc_repr_proxy_mport_filter_remove(sa); |
| 1213 | |
| 1214 | rc = rte_service_runstate_set(rp->service_id, 0); |
| 1215 | if (rc < 0) { |
| 1216 | sfc_err(sa, "failed to stop %s: %s", |
| 1217 | rte_service_get_name(rp->service_id), |
| 1218 | rte_strerror(-rc)); |
| 1219 | } |
| 1220 | |
| 1221 | rc = rte_service_component_runstate_set(rp->service_id, 0); |
| 1222 | if (rc < 0) { |
| 1223 | sfc_err(sa, "failed to stop %s component: %s", |
| 1224 | rte_service_get_name(rp->service_id), |
| 1225 | rte_strerror(-rc)); |
| 1226 | } |
| 1227 | |
| 1228 | /* Service lcore may be shared and we never stop it */ |
| 1229 | |
| 1230 | /* |
| 1231 | * Wait for the representor proxy routine to finish the last iteration. |
| 1232 | * Give up on timeout. |
| 1233 | */ |
| 1234 | for (i = 0; i < wait_ms_total; i++) { |
| 1235 | if (rte_service_may_be_active(rp->service_id) == 0) |
no test coverage detected