1. 15 Jun, 2021 25 commits
  2. 14 Jun, 2021 15 commits
    • Loic Poulain's avatar
      net: wwan: Fix WWAN config symbols · 89212e16
      Loic Poulain authored
      There is not strong reason to have both WWAN and WWAN_CORE symbols,
      Let's build the WWAN core framework when WWAN is selected, in the
      same way as for other subsystems.
      
      This fixes issue with mhi_net selecting WWAN_CORE without WWAN and
      reported by kernel test robot:
      
      Kconfig warnings: (for reference only)
         WARNING: unmet direct dependencies detected for WWAN_CORE
         Depends on NETDEVICES && WWAN
         Selected by
         - MHI_NET && NETDEVICES && NET_CORE && MHI_BUS
      
      Fixes: 9a44c1cc ("net: Add a WWAN subsystem")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89212e16
    • Vladimir Oltean's avatar
      net: flow_dissector: fix RPS on DSA masters · ec133572
      Vladimir Oltean authored
      After the blamed patch, __skb_flow_dissect() on the DSA master stopped
      adjusting for the length of the DSA headers. This is because it was told
      to adjust only if the needed_headroom is zero, aka if there is no DSA
      header. Of course, the adjustment should be done only if there _is_ a
      DSA header.
      
      Modify the comment too so it is clearer.
      
      Fixes: 4e500251 ("net: dsa: generalize overhead for taggers that use both headers and trailers")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec133572
    • Vladimir Oltean's avatar
      net: dsa: sja1105: constify the sja1105_regs structures · 3009e8aa
      Vladimir Oltean authored
      The struct sja1105_regs tables are not modified during the runtime of
      the driver, so they can be made constant. In fact, struct sja1105_info
      already holds a const pointer to these.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3009e8aa
    • David S. Miller's avatar
      Merge branch 'tja1103-improvewmentsa' · 0b703008
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Fixes and improvements to TJA1103 PHY driver
      
      This series contains:
      - an erratum workaround for the TJA1103 PHY integrated in SJA1110
      - an adaptation of the driver so it prints less unnecessary information
        when probing on SJA1110
      - a PTP RX timestamping bug fix and a clarification patch
      
      Targeting net-next since the PHY support is currently in net-next only.
      
      Changes in v3:
      Added one more patch which improves the readability of
      nxp_c45_reconstruct_ts.
      
      Changes in v2:
      Added a comment to the hardware workaround procedure.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b703008
    • Vladimir Oltean's avatar
      net: phy: nxp-c45-tja11xx: enable MDIO write access to the master/slave registers · 0b5f0f29
      Vladimir Oltean authored
      The SJA1110 switch integrates TJA1103 PHYs, but in SJA1110 switch rev B
      silicon, there is a bug in that the registers for selecting the 100base-T1
      autoneg master/slave roles are not writable.
      
      To enable write access to the master/slave registers, these additional
      PHY writes are necessary during initialization.
      
      The issue has been corrected in later SJA1110 silicon versions and is
      not present in the standalone PHY variants, but applying the workaround
      unconditionally in the driver should not do any harm.
      Suggested-by: default avatarRadu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b5f0f29
    • Vladimir Oltean's avatar
      net: phy: nxp-c45-tja11xx: fix potential RX timestamp wraparound · 109258ed
      Vladimir Oltean authored
      The reconstruction procedure for partial timestamps reads the current
      PTP time and fills in the low 2 bits of the second portion, as well as
      the nanoseconds portion, from the actual hardware packet timestamp.
      Critically, the reconstruction procedure works because it assumes that
      the current PTP time is strictly larger than the hardware timestamp was:
      it detects a 2-bit wraparound of the 'seconds' portion by checking whether
      the 'seconds' portion of the partial hardware timestamp is larger than
      the 'seconds' portion of the current time. That can only happen if the
      hardware timestamp was captured by the PHY during the last phase of a
      'modulo 4 seconds' interval, and the current PTP time was read by the
      driver during the initial phase of the next 'modulo 4 seconds' interval.
      
      The partial RX timestamps are added to priv->rx_queue in
      nxp_c45_rxtstamp() and they are processed potentially in parallel by the
      aux worker thread in nxp_c45_do_aux_work(). This means that it is
      possible for nxp_c45_do_aux_work() to process more than one RX timestamp
      during the same schedule.
      
      There is one premature optimization that will cause issues: for RX
      timestamping, the driver reads the current time only once, and it uses
      that to reconstruct all PTP RX timestamps in the queue. For the second
      and later timestamps, this will be an issue if we are processing two RX
      timestamps which are to the left and to the right, respectively, of a
      4-bit wraparound of the 'seconds' portion of the PTP time, and the
      current PTP time is also pre-wraparound.
      
       0.000000000        4.000000000        8.000000000        12.000000000
       |..................|..................|..................|............>
                       ^ ^ ^ ^                                            time
                       | | | |
                       | | | process hwts 1 and hwts 2
                       | | |
                       | | hwts 2
                       | |
                       | read current PTP time
                       |
                       hwts 1
      
      What will happen in that case is that hwts 2 (post-wraparound) will use
      a stale current PTP time that is pre-wraparound.
      But nxp_c45_reconstruct_ts will not detect this condition, because it is
      not coded up for it, so it will reconstruct hwts 2 with a current time
      from the previous 4 second interval (i.e. 0.something instead of
      4.something).
      
      This is solvable by making sure that the full 64-bit current time is
      always read after the PHY has taken the partial RX timestamp. We do this
      by reading the current PTP time for every timestamp in the RX queue.
      
      Fixes: 514def5d ("phy: nxp-c45-tja11xx: add timestamping support")
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      109258ed
    • Vladimir Oltean's avatar
      net: phy: nxp-c45-tja11xx: express timestamp wraparound interval in terms of TS_SEC_MASK · 661fef56
      Vladimir Oltean authored
      nxp_c45_reconstruct_ts() takes a partial hardware timestamp in @hwts,
      with 2 bits of the 'seconds' portion, and a full PTP time in @ts.
      
      It patches in the lower bits of @hwts into @ts, and to ensure that the
      reconstructed timestamp is correct, it checks whether the lower 2 bits
      of @hwts are not in fact higher than the lower 2 bits of @ts. This is
      not logically possible because, according to the calling convention, @ts
      was collected later in time than @hwts, but due to two's complement
      arithmetic it can actually happen, because the current PTP time might
      have wrapped around between when @hwts was collected and when @ts was,
      yielding the lower 2 bits of @ts smaller than those of @hwts.
      
      To correct for that situation which is expected to happen under normal
      conditions, the driver subtracts exactly one wraparound interval from
      the reconstructed timestamp, since the upper bits of that need to
      correspond to what the upper bits of @hwts were, not to what the upper
      bits of @ts were.
      
      Readers might be confused because the driver denotes the amount of bits
      that the partial hardware timestamp has to offer as TS_SEC_MASK
      (timestamp mask for seconds). But it subtracts a seemingly unrelated
      BIT(2), which is in fact more subtle: if the hardware timestamp provides
      2 bits of partial 'seconds' timestamp, then the wraparound interval is
      2^2 == BIT(2).
      
      But nonetheless, it is better to express the wraparound interval in
      terms of a definition we already have, so replace BIT(2) with
      1 + GENMASK(1, 0) which produces the same result but is clearer.
      Suggested-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      661fef56
    • Vladimir Oltean's avatar
      net: phy: nxp-c45-tja11xx: demote the "no PTP support" message to debug · 565c6d8c
      Vladimir Oltean authored
      The SJA1110 switch integrates these PHYs, and they do not have support
      for timestamping. This message becomes quite overwhelming:
      
      [   10.056596] NXP C45 TJA1103 spi1.0-base-t1:01: the phy does not support PTP
      [   10.112625] NXP C45 TJA1103 spi1.0-base-t1:02: the phy does not support PTP
      [   10.167461] NXP C45 TJA1103 spi1.0-base-t1:03: the phy does not support PTP
      [   10.223510] NXP C45 TJA1103 spi1.0-base-t1:04: the phy does not support PTP
      [   10.278239] NXP C45 TJA1103 spi1.0-base-t1:05: the phy does not support PTP
      [   10.332663] NXP C45 TJA1103 spi1.0-base-t1:06: the phy does not support PTP
      [   15.390828] NXP C45 TJA1103 spi1.2-base-t1:01: the phy does not support PTP
      [   15.445224] NXP C45 TJA1103 spi1.2-base-t1:02: the phy does not support PTP
      [   15.499673] NXP C45 TJA1103 spi1.2-base-t1:03: the phy does not support PTP
      [   15.554074] NXP C45 TJA1103 spi1.2-base-t1:04: the phy does not support PTP
      [   15.608516] NXP C45 TJA1103 spi1.2-base-t1:05: the phy does not support PTP
      [   15.662996] NXP C45 TJA1103 spi1.2-base-t1:06: the phy does not support PTP
      
      So reduce its log level to debug.
      
      Cc: Richard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      565c6d8c
    • David S. Miller's avatar
      Merge branch 'Ingenic-SOC-mac-support' · ed0141d1
      David S. Miller authored
      Zhou Yanjie says:
      
      ====================
      Add Ingenic SoCs MAC support.
      
      v2->v3:
      1.Add "ingenic,mac.yaml" for Ingenic SoCs.
      2.Change tx clk delay and rx clk delay from hardware value to ps.
      3.return -EINVAL when a unsupported value is encountered when
        parsing the binding.
      4.Simplify the code of the RGMII part of X2000 SoC according to
        Andrew Lunn’s suggestion.
      5.Follow the example of "dwmac-mediatek.c" to improve the code
        that handles delays according to Andrew Lunn’s suggestion.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ed0141d1
    • 周琰杰 (Zhou Yanjie)'s avatar
      net: stmmac: Add Ingenic SoCs MAC support. · 2bb4b98b
      周琰杰 (Zhou Yanjie) authored
      Add support for Ingenic SoC MAC glue layer support for the stmmac
      device driver. This driver is used on for the MAC ethernet controller
      found in the JZ4775 SoC, the X1000 SoC, the X1600 SoC, the X1830 SoC,
      and the X2000 SoC.
      Signed-off-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2bb4b98b
    • 周琰杰 (Zhou Yanjie)'s avatar
      dt-bindings: dwmac: Add bindings for new Ingenic SoCs. · 3b840106
      周琰杰 (Zhou Yanjie) authored
      Add the dwmac bindings for the JZ4775 SoC, the X1000 SoC,
      the X1600 SoC, the X1830 SoC and the X2000 SoC from Ingenic.
      Signed-off-by: default avatar周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b840106
    • David S. Miller's avatar
      Merge branch 'marvell-prestera-devlink' · 0a84a828
      David S. Miller authored
      Oleksandr Mazur says:
      
      ====================
      Marvell Prestera driver implementation of devlink functionality.
      
      This patch series implement Prestera Switchdev driver devlink traps,
      that are registered within the driver, as well as extend current devlink
      functionality by adding new hard drop statistics counter, that could be
      retrieved on-demand: the counter shows number of packets that have been
      dropped by the underlying device and haven't been passed to the devlink
      subsystem.
      
      The core prestera-devlink functionality is implemented in the prestera_devlink.c.
      
      The patch series also extends the existing devlink kernel API:
       - devlink: add trap_drop_counter_get callback for driver to register - make it possible
         to keep track of how many packets have been dropped (hard) by the switch device, before
         the packets even made it to the devlink subsystem (e.g. dropped due to RXDMA buffer
         overflow).
      
      The core features that extend current functionality of prestera Switchdev driver:
       - add logic for driver traps and drops registration (also traps with DROP action).
       - add documentation for prestera driver traps and drops group.
      
      PATCH v2:
       1) Rebase whole series on top of latest mater;
       2) Remove storm control-related patches, as they're out of devlink
          scope;
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a84a828
    • Oleksandr Mazur's avatar
      documentation: networking: devlink: add prestera switched driver Documentation · 66826c43
      Oleksandr Mazur authored
      Add documentation for the devlink feature prestera switchdev driver supports:
      add description for the support of the driver-specific devlink traps
      (include both traps with action TRAP and action DROP);
      Signed-off-by: default avatarOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66826c43
    • Oleksandr Mazur's avatar
      net: marvell: prestera: devlink: add traps with DROP action · a80cf955
      Oleksandr Mazur authored
      Add traps that have init_action being set to DROP.
      Add 'trap_drop_counter_get' (devlink API) callback implementation,
      that is used to get number of packets that have been dropped by the HW
      (traps with action 'DROP').
      Add new FW command CPU_CODE_COUNTERS_GET.
      Signed-off-by: default avatarOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a80cf955
    • Oleksandr Mazur's avatar
      net: marvell: prestera: devlink: add traps/groups implementation · 0a9003f4
      Oleksandr Mazur authored
      Add devlink traps registration (with corresponding groups) for
      all the traffic types that driver traps to the CPU;
      prestera_rxtx: report each packet trapped to the CPU (RX) to the
      prestera_devlink;
      Signed-off-by: default avatarOleksandr Mazur <oleksandr.mazur@plvision.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a9003f4