1. 15 Oct, 2019 5 commits
    • David Ahern's avatar
      net: Update address for vrf and l3mdev in MAINTAINERS · 14f2cf60
      David Ahern authored
      Use my kernel.org address for all entries in MAINTAINERS.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14f2cf60
    • David S. Miller's avatar
      Merge branch 'Scatter-gather-SPI-for-SJA1105-DSA' · 1c9dc2b5
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Scatter/gather SPI for SJA1105 DSA
      
      This is a small series that reduces the stack memory usage for the
      sja1105 driver.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c9dc2b5
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Switch to scatter/gather API for SPI · 08839c06
      Vladimir Oltean authored
      This reworks the SPI transfer implementation to make use of more of the
      SPI core features. The main benefit is to avoid the memcpy in
      sja1105_xfer_buf().
      
      The memcpy was only needed because the function was transferring a
      single buffer at a time. So it needed to copy the caller-provided buffer
      at buf + 4, to store the SPI message header in the "headroom" area.
      
      But the SPI core supports scatter-gather messages, comprised of multiple
      transfers. We can actually use those to break apart every SPI message
      into 2 transfers: one for the header and one for the actual payload.
      
      To keep the behavior the same regarding the chip select signal, it is
      necessary to tell the SPI core to de-assert the chip select after each
      chunk. This was not needed before, because each spi_message contained
      only 1 single transfer.
      
      The meaning of the per-transfer cs_change=1 is:
      
      - If the transfer is the last one of the message, keep CS asserted
      - Otherwise, deassert CS
      
      We need to deassert CS in the "otherwise" case, which was implicit
      before.
      
      Avoiding the memcpy creates yet another opportunity. The device can't
      process more than 256 bytes of SPI payload at a time, so the
      sja1105_xfer_long_buf() function used to exist, to split the larger
      caller buffer into chunks.
      
      But these chunks couldn't be used as scatter/gather buffers for
      spi_message until now, because of that memcpy (we would have needed more
      memory for each chunk). So we can now remove the sja1105_xfer_long_buf()
      function and have a single implementation for long and short buffers.
      
      Another benefit is lower usage of stack memory. Previously we had to
      store 2 SPI buffers for each chunk. Due to the elimination of the
      memcpy, we can now send pointers to the actual chunks from the
      caller-supplied buffer to the SPI core.
      
      Since the patch merges two functions into a rewritten implementation,
      the function prototype was also changed, mainly for cosmetic consistency
      with the structures used within it.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08839c06
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Move sja1105_spi_transfer into sja1105_xfer · 8a559400
      Vladimir Oltean authored
      This is a cosmetic patch that reduces some boilerplate in the SPI
      interaction of the driver.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8a559400
    • Colin Ian King's avatar
      net: b44: remove redundant assignment to variable reg · f58a887e
      Colin Ian King authored
      The variable reg is being assigned a value that is never read
      and is being re-assigned in the following for-loop. The
      assignment is redundant and hence can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f58a887e
  2. 14 Oct, 2019 6 commits
    • David S. Miller's avatar
      Merge branch 'PTP-driver-refactoring-for-SJA1105-DSA' · 85a83a8f
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      PTP driver refactoring for SJA1105 DSA
      
      This series creates a better separation between the driver core and the
      PTP portion. Therefore, users who are not interested in PTP can get a
      simpler and smaller driver by compiling it out.
      
      This is in preparation for further patches: SPI transfer timestamping,
      synchronizing the hardware clock (as opposed to keeping it
      free-running), PPS input/output, etc.
      ====================
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85a83a8f
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Change the PTP command access pattern · 66427778
      Vladimir Oltean authored
      The PTP command register contains enable bits for:
      - Putting the 64-bit PTPCLKVAL register in add/subtract or write mode
      - Taking timestamps off of the corrected vs free-running clock
      - Starting/stopping the TTEthernet scheduling
      - Starting/stopping PPS output
      - Resetting the switch
      
      When a command needs to be issued (e.g. "change the PTPCLKVAL from write
      mode to add/subtract mode"), one cannot simply write to the command
      register setting the PTPCLKADD bit to 1, because that would zeroize the
      other settings. One also cannot do a read-modify-write (that would be
      too easy for this hardware) because not all bits of the command register
      are readable over SPI.
      
      So this leaves us with the only option of keeping the value of the PTP
      command register in the driver, and operating on that.
      
      Actually there are 2 types of PTP operations now:
      - Operations that modify the cached PTP command. These operate on
        ptp_data->cmd as a pointer.
      - Operations that apply all previously cached PTP settings, but don't
        otherwise cache what they did themselves. The sja1105_ptp_reset
        function is such an example. It copies the ptp_data->cmd on stack
        before modifying and writing it to SPI.
      
      This practically means that struct sja1105_ptp_cmd is no longer an
      implementation detail, since it needs to be stored in full into struct
      sja1105_ptp_data, and hence in struct sja1105_private. So the (*ptp_cmd)
      function prototype can change and take struct sja1105_ptp_cmd as second
      argument now.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66427778
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Move PTP data to its own private structure · a9d6ed7a
      Vladimir Oltean authored
      This is a non-functional change with 2 goals (both for the case when
      CONFIG_NET_DSA_SJA1105_PTP is not enabled):
      
      - Reduce the size of the sja1105_private structure.
      - Make the PTP code more self-contained.
      
      Leaving priv->ptp_data.lock to be initialized in sja1105_main.c is not a
      leftover: it will be used in a future patch "net: dsa: sja1105: Restore
      PTP time after switch reset".
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a9d6ed7a
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Make all public PTP functions take dsa_switch as argument · 61c77126
      Vladimir Oltean authored
      The new rule (as already started for sja1105_tas.h) is for functions of
      optional driver components (ones which may be disabled via Kconfig - PTP
      and TAS) to take struct dsa_switch *ds instead of struct sja1105_private
      *priv as first argument.
      
      This is so that forward-declarations of struct sja1105_private can be
      avoided.
      
      So make sja1105_ptp.h the second user of this rule.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61c77126
    • Vladimir Oltean's avatar
      net: dsa: sja1105: Get rid of global declaration of struct ptp_clock_info · 5b3ae43a
      Vladimir Oltean authored
      We need priv->ptp_caps to hold a structure and not just a pointer,
      because we use container_of in the various PTP callbacks.
      
      Therefore, the sja1105_ptp_caps structure declared in the global memory
      of the driver serves no further purpose after copying it into
      priv->ptp_caps.
      
      So just populate priv->ptp_caps with the needed operations and remove
      sja1105_ptp_caps.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b3ae43a
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · a98d62c3
      David S. Miller authored
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf-next 2019-10-14
      
      The following pull-request contains BPF updates for your *net-next* tree.
      
      12 days of development and
      85 files changed, 1889 insertions(+), 1020 deletions(-)
      
      The main changes are:
      
      1) auto-generation of bpf_helper_defs.h, from Andrii.
      
      2) split of bpf_helpers.h into bpf_{helpers, helper_defs, endian, tracing}.h
         and move into libbpf, from Andrii.
      
      3) Track contents of read-only maps as scalars in the verifier, from Andrii.
      
      4) small x86 JIT optimization, from Daniel.
      
      5) cross compilation support, from Ivan.
      
      6) bpf flow_dissector enhancements, from Jakub and Stanislav.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a98d62c3
  3. 13 Oct, 2019 3 commits
  4. 12 Oct, 2019 26 commits