changeset 9002:95b8929386a5

6813741 mac_tx_is_flow_blocked() panicked because of NULL mac_client_impl_t 6811070 softmac calls copyb() which strips db_struioun.cksum.flags effectively disabling H/W checksum
author Cathy Zhou <Cathy.Zhou@Sun.COM>
date Mon, 09 Mar 2009 17:00:45 -0700
parents 55ea5a5c257a
children f030be2909ac
files usr/src/uts/common/io/softmac/softmac_pkt.c usr/src/uts/common/sys/dld_impl.h
diffstat 2 files changed, 23 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/softmac/softmac_pkt.c	Mon Mar 09 19:31:17 2009 -0400
+++ b/usr/src/uts/common/io/softmac/softmac_pkt.c	Mon Mar 09 17:00:45 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -79,12 +79,17 @@
 
 	if (DB_REF(mp) > 1) {
 		mblk_t *tmp;
+		uint32_t start, stuff, end, value, flags;
 
 		if ((tmp = copymsg(mp)) == NULL) {
 			cmn_err(CE_WARN, "softmac_rput_process_data: "
 			    "copymsg failed");
 			goto failed;
 		}
+		hcksum_retrieve(mp, NULL, NULL, &start, &stuff, &end,
+		    &value, &flags);
+		VERIFY(hcksum_assoc(tmp, NULL, NULL, start, stuff, end,
+		    value, flags, KM_NOSLEEP) == 0);
 		freemsg(mp);
 		mp = tmp;
 	}
--- a/usr/src/uts/common/sys/dld_impl.h	Mon Mar 09 19:31:17 2009 -0400
+++ b/usr/src/uts/common/sys/dld_impl.h	Mon Mar 09 17:00:45 2009 -0700
@@ -108,7 +108,7 @@
 	/*
 	 * Current DLPI state.
 	 */
-	t_uscalar_t		ds_dlstate;		/* ds_lock */
+	t_uscalar_t		ds_dlstate;		/* SL */
 
 	/*
 	 * DLPI style
@@ -311,16 +311,22 @@
 	mutex_exit(&(dsp)->ds_lock);					\
 }
 
-#define	DLD_CLRQFULL(dsp) {						\
-	queue_t *q = (dsp)->ds_wq;					\
-									\
-	mutex_enter(&(dsp)->ds_lock);					\
-	if (!mac_tx_is_flow_blocked((dsp)->ds_mch, NULL)) {		\
-		if ((dsp)->ds_tx_flow_mp == NULL)			\
-			(dsp)->ds_tx_flow_mp = getq(q);			\
-		ASSERT((dsp)->ds_tx_flow_mp != NULL);			\
-	}								\
-	mutex_exit(&(dsp)->ds_lock);					\
+/*
+ * This is called to check whether we can disable the flow control, and
+ * it is usually only needed in TX data-path when the dsp->ds_dlstate is
+ * DL_IDLE. Otherwise, it does not hurt to always disable the flow control.
+ */
+#define	DLD_CLRQFULL(dsp) {					\
+	queue_t *q = (dsp)->ds_wq;				\
+								\
+	mutex_enter(&(dsp)->ds_lock);				\
+	if ((dsp)->ds_dlstate != DL_IDLE ||			\
+	    !mac_tx_is_flow_blocked((dsp)->ds_mch, NULL)) {	\
+		if ((dsp)->ds_tx_flow_mp == NULL)		\
+			(dsp)->ds_tx_flow_mp = getq(q);		\
+		ASSERT((dsp)->ds_tx_flow_mp != NULL);		\
+	}							\
+	mutex_exit(&(dsp)->ds_lock);				\
 }
 
 #define	DLD_TX(dsp, mp, f_hint, flag)				\