| 16 | #define MBUF_CACHE_SIZE 256 |
| 17 | |
| 18 | static int32_t |
| 19 | ethdev_api_queue_status(void) |
| 20 | { |
| 21 | struct rte_eth_dev_info dev_info; |
| 22 | struct rte_eth_rxq_info rx_qinfo; |
| 23 | struct rte_eth_txq_info tx_qinfo; |
| 24 | struct rte_mempool *mbuf_pool; |
| 25 | struct rte_eth_conf eth_conf; |
| 26 | uint16_t port_id; |
| 27 | int ret; |
| 28 | |
| 29 | if (rte_eth_dev_count_avail() == 0) |
| 30 | return TEST_SKIPPED; |
| 31 | |
| 32 | mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUF, MBUF_CACHE_SIZE, 0, |
| 33 | RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); |
| 34 | |
| 35 | RTE_ETH_FOREACH_DEV(port_id) { |
| 36 | memset(ð_conf, 0, sizeof(eth_conf)); |
| 37 | ret = rte_eth_dev_configure(port_id, NUM_RXQ, NUM_TXQ, ð_conf); |
| 38 | TEST_ASSERT(ret == 0, |
| 39 | "Port(%u) failed to configure.\n", port_id); |
| 40 | |
| 41 | /* RxQ setup */ |
| 42 | for (uint16_t queue_id = 0; queue_id < NUM_RXQ; queue_id++) { |
| 43 | ret = rte_eth_rx_queue_setup(port_id, queue_id, NUM_RXD, |
| 44 | rte_socket_id(), NULL, mbuf_pool); |
| 45 | TEST_ASSERT(ret == 0, |
| 46 | "Port(%u), queue(%u) failed to setup RxQ.\n", |
| 47 | port_id, queue_id); |
| 48 | } |
| 49 | |
| 50 | /* TxQ setup */ |
| 51 | for (uint16_t queue_id = 0; queue_id < NUM_TXQ; queue_id++) { |
| 52 | ret = rte_eth_tx_queue_setup(port_id, queue_id, NUM_TXD, |
| 53 | rte_socket_id(), NULL); |
| 54 | TEST_ASSERT(ret == 0, |
| 55 | "Port(%u), queue(%u) failed to setup TxQ.\n", |
| 56 | port_id, queue_id); |
| 57 | } |
| 58 | |
| 59 | ret = rte_eth_dev_info_get(port_id, &dev_info); |
| 60 | TEST_ASSERT(ret == 0, |
| 61 | "Port(%u) failed to get dev info.\n", port_id); |
| 62 | |
| 63 | /* Initial RxQ */ |
| 64 | for (uint16_t queue_id = 0; queue_id < dev_info.nb_rx_queues; queue_id++) { |
| 65 | ret = rte_eth_rx_queue_info_get(port_id, queue_id, &rx_qinfo); |
| 66 | if (ret == -ENOTSUP) |
| 67 | continue; |
| 68 | |
| 69 | TEST_ASSERT(ret == 0, |
| 70 | "Port(%u), queue(%u) failed to get RxQ info.\n", |
| 71 | port_id, queue_id); |
| 72 | |
| 73 | TEST_ASSERT(rx_qinfo.queue_state == RTE_ETH_QUEUE_STATE_STOPPED, |
| 74 | "Wrong initial Rx queue(%u) state(%d)\n", |
| 75 | queue_id, rx_qinfo.queue_state); |
nothing calls this directly
no test coverage detected