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

Function start_packet_forwarding

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

* Launch packet forwarding configuration. */

Source from the content-addressed store, hash-verified

2497 * Launch packet forwarding configuration.
2498 */
2499void
2500start_packet_forwarding(int with_tx_first)
2501{
2502 port_fwd_begin_t port_fwd_begin;
2503 port_fwd_end_t port_fwd_end;
2504 stream_init_t stream_init = cur_fwd_eng->stream_init;
2505 unsigned int i;
2506
2507 if (strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") == 0 && !nb_rxq)
2508 rte_exit(EXIT_FAILURE, "rxq are 0, cannot use rxonly fwd mode\n");
2509
2510 if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 && !nb_txq)
2511 rte_exit(EXIT_FAILURE, "txq are 0, cannot use txonly fwd mode\n");
2512
2513 if ((strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") != 0 &&
2514 strcmp(cur_fwd_eng->fwd_mode_name, "txonly") != 0) &&
2515 (!nb_rxq || !nb_txq))
2516 rte_exit(EXIT_FAILURE,
2517 "Either rxq or txq are 0, cannot use %s fwd mode\n",
2518 cur_fwd_eng->fwd_mode_name);
2519
2520 if (all_ports_started() == 0) {
2521 fprintf(stderr, "Not all ports were started\n");
2522 return;
2523 }
2524 if (test_done == 0) {
2525 fprintf(stderr, "Packet forwarding already started\n");
2526 return;
2527 }
2528
2529 fwd_config_setup();
2530
2531 pkt_fwd_config_display(&cur_fwd_config);
2532 if (!pkt_fwd_shared_rxq_check())
2533 return;
2534
2535 if (stream_init != NULL) {
2536 update_queue_state(RTE_PORT_ALL);
2537 for (i = 0; i < cur_fwd_config.nb_fwd_streams; i++)
2538 stream_init(fwd_streams[i]);
2539 }
2540
2541 port_fwd_begin = cur_fwd_config.fwd_eng->port_fwd_begin;
2542 if (port_fwd_begin != NULL) {
2543 for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
2544 if (port_fwd_begin(fwd_ports_ids[i])) {
2545 fprintf(stderr,
2546 "Packet forwarding is not ready\n");
2547 return;
2548 }
2549 }
2550 }
2551
2552 if (with_tx_first) {
2553 port_fwd_begin = tx_only_engine.port_fwd_begin;
2554 if (port_fwd_begin != NULL) {
2555 for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
2556 if (port_fwd_begin(fwd_ports_ids[i])) {

Callers 5

rmv_port_callbackFunction · 0.85
mainFunction · 0.85
cmd_start_parsedFunction · 0.85

Calls 12

strcmpFunction · 0.85
rte_exitFunction · 0.85
all_ports_startedFunction · 0.85
fwd_config_setupFunction · 0.85
pkt_fwd_config_displayFunction · 0.85
pkt_fwd_shared_rxq_checkFunction · 0.85
update_queue_stateFunction · 0.85
flush_fwd_rx_queuesFunction · 0.85
rxtx_config_displayFunction · 0.85
fwd_stats_resetFunction · 0.85
launch_packet_forwardingFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85

Tested by

no test coverage detected