• D
    packet: respect devices with LLTX flag in direct xmit · 43279500
    Daniel Borkmann 提交于
    Quite often it can be useful to test with dummy or similar
    devices as a blackhole sink for skbs. Such devices are only
    equipped with a single txq, but marked as NETIF_F_LLTX as
    they do not require locking their internal queues on xmit
    (or implement locking themselves). Therefore, rather use
    HARD_TX_{UN,}LOCK API, so that NETIF_F_LLTX will be respected.
    
    trafgen mmap/TX_RING example against dummy device with config
    foo: { fill(0xff, 64) } results in the following performance
    improvements for such scenarios on an ordinary Core i7/2.80GHz:
    
    Before:
    
     Performance counter stats for 'trafgen -i foo -o du0 -n100000000' (10 runs):
    
       160,975,944,159 instructions:k            #    0.55  insns per cycle          ( +-  0.09% )
       293,319,390,278 cycles:k                  #    0.000 GHz                      ( +-  0.35% )
           192,501,104 branch-misses:k                                               ( +-  1.63% )
                   831 context-switches:k                                            ( +-  9.18% )
                     7 cpu-migrations:k                                              ( +-  7.40% )
                69,382 cache-misses:k            #    0.010 % of all cache refs      ( +-  2.18% )
           671,552,021 cache-references:k                                            ( +-  1.29% )
    
          22.856401569 seconds time elapsed                                          ( +-  0.33% )
    
    After:
    
     Performance counter stats for 'trafgen -i foo -o du0 -n100000000' (10 runs):
    
       133,788,739,692 instructions:k            #    0.92  insns per cycle          ( +-  0.06% )
       145,853,213,256 cycles:k                  #    0.000 GHz                      ( +-  0.17% )
            59,867,100 branch-misses:k                                               ( +-  4.72% )
                   384 context-switches:k                                            ( +-  3.76% )
                     6 cpu-migrations:k                                              ( +-  6.28% )
                70,304 cache-misses:k            #    0.077 % of all cache refs      ( +-  1.73% )
            90,879,408 cache-references:k                                            ( +-  1.35% )
    
          11.719372413 seconds time elapsed                                          ( +-  0.24% )
    Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
    Cc: Jesper Dangaard Brouer <brouer@redhat.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    43279500
af_packet.c 95.7 KB