1. 16 Sep, 2022 4 commits
  2. 15 Sep, 2022 12 commits
  3. 13 Sep, 2022 2 commits
  4. 09 Sep, 2022 22 commits
    • Jilin Yuan's avatar
      net: openvswitch: fix repeated words in comments · 169ccf0e
      Jilin Yuan authored
      Delete the redundant word 'is'.
      Signed-off-by: default avatarJilin Yuan <yuanjilin@cdjrlc.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      169ccf0e
    • David S. Miller's avatar
      Merge branch 'net-ipa-next' · 6988c1d3
      David S. Miller authored
      Alex Elder says:
      
      ====================
      net: ipa: don't use lists for transaction state
      
      This is the last series of patches to convert the IPA code so
      integer IDs are used rather than lists to track the state of
      transactions.
      
      A first series of patches added ID fields to track the state of
      transactions:
        https://lore.kernel.org/netdev/20220831224017.377745-1-elder@linaro.org
      The second series started transitioning code to use these IDs rather
      than lists to manage state:
        https://lore.kernel.org/netdev/20220902210218.745873-1-elder@linaro.org
      
      This final series finishes the transition, to always use IDs instead
      of the lists to manage transaction state.  As a result, the list
      fields, links, and a spinlock to protect updates are no longer
      needed, so they are removed.  This permits a few other improvements
      to be implemented.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6988c1d3
    • Alex Elder's avatar
      net: ipa: don't have gsi_channel_update() return a value · 019e37ea
      Alex Elder authored
      If it finds no completed transactions, gsi_channel_trans_complete()
      calls gsi_channel_update() to check hardware.  If new transactions
      have completed, gsi_channel_update() records that, then calls
      gsi_channel_trans_complete() to return the first of those found.
      This recursion won't go any further, but can be avoided if we
      have gsi_channel_update() only be responsible for updating state
      after accessing hardware.
      
      Change gsi_channel_update() so it simply checks for and handles
      new completions, without returning a value.  If it needs to call
      that function, have gsi_channel_trans_complete() determine whether
      there are new transactions available after the update.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      019e37ea
    • Alex Elder's avatar
      net: ipa: update channel in gsi_channel_trans_complete() · e0e3406c
      Alex Elder authored
      Have gsi_channel_trans_complete() update the known state from
      hardware rather than doing so in gsi_channel_poll_one().
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0e3406c
    • Alex Elder's avatar
      net: ipa: kill all other transaction lists · d338ae28
      Alex Elder authored
      None of the transaction lists are actually needed any more, because
      transaction IDs (which have been shown to be equivalent) are used
      instead.  So we can remove all of them, as well as the spinlock
      that protects updates to them.
      
      Not requiring a lock simplifies gsi_trans_free() as well; we only
      need to check the reference count once to decide whether we've hit
      the last reference.
      
      This makes the links field in the gsi_trans structure unused, so get
      rid of that as well.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d338ae28
    • Alex Elder's avatar
      net: ipa: kill the allocated transaction list · 11902b41
      Alex Elder authored
      The only place the trans_info->alloc list is used is when
      initializing it, when adding a transaction to it when allocation
      finishes, and when moving a transaction from that list to the
      committed list.
      
      We can just skip putting a transaction on the allocated list, and
      add it (rather than move it) to the committed list when it is
      committed.
      
      On additional caveat is that an allocated transaction that's
      committed without any TREs added will be immediately freed.  Because
      we aren't adding allocated transactions to a list any more, the
      list links need to be initialized to ensure they're valid at the
      time list_del() is called for the transaction.
      
      Then we can safely eliminate the allocated transaction list.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11902b41
    • Alex Elder's avatar
      net: ipa: always use transaction IDs instead of lists · 0c126ec3
      Alex Elder authored
      In gsi_channel_trans_complete(), use the completed and pending IDs
      to determine whether there are any transactions in completed state.
      
      Similarly, in gsi_channel_trans_cancel_pending(), use the pending
      and committed IDs to mark pending transactions cancelled.  Rearrange
      the logic a bit there for a simpler result.
      
      This removes the only user of list_last_entry_or_null(), so get rid
      of that macro.
      
      Remove the temporary warnings added by the previous commit.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c126ec3
    • David S. Miller's avatar
      Merge branch 'felix-dsa-ethtool-stats' · 6fff9261
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Standardized ethtool counters for Felix DSA driver
      
      The main purpose of this change set is to add reporting of structured
      ethtool statistics counters to the felix DSA driver (see patch 11/14 for
      details), as a prerequisite for extending these counters to the
      eMAC/pMAC defined by the IEEE MAC Merge layer.
      
      Along the way, the main purpose has diverged into multiple sub-purposes
      which are also tackled:
      
      - A bug fix patch submitted to "net" has made ocelot->stats_lock a spin
        lock, which is not an issue currently (all Ocelot switches are MMIO),
        but will be an issue for Colin Foster who is working on a SPI
        controlled Ocelot switch. We restore the hardware access to port stats
        to be sleepable.
      
      - PSFP (tc-gate, tc-police) tc-flower stats on Felix use a non-converged
        procedure to access the hardware counters, although the interface is
        very similar to what is used for the port counters. Benefit from the
        logic used for the port counters, which gains us 64-bit tc-flower
        stats that are resistant to overflows.
      
      - Also export the ndo_get_stats64 method used by the ocelot switchdev
        driver to Felix, so that ifconfig sees something hardware-based as
        well (but not 100% up to date).
      
      - Create a new ocelot_stats.c file which groups everything stats-related
        together. Along with this, also move some other topic-specific code,
        like FDB and PTP, out of the main ocelot.c.
      
      - Minimize the lines of code for the stats layout definitions. These
        changes alone cause the patch set to have an overall reduction of
        lines of code in the driver, even though we are adding new
        functionality as well.
      
      Tested the port counters with lockdep and friends, with some
      garden-variety traffic (ping, iperf3) and the PSFP counters with
      tools/testing/selftests/drivers/net/ocelot/psfp.sh.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6fff9261
    • Vladimir Oltean's avatar
      net: mscc: ocelot: share the common stat definitions between all drivers · 4d1d157f
      Vladimir Oltean authored
      All switch families supported by the ocelot lib (ocelot, felix, seville)
      export the same registers so far. But for example felix also has TSN
      counters, while the others don't.
      
      To reduce the bloat even further, create an OCELOT_COMMON_STATS() macro
      which just lists all stats that are common between switches. The array
      elements are still replicated among all of vsc9959_stats_layout,
      vsc9953_stats_layout and ocelot_stats_layout.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4d1d157f
    • Vladimir Oltean's avatar
      net: mscc: ocelot: minimize definitions for stats · b69cf1c6
      Vladimir Oltean authored
      The current definition of struct ocelot_stat_layout is long-winded (4
      lines per entry, and we have hundreds of entries), so we could make an
      effort to use the C preprocessor and reduce the line count.
      
      Create an implicit correspondence between enum ocelot_reg, which tells
      us the register address (SYS_COUNT_RX_OCTETS etc) and enum ocelot_stat
      which allows us to index the ocelot->stats array (OCELOT_STAT_RX_OCTETS
      etc), and don't require us to specify both when we define what stats
      each switch family has.
      
      Create an OCELOT_STAT() macro that pairs only an enum ocelot_stat to an
      enum ocelot_reg, and an OCELOT_STAT_ETHTOOL() macro which also contains
      a name exported to the unstructured ethtool -S stringset API. For now,
      we define all counters as having the OCELOT_STAT_ETHTOOL() kind, but we
      will add more counters in the future which are not exported to the
      unstructured ethtool -S.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b69cf1c6
    • Vladimir Oltean's avatar
      net: mscc: ocelot: harmonize names of SYS_COUNT_TX_AGING and OCELOT_STAT_TX_AGED · be5c13f2
      Vladimir Oltean authored
      The hardware counter is called C_TX_AGED, so rename SYS_COUNT_TX_AGING
      to SYS_COUNT_TX_AGED. This will become important since we want to
      minimize the way in which we declare struct ocelot_stat_layout elements,
      using the C preprocessor.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      be5c13f2
    • Vladimir Oltean's avatar
      net: mscc: ocelot: add support for all sorts of standardized counters present in DSA · e32036e1
      Vladimir Oltean authored
      DSA is integrated with the new standardized ethtool -S --groups option,
      but the felix driver only exports unstructured statistics.
      
      Reuse the array of 64-bit statistics collected by ocelot_check_stats_work(),
      but just export select values from it.
      
      Since ocelot_check_stats_work() runs periodically to avoid 32-bit
      overflow, and the ethtool calling context is sleepable, we update the
      64-bit stats one more time, to provide up-to-date values. The locking
      scheme with a mutex followed by a spinlock is a bit hard to digest, so
      we create and use a ocelot_port_stats_run() helper with a callback that
      populates the ethool stats group the caller is interested in.
      
      The exported stats are:
      ethtool -S swp0 --groups eth-phy
      ethtool -S swp0 --groups eth-mac
      ethtool -S swp0 --groups eth-ctrl
      ethtool -S swp0 --groups rmon
      ethtool --include-statistics --show-pause swp0
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e32036e1
    • Vladimir Oltean's avatar
      net: mscc: ocelot: exclude stats from bulk regions based on reg, not name · d3e75f16
      Vladimir Oltean authored
      We want to introduce elements kept in ocelot->stats that aren't exposed
      to the unstructured ethtool -S (so they won't have their name populated),
      but are otherwise checked for 32-bit wraparounds by
      ocelot_port_update_stats().
      
      This isn't possible today because ocelot_prepare_stats_regions() skips
      over ocelot_stat_layout elements with no name. Now that we've changed
      struct ocelot_stat_layout to keep the absolute register address rather
      than the offset relative to SYS_CNT, we can make use of the unpopulated
      "reg" value of 0 to mean that the counter isn't present on the current
      switch revision, and skip it from the preparation of bulk regions.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d3e75f16
    • Vladimir Oltean's avatar
      net: dsa: felix: use ocelot's ndo_get_stats64 method · 776b71e5
      Vladimir Oltean authored
      Move the logic from the ocelot switchdev driver's ocelot_get_stats64()
      method to the common switch lib and reuse it for the DSA driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      776b71e5
    • Vladimir Oltean's avatar
      net: mscc: ocelot: move more PTP code from the lib to ocelot_ptp.c · d50e41bf
      Vladimir Oltean authored
      Decongest ocelot.c a bit more by moving all PTP related logic (including
      timestamp processing and PTP packet traps) to ocelot_ptp.c.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d50e41bf
    • Vladimir Oltean's avatar
      net: mscc: ocelot: unexport ocelot_port_fdb_do_dump from the common lib · 97076c3c
      Vladimir Oltean authored
      ocelot_port_fdb_do_dump() is only used by ocelot_net.c, so move it
      there.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      97076c3c
    • Vladimir Oltean's avatar
      net: mscc: ocelot: move stats code to ocelot_stats.c · fe90104c
      Vladimir Oltean authored
      The main C file of the ocelot switch lib, ocelot.c, is getting larger
      and larger, and there are plans to add more logic related to stats.
      So it seems like an appropriate moment to split the statistics code to a
      new file.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe90104c
    • Vladimir Oltean's avatar
      net: mscc: ocelot: sort Makefile files alphabetically · 28c8df8d
      Vladimir Oltean authored
      Create a clear ordering of the files used to compile the switch lib and
      the switchdev driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      28c8df8d
    • Vladimir Oltean's avatar
      net: mscc: ocelot: report FIFO drop counters through stats->rx_dropped · cc160fc2
      Vladimir Oltean authored
      if_link.h says:
      
       * @rx_dropped: Number of packets received but not processed,
       *   e.g. due to lack of resources or unsupported protocol.
       *   For hardware interfaces this counter may include packets discarded
       *   due to L2 address filtering but should not include packets dropped
       *   by the device due to buffer exhaustion which are counted separately in
       *   @rx_missed_errors (since procfs folds those two counters together).
      
      Currently we report "stats->rx_dropped = dev->stats.rx_dropped", the
      latter being incremented by various entities in the stack. This is not
      wrong, but we'd like to move ocelot_get_stats64() in the common ocelot
      switch lib which is independent of struct net_device.
      
      To do that, report the hardware RX drop counters instead. These drops
      are due to policer action, or due to no destinations. When we have no
      memory in the queue system, report this through rx_missed_errors, as
      instructed.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cc160fc2
    • Vladimir Oltean's avatar
      net: dsa: felix: check the 32-bit PSFP stats against overflow · 25027c84
      Vladimir Oltean authored
      The Felix PSFP counters suffer from the same problem as the ocelot
      ndo_get_stats64 ones - they are 32-bit, so they can easily overflow and
      this can easily go undetected.
      
      Add a custom hook in ocelot_check_stats_work() through which driver
      specific actions can be taken, and update the stats for the existing
      PSFP filters from that hook.
      
      Previously, vsc9959_psfp_filter_add() and vsc9959_psfp_filter_del() were
      serialized with respect to each other via rtnl_lock(). However, with the
      new entry point into &psfp->sfi_list coming from the periodic worker, we
      now need an explicit mutex to serialize access to these lists.
      
      We used to keep a struct felix_stream_filter_counters on stack, through
      which vsc9959_psfp_stats_get() - a FLOW_CLS_STATS callback - would
      retrieve data from vsc9959_psfp_counters_get(). We need to become
      smarter about that in 3 ways:
      
      - we need to keep a persistent set of counters for each stream instead
        of keeping them on stack
      
      - we need to promote those counters from u32 to u64, and create a
        procedure that properly keeps 64-bit counters. Since we clear the
        hardware counters anyway, and we poll every 2 seconds, a simple
        increment of a u64 counter with a u32 value will perfectly do the job.
      
      - FLOW_CLS_STATS also expect incremental counters, so we also need to
        zeroize our u64 counters every time sch_flower calls us
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      25027c84
    • Vladimir Oltean's avatar
      net: mscc: ocelot: make access to STAT_VIEW sleepable again · 96980ff7
      Vladimir Oltean authored
      To support SPI-controlled switches in the future, access to
      SYS_STAT_CFG_STAT_VIEW needs to be done outside of any spinlock
      protected region, but it still needs to be serialized (by a mutex).
      
      Split the ocelot->stats_lock spinlock into a mutex that serializes
      indirect access to hardware registers (ocelot->stat_view_lock) and a
      spinlock that serializes access to the u64 ocelot->stats array.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      96980ff7
    • Vladimir Oltean's avatar
      net: dsa: felix: add definitions for the stream filter counters · 0a2360c5
      Vladimir Oltean authored
      TSN stream (802.1Qci, 802.1CB) filters are also accessed through
      STAT_VIEW, just like the port registers, but these counters are per
      stream, rather than per port. So we don't keep them in
      ocelot_port_update_stats().
      
      What we can do, however, is we can create register definitions for them
      just like we have for the port counters, and delete the last remaining
      user of the SYS_CNT register + a group index (read_gix).
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a2360c5