OSDN Git Service

net: microchip: sparx5: Ensure VCAP last_used_addr is set back to default
authorSteen Hegelund <steen.hegelund@microchip.com>
Thu, 17 Nov 2022 21:31:08 +0000 (22:31 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Nov 2022 11:33:02 +0000 (11:33 +0000)
This ensures that the last_used_addr in a VCAP instance is returned to the
default value when all rules have been deleted.

Signed-off-by: Steen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/vcap/vcap_api.c

index d12c8ec..24f4ea1 100644 (file)
@@ -1249,9 +1249,9 @@ int vcap_del_rule(struct vcap_control *vctrl, struct net_device *ndev, u32 id)
        vctrl->ops->init(ndev, admin, admin->last_used_addr, ri->size + gap);
        kfree(ri);
 
-       /* Update the last used address */
+       /* Update the last used address, set to default when no rules */
        if (list_empty(&admin->rules)) {
-               admin->last_used_addr = admin->last_valid_addr;
+               admin->last_used_addr = admin->last_valid_addr + 1;
        } else {
                elem = list_last_entry(&admin->rules, struct vcap_rule_internal,
                                       list);