diff options
author | Pavel Roskin <proski@gnu.org> | 2006-04-07 04:10:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:51 -0400 |
commit | 470e2aa6dbdd2c7eb6562ae365a17a627f7070e8 (patch) | |
tree | d6ecbf82b73c6cb1700c635704dacbda8baa4b7c | |
parent | 8d5be088263b0d3dbb7e7959b7c403b3d026a5d3 (diff) |
[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: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/orinoco.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 9fde17bebebf..e7d06b90afe2 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -449,16 +449,13 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
449 | /* Oops, the firmware hasn't established a connection, | 449 | /* Oops, the firmware hasn't established a connection, |
450 | silently drop the packet (this seems to be the | 450 | silently drop the packet (this seems to be the |
451 | safest approach). */ | 451 | safest approach). */ |
452 | stats->tx_errors++; | 452 | goto drop; |
453 | orinoco_unlock(priv, &flags); | ||
454 | dev_kfree_skb(skb); | ||
455 | return NETDEV_TX_OK; | ||
456 | } | 453 | } |
457 | 454 | ||
458 | /* Check packet length */ | 455 | /* Check packet length */ |
459 | data_len = skb->len; | 456 | data_len = skb->len; |
460 | if (data_len < ETH_HLEN) | 457 | if (data_len < ETH_HLEN) |
461 | goto fail; | 458 | goto drop; |
462 | 459 | ||
463 | eh = (struct ethhdr *)skb->data; | 460 | eh = (struct ethhdr *)skb->data; |
464 | 461 | ||
@@ -469,8 +466,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
469 | if (net_ratelimit()) | 466 | if (net_ratelimit()) |
470 | printk(KERN_ERR "%s: Error %d writing Tx descriptor " | 467 | printk(KERN_ERR "%s: Error %d writing Tx descriptor " |
471 | "to BAP\n", dev->name, err); | 468 | "to BAP\n", dev->name, err); |
472 | stats->tx_errors++; | 469 | goto busy; |
473 | goto fail; | ||
474 | } | 470 | } |
475 | 471 | ||
476 | /* Clear the 802.11 header and data length fields - some | 472 | /* 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 | if (net_ratelimit()) | 497 | if (net_ratelimit()) |
502 | printk(KERN_ERR "%s: Error %d writing packet " | 498 | printk(KERN_ERR "%s: Error %d writing packet " |
503 | "header to BAP\n", dev->name, err); | 499 | "header to BAP\n", dev->name, err); |
504 | stats->tx_errors++; | 500 | goto busy; |
505 | goto fail; | ||
506 | } | 501 | } |
507 | } else { /* IEEE 802.3 frame */ | 502 | } else { /* IEEE 802.3 frame */ |
508 | data_len = skb->len; | 503 | data_len = skb->len; |
@@ -515,8 +510,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
515 | if (err) { | 510 | if (err) { |
516 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", | 511 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", |
517 | dev->name, err); | 512 | dev->name, err); |
518 | stats->tx_errors++; | 513 | goto busy; |
519 | goto fail; | ||
520 | } | 514 | } |
521 | 515 | ||
522 | /* Finally, we actually initiate the send */ | 516 | /* Finally, we actually initiate the send */ |
@@ -529,20 +523,23 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
529 | if (net_ratelimit()) | 523 | if (net_ratelimit()) |
530 | printk(KERN_ERR "%s: Error %d transmitting packet\n", | 524 | printk(KERN_ERR "%s: Error %d transmitting packet\n", |
531 | dev->name, err); | 525 | dev->name, err); |
532 | stats->tx_errors++; | 526 | goto busy; |
533 | goto fail; | ||
534 | } | 527 | } |
535 | 528 | ||
536 | dev->trans_start = jiffies; | 529 | dev->trans_start = jiffies; |
537 | stats->tx_bytes += data_off + data_len; | 530 | stats->tx_bytes += data_off + data_len; |
531 | goto ok; | ||
538 | 532 | ||
539 | orinoco_unlock(priv, &flags); | 533 | drop: |
534 | stats->tx_errors++; | ||
535 | stats->tx_dropped++; | ||
540 | 536 | ||
537 | ok: | ||
538 | orinoco_unlock(priv, &flags); | ||
541 | dev_kfree_skb(skb); | 539 | dev_kfree_skb(skb); |
542 | |||
543 | return NETDEV_TX_OK; | 540 | return NETDEV_TX_OK; |
544 | fail: | ||
545 | 541 | ||
542 | busy: | ||
546 | orinoco_unlock(priv, &flags); | 543 | orinoco_unlock(priv, &flags); |
547 | return NETDEV_TX_BUSY; | 544 | return NETDEV_TX_BUSY; |
548 | } | 545 | } |