ieee80211_proto.c (254082) | ieee80211_proto.c (254315) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_proto.c 254082 2013-08-08 05:09:35Z adrian $"); | 28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_proto.c 254315 2013-08-14 04:24:25Z rpaulo $"); |
29 30/* 31 * IEEE 802.11 protocol support. 32 */ 33 34#include "opt_inet.h" 35#include "opt_wlan.h" 36 --- 620 unchanged lines hidden (view full) --- 657 658/* 659 * Check if the specified rate set supports ERP. 660 * NB: the rate set is assumed to be sorted. 661 */ 662int 663ieee80211_iserp_rateset(const struct ieee80211_rateset *rs) 664{ | 29 30/* 31 * IEEE 802.11 protocol support. 32 */ 33 34#include "opt_inet.h" 35#include "opt_wlan.h" 36 --- 620 unchanged lines hidden (view full) --- 657 658/* 659 * Check if the specified rate set supports ERP. 660 * NB: the rate set is assumed to be sorted. 661 */ 662int 663ieee80211_iserp_rateset(const struct ieee80211_rateset *rs) 664{ |
665#define N(a) (sizeof(a) / sizeof(a[0])) | |
666 static const int rates[] = { 2, 4, 11, 22, 12, 24, 48 }; 667 int i, j; 668 | 665 static const int rates[] = { 2, 4, 11, 22, 12, 24, 48 }; 666 int i, j; 667 |
669 if (rs->rs_nrates < N(rates)) | 668 if (rs->rs_nrates < nitems(rates)) |
670 return 0; | 669 return 0; |
671 for (i = 0; i < N(rates); i++) { | 670 for (i = 0; i < nitems(rates); i++) { |
672 for (j = 0; j < rs->rs_nrates; j++) { 673 int r = rs->rs_rates[j] & IEEE80211_RATE_VAL; 674 if (rates[i] == r) 675 goto next; 676 if (r > rates[i]) 677 return 0; 678 } 679 return 0; 680 next: 681 ; 682 } 683 return 1; | 671 for (j = 0; j < rs->rs_nrates; j++) { 672 int r = rs->rs_rates[j] & IEEE80211_RATE_VAL; 673 if (rates[i] == r) 674 goto next; 675 if (r > rates[i]) 676 return 0; 677 } 678 return 0; 679 next: 680 ; 681 } 682 return 1; |
684#undef N | |
685} 686 687/* 688 * Mark the basic rates for the rate table based on the 689 * operating mode. For real 11g we mark all the 11b rates 690 * and 6, 12, and 24 OFDM. For 11b compatibility we mark only 691 * 11b rates. There's also a pseudo 11a-mode used to mark only 692 * the basic OFDM rates. --- 1307 unchanged lines hidden --- | 683} 684 685/* 686 * Mark the basic rates for the rate table based on the 687 * operating mode. For real 11g we mark all the 11b rates 688 * and 6, 12, and 24 OFDM. For 11b compatibility we mark only 689 * 11b rates. There's also a pseudo 11a-mode used to mark only 690 * the basic OFDM rates. --- 1307 unchanged lines hidden --- |