Commit a058a632 authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

be2net: a mini optimization in rx_compl_process() code

Introduce unlikely() for skb alloc failure and vlanf checks...
Signed-off-by: default avatarSathya Perla <sathyap@serverengines.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aa13bd6e
...@@ -768,16 +768,8 @@ static void be_rx_compl_process(struct be_adapter *adapter, ...@@ -768,16 +768,8 @@ static void be_rx_compl_process(struct be_adapter *adapter,
u32 vlanf, vid; u32 vlanf, vid;
u8 vtm; 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); skb = netdev_alloc_skb_ip_align(adapter->netdev, BE_HDR_LEN);
if (!skb) { if (unlikely(!skb)) {
if (net_ratelimit()) if (net_ratelimit())
dev_warn(&adapter->pdev->dev, "skb alloc failed\n"); dev_warn(&adapter->pdev->dev, "skb alloc failed\n");
be_rx_compl_discard(adapter, rxcp); be_rx_compl_discard(adapter, rxcp);
...@@ -795,7 +787,15 @@ static void be_rx_compl_process(struct be_adapter *adapter, ...@@ -795,7 +787,15 @@ static void be_rx_compl_process(struct be_adapter *adapter,
skb->protocol = eth_type_trans(skb, adapter->netdev); skb->protocol = eth_type_trans(skb, adapter->netdev);
skb->dev = 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) { if (!adapter->vlan_grp || adapter->vlans_added == 0) {
kfree_skb(skb); kfree_skb(skb);
return; return;
......
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