net/bnxt: use new API to get IOVA address
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 3 Jan 2018 10:32:24 +0000 (11:32 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
Replace internal functions to get DMA address them with their generic
IOVA version. Also rename the 'data' variable to 'mbuf' for more
readability.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ring.h
drivers/net/bnxt/bnxt_rxr.c
drivers/net/bnxt/bnxt_txr.c

index a88ab55..ebf7228 100644 (file)
@@ -40,9 +40,6 @@
 
 #define RING_NEXT(ring, idx)           (((idx) + 1) & (ring)->ring_mask)
 
-#define RTE_MBUF_DATA_DMA_ADDR(mb) \
-       ((uint64_t)((mb)->buf_iova + (mb)->data_off))
-
 #define DB_IDX_MASK                                            0xffffff
 #define DB_IDX_VALID                                           (0x1 << 26)
 #define DB_IRQ_DIS                                             (0x1 << 27)
index 188df36..89114cc 100644 (file)
@@ -65,17 +65,17 @@ static inline int bnxt_alloc_rx_data(struct bnxt_rx_queue *rxq,
 {
        struct rx_prod_pkt_bd *rxbd = &rxr->rx_desc_ring[prod];
        struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[prod];
-       struct rte_mbuf *data;
+       struct rte_mbuf *mbuf;
 
-       data = __bnxt_alloc_rx_data(rxq->mb_pool);
-       if (!data) {
+       mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
+       if (!mbuf) {
                rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
                return -ENOMEM;
        }
 
-       rx_buf->mbuf = data;
+       rx_buf->mbuf = mbuf;
 
-       rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
+       rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
 
        return 0;
 }
@@ -86,10 +86,10 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 {
        struct rx_prod_pkt_bd *rxbd = &rxr->ag_desc_ring[prod];
        struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod];
-       struct rte_mbuf *data;
+       struct rte_mbuf *mbuf;
 
-       data = __bnxt_alloc_rx_data(rxq->mb_pool);
-       if (!data) {
+       mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
+       if (!mbuf) {
                rte_atomic64_inc(&rxq->bp->rx_mbuf_alloc_fail);
                return -ENOMEM;
        }
@@ -100,9 +100,9 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
                RTE_LOG(ERR, PMD, "Jumbo Frame. rx_buf is NULL\n");
 
 
-       rx_buf->mbuf = data;
+       rx_buf->mbuf = mbuf;
 
-       rxbd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(rx_buf->mbuf));
+       rxbd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
 
        return 0;
 }
@@ -123,7 +123,7 @@ static inline void bnxt_reuse_rx_mbuf(struct bnxt_rx_ring_info *rxr,
 
        prod_bd = &rxr->rx_desc_ring[prod];
 
-       prod_bd->addr = rte_cpu_to_le_64(RTE_MBUF_DATA_DMA_ADDR(mbuf));
+       prod_bd->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(mbuf));
 
        rxr->rx_prod = prod;
 }
index 4a152aa..ac77434 100644 (file)
@@ -181,7 +181,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
                txbd->flags_type |= TX_BD_LONG_FLAGS_LHINT_GTE2K;
        else
                txbd->flags_type |= lhint_arr[txbd->len >> 9];
-       txbd->addr = rte_cpu_to_le_32(RTE_MBUF_DATA_DMA_ADDR(tx_buf->mbuf));
+       txbd->addr = rte_cpu_to_le_32(rte_mbuf_data_iova(tx_buf->mbuf));
 
        if (long_bd) {
                txbd->flags_type |= TX_BD_LONG_TYPE_TX_BD_LONG;
@@ -262,7 +262,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
                tx_buf = &txr->tx_buf_ring[txr->tx_prod];
 
                txbd = &txr->tx_desc_ring[txr->tx_prod];
-               txbd->addr = rte_cpu_to_le_32(RTE_MBUF_DATA_DMA_ADDR(m_seg));
+               txbd->addr = rte_cpu_to_le_32(rte_mbuf_data_iova(m_seg));
                txbd->flags_type = TX_BD_SHORT_TYPE_TX_BD_SHORT;
                txbd->len = m_seg->data_len;