20 Apr, 2013

2 commits


11 Feb, 2013

1 commit

  • commit d0e2c55e7c940 (veth: avoid a NULL deref in veth_stats_one)
    added another NULL deref in veth_dellink().

    # ip link add name veth1 type veth peer name veth0
    # rmmod veth

    We crash because veth_dellink() is called twice, so we must
    take care of NULL peer.

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

    Eric Dumazet
     

11 Jan, 2013

1 commit

  • In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one)
    we now clear the peer pointers in veth_dellink()

    veth_close() must therefore make sure the peer pointer is set.

    Reported-by: Tom Parkin
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

08 Jan, 2013

1 commit

  • commit 2681128f0ced8a (veth: extend device features) added a NULL deref
    in veth_stats_one(), as veth_get_stats64() was not testing if the peer
    device was setup or not.

    At init time, we call dev_get_stats() before veth pair is fully setup.

    [ 178.854758] [] veth_get_stats64+0x47/0x70 [veth]
    [ 178.861013] [] dev_get_stats+0x6d/0x130
    [ 178.866486] [] rtnl_fill_ifinfo+0x47c/0x930
    [ 178.872299] [] rtmsg_ifinfo+0x83/0x100
    [ 178.877678] [] rtnl_configure_link+0x76/0xa0
    [ 178.883580] [] veth_newlink+0x16a/0x350 [veth]
    [ 178.889654] [] rtnl_newlink+0x4dc/0x5e0
    [ 178.895128] [] ? rtnl_newlink+0x12e/0x5e0
    [ 178.900769] [] rtnetlink_rcv_msg+0x11d/0x310
    [ 178.906669] [] ? __rtnl_unlock+0x20/0x20
    [ 178.912225] [] netlink_rcv_skb+0xa9/0xd0
    [ 178.917779] [] rtnetlink_rcv+0x25/0x40
    [ 178.923159] [] netlink_unicast+0x1b1/0x230
    [ 178.928887] [] netlink_sendmsg+0x2fe/0x3b0
    [ 178.934615] [] sock_sendmsg+0xd2/0xf0

    So we must check if peer was setup in veth_get_stats64()

    As pointed out by Ben Hutchings, priv->peer is missing proper
    synchronization. Adding RCU protection is a safe and well documented
    way to make sure we don't access about to be freed or already
    freed data.

    Reported-by: Tom Parkin
    Signed-off-by: Eric Dumazet
    CC: Ben Hutchings
    Signed-off-by: David S. Miller

    Eric Dumazet
     

30 Dec, 2012

2 commits

  • veth is lacking most modern facilities, like SG, checksums, TSO.

    It makes sense to extend dev->features to get them, or GRO aggregation
    is defeated by a forced segmentation.

    Reported-by: Andrew Vagin
    Signed-off-by: Eric Dumazet
    Cc: Michał Mirosław
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • veth stats are a bit bloated. There is no need to account transmit
    and receive stats, since they are absolutely symmetric.

    Also use a per device atomic64_t for the dropped counter, as it
    should never be used in fast path.

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

    Eric Dumazet
     

01 Dec, 2012

1 commit

  • This patch removes an unused parameter (src_net) from rtnl_create_link()
    method and from the method single invocation, in veth.
    This parameter was used in the past when calling
    ops->get_tx_queues(src_net, tb) in rtnl_create_link().
    The get_tx_queues() member of rtnl_link_ops was replaced by two methods,
    get_num_tx_queues() and get_num_rx_queues(), which do not get any
    parameter. This was done in commit d40156aa5ecbd51fed932ed4813df82b56e5ff4d by
    Jiri Pirko ("rtnl: allow to specify different num for rx and tx queue count").

    Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     

02 Nov, 2012

1 commit


10 Aug, 2012

1 commit

  • The ifinfomsg is in there (thanks kaber@ for foreseeing this long time ago),
    so take the given ifidex and register netdev with it.

    Ben noticed, that this code path previously ignored ifmp->ifi_index and
    userland could be passing in garbage. Thus it may now fail occasionally
    because the value clashes with an existing interface.

    To address this it's assumed that if the caller specifies the ifindex for
    the veth master device, then it's aware of this possibility and should
    explicitly specify (or set to 0 for auto-assignment) the peer's ifindex as
    well. With this the compatibility with old tools not setting ifindex is
    preserved.

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

    Pavel Emelyanov
     

