1. May 11, 2022
  2. May 10, 2022
    • Colin Ian King's avatar
      x25: remove redundant pointer dev · ecd17a87
      Colin Ian King authored
      
      
      Pointer dev is being assigned a value that is never used, the assignment
      and the variable are redundant and can be removed. Also replace null check
      with the preferred !ptr idiom.
      
      Cleans up clang scan warning:
      net/x25/x25_proc.c:94:26: warning: Although the value stored to 'dev' is
      used in the enclosing expression, the value is never actually read
      from 'dev' [deadcode.DeadStores]
      
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Link: https://lore.kernel.org/r/20220508214500.60446-1-colin.i.king@gmail.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ecd17a87
    • Paolo Abeni's avatar
      Merge branch 'this-is-a-patch-series-for-ethernet-driver-of-sunplus-sp7021-soc' · a12af6f8
      Paolo Abeni authored
      Wells Lu says:
      
      ====================
      This is a patch series for Ethernet driver of Sunplus SP7021 SoC.
      
      Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates
      many peripherals (ex: UART, I2C, SPI, SDIO, eMMC, USB, SD card and
      etc.) into a single chip. It is designed for industrial control
      applications.
      
      Refer to:
      https://sunplus.atlassian.net/wiki/spaces/doc/overview
      https://tibbo.com/store/plus1.html
      ====================
      
      Link: https://lore.kernel.org/r/1652004800-3212-1-git-send-email-wellslutw@gmail.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a12af6f8
    • Wells Lu's avatar
      net: ethernet: Add driver for Sunplus SP7021 · fd3040b9
      Wells Lu authored
      
      
      Add driver for Sunplus SP7021 SoC.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarWells Lu <wellslutw@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      fd3040b9
    • Wells Lu's avatar
      devicetree: bindings: net: Add bindings doc for Sunplus SP7021. · 0cfeca62
      Wells Lu authored
      
      
      Add bindings documentation for Sunplus SP7021 SoC.
      
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarWells Lu <wellslutw@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      0cfeca62
    • Paolo Abeni's avatar
      Merge branch 'ptp-support-hardware-clocks-with-additional-free-running-cycle-counter' · 82763453
      Paolo Abeni authored
      Gerhard Engleder says:
      
      ====================
      ptp: Support hardware clocks with additional free running cycle counter
      
      ptp vclocks require a clock with free running time for the timecounter.
      Currently only a physical clock forced to free running is supported.
      If vclocks are used, then the physical clock cannot be synchronized
      anymore. The synchronized time is not available in hardware in this
      case. As a result, timed transmission with TAPRIO hardware support
      is not possible anymore.
      
      If hardware would support a free running time additionally to the
      physical clock, then the physical clock does not need to be forced to
      free running. Thus, the physical clocks can still be synchronized while
      vclocks are in use.
      
      The physical clock could be used to synchronize the time domain of the
      TSN network and trigger TAPRIO. In parallel vclocks can be used to
      synchronize other time domains.
      
      One year ago I thought for two time domains within a TSN network also
      two physical clocks are required. This would lead to new kernel
      interfaces for asking for the second clock, ... . But actually for a
      time triggered system like TSN there can be only one time domain that
      controls the system itself. All other time domains belong to other
      layers, but not to the time triggered system itself. So other time
      domains can be based on a free running counter if similar mechanisms
      like 2 step synchroisation are used.
      
      Synchronisation was tested with two time domains between two directly
      connected hosts. Each host run two ptp4l instances, the first used the
      physical clock and the second used the virtual clock. I used my FPGA
      based network controller as network device. ptp4l was used in
      combination with the virtual clock support patches from Miroslav
      Lichvar.
      
      v4:
      - if_index of 0 is invalid (Jonathan Lemon)
      - set if_index to 0 in the SOF_TIMESTAMPING_RAW_HARDWARE block (Jonathan
        Lemon)
      - add helper function for netdev_get_tstamp() call (Jonathan Lemon)
      - update SKBTX_ANY_TSTAMP (Paolo Abeni)
      - use separate bits for new tx_flags (Richard Cochran)
      
      v3:
      - optimize ptp_convert_timestamp (Richard Cochran)
      - call dev_get_by_napi_id() only if needed (Richard Cochran)
      - use non-negated logical test (Richard Cochran)
      - add comment for skipped output (Richard Cochran)
      - add comment for SKBTX_HW_TSTAMP_USE_CYCLES masking (Richard Cochran)
      
      v2:
      - rename ptp_clock cycles to has_cycles (Richard Cochran)
      - call it free running cycle counter (Richard Cochran)
      - update struct skb_shared_hwtstamps kdoc (Richard Cochran)
      - optimize timestamp address/cookie processing path (Richard Cochran,
        Vinicius Costa Gomes)
      
      v1:
      - complete rework based on suggestions (Richard Cochran)
      ====================
      
      Link: https://lore.kernel.org/r/20220506200142.3329-1-gerhard@engleder-embedded.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      82763453
    • Gerhard Engleder's avatar
      tsnep: Add free running cycle counter support · 0abb62b6
      Gerhard Engleder authored
      
      
      The TSN endpoint Ethernet MAC supports a free running counter
      additionally to its clock. This free running counter can be read and
      hardware timestamps are supported. As the name implies, this counter
      cannot be set and its frequency cannot be adjusted.
      
      Add free running cycle counter support based on this free running
      counter to physical clock. This also requires hardware time stamps
      based on that free running counter.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      0abb62b6
    • Gerhard Engleder's avatar
      ptp: Speed up vclock lookup · fcf308e5
      Gerhard Engleder authored
      
      
      ptp_convert_timestamp() is called in the RX path of network messages.
      The current implementation takes ~5000ns on 1.2GHz A53. This is too much
      for the hot path of packet processing.
      
      Introduce hash table for fast vclock lookup in ptp_convert_timestamp().
      The execution time of ptp_convert_timestamp() is reduced to ~700ns on
      1.2GHz A53.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      fcf308e5
    • Gerhard Engleder's avatar
      ptp: Support late timestamp determination · 97dc7cd9
      Gerhard Engleder authored
      
      
      If a physical clock supports a free running cycle counter, then
      timestamps shall be based on this time too. For TX it is known in
      advance before the transmission if a timestamp based on the free running
      cycle counter is needed. For RX it is impossible to know which timestamp
      is needed before the packet is received and assigned to a socket.
      
      Support late timestamp determination by a network device. Therefore, an
      address/cookie is stored within the new netdev_data field of struct
      skb_shared_hwtstamps. This address/cookie is provided to a new network
      device function called ndo_get_tstamp(), which returns a timestamp based
      on the normal/adjustable time or based on the free running cycle
      counter. If function is not supported, then timestamp handling is not
      changed.
      
      This mechanism is intended for RX, but TX use is also possible.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      97dc7cd9
    • Gerhard Engleder's avatar
      ptp: Pass hwtstamp to ptp_convert_timestamp() · d58809d8
      Gerhard Engleder authored
      
      
      ptp_convert_timestamp() converts only the timestamp hwtstamp, which is
      a field of the argument with the type struct skb_shared_hwtstamps *. So
      a pointer to the hwtstamp field of this structure is sufficient.
      
      Rework ptp_convert_timestamp() to use an argument of type ktime_t *.
      This allows to add additional timestamp manipulation stages before the
      call of ptp_convert_timestamp().
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d58809d8
    • Gerhard Engleder's avatar
      ptp: Request cycles for TX timestamp · 51eb7492
      Gerhard Engleder authored
      
      
      The free running cycle counter of physical clocks called cycles shall be
      used for hardware timestamps to enable synchronisation.
      
      Introduce new flag SKBTX_HW_TSTAMP_USE_CYCLES, which signals driver to
      provide a TX timestamp based on cycles if cycles are supported.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      51eb7492
    • Gerhard Engleder's avatar
      ptp: Add cycles support for virtual clocks · 42704b26
      Gerhard Engleder authored
      
      
      ptp vclocks require a free running time for their timecounter.
      Currently only a physical clock forced to free running is supported.
      If vclocks are used, then the physical clock cannot be synchronized
      anymore. The synchronized time is not available in hardware in this
      case. As a result, timed transmission with TAPRIO hardware support
      is not possible anymore.
      
      If hardware would support a free running time additionally to the
      physical clock, then the physical clock does not need to be forced to
      free running. Thus, the physical clocks can still be synchronized
      while vclocks are in use.
      
      The physical clock could be used to synchronize the time domain of the
      TSN network and trigger TAPRIO. In parallel vclocks can be used to
      synchronize other time domains.
      
      Introduce support for a free running cycle counter called cycles to
      physical clocks. Rework ptp vclocks to use this free running cycle
      counter. Default implementation is based on time of physical clock.
      Thus, behavior of ptp vclocks based on physical clocks without free
      running cycle counter is identical to previous behavior.
      
      Signed-off-by: default avatarGerhard Engleder <gerhard@engleder-embedded.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      42704b26
    • Jakub Kicinski's avatar
      eth: dpaa2-mac: remove a dead-code NULL check on fwnode parent · b3552d6a
      Jakub Kicinski authored
      Since commit 4e30e98c
      
       ("dpaa2-mac: return -EPROBE_DEFER from dpaa2_mac_open in case the fwnode is not set")
      @parent can't be NULL after the if. It's either the address
      of the ->fwnode of @dpmacs or @fwnode in case of ACPI.
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Link: https://lore.kernel.org/r/20220506200029.852310-1-kuba@kernel.org
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b3552d6a
    • Mark Bloch's avatar
      net/mlx5: Lag, add debugfs to query hardware lag state · 7f46a0b7
      Mark Bloch authored
      
      
      Lag state has become very complicated with many modes, flags, types and
      port selections methods and future work will add additional features.
      
      Add a debugfs to query the current lag state. A new directory named "lag"
      will be created under the mlx5 debugfs directory. As the driver has
      debugfs per pci function the location will be: <debugfs>/mlx5/<BDF>/lag
      
      For example:
      /sys/kernel/debug/mlx5/0000:08:00.0/lag
      
      The following files are exposed:
      
      - state: Returns "active" or "disabled". If "active" it means hardware
               lag is active.
      
      - members: Returns the BDFs of all the members of lag object.
      
      - type: Returns the type of the lag currently configured. Valid only
      	if hardware lag is active.
      	* "roce" - Members are bare metal PFs.
      	* "switchdev" - Members are in switchdev mode.
      	* "multipath" - ECMP offloads.
      
      - port_sel_mode: Returns the egress port selection method, valid
      		 only if hardware lag is active.
      		 * "queue_affinity" - Egress port is selected by
      		   the QP/SQ affinity.
      		 * "hash" - Egress port is selected by hash done on
      		   each packet. Controlled by: xmit_hash_policy of the
      		   bond device.
      - flags: Returns flags that are specific per lag @type. Valid only if
      	 hardware lag is active.
      	 * "shared_fdb" - "on" or "off", if "on" single FDB is used.
      
      - mapping: Returns the mapping which is used to select egress port.
      	   Valid only if hardware lag is active.
      	   If @port_sel_mode is "hash" returns the active egress ports.
      	   The hash result will select only active ports.
      	   if @port_sel_mode is "queue_affinity" returns the mapping
      	   between the configured port affinity of the QP/SQ and actual
      	   egress port. For example:
      	   * 1:1 - Mapping means if the configured affinity is port 1
      	           traffic will egress via port 1.
      	   * 1:2 - Mapping means if the configured affinity is port 1
      		   traffic will egress via port 2. This can happen
      		   if port 1 is down or in active/backup mode and port 1
      		   is backup.
      
      Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7f46a0b7
    • Mark Bloch's avatar
      net/mlx5: Lag, use buckets in hash mode · 352899f3
      Mark Bloch authored
      
      
      When in hardware lag and the NIC has more than 2 ports when one port
      goes down need to distribute the traffic between the remaining
      active ports.
      
      For better spread in such cases instead of using 1-to-1 mapping and only
      4 slots in the hash, use many.
      
      Each port will have many slots that point to it. When a port goes down
      go over all the slots that pointed to that port and spread them between
      the remaining active ports. Once the port comes back restore the default
      mapping.
      
      We will have number_of_ports * MLX5_LAG_MAX_HASH_BUCKETS slots.
      Each MLX5_LAG_MAX_HASH_BUCKETS belong to a different port.
      The native mapping is such that:
      
      port 1: The first MLX5_LAG_MAX_HASH_BUCKETS slots are: [1, 1, .., 1]
      which means if a packet is hased into one of this slots it will hit the
      wire via port 1.
      
      port 2: The second MLX5_LAG_MAX_HASH_BUCKETS slots are: [2, 2, .., 2]
      which means if a packet is hased into one of this slots it will hit the
      wire via port2.
      
      and this mapping is the same of the rest of the ports.
      On a failover, lets say port 2 goes down (port 1, 3, 4 are still up).
      the new mapping for port 2 will be:
      
      port 2: The second MLX5_LAG_MAX_HASH_BUCKETS are: [1, 3, 1, 4, .., 4]
      which means the mapping was changed from the native mapping to a mapping
      that consists of only the active ports.
      
      With this if a port goes down the traffic will be split between the
      active ports randomly
      
      Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      352899f3
    • Mark Bloch's avatar
      net/mlx5: Lag, refactor dmesg print · 24b3599e
      Mark Bloch authored
      
      
      Combine dmesg lag prints into a single function.
      
      Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      24b3599e