07 Feb, 2017

1 commit

  • Move the fdb garbage collector to a workqueue which fires at least 10
    milliseconds apart and cleans chain by chain allowing for other tasks
    to run in the meantime. When having thousands of fdbs the system is much
    more responsive. Most importantly remove the need to check if the
    matched entry has expired in __br_fdb_get that causes false-sharing and
    is completely unnecessary if we cleanup entries, at worst we'll get 10ms
    of traffic for that entry before it gets deleted.

    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

11 Dec, 2016

3 commits

  • 802.1D [1] specifies that the bridges must use a short value to age out
    dynamic entries in the Filtering Database for a period, once a topology
    change has been communicated by the root bridge.

    Add a bridge_ageing_time member in the net_bridge structure to store the
    bridge ageing time value configured by the user (ioctl/netlink/sysfs).

    If we are using in-kernel STP, shorten the ageing time value to twice
    the forward delay used by the topology when the topology change flag is
    set. When the flag is cleared, restore the configured ageing time.

    [1] "8.3.5 Notifying topology changes ",
    http://profesores.elo.utfsm.cl/~agv/elo309/doc/802.1D-1998.pdf

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Add a __br_set_topology_change helper to set the topology change value.

    This can be later extended to add actions when the topology change flag
    is set or cleared.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • The SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME switchdev attr is actually set
    when initializing a bridge port, and when configuring the bridge ageing
    time from ioctl/netlink/sysfs.

    Add a __set_ageing_time helper to offload the ageing time to physical
    switches, and add the SWITCHDEV_F_DEFER flag since it can be called
    under bridge lock.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

26 Jul, 2016

1 commit


31 Mar, 2016

1 commit


12 Mar, 2016

1 commit

  • This fixes a regression in the bridge ageing time caused by:
    commit c62987bbd8a1 ("bridge: push bridge setting ageing_time down to switchdev")

    There are users of Linux bridge which use the feature that if ageing time
    is set to 0 it causes entries to never expire. See:
    https://www.linuxfoundation.org/collaborate/workgroups/networking/bridge

    For a pure software bridge, it is unnecessary for the code to have
    arbitrary restrictions on what values are allowable.

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

    Stephen Hemminger
     

19 Feb, 2016

1 commit


16 Dec, 2015

1 commit

  • switchdev drivers need to know the netdev on which the switchdev op was
    invoked. For example, the STP state of a VLAN interface configured on top
    of a port can change while being member in a bridge. In this case, the
    underlying driver should only change the STP state of that particular
    VLAN and not of all the VLANs configured on the port.

    However, current switchdev infrastructure only passes the port netdev down
    to the driver. Solve that by passing the original device down to the
    driver as part of the required switchdev object / attribute.

    This doesn't entail any change in current switchdev drivers. It simply
    enables those supporting stacked devices to know the originating device
    and act accordingly.

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

    Ido Schimmel
     

17 Nov, 2015

1 commit

  • When NET_SWITCHDEV=n, switchdev_port_attr_set simply returns EOPNOTSUPP.
    In this case we should not emit errors and warnings to the kernel log.

    Reported-by: Sander Eikelenboom
    Tested-by: Christian Borntraeger
    Fixes: 0bc05d585d38 ("switchdev: allow caller to explicitly request
    attr_set as deferred")
    Fixes: 6ac311ae8bfb ("Adding switchdev ageing notification on port
    bridged")
    Signed-off-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Ido Schimmel
     

11 Nov, 2015

1 commit

  • This reverts commit 34c2d9fb0498c066afbe610b15e18995fd8be792.

    There are 2 reasons for this revert:
    1) The commit in question doesn't do what it says it does. The
    description reads: "Allow bridge forward delay to be configured
    when Spanning Tree is enabled." This was already the case before
    the commit was made. What the commit actually do was disallow
    invalid values or 'forward_delay' when STP was turned off.

    2) The above change was actually a change in the user observed
    behavior and broke things like libvirt and other network configs
    that set 'forward_delay' to 0 without enabling STP. The value
    of 0 is actually used when STP is turned off to immediately mark
    the bridge as forwarding.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

15 Oct, 2015

1 commit

  • Caller should know if he can call attr_set directly (when holding RTNL)
    or if he has to defer the att_set processing for later.

    This also allows drivers to sleep inside attr_set and report operation
    status back to switchdev core. Switchdev core then warns if status is
    not ok, instead of silent errors happening in drivers.

    Benefit from newly introduced switchdev deferred ops infrastructure.

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

    Jiri Pirko
     

12 Oct, 2015

1 commit

  • Use SWITCHDEV_F_SKIP_EOPNOTSUPP to skip over ports in bridge that don't
    support setting ageing_time (or setting bridge attrs in general).

    If push fails, don't update ageing_time in bridge and return err to user.

    If push succeeds, update ageing_time in bridge and run gc_timer now to
    recalabrate when to run gc_timer next, based on new ageing_time.

    Signed-off-by: Scott Feldman
    Signed-off-by: Jiri Pirko
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Scott Feldman
     

03 Oct, 2015

1 commit


28 Sep, 2015

1 commit


29 Jul, 2015

1 commit

  • These should be handled only by the respective STP which is in control.
    They become problematic for devices with limited resources with many
    ports because the hold_timer is per port and fires each second and the
    hello timer fires each 2 seconds even though it's global. While in
    user-space STP mode these timers are completely unnecessary so it's better
    to keep them off.
    Also ensure that when the bridge is up these timers are started only when
    running with kernel STP.

    Signed-off-by: Satish Ashok
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

24 Jun, 2015

1 commit


23 Jun, 2015

1 commit

  • When STP is running in user-space and querier is configured, the
    querier timer is not started when a port goes to a non-blocking state.
    This patch unifies the user- and kernel-space stp multicast port enable
    path and enables it in all states different from blocking. Note that when a
    port goes in BR_STATE_DISABLED it's not enabled because that is handled
    in the beginning of the port list loop.

    Signed-off-by: Nikolay Aleksandrov
    Acked-by: Herbert Xu
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

14 May, 2015

1 commit


13 May, 2015

2 commits

  • STP update is just a settable port attribute, so convert
    switchdev_port_stp_update to an attr set.

    For DSA, the prepare phase is skipped and STP updates are only done in the
    commit phase. This is because currently the DSA drivers don't need to
    allocate any memory for STP updates and the STP update will not fail to HW
    (unless something horrible goes wrong on the MDIO bus, in which case the
    prepare phase wouldn't have been able to predict anyway).

    Signed-off-by: Scott Feldman
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Scott Feldman
     
  • Turned out that "switchdev" sticks. So just unify all related terms to use
    this prefix.

    Signed-off-by: Jiri Pirko
    Signed-off-by: Scott Feldman
    Acked-by: Roopa Prabhu
    Acked-by: Andy Gospodarek
    Signed-off-by: David S. Miller

    Jiri Pirko
     

03 Dec, 2014

1 commit


02 Oct, 2014

1 commit

  • In preparation for being able to propagate port states to e.g: notifiers
    or other kernel parts, do not manipulate the port state directly, but
    instead use a helper function which will allow us to do a bit more than
    just setting the state.

    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

13 Sep, 2013

2 commits

  • At some point limits were added to forward_delay. However, the
    limits are only enforced when STP is enabled. This created a
    scenario where you could have a value outside the allowed range
    while STP is disabled, which then stuck around even after STP
    is enabled.

    This patch fixes this by clamping the value when we enable STP.

    I had to move the locking around a bit to ensure that there is
    no window where someone could insert a value outside the range
    while we're in the middle of enabling STP.

    Signed-off-by: Herbert Xu

    Cheers,
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This changes the message_age_timer calculation to use the BPDU's max age as
    opposed to the local bridge's max age. This is in accordance with section
    8.6.2.3.2 Step 2 of the 802.1D-1998 sprecification.

    With the current implementation, when running with very large bridge
    diameters, convergance will not always occur even if a root bridge is
    configured to have a longer max age.

    Tested successfully on bridge diameters of ~200.

    Signed-off-by: Chris Healy
    Signed-off-by: David S. Miller

    Chris Healy
     

01 May, 2013

1 commit

  • Bridge can crash while trying to send topology change packet.
    This happens if root port can't be found. This was reported by user
    but currently unable to reproduce it easily. The STP conditions that cause
    this are not known yet, but the problem doesn't have to be fatal.

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

    stephen hemminger
     

15 Nov, 2012

1 commit

  • This is Linux bridge implementation of root port guard.
    If BPDU is received from a leaf (edge) port, it should not
    be elected as root port.

    Why would you want to do this?
    If using STP on a bridge and the downstream bridges are not fully
    trusted; this prevents a hostile guest for rerouting traffic.

    Why not just use netfilter?
    Netfilter does not track of follow spanning tree decisions.
    It would be difficult and error prone to try and mirror STP
    resolution in netfilter module.

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

    stephen hemminger
     

16 Apr, 2012

1 commit


08 Mar, 2012

1 commit


05 Mar, 2012

2 commits


02 Dec, 2011

1 commit

  • When in user-stp mode, bridge master do not follow state of its slaves, so
    after the following sequence of events it can stuck forever in no-carrier
    state:
    1) turn stp off
    2) put all slaves down - master device will follow their state and also go in
    no-carrier state
    3) turn stp on with bridge-stp script returning 0 (go to the user-stp mode)
    Now bridge master won't follow slaves' state and will never reach running
    state.

    This patch solves the problem by making user-stp and kernel-stp behavior
    similar regarding master following slaves' states.

    Signed-off-by: Vitalii Demianets
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Vitalii Demianets
     

23 Jul, 2011

3 commits

  • Some minor cleanups that won't impact code:
    1. Remove inline from non-critical functions; compiler will most
    likely inline them anyway.
    2. Make function args const where possible.
    3. Whitespace cleanup

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

    stephen hemminger
     
  • When STP changes state of interface need to send a new link
    message to reflect that change.

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

    stephen hemminger
     
  • A bridge topology with three systems:

    +------+ +------+
    | A(2) |--| B(1) |
    +------+ +------+
    \ /
    +------+
    | C(3) |
    +------+

    What is supposed to happen:
    * bridge with the lowest ID is elected root (for example: B)
    * C detects that A->C is higher cost path and puts in blocking state

    What happens. Bridge with lowest id (B) is elected correctly as
    root and things start out fine initially. But then config BPDU
    doesn't get transmitted from A -> C. Because of that
    the link from A-C is transistioned to the forwarding state.

    The root cause of this is that the configuration messages
    is generated with bogus message age, and dropped before
    sending.

    In the standardmessage_age is supposed to be:
    the time since the generation of the Configuration BPDU by
    the Root that instigated the generation of this Configuration BPDU.

    Reimplement this by recording the timestamp (age + jiffies) when
    recording config information. The old code incorrectly used the time
    elapsed on the ageing timer which was incorrect.

    See also:
    https://bugzilla.vyatta.com/show_bug.cgi?id=7164

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

    stephen hemminger
     

05 Apr, 2011

1 commit

  • Apply restrictions on STP parameters based 802.1D 1998 standard.
    * Fixes missing locking in set path cost ioctl
    * Uses common code for both ioctl and sysfs

    This is based on an earlier patch Sasikanth V but with overhaul.

    Note:
    1. It does NOT enforce the restriction on the relationship max_age and
    forward delay or hello time because in existing implementation these are
    set as independant operations.

    2. If STP is disabled, there is no restriction on forward delay

    3. No restriction on holding time because users use Linux code to act
    as hub or be sticky.

    4. Although standard allow 0-255, Linux only allows 0-63 for port priority
    because more bits are reserved for port number.

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

    stephen hemminger
     

16 Mar, 2011

1 commit


15 Mar, 2011

2 commits

  • If Spanning Tree Protocol is not enabled, there is no good reason for
    the bridge code to wait for the forwarding delay period before enabling
    the link. The purpose of the forwarding delay is to allow STP to
    learn about other bridges before nominating itself.

    The only possible impact is that when starting up a new port
    the bridge may flood a packet now, where previously it might have
    seen traffic from the other host and preseeded the forwarding table.

    Includes change for local variable br already available in that func.

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

    stephen hemminger
     
  • This makes the bridge device behave like a physical device.
    In earlier releases the bridge always asserted carrier. This
    changes the behavior so that bridge device carrier is on only
    if one or more ports are in the forwarding state. This
    should help IPv6 autoconfiguration, DHCP, and routing daemons.

    I did brief testing with Network and Virt manager and they
    seem fine, but since this changes behavior of bridge, it should
    wait until net-next (2.6.39).

    Signed-off-by: Stephen Hemminger
    Reviewed-by: Nicolas de Pesloüan
    Tested-By: Adam Majer
    Signed-off-by: David S. Miller

    stephen hemminger
     

16 May, 2010

1 commit