net/iavf: fix Tx threshold check
authorXiaoyun Li <xiaoyun.li@intel.com>
Thu, 22 Jul 2021 07:56:20 +0000 (15:56 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Sun, 25 Jul 2021 09:47:05 +0000 (11:47 +0200)
Function check_tx_thresh is called with wrong parameter. If the
check fails, tx_queue_setup should return error not keep going.
This patch fixes above issues.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/iavf/iavf_rxtx.c

index d61b32f..e33fe45 100644 (file)
@@ -708,7 +708,8 @@ iavf_dev_tx_queue_setup(struct rte_eth_dev *dev,
                tx_conf->tx_rs_thresh : DEFAULT_TX_RS_THRESH);
        tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
                tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH);
-       check_tx_thresh(nb_desc, tx_rs_thresh, tx_rs_thresh);
+       if (check_tx_thresh(nb_desc, tx_rs_thresh, tx_free_thresh) != 0)
+               return -EINVAL;
 
        /* Free memory if needed. */
        if (dev->data->tx_queues[queue_idx]) {