ramips: use napi_alloc_frag and skb_free_frag
Slightly improves rx performance Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
968b861612
commit
d3ea5fc9f3
@ -216,7 +216,7 @@ static void fe_clean_rx(struct fe_priv *priv)
|
|||||||
ring->rx_dma[i].rxd1,
|
ring->rx_dma[i].rxd1,
|
||||||
ring->rx_buf_size,
|
ring->rx_buf_size,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
put_page(virt_to_head_page(ring->rx_data[i]));
|
skb_free_frag(ring->rx_data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(ring->rx_data);
|
kfree(ring->rx_data);
|
||||||
@ -834,7 +834,7 @@ static int fe_poll_rx(struct napi_struct *napi, int budget,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* alloc new buffer */
|
/* alloc new buffer */
|
||||||
new_data = netdev_alloc_frag(ring->frag_size);
|
new_data = napi_alloc_frag(ring->frag_size);
|
||||||
if (unlikely(!new_data)) {
|
if (unlikely(!new_data)) {
|
||||||
stats->rx_dropped++;
|
stats->rx_dropped++;
|
||||||
goto release_desc;
|
goto release_desc;
|
||||||
@ -844,14 +844,14 @@ static int fe_poll_rx(struct napi_struct *napi, int budget,
|
|||||||
ring->rx_buf_size,
|
ring->rx_buf_size,
|
||||||
DMA_FROM_DEVICE);
|
DMA_FROM_DEVICE);
|
||||||
if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) {
|
if (unlikely(dma_mapping_error(&netdev->dev, dma_addr))) {
|
||||||
put_page(virt_to_head_page(new_data));
|
skb_free_frag(new_data);
|
||||||
goto release_desc;
|
goto release_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* receive data */
|
/* receive data */
|
||||||
skb = build_skb(data, ring->frag_size);
|
skb = build_skb(data, ring->frag_size);
|
||||||
if (unlikely(!skb)) {
|
if (unlikely(!skb)) {
|
||||||
put_page(virt_to_head_page(new_data));
|
skb_free_frag(new_data);
|
||||||
goto release_desc;
|
goto release_desc;
|
||||||
}
|
}
|
||||||
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
|
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
|
||||||
|
Loading…
Reference in New Issue
Block a user