20 Mar, 2020

2 commits

  • While discussing the new API, Roopa mentioned that we'll be adding more
    tunnel attributes and options in the future, so it's better to make it a
    nested attribute, since this is still in net-next we can easily change it
    and nest the tunnel id attribute under BRIDGE_VLANDB_ENTRY_TUNNEL_INFO.

    The new format is:
    [BRIDGE_VLANDB_ENTRY]
    [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO]
    [BRIDGE_VLANDB_TINFO_ID]

    Any new tunnel attributes can be nested under
    BRIDGE_VLANDB_ENTRY_TUNNEL_INFO.

    Suggested-by: Roopa Prabhu
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     
  • This patch adds support for vlan stats to be included when dumping vlan
    information. We have to dump them only when explicitly requested (thus the
    flag below) because that disables the vlan range compression and will make
    the dump significantly larger. In order to request the stats to be
    included we add a new dump attribute called BRIDGE_VLANDB_DUMP_FLAGS which
    can affect dumps with the following first flag:
    - BRIDGE_VLANDB_DUMPF_STATS
    The stats are intentionally nested and put into separate attributes to make
    it easier for extending later since we plan to add per-vlan mcast stats,
    drop stats and possibly STP stats. This is the last missing piece from the
    new vlan API which makes the dumped vlan information complete.

    A dump request which should include stats looks like:
    [BRIDGE_VLANDB_DUMP_FLAGS] |= BRIDGE_VLANDB_DUMPF_STATS

    A vlandb entry attribute with stats looks like:
    [BRIDGE_VLANDB_ENTRY] = {
    [BRIDGE_VLANDB_ENTRY_STATS] = {
    [BRIDGE_VLANDB_STATS_RX_BYTES]
    [BRIDGE_VLANDB_STATS_RX_PACKETS]
    ...
    }
    }

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

    Nikolay Aleksandrov
     

18 Mar, 2020

2 commits

  • This patch adds support for manipulating vlan/tunnel mappings. The
    tunnel ids are globally unique and are one per-vlan. There were two
    trickier issues - first in order to support vlan ranges we have to
    compute the current tunnel id in the following way:
    - base tunnel id (attr) + current vlan id - starting vlan id
    This is in line how the old API does vlan/tunnel mapping with ranges. We
    already have the vlan range present, so it's redundant to add another
    attribute for the tunnel range end. It's simply base tunnel id + vlan
    range. And second to support removing mappings we need an out-of-band way
    to tell the option manipulating function because there are no
    special/reserved tunnel id values, so we use a vlan flag to denote the
    operation is tunnel mapping removal.

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

    Nikolay Aleksandrov
     
  • It is more appropriate name as it shows the intent of why we need to
    check the options' state. It also allows us to give meaning to the two
    arguments of the function: the first is the current vlan (v_curr) being
    checked if it could enter the range ending in the second one (range_end).

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

    Nikolay Aleksandrov
     

24 Jan, 2020

3 commits

  • The first per-vlan option added is state, it is needed for EVPN and for
    per-vlan STP. The state allows to control the forwarding on per-vlan
    basis. The vlan state is considered only if the port state is forwarding
    in order to avoid conflicts and be consistent. br_allowed_egress is
    called only when the state is forwarding, but the ingress case is a bit
    more complicated due to the fact that we may have the transition between
    port:BR_STATE_FORWARDING -> vlan:BR_STATE_LEARNING which should still
    allow the bridge to learn from the packet after vlan filtering and it will
    be dropped after that. Also to optimize the pvid state check we keep a
    copy in the vlan group to avoid one lookup. The state members are
    modified with *_ONCE() to annotate the lockless access.

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

    Nikolay Aleksandrov
     
  • This patch adds support for option modification of single vlans and
    ranges. It allows to only modify options, i.e. skip create/delete by
    using the BRIDGE_VLAN_INFO_ONLY_OPTS flag. When working with a range
    option changes we try to pack the notifications as much as possible.

    v2: do full port (all vlans) notification only when creating/deleting
    vlans for compatibility, rework the range detection when changing
    options, add more verbose extack errors and check if a vlan should
    be used (br_vlan_should_use checks)

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

    Nikolay Aleksandrov
     
  • We'll be dumping the options for the whole range if they're equal. The
    first range vlan will be used to extract the options. The commit doesn't
    change anything yet it just adds the skeleton for the support. The dump
    will happen when the first option is added.

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

    Nikolay Aleksandrov
     

