• Furong Xu's avatar
    net: stmmac: Enable TSO on VLANs · 041cc86b
    Furong Xu authored
    The TSO engine works well when the frames are not VLAN Tagged.
    But it will produce broken segments when frames are VLAN Tagged.
    
    The first segment is all good, while the second segment to the
    last segment are broken, they lack of required VLAN tag.
    
    An example here:
    ========
    // 1st segment of a VLAN Tagged TSO frame, nothing wrong.
    MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1518: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [.], seq 1:1449
    
    // 2nd to last segments of a VLAN Tagged TSO frame, VLAN tag is missing.
    MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 1449:2897
    MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 2897:4345
    MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [.], seq 4345:5793
    MacSrc > MacDst, ethertype IPv4 (0x0800), length 1514: HostA:42643 > HostB:5201: Flags [P.], seq 5793:7241
    
    // normal VLAN Tagged non-TSO frame, nothing wrong.
    MacSrc > MacDst, ethertype 802.1Q (0x8100), length 1022: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [P.], seq 7241:8193
    MacSrc > MacDst, ethertype 802.1Q (0x8100), length 70: vlan 100, p 1, ethertype IPv4 (0x0800), HostA:42643 > HostB:5201: Flags [F.], seq 8193
    ========
    
    When transmitting VLAN Tagged TSO frames, never insert VLAN tag by HW,
    always insert VLAN tag to SKB payload, then TSO works well on VLANs for
    all MAC cores.
    
    Tested on DWMAC CORE 5.10a, DWMAC CORE 5.20a and DWXGMAC CORE 3.20a
    Signed-off-by: default avatarFurong Xu <0x1207@gmail.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240615095611.517323-1-0x1207@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    041cc86b
stmmac_main.c 220 KB