• Petar Penkov's avatar
    tun: enable NAPI for TUN/TAP driver · 94317099
    Petar Penkov authored
    Changes TUN driver to use napi_gro_receive() upon receiving packets
    rather than netif_rx_ni(). Adds flag IFF_NAPI that enables these
    changes and operation is not affected if the flag is disabled.  SKBs
    are constructed upon packet arrival and are queued to be processed
    later.
    
    The new path was evaluated with a benchmark with the following setup:
    Open two tap devices and a receiver thread that reads in a loop for
    each device. Start one sender thread and pin all threads to different
    CPUs. Send 1M minimum UDP packets to each device and measure sending
    time for each of the sending methods:
    	napi_gro_receive():	4.90s
    	netif_rx_ni():		4.90s
    	netif_receive_skb():	7.20s
    Signed-off-by: default avatarPetar Penkov <peterpenkov96@gmail.com>
    Cc: Eric Dumazet <edumazet@google.com>
    Cc: Mahesh Bandewar <maheshb@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Cc: davem@davemloft.net
    Cc: ppenkov@stanford.edu
    Acked-by: default avatarMahesh Bandewar <maheshb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    94317099
tun.c 68.6 KB