changeset 2954:b0b763bffb8e

6464240 back out 6436930
author jb145095
date Fri, 20 Oct 2006 14:20:31 -0700
parents f47ccf3069f8
children 2aef90ea300f
files usr/src/uts/sun4v/io/qcn.c usr/src/uts/sun4v/sys/qcn.h
diffstat 2 files changed, 19 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/sun4v/io/qcn.c	Fri Oct 20 13:11:24 2006 -0700
+++ b/usr/src/uts/sun4v/io/qcn.c	Fri Oct 20 14:20:31 2006 -0700
@@ -82,29 +82,20 @@
 static int qcn_timeout_period = 20;	/* time out in seconds */
 size_t qcn_input_dropped;	/* dropped input character counter */
 
-static cyc_time_t qcn_poll_time;
-static uint64_t	qcn_poll_interval = 5;  /* milli sec */
-static void qcn_tx_block_handler(void *unused);
-static cyc_handler_t qcn_tx_block_cychandler = {
-	qcn_tx_block_handler,
-	NULL,
-	CY_LOW_LEVEL
-};
-static cyclic_id_t qcn_tx_block_cycid = CYCLIC_NONE;
-
 #ifdef QCN_POLLING
 static void qcn_poll_handler(void *unused);
+static cyc_time_t qcn_poll_time;
 static cyc_handler_t qcn_poll_cychandler = {
 	qcn_poll_handler,
 	NULL,
 	CY_LOW_LEVEL		/* XXX need softint to make this high */
 };
 static cyclic_id_t qcn_poll_cycid = CYCLIC_NONE;
+static uint64_t	qcn_poll_interval = 5;  /* milli sec */
 static uint64_t sb_interval = 0;
 uint_t qcn_force_polling = 0;
 #endif
 
-
 #define	QCN_MI_IDNUM		0xABCE
 #define	QCN_MI_HIWAT		8192
 #define	QCN_MI_LOWAT		128
@@ -416,18 +407,8 @@
 			return (DDI_FAILURE);
 		}
 
-		qcn_poll_time.cyt_when = 0ull;
-		qcn_poll_time.cyt_interval =
-		    qcn_poll_interval * 1000ull * 1000ull;
-		mutex_enter(&cpu_lock);
-		qcn_tx_block_cycid = cyclic_add(&qcn_tx_block_cychandler,
-		    &qcn_poll_time);
-		mutex_exit(&cpu_lock);
-
-		qcn_state->qcn_tx_blocked = B_FALSE;
-
-		mutex_init(&qcn_state->qcn_hi_lock, NULL, MUTEX_DRIVER,
-		    (void *)(uintptr_t)(qcn_state->qcn_intr_pri));
+	mutex_init(&qcn_state->qcn_hi_lock, NULL, MUTEX_DRIVER,
+	    (void *)(uintptr_t)(qcn_state->qcn_intr_pri));
 	}
 
 	mutex_init(&qcn_state->qcn_lock, NULL, MUTEX_DRIVER, NULL);
@@ -469,15 +450,9 @@
 	}
 #endif
 
-	if (!qcn_state->qcn_polling) {
+	if (!qcn_state->qcn_polling)
 		qcn_remove_intrs();
 
-		mutex_enter(&cpu_lock);
-		if (qcn_tx_block_cycid != CYCLIC_NONE)
-			cyclic_remove(qcn_tx_block_cycid);
-		qcn_tx_block_cycid = CYCLIC_NONE;
-		mutex_exit(&cpu_lock);
-	}
 	return (DDI_SUCCESS);
 }
 
@@ -884,7 +859,6 @@
 				 * hypervisor cannot process the request -
 				 * channel busy.  Try again later.
 				 */
-				qcn_state->qcn_tx_blocked = B_TRUE;
 				return (EAGAIN);
 
 			case H_EIO :
@@ -913,10 +887,8 @@
 		len = bp->b_wptr - bp->b_rptr;
 		buf = (caddr_t)bp->b_rptr;
 		for (i = 0; i < len; i++) {
-			if (hv_cnputchar(buf[i]) == H_EWOULDBLOCK) {
-				qcn_state->qcn_tx_blocked = B_TRUE;
+			if (hv_cnputchar(buf[i]) == H_EWOULDBLOCK)
 				break;
-			}
 		}
 		if (i != len) {
 			bp->b_rptr += i;
@@ -1005,13 +977,21 @@
 			putnext(qcn_state->qcn_readq, mp);
 		}
 out:
-		if (qcn_state->qcn_hangup) {
-			(void) putctl(qcn_state->qcn_readq, M_HANGUP);
-			if (qcn_state->qcn_writeq != NULL) {
+		/*
+		 * If there are pending transmits because hypervisor
+		 * returned EWOULDBLOCK poke start now.
+		 */
+
+		if (qcn_state->qcn_writeq != NULL) {
+			if (qcn_state->qcn_hangup) {
+				(void) putctl(qcn_state->qcn_readq, M_HANGUP);
 				flushq(qcn_state->qcn_writeq, FLUSHDATA);
-				qcn_state->qcn_tx_blocked = B_FALSE;
+				qcn_state->qcn_hangup = 0;
+			} else {
+				mutex_enter(&qcn_state->qcn_lock);
+				qcn_start();
+				mutex_exit(&qcn_state->qcn_lock);
 			}
-			qcn_state->qcn_hangup = 0;
 		}
 		/*
 		 * now loop if another interrupt came in (qcn_trigger_softint
@@ -1211,21 +1191,6 @@
 }
 #endif
 
-/*ARGSUSED*/
-static void
-qcn_tx_block_handler(void *unused)
-{
-	mutex_enter(&qcn_state->qcn_lock);
-	/*
-	 * If the hypervisor returned EWOULDBLOCK on the transmit,
-	 * re-transmit now.
-	 */
-	if (qcn_state->qcn_tx_blocked && qcn_state->qcn_writeq != NULL) {
-		qcn_state->qcn_tx_blocked = B_FALSE;
-		qcn_start();
-	}
-	mutex_exit(&qcn_state->qcn_lock);
-}
 /*
  * Check for abort character sequence, copied from zs_async.c
  */
--- a/usr/src/uts/sun4v/sys/qcn.h	Fri Oct 20 13:11:24 2006 -0700
+++ b/usr/src/uts/sun4v/sys/qcn.h	Fri Oct 20 14:20:31 2006 -0700
@@ -105,11 +105,6 @@
 	char		*cons_write_buffer;
 	uint64_t	cons_write_buf_ra;
 	uint64_t	cons_read_buf_ra;
-	/*
-	 * qcn tx blocked used to indicate HV
-	 * returned EWOULDBLOCK on transmit.
-	 */
-	boolean_t	qcn_tx_blocked;
 } qcn_t;
 
 /* Constants for qcn_soft_pend */