[dpdk-dev] [PATCH] net/avf: convert to new RX/TX offload API

Xing, Beilei beilei.xing at intel.com
Thu Mar 29 12:29:53 CEST 2018


> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Thursday, March 1, 2018 2:42 PM
> To: dev at dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu at intel.com>
> Subject: [dpdk-dev] [PATCH] net/avf: convert to new RX/TX offload API
> 
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu at intel.com>
> ---
>  drivers/net/avf/avf_ethdev.c |  6 +++---
>  drivers/net/avf/avf_rxtx.c   |  6 +++---
>  drivers/net/avf/avf_rxtx.h   | 10 +++++++---
>  3 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
> index 4df6617..444e0e7 100644
> --- a/drivers/net/avf/avf_ethdev.c
> +++ b/drivers/net/avf/avf_ethdev.c
> @@ -532,13 +532,13 @@ static int avf_config_rx_queues_irqs(struct
> rte_eth_dev *dev,
>  	dev_info->default_rxconf = (struct rte_eth_rxconf) {
>  		.rx_free_thresh = AVF_DEFAULT_RX_FREE_THRESH,
>  		.rx_drop_en = 0,
> +		.offloads = 0,
>  	};
> 
>  	dev_info->default_txconf = (struct rte_eth_txconf) {
>  		.tx_free_thresh = AVF_DEFAULT_TX_FREE_THRESH,
>  		.tx_rs_thresh = AVF_DEFAULT_TX_RS_THRESH,
> -		.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |
> -				ETH_TXQ_FLAGS_NOOFFLOADS,
> +		.offloads = 0,
>  	};
> 
>  	dev_info->rx_desc_lim = (struct rte_eth_desc_lim) { @@ -759,7 +759,7
> @@ static int avf_config_rx_queues_irqs(struct rte_eth_dev *dev,
>  	/* Vlan stripping setting */
>  	if (mask & ETH_VLAN_STRIP_MASK) {
>  		/* Enable or disable VLAN stripping */
> -		if (dev_conf->rxmode.hw_vlan_strip)
> +		if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
>  			err = avf_enable_vlan_strip(adapter);
>  		else
>  			err = avf_disable_vlan_strip(adapter); diff --git
> a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c index
> d276d97..1824ed7 100644
> --- a/drivers/net/avf/avf_rxtx.c
> +++ b/drivers/net/avf/avf_rxtx.c
> @@ -109,7 +109,7 @@
>  static inline bool
>  check_tx_vec_allow(struct avf_tx_queue *txq)  {
> -	if ((txq->txq_flags & AVF_SIMPLE_FLAGS) == AVF_SIMPLE_FLAGS &&
> +	if (!(txq->offloads & AVF_NO_VECTOR_FLAGS) &&
>  	    txq->rs_thresh >= AVF_VPMD_TX_MAX_BURST &&
>  	    txq->rs_thresh <= AVF_VPMD_TX_MAX_FREE_BUF) {
>  		PMD_INIT_LOG(DEBUG, "Vector tx can be enabled on this txq.");
> @@ -474,7 +474,7 @@
>  	txq->free_thresh = tx_free_thresh;
>  	txq->queue_id = queue_idx;
>  	txq->port_id = dev->data->port_id;
> -	txq->txq_flags = tx_conf->txq_flags;
> +	txq->offloads = tx_conf->offloads;
>  	txq->tx_deferred_start = tx_conf->tx_deferred_start;
> 
>  	/* Allocate software ring */
> @@ -1831,7 +1831,7 @@
> 
>  	qinfo->conf.tx_free_thresh = txq->free_thresh;
>  	qinfo->conf.tx_rs_thresh = txq->rs_thresh;
> -	qinfo->conf.txq_flags = txq->txq_flags;
> +	qinfo->conf.offloads = txq->offloads;
>  	qinfo->conf.tx_deferred_start = txq->tx_deferred_start;  }
> 
> diff --git a/drivers/net/avf/avf_rxtx.h b/drivers/net/avf/avf_rxtx.h index
> d1701cd..297d077 100644
> --- a/drivers/net/avf/avf_rxtx.h
> +++ b/drivers/net/avf/avf_rxtx.h
> @@ -22,8 +22,12 @@
>  #define AVF_VPMD_DESCS_PER_LOOP  4
>  #define AVF_VPMD_TX_MAX_FREE_BUF 64
> 
> -#define AVF_SIMPLE_FLAGS ((uint32_t)ETH_TXQ_FLAGS_NOMULTSEGS | \
> -			  ETH_TXQ_FLAGS_NOOFFLOADS)
> +#define AVF_NO_VECTOR_FLAGS (				 \
> +		DEV_TX_OFFLOAD_MULTI_SEGS |		 \
> +		DEV_TX_OFFLOAD_VLAN_INSERT |		 \
> +		DEV_TX_OFFLOAD_SCTP_CKSUM |		 \
> +		DEV_TX_OFFLOAD_UDP_CKSUM |		 \
> +		DEV_TX_OFFLOAD_TCP_CKSUM)
> 
>  #define DEFAULT_TX_RS_THRESH     32
>  #define DEFAULT_TX_FREE_THRESH   32
> @@ -125,7 +129,7 @@ struct avf_tx_queue {
> 
>  	uint16_t port_id;
>  	uint16_t queue_id;
> -	uint32_t txq_flags;
> +	uint64_t offloads;
>  	uint16_t next_dd;              /* next to set RS, for VPMD */
>  	uint16_t next_rs;              /* next to check DD,  for VPMD */
> 
> --
> 1.9.3

Acked-by: Beilei Xing <beilei.xing at intel.com>



More information about the dev mailing list