Deleted Added
full compact
ieee80211_ht.c (183254) ieee80211_ht.c (183255)
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 183254 2008-09-21 23:44:15Z sam $");
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ht.c 183255 2008-09-21 23:59:14Z sam $");
29#endif
30
31/*
32 * IEEE 802.11n protocol support.
33 */
34
35#include "opt_inet.h"
36#include "opt_wlan.h"

--- 1195 unchanged lines hidden (view full) ---

1232 }
1233 /* NB: caller responsible for forcing any channel change */
1234 }
1235 /* update node's tx channel width */
1236 ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan)? 40 : 20;
1237}
1238
1239/*
29#endif
30
31/*
32 * IEEE 802.11n protocol support.
33 */
34
35#include "opt_inet.h"
36#include "opt_wlan.h"

--- 1195 unchanged lines hidden (view full) ---

1232 }
1233 /* NB: caller responsible for forcing any channel change */
1234 }
1235 /* update node's tx channel width */
1236 ni->ni_chw = IEEE80211_IS_CHAN_HT40(ni->ni_chan)? 40 : 20;
1237}
1238
1239/*
1240 * Update 11n MIMO PS state according to received htcap.
1241 */
1242static __inline int
1243htcap_update_mimo_ps(struct ieee80211_node *ni)
1244{
1245 uint16_t oflags = ni->ni_flags;
1246
1247 switch (ni->ni_htcap & IEEE80211_HTCAP_SMPS) {
1248 case IEEE80211_HTCAP_SMPS_DYNAMIC:
1249 ni->ni_flags |= IEEE80211_NODE_MIMO_PS;
1250 ni->ni_flags |= IEEE80211_NODE_MIMO_RTS;
1251 break;
1252 case IEEE80211_HTCAP_SMPS_ENA:
1253 ni->ni_flags |= IEEE80211_NODE_MIMO_PS;
1254 ni->ni_flags &= ~IEEE80211_NODE_MIMO_RTS;
1255 break;
1256 case IEEE80211_HTCAP_SMPS_OFF:
1257 default: /* disable on rx of reserved value */
1258 ni->ni_flags &= ~IEEE80211_NODE_MIMO_PS;
1259 ni->ni_flags &= ~IEEE80211_NODE_MIMO_RTS;
1260 break;
1261 }
1262 return (oflags ^ ni->ni_flags);
1263}
1264
1265/*
1240 * Parse and update HT-related state extracted from
1241 * the HT cap and info ie's.
1242 */
1243void
1244ieee80211_ht_updateparams(struct ieee80211_node *ni,
1245 const uint8_t *htcapie, const uint8_t *htinfoie)
1246{
1247 struct ieee80211vap *vap = ni->ni_vap;
1248 const struct ieee80211_ie_htinfo *htinfo;
1249 int htflags;
1250
1251 ieee80211_parse_htcap(ni, htcapie);
1266 * Parse and update HT-related state extracted from
1267 * the HT cap and info ie's.
1268 */
1269void
1270ieee80211_ht_updateparams(struct ieee80211_node *ni,
1271 const uint8_t *htcapie, const uint8_t *htinfoie)
1272{
1273 struct ieee80211vap *vap = ni->ni_vap;
1274 const struct ieee80211_ie_htinfo *htinfo;
1275 int htflags;
1276
1277 ieee80211_parse_htcap(ni, htcapie);
1278 if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS)
1279 htcap_update_mimo_ps(ni);
1252
1253 if (htinfoie[0] == IEEE80211_ELEMID_VENDOR)
1254 htinfoie += 4;
1255 htinfo = (const struct ieee80211_ie_htinfo *) htinfoie;
1256 htinfo_parse(ni, htinfo);
1257
1258 htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
1259 IEEE80211_CHAN_HT20 : 0;

--- 14 unchanged lines hidden (view full) ---

1274 */
1275void
1276ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
1277{
1278 struct ieee80211vap *vap = ni->ni_vap;
1279 int htflags;
1280
1281 ieee80211_parse_htcap(ni, htcapie);
1280
1281 if (htinfoie[0] == IEEE80211_ELEMID_VENDOR)
1282 htinfoie += 4;
1283 htinfo = (const struct ieee80211_ie_htinfo *) htinfoie;
1284 htinfo_parse(ni, htinfo);
1285
1286 htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
1287 IEEE80211_CHAN_HT20 : 0;

--- 14 unchanged lines hidden (view full) ---

1302 */
1303void
1304ieee80211_ht_updatehtcap(struct ieee80211_node *ni, const uint8_t *htcapie)
1305{
1306 struct ieee80211vap *vap = ni->ni_vap;
1307 int htflags;
1308
1309 ieee80211_parse_htcap(ni, htcapie);
1310 if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS)
1311 htcap_update_mimo_ps(ni);
1282
1283 /* NB: honor operating mode constraint */
1284 /* XXX 40 MHZ intolerant */
1285 htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
1286 IEEE80211_CHAN_HT20 : 0;
1287 if ((ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40) &&
1288 (vap->iv_flags_ext & IEEE80211_FEXT_USEHT40)) {
1289 if (IEEE80211_IS_CHAN_HT40U(vap->iv_bss->ni_chan))

--- 365 unchanged lines hidden (view full) ---

1655 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1656 "%s: HT txchwidth, width %d%s",
1657 __func__, chw, ni->ni_chw != chw ? "*" : "");
1658 if (chw != ni->ni_chw) {
1659 ni->ni_chw = chw;
1660 /* XXX notify on change */
1661 }
1662 break;
1312
1313 /* NB: honor operating mode constraint */
1314 /* XXX 40 MHZ intolerant */
1315 htflags = (vap->iv_flags_ext & IEEE80211_FEXT_HT) ?
1316 IEEE80211_CHAN_HT20 : 0;
1317 if ((ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40) &&
1318 (vap->iv_flags_ext & IEEE80211_FEXT_USEHT40)) {
1319 if (IEEE80211_IS_CHAN_HT40U(vap->iv_bss->ni_chan))

--- 365 unchanged lines hidden (view full) ---

1685 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1686 "%s: HT txchwidth, width %d%s",
1687 __func__, chw, ni->ni_chw != chw ? "*" : "");
1688 if (chw != ni->ni_chw) {
1689 ni->ni_chw = chw;
1690 /* XXX notify on change */
1691 }
1692 break;
1663 case IEEE80211_ACTION_HT_MIMOPWRSAVE:
1693 case IEEE80211_ACTION_HT_MIMOPWRSAVE: {
1694 const struct ieee80211_action_ht_mimopowersave *mps =
1695 (const struct ieee80211_action_ht_mimopowersave *) ia;
1696 /* XXX check iv_htcaps */
1697 if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_ENA)
1698 ni->ni_flags |= IEEE80211_NODE_MIMO_PS;
1699 else
1700 ni->ni_flags &= ~IEEE80211_NODE_MIMO_PS;
1701 if (mps->am_control & IEEE80211_A_HT_MIMOPWRSAVE_MODE)
1702 ni->ni_flags |= IEEE80211_NODE_MIMO_RTS;
1703 else
1704 ni->ni_flags &= ~IEEE80211_NODE_MIMO_RTS;
1705 /* XXX notify on change */
1664 IEEE80211_NOTE(vap,
1665 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1706 IEEE80211_NOTE(vap,
1707 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1666 "%s: HT MIMO PS", __func__);
1708 "%s: HT MIMO PS (%s%s)", __func__,
1709 (ni->ni_flags & IEEE80211_NODE_MIMO_PS) ?
1710 "on" : "off",
1711 (ni->ni_flags & IEEE80211_NODE_MIMO_RTS) ?
1712 "+rts" : ""
1713 );
1667 break;
1714 break;
1715 }
1668 default:
1669 IEEE80211_NOTE(vap,
1670 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1671 "%s: HT action %d not implemented", __func__,
1672 ia->ia_action);
1673 vap->iv_stats.is_rx_mgtdiscard++;
1674 break;
1675 }

--- 572 unchanged lines hidden ---
1716 default:
1717 IEEE80211_NOTE(vap,
1718 IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
1719 "%s: HT action %d not implemented", __func__,
1720 ia->ia_action);
1721 vap->iv_stats.is_rx_mgtdiscard++;
1722 break;
1723 }

--- 572 unchanged lines hidden ---