18 May, 2010

1 commit

  • skb rxhash should be cleared when a skb is handled by a tunnel before
    being delivered again, so that correct packet steering can take place.

    There are other cleanups and accounting that we can factorize in a new
    helper, skb_tunnel_rx()

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

    Eric Dumazet
     

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 Feb, 2010

1 commit


18 Jan, 2010

1 commit


02 Dec, 2009

1 commit


18 Nov, 2009

1 commit


09 Nov, 2009

1 commit


07 Nov, 2009

1 commit

  • RFC 2003 requires the outer header to have DF set if DF is set
    on the inner header, even when PMTU discovery is off for the
    tunnel. Our implementation does exactly that.

    For this to work properly the IPIP gateway also needs to engate
    in PMTU when the inner DF bit is set. As otherwise the original
    host would not be able to carry out its PMTU successfully since
    part of the path is only visible to the gateway.

    Unfortunately when the tunnel PMTU discovery setting is off, we
    do not collect the necessary soft state, resulting in blackholes
    when the original host tries to perform PMTU discovery.

    This problem is not reproducible on the IPIP gateway itself as
    the inner packet usually has skb->local_df set. This is not
    correctly cleared (an unrelated bug) when the packet passes
    through the tunnel, which allows fragmentation to occur. For
    hosts behind the IPIP gateway it is readily visible with a simple
    ping.

    This patch fixes the problem by performing PMTU discovery for
    all packets with the inner DF bit set, regardless of the PMTU
    discovery setting on the tunnel itself.

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

    Herbert Xu
     

28 Oct, 2009

1 commit


24 Oct, 2009

1 commit

  • IPIP tunnels use one rwlock to protect their hash tables.

    This locking scheme can be converted to RCU for free, since netdevice
    already must wait for a RCU grace period at dismantle time.

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

    Eric Dumazet
     

05 Oct, 2009

1 commit

  • We currently dirty a cache line to update tunnel device stats
    (tx_packets/tx_bytes). We better use the txq->tx_bytes/tx_packets
    counters that already are present in cpu cache, in the cache
    line shared with txq->_xmit_lock

    This patch extends IPTUNNEL_XMIT() macro to use txq pointer
    provided by the caller.

    Also &tunnel->dev->stats can be replaced by &dev->stats

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

    Eric Dumazet
     

25 Sep, 2009

1 commit

  • It seems recursion field from "struct ip_tunnel" is not anymore needed.
    recursion prevention is done at the upper level (in dev_queue_xmit()),
    since we use HARD_TX_LOCK protection for tunnels.

    This avoids a cache line ping pong on "struct ip_tunnel" : This structure
    should be now mostly read on xmit and receive paths.

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

    Eric Dumazet
     

01 Sep, 2009

1 commit


06 Jul, 2009

1 commit


03 Jun, 2009

2 commits

  • Define three accessors to get/set dst attached to a skb

    struct dst_entry *skb_dst(const struct sk_buff *skb)

    void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)

    void skb_dst_drop(struct sk_buff *skb)
    This one should replace occurrences of :
    dst_release(skb->dst)
    skb->dst = NULL;

    Delete skb->dst field

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

    Eric Dumazet
     
  • Define skb_rtable(const struct sk_buff *skb) accessor to get rtable from skb

    Delete skb->rtable field

    Setting rtable is not allowed, just set dst instead as rtable is an alias.

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

    Eric Dumazet
     

29 May, 2009

1 commit


25 Feb, 2009

1 commit


23 Feb, 2009

1 commit


24 Nov, 2008

