Skip to contentSkip to conversation

octeontx2-pf: Add support for page pool

PATCH Superseded Ratheesh Kannoth 3 participants 6 messages May 18, 2023 – May 19, 2023

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ratheesh Kannoth

author maintainer
#0 lore raw

PATCH v2 1/1 octeontx2-pf: Add support for page pool

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers. As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Image        |  Performance with Linux kernel Packet Generator
------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

---

ChangeLog
v1 -> v2:
* Removed GFP_DMA flag
* Returned correct err value

v0 -> v1:
* Removed CONFIG_PAGE_POOL #ifdefs in code
* Used compound page APIs
* Replaced page_pool_put_page API with page_pool_put_full_page API

---
 .../net/ethernet/marvell/octeontx2/Kconfig    |  1 +
 .../marvell/octeontx2/nic/otx2_common.c       | 75 ++++++++++++++++---
 .../marvell/octeontx2/nic/otx2_common.h       |  6 +-
 .../ethernet/marvell/octeontx2/nic/otx2_pf.c  | 11 ++-
 .../marvell/octeontx2/nic/otx2_txrx.c         | 19 +++--
 .../marvell/octeontx2/nic/otx2_txrx.h         |  1 +
 .../ethernet/marvell/octeontx2/nic/qos_sq.c   |  2 +-
 7 files changed, 93 insertions(+), 22 deletions(-)
drivers/net/ethernet/marvell/octeontx2/Kconfig +1 -0
index 993ac180a5db..a32d85d6f599 100644
@@ -32,6 +32,7 @@ config OCTEONTX2_PF
 	tristate "Marvell OcteonTX2 NIC Physical Function driver"
 	select OCTEONTX2_MBOX
 	select NET_DEVLINK
+	select PAGE_POOL
 	depends on (64BIT && COMPILE_TEST) || ARM64
 	select DIMLIB
 	depends on PCI
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +65 -10

142 lines not on this page · raw message

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +4 -2
index b2267c8bec37..a9ed15d1793a 100644
@@ -976,7 +976,7 @@ int otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,
 int otx2_rxtx_enable(struct otx2_nic *pfvf, bool enable);
 void otx2_ctx_disable(struct mbox *mbox, int type, bool npa);
 int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable);
-void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq);
+void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq, int qidx);
 void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq);
 int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura);
 int otx2_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura);
@@ -984,7 +984,7 @@ int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura);
 int otx2_alloc_buffer(struct otx2_nic *pfvf, struct otx2_cq_queue *cq,
 		      dma_addr_t *dma);
 int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
-		   int stack_pages, int numptrs, int buf_size);
+		   int stack_pages, int numptrs, int buf_size, int type);
 int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
 		   int pool_id, int numptrs);
 
@@ -1054,6 +1054,8 @@ u16 otx2_get_max_mtu(struct otx2_nic *pfvf);
 int otx2_handle_ntuple_tc_features(struct net_device *netdev,
 				   netdev_features_t features);
 int otx2_smq_flush(struct otx2_nic *pfvf, int smq);
+void otx2_free_bufs(struct otx2_nic *pfvf, struct otx2_pool *pool,
+		    u64 iova, int size);
 
 /* tc support */
 int otx2_init_tc(struct otx2_nic *nic);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +10 -1
index e1883c3edda3..db3fcab1c8cd 100644
@@ -1555,7 +1555,9 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
 	struct nix_lf_free_req *free_req;
 	struct mbox *mbox = &pf->mbox;
 	struct otx2_cq_queue *cq;
+	struct otx2_pool *pool;
 	struct msg_req *req;
+	int pool_id;
 	int qidx;
 
 	/* Ensure all SQE are processed */
@@ -1584,7 +1586,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
 	for (qidx = 0; qidx < qset->cq_cnt; qidx++) {
 		cq = &qset->cq[qidx];
 		if (cq->cq_type == CQ_RX)
-			otx2_cleanup_rx_cqes(pf, cq);
+			otx2_cleanup_rx_cqes(pf, cq, qidx);
 		else
 			otx2_cleanup_tx_cqes(pf, cq);
 	}
