1. 12 May, 2022 31 commits
  2. 11 May, 2022 9 commits
    • Jakub Kicinski's avatar
      Merge branch 'count-tc-taprio-window-drops-in-enetc-driver' · bb709987
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      Count tc-taprio window drops in enetc driver
      
      This series includes a patch from Po Liu (no longer with NXP) which
      counts frames dropped by the tc-taprio offload in ethtool -S and in
      ndo_get_stats64. It also contains a preparation patch from myself.
      ====================
      
      Link: https://lore.kernel.org/r/20220510163615.6096-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bb709987
    • Po Liu's avatar
      net: enetc: count the tc-taprio window drops · 285e8ded
      Po Liu authored
      The enetc scheduler for IEEE 802.1Qbv has 2 options (depending on
      PTGCR[TG_DROP_DISABLE]) when we attempt to send an oversized packet
      which will never fit in its allotted time slot for its traffic class:
      either block the entire port due to head-of-line blocking, or drop the
      packet and set a bit in the writeback format of the transmit buffer
      descriptor, allowing other packets to be sent.
      
      We obviously choose the second option in the driver, but we do not
      detect the drop condition, so from the perspective of the network stack,
      the packet is sent and no error counter is incremented.
      
      This change checks the writeback of the TX BD when tc-taprio is enabled,
      and increments a specific ethtool statistics counter and a generic
      "tx_dropped" counter in ndo_get_stats64.
      Signed-off-by: default avatarPo Liu <Po.Liu@nxp.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      285e8ded
    • Vladimir Oltean's avatar
      net: enetc: manage ENETC_F_QBV in priv->active_offloads only when enabled · 32bf8e1f
      Vladimir Oltean authored
      Future work in this driver would like to look at priv->active_offloads &
      ENETC_F_QBV to determine whether a tc-taprio qdisc offload was
      installed, but this does not produce the intended effect.
      
      All the other flags in priv->active_offloads are managed dynamically,
      except ENETC_F_QBV which is set statically based on the probed SI capability.
      
      This change makes priv->active_offloads & ENETC_F_QBV really track the
      presence of a tc-taprio schedule on the port.
      
      Some existing users, like the enetc_sched_speed_set() call from
      phylink_mac_link_up(), are best kept using the old logic: the tc-taprio
      offload does not re-trigger another link mode resolve, so the scheduler
      needs to be functional from the get go, as long as Qbv is supported at
      all on the port. So to preserve functionality there, look at the static
      station interface capability from pf->si->hw_features instead.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      32bf8e1f
    • Jakub Kicinski's avatar
      Merge branch 'macb-napi-improvements' · d7722973
      Jakub Kicinski authored
      Robert Hancock says:
      
      ====================
      MACB NAPI improvements
      
      Simplify the logic in the Cadence MACB/GEM driver for determining
      when to reschedule NAPI processing, and update it to use NAPI for the
      TX path as well as the RX path.
      
      Changes since v1: Changed to use separate TX and RX NAPI instances and
      poll functions to avoid unnecessary checks of the other ring (TX/RX)
      states during polling and to use budget handling for both RX and TX.
      Fixed locking to protect against concurrent access to TX ring on
      TX transmit and TX poll paths.
      ====================
      
      Link: https://lore.kernel.org/r/20220509194635.3094080-1-robert.hancock@calian.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d7722973
    • Robert Hancock's avatar
      net: macb: use NAPI for TX completion path · 138badbc
      Robert Hancock authored
      This driver was using the TX IRQ handler to perform all TX completion
      tasks. Under heavy TX network load, this can cause significant irqs-off
      latencies (found to be in the hundreds of microseconds using ftrace).
      This can cause other issues, such as overrunning serial UART FIFOs when
      using high baud rates with limited UART FIFO sizes.
      
      Switch to using a NAPI poll handler to perform the TX completion work
      to get this out of hard IRQ context and avoid the IRQ latency impact. A
      separate NAPI instance is used for TX and RX to avoid checking the other
      ring's state unnecessarily when doing the poll, and so that the NAPI
      budget handling can work for both TX and RX packets.
      
      A new per-queue tx_ptr_lock spinlock has been added to avoid using the
      main device lock (with IRQs needing to be disabled) across the entire TX
      mapping operation, and also to protect the TX queue pointers from
      concurrent access between the TX start and TX poll operations.
      
      The TX Used Bit Read interrupt (TXUBR) handling also needs to be moved into
      the TX NAPI poll handler to maintain the proper order of operations. A flag
      is used to notify the poll handler that a UBR condition needs to be
      handled. The macb_tx_restart handler has had some locking added for global
      register access, since this could now potentially happen concurrently on
      different queues.
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      138badbc
    • Robert Hancock's avatar
      net: macb: simplify/cleanup NAPI reschedule checking · 1900e30d
      Robert Hancock authored
      Previously the macb_poll method was checking the RSR register after
      completing its RX receive work to see if additional packets had been
      received since IRQs were disabled, since this controller does not
      maintain the pending IRQ status across IRQ disable. It also had to
      double-check the register after re-enabling IRQs to detect if packets
      were received after the first check but before IRQs were enabled.
      
      Using the RSR register for this purpose is problematic since it reflects
      the global device state rather than the per-queue state, so if packets
      are being received on multiple queues it may end up retriggering receive
      on a queue where the packets did not actually arrive and not on the one
      where they did arrive. This will also cause problems with an upcoming
      change to use NAPI for the TX path where use of multiple queues is more
      likely.
      
      Add a macb_rx_pending function to check the RX ring to see if more
      packets have arrived in the queue, and use that to check if NAPI should
      be rescheduled rather than the RSR register. By doing this, we can just
      ignore the global RSR register entirely, and thus save some extra device
      register accesses at the same time.
      
      This also makes the previous first check for pending packets rather
      redundant, since it would be checking the RX ring state which was just
      checked in the receive work function. Therefore we can get rid of it and
      just check after enabling interrupts whether packets are already
      pending.
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1900e30d
    • Vladimir Oltean's avatar
      net: dsa: ocelot: accept 1000base-X for VSC9959 and VSC9953 · 11ecf341
      Vladimir Oltean authored
      Switches using the Lynx PCS driver support 1000base-X optical SFP
      modules. Accept this interface type on a port.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Link: https://lore.kernel.org/r/20220510164320.10313-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      11ecf341
    • Xiaomeng Tong's avatar
      i40e: i40e_main: fix a missing check on list iterator · 3f95a747
      Xiaomeng Tong authored
      The bug is here:
      	ret = i40e_add_macvlan_filter(hw, ch->seid, vdev->dev_addr, &aq_err);
      
      The list iterator 'ch' will point to a bogus position containing
      HEAD if the list is empty or no element is found. This case must
      be checked before any use of the iterator, otherwise it will
      lead to a invalid memory access.
      
      To fix this bug, use a new variable 'iter' as the list iterator,
      while use the origin variable 'ch' as a dedicated pointer to
      point to the found element.
      
      Cc: stable@vger.kernel.org
      Fixes: 1d8d80b4 ("i40e: Add macvlan support on i40e")
      Signed-off-by: default avatarXiaomeng Tong <xiam0nd.tong@gmail.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20220510204846.2166999-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3f95a747
    • Vladimir Oltean's avatar
      selftests: forwarding: tc_actions: allow mirred egress test to run on non-offloaded h2 · b57c7e8b
      Vladimir Oltean authored
      The host interfaces $h1 and $h2 don't have to be switchdev interfaces,
      but due to the fact that we pass $tcflags which may have the value of
      "skip_sw", we force $h2 to offload a drop rule for dst_ip, something
      which it may not be able to do.
      
      The selftest only wants to verify the hit count of this rule as a means
      of figuring out whether the packet was received, so remove the $tcflags
      for it and let it be done in software.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Tested-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/20220510220904.284552-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b57c7e8b