08 Aug, 2017

2 commits

  • Currently the bridge port flags, vlans, FDBs and MDBs can be offloaded
    through the bridge code, making the switchdev's SELF bridge bypass
    implementation to be redundant. This implies several changes:
    - No need for dump infra in switchdev, DSA's special case is handled
    privately.
    - Remove obj_dump from switchdev_ops.
    - FDBs are removed from obj_add/del routines, due to the fact that they
    are offloaded through the bridge notification chain.
    - The switchdev_port_bridge_xx() and switchdev_port_fdb_xx() functions
    can be removed.

    Signed-off-by: Arkadi Sharshevsky
    Reviewed-by: Vivien Didelot
    Acked-by: Jiri Pirko
    Reviewed-by: Ivan Vecera
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     
  • >From all switchdev devices only DSA requires special FDB dump. This is due
    to lack of ability for syncing the hardware learned FDBs with the bridge.
    Due to this it is removed from switchdev and moved inside DSA.

    Signed-off-by: Arkadi Sharshevsky
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     

01 Jul, 2017

1 commit

  • Add a helper to allow switchdev ops to be set if NET_SWITCHDEV is configured
    and do nothing otherwise. This allows for slightly cleaner code which
    uses switchdev but does not select NET_SWITCHDEV.

    Signed-off-by: Simon Horman
    Acked-by: Ivan Vecera
    Signed-off-by: David S. Miller

    Simon Horman
     

09 Jun, 2017

3 commits

  • When a new static FDB is added to the bridge a notification is sent to
    the driver for offload. In case of successful offload the driver should
    notify the bridge back, which in turn should mark the FDB as offloaded.

    Currently, externally learned is equivalent for being offloaded which is
    not correct due to the fact that FDBs which are added from user-space are
    also marked as externally learned. In order to specify if an FDB was
    successfully offloaded a new flag is introduced.

    Signed-off-by: Arkadi Sharshevsky
    Reviewed-by: Ido Schimmel
    Reviewed-by: Nikolay Aleksandrov
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     
  • Currently the bridge doesn't notify the underlying devices about new
    FDBs learned. The FDB sync is placed on the switchdev notifier chain
    because devices may potentially learn FDB that are not directly related
    to their ports, for example:

    1. Mixed SW/HW bridge - FDBs that point to the ASICs external devices
    should be offloaded as CPU traps in order to
    perform forwarding in slow path.
    2. EVPN - Externally learned FDBs for the vtep device.

    Notification is sent only about static FDB add/del. This is done due
    to fact that currently this is the only scenario supported by switch
    drivers.

    Signed-off-by: Arkadi Sharshevsky
    Reviewed-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Reviewed-by: Nikolay Aleksandrov
    Reviewed-by: Ivan Vecera
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     
  • This is done as a preparation stage before setting the bridge port flags
    from the bridge code. Currently the device can be queried for the bridge
    flags state, but the querier cannot distinguish if the flag is disabled
    or if it is not supported at all. Thus, add new attr and a bit-mask which
    include information regarding the support on a per-flag basis.

    Drivers that support bridge offload but not support bridge flags should
    return zeroed bitmask.

    Signed-off-by: Arkadi Sharshevsky
    Reviewed-by: Ido Schimmel
    Reviewed-by: Ivan Vecera
    Signed-off-by: Jiri Pirko
    Reviewed-by: Ivan Vecera
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     

11 Feb, 2017

2 commits

  • Offload the mc router ports list, whenever it is being changed.
    It is done because in some cases mc packets needs to be flooded to all
    the ports in this list.

    Signed-off-by: Nogah Frankel
    Signed-off-by: Yotam Gigi
    Signed-off-by: Jiri Pirko
    Acked-by: Ivan Vecera
    Signed-off-by: David S. Miller

    Nogah Frankel
     
  • Offload multicast disabled flag, for more accurate mc flood behavior:
    When it is on, the mdb should be ignored.
    When it is off, unregistered mc packets should be flooded to mc router
    ports.

    Signed-off-by: Nogah Frankel
    Signed-off-by: Yotam Gigi
    Signed-off-by: Jiri Pirko
    Acked-by: Ivan Vecera
    Signed-off-by: David S. Miller

    Nogah Frankel
     

28 Sep, 2016

1 commit


03 Sep, 2016

1 commit

  • This patch fixes the retun value of switchdev_port_fdb_dump() when
    CONFIG_NET_SWITCHDEV is not set. This avoids getting "warning: return makes
    integer from pointer without a cast [-Wint-conversion]" when building
    when CONFIG_NET_SWITCHDEV is not set under several compiler versions.
    This warning is due to commit d297653dd6f07afbe7e6c702a4bcd7615680002e
    ("rtnetlink: fdb dump: optimize by saving last interface markers").

    Signed-off-by: Rami Rosen
    Acked-by: Roopa Prabhu
    Reported-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Rosen, Rami
     

02 Sep, 2016

1 commit

  • fdb dumps spanning multiple skb's currently restart from the first
    interface again for every skb. This results in unnecessary
    iterations on the already visited interfaces and their fdb
    entries. In large scale setups, we have seen this to slow
    down fdb dumps considerably. On a system with 30k macs we
    see fdb dumps spanning across more than 300 skbs.

    To fix the problem, this patch replaces the existing single fdb
    marker with three markers: netdev hash entries, netdevs and fdb
    index to continue where we left off instead of restarting from the
    first netdev. This is consistent with link dumps.

    In the process of fixing the performance issue, this patch also
    re-implements fix done by
    commit 472681d57a5d ("net: ndo_fdb_dump should report -EMSGSIZE to rtnl_fdb_dump")
    (with an internal fix from Wilson Kok) in the following ways:
    - change ndo_fdb_dump handlers to return error code instead
    of the last fdb index
    - use cb->args strictly for dump frag markers and not error codes.
    This is consistent with other dump functions.

    Below results were taken on a system with 1000 netdevs
    and 35085 fdb entries:
    before patch:
    $time bridge fdb show | wc -l
    15065

    real 1m11.791s
    user 0m0.070s
    sys 1m8.395s

    (existing code does not return all macs)

    after patch:
    $time bridge fdb show | wc -l
    35085

    real 0m2.017s
    user 0m0.113s
    sys 0m1.942s

    Signed-off-by: Roopa Prabhu
    Signed-off-by: Wilson Kok
    Signed-off-by: David S. Miller

    Roopa Prabhu
     

27 Aug, 2016

1 commit

  • switchdev_port_fwd_mark_set() is used to set the 'offload_fwd_mark' of
    port netdevs so that packets being flooded by the device won't be
    flooded twice.

    It works by assigning a unique identifier (the ifindex of the first
    bridge port) to bridge ports sharing the same parent ID. This prevents
    packets from being flooded twice by the same switch, but will flood
    packets through bridge ports belonging to a different switch.

    This method is problematic when stacked devices are taken into account,
    such as VLANs. In such cases, a physical port netdev can have upper
    devices being members in two different bridges, thus requiring two
    different 'offload_fwd_mark's to be configured on the port netdev, which
    is impossible.

    The main problem is that packet and netdev marking is performed at the
    physical netdev level, whereas flooding occurs between bridge ports,
    which are not necessarily port netdevs.

    Instead, packet and netdev marking should really be done in the bridge
    driver with the switch driver only telling it which packets it already
    forwarded. The bridge driver will mark such packets using the mark
    assigned to the ingress bridge port and will prevent the packet from
    being forwarded through any bridge port sharing the same mark (i.e.
    having the same parent ID).

    Remove the current switchdev 'offload_fwd_mark' implementation and
    instead implement the proposed method. In addition, make rocker - the
    sole user of the mark - use the proposed method.

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

    Ido Schimmel
     

24 Jul, 2016

1 commit


20 Jul, 2016

1 commit

  • The switchdev value for the SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME
    attribute is a clock_t and requires to use helpers such as
    clock_t_to_jiffies() to convert to milliseconds.

    Change ageing_time type from u32 to clock_t to make it explicit.

    Fixes: f55ac58ae64c ("switchdev: add bridge ageing_time attribute")
    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     

15 Jul, 2016

1 commit


18 May, 2016

1 commit

  • The problem is that fib_info->nh is [0] so the struct fib_info
    allocation size depends on number of nexthops. If we just copy fib_info,
    we do not copy the nexthops info and driver accesses memory which is not
    ours.

    Given the fact that fib4 does not defer operations and therefore it does
    not need copy, just pass the pointer down to drivers as it was done
    before.

    Fixes: 850d0cbc91 ("switchdev: remove pointers from switchdev objects")
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

25 Apr, 2016

1 commit

  • When using switchdev deferred operation (SWITCHDEV_F_DEFER), the operation
    is executed in different context and the application doesn't have any way
    to get the operation real status.

    Adding a completion callback fixes that. This patch adds fields to
    switchdev_attr and switchdev_obj "complete_priv" field which is used by
    the "complete" callback.

    Application can set a complete function which will be called once the
    operation executed.

    Signed-off-by: Elad Raz
    Signed-off-by: Jiri Pirko
    Reviewed-by: Ido Schimmel
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Elad Raz
     

11 Jan, 2016

1 commit

  • Define HW multicast entry: MAC and VID.
    Using a MAC address simplifies support for both IPV4 and IPv6.

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

    Elad Raz
     

07 Jan, 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

  • rtnl_fdb_dump always expects an index to be returned by the ndo_fdb_dump op,
    but when CONFIG_NET_SWITCHDEV is off, it returns an error.

    Fix that by returning the given unmodified idx.

    A similar fix was 0890cf6cb6ab ("switchdev: fix return value of
    switchdev_port_fdb_dump in case of error") but for the CONFIG_NET_SWITCHDEV=y
    case.

    Fixes: 45d4122ca7cd ("switchdev: add support for fdb add/del/dump via switchdev_port_obj ops.")
    Signed-off-by: Dragos Tatulea
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Dragos Tatulea
     

15 Oct, 2015

5 commits


12 Oct, 2015

2 commits


03 Oct, 2015

6 commits


30 Sep, 2015

4 commits

  • Now that switchdev and its drivers directly use specific switchdev_obj_*
    structures, move them out of the switchdev_obj union and get rif of this
    outer structure.

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

    Vivien Didelot
     
  • Similar to the notifier_call callback of a notifier_block, change the
    function signature of switchdev add and del operations to:

    int switchdev_port_obj_add/del(struct net_device *dev,
    enum switchdev_obj_id id, void *obj);

    This allows the caller to pass a specific switchdev_obj_* structure
    instead of the generic switchdev_obj one.

    Drivers implementation of these operations and switchdev have been
    changed accordingly.

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

    Vivien Didelot
     
  • Similar to the notifier_call callback of a notifier_block, change the
    function signature of switchdev dump operation to:

    int switchdev_port_obj_dump(struct net_device *dev,
    enum switchdev_obj_id id, void *obj,
    int (*cb)(void *obj));

    This allows the caller to pass and expect back a specific
    switchdev_obj_* structure instead of the generic switchdev_obj one.

    Drivers implementation of dump operation can now expect this specific
    structure and call the callback with it. Drivers have been changed
    accordingly.

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

    Vivien Didelot
     
  • The net_device associated to a dump operation does not have to be passed
    to the callback. switchdev stores it in a superset struct, if needed.

    Also some drivers (such as DSA drivers) may not have easy access to it.

    This will simplify pushing the callback function down to the drivers.

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

    Vivien Didelot
     

25 Sep, 2015

2 commits