MCPcopy Create free account
hub / github.com/F-Stack/f-stack / attach_port

Function attach_port

dpdk/app/test-pmd/testpmd.c:3610–3645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3608}
3609
3610void
3611attach_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
3647static void
3648setup_attached_port(portid_t pi)

Calls 4

rte_dev_probeFunction · 0.85
setup_attached_portFunction · 0.85
port_is_forwardingFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected