2018-05-31 16:07:43 +08:00
|
|
|
/*
|
|
|
|
* RSS and Classifier definitions for Marvell PPv2 Network Controller
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Marvell
|
|
|
|
*
|
|
|
|
* Marcin Wojtas <mw@semihalf.com>
|
|
|
|
*
|
|
|
|
* This file is licensed under the terms of the GNU General Public
|
|
|
|
* License version 2. This program is licensed "as is" without any
|
|
|
|
* warranty of any kind, whether express or implied.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MVPP2_CLS_H_
|
|
|
|
#define _MVPP2_CLS_H_
|
|
|
|
|
2018-07-12 19:54:11 +08:00
|
|
|
#include "mvpp2.h"
|
net: mvpp2: use classifier to assign default rx queue
The PPv2 Controller has a classifier, that can perform multiple lookup
operations for each packet, using different engines.
One of these engines is the C2 engine, which performs TCAM based lookups
on data extracted from the packet header. When a packet matches an
entry, the engine sets various attributes, used to perform
classification operations.
One of these attributes is the rx queue in which the packet should be sent.
The current code uses the lookup_id table (also called decoding table)
to assign the rx queue. However, this only works if we use one entry per
port in the decoding table, which won't be the case once we add RSS
lookups.
This patch uses the C2 engine to assign the rx queue to each packet.
The C2 engine is used through the flow table, which dictates what
classification operations are done for a given flow.
Right now, we have one flow per port, which contains every ingress
packet for this port.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-07-12 19:54:24 +08:00
|
|
|
#include "mvpp2_prs.h"
|
2018-07-12 19:54:11 +08:00
|
|
|
|
2018-05-31 16:07:43 +08:00
|
|
|
/* Classifier constants */
|
|
|
|
#define MVPP2_CLS_FLOWS_TBL_SIZE 512
|
|
|
|
#define MVPP2_CLS_FLOWS_TBL_DATA_WORDS 3
|
|
|
|
#define MVPP2_CLS_LKP_TBL_SIZE 64
|
|
|
|
#define MVPP2_CLS_RX_QUEUES 256
|
|
|
|
|
net: mvpp2: use classifier to assign default rx queue
The PPv2 Controller has a classifier, that can perform multiple lookup
operations for each packet, using different engines.
One of these engines is the C2 engine, which performs TCAM based lookups
on data extracted from the packet header. When a packet matches an
entry, the engine sets various attributes, used to perform
classification operations.
One of these attributes is the rx queue in which the packet should be sent.
The current code uses the lookup_id table (also called decoding table)
to assign the rx queue. However, this only works if we use one entry per
port in the decoding table, which won't be the case once we add RSS
lookups.
This patch uses the C2 engine to assign the rx queue to each packet.
The C2 engine is used through the flow table, which dictates what
classification operations are done for a given flow.
Right now, we have one flow per port, which contains every ingress
packet for this port.
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-07-12 19:54:24 +08:00
|
|
|
/* Classifier flow constants */
|
|
|
|
enum mvpp2_cls_engine {
|
|
|
|
MVPP22_CLS_ENGINE_C2 = 1,
|
|
|
|
MVPP22_CLS_ENGINE_C3A,
|
|
|
|
MVPP22_CLS_ENGINE_C3B,
|
|
|
|
MVPP22_CLS_ENGINE_C4,
|
|
|
|
MVPP22_CLS_ENGINE_C3HA = 6,
|
|
|
|
MVPP22_CLS_ENGINE_C3HB = 7,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mvpp2_cls_flow_seq {
|
|
|
|
MVPP2_CLS_FLOW_SEQ_NORMAL = 0,
|
|
|
|
MVPP2_CLS_FLOW_SEQ_FIRST1,
|
|
|
|
MVPP2_CLS_FLOW_SEQ_FIRST2,
|
|
|
|
MVPP2_CLS_FLOW_SEQ_LAST,
|
|
|
|
MVPP2_CLS_FLOW_SEQ_MIDDLE
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Classifier C2 engine constants */
|
|
|
|
#define MVPP22_CLS_C2_TCAM_EN(data) ((data) << 16)
|
|
|
|
|
|
|
|
enum mvpp22_cls_c2_action {
|
|
|
|
MVPP22_C2_NO_UPD = 0,
|
|
|
|
MVPP22_C2_NO_UPD_LOCK,
|
|
|
|
MVPP22_C2_UPD,
|
|
|
|
MVPP22_C2_UPD_LOCK,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum mvpp22_cls_c2_fwd_action {
|
|
|
|
MVPP22_C2_FWD_NO_UPD = 0,
|
|
|
|
MVPP22_C2_FWD_NO_UPD_LOCK,
|
|
|
|
MVPP22_C2_FWD_SW,
|
|
|
|
MVPP22_C2_FWD_SW_LOCK,
|
|
|
|
MVPP22_C2_FWD_HW,
|
|
|
|
MVPP22_C2_FWD_HW_LOCK,
|
|
|
|
MVPP22_C2_FWD_HW_LOW_LAT,
|
|
|
|
MVPP22_C2_FWD_HW_LOW_LAT_LOCK,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MVPP2_CLS_C2_TCAM_WORDS 5
|
|
|
|
#define MVPP2_CLS_C2_ATTR_WORDS 5
|
|
|
|
|
|
|
|
struct mvpp2_cls_c2_entry {
|
|
|
|
u32 index;
|
|
|
|
u32 tcam[MVPP2_CLS_C2_TCAM_WORDS];
|
|
|
|
u32 act;
|
|
|
|
u32 attr[MVPP2_CLS_C2_ATTR_WORDS];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Classifier C2 engine entries */
|
|
|
|
#define MVPP22_CLS_C2_RSS_ENTRY(port) (port)
|
|
|
|
#define MVPP22_CLS_C2_N_ENTRIES MVPP2_MAX_PORTS
|
|
|
|
|
|
|
|
#define MVPP22_RSS_FLOW_C2_OFFS 0
|
|
|
|
|
2018-05-31 16:07:43 +08:00
|
|
|
struct mvpp2_cls_flow_entry {
|
|
|
|
u32 index;
|
|
|
|
u32 data[MVPP2_CLS_FLOWS_TBL_DATA_WORDS];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mvpp2_cls_lookup_entry {
|
|
|
|
u32 lkpid;
|
|
|
|
u32 way;
|
|
|
|
u32 data;
|
|
|
|
};
|
|
|
|
|
2018-07-12 19:54:20 +08:00
|
|
|
void mvpp22_rss_fill_table(struct mvpp2_port *port, u32 table);
|
|
|
|
|
2018-07-12 19:54:23 +08:00
|
|
|
void mvpp22_rss_port_init(struct mvpp2_port *port);
|
2018-05-31 16:07:43 +08:00
|
|
|
|
|
|
|
void mvpp2_cls_init(struct mvpp2 *priv);
|
|
|
|
|
|
|
|
void mvpp2_cls_port_config(struct mvpp2_port *port);
|
|
|
|
|
|
|
|
void mvpp2_cls_oversize_rxq_set(struct mvpp2_port *port);
|
|
|
|
|
|
|
|
#endif
|