svn commit: r193114 - head/sys/net80211

Sam Leffler sam at FreeBSD.org
Sat May 30 19:57:32 UTC 2009


Author: sam
Date: Sat May 30 19:57:31 2009
New Revision: 193114
URL: http://svn.freebsd.org/changeset/base/193114

Log:
  o assert TDMA_MAXSLOTS is 2 so noone tries to blindly increase it
  o add safety belt in vdetach for failed state block allocation
  o fix dynamic change to tdma config; ERESTART may not result in
    kicking the state machine so we need to explicitly mark the
    beacon for update
  
  Sponsored by:

Modified:
  head/sys/net80211/ieee80211_tdma.c

Modified: head/sys/net80211/ieee80211_tdma.c
==============================================================================
--- head/sys/net80211/ieee80211_tdma.c	Sat May 30 19:39:57 2009	(r193113)
+++ head/sys/net80211/ieee80211_tdma.c	Sat May 30 19:57:31 2009	(r193114)
@@ -104,6 +104,11 @@ __FBSDID("$FreeBSD$");
 /* XXX probably should set a max */
 #define	TDMA_BINTVAL_VALID(_bintval)	(1 <= (_bintval))
 
+/*
+ * This code is not prepared to handle more than 2 slots.
+ */
+CTASSERT(TDMA_MAXSLOTS == 2);
+
 static void tdma_vdetach(struct ieee80211vap *vap);
 static int tdma_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static void tdma_beacon_miss(struct ieee80211vap *vap);
@@ -187,8 +192,13 @@ tdma_vdetach(struct ieee80211vap *vap)
 {
 	struct ieee80211_tdma_state *ts = vap->iv_tdma;
 
+	if (ts == NULL) {
+		/* NB: should not have touched any ic state */
+		return;
+	}
 	ts->tdma_opdetach(vap);
 	free(vap->iv_tdma, M_80211_VAP);
+	vap->iv_tdma = NULL;
 
 	setackpolicy(vap->iv_ic, 0);	/* enable ACK's */
 }
@@ -764,7 +774,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slot) {
 			ts->tdma_slot = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_SLOTCNT:
@@ -772,7 +782,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slotcnt) {
 			ts->tdma_slotcnt = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_SLOTLEN:
@@ -786,7 +796,7 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_slotlen) {
 			ts->tdma_slotlen = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	case IEEE80211_IOC_TDMA_BINTERVAL:
@@ -794,12 +804,15 @@ tdma_ioctl_set80211(struct ieee80211vap 
 			return EINVAL;
 		if (ireq->i_val != ts->tdma_bintval) {
 			ts->tdma_bintval = ireq->i_val;
-			return ERESTART;
+			goto restart;
 		}
 		break;
 	default:
 		return ENOSYS;
 	}
 	return 0;
+restart:
+	ieee80211_beacon_notify(vap, IEEE80211_BEACON_TDMA);
+	return ERESTART;
 }
 IEEE80211_IOCTL_SET(tdma, tdma_ioctl_set80211);


More information about the svn-src-head mailing list