• Toshiaki Makita's avatar
    veth: Add XDP TX and REDIRECT · d1396004
    Toshiaki Makita authored
    This allows further redirection of xdp_frames like
    
     NIC   -> veth--veth -> veth--veth
     (XDP)          (XDP)         (XDP)
    
    The intermediate XDP, redirecting packets from NIC to the other veth,
    reuses xdp_mem_info from NIC so that page recycling of the NIC works on
    the destination veth's XDP.
    In this way return_frame is not fully guarded by NAPI, since another
    NAPI handler on another cpu may use the same xdp_mem_info concurrently.
    Thus disable napi_direct by xdp_set_return_frame_no_direct() during the
    NAPI context.
    
    v8:
    - Don't use xdp_frame pointer address for data_hard_start of xdp_buff.
    
    v4:
    - Use xdp_[set|clear]_return_frame_no_direct() instead of a flag in
      xdp_mem_info.
    
    v3:
    - Fix double free when veth_xdp_tx() returns a positive value.
    - Convert xdp_xmit and xdp_redir variables into flags.
    Signed-off-by: default avatarToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    d1396004
veth.c 25.8 KB