diff options
-rw-r--r-- | drivers/firewire/net.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index e2e968e732bc..3a27cee5bf26 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -916,9 +916,10 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) | |||
916 | 916 | ||
917 | /* Check whether we or the networking TX soft-IRQ is last user. */ | 917 | /* Check whether we or the networking TX soft-IRQ is last user. */ |
918 | free = (ptask->outstanding_pkts == 0 && !list_empty(&ptask->pt_link)); | 918 | free = (ptask->outstanding_pkts == 0 && !list_empty(&ptask->pt_link)); |
919 | if (free) | ||
920 | list_del(&ptask->pt_link); | ||
919 | 921 | ||
920 | if (ptask->outstanding_pkts == 0) { | 922 | if (ptask->outstanding_pkts == 0) { |
921 | list_del(&ptask->pt_link); | ||
922 | dev->netdev->stats.tx_packets++; | 923 | dev->netdev->stats.tx_packets++; |
923 | dev->netdev->stats.tx_bytes += skb->len; | 924 | dev->netdev->stats.tx_bytes += skb->len; |
924 | } | 925 | } |
@@ -973,6 +974,31 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) | |||
973 | fwnet_free_ptask(ptask); | 974 | fwnet_free_ptask(ptask); |
974 | } | 975 | } |
975 | 976 | ||
977 | static void fwnet_transmit_packet_failed(struct fwnet_packet_task *ptask) | ||
978 | { | ||
979 | struct fwnet_device *dev = ptask->dev; | ||
980 | unsigned long flags; | ||
981 | bool free; | ||
982 | |||
983 | spin_lock_irqsave(&dev->lock, flags); | ||
984 | |||
985 | /* One fragment failed; don't try to send remaining fragments. */ | ||
986 | ptask->outstanding_pkts = 0; | ||
987 | |||
988 | /* Check whether we or the networking TX soft-IRQ is last user. */ | ||
989 | free = !list_empty(&ptask->pt_link); | ||
990 | if (free) | ||
991 | list_del(&ptask->pt_link); | ||
992 | |||
993 | dev->netdev->stats.tx_dropped++; | ||
994 | dev->netdev->stats.tx_errors++; | ||
995 | |||
996 | spin_unlock_irqrestore(&dev->lock, flags); | ||
997 | |||
998 | if (free) | ||
999 | fwnet_free_ptask(ptask); | ||
1000 | } | ||
1001 | |||
976 | static void fwnet_write_complete(struct fw_card *card, int rcode, | 1002 | static void fwnet_write_complete(struct fw_card *card, int rcode, |
977 | void *payload, size_t length, void *data) | 1003 | void *payload, size_t length, void *data) |
978 | { | 1004 | { |
@@ -980,11 +1006,12 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
980 | 1006 | ||
981 | ptask = data; | 1007 | ptask = data; |
982 | 1008 | ||
983 | if (rcode == RCODE_COMPLETE) | 1009 | if (rcode == RCODE_COMPLETE) { |
984 | fwnet_transmit_packet_done(ptask); | 1010 | fwnet_transmit_packet_done(ptask); |
985 | else | 1011 | } else { |
986 | fw_error("fwnet_write_complete: failed: %x\n", rcode); | 1012 | fw_error("fwnet_write_complete: failed: %x\n", rcode); |
987 | /* ??? error recovery */ | 1013 | fwnet_transmit_packet_failed(ptask); |
1014 | } | ||
988 | } | 1015 | } |
989 | 1016 | ||
990 | static int fwnet_send_packet(struct fwnet_packet_task *ptask) | 1017 | static int fwnet_send_packet(struct fwnet_packet_task *ptask) |