Commit c63c615e authored by Sieng Piaw Liew's avatar Sieng Piaw Liew Committed by David S. Miller

bcm63xx_enet: switch to napi_build_skb() to reuse skbuff_heads

napi_build_skb() reuses NAPI skbuff_head cache in order to save some
cycles on freeing/allocating skbuff_heads on every new Rx or completed
Tx.
Use napi_consume_skb() to feed the cache with skbuff_heads of completed
Tx so it's never empty.
Signed-off-by: default avatarSieng Piaw Liew <liew.s.piaw@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 49ae83fc
...@@ -388,7 +388,7 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget) ...@@ -388,7 +388,7 @@ static int bcm_enet_receive_queue(struct net_device *dev, int budget)
priv->rx_buf_size, DMA_FROM_DEVICE); priv->rx_buf_size, DMA_FROM_DEVICE);
priv->rx_buf[desc_idx] = NULL; priv->rx_buf[desc_idx] = NULL;
skb = build_skb(buf, priv->rx_frag_size); skb = napi_build_skb(buf, priv->rx_frag_size);
if (unlikely(!skb)) { if (unlikely(!skb)) {
skb_free_frag(buf); skb_free_frag(buf);
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
...@@ -468,7 +468,7 @@ static int bcm_enet_tx_reclaim(struct net_device *dev, int force) ...@@ -468,7 +468,7 @@ static int bcm_enet_tx_reclaim(struct net_device *dev, int force)
dev->stats.tx_errors++; dev->stats.tx_errors++;
bytes += skb->len; bytes += skb->len;
dev_kfree_skb(skb); napi_consume_skb(skb, !force);
released++; released++;
} }
......
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