• Maciej Fijalkowski's avatar
    selftests: xsk: Implement bpf_link test · 27e1ca25
    Maciej Fijalkowski authored
    Introduce a test that is supposed to verify the persistence of BPF
    resources based on underlying bpf_link usage.
    
    Test will:
    1) create and bind two sockets on queue ids 0 and 1
    2) run a traffic on queue ids 0
    3) remove xsk sockets from queue 0 on both veth interfaces
    4) run a traffic on queues ids 1
    
    Running traffic successfully on qids 1 means that BPF resources were
    not removed on step 3).
    
    In order to make it work, change the command that creates veth pair to
    have the 4 queue pairs by default.
    
    Introduce the arrays of xsks and umems to ifobject struct but keep a
    pointers to single entities, so rest of the logic around Rx/Tx can be
    kept as-is.
    
    For umem handling, double the size of mmapped space and split that
    between the two sockets.
    
    Rename also bidi_pass to a variable 'second_step' of a boolean type as
    it's now used also for the test that is introduced here and it doesn't
    have anything in common with bi-directional testing.
    
    Drop opt_queue command line argument as it wasn't working before anyway.
    Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20210329224316.17793-15-maciej.fijalkowski@intel.com
    27e1ca25
test_xsk.sh 4.4 KB