@@ -1594,6 +1596,13 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
 	/* Free RQ buffer pointers*/
 	otx2_free_aura_ptr(pf, AURA_NIX_RQ);
 
+	for (qidx = 0; qidx < pf->hw.rx_queues; qidx++) {
+		pool_id = otx2_get_pool_idx(pf, AURA_NIX_RQ, qidx);
+		pool = &pf->qset.pool[pool_id];
+		page_pool_destroy(pool->page_pool);
+		pool->page_pool = NULL;
+	}
+
 	otx2_free_cq_res(pf);
 
 	/* Free all ingress bandwidth profiles allocated */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +11 -8
index e288f46b23a8..37d4e4b73816 100644
@@ -217,9 +217,6 @@ static bool otx2_skb_add_frag(struct otx2_nic *pfvf, struct sk_buff *skb,
 		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,
 				va - page_address(page) + off,
 				len - off, pfvf->rbsize);
-
-		otx2_dma_unmap_page(pfvf, iova - OTX2_HEAD_ROOM,
-				    pfvf->rbsize, DMA_FROM_DEVICE);
 		return true;
 	}
 
@@ -382,6 +379,8 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
 	if (pfvf->netdev->features & NETIF_F_RXCSUM)
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
+	skb_mark_for_recycle(skb);
+
 	napi_gro_frags(napi);
 }
 
@@ -1186,11 +1185,13 @@ bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,
 }
 EXPORT_SYMBOL(otx2_sq_append_skb);
 
-void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
+void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq, int qidx)
 {
 	struct nix_cqe_rx_s *cqe;
 	int processed_cqe = 0;
-	u64 iova, pa;
+	struct otx2_pool *pool;
+	u16 pool_id;
+	u64 iova;
 
 	if (pfvf->xdp_prog)
 		xdp_rxq_info_unreg(&cq->xdp_rxq);
@@ -1198,6 +1199,9 @@ void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
 	if (otx2_nix_cq_op_status(pfvf, cq) || !cq->pend_cqe)
 		return;
 
+	pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_RQ, qidx);
+	pool = &pfvf->qset.pool[pool_id];
+
 	while (cq->pend_cqe) {
 		cqe = (struct nix_cqe_rx_s *)otx2_get_next_cqe(cq);
 		processed_cqe++;
@@ -1210,9 +1214,8 @@ void otx2_cleanup_rx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)
 			continue;
 		}
 		iova = cqe->sg.seg_addr - OTX2_HEAD_ROOM;
-		pa = otx2_iova_to_phys(pfvf->iommu_domain, iova);
-		otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize, DMA_FROM_DEVICE);
-		put_page(virt_to_page(phys_to_virt(pa)));
+
+		otx2_free_bufs(pfvf, pool, iova, pfvf->rbsize);
 	}
 
 	/* Free CQEs to HW */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +1 -0
index 7ab6db9a986f..b5d689eeff80 100644
@@ -118,6 +118,7 @@ struct otx2_cq_poll {
 struct otx2_pool {
 	struct qmem		*stack;
 	struct qmem		*fc_addr;
+	struct page_pool	*page_pool;
 	u16			rbsize;
 };
 
drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c +1 -1
index d96ed29c1567..9d887bfc3108 100644
@@ -63,7 +63,7 @@ static int otx2_qos_sq_aura_pool_init(struct otx2_nic *pfvf, int qidx)
 
 	/* Initialize pool context */
 	err = otx2_pool_init(pfvf, pool_id, stack_pages,
-			     num_sqbs, hw->sqb_size);
+			     num_sqbs, hw->sqb_size, AURA_NIX_SQ);
 	if (err)
 		goto aura_free;
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 7 lines · Ratheesh Kannoth

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers. As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Image | Performance with Linux kernel Packet Generator

Is there any more detailed info for the performance data? 'kernel Packet Generator' means using pktgen module in the net/core/pktgen.c? it seems pktgen is more for tx, is there any abvious reason why the page pool optimization for rx have brought about ten times improvement?

Quoted 7 lines
------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

...

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) · line 549

Quoted 11 lines

static int __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
 			     dma_addr_t *dma)
 {
 	u8 *buf;
 
+	if (pool->page_pool)
+		return otx2_alloc_pool_buf(pfvf, pool, dma);
+
 	buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
 	if (unlikely(!buf))
 		return -ENOMEM;

It seems the above is dead code when using 'select PAGE_POOL', as PAGE_POOL config is always selected by the driver?

Quoted 4 lines
(quoted diff) +0 -0
@@ -1205,10 +1226,28 @@ void otx2_sq_free_sqbs(struct otx2_nic *pfvf)
 	}
 }
 

...

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable) · line 1662

Quoted 5 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0 -1
@@ -1659,7 +1715,6 @@ int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable)
 	req->bpid_per_chan = 0;
 #endif
 
-

Nit: unrelated change here.

Quoted 2 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0 -0
 	return otx2_sync_mbox_msg(&pfvf->mbox);
 }
author maintainer
#2 lore raw
Quoted 24 lines

-----Original Message-----
From: Yunsheng Lin <[email protected]>
Sent: Friday, May 19, 2023 7:12 AM
To: Ratheesh Kannoth <[email protected]>; [email protected]; [email protected]
Cc: Sunil Kovvuri Goutham <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Subbaraya Sundeep Bhatta <[email protected]>; Geethasowjanya Akula <[email protected]>; Srujana Challa <[email protected]>; Hariprasad Kelam <[email protected]>
Subject: [EXT] Re: [PATCH net-next v2] octeontx2-pf: Add support for page pool

External Email

----------------------------------------------------------------------

Quoted 6 lines · Ratheesh Kannoth

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers.
As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Quoted 7 lines
Quoted 1 line

Image | Performance with Linux kernel Packet Generator

Is there any more detailed info for the performance data? 'kernel Packet Generator' means using pktgen module in the net/core/pktgen.c? it seems pktgen is more for tx, is there any abvious reason why the page pool optimization for rx have brought about ten times improvement?

We used packet generator for TX machine. Performance data is for RX DUT. I will remove Packet generator text from the commit message as it gives ambiguous information
DUT Rx <------------------------- TX (Linux machine with packet generator)
(page pool support)

Quoted 16 lines
Quoted 8 lines
------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

...

Quoted 5 lines

static int __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0 -0
 			     dma_addr_t *dma)
 {
 	u8 *buf;
Quoted 9 lines

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) · line 549

Quoted 6 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
+	if (pool->page_pool)
+		return otx2_alloc_pool_buf(pfvf, pool, dma);
+
 	buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
 	if (unlikely(!buf))
 		return -ENOMEM;

It seems the above is dead code when using 'select PAGE_POOL', as PAGE_POOL config is always selected by the driver?

_otx2_alloc_rbuf() is common code for RX and TX. For RX, pool->page_pool != NULL, so allocation is from page pool.

Quoted 7 lines
Quoted 4 lines
(quoted diff) +0 -0
@@ -1205,10 +1226,28 @@ void otx2_sq_free_sqbs(struct otx2_nic *pfvf)
 	}
 }
 

...

Quoted 8 lines

Review int otx2_nix_config_bp(struct otx2_nic *pfvf,

Quoted 1 line
(quoted diff) +0 -0
@@ -1659,7 +1715,6 @@ int otx2_nix_config_bp(struct otx2_nic *pfvf,

bool enable)

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable) · line 1662

Quoted 4 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0 -1
 	req->bpid_per_chan = 0;
 #endif
 
-

Nit: unrelated change here.

Sorry, This caused due to vim script; will remove it.

Quoted 1 line
Quoted 1 line
(quoted diff) +0 -0
 	return otx2_sync_mbox_msg(&pfvf->mbox);  }
