| 3608 | } |
| 3609 | |
| 3610 | void |
| 3611 | attach_port(char *identifier) |
| 3612 | { |
| 3613 | portid_t pi; |
| 3614 | struct rte_dev_iterator iterator; |
| 3615 | |
| 3616 | printf("Attaching a new port...\n"); |
| 3617 | |
| 3618 | if (identifier == NULL) { |
| 3619 | fprintf(stderr, "Invalid parameters are specified\n"); |
| 3620 | return; |
| 3621 | } |
| 3622 | |
| 3623 | if (rte_dev_probe(identifier) < 0) { |
| 3624 | TESTPMD_LOG(ERR, "Failed to attach port %s\n", identifier); |
| 3625 | return; |
| 3626 | } |
| 3627 | |
| 3628 | /* first attach mode: event */ |
| 3629 | if (setup_on_probe_event) { |
| 3630 | /* new ports are detected on RTE_ETH_EVENT_NEW event */ |
| 3631 | for (pi = 0; pi < RTE_MAX_ETHPORTS; pi++) |
| 3632 | if (ports[pi].port_status == RTE_PORT_HANDLING && |
| 3633 | ports[pi].need_setup != 0) |
| 3634 | setup_attached_port(pi); |
| 3635 | return; |
| 3636 | } |
| 3637 | |
| 3638 | /* second attach mode: iterator */ |
| 3639 | RTE_ETH_FOREACH_MATCHING_DEV(pi, identifier, &iterator) { |
| 3640 | /* setup ports matching the devargs used for probing */ |
| 3641 | if (port_is_forwarding(pi)) |
| 3642 | continue; /* port was already attached before */ |
| 3643 | setup_attached_port(pi); |
| 3644 | } |
| 3645 | } |
| 3646 | |
| 3647 | static void |
| 3648 | setup_attached_port(portid_t pi) |
no test coverage detected