1. 03 10月, 2020 5 次提交
    • X
      net: mscc: ocelot: offload egress VLAN rewriting to VCAP ES0 · 2f17c050
      Xiaoliang Yang 提交于
      VCAP ES0 is an egress VCAP operating on all outgoing frames.
      This patch added ES0 driver to support vlan push action of tc filter.
      Usage:
      
      tc filter add dev swp1 egress protocol 802.1Q flower indev swp0 skip_sw \
              vlan_id 1 vlan_prio 1 action vlan push id 2 priority 2
      Signed-off-by: NXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2f17c050
    • X
      net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1 · 75944fda
      Xiaoliang Yang 提交于
      VCAP IS1 is a VCAP module which can filter on the most common L2/L3/L4
      Ethernet keys, and modify the results of the basic QoS classification
      and VLAN classification based on those flow keys.
      
      There are 3 VCAP IS1 lookups, mapped over chains 10000, 11000 and 12000.
      Currently the driver is hardcoded to use IS1_ACTION_TYPE_NORMAL half
      keys.
      
      Note that the VLAN_MANGLE has been omitted for now. In hardware, the
      VCAP_IS1_ACT_VID_REPLACE_ENA field replaces the classified VLAN
      (metadata associated with the frame) and not the VLAN from the header
      itself. There are currently some issues which need to be addressed when
      operating in standalone, or in bridge with vlan_filtering=0 modes,
      because in those cases the switch ports have VLAN awareness disabled,
      and changing the classified VLAN to anything other than the pvid causes
      the packets to be dropped. Another issue is that on egress, we expect
      port tagging to push the classified VLAN, but port tagging is disabled
      in the modes mentioned above, so although the classified VLAN is
      replaced, it is not visible in the packet transmitted by the switch.
      Signed-off-by: NXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      75944fda
    • V
      net: mscc: ocelot: create TCAM skeleton from tc filter chains · 1397a2eb
      Vladimir Oltean 提交于
      For Ocelot switches, there are 2 ingress pipelines for flow offload
      rules: VCAP IS1 (Ingress Classification) and IS2 (Security Enforcement).
      IS1 and IS2 support different sets of actions. The pipeline order for a
      packet on ingress is:
      
      Basic classification -> VCAP IS1 -> VCAP IS2
      
      Furthermore, IS1 is looked up 3 times, and IS2 is looked up twice (each
      TCAM entry can be configured to match only on the first lookup, or only
      on the second, or on both etc).
      
      Because the TCAMs are completely independent in hardware, and because of
      the fixed pipeline, we actually have very limited options when it comes
      to offloading complex rules to them while still maintaining the same
      semantics with the software data path.
      
      This patch maps flow offload rules to ingress TCAMs according to a
      predefined chain index number. There is going to be a script in
      selftests that clarifies the usage model.
      
      There is also an egress TCAM (VCAP ES0, the Egress Rewriter), which is
      modeled on top of the default chain 0 of the egress qdisc, because it
      doesn't have multiple lookups.
      Suggested-by: NAllan W. Nielsen <allan.nielsen@microchip.com>
      Co-developed-by: NXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Signed-off-by: NXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1397a2eb
    • V
      net: mscc: ocelot: introduce conversion helpers between port and netdev · 319e4dd1
      Vladimir Oltean 提交于
      Since the mscc_ocelot_switch_lib is common between a pure switchdev and
      a DSA driver, the procedure of retrieving a net_device for a certain
      port index differs, as those are registered by their individual
      front-ends.
      
      Up to now that has been dealt with by always passing the port index to
      the switch library, but now, we're going to need to work with net_device
      pointers from the tc-flower offload, for things like indev, or mirred.
      It is not desirable to refactor that, so let's make sure that the flower
      offload core has the ability to translate between a net_device and a
      port index properly.
      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>
      319e4dd1
    • V
      net: mscc: ocelot: offload multiple tc-flower actions in same rule · ea9d1f30
      Vladimir Oltean 提交于
      At this stage, the tc-flower offload of mscc_ocelot can only delegate
      rules to the VCAP IS2 security enforcement block. These rules have, in
      hardware, separate bits for policing and for overriding the destination
      port mask and/or copying to the CPU. So it makes sense that we attempt
      to expose some more of that low-level complexity instead of simply
      choosing between a single type of action.
      
      Something similar happens with the VCAP IS1 block, where the same action
      can contain enable bits for VLAN classification and for QoS
      classification at the same time.
      
      So model the action structure after the hardware description, and let
      the high-level ocelot_flower.c construct an action vector from multiple
      tc actions.
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea9d1f30
  2. 30 9月, 2020 13 次提交
  3. 27 9月, 2020 1 次提交
    • V
      net: mscc: ocelot: move NPI port configuration to DSA · 2d44b097
      Vladimir Oltean 提交于
      Remove the ocelot_configure_cpu() function, which was in fact bringing
      up 2 ports: the CPU port module, which both switchdev and DSA have, and
      the NPI port, which only DSA has.
      
      The (non-Ethernet) CPU port module is at a fixed index in the analyzer,
      whereas the NPI port is selected through the "ethernet" property in the
      device tree.
      
      Therefore, the function to set up an NPI port is DSA-specific, so we
      move it there, simplifying the ocelot switch library a little bit.
      
      Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: UNGLinuxDriver <UNGLinuxDriver@microchip.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2d44b097
  4. 25 9月, 2020 1 次提交
  5. 22 9月, 2020 1 次提交
  6. 19 9月, 2020 8 次提交
  7. 24 8月, 2020 1 次提交
  8. 28 7月, 2020 1 次提交
  9. 23 7月, 2020 1 次提交
    • V
      net: mscc: ocelot: fix non-initialized CPU port on VSC7514 · 8bb849d6
      Vladimir Oltean 提交于
      The VSC7514 is marketed as a 10-port switch, however it has 11 physical
      ports (0->10) in the block diagram:
      https://www.microsemi.com/product-directory/ethernet-switches/3992-vsc7514
      (also in the device tree at arch/mips/boot/dts/mscc/ocelot.dtsi)
      
      Additionally, by architecture it has one more entry in the analyzer
      block, situated right after the physical ports, for the CPU port module.
      This is not a physical port, it only represents a channel for frame
      injection and extraction. That entry for the CPU port is at index 11 in
      the analyzer.
      
      When the register groups for QSYS_SWITCH_PORT_MODE, SYS_PORT_MODE and
      SYS_PAUSE_CFG are declared to be replicated 11 times, the 11th entry in
      the array of regfields is not initialized, so the CPU port module is not
      initialized either.
      
      The documentation of QSYS_SWITCH_PORT_MODE for VSC7514 also says that
      this register group is replicated 12 times, so this patch is simply
      reflecting that and not introducing any further inconsistency.
      
      Fixes: 886e1387 ("net: mscc: ocelot: convert QSYS_SWITCH_PORT_MODE and SYS_PORT_MODE to regfields")
      Fixes: 541132f0 ("net: mscc: ocelot: convert SYS_PAUSE_CFG register access to regfield")
      Reported-by: NBryan Whitehead <bryan.whitehead@microchip.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8bb849d6
  10. 20 7月, 2020 1 次提交
  11. 17 7月, 2020 1 次提交
    • V
      net: mscc: ocelot: rethink Kconfig dependencies again · 89e35f66
      Vladimir Oltean 提交于
      Having the users of MSCC_OCELOT_SWITCH_LIB depend on REGMAP_MMIO was a
      bad idea, since that symbol is not user-selectable. So we should have
      kept a 'select REGMAP_MMIO'.
      
      When we do that, we run into 2 more problems:
      
      - By depending on GENERIC_PHY, we are causing a recursive dependency.
        But it looks like GENERIC_PHY has no other dependencies, and other
        drivers select it, so we can select it too:
      
      drivers/of/Kconfig:69:error: recursive dependency detected!
      drivers/of/Kconfig:69:  symbol OF_IRQ depends on IRQ_DOMAIN
      kernel/irq/Kconfig:68:  symbol IRQ_DOMAIN is selected by REGMAP
      drivers/base/regmap/Kconfig:7:  symbol REGMAP default is visible depending on REGMAP_MMIO
      drivers/base/regmap/Kconfig:39: symbol REGMAP_MMIO is selected by MSCC_OCELOT_SWITCH_LIB
      drivers/net/ethernet/mscc/Kconfig:15:   symbol MSCC_OCELOT_SWITCH_LIB is selected by MSCC_OCELOT_SWITCH
      drivers/net/ethernet/mscc/Kconfig:22:   symbol MSCC_OCELOT_SWITCH depends on GENERIC_PHY
      drivers/phy/Kconfig:8:  symbol GENERIC_PHY is selected by PHY_BCM_NS_USB3
      drivers/phy/broadcom/Kconfig:41:        symbol PHY_BCM_NS_USB3 depends on MDIO_BUS
      drivers/net/phy/Kconfig:13:     symbol MDIO_BUS depends on MDIO_DEVICE
      drivers/net/phy/Kconfig:6:      symbol MDIO_DEVICE is selected by PHYLIB
      drivers/net/phy/Kconfig:254:    symbol PHYLIB is selected by ARC_EMAC_CORE
      drivers/net/ethernet/arc/Kconfig:19:    symbol ARC_EMAC_CORE is selected by ARC_EMAC
      drivers/net/ethernet/arc/Kconfig:25:    symbol ARC_EMAC depends on OF_IRQ
      
      - By depending on PHYLIB, we are causing a recursive dependency. PHYLIB
        only has a single dependency, "depends on NETDEVICES", which we are
        already depending on, so we can again hack our way into conformance by
        turning the PHYLIB dependency into a select.
      
      drivers/of/Kconfig:69:error: recursive dependency detected!
      drivers/of/Kconfig:69:  symbol OF_IRQ depends on IRQ_DOMAIN
      kernel/irq/Kconfig:68:  symbol IRQ_DOMAIN is selected by REGMAP
      drivers/base/regmap/Kconfig:7:  symbol REGMAP default is visible depending on REGMAP_MMIO
      drivers/base/regmap/Kconfig:39: symbol REGMAP_MMIO is selected by MSCC_OCELOT_SWITCH_LIB
      drivers/net/ethernet/mscc/Kconfig:15:   symbol MSCC_OCELOT_SWITCH_LIB is selected by MSCC_OCELOT_SWITCH
      drivers/net/ethernet/mscc/Kconfig:22:   symbol MSCC_OCELOT_SWITCH depends on PHYLIB
      drivers/net/phy/Kconfig:254:    symbol PHYLIB is selected by ARC_EMAC_CORE
      drivers/net/ethernet/arc/Kconfig:19:    symbol ARC_EMAC_CORE is selected by ARC_EMAC
      drivers/net/ethernet/arc/Kconfig:25:    symbol ARC_EMAC depends on OF_IRQ
      
      Fixes: f4d0323b ("net: mscc: ocelot: convert MSCC_OCELOT_SWITCH into a library")
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      89e35f66
  12. 14 7月, 2020 6 次提交