DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 16/23] net/sfc: add Rx descriptor wait timeout
Date: Thu, 19 Apr 2018 12:36:59 +0100	[thread overview]
Message-ID: <1524137826-5675-17-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1524137826-5675-1-git-send-email-arybchenko@solarflare.com>

Add device argument to customize Rx descriptor wait timeout which
is supported in DPDK firmware variant only in equal stride super-buffer
Rx mode only.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
---
 doc/guides/nics/sfc_efx.rst  | 12 ++++++++++++
 drivers/net/sfc/sfc.c        | 31 +++++++++++++++++++++++++++++++
 drivers/net/sfc/sfc.h        |  2 ++
 drivers/net/sfc/sfc_ethdev.c |  1 +
 drivers/net/sfc/sfc_kvargs.c |  1 +
 drivers/net/sfc/sfc_kvargs.h |  2 ++
 drivers/net/sfc/sfc_rx.c     |  2 +-
 drivers/net/sfc/sfc_tweak.h  |  8 ++++++++
 8 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst
index 19b1087..c9354e3 100644
--- a/doc/guides/nics/sfc_efx.rst
+++ b/doc/guides/nics/sfc_efx.rst
@@ -372,6 +372,18 @@ boolean parameters value.
   without checksumming on transmit for higher Tx packet rate if
   checksumming is not required.
 
+- ``rxd_wait_timeout_ns`` [long] (default **200 us**)
+
+  Adjust timeout in nanoseconds to head-of-line block to wait for
+  Rx descriptors.
+  The accepted range is 0 to 400 ms.
+  Flow control should be enabled to make it work.
+  The value of **0** disables it and packets are dropped immediately.
+  When a packet is dropped because of no Rx descriptors,
+  ``rx_nodesc_drop_cnt`` counter grows.
+  The feature is supported only by the DPDK firmware variant when equal
+  stride super-buffer Rx mode is used.
+
 
 Dynamic Logging Parameters
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 5458f39..d1abf62 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -21,6 +21,7 @@
 #include "sfc_rx.h"
 #include "sfc_tx.h"
 #include "sfc_kvargs.h"
+#include "sfc_tweak.h"
 
 
 int
@@ -896,6 +897,32 @@ sfc_fw_variant2str(efx_fw_variant_t efv)
 }
 
 static int
+sfc_kvarg_rxd_wait_timeout_ns(struct sfc_adapter *sa)
+{
+	int rc;
+	long value;
+
+	value = SFC_RXD_WAIT_TIMEOUT_NS_DEF;
+
+	rc = sfc_kvargs_process(sa, SFC_KVARG_RXD_WAIT_TIMEOUT_NS,
+				sfc_kvarg_long_handler, &value);
+	if (rc != 0)
+		return rc;
+
+	if (value < 0 ||
+	    (unsigned long)value > EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX) {
+		sfc_err(sa, "wrong '" SFC_KVARG_RXD_WAIT_TIMEOUT_NS "' "
+			    "was set (%ld);", value);
+		sfc_err(sa, "it must not be less than 0 or greater than %u",
+			    EFX_RXQ_ES_SUPER_BUFFER_HOL_BLOCK_MAX);
+		return EINVAL;
+	}
+
+	sa->rxd_wait_timeout_ns = value;
+	return 0;
+}
+
+static int
 sfc_nic_probe(struct sfc_adapter *sa)
 {
 	efx_nic_t *enp = sa->nic;
@@ -912,6 +939,10 @@ sfc_nic_probe(struct sfc_adapter *sa)
 		return rc;
 	}
 
