01 Nov, 2011

1 commit


25 Oct, 2011

1 commit


20 Oct, 2011

1 commit


22 Sep, 2011

2 commits

  • Conflicts:
    MAINTAINERS
    drivers/net/Kconfig
    drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
    drivers/net/ethernet/broadcom/tg3.c
    drivers/net/wireless/iwlwifi/iwl-pci.c
    drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
    drivers/net/wireless/rt2x00/rt2800usb.c
    drivers/net/wireless/wl12xx/main.c

    David S. Miller
     
  • add new fib rule can cause BUG_ON happen
    the reproduce shell is
    ip rule add pref 38
    ip rule add pref 38
    ip rule add to 192.168.3.0/24 goto 38
    ip rule del pref 38
    ip rule add to 192.168.3.0/24 goto 38
    ip rule add pref 38

    then the BUG_ON will happen
    del BUG_ON and use (ctarget == NULL) identify whether this rule is unresolved

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

    Gao feng
     

12 Aug, 2011

1 commit


02 Aug, 2011

1 commit

  • When assigning a NULL value to an RCU protected pointer, no barrier
    is needed. The rcu_assign_pointer, used to handle that but will soon
    change to not handle the special case.

    Convert all rcu_assign_pointer of NULL value.

    //smpl
    @@ expression P; @@

    - rcu_assign_pointer(P, NULL)
    + RCU_INIT_POINTER(P, NULL)

    //

    Signed-off-by: Stephen Hemminger
    Acked-by: Paul E. McKenney
    Signed-off-by: David S. Miller

    Stephen Hemminger
     

10 Jun, 2011

1 commit

  • The message size allocated for rtnl ifinfo dumps was limited to
    a single page. This is not enough for additional interface info
    available with devices that support SR-IOV and caused a bug in
    which VF info would not be displayed if more than approximately
    40 VFs were created per interface.

    Implement a new function pointer for the rtnl_register service that will
    calculate the amount of data required for the ifinfo dump and allocate
    enough data to satisfy the request.

    Signed-off-by: Greg Rose
    Signed-off-by: Jeff Kirsher

    Greg Rose
     

26 May, 2011

1 commit

  • Commit e67f88dd12f6 (dont hold rtnl mutex during netlink dump callbacks)
    missed fact that rtnl_fill_ifinfo() must be called with rtnl held.

    Because of possible deadlocks between two mutexes (cb_mutex and rtnl),
    its not easy to solve this problem, so revert this part of the patch.

    It also forgot one rcu_read_unlock() in FIB dump_rules()

    Add one ASSERT_RTNL() in rtnl_fill_ifinfo() to remind us the rule.

    Signed-off-by: Eric Dumazet
    CC: Patrick McHardy
    CC: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric Dumazet
     

03 May, 2011

1 commit

  • Four years ago, Patrick made a change to hold rtnl mutex during netlink
    dump callbacks.

    I believe it was a wrong move. This slows down concurrent dumps, making
    good old /proc/net/ files faster than rtnetlink in some situations.

    This occurred to me because one "ip link show dev ..." was _very_ slow
    on a workload adding/removing network devices in background.

    All dump callbacks are able to use RCU locking now, so this patch does
    roughly a revert of commits :

    1c2d670f366 : [RTNETLINK]: Hold rtnl_mutex during netlink dump callbacks
    6313c1e0992 : [RTNETLINK]: Remove unnecessary locking in dump callbacks

    This let writers fight for rtnl mutex and readers going full speed.

    It also takes care of phonet : phonet_route_get() is now called from rcu
    read section. I renamed it to phonet_route_get_rcu()

    Signed-off-by: Eric Dumazet
    Cc: Patrick McHardy
    Cc: Remi Denis-Courmont
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric Dumazet
     

13 Mar, 2011

1 commit


24 Dec, 2010

