Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jan 2016 20:04:44 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294034 - stable/10/sys/dev/ixgbe
Message-ID:  <201601142004.u0EK4irC029708@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Thu Jan 14 20:04:44 2016
New Revision: 294034
URL: https://svnweb.freebsd.org/changeset/base/294034

Log:
  MFC r289238
  
  Add support for sysctl knobs to live tune the per interrupt rx/tx packet
  processing limits in ixgbe(4)
  
  Submitted by:	jason wolfe (j-nitrology.com)
  Sponsored by:	Limelight Networks

Modified:
  stable/10/sys/dev/ixgbe/if_ix.c
  stable/10/sys/dev/ixgbe/if_ixv.c
  stable/10/sys/dev/ixgbe/ix_txrx.c
  stable/10/sys/dev/ixgbe/ixgbe.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ixgbe/if_ix.c
==============================================================================
--- stable/10/sys/dev/ixgbe/if_ix.c	Thu Jan 14 19:47:52 2016	(r294033)
+++ stable/10/sys/dev/ixgbe/if_ix.c	Thu Jan 14 20:04:44 2016	(r294034)
@@ -163,6 +163,8 @@ static void	ixgbe_add_device_sysctls(str
 static void     ixgbe_add_hw_stats(struct adapter *);
 
 /* Sysctl handlers */
+static void	ixgbe_set_sysctl_value(struct adapter *, const char *,
+		    const char *, int *, int);
 static int	ixgbe_set_flowcntl(SYSCTL_HANDLER_ARGS);
 static int	ixgbe_set_advertise(SYSCTL_HANDLER_ARGS);
 static int	ixgbe_sysctl_thermal_test(SYSCTL_HANDLER_ARGS);
@@ -436,6 +438,15 @@ ixgbe_attach(device_t dev)
 		goto err_out;
 	}
 
+	/* Sysctls for limiting the amount of work done in the taskqueues */
+	ixgbe_set_sysctl_value(adapter, "rx_processing_limit",
+	    "max number of rx packets to process",
+	    &adapter->rx_process_limit, ixgbe_rx_process_limit);
+
+	ixgbe_set_sysctl_value(adapter, "tx_processing_limit",
+	    "max number of tx packets to process",
+	&adapter->tx_process_limit, ixgbe_tx_process_limit);
+
 	/* Do descriptor calc and sanity checks */
 	if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
 	    ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
@@ -2695,9 +2706,6 @@ ixgbe_initialize_transmit_units(struct a
 		/* Cache the tail address */
 		txr->tail = IXGBE_TDT(txr->me);
 
-		/* Set the processing limit */
-		txr->process_limit = ixgbe_tx_process_limit;
-
 		/* Disable Head Writeback */
 		switch (hw->mac.type) {
 		case ixgbe_mac_82598EB:
@@ -2907,9 +2915,6 @@ ixgbe_initialize_receive_units(struct ad
 		IXGBE_WRITE_REG(hw, IXGBE_RDH(i), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_RDT(i), 0);
 
-		/* Set the processing limit */
-		rxr->process_limit = ixgbe_rx_process_limit;
-
 		/* Set the driver rx tail address */
 		rxr->tail =  IXGBE_RDT(rxr->me);
 	}
@@ -4219,6 +4224,16 @@ ixgbe_add_hw_stats(struct adapter *adapt
 			"1024-1522 byte frames transmitted");
 }
 
+static void
+ixgbe_set_sysctl_value(struct adapter *adapter, const char *name,
+    const char *description, int *limit, int value)
+{
+	*limit = value;
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)),
+	    OID_AUTO, name, CTLFLAG_RW, limit, value, description);
+}
+
 /*
 ** Set flow control using sysctl:
 ** Flow control values:

Modified: stable/10/sys/dev/ixgbe/if_ixv.c
==============================================================================
--- stable/10/sys/dev/ixgbe/if_ixv.c	Thu Jan 14 19:47:52 2016	(r294033)
+++ stable/10/sys/dev/ixgbe/if_ixv.c	Thu Jan 14 20:04:44 2016	(r294034)
@@ -115,6 +115,8 @@ static void	ixv_save_stats(struct adapte
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
+static void	ixv_set_sysctl_value(struct adapter *, const char *,
+		    const char *, int *, int);
 
 /* The MSI/X Interrupt handlers */
 static void	ixv_msix_que(void *);
@@ -301,6 +303,15 @@ ixv_attach(device_t dev)
 		goto err_out;
 	}
 
+	/* Sysctls for limiting the amount of work done in the taskqueues */
+	ixv_set_sysctl_value(adapter, "rx_processing_limit",
+	    "max number of rx packets to process",
+	    &adapter->rx_process_limit, ixv_rx_process_limit);
+
+	ixv_set_sysctl_value(adapter, "tx_processing_limit",
+	    "max number of tx packets to process",
+	    &adapter->tx_process_limit, ixv_tx_process_limit);
+
 	/* Do descriptor calc and sanity checks */
 	if (((ixv_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
 	    ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) {
@@ -1555,9 +1566,6 @@ ixv_initialize_transmit_units(struct ada
 		/* Set Tx Tail register */
 		txr->tail = IXGBE_VFTDT(i);
 
-		/* Set the processing limit */
-		txr->process_limit = ixv_tx_process_limit;
-
 		/* Set Ring parameters */
 		IXGBE_WRITE_REG(hw, IXGBE_VFTDBAL(i),
 		       (tdba & 0x00000000ffffffffULL));
@@ -1637,8 +1645,6 @@ ixv_initialize_receive_units(struct adap
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDH(rxr->me), 0);
 		IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me),
 		    adapter->num_rx_desc - 1);
-		/* Set the processing limit */
-		rxr->process_limit = ixv_rx_process_limit;
 
 		/* Set Rx Tail register */
 		rxr->tail = IXGBE_VFRDT(rxr->me);
@@ -2041,6 +2047,16 @@ ixv_add_stats_sysctls(struct adapter *ad
 			"# of times not enough descriptors were available during TX");
 }
 
+static void
+ixv_set_sysctl_value(struct adapter *adapter, const char *name,
+	const char *description, int *limit, int value)
+{
+	*limit = value;
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)),
+	    OID_AUTO, name, CTLFLAG_RW, limit, value, description);
+}
+
 /**********************************************************************
  *
  *  This routine is called only when em_display_debug_stats is enabled.

Modified: stable/10/sys/dev/ixgbe/ix_txrx.c
==============================================================================
--- stable/10/sys/dev/ixgbe/ix_txrx.c	Thu Jan 14 19:47:52 2016	(r294033)
+++ stable/10/sys/dev/ixgbe/ix_txrx.c	Thu Jan 14 20:04:44 2016	(r294034)
@@ -971,12 +971,12 @@ ixgbe_tso_setup(struct tx_ring *txr, str
 void
 ixgbe_txeof(struct tx_ring *txr)
 {
-#ifdef DEV_NETMAP
 	struct adapter		*adapter = txr->adapter;
+#ifdef DEV_NETMAP
 	struct ifnet		*ifp = adapter->ifp;
 #endif
 	u32			work, processed = 0;
-	u16			limit = txr->process_limit;
+	u32			limit = adapter->tx_process_limit;
 	struct ixgbe_tx_buf	*buf;
 	union ixgbe_adv_tx_desc *txd;
 
@@ -1733,7 +1733,7 @@ ixgbe_rxeof(struct ix_queue *que)
 	struct lro_entry	*queued;
 	int			i, nextp, processed = 0;
 	u32			staterr = 0;
-	u16			count = rxr->process_limit;
+	u32			count = adapter->rx_process_limit;
 	union ixgbe_adv_rx_desc	*cur;
 	struct ixgbe_rx_buf	*rbuf, *nbuf;
 	u16			pkt_info;

Modified: stable/10/sys/dev/ixgbe/ixgbe.h
==============================================================================
--- stable/10/sys/dev/ixgbe/ixgbe.h	Thu Jan 14 19:47:52 2016	(r294033)
+++ stable/10/sys/dev/ixgbe/ixgbe.h	Thu Jan 14 20:04:44 2016	(r294034)
@@ -323,7 +323,6 @@ struct tx_ring {
 	volatile u16		tx_avail;
 	u16			next_avail_desc;
 	u16			next_to_clean;
-	u16			process_limit;
 	u16			num_desc;
 	u32			txd_cmd;
 	bus_dma_tag_t		txtag;
@@ -365,7 +364,6 @@ struct rx_ring {
         u16 			next_to_check;
 	u16			num_desc;
 	u16			mbuf_sz;
-	u16			process_limit;
 	char			mtx_name[16];
 	struct ixgbe_rx_buf	*rx_buffers;
 	bus_dma_tag_t		ptag;
@@ -472,6 +470,7 @@ struct adapter {
 	 */
 	struct tx_ring		*tx_rings;
 	u32			num_tx_desc;
+	u32			tx_process_limit;
 
 	/*
 	 * Receive rings:
@@ -480,6 +479,7 @@ struct adapter {
 	struct rx_ring		*rx_rings;
 	u64			active_queues;
 	u32			num_rx_desc;
+	u32			rx_process_limit;
 
 	/* Multicast array memory */
 	u8			*mta;



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