Commit ff2f3cb6 authored by Maxime Chevallier's avatar Maxime Chevallier Committed by David S. Miller

net: mvpp2: cls: Rename the flow table macros

The Flow Table dictates what lookups will be issued for each flow type.
The lookup sequence for each flow is similar, and the index of each
lookup is computed by some macros.

There are similar mechanisms for the C2 TCAM lookups, so in order to
avoid confusion, rename the flow table index computing macros with a
common prefix.

The only difference in behaviour is that we now use the very first entry
in the flow for the RSS lookup (the first entry was previously unused).
Signed-off-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b353806
...@@ -478,7 +478,7 @@ static void mvpp2_cls_flow_lkp_init(struct mvpp2 *priv, ...@@ -478,7 +478,7 @@ static void mvpp2_cls_flow_lkp_init(struct mvpp2 *priv,
/* We point on the first lookup in the sequence for the flow, that is /* We point on the first lookup in the sequence for the flow, that is
* the C2 lookup. * the C2 lookup.
*/ */
le.data |= MVPP2_CLS_LKP_FLOW_PTR(MVPP2_FLOW_C2_ENTRY(flow->flow_id)); le.data |= MVPP2_CLS_LKP_FLOW_PTR(MVPP2_CLS_FLT_FIRST(flow->flow_id));
/* CLS is always enabled, RSS is enabled/disabled in C2 lookup */ /* CLS is always enabled, RSS is enabled/disabled in C2 lookup */
le.data |= MVPP2_CLS_LKP_TBL_LOOKUP_EN_MASK; le.data |= MVPP2_CLS_LKP_TBL_LOOKUP_EN_MASK;
...@@ -536,7 +536,7 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv, ...@@ -536,7 +536,7 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv,
/* C2 lookup */ /* C2 lookup */
memset(&fe, 0, sizeof(fe)); memset(&fe, 0, sizeof(fe));
fe.index = MVPP2_FLOW_C2_ENTRY(flow->flow_id); fe.index = MVPP2_CLS_FLT_C2_RSS_ENTRY(flow->flow_id);
mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C2); mvpp2_cls_flow_eng_set(&fe, MVPP22_CLS_ENGINE_C2);
mvpp2_cls_flow_port_id_sel(&fe, true); mvpp2_cls_flow_port_id_sel(&fe, true);
...@@ -553,7 +553,7 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv, ...@@ -553,7 +553,7 @@ static void mvpp2_cls_flow_init(struct mvpp2 *priv,
/* C3Hx lookups */ /* C3Hx lookups */
for (i = 0; i < MVPP2_MAX_PORTS; i++) { for (i = 0; i < MVPP2_MAX_PORTS; i++) {
memset(&fe, 0, sizeof(fe)); memset(&fe, 0, sizeof(fe));
fe.index = MVPP2_PORT_FLOW_HASH_ENTRY(i, flow->flow_id); fe.index = MVPP2_CLS_FLT_HASH_ENTRY(i, flow->flow_id);
mvpp2_cls_flow_port_id_sel(&fe, true); mvpp2_cls_flow_port_id_sel(&fe, true);
mvpp2_cls_flow_pri_set(&fe, i + 1); mvpp2_cls_flow_pri_set(&fe, i + 1);
...@@ -661,8 +661,7 @@ static int mvpp2_port_rss_hash_opts_set(struct mvpp2_port *port, int flow_type, ...@@ -661,8 +661,7 @@ static int mvpp2_port_rss_hash_opts_set(struct mvpp2_port *port, int flow_type,
if (!flow) if (!flow)
return -EINVAL; return -EINVAL;
flow_index = MVPP2_PORT_FLOW_HASH_ENTRY(port->id, flow_index = MVPP2_CLS_FLT_HASH_ENTRY(port->id, flow->flow_id);
flow->flow_id);
mvpp2_cls_flow_read(port->priv, flow_index, &fe); mvpp2_cls_flow_read(port->priv, flow_index, &fe);
...@@ -747,8 +746,7 @@ static u16 mvpp2_port_rss_hash_opts_get(struct mvpp2_port *port, int flow_type) ...@@ -747,8 +746,7 @@ static u16 mvpp2_port_rss_hash_opts_get(struct mvpp2_port *port, int flow_type)
if (!flow) if (!flow)
return 0; return 0;
flow_index = MVPP2_PORT_FLOW_HASH_ENTRY(port->id, flow_index = MVPP2_CLS_FLT_HASH_ENTRY(port->id, flow->flow_id);
flow->flow_id);
mvpp2_cls_flow_read(port->priv, flow_index, &fe); mvpp2_cls_flow_read(port->priv, flow_index, &fe);
......
...@@ -177,12 +177,13 @@ struct mvpp2_cls_flow { ...@@ -177,12 +177,13 @@ struct mvpp2_cls_flow {
struct mvpp2_prs_result_info prs_ri; struct mvpp2_prs_result_info prs_ri;
}; };
#define MVPP2_CLS_FLT_ENTRIES_PER_FLOW (MVPP2_MAX_PORTS + 1)
#define MVPP2_ENTRIES_PER_FLOW (MVPP2_MAX_PORTS + 1) #define MVPP2_CLS_FLT_FIRST(id) (((id) - MVPP2_FL_START) * \
#define MVPP2_FLOW_C2_ENTRY(id) ((((id) - MVPP2_FL_START) * \ MVPP2_CLS_FLT_ENTRIES_PER_FLOW)
MVPP2_ENTRIES_PER_FLOW) + 1) #define MVPP2_CLS_FLT_C2_RSS_ENTRY(id) (MVPP2_CLS_FLT_FIRST(id))
#define MVPP2_PORT_FLOW_HASH_ENTRY(port, id) (MVPP2_FLOW_C2_ENTRY(id) + \ #define MVPP2_CLS_FLT_HASH_ENTRY(port, id) (MVPP2_CLS_FLT_C2_RSS_ENTRY(id) + (port) + 1)
1 + (port)) #define MVPP2_CLS_FLT_LAST(id) (MVPP2_CLS_FLT_FIRST(id) + \
MVPP2_CLS_FLT_ENTRIES_PER_FLOW - 1)
/* Iterate on each classifier flow id. Sets 'i' to be the index of the first /* Iterate on each classifier flow id. Sets 'i' to be the index of the first
* entry in the cls_flows table for each different flow_id. * entry in the cls_flows table for each different flow_id.
......
...@@ -150,7 +150,7 @@ static int mvpp2_dbgfs_port_flow_hash_opt_show(struct seq_file *s, void *unused) ...@@ -150,7 +150,7 @@ static int mvpp2_dbgfs_port_flow_hash_opt_show(struct seq_file *s, void *unused)
if (!f) if (!f)
return -EINVAL; return -EINVAL;
flow_index = MVPP2_PORT_FLOW_HASH_ENTRY(entry->port->id, f->flow_id); flow_index = MVPP2_CLS_FLT_HASH_ENTRY(entry->port->id, f->flow_id);
mvpp2_cls_flow_read(port->priv, flow_index, &fe); mvpp2_cls_flow_read(port->priv, flow_index, &fe);
...@@ -175,7 +175,7 @@ static int mvpp2_dbgfs_port_flow_engine_show(struct seq_file *s, void *unused) ...@@ -175,7 +175,7 @@ static int mvpp2_dbgfs_port_flow_engine_show(struct seq_file *s, void *unused)
if (!f) if (!f)
return -EINVAL; return -EINVAL;
flow_index = MVPP2_PORT_FLOW_HASH_ENTRY(entry->port->id, f->flow_id); flow_index = MVPP2_CLS_FLT_HASH_ENTRY(entry->port->id, f->flow_id);
mvpp2_cls_flow_read(port->priv, flow_index, &fe); mvpp2_cls_flow_read(port->priv, flow_index, &fe);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment