net: microchip: vcap api: Erase VCAP cache before encoding rule
authorSteen Hegelund <steen.hegelund@microchip.com>
Sat, 14 Jan 2023 13:42:35 +0000 (14:42 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Jan 2023 13:45:16 +0000 (13:45 +0000)
For consistency the VCAP cache area is erased just before the new rule is
being encoded.

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 664aae3e2acd8613e8180d2c220c0cc1751d3645..b9b6432f4094160d52be7b6dfb9227aa21bdd1f4 100644 (file)
@@ -1823,6 +1823,7 @@ int vcap_add_rule(struct vcap_rule *rule)
        }
        if (move.count > 0)
                vcap_move_rules(ri, &move);
+       vcap_erase_cache(ri);
        ret = vcap_encode_rule(ri);
        if (ret) {
                pr_err("%s:%d: rule encoding error: %d\n", __func__, __LINE__, ret);
@@ -1885,7 +1886,6 @@ struct vcap_rule *vcap_alloc_rule(struct vcap_control *vctrl,
        ri->vctrl = vctrl; /* refer to the client */
        if (vcap_set_rule_id(ri) == 0)
                goto out_free;
-       vcap_erase_cache(ri);
        return (struct vcap_rule *)ri;
 
 out_free: