]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ixgbe: Check PTP Rx timestamps via BPF filter
authorJacob Keller <jacob.e.keller@intel.com>
Tue, 22 May 2012 06:18:08 +0000 (06:18 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 14 Jun 2012 10:13:48 +0000 (03:13 -0700)
commit1d1a79b5b94b0aa84e1e78dd9acdcffb12274848
tree9c6833a1486d5695269b35c56c1abbcbd3c618ae
parentc19197a7866fee6ff9985d9dc9962bc2ccbd3d7b
ixgbe: Check PTP Rx timestamps via BPF filter

This patch fixes a potential Rx timestamp deadlock that causes the Rx
timestamping to stall indefinitely. The issue could occur when a PTP packet is
timestamped by hardware but never reaches the Rx queue. In order to prevent a
permanent loss of timestamping, the RXSTMP(L/H) registers have to be read to
unlock them. (This used to only occur when a packet that was timestamped
reached the software.) However the registers can't be read early otherwise
there is no way to correlate them to the packet.

This patch introduces a filter function which can be used to determine if a
packet should have been timestamped. Supplied with the filter setup by the
hwtstamp ioctl, check to make sure the PTP protocol and message type match the
expected values. If so, then read the timestamp registers (to free them.) At
this point check the descriptor bit, if the bit is set then we know this
packet correlates to the timestamp stored in the RXTSTAMP registers.
Otherwise, assume that packet was dropped by the hardware, and ignore this
timestamp value. However, we have at least unlocked the rxtstamp registers for
future timestamping.

Due to the way the driver handles skb data, it cannot be directly accessed. In
order to work around this, a copy of the skb data into a linear buffer is
made. From this buffer it becomes possible to read the data correctly

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Richard Cochran <richardcochran@gmail.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe.h
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c