When the no-poll feature is enabled (it is enabled by default), the
device burst functions point at the no-poll wrapper for the lifetime of
the port. As the wrapper occupies the "Disabled" slot in the burst mode
path-info tables, the Rx/Tx burst mode was always reported as "Disabled"
regardless of link state, even though the wrapper only drops traffic
while the link is down and otherwise dispatches to the selected path.

Report the burst mode of the selected path directly by indexing the
path-info tables with the selected path type. This fixes the misreport
while the no-poll wrapper is active and also simplifies the burst mode
lookup: the previous pointer comparison and table search loop are no
longer needed.

Fixes: 0d5a856f5be9 ("net/iavf: support Rx/Tx burst mode info")
Cc: [email protected]

Signed-off-by: Ciara Loftus <[email protected]>
---
 drivers/net/intel/iavf/iavf_rxtx.c | 40 +++++++++++++++---------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_rxtx.c 
b/drivers/net/intel/iavf/iavf_rxtx.c
index decbc75142..9cc09583a3 100644
--- a/drivers/net/intel/iavf/iavf_rxtx.c
+++ b/drivers/net/intel/iavf/iavf_rxtx.c
@@ -3567,18 +3567,18 @@ iavf_rx_burst_mode_get(struct rte_eth_dev *dev,
                       __rte_unused uint16_t queue_id,
                       struct rte_eth_burst_mode *mode)
 {
-       eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
-       size_t i;
+       struct iavf_adapter *adapter =
+               IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+       enum iavf_rx_func_type rx_func_type = adapter->rx_func_type;
 
-       for (i = 0; i < RTE_DIM(iavf_rx_path_infos); i++) {
-               if (pkt_burst == iavf_rx_path_infos[i].pkt_burst) {
-                       snprintf(mode->info, sizeof(mode->info), "%s",
-                                iavf_rx_path_infos[i].info);
-                       return 0;
-               }
-       }
+       if (rx_func_type >= RTE_DIM(iavf_rx_path_infos) ||
+                       iavf_rx_path_infos[rx_func_type].info == NULL)
+               return -EINVAL;
 
-       return -EINVAL;
+       snprintf(mode->info, sizeof(mode->info), "%s",
+                iavf_rx_path_infos[rx_func_type].info);
+
+       return 0;
 }
 
 static const struct ci_tx_path_info iavf_tx_path_infos[] = {
@@ -3685,18 +3685,18 @@ iavf_tx_burst_mode_get(struct rte_eth_dev *dev,
                       __rte_unused uint16_t queue_id,
                       struct rte_eth_burst_mode *mode)
 {
-       eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
-       size_t i;
+       struct iavf_adapter *adapter =
+               IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+       enum iavf_tx_func_type tx_func_type = adapter->tx_func_type;
 
-       for (i = 0; i < RTE_DIM(iavf_tx_path_infos); i++) {
-               if (pkt_burst == iavf_tx_path_infos[i].pkt_burst) {
-                       snprintf(mode->info, sizeof(mode->info), "%s",
-                                iavf_tx_path_infos[i].info);
-                       return 0;
-               }
-       }
+       if (tx_func_type >= RTE_DIM(iavf_tx_path_infos) ||
+                       iavf_tx_path_infos[tx_func_type].info == NULL)
+               return -EINVAL;
 
-       return -EINVAL;
+       snprintf(mode->info, sizeof(mode->info), "%s",
+                iavf_tx_path_infos[tx_func_type].info);
+
+       return 0;
 }
 
 static uint16_t
-- 
2.43.0

Reply via email to