socsvn commit: r257107 - in soc2013/ccqin/head/sys: dev/ath net80211

ccqin at FreeBSD.org ccqin at FreeBSD.org
Sun Sep 8 09:37:11 UTC 2013


Author: ccqin
Date: Sun Sep  8 09:37:11 2013
New Revision: 257107
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257107

Log:
  fix ratectl mbuf tag stuffs, add some debug msgs.
  * for __complete__ that without ratectl mbuf tag, feed a tmp
    ieee80211_rc_info.
  * for reassoc node, init the ratectl node only when it's a new assoc.
  * print the rc_flags of rc series after complete_rc_flags.
  

Modified:
  soc2013/ccqin/head/sys/dev/ath/if_ath.c
  soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c
  soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c
  soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c

Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c
==============================================================================
--- soc2013/ccqin/head/sys/dev/ath/if_ath.c	Sat Sep  7 22:40:32 2013	(r257106)
+++ soc2013/ccqin/head/sys/dev/ath/if_ath.c	Sun Sep  8 09:37:11 2013	(r257107)
@@ -324,6 +324,7 @@
 	sc->sc_ah = ah;
 	sc->sc_invalid = 0;	/* ready to go, enable interrupt handling */
 #ifdef	ATH_DEBUG
+	ath_debug |= ATH_DEBUG_NODE; 
 	sc->sc_debug = ath_debug;
 #endif
 
@@ -4089,19 +4090,27 @@
 			    bf->bf_state.bfs_pktlen, 1,
 			    (ts->ts_status == 0 ? 0 : 1));
 #endif
-			mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
-					NET80211_TAG_RATECTL, NULL);
-			if (NULL != mtag) {
-				rc_info = (struct ieee80211_rc_info*)(mtag + 1);
-				ieee80211_ratectl_rc_info_set(rc_info,
-						1, (ts->ts_status == 0 ? 0 : 1), 
-						bf->bf_state.bfs_pktlen,
-						ts->ts_shortretry, ts->ts_longretry,
-						ts->ts_finaltsi, ts->ts_rate);
-				ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
-			} else
+			/* net80211 ratectl */
+		    mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
+				            NET80211_TAG_RATECTL, NULL);
+			if (NULL == mtag) {
 				IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-						"%s: can't locate mbuf tag for ratectl.\n", __func__);
+						"%s: no ratectl mbuf tag found.\n", __func__);
+				struct ieee80211_rc_info tmp_rc_info;
+				rc_info = &tmp_rc_info;
+				bzero(rc_info, sizeof(rc_info));
+			} else {
+				IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+						"%s: found ratectl mbuf tag.\n", __func__);
+				rc_info = (struct ieee80211_rc_info*)(mtag + 1);
+			}
+	
+			ieee80211_ratectl_rc_info_set(rc_info,
+					1, (ts->ts_status == 0 ? 0 : 1), 
+					bf->bf_state.bfs_pktlen,
+					ts->ts_shortretry, ts->ts_longretry,
+					ts->ts_finaltsi, ts->ts_rate);
+			ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
 		}
 		ath_tx_default_comp(sc, bf, 0);
 	} else
@@ -5607,7 +5616,11 @@
 #if 0
 	ath_rate_newassoc(sc, an, isnew);
 #endif
-	ieee80211_ratectl_node_init(ni);
+
+	DPRINTF(sc, ATH_DEBUG_NODE, "%s: newassoc is new: %d\n",
+			__func__, isnew);
+	if (isnew)
+		ieee80211_ratectl_node_init(ni);
 
 	if (isnew &&
 	    (vap->iv_flags & IEEE80211_F_PRIVACY) == 0 && sc->sc_hasclrkey &&

Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c	Sat Sep  7 22:40:32 2013	(r257106)
+++ soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c	Sun Sep  8 09:37:11 2013	(r257107)
@@ -1420,13 +1420,15 @@
 	/* net80211 ratectl */
 	mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
 			NET80211_TAG_RATECTL, NULL);
+again:	
 	if (NULL == mtag) {
 		mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_RATECTL,
 				sizeof(struct ieee80211_rc_info), M_NOWAIT);
