DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Krawczyk <mk@semihalf.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, shaibran@amazon.com,
	upstream@semihalf.com, Michal Krawczyk <mk@semihalf.com>,
	Dawid Gorecki <dgr@semihalf.com>
Subject: [PATCH v3 16/21] net/ena: make Tx completion timeout configurable
Date: Wed, 23 Feb 2022 13:19:39 +0100	[thread overview]
Message-ID: <20220223121944.24156-17-mk@semihalf.com> (raw)
In-Reply-To: <20220223121944.24156-1-mk@semihalf.com>

The default missing Tx completion timeout was set to 5 seconds.
In order to provide users with the interface to control this timeout
to adjust it with the application's watchdog, the device argument for
controlling this value was added.

The parameter is called 'miss_txc_to' and can be modified using the
devargs interface:

  ./app -a <bdf>,miss_txc_to=UINT_NUMBER

This parameter accepts values from 0 to 60 and indicates number of
seconds after which the Tx packet will be considered as missing.

HW hints for the Tx completions timeout were removed to do not overwrite
parameter from the user. Also specyfing default Tx completion timeout
value was moved from the configuration to init phase in order to
simplify default value assignment.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Dawid Gorecki <dgr@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
---
 doc/guides/nics/ena.rst                |  9 ++++
 doc/guides/rel_notes/release_22_03.rst |  1 +
 drivers/net/ena/ena_ethdev.c           | 66 ++++++++++++++++++++------
 drivers/net/ena/ena_ethdev.h           |  1 +
 4 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/doc/guides/nics/ena.rst b/doc/guides/nics/ena.rst
index 85c790e80f..3d780acac9 100644
--- a/doc/guides/nics/ena.rst
+++ b/doc/guides/nics/ena.rst
@@ -87,6 +87,15 @@ Configuration information
      effect only if the device also supports large LLQ headers. Otherwise, the
      default value will be used.
 
+   * **miss_txc_to** (default 5)
+
+     Number of seconds after which the Tx packet will be considered missing.
+     If the missing packets number will exceed dynamically calculated threshold,
+     the driver will trigger the device reset which should be handled by the
+     application. Checking for missing Tx completions happens in the driver's
+     timer service. Setting this parameter to 0 disables this feature. Maximum
+     allowed value is 60 seconds.
+
 **ENA Configuration Parameters**
 
    * **Number of Queues**
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index 1746abddbb..e04567ed5b 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -116,6 +116,7 @@ New Features
   * Added ENA admin queue support for the MP applications.
   * Added free Tx mbuf on demand feature support.
   * Added ``rte_eth_xstats_get_names_by_id`` API support.