15 Jan, 2020

6 commits

  • Now that we can notify, send a notification on add/del or change of flags.
    Notifications are also compressed when possible to reduce their number
    and relieve user-space of extra processing, due to that we have to
    manually notify after each add/del in order to avoid double
    notifications. We try hard to notify only about the vlans which actually
    changed, thus a single command can result in multiple notifications
    about disjoint ranges if there were vlans which didn't change inside.

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

    Nikolay Aleksandrov
     
  • Add a new rtnetlink group for bridge vlan notifications - RTNLGRP_BRVLAN
    and add support for sending vlan notifications (both single and ranges).
    No functional changes intended, the notification support will be used by
    later patches.

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

    Nikolay Aleksandrov
     
  • Add a new vlandb nl attribute - BRIDGE_VLANDB_ENTRY_RANGE which causes
    RTM_NEWVLAN/DELVAN to act on a range. Dumps now automatically compress
    similar vlans into ranges. This will be also used when per-vlan options
    are introduced and vlans' options match, they will be put into a single
    range which is encapsulated in one netlink attribute. We need to run
    similar checks as br_process_vlan_info() does because these ranges will
    be used for options setting and they'll be able to skip
    br_process_vlan_info().

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

    Nikolay Aleksandrov
     
  • Adding RTM_DELVLAN support similar to RTM_NEWVLAN is simple, just need to
    map DELVLAN to DELLINK and register the handler.

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

    Nikolay Aleksandrov
     
  • Add initial RTM_NEWVLAN support which can only create vlans, operating
    similar to the current br_afspec(). We will use it later to also change
    per-vlan options. Old-style (flag-based) vlan ranges are not allowed
    when using RTM messages, we will introduce vlan ranges later via a new
    nested attribute which would allow us to have all the information about a
    range encapsulated into a single nl attribute.

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

    Nikolay Aleksandrov
     
  • This patch adds vlan rtm definitions:
    - NEWVLAN: to be used for creating vlans, setting options and
    notifications
    - DELVLAN: to be used for deleting vlans
    - GETVLAN: used for dumping vlan information

    Dumping vlans which can span multiple messages is added now with basic
    information (vid and flags). We use nlmsg_parse() to validate the header
    length in order to be able to extend the message with filtering
    attributes later.

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

    Nikolay Aleksandrov
     

01 Sep, 2019

1 commit

  • Currently this simplified code snippet fails:

    br_vlan_get_pvid(netdev, &pvid);
    br_vlan_get_info(netdev, pvid, &vinfo);
    ASSERT(!(vinfo.flags & BRIDGE_VLAN_INFO_PVID));

    It is intuitive that the pvid of a netdevice should have the
    BRIDGE_VLAN_INFO_PVID flag set.

    However I can't seem to pinpoint a commit where this behavior was
    introduced. It seems like it's been like that since forever.

    At a first glance it would make more sense to just handle the
    BRIDGE_VLAN_INFO_PVID flag in __vlan_add_flags. However, as Nikolay
    explains:

    There are a few reasons why we don't do it, most importantly because
    we need to have only one visible pvid at any single time, even if it's
    stale - it must be just one. Right now that rule will not be violated
    by this change, but people will try using this flag and could see two
    pvids simultaneously. You can see that the pvid code is even using
    memory barriers to propagate the new value faster and everywhere the
    pvid is read only once. That is the reason the flag is set
    dynamically when dumping entries, too. A second (weaker) argument
    against would be given the above we don't want another way to do the
    same thing, specifically if it can provide us with two pvids (e.g. if
    walking the vlan list) or if it can provide us with a pvid different
    from the one set in the vg. [Obviously, I'm talking about RCU
    pvid/vlan use cases similar to the dumps. The locked cases are fine.
    I would like to avoid explaining why this shouldn't be relied upon
    without locking]

    So instead of introducing the above change and making sure of the pvid
    uniqueness under RCU, simply dynamically populate the pvid flag in
    br_vlan_get_info().

    Signed-off-by: Vladimir Oltean
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Vladimir Oltean
     

