Skip to content

Commit

Permalink
be2net: a mini optimization in rx_compl_process() code
Browse files Browse the repository at this point in the history
Introduce unlikely() for skb alloc failure and vlanf checks...

Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sathya Perla authored and David S. Miller committed Feb 17, 2010
1 parent aa13bd6 commit a058a63
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit a058a63

Please sign in to comment.