#3 lore raw
Quoted 15 lines · Ratheesh Kannoth
Quoted 8 lines

----------------------------------------------------------------------

Quoted 6 lines · Ratheesh Kannoth

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers.
As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Quoted 7 lines
Quoted 1 line

Image | Performance with Linux kernel Packet Generator

Is there any more detailed info for the performance data? 'kernel Packet Generator' means using pktgen module in the net/core/pktgen.c? it seems pktgen is more for tx, is there any abvious reason why the page pool optimization for rx have brought about ten times improvement?

Quoted 4 lines

We used packet generator for TX machine. Performance data is for RX DUT. I will remove Packet generator text from the commit message as it gives ambiguous information
DUT Rx <------------------------- TX (Linux machine with packet generator)
(page pool support)

Thanks for clarifying.
DUT is for 'Device Under Test'?
what does DUT do after it receive a packet? XDP DROP?

Quoted 26 lines
Quoted 17 lines
Quoted 9 lines

------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

...

Quoted 5 lines

static int __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +0 -0
 			     dma_addr_t *dma)
 {
 	u8 *buf;
Quoted 9 lines

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) · line 549

Quoted 6 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
+	if (pool->page_pool)
+		return otx2_alloc_pool_buf(pfvf, pool, dma);
+
 	buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
 	if (unlikely(!buf))
 		return -ENOMEM;

It seems the above is dead code when using 'select PAGE_POOL', as PAGE_POOL config is always selected by the driver?

Quoted 2 lines

_otx2_alloc_rbuf() is common code for RX and TX. For RX, pool->page_pool != NULL, so allocation is from page pool.

Am I missing something here? 'buf' is dma-mapped with DMA_FROM_DEVICE, can it be used for TX?

Also, what does 'r' in _otx2_alloc_rbuf() mean?

#4 lore raw
Quoted 69 lines

-----Original Message-----
From: Yunsheng Lin <[email protected]>
Sent: Friday, May 19, 2023 8:07 AM
To: Ratheesh Kannoth <[email protected]>; [email protected]; [email protected]
Cc: Sunil Kovvuri Goutham <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Subbaraya Sundeep Bhatta <[email protected]>; Geethasowjanya Akula <[email protected]>; Srujana Challa <[email protected]>; Hariprasad Kelam <[email protected]>
Subject: [EXT] Re: [PATCH net-next v2] octeontx2-pf: Add support for page pool

External Email

----------------------------------------------------------------------

Quoted 10 lines · Ratheesh Kannoth
Quoted 10 lines

---------------------------------------------------------------------

Quoted 7 lines · Ratheesh Kannoth

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers.
As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Image | Performance with Linux kernel Packet Generator

Quoted 7 lines
Quoted 5 lines

Is there any more detailed info for the performance data? 'kernel Packet Generator' means using pktgen module in the net/core/pktgen.c? it seems pktgen is more for tx, is there any abvious reason why the page pool optimization for rx have brought about ten times improvement?

We used packet generator for TX machine. Performance data is for RX DUT. I will remove Packet generator text from the commit message as it gives

ambiguous information

Quoted 2 lines

DUT Rx <------------------------- TX (Linux machine with packet generator)
(page pool support)

Thanks for clarifying.
DUT is for 'Device Under Test'?
what does DUT do after it receive a packet? XDP DROP?

Quoted 26 lines
Quoted 26 lines
Quoted 9 lines

------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

...

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) · line 549

Quoted 11 lines

static int __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool,

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
 			     dma_addr_t *dma)
 {
 	u8 *buf;
 
+	if (pool->page_pool)
+		return otx2_alloc_pool_buf(pfvf, pool, dma);
+
 	buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
 	if (unlikely(!buf))
 		return -ENOMEM;

It seems the above is dead code when using 'select PAGE_POOL', as PAGE_POOL config is always selected by the driver?

Quoted 9 lines
Quoted 1 line

_otx2_alloc_rbuf() is common code for RX and TX. For RX, pool->page_pool

!= NULL, so allocation is from page pool.

Quoted 1 line

Am I missing something here? 'buf' is dma-mapped with DMA_FROM_DEVICE, can it be used for TX?

Also, what does 'r' in _otx2_alloc_rbuf() mean?

HW takes care of cache coherency between device and CPU, hence DMA_ATTR_SKIP_CPU_SYNC was used. Direction of DMA doesn't matter here. Hence instead of duplicating the same API ' otx2_alloc_rbuf' was used for both Rx and Tx. 'r' stands for receive.

Thanks,
Sunil.

author maintainer
#5 lore raw
Quoted 32 lines

-----Original Message-----
From: Sunil Kovvuri Goutham <[email protected]>
Sent: Friday, May 19, 2023 10:50 AM
To: Yunsheng Lin <[email protected]>; Ratheesh Kannoth <[email protected]>; [email protected]; linux- [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Subbaraya Sundeep Bhatta <[email protected]>; Geethasowjanya Akula <[email protected]>; Srujana Challa <[email protected]>; Hariprasad Kelam <[email protected]>
Subject: RE: [EXT] Re: [PATCH net-next v2] octeontx2-pf: Add support for page pool

Quoted 19 lines

----------------------------------------------------------------------

Quoted 16 lines · Ratheesh Kannoth
Quoted 16 lines

-------------------------------------------------------------------
--

Quoted 7 lines · Ratheesh Kannoth

Page pool for each rx queue enhance rx side performance by reclaiming buffers back to each queue specific pool. DMA mapping is done only for first allocation of buffers.
As subsequent buffers allocation avoid DMA mapping, it results in performance improvement.

Image | Performance with Linux kernel Packet Generator

Is there any more detailed info for the performance data? 'kernel Packet Generator' means using pktgen module in the net/core/pktgen.c? it seems pktgen is more for tx, is there any abvious reason why the page pool optimization for rx have brought about ten times improvement?

Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

We used packet generator for TX machine. Performance data is for RX DUT. I will remove Packet generator text from the commit message as it gives

ambiguous information

Quoted 1 line

DUT Rx <------------------------- TX (Linux machine with packet

generator)

Quoted 4 lines
Quoted 1 line

(page pool support)

Thanks for clarifying.
DUT is for 'Device Under Test'?

Yes

Quoted 1 line
Quoted 1 line

what does DUT do after it receive a packet? XDP DROP?

We did not use any XDP programs to drop the packets. Stack drops them as there are no listeners for these packets.

Quoted 39 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

------------ | -----------------------------------------------
Vannila      |   3Mpps
             |
with this    |   42Mpps

change |
-------------------------------------------------------------

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

...

Quoted 1 line

static int __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool

*pool,

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) · line 549

Quoted 10 lines
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +3 -0
 			     dma_addr_t *dma)
 {
 	u8 *buf;
 
+	if (pool->page_pool)
+		return otx2_alloc_pool_buf(pfvf, pool, dma);
+
 	buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
 	if (unlikely(!buf))
 		return -ENOMEM;

It seems the above is dead code when using 'select PAGE_POOL', as PAGE_POOL config is always selected by the driver?

Quoted 6 lines
Quoted 2 lines

_otx2_alloc_rbuf() is common code for RX and TX. For RX, pool->page_pool

!= NULL, so allocation is from page pool.

Quoted 1 line

Am I missing something here? 'buf' is dma-mapped with

DMA_FROM_DEVICE,

Quoted 4 lines

can it be used for TX?

Also, what does 'r' in _otx2_alloc_rbuf() mean?

Quoted 7 lines

HW takes care of cache coherency between device and CPU, hence DMA_ATTR_SKIP_CPU_SYNC was used. Direction of DMA doesn't matter here. Hence instead of duplicating the same API ' otx2_alloc_rbuf' was used for both Rx and Tx. 'r' stands for receive.

Thanks,
Sunil.

-Ratheesh