20 Feb, 2012

1 commit


16 Feb, 2012

2 commits


23 Nov, 2011

1 commit


17 Nov, 2011

2 commits


09 Nov, 2011

1 commit

  • Tunnels can force an alignment of their percpu data to reduce number of
    cache lines used in fast path, or read in .ndo_get_stats()

    percpu_alloc() is a very fine grained allocator, so any small hole will
    be used anyway.

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

    Eric Dumazet
     

01 Nov, 2011

1 commit


28 Jul, 2011

1 commit

  • After the last patch, We are left in a state in which only drivers calling
    ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real
    hardware call ether_setup for their net_devices and don't hold any state in
    their skbs. There are a handful of drivers that violate this assumption of
    course, and need to be fixed up. This patch identifies those drivers, and marks
    them as not being able to support the safe transmission of skbs by clearning the
    IFF_TX_SKB_SHARING flag in priv_flags

    Signed-off-by: Neil Horman
    CC: Karsten Keil
    CC: "David S. Miller"
    CC: Jay Vosburgh
    CC: Andy Gospodarek
    CC: Patrick McHardy
    CC: Krzysztof Halasa
    CC: "John W. Linville"
    CC: Greg Kroah-Hartman
    CC: Marcel Holtmann
    CC: Johannes Berg
    Signed-off-by: David S. Miller

    Neil Horman
     

06 Jul, 2011

2 commits


01 Jul, 2011

1 commit


20 Jun, 2011

1 commit

  • Using 64bit stats on 32bit arches must use a synchronization or readers
    can get transient values.

    Fixes bug introduced in commit 6311cc44a2 (veth: convert to 64 bit
    statistics)

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

    Eric Dumazet
     

09 Jun, 2011

1 commit


16 May, 2011

1 commit


06 May, 2011

1 commit


03 May, 2011

1 commit


30 Apr, 2011

1 commit

  • This updates the network drivers so that they don't access the
    ethtool_cmd::speed field directly, but use ethtool_cmd_speed()
    instead.

    For most of the drivers, these changes are purely cosmetic and don't
    fix any problem, such as for those 1GbE/10GbE drivers that indirectly
    call their own ethtool get_settings()/mii_ethtool_gset(). The changes
    are meant to enforce code consistency and provide robustness with
    future larger throughputs, at the expense of a few CPU cycles for each
    ethtool operation.

    All drivers compiled with make allyesconfig ion x86_64 have been
    updated.

    Tested: make allyesconfig on x86_64 + e1000e/bnx2x work
    Signed-off-by: David Decotigny
    Signed-off-by: David S. Miller

    David Decotigny
     

02 Apr, 2011

1 commit


22 Mar, 2011

1 commit

  • Commit 44540960 "veth: move loopback logic to common location" introduced
    a bug in the packet counters. I don't understand why that happened as it
    is not explained in the comments and the mut check in dev_forward_skb
    retains the assumption that skb->len is the total length of the packet.

    I just measured this emperically by setting up a veth pair between two
    noop network namespaces setting and attempting a telnet connection between
    the two. I saw three packets in each direction and the byte counters were
    exactly 14*3 = 42 bytes high in each direction. I got the actual
    packet lengths with tcpdump.

    So remove the extra ETH_HLEN from the veth byte count totals.

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

    Eric W. Biederman
     

25 Jan, 2011

1 commit


17 Dec, 2010

1 commit

  • We can't change ip_summed from CHECKSUM_PARTIAL to CHECKSUM_NONE
    or CHECKSUM_UNNECESSARY because checksum in packet's headers is
    not valid and will cause invalid checksum when frame is forwarded.

    Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     

27 Sep, 2010

1 commit


06 May, 2010

1 commit

  • In case of congestion, netif_rx() frees the skb, so we must assume
    dev_forward_skb() also consume skb.

    Bug introduced by commit 445409602c092
    (veth: move loopback logic to common location)

    We must change dev_forward_skb() to always consume skb, and veth to not
    double free it.

    Bug report : http://marc.info/?l=linux-netdev&m=127310770900442&w=3

    Reported-by: Martín Ferrari
    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
     

27 Feb, 2010

