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

Function stop_port

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

Source from the content-addressed store, hash-verified

3354}
3355
3356void
3357stop_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

Callers 4

pmd_test_exitFunction · 0.85
rmv_port_callbackFunction · 0.85
cmd_operate_port_parsedFunction · 0.85

Calls 10

port_id_is_invalidFunction · 0.85
port_is_forwardingFunction · 0.85
port_is_bonding_memberFunction · 0.85
rte_eth_hairpin_unbindFunction · 0.85
port_is_startedFunction · 0.85
port_flow_flushFunction · 0.85
eth_dev_stop_mpFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected