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

Function reset_port

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

Source from the content-addressed store, hash-verified

3555}
3556
3557void
3558reset_port(portid_t pid)
3559{
3560 int diag;
3561 portid_t pi;
3562 struct rte_port *port;
3563
3564 if (port_id_is_invalid(pid, ENABLED_WARN))
3565 return;
3566
3567 if ((pid == (portid_t)RTE_PORT_ALL && !all_ports_stopped()) ||
3568 (pid != (portid_t)RTE_PORT_ALL && !port_is_stopped(pid))) {
3569 fprintf(stderr,
3570 "Can not reset port(s), please stop port(s) first.\n");
3571 return;
3572 }
3573
3574 printf("Resetting ports...\n");
3575
3576 RTE_ETH_FOREACH_DEV(pi) {
3577 if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
3578 continue;
3579
3580 if (port_is_forwarding(pi) != 0 && test_done == 0) {
3581 fprintf(stderr,
3582 "Please remove port %d from forwarding configuration.\n",
3583 pi);
3584 continue;
3585 }
3586
3587 if (port_is_bonding_member(pi)) {
3588 fprintf(stderr,
3589 "Please remove port %d from bonding device.\n",
3590 pi);
3591 continue;
3592 }
3593
3594 if (is_proc_primary()) {
3595 diag = rte_eth_dev_reset(pi);
3596 if (diag == 0) {
3597 port = &ports[pi];
3598 port->need_reconfig = 1;
3599 port->need_reconfig_queues = 1;
3600 } else {
3601 fprintf(stderr, "Failed to reset port %d. diag=%d\n",
3602 pi, diag);
3603 }
3604 }
3605 }
3606
3607 printf("Done\n");
3608}
3609
3610void
3611attach_port(char *identifier)

Callers 2

cmd_operate_port_parsedFunction · 0.85

Calls 8

port_id_is_invalidFunction · 0.85
all_ports_stoppedFunction · 0.85
port_is_stoppedFunction · 0.85
port_is_forwardingFunction · 0.85
port_is_bonding_memberFunction · 0.85
is_proc_primaryFunction · 0.85
rte_eth_dev_resetFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected