Commit 80f573c9 authored by Ong Boon Leong's avatar Ong Boon Leong Committed by David S. Miller
Browse files

net: stmmac: introduce dma_recycle_rx_skbufs for stmmac_reinit_rx_buffers



Rearrange RX buffer page_pool recycling logics into dma_recycle_rx_skbufs,
so that we prepare stmmac_reinit_rx_buffers() for XSK pool expansion.

Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4298255f
Loading
Loading
Loading
Loading
+27 −17
Original line number Diff line number Diff line
@@ -1513,19 +1513,14 @@ static int stmmac_alloc_rx_buffers(struct stmmac_priv *priv, u32 queue,
}

/**
 * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer.
 * @priv: driver private structure
 * Description: this function is called to re-allocate a receive buffer, perform
 * the DMA mapping and init the descriptor.
 * dma_recycle_rx_skbufs - recycle RX dma buffers
 * @priv: private structure
 * @queue: RX queue index
 */
static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
static void dma_recycle_rx_skbufs(struct stmmac_priv *priv, u32 queue)
{
	u32 rx_count = priv->plat->rx_queues_to_use;
	u32 queue;
	int i;

	for (queue = 0; queue < rx_count; queue++) {
	struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
	int i;

	for (i = 0; i < priv->dma_rx_size; i++) {
		struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
@@ -1542,6 +1537,21 @@ static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
	}
}

/**
 * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer.
 * @priv: driver private structure
 * Description: this function is called to re-allocate a receive buffer, perform
 * the DMA mapping and init the descriptor.
 */
static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
{
	u32 rx_count = priv->plat->rx_queues_to_use;
	u32 queue;
	int i;

	for (queue = 0; queue < rx_count; queue++)
		dma_recycle_rx_skbufs(priv, queue);

	for (queue = 0; queue < rx_count; queue++) {
		struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];