• Robert Hancock's avatar
    net: macb: fix PTP TX timestamp failure due to packet padding · 7b90f5a6
    Robert Hancock authored
    PTP TX timestamp handling was observed to be broken with this driver
    when using the raw Layer 2 PTP encapsulation. ptp4l was not receiving
    the expected TX timestamp after transmitting a packet, causing it to
    enter a failure state.
    
    The problem appears to be due to the way that the driver pads packets
    which are smaller than the Ethernet minimum of 60 bytes. If headroom
    space was available in the SKB, this caused the driver to move the data
    back to utilize it. However, this appears to cause other data references
    in the SKB to become inconsistent. In particular, this caused the
    ptp_one_step_sync function to later (in the TX completion path) falsely
    detect the packet as a one-step SYNC packet, even when it was not, which
    caused the TX timestamp to not be processed when it should be.
    
    Using the headroom for this purpose seems like an unnecessary complexity
    as this is not a hot path in the driver, and in most cases it appears
    that there is sufficient tailroom to not require using the headroom
    anyway. Remove this usage of headroom to prevent this inconsistency from
    occurring and causing other problems.
    
    Fixes: 653e92a9 ("net: macb: add support for padding and fcs computation")
    Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
    Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com> # on SAMA7G5
    Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7b90f5a6
macb_main.c 136 KB