Commit 95fa7414 authored by Steen Hegelund's avatar Steen Hegelund Committed by David S. Miller

net: microchip: sparx5: Reset VCAP counter for new rules

When a rule counter is external to the VCAP such as the Sparx5 IS2 counters
are, then this counter must be reset when a new rule is created.
Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6573f71a
...@@ -1808,6 +1808,7 @@ int vcap_add_rule(struct vcap_rule *rule) ...@@ -1808,6 +1808,7 @@ int vcap_add_rule(struct vcap_rule *rule)
{ {
struct vcap_rule_internal *ri = to_intrule(rule); struct vcap_rule_internal *ri = to_intrule(rule);
struct vcap_rule_move move = {0}; struct vcap_rule_move move = {0};
struct vcap_counter ctr = {0};
int ret; int ret;
ret = vcap_api_check(ri->vctrl); ret = vcap_api_check(ri->vctrl);
...@@ -1831,8 +1832,12 @@ int vcap_add_rule(struct vcap_rule *rule) ...@@ -1831,8 +1832,12 @@ int vcap_add_rule(struct vcap_rule *rule)
} }
ret = vcap_write_rule(ri); ret = vcap_write_rule(ri);
if (ret) if (ret) {
pr_err("%s:%d: rule write error: %d\n", __func__, __LINE__, ret); pr_err("%s:%d: rule write error: %d\n", __func__, __LINE__, ret);
goto out;
}
/* Set the counter to zero */
ret = vcap_write_counter(ri, &ctr);
out: out:
mutex_unlock(&ri->admin->lock); mutex_unlock(&ri->admin->lock);
return ret; return ret;
......
...@@ -1343,8 +1343,8 @@ static void vcap_api_encode_rule_test(struct kunit *test) ...@@ -1343,8 +1343,8 @@ static void vcap_api_encode_rule_test(struct kunit *test)
u32 port_mask_rng_mask = 0x0f; u32 port_mask_rng_mask = 0x0f;
u32 igr_port_mask_value = 0xffabcd01; u32 igr_port_mask_value = 0xffabcd01;
u32 igr_port_mask_mask = ~0; u32 igr_port_mask_mask = ~0;
/* counter is not written yet, so it is not in expwriteaddr */ /* counter is written as the last operation */
u32 expwriteaddr[] = {792, 793, 794, 795, 796, 797, 0}; u32 expwriteaddr[] = {792, 793, 794, 795, 796, 797, 792};
int idx; int idx;
vcap_test_api_init(&is2_admin); vcap_test_api_init(&is2_admin);
......
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