Commit 7b911a53 authored by Steen Hegelund's avatar Steen Hegelund Committed by David S. Miller

net: microchip: sparx5: Add TC support for the ES2 VCAP

This enables the TC command to use the Sparx5 ES2 VCAP, and provides a new
ES2 ethertype table and handling of rule links between IS0 and ES2.
Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e7e3f514
...@@ -680,7 +680,7 @@ static int sparx5_tc_add_rule_counter(struct vcap_admin *admin, ...@@ -680,7 +680,7 @@ static int sparx5_tc_add_rule_counter(struct vcap_admin *admin,
{ {
int err; int err;
if (admin->vtype == VCAP_TYPE_IS2) { if (admin->vtype == VCAP_TYPE_IS2 || admin->vtype == VCAP_TYPE_ES2) {
err = vcap_rule_mod_action_u32(vrule, VCAP_AF_CNT_ID, err = vcap_rule_mod_action_u32(vrule, VCAP_AF_CNT_ID,
vrule->id); vrule->id);
if (err) if (err)
...@@ -883,6 +883,9 @@ static int sparx5_tc_set_actionset(struct vcap_admin *admin, ...@@ -883,6 +883,9 @@ static int sparx5_tc_set_actionset(struct vcap_admin *admin,
case VCAP_TYPE_IS2: case VCAP_TYPE_IS2:
aset = VCAP_AFS_BASE_TYPE; aset = VCAP_AFS_BASE_TYPE;
break; break;
case VCAP_TYPE_ES2:
aset = VCAP_AFS_BASE_TYPE;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -919,6 +922,10 @@ static int sparx5_tc_add_rule_link_target(struct vcap_admin *admin, ...@@ -919,6 +922,10 @@ static int sparx5_tc_add_rule_link_target(struct vcap_admin *admin,
return vcap_rule_add_key_u32(vrule, VCAP_KF_LOOKUP_PAG, return vcap_rule_add_key_u32(vrule, VCAP_KF_LOOKUP_PAG,
link_val, /* target */ link_val, /* target */
~0); ~0);
case VCAP_TYPE_ES2:
/* Add ISDX key for chaining rules from IS0 */
return vcap_rule_add_key_u32(vrule, VCAP_KF_ISDX_CLS, link_val,
~0);
default: default:
break; break;
} }
...@@ -961,6 +968,18 @@ static int sparx5_tc_add_rule_link(struct vcap_control *vctrl, ...@@ -961,6 +968,18 @@ static int sparx5_tc_add_rule_link(struct vcap_control *vctrl,
0xff); 0xff);
if (err) if (err)
goto out; goto out;
} else if (admin->vtype == VCAP_TYPE_IS0 &&
to_admin->vtype == VCAP_TYPE_ES2) {
/* Between IS0 and ES2 the ISDX value is used */
err = vcap_rule_add_action_u32(vrule, VCAP_AF_ISDX_VAL,
diff);
if (err)
goto out;
err = vcap_rule_add_action_bit(vrule,
VCAP_AF_ISDX_ADD_REPLACE_SEL,
VCAP_BIT_1);
if (err)
goto out;
} else { } else {
pr_err("%s:%d: unsupported chain destination: %d\n", pr_err("%s:%d: unsupported chain destination: %d\n",
__func__, __LINE__, to_cid); __func__, __LINE__, to_cid);
...@@ -1015,7 +1034,8 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, ...@@ -1015,7 +1034,8 @@ static int sparx5_tc_flower_replace(struct net_device *ndev,
flow_action_for_each(idx, act, &frule->action) { flow_action_for_each(idx, act, &frule->action) {
switch (act->id) { switch (act->id) {
case FLOW_ACTION_TRAP: case FLOW_ACTION_TRAP:
if (admin->vtype != VCAP_TYPE_IS2) { if (admin->vtype != VCAP_TYPE_IS2 &&
admin->vtype != VCAP_TYPE_ES2) {
NL_SET_ERR_MSG_MOD(fco->common.extack, NL_SET_ERR_MSG_MOD(fco->common.extack,
"Trap action not supported in this VCAP"); "Trap action not supported in this VCAP");
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
...@@ -1030,8 +1050,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev, ...@@ -1030,8 +1050,11 @@ static int sparx5_tc_flower_replace(struct net_device *ndev,
VCAP_AF_CPU_QUEUE_NUM, 0); VCAP_AF_CPU_QUEUE_NUM, 0);
if (err) if (err)
goto out; goto out;
err = vcap_rule_add_action_u32(vrule, VCAP_AF_MASK_MODE, if (admin->vtype != VCAP_TYPE_IS2)
SPX5_PMM_REPLACE_ALL); break;
err = vcap_rule_add_action_u32(vrule,
VCAP_AF_MASK_MODE,
SPX5_PMM_REPLACE_ALL);
if (err) if (err)
goto out; goto out;
break; break;
......
...@@ -143,6 +143,14 @@ static u16 sparx5_vcap_is2_known_etypes[] = { ...@@ -143,6 +143,14 @@ static u16 sparx5_vcap_is2_known_etypes[] = {
ETH_P_IPV6, ETH_P_IPV6,
}; };
/* These protocols have dedicated keysets in ES2 and a TC dissector */
static u16 sparx5_vcap_es2_known_etypes[] = {
ETH_P_ALL,
ETH_P_ARP,
ETH_P_IP,
ETH_P_IPV6,
};
static void sparx5_vcap_type_err(struct sparx5 *sparx5, static void sparx5_vcap_type_err(struct sparx5 *sparx5,
struct vcap_admin *admin, struct vcap_admin *admin,
const char *fname) const char *fname)
...@@ -667,6 +675,10 @@ bool sparx5_vcap_is_known_etype(struct vcap_admin *admin, u16 etype) ...@@ -667,6 +675,10 @@ bool sparx5_vcap_is_known_etype(struct vcap_admin *admin, u16 etype)
known_etypes = sparx5_vcap_is2_known_etypes; known_etypes = sparx5_vcap_is2_known_etypes;
size = ARRAY_SIZE(sparx5_vcap_is2_known_etypes); size = ARRAY_SIZE(sparx5_vcap_is2_known_etypes);
break; break;
case VCAP_TYPE_ES2:
known_etypes = sparx5_vcap_es2_known_etypes;
size = ARRAY_SIZE(sparx5_vcap_es2_known_etypes);
break;
default: default:
return false; return false;
} }
......
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