Refuse VMDq related Rx/Tx modes when the driver do not announce VMDq
pools availability.
This will used later as a gate to ignore/reject VMDq related matters.

Signed-off-by: David Marchand <[email protected]>
---
Changes since v2:
- added an entry in release notes,
- changed approach: relied on pre-existing dev_info->max_vmdq_pools
  rather than introduce a new device capability,

Changes since v1:
- dropped incorrect VMDq feature announce for bnxt representors, em,
  i40e representors, ipn3ke representors,

---
 doc/guides/rel_notes/release_26_07.rst |  6 ++++++
 lib/ethdev/rte_ethdev.c                | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/doc/guides/rel_notes/release_26_07.rst 
b/doc/guides/rel_notes/release_26_07.rst
index f012d47a4b..b59793f177 100644
--- a/doc/guides/rel_notes/release_26_07.rst
+++ b/doc/guides/rel_notes/release_26_07.rst
@@ -92,6 +92,12 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* **Updated VMDq related API in ethdev.**
+
+  * At port configuration time, the number of VMDq pools advertised by a 
driver is now used to
+    validate VMDq related Rx and Tx modes (``RTE_ETH_MQ_RX_VMDQ_FLAG``, 
``RTE_ETH_MQ_TX_VMDQ_DCB``,
+    ``RTE_ETH_MQ_TX_VMDQ_ONLY``).
+
 
 ABI Changes
 -----------
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 2edc7a362e..eae34954e2 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1581,6 +1581,22 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t 
nb_rx_q, uint16_t nb_tx_q,
                goto rollback;
        }
 
+       if (dev_info.max_vmdq_pools == 0) {
+               if ((dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_VMDQ_FLAG) != 0) {
+                       RTE_ETHDEV_LOG_LINE(ERR, "Ethdev port_id=%u does not 
support VMDq rx mode",
+                               port_id);
+                       ret = -EINVAL;
+                       goto rollback;
+               }
+               if (dev_conf->txmode.mq_mode == RTE_ETH_MQ_TX_VMDQ_DCB ||
+                               dev_conf->txmode.mq_mode == 
RTE_ETH_MQ_TX_VMDQ_ONLY) {
+                       RTE_ETHDEV_LOG_LINE(ERR, "Ethdev port_id=%u does not 
support VMDq tx mode",
+                               port_id);
+                       ret = -EINVAL;
+                       goto rollback;
+               }
+       }
+
        /*
         * Setup new number of Rx/Tx queues and reconfigure device.
         */
-- 
2.53.0

Reply via email to