From owner-p4-projects@FreeBSD.ORG Mon Nov 29 16:09:07 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2439616A4D0; Mon, 29 Nov 2004 16:09:07 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DF3E416A4CE for ; Mon, 29 Nov 2004 16:09:06 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B29C043D39 for ; Mon, 29 Nov 2004 16:09:06 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iATG96Ku009049 for ; Mon, 29 Nov 2004 16:09:06 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iATG96K2009046 for perforce@freebsd.org; Mon, 29 Nov 2004 16:09:06 GMT (envelope-from sam@freebsd.org) Date: Mon, 29 Nov 2004 16:09:06 GMT Message-Id: <200411291609.iATG96K2009046@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 66033 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2004 16:09:07 -0000 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);