From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nbfkord-smmo02.seg.att.com (nbfkord-smmo02.seg.att.com [209.65.160.78]) by dpdk.org (Postfix) with ESMTP id 14D906932 for ; Fri, 2 Dec 2016 08:45:06 +0100 (CET) Received: from unknown [12.187.104.26] by nbfkord-smmo02.seg.att.com(mxl_mta-7.2.4-7) with SMTP id 28621485.0.106138.00-2388.245921.nbfkord-smmo02.seg.att.com (envelope-from ); Fri, 02 Dec 2016 07:45:07 +0000 (UTC) X-MXL-Hash: 584126832c768d0e-59972bde351a0558038268a70c6f651be70d66fd Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Thu, 1 Dec 2016 23:45:01 -0800 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Thu, 1 Dec 2016 23:45:01 -0800 Received: from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com [10.17.10.10]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uB27j0R9005850 for ; Fri, 2 Dec 2016 07:45:00 GMT Received: from uklogin.uk.solarflarecom.com (localhost.localdomain [127.0.0.1]) by uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id uB27ixwd026628 for ; Fri, 2 Dec 2016 07:45:00 GMT From: Andrew Rybchenko To: Date: Fri, 2 Dec 2016 07:44:22 +0000 Message-ID: <1480664691-26561-3-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> References: <1480664691-26561-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-AnalysisOut: [v=2.1 cv=NIXTjhOg c=1 sm=1 tr=0 a=8BlWFWvVlq5taO8ncb8nKg==] X-AnalysisOut: [:17 a=n5n_aSjo0skA:10 a=zRKbQ67AAAAA:8 a=g_G3fzvY3BooDjDdp] X-AnalysisOut: [tEA:9 a=YGE3ZluoQfzfLcrN:21 a=lXIMY1YraXUrqOzT:21 a=PA03WX] X-AnalysisOut: [8tBzeizutn5_OT:22] X-Spam: [F=0.5013122585; CM=0.500; S=0.501(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.26] Subject: [dpdk-dev] [PATCH 02/31] net/sfc: support parameter to choose performance profile X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 07:45:07 -0000 Supported options are auto (based on NIC firmware variant and installed licences), throughput, low-latency. Reviewed-by: Andrew Lee Reviewed-by: Robert Stonehouse Signed-off-by: Andrew Rybchenko --- doc/guides/nics/sfc_efx.rst | 7 +++++++ drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_ev.c | 36 +++++++++++++++++++++++++++++++++--- drivers/net/sfc/sfc_ev.h | 2 ++ drivers/net/sfc/sfc_kvargs.c | 1 + drivers/net/sfc/sfc_kvargs.h | 10 ++++++++++ 7 files changed, 55 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst index 2cca287..36d0974 100644 --- a/doc/guides/nics/sfc_efx.rst +++ b/doc/guides/nics/sfc_efx.rst @@ -152,6 +152,13 @@ whitelist option like "-w 02:00.0,arg1=value1,...". Case-insensitive 1/y/yes/on or 0/n/no/off may be used to specify boolean parameters value. +- ``perf_profile`` [auto|throughput|low-latency] (default **throughput**) + + Choose hardware tunning to be optimized for either throughput or + low-latency. + **auto** allows NIC firmware to make a choice based on + installed licences and firmware variant configured using **sfboot**. + - ``debug_init`` [bool] (default **n**) Enable extra logging during device intialization and startup. diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 0064fcb..d0aafa3 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -152,6 +152,7 @@ struct sfc_adapter { unsigned int txq_max_entries; + uint32_t evq_flags; unsigned int evq_count; struct sfc_evq_info *evq_info; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 12309ee..1df227e 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -464,5 +464,6 @@ static struct eth_driver sfc_efx_pmd = { RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd.pci_drv); RTE_PMD_REGISTER_PCI_TABLE(net_sfc_efx, pci_id_sfc_efx_map); RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx, + SFC_KVARG_PERF_PROFILE "=" SFC_KVARG_VALUES_PERF_PROFILE " " SFC_KVARG_MCDI_LOGGING "=" SFC_KVARG_VALUES_BOOL " " SFC_KVARG_DEBUG_INIT "=" SFC_KVARG_VALUES_BOOL); diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c index 96b95cc..34c1127 100644 --- a/drivers/net/sfc/sfc_ev.c +++ b/drivers/net/sfc/sfc_ev.c @@ -39,6 +39,7 @@ #include "sfc_ev.h" #include "sfc_rx.h" #include "sfc_tx.h" +#include "sfc_kvargs.h" /* Initial delay when waiting for event queue init complete event */ @@ -365,9 +366,7 @@ sfc_ev_qstart(struct sfc_adapter *sa, unsigned int sw_index) /* Create the common code event queue */ rc = efx_ev_qcreate(sa->nic, sw_index, esmp, evq_info->entries, - 0 /* unused on EF10 */, 0, - EFX_EVQ_FLAGS_TYPE_THROUGHPUT | - EFX_EVQ_FLAGS_NOTIFY_DISABLED, + 0 /* unused on EF10 */, 0, evq_info->flags, &evq->common); if (rc != 0) goto fail_ev_qcreate; @@ -600,6 +599,25 @@ sfc_ev_qinit_info(struct sfc_adapter *sa, unsigned int sw_index) SFC_ASSERT(rte_is_power_of_2(max_entries)); evq_info->max_entries = max_entries; + evq_info->flags = sa->evq_flags | EFX_EVQ_FLAGS_NOTIFY_DISABLED; + + return 0; +} + +static int +sfc_kvarg_perf_profile_handler(__rte_unused const char *key, + const char *value_str, void *opaque) +{ + uint64_t *value = opaque; + + if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_THROUGHPUT) == 0) + *value = EFX_EVQ_FLAGS_TYPE_THROUGHPUT; + else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_LOW_LATENCY) == 0) + *value = EFX_EVQ_FLAGS_TYPE_LOW_LATENCY; + else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_AUTO) == 0) + *value = EFX_EVQ_FLAGS_TYPE_AUTO; + else + return -EINVAL; return 0; } @@ -620,6 +638,16 @@ sfc_ev_init(struct sfc_adapter *sa) sfc_log_init(sa, "entry"); + sa->evq_flags = EFX_EVQ_FLAGS_TYPE_THROUGHPUT; + rc = sfc_kvargs_process(sa, SFC_KVARG_PERF_PROFILE, + sfc_kvarg_perf_profile_handler, + &sa->evq_flags); + if (rc != 0) { + sfc_err(sa, "invalid %s parameter value", + SFC_KVARG_PERF_PROFILE); + goto fail_kvarg_perf_profile; + } + sa->evq_count = sfc_ev_qcount(sa); sa->mgmt_evq_index = 0; rte_spinlock_init(&sa->mgmt_evq_lock); @@ -660,6 +688,8 @@ sfc_ev_init(struct sfc_adapter *sa) fail_evqs_alloc: sa->evq_count = 0; + +fail_kvarg_perf_profile: sfc_log_init(sa, "failed %d", rc); return rc; } diff --git a/drivers/net/sfc/sfc_ev.h b/drivers/net/sfc/sfc_ev.h index 110f3b6..346e3ec 100644 --- a/drivers/net/sfc/sfc_ev.h +++ b/drivers/net/sfc/sfc_ev.h @@ -74,6 +74,8 @@ struct sfc_evq_info { unsigned int max_entries; /* Real number of EVQ entries, less or equal to max_entries */ unsigned int entries; + /* Event queue creation flags */ + uint32_t flags; /* NUMA-aware EVQ data structure used on datapath */ struct sfc_evq *evq; }; diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c index bbbd026..2ced47c 100644 --- a/drivers/net/sfc/sfc_kvargs.c +++ b/drivers/net/sfc/sfc_kvargs.c @@ -43,6 +43,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa) const char **params = (const char *[]){ SFC_KVARG_DEBUG_INIT, SFC_KVARG_MCDI_LOGGING, + SFC_KVARG_PERF_PROFILE, NULL, }; diff --git a/drivers/net/sfc/sfc_kvargs.h b/drivers/net/sfc/sfc_kvargs.h index ffce851..2fea9c7 100644 --- a/drivers/net/sfc/sfc_kvargs.h +++ b/drivers/net/sfc/sfc_kvargs.h @@ -42,6 +42,16 @@ extern "C" { #define SFC_KVARG_MCDI_LOGGING "mcdi_logging" +#define SFC_KVARG_PERF_PROFILE "perf_profile" + +#define SFC_KVARG_PERF_PROFILE_AUTO "auto" +#define SFC_KVARG_PERF_PROFILE_THROUGHPUT "throughput" +#define SFC_KVARG_PERF_PROFILE_LOW_LATENCY "low-latency" +#define SFC_KVARG_VALUES_PERF_PROFILE \ + "[" SFC_KVARG_PERF_PROFILE_AUTO "|" \ + SFC_KVARG_PERF_PROFILE_THROUGHPUT "|" \ + SFC_KVARG_PERF_PROFILE_LOW_LATENCY "]" + struct sfc_adapter; int sfc_kvargs_parse(struct sfc_adapter *sa); -- 2.5.5