]> git.baikalelectronics.ru Git - kernel.git/commit
dp83640: Fix receive timestamp race condition
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Tue, 22 Jul 2014 13:20:45 +0000 (15:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jul 2014 02:56:18 +0000 (19:56 -0700)
commit36c3ad82cbad5e4febfcfc1caa5aee2a825dc9dc
tree157d94a877a55474fec8f4bd3bf01fa05203fbe4
parenta0d97e85fac2ec88544377e7cecebfa32465da42
dp83640: Fix receive timestamp race condition

When timestamping received packets, rx_timestamp_work may be scheduled
before the timestamps is received from the hardware resulting in the
packet beeing delivered without the timestamp.

This is fixed by changing the receive timestamp path:

On receiving a packet that need timestamping, the rxts list is
traversed.  If a match is found, packet+timestamp are delivered,
otherwise the packet is added to a rx_queue.

When a timestamp arrives rx_queue is traversed and if a matching
packet is found, it is delivered with the timestamp. Otherwise the
timestamp is added to the rxts list for matching with packets arriving
later.

In case the hardware drops a timestamp, a workqueue regularly checks
the queue for old packets and delivers them without a timestamp.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/dp83640.c