• Gerhard Engleder's avatar
    tsnep: Fix mapping for zero copy XDP_TX action · d7f5fb33
    Gerhard Engleder authored
    For XDP_TX action xdp_buff is converted to xdp_frame. The conversion is
    done by xdp_convert_buff_to_frame(). The memory type of the resulting
    xdp_frame depends on the memory type of the xdp_buff. For page pool
    based xdp_buff it produces xdp_frame with memory type
    MEM_TYPE_PAGE_POOL. For zero copy XSK pool based xdp_buff it produces
    xdp_frame with memory type MEM_TYPE_PAGE_ORDER0.
    
    tsnep_xdp_xmit_back() is not prepared for that and uses always the page
    pool buffer type TSNEP_TX_TYPE_XDP_TX. This leads to invalid mappings
    and the transmission of undefined data.
    
    Improve tsnep_xdp_xmit_back() to use the generic buffer type
    TSNEP_TX_TYPE_XDP_NDO for zero copy XDP_TX.
    
    Fixes: 3fc23339 ("tsnep: Add XDP socket zero-copy RX support")
    Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    d7f5fb33
tsnep_main.c 67.3 KB