[dpdk-dev] [PATCH v2 23/29] net/i40e: use eal I/O device memory read/write API

Tiwei Bie tiwei.bie at intel.com
Wed Jan 4 14:53:40 CET 2017


On Tue, Dec 27, 2016 at 03:19:29PM +0530, Jerin Jacob wrote:
> From: Santosh Shukla <santosh.shukla at caviumnetworks.com>
> 
> Replace the raw I/O device memory read/write access with eal abstraction
> for I/O device memory read/write access to fix portability issues across
> different architectures.
> 
[...]
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
> index 7ae7d9f..5c41a90 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -1228,7 +1228,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
>  		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
>  		   (unsigned) tx_id, (unsigned) nb_tx);
>  
> -	I40E_PCI_REG_WRITE(txq->qtx_tail, tx_id);
> +	I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id);
>  	txq->tx_tail = tx_id;
>  
>  	return nb_tx;
> @@ -1380,7 +1380,7 @@ tx_xmit_pkts(struct i40e_tx_queue *txq,
>  
>  	/* Update the tx tail register */
>  	rte_wmb();
> -	I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail);
> +	I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, txq->tx_tail);
>  
>  	return nb_pkts;
>  }

Besides i40e_xmit_pkts() and tx_xmit_pkts(), i40e_rx_alloc_bufs() which is
called by rx_recv_pkts() is also in the fast path. So I40E_PCI_REG_WRITE()
called by it should also be replaced by the relaxed version:

diff --git i/drivers/net/i40e/i40e_rxtx.c w/drivers/net/i40e/i40e_rxtx.c
index 7ae7d9f..55a707a 100644
--- i/drivers/net/i40e/i40e_rxtx.c
+++ w/drivers/net/i40e/i40e_rxtx.c
@@ -581,7 +581,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
 
 	/* Update rx tail regsiter */
 	rte_wmb();
-	I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_free_trigger);
+	I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rxq->rx_free_trigger);
 
 	rxq->rx_free_trigger =
 		(uint16_t)(rxq->rx_free_trigger + rxq->rx_free_thresh);

Thanks & regards,
Tiwei Bie

> -- 
> 2.5.5
> 


More information about the dev mailing list