From: Sathya Perla Date: Wed, 17 Feb 2010 01:34:22 +0000 (+0000) Subject: be2net: a mini optimization in rx_compl_process() code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a058a632747dd0f1799b12f4ecd54e43f5b5f10d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git be2net: a mini optimization in rx_compl_process() code Introduce unlikely() for skb alloc failure and vlanf checks... Signed-off-by: Sathya Perla Signed-off-by: David S. Miller --- diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index cbfaa3feb7c4..7bf1900df665 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c @@ -768,16 +768,8 @@ static void be_rx_compl_process(struct be_adapter *adapter, u32 vlanf, vid; u8 vtm; - vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); - vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); - - /* vlanf could be wrongly set in some cards. - * ignore if vtm is not set */ - if ((adapter->cap & 0x400) && !vtm) - vlanf = 0; - skb = netdev_alloc_skb_ip_align(adapter->netdev, BE_HDR_LEN); - if (!skb) { + if (unlikely(!skb)) { if (net_ratelimit()) dev_warn(&adapter->pdev->dev, "skb alloc failed\n"); be_rx_compl_discard(adapter, rxcp); @@ -795,7 +787,15 @@ static void be_rx_compl_process(struct be_adapter *adapter, skb->protocol = eth_type_trans(skb, adapter->netdev); skb->dev = adapter->netdev; - if (vlanf) { + vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); + vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); + + /* vlanf could be wrongly set in some cards. + * ignore if vtm is not set */ + if ((adapter->cap & 0x400) && !vtm) + vlanf = 0; + + if (unlikely(vlanf)) { if (!adapter->vlan_grp || adapter->vlans_added == 0) { kfree_skb(skb); return;