1 commit

  • This reverts commit 4465b469008bc03b98a1b8df4e9ae501b6c69d4b.

    Conflicts:

    net/ipv4/fib_frontend.c

    As reported by Ben Greear, this causes regressions:

    > Change 4465b469008bc03b98a1b8df4e9ae501b6c69d4b caused rules
    > to stop matching the input device properly because the
    > FLOWI_FLAG_MATCH_ANY_IIF is always defined in ip_dev_find().
    >
    > This breaks rules such as:
    >
    > ip rule add pref 512 lookup local
    > ip rule del pref 0 lookup local
    > ip link set eth2 up
    > ip -4 addr add 172.16.0.102/24 broadcast 172.16.0.255 dev eth2
    > ip rule add to 172.16.0.102 iif eth2 lookup local pref 10
    > ip rule add iif eth2 lookup 10001 pref 20
    > ip route add 172.16.0.0/24 dev eth2 table 10001
    > ip route add unreachable 0/0 table 10001
    >
    > If you had a second interface 'eth0' that was on a different
    > subnet, pinging a system on that interface would fail:
    >
    > [root@ct503-60 ~]# ping 192.168.100.1
    > connect: Invalid argument

    Reported-by: Ben Greear
    Signed-off-by: David S. Miller

    David S. Miller
     

28 Oct, 2010

1 commit


27 Oct, 2010

1 commit

  • Some panic reports in fib_rules_lookup() show a rule could have a NULL
    pointer as a next pointer in the rules_list.

    This can actually happen because of a bug in fib_nl_newrule() : It
    checks if current rule is the destination of unresolved gotos. (Other
    rules have gotos to this about to be inserted rule)

    Problem is it does the resolution of the gotos before the rule is
    inserted in the rules_list (and has a valid next pointer)

    Fix this by moving the rules_list insertion before the changes on gotos.

    A lockless reader can not any more follow a ctarget pointer, unless
    destination is ready (has a valid next pointer)

    Reported-by: Oleg A. Arkhangelsky
    Reported-by: Joe Buehler
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

17 Oct, 2010

1 commit

  • fib_nl_delrule() calls synchronize_rcu() for no apparent reason,
    while rtnl is held.

    I suspect it was done to avoid an atomic_inc_not_zero() in
    fib_rules_lookup(), which commit 7fa7cb7109d07 added anyway.

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

    Eric Dumazet
     

06 Oct, 2010

