ieee80211_ht.c (297775) | ieee80211_ht.c (298359) |
---|---|
1/*- 2 * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> 27#ifdef __FreeBSD__ | 1/*- 2 * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> 27#ifdef __FreeBSD__ |
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ht.c 297775 2016-04-10 04:16:34Z adrian $"); | 28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ht.c 298359 2016-04-20 18:29:30Z avos $"); |
29#endif 30 31/* 32 * IEEE 802.11n protocol support. 33 */ 34 35#include "opt_inet.h" 36#include "opt_wlan.h" --- 1382 unchanged lines hidden (view full) --- 1419 * mark the node so when we respond we'll use 1420 * the Vendor OUI's and not the standard ie's. 1421 */ 1422 ni->ni_flags |= IEEE80211_NODE_HTCOMPAT; 1423 ie += 4; 1424 } else 1425 ni->ni_flags &= ~IEEE80211_NODE_HTCOMPAT; 1426 | 29#endif 30 31/* 32 * IEEE 802.11n protocol support. 33 */ 34 35#include "opt_inet.h" 36#include "opt_wlan.h" --- 1382 unchanged lines hidden (view full) --- 1419 * mark the node so when we respond we'll use 1420 * the Vendor OUI's and not the standard ie's. 1421 */ 1422 ni->ni_flags |= IEEE80211_NODE_HTCOMPAT; 1423 ie += 4; 1424 } else 1425 ni->ni_flags &= ~IEEE80211_NODE_HTCOMPAT; 1426 |
1427 ni->ni_htcap = LE_READ_2(ie + | 1427 ni->ni_htcap = le16dec(ie + |
1428 __offsetof(struct ieee80211_ie_htcap, hc_cap)); 1429 ni->ni_htparam = ie[__offsetof(struct ieee80211_ie_htcap, hc_param)]; 1430} 1431 1432static void 1433htinfo_parse(struct ieee80211_node *ni, 1434 const struct ieee80211_ie_htinfo *htinfo) 1435{ 1436 uint16_t w; 1437 1438 ni->ni_htctlchan = htinfo->hi_ctrlchannel; 1439 ni->ni_ht2ndchan = SM(htinfo->hi_byte1, IEEE80211_HTINFO_2NDCHAN); | 1428 __offsetof(struct ieee80211_ie_htcap, hc_cap)); 1429 ni->ni_htparam = ie[__offsetof(struct ieee80211_ie_htcap, hc_param)]; 1430} 1431 1432static void 1433htinfo_parse(struct ieee80211_node *ni, 1434 const struct ieee80211_ie_htinfo *htinfo) 1435{ 1436 uint16_t w; 1437 1438 ni->ni_htctlchan = htinfo->hi_ctrlchannel; 1439 ni->ni_ht2ndchan = SM(htinfo->hi_byte1, IEEE80211_HTINFO_2NDCHAN); |
1440 w = LE_READ_2(&htinfo->hi_byte2); | 1440 w = le16dec(&htinfo->hi_byte2); |
1441 ni->ni_htopmode = SM(w, IEEE80211_HTINFO_OPMODE); | 1441 ni->ni_htopmode = SM(w, IEEE80211_HTINFO_OPMODE); |
1442 w = LE_READ_2(&htinfo->hi_byte45); | 1442 w = le16dec(&htinfo->hi_byte45); |
1443 ni->ni_htstbc = SM(w, IEEE80211_HTINFO_BASIC_STBCMCS); 1444} 1445 1446/* 1447 * Parse an 802.11n HT info ie and save useful information 1448 * to the node state. Note this does not effect any state 1449 * changes such as for channel width change. 1450 */ --- 476 unchanged lines hidden (view full) --- 1927 struct ieee80211vap *vap = ni->ni_vap; 1928 struct ieee80211_rx_ampdu *rap; 1929 uint8_t dialogtoken; 1930 uint16_t baparamset, batimeout, baseqctl; 1931 uint16_t args[5]; 1932 int tid; 1933 1934 dialogtoken = frm[2]; | 1443 ni->ni_htstbc = SM(w, IEEE80211_HTINFO_BASIC_STBCMCS); 1444} 1445 1446/* 1447 * Parse an 802.11n HT info ie and save useful information 1448 * to the node state. Note this does not effect any state 1449 * changes such as for channel width change. 1450 */ --- 476 unchanged lines hidden (view full) --- 1927 struct ieee80211vap *vap = ni->ni_vap; 1928 struct ieee80211_rx_ampdu *rap; 1929 uint8_t dialogtoken; 1930 uint16_t baparamset, batimeout, baseqctl; 1931 uint16_t args[5]; 1932 int tid; 1933 1934 dialogtoken = frm[2]; |
1935 baparamset = LE_READ_2(frm+3); 1936 batimeout = LE_READ_2(frm+5); 1937 baseqctl = LE_READ_2(frm+7); | 1935 baparamset = le16dec(frm+3); 1936 batimeout = le16dec(frm+5); 1937 baseqctl = le16dec(frm+7); |
1938 1939 tid = MS(baparamset, IEEE80211_BAPS_TID); 1940 1941 IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, 1942 "recv ADDBA request: dialogtoken %u baparamset 0x%x " 1943 "(tid %d bufsiz %d) batimeout %d baseqctl %d:%d", 1944 dialogtoken, baparamset, 1945 tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ), --- 46 unchanged lines hidden (view full) --- 1992 struct ieee80211com *ic = ni->ni_ic; 1993 struct ieee80211vap *vap = ni->ni_vap; 1994 struct ieee80211_tx_ampdu *tap; 1995 uint8_t dialogtoken, policy; 1996 uint16_t baparamset, batimeout, code; 1997 int tid, bufsiz; 1998 1999 dialogtoken = frm[2]; | 1938 1939 tid = MS(baparamset, IEEE80211_BAPS_TID); 1940 1941 IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, 1942 "recv ADDBA request: dialogtoken %u baparamset 0x%x " 1943 "(tid %d bufsiz %d) batimeout %d baseqctl %d:%d", 1944 dialogtoken, baparamset, 1945 tid, MS(baparamset, IEEE80211_BAPS_BUFSIZ), --- 46 unchanged lines hidden (view full) --- 1992 struct ieee80211com *ic = ni->ni_ic; 1993 struct ieee80211vap *vap = ni->ni_vap; 1994 struct ieee80211_tx_ampdu *tap; 1995 uint8_t dialogtoken, policy; 1996 uint16_t baparamset, batimeout, code; 1997 int tid, bufsiz; 1998 1999 dialogtoken = frm[2]; |
2000 code = LE_READ_2(frm+3); 2001 baparamset = LE_READ_2(frm+5); | 2000 code = le16dec(frm+3); 2001 baparamset = le16dec(frm+5); |
2002 tid = MS(baparamset, IEEE80211_BAPS_TID); 2003 bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); 2004 policy = MS(baparamset, IEEE80211_BAPS_POLICY); | 2002 tid = MS(baparamset, IEEE80211_BAPS_TID); 2003 bufsiz = MS(baparamset, IEEE80211_BAPS_BUFSIZ); 2004 policy = MS(baparamset, IEEE80211_BAPS_POLICY); |
2005 batimeout = LE_READ_2(frm+7); | 2005 batimeout = le16dec(frm+7); |
2006 2007 tap = &ni->ni_tx_ampdu[tid]; 2008 if ((tap->txa_flags & IEEE80211_AGGR_XCHGPEND) == 0) { 2009 IEEE80211_DISCARD_MAC(vap, 2010 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, 2011 ni->ni_macaddr, "ADDBA response", 2012 "no pending ADDBA, tid %d dialogtoken %u " 2013 "code %d", tid, dialogtoken, code); --- 50 unchanged lines hidden (view full) --- 2064 const uint8_t *frm, const uint8_t *efrm) 2065{ 2066 struct ieee80211com *ic = ni->ni_ic; 2067 struct ieee80211_rx_ampdu *rap; 2068 struct ieee80211_tx_ampdu *tap; 2069 uint16_t baparamset, code; 2070 int tid; 2071 | 2006 2007 tap = &ni->ni_tx_ampdu[tid]; 2008 if ((tap->txa_flags & IEEE80211_AGGR_XCHGPEND) == 0) { 2009 IEEE80211_DISCARD_MAC(vap, 2010 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, 2011 ni->ni_macaddr, "ADDBA response", 2012 "no pending ADDBA, tid %d dialogtoken %u " 2013 "code %d", tid, dialogtoken, code); --- 50 unchanged lines hidden (view full) --- 2064 const uint8_t *frm, const uint8_t *efrm) 2065{ 2066 struct ieee80211com *ic = ni->ni_ic; 2067 struct ieee80211_rx_ampdu *rap; 2068 struct ieee80211_tx_ampdu *tap; 2069 uint16_t baparamset, code; 2070 int tid; 2071 |
2072 baparamset = LE_READ_2(frm+2); 2073 code = LE_READ_2(frm+4); | 2072 baparamset = le16dec(frm+2); 2073 code = le16dec(frm+4); |
2074 2075 tid = MS(baparamset, IEEE80211_DELBAPS_TID); 2076 2077 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, 2078 "recv DELBA: baparamset 0x%x (tid %d initiator %d) " 2079 "code %d", baparamset, tid, 2080 MS(baparamset, IEEE80211_DELBAPS_INIT), code); 2081 --- 889 unchanged lines hidden --- | 2074 2075 tid = MS(baparamset, IEEE80211_DELBAPS_TID); 2076 2077 IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni, 2078 "recv DELBA: baparamset 0x%x (tid %d initiator %d) " 2079 "code %d", baparamset, tid, 2080 MS(baparamset, IEEE80211_DELBAPS_INIT), code); 2081 --- 889 unchanged lines hidden --- |