summaryrefslogtreecommitdiff
path: root/target/linux/cns3xxx/files
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-31 12:35:20 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-31 12:35:20 +0000
commit9ab08d665f0b6ac919e74e3969ef6370f6e37101 (patch)
treebe4f0e6a63eb41443373a2f3d557677246a9f0b1 /target/linux/cns3xxx/files
parent3d4444f257132442c07a7ffa94632cd92ec4d475 (diff)
downloadmtk-20170518-9ab08d665f0b6ac919e74e3969ef6370f6e37101.zip
mtk-20170518-9ab08d665f0b6ac919e74e3969ef6370f6e37101.tar.gz
mtk-20170518-9ab08d665f0b6ac919e74e3969ef6370f6e37101.tar.bz2
cns3xxx: improve ethernet performance by using the page fragment allocation API
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48580
Diffstat (limited to 'target/linux/cns3xxx/files')
-rw-r--r--target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
index ab2727f..2f232c1 100644
--- a/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
+++ b/target/linux/cns3xxx/files/drivers/net/ethernet/cavium/cns3xxx_eth.c
@@ -518,14 +518,14 @@ static void cns3xxx_alloc_rx_buf(struct sw *sw, int received)
unsigned int phys;
for (received += rx_ring->alloc_count; received > 0; received--) {
- buf = kmalloc(RX_SEGMENT_ALLOC_SIZE, GFP_ATOMIC);
+ buf = napi_alloc_frag(RX_SEGMENT_ALLOC_SIZE);
if (!buf)
break;
phys = dma_map_single(sw->dev, buf + SKB_HEAD_ALIGN,
RX_SEGMENT_MRU, DMA_FROM_DEVICE);
if (dma_mapping_error(sw->dev, phys)) {
- kfree(buf);
+ skb_free_frag(buf);
break;
}
@@ -636,7 +636,7 @@ static int eth_poll(struct napi_struct *napi, int budget)
dma_unmap_single(sw->dev, rx_ring->phys_tab[i],
RX_SEGMENT_MRU, DMA_FROM_DEVICE);
- skb = build_skb(rx_ring->buff_tab[i], 0);
+ skb = build_skb(rx_ring->buff_tab[i], RX_SEGMENT_ALLOC_SIZE);
if (!skb)
break;
@@ -907,7 +907,7 @@ static int init_rings(struct sw *sw)
struct rx_desc *desc = &(rx_ring)->desc[i];
void *buf;
- buf = kzalloc(RX_SEGMENT_ALLOC_SIZE, GFP_KERNEL);
+ buf = netdev_alloc_frag(RX_SEGMENT_ALLOC_SIZE);
if (!buf)
return -ENOMEM;
@@ -957,14 +957,14 @@ static void destroy_rings(struct sw *sw)
for (i = 0; i < RX_DESCS; i++) {
struct _rx_ring *rx_ring = &sw->rx_ring;
struct rx_desc *desc = &(rx_ring)->desc[i];
- struct sk_buff *skb = sw->rx_ring.buff_tab[i];
+ void *buf = sw->rx_ring.buff_tab[i];
- if (!skb)
+ if (!buf)
continue;
dma_unmap_single(sw->dev, desc->sdp, RX_SEGMENT_MRU,
DMA_FROM_DEVICE);
- dev_kfree_skb(skb);
+ skb_free_frag(buf);
}
for (i = 0; i < TX_DESCS; i++) {