• Tirthendu Sarkar's avatar
    xsk: add support for AF_XDP multi-buffer on Tx path · cf24f5a5
    Tirthendu Sarkar authored
    For transmitting an AF_XDP packet, allocate skb while processing the
    first desc and copy data to it. The 'XDP_PKT_CONTD' flag in 'options'
    field of the desc indicates the EOP status of the packet. If the current
    desc is not EOP, store the skb, release the current desc and go
    on to read the next descs.
    
    Allocate a page for each subsequent desc, copy data to it and add it as
    a frag in the skb stored in xsk. On processing EOP, transmit the skb
    with frags. Addresses contained in descs have been already queued in
    consumer queue and skb destructor updated the completion count.
    
    On transmit failure cancel the releases, clear the descs from the
    completion queue and consume the skb for retrying packet transmission.
    
    For any invalid descriptor (invalid length/address/options) in the middle
    of a packet, all pending descriptors will be dropped by xsk core along
    with the invalid one and the next descriptor is treated as the start of
    a new packet.
    
    Maximum supported frames for a packet is MAX_SKB_FRAGS + 1. If it is
    exceeded, all descriptors accumulated so far are dropped.
    Signed-off-by: default avatarTirthendu Sarkar <tirthendu.sarkar@intel.com>
    Link: https://lore.kernel.org/r/20230719132421.584801-9-maciej.fijalkowski@intel.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    cf24f5a5
xsk_queue.h 11.5 KB