diff options
author | Steen Hegelund <steen.hegelund@microchip.com> | 2023-02-14 11:40:41 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-02-16 08:59:48 +0100 |
commit | d7953da4f2935039430322a31b9da93f978fcc86 (patch) | |
tree | bc9d603b0af26c2eaa598e36872c9e0770547822 /drivers/net/ethernet/microchip/vcap/vcap_api.c | |
parent | 65b6625069a42edf2a813dd1c50604c6c6236fe5 (diff) |
net: microchip: sparx5: Clear rule counter even if lookup is disabled
The rule counter must be cleared when creating a new rule, even if the VCAP
lookup is currently disabled.
This ensures that rules located in VCAPs that use external counters (such
as Sparx5 IS2 and ES0) will have their counter reset even if the VCAP
lookup is not enabled at the moment.
Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Fixes: 95fa74148daa ("net: microchip: sparx5: Reset VCAP counter for new rules")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/microchip/vcap/vcap_api.c')
-rw-r--r-- | drivers/net/ethernet/microchip/vcap/vcap_api.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c index 6307d59f23da..68e04d47f6fd 100644 --- a/drivers/net/ethernet/microchip/vcap/vcap_api.c +++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c @@ -2246,6 +2246,11 @@ int vcap_add_rule(struct vcap_rule *rule) if (move.count > 0) vcap_move_rules(ri, &move); + /* Set the counter to zero */ + ret = vcap_write_counter(ri, &ctr); + if (ret) + goto out; + if (ri->state == VCAP_RS_DISABLED) { /* Erase the rule area */ ri->vctrl->ops->init(ri->ndev, ri->admin, ri->addr, ri->size); @@ -2264,8 +2269,6 @@ int vcap_add_rule(struct vcap_rule *rule) 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: mutex_unlock(&ri->admin->lock); return ret; |