1. 27 Feb, 2022 6 commits
  2. 26 Feb, 2022 15 commits
  3. 25 Feb, 2022 19 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