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 061B0A00C5; Tue, 1 Feb 2022 09:50:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F86A426ED; Tue, 1 Feb 2022 09:50:14 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 2879240685 for ; Tue, 1 Feb 2022 09:50:07 +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 06E9550; Tue, 1 Feb 2022 11:50:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 06E9550 Authentication-Results: shelob.oktetlabs.ru/06E9550; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton Subject: [PATCH 8/8] net/sfc: use the even spread mode in flow action RSS Date: Tue, 1 Feb 2022 11:50:02 +0300 Message-Id: <20220201085002.320102-9-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220201085002.320102-1-ivan.malov@oktetlabs.ru> References: <20220201085002.320102-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 If the user provides contiguous ascending queue IDs, use the even spread mode to avoid wasting resources which are needed to serve indirection table entries. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_flow_rss.c | 19 +++++++++++++++++++ drivers/net/sfc/sfc_flow_rss.h | 1 + 2 files changed, 20 insertions(+) diff --git a/drivers/net/sfc/sfc_flow_rss.c b/drivers/net/sfc/sfc_flow_rss.c index 4bf3002164..e28c943335 100644 --- a/drivers/net/sfc/sfc_flow_rss.c +++ b/drivers/net/sfc/sfc_flow_rss.c @@ -140,6 +140,8 @@ sfc_flow_rss_parse_conf(struct sfc_adapter *sa, return EINVAL; } + out->rte_hash_function = in->func; + if (in->queue_num == 0) { sfc_err(sa, "flow-rss: parse: 'queue_num' is 0; MIN=1"); return EINVAL; @@ -317,6 +319,9 @@ sfc_flow_rss_ctx_program_tbl(struct sfc_adapter *sa, SFC_ASSERT(sfc_adapter_is_locked(sa)); + if (nb_tbl_entries == 0) + return 0; + if (conf->nb_qid_offsets != 0) { SFC_ASSERT(ctx->qid_offsets != NULL); @@ -336,6 +341,7 @@ sfc_flow_rss_ctx_program(struct sfc_adapter *sa, struct sfc_flow_rss_ctx *ctx) { efx_rx_scale_context_type_t ctx_type = EFX_RX_SCALE_EXCLUSIVE; struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); + const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); const struct sfc_flow_rss *flow_rss = &sa->flow_rss; struct sfc_rss *ethdev_rss = &sas->rss; struct sfc_flow_rss_conf *conf; @@ -366,6 +372,19 @@ sfc_flow_rss_ctx_program(struct sfc_adapter *sa, struct sfc_flow_rss_ctx *ctx) nb_tbl_entries = RTE_MAX(flow_rss->nb_tbl_entries_min, nb_qid_offsets); + if (conf->rte_hash_function == RTE_ETH_HASH_FUNCTION_DEFAULT && + conf->nb_qid_offsets == 0 && + conf->qid_span <= encp->enc_rx_scale_even_spread_max_nqueues) { + /* + * Conformance to a specific hash algorithm is a don't care to + * the user. The queue array is contiguous and ascending. That + * means that the even spread context may be requested here in + * order to avoid wasting precious indirection table resources. + */ + ctx_type = EFX_RX_SCALE_EVEN_SPREAD; + nb_tbl_entries = 0; + } + if (ctx->nic_handle_refcnt == 0) { rc = efx_rx_scale_context_alloc_v2(sa->nic, ctx_type, conf->qid_span, diff --git a/drivers/net/sfc/sfc_flow_rss.h b/drivers/net/sfc/sfc_flow_rss.h index 3341d06cf4..2ed81dc190 100644 --- a/drivers/net/sfc/sfc_flow_rss.h +++ b/drivers/net/sfc/sfc_flow_rss.h @@ -20,6 +20,7 @@ extern "C" { struct sfc_flow_rss_conf { uint8_t key[EFX_RSS_KEY_SIZE]; + enum rte_eth_hash_function rte_hash_function; efx_rx_hash_type_t efx_hash_types; unsigned int nb_qid_offsets; unsigned int qid_span; -- 2.30.2