-		if (NULL == mtag)
-			return;
-		IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-				"%s: can't alloc mbuf tag for ratectl.\n", __func__);
+		if (NULL == mtag) {
+			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+					"%s: can't alloc mbuf tag for ratectl.\n", __func__);
+			goto again;
+		}
 	} else
 		IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
 				"%s: nani? find mbuf tag for ratectl directly.\n", __func__);
@@ -4152,19 +4154,28 @@
 		    ts, bf->bf_state.bfs_pktlen,
 		    1, (ts->ts_status == 0) ? 0 : 1);
 #endif
-		mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
-				NET80211_TAG_RATECTL, NULL);
-		if (NULL != mtag) {
-			rc_info = (struct ieee80211_rc_info*)(mtag + 1);
-			ieee80211_ratectl_rc_info_set(rc_info,
-					1, (ts->ts_status == 0 ? 0 : 1), 
-					bf->bf_state.bfs_pktlen,
-					ts->ts_shortretry, ts->ts_longretry,
-					ts->ts_finaltsi, ts->ts_rate);
-			ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
-		} else
+	
+		/* net80211 ratectl */
+	    mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
+			            NET80211_TAG_RATECTL, NULL);
+		if (NULL == mtag) {
+			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+					"%s: no ratectl mbuf tag found.\n", __func__);
+			struct ieee80211_rc_info tmp_rc_info;
+			rc_info = &tmp_rc_info;
+			bzero(rc_info, sizeof(rc_info));
+		} else {
 			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-					"%s: can't locate mbuf tag for ratectl.\n", __func__);
+					"%s: found ratectl mbuf tag.\n", __func__);
+			rc_info = (struct ieee80211_rc_info*)(mtag + 1);
+		}
+		
+		ieee80211_ratectl_rc_info_set(rc_info,
+				1, (ts->ts_status == 0 ? 0 : 1), 
+				bf->bf_state.bfs_pktlen,
+				ts->ts_shortretry, ts->ts_longretry,
+				ts->ts_finaltsi, ts->ts_rate);
+		ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
 	}
 
 	ath_tx_default_comp(sc, bf, fail);
@@ -4549,23 +4560,29 @@
 	    bf_first->bf_state.bfs_pktlen,
 	    bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes);
 #endif
-
+	/* net80211 ratectl */
 	mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, 
 			NET80211_TAG_RATECTL, NULL);
-	
-	if (NULL != mtag) {
-		rc_info = (struct ieee80211_rc_info*)(mtag + 1);
-		ieee80211_ratectl_rc_info_set(rc_info,
-				bf_first->bf_state.bfs_nframes, 
-				bf_first->bf_state.bfs_nframes,
-				bf_first->bf_state.bfs_pktlen,
-				ts.ts_shortretry, ts.ts_longretry,
-				ts.ts_finaltsi, ts.ts_rate);
-		ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
-	} else
+	if (NULL == mtag) {
 		IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-				"%s: can't locate mbuf tag for ratectl.\n", __func__);
-	
+				"%s: no ratectl mbuf tag found.\n", __func__);
+		struct ieee80211_rc_info tmp_rc_info;
+		rc_info = &tmp_rc_info;
+		bzero(rc_info, sizeof(rc_info));
+	} else {
+		IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+				"%s: found ratectl mbuf tag.\n", __func__);
+		rc_info = (struct ieee80211_rc_info*)(mtag + 1);
+	}
+
+	ieee80211_ratectl_rc_info_set(rc_info,
+			bf_first->bf_state.bfs_nframes, 
+			bf_first->bf_state.bfs_nframes,
+			bf_first->bf_state.bfs_pktlen,
+			ts.ts_shortretry, ts.ts_longretry,
+			ts.ts_finaltsi, ts.ts_rate);
+	ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
+
 	ATH_TX_LOCK(sc);
 	tap = ath_tx_get_tx_tid(an, tid->tid);
 	sc->sc_stats.ast_tx_aggr_failall++;
@@ -4843,7 +4860,7 @@
 	 */
 	mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, 
 			NET80211_TAG_RATECTL, NULL);
