[PATCH 1/4] net/sfc: refine the order of checks on MAE action set attach

Ivan Malov ivan.malov at oktetlabs.ru
Wed Nov 17 12:44:35 CET 2021


The number of counters being non-zero can be detected before
the action set registry traversal, so move the check outside.

Signed-off-by: Ivan Malov <ivan.malov at oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton at xilinx.com>
---
 drivers/net/sfc/sfc_mae.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 08e28b13c9..73bedf5088 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -763,13 +763,15 @@ sfc_mae_action_set_attach(struct sfc_adapter *sa,
 
 	SFC_ASSERT(sfc_adapter_is_locked(sa));
 
+	/*
+	 * Shared counters are not supported, hence, action
+	 * sets with counters are not attachable.
+	 */
+	if (n_count != 0)
+		return NULL;
+
 	TAILQ_FOREACH(action_set, &mae->action_sets, entries) {
-		/*
-		 * Shared counters are not supported, hence action sets with
-		 * COUNT are not attachable.
-		 */
 		if (action_set->encap_header == encap_header &&
-		    n_count == 0 &&
 		    efx_mae_action_set_specs_equal(action_set->spec, spec)) {
 			sfc_dbg(sa, "attaching to action_set=%p", action_set);
 			++(action_set->refcnt);
-- 
2.30.2



More information about the dev mailing list