From: <shaibran@amazon.com>
To: <ferruh.yigit@amd.com>
Cc: <dev@dpdk.org>, Shai Brandes <shaibran@amazon.com>
Subject: [PATCH v3 07/33] net/ena: restructure the llq policy setting process
Date: Wed, 6 Mar 2024 14:24:19 +0200 [thread overview]
Message-ID: <20240306122445.4350-8-shaibran@amazon.com> (raw)
In-Reply-To: <20240306122445.4350-1-shaibran@amazon.com>
From: Shai Brandes <shaibran@amazon.com>
The driver will set the size of the LLQ header size according to the
recommendation from the device.
Replaced `enable_llq` and `large_llq_hdr` devargs with
a new devarg `llq_policy` that accepts the following values:
0 - Disable LLQ.
Use with extreme caution as it leads to a huge performance
degradation on AWS instances from 6th generation onwards.
1 - Accept device recommended LLQ policy (Default).
Device can recommend normal or large LLQ policy.
2 - Enforce normal LLQ policy.
3 - Enforce large LLQ policy.
Required for packets with header that exceed 96 bytes on
AWS instances prior to 5th generation.
Signed-off-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
---
doc/guides/nics/ena.rst | 21 ++---
doc/guides/rel_notes/release_24_03.rst | 1 +
drivers/net/ena/ena_ethdev.c | 110 +++++++++++++------------
drivers/net/ena/ena_ethdev.h | 11 ++-
4 files changed, 77 insertions(+), 66 deletions(-)
diff --git a/doc/guides/nics/ena.rst b/doc/guides/nics/ena.rst
index b039e75ead..53c9341859 100644
--- a/doc/guides/nics/ena.rst
+++ b/doc/guides/nics/ena.rst
@@ -107,11 +107,15 @@ Configuration
Runtime Configuration
^^^^^^^^^^^^^^^^^^^^^
- * **large_llq_hdr** (default 0)
+ * **llq_policy** (default 1)
- Enables or disables usage of large LLQ headers. This option will have
- effect only if the device also supports large LLQ headers. Otherwise, the
- default value will be used.
+ Controls whether use device recommended header policy or override it.
+ 0 - Disable LLQ.
+ **Use with extreme caution as it leads to a huge performance
+ degradation on AWS instances from 6th generation onwards.**
+ 1 - Accept device recommended LLQ policy (Default).
+ 2 - Enforce normal LLQ policy.
+ 3 - Enforce large LLQ policy.
* **miss_txc_to** (default 5)
@@ -122,15 +126,6 @@ Runtime Configuration
timer service. Setting this parameter to 0 disables this feature. Maximum
allowed value is 60 seconds.
- * **enable_llq** (default 1)
-
- Determines whenever the driver should use the LLQ (if it's available) or
- not.
-
- **NOTE: On the 6th generation AWS instances disabling LLQ may lead to a
- huge performance degradation. In general disabling LLQ is highly not
- recommended!**
-
ENA Configuration Parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 6b73d4fedf..2a22bb07ed 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -106,6 +106,7 @@ New Features
* Removed the reporting of `rx_overruns` errors from xstats and instead updated `imissed` stat with its value.
* Added support for sub-optimal configuration notifications from the device.
* Restructured fast release of mbufs when RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE optimization is enabled.
+ * Replaced `enable_llq` and `large_llq_hdr` devargs with a new devarg `llq_policy`.
* **Updated Atomic Rules' Arkville driver.**
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 537ee9f8c3..2414f631c8 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -40,6 +40,8 @@
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
+#define DECIMAL_BASE 10
+
/*
* We should try to keep ENA_CLEANUP_BUF_SIZE lower than
* RTE_MEMPOOL_CACHE_MAX_SIZE, so we can fit this in mempool local cache.
@@ -74,17 +76,23 @@ struct ena_stats {
ENA_STAT_ENTRY(stat, srd)
/* Device arguments */
-#define ENA_DEVARG_LARGE_LLQ_HDR "large_llq_hdr"
+/* Controls whether to disable LLQ, use device recommended header policy
+ * or overriding the device recommendation.
+ * 0 - Disable LLQ.
+ * Use with extreme caution as it leads to a huge performance
+ * degradation on AWS instances from 6th generation onwards.
+ * 1 - Accept device recommended LLQ policy (Default).
+ * Device can recommend normal or large LLQ policy.
+ * 2 - Enforce normal LLQ policy.
+ * 3 - Enforce large LLQ policy.
+ * Required for packets with header that exceed 96 bytes on
+ * AWS instances prior to 5th generation.
+ */
+#define ENA_DEVARG_LLQ_POLICY "llq_policy"
/* Timeout in seconds after which a single uncompleted Tx packet should be
* considered as a missing.
*/
#define ENA_DEVARG_MISS_TXC_TO "miss_txc_to"
-/*
- * Controls whether LLQ should be used (if available). Enabled by default.
- * NOTE: It's highly not recommended to disable the LLQ, as it may lead to a
- * huge performance degradation on 6th generation AWS instances.
- */
-#define ENA_DEVARG_ENABLE_LLQ "enable_llq"
/*
* Each rte_memzone should have unique name.
@@ -279,9 +287,9 @@ static int ena_xstats_get_by_id(struct rte_eth_dev *dev,
const uint64_t *ids,
uint64_t *values,
unsigned int n);
-static int ena_process_bool_devarg(const char *key,
- const char *value,
- void *opaque);
+static int ena_process_llq_policy_devarg(const char *key,
+ const char *value,
+ void *opaque);
static int ena_parse_devargs(struct ena_adapter *adapter,
struct rte_devargs *devargs);
static void ena_copy_customer_metrics(struct ena_adapter *adapter,
@@ -297,6 +305,7 @@ static int ena_rx_queue_intr_disable(struct rte_eth_dev *dev,
static int ena_configure_aenq(struct ena_adapter *adapter);
static int ena_mp_primary_handle(const struct rte_mp_msg *mp_msg,
const void *peer);
+static bool ena_use_large_llq_hdr(struct ena_adapter *adapter, uint8_t recommended_entry_size);
static const struct eth_dev_ops ena_dev_ops = {
.dev_configure = ena_dev_configure,
@@ -1135,6 +1144,7 @@ ena_calc_io_queue_size(struct ena_calc_queue_size_ctx *ctx,
ctx->max_tx_queue_size = max_tx_queue_size;
ctx->max_rx_queue_size = max_rx_queue_size;
+ PMD_DRV_LOG(INFO, "tx queue size %u\n", max_tx_queue_size);
return 0;
}
@@ -2034,7 +2044,7 @@ ena_set_queues_placement_policy(struct ena_adapter *adapter,
int rc;
u32 llq_feature_mask;
- if (!adapter->enable_llq) {
+ if (adapter->llq_header_policy == ENA_LLQ_POLICY_DISABLED) {
PMD_DRV_LOG(WARNING,
"NOTE: LLQ has been disabled as per user's request. "
"This may lead to a huge performance degradation!\n");
@@ -2239,8 +2249,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
/* Assign default devargs values */
adapter->missing_tx_completion_to = ENA_TX_TIMEOUT;
- adapter->enable_llq = true;
- adapter->use_large_llq_hdr = false;
+ adapter->llq_header_policy = ENA_LLQ_POLICY_RECOMMENDED;
rc = ena_parse_devargs(adapter, pci_dev->device.devargs);
if (rc != 0) {
@@ -2264,8 +2273,9 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
if (!(adapter->all_aenq_groups & BIT(ENA_ADMIN_LINK_CHANGE)))
adapter->edev_data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
- set_default_llq_configurations(&llq_config, &get_feat_ctx.llq,
- adapter->use_large_llq_hdr);
+ bool use_large_llq_hdr = ena_use_large_llq_hdr(adapter,
+ get_feat_ctx.llq.entry_size_recommended);
+ set_default_llq_configurations(&llq_config, &get_feat_ctx.llq, use_large_llq_hdr);
rc = ena_set_queues_placement_policy(adapter, ena_dev,
&get_feat_ctx.llq, &llq_config);
if (unlikely(rc)) {
@@ -2273,18 +2283,19 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
return rc;
}
- if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST)
+ if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) {
queue_type_str = "Regular";
- else
+ } else {
queue_type_str = "Low latency";
+ PMD_DRV_LOG(INFO, "LLQ entry size %uB\n", llq_config.llq_ring_entry_size_value);
+ }
PMD_DRV_LOG(INFO, "Placement policy: %s\n", queue_type_str);
calc_queue_ctx.ena_dev = ena_dev;
calc_queue_ctx.get_feat_ctx = &get_feat_ctx;
max_num_io_queues = ena_calc_max_io_queue_num(ena_dev, &get_feat_ctx);
- rc = ena_calc_io_queue_size(&calc_queue_ctx,
- adapter->use_large_llq_hdr);
+ rc = ena_calc_io_queue_size(&calc_queue_ctx, use_large_llq_hdr);
if (unlikely((rc != 0) || (max_num_io_queues == 0))) {
rc = -EFAULT;
goto err_device_destroy;
@@ -3632,7 +3643,7 @@ static int ena_process_uint_devarg(const char *key,
char *str_end;
uint64_t uint_value;
- uint_value = strtoull(value, &str_end, 10);
+ uint_value = strtoull(value, &str_end, DECIMAL_BASE);
if (value == str_end) {
PMD_INIT_LOG(ERR,
"Invalid value for key '%s'. Only uint values are accepted.\n",
@@ -3663,41 +3674,29 @@ static int ena_process_uint_devarg(const char *key,
return 0;
}
-static int ena_process_bool_devarg(const char *key,
- const char *value,
- void *opaque)
+static int ena_process_llq_policy_devarg(const char *key, const char *value, void *opaque)
{
struct ena_adapter *adapter = opaque;
- bool bool_value;
+ uint32_t policy;
- /* Parse the value. */
- if (strcmp(value, "1") == 0) {
- bool_value = true;
- } else if (strcmp(value, "0") == 0) {
- bool_value = false;
+ policy = strtoul(value, NULL, DECIMAL_BASE);
+ if (policy < ENA_LLQ_POLICY_LAST) {
+ adapter->llq_header_policy = policy;
} else {
- PMD_INIT_LOG(ERR,
- "Invalid value: '%s' for key '%s'. Accepted: '0' or '1'\n",
- value, key);
+ PMD_INIT_LOG(ERR, "Invalid value: '%s' for key '%s'. valid [0-3]\n", value, key);
return -EINVAL;
}
-
- /* Now, assign it to the proper adapter field. */
- if (strcmp(key, ENA_DEVARG_LARGE_LLQ_HDR) == 0)
- adapter->use_large_llq_hdr = bool_value;
- else if (strcmp(key, ENA_DEVARG_ENABLE_LLQ) == 0)
- adapter->enable_llq = bool_value;
-
+ PMD_DRV_LOG(INFO,
+ "LLQ policy is %u [0 - disabled, 1 - device recommended, 2 - normal, 3 - large]\n",
+ adapter->llq_header_policy);
return 0;
}
-static int ena_parse_devargs(struct ena_adapter *adapter,
- struct rte_devargs *devargs)
+static int ena_parse_devargs(struct ena_adapter *adapter, struct rte_devargs *devargs)
{
static const char * const allowed_args[] = {
- ENA_DEVARG_LARGE_LLQ_HDR,
+ ENA_DEVARG_LLQ_POLICY,
ENA_DEVARG_MISS_TXC_TO,
- ENA_DEVARG_ENABLE_LLQ,
NULL,
};
struct rte_kvargs *kvlist;
@@ -3708,21 +3707,18 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
kvlist = rte_kvargs_parse(devargs->args, allowed_args);
if (kvlist == NULL) {
- PMD_INIT_LOG(ERR, "Invalid device arguments: %s\n",
- devargs->args);
+ PMD_INIT_LOG(ERR, "Invalid device arguments: %s\n", devargs->args);
return -EINVAL;
}
- rc = rte_kvargs_process(kvlist, ENA_DEVARG_LARGE_LLQ_HDR,
- ena_process_bool_devarg, adapter);
+ rc = rte_kvargs_process(kvlist, ENA_DEVARG_LLQ_POLICY,
+ ena_process_llq_policy_devarg, adapter);
if (rc != 0)
goto exit;
rc = rte_kvargs_process(kvlist, ENA_DEVARG_MISS_TXC_TO,
ena_process_uint_devarg, adapter);
if (rc != 0)
goto exit;
- rc = rte_kvargs_process(kvlist, ENA_DEVARG_ENABLE_LLQ,
- ena_process_bool_devarg, adapter);
exit:
rte_kvargs_free(kvlist);
@@ -3942,8 +3938,7 @@ RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd);
RTE_PMD_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
RTE_PMD_REGISTER_KMOD_DEP(net_ena, "* igb_uio | uio_pci_generic | vfio-pci");
RTE_PMD_REGISTER_PARAM_STRING(net_ena,
- ENA_DEVARG_LARGE_LLQ_HDR "=<0|1> "
- ENA_DEVARG_ENABLE_LLQ "=<0|1> "
+ ENA_DEVARG_LLQ_POLICY "=<0|1|2|3> "
ENA_DEVARG_MISS_TXC_TO "=<uint>");
RTE_LOG_REGISTER_SUFFIX(ena_logtype_init, init, NOTICE);
RTE_LOG_REGISTER_SUFFIX(ena_logtype_driver, driver, NOTICE);
@@ -4129,3 +4124,16 @@ ena_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
/* Return just IPC processing status */
return rte_mp_reply(&mp_rsp, peer);
}
+
+static bool ena_use_large_llq_hdr(struct ena_adapter *adapter, uint8_t recommended_entry_size)
+{
+ if (adapter->llq_header_policy == ENA_LLQ_POLICY_LARGE) {
+ return true;
+ } else if (adapter->llq_header_policy == ENA_LLQ_POLICY_RECOMMENDED) {
+ PMD_DRV_LOG(INFO, "Recommended device entry size policy %u\n",
+ recommended_entry_size);
+ if (recommended_entry_size == ENA_ADMIN_LIST_ENTRY_SIZE_256B)
+ return true;
+ }
+ return false;
+}
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index 20b8307836..6716f01ba5 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -85,6 +85,14 @@ enum ena_ring_type {
ENA_RING_TYPE_TX = 2,
};
+typedef enum ena_llq_policy_t {
+ ENA_LLQ_POLICY_DISABLED = 0, /* Host queues */
+ ENA_LLQ_POLICY_RECOMMENDED = 1, /* Device recommendation */
+ ENA_LLQ_POLICY_NORMAL = 2, /* 128B long LLQ entry */
+ ENA_LLQ_POLICY_LARGE = 3, /* 256B long LLQ entry */
+ ENA_LLQ_POLICY_LAST,
+} ena_llq_policy;
+
struct ena_tx_buffer {
struct rte_mbuf *mbuf;
unsigned int tx_descs;
@@ -329,8 +337,7 @@ struct ena_adapter {
bool trigger_reset;
- bool enable_llq;
- bool use_large_llq_hdr;
+ ena_llq_policy llq_header_policy;
uint32_t last_tx_comp_qid;
uint64_t missing_tx_completion_to;
--
2.17.1
next prev parent reply other threads:[~2024-03-06 12:25 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 12:24 [PATCH v3 00/33] net/ena: v2.9.0 driver release shaibran
2024-03-06 12:24 ` [PATCH v3 01/33] net/ena: rework the metrics multi-process functions shaibran
2024-03-06 12:24 ` [PATCH v3 02/33] net/ena: report new supported link speed capabilities shaibran
2024-03-06 12:24 ` [PATCH v3 03/33] net/ena: update imissed stat with Rx overruns shaibran
2024-03-06 12:24 ` [PATCH v3 04/33] net/ena: sub-optimal configuration notifications support shaibran
2024-03-08 17:23 ` Ferruh Yigit
2024-03-10 14:43 ` Brandes, Shai
2024-03-13 11:18 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 05/33] net/ena: fix fast mbuf free shaibran
2024-03-08 17:23 ` Ferruh Yigit
2024-03-10 14:58 ` Brandes, Shai
2024-03-13 11:28 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 06/33] net/ena: rename base folder to hal shaibran
2024-03-08 17:23 ` Ferruh Yigit
2024-03-10 14:23 ` Brandes, Shai
2024-03-06 12:24 ` shaibran [this message]
2024-03-08 17:24 ` [PATCH v3 07/33] net/ena: restructure the llq policy setting process Ferruh Yigit
2024-03-10 14:29 ` Brandes, Shai
2024-03-13 11:21 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 08/33] net/ena/hal: exponential backoff exp limit shaibran
2024-03-08 17:24 ` Ferruh Yigit
2024-03-10 14:53 ` Brandes, Shai
2024-03-12 16:53 ` Brandes, Shai
2024-03-13 11:25 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 09/33] net/ena/hal: add a new csum offload bit shaibran
2024-03-08 17:24 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 10/33] net/ena/hal: added a bus parameter to ena memcpy macro shaibran
2024-03-08 17:25 ` Ferruh Yigit
2024-03-10 15:08 ` Brandes, Shai
2024-03-13 11:27 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 11/33] net/ena/hal: optimize Rx ring submission queue shaibran
2024-03-06 12:24 ` [PATCH v3 12/33] net/ena/hal: rename fields in completion descriptors shaibran
2024-03-06 12:24 ` [PATCH v3 13/33] net/ena/hal: use correct read once on u8 field shaibran
2024-03-06 12:24 ` [PATCH v3 14/33] net/ena/hal: add completion descriptor corruption check shaibran
2024-03-06 12:24 ` [PATCH v3 15/33] net/ena/hal: malformed Tx descriptor error reason shaibran
2024-03-06 12:24 ` [PATCH v3 16/33] net/ena/hal: phc feature modifications shaibran
2024-03-06 12:24 ` [PATCH v3 17/33] net/ena/hal: restructure interrupt handling shaibran
2024-03-06 12:24 ` [PATCH v3 18/33] net/ena/hal: add unlikely to error checks shaibran
2024-03-06 12:24 ` [PATCH v3 19/33] net/ena/hal: missing admin interrupt reset reason shaibran
2024-03-06 12:24 ` [PATCH v3 20/33] net/ena/hal: check for existing keep alive notification shaibran
2024-03-06 12:24 ` [PATCH v3 21/33] net/ena/hal: modify memory barrier comment shaibran
2024-03-06 12:24 ` [PATCH v3 22/33] net/ena/hal: rework Rx ring submission queue shaibran
2024-03-06 12:24 ` [PATCH v3 23/33] net/ena/hal: remove operating system type enum shaibran
2024-03-06 12:24 ` [PATCH v3 24/33] net/ena/hal: handle command abort shaibran
2024-03-06 12:24 ` [PATCH v3 25/33] net/ena/hal: add support for device reset request shaibran
2024-03-06 12:24 ` [PATCH v3 26/33] net/ena: cosmetic changes shaibran
2024-03-08 11:17 ` Ferruh Yigit
2024-03-08 13:19 ` Brandes, Shai
2024-03-08 14:50 ` Ferruh Yigit
2024-03-06 12:24 ` [PATCH v3 27/33] net/ena/hal: modify customer metrics memory management shaibran
2024-03-06 12:24 ` [PATCH v3 28/33] net/ena/hal: cosmetic changes shaibran
2024-03-08 17:43 ` Ferruh Yigit
2024-03-08 17:44 ` Ferruh Yigit
2024-03-12 17:12 ` Brandes, Shai
2024-03-06 12:24 ` [PATCH v3 29/33] net/ena: update device-preferred size of rings shaibran
2024-03-06 12:24 ` [PATCH v3 30/33] net/ena: exhaust interrupt callbacks in device close shaibran
2024-03-06 12:24 ` [PATCH v3 31/33] net/ena: support max large llq depth from the device shaibran
2024-03-06 12:24 ` [PATCH v3 32/33] net/ena: control path pure polling mode shaibran
2024-03-06 12:24 ` [PATCH v3 33/33] net/ena: upgrade driver version to 2.9.0 shaibran
2024-03-08 17:36 ` [PATCH v3 00/33] net/ena: v2.9.0 driver release Ferruh Yigit
2024-03-08 20:26 ` Brandes, Shai
2024-03-10 14:21 ` Brandes, Shai
2024-03-13 11:28 ` Ferruh Yigit
2024-03-13 13:38 ` Brandes, Shai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240306122445.4350-8-shaibran@amazon.com \
--to=shaibran@amazon.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).