+  * Added ``miss_txc_to`` device argument for setting the Tx completion timeout.
 
 * **Updated Cisco enic driver.**
 
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 3cdeba9fad..0ca4269522 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -62,6 +62,10 @@ struct ena_stats {
 
 /* Device arguments */
 #define ENA_DEVARG_LARGE_LLQ_HDR "large_llq_hdr"
+/* 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"
 
 /*
  * Each rte_memzone should have unique name.
@@ -2132,6 +2136,8 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
 	snprintf(adapter->name, ENA_NAME_MAX_LEN, "ena_%d",
 		 adapter->id_number);
 
+	adapter->missing_tx_completion_to = ENA_TX_TIMEOUT;
+
 	rc = ena_parse_devargs(adapter, pci_dev->device.devargs);
 	if (rc != 0) {
 		PMD_INIT_LOG(CRIT, "Failed to parse devargs\n");
@@ -2307,7 +2313,6 @@ static int ena_dev_configure(struct rte_eth_dev *dev)
 	adapter->missing_tx_completion_budget =
 		RTE_MIN(ENA_MONITORED_TX_QUEUES, dev->data->nb_tx_queues);
 
-	adapter->missing_tx_completion_to = ENA_TX_TIMEOUT;
 	/* To avoid detection of the spurious Tx completion timeout due to
 	 * application not calling the Tx cleanup function, set timeout for the
 	 * Tx queue which should be half of the missing completion timeout for a
@@ -2830,20 +2835,6 @@ static void ena_update_hints(struct ena_adapter *adapter,
 		adapter->ena_dev.mmio_read.reg_read_to =
 			hints->mmio_read_timeout * 1000;
 
-	if (hints->missing_tx_completion_timeout) {
-		if (hints->missing_tx_completion_timeout ==
-		    ENA_HW_HINTS_NO_TIMEOUT) {
-			adapter->missing_tx_completion_to =
-				ENA_HW_HINTS_NO_TIMEOUT;
-		} else {
-			/* Convert from msecs to ticks */
-			adapter->missing_tx_completion_to = rte_get_timer_hz() *
-				hints->missing_tx_completion_timeout / 1000;
-			adapter->tx_cleanup_stall_delay =
-				adapter->missing_tx_completion_to / 2;
-		}
-	}
-
 	if (hints->driver_watchdog_timeout) {
 		if (hints->driver_watchdog_timeout == ENA_HW_HINTS_NO_TIMEOUT)
 			adapter->keep_alive_timeout = ENA_HW_HINTS_NO_TIMEOUT;
@@ -3396,6 +3387,45 @@ static int ena_xstats_get_by_id(struct rte_eth_dev *dev,
 	return valid;
 }
 
+static int ena_process_uint_devarg(const char *key,
+				  const char *value,
+				  void *opaque)
+{
+	struct ena_adapter *adapter = opaque;
+	char *str_end;
+	uint64_t uint_value;
+
+	uint_value = strtoull(value, &str_end, 10);
+	if (value == str_end) {
+		PMD_INIT_LOG(ERR,
+			"Invalid value for key '%s'. Only uint values are accepted.\n",
+			key);
+		return -EINVAL;
+	}
+
+	if (strcmp(key, ENA_DEVARG_MISS_TXC_TO) == 0) {
+		if (uint_value > ENA_MAX_TX_TIMEOUT_SECONDS) {
+			PMD_INIT_LOG(ERR,
+				"Tx timeout too high: %" PRIu64 " sec. Maximum allowed: %d sec.\n",
+				uint_value, ENA_MAX_TX_TIMEOUT_SECONDS);
+			return -EINVAL;
+		} else if (uint_value == 0) {
+			PMD_INIT_LOG(INFO,
+				"Check for missing Tx completions has been disabled.\n");
+			adapter->missing_tx_completion_to =
+				ENA_HW_HINTS_NO_TIMEOUT;
+		} else {
+			PMD_INIT_LOG(INFO,
+				"Tx packet completion timeout set to %" PRIu64 " seconds.\n",
+				uint_value);
+			adapter->missing_tx_completion_to =
+				uint_value * rte_get_timer_hz();
+		}
+	}
+
+	return 0;
+}
+
 static int ena_process_bool_devarg(const char *key,
 				   const char *value,
 				   void *opaque)
@@ -3427,6 +3457,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
 {
 	static const char * const allowed_args[] = {
 		ENA_DEVARG_LARGE_LLQ_HDR,
+		ENA_DEVARG_MISS_TXC_TO,
 		NULL,
 	};
 	struct rte_kvargs *kvlist;
@@ -3444,7 +3475,12 @@ static int ena_parse_devargs(struct ena_adapter *adapter,
 
 	rc = rte_kvargs_process(kvlist, ENA_DEVARG_LARGE_LLQ_HDR,
 		ena_process_bool_devarg, adapter);
+	if (rc != 0)
+		goto exit;
+	rc = rte_kvargs_process(kvlist, ENA_DEVARG_MISS_TXC_TO,
+		ena_process_uint_devarg, adapter);
 
+exit:
 	rte_kvargs_free(kvlist);
 
 	return rc;
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index ca3e5ed691..c0094b03ee 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -40,6 +40,7 @@
 #define ENA_DEVICE_KALIVE_TIMEOUT (ENA_WD_TIMEOUT_SEC * rte_get_timer_hz())
 
 #define ENA_TX_TIMEOUT			(5 * rte_get_timer_hz())
+#define ENA_MAX_TX_TIMEOUT_SECONDS	60
 #define ENA_MONITORED_TX_QUEUES		3
 #define ENA_DEFAULT_MISSING_COMP	256U
 
-- 
2.25.1


  parent reply	other threads:[~2022-02-23 12:22 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 16:06 [PATCH 00/21] net/ena: v2.6.0 driver update Michal Krawczyk
2022-02-22 16:06 ` [PATCH 01/21] net/ena: remove linearization function Michal Krawczyk
2022-02-22 16:06 ` [PATCH 02/21] net/ena: add assertion on Tx info mbuf Michal Krawczyk
2022-02-22 16:06 ` [PATCH 03/21] net/ena: remove unused enumeration Michal Krawczyk
2022-02-22 16:06 ` [PATCH 04/21] net/ena: remove unused offloads variables Michal Krawczyk
2022-02-22 16:06 ` [PATCH 05/21] net/ena: add extra Rx checksum related xstats Michal Krawczyk
2022-02-22 16:06 ` [PATCH 06/21] net/ena: make LSC configurable Michal Krawczyk
2022-02-22 16:06 ` [PATCH 07/21] net/ena: skip timer if the reset is triggered Michal Krawczyk
2022-02-22 16:06 ` [PATCH 08/21] net/ena: perform Tx cleanup before sending pkts Michal Krawczyk
2022-02-22 16:06 ` [PATCH 09/21] net/ena/base: use optimized memcpy version also on Arm Michal Krawczyk
2022-02-22 16:06 ` [PATCH 10/21] net/ena: proxy AQ calls to primary process Michal Krawczyk
2022-02-22 16:06 ` [PATCH 11/21] net/ena: enable stats get function for MP mode Michal Krawczyk
2022-02-22 16:06 ` [PATCH 12/21] net/ena/base: make IO memzone unique per port Michal Krawczyk
2022-02-22 16:06 ` [PATCH 13/21] net/ena: expose Tx cleanup function Michal Krawczyk
2022-02-22 16:06 ` [PATCH 14/21] net/ena: add API for probing xstat names by ID Michal Krawczyk
2022-02-22 16:06 ` [PATCH 15/21] net/ena: check if reset was already triggered Michal Krawczyk
2022-02-22 16:06 ` [PATCH 16/21] net/ena: make Tx completion timeout configurable Michal Krawczyk
2022-02-22 16:06 ` [PATCH 17/21] net/ena: fix meta-desc DF flag setup Michal Krawczyk
2022-02-22 16:06 ` [PATCH 18/21] net/ena: extend debug prints for invalid req ID resets Michal Krawczyk
2022-02-22 16:06 ` [PATCH 19/21] net/ena: don't initialize LLQ when membar isn't exposed Michal Krawczyk
2022-02-22 16:06 ` [PATCH 20/21] net/ena: don't indicate bad csum for L4 csum error Michal Krawczyk
2022-02-22 16:06 ` [PATCH 21/21] net/ena: update version to 2.6.0 Michal Krawczyk
2022-02-22 18:11 ` [PATCH v2 00/21] net/ena: v2.6.0 driver update Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 01/21] net/ena: remove linearization function Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 02/21] net/ena: add assertion on Tx info mbuf Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 03/21] net/ena: remove unused enumeration Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 04/21] net/ena: remove unused offloads variables Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 05/21] net/ena: add extra Rx checksum related xstats Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 06/21] net/ena: make LSC configurable Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 07/21] net/ena: skip timer if the reset is triggered Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 08/21] net/ena: perform Tx cleanup before sending pkts Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 09/21] net/ena/base: use optimized memcpy version also on Arm Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 10/21] net/ena: proxy AQ calls to primary process Michal Krawczyk
2022-02-22 22:24     ` Ferruh Yigit
2022-02-23  0:50       ` Ferruh Yigit
2022-02-22 18:11   ` [PATCH v2 11/21] net/ena: enable stats get function for MP mode Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 12/21] net/ena/base: make IO memzone unique per port Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 13/21] net/ena: expose Tx cleanup function Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 14/21] net/ena: add API for probing xstat names by ID Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 15/21] net/ena: check if reset was already triggered Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 16/21] net/ena: make Tx completion timeout configurable Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 17/21] net/ena: fix meta-desc DF flag setup Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 18/21] net/ena: extend debug prints for invalid req ID resets Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 19/21] net/ena: don't initialize LLQ when membar isn't exposed Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 20/21] net/ena: don't indicate bad csum for L4 csum error Michal Krawczyk
2022-02-22 18:11   ` [PATCH v2 21/21] net/ena: update version to 2.6.0 Michal Krawczyk
2022-02-22 22:21   ` [PATCH v2 00/21] net/ena: v2.6.0 driver update Ferruh Yigit
2022-02-23 10:07     ` Michał Krawczyk
2022-02-23 12:19   ` [PATCH v3 " Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 01/21] net/ena: remove linearization function Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 02/21] net/ena: add assertion on Tx info mbuf Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 03/21] net/ena: remove unused enumeration Michal Krawczyk
2022-02-23 17:25       ` Ferruh Yigit
2022-02-23 12:19     ` [PATCH v3 04/21] net/ena: remove unused offloads variables Michal Krawczyk
2022-02-23 17:25       ` Ferruh Yigit
2022-02-23 17:47         ` Michał Krawczyk
2022-02-23 18:12           ` Ferruh Yigit
2022-02-23 12:19     ` [PATCH v3 05/21] net/ena: add extra Rx checksum related xstats Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 06/21] net/ena: make LSC configurable Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 07/21] net/ena: skip timer if the reset is triggered Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 08/21] net/ena: perform Tx cleanup before sending pkts Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 09/21] net/ena/base: use optimized memcpy version also on Arm Michal Krawczyk
2022-02-23 17:25       ` Ferruh Yigit
2022-02-23 17:40         ` Michał Krawczyk
2022-02-23 12:19     ` [PATCH v3 10/21] net/ena: proxy AQ calls to primary process Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 11/21] net/ena: enable stats get function for MP mode Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 12/21] net/ena/base: make IO memzone unique per port Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 13/21] net/ena: expose Tx cleanup function Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 14/21] net/ena: add API for probing xstat names by ID Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 15/21] net/ena: check if reset was already triggered Michal Krawczyk
2022-02-23 12:19     ` Michal Krawczyk [this message]
2022-02-23 12:19     ` [PATCH v3 17/21] net/ena: fix meta-desc DF flag setup Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 18/21] net/ena: extend debug prints for invalid req ID resets Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 19/21] net/ena: don't initialize LLQ when membar isn't exposed Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 20/21] net/ena: don't indicate bad csum for L4 csum error Michal Krawczyk
2022-02-23 12:19     ` [PATCH v3 21/21] net/ena: update version to 2.6.0 Michal Krawczyk
2022-02-23 18:12     ` [PATCH v3 00/21] net/ena: v2.6.0 driver update Ferruh Yigit

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=20220223121944.24156-17-mk@semihalf.com \
    --to=mk@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dgr@semihalf.com \
    --cc=ferruh.yigit@intel.com \
    --cc=shaibran@amazon.com \
    --cc=upstream@semihalf.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).