• E
    filter: add SKF_AD_RXHASH and SKF_AD_CPU · da2033c2
    Eric Dumazet 提交于
    Add SKF_AD_RXHASH and SKF_AD_CPU to filter ancillary mechanism,
    to be able to build advanced filters.
    
    This can help spreading packets on several sockets with a fast
    selection, after RPS dispatch to N cpus for example, or to catch a
    percentage of flows in one queue.
    
    tcpdump -s 500 "cpu = 1" :
    
    [0] ld CPU
    [1] jeq #1  jt 2  jf 3
    [2] ret #500
    [3] ret #0
    
    # take 12.5 % of flows (average)
    tcpdump -s 1000 "rxhash & 7 = 2" :
    
    [0] ld RXHASH
    [1] and #7
    [2] jeq #2  jt 3  jf 4
    [3] ret #1000
    [4] ret #0
    Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
    Cc: Rui <wirelesser@gmail.com>
    Acked-by: NChangli Gao <xiaosuo@gmail.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    da2033c2
filter.h 4.1 KB