14 Nov, 2011

1 commit

  • Reading /proc/net/snmp6 on a machine with a lot of cpus is very
    expensive (can be ~88000 us).

    This is because ICMPV6MSG MIB uses 4096 bytes per cpu, and folding
    values for all possible cpus can read 16 Mbytes of memory (32MBytes on
    non x86 arches)

    ICMP messages are not considered as fast path on a typical server, and
    eventually few cpus handle them anyway. We can afford an atomic
    operation instead of using percpu data.

    This saves 4096 bytes per cpu and per network namespace.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

01 Nov, 2011

1 commit


20 May, 2011

1 commit

  • ipv6 has per device ICMP SNMP counters, taking too much space because
    they use percpu storage.

    needed size per device is :
    (512+4)*sizeof(long)*number_of_possible_cpus*2

    On a 32bit kernel, 16 possible cpus, this wastes more than 64kbytes of
    memory per ipv6 enabled network device, taken in vmalloc pool.

    Since ICMP messages are rare, just use shared counters (atomic_long_t)

    Per network space ICMP counters are still using percpu memory, we might
    also convert them to shared counters in a future patch.

    Signed-off-by: Eric Dumazet
    CC: Denys Fedoryshchenko
    Signed-off-by: David S. Miller

    Eric Dumazet
     

31 Oct, 2010

1 commit


01 Jul, 2010

1 commit

  • /proc/net/snmp and /proc/net/netstat expose SNMP counters.

    Width of these counters is either 32 or 64 bits, depending on the size
    of "unsigned long" in kernel.

    This means user program parsing these files must already be prepared to
    deal with 64bit values, regardless of user program being 32 or 64 bit.

    This patch introduces 64bit snmp values for IPSTAT mib, where some
    counters can wrap pretty fast if they are 32bit wide.

    # netstat -s|egrep "InOctets|OutOctets"
    InOctets: 244068329096
    OutOctets: 244069348848

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

18 May, 2010

1 commit

  • This patch removes from net/ (but not any netfilter files)
    all the unnecessary return; statements that precede the
    last closing brace of void functions.

    It does not remove the returns that are immediately
    preceded by a label as gcc doesn't like that.

    Done via:
    $ grep -rP --include=*.[ch] -l "return;\n}" net/ | \
    xargs perl -i -e 'local $/ ; while (<>) { s/\n[ \t\n]+return;\n}/\n}/g; print; }'

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

04 Apr, 2010

1 commit

  • When ip_append() fails because of socket limit or memory shortage,
    increment ICMP_MIB_OUTERRORS counter, so that "netstat -s" can report
    these errors.

    LANG=C netstat -s | grep "ICMP messages failed"
    0 ICMP messages failed

    For IPV6, implement ICMP6_MIB_OUTERRORS counter as well.

    # grep Icmp6OutErrors /proc/net/dev_snmp6/*
    /proc/net/dev_snmp6/eth0:Icmp6OutErrors 0
    /proc/net/dev_snmp6/lo:Icmp6OutErrors 0

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

17 Feb, 2010

1 commit

  • Add __percpu sparse annotations to net.

    These annotations are to make sparse consider percpu variables to be
    in a different address space and warn if accessed without going
    through percpu accessors. This patch doesn't affect normal builds.

    The macro and type tricks around snmp stats make things a bit
    interesting. DEFINE/DECLARE_SNMP_STAT() macros mark the target field
    as __percpu and SNMP_UPD_PO_STATS() macro is updated accordingly. All
    snmp_mib_*() users which used to cast the argument to (void **) are
    updated to cast it to (void __percpu **).

    Signed-off-by: Tejun Heo
    Acked-by: David S. Miller
    Cc: Patrick McHardy
    Cc: Arnaldo Carvalho de Melo
    Cc: Vlad Yasevich
    Cc: netdev@vger.kernel.org
    Signed-off-by: David S. Miller

    Tejun Heo
     

23 Jan, 2010

1 commit


18 Jan, 2010

1 commit


11 Jan, 2010

1 commit

  • Stanse found a potential null dereference in snmp6_unregister_dev.
    There is a check for idev being NULL, but it is dereferenced
    earlier. But idev cannot be NULL when passed to
    snmp6_unregister_dev, so remove the test.

    Signed-off-by: Jiri Slaby
    Cc: "David S. Miller"
    Cc: Alexey Kuznetsov
    Cc: "Pekka Savola (ipv6)"
    Cc: James Morris
    Cc: Hideaki YOSHIFUJI
    Cc: Patrick McHardy
    Cc: netdev@vger.kernel.org
    Signed-off-by: David S. Miller

    Jiri Slaby
     

06 Aug, 2009

1 commit


27 Apr, 2009

1 commit

  • The IP MIB (RFC 4293) defines stats for InOctets, OutOctets, InMcastOctets and
    OutMcastOctets:
    http://tools.ietf.org/html/rfc4293
    But it seems we don't track those in any way that easy to separate from other
    protocols. This patch adds those missing counters to the stats file. Tested
    successfully by me

    With help from Eric Dumazet.

    Signed-off-by: Neil Horman
    Signed-off-by: David S. Miller

    Neil Horman
     

20 Nov, 2008

1 commit


09 Oct, 2008

1 commit


08 Oct, 2008

8 commits


30 Jul, 2008

1 commit


20 Jul, 2008

1 commit


18 Jul, 2008

2 commits


12 Jun, 2008

1 commit


02 May, 2008

1 commit


01 Apr, 2008

3 commits


26 Mar, 2008

1 commit


07 Mar, 2008

1 commit

  • This reverts commit db1ed684f6c430c4cdad67d058688b8a1b5e607c ("[IPV6]
    UDP: Rename IPv6 UDP files."), commit
    8be8af8fa4405652e6c0797db5465a4be8afb998 ("[IPV4] UDP: Move
    IPv4-specific bits to other file.") and commit
    e898d4db2749c6052072e9bc4448e396cbdeb06a ("[UDP]: Allow users to
    configure UDP-Lite.").

    First, udplite is of such small cost, and it is a core protocol just
    like TCP and normal UDP are.

    We spent enormous amounts of effort to make udplite share as much code
    with core UDP as possible. All of that work is less valuable if we're
    just going to slap a config option on udplite support.

    It is also causing build failures, as reported on linux-next, showing
    that the changeset was not tested very well. In fact, this is the
    second build failure resulting from the udplite change.

    Finally, the config options provided was a bool, instead of a modular
    option. Meaning the udplite code does not even get build tested
    by allmodconfig builds, and furthermore the user is not presented
    with a reasonable modular build option which is particularly needed
    by distribution vendors.

    Signed-off-by: David S. Miller

    David S. Miller
     

06 Mar, 2008

1 commit


04 Mar, 2008

1 commit

  • Let's give users an option for disabling UDP-Lite (~4K).

    old:
    | text data bss dec hex filename
    | 286498 12432 6072 305002 4a76a net/ipv4/built-in.o
    | 193830 8192 3204 205226 321aa net/ipv6/ipv6.o

    new (without UDP-Lite):
    | text data bss dec hex filename
    | 284086 12136 5432 301654 49a56 net/ipv4/built-in.o
    | 191835 7832 3076 202743 317f7 net/ipv6/ipv6.o

    Signed-off-by: YOSHIFUJI Hideaki

    YOSHIFUJI Hideaki
     

29 Feb, 2008

1 commit


29 Jan, 2008

3 commits

  • This is also simple, but introduces more changes, since
    then mem counter is altered in more places.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     
  • This is simple - just move the variable from struct inet_frags
    to struct netns_frags and adjust the usage appropriately.

    Signed-off-by: Pavel Emelyanov
    Signed-off-by: David S. Miller

    Pavel Emelyanov
     
  • 1) Cleanups (all functions are prefixed by sock_prot_inuse)

    sock_prot_inc_use(prot) -> sock_prot_inuse_add(prot,-1)
    sock_prot_dec_use(prot) -> sock_prot_inuse_add(prot,-1)
    sock_prot_inuse() -> sock_prot_inuse_get()

    New functions :

    sock_prot_inuse_init() and sock_prot_inuse_free() to abstract pcounter use.

    2) if CONFIG_PROC_FS=n, we can zap 'inuse' member from "struct proto",
    since nobody wants to read the inuse value.

    This saves 1372 bytes on i386/SMP and some cpu cycles.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet