|
40 | 40 |
|
41 | 41 | // 2 queues are enough for handling 40GBits. Should be checked for other NICs.
|
42 | 42 | // TODO This macro should be a function that will dynamically return the needed number of cores.
|
43 |
| -#define TX_QUEUE_NUMBER 16 |
44 | 43 | #define TX_QUEUE_CORES 2
|
45 | 44 | #define TX_ATTEMPTS 3
|
46 | 45 |
|
@@ -274,14 +273,15 @@ uint16_t check_current_port_tx_queues(uint16_t port) {
|
274 | 273 | // Initializes a given port using global settings and with the RX buffers
|
275 | 274 | // coming from the mbuf_pool passed as a parameter.
|
276 | 275 | int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, bool promiscuous, bool hwtxchecksum, bool hwrxpacketstimestamp, int32_t inIndex, int32_t tx_queues) {
|
277 |
| - uint16_t rx_rings, tx_rings = TX_QUEUE_NUMBER; |
| 276 | + uint16_t rx_rings, tx_rings = tx_queues; |
278 | 277 |
|
279 | 278 | struct rte_eth_dev_info dev_info;
|
280 | 279 | memset(&dev_info, 0, sizeof(dev_info));
|
281 | 280 | rte_eth_dev_info_get(port, &dev_info);
|
282 | 281 |
|
283 | 282 | if (tx_rings > dev_info.max_tx_queues) {
|
284 |
| - tx_rings = check_max_port_tx_queues(port); |
| 283 | + printf("Warning! Port %d does not support requested number of TX queues %d. Setting number of TX queues to %d\n", port, tx_rings, dev_info.max_tx_queues); |
| 284 | + tx_rings = dev_info.max_tx_queues; |
285 | 285 | }
|
286 | 286 |
|
287 | 287 | if (willReceive) {
|
@@ -563,9 +563,9 @@ void nff_go_send(uint16_t port, struct rte_ring **in_rings, int32_t inIndexNumbe
|
563 | 563 | struct rte_mbuf *bufs[BURST_SIZE];
|
564 | 564 | uint16_t buf;
|
565 | 565 | uint16_t tx_pkts_number;
|
566 |
| - int16_t port_tx_queues = check_current_port_tx_queues(port); |
567 |
| - int16_t tx_qstart = port_tx_queues / totalSendTreads * sendThreadIndex; |
568 |
| - int16_t tx_qend = port_tx_queues / totalSendTreads * (sendThreadIndex + 1); |
| 566 | + int16_t port_tx_queues = check_current_port_tx_queues(port); |
| 567 | + int16_t tx_qstart = port_tx_queues / totalSendTreads * sendThreadIndex; |
| 568 | + int16_t tx_qend = sendThreadIndex + 1 == totalSendTreads ? port_tx_queues : port_tx_queues / totalSendTreads * (sendThreadIndex + 1); |
569 | 569 | int16_t tx_queue_counter = tx_qstart;
|
570 | 570 | int rx_qstart = inIndexNumber / totalSendTreads * sendThreadIndex;
|
571 | 571 | int rx_qend = inIndexNumber / totalSendTreads * (sendThreadIndex + 1);
|
|
0 commit comments