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:
This commit is contained in:
parent
aacbbee3d5
commit
2609044366
@ -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 *vap, struct ieee80211req *ireq)
|
||||
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 *vap, struct ieee80211req *ireq)
|
||||
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 *vap, struct ieee80211req *ireq)
|
||||
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 *vap, struct ieee80211req *ireq)
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user