summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/nvidia
diff options
context:
space:
mode:
authorZhu Yanjun <yanjun.zhu@oracle.com>2017-12-26 01:22:50 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-02 13:29:23 -0500
commitac0b715eab23b82e7f9257fc2ca0c04f8c7695f1 (patch)
treed64acb735e8df58dc2b8d40e69f0bce19fba8f27 /drivers/net/ethernet/nvidia
parentd36f45e5b46723cf2d4147173e18c52d4143176d (diff)
downloadlinux-ac0b715eab23b82e7f9257fc2ca0c04f8c7695f1.tar.bz2
forcedeth: optimize the rx with likely
In the rx fastpath, the function netdev_alloc_skb rarely fails. Therefore, a likely() optimization is added to this error check conditional. CC: Srinivas Eeda <srinivas.eeda@oracle.com> CC: Joe Jin <joe.jin@oracle.com> CC: Junxiao Bi <junxiao.bi@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/nvidia')
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 49d6d789459e..a79b9f814844 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -1817,7 +1817,7 @@ static int nv_alloc_rx(struct net_device *dev)
while (np->put_rx.orig != less_rx) {
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
- if (skb) {
+ if (likely(skb)) {
np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
skb->data,
@@ -1858,7 +1858,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
while (np->put_rx.ex != less_rx) {
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
- if (skb) {
+ if (likely(skb)) {
np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
skb->data,