The DPAA2_RX_TAILDROP_OFF flag was defined and checked in
dpaa2_dev_rx_queue_setup(), but never set — making the taildrop
disable path dead code.

Wire it to a new "drv_no_taildrop" devargs, following the existing
pattern (drv_loopback, drv_no_prefetch, etc.).

Also move dpaa2_q->nb_desc assignment before the taildrop if/else
so that the descriptor count is always tracked correctly, regardless
of whether taildrop is enabled or disabled.

Usage: fslmc:dpni.1,drv_no_taildrop=1

Note: the taildrop disable path has never been reachable until now
and is untested. NXP maintainers should validate this feature.

Fixes: 23d6a87ee2ea ("net/dpaa2: add support for tail drop on queue")
Signed-off-by: Maxime Leroy <[email protected]>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 3658e24dd2..578ad98b8e 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -34,6 +34,7 @@
 #define DRIVER_TX_CONF "drv_tx_conf"
 #define DRIVER_RX_PARSE_ERR_DROP "drv_rx_parse_drop"
 #define DRIVER_ERROR_QUEUE  "drv_err_queue"
+#define DRIVER_NO_TAILDROP  "drv_no_taildrop"
 #define CHECK_INTERVAL         100  /* 100ms */
 #define MAX_REPEAT_TIME        90   /* 9s (90 * 100ms) in total */
 
@@ -929,7 +930,6 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
        dpaa2_q = priv->rx_vq[rx_queue_id];
        dpaa2_q->mb_pool = mb_pool; /**< mbuf pool to populate RX ring. */
        dpaa2_q->bp_array = rte_dpaa2_bpid_info;
-       dpaa2_q->nb_desc = UINT16_MAX;
        dpaa2_q->offloads = rx_conf->offloads;
 
        /*Get the flow id from given VQ id*/
@@ -982,11 +982,12 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev,
                return ret;
        }
 
+       dpaa2_q->nb_desc = nb_rx_desc;
+
        if (!(priv->flags & DPAA2_RX_TAILDROP_OFF)) {
                struct dpni_taildrop taildrop;
 
                taildrop.enable = 1;
-               dpaa2_q->nb_desc = nb_rx_desc;
                /* Private CGR will use tail drop length as nb_rx_desc.
                 * for rest cases we can use standard byte based tail drop.
                 * There is no HW restriction, but number of CGRs are limited,
@@ -2932,6 +2933,11 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
                DPAA2_PMD_INFO("Rx loopback mode");
        }
 
+       if (dpaa2_get_devargs(dev->devargs, DRIVER_NO_TAILDROP)) {
+               priv->flags |= DPAA2_RX_TAILDROP_OFF;
+               DPAA2_PMD_INFO("Rx taildrop disabled");
+       }
+
        /* For secondary processes, the primary has done all the work */
        if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
                /* In case of secondary, only burst and ops API need to be
@@ -3418,5 +3424,6 @@ RTE_PMD_REGISTER_PARAM_STRING(NET_DPAA2_PMD_DRIVER_NAME,
                DRIVER_NO_PREFETCH_MODE "=<int>"
                DRIVER_TX_CONF "=<int>"
                DRIVER_RX_PARSE_ERR_DROP "=<int>"
-               DRIVER_ERROR_QUEUE "=<int>");
+               DRIVER_ERROR_QUEUE "=<int>"
+               DRIVER_NO_TAILDROP "=<int>");
 RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_pmd, NOTICE);
-- 
2.43.0

Reply via email to