Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2009 19:38:39 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189981 - head/sys/net80211
Message-ID:  <200903181938.n2IJcdnk035736@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Wed Mar 18 19:38:39 2009
New Revision: 189981
URL: http://svn.freebsd.org/changeset/base/189981

Log:
  rate limit printfs for invalid tdma ie contents; probably want this to
  be less than 1/sec

Modified:
  head/sys/net80211/ieee80211_tdma.c
  head/sys/net80211/ieee80211_tdma.h

Modified: head/sys/net80211/ieee80211_tdma.c
==============================================================================
--- head/sys/net80211/ieee80211_tdma.c	Wed Mar 18 19:28:17 2009	(r189980)
+++ head/sys/net80211/ieee80211_tdma.c	Wed Mar 18 19:38:39 2009	(r189981)
@@ -387,8 +387,9 @@ tdma_update(struct ieee80211vap *vap, co
 	update = 0;
 	if (tdma->tdma_slotcnt != ts->tdma_slotcnt) {
 		if (!TDMA_SLOTCNT_VALID(tdma->tdma_slotcnt)) {
-			printf("%s: bad slot cnt %u\n",
-			    __func__, tdma->tdma_slotcnt);
+			if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+				printf("%s: bad slot cnt %u\n",
+				    __func__, tdma->tdma_slotcnt);
 			return 0;
 		}
 		update |= TDMA_UPDATE_SLOTCNT;
@@ -396,16 +397,18 @@ tdma_update(struct ieee80211vap *vap, co
 	slotlen = le16toh(tdma->tdma_slotlen) * 100;
 	if (slotlen != ts->tdma_slotlen) {
 		if (!TDMA_SLOTLEN_VALID(slotlen)) {
-			printf("%s: bad slot len %u\n",
-			    __func__, slotlen);
+			if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+				printf("%s: bad slot len %u\n",
+				    __func__, slotlen);
 			return 0;
 		}
 		update |= TDMA_UPDATE_SLOTLEN;
  	}
 	if (tdma->tdma_bintval != ts->tdma_bintval) {
 		if (!TDMA_BINTVAL_VALID(tdma->tdma_bintval)) {
-			printf("%s: bad beacon interval %u\n",
-			    __func__, tdma->tdma_bintval);
+			if (ppsratecheck(&ts->tdma_lastprint, &ts->tdma_fails, 1))
+				printf("%s: bad beacon interval %u\n",
+				    __func__, tdma->tdma_bintval);
 			return 0;
 		}
 		update |= TDMA_UPDATE_BINTVAL;

Modified: head/sys/net80211/ieee80211_tdma.h
==============================================================================
--- head/sys/net80211/ieee80211_tdma.h	Wed Mar 18 19:28:17 2009	(r189980)
+++ head/sys/net80211/ieee80211_tdma.h	Wed Mar 18 19:38:39 2009	(r189981)
@@ -38,9 +38,11 @@ struct ieee80211_tdma_state {
 	uint8_t	tdma_bintval;		/* beacon interval (slots) */
 	uint8_t	tdma_slot;		/* station slot # */
 	uint8_t	tdma_inuse[1];		/* mask of slots in use */
-	void	*tdma_peer;		/* peer station cookie */
 	uint8_t	tdma_active[1];		/* mask of active slots */
 	int	tdma_count;		/* active/inuse countdown */
+	void	*tdma_peer;		/* peer station cookie */
+	struct timeval tdma_lastprint;	/* time of last rate-limited printf */
+	int	tdma_fails;		/* fail count for rate-limiting */
 
 	/* parent method pointers */
 	int	(*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state,



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