Commit 470e2aa6 authored by Pavel Roskin's avatar Pavel Roskin Committed by John W. Linville

[PATCH] orinoco: refactor and clean up Tx error handling

The result of orinoco_xmit() can be OK, dropped packet and busy
transmitter.  Rename labels accordingly.  Increment stats->tx_errors in
one place.  Increment stats->tx_dropped - nobody is doing it for us.
Signed-off-by: default avatarPavel Roskin <proski@gnu.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8d5be088
...@@ -449,16 +449,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -449,16 +449,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
/* Oops, the firmware hasn't established a connection, /* Oops, the firmware hasn't established a connection,
silently drop the packet (this seems to be the silently drop the packet (this seems to be the
safest approach). */ safest approach). */
stats->tx_errors++; goto drop;
orinoco_unlock(priv, &flags);
dev_kfree_skb(skb);
return NETDEV_TX_OK;
} }
/* Check packet length */ /* Check packet length */
data_len = skb->len; data_len = skb->len;
if (data_len < ETH_HLEN) if (data_len < ETH_HLEN)
goto fail; goto drop;
eh = (struct ethhdr *)skb->data; eh = (struct ethhdr *)skb->data;
...@@ -469,8 +466,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -469,8 +466,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: Error %d writing Tx descriptor " printk(KERN_ERR "%s: Error %d writing Tx descriptor "
"to BAP\n", dev->name, err); "to BAP\n", dev->name, err);
stats->tx_errors++; goto busy;
goto fail;
} }
/* Clear the 802.11 header and data length fields - some /* Clear the 802.11 header and data length fields - some
...@@ -501,8 +497,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -501,8 +497,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: Error %d writing packet " printk(KERN_ERR "%s: Error %d writing packet "
"header to BAP\n", dev->name, err); "header to BAP\n", dev->name, err);
stats->tx_errors++; goto busy;
goto fail;
} }
} else { /* IEEE 802.3 frame */ } else { /* IEEE 802.3 frame */
data_len = skb->len; data_len = skb->len;
...@@ -515,8 +510,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -515,8 +510,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
if (err) { if (err) {
printk(KERN_ERR "%s: Error %d writing packet to BAP\n", printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
dev->name, err); dev->name, err);
stats->tx_errors++; goto busy;
goto fail;
} }
/* Finally, we actually initiate the send */ /* Finally, we actually initiate the send */
...@@ -529,20 +523,23 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -529,20 +523,23 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "%s: Error %d transmitting packet\n", printk(KERN_ERR "%s: Error %d transmitting packet\n",
dev->name, err); dev->name, err);
stats->tx_errors++; goto busy;
goto fail;
} }
dev->trans_start = jiffies; dev->trans_start = jiffies;
stats->tx_bytes += data_off + data_len; stats->tx_bytes += data_off + data_len;
goto ok;
orinoco_unlock(priv, &flags); drop:
stats->tx_errors++;
stats->tx_dropped++;
ok:
orinoco_unlock(priv, &flags);
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
fail:
busy:
orinoco_unlock(priv, &flags); orinoco_unlock(priv, &flags);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
......
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