From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA65EA0C41; Wed, 17 Nov 2021 12:44:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61DBA4117A; Wed, 17 Nov 2021 12:44:42 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id B156B4068C for ; Wed, 17 Nov 2021 12:44:40 +0100 (CET) Received: from bree.oktetlabs.ru (bree.oktetlabs.ru [192.168.34.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPS id 52DDB7F502; Wed, 17 Nov 2021 14:44:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 52DDB7F502 Authentication-Results: shelob.oktetlabs.ru/52DDB7F502; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton Subject: [PATCH 1/4] net/sfc: refine the order of checks on MAE action set attach Date: Wed, 17 Nov 2021 14:44:35 +0300 Message-Id: <20211117114438.8347-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211117114438.8347-1-ivan.malov@oktetlabs.ru> References: <20211117114438.8347-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- 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