17 Nov, 2011

1 commit


25 Oct, 2011

1 commit


19 Oct, 2011

1 commit

  • Need to cleanup bridge device timers and ports when being bridge
    device is being removed via netlink.

    This fixes the problem of observed when doing:
    ip link add br0 type bridge
    ip link set dev eth1 master br0
    ip link set br0 up
    ip link del br0

    which would cause br0 to hang in unregister_netdev because
    of leftover reference count.

    Reported-by: Sridhar Samudrala
    Signed-off-by: Stephen Hemminger
    Acked-by: Sridhar Samudrala
    Signed-off-by: David S. Miller

    stephen hemminger
     

04 Oct, 2011

1 commit

  • When port is added to a bridge, the old code would send the new neighbor
    netlink message before the subsequent new link message. This bug makes
    it difficult to use the monitoring API in an application.

    This code changes the ordering to add the forwarding entry
    after the port is setup. One of the error checks (for invalid address)
    is moved earlier in the process to avoid having to do unwind.

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

    stephen hemminger
     

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
     

16 Sep, 2011

2 commits

  • This patch does several things:
    - introduces __ethtool_get_settings which is called from ethtool code and
    from drivers as well. Put ASSERT_RTNL there.
    - dev_ethtool_get_settings() is replaced by __ethtool_get_settings()
    - changes calling in drivers so rtnl locking is respected. In
    iboe_get_rate was previously ->get_settings() called unlocked. This
    fixes it. Also prb_calc_retire_blk_tmo() in af_packet.c had the same
    problem. Also fixed by calling __dev_get_by_index() instead of
    dev_get_by_index() and holding rtnl_lock for both calls.
    - introduces rtnl_lock in bnx2fc_vport_create() and fcoe_vport_create()
    so bnx2fc_if_create() and fcoe_if_create() are called locked as they
    are from other places.
    - use __ethtool_get_settings() in bonding code

    Signed-off-by: Jiri Pirko

    v2->v3:
    -removed dev_ethtool_get_settings()
    -added ASSERT_RTNL into __ethtool_get_settings()
    -prb_calc_retire_blk_tmo - use __dev_get_by_index() and lock
    around it and __ethtool_get_settings() call
    v1->v2:
    add missing export_symbol
    Reviewed-by: Ben Hutchings [except FCoE bits]
    Acked-by: Ralf Baechle
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • Since these checks and initialization are done in
    dev_ethtool_get_settings called later on, remove this redundancy.

    Signed-off-by: Jiri Pirko
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Jiri Pirko
     

23 Aug, 2011

1 commit

  • Jan Beulich reported a possible net_device leak in bridge code after
    commit bb900b27a2f4 (bridge: allow creating bridge devices with netlink)

    Reported-by: Jan Beulich
    Signed-off-by: Eric Dumazet
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric Dumazet
     

10 Aug, 2011

1 commit

  • This ensures the neighbor entries associated with the bridge
    dev are flushed, also invalidating the associated cached L2 headers.

    This means we br_add_if/br_del_if ports to implement hand-over and
    not wind up with bridge packets going out with stale MAC.

    This means we can also change MAC of port device and also not wind
    up with bridge packets going out with stale MAC.

    This builds on Stephen Hemminger's patch, also handling the br_del_if
    case and the port MAC change case.

    Cc: Stephen Hemminger
    Signed-off-by: Andrei Warkentin
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Andrei Warkentin
     

23 Jul, 2011

1 commit

  • If a new device is added to a bridge, the ethernet address of the
    bridge network device may change. When the address changes, the
    appropriate callback is called, but with the wrong device argument.
    The address of the bridge device (ie br0) changes not the address
    of the device being passed to add_if (ie eth0).

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

    stephen hemminger
     

23 May, 2011

2 commits

  • In the old days, we used to access dev->master in __netif_receive_skb()
    in a rcu_read_lock section.

    So one synchronize_net() call was needed in netdev_set_master() to make
    sure another cpu could not use old master while/after we release it.

    We now use netdev_rx_handler infrastructure and added one
    synchronize_net() call in bond_release()/bond_release_all()

    Remove the obsolete synchronize_net() from netdev_set_master() and add
    one in bridge del_nbp() after its netdev_rx_handler_unregister() call.

    This makes enslave -d a bit faster.

    Signed-off-by: Eric Dumazet
    CC: Jiri Pirko
    CC: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • In the previous patch I added NETDEV_JOIN, now
    we can notify netconsole when adding a device to a bridge too.

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

    Amerigo Wang
     

30 Apr, 2011

1 commit


29 Apr, 2011

1 commit


05 Apr, 2011

1 commit

  • Add netlink device ops to allow creating bridge device via netlink.
    This works in a manner similar to vlan, macvlan and bonding.

    Example:
    # ip link add link dev br0 type bridge
    # ip link del dev br0

    The change required rearranging initializtion code to deal with
    being called by create link. Most of the initialization happens
    in br_dev_setup, but allocation of stats is done in ndo_init callback
    to deal with allocation failure. Sysfs setup has to wait until
    after the network device kobject is registered.

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

    stephen hemminger
     

28 Mar, 2011

1 commit


14 Feb, 2011

1 commit


25 Jan, 2011

2 commits

  • Reduce printk() levels to KERN_INFO in netdev_fix_features() as this will
    be used by ethtool and might spam dmesg unnecessarily.

    This converts the function to use netdev_info() instead of plain printk().

    As a side effect, bonding and bridge devices will now log dropped features
    on every slave device change.

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

    Michał Mirosław
     
  • Quoting Ben Hutchings: we presumably won't be defining features that
    can only be enabled on 64-bit architectures.

    Occurences found by `grep -r` on net/, drivers/net, include/

    [ Move features and vlan_features next to each other in
    struct netdev, as per Eric Dumazet's suggestion -DaveM ]

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

    Michał Mirosław
     

16 Nov, 2010

2 commits


26 Aug, 2010

2 commits


16 Jun, 2010

3 commits

  • Register net_bridge_port pointer as rx_handler data pointer. As br_port is
    removed from struct net_device, another netdev priv_flag is added to indicate
    the device serves as a bridge port. Also rcuized pointers are now correctly
    dereferenced in br_fdb.c and in netfilter parts.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • Add possibility to register rx_handler data pointer along with a rx_handler.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     
  • There are multiple problems with the newly added netpoll support:

    1) Use-after-free on each netpoll packet.
    2) Invoking unsafe code on netpoll/IRQ path.
    3) Breaks when netpoll is enabled on the underlying device.

    This patch fixes all of these problems. In particular, we now
    allocate proper netpoll structures for each underlying device.

    We only allow netpoll to be enabled on the bridge when all the
    devices underneath it support netpoll. Once it is enabled, we
    do not allow non-netpoll devices to join the bridge (until netpoll
    is disabled again).

    This allows us to do away with the npinfo juggling that caused
    problem number 1.

    Incidentally this patch fixes number 2 by bypassing unsafe code
    such as multicast snooping and netfilter.

    Reported-by: Qianfeng Zhang
    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

02 Jun, 2010

1 commit

  • What this patch does is it removes two receive frame hooks (for bridge and for
    macvlan) from __netif_receive_skb. These are replaced them with a single
    hook for both. It only supports one hook per device because it makes no
    sense to do bridging and macvlan on the same device.

    Then a network driver (of virtual netdev like macvlan or bridge) can register
    an rx_handler for needed net device.

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

    Jiri Pirko
     

19 May, 2010

1 commit

  • Fix build when CONFIG_SYSFS is not enabled:
    net/bridge/br_if.c:136: error: 'struct net_bridge_port' has no member named 'sysfs_name'

    Note: dev->name == sysfs_name except when change name is in
    progress, and we are protected from that by RTNL mutex.

    Signed-off-by: Randy Dunlap
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Randy Dunlap
     

16 May, 2010

2 commits

  • Links for each port are created in sysfs using the device
    name, but this could be changed after being added to the
    bridge.

    As well as being unable to remove interfaces after this
    occurs (because userspace tools don't recognise the new
    name, and the kernel won't recognise the old name), adding
    another interface with the old name to the bridge will
    cause an error trying to create the sysfs link.

    This fixes the problem by listening for NETDEV_CHANGENAME
    notifications and renaming the link.

    https://bugzilla.kernel.org/show_bug.cgi?id=12743

    Signed-off-by: Simon Arlott
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Simon Arlott
     
  • Move code around so that the ifdef for NETPOLL_CONTROLLER don't have to
    show up in main code path. The control functions should be in helpers
    that are only compiled if needed.

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

    stephen hemminger
     

06 May, 2010

1 commit

  • Based on the previous patch, make bridge support netpoll by:

    1) implement the 2 methods to support netpoll for bridge;

    2) modify netpoll during forwarding packets via bridge;

    3) disable netpoll support of bridge when a netpoll-unabled device
    is added to bridge;

    4) enable netpoll support when all underlying devices support netpoll.

    Cc: David Miller
    Cc: Neil Horman
    Cc: Stephen Hemminger
    Cc: Matt Mackall
    Signed-off-by: WANG Cong
    Signed-off-by: David S. Miller

    WANG Cong
     

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

  • The shared packet statistics are a potential source of slow down
    on bridged traffic. Convert to per-cpu array, but only keep those
    statistics which change per-packet.

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

    stephen hemminger
     

28 Feb, 2010

1 commit


05 Feb, 2010

1 commit


18 Jan, 2010

1 commit


20 Nov, 2009

1 commit

  • A number of people have tried to add a wireless interface
    (in managed mode) to a bridge and then complained that it
    doesn't work. It cannot work, however, because in 802.11
    networks all packets need to be acknowledged and as such
    need to be sent to the right address. Promiscuous doesn't
    help here. The wireless address format used for these
    links has only space for three addresses, the
    * transmitter, which must be equal to the sender (origin)
    * receiver (on the wireless medium), which is the AP in
    the case of managed mode
    * the recipient (destination), which is on the APs local
    network segment

    In an IBSS, it is similar, but the receiver and recipient
    must match and the third address is used as the BSSID.

    To avoid such mistakes in the future, disallow adding a
    wireless interface to a bridge.

    Felix has recently added a four-address mode to the AP
    and client side that can be used (after negotiating that
    it is possible, which must happen out-of-band by setting
    up both sides) for bridging, so allow that case.

    Signed-off-by: Johannes Berg
    Acked-by: Stephen Hemminger
    Signed-off-by: John W. Linville

    Johannes Berg
     

06 Nov, 2009

2 commits