DPDK patches and discussions
 help / color / mirror / Atom feed
From: Slava Ovsiienko <viacheslavo@mellanox.com>
To: Alexander Kozyrev <akozyrev@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Raslan Darawsheh <rasland@mellanox.com>,
	Matan Azrad <matan@mellanox.com>,
	 "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH] net/mlx5: add Rx/Tx burst mode info callbacks
Date: Fri, 31 Jan 2020 15:12:42 +0000	[thread overview]
Message-ID: <AM4PR05MB3265D967D28A71C9A06374E1D2070@AM4PR05MB3265.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1580401681-130802-1-git-send-email-akozyrev@mellanox.com>

> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@mellanox.com>
> Sent: Thursday, January 30, 2020 18:28
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@mellanox.com>; Matan Azrad
> <matan@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>;
> ferruh.yigit@intel.com; Thomas Monjalon <thomas@monjalon.net>
> Subject: [PATCH] net/mlx5: add Rx/Tx burst mode info callbacks
> 
> 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>

> ---
>  doc/guides/nics/features/mlx5.ini |   1 +
>  drivers/net/mlx5/mlx5.c           |  12 +++
>  drivers/net/mlx5/mlx5_rxtx.c      | 172
> ++++++++++++++++++++++++++++++++++++++
>  drivers/net/mlx5/mlx5_rxtx.h      |   8 ++
>  4 files changed, 193 insertions(+)
> 
> diff --git a/doc/guides/nics/features/mlx5.ini
> b/doc/guides/nics/features/mlx5.ini
> index b0a2f8e..3d1c5d6 100644
> --- a/doc/guides/nics/features/mlx5.ini
> +++ b/doc/guides/nics/features/mlx5.ini
> @@ -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
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> 3b8de8f..ac793bd 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1389,6 +1389,10 @@ struct mlx5_flow_id_pool *
>  	.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
> @@ struct mlx5_flow_id_pool *
>  	.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 @@ struct mlx5_flow_id_pool *
>  	.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,
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index
> b14ae31..cd5cf92 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -535,6 +535,89 @@ enum mlx5_txcmp_code {  }
> 
>  /**
> + * 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
>   *
>   * @param dev
> @@ -5335,3 +5418,92 @@ enum mlx5_txcmp_code {
>  	}
>  	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;
> +}
> diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
> index c2cd23b..10ab7fd 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.h
> +++ b/drivers/net/mlx5/mlx5_rxtx.h
> @@ -475,6 +475,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);
> --
> 1.8.3.1


  reply	other threads:[~2020-01-31 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 16:28 Alexander Kozyrev
2020-01-31 15:12 ` Slava Ovsiienko [this message]
2020-02-03 11:56 ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM4PR05MB3265D967D28A71C9A06374E1D2070@AM4PR05MB3265.eurprd05.prod.outlook.com \
    --to=viacheslavo@mellanox.com \
    --cc=akozyrev@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=matan@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).