1 commit

  • fib_lookup() converted to be called in RCU protected context, no
    reference taken and released on a contended cache line (fib_clntref)

    fib_table_lookup() and fib_semantic_match() get an additional parameter.

    struct fib_info gets an rcu_head field, and is freed after an rcu grace
    period.

    Stress test :
    (Sending 160.000.000 UDP frames on same neighbour,
    IP route cache disabled, dual E5540 @2.53GHz,
    32bit kernel, FIB_HASH) (about same results for FIB_TRIE)

    Before patch :

    real 1m31.199s
    user 0m13.761s
    sys 23m24.780s

    After patch:

    real 1m5.375s
    user 0m14.997s
    sys 15m50.115s

    Before patch Profile :

    13044.00 15.4% __ip_route_output_key vmlinux
    8438.00 10.0% dst_destroy vmlinux
    5983.00 7.1% fib_semantic_match vmlinux
    5410.00 6.4% fib_rules_lookup vmlinux
    4803.00 5.7% neigh_lookup vmlinux
    4420.00 5.2% _raw_spin_lock vmlinux
    3883.00 4.6% rt_set_nexthop vmlinux
    3261.00 3.9% _raw_read_lock vmlinux
    2794.00 3.3% fib_table_lookup vmlinux
    2374.00 2.8% neigh_resolve_output vmlinux
    2153.00 2.5% dst_alloc vmlinux
    1502.00 1.8% _raw_read_lock_bh vmlinux
    1484.00 1.8% kmem_cache_alloc vmlinux
    1407.00 1.7% eth_header vmlinux
    1406.00 1.7% ipv4_dst_destroy vmlinux
    1298.00 1.5% __copy_from_user_ll vmlinux
    1174.00 1.4% dev_queue_xmit vmlinux
    1000.00 1.2% ip_output vmlinux

    After patch Profile :

    13712.00 15.8% dst_destroy vmlinux
    8548.00 9.9% __ip_route_output_key vmlinux
    7017.00 8.1% neigh_lookup vmlinux
    4554.00 5.3% fib_semantic_match vmlinux
    4067.00 4.7% _raw_read_lock vmlinux
    3491.00 4.0% dst_alloc vmlinux
    3186.00 3.7% neigh_resolve_output vmlinux
    3103.00 3.6% fib_table_lookup vmlinux
    2098.00 2.4% _raw_read_lock_bh vmlinux
    2081.00 2.4% kmem_cache_alloc vmlinux
    2013.00 2.3% _raw_spin_lock vmlinux
    1763.00 2.0% __copy_from_user_ll vmlinux
    1763.00 2.0% ip_output vmlinux
    1761.00 2.0% ipv4_dst_destroy vmlinux
    1631.00 1.9% eth_header vmlinux
    1440.00 1.7% _raw_read_unlock_bh vmlinux

    Reference results, if IP route cache is enabled :

    real 0m29.718s
    user 0m10.845s
    sys 7m37.341s

    25213.00 29.5% __ip_route_output_key vmlinux
    9011.00 10.5% dst_release vmlinux
    4817.00 5.6% ip_push_pending_frames vmlinux
    4232.00 5.0% ip_finish_output vmlinux
    3940.00 4.6% udp_sendmsg vmlinux
    3730.00 4.4% __copy_from_user_ll vmlinux
    3716.00 4.4% ip_route_output_flow vmlinux
    2451.00 2.9% __xfrm_lookup vmlinux
    2221.00 2.6% ip_append_data vmlinux
    1718.00 2.0% _raw_spin_lock_bh vmlinux
    1655.00 1.9% __alloc_skb vmlinux
    1572.00 1.8% sock_wfree vmlinux
    1345.00 1.6% kfree vmlinux

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

    Eric Dumazet
     

05 Oct, 2010

1 commit


29 Sep, 2010

1 commit

  • This patch allows a host to be configured to respond to any address in
    a specified range as if it were local, without actually needing to
    configure the address on an interface. This is done through routing
    table configuration. For instance, to configure a host to respond
    to any address in 10.1/16 received on eth0 as a local address we can do:

    ip rule add from all iif eth0 lookup 200
    ip route add local 10.1/16 dev lo proto kernel scope host src 127.0.0.1 table 200

    This host is now reachable by any 10.1/16 address (route lookup on
    input for packets received on eth0 can find the route). On output, the
    rule will not be matched so that this host can still send packets to
    10.1/16 (not sent on loopback). Presumably, external routing can be
    configured to make sense out of this.

    To make this work, we needed to modify the logic in finding the
    interface which is assigned a given source address for output
    (dev_ip_find). We perform a normal fib_lookup instead of just a
    lookup on the local table, and in the lookup we ignore the input
    interface for matching.

    This patch is useful to implement IP-anycast for subnets of virtual
    addresses.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     

28 Sep, 2010

1 commit

  • It seems we dont use appropriate refcount increment in an
    rcu_read_lock() protected section.

    fib_rule_get() might increment a null refcount and bad things could
    happen.

    While fib_nl_delrule() respects an rcu grace period before calling
    fib_rule_put(), fib_rules_cleanup_ops() calls fib_rule_put() without a
    grace period.

    Note : after this patch, we might avoid the synchronize_rcu() call done
    in fib_nl_delrule()

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

    Eric Dumazet
     

26 Apr, 2010

1 commit


14 Apr, 2010

2 commits


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
     

17 Mar, 2010

