• Stefan Richter's avatar
    firewire: net: replace lists by counters · 48553011
    Stefan Richter authored
    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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
    48553011
net.c 42.1 KB