]> git.droids-corp.org - dpdk.git/commitdiff
net/sfc: use even spread mode in flow action RSS
authorIvan Malov <ivan.malov@oktetlabs.ru>
Tue, 1 Feb 2022 08:50:02 +0000 (11:50 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 2 Feb 2022 17:37:31 +0000 (18:37 +0100)
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 <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/net/sfc/sfc_flow_rss.c
drivers/net/sfc/sfc_flow_rss.h

index 4bf300216406381cff444110b013149ce7b6b64c..e28c943335f3b05d5cf853a050f78c3de5804fcb 100644 (file)
@@ -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,
index 3341d06cf474f69eac1fcf0d9345c111e07c23bb..2ed81dc19007a2ac016e40f76edc5524bebdd6f0 100644 (file)
@@ -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;