1. 19 Apr, 2021 10 commits
    • Vladimir Oltean's avatar
      net: enetc: add a mini driver for the Integrated Endpoint Register Block · e7d48e5f
      Vladimir Oltean authored
      The NXP ENETC is a 4-port Ethernet controller which 'smells' to
      operating systems like 4 distinct PCIe PFs with SR-IOV, each PF having
      its own driver instance, but in fact there are some hardware resources
      which are shared between all ports, like for example the 256 KB SRAM
      FIFO between the MACs and the Host Transfer Agent which DMAs frames to
      DRAM.
      
      To hide the stuff that cannot be neatly exposed per port, the hardware
      designers came up with this idea of having a dedicated register block
      which is supposed to be populated by the bootloader, and contains
      everything configuration-related: MAC addresses, FIFO partitioning, etc.
      
      When a port is reset using PCIe Function Level Reset, its defaults are
      transferred from the IERB configuration. Most of the time, the settings
      made through the IERB are read-only in the port's memory space (if they
      are even visible), so they cannot be modified at runtime.
      
      Linux doesn't have any advanced FIFO partitioning requirements at all,
      but when reading through the hardware manual, it became clear that, even
      though there are many good 'recommendations' for default values, many of
      them were not actually put in practice on LS1028A. So we end up with a
      default configuration that:
      
      (a) does not have enough TX and RX byte credits to support the max MTU
          of 9600 (which the Linux driver claims already) properly (at full speed)
      (b) allows the FIFO to be overrun with RX traffic, potentially
          overwriting internal data structures.
      
      The last part sounds a bit catastrophic, but it isn't. Frames are
      supposed to transit the FIFO for a very short time, but they can
      actually accumulate there under 2 conditions:
      
      (a) there is very severe congestion on DRAM memory, or
      (b) the RX rings visible to the operating system were configured for
          lossless operation, and they just ran out of free buffers to copy
          the frame to. This is what is used to put backpressure onto the MAC
          with flow control.
      
      So since ENETC has not supported flow control thus far, RX FIFO overruns
      were never seen with Linux. But with the addition of flow control, we
      should configure some registers to prevent this from happening. What we
      are trying to protect against are bad actors which continue to send us
      traffic despite the fact that we have signaled a PAUSE condition. Of
      course we can't be lossless in that case, but it is best to configure
      the FIFO to do tail dropping rather than letting it overrun.
      
      So in a nutshell, this driver is a fixup for all the IERB default values
      that should have been but aren't.
      
      The IERB configuration needs to be done _before_ the PFs are enabled.
      So every PF searches for the presence of the "fsl,ls1028a-enetc-ierb"
      node in the device tree, and if it finds it, it "registers" with the
      IERB, which means that it requests the IERB to fix up its default
      values. This is done through -EPROBE_DEFER. The IERB driver is part of
      the fsl_enetc module, but is technically a platform driver, since the
      IERB is a good old fashioned MMIO region, as opposed to ENETC ports
      which pretend to be PCIe devices.
      
      The driver was already configuring ENETC_PTXMBAR (FIFO allocation for
      TX) because due to an omission, TXMBAR is a read/write register in the
      PF memory space. But the manual is quite clear that the formula for this
      should depend upon the TX byte credits (TXBCR). In turn, the TX byte
      credits are only readable/writable through the IERB. So if we want to
      ensure that the TXBCR register also has a value that is correct and in
      line with TXMBAR, there is simply no way this can be done from the PF
      driver, access to the IERB is needed.
      
      I could have modified U-Boot to fix up the IERB values, but that is
      quite undesirable, as old U-Boot versions are likely to be floating
      around for quite some time from now.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7d48e5f
    • Vladimir Oltean's avatar
      dt-bindings: net: fsl: enetc: add the IERB documentation · 4ac7acc6
      Vladimir Oltean authored
      Mention the required compatible string and base address for the
      Integrated Endpoint Register Block node.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ac7acc6
    • Vladimir Oltean's avatar
      net: enetc: create a common enetc_pf_to_port helper · 87614b93
      Vladimir Oltean authored
      Even though ENETC interfaces are exposed as individual PCIe PFs with
      their own driver instances, the ENETC is still fundamentally a
      multi-port Ethernet controller, and some parts of the IP take a port
      number (as can be seen in the PSFP implementation).
      
      Create a common helper that can be used outside of the TSN code for
      retrieving the ENETC port number based on the PF number. This is only
      correct for LS1028A, the only Linux-capable instantiation of ENETC thus
      far.
      
      Note that ENETC port 3 is PF 6. The TSN code did not care about this
      because ENETC port 3 does not support TSN, so the wrong mapping done by
      enetc_get_port for PF 6 could have never been hit.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87614b93
    • Gustavo A. R. Silva's avatar
      ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user() · c1d9e34e
      Gustavo A. R. Silva authored
      Fix the following out-of-bounds warning:
      
      net/ethtool/ioctl.c:492:2: warning: 'memcpy' offset [49, 84] from the object at 'link_usettings' is out of the bounds of referenced subobject 'base' with type 'struct ethtool_link_settings' at offset 0 [-Warray-bounds]
      
      The problem is that the original code is trying to copy data into a
      some struct members adjacent to each other in a single call to
      memcpy(). This causes a legitimate compiler warning because memcpy()
      overruns the length of &link_usettings.base. Fix this by directly
      using &link_usettings and _from_ as destination and source addresses,
      instead.
      
      This helps with the ongoing efforts to globally enable -Warray-bounds
      and get us closer to being able to tighten the FORTIFY_SOURCE routines
      on memcpy().
      
      Link: https://github.com/KSPP/linux/issues/109Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1d9e34e
    • Dexuan Cui's avatar
      net: mana: Add a driver for Microsoft Azure Network Adapter (MANA) · ca9c54d2
      Dexuan Cui authored
      Add a VF driver for Microsoft Azure Network Adapter (MANA) that will be
      available in the future.
      Co-developed-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Co-developed-by: default avatarShachar Raindel <shacharr@microsoft.com>
      Signed-off-by: default avatarShachar Raindel <shacharr@microsoft.com>
      Signed-off-by: default avatarDexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca9c54d2
    • Taehee Yoo's avatar
      mld: remove unnecessary prototypes · 83c1ca25
      Taehee Yoo authored
      Some prototypes are unnecessary, so delete it.
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      83c1ca25
    • David S. Miller's avatar
      Merge branch 'nh-flushing' · c589fa10
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      nexthop: Support large scale nexthop flushing
      
      Patch #1 fixes a day-one bug in the nexthop code and allows "ip nexthop
      flush" to work correctly with large number of nexthops that do not fit
      in a single-part dump.
      
      Patch #2 adds a test case.
      
      Targeting at net-next since this use case never worked, the flow is
      pretty obscure and such a large number of nexthops is unlikely to be
      used in any real-world scenario.
      
      Tested with fib_nexthops.sh:
      
      Tests passed: 219
      Tests failed:   0
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c589fa10
    • Ido Schimmel's avatar
      selftests: fib_nexthops: Test large scale nexthop flushing · bf5eb67d
      Ido Schimmel authored
      Test that all the nexthops are flushed when a multi-part nexthop dump is
      required for the flushing.
      
      Without previous patch:
      
       # ./fib_nexthops.sh
       TEST: Large scale nexthop flushing                                  [FAIL]
      
      With previous patch:
      
       # ./fib_nexthops.sh
       TEST: Large scale nexthop flushing                                  [ OK ]
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf5eb67d
    • Ido Schimmel's avatar
      nexthop: Restart nexthop dump based on last dumped nexthop identifier · 9e46fb65
      Ido Schimmel authored
      Currently, a multi-part nexthop dump is restarted based on the number of
      nexthops that have been dumped so far. This can result in a lot of
      nexthops not being dumped when nexthops are simultaneously deleted:
      
       # ip nexthop | wc -l
       65536
       # ip nexthop flush
       Dump was interrupted and may be inconsistent.
       Flushed 36040 nexthops
       # ip nexthop | wc -l
       29496
      
      Instead, restart the dump based on the nexthop identifier (fixed number)
      of the last successfully dumped nexthop:
      
       # ip nexthop | wc -l
       65536
       # ip nexthop flush
       Dump was interrupted and may be inconsistent.
       Flushed 65536 nexthops
       # ip nexthop | wc -l
       0
      Reported-by: default avatarMaksym Yaremchuk <maksymy@nvidia.com>
      Tested-by: default avatarMaksym Yaremchuk <maksymy@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9e46fb65
    • David S. Miller's avatar
      Merge tag 'wireless-drivers-next-2021-04-18' of... · 56aa7b21
      David S. Miller authored
      Merge tag 'wireless-drivers-next-2021-04-18' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for v5.13
      
      Second set of patches for v5.13. A lot of iwlwifi and mt76 patches
      this time, and also smaller features and fixes all over.
      
      mt76
      
      * mt7915/mt7615 decapsulation offload support
      
      * threaded NAPI support
      
      * new device IDs
      
      * mt7921 device reset support
      
      * rx timestamp support
      
      iwlwifi
      
      * passive scan support for 6GHz
      
      * new hardware support
      
      wilc1000
      
      * CRC support for SPI bus
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      56aa7b21
  2. 18 Apr, 2021 15 commits
  3. 17 Apr, 2021 15 commits