1 commit


18 Jan, 2010

1 commit


04 Dec, 2009

4 commits

  • Refactor the code so fib_rules_register always takes a template instead
    of the actual fib_rules_ops structure that will be used. This is
    required for network namespace support so 2 out of the 3 callers already
    do this, it allows the error handling to be made common, and it allows
    fib_rules_unregister to free the template for hte caller.

    Modify fib_rules_unregister to use call_rcu instead of syncrhonize_rcu
    to allw multiple namespaces to be cleaned up in the same rcu grace
    period.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • commit d124356ce314fff22a047ea334379d5105b2d834
    Author: Patrick McHardy
    Date: Thu Dec 3 12:16:35 2009 +0100

    net: fib_rules: allow to delete local rule

    Allow to delete the local rule and recreate it with a higher priority. This
    can be used to force packets with a local destination out on the wire instead
    of routing them to loopback. Additionally this patch allows to recreate rules
    with a priority of 0.

    Combined with the previous patch to allow oif classification, a socket can
    be bound to the desired interface and packets routed to the wire like this:

    # move local rule to lower priority
    ip rule add pref 1000 lookup local
    ip rule del pref 0

    # route packets of sockets bound to eth0 to the wire independant
    # of the destination address
    ip rule add pref 100 oif eth0 lookup 100
    ip route add default dev eth0 table 100

    Signed-off-by: Patrick McHardy

    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • commit 68144d350f4f6c348659c825cde6a82b34c27a91
    Author: Patrick McHardy
    Date: Thu Dec 3 12:05:25 2009 +0100

    net: fib_rules: add oif classification

    Support routing table lookup based on the flow's oif. This is useful to
    classify packets originating from sockets bound to interfaces differently.

    The route cache already includes the oif and needs no changes.

    Signed-off-by: Patrick McHardy

    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • commit 229e77eec406ad68662f18e49fda8b5d366768c5
    Author: Patrick McHardy
    Date: Thu Dec 3 12:05:23 2009 +0100

    net: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME

    The next patch will add oif classification, rename interface related members
    and attributes to reflect that they're used for iif classification.

    Signed-off-by: Patrick McHardy

    Signed-off-by: David S. Miller

    Patrick McHardy
     

21 May, 2009

1 commit


18 May, 2009

1 commit


25 Feb, 2009

1 commit

  • This patch changes the return value of nlmsg_notify() as follows:

    If NETLINK_BROADCAST_ERROR is set by any of the listeners and
    an error in the delivery happened, return the broadcast error;
    else if there are no listeners apart from the socket that
    requested a change with the echo flag, return the result of the
    unicast notification. Thus, with this patch, the unicast
    notification is handled in the same way of a broadcast listener
    that has set the NETLINK_BROADCAST_ERROR socket flag.

    This patch is useful in case that the caller of nlmsg_notify()
    wants to know the result of the delivery of a netlink notification
    (including the broadcast delivery) and take any action in case
    that the delivery failed. For example, ctnetlink can drop packets
    if the event delivery failed to provide reliable logging and
    state-synchronization at the cost of dropping packets.

    This patch also modifies the rtnetlink code to ignore the return
    value of rtnl_notify() in all callers. The function rtnl_notify()
    (before this patch) returned the error of the unicast notification
    which makes rtnl_set_sk_err() reports errors to all listeners. This
    is not of any help since the origin of the change (the socket that
    requested the echoing) notices the ENOBUFS error if the notification
    fails and should resync itself.

    Signed-off-by: Pablo Neira Ayuso
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Pablo Neira Ayuso
     

08 Nov, 2008

1 commit

  • We need to setup the network namespace state before we register
    the notifier. Otherwise if a network device is already registered
    we get a nasty NULL pointer dereference.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

06 Jul, 2008

2 commits


02 Jul, 2008

1 commit


16 Apr, 2008

1 commit


26 Mar, 2008

2 commits