Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2014 20:57:25 +0000 (UTC)
From:      "George V. Neville-Neil" <gnn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272331 - head/sys/dev/sfxge
Message-ID:  <201409302057.s8UKvP4W013017@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gnn
Date: Tue Sep 30 20:57:25 2014
New Revision: 272331
URL: http://svnweb.freebsd.org/changeset/base/272331

Log:
  Support tunable to control Tx deferred packet list limits
  
  Also increase default for Tx queue get-list limit.
  Too small limit results in TCP packets drops especiall when many
  streams are running simultaneously.
  Put list may be kept small enough since it is just a temporary
  location if transmit function can't get Tx queue lock.
  
  Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/sfxge_tx.c
  head/sys/dev/sfxge/sfxge_tx.h

Modified: head/sys/dev/sfxge/sfxge_tx.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.c	Tue Sep 30 20:43:21 2014	(r272330)
+++ head/sys/dev/sfxge/sfxge_tx.c	Tue Sep 30 20:57:25 2014	(r272331)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/smp.h>
 #include <sys/socket.h>
 #include <sys/sysctl.h>
+#include <sys/syslog.h>
 
 #include <net/bpf.h>
 #include <net/ethernet.h>
@@ -77,6 +78,25 @@ __FBSDID("$FreeBSD$");
 #define	SFXGE_TSO_MAX_DESC ((65535 / 512) * 2 + SFXGE_TX_MAPPING_MAX_SEG - 1)
 #define	SFXGE_TXQ_BLOCK_LEVEL(_entries)	((_entries) - SFXGE_TSO_MAX_DESC)
 
+#ifdef SFXGE_HAVE_MQ
+
+#define	SFXGE_PARAM_TX_DPL_GET_MAX	SFXGE_PARAM(tx_dpl_get_max)
+static int sfxge_tx_dpl_get_max = SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_GET_MAX, &sfxge_tx_dpl_get_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_get_max, CTLFLAG_RDTUN,
+	   &sfxge_tx_dpl_get_max, 0,
+	   "Maximum number of packets in deferred packet get-list");
+
+#define	SFXGE_PARAM_TX_DPL_PUT_MAX	SFXGE_PARAM(tx_dpl_put_max)
+static int sfxge_tx_dpl_put_max = SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT;
+TUNABLE_INT(SFXGE_PARAM_TX_DPL_PUT_MAX, &sfxge_tx_dpl_put_max);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, tx_dpl_put_max, CTLFLAG_RDTUN,
+	   &sfxge_tx_dpl_put_max, 0,
+	   "Maximum number of packets in deferred packet put-list");
+
+#endif
+
+
 /* Forward declarations. */
 static inline void sfxge_tx_qdpl_service(struct sfxge_txq *txq);
 static void sfxge_tx_qlist_post(struct sfxge_txq *txq);
@@ -476,7 +496,7 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
 
 		sfxge_tx_qdpl_swizzle(txq);
 
-		if (stdp->std_get_count >= SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT)
+		if (stdp->std_get_count >= stdp->std_get_max)
 			return (ENOBUFS);
 
 		*(stdp->std_getp) = mbuf;
@@ -498,7 +518,7 @@ sfxge_tx_qdpl_put(struct sfxge_txq *txq,
 				old_len = mp->m_pkthdr.csum_data;
 			} else
 				old_len = 0;
-			if (old_len >= SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT)
+			if (old_len >= stdp->std_put_max)
 				return (ENOBUFS);
 			mbuf->m_pkthdr.csum_data = old_len + 1;
 			mbuf->m_nextpkt = (void *)old;
@@ -1384,8 +1404,23 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 		goto fail3;
 
 #ifdef SFXGE_HAVE_MQ
+	if (sfxge_tx_dpl_get_max <= 0) {
+		log(LOG_ERR, "%s=%d must be greater than 0",
+		    SFXGE_PARAM_TX_DPL_GET_MAX, sfxge_tx_dpl_get_max);
+		rc = EINVAL;
+		goto fail_tx_dpl_get_max;
+	}
+	if (sfxge_tx_dpl_put_max < 0) {
+		log(LOG_ERR, "%s=%d must be greater or equal to 0",
+		    SFXGE_PARAM_TX_DPL_PUT_MAX, sfxge_tx_dpl_put_max);
+		rc = EINVAL;
+		goto fail_tx_dpl_put_max;
+	}
+
 	/* Initialize the deferred packet list. */
 	stdp = &txq->dpl;
+	stdp->std_put_max = sfxge_tx_dpl_put_max;
+	stdp->std_get_max = sfxge_tx_dpl_get_max;
 	stdp->std_getp = &stdp->std_get;
 
 	mtx_init(&txq->lock, "txq", NULL, MTX_DEF);
@@ -1403,6 +1438,8 @@ sfxge_tx_qinit(struct sfxge_softc *sc, u
 
 	return (0);
 
+fail_tx_dpl_put_max:
+fail_tx_dpl_get_max:
 fail3:
 fail_txq_node:
 	free(txq->pend_desc, M_SFXGE);

Modified: head/sys/dev/sfxge/sfxge_tx.h
==============================================================================
--- head/sys/dev/sfxge/sfxge_tx.h	Tue Sep 30 20:43:21 2014	(r272330)
+++ head/sys/dev/sfxge/sfxge_tx.h	Tue Sep 30 20:57:25 2014	(r272331)
@@ -75,13 +75,17 @@ struct sfxge_tx_mapping {
 	enum sfxge_tx_buf_flags	flags;
 };
 
-#define	SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT	64
+#define	SFXGE_TX_DPL_GET_PKT_LIMIT_DEFAULT	1024
 #define	SFXGE_TX_DPL_PUT_PKT_LIMIT_DEFAULT	64
 
 /*
  * Deferred packet list.
  */
 struct sfxge_tx_dpl {
+	unsigned int		std_get_max;	/* Maximum number of packets
+						 * in get list */
+	unsigned int		std_put_max;	/* Maximum number of packets
+						 * in put list */
 	uintptr_t		std_put;	/* Head of put list. */
 	struct mbuf		*std_get;	/* Head of get list. */
 	struct mbuf		**std_getp;	/* Tail of get list. */



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