DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH 06/14] net/sfc/base: add function to create packed stream RxQ
Date: Sun, 24 Dec 2017 10:46:36 +0000	[thread overview]
Message-ID: <1514112404-13398-7-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1514112404-13398-1-git-send-email-arybchenko@solarflare.com>

Encoding packed stream buffer size in RxQ type is not a future-proof
idea taking into account a new RxQ types with extra parameters.
To be consistent make packet stream buffer size a separate parameter.
In order to avoid blowing of the default RxQ create function prototype
add a dedicated function to create packed stream RxQ without not
applicable paramters.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Mark Spender <mspender@solarflare.com>
---
 drivers/net/sfc/base/ef10_ev.c   |  3 +--
 drivers/net/sfc/base/ef10_impl.h |  1 +
 drivers/net/sfc/base/ef10_rx.c   | 54 ++++++++++++++++++++++++----------------
 drivers/net/sfc/base/efx.h       | 27 ++++++++++++++++----
 drivers/net/sfc/base/efx_impl.h  |  2 +-
 drivers/net/sfc/base/efx_rx.c    | 49 +++++++++++++++++++++++++++++++++---
 6 files changed, 103 insertions(+), 33 deletions(-)

diff --git a/drivers/net/sfc/base/ef10_ev.c b/drivers/net/sfc/base/ef10_ev.c
index ee576a0..80257da 100644
--- a/drivers/net/sfc/base/ef10_ev.c
+++ b/drivers/net/sfc/base/ef10_ev.c
@@ -1347,8 +1347,7 @@ ef10_ev_rxlabel_init(
 {
 	efx_evq_rxq_state_t *eersp;
 #if EFSYS_OPT_RX_PACKED_STREAM
-	boolean_t packed_stream = (type >= EFX_RXQ_TYPE_PACKED_STREAM_1M) &&
-	    (type <= EFX_RXQ_TYPE_PACKED_STREAM_64K);
+	boolean_t packed_stream = (type == EFX_RXQ_TYPE_PACKED_STREAM);
 #endif
 
 	_NOTE(ARGUNUSED(type))
diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h
index 0eeb68f..a17b471 100644
--- a/drivers/net/sfc/base/ef10_impl.h
+++ b/drivers/net/sfc/base/ef10_impl.h
@@ -977,6 +977,7 @@ ef10_rx_qcreate(
 	__in		unsigned int index,
 	__in		unsigned int label,
 	__in		efx_rxq_type_t type,
+	__in		uint32_t type_data,
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
diff --git a/drivers/net/sfc/base/ef10_rx.c b/drivers/net/sfc/base/ef10_rx.c
index 9aa8981..17b1652 100644
--- a/drivers/net/sfc/base/ef10_rx.c
+++ b/drivers/net/sfc/base/ef10_rx.c
@@ -948,6 +948,7 @@ ef10_rx_qcreate(
 	__in		unsigned int index,
 	__in		unsigned int label,
 	__in		efx_rxq_type_t type,
+	__in		uint32_t type_data,
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
@@ -984,25 +985,32 @@ ef10_rx_qcreate(
 		ps_buf_size = 0;
 		break;
 #if EFSYS_OPT_RX_PACKED_STREAM
-	case EFX_RXQ_TYPE_PACKED_STREAM_1M:
-		ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
-		break;
-	case EFX_RXQ_TYPE_PACKED_STREAM_512K:
-		ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K;
-		break;
-	case EFX_RXQ_TYPE_PACKED_STREAM_256K:
-		ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K;
-		break;
-	case EFX_RXQ_TYPE_PACKED_STREAM_128K:
-		ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K;
-		break;
-	case EFX_RXQ_TYPE_PACKED_STREAM_64K:
-		ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K;
+	case EFX_RXQ_TYPE_PACKED_STREAM:
+		switch (type_data) {
+		case EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M:
+			ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M;
+			break;
+		case EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K:
+			ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_512K;
+			break;
+		case EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K:
+			ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_256K;
+			break;
+		case EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K:
+			ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_128K;
+			break;
+		case EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K:
+			ps_buf_size = MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_64K;
+			break;
+		default:
+			rc = ENOTSUP;
+			goto fail3;
+		}
 		break;
 #endif /* EFSYS_OPT_RX_PACKED_STREAM */
 	default:
 		rc = ENOTSUP;
-		goto fail3;
+		goto fail4;
 	}
 
 #if EFSYS_OPT_RX_PACKED_STREAM
@@ -1010,13 +1018,13 @@ ef10_rx_qcreate(
 		/* Check if datapath firmware supports packed stream mode */
 		if (encp->enc_rx_packed_stream_supported == B_FALSE) {
 			rc = ENOTSUP;
-			goto fail4;
+			goto fail5;
 		}
 		/* Check if packed stream allows configurable buffer sizes */
-		if ((type != EFX_RXQ_TYPE_PACKED_STREAM_1M) &&
+		if ((ps_buf_size != MC_CMD_INIT_RXQ_EXT_IN_PS_BUFF_1M) &&
 		    (encp->enc_rx_var_packed_stream_supported == B_FALSE)) {
 			rc = ENOTSUP;
-			goto fail5;
+			goto fail6;
 		}
 	}
 #else /* EFSYS_OPT_RX_PACKED_STREAM */
@@ -1031,7 +1039,7 @@ ef10_rx_qcreate(
 
 	if ((rc = efx_mcdi_init_rxq(enp, ndescs, eep->ee_index, label, index,
 		    esmp, disable_scatter, ps_buf_size)) != 0)
-		goto fail6;
+		goto fail7;
 
 	erp->er_eep = eep;
 	erp->er_label = label;
@@ -1042,16 +1050,20 @@ ef10_rx_qcreate(
 
 	return (0);
 
+fail7:
+	EFSYS_PROBE(fail7);
+#if EFSYS_OPT_RX_PACKED_STREAM
 fail6:
 	EFSYS_PROBE(fail6);
-#if EFSYS_OPT_RX_PACKED_STREAM
 fail5:
 	EFSYS_PROBE(fail5);
+#endif /* EFSYS_OPT_RX_PACKED_STREAM */
 fail4:
 	EFSYS_PROBE(fail4);
-#endif /* EFSYS_OPT_RX_PACKED_STREAM */
+#if EFSYS_OPT_RX_PACKED_STREAM
 fail3:
 	EFSYS_PROBE(fail3);
+#endif /* EFSYS_OPT_RX_PACKED_STREAM */
 fail2:
 	EFSYS_PROBE(fail2);
 fail1:
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index e0dc76c..d4e0bc5 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -2002,11 +2002,7 @@ efx_pseudo_hdr_pkt_length_get(
 
 typedef enum efx_rxq_type_e {
 	EFX_RXQ_TYPE_DEFAULT,
-	EFX_RXQ_TYPE_PACKED_STREAM_1M,
-	EFX_RXQ_TYPE_PACKED_STREAM_512K,
-	EFX_RXQ_TYPE_PACKED_STREAM_256K,
-	EFX_RXQ_TYPE_PACKED_STREAM_128K,
-	EFX_RXQ_TYPE_PACKED_STREAM_64K,
+	EFX_RXQ_TYPE_PACKED_STREAM,
 	EFX_RXQ_NTYPES
 } efx_rxq_type_t;
 
@@ -2030,6 +2026,27 @@ efx_rx_qcreate(
 	__in		efx_evq_t *eep,
 	__deref_out	efx_rxq_t **erpp);
 
+#if EFSYS_OPT_RX_PACKED_STREAM
+
+#define	EFX_RXQ_PACKED_STREAM_BUF_SIZE_1M	(1U * 1024 * 1024)
+#define	EFX_RXQ_PACKED_STREAM_BUF_SIZE_512K	(512U * 1024)
+#define	EFX_RXQ_PACKED_STREAM_BUF_SIZE_256K	(256U * 1024)
+#define	EFX_RXQ_PACKED_STREAM_BUF_SIZE_128K	(128U * 1024)
+#define	EFX_RXQ_PACKED_STREAM_BUF_SIZE_64K	(64U * 1024)
+
+extern	__checkReturn	efx_rc_t
+efx_rx_qcreate_packed_stream(
+	__in		efx_nic_t *enp,
+	__in		unsigned int index,
+	__in		unsigned int label,
+	__in		uint32_t ps_buf_size,
+	__in		efsys_mem_t *esmp,
+	__in		size_t ndescs,
+	__in		efx_evq_t *eep,
+	__deref_out	efx_rxq_t **erpp);
+
+#endif
+
 typedef struct efx_buffer_s {
 	efsys_dma_addr_t	eb_addr;
 	size_t			eb_size;
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 8bd667c..16e5c20 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -181,7 +181,7 @@ typedef struct efx_rx_ops_s {
 	efx_rc_t	(*erxo_qflush)(efx_rxq_t *);
 	void		(*erxo_qenable)(efx_rxq_t *);
 	efx_rc_t	(*erxo_qcreate)(efx_nic_t *enp, unsigned int,
-					unsigned int, efx_rxq_type_t,
+					unsigned int, efx_rxq_type_t, uint32_t,
 					efsys_mem_t *, size_t, uint32_t,
 					unsigned int,
 					efx_evq_t *, efx_rxq_t *);
diff --git a/drivers/net/sfc/base/efx_rx.c b/drivers/net/sfc/base/efx_rx.c
index 870d42f..d0dd605 100644
--- a/drivers/net/sfc/base/efx_rx.c
+++ b/drivers/net/sfc/base/efx_rx.c
@@ -131,6 +131,7 @@ siena_rx_qcreate(
 	__in		unsigned int index,
 	__in		unsigned int label,
 	__in		efx_rxq_type_t type,
+	__in		uint32_t type_data,
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
@@ -611,12 +612,13 @@ efx_rx_qenable(
 	erxop->erxo_qenable(erp);
 }
 
-	__checkReturn	efx_rc_t
-efx_rx_qcreate(
+static	__checkReturn	efx_rc_t
+efx_rx_qcreate_internal(
 	__in		efx_nic_t *enp,
 	__in		unsigned int index,
 	__in		unsigned int label,
 	__in		efx_rxq_type_t type,
+	__in		uint32_t type_data,
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
@@ -645,8 +647,8 @@ efx_rx_qcreate(
 	erp->er_mask = ndescs - 1;
 	erp->er_esmp = esmp;
 
-	if ((rc = erxop->erxo_qcreate(enp, index, label, type, esmp, ndescs, id,
-	    flags, eep, erp)) != 0)
+	if ((rc = erxop->erxo_qcreate(enp, index, label, type, type_data, esmp,
+	    ndescs, id, flags, eep, erp)) != 0)
 		goto fail2;
 
 	enp->en_rx_qcount++;
@@ -664,6 +666,43 @@ efx_rx_qcreate(
 	return (rc);
 }
 
+	__checkReturn	efx_rc_t
+efx_rx_qcreate(
+	__in		efx_nic_t *enp,
+	__in		unsigned int index,
+	__in		unsigned int label,
+	__in		efx_rxq_type_t type,
+	__in		efsys_mem_t *esmp,
+	__in		size_t ndescs,
+	__in		uint32_t id,
+	__in		unsigned int flags,
+	__in		efx_evq_t *eep,
+	__deref_out	efx_rxq_t **erpp)
+{
+	return efx_rx_qcreate_internal(enp, index, label, type, 0, esmp, ndescs,
+	    id, flags, eep, erpp);
+}
+
+#if EFSYS_OPT_RX_PACKED_STREAM
+
+	__checkReturn	efx_rc_t
+efx_rx_qcreate_packed_stream(
+	__in		efx_nic_t *enp,
+	__in		unsigned int index,
+	__in		unsigned int label,
+	__in		uint32_t ps_buf_size,
+	__in		efsys_mem_t *esmp,
+	__in		size_t ndescs,
+	__in		efx_evq_t *eep,
+	__deref_out	efx_rxq_t **erpp)
+{
+	return efx_rx_qcreate_internal(enp, index, label,
+	    EFX_RXQ_TYPE_PACKED_STREAM, ps_buf_size, esmp, ndescs,
+	    0 /* id unused on EF10 */, EFX_RXQ_FLAG_NONE, eep, erpp);
+}
+
+#endif
+
 			void
 efx_rx_qdestroy(
 	__in		efx_rxq_t *erp)
@@ -1305,6 +1344,7 @@ siena_rx_qcreate(
 	__in		unsigned int index,
 	__in		unsigned int label,
 	__in		efx_rxq_type_t type,
+	__in		uint32_t type_data,
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
@@ -1319,6 +1359,7 @@ siena_rx_qcreate(
 	efx_rc_t rc;
 
 	_NOTE(ARGUNUSED(esmp))
+	_NOTE(ARGUNUSED(type_data))
 
 	EFX_STATIC_ASSERT(EFX_EV_RX_NLABELS ==
 	    (1 << FRF_AZ_RX_DESCQ_LABEL_WIDTH));
-- 
2.7.4

  parent reply	other threads:[~2017-12-24 10:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-24 10:46 [dpdk-dev] [PATCH 00/14] net/sfc: support NVGRE, VXLAN and GENEVE tunnels Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 01/14] net/sfc: fix label name to be consistent Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 02/14] net/sfc: do not hold management event queue lock while MCDI Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 03/14] net/sfc: handle MC reboot event Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 04/14] net/sfc: retry port start to handle MC reboot in the middle Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 05/14] net/sfc/base: control RxQ scatter using flag instead of type Andrew Rybchenko
2017-12-24 10:46 ` Andrew Rybchenko [this message]
2017-12-24 10:46 ` [dpdk-dev] [PATCH 07/14] net/sfc/base: allow to request inner classes for Rx packets Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 08/14] net/sfc/base: add API to control UDP tunnel ports Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 09/14] net/sfc: support UDP tunnel ports configuration Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 10/14] net/sfc: fix incorrect bitwise ORing of L3/L4 packet types Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 11/14] net/sfc: support VXLAN and NVGRE packet types classification Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 12/14] net/sfc: correct Rx checksum offloads for tunnel packets Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 13/14] net/sfc: support inner checksum offload on transmit Andrew Rybchenko
2017-12-24 10:46 ` [dpdk-dev] [PATCH 14/14] doc: add net/sfc tunnels support to release features Andrew Rybchenko
2018-01-09 17:31 ` [dpdk-dev] [PATCH 00/14] net/sfc: support NVGRE, VXLAN and GENEVE tunnels 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=1514112404-13398-7-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).