• Willem de Bruijn's avatar
    packet: tpacket_snd gso and checksum offload · 1d036d25
    Willem de Bruijn authored
    Support socket option PACKET_VNET_HDR together with PACKET_TX_RING.
    
    When enabled, a struct virtio_net_hdr is expected to precede the data
    in the ring. The vnet option must be set before the ring is created.
    
    The implementation reuses the existing skb_copy_bits code that is used
    when dev->hard_header_len is non-zero. Move this ll_header check to
    before the skb alloc and combine it with a test for vnet_hdr->hdr_len.
    Allocate and copy the max of the two.
    
    Verified with test program at
    github.com/wdebruij/kerneltools/blob/master/tests/psock_txring_vnet.c
    Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1d036d25
af_packet.c 106 KB