OSDN Git Service

firewire: net: replace lists by counters
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sat, 6 Nov 2010 22:18:23 +0000 (23:18 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Tue, 16 Nov 2010 23:08:48 +0000 (00:08 +0100)
commit48553011cea504796e513350740781ac6745f556
treef90a9e23ecd00c9c476e61e6e2c2fdd6cc552008
parent7ee11fa8d0a84b05cefe12b0bebc05ab0ea89cd6
firewire: net: replace lists by counters

The current transmit code does not at all make use of
  - fwnet_device.packet_list
and only very limited use of
  - fwnet_device.broadcasted_list,
  - fwnet_device.queued_packets.
Their current function is to track whether the TX soft-IRQ finished
dealing with an skb when the AT-req tasklet takes over, and to discard
pending tx datagrams (if there are any) when the local node is removed.

The latter does actually contain a race condition bug with TX soft-IRQ
and AT-req tasklet.

Instead of these lists and the corresponding link in fwnet_packet_task,
  - a flag in fwnet_packet_task to track whether fwnet_tx is done,
  - a counter of queued datagrams in fwnet_device
do the job as well.

The above mentioned theoretic race condition is resolved by letting
fwnet_remove sleep until all datagrams were flushed.  It may sleep
almost arbitrarily long since fwnet_remove is executed in the context of
a multithreaded (concurrency managed) workqueue.

The type of max_payload is changed to u16 here to avoid waste in struct
fwnet_packet_task.  This value cannot exceed 4096 per IEEE 1394:2008
table 16-18 (or 32678 per specification of packet headers, if there is
ever going to be something else than beta mode).

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/net.c