1 commit

  • dev_net_set() should be the very first thing after alloc_netdev().

    "ndo_" changes turned simple assignment (which is OK to do before netns
    assignment) into quite non-trivial operation (which is not OK, init_net was
    used). This leads to incomplete initialisation of tunnel device in netns.

    BUG: unable to handle kernel NULL pointer dereference at 00000004
    IP: [] ip6_tnl_exit_net+0x37/0x4f
    *pde = 00000000
    Oops: 0000 [#1] PREEMPT DEBUG_PAGEALLOC
    last sysfs file: /sys/class/net/lo/operstate

    Pid: 10, comm: netns Not tainted (2.6.28-rc6 #1)
    EIP: 0060:[] EFLAGS: 00010246 CPU: 0
    EIP is at ip6_tnl_exit_net+0x37/0x4f
    EAX: 00000000 EBX: 00000020 ECX: 00000000 EDX: 00000003
    ESI: c5caef30 EDI: c782bbe8 EBP: c7909f50 ESP: c7909f48
    DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
    Process netns (pid: 10, ti=c7908000 task=c7905780 task.ti=c7908000)
    Stack:
    c03e75e0 c7390bc8 c7909f60 c0245448 c7390bd8 c7390bf0 c7909fa8 c012577a
    00000000 00000002 00000000 c0125736 c782bbe8 c7909f90 c0308fe3 c782bc04
    c7390bd4 c0245406 c084b718 c04f0770 c03ad785 c782bbe8 c782bc04 c782bc0c
    Call Trace:
    [] ? cleanup_net+0x42/0x82
    [] ? run_workqueue+0xd6/0x1ae
    [] ? run_workqueue+0x92/0x1ae
    [] ? schedule+0x275/0x285
    [] ? cleanup_net+0x0/0x82
    [] ? worker_thread+0x81/0x8d
    [] ? autoremove_wake_function+0x0/0x33
    [] ? worker_thread+0x0/0x8d
    [] ? kthread+0x39/0x5e
    [] ? kthread+0x0/0x5e
    [] ? kernel_thread_helper+0x7/0x10
    Code: db e8 05 ff ff ff 89 c6 e8 dc 04 f6 ff eb 08 8b 40 04 e8 38 89 f5 ff 8b 44 9e 04 85 c0 75 f0 43 83 fb 20 75 f2 8b 86 84 00 00 00 40 04 e8 1c 89 f5 ff e8 98 04 f6 ff 89 f0 e8 f8 63 e6 ff 5b
    EIP: [] ip6_tnl_exit_net+0x37/0x4f SS:ESP 0068:c7909f48
    ---[ end trace 6c2f2328fccd3e0c ]---

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

21 Nov, 2008

1 commit

  • Convert to network device ops. Needed to change to directly call
    the init routine since two sides share same ops. In the process
    found by inspection a device ref count leak if register_netdevice failed.

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

    Stephen Hemminger
     

03 Nov, 2008

1 commit


14 Oct, 2008

1 commit

  • Clean up the various different email addresses of mine listed in the code
    to a single current and valid address. As Dave says his network merges
    for 2.6.28 are now done this seems a good point to send them in where
    they won't risk disrupting real changes.

    Signed-off-by: Alan Cox
    Signed-off-by: David S. Miller

    Alan Cox
     

12 Jun, 2008

1 commit


26 May, 2008

1 commit


22 May, 2008

2 commits


16 Apr, 2008

7 commits


06 Mar, 2008

1 commit


27 Feb, 2008

1 commit

  • Four tunnel drivers (ip_gre, ipip, ip6_tunnel and sit) can receive a
    pre-defined name for a device from the userspace. Since these drivers
    call the register_netdevice() (rtnl_lock, is held), which does _not_
    generate the device's name, this name may contain a '%' character.

    Not sure how bad is this to have a device with a '%' in its name, but
    all the other places either use the register_netdev(), which call the
    dev_alloc_name(), or explicitly call the dev_alloc_name() before
    registering, i.e. do not allow for such names.

    This had to be prior to the commit 34cc7b, but I forgot to number the
    patches and this one got lost, sorry.

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

    Pavel Emelyanov
     

24 Feb, 2008

1 commit

  • Use the added dev_alloc_name() call to create tunnel device name,
    rather than iterate in a hand-made loop with an artificial limit.

    Thanks Patrick for noticing this.

    [ The way this works is, when the device is actually registered,
    the generic code noticed the '%' in the name and invokes
    dev_alloc_name() to fully resolve the name. -DaveM ]

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

    Pavel Emelyanov
     

29 Jan, 2008

2 commits

  • Needed to propagate it down to the ip_route_output_flow.

    Signed-off-by: Denis V. Lunev
    Signed-off-by: David S. Miller

    Denis V. Lunev
     
  • Once created, an IP tunnel can't be bound to another device.
    (reported as https://bugzilla.redhat.com/show_bug.cgi?id=419671)

    To reproduce:

    # create a tunnel:
    ip tunnel add tunneltest0 mode ipip remote 10.0.0.1 dev eth0
    # try to change the bounding device from eth0 to eth1:
    ip tunnel change tunneltest0 dev eth1
    # show the result:
    ip tunnel show tunneltest0

    tunneltest0: ip/ip remote 10.0.0.1 local any dev eth0 ttl inherit

    Notice the bound device has not changed from eth0 to eth1.

    This patch fixes it. When changing the binding, it also recalculates the
    MTU according to the new bound device's MTU.

    If the change is acceptable, I'll do the same for GRE and SIT tunnels.

    Signed-off-by: Michal Schmidt
    Signed-off-by: David S. Miller

    Michal Schmidt
     

24 Oct, 2007

1 commit