1. 03 10月, 2020 2 次提交
  2. 01 10月, 2020 11 次提交
  3. 30 9月, 2020 11 次提交
    • V
      net: mscc: ocelot: automatically detect VCAP constants · 20968054
      Vladimir Oltean 提交于
      The numbers in struct vcap_props are not intuitive to derive, because
      they are not a straightforward copy-and-paste from the reference manual
      but instead rely on a fairly detailed level of understanding of the
      layout of an entry in the TCAM and in the action RAM. For this reason,
      bugs are very easy to introduce here.
      
      Ease the work of hardware porters and read from hardware the constants
      that were exported for this particular purpose. Note that this implies
      that struct vcap_props can no longer be const.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      20968054
    • V
      net: mscc: ocelot: add definitions for VCAP ES0 keys, actions and target · e3aea296
      Vladimir Oltean 提交于
      As a preparation step for the offloading to ES0, let's create the
      infrastructure for talking with this hardware block.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e3aea296
    • V
      net: mscc: ocelot: add definitions for VCAP IS1 keys, actions and target · a61e365d
      Vladimir Oltean 提交于
      As a preparation step for the offloading to IS1, let's create the
      infrastructure for talking with this hardware block.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a61e365d
    • V
      net: mscc: ocelot: generalize existing code for VCAP · c1c3993e
      Vladimir Oltean 提交于
      In the Ocelot switches there are 3 TCAMs: VCAP ES0, IS1 and IS2, which
      have the same configuration interface, but different sets of keys and
      actions. The driver currently only supports VCAP IS2.
      
      In preparation of VCAP IS1 and ES0 support, the existing code must be
      generalized to work with any VCAP.
      
      In that direction, we should move the structures that depend upon VCAP
      instantiation, like vcap_is2_keys and vcap_is2_actions, out of struct
      ocelot and into struct vcap_props .keys and .actions, a structure that
      is replicated 3 times, once per VCAP. We'll pass that structure as an
      argument to each function that does the key and action packing - only
      the control logic needs to distinguish between ocelot->vcap[VCAP_IS2]
      or IS1 or ES0.
      
      Another change is to make use of the newly introduced ocelot_target_read
      and ocelot_target_write API, since the 3 VCAPs have the same registers
      but put at different addresses.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c1c3993e
    • V
      net: mscc: ocelot: introduce a new ocelot_target_{read,write} API · 3c0e37a9
      Vladimir Oltean 提交于
      There are some targets (register blocks) in the Ocelot switch that are
      instantiated more than once. For example, the VCAP IS1, IS2 and ES0
      blocks all share the same register layout for interacting with the cache
      for the TCAM and the action RAM.
      
      For the VCAPs, the procedure for servicing them is actually common. We
      just need an API specifying which VCAP we are talking to, and we do that
      via these raw ocelot_target_read and ocelot_target_write accessors.
      
      In plain ocelot_read, the target is encoded into the register enum
      itself:
      
      	u16 target = reg >> TARGET_OFFSET;
      
      For the VCAPs, the registers are currently defined like this:
      
      	enum ocelot_reg {
      	[...]
      		S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
      		S2_CORE_MV_CFG,
      		S2_CACHE_ENTRY_DAT,
      		S2_CACHE_MASK_DAT,
      		S2_CACHE_ACTION_DAT,
      		S2_CACHE_CNT_DAT,
      		S2_CACHE_TG_DAT,
      	[...]
      	};
      
      which is precisely what we want to avoid, because we'd have to duplicate
      the same register map for S1 and for S0, and then figure out how to pass
      VCAP instance-specific registers to the ocelot_read calls (basically
      another lookup table that undoes the effect of shifting with
      TARGET_OFFSET).
      
      So for some targets, propose a more raw API, similar to what is
      currently done with ocelot_port_readl and ocelot_port_writel. Those
      targets can only be accessed with ocelot_target_{read,write} and not
      with ocelot_{read,write} after the conversion, which is fine.
      
      The VCAP registers are not actually modified to use this new API as of
      this patch. They will be modified in the next one.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3c0e37a9
    • S
      net: Add netif_rx_any_context() · c11171a4
      Sebastian Andrzej Siewior 提交于
      Quite some drivers make conditional decisions based on in_interrupt() to
      invoke either netif_rx() or netif_rx_ni().
      
      Conditionals based on in_interrupt() or other variants of preempt count
      checks in drivers should not exist for various reasons and Linus clearly
      requested to either split the code pathes or pass an argument to the
      common functions which provides the context.
      
      This is obviously the correct solution, but for some of the affected
      drivers this needs a major rewrite due to their convoluted structure.
      
      As in_interrupt() usage in drivers needs to be phased out, provide
      netif_rx_any_context() as a stop gap for these drivers.
      
      This confines the in_interrupt() conditional to core code which in turn
      allows to remove the access to this check for driver code and provides one
      central place to do further modifications once the driver maze is cleaned
      up.
      Suggested-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c11171a4
    • T
      net: caif: Remove unused caif SPI driver · f2bf88c4
      Thomas Gleixner 提交于
      While chasing in_interrupt() (ab)use in drivers it turned out that the
      caif_spi driver has never been in use since the driver was merged 10 years
      ago. There never was any matching code which provides a platform device.
      
      The driver has not seen any update (asided of treewide changes and
      cleanups) since 8 years and the maintainers vanished from the planet.
      
      So analysing the potential contexts and the (in)correctness of
      in_interrupt() usage is just a pointless exercise.
      
      Remove the cruft.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f2bf88c4
    • J
      devlink: include <linux/const.h> for _BITUL · 2ec13cbc
      Jacob Keller 提交于
      Commit 5d5b4128 ("devlink: introduce flash update overwrite mask")
      added a usage of _BITUL to the UAPI <linux/devlink.h> header, but failed
      to include the header file where it was defined. It happens that this
      does not break any existing kernel include chains because it gets
      included through other sources. However, when including the UAPI headers
      in a userspace application (such as devlink in iproute2), _BITUL is not
      defined.
      
      Fixes: 5d5b4128 ("devlink: introduce flash update overwrite mask")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ec13cbc
    • T
      l2tp: report rx cookie discards in netlink get · 3f47cb4c
      Tom Parkin 提交于
      When an L2TPv3 session receives a data frame with an incorrect cookie
      l2tp_core logs a warning message and bumps a stats counter to reflect
      the fact that the packet has been dropped.
      
      However, the stats counter in question is missing from the l2tp_netlink
      get message for tunnel and session instances.
      
      Include the statistic in the netlink get response.
      Signed-off-by: NTom Parkin <tparkin@katalix.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3f47cb4c
    • T
      bpf: Support attaching freplace programs to multiple attach points · 4a1e7c0c
      Toke Høiland-Jørgensen 提交于
      This enables support for attaching freplace programs to multiple attach
      points. It does this by amending the UAPI for bpf_link_Create with a target
      btf ID that can be used to supply the new attachment point along with the
      target program fd. The target must be compatible with the target that was
      supplied at program load time.
      
      The implementation reuses the checks that were factored out of
      check_attach_btf_id() to ensure compatibility between the BTF types of the
      old and new attachment. If these match, a new bpf_tracing_link will be
      created for the new attach target, allowing multiple attachments to
      co-exist simultaneously.
      
      The code could theoretically support multiple-attach of other types of
      tracing programs as well, but since I don't have a use case for any of
      those, there is no API support for doing so.
      Signed-off-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/160138355169.48470.17165680973640685368.stgit@toke.dk
      4a1e7c0c
    • T
      bpf: Move prog->aux->linked_prog and trampoline into bpf_link on attach · 3aac1ead
      Toke Høiland-Jørgensen 提交于
      In preparation for allowing multiple attachments of freplace programs, move
      the references to the target program and trampoline into the
      bpf_tracing_link structure when that is created. To do this atomically,
      introduce a new mutex in prog->aux to protect writing to the two pointers
      to target prog and trampoline, and rename the members to make it clear that
      they are related.
      
      With this change, it is no longer possible to attach the same tracing
      program multiple times (detaching in-between), since the reference from the
      tracing program to the target disappears on the first attach. However,
      since the next patch will let the caller supply an attach target, that will
      also make it possible to attach to the same place multiple times.
      Signed-off-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/160138355059.48470.2503076992210324984.stgit@toke.dk
      3aac1ead
  4. 29 9月, 2020 11 次提交
  5. 28 9月, 2020 1 次提交
  6. 27 9月, 2020 4 次提交
    • V
      net: dsa: point out the tail taggers · 7a6ffe76
      Vladimir Oltean 提交于
      The Marvell 88E6060 uses tag_trailer.c and the KSZ8795, KSZ9477 and
      KSZ9893 switches also use tail tags.
      
      Tell that to the DSA core, since this makes a difference for the flow
      dissector. Most switches break the parsing of frame headers, but these
      ones don't, so no flow dissector adjustment needs to be done for them.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7a6ffe76
    • V
      net: dsa: add a generic procedure for the flow dissector · 9790cf20
      Vladimir Oltean 提交于
      For all DSA formats that don't use tail tags, it looks like behind the
      obscure number crunching they're all doing the same thing: locating the
      real EtherType behind the DSA tag. Nonetheless, this is not immediately
      obvious, so create a generic helper for those DSA taggers that put the
      header before the EtherType.
      
      Another assumption for the generic function is that the DSA tags are of
      equal length on RX and on TX. Prior to the previous patch, this was not
      true for ocelot and for gswip. The problem was resolved for ocelot, but
      for gswip it still remains, so that can't use this helper yet.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9790cf20
    • V
      net: dsa: make the .flow_dissect tagger callback return void · 2e8cb1b3
      Vladimir Oltean 提交于
      There is no tagger that returns anything other than zero, so just change
      the return type appropriately.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2e8cb1b3
    • V
      net: dsa: tag_ocelot: use a short prefix on both ingress and egress · 5124197c
      Vladimir Oltean 提交于
      There are 2 goals that we follow:
      
      - Reduce the header size
      - Make the header size equal between RX and TX
      
      The issue that required long prefix on RX was the fact that the ocelot
      DSA tag, being put before Ethernet as it is, would overlap with the area
      that a DSA master uses for RX filtering (destination MAC address
      mainly).
      
      Now that we can ask DSA to put the master in promiscuous mode, in theory
      we could remove the prefix altogether and call it a day, but it looks
      like we can't. Using no prefix on ingress, some packets (such as ICMP)
      would be received, while others (such as PTP) would not be received.
      This is because the DSA master we use (enetc) triggers parse errors
      ("MAC rx frame errors") presumably because it sees Ethernet frames with
      a bad length. And indeed, when using no prefix, the EtherType (bytes
      12-13 of the frame, bits 96-111) falls over the REW_VAL field from the
      extraction header, aka the PTP timestamp.
      
      When turning the short (32-bit) prefix on, the EtherType overlaps with
      bits 64-79 of the extraction header, which are a reserved area
      transmitted as zero by the switch. The packets are not dropped by the
      DSA master with a short prefix. Actually, the frames look like this in
      tcpdump (below is a PTP frame, with an extra dsa_8021q tag - dadb 0482 -
      added by a downstream sja1105).
      
      89:0c:a9:f2:01:00 > 88:80:00:0a:00:1d, 802.3, length 0: LLC, \
      	dsap Unknown (0x10) Individual, ssap ProWay NM (0x0e) Response, \
      	ctrl 0x0004: Information, send seq 2, rcv seq 0, \
      	Flags [Response], length 78
      
      0x0000:  8880 000a 001d 890c a9f2 0100 0000 100f  ................
      0x0010:  0400 0000 0180 c200 000e 001f 7b63 0248  ............{c.H
      0x0020:  dadb 0482 88f7 1202 0036 0000 0000 0000  .........6......
      0x0030:  0000 0000 0000 0000 0000 001f 7bff fe63  ............{..c
      0x0040:  0248 0001 1f81 0500 0000 0000 0000 0000  .H..............
      0x0050:  0000 0000 0000 0000 0000 0000            ............
      
      So the short prefix is our new default: we've shortened our RX frames by
      12 octets, increased TX by 4, and headers are now equal between RX and
      TX. Note that we still need promiscuous mode for the DSA master to not
      drop it.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5124197c