13 Jan, 2012

1 commit

  • commit a9b3cd7f32 (rcu: convert uses of rcu_assign_pointer(x, NULL) to
    RCU_INIT_POINTER) did a lot of incorrect changes, since it did a
    complete conversion of rcu_assign_pointer(x, y) to RCU_INIT_POINTER(x,
    y).

    We miss needed barriers, even on x86, when y is not NULL.

    Signed-off-by: Eric Dumazet
    CC: Stephen Hemminger
    CC: Paul E. McKenney
    Signed-off-by: David S. Miller

    Eric Dumazet
     

30 Nov, 2011

1 commit

  • Create separate queue state flags so that either the stack or drivers
    can turn on XOFF. Added a set of functions used in the stack to determine
    if a queue is really stopped (either by stack or driver)

    Signed-off-by: Tom Herbert
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Tom Herbert
     

19 Nov, 2011

1 commit

  • net: Remove all uses of LL_ALLOCATED_SPACE

    The macro LL_ALLOCATED_SPACE was ill-conceived. It applies the
    alignment to the sum of needed_headroom and needed_tailroom. As
    the amount that is then reserved for head room is needed_headroom
    with alignment, this means that the tail room left may be too small.

    This patch replaces all uses of LL_ALLOCATED_SPACE with the macro
    LL_RESERVED_SPACE and direct reference to needed_tailroom.

    This also fixes the problem with needed_headroom changing between
    allocating the skb and reserving the head room.

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

    Herbert Xu
     

01 Nov, 2011

1 commit


22 Sep, 2011

1 commit

  • 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
     

27 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
     

04 Jul, 2011

2 commits


12 Jun, 2011

1 commit


09 Jun, 2011

1 commit

  • In commit 8d8fc29d02a33e4bd5f4fa47823c1fd386346093
    (netpoll: disable netpoll when enslave a device), we automatically
    disable netpoll when the underlying device is being enslaved,
    we also need to prevent people from setuping netpoll on
    devices that are already enslaved.

    Signed-off-by: WANG Cong
    Signed-off-by: David S. Miller

    WANG Cong
     

10 May, 2011

1 commit

  • mac_pton() parses MAC address in form XX:XX:XX:XX:XX:XX and only in that form.

    mac_pton() doesn't dirty result until it's sure string representation is valid.

    mac_pton() doesn't care about characters _after_ last octet,
    it's up to caller to deal with it.

    mac_pton() diverges from 0/-E return value convention.
    Target usage:

    if (!mac_pton(str, whatever->mac))
    return -EINVAL;
    /* ->mac being u8 [ETH_ALEN] is filled at this point. */
    /* optionally check str[3 * ETH_ALEN - 1] for termination */

    Use mac_pton() in pktgen and netconsole for start.

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

    Alexey Dobriyan
     

23 Apr, 2011

1 commit


28 Feb, 2011

2 commits


08 Jan, 2011

1 commit

  • * 'for-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (33 commits)
    usb: don't use flush_scheduled_work()
    speedtch: don't abuse struct delayed_work
    media/video: don't use flush_scheduled_work()
    media/video: explicitly flush request_module work
    ioc4: use static work_struct for ioc4_load_modules()
    init: don't call flush_scheduled_work() from do_initcalls()
    s390: don't use flush_scheduled_work()
    rtc: don't use flush_scheduled_work()
    mmc: update workqueue usages
    mfd: update workqueue usages
    dvb: don't use flush_scheduled_work()
    leds-wm8350: don't use flush_scheduled_work()
    mISDN: don't use flush_scheduled_work()
    macintosh/ams: don't use flush_scheduled_work()
    vmwgfx: don't use flush_scheduled_work()
    tpm: don't use flush_scheduled_work()
    sonypi: don't use flush_scheduled_work()
    hvsi: don't use flush_scheduled_work()
    xen: don't use flush_scheduled_work()
    gdrom: don't use flush_scheduled_work()
    ...

    Fixed up trivial conflict in drivers/media/video/bt8xx/bttv-input.c
    as per Tejun.

    Linus Torvalds
     

20 Dec, 2010

1 commit


15 Dec, 2010

