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

Function close_port

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

Source from the content-addressed store, hash-verified

3494}
3495
3496void
3497close_port(portid_t pid)
3498{
3499 portid_t pi;
3500 struct rte_port *port;
3501 portid_t member_pids[RTE_MAX_ETHPORTS];
3502 int num_members = 0;
3503
3504 if (port_id_is_invalid(pid, ENABLED_WARN))
3505 return;
3506
3507 printf("Closing ports...\n");
3508
3509 RTE_ETH_FOREACH_DEV(pi) {
3510 if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
3511 continue;
3512
3513 if (port_is_forwarding(pi) != 0 && test_done == 0) {
3514 fprintf(stderr,
3515 "Please remove port %d from forwarding configuration.\n",
3516 pi);
3517 continue;
3518 }
3519
3520 if (port_is_bonding_member(pi)) {
3521 fprintf(stderr,
3522 "Please remove port %d from bonding device.\n",
3523 pi);
3524 continue;
3525 }
3526
3527 port = &ports[pi];
3528 if (port->port_status == RTE_PORT_CLOSED) {
3529 fprintf(stderr, "Port %d is already closed\n", pi);
3530 continue;
3531 }
3532
3533 if (is_proc_primary()) {
3534 flush_port_owned_resources(pi);
3535#ifdef RTE_NET_BOND
3536 if (port->bond_flag == 1)
3537 num_members = rte_eth_bond_members_get(pi,
3538 member_pids, RTE_MAX_ETHPORTS);
3539#endif
3540 rte_eth_dev_close(pi);
3541 /*
3542 * If this port is bonding device, all members under the
3543 * device need to be removed or closed.
3544 */
3545 if (port->bond_flag == 1 && num_members > 0)
3546 clear_bonding_member_device(member_pids,
3547 num_members);
3548 }
3549
3550 free_xstats_display_info(pi);
3551 }
3552
3553 remove_invalid_ports();

Callers 4

pmd_test_exitFunction · 0.85
rmv_port_callbackFunction · 0.85
cmd_operate_port_parsedFunction · 0.85

Calls 11

port_id_is_invalidFunction · 0.85
port_is_forwardingFunction · 0.85
port_is_bonding_memberFunction · 0.85
is_proc_primaryFunction · 0.85
rte_eth_bond_members_getFunction · 0.85
rte_eth_dev_closeFunction · 0.85
free_xstats_display_infoFunction · 0.85
remove_invalid_portsFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected