[PATCH v8 12/14] net/cpfl: support peer ports get

Wu, Jingjing jingjing.wu at intel.com
Mon Jun 5 13:22:24 CEST 2023



> -----Original Message-----
> From: Xing, Beilei <beilei.xing at intel.com>
> Sent: Monday, June 5, 2023 2:17 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>
> Cc: dev at dpdk.org; Liu, Mingxia <mingxia.liu at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>; Wang, Xiao W <xiao.w.wang at intel.com>
> Subject: [PATCH v8 12/14] net/cpfl: support peer ports get
> 
> From: Beilei Xing <beilei.xing at intel.com>
> 
> This patch supports get hairpin peer ports.
> 
> Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  drivers/net/cpfl/cpfl_ethdev.c | 41 ++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
> index 850f1c0bc6..1a1ca4bc77 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -1080,6 +1080,46 @@ cpfl_dev_close(struct rte_eth_dev *dev)
>  	return 0;
>  }
> 
> +static int
> +cpfl_hairpin_get_peer_ports(struct rte_eth_dev *dev, uint16_t *peer_ports,
> +			    size_t len, uint32_t tx)
> +{
> +	struct cpfl_vport *cpfl_vport =
> +		(struct cpfl_vport *)dev->data->dev_private;
> +	struct idpf_tx_queue *txq;
> +	struct idpf_rx_queue *rxq;
> +	struct cpfl_tx_queue *cpfl_txq;
> +	struct cpfl_rx_queue *cpfl_rxq;
> +	int i;
> +	int j = 0;
> +
> +	if (len <= 0)
> +		return -EINVAL;
> +
> +	if (cpfl_vport->p2p_q_chunks_info == NULL)
> +		return -ENOTSUP;
> +
> +	if (tx > 0) {
> +		for (i = cpfl_vport->nb_data_txq, j = 0; i < dev->data->nb_tx_queues; i++,
> j++) {
> +			txq = dev->data->tx_queues[i];
> +			if (txq == NULL)
> +				return -EINVAL;
> +			cpfl_txq = (struct cpfl_tx_queue *)txq;
> +			peer_ports[j] = cpfl_txq->hairpin_info.peer_rxp;
Shouldn't access the peer_ports[j] if j >= len.



More information about the dev mailing list