1. 30 Jun, 2020 13 commits
    • David S. Miller's avatar
      Merge branch 'TC-Introduce-qevents' · 989d957a
      David S. Miller authored
      Petr Machata says:
      
      ====================
      TC: Introduce qevents
      
      The Spectrum hardware allows execution of one of several actions as a
      result of queue management decisions: tail-dropping, early-dropping,
      marking a packet, or passing a configured latency threshold or buffer
      size. Such packets can be mirrored, trapped, or sampled.
      
      Modeling the action to be taken as simply a TC action is very attractive,
      but it is not obvious where to put these actions. At least with ECN marking
      one could imagine a tree of qdiscs and classifiers that effectively
      accomplishes this task, albeit in an impractically complex manner. But
      there is just no way to match on dropped-ness of a packet, let alone
      dropped-ness due to a particular reason.
      
      To allow configuring user-defined actions as a result of inner workings of
      a qdisc, this patch set introduces a concept of qevents. Those are attach
      points for TC blocks, where filters can be put that are executed as the
      packet hits well-defined points in the qdisc algorithms. The attached
      blocks can be shared, in a manner similar to clsact ingress and egress
      blocks, arbitrary classifiers with arbitrary actions can be put on them,
      etc.
      
      For example:
      
      	red limit 500K avpkt 1K qevent early_drop block 10
      	matchall action mirred egress mirror dev eth1
      
      The central patch #2 introduces several helpers to allow easy and uniform
      addition of qevents to qdiscs: initialization, destruction, qevent block
      number change validation, and qevent handling, i.e. dispatch of the filters
      attached to the block bound to a qevent.
      
      Patch #1 adds root_lock argument to qdisc enqueue op. The problem this is
      tackling is that if a qevent filter pushes packets to the same qdisc tree
      that holds the qevent in the first place, attempt to take qdisc root lock
      for the second time will lead to a deadlock. To solve the issue, qevent
      handler needs to unlock and relock the root lock around the filter
      processing. Passing root_lock around makes it possible to get the lock
      where it is needed, and visibly so, such that it is obvious the lock will
      be used when invoking a qevent.
      
      The following two patches, #3 and #4, then add two qevents to the RED
      qdisc: "early_drop" qevent fires when a packet is early-dropped; "mark"
      qevent, when it is ECN-marked.
      
      Patch #5 contains a selftest. I have mentioned this test when pushing the
      RED ECN nodrop mode and said that "I have no confidence in its portability
      to [...] different configurations". That still holds. The backlog and
      packet size are tuned to make the test deterministic. But it is better than
      nothing, and on the boxes that I ran it on it does work and shows that
      qevents work the way they are supposed to, and that their addition has not
      broken the other tested features.
      
      This patch set does not deal with offloading. The idea there is that a
      driver will be able to figure out that a given block is used in qevent
      context by looking at binder type. A future patch-set will add a qdisc
      pointer to struct flow_block_offload, which a driver will be able to
      consult to glean the TC or other relevant attributes.
      
      Changes from RFC to v1:
      - Move a "q = qdisc_priv(sch)" from patch #3 to patch #4
      - Fix deadlock caused by mirroring packet back to the same qdisc tree.
      - Rename "tail" qevent to "tail_drop".
      - Adapt to the new 100-column standard.
      - Add a selftest
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      989d957a
    • Petr Machata's avatar
      selftests: forwarding: Add a RED test for SW datapath · 6cf0291f
      Petr Machata authored
      This test is inspired by the mlxsw RED selftest. It is much simpler to set
      up (also because there is no point in testing PRIO / RED encapsulation). It
      tests bare RED, ECN and ECN+nodrop modes of operation. On top of that it
      tests RED early_drop and mark qevents.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6cf0291f
    • Petr Machata's avatar
      net: sched: sch_red: Add qevents "early_drop" and "mark" · aee9caa0
      Petr Machata authored
      In order to allow acting on dropped and/or ECN-marked packets, add two new
      qevents to the RED qdisc: "early_drop" and "mark". Filters attached at
      "early_drop" block are executed as packets are early-dropped, those
      attached at the "mark" block are executed as packets are ECN-marked.
      
      Two new attributes are introduced: TCA_RED_EARLY_DROP_BLOCK with the block
      index for the "early_drop" qevent, and TCA_RED_MARK_BLOCK for the "mark"
      qevent. Absence of these attributes signifies "don't care": no block is
      allocated in that case, or the existing blocks are left intact in case of
      the change callback.
      
      For purposes of offloading, blocks attached to these qevents appear with
      newly-introduced binder types, FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP and
      FLOW_BLOCK_BINDER_TYPE_RED_MARK.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aee9caa0
    • Petr Machata's avatar
      net: sched: sch_red: Split init and change callbacks · 65545ea2
      Petr Machata authored
      In the following patches, RED will get two qevents. The implementation will
      be clearer if the callback for change is not a pure subset of the callback
      for init. Split the two and promote attribute parsing to the callbacks
      themselves from the common code, because it will be handy there.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      65545ea2
    • Petr Machata's avatar
      net: sched: Introduce helpers for qevent blocks · 3625750f
      Petr Machata authored
      Qevents are attach points for TC blocks, where filters can be put that are
      executed when "interesting events" take place in a qdisc. The data to keep
      and the functions to invoke to maintain a qevent will be largely the same
      between qevents. Therefore introduce sched-wide helpers for qevent
      management.
      
      Currently, similarly to ingress and egress blocks of clsact pseudo-qdisc,
      blocks attachment cannot be changed after the qdisc is created. To that
      end, add a helper tcf_qevent_validate_change(), which verifies whether
      block index attribute is not attached, or if it is, whether its value
      matches the current one (i.e. there is no material change).
      
      The function tcf_qevent_handle() should be invoked when qdisc hits the
      "interesting event" corresponding to a block. This function releases root
      lock for the duration of executing the attached filters, to allow packets
      generated through user actions (notably mirred) to be reinserted to the
      same qdisc tree.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3625750f
    • Petr Machata's avatar
      net: sched: Pass root lock to Qdisc_ops.enqueue · aebe4426
      Petr Machata authored
      A following patch introduces qevents, points in qdisc algorithm where
      packet can be processed by user-defined filters. Should this processing
      lead to a situation where a new packet is to be enqueued on the same port,
      holding the root lock would lead to deadlocks. To solve the issue, qevent
      handler needs to unlock and relock the root lock when necessary.
      
      To that end, add the root lock argument to the qdisc op enqueue, and
      propagate throughout.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aebe4426
    • David S. Miller's avatar
      Merge branch 'net-ethernet-ti-am65-cpsw-update-and-enable-sr2-0-soc' · 5e701e49
      David S. Miller authored
      Grygorii Strashko says:
      
      ====================
      net: ethernet: ti: am65-cpsw: update and enable sr2.0 soc
      
      This series contains set of improvements for TI AM654x/J721E CPSW2G driver and
      adds support for TI AM654x SR2.0 SoC.
      
      Patch 1: adds vlans restoration after "if down/up"
      Patches 2-5: improvments
      Patch 6: adds support for TI AM654x SR2.0 SoC which allows to disable errata i2027 W/A.
      By default, errata i2027 W/A (TX csum offload disabled) is enabled on AM654x SoC
      for backward compatibility, unless SR2.0 SoC is identified using SOC BUS framework.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5e701e49
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw-nuss: enable am65x sr2.0 support · 38389aa6
      Grygorii Strashko authored
      The AM65x SR2.0 MCU CPSW has fixed errata i2027 "CPSW: CPSW Does Not
      Support CPPI Receive Checksum (Host to Ethernet) Offload Feature". This
      errata also fixed for J271E SoC.
      
      Use SOC bus data for K3 SoC identification and apply i2027 errata w/a only
      for the AM65x SR1.0 SoC.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38389aa6
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw-ethtool: configured critical setting only when no running netdevs · 3d0fda90
      Grygorii Strashko authored
      Ensure that critical setting can only be configured when there are no
      running netdevs - all ports are down.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d0fda90
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw-ethtool: skip hw cfg when change p0-rx-ptype-rrobin · 7d58d3eb
      Grygorii Strashko authored
      Skip HW configuration when p0-rx-ptype-rrobin is changed as it will be done
      by .ndev_open(),
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d58d3eb
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw-nuss: fix ports mac sl initialization · d6d0aeaf
      Grygorii Strashko authored
      The MAC SL has to be initialized for each port otherwise
      am65_cpsw_nuss_slave_disable_unused() will crash for disabled ports.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d6d0aeaf
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw: move to pf_p0_rx_ptype_rrobin init in probe · 51824048
      Grygorii Strashko authored
      The pf_p0_rx_ptype_rrobin is global parameter so move its initialization in
      probe.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      51824048
    • Grygorii Strashko's avatar
      net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up · 7bcffde0
      Grygorii Strashko authored
      The vlan configuration is not restored after interface down/up sequence.
      
      Steps to check:
       # ip link add link eth0 name eth0.100 type vlan id 100
       # ifconfig eth0 down
       # ifconfig eth0 up
      
      This patch fixes it, restoring vlan ALE entries on .ndo_open().
      
      Fixes: 93a76530 ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7bcffde0
  2. 29 Jun, 2020 27 commits