| 2667 | TOKEN_STRING_INITIALIZER(struct cmd_setup_rxtx_queue, setup, "setup"); |
| 2668 | |
| 2669 | static void |
| 2670 | cmd_setup_rxtx_queue_parsed( |
| 2671 | void *parsed_result, |
| 2672 | __rte_unused struct cmdline *cl, |
| 2673 | __rte_unused void *data) |
| 2674 | { |
| 2675 | struct cmd_setup_rxtx_queue *res = parsed_result; |
| 2676 | struct rte_port *port; |
| 2677 | struct rte_mempool *mp; |
| 2678 | unsigned int socket_id; |
| 2679 | uint8_t isrx = 0; |
| 2680 | int ret; |
| 2681 | |
| 2682 | if (port_id_is_invalid(res->portid, ENABLED_WARN)) |
| 2683 | return; |
| 2684 | |
| 2685 | if (res->portid == (portid_t)RTE_PORT_ALL) { |
| 2686 | fprintf(stderr, "Invalid port id\n"); |
| 2687 | return; |
| 2688 | } |
| 2689 | |
| 2690 | if (!strcmp(res->rxtxq, "rxq")) |
| 2691 | isrx = 1; |
| 2692 | else if (!strcmp(res->rxtxq, "txq")) |
| 2693 | isrx = 0; |
| 2694 | else { |
| 2695 | fprintf(stderr, "Unknown parameter\n"); |
| 2696 | return; |
| 2697 | } |
| 2698 | |
| 2699 | if (isrx && rx_queue_id_is_invalid(res->qid)) { |
| 2700 | fprintf(stderr, "Invalid rx queue\n"); |
| 2701 | return; |
| 2702 | } else if (!isrx && tx_queue_id_is_invalid(res->qid)) { |
| 2703 | fprintf(stderr, "Invalid tx queue\n"); |
| 2704 | return; |
| 2705 | } |
| 2706 | |
| 2707 | port = &ports[res->portid]; |
| 2708 | if (isrx) { |
| 2709 | socket_id = rxring_numa[res->portid]; |
| 2710 | if (!numa_support || socket_id == NUMA_NO_CONFIG) |
| 2711 | socket_id = port->socket_id; |
| 2712 | |
| 2713 | mp = mbuf_pool_find(socket_id, 0); |
| 2714 | if (mp == NULL) { |
| 2715 | fprintf(stderr, |
| 2716 | "Failed to setup RX queue: No mempool allocation on the socket %d\n", |
| 2717 | rxring_numa[res->portid]); |
| 2718 | return; |
| 2719 | } |
| 2720 | ret = rx_queue_setup(res->portid, |
| 2721 | res->qid, |
| 2722 | port->nb_rx_desc[res->qid], |
| 2723 | socket_id, |
| 2724 | &port->rxq[res->qid].conf, |
| 2725 | mp); |
| 2726 | if (ret) |
nothing calls this directly
no test coverage detected