1 commit

  • cancel_rearming_delayed_work[queue]() has been superceded by
    cancel_delayed_work_sync() quite some time ago. Convert all the
    in-kernel users. The conversions are completely equivalent and
    trivial.

    Signed-off-by: Tejun Heo
    Acked-by: "David S. Miller"
    Acked-by: Greg Kroah-Hartman
    Acked-by: Evgeniy Polyakov
    Cc: Jeff Garzik
    Cc: Benjamin Herrenschmidt
    Cc: Mauro Carvalho Chehab
    Cc: netdev@vger.kernel.org
    Cc: Anton Vorontsov
    Cc: David Woodhouse
    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: Alex Elder
    Cc: xfs-masters@oss.sgi.com
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: Andrew Morton
    Cc: netfilter-devel@vger.kernel.org
    Cc: Trond Myklebust
    Cc: linux-nfs@vger.kernel.org

    Tejun Heo
     

29 Nov, 2010

1 commit


20 Oct, 2010

1 commit

  • In an erlier patch I modified napi_poll so that devices with IFF_MASTER polled
    the per_cpu list instead of the device list for napi. I did this because the
    bonding driver has no napi instances to poll, it instead expects to check the
    slave devices napi instances, which napi_poll was unaware of. Looking at this
    more closely however, I now see this isn't strictly needed. As the bond driver
    poll_controller calls the slaves poll_controller via netpoll_poll_dev, which
    recursively calls poll_napi on each slave, allowing those napi instances to get
    serviced. The earlier patch isn't at all harmfull, its just not needed, so lets
    revert it to make the code cleaner. Sorry for the noise,

    Signed-off-by: Neil Horman
    Reviewed-by: WANG Cong
    Signed-off-by: David S. Miller

    Neil Horman
     

18 Oct, 2010

2 commits

  • Usually the netpoll path, when preforming a napi poll can get away with just
    polling all the napi instances of the configured device. Thats not the case for
    the bonding driver however, as the napi instances which may wind up getting
    flagged as needing polling after the poll_controller call don't belong to the
    bonded device, but rather to the slave devices. Fix this by checking the device
    in question for the IFF_MASTER flag, if set, we know we need to check the full
    poll list for this cpu, rather than just the devices napi instance list.

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

    Neil Horman
     
  • The bonding driver currently modifies the netpoll structure in its xmit path
    while sending frames from netpoll. This is racy, as other cpus can access the
    netpoll structure in parallel. Since the bonding driver points np->dev to a
    slave device, other cpus can inadvertently attempt to send data directly to
    slave devices, leading to improper locking with the bonding master, lost frames,
    and deadlocks. This patch fixes that up.

    This patch also removes the real_dev pointer from the netpoll structure as that
    data is really only used by bonding in the poll_controller, and we can emulate
    its behavior by check each slave for IS_UP.

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

    Neil Horman
     

03 Aug, 2010

1 commit

  • This reverts commit 15e83ed78864d0625e87a85f09b297c0919a4797.

    As explained by Johannes Berg, the optimization made here is
    invalid. Or, at best, incomplete.

    Not only destructor invocation, but conntract entry releasing
    must be executed outside of hw IRQ context.

    So just checking "skb->destructor" is insufficient.

    Signed-off-by: David S. Miller

    David S. Miller
     

13 Jul, 2010

1 commit


25 Jun, 2010

1 commit


16 Jun, 2010

5 commits

  • This patch adds the functions __netpoll_setup/__netpoll_cleanup
    which is designed to be called recursively through ndo_netpoll_seutp.

    They must be called with RTNL held, and the caller must initialise
    np->dev and ensure that it has a valid reference count.

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

    Herbert Xu
     
  • This patch adds ndo_netpoll_setup as the initialisation primitive
    to complement ndo_netpoll_cleanup.

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

    Herbert Xu
     
  • As it stands, netpoll_setup and netpoll_cleanup have no locking
    protection whatsoever. So chaos ensures if two entities try to
    perform them on the same device.

    This patch adds RTNL to the equation. The code has been rearranged so
    that bits that do not need RTNL protection are now moved to the top of
    netpoll_setup.

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

    Herbert Xu
     
  • The use of RCU in netpoll is incorrect in a number of places:

    1) The initial setting is lacking a write barrier.
    2) The synchronize_rcu is in the wrong place.
    3) Read barriers are missing.
    4) Some places are even missing rcu_read_lock.
    5) npinfo is zeroed after freeing.

    This patch fixes those issues. As most users are in BH context,
    this also converts the RCU usage to the BH variant.

    Signed-off-by: Herbert Xu
    Acked-by: Paul E. McKenney
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Since we have to NULL npinfo regardless of whether there is a
    ndo_netpoll_cleanup, it makes sense to do this unconditionally
    in netpoll_cleanup rather than having every driver do it by
    themselves.

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

    Herbert Xu
     

31 May, 2010

1 commit

  • netpoll does an interesting work in zap_completion_queue(), but this was
    before we did skb orphaning before delivering packets to device.

    It now makes sense to add a test in dev_kfree_skb_irq() to not queue a
    skb if already orphaned, and to remove netpoll zap_completion_queue() as
    a bonus.

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

    Eric Dumazet
     

06 May, 2010

1 commit

  • This whole patchset is for adding netpoll support to bridge and bonding
    devices. I already tested it for bridge, bonding, bridge over bonding,
    and bonding over bridge. It looks fine now.

    To make bridge and bonding support netpoll, we need to adjust
    some netpoll generic code. This patch does the following things:

    1) introduce two new priv_flags for struct net_device:
    IFF_IN_NETPOLL which identifies we are processing a netpoll;
    IFF_DISABLE_NETPOLL is used to disable netpoll support for a device
    at run-time;

    2) introduce one new method for netdev_ops:
    ->ndo_netpoll_cleanup() is used to clean up netpoll when a device is
    removed.

    3) introduce netpoll_poll_dev() which takes a struct net_device * parameter;
    export netpoll_send_skb() and netpoll_poll_dev() which will be used later;

    4) hide a pointer to struct netpoll in struct netpoll_info, ditto.

    5) introduce ->real_dev for struct netpoll.

    6) introduce a new status NETDEV_BONDING_DESLAE, which is used to disable
    netconsole before releasing a slave, to avoid deadlocks.

    Cc: David Miller
    Cc: Neil Horman
    Signed-off-by: WANG Cong
    Signed-off-by: David S. Miller

    WANG Cong
     

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
     

23 Mar, 2010

1 commit

  • v2: update according to Frans' comments.

    Currently, if we leave spaces before dst port,
    netconsole will silently accept it as 0. Warn about this.

    Also, when spaces appear in other places, make them
    visible in error messages.

    Signed-off-by: WANG Cong
    Cc: David Miller
    Acked-by: Neil Horman
    Signed-off-by: David S. Miller

    Amerigo Wang
     

17 Mar, 2010

1 commit

  • Stanse found that one error path in netpoll_setup dereferences npinfo
    even though it is NULL. Avoid that by adding new label and go to that
    instead.

    Signed-off-by: Jiri Slaby
    Cc: Daniel Borkmann
    Cc: David S. Miller
    Acked-by: chavey@google.com
    Acked-by: Matt Mackall
    Signed-off-by: David S. Miller

    Jiri Slaby
     

14 Jan, 2010

1 commit


02 Sep, 2009

1 commit


24 Aug, 2009

1 commit


10 Jul, 2009

1 commit


09 Jul, 2009

1 commit

  • Using early netconsole and gianfar driver this error pops up:

    netconsole: timeout waiting for carrier

    It appears that net/core/netpoll.c:netpoll_setup() is using
    cond_resched() in a loop waiting for a carrier.

    The thing is that cond_resched() is a no-op when system_state !=
    SYSTEM_RUNNING, and so drivers/net/phy/phy.c's state_queue is never
    scheduled, therefore link detection doesn't work.

    I belive that the main problem is in cond_resched()[1], but despite
    how the cond_resched() story ends, it might be a good idea to call
    msleep(1) instead of cond_resched(), as suggested by Andrew Morton.

    [1] http://lkml.org/lkml/2009/7/7/463

    Signed-off-by: Anton Vorontsov
    Signed-off-by: David S. Miller

    Anton Vorontsov