• Gerhard Engleder's avatar
    tsnep: Add XDP socket zero-copy RX support · 3fc23339
    Gerhard Engleder authored
    Add support for XSK zero-copy to RX path. The setup of the XSK pool can
    be done at runtime. If the netdev is running, then the queue must be
    disabled and enabled during reconfiguration. This can be done easily
    with functions introduced in previous commits.
    
    A more important property is that, if the netdev is running, then the
    setup of the XSK pool shall not stop the netdev in case of errors. A
    broken netdev after a failed XSK pool setup is bad behavior. Therefore,
    the allocation and setup of resources during XSK pool setup is done only
    before any queue is disabled. Additionally, freeing and later allocation
    of resources is eliminated in some cases. Page pool entries are kept for
    later use. Two memory models are registered in parallel. As a result,
    the XSK pool setup cannot fail during queue reconfiguration.
    
    In contrast to other drivers, XSK pool setup and XDP BPF program setup
    are separate actions. XSK pool setup can be done without any XDP BPF
    program. The XDP BPF program can be added, removed or changed without
    any reconfiguration of the XSK pool.
    
    Test results with A53 1.2GHz:
    
    xdpsock rxdrop copy mode, 64 byte frames:
                       pps            pkts           1.00
    rx                 856,054        10,625,775
    Two CPUs with both 100% utilization.
    
    xdpsock rxdrop zero-copy mode, 64 byte frames:
                       pps            pkts           1.00
    rx                 889,388        4,615,284
    Two CPUs with 100% and 20% utilization.
    
    Packet rate increases and CPU utilization is reduced.
    
    100% CPU load seems to the base load. This load is consumed by ksoftirqd
    just for dropping the generated packets without xdpsock running.
    
    Using batch API reduced CPU utilization slightly, but measurements are
    not stable enough to provide meaningful numbers.
    Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
    Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    3fc23339
tsnep_xdp.c 1.88 KB