rate limit printfs for invalid tdma ie contents; probably want this to

be less than 1/sec
This commit is contained in:
Sam Leffler 2009-03-18 19:38:39 +00:00
parent 2bc3ce7732
commit f9b5a72f15
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189981
2 changed files with 12 additions and 7 deletions

View File

@ -387,8 +387,9 @@ tdma_update(struct ieee80211vap *vap, const struct ieee80211_tdma_param *tdma,
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, const struct ieee80211_tdma_param *tdma,
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;

View File

@ -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,