net/mlx5: add Rx/Tx burst mode info
Get a burst mode information for Rx/Tx queues in mlx5. Provide callback functions to show this information in a "show rxq info" and "show txq info" output. Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
This commit is contained in:
parent
9614459b1e
commit
26f1bae837
@ -10,6 +10,7 @@ Link status event = Y
|
||||
Removal event = Y
|
||||
Rx interrupt = Y
|
||||
Queue start/stop = Y
|
||||
Burst mode info = Y
|
||||
MTU update = Y
|
||||
Jumbo frame = Y
|
||||
Scattered Rx = Y
|
||||
|
@ -1389,6 +1389,10 @@ const struct eth_dev_ops mlx5_dev_ops = {
|
||||
.filter_ctrl = mlx5_dev_filter_ctrl,
|
||||
.rx_descriptor_status = mlx5_rx_descriptor_status,
|
||||
.tx_descriptor_status = mlx5_tx_descriptor_status,
|
||||
.rxq_info_get = mlx5_rxq_info_get,
|
||||
.txq_info_get = mlx5_txq_info_get,
|
||||
.rx_burst_mode_get = mlx5_rx_burst_mode_get,
|
||||
.tx_burst_mode_get = mlx5_tx_burst_mode_get,
|
||||
.rx_queue_count = mlx5_rx_queue_count,
|
||||
.rx_queue_intr_enable = mlx5_rx_intr_enable,
|
||||
.rx_queue_intr_disable = mlx5_rx_intr_disable,
|
||||
@ -1411,6 +1415,10 @@ static const struct eth_dev_ops mlx5_dev_sec_ops = {
|
||||
.dev_infos_get = mlx5_dev_infos_get,
|
||||
.rx_descriptor_status = mlx5_rx_descriptor_status,
|
||||
.tx_descriptor_status = mlx5_tx_descriptor_status,
|
||||
.rxq_info_get = mlx5_rxq_info_get,
|
||||
.txq_info_get = mlx5_txq_info_get,
|
||||
.rx_burst_mode_get = mlx5_rx_burst_mode_get,
|
||||
.tx_burst_mode_get = mlx5_tx_burst_mode_get,
|
||||
.get_module_info = mlx5_get_module_info,
|
||||
.get_module_eeprom = mlx5_get_module_eeprom,
|
||||
};
|
||||
@ -1455,6 +1463,10 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
|
||||
.filter_ctrl = mlx5_dev_filter_ctrl,
|
||||
.rx_descriptor_status = mlx5_rx_descriptor_status,
|
||||
.tx_descriptor_status = mlx5_tx_descriptor_status,
|
||||
.rxq_info_get = mlx5_rxq_info_get,
|
||||
.txq_info_get = mlx5_txq_info_get,
|
||||
.rx_burst_mode_get = mlx5_rx_burst_mode_get,
|
||||
.tx_burst_mode_get = mlx5_tx_burst_mode_get,
|
||||
.rx_queue_intr_enable = mlx5_rx_intr_enable,
|
||||
.rx_queue_intr_disable = mlx5_rx_intr_disable,
|
||||
.is_removed = mlx5_is_removed,
|
||||
|
@ -536,6 +536,89 @@ mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset)
|
||||
return RTE_ETH_RX_DESC_AVAIL;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get the RX queue information
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to the device structure.
|
||||
*
|
||||
* @param rx_queue_id
|
||||
* Rx queue identificator.
|
||||
*
|
||||
* @param qinfo
|
||||
* Pointer to the RX queue information structure.
|
||||
*
|
||||
* @return
|
||||
* None.
|
||||
*/
|
||||
|
||||
void
|
||||
mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
|
||||
struct rte_eth_rxq_info *qinfo)
|
||||
{
|
||||
struct mlx5_priv *priv = dev->data->dev_private;
|
||||
struct mlx5_rxq_data *rxq = (*priv->rxqs)[rx_queue_id];
|
||||
struct mlx5_rxq_ctrl *rxq_ctrl =
|
||||
container_of(rxq, struct mlx5_rxq_ctrl, rxq);
|
||||
|
||||
if (!rxq)
|
||||
return;
|
||||
qinfo->mp = mlx5_rxq_mprq_enabled(&rxq_ctrl->rxq) ?
|
||||
rxq->mprq_mp : rxq->mp;
|
||||
qinfo->conf.rx_thresh.pthresh = 0;
|
||||
qinfo->conf.rx_thresh.hthresh = 0;
|
||||
qinfo->conf.rx_thresh.wthresh = 0;
|
||||
qinfo->conf.rx_free_thresh = rxq->rq_repl_thresh;
|
||||
qinfo->conf.rx_drop_en = 1;
|
||||
qinfo->conf.rx_deferred_start = rxq_ctrl ? 0 : 1;
|
||||
qinfo->conf.offloads = dev->data->dev_conf.rxmode.offloads;
|
||||
qinfo->scattered_rx = dev->data->scattered_rx;
|
||||
qinfo->nb_desc = 1 << rxq->elts_n;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get the RX packet burst mode information
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to the device structure.
|
||||
*
|
||||
* @param rx_queue_id
|
||||
* Rx queue identificatior.
|
||||
*
|
||||
* @param mode
|
||||
* Pointer to the burts mode information.
|
||||
*
|
||||
* @return
|
||||
* 0 as success, -EINVAL as failure.
|
||||
*/
|
||||
|
||||
int
|
||||
mlx5_rx_burst_mode_get(struct rte_eth_dev *dev,
|
||||
uint16_t rx_queue_id __rte_unused,
|
||||
struct rte_eth_burst_mode *mode)
|
||||
{
|
||||
eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
|
||||
|
||||
if (pkt_burst == mlx5_rx_burst) {
|
||||
snprintf(mode->info, sizeof(mode->info), "%s", "Scalar");
|
||||
} else if (pkt_burst == mlx5_rx_burst_mprq) {
|
||||
snprintf(mode->info, sizeof(mode->info), "%s", "Multi-Packet RQ");
|
||||
} else if (pkt_burst == mlx5_rx_burst_vec) {
|
||||
#if defined RTE_ARCH_X86_64
|
||||
snprintf(mode->info, sizeof(mode->info), "%s", "Vector SSE");
|
||||
#elif defined RTE_ARCH_ARM64
|
||||
snprintf(mode->info, sizeof(mode->info), "%s", "Vector Neon");
|
||||
#elif defined RTE_ARCH_PPC_64
|
||||
snprintf(mode->info, sizeof(mode->info), "%s", "Vector AltiVec");
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
} else {
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get the number of used descriptors in a RX queue
|
||||
*
|
||||
@ -5414,3 +5497,92 @@ mlx5_select_tx_function(struct rte_eth_dev *dev)
|
||||
}
|
||||
return txoff_func[m].func;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get the TX queue information
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to the device structure.
|
||||
*
|
||||
* @param tx_queue_id
|
||||
* Tx queue identificator.
|
||||
*
|
||||
* @param qinfo
|
||||
* Pointer to the TX queue information structure.
|
||||
*
|
||||
* @return
|
||||
* None.
|
||||
*/
|
||||
|
||||
void
|
||||
mlx5_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
|
||||
struct rte_eth_txq_info *qinfo)
|
||||
{
|
||||
struct mlx5_priv *priv = dev->data->dev_private;
|
||||
struct mlx5_txq_data *txq = (*priv->txqs)[tx_queue_id];
|
||||
struct mlx5_txq_ctrl *txq_ctrl =
|
||||
container_of(txq, struct mlx5_txq_ctrl, txq);
|
||||
|
||||
if (!txq)
|
||||
return;
|
||||
qinfo->nb_desc = txq->elts_s;
|
||||
qinfo->conf.tx_thresh.pthresh = 0;
|
||||
qinfo->conf.tx_thresh.hthresh = 0;
|
||||
qinfo->conf.tx_thresh.wthresh = 0;
|
||||
qinfo->conf.tx_rs_thresh = 0;
|
||||
qinfo->conf.tx_free_thresh = 0;
|
||||
qinfo->conf.tx_deferred_start = txq_ctrl ? 0 : 1;
|
||||
qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads;
|
||||
}
|
||||
|
||||
/**
|
||||
* DPDK callback to get the TX packet burst mode information
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to the device structure.
|
||||
*
|
||||
* @param tx_queue_id
|
||||
* Tx queue identificatior.
|
||||
*
|
||||
* @param mode
|
||||
* Pointer to the burts mode information.
|
||||
*
|
||||
* @return
|
||||
* 0 as success, -EINVAL as failure.
|
||||
*/
|
||||
|
||||
int
|
||||
mlx5_tx_burst_mode_get(struct rte_eth_dev *dev,
|
||||
uint16_t tx_queue_id __rte_unused,
|
||||
struct rte_eth_burst_mode *mode)
|
||||
{
|
||||
eth_tx_burst_t pkt_burst = dev->tx_pkt_burst;
|
||||
unsigned int i, olx;
|
||||
|
||||
for (i = 0; i < RTE_DIM(txoff_func); i++) {
|
||||
if (pkt_burst == txoff_func[i].func) {
|
||||
olx = txoff_func[i].olx;
|
||||
snprintf(mode->info, sizeof(mode->info),
|
||||
"%s%s%s%s%s%s%s%s",
|
||||
(olx & MLX5_TXOFF_CONFIG_EMPW) ?
|
||||
((olx & MLX5_TXOFF_CONFIG_MPW) ?
|
||||
"Legacy MPW" : "Enhanced MPW") : "No MPW",
|
||||
(olx & MLX5_TXOFF_CONFIG_MULTI) ?
|
||||
" + MULTI" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_TSO) ?
|
||||
" + TSO" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_SWP) ?
|
||||
" + SWP" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_CSUM) ?
|
||||
" + CSUM" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_INLINE) ?
|
||||
" + INLINE" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_VLAN) ?
|
||||
" + VLAN" : "",
|
||||
(olx & MLX5_TXOFF_CONFIG_METADATA) ?
|
||||
" + METADATA" : "");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -478,6 +478,14 @@ void mlx5_dump_debug_information(const char *path, const char *title,
|
||||
const void *buf, unsigned int len);
|
||||
int mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
|
||||
const struct mlx5_mp_arg_queue_state_modify *sm);
|
||||
void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
struct rte_eth_rxq_info *qinfo);
|
||||
void mlx5_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
struct rte_eth_txq_info *qinfo);
|
||||
int mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
|
||||
struct rte_eth_burst_mode *mode);
|
||||
int mlx5_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
|
||||
struct rte_eth_burst_mode *mode);
|
||||
|
||||
/* Vectorized version of mlx5_rxtx.c */
|
||||
int mlx5_rxq_check_vec_support(struct mlx5_rxq_data *rxq_data);
|
||||
|
Loading…
Reference in New Issue
Block a user