• J
    net: Add net_ratelimited_function and net_<level>_ratelimited macros · 3a3bfb61
    Joe Perches 提交于
    __ratelimit() can be considered an inverted bool test because
    it returns true when not ratelimited.  Several tests in the
    kernel tree use this __ratelimit() function incorrectly.
    
    No net_ratelimit uses are incorrect currently though.
    
    Most uses of net_ratelimit are to log something via printk or
    pr_<level>.
    
    In order to minimize the uses of net_ratelimit, and to start
    standardizing the code style used for __ratelimit() and net_ratelimit(),
    add a net_ratelimited_function() macro and net_<level>_ratelimited()
    logging macros similar to pr_<level>_ratelimited that use the global
    net_ratelimit instead of a static per call site "struct ratelimit_state".
    Signed-off-by: NJoe Perches <joe@perches.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    3a3bfb61
net.h 10.6 KB