1. 27 Feb, 2022 1 commit
  2. 26 Feb, 2022 15 commits
  3. 25 Feb, 2022 24 commits
    • David S. Miller's avatar
      Merge branch 'sja1105-phylink-updates' · 5ebaaa69
      David S. Miller authored
      Russell King says:
      
      ====================
      net: dsa: sja1105: phylink updates
      
      This series updates the phylink implementation in sja1105 to use the
      supported_interfaces bitmap, convert to the mac_select_pcs() interface,
      mark as non-legacy, and get rid of the validation method.
      
      As a final step, enable switching between SGMII and 2500BASE-X as it
      is a feature that Vladimir desires.
      
      Specifically, the patches in this series:
      
      1. Populates the supported_interfaces bitmap.
      2. As a result of the supported_interfaces bitmap being populated,
         sja1105 no longer needs to check the interface mode as phylink
         will do this.
      3. Switch away from using phylink_set_pcs(), using the mac_select_pcs()
         method instead.
      4. Mark the driver as not-legacy
      5. Fill in mac_capabilities using _exactly_ the same conditions as is
         currently used to decide which link modes to support, and convert
         to use phylink_generic_validate()
      6. Add brand new support to permit switching between SGMII and
         2500BASE-X modes of operation as per Vladimir's single patch that
         performs steps 1, 2, 5 and 6 in one go.
      
      There are some additional changes in Vladimir's single patch that I
      have not included:
      
      * validation of priv->phy_mode[] in sja1105_phylink_get_caps(). The
        driver has already validated the phy_mode for each port in
        sja1105_init_mii_settings(), and a failure here will prevent the
        driver reaching sja1105_phylink_get_caps().
      
      * Changing the decisions on which mac_capabilities to set. Vladimir's
        patch always sets MAC_10FD | MAC_100FD | MAC_1000FD despite the
        current code clearly making the 1G speed conditional on the
        xmii_mode for the port. The change in decision making may be
        visible when in PHY_INTERFACE_MODE_INTERNAL mode, for which
        the phylink_generic_validate() will pass through all the MAC
        capabilities as ethtool link modes.
      
        Hence, if we have PHY_INTERFACE_MODE_INTERNAL but supports_rgmii[]
        or supports_sgmii[] is non-zero, currently we do not get 1G speeds.
        With Vladimir's additional change, we will get 1G speeds.
      
        While it is not clear whether that can happen, I feel changing the
        decision making should be a separate patch.
      
      * The decision for MAC_2500FD is made differently -
        sja1105_init_mii_settings() allows PHY_INTERFACE_MODE_2500BASEX
        when supports_2500basex[] is non-zero, and is not based on any other
        condition such as supports_sgmii[] or supports_rgmii[]. Vladimir's
        patch makes it additionally conditional on those supports_.gmii[]
        settings, which is a functional change that should be made in a
        separate patch - and if desired, then sja1105_init_mii_settings()
        should also be updated at the same time.
      
      Consequently, I believe that my previous objections to Vladimir's
      single patch approach are well founded and justified, even through
      Vladimir is the maintainer of this driver. I have no objection to
      the additional changes, I just don't think they should all be wrapped
      up into a single patch that converts the way validation is done _and_
      also makes a bunch of other functional changes.
      
      RFC->non-RFC: added Vladimir's Reviewed-by's, fixed the typo in the
      commit message of patch 6, and removed the phrase at the end of a
      comment as requested.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ebaaa69
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: support switching between SGMII and 2500BASE-X · 83dc4c2a
      Russell King (Oracle) authored
      Vladimir Oltean suggests that sja1105 can support switching between
      SGMII and 2500BASE-X modes. Augment sja1105_phylink_get_caps() to
      fill in both interface modes if they can be supported.
      Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      83dc4c2a
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: convert to phylink_generic_validate() · 9c318be1
      Russell King (Oracle) authored
      Populate the MAC capabilities for the SJA1105 DSA switch using the same
      decision making which sja1105_phylink_validate() uses. Remove the now
      obsolete sja1105_phylink_validate() implementation to allow DSA to use
      phylink_generic_validate() for this switch driver.
      
      As noted by Vladimir, this fixes an inconsequential bug which allowed
      gigabit and lower interface modes to be indicated when operating in
      2500base-X mode.
      Reviewed-by: default avatarVladimir Oltean &lt;olteanv@gmail.com&gt;                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c318be1
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: mark as non-legacy · 2d1d548e
      Russell King (Oracle) authored
      The sja1105 DSA driver does not have a phylink_mac_config() method
      implementation, it is safe to mark this as a non-legacy driver.
      Reviewed-by: default avatarVladimir Oltean &lt;olteanv@gmail.com&gt;                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d1d548e
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: use .mac_select_pcs() interface · 827b4ef2
      Russell King (Oracle) authored
      Convert the PCS selection to use mac_select_pcs, which allows the PCS
      to perform any validation it needs, and removes the need to set the PCS
      in the mac_config() callback, delving into the higher DSA levels to do
      so.
      Reviewed-by: default avatarVladimir Oltean &lt;olteanv@gmail.com&gt;                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      827b4ef2
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: remove interface checks · c2b8e1e3
      Russell King (Oracle) authored
      When the supported interfaces bitmap is populated, phylink will itself
      check that the interface mode is present in this bitmap. Drivers no
      longer need to perform this check themselves. Remove these checks.
      Reviewed-by: default avatarVladimir Oltean &lt;olteanv@gmail.com&gt;                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c2b8e1e3
    • Russell King (Oracle)'s avatar
      net: dsa: sja1105: populate supported_interfaces · a420b757
      Russell King (Oracle) authored
      Populate the supported interfaces bitmap for the SJA1105 DSA switch.
      
      This switch only supports a static model of configuration, so we
      restrict the interface modes to the configured setting.
      Reviewed-by: default avatarVladimir Oltean &lt;olteanv@gmail.com&gt;                                Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Vladimir Oltean <vladimir.    │
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a420b757
    • Toms Atteka's avatar
      net: openvswitch: IPv6: Add IPv6 extension header support · 28a3f060
      Toms Atteka authored
      This change adds a new OpenFlow field OFPXMT_OFB_IPV6_EXTHDR and
      packets can be filtered using ipv6_ext flag.
      Signed-off-by: default avatarToms Atteka <cpp.code.lv@gmail.com>
      Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28a3f060
    • Jakub Kicinski's avatar
      Merge branch 'nfp-flow-independent-tc-action-hardware-offload' · a46e3d5e
      Jakub Kicinski authored
      Simon Horman says:
      
      ====================
      nfp: flow-independent tc action hardware offload
      
      Baowen Zheng says:
      
      Allow nfp NIC to offload tc actions independent of flows.
      
      The motivation for this work is to offload tc actions independent of flows
      for nfp NIC. We allow nfp driver to provide hardware offload of OVS
      metering feature - which calls for policers that may be used by multiple
      flows and whose lifecycle is independent of any flows that use them.
      
      When nfp driver tries to offload a flow table using the independent action,
      the driver will search if the action is already offloaded to the hardware.
      If not, the flow table offload will fail.
      
      When the nfp NIC successes to offload an action, the user can check
      in_hw_count when dumping the tc action.
      
      Tc cli command to offload and dump an action:
      
       # tc actions add action police rate 100mbit burst 10000k index 200 skip_sw
      
       # tc -s -d actions list action police
      
       total acts 1
      
            action order 0:  police 0xc8 rate 100Mbit burst 10000Kb mtu 2Kb action reclassify
            overhead 0b linklayer ethernet
            ref 1 bind 0  installed 142 sec used 0 sec
            Action statistics:
            Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
            backlog 0b 0p requeues 0
            skip_sw in_hw in_hw_count 1
            used_hw_stats delayed
      ====================
      
      Link: https://lore.kernel.org/r/20220223162302.97609-1-simon.horman@corigine.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a46e3d5e
    • Baowen Zheng's avatar
      nfp: add NFP_FL_FEATS_QOS_METER to host features to enable meter offload · 5e98743c
      Baowen Zheng authored
      Add NFP_FL_FEATS_QOS_METER to host features to enable meter
      offload in driver.
      
      Before adding this feature, we will not offload any police action
      since we will check the host features before offloading any police
      action.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5e98743c
    • Baowen Zheng's avatar
      nfp: add support to offload police action from flower table · 147747ec
      Baowen Zheng authored
      Offload flow table if the action is already offloaded to hardware when
      flow table uses this action.
      
      Change meter id to type of u32 to support all the action index.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      147747ec
    • Baowen Zheng's avatar
      nfp: add process to get action stats from hardware · 776178a5
      Baowen Zheng authored
      Add a process to update action stats from hardware.
      
      This stats data will be updated to tc action when dumping actions
      or filters.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      776178a5
    • Baowen Zheng's avatar
      nfp: add hash table to store meter table · 26ff98d7
      Baowen Zheng authored
      Add a hash table to store meter table.
      
      This meter table will also be used by flower action.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      26ff98d7
    • Baowen Zheng's avatar
      nfp: add support to offload tc action to hardware · 59080da0
      Baowen Zheng authored
      Add process to offload tc action to hardware.
      
      Currently we only support to offload police action.
      
      Add meter capability to check if firmware supports
      meter offload.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      59080da0
    • Baowen Zheng's avatar
      nfp: refactor policer config to support ingress/egress meter · bbab5f93
      Baowen Zheng authored
      Add an policer API to support ingress/egress meter.
      
      Change ingress police to compatible with the new API.
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bbab5f93
    • Dmitry Safonov's avatar
      net/tcp: Merge TCP-MD5 inbound callbacks · 7bbb765b
      Dmitry Safonov authored
      The functions do essentially the same work to verify TCP-MD5 sign.
      Code can be merged into one family-independent function in order to
      reduce copy'n'paste and generated code.
      Later with TCP-AO option added, this will allow to create one function
      that's responsible for segment verification, that will have all the
      different checks for MD5/AO/non-signed packets, which in turn will help
      to see checks for all corner-cases in one function, rather than spread
      around different families and functions.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20220223175740.452397-1-dima@arista.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7bbb765b
    • Jakub Kicinski's avatar
      Merge branch 'fdb-entries-on-dsa-lag-interfaces' · 53110c67
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      FDB entries on DSA LAG interfaces
      
      This work permits having static and local FDB entries on LAG interfaces
      that are offloaded by DSA ports. New API needs to be introduced in
      drivers. To maintain consistency with the bridging offload code, I've
      taken the liberty to reorganize the data structures added by Tobias in
      the DSA core a little bit.
      
      Tested on NXP LS1028A (felix switch). Would appreciate feedback/testing
      on other platforms too. Testing procedure was the one described here:
      https://patchwork.kernel.org/project/netdevbpf/cover/20210205130240.4072854-1-vladimir.oltean@nxp.com/
      
      with this script:
      
      ip link del bond0
      ip link add bond0 type bond mode 802.3ad
      ip link set swp1 down && ip link set swp1 master bond0 && ip link set swp1 up
      ip link set swp2 down && ip link set swp2 master bond0 && ip link set swp2 up
      ip link del br0
      ip link add br0 type bridge && ip link set br0 up
      ip link set br0 arp off
      ip link set bond0 master br0 && ip link set bond0 up
      ip link set swp0 master br0 && ip link set swp0 up
      ip link set dev bond0 type bridge_slave flood off learning off
      bridge fdb add dev bond0 <mac address of other eno0> master static
      
      I'm noticing a problem in 'bridge fdb dump' with the 'self' entries, and
      I didn't solve this. On Ocelot, an entry learned on a LAG is reported as
      being on the first member port of it (so instead of saying 'self bond0',
      it says 'self swp1'). This is better than not seeing the entry at all,
      but when DSA queries for the FDBs on a port via ds->ops->port_fdb_dump,
      it never queries for FDBs on a LAG. Not clear what we should do there,
      we aren't in control of the ->ndo_fdb_dump of the bonding/team drivers.
      Alternatively, we could just consider the 'self' entries reported via
      ndo_fdb_dump as "better than nothing", and concentrate on the 'master'
      entries that are in sync with the bridge when packets are flooded to
      software.
      ====================
      
      Link: https://lore.kernel.org/r/20220223140054.3379617-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      53110c67
    • Vladimir Oltean's avatar
      net: dsa: felix: support FDB entries on offloaded LAG interfaces · 961d8b69
      Vladimir Oltean authored
      This adds the logic in the Felix DSA driver and Ocelot switch library.
      For Ocelot switches, the DEST_IDX that is the output of the MAC table
      lookup is a logical port (equal to physical port, if no LAG is used, or
      a dynamically allocated number otherwise). The allocation we have in
      place for LAG IDs is different from DSA's, so we can't use that:
      - DSA allocates a continuous range of LAG IDs starting from 1
      - Ocelot appears to require that physical ports and LAG IDs are in the
        same space of [0, num_phys_ports), and additionally, ports that aren't
        in a LAG must have physical port id == logical port id
      
      The implication is that an FDB entry towards a LAG might need to be
      deleted and reinstalled when the LAG ID changes.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      961d8b69
    • Vladimir Oltean's avatar
      net: dsa: support FDB events on offloaded LAG interfaces · e212fa7c
      Vladimir Oltean authored
      This change introduces support for installing static FDB entries towards
      a bridge port that is a LAG of multiple DSA switch ports, as well as
      support for filtering towards the CPU local FDB entries emitted for LAG
      interfaces that are bridge ports.
      
      Conceptually, host addresses on LAG ports are identical to what we do
      for plain bridge ports. Whereas FDB entries _towards_ a LAG can't simply
      be replicated towards all member ports like we do for multicast, or VLAN.
      Instead we need new driver API. Hardware usually considers a LAG to be a
      "logical port", and sets the entire LAG as the forwarding destination.
      The physical egress port selection within the LAG is made by hashing
      policy, as usual.
      
      To represent the logical port corresponding to the LAG, we pass by value
      a copy of the dsa_lag structure to all switches in the tree that have at
      least one port in that LAG.
      
      To illustrate why a refcounted list of FDB entries is needed in struct
      dsa_lag, it is enough to say that:
      - a LAG may be a bridge port and may therefore receive FDB events even
        while it isn't yet offloaded by any DSA interface
      - DSA interfaces may be removed from a LAG while that is a bridge port;
        we don't want FDB entries lingering around, but we don't want to
        remove entries that are still in use, either
      
      For all the cases below to work, the idea is to always keep an FDB entry
      on a LAG with a reference count equal to the DSA member ports. So:
      - if a port joins a LAG, it requests the bridge to replay the FDB, and
        the FDB entries get created, or their refcount gets bumped by one
      - if a port leaves a LAG, the FDB replay deletes or decrements refcount
        by one
      - if an FDB is installed towards a LAG with ports already present, that
        entry is created (if it doesn't exist) and its refcount is bumped by
        the amount of ports already present in the LAG
      
      echo "Adding FDB entry to bond with existing ports"
      ip link del bond0
      ip link add bond0 type bond mode 802.3ad
      ip link set swp1 down && ip link set swp1 master bond0 && ip link set swp1 up
      ip link set swp2 down && ip link set swp2 master bond0 && ip link set swp2 up
      ip link del br0
      ip link add br0 type bridge
      ip link set bond0 master br0
      bridge fdb add dev bond0 00:01:02:03:04:05 master static
      
      ip link del br0
      ip link del bond0
      
      echo "Adding FDB entry to empty bond"
      ip link del bond0
      ip link add bond0 type bond mode 802.3ad
      ip link del br0
      ip link add br0 type bridge
      ip link set bond0 master br0
      bridge fdb add dev bond0 00:01:02:03:04:05 master static
      ip link set swp1 down && ip link set swp1 master bond0 && ip link set swp1 up
      ip link set swp2 down && ip link set swp2 master bond0 && ip link set swp2 up
      
      ip link del br0
      ip link del bond0
      
      echo "Adding FDB entry to empty bond, then removing ports one by one"
      ip link del bond0
      ip link add bond0 type bond mode 802.3ad
      ip link del br0
      ip link add br0 type bridge
      ip link set bond0 master br0
      bridge fdb add dev bond0 00:01:02:03:04:05 master static
      ip link set swp1 down && ip link set swp1 master bond0 && ip link set swp1 up
      ip link set swp2 down && ip link set swp2 master bond0 && ip link set swp2 up
      
      ip link set swp1 nomaster
      ip link set swp2 nomaster
      ip link del br0
      ip link del bond0
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e212fa7c
    • Vladimir Oltean's avatar
      net: dsa: call SWITCHDEV_FDB_OFFLOADED for the orig_dev · 93c79823
      Vladimir Oltean authored
      When switchdev_handle_fdb_event_to_device() replicates a FDB event
      emitted for the bridge or for a LAG port and DSA offloads that, we
      should notify back to switchdev that the FDB entry on the original
      device is what was offloaded, not on the DSA slave devices that the
      event is replicated on.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      93c79823
    • Vladimir Oltean's avatar
      net: dsa: remove "ds" and "port" from struct dsa_switchdev_event_work · e35f12e9
      Vladimir Oltean authored
      By construction, the struct net_device *dev passed to
      dsa_slave_switchdev_event_work() via struct dsa_switchdev_event_work
      is always a DSA slave device.
      
      Therefore, it is redundant to pass struct dsa_switch and int port
      information in the deferred work structure. This can be retrieved at all
      times from the provided struct net_device via dsa_slave_to_port().
      
      For the same reason, we can drop the dsa_is_user_port() check in
      dsa_fdb_offload_notify().
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e35f12e9
    • Vladimir Oltean's avatar
      net: switchdev: remove lag_mod_cb from switchdev_handle_fdb_event_to_device · ec638740
      Vladimir Oltean authored
      When the switchdev_handle_fdb_event_to_device() event replication helper
      was created, my original thought was that FDB events on LAG interfaces
      should most likely be special-cased, not just replicated towards all
      switchdev ports beneath that LAG. So this replication helper currently
      does not recurse through switchdev lower interfaces of LAG bridge ports,
      but rather calls the lag_mod_cb() if that was provided.
      
      No switchdev driver uses this helper for FDB events on LAG interfaces
      yet, so that was an assumption which was yet to be tested. It is
      certainly usable for that purpose, as my RFC series shows:
      
      https://patchwork.kernel.org/project/netdevbpf/cover/20220210125201.2859463-1-vladimir.oltean@nxp.com/
      
      however this approach is slightly convoluted because:
      
      - the switchdev driver gets a "dev" that isn't its own net device, but
        rather the LAG net device. It must call switchdev_lower_dev_find(dev)
        in order to get a handle of any of its own net devices (the ones that
        pass check_cb).
      
      - in order for FDB entries on LAG ports to be correctly refcounted per
        the number of switchdev ports beneath that LAG, we haven't escaped the
        need to iterate through the LAG's lower interfaces. Except that is now
        the responsibility of the switchdev driver, because the replication
        helper just stopped half-way.
      
      So, even though yes, FDB events on LAG bridge ports must be
      special-cased, in the end it's simpler to let switchdev_handle_fdb_*
      just iterate through the LAG port's switchdev lowers, and let the
      switchdev driver figure out that those physical ports are under a LAG.
      
      The switchdev_handle_fdb_event_to_device() helper takes a
      "foreign_dev_check" callback so it can figure out whether @dev can
      autonomously forward to @foreign_dev. DSA fills this method properly:
      if the LAG is offloaded by another port in the same tree as @dev, then
      it isn't foreign. If it is a software LAG, it is foreign - forwarding
      happens in software.
      
      Whether an interface is foreign or not decides whether the replication
      helper will go through the LAG's switchdev lowers or not. Since the
      lan966x doesn't properly fill this out, FDB events on software LAG
      uppers will get called. By changing lan966x_foreign_dev_check(), we can
      suppress them.
      
      Whereas DSA will now start receiving FDB events for its offloaded LAG
      uppers, so we need to return -EOPNOTSUPP, since we currently don't do
      the right thing for them.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec638740
    • Vladimir Oltean's avatar
      net: dsa: create a dsa_lag structure · dedd6a00
      Vladimir Oltean authored
      The main purpose of this change is to create a data structure for a LAG
      as seen by DSA. This is similar to what we have for bridging - we pass a
      copy of this structure by value to ->port_lag_join and ->port_lag_leave.
      For now we keep the lag_dev, id and a reference count in it. Future
      patches will add a list of FDB entries for the LAG (these also need to
      be refcounted to work properly).
      
      The LAG structure is created using dsa_port_lag_create() and destroyed
      using dsa_port_lag_destroy(), just like we have for bridging.
      
      Because now, the dsa_lag itself is refcounted, we can simplify
      dsa_lag_map() and dsa_lag_unmap(). These functions need to keep a LAG in
      the dst->lags array only as long as at least one port uses it. The
      refcounting logic inside those functions can be removed now - they are
      called only when we should perform the operation.
      
      dsa_lag_dev() is renamed to dsa_lag_by_id() and now returns the dsa_lag
      structure instead of the lag_dev net_device.
      
      dsa_lag_foreach_port() now takes the dsa_lag structure as argument.
      
      dst->lags holds an array of dsa_lag structures.
      
      dsa_lag_map() now also saves the dsa_lag->id value, so that linear
      walking of dst->lags in drivers using dsa_lag_id() is no longer
      necessary. They can just look at lag.id.
      
      dsa_port_lag_id_get() is a helper, similar to dsa_port_bridge_num_get(),
      which can be used by drivers to get the LAG ID assigned by DSA to a
      given port.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dedd6a00
    • Vladimir Oltean's avatar
      net: dsa: mv88e6xxx: use dsa_switch_for_each_port in mv88e6xxx_lag_sync_masks · b99dbdf0
      Vladimir Oltean authored
      Make the intent of the code more clear by using the dedicated helper for
      iterating over the ports of a switch.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b99dbdf0