1 commit

  • commit e8469ed959c373c2ff9e6f488aa5a14971aebe1f
    Author: Patrick McHardy
    Date: Tue Feb 23 20:41:30 2010 +0100

    Support specifying the initial device flags when creating a device though
    rtnl_link. Devices allocated by rtnl_create_link() are marked as INITIALIZING
    in order to surpress netlink registration notifications. To complete setup,
    rtnl_configure_link() must be called, which performs the device flag changes
    and invokes the deferred notifiers if everything went well.

    Two examples:

    # add macvlan to eth0
    #
    $ ip link add link eth0 up allmulticast on type macvlan

    [LINK]11: macvlan0@eth0: mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 26:f8:84:02:f9:2a brd ff:ff:ff:ff:ff:ff
    [ROUTE]ff00::/8 dev macvlan0 table local metric 256 mtu 1500 advmss 1440 hoplimit 0
    [ROUTE]fe80::/64 dev macvlan0 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit 0
    [LINK]11: macvlan0@eth0: mtu 1500
    link/ether 26:f8:84:02:f9:2a
    [ADDR]11: macvlan0 inet6 fe80::24f8:84ff:fe02:f92a/64 scope link
    valid_lft forever preferred_lft forever
    [ROUTE]local fe80::24f8:84ff:fe02:f92a via :: dev lo table local proto none metric 0 mtu 16436 advmss 16376 hoplimit 0
    [ROUTE]default via fe80::215:e9ff:fef0:10f8 dev macvlan0 proto kernel metric 1024 mtu 1500 advmss 1440 hoplimit 0
    [NEIGH]fe80::215:e9ff:fef0:10f8 dev macvlan0 lladdr 00:15:e9:f0:10:f8 router STALE
    [ROUTE]2001:6f8:974::/64 dev macvlan0 proto kernel metric 256 expires 0sec mtu 1500 advmss 1440 hoplimit 0
    [PREFIX]prefix 2001:6f8:974::/64 dev macvlan0 onlink autoconf valid 14400 preferred 131084
    [ADDR]11: macvlan0 inet6 2001:6f8:974:0:24f8:84ff:fe02:f92a/64 scope global dynamic
    valid_lft 86399sec preferred_lft 14399sec

    # add VLAN to eth1, eth1 is down
    #
    $ ip link add link eth1 up type vlan id 1000
    RTNETLINK answers: Network is down

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

    Patrick McHardy
     

17 Feb, 2010

1 commit

  • Add __percpu sparse annotations to net drivers.

    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.

    Signed-off-by: Tejun Heo
    Acked-by: David S. Miller
    Cc: Eric Dumazet
    Cc: Arnd Bergmann
    Signed-off-by: David S. Miller

    Tejun Heo
     

15 Dec, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (34 commits)
    m68k: rename global variable vmalloc_end to m68k_vmalloc_end
    percpu: add missing per_cpu_ptr_to_phys() definition for UP
    percpu: Fix kdump failure if booted with percpu_alloc=page
    percpu: make misc percpu symbols unique
    percpu: make percpu symbols in ia64 unique
    percpu: make percpu symbols in powerpc unique
    percpu: make percpu symbols in x86 unique
    percpu: make percpu symbols in xen unique
    percpu: make percpu symbols in cpufreq unique
    percpu: make percpu symbols in oprofile unique
    percpu: make percpu symbols in tracer unique
    percpu: make percpu symbols under kernel/ and mm/ unique
    percpu: remove some sparse warnings
    percpu: make alloc_percpu() handle array types
    vmalloc: fix use of non-existent percpu variable in put_cpu_var()
    this_cpu: Use this_cpu_xx in trace_functions_graph.c
    this_cpu: Use this_cpu_xx for ftrace
    this_cpu: Use this_cpu_xx in nmi handling
    this_cpu: Use this_cpu operations in RCU
    this_cpu: Use this_cpu ops for VM statistics
    ...

    Fix up trivial (famous last words) global per-cpu naming conflicts in
    arch/x86/kvm/svm.c
    mm/slab.c

    Linus Torvalds
     

29 Nov, 2009

1 commit


27 Nov, 2009

1 commit

  • The veth driver contains code to forward an skb
    from the start_xmit function of one network
    device into the receive path of another device.

    Moving that code into a common location lets us
    reuse the code for direct forwarding of data
    between macvlan ports, and possibly in other
    drivers.

    Signed-off-by: Arnd Bergmann
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Arnd Bergmann