[PATCH v1 4/5] net/i40e: add direct rearm mode internal API

Konstantin Ananyev konstantin.v.ananyev at yandex.ru
Thu May 12 00:31:01 CEST 2022


20/04/2022 09:16, Feifei Wang пишет:
> For direct rearm mode, add two internal functions.
> 
> One is to enable direct rearm mode in Rx queue.
> 
> The other is to map Tx queue with Rx queue to make Rx queue take
> buffers from the specific Tx queue.
> 
> Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> Signed-off-by: Feifei Wang <feifei.wang2 at arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang at arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli at arm.com>
> ---
>   drivers/net/i40e/i40e_ethdev.c | 34 ++++++++++++++++++++++++++++++++++
>   1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 755786dc10..9e1a523bcc 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -369,6 +369,13 @@ static int i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev,
>   static int i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
>   					  uint16_t queue_id);
>   
> +static int i40e_dev_rx_queue_direct_rearm_enable(struct rte_eth_dev *dev,
> +						uint16_t queue_id);
> +static int i40e_dev_rx_queue_direct_rearm_map(struct rte_eth_dev *dev,
> +						uint16_t rx_queue_id,
> +						uint16_t tx_port_id,
> +						uint16_t tx_queue_id);
> +
>   static int i40e_get_regs(struct rte_eth_dev *dev,
>   			 struct rte_dev_reg_info *regs);
>   
> @@ -477,6 +484,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = {
>   	.rx_queue_setup               = i40e_dev_rx_queue_setup,
>   	.rx_queue_intr_enable         = i40e_dev_rx_queue_intr_enable,
>   	.rx_queue_intr_disable        = i40e_dev_rx_queue_intr_disable,
> +	.rx_queue_direct_rearm_enable = i40e_dev_rx_queue_direct_rearm_enable,
> +	.rx_queue_direct_rearm_map    = i40e_dev_rx_queue_direct_rearm_map,
>   	.rx_queue_release             = i40e_dev_rx_queue_release,
>   	.tx_queue_setup               = i40e_dev_tx_queue_setup,
>   	.tx_queue_release             = i40e_dev_tx_queue_release,
> @@ -11108,6 +11117,31 @@ i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
>   	return 0;
>   }
>   
> +static int i40e_dev_rx_queue_direct_rearm_enable(struct rte_eth_dev *dev,
> +			uint16_t queue_id)
> +{
> +	struct i40e_rx_queue *rxq;
> +
> +	rxq = dev->data->rx_queues[queue_id];
> +	rxq->direct_rxrearm_enable = 1;
> +
> +	return 0;
> +}
> +
> +static int i40e_dev_rx_queue_direct_rearm_map(struct rte_eth_dev *dev,
> +				uint16_t rx_queue_id, uint16_t tx_port_id,
> +				uint16_t tx_queue_id)
> +{
> +	struct i40e_rx_queue *rxq;
> +
> +	rxq = dev->data->rx_queues[rx_queue_id];
> +
> +	rxq->direct_rxrearm_port = tx_port_id;
> +	rxq->direct_rxrearm_queue = tx_queue_id;

I don't think this function should not enable that mode blindly.
Instead, it needs to check first that all pre-conditions are met
(tx/rx threshold values are equal, etc.).


> +
> +	return 0;
> +}
> +
>   /**
>    * This function is used to check if the register is valid.
>    * Below is the valid registers list for X722 only:



More information about the dev mailing list