• Song Yoong Siang's avatar
    net: stmmac: Add Tx HWTS support to XDP ZC · 1347b419
    Song Yoong Siang authored
    This patch enables transmit hardware timestamp support to XDP zero copy
    via XDP Tx metadata framework.
    
    This patchset is tested with tools/testing/selftests/bpf/xdp_hw_metadata
    on Intel Tiger Lake platform. Below are the test steps and results.
    
    Command on DUT:
    sudo ./xdp_hw_metadata <interface name>
    sudo hwstamp_ctl -i <interface name> -t 1 -r 1
    
    Command on Link Partner:
    echo -n xdp | nc -u -q1 <destination IPv4 addr> 9091
    
    Result:
    xsk_ring_cons__peek: 1
    0x55bbbf08b6d0: rx_desc[2]->addr=8c100 addr=8c100 comp_addr=8c100 EoP
    No rx_hash err=-95
    rx_timestamp:  1677762688429141540 (sec:1677762688.4291)
    HW RX-time:   1677762688429141540 (sec:1677762688.4291) delta to User RX-time sec:0.0003 (250.665 usec)
    XDP RX-time:   1677762688429375597 (sec:1677762688.4294) delta to User RX-time sec:0.0000 (16.608 usec)
    0x55bbbf08b6d0: ping-pong with csum=561c (want f488) csum_start=34 csum_offset=6
    0x55bbbf08b6d0: complete tx idx=2 addr=2008
    tx_timestamp:  1677762688431127273 (sec:1677762688.4311)
    HW TX-complete-time:   1677762688431127273 (sec:1677762688.4311) delta to User TX-complete-time sec:0.0083 (8331.655 usec)
    XDP RX-time:   1677762688429375597 (sec:1677762688.4294) delta to User TX-complete-time sec:0.0101 (10083.331 usec)
    HW RX-time:   1677762688429141540 (sec:1677762688.4291) delta to HW TX-complete-time sec:0.0020 (1985.733 usec)
    0x55bbbf08b6d0: complete rx idx=130 addr=8c100
    Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
    Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
    Link: https://lore.kernel.org/r/20231127190319.1190813-6-sdf@google.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    1347b419
stmmac_main.c 218 KB