[1/6] net/sfc/base: refactor filters cleanup in reconfigure

Message ID 1585563945-9537-2-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/sfc: improve Rx mode handling on VF |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Andrew Rybchenko March 30, 2020, 10:25 a.m. UTC
  From: Igor Romanov <igor.romanov@oktetlabs.ru>

Refactor the filters cleanup stage of the reconfigure function
to make it clearer and allow for more convenient further changes.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/base/ef10_filter.c | 44 ++++++++++++++++++------------
 1 file changed, 26 insertions(+), 18 deletions(-)
  

Patch

diff --git a/drivers/net/sfc/base/ef10_filter.c b/drivers/net/sfc/base/ef10_filter.c
index 12802a3d13..74d06ecf57 100644
--- a/drivers/net/sfc/base/ef10_filter.c
+++ b/drivers/net/sfc/base/ef10_filter.c
@@ -1756,6 +1756,31 @@  ef10_filter_get_workarounds(
 
 }
 
+static			void
+ef10_filter_remove_all_existing_filters(
+	__in				efx_nic_t *enp)
+{
+	ef10_filter_table_t *table = enp->en_filter.ef_ef10_filter_table;
+	unsigned int i;
+
+	for (i = 0; i < table->eft_unicst_filter_count; i++) {
+		ef10_filter_delete_auto(enp,
+				table->eft_unicst_filter_indexes[i]);
+	}
+	table->eft_unicst_filter_count = 0;
+
+	for (i = 0; i < table->eft_mulcst_filter_count; i++) {
+		ef10_filter_delete_auto(enp,
+				table->eft_mulcst_filter_indexes[i]);
+	}
+	table->eft_mulcst_filter_count = 0;
+
+	for (i = 0; i < table->eft_encap_filter_count; i++) {
+		ef10_filter_delete_auto(enp,
+				table->eft_encap_filter_indexes[i]);
+	}
+	table->eft_encap_filter_count = 0;
+}
 
 /*
  * Reconfigure all filters.
@@ -1789,24 +1814,7 @@  ef10_filter_reconfigure(
 		 * filters must be removed (ignore errors in case the MC
 		 * has rebooted, which removes hardware filters).
 		 */
-		for (i = 0; i < table->eft_unicst_filter_count; i++) {
-			ef10_filter_delete_auto(enp,
-					table->eft_unicst_filter_indexes[i]);
-		}
-		table->eft_unicst_filter_count = 0;
-
-		for (i = 0; i < table->eft_mulcst_filter_count; i++) {
-			ef10_filter_delete_auto(enp,
-					table->eft_mulcst_filter_indexes[i]);
-		}
-		table->eft_mulcst_filter_count = 0;
-
-		for (i = 0; i < table->eft_encap_filter_count; i++) {
-			ef10_filter_delete_auto(enp,
-					table->eft_encap_filter_indexes[i]);
-		}
-		table->eft_encap_filter_count = 0;
-
+		ef10_filter_remove_all_existing_filters(enp);
 		return (0);
 	}