06 Aug, 2019

1 commit

  • Most of the bridge device's vlan init bugs come from the fact that its
    default pvid is created at the wrong time, way too early in ndo_init()
    before the device is even assigned an ifindex. It introduces a bug when the
    bridge's dev_addr is added as fdb during the initial default pvid creation
    the notification has ifindex/NDA_MASTER both equal to 0 (see example below)
    which really makes no sense for user-space[0] and is wrong.
    Usually user-space software would ignore such entries, but they are
    actually valid and will eventually have all necessary attributes.
    It makes much more sense to send a notification *after* the device has
    registered and has a proper ifindex allocated rather than before when
    there's a chance that the registration might still fail or to receive
    it with ifindex/NDA_MASTER == 0. Note that we can remove the fdb flush
    from br_vlan_flush() since that case can no longer happen. At
    NETDEV_REGISTER br->default_pvid is always == 1 as it's initialized by
    br_vlan_init() before that and at NETDEV_UNREGISTER it can be anything
    depending why it was called (if called due to NETDEV_REGISTER error
    it'll still be == 1, otherwise it could be any value changed during the
    device life time).

    For the demonstration below a small change to iproute2 for printing all fdb
    notifications is added, because it contained a workaround not to show
    entries with ifindex == 0.
    Command executed while monitoring: $ ip l add br0 type bridge
    Before (both ifindex and master == 0):
    $ bridge monitor fdb
    36:7e:8a:b3:56:ba dev * vlan 1 master * permanent

    After (proper br0 ifindex):
    $ bridge monitor fdb
    e6:2a:ae:7a:b7:48 dev br0 vlan 1 master br0 permanent

    v4: move only the default pvid init/deinit to NETDEV_REGISTER/UNREGISTER
    v3: send the correct v2 patch with all changes (stub should return 0)
    v2: on error in br_vlan_init set br->vlgrp to NULL and return 0 in
    the br_vlan_bridge_event stub when bridge vlans are disabled

    [0] https://bugzilla.kernel.org/show_bug.cgi?id=204389

    Reported-by: michael-dev
    Fixes: 5be5a2df40f0 ("bridge: Add filtering support for default_pvid")
    Signed-off-by: Nikolay Aleksandrov
    Acked-by: Roopa Prabhu
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

30 Jul, 2019

1 commit

  • On initialization failure we have to delete the local fdb which was
    inserted due to the default pvid creation. This problem has been present
    since the inception of default_pvid. Note that currently there are 2 cases:
    1) in br_dev_init() when br_multicast_init() fails
    2) if register_netdevice() fails after calling ndo_init()

    This patch takes care of both since br_vlan_flush() is called on both
    occasions. Also the new fdb delete would be a no-op on normal bridge
    device destruction since the local fdb would've been already flushed by
    br_dev_delete(). This is not an issue for ports since nbp_vlan_init() is
    called last when adding a port thus nothing can fail after it.

    Reported-by: syzbot+88533dc8b582309bf3ee@syzkaller.appspotmail.com
    Fixes: 5be5a2df40f0 ("bridge: Add filtering support for default_pvid")
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

06 Jul, 2019

2 commits


21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have EXPORT_.*_SYMBOL_GPL inside which was used in the
    initial scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

20 Apr, 2019

