• Maxime Chevallier's avatar
    net: mvpp2: split ingress traffic into multiple flows · f9358e12
    Maxime Chevallier authored
    The PPv2 classifier allows to perform classification operations on each
    ingress packet, based on the flow the packet is assigned to.
    
    The current code uses only 1 flow per port, and the only classification
    action consists of assigning the rx queue to the packet, depending on the
    port.
    
    In preparation for adding RSS support, we have to split all incoming
    traffic into different flows. Since RSS assigns a rx queue depending on
    the hash of some header fields, we have to make sure that the hash is
    generated in a consistent way for all packets in the same flow.
    
    What we call a "flow" is actually a set of attributes attached to a
    packet that depends on various L2/L3/L4 info.
    
    This patch introduces 52 flows, wich are a combination of various L2, L3
    and L4 attributes :
     - Whether or not the packet has a VLAN tag
     - Whether the packet is IPv4, IPv6 or something else
     - Whether the packet is TCP, UDP or something else
     - Whether or not the packet is fragmented at L3 level.
    
    The flow is associated to a packet by the Header Parser. Each flow
    corresponds to an entry in the decoding table. This entry then points to
    the sequence of classification lookups to be performed by the
    classifier, represented in the flow table.
    
    For now, the only lookup we perform is a C2 lookup to set the default
    rx queue.
    
                   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                 |
                    +------------+        +---------------------+         |
         To RxQ <---| Classifier |<-------| flow 0: C2 lookup   |<--------+
                    +------------+        | flow 1: C2 lookup   |
                           |              | ...                 |
                    +------------+        | flow 51 : C2 lookup |
    		| C2 engine  |        +---------------------+
                    +------------+
    Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    f9358e12
mvpp2_prs.c 69.8 KB