Deleted Added
full compact
ieee80211_scan_sta.c (215699) ieee80211_scan_sta.c (219601)
1/*-
2 * Copyright (c) 2002-2009 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

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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>
1/*-
2 * Copyright (c) 2002-2009 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

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sta.c 215699 2010-11-22 19:01:47Z bschmidt $");
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_scan_sta.c 219601 2011-03-13 11:58:40Z bschmidt $");
28
29/*
30 * IEEE 802.11 station scanning support.
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

751 return chan;
752}
753
754static int
755maxrate(const struct ieee80211_scan_entry *se)
756{
757 const struct ieee80211_ie_htcap *htcap =
758 (const struct ieee80211_ie_htcap *) se->se_ies.htcap_ie;
28
29/*
30 * IEEE 802.11 station scanning support.
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

751 return chan;
752}
753
754static int
755maxrate(const struct ieee80211_scan_entry *se)
756{
757 const struct ieee80211_ie_htcap *htcap =
758 (const struct ieee80211_ie_htcap *) se->se_ies.htcap_ie;
759 int rmax, r, i;
759 int rmax, r, i, txstream;
760 uint16_t caps;
760 uint16_t caps;
761 uint8_t txparams;
761
762 rmax = 0;
763 if (htcap != NULL) {
764 /*
765 * HT station; inspect supported MCS and then adjust
762
763 rmax = 0;
764 if (htcap != NULL) {
765 /*
766 * HT station; inspect supported MCS and then adjust
766 * rate by channel width. Could also include short GI
767 * in this if we want to be extra accurate.
767 * rate by channel width.
768 */
768 */
769 /* XXX assumes MCS15 is max */
770 for (i = 15; i >= 0 && isclr(htcap->hc_mcsset, i); i--)
771 ;
769 txparams = htcap->hc_mcsset[12];
770 if (txparams & 0x3) {
771 /*
772 * TX MCS parameters defined and not equal to RX,
773 * extract the number of spartial streams and
774 * map it to the highest MCS rate.
775 */
776 txstream = ((txparams & 0xc) >> 2) + 1;
777 i = txstream * 8 - 1;
778 } else
779 for (i = 31; i >= 0 && isclr(htcap->hc_mcsset, i); i--);
772 if (i >= 0) {
773 caps = LE_READ_2(&htcap->hc_cap);
780 if (i >= 0) {
781 caps = LE_READ_2(&htcap->hc_cap);
774 /* XXX short/long GI */
775 if (caps & IEEE80211_HTCAP_CHWIDTH40)
782 if ((caps & IEEE80211_HTCAP_CHWIDTH40) &&
783 (caps & IEEE80211_HTCAP_SHORTGI40))
776 rmax = ieee80211_htrates[i].ht40_rate_400ns;
784 rmax = ieee80211_htrates[i].ht40_rate_400ns;
777 else
785 else if (caps & IEEE80211_HTCAP_CHWIDTH40)
778 rmax = ieee80211_htrates[i].ht40_rate_800ns;
786 rmax = ieee80211_htrates[i].ht40_rate_800ns;
787 else if (caps & IEEE80211_HTCAP_SHORTGI20)
788 rmax = ieee80211_htrates[i].ht20_rate_400ns;
789 else
790 rmax = ieee80211_htrates[i].ht20_rate_800ns;
779 }
780 }
781 for (i = 0; i < se->se_rates[1]; i++) {
782 r = se->se_rates[2+i] & IEEE80211_RATE_VAL;
783 if (r > rmax)
784 rmax = r;
785 }
786 for (i = 0; i < se->se_xrates[1]; i++) {

--- 1140 unchanged lines hidden ---
791 }
792 }
793 for (i = 0; i < se->se_rates[1]; i++) {
794 r = se->se_rates[2+i] & IEEE80211_RATE_VAL;
795 if (r > rmax)
796 rmax = r;
797 }
798 for (i = 0; i < se->se_xrates[1]; i++) {

--- 1140 unchanged lines hidden ---