Date: Mon, 29 Nov 2004 16:09:06 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 66033 for review Message-ID: <200411291609.iATG96K2009046@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=66033 Change 66033 by sam@sam_ebb on 2004/11/29 16:08:55 simplify the size calculations of management frames; force calculations that will always fit in an mbuf (i.e. not require a cluster) to be done at compile time and leave only those that might cause a cluster to be used to be done at runtime Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_output.c#14 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#14 (text+ko) ==== @@ -938,12 +938,12 @@ * [tlv] user-specified ie's */ m = ieee80211_getmgtframe(&frm, - 2 + ic->ic_des_esslen + 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + ((ic->ic_flags & IEEE80211_F_WME) ? - sizeof(struct ieee80211_wme_param) : 0) - + (ic->ic_opt_ie != NULL ? ic->ic_opt_ie_len : 0)); + + sizeof(struct ieee80211_wme_param) + + (ic->ic_opt_ie != NULL ? ic->ic_opt_ie_len : 0) + ); if (m == NULL) senderr(ENOMEM, is_tx_nobuf); @@ -978,13 +978,16 @@ * [tlv] WPA */ m = ieee80211_getmgtframe(&frm, - 8 + 2 + 2 + 2 - + 2 + ni->ni_esslen + 8 + + sizeof(u_int16_t) + + sizeof(u_int16_t) + + 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE - + (ic->ic_phytype == IEEE80211_T_FH ? 7 : 3) + + 7 /* max(7,3) */ + 6 - + (ic->ic_curmode == IEEE80211_MODE_11G ? 3 : 0) + + 3 + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) + /* XXX !WPA1+WPA2 fits w/o a cluster */ + (ic->ic_flags & IEEE80211_F_WPA ? 2*sizeof(struct ieee80211_ie_wpa) : 0) ); @@ -1064,7 +1067,8 @@ m = ieee80211_getmgtframe(&frm, 3 * sizeof(u_int16_t) + (has_challenge && status == IEEE80211_STATUS_SUCCESS ? - sizeof(u_int16_t)+IEEE80211_CHALLENGE_LEN : 0)); + sizeof(u_int16_t)+IEEE80211_CHALLENGE_LEN : 0) + ); if (m == NULL) senderr(ENOMEM, is_tx_nobuf); @@ -1147,16 +1151,15 @@ * [tlv] user-specified ie's */ m = ieee80211_getmgtframe(&frm, - sizeof(capinfo) + sizeof(u_int16_t) + sizeof(u_int16_t) + IEEE80211_ADDR_LEN - + 2 + ni->ni_esslen + + 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + ((ic->ic_flags & IEEE80211_F_WME) && - ni->ni_wme_ie != NULL ? - sizeof(struct ieee80211_wme_info) : 0) - + (ic->ic_opt_ie != NULL ? ic->ic_opt_ie_len : 0)); + + sizeof(struct ieee80211_wme_info) + + (ic->ic_opt_ie != NULL ? ic->ic_opt_ie_len : 0) + ); if (m == NULL) senderr(ENOMEM, is_tx_nobuf); @@ -1214,14 +1217,13 @@ * [tlv] WME (if enabled and STA enabled) */ m = ieee80211_getmgtframe(&frm, - sizeof(capinfo) + sizeof(u_int16_t) + sizeof(u_int16_t) + sizeof(u_int16_t) + 2 + IEEE80211_RATE_SIZE + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + ((ic->ic_flags & IEEE80211_F_WME) && - ni->ni_wme_ie != NULL ? - sizeof(struct ieee80211_wme_param) : 0)); + + sizeof(struct ieee80211_wme_param) + ); if (m == NULL) senderr(ENOMEM, is_tx_nobuf);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411291609.iATG96K2009046>
