net/iavf: report selected burst mode when no-poll active
PATCH 1/1 net/iavf: report selected burst mode when no-poll active
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.
--- drivers/net/intel/iavf/iavf_rxtx.c | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +20 -20
@@ -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
Signature · 1 line
2.43.0
PATCH v2 1/1 net/iavf: report selected burst mode when no-poll active
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.
---
v2:
* cast func_type to size_t in bounds check to fix -Wsign-compare error
--- drivers/net/intel/iavf/iavf_rxtx.c | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/net/intel/iavf/iavf_rxtx.c +20 -20
@@ -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 ((size_t )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 ((size_t )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
Signature · 1 line
2.43.0
Quoted 13 lines · Ciara Loftus
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.
Quoted 4 lines
Fixes 0d5a856f5be9 ("net/iavf: support Rx/Tx burst mode info")Signed-off-by Ciara Loftus <[email protected]>
Applied to dpdk-next-net-intel.
Thanks,
/Bruce