Merge branch 'mvpp2-improvements-in-rx-path'

Matteo Croce says:

====================
mvpp2 improvements in rx path

Refactor some code in the RX path to allow prefetching some data from the
packet header. The first patch is only a refactor, the second one
reduces the data synced, while the third one adds the prefetch.

The packet rate improvement with the second patch is very small (1606 => 1620 kpps),
while the prefetch bumps it up by 14%: 1620 => 1853 kpps.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-10-28 13:44:26 -07:00
commit 7a9eff98a5
1 changed files with 17 additions and 10 deletions

View File

@ -2956,14 +2956,13 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
* by the hardware, and the information about the buffer is * by the hardware, and the information about the buffer is
* comprised by the RX descriptor. * comprised by the RX descriptor.
*/ */
if (rx_status & MVPP2_RXD_ERR_SUMMARY) { if (rx_status & MVPP2_RXD_ERR_SUMMARY)
err_drop_frame: goto err_drop_frame;
dev->stats.rx_errors++;
mvpp2_rx_error(port, rx_desc); dma_sync_single_for_cpu(dev->dev.parent, dma_addr,
/* Return the buffer to the pool */ rx_bytes + MVPP2_MH_SIZE,
mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); DMA_FROM_DEVICE);
continue; prefetch(data);
}
if (bm_pool->frag_size > PAGE_SIZE) if (bm_pool->frag_size > PAGE_SIZE)
frag_size = 0; frag_size = 0;
@ -2982,8 +2981,9 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
goto err_drop_frame; goto err_drop_frame;
} }
dma_unmap_single(dev->dev.parent, dma_addr, dma_unmap_single_attrs(dev->dev.parent, dma_addr,
bm_pool->buf_size, DMA_FROM_DEVICE); bm_pool->buf_size, DMA_FROM_DEVICE,
DMA_ATTR_SKIP_CPU_SYNC);
rcvd_pkts++; rcvd_pkts++;
rcvd_bytes += rx_bytes; rcvd_bytes += rx_bytes;
@ -2994,6 +2994,13 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
mvpp2_rx_csum(port, rx_status, skb); mvpp2_rx_csum(port, rx_status, skb);
napi_gro_receive(napi, skb); napi_gro_receive(napi, skb);
continue;
err_drop_frame:
dev->stats.rx_errors++;
mvpp2_rx_error(port, rx_desc);
/* Return the buffer to the pool */
mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
} }
if (rcvd_pkts) { if (rcvd_pkts) {