* Launch packet forwarding configuration. */
| 2497 | * Launch packet forwarding configuration. |
| 2498 | */ |
| 2499 | void |
| 2500 | start_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])) { |
no test coverage detected