-	
+
 	DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR,
 	    "%s: txa_start=%d, tx_ok=%d, status=%.8x, flags=%.8x, "
 	    "isaggr=%d, seq_st=%d, hasba=%d, ba=%.8x, %.8x\n",
@@ -4965,16 +4982,24 @@
 		ath_tx_update_ratectrl(sc, ni, rc, &ts, pktlen, nframes,
 		    nbad);
 #endif
-		if (NULL != mtag) {
+		/* net80211 ratectl */
+		if (NULL == mtag) {
+			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+					"%s: no ratectl mbuf tag found.\n", __func__);
+			struct ieee80211_rc_info tmp_rc_info;
+			rc_info = &tmp_rc_info;
+			bzero(rc_info, sizeof(rc_info));
+		} else {
+			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+					"%s: found ratectl mbuf tag.\n", __func__);
 			rc_info = (struct ieee80211_rc_info*)(mtag + 1);
-			ieee80211_ratectl_rc_info_set(rc_info,
+		}
+
+		ieee80211_ratectl_rc_info_set(rc_info,
 					nframes, nbad, pktlen,
 					ts.ts_shortretry, ts.ts_longretry,
 					ts.ts_finaltsi, ts.ts_rate);
-			ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
-		} else
-			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-					"%s: can't locate mbuf tag for ratectl.\n", __func__);
+		ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
 	}
 
 	/*
@@ -5075,17 +5100,24 @@
 		mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, 
 				NET80211_TAG_RATECTL, NULL);
 		
-		if (NULL != mtag) {
-			rc_info = (struct ieee80211_rc_info*)(mtag + 1);
-			ieee80211_ratectl_rc_info_set(rc_info,
-					1, (ts.ts_status == 0 ? 0 : 1), 
-					bf->bf_state.bfs_pktlen,
-					ts.ts_shortretry, ts.ts_longretry,
-					ts.ts_finaltsi, ts.ts_rate);
-			ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
-		} else
+		if (NULL == mtag) {
 			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
-					"%s: can't locate mbuf tag for ratectl.\n", __func__);
+					"%s: no ratectl mbuf tag found.\n", __func__);
+			struct ieee80211_rc_info tmp_rc_info;
+			rc_info = &tmp_rc_info;
+			bzero(rc_info, sizeof(rc_info));
+		} else {
+			IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+					"%s: found ratectl mbuf tag.\n", __func__);
+			rc_info = (struct ieee80211_rc_info*)(mtag + 1);
+		}
+
+		ieee80211_ratectl_rc_info_set(rc_info,
+				1, (ts.ts_status == 0 ? 0 : 1), 
+				bf->bf_state.bfs_pktlen,
+				ts.ts_shortretry, ts.ts_longretry,
+				ts.ts_finaltsi, ts.ts_rate);
+		ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info);
 	}
 	/*
 	 * This is called early so atid->hwq_depth can be tracked.

Modified: soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c
==============================================================================
--- soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c	Sat Sep  7 22:40:32 2013	(r257106)
+++ soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c	Sun Sep  8 09:37:11 2013	(r257107)
@@ -315,7 +315,10 @@
 
 	rs = ieee80211_ratectl_get_rateset(ni);
 	rt = ieee80211_get_ratetable(ni->ni_ic->ic_curchan);
-
+	IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_RATECTL, 
+	    "%s: channel flags: 0x%08x\n", __func__, 
+		ni->ni_ic->ic_curchan->ic_flags); 
+	
 	rix = amrr_rate(ni, NULL, 0);
 
 	rc[0].flags = rc[1].flags = rc[2].flags = rc[3].flags = 0;

Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c
==============================================================================
--- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c	Sat Sep  7 22:40:32 2013	(r257106)
+++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c	Sun Sep  8 09:37:11 2013	(r257107)
@@ -229,5 +229,9 @@
 		rc[i].tx_power_cap = ieee80211_get_node_txpower(ni);
 		
 	}
+	IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni,
+	    "%s: flags: rc[0]:0x%08x, rc[1]:0x%08x, "
+		"rc[2]:0x%08x, rc[3]:0x%08x\n", __func__, 
+		rc[0].flags, rc[1].flags, rc[2].flags, rc[3].flags);
 }
 


More information about the svn-soc-all mailing list