1. 18 3月, 2020 1 次提交
  2. 09 3月, 2020 1 次提交
  3. 09 7月, 2019 2 次提交
  4. 19 6月, 2019 4 次提交
    • M
      net: mvpp2: cls: Add steering based on vlan Id and priority. · 1274daed
      Maxime Chevallier 提交于
      This commit allows using the vlan Id and priority as parts of the key
      for classification offload. These fields are extracted from the
      outermost tag, if multiple tags are present.
      
      Vlan Id and priority are considered as 2 different fields by the
      classifier, however the fields are both appended in the Header Extracted
      Key in the same layout as they are found in the tags. This means that
      when steering only based on the prio, a 16-bit slot is still taken in
      the HEK.
      
      The classifier doesn't allow extracting the DEI bit from the tag, so we
      explicitly prevent user from using this bit in the key.
      
      This commit adds the vlan priotity as a compatible HEK field for
      tagged traffic, meaning that we limit the possibility of extracting this
      field only to the flows that contain tagged traffic.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1274daed
    • M
      net: mvpp2: cls: right-justify the C2 TCAM keys · 12b8e2dd
      Maxime Chevallier 提交于
      The C2 TCAM used for classification uses a key (Header Extracted Key)
      built by concatenating several fields extracted from the packet header.
      
      After a lot of trial-and-error and some guess work, it seems the HEK is
      right justified, with the first fields being stored in the MSB, then
      concatenated up until the LSB.
      
      Until now, this doesn't cause any issue since all HEK fields we use are
      full bytes. However this is an issue for the upcoming VLAN id and pri
      extraction, which aren't full bytes.
      
      Rework the way we built that TCAM key, by changing the order in which we
      append the fields.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      12b8e2dd
    • M
      net: mvpp2: cls: Only select applicable flows of classification offload · 834df6ea
      Maxime Chevallier 提交于
      The way we currently handle classification offload and RSS is by having
      dedicated lookup sequences in the flow table, each being selected
      depending on several fields being present in the packet header.
      
      We need to make sure the classification operation we want to perform can
      be done in each flow we want to insert it into. As an example,
      classifying on VLAN tag can only be done on flows used for tagged
      traffic.
      
      This commit makes sure we don't insert rules in flows we aren't
      compatible with.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      834df6ea
    • M
      net: mvpp2: cls: Use a dedicated lu_type for the RSS lookup · c641af4f
      Maxime Chevallier 提交于
      When performing a TCAM lookup in the C2 engine, it's possible that
      multiple entries match the packet. To make sure the correct entry match
      when performing a lookup, the Flow Table can set a lookup type, which
      will be used in the TCAM lookup, thus preventing such false-positives.
      
      We need to make sure the RSS match doesn't interfere with other
      classification lookups, hence we use a dedicated lookup_type for it.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c641af4f
  5. 31 5月, 2019 1 次提交
  6. 29 5月, 2019 1 次提交
  7. 26 5月, 2019 5 次提交
  8. 24 5月, 2019 1 次提交
  9. 08 5月, 2019 1 次提交
  10. 06 5月, 2019 1 次提交
  11. 02 5月, 2019 4 次提交
    • M
      net: mvpp2: cls: Allow dropping packets with classification offload · bec2d46d
      Maxime Chevallier 提交于
      This commit introduces support for the "Drop" action in classification
      offload. This corresponds to the "-1" action with ethtool -N.
      
      This is achieved using the color marking actions available in the C2
      engine, which associate a color to a packet. These colors can be either
      Green, Yellow or Red, Red meaning that the packet should be dropped.
      
      Green and Yellow colors are interpreted by the Policer, which isn't
      supported yet.
      
      This method of dropping using the Classifier is different than the
      already existing early-drop features, such as VLAN filtering and MAC
      UC/MC filtering, which are performed during the Parsing step, and
      therefore take precedence over classification actions.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bec2d46d
    • M
      net: mvpp2: cls: Add Classification offload support · 90b509b3
      Maxime Chevallier 提交于
      This commit introduces basic classification offloading support for the
      PPv2 controller.
      
      The PPv2 classifier has many classification engines, for now we only use
      the C2 TCAM match engine.
      
      This engine allows to perform ternary lookups on 64 bits keys (called
      Header Extracted Key), that are built by extracting fields from the packet
      header and concatenating them. At most 4 fields can be extracted for a
      single lookup.
      
      This basic implementation allows to build the HEK from the following
      fields :
       - L4 source and destination ports (for UDP and TCP)
      
      More fields are to be added in the future.
      
      Classification flows are added through the ethtool interface, using the
      newly introduced flow_rule infrastructure as an internal rule
      representation, allowing to more easily implement tc flower rules if
      need be.
      
      The internal design for now allocates one range of 4 rules per port
      due to the internal design of the flow table, which uses 22 sub-flows.
      
      When inserting a classification rule, the rule is created in every
      relevant sub-flow.
      
      This low rule-count is a very simple design which reaches quickly the
      limitations of the flow table ordering, but guarantees that the rule
      ordering will always be respected.
      
      This commit only introduces support for the "steer to rxq" action.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      90b509b3
    • M
      net: mvpp2: cls: Use a bitfield to represent the flow_type · 84e90b0b
      Maxime Chevallier 提交于
      As of today, the classification code is used only for RSS. We split the
      incoming traffic into multiple flows, that correspond to the ethtool
      flow_type parameter.
      
      We don't want to use the ethtool flow definitions such as TCP_V4_FLOW,
      for several reason :
      
       - We want to decorrelate the driver code from ethtool as much as
         possible, so that we can easily use other interfaces such as tc flower,
      
       - We want the flow_type to be a bitfield, so that we can match flows
         embedded into each other, such as TCP4 which is a subset of IP4.
      
      This commit does the conversion to the newer type.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      84e90b0b
    • M
      net: mvpp2: cls: Remove extra whitespace in mvpp2_cls_flow_write · 6f16a465
      Maxime Chevallier 提交于
      Cosmetic patch removing extra whitespaces when writing the flow_table
      entries
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f16a465
  12. 28 3月, 2019 12 次提交
  13. 16 7月, 2018 3 次提交
    • M
      net: mvpp2: debugfs: add classifier hit counters · f9d30d5b
      Maxime Chevallier 提交于
      The classification operations that are used for RSS make use of several
      lookup tables. Having hit counters for these tables is really helpful
      to determine what flows were matched by ingress traffic, and see the
      path of packets among all the classifier tables.
      
      This commit adds hit counters for the 3 tables used at the moment :
      
       - The decoding table (also called lookup_id table), that links flows
         identified by the Header Parser to the flow table.
      
         There's one entry per flow, located at :
         .../mvpp2/<controller>/flows/XX/dec_hits
      
         Note that there are 21 flows in the decoding table, whereas there are
         52 flows in the Header Parser. That's because there are several kind
         of traffic that will match a given flow. Reading the hit counter from
         one sub-flow will clear all hit counter that have the same flow_id.
      
         This also applies to the flow_hits.
      
       - The flow table, that contains all the different lookups to be
         performed by the classifier for each packet of a given flow. The match
         is done on the first entry of the flow sequence.
      
       - The C2 engine entries, that are used to assign the default rx queue,
         and enable or disable RSS for a given port.
      
         There's one entry per flow, located at:
         .../mvpp2/<controller>/flows/XX/flow_hits
      
         There is one C2 entry per port, so the c2 hit counter is located at :
         .../mvpp2/<controller>/ethX/c2_hits
      
      All hit counter values are 16-bits clear-on-read values.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9d30d5b
    • M
      net: mvpp2: debugfs: add entries for classifier flows · dba1d918
      Maxime Chevallier 提交于
      The classifier configuration for RSS is quite complex, with several
      lookup tables being used. This commit adds useful info in debugfs to
      see how the different tables are configured :
      
      Added 2 new entries in the per-port directory :
      
        - .../eth0/default_rxq : The default rx queue on that port
        - .../eth0/rss_enable : Indicates if RSS is enabled in the C2 entry
      
      Added the 'flows' directory :
      
        It contains one entry per sub-flow. a 'sub-flow' is a unique path from
        Header Parser to the flow table. Multiple sub-flows can point to the
        same 'flow' (each flow has an id from 8 to 29, which is its index in the
        Lookup Id table) :
      
        - .../flows/00/...
                   /01/...
                   ...
                   /51/id : The flow id. There are 21 unique flows. There's one
                             flow per combination of the following parameters :
                             - L4 protocol (TCP, UDP, none)
                             - L3 protocol (IPv4, IPv6)
                             - L3 parameters (Fragmented or not)
                             - L2 parameters (Vlan tag presence or not)
                    .../type : The flow type. This is an even higher level flow,
                               that we manipulate with ethtool. It can be :
                               "udp4" "tcp4" "udp6" "tcp6" "ipv4" "ipv6" "other".
                    .../eth0/...
                    .../eth1/engine : The hash generation engine used for this
      	                        flow on the given port
                        .../hash_opts : The hash generation options indicating on
                                        what data we base the hash (vlan tag, src
                                        IP, src port, etc.)
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dba1d918
    • A
      net: mvpp2: switch to SPDX identifiers · f1e37e31
      Antoine Tenart 提交于
      Use the appropriate SPDX license identifiers and drop the license text.
      This patch is only cosmetic.
      Signed-off-by: NAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1e37e31
  14. 14 7月, 2018 1 次提交
  15. 13 7月, 2018 2 次提交
    • M
      net: mvpp2: allow setting RSS flow hash parameters with ethtool · 436d4fdb
      Maxime Chevallier 提交于
      This commit allows setting the RSS hash generation parameters from
      ethtool. When setting parameters for a given flow type from ethtool
      (e.g. tcp4), all the corresponding flows in the flow table are updated,
      according to the supported hash parameters.
      
      For example, when configuring TCP over IPv4 hash parameters to be
      src/dst IP  + src/dst port ("ethtool -N eth0 rx-flow-hash tcp4 sdfn"),
      we only set the "src/dst port" hash parameters on the non-fragmented TCP
      over IPv4 flows.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      436d4fdb
    • M
      net: mvpp2: add an RSS classification step for each flow · d33ec452
      Maxime Chevallier 提交于
      One of the classification action that can be performed is to compute a
      hash of the packet header based on some header fields, and lookup a RSS
      table based on this hash to determine the final RxQ.
      
      This is done by adding one lookup entry per flow per port, so that we
      can configure the hash generation parameters for each flow and each
      port.
      
      There are 2 possible engines that can be used for RSS hash generation :
      
       - C3HA, that generates a hash based on up to 4 header-extracted fields
       - C3HB, that does the same as c3HA, but also includes L4 info in the hash
      
      There are a lot of fields that can be extracted from the header. For now,
      we only use the ones that we can configure using ethtool :
       - DST MAC address
       - L3 info
       - Source IP
       - Destination IP
       - Source port
       - Destination port
      
      The C3HB engine is selected when we use L4 fields (src/dst port).
      
                     Header parser          Dec table
       Ingress pkt  +-------------+ flow id +----------------------------+
      ------------->| TCAM + SRAM |-------->|TCP IPv4 w/ VLAN, not frag  |
                    +-------------+         |TCP IPv4 w/o VLAN, not frag |
                                            |TCP IPv4 w/ VLAN, frag      |--+
                                            |etc.                        |  |
                                            +----------------------------+  |
                                                                            |
                                                  Flow table                |
        +---------+   +------------+         +--------------------------+   |
        | RSS tbl |<--| Classifier |<--------| flow 0: C2 lookup        |   |
        +---------+   +------------+         |         C3 lookup port 0 |   |
                       |         |           |         C3 lookup port 1 |   |
               +-----------+ +-------------+ |         ...              |   |
               | C2 engine | | C3H engines | | flow 1: C2 lookup        |<--+
               +-----------+ +-------------+ |         C3 lookup port 0 |
                                             |         ...              |
                                             | ...                      |
                                             | flow 51 : C2 lookup      |
                                             |           ...            |
                                             +--------------------------+
      
      The C2 engine also gains the role of enabling and disabling the RSS
      table lookup for this packet.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d33ec452