sfc: release encap match in efx_tc_flow_free()
authorEdward Cree <ecree.xilinx@gmail.com>
Thu, 11 May 2023 19:47:28 +0000 (20:47 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 May 2023 09:37:02 +0000 (10:37 +0100)
When force-freeing leftover entries from our match_action_ht, call
 efx_tc_delete_rule(), which releases all the rule's resources, rather
 than open-coding it.  The open-coded version was missing a call to
 release the rule's encap match (if any).
It probably doesn't matter as everything's being torn down anyway, but
 it's cleaner this way and prevents further error messages potentially
 being logged by efx_tc_encap_match_free() later on.
Move efx_tc_flow_free() further down the file to avoid introducing a
 forward declaration of efx_tc_delete_rule().

Fixes: 17654d84b47c ("sfc: add offloading of 'foreign' TC (decap) rules")
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/tc.c

index 0327639..236b44a 100644 (file)
@@ -132,23 +132,6 @@ static void efx_tc_free_action_set_list(struct efx_nic *efx,
        /* Don't kfree, as acts is embedded inside a struct efx_tc_flow_rule */
 }
 
-static void efx_tc_flow_free(void *ptr, void *arg)
-{
-       struct efx_tc_flow_rule *rule = ptr;
-       struct efx_nic *efx = arg;
-
-       netif_err(efx, drv, efx->net_dev,
-                 "tc rule %lx still present at teardown, removing\n",
-                 rule->cookie);
-
-       efx_mae_delete_rule(efx, rule->fw_id);
-
-       /* Release entries in subsidiary tables */
-       efx_tc_free_action_set_list(efx, &rule->acts, true);
-
-       kfree(rule);
-}
-
 /* Boilerplate for the simple 'copy a field' cases */
 #define _MAP_KEY_AND_MASK(_name, _type, _tcget, _tcfield, _field)      \
 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_##_name)) {           \
@@ -1454,6 +1437,21 @@ static void efx_tc_encap_match_free(void *ptr, void *__unused)
        kfree(encap);
 }
 
+static void efx_tc_flow_free(void *ptr, void *arg)
+{
+       struct efx_tc_flow_rule *rule = ptr;
+       struct efx_nic *efx = arg;
+
+       netif_err(efx, drv, efx->net_dev,
+                 "tc rule %lx still present at teardown, removing\n",
+                 rule->cookie);
+
+       /* Also releases entries in subsidiary tables */
+       efx_tc_delete_rule(efx, rule);
+
+       kfree(rule);
+}
+
 int efx_init_struct_tc(struct efx_nic *efx)
 {
        int rc;