Skip to content
Snippets Groups Projects
  1. Aug 22, 2021
  2. Aug 20, 2021
    • Sunil Goutham's avatar
      octeontx2-pf: Add check for non zero mcam flows · a515e5b5
      Sunil Goutham authored
      
      This patch ensures that mcam flows are allocated
      before adding or destroying the flows.
      
      Signed-off-by: default avatarSunil Goutham <sgoutham@marvell.com>
      Signed-off-by: default avatarSubbaraya Sundeep <sbhatta@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a515e5b5
    • Alex Elder's avatar
      net: ipa: kill ipa_clock_get() · c3f115aa
      Alex Elder authored
      
      The only remaining user of the ipa_clock_{get,put}() interface is
      ipa_isr_thread().  Replace calls to ipa_clock_get() there calling
      pm_runtime_get_sync() instead.  And call pm_runtime_put() there
      rather than ipa_clock_put().  Warn if we ever get an error.
      
      With that, we can get rid of ipa_clock_get() and ipa_clock_put().
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c3f115aa
    • Alex Elder's avatar
      net: ipa: don't use ipa_clock_get() in "ipa_modem.c" · 724c2d74
      Alex Elder authored
      
      When we open or close the modem network device we need to ensure the
      hardware is powered.  Replace the callers of ipa_clock_get() found
      in ipa_open() and ipa_stop() with calls to pm_runtime_get_sync().
      If an error is returned, simply return that error to the caller
      (without any error or warning message).  This could conceivably
      occur if the function was called while the system was suspended,
      but that really shouldn't happen.  Replace corresponding calls to
      ipa_clock_put() with pm_runtime_put() also.
      
      If the modem crashes we also need to ensure the hardware is powered
      to recover.  If getting power returns an error there's not much we
      can do, but at least report the error.  (Ideally the remoteproc SSR
      code would ensure the AP was not suspended when it sends the
      notification, but that is not (yet) the case.)
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      724c2d74
    • Alex Elder's avatar
      net: ipa: don't use ipa_clock_get() in "ipa_uc.c" · 799c5c24
      Alex Elder authored
      
      Replace the ipa_clock_get() call in ipa_uc_clock() when taking the
      "proxy" clock reference for the microcontroller with a call to
      pm_runtime_get_sync().  Replace calls of ipa_clock_put() for the
      microcontroller with pm_runtime_put() calls instead.
      
      There is a chance we get an error when taking the microcontroller
      power reference.  This is an unlikely scenario, where system suspend
      is initiated just before we learn the modem is booting.  For now
      we'll just accept that this could occur, and report it if it does.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      799c5c24
    • Alex Elder's avatar
      net: ipa: don't use ipa_clock_get() in "ipa_smp2p.c" · c43adc75
      Alex Elder authored
      
      If the "modem-init" Device Tree property is present for a platform,
      the modem performs early IPA hardware initialization, and signals
      this is complete with an "ipa-setup-ready" SMP2P interrupt.  This
      triggers a call to ipa_setup(), which requires the hardware to be
      powered.
      
      Replace the call to ipa_clock_get() in this case with a call to
      pm_runtime_get_sync().  And replace the corresponding calls to
      ipa_clock_put() with calls to pm_runtime_put() instead.
      
      There is a chance we get an error when taking this power reference.
      This is an unlikely scenario, where system suspend is initiated just
      before the modem signals it has finished initializing the IPA
      hardware.  For now we'll just accept that this could occur, and
      report it if it does.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c43adc75
    • Alex Elder's avatar
      net: ipa: don't use ipa_clock_get() in "ipa_main.c" · 4c6a4da8
      Alex Elder authored
      
      We need the hardware to be powered starting at the config stage of
      initialization when the IPA driver probes.  And we need it powered
      when the driver is removed, at least until the deconfig stage has
      completed.
      
      Replace callers of ipa_clock_get() in ipa_probe() and ipa_exit(),
      calling pm_runtime_get_sync() instead.  Replace the corresponding
      callers of ipa_clock_put(), calling pm_runtime_put() instead.
      
      The only error we expect when getting power would occur when the
      system is suspended.  The ->probe and ->remove driver callbacks
      won't be called when suspended, so issue a WARN() call if an error
      is seen getting power.
      
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4c6a4da8
    • Alex Elder's avatar
      net: ipa: fix TX queue race · b8e36e13
      Alex Elder authored
      Jakub Kicinski pointed out a race condition in ipa_start_xmit() in a
      recently-accepted series of patches:
        https://lore.kernel.org/netdev/20210812195035.2816276-1-elder@linaro.org/
      
      
      We are stopping the modem TX queue in that function if the power
      state is not active.  We restart the TX queue again once hardware
      resume is complete.
      
        TX path                       Power Management
        -------                       ----------------
        pm_runtime_get(); no power    Start resume
        Stop TX queue                      ...
        pm_runtime_put()              Resume complete
        return NETDEV_TX_BUSY         Start TX queue
      
        pm_runtime_get()
        Power present, transmit
        pm_runtime_put()              (auto-suspend)
      
      The issue is that the power management (resume) activity and the
      network transmit activity can occur concurrently, and there's a
      chance the queue will be stopped *after* it has been started again.
      
        TX path                       Power Management
        -------                       ----------------
                                      Resume underway
        pm_runtime_get(); no power         ...
                                      Resume complete
                                      Start TX queue
        Stop TX queue       <-- No more transmits after this
        pm_runtime_put()
        return NETDEV_TX_BUSY
      
      We address this using a STARTED flag to indicate when the TX queue
      has been started from the resume path, and a spinlock to make the
      flag and queue updates happen atomically.
      
        TX path                       Power Management
        -------                       ----------------
                                      Resume underway
        pm_runtime_get(); no power    Resume complete
                                      start TX queue     \
        If STARTED flag is *not* set:                     > atomic
            Stop TX queue             set STARTED flag   /
        pm_runtime_put()
        return NETDEV_TX_BUSY
      
      A second flag is used to address a different race that involves
      another path requesting power.
      
        TX path            Other path              Power Management
        -------            ----------              ----------------
                           pm_runtime_get_sync()   Resume
                                                   Start TX queue   \ atomic
                                                   Set STARTED flag /
                           (do its thing)
                           pm_runtime_put()
                                                   (auto-suspend)
        pm_runtime_get()                           Mark delayed resume
        STARTED *is* set, so
          do *not* stop TX queue  <-- Queue should be stopped here
        pm_runtime_put()
        return NETDEV_TX_BUSY                      Suspend done, resume
                                                   Resume complete
        pm_runtime_get()
        Stop TX queue
          (STARTED is *not* set)                   Start TX queue   \ atomic
        pm_runtime_put()                           Set STARTED flag /
        return NETDEV_TX_BUSY
      
      So a STOPPED flag is set in the transmit path when it has stopped
      the TX queue, and this pair of operations is also protected by the
      spinlock.  The resume path only restarts the TX queue if the STOPPED
      flag is set.  This case isn't a major problem, but it avoids the
      "non-trivial amount of useless work" done by the networking stack
      when NETDEV_TX_BUSY is returned.
      
      Fixes: 6b51f802 ("net: ipa: ensure hardware has power in ipa_start_xmit()")
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b8e36e13
    • Vladimir Oltean's avatar
      net: mscc: ocelot: use helpers for port VLAN membership · bbf6a2d9
      Vladimir Oltean authored
      
      This is a mostly cosmetic patch that creates some helpers for accessing
      the VLAN table. These helpers are also a bit more careful in that they
      do not modify the ocelot->vlan_mask unless the hardware operation
      succeeded.
      
      Not all callers check the return value (the init code doesn't), but anyway.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bbf6a2d9
    • Vladimir Oltean's avatar
      net: mscc: ocelot: transmit the VLAN filtering restrictions via extack · 3b95d1b2
      Vladimir Oltean authored
      
      We need to transmit more restrictions in future patches, convert this
      one to netlink extack.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b95d1b2
    • Vladimir Oltean's avatar
      net: mscc: ocelot: transmit the "native VLAN" error via extack · 01af940e
      Vladimir Oltean authored
      
      We need to reject some more configurations in future patches, convert
      the existing one to netlink extack.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      01af940e
    • Vladimir Oltean's avatar
      net: mscc: ocelot: allow probing to continue with ports that fail to register · 5c8bb71d
      Vladimir Oltean authored
      
      The existing ocelot device trees, like ocelot_pcb123.dts for example,
      have SERDES ports (ports 4 and higher) that do not have status = "disabled";
      but on the other hand do not have a phy-handle or a fixed-link either.
      
      So from the perspective of phylink, they have broken DT bindings.
      
      Since the blamed commit, probing for the entire switch will fail when
      such a device tree binding is encountered on a port. There used to be
      this piece of code which skipped ports without a phy-handle:
      
      	phy_node = of_parse_phandle(portnp, "phy-handle", 0);
      	if (!phy_node)
      		continue;
      
      but now it is gone.
      
      Anyway, fixed-link setups are a thing which should work out of the box
      with phylink, so it would not be in the best interest of the driver to
      add that check back.
      
      Instead, let's look at what other drivers do. Since commit 86f8b1c0
      ("net: dsa: Do not make user port errors fatal"), DSA continues after a
      switch port fails to register, and works only with the ports that
      succeeded.
      
      We can achieve the same behavior in ocelot by unregistering the devlink
      port for ports where ocelot_port_phylink_create() failed (called via
      ocelot_probe_port), and clear the bit in devlink_ports_registered for
      that port. This will make the next iteration reconsider the port that
      failed to probe as an unused port, and re-register a devlink port of
      type UNUSED for it. No other cleanup should need to be performed, since
      ocelot_probe_port() should be self-contained when it fails.
      
      Fixes: e6e12df6 ("net: mscc: ocelot: convert to phylink")
      Reported-and-tested-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c8bb71d
    • Horatiu Vultur's avatar
      net: mscc: ocelot: be able to reuse a devlink_port after teardown · b5e33a15
      Horatiu Vultur authored
      
      There are cases where we would like to continue probing the switch even
      if one port has failed to probe. When that happens, we need to
      unregister a devlink_port of type DEVLINK_PORT_FLAVOUR_PHYSICAL and
      re-register it of type DEVLINK_PORT_FLAVOUR_UNUSED.
      
      This is fine, except when calling devlink_port_attrs_set on a structure
      on which devlink_port_register has been previously called, there is a
      WARN_ON in devlink_port_attrs_set that devlink_port->devlink must be
      NULL.
      
      So don't assume that the memory behind dlp is clean when calling
      ocelot_port_devlink_init, just zero-initialize it.
      
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5e33a15
    • Vladimir Oltean's avatar
      net: dpaa2-switch: call dpaa2_switch_port_disconnect_mac on probe error path · 860fe1f8
      Vladimir Oltean authored
      
      Currently when probing returns an error, the netdev is freed but
      phylink_disconnect is not called.
      
      Create a common function between the unbind path and the error path,
      call it the opposite of dpaa2_switch_probe_port: dpaa2_switch_remove_port,
      and call it from both the unbind and the error path.
      
      Fixes: 84cba729 ("dpaa2-switch: integrate the MAC endpoint support")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      860fe1f8
    • Vladimir Oltean's avatar
      net: dpaa2-switch: phylink_disconnect_phy needs rtnl_lock · d52ef12f
      Vladimir Oltean authored
      
      There is an ASSERT_RTNL in phylink_disconnect_phy which triggers
      whenever dpaa2_switch_port_disconnect_mac is called.
      
      To follow the pattern established by dpaa2_eth_disconnect_mac, take the
      rtnl_mutex every time we call dpaa2_switch_port_disconnect_mac.
      
      Fixes: 84cba729 ("dpaa2-switch: integrate the MAC endpoint support")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d52ef12f
    • Gerhard Engleder's avatar
      net: phy: gmii2rgmii: Support PHY loopback · ceaeaafc
      Gerhard Engleder authored
      
      Configure speed if loopback is used. read_status is not called for
      loopback.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ceaeaafc
    • Gerhard Engleder's avatar
      net: phy: Uniform PHY driver access · 3ac8eed6
      Gerhard Engleder authored
      
      struct phy_device contains a pointer to the PHY driver and nearly
      everywhere this pointer is used to access the PHY driver. Only
      mdio_bus_phy_may_suspend() is still using to_phy_driver() instead of the
      PHY driver pointer. Uniform PHY driver access by eliminating
      to_phy_driver() use in mdio_bus_phy_may_suspend().
      
      Only phy_bus_match() and phy_probe() are still using to_phy_driver(),
      because PHY driver pointer is not available there.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ac8eed6
    • Gerhard Engleder's avatar
      net: phy: Support set_loopback override · 4ed311b0
      Gerhard Engleder authored
      
      phy_read_status and various other PHY functions support PHY specific
      overriding of driver functions by using a PHY specific pointer to the
      PHY driver. Add support of PHY specific override to phy_loopback too.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ed311b0
    • Steen Hegelund's avatar
      net: sparx5: switchdev: adding frame DMA functionality · 10615907
      Steen Hegelund authored
      
      This add frame DMA functionality to the Sparx5 platform.
      
      Ethernet frames can be extracted or injected autonomously to or from the
      device’s DDR3/DDR3L memory and/or PCIe memory space. Linked list data
      structures in memory are used for injecting or extracting Ethernet frames.
      The FDMA generates interrupts when frame extraction or injection is done
      and when the linked lists need updating.
      
      The FDMA implements two extraction channels, one per switch core port
      towards the VCore CPU system and a total of six injection channels.
      Extraction channels are mapped one-to-one to the CPU ports, while injection
      channels can be individually assigned to any CPU port.
      
      - FDMA channel 0 through 5 corresponds to CPU port 0 injection direction
        FDMA_CH_CFG[channel].CH_INJ_PORT is set to 0.
      - FDMA channel 0 through 5 corresponds to CPU port 1 injection direction when
        FDMA_CH_CFG[channel].CH_INJ_PORT is set to 1.
      - FDMA channel 6 corresponds to CPU port 0 extraction direction.
      - FDMA channel 7 corresponds to CPU port 1 extraction direction.
      
      The FDMA implements a strict priority scheme among channels. Extraction
      channels are prioritized over injection channels and secondarily channels
      with higher channel number are prioritized over channels with lower number.
      On the other hand, ports are being served on an equal-bandwidth principle
      both on injection and extraction directions.  The equal-bandwidth principle
      will not force an equal bandwidth. Instead, it ensures that the ports
      perform at their best considering the operating conditions.
      
      When more than one injection channel is enabled for injection on the same
      CPU port, priority determines which channel can inject data. Ownership
      is re-arbitrated on frame boundaries.
      
      The FDMA processes linked lists of DMA Control Block Structures (DCBs). The
      DCBs have the same basic structure for both injection and extraction. A DCB
      must be placed on a 64-bit word-aligned address in memory. Each DCB has a
      per-channel configurable amount of associated data blocks in memory, where
      the frame data is stored.
      
      The data blocks that are used by extraction channels must be placed on
      64-bit word aligned addresses in memory, and their length must be a
      multiple of 128 bytes.
      
      A DCB carries the pointer to the next DCB of the linked list, the INFO word
      which holds information for the DCB, and a pair of status word and memory
      pointer for every data block that it is associated with.
      
      Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      10615907
    • Dmytro Linkin's avatar
      net/mlx5: E-switch, Add QoS tracepoints · 3202ea65
      Dmytro Linkin authored
      
      Add tracepoints to log QoS enabling/disabling/configuration for vports
      and rate groups.
      
      Signed-off-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
      Reviewed-by: default avatarHuy Nguyen <huyn@nvidia.com>
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      3202ea65
    • Dmytro Linkin's avatar
      net/mlx5: E-switch, Allow to add vports to rate groups · 0fe132ea
      Dmytro Linkin authored
      
      Implement eswitch API that allows updating rate groups. If group
      pointer is NULL, then move the vport to internal unlimited group zero.
      
      Implement devlink_ops->rate_parent_node_set() callback in the terms of
      the new eswitch group update API.
      
      Enable QoS for all group's elements if a group has allocated BW share.
      
      Co-developed-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarDmytro Linkin <dlinkin@nvidia.com>
      Reviewed-by: default avatarHuy Nguyen <huyn@nvidia.com>
      Reviewed-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarParav Pandit <parav@nvidia.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      0fe132ea
Loading