From owner-svn-src-head@FreeBSD.ORG Sat May 30 19:57:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 230F1106566B; Sat, 30 May 2009 19:57:32 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB6DF8FC16; Sat, 30 May 2009 19:57:31 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4UJvVOa017685; Sat, 30 May 2009 19:57:31 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4UJvVVi017684; Sat, 30 May 2009 19:57:31 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905301957.n4UJvVVi017684@svn.freebsd.org> From: Sam Leffler Date: Sat, 30 May 2009 19:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193114 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 19:57:32 -0000 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);