]> git.droids-corp.org - dpdk.git/commitdiff
net/tap: forbid different Rx/Tx queue number
authorNobuhiro Miki <nmiki@yahoo-corp.jp>
Wed, 19 Jan 2022 07:43:16 +0000 (16:43 +0900)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 26 Jan 2022 16:18:31 +0000 (17:18 +0100)
Users can create the desired number of RxQ and TxQ in DPDK. For
example, if the number of RxQ = 2 and the number of TxQ = 5,
a total of 8 file descriptors will be created for a tap device,
including RxQ, TxQ, and one for keepalive. The RxQ and TxQ
with the same ID are paired by dup(2).

In this scenario, Kernel will have 3 RxQ where packets are
incoming but not read. The reason for this is that there are only
2 RxQ that are polled by DPDK, while there are 5 queues in Kernel.
This patch add a checking if DPDK has appropriate numbers of
queues to avoid unexpected packet drop.

Signed-off-by: Nobuhiro Miki <nmiki@yahoo-corp.jp>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
doc/guides/nics/tap.rst
drivers/net/tap/rte_eth_tap.c

index 681010d9ed7daad78a3b277404bf11dbac3e6ea2..3d4564b04612b2fdcfe7770f9bcedb6e3832c9b2 100644 (file)
@@ -298,3 +298,8 @@ Systems supporting flow API
 | Azure Ubuntu 16.04,| No limitation         |
 | kernel 4.13        |                       |
 +--------------------+-----------------------+
+
+Limitations
+-----------
+
+* Rx/Tx must have the same number of queues.
index 5bb472f1a6b6e71db1ec6a6ea008bd70bfdf2513..02eb311e09f56e731c51b80442cb663776b5e054 100644 (file)
@@ -940,6 +940,14 @@ tap_dev_configure(struct rte_eth_dev *dev)
                        RTE_PMD_TAP_MAX_QUEUES);
                return -1;
        }
+       if (dev->data->nb_rx_queues != dev->data->nb_tx_queues) {
+               TAP_LOG(ERR,
+                       "%s: number of rx queues %d must be equal to number of tx queues %d",
+                       dev->device->name,
+                       dev->data->nb_rx_queues,
+                       dev->data->nb_tx_queues);
+               return -1;
+       }
 
        TAP_LOG(INFO, "%s: %s: TX configured queues number: %u",
                dev->device->name, pmd->name, dev->data->nb_tx_queues);