1. 14 Mar, 2022 13 commits
    • Ioana Ciornei's avatar
      dpaa2-mac: add the MC API for reconfiguring the protocol · 332b9ea5
      Ioana Ciornei authored
      The MC firmware gained recently a new command which can reconfigure the
      running protocol on the underlying MAC. Add this new command which will
      be used in the next patches in order to do a major reconfig on the
      interface.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      332b9ea5
    • Ioana Ciornei's avatar
      dpaa2-mac: add the MC API for retrieving the version · 38d28b02
      Ioana Ciornei authored
      The dpmac_get_api_version command will be used in the next patches to
      determine if the current firmware is capable or not to change the
      Ethernet protocol running on the MAC.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38d28b02
    • Ioana Ciornei's avatar
      dt-bindings: phy: add bindings for Lynx 28G PHY · c553f22e
      Ioana Ciornei authored
      Add device tree binding for the Lynx 28G SerDes PHY driver used on
      Layerscape based SoCs.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c553f22e
    • Ioana Ciornei's avatar
      phy: add support for the Layerscape SerDes 28G · 8f73b37c
      Ioana Ciornei authored
      This patch adds a new generic PHY driver to support the Lynx 28G SerDes
      block found on some of the Layerscape SoCs such as LX2160A.
      At the moment, only the following Ethernet protocols are supported:
      SGMII/1000Base-X and 10GBaseR.
      
      SerDes lanes which are not running an Ethernet protocol or a currently
      supported Ethenet protocol will be left as it was configured through the
      RCW (Reset Configuration Word) at boot time.
      
      At probe time, the platform driver will read the current
      configuration of both PLLs found on a SerDes block and will determine
      what protocols are supported using that PLL.
      
      For example, if a PLL is configured to generate a clock net (frate) of
      5GHz the only protocols sustained by that PLL are SGMII/1000Base-X
      (using a quarter of the full clock rate) and QSGMII using the full clock
      net frequency on the lane.
      
      On the .set_mode() callback, the PHY driver will first check if the
      requested operating mode (protocol) is even supported by the current PLL
      configuration and will error out if not.
      Then, the lane is reconfigured to run on the requested protocol.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f73b37c
    • David S. Miller's avatar
      Merge branch 'dsa-felix-qos' · 92ebb236
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Basic QoS classification on Felix DSA switch using dcbnl
      
      Basic QoS classification for Ocelot switches means port-based default
      priority, DSCP-based and VLAN PCP based. This is opposed to advanced QoS
      classification which is done through the VCAP IS1 TCAM based engine.
      
      The patch set is a logical continuation of this RFC which attempted to
      describe the default-prio as a matchall entry placed at the end of a
      series of offloaded tc filters:
      https://patchwork.kernel.org/project/netdevbpf/cover/20210113154139.1803705-1-olteanv@gmail.com/
      
      I have tried my best to satisfy the feedback that we should cater for
      pre-configured QoS profiles. Ironically, the only pre-configured QoS
      profile that the Felix switch driver has is for VLAN PCP (1:1 mapping
      with QoS class), yet IEEE 802.1Q or dcbnl offer no mechanism for
      reporting or changing that.
      
      Testing was done with the iproute2 dcb app. The qos_class of packets was
      dumped from net/dsa/tag_ocelot.c.
      
      (1) $ dcb app show dev swp3
      default-prio 0
      (2) $ dcb app replace dev swp3 default-prio 3
      (3) $ dcb app replace dev swp3 dscp-prio CS3:5
      (4) $ dcb app replace dev swp3 dscp-prio CS2:2
      (5) $ dcb app show dev swp3
      default-prio 3
      dscp-prio CS2:2 CS3:5
      
      Traffic sent with "ping -Q 64 <ipaddr>", which means CS2.
      These packets match qos_class 0 after command (1),
      qos_class 3 after command (2),
      qos_class 3 after command (3), and
      qos_class 2 after command (2).
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      92ebb236
    • Vladimir Oltean's avatar
      net: dsa: felix: configure default-prio and dscp priorities · 978777d0
      Vladimir Oltean authored
      Follow the established programming model for this driver and provide
      shims in the felix DSA driver which call the implementations from the
      ocelot switch lib. The ocelot switchdev driver wasn't integrated with
      dcbnl due to lack of hardware availability.
      
      The switch doesn't have any fancy QoS classification enabled by default.
      The provided getters will create a default-prio app table entry of 0,
      and no dscp entry. However, the getters have been made to actually
      retrieve the hardware configuration rather than static values, to be
      future proof in case DSA will need this information from more call paths.
      
      For default-prio, there is a single field per port, in ANA_PORT_QOS_CFG,
      called QOS_DEFAULT_VAL.
      
      DSCP classification is enabled per-port, again via ANA_PORT_QOS_CFG
      (field QOS_DSCP_ENA), and individual DSCP values are configured as
      trusted or not through register ANA_DSCP_CFG (replicated 64 times).
      An untrusted DSCP value falls back to other QoS classification methods.
      If trusted, the selected ANA_DSCP_CFG register also holds the QoS class
      in the QOS_DSCP_VAL field.
      
      The hardware also supports DSCP remapping (DSCP value X is translated to
      DSCP value Y before the QoS class is determined based on the app table
      entry for Y) and DSCP packet rewriting. The dcbnl framework, for being
      so flexible in other useless areas, doesn't appear to support this.
      So this functionality has been left out.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      978777d0
    • Vladimir Oltean's avatar
      net: dsa: report and change port dscp priority using dcbnl · 47d75f78
      Vladimir Oltean authored
      Similar to the port-based default priority, IEEE 802.1Q-2018 allows the
      Application Priority Table to define QoS classes (0 to 7) per IP DSCP
      value (0 to 63).
      
      In the absence of an app table entry for a packet with DSCP value X,
      QoS classification for that packet falls back to other methods (VLAN PCP
      or port-based default). The presence of an app table for DSCP value X
      with priority Y makes the hardware classify the packet to QoS class Y.
      
      As opposed to the default-prio where DSA exposes only a "set" in
      dsa_switch_ops (because the port-based default is the fallback, it
      always exists, either implicitly or explicitly), for DSCP priorities we
      expose an "add" and a "del". The addition of a DSCP entry means trusting
      that DSCP priority, the deletion means ignoring it.
      
      Drivers that already trust (at least some) DSCP values can describe
      their configuration in dsa_switch_ops :: port_get_dscp_prio(), which is
      called for each DSCP value from 0 to 63.
      
      Again, there can be more than one dcbnl app table entry for the same
      DSCP value, DSA chooses the one with the largest configured priority.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      47d75f78
    • Vladimir Oltean's avatar
      net: dsa: report and change port default priority using dcbnl · d538eca8
      Vladimir Oltean authored
      The port-based default QoS class is assigned to packets that lack a
      VLAN PCP (or the port is configured to not trust the VLAN PCP),
      an IP DSCP (or the port is configured to not trust IP DSCP), and packets
      on which no tc-skbedit action has matched.
      
      Similar to other drivers, this can be exposed to user space using the
      DCB Application Priority Table. IEEE 802.1Q-2018 specifies in Table
      D-8 - Sel field values that when the Selector is 1, the Protocol ID
      value of 0 denotes the "Default application priority. For use when
      application priority is not otherwise specified."
      
      The way in which the dcbnl integration in DSA has been designed has to
      do with its requirements. Andrew Lunn explains that SOHO switches are
      expected to come with some sort of pre-configured QoS profile, and that
      it is desirable for this to come pre-loaded into the DSA slave interfaces'
      DCB application priority table.
      
      In the dcbnl design, this is possible because calls to dcb_ieee_setapp()
      can be initiated by anyone including being self-initiated by this device
      driver.
      
      However, what makes this challenging to implement in DSA is that the DSA
      core manages the net_devices (effectively hiding them from drivers),
      while drivers manage the hardware. The DSA core has no knowledge of what
      individual drivers' QoS policies are. DSA could export to drivers a
      wrapper over dcb_ieee_setapp() and these could call that function to
      pre-populate the app priority table, however drivers don't have a good
      moment in time to do this. The dsa_switch_ops :: setup() method gets
      called before the net_devices are created (dsa_slave_create), and so is
      dsa_switch_ops :: port_setup(). What remains is dsa_switch_ops ::
      port_enable(), but this gets called upon each ndo_open. If we add app
      table entries on every open, we'd need to remove them on close, to avoid
      duplicate entry errors. But if we delete app priority entries on close,
      what we delete may not be the initial, driver pre-populated entries, but
      rather user-added entries.
      
      So it is clear that letting drivers choose the timing of the
      dcb_ieee_setapp() call is inappropriate. The alternative which was
      chosen is to introduce hardware-specific ops in dsa_switch_ops, and
      effectively hide dcbnl details from drivers as well. For pre-populating
      the application table, dsa_slave_dcbnl_init() will call
      ds->ops->port_get_default_prio() which is supposed to read from
      hardware. If the operation succeeds, DSA creates a default-prio app
      table entry. The method is called as soon as the slave_dev is
      registered, but before we release the rtnl_mutex. This is done such that
      user space sees the app table entries as soon as it sees the interface
      being registered.
      
      The fact that we populate slave_dev->dcbnl_ops with a non-NULL pointer
      changes behavior in dcb_doit() from net/dcb/dcbnl.c, which used to
      return -EOPNOTSUPP for any dcbnl operation where netdev->dcbnl_ops is
      NULL. Because there are still dcbnl-unaware DSA drivers even if they
      have dcbnl_ops populated, the way to restore the behavior is to make all
      dcbnl_ops return -EOPNOTSUPP on absence of the hardware-specific
      dsa_switch_ops method.
      
      The dcbnl framework absurdly allows there to be more than one app table
      entry for the same selector and protocol (in other words, more than one
      port-based default priority). In the iproute2 dcb program, there is a
      "replace" syntactical sugar command which performs an "add" and a "del"
      to hide this away. But we choose the largest configured priority when we
      call ds->ops->port_set_default_prio(), using __fls(). When there is no
      default-prio app table entry left, the port-default priority is restored
      to 0.
      
      Link: https://patchwork.kernel.org/project/netdevbpf/patch/20210113154139.1803705-2-olteanv@gmail.com/Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d538eca8
    • Victor Nogueira's avatar
      selftests: tc-testing: Increase timeout in tdc config file · 102e4a8e
      Victor Nogueira authored
      Some tests, such as Test d052: Add 1M filters with the same action, may
      not work with a small timeout value.
      
      Increase timeout to 24 seconds.
      Signed-off-by: default avatarVictor Nogueira <victor@mojatatu.com>
      Acked-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      102e4a8e
    • Sebastian Andrzej Siewior's avatar
      net: Add lockdep asserts to ____napi_schedule(). · fbd9a2ce
      Sebastian Andrzej Siewior authored
      ____napi_schedule() needs to be invoked with disabled interrupts due to
      __raise_softirq_irqoff (in order not to corrupt the per-CPU list).
      ____napi_schedule() needs also to be invoked from an interrupt context
      so that the raised-softirq is processed while the interrupt context is
      left.
      
      Add lockdep asserts for both conditions.
      While this is the second time the irq/softirq check is needed, provide a
      generic lockdep_assert_softirq_will_run() which is used by both caller.
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fbd9a2ce
    • David S. Miller's avatar
      Merge branch 'macvlan-uaf' · d96657dc
      David S. Miller authored
      Ziyang Xuan says:
      
      ====================
      net: macvlan: fix potential UAF problem for lowerdev
      
      Add the reference operation to lowerdev of macvlan to avoid
      the potential UAF problem under the following known scenario:
      
      Someone module puts the NETDEV_UNREGISTER event handler to a
      work, and lowerdev is accessed in the work handler. But when
      the work is excuted, lowerdev has been destroyed because upper
      macvlan did not get reference to lowerdev correctly.
      
      In addition, add net device refcount tracker to macvlan.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d96657dc
    • Ziyang Xuan's avatar
      net: macvlan: add net device refcount tracker · 1f4a5983
      Ziyang Xuan authored
      Add net device refcount tracker to macvlan.
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f4a5983
    • Ziyang Xuan's avatar
      net: macvlan: fix potential UAF problem for lowerdev · 291ac684
      Ziyang Xuan authored
      Add the reference operation to lowerdev of macvlan to avoid
      the potential UAF problem under the following known scenario:
      
      Someone module puts the NETDEV_UNREGISTER event handler to a
      work, and lowerdev is accessed in the work handler. But when
      the work is excuted, lowerdev has been destroyed because upper
      macvlan did not get reference to lowerdev correctly.
      
      That likes as the scenario occurred by
      commit 563bcbae ("net: vlan: fix a UAF in vlan_dev_real_dev()").
      Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      291ac684
  2. 13 Mar, 2022 14 commits
  3. 12 Mar, 2022 13 commits