| 3354 | } |
| 3355 | |
| 3356 | void |
| 3357 | stop_port(portid_t pid) |
| 3358 | { |
| 3359 | portid_t pi; |
| 3360 | struct rte_port *port; |
| 3361 | int need_check_link_status = 0; |
| 3362 | portid_t peer_pl[RTE_MAX_ETHPORTS]; |
| 3363 | int peer_pi; |
| 3364 | int ret; |
| 3365 | |
| 3366 | if (port_id_is_invalid(pid, ENABLED_WARN)) |
| 3367 | return; |
| 3368 | |
| 3369 | printf("Stopping ports...\n"); |
| 3370 | |
| 3371 | RTE_ETH_FOREACH_DEV(pi) { |
| 3372 | if (pid != pi && pid != (portid_t)RTE_PORT_ALL) |
| 3373 | continue; |
| 3374 | |
| 3375 | if (port_is_forwarding(pi) != 0 && test_done == 0) { |
| 3376 | fprintf(stderr, |
| 3377 | "Please remove port %d from forwarding configuration.\n", |
| 3378 | pi); |
| 3379 | continue; |
| 3380 | } |
| 3381 | |
| 3382 | if (port_is_bonding_member(pi)) { |
| 3383 | fprintf(stderr, |
| 3384 | "Please remove port %d from bonding device.\n", |
| 3385 | pi); |
| 3386 | continue; |
| 3387 | } |
| 3388 | |
| 3389 | port = &ports[pi]; |
| 3390 | if (port->port_status == RTE_PORT_STARTED) |
| 3391 | port->port_status = RTE_PORT_HANDLING; |
| 3392 | else |
| 3393 | continue; |
| 3394 | |
| 3395 | if (hairpin_mode & 0xf) { |
| 3396 | int j; |
| 3397 | |
| 3398 | rte_eth_hairpin_unbind(pi, RTE_MAX_ETHPORTS); |
| 3399 | /* unbind all peer Tx from current Rx */ |
| 3400 | peer_pi = rte_eth_hairpin_get_peer_ports(pi, peer_pl, |
| 3401 | RTE_MAX_ETHPORTS, 0); |
| 3402 | if (peer_pi < 0) |
| 3403 | continue; |
| 3404 | for (j = 0; j < peer_pi; j++) { |
| 3405 | if (!port_is_started(peer_pl[j])) |
| 3406 | continue; |
| 3407 | rte_eth_hairpin_unbind(peer_pl[j], pi); |
| 3408 | } |
| 3409 | } |
| 3410 | |
| 3411 | if (port->flow_list && !no_flow_flush) |
| 3412 | port_flow_flush(pi); |
| 3413 |
no test coverage detected