Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Nov 2018 18:13:08 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340906 - in head/sys/dev/sfxge: . common
Message-ID:  <201811241813.wAOID8PY044901@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Sat Nov 24 18:13:07 2018
New Revision: 340906
URL: https://svnweb.freebsd.org/changeset/base/340906

Log:
  sfxge(4): control RxQ scatter using flag instead of type
  
  Rx scatter may be applicable to different Rx queue types.
  
  Sponsored by:   Solarflare Communications, Inc.
  Differential Revision:  https://reviews.freebsd.org/D18131

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_rx.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_rx.c
  head/sys/dev/sfxge/sfxge_rx.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/ef10_impl.h	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/common/ef10_impl.h	Sat Nov 24 18:13:07 2018	(r340906)
@@ -982,6 +982,7 @@ ef10_rx_qcreate(
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
+	__in		unsigned int flags,
 	__in		efx_evq_t *eep,
 	__in		efx_rxq_t *erp);
 

Modified: head/sys/dev/sfxge/common/ef10_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/ef10_rx.c	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/common/ef10_rx.c	Sat Nov 24 18:13:07 2018	(r340906)
@@ -954,6 +954,7 @@ ef10_rx_qcreate(
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
+	__in		unsigned int flags,
 	__in		efx_evq_t *eep,
 	__in		efx_rxq_t *erp)
 {
@@ -983,7 +984,6 @@ ef10_rx_qcreate(
 
 	switch (type) {
 	case EFX_RXQ_TYPE_DEFAULT:
-	case EFX_RXQ_TYPE_SCATTER:
 		ps_buf_size = 0;
 		break;
 #if EFSYS_OPT_RX_PACKED_STREAM
@@ -1027,7 +1027,7 @@ ef10_rx_qcreate(
 #endif /* EFSYS_OPT_RX_PACKED_STREAM */
 
 	/* Scatter can only be disabled if the firmware supports doing so */
-	if (type == EFX_RXQ_TYPE_SCATTER)
+	if (flags & EFX_RXQ_FLAG_SCATTER)
 		disable_scatter = B_FALSE;
 	else
 		disable_scatter = encp->enc_rx_disable_scatter_supported;

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/common/efx.h	Sat Nov 24 18:13:07 2018	(r340906)
@@ -2006,7 +2006,6 @@ efx_pseudo_hdr_pkt_length_get(
 
 typedef enum efx_rxq_type_e {
 	EFX_RXQ_TYPE_DEFAULT,
-	EFX_RXQ_TYPE_SCATTER,
 	EFX_RXQ_TYPE_PACKED_STREAM_1M,
 	EFX_RXQ_TYPE_PACKED_STREAM_512K,
 	EFX_RXQ_TYPE_PACKED_STREAM_256K,
@@ -2015,6 +2014,13 @@ typedef enum efx_rxq_type_e {
 	EFX_RXQ_NTYPES
 } efx_rxq_type_t;
 
+/*
+ * Dummy flag to be used instead of 0 to make it clear that the argument
+ * is receive queue flags.
+ */
+#define	EFX_RXQ_FLAG_NONE		0x0
+#define	EFX_RXQ_FLAG_SCATTER		0x1
+
 extern	__checkReturn	efx_rc_t
 efx_rx_qcreate(
 	__in		efx_nic_t *enp,
@@ -2024,6 +2030,7 @@ efx_rx_qcreate(
 	__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);
 

Modified: head/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_impl.h	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/common/efx_impl.h	Sat Nov 24 18:13:07 2018	(r340906)
@@ -187,6 +187,7 @@ typedef struct efx_rx_ops_s {
 	efx_rc_t	(*erxo_qcreate)(efx_nic_t *enp, unsigned int,
 					unsigned int, efx_rxq_type_t,
 					efsys_mem_t *, size_t, uint32_t,
+					unsigned int,
 					efx_evq_t *, efx_rxq_t *);
 	void		(*erxo_qdestroy)(efx_rxq_t *);
 } efx_rx_ops_t;

Modified: head/sys/dev/sfxge/common/efx_rx.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_rx.c	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/common/efx_rx.c	Sat Nov 24 18:13:07 2018	(r340906)
@@ -139,6 +139,7 @@ siena_rx_qcreate(
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
+	__in		unsigned int flags,
 	__in		efx_evq_t *eep,
 	__in		efx_rxq_t *erp);
 
@@ -624,6 +625,7 @@ efx_rx_qcreate(
 	__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)
 {
@@ -649,7 +651,7 @@ efx_rx_qcreate(
 	erp->er_esmp = esmp;
 
 	if ((rc = erxop->erxo_qcreate(enp, index, label, type, esmp, ndescs, id,
-	    eep, erp)) != 0)
+	    flags, eep, erp)) != 0)
 		goto fail2;
 
 	enp->en_rx_qcount++;
@@ -1311,13 +1313,14 @@ siena_rx_qcreate(
 	__in		efsys_mem_t *esmp,
 	__in		size_t ndescs,
 	__in		uint32_t id,
+	__in		unsigned int flags,
 	__in		efx_evq_t *eep,
 	__in		efx_rxq_t *erp)
 {
 	efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
 	efx_oword_t oword;
 	uint32_t size;
-	boolean_t jumbo;
+	boolean_t jumbo = B_FALSE;
 	efx_rc_t rc;
 
 	_NOTE(ARGUNUSED(esmp))
@@ -1350,20 +1353,22 @@ siena_rx_qcreate(
 
 	switch (type) {
 	case EFX_RXQ_TYPE_DEFAULT:
-		jumbo = B_FALSE;
 		break;
 
-#if EFSYS_OPT_RX_SCATTER
-	case EFX_RXQ_TYPE_SCATTER:
-		jumbo = B_TRUE;
-		break;
-#endif	/* EFSYS_OPT_RX_SCATTER */
-
 	default:
 		rc = EINVAL;
 		goto fail4;
 	}
 
+	if (flags & EFX_RXQ_FLAG_SCATTER) {
+#if EFSYS_OPT_RX_SCATTER
+		jumbo = B_TRUE;
+#else
+		rc = EINVAL;
+		goto fail5;
+#endif	/* EFSYS_OPT_RX_SCATTER */
+	}
+
 	/* Set up the new descriptor queue */
 	EFX_POPULATE_OWORD_7(oword,
 	    FRF_AZ_RX_DESCQ_BUF_BASE_ID, id,
@@ -1379,6 +1384,10 @@ siena_rx_qcreate(
 
 	return (0);
 
+#if !EFSYS_OPT_RX_SCATTER
+fail5:
+	EFSYS_PROBE(fail5);
+#endif
 fail4:
 	EFSYS_PROBE(fail4);
 fail3:

Modified: head/sys/dev/sfxge/sfxge_rx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_rx.c	Sat Nov 24 17:47:53 2018	(r340905)
+++ head/sys/dev/sfxge/sfxge_rx.c	Sat Nov 24 18:13:07 2018	(r340906)
@@ -1037,8 +1037,8 @@ sfxge_rx_qstart(struct sfxge_softc *sc, unsigned int i
 
 	/* Create the common code receive queue. */
 	if ((rc = efx_rx_qcreate(sc->enp, index, 0, EFX_RXQ_TYPE_DEFAULT,
-	    esmp, sc->rxq_entries, rxq->buf_base_id, evq->common,
-	    &rxq->common)) != 0)
+	    esmp, sc->rxq_entries, rxq->buf_base_id, EFX_RXQ_FLAG_NONE,
+	    evq->common, &rxq->common)) != 0)
 		goto fail;
 
 	SFXGE_EVQ_LOCK(evq);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811241813.wAOID8PY044901>