+	rc = sfc_kvarg_rxd_wait_timeout_ns(sa);
+	if (rc != 0)
+		return rc;
+
 	rc = efx_nic_probe(enp, preferred_efv);
 	if (rc == EACCES) {
 		/* Unprivileged functions cannot set FW variant */
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 3a5f6dc..51be440 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -238,6 +238,8 @@ struct sfc_adapter {
 
 	boolean_t			tso;
 
+	uint32_t			rxd_wait_timeout_ns;
+
 	struct sfc_rss			rss;
 
 	/*
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index c3f37bc..e42d553 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -2109,6 +2109,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx,
 	SFC_KVARG_TX_DATAPATH "=" SFC_KVARG_VALUES_TX_DATAPATH " "
 	SFC_KVARG_PERF_PROFILE "=" SFC_KVARG_VALUES_PERF_PROFILE " "
 	SFC_KVARG_FW_VARIANT "=" SFC_KVARG_VALUES_FW_VARIANT " "
+	SFC_KVARG_RXD_WAIT_TIMEOUT_NS "=<long> "
 	SFC_KVARG_STATS_UPDATE_PERIOD_MS "=<long>");
 
 RTE_INIT(sfc_driver_register_logtype);
diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c
index 53fa939..7a89c76 100644
--- a/drivers/net/sfc/sfc_kvargs.c
+++ b/drivers/net/sfc/sfc_kvargs.c
@@ -27,6 +27,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa)
 		SFC_KVARG_RX_DATAPATH,
 		SFC_KVARG_TX_DATAPATH,
 		SFC_KVARG_FW_VARIANT,
+		SFC_KVARG_RXD_WAIT_TIMEOUT_NS,
 		NULL,
 	};
 
diff --git a/drivers/net/sfc/sfc_kvargs.h b/drivers/net/sfc/sfc_kvargs.h
index 9f21cfd..4506667 100644
--- a/drivers/net/sfc/sfc_kvargs.h
+++ b/drivers/net/sfc/sfc_kvargs.h
@@ -61,6 +61,8 @@ extern "C" {
 	    SFC_KVARG_FW_VARIANT_PACKED_STREAM "|" \
 	    SFC_KVARG_FW_VARIANT_DPDK "]"
 
+#define SFC_KVARG_RXD_WAIT_TIMEOUT_NS	"rxd_wait_timeout_ns"
+
 struct sfc_adapter;
 
 int sfc_kvargs_parse(struct sfc_adapter *sa);
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index 653724f..57ed34f 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -703,7 +703,7 @@ sfc_rx_qstart(struct sfc_adapter *sa, unsigned int sw_index)
 		rc = efx_rx_qcreate_es_super_buffer(sa->nic, rxq->hw_index, 0,
 			mp_info.contig_block_size, rxq->buf_size,
 			mp->header_size + mp->elt_size + mp->trailer_size,
-			0 /* hol_block_timeout */,
+			sa->rxd_wait_timeout_ns,
 			&rxq->mem, rxq_info->entries, rxq_info->type_flags,
 			evq->common, &rxq->common);
 		break;
diff --git a/drivers/net/sfc/sfc_tweak.h b/drivers/net/sfc/sfc_tweak.h
index b402685..4d543f6 100644
--- a/drivers/net/sfc/sfc_tweak.h
+++ b/drivers/net/sfc/sfc_tweak.h
@@ -34,4 +34,12 @@
 /** Number of mbufs to be freed in bulk in a single call */
 #define SFC_TX_REAP_BULK_SIZE		32
 
+/**
+ * Default head-of-line block timeout to wait for Rx descriptor before
+ * packet drop because of no descriptors available.
+ *
+ * DPDK FW variant only with equal stride super-buffer Rx mode.
+ */
+#define SFC_RXD_WAIT_TIMEOUT_NS_DEF	(200U * 1000)
+
 #endif /* _SFC_TWEAK_H_ */
-- 
2.7.4

  parent reply	other threads:[~2018-04-19 11:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 11:36 [dpdk-dev] [PATCH 00/23] net/sfc: support equal stride super-buffer Rx mode Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 01/23] net/sfc/base: update autogenerated MCDI and TLV headers Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 02/23] net/sfc/base: make RxQ type data an union Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 03/23] net/sfc/base: detect equal stride super-buffer support Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 04/23] net/sfc/base: support equal stride super-buffer Rx mode Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 05/23] net/sfc/base: add equal stride super-buffer prefix layout Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 06/23] net/sfc: factor out function to push Rx doorbell Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 07/23] net/sfc: prepare EF10 Rx event parser to be reused Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 08/23] net/sfc: move EF10 Rx event parser to shared header Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 09/23] net/sfc: conditionally compile support for tunnel packets Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 10/23] net/sfc: allow one Rx queue entry carry many packet buffers Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 11/23] net/sfc: allow to take mbuf pool into account when sizing Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 12/23] net/sfc: support equal stride super-buffer Rx mode Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 13/23] net/sfc: support callback to check if mempool is supported Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 14/23] net/sfc: check mempool when equal stride super-buffer used Andrew Rybchenko
2018-04-19 11:36 ` [dpdk-dev] [PATCH 15/23] net/sfc: support DPDK firmware variant Andrew Rybchenko
2018-04-19 11:36 ` Andrew Rybchenko [this message]
2018-04-19 11:37 ` [dpdk-dev] [PATCH 17/23] net/sfc: support flow marks in equal stride super-buffer Rx Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 18/23] net/sfc/base: get actions MARK and FLAG support Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 19/23] net/sfc/base: support MARK and FLAG actions in filters Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 20/23] net/sfc/base: get max supported value for action MARK Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 21/23] net/sfc: make processing of flow rule actions more uniform Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 22/23] net/sfc: support MARK and FLAG actions in flow API Andrew Rybchenko
2018-04-19 11:37 ` [dpdk-dev] [PATCH 23/23] doc: advertise equal stride super-buffer Rx mode support in net/sfc Andrew Rybchenko
2018-04-26 22:47 ` [dpdk-dev] [PATCH 00/23] net/sfc: support equal stride super-buffer Rx mode 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=1524137826-5675-17-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    /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).