From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 162D8A04DD for ; Wed, 28 Oct 2020 11:51:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 012C9C9CC; Wed, 28 Oct 2020 11:51:08 +0100 (CET) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by dpdk.org (Postfix) with ESMTP id 8DECEC9CC for ; Wed, 28 Oct 2020 11:51:05 +0100 (CET) Received: by mail-wr1-f51.google.com with SMTP id a9so1344081wrg.12 for ; Wed, 28 Oct 2020 03:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=49X3wzNUCfZwAZ9WnScEPh2pc6D4ZDe0pso8IhQol/U=; b=vEmS3i3pXgixmh/9pFtinK6CBoVmXT8f87lPcriiJoE4kS1d1RTbC0lgUBQ9JVZI2h tyoV/SqSOzXR0EG1soHzH7cOHbOHKpyM6pnWAtaXaNnOzHk9APjfnZPy7YMUI3m6SMjC oXGsulVsbtP+T8yqx3BomloindxnYb8MliWibDAa11O5EZ1AZ1+ixIQ8zb8vATIPdiSB tsw0AE+XD8+h3sNxKEFiEY/sVf9A8NZQezNbcuaQG2CYbgfnnSZBm8kCCRjnrj/CRS6j b/uqPk/hIcfNBE0yJ70LUNxHXjIOINh5+q3VcH5h1q3wBepKfd7FoLEwpMwVANm5hvPN jKAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=49X3wzNUCfZwAZ9WnScEPh2pc6D4ZDe0pso8IhQol/U=; b=ttfU1WaVS4y9+8CMEbgKzzANYMsstmgQr4q+ZddDTmkQpuDRHm84uhYNjCulRuHqg2 1XtDG+WMUlwi0KKEP0xhUW28GTE6Uaj2QzRM/M67mq/SyZuLGIbMYQkht0sOR+Wzoe2l lxfzUl6UAzBoXCbooVrjvHKpZ0TLP5NbksU/VfA5ksaAdISEtLYK7nTrn+3zTWSJWr9Q 0mV+GLSknKMya8LcyhcvesJ3Q1QKJWmfUU73DKsI62sGitQVbvWKRBkz5JMeZE9EAYGS J+i4NbNlWl1vgP0y1rUbj/++Nom5/OTIzCGAUZKnCl3sV8IJ9Hebp/RvmcZGPvecQpHx n3wg== X-Gm-Message-State: AOAM531gbEsrNDcgEs7R+tRMvhZbA0od1THA74yAwCawo5HuxhQMHgkL +z1A/sXosyGC5g2sTujqTyu0gcA0Y8iKx5Ix X-Google-Smtp-Source: ABdhPJwGR+RfXrSqTbPty2rOPqeQ4cXTppg9uNgrUpaRxmAKqj7yq40EBOv8KIFhQO1F2X307pvX5g== X-Received: by 2002:adf:92e4:: with SMTP id 91mr8027234wrn.230.1603882264156; Wed, 28 Oct 2020 03:51:04 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l16sm6525251wrx.5.2020.10.28.03.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 03:51:03 -0700 (PDT) From: luca.boccassi@gmail.com To: Igor Romanov Cc: Andrew Rybchenko , dpdk stable Date: Wed, 28 Oct 2020 10:44:12 +0000 Message-Id: <20201028104606.3504127-93-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201028104606.3504127-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/sfc: fix RSS hash offload if queue action is used' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/30/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From d175b6131bfb369cc1af2951d05e9ad03eaa184a Mon Sep 17 00:00:00 2001 From: Igor Romanov Date: Thu, 24 Sep 2020 13:40:59 +0100 Subject: [PATCH] net/sfc: fix RSS hash offload if queue action is used [ upstream commit 92a15fc541fcba1848933c4ba5c6e08f6330bc13 ] When RSS hash offload is requested, the ingress filters that forward packets to an RX queue must have an RSS context assigned to them to calculate RSS hash, which was not always provided. Fix it by creating a dummy RSS context that forwards packets to the same queue and assign it to created by flow API filters when RSS hash offload is enabled. RSS key and hash functions from default RSS context are used. Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload") Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/sfc.c | 1 + drivers/net/sfc/sfc.h | 2 ++ drivers/net/sfc/sfc_ethdev.c | 48 +++++++++++++++++-------- drivers/net/sfc/sfc_flow.c | 69 +++++++++++++++++++++++++++++------- drivers/net/sfc/sfc_flow.h | 2 ++ drivers/net/sfc/sfc_rx.c | 13 ++++--- drivers/net/sfc/sfc_rx.h | 1 + 7 files changed, 105 insertions(+), 31 deletions(-) diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 3f5cd7758b..da67acaa87 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -684,6 +684,7 @@ sfc_rss_attach(struct sfc_adapter *sa) efx_intr_fini(sa->nic); rte_memcpy(rss->key, default_rss_key, sizeof(rss->key)); + rss->dummy_rss_context = EFX_RSS_CONTEXT_DEFAULT; return 0; diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index cc52228771..bce6beefaa 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -172,6 +172,8 @@ struct sfc_rss { efx_rx_hash_type_t hash_types; unsigned int tbl[EFX_RSS_TBL_SIZE]; uint8_t key[EFX_RSS_KEY_SIZE]; + + uint32_t dummy_rss_context; }; /* Adapter private data shared by primary and secondary processes */ diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index f8867b0ec0..d33c476bd7 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1515,8 +1515,15 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; unsigned int efx_hash_types; + uint32_t contexts[] = {EFX_RSS_CONTEXT_DEFAULT, rss->dummy_rss_context}; + unsigned int n_contexts; + unsigned int mode_i = 0; + unsigned int key_i = 0; + unsigned int i = 0; int rc = 0; + n_contexts = rss->dummy_rss_context == EFX_RSS_CONTEXT_DEFAULT ? 1 : 2; + if (sfc_sa2shared(sa)->isolated) return -ENOTSUP; @@ -1543,19 +1550,24 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, if (rc != 0) goto fail_rx_hf_rte_to_efx; - rc = efx_rx_scale_mode_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT, - rss->hash_alg, efx_hash_types, B_TRUE); - if (rc != 0) - goto fail_scale_mode_set; + for (mode_i = 0; mode_i < n_contexts; mode_i++) { + rc = efx_rx_scale_mode_set(sa->nic, contexts[mode_i], + rss->hash_alg, efx_hash_types, + B_TRUE); + if (rc != 0) + goto fail_scale_mode_set; + } if (rss_conf->rss_key != NULL) { if (sa->state == SFC_ADAPTER_STARTED) { - rc = efx_rx_scale_key_set(sa->nic, - EFX_RSS_CONTEXT_DEFAULT, - rss_conf->rss_key, - sizeof(rss->key)); - if (rc != 0) - goto fail_scale_key_set; + for (key_i = 0; key_i < n_contexts; key_i++) { + rc = efx_rx_scale_key_set(sa->nic, + contexts[key_i], + rss_conf->rss_key, + sizeof(rss->key)); + if (rc != 0) + goto fail_scale_key_set; + } } rte_memcpy(rss->key, rss_conf->rss_key, sizeof(rss->key)); @@ -1568,12 +1580,20 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, return 0; fail_scale_key_set: - if (efx_rx_scale_mode_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT, - EFX_RX_HASHALG_TOEPLITZ, - rss->hash_types, B_TRUE) != 0) - sfc_err(sa, "failed to restore RSS mode"); + for (i = 0; i < key_i; i++) { + if (efx_rx_scale_key_set(sa->nic, contexts[i], rss->key, + sizeof(rss->key)) != 0) + sfc_err(sa, "failed to restore RSS key"); + } fail_scale_mode_set: + for (i = 0; i < mode_i; i++) { + if (efx_rx_scale_mode_set(sa->nic, contexts[i], + EFX_RX_HASHALG_TOEPLITZ, + rss->hash_types, B_TRUE) != 0) + sfc_err(sa, "failed to restore RSS mode"); + } + fail_rx_hf_rte_to_efx: sfc_adapter_unlock(sa); return -rc; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 023e55d951..91aa2a687a 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1240,6 +1240,7 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, struct rte_flow *flow) { struct sfc_rxq *rxq; + struct sfc_rxq_info *rxq_info; if (queue->index >= sfc_sa2shared(sa)->rxq_count) return -EINVAL; @@ -1247,6 +1248,10 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, rxq = &sa->rxq_ctrl[queue->index]; flow->spec.template.efs_dmaq_id = (uint16_t)rxq->hw_index; + rxq_info = &sfc_sa2shared(sa)->rxq_info[queue->index]; + flow->spec.rss_hash_required = !!(rxq_info->rxq_flags & + SFC_RXQ_FLAG_RSS_HASH); + return 0; } @@ -1405,13 +1410,34 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, struct sfc_rss *rss = &sas->rss; struct sfc_flow_rss *flow_rss = &flow->rss_conf; uint32_t efs_rss_context = EFX_RSS_CONTEXT_DEFAULT; + boolean_t create_context; unsigned int i; int rc = 0; - if (flow->rss) { - unsigned int rss_spread = MIN(flow_rss->rxq_hw_index_max - - flow_rss->rxq_hw_index_min + 1, - EFX_MAXRSS); + create_context = flow->rss || (flow->spec.rss_hash_required && + rss->dummy_rss_context == EFX_RSS_CONTEXT_DEFAULT); + + if (create_context) { + unsigned int rss_spread; + unsigned int rss_hash_types; + uint8_t *rss_key; + + if (flow->rss) { + rss_spread = MIN(flow_rss->rxq_hw_index_max - + flow_rss->rxq_hw_index_min + 1, + EFX_MAXRSS); + rss_hash_types = flow_rss->rss_hash_types; + rss_key = flow_rss->rss_key; + } else { + /* + * Initialize dummy RSS context parameters to have + * valid RSS hash. Use default RSS hash function and + * key. + */ + rss_spread = 1; + rss_hash_types = rss->hash_types; + rss_key = rss->key; + } rc = efx_rx_scale_context_alloc(sa->nic, EFX_RX_SCALE_EXCLUSIVE, @@ -1422,16 +1448,19 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, rc = efx_rx_scale_mode_set(sa->nic, efs_rss_context, rss->hash_alg, - flow_rss->rss_hash_types, B_TRUE); + rss_hash_types, B_TRUE); if (rc != 0) goto fail_scale_mode_set; rc = efx_rx_scale_key_set(sa->nic, efs_rss_context, - flow_rss->rss_key, - sizeof(rss->key)); + rss_key, sizeof(rss->key)); if (rc != 0) goto fail_scale_key_set; + } else { + efs_rss_context = rss->dummy_rss_context; + } + if (flow->rss || flow->spec.rss_hash_required) { /* * At this point, fully elaborated filter specifications * have been produced from the template. To make sure that @@ -1442,8 +1471,9 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, efx_filter_spec_t *spec = &flow->spec.filters[i]; spec->efs_rss_context = efs_rss_context; - spec->efs_dmaq_id = flow_rss->rxq_hw_index_min; spec->efs_flags |= EFX_FILTER_FLAG_RX_RSS; + if (flow->rss) + spec->efs_dmaq_id = flow_rss->rxq_hw_index_min; } } @@ -1451,7 +1481,12 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, if (rc != 0) goto fail_filter_insert; - if (flow->rss) { + if (create_context) { + unsigned int dummy_tbl[RTE_DIM(flow_rss->rss_tbl)] = {0}; + unsigned int *tbl; + + tbl = flow->rss ? flow_rss->rss_tbl : dummy_tbl; + /* * Scale table is set after filter insertion because * the table entries are relative to the base RxQ ID @@ -1461,10 +1496,13 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, * the table entries, and the operation will succeed */ rc = efx_rx_scale_tbl_set(sa->nic, efs_rss_context, - flow_rss->rss_tbl, - RTE_DIM(flow_rss->rss_tbl)); + tbl, RTE_DIM(flow_rss->rss_tbl)); if (rc != 0) goto fail_scale_tbl_set; + + /* Remember created dummy RSS context */ + if (!flow->rss) + rss->dummy_rss_context = efs_rss_context; } return 0; @@ -1475,7 +1513,7 @@ fail_scale_tbl_set: fail_filter_insert: fail_scale_key_set: fail_scale_mode_set: - if (efs_rss_context != EFX_RSS_CONTEXT_DEFAULT) + if (create_context) efx_rx_scale_context_free(sa->nic, efs_rss_context); fail_scale_context_alloc: @@ -2474,12 +2512,19 @@ sfc_flow_fini(struct sfc_adapter *sa) void sfc_flow_stop(struct sfc_adapter *sa) { + struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); + struct sfc_rss *rss = &sas->rss; struct rte_flow *flow; SFC_ASSERT(sfc_adapter_is_locked(sa)); TAILQ_FOREACH(flow, &sa->filter.flow_list, entries) sfc_flow_filter_remove(sa, flow); + + if (rss->dummy_rss_context != EFX_RSS_CONTEXT_DEFAULT) { + efx_rx_scale_context_free(sa->nic, rss->dummy_rss_context); + rss->dummy_rss_context = EFX_RSS_CONTEXT_DEFAULT; + } } int diff --git a/drivers/net/sfc/sfc_flow.h b/drivers/net/sfc/sfc_flow.h index 71ec18cb95..f59db0a468 100644 --- a/drivers/net/sfc/sfc_flow.h +++ b/drivers/net/sfc/sfc_flow.h @@ -43,6 +43,8 @@ struct sfc_flow_spec { efx_filter_spec_t filters[SF_FLOW_SPEC_NB_FILTERS_MAX]; /* number of complete specifications */ unsigned int count; + /* RSS hash toggle */ + boolean_t rss_hash_required; }; /* PMD-specific definition of the opaque type from rte_flow.h */ diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index 3ecd8da8c9..9a1c368328 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1139,6 +1139,13 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, rxq_info->refill_threshold = RTE_MAX(rx_free_thresh, SFC_RX_REFILL_BULK); rxq_info->refill_mb_pool = mb_pool; + + if (rss->hash_support == EFX_RX_HASH_AVAILABLE && rss->channels > 0 && + (offloads & DEV_RX_OFFLOAD_RSS_HASH)) + rxq_info->rxq_flags = SFC_RXQ_FLAG_RSS_HASH; + else + rxq_info->rxq_flags = 0; + rxq->buf_size = buf_size; rc = sfc_dma_alloc(sa, "rxq", sw_index, @@ -1154,11 +1161,7 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, info.buf_size = buf_size; info.batch_max = encp->enc_rx_batch_max; info.prefix_size = encp->enc_rx_prefix_size; - - if (rss->hash_support == EFX_RX_HASH_AVAILABLE && rss->channels > 0 && - (offloads & DEV_RX_OFFLOAD_RSS_HASH)) - info.flags |= SFC_RXQ_FLAG_RSS_HASH; - + info.flags = rxq_info->rxq_flags; info.rxq_entries = rxq_info->entries; info.rxq_hw_ring = rxq->mem.esm_base; info.evq_hw_index = sfc_evq_index_by_rxq_sw_index(sa, sw_index); diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h index 42b16e2ee6..4c31cfbaa2 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -115,6 +115,7 @@ struct sfc_rxq_info { boolean_t deferred_started; unsigned int refill_threshold; struct rte_mempool *refill_mb_pool; + unsigned int rxq_flags; }; struct sfc_rxq_info *sfc_rxq_info_by_dp_rxq(const struct sfc_dp_rxq *dp_rxq); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-10-28 10:35:14.672255866 +0000 +++ 0093-net-sfc-fix-RSS-hash-offload-if-queue-action-is-used.patch 2020-10-28 10:35:11.644832085 +0000 @@ -1,8 +1,10 @@ -From 92a15fc541fcba1848933c4ba5c6e08f6330bc13 Mon Sep 17 00:00:00 2001 +From d175b6131bfb369cc1af2951d05e9ad03eaa184a Mon Sep 17 00:00:00 2001 From: Igor Romanov Date: Thu, 24 Sep 2020 13:40:59 +0100 Subject: [PATCH] net/sfc: fix RSS hash offload if queue action is used +[ upstream commit 92a15fc541fcba1848933c4ba5c6e08f6330bc13 ] + When RSS hash offload is requested, the ingress filters that forward packets to an RX queue must have an RSS context assigned to them to calculate RSS hash, which was not always provided. @@ -13,7 +15,6 @@ default RSS context are used. Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload") -Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko @@ -28,10 +29,10 @@ 7 files changed, 105 insertions(+), 31 deletions(-) diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c -index 4be65c15dc..615e15af64 100644 +index 3f5cd7758b..da67acaa87 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c -@@ -685,6 +685,7 @@ sfc_rss_attach(struct sfc_adapter *sa) +@@ -684,6 +684,7 @@ sfc_rss_attach(struct sfc_adapter *sa) efx_intr_fini(sa->nic); rte_memcpy(rss->key, default_rss_key, sizeof(rss->key)); @@ -40,10 +41,10 @@ return 0; diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h -index fa7c79b80b..5ea29362e1 100644 +index cc52228771..bce6beefaa 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h -@@ -157,6 +157,8 @@ struct sfc_rss { +@@ -172,6 +172,8 @@ struct sfc_rss { efx_rx_hash_type_t hash_types; unsigned int tbl[EFX_RSS_TBL_SIZE]; uint8_t key[EFX_RSS_KEY_SIZE]; @@ -53,10 +54,10 @@ /* Adapter private data shared by primary and secondary processes */ diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c -index 6e6eb16860..602351bcc4 100644 +index f8867b0ec0..d33c476bd7 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c -@@ -1544,8 +1544,15 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, +@@ -1515,8 +1515,15 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); struct sfc_rss *rss = &sfc_sa2shared(sa)->rss; unsigned int efx_hash_types; @@ -72,7 +73,7 @@ if (sfc_sa2shared(sa)->isolated) return -ENOTSUP; -@@ -1572,19 +1579,24 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, +@@ -1543,19 +1550,24 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, if (rc != 0) goto fail_rx_hf_rte_to_efx; @@ -107,7 +108,7 @@ } rte_memcpy(rss->key, rss_conf->rss_key, sizeof(rss->key)); -@@ -1597,12 +1609,20 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, +@@ -1568,12 +1580,20 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, return 0; fail_scale_key_set: @@ -133,41 +134,41 @@ sfc_adapter_unlock(sa); return -rc; diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c -index 1a3c0d618b..cb802d7991 100644 +index 023e55d951..91aa2a687a 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c -@@ -1293,6 +1293,7 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, - struct sfc_flow_spec *spec = &flow->spec; - struct sfc_flow_spec_filter *spec_filter = &spec->filter; +@@ -1240,6 +1240,7 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, + struct rte_flow *flow) + { struct sfc_rxq *rxq; + struct sfc_rxq_info *rxq_info; if (queue->index >= sfc_sa2shared(sa)->rxq_count) return -EINVAL; -@@ -1300,6 +1301,10 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, +@@ -1247,6 +1248,10 @@ sfc_flow_parse_queue(struct sfc_adapter *sa, rxq = &sa->rxq_ctrl[queue->index]; - spec_filter->template.efs_dmaq_id = (uint16_t)rxq->hw_index; + flow->spec.template.efs_dmaq_id = (uint16_t)rxq->hw_index; + rxq_info = &sfc_sa2shared(sa)->rxq_info[queue->index]; -+ spec_filter->rss_hash_required = !!(rxq_info->rxq_flags & ++ flow->spec.rss_hash_required = !!(rxq_info->rxq_flags & + SFC_RXQ_FLAG_RSS_HASH); + return 0; } -@@ -1465,13 +1470,34 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, - struct sfc_flow_spec_filter *spec_filter = &flow->spec.filter; - struct sfc_flow_rss *flow_rss = &spec_filter->rss_conf; +@@ -1405,13 +1410,34 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, + struct sfc_rss *rss = &sas->rss; + struct sfc_flow_rss *flow_rss = &flow->rss_conf; uint32_t efs_rss_context = EFX_RSS_CONTEXT_DEFAULT; + boolean_t create_context; unsigned int i; int rc = 0; -- if (spec_filter->rss) { +- if (flow->rss) { - unsigned int rss_spread = MIN(flow_rss->rxq_hw_index_max - - flow_rss->rxq_hw_index_min + 1, - EFX_MAXRSS); -+ create_context = spec_filter->rss || (spec_filter->rss_hash_required && ++ create_context = flow->rss || (flow->spec.rss_hash_required && + rss->dummy_rss_context == EFX_RSS_CONTEXT_DEFAULT); + + if (create_context) { @@ -175,7 +176,7 @@ + unsigned int rss_hash_types; + uint8_t *rss_key; + -+ if (spec_filter->rss) { ++ if (flow->rss) { + rss_spread = MIN(flow_rss->rxq_hw_index_max - + flow_rss->rxq_hw_index_min + 1, + EFX_MAXRSS); @@ -194,7 +195,7 @@ rc = efx_rx_scale_context_alloc(sa->nic, EFX_RX_SCALE_EXCLUSIVE, -@@ -1482,16 +1508,19 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, +@@ -1422,16 +1448,19 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, rc = efx_rx_scale_mode_set(sa->nic, efs_rss_context, rss->hash_alg, @@ -213,36 +214,36 @@ + efs_rss_context = rss->dummy_rss_context; + } -+ if (spec_filter->rss || spec_filter->rss_hash_required) { ++ if (flow->rss || flow->spec.rss_hash_required) { /* * At this point, fully elaborated filter specifications * have been produced from the template. To make sure that -@@ -1502,8 +1531,9 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, - efx_filter_spec_t *spec = &spec_filter->filters[i]; +@@ -1442,8 +1471,9 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, + efx_filter_spec_t *spec = &flow->spec.filters[i]; spec->efs_rss_context = efs_rss_context; - spec->efs_dmaq_id = flow_rss->rxq_hw_index_min; spec->efs_flags |= EFX_FILTER_FLAG_RX_RSS; -+ if (spec_filter->rss) ++ if (flow->rss) + spec->efs_dmaq_id = flow_rss->rxq_hw_index_min; } } -@@ -1511,7 +1541,12 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, +@@ -1451,7 +1481,12 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, if (rc != 0) goto fail_filter_insert; -- if (spec_filter->rss) { +- if (flow->rss) { + if (create_context) { + unsigned int dummy_tbl[RTE_DIM(flow_rss->rss_tbl)] = {0}; + unsigned int *tbl; + -+ tbl = spec_filter->rss ? flow_rss->rss_tbl : dummy_tbl; ++ tbl = flow->rss ? flow_rss->rss_tbl : dummy_tbl; + /* * Scale table is set after filter insertion because * the table entries are relative to the base RxQ ID -@@ -1521,10 +1556,13 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, +@@ -1461,10 +1496,13 @@ sfc_flow_filter_insert(struct sfc_adapter *sa, * the table entries, and the operation will succeed */ rc = efx_rx_scale_tbl_set(sa->nic, efs_rss_context, @@ -253,12 +254,12 @@ goto fail_scale_tbl_set; + + /* Remember created dummy RSS context */ -+ if (!spec_filter->rss) ++ if (!flow->rss) + rss->dummy_rss_context = efs_rss_context; } return 0; -@@ -1535,7 +1573,7 @@ fail_scale_tbl_set: +@@ -1475,7 +1513,7 @@ fail_scale_tbl_set: fail_filter_insert: fail_scale_key_set: fail_scale_mode_set: @@ -267,7 +268,7 @@ efx_rx_scale_context_free(sa->nic, efs_rss_context); fail_scale_context_alloc: -@@ -2634,12 +2672,19 @@ sfc_flow_fini(struct sfc_adapter *sa) +@@ -2474,12 +2512,19 @@ sfc_flow_fini(struct sfc_adapter *sa) void sfc_flow_stop(struct sfc_adapter *sa) { @@ -277,8 +278,8 @@ SFC_ASSERT(sfc_adapter_is_locked(sa)); - TAILQ_FOREACH(flow, &sa->flow_list, entries) - sfc_flow_remove(sa, flow, NULL); + TAILQ_FOREACH(flow, &sa->filter.flow_list, entries) + sfc_flow_filter_remove(sa, flow); + + if (rss->dummy_rss_context != EFX_RSS_CONTEXT_DEFAULT) { + efx_rx_scale_context_free(sa->nic, rss->dummy_rss_context); @@ -288,20 +289,20 @@ int diff --git a/drivers/net/sfc/sfc_flow.h b/drivers/net/sfc/sfc_flow.h -index 5a7dad8f09..433c7a31e9 100644 +index 71ec18cb95..f59db0a468 100644 --- a/drivers/net/sfc/sfc_flow.h +++ b/drivers/net/sfc/sfc_flow.h -@@ -52,6 +52,8 @@ struct sfc_flow_spec_filter { +@@ -43,6 +43,8 @@ struct sfc_flow_spec { + efx_filter_spec_t filters[SF_FLOW_SPEC_NB_FILTERS_MAX]; + /* number of complete specifications */ unsigned int count; - /* RSS toggle */ - boolean_t rss; + /* RSS hash toggle */ + boolean_t rss_hash_required; - /* RSS configuration */ - struct sfc_flow_rss rss_conf; }; + + /* PMD-specific definition of the opaque type from rte_flow.h */ diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c -index dccafb163a..3e5c8e42da 100644 +index 3ecd8da8c9..9a1c368328 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1139,6 +1139,13 @@ sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index, @@ -332,7 +333,7 @@ info.rxq_hw_ring = rxq->mem.esm_base; info.evq_hw_index = sfc_evq_index_by_rxq_sw_index(sa, sw_index); diff --git a/drivers/net/sfc/sfc_rx.h b/drivers/net/sfc/sfc_rx.h -index 697ea29d62..b0b5327a49 100644 +index 42b16e2ee6..4c31cfbaa2 100644 --- a/drivers/net/sfc/sfc_rx.h +++ b/drivers/net/sfc/sfc_rx.h @@ -115,6 +115,7 @@ struct sfc_rxq_info {