Commit 0f00658d authored by David S. Miller's avatar David S. Miller

Merge branch 'mvpp2-prefetch'

Matteo Croce says:

====================
mvpp2: prefetch data early

These two patches prefetch some data from RAM so to reduce stall
and speedup the packet processing.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e77e2cf4 2f128eb3
...@@ -3900,15 +3900,19 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, ...@@ -3900,15 +3900,19 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
phys_addr_t phys_addr; phys_addr_t phys_addr;
u32 rx_status, timestamp; u32 rx_status, timestamp;
int pool, rx_bytes, err, ret; int pool, rx_bytes, err, ret;
struct page *page;
void *data; void *data;
phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
data = (void *)phys_to_virt(phys_addr);
page = virt_to_page(data);
prefetch(page);
rx_done++; rx_done++;
rx_status = mvpp2_rxdesc_status_get(port, rx_desc); rx_status = mvpp2_rxdesc_status_get(port, rx_desc);
rx_bytes = mvpp2_rxdesc_size_get(port, rx_desc); rx_bytes = mvpp2_rxdesc_size_get(port, rx_desc);
rx_bytes -= MVPP2_MH_SIZE; rx_bytes -= MVPP2_MH_SIZE;
dma_addr = mvpp2_rxdesc_dma_addr_get(port, rx_desc); dma_addr = mvpp2_rxdesc_dma_addr_get(port, rx_desc);
phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
data = (void *)phys_to_virt(phys_addr);
pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >> pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >>
MVPP2_RXD_BM_POOL_ID_OFFS; MVPP2_RXD_BM_POOL_ID_OFFS;
...@@ -3938,7 +3942,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, ...@@ -3938,7 +3942,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
goto err_drop_frame; goto err_drop_frame;
/* Prefetch header */ /* Prefetch header */
prefetch(data); prefetch(data + MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM);
if (bm_pool->frag_size > PAGE_SIZE) if (bm_pool->frag_size > PAGE_SIZE)
frag_size = 0; frag_size = 0;
...@@ -3997,7 +4001,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, ...@@ -3997,7 +4001,7 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
} }
if (pp) if (pp)
skb_mark_for_recycle(skb, virt_to_page(data), pp); skb_mark_for_recycle(skb, page, pp);
else else
dma_unmap_single_attrs(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,
...@@ -4008,8 +4012,8 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, ...@@ -4008,8 +4012,8 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
skb_reserve(skb, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM); skb_reserve(skb, MVPP2_MH_SIZE + MVPP2_SKB_HEADROOM);
skb_put(skb, rx_bytes); skb_put(skb, rx_bytes);
skb->protocol = eth_type_trans(skb, dev);
mvpp2_rx_csum(port, rx_status, skb); mvpp2_rx_csum(port, rx_status, skb);
skb->protocol = eth_type_trans(skb, dev);
napi_gro_receive(napi, skb); napi_gro_receive(napi, skb);
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment