06 Jul, 2011

1 commit


23 Feb, 2011

1 commit


20 Jan, 2011

1 commit


05 Oct, 2010

1 commit

  • skb_headroom() is unsigned so "skb_headroom(skb) + toff" is also
    unsigned and can't be less than zero. This test was added in 66d50d25:
    "u32: negative offset fix" It was supposed to fix a regression.

    Signed-off-by: Dan Carpenter
    Signed-off-by: David S. Miller

    Dan Carpenter
     

03 Aug, 2010

1 commit

  • It was possible to use a negative offset in a u32 match to reference
    the ethernet header or other parts of the link layer header.
    This fixes the regression caused by:

    commit fbc2e7d9cf49e0bf89b9e91fd60a06851a855c5d
    Author: Changli Gao
    Date: Wed Jun 2 07:32:42 2010 -0700

    cls_u32: use skb_header_pointer() to dereference data safely

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

02 Jun, 2010

1 commit

  • use skb_header_pointer() to dereference data safely

    the original skb->data dereference isn't safe, as there isn't any skb->len or
    skb_is_nonlinear() check. skb_header_pointer() is used instead in this patch.
    And when the skb isn't long enough, we terminate the function u32_classify()
    immediately with -1.

    Signed-off-by: Changli Gao
    Signed-off-by: David S. Miller

    Changli Gao
     

18 May, 2010

1 commit

  • The previous patch encourage me to go look at all the messages in
    the network scheduler and fix them. Many messages were missing
    any severity level. Some serious ones that should never happen
    were turned into WARN(), and the random noise messages that were
    handled changed to pr_debug().

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

12 Apr, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

25 Mar, 2010

1 commit


06 Jan, 2009

1 commit

  • New nodes are inserted in u32_change() under rtnl_lock() with wmb(),
    so without tcf_tree_lock() like in other classifiers (e.g. cls_fw).
    This isn't enough without rmb() on the read side, but on the other
    hand adding such barriers doesn't give any savings, so the lock is
    added instead.

    Reported-by: m0sia
    Signed-off-by: Jarek Poplawski
    Signed-off-by: David S. Miller

    Jarek Poplawski
     

20 Nov, 2008

1 commit

  • The use of xchg() hasn't been necessary since 2.2.something when proper
    locking was added to packet schedulers. In the case of classifiers they
    mostly weren't even necessary before that since they're mainly used
    to assign a NULL pointer to the filter root in the ->destroy path;
    the root is destroyed immediately after that.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

26 Jul, 2008

1 commit

  • Removes legacy reinvent-the-wheel type thing. The generic
    machinery integrates much better to automated debugging aids
    such as kerneloops.org (and others), and is unambiguous due to
    better naming. Non-intuively BUG_TRAP() is actually equal to
    WARN_ON() rather than BUG_ON() though some might actually be
    promoted to BUG_ON() but I left that to future.

    I could make at least one BUILD_BUG_ON conversion.

    Signed-off-by: Ilpo Järvinen
    Signed-off-by: David S. Miller

    Ilpo Järvinen
     

19 Jul, 2008

1 commit

  • The u32_list is just an indirect way of maintaining a reference
    to a U32 node on a per-qdisc basis.

    Just add an explicit node pointer for u32 to struct Qdisc an do
    away with this global list.

    Signed-off-by: David S. Miller

    David S. Miller
     

13 Apr, 2008

1 commit

  • Deleting of nonroot hnodes mostly doesn't work in u32_delete():
    refcnt == 1 is expected, but such hnodes' refcnts are initialized
    with 0 and charged only with "link" nodes. Now they'll start with
    1 like usual. Thanks to Patrick McHardy for an improving suggestion.

    Signed-off-by: Jarek Poplawski
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Jarek Poplawski
     

18 Mar, 2008

1 commit


01 Feb, 2008

1 commit


29 Jan, 2008

8 commits


11 Nov, 2007

1 commit

  • Computing the rank of the first set bit in the hash mask (for using later
    in u32_hash_fold()) was done with plain C code. Using ffs() instead makes
    the code more readable and improves performance (since ffs() is better
    optimized in assembler).

    Using the conditional operator on hash mask before applying ntohl() also
    saves one ntohl() call if mask is 0.

    Signed-off-by: Radu Rendec
    Signed-off-by: Jarek Poplawski
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Radu Rendec
     

07 Nov, 2007

1 commit

  • While trying to implement u32 hashes in my shaping machine I ran into
    a possible bug in the u32 hash/bucket computing algorithm
    (net/sched/cls_u32.c).

    The problem occurs only with hash masks that extend over the octet
    boundary, on little endian machines (where htonl() actually does
    something).

    Let's say that I would like to use 0x3fc0 as the hash mask. This means
    8 contiguous "1" bits starting at b6. With such a mask, the expected
    (and logical) behavior is to hash any address in, for instance,
    192.168.0.0/26 in bucket 0, then any address in 192.168.0.64/26 in
    bucket 1, then 192.168.0.128/26 in bucket 2 and so on.

    This is exactly what would happen on a big endian machine, but on
    little endian machines, what would actually happen with current
    implementation is 0x3fc0 being reversed (into 0xc03f0000) by htonl()
    in the userspace tool and then applied to 192.168.x.x in the u32
    classifier. When shifting right by 16 bits (rank of first "1" bit in
    the reversed mask) and applying the divisor mask (0xff for divisor
    256), what would actually remain is 0x3f applied on the "168" octet of
    the address.

    One could say is this can be easily worked around by taking endianness
    into account in userspace and supplying an appropriate mask (0xfc03)
    that would be turned into contiguous "1" bits when reversed
    (0x03fc0000). But the actual problem is the network address (inside
    the packet) not being converted to host order, but used as a
    host-order value when computing the bucket.

    Let's say the network address is written as n31 n30 ... n0, with n0
    being the least significant bit. When used directly (without any
    conversion) on a little endian machine, it becomes n7 ... n0 n8 ..n15
    etc in the machine's registers. Thus bits n7 and n8 would no longer be
    adjacent and 192.168.64.0/26 and 192.168.128.0/26 would no longer be
    consecutive.

    The fix is to apply ntohl() on the hmask before computing fshift,
    and in u32_hash_fold() convert the packet data to host order before
    shifting down by fshift.

    With helpful feedback from Jamal Hadi Salim and Jarek Poplawski.

    Signed-off-by: David S. Miller

    Radu Rendec
     

11 Oct, 2007

1 commit

  • Fix a bunch of sparse warnings. Mostly about 0 used as
    NULL pointer, and shadowed variable declarations.
    One notable case was that hash size should have been unsigned.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     

08 Oct, 2007

1 commit


15 Jul, 2007

1 commit

  • The NET_CLS_ACT option is now a full replacement for NET_CLS_POLICE,
    remove the old code. The config option will be kept around to select
    the equivalent NET_CLS_ACT options for a short time to allow easier
    upgrades.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

11 Jul, 2007

1 commit


26 Apr, 2007

4 commits


15 Feb, 2007

1 commit

  • After Al Viro (finally) succeeded in removing the sched.h #include in module.h
    recently, it makes sense again to remove other superfluous sched.h includes.
    There are quite a lot of files which include it but don't actually need
    anything defined in there. Presumably these includes were once needed for
    macros that used to live in sched.h, but moved to other header files in the
    course of cleaning it up.

    To ease the pain, this time I did not fiddle with any header files and only
    removed #includes from .c-files, which tend to cause less trouble.

    Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
    arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
    allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
    configs in arch/arm/configs on arm. I also checked that no new warnings were
    introduced by the patch (actually, some warnings are removed that were emitted
    by unnecessarily included header files).

    Signed-off-by: Tim Schmielau
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

11 Feb, 2007

1 commit


03 Dec, 2006

1 commit

  • nfmark is being used in various subsystems and has become
    the defacto mark field for all kinds of packets. Therefore
    it makes sense to rename it to `mark' and remove the
    dependency on CONFIG_NETFILTER.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     

18 Aug, 2006

1 commit


22 Jul, 2006

1 commit