3 commits

  • If vlan bridge binding is enabled, then the link state of a vlan device
    that is an upper device of the bridge tracks the state of bridge ports
    that are members of that vlan. But this can only be done when the link
    state of the bridge is up. If it is down, then the link state of the
    vlan devices must also be down. This is to maintain existing behavior
    for when STP is enabled and there are no live ports, in which case the
    link state for the bridge and any vlan devices is down.

    Signed-off-by: Mike Manning
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Mike Manning
     
  • If vlan bridge binding is enabled, then the link state of a vlan device
    that is an upper device of the bridge should track the state of bridge
    ports that are members of that vlan. So if a bridge port becomes or
    stops being a member of a vlan, then update the link state of the
    vlan device if necessary.

    Signed-off-by: Mike Manning
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Mike Manning
     
  • In the case of vlan filtering on bridges, the bridge may also have the
    corresponding vlan devices as upper devices. A vlan bridge binding mode
    is added to allow the link state of the vlan device to track only the
    state of the subset of bridge ports that are also members of the vlan,
    rather than that of all bridge ports. This mode is set with a vlan flag
    rather than a bridge sysfs so that the 8021q module is aware that it
    should not set the link state for the vlan device.

    If bridge vlan is configured, the bridge device event handling results
    in the link state for an upper device being set, if it is a vlan device
    with the vlan bridge binding mode enabled. This also sets a
    vlan_bridge_binding flag so that subsequent UP/DOWN/CHANGE events for
    the ports in that bridge result in a link state update of the vlan
    device if required.

    The link state of the vlan device is up if there is at least one bridge
    port that is a vlan member that is admin & oper up, otherwise its oper
    state is IF_OPER_LOWERLAYERDOWN.

    Signed-off-by: Mike Manning
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Mike Manning
     

08 Apr, 2019

1 commit

  • This patch changes rhashtables to use a bit_spin_lock on BIT(1) of the
    bucket pointer to lock the hash chain for that bucket.

    The benefits of a bit spin_lock are:
    - no need to allocate a separate array of locks.
    - no need to have a configuration option to guide the
    choice of the size of this array
    - locking cost is often a single test-and-set in a cache line
    that will have to be loaded anyway. When inserting at, or removing
    from, the head of the chain, the unlock is free - writing the new
    address in the bucket head implicitly clears the lock bit.
    For __rhashtable_insert_fast() we ensure this always happens
    when adding a new key.
    - even when lockings costs 2 updates (lock and unlock), they are
    in a cacheline that needs to be read anyway.

    The cost of using a bit spin_lock is a little bit of code complexity,
    which I think is quite manageable.

    Bit spin_locks are sometimes inappropriate because they are not fair -
    if multiple CPUs repeatedly contend of the same lock, one CPU can
    easily be starved. This is not a credible situation with rhashtable.
    Multiple CPUs may want to repeatedly add or remove objects, but they
    will typically do so at different buckets, so they will attempt to
    acquire different locks.

    As we have more bit-locks than we previously had spinlocks (by at
    least a factor of two) we can expect slightly less contention to
    go with the slightly better cache behavior and reduced memory
    consumption.

    To enhance type checking, a new struct is introduced to represent the
    pointer plus lock-bit
    that is stored in the bucket-table. This is "struct rhash_lock_head"
    and is empty. A pointer to this needs to be cast to either an
    unsigned lock, or a "struct rhash_head *" to be useful.
    Variables of this type are most often called "bkt".

    Previously "pprev" would sometimes point to a bucket, and sometimes a
    ->next pointer in an rhash_head. As these are now different types,
    pprev is NULL when it would have pointed to the bucket. In that case,
    'blk' is used, together with correct locking protocol.

    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     

09 Jan, 2019

1 commit

  • When adding / deleting VLANs to / from a bridge port, the bridge driver
    first tries to propagate the information via switchdev and falls back to
    the 8021q driver in case the underlying driver does not support
    switchdev. This can result in a memory leak [1] when VXLAN and mlxsw
    ports are enslaved to the bridge:

    $ ip link set dev vxlan0 master br0
    # No mlxsw ports are enslaved to 'br0', so mlxsw ignores the switchdev
    # notification and the bridge driver adds the VLAN on 'vxlan0' via the
    # 8021q driver
    $ bridge vlan add vid 10 dev vxlan0 pvid untagged
    # mlxsw port is enslaved to the bridge
    $ ip link set dev swp1 master br0
    # mlxsw processes the switchdev notification and the 8021q driver is
    # skipped
    $ bridge vlan del vid 10 dev vxlan0

    This results in 'struct vlan_info' and 'struct vlan_vid_info' being
    leaked, as they were allocated by the 8021q driver during VLAN addition,
    but never freed as the 8021q driver was skipped during deletion.

    Fix this by introducing a new VLAN private flag that indicates whether
    the VLAN was added on the port by switchdev or the 8021q driver. If the
    VLAN was added by the 8021q driver, then we make sure to delete it via
    the 8021q driver as well.

    [1]
    unreferenced object 0xffff88822d20b1e8 (size 256):
    comm "bridge", pid 2532, jiffies 4295216998 (age 1188.830s)
    hex dump (first 32 bytes):
    e0 42 97 ce 81 88 ff ff 00 00 00 00 00 00 00 00 .B..............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmem_cache_alloc_trace+0x1be/0x330
    [] vlan_vid_add+0x661/0x920
    [] __vlan_add+0x1be9/0x3a00
    [] nbp_vlan_add+0x8b3/0xd90
    [] br_vlan_info+0x132/0x410
    [] br_afspec+0x75c/0x870
    [] br_setlink+0x3dc/0x6d0
    [] rtnl_bridge_setlink+0x615/0xb30
    [] rtnetlink_rcv_msg+0x3a3/0xa80
    [] netlink_rcv_skb+0x152/0x3c0
    [] rtnetlink_rcv+0x21/0x30
    [] netlink_unicast+0x52f/0x740
    [] netlink_sendmsg+0x9c7/0xf50
    [] sock_sendmsg+0xbe/0x120
    [] ___sys_sendmsg+0x778/0x8f0
    [] __sys_sendmsg+0x112/0x270
    unreferenced object 0xffff888227454308 (size 32):
    comm "bridge", pid 2532, jiffies 4295216998 (age 1188.882s)
    hex dump (first 32 bytes):
    88 b2 20 2d 82 88 ff ff 88 b2 20 2d 82 88 ff ff .. -...... -....
    81 00 0a 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmem_cache_alloc_trace+0x1be/0x330
    [] vlan_vid_add+0x3e6/0x920
    [] __vlan_add+0x1be9/0x3a00
    [] nbp_vlan_add+0x8b3/0xd90
    [] br_vlan_info+0x132/0x410
    [] br_afspec+0x75c/0x870
    [] br_setlink+0x3dc/0x6d0
    [] rtnl_bridge_setlink+0x615/0xb30
    [] rtnetlink_rcv_msg+0x3a3/0xa80
    [] netlink_rcv_skb+0x152/0x3c0
    [] rtnetlink_rcv+0x21/0x30
    [] netlink_unicast+0x52f/0x740
    [] netlink_sendmsg+0x9c7/0xf50
    [] sock_sendmsg+0xbe/0x120
    [] ___sys_sendmsg+0x778/0x8f0
    [] __sys_sendmsg+0x112/0x270

    Fixes: d70e42b22dd4 ("mlxsw: spectrum: Enable VxLAN enslavement to VLAN-aware bridges")
    Signed-off-by: Ido Schimmel
    Reviewed-by: Petr Machata
    Cc: Roopa Prabhu
    Cc: Nikolay Aleksandrov
    Cc: bridge@lists.linux-foundation.org
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Ido Schimmel
     

13 Dec, 2018

1 commit

  • ndo_bridge_setlink has been updated in the previous patch to have extack
    available, and changelink RTNL op has had this argument since the time
    extack was added. Propagate both through the bridge driver to eventually
    reach br_switchdev_port_vlan_add(), where it will be used by subsequent
    patches.

    Signed-off-by: Petr Machata
    Acked-by: Jiri Pirko
    Acked-by: Nikolay Aleksandrov
    Acked-by: Ivan Vecera
    Acked-by: Roopa Prabhu
    Reviewed-by: Ido Schimmel
    Signed-off-by: David S. Miller

    Petr Machata
     

01 Dec, 2018

1 commit


20 Nov, 2018

1 commit


18 Nov, 2018

1 commit

  • Syzbot reported a use-after-free of the global vlan context on port vlan
    destruction. When I added per-port vlan stats I missed the fact that the
    global vlan context can be freed before the per-port vlan rcu callback.
    There're a few different ways to deal with this, I've chosen to add a
    new private flag that is set only when per-port stats are allocated so
    we can directly check it on destruction without dereferencing the global
    context at all. The new field in net_bridge_vlan uses a hole.

    v2: cosmetic change, move the check to br_process_vlan_info where the
    other checks are done
    v3: add change log in the patch, add private (in-kernel only) flags in a
    hole in net_bridge_vlan struct and use that instead of mixing
    user-space flags with private flags

    Fixes: 9163a0fc1f0c ("net: bridge: add support for per-port vlan stats")
    Reported-by: syzbot+04681da557a0e49a52e5@syzkaller.appspotmail.com
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

09 Nov, 2018

1 commit


16 Oct, 2018

1 commit

  • After per-port vlan stats, vlan stats should be released
    when fail to add vlan

    Fixes: 9163a0fc1f0c0 ("net: bridge: add support for per-port vlan stats")
    CC: bridge@lists.linux-foundation.org
    cc: Nikolay Aleksandrov
    CC: Roopa Prabhu
    Signed-off-by: Zhang Yu
    Signed-off-by: Li RongQing
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Li RongQing
     

13 Oct, 2018

1 commit

  • This patch adds an option to have per-port vlan stats instead of the
    default global stats. The option can be set only when there are no port
    vlans in the bridge since we need to allocate the stats if it is set
    when vlans are being added to ports (and respectively free them
    when being deleted). Also bump RTNL_MAX_TYPE as the bridge is the
    largest user of options. The current stats design allows us to add
    these without any changes to the fast-path, it all comes down to
    the per-vlan stats pointer which, if this option is enabled, will
    be allocated for each port vlan instead of using the global bridge-wide
    one.

    CC: bridge@lists.linux-foundation.org
    CC: Roopa Prabhu
    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

27 Sep, 2018

2 commits


01 Sep, 2018

1 commit


01 Jun, 2018

3 commits

  • A driver might need to react to changes in settings of brentry VLANs.
    Therefore send switchdev port notifications for these as well. Reuse
    SWITCHDEV_OBJ_ID_PORT_VLAN for this purpose. Listeners should use
    netif_is_bridge_master() on orig_dev to determine whether the
    notification is about a bridge port or a bridge.

    Signed-off-by: Petr Machata
    Reviewed-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Petr Machata
     
  • Extract the code that deals with adding a preexisting VLAN to bridge CPU
    port to a separate function. A follow-up patch introduces a need to roll
    back operations in this block due to an error, and this split will make
    the error-handling code clearer.

    Signed-off-by: Petr Machata
    Reviewed-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Petr Machata
     
  • A call to switchdev_port_obj_add() or switchdev_port_obj_del() involves
    initializing a struct switchdev_obj_port_vlan, a piece of code that
    repeats on each call site almost verbatim. While in the current codebase
    there is just one duplicated add call, the follow-up patches add more of
    both add and del calls.

    Thus to remove the duplication, extract the repetition into named
    functions and reuse.

    Signed-off-by: Petr Machata
    Reviewed-by: Vivien Didelot
    Reviewed-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Petr Machata
     

11 May, 2018

1 commit

  • Mirroring offload in mlxsw needs to check that a given VLAN is allowed
    to ingress the bridge device. br_vlan_get_info() is the function that is
    used for this, however currently it only supports bridge port devices.
    Extend it to support bridge masters as well.

    Signed-off-by: Petr Machata
    Signed-off-by: Ido Schimmel
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Petr Machata
     

01 May, 2018

1 commit


27 Feb, 2018

1 commit

  • When a VLAN is added on a port, a reference is taken on the
    corresponding master VLAN entry. If it does not already exist, then it
    is created and a reference taken.

    However, in the second case a reference is not really taken when
    CONFIG_REFCOUNT_FULL is enabled as refcount_inc() is replaced by
    refcount_inc_not_zero().

    Fix this by using refcount_set() on a newly created master VLAN entry.

    Fixes: 251277598596 ("net, bridge: convert net_bridge_vlan.refcnt from atomic_t to refcount_t")
    Signed-off-by: Ido Schimmel
    Acked-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Ido Schimmel