Deleted Added
full compact
ieee80211.c (152450) ieee80211.c (153350)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 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:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 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:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 152450 2005-11-15 05:56:32Z sam $");
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 153350 2005-12-12 18:38:20Z sam $");
35
36/*
37 * IEEE 802.11 generic handler
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

802 /*
803 * Verify at least one channel is present in the available
804 * channel list before committing to the new mode.
805 */
806 KASSERT(mode < N(chanflags), ("Unexpected mode %u", mode));
807 modeflags = chanflags[mode];
808 for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
809 c = &ic->ic_channels[i];
35
36/*
37 * IEEE 802.11 generic handler
38 */
39
40#include <sys/param.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>

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

802 /*
803 * Verify at least one channel is present in the available
804 * channel list before committing to the new mode.
805 */
806 KASSERT(mode < N(chanflags), ("Unexpected mode %u", mode));
807 modeflags = chanflags[mode];
808 for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
809 c = &ic->ic_channels[i];
810 if (c->ic_flags == 0)
811 continue;
810 if (mode == IEEE80211_MODE_AUTO) {
811 /* ignore turbo channels for autoselect */
812 if (mode == IEEE80211_MODE_AUTO) {
813 /* ignore turbo channels for autoselect */
812 if ((c->ic_flags &~ IEEE80211_CHAN_TURBO) != 0)
814 if ((c->ic_flags & IEEE80211_CHAN_TURBO) == 0)
813 break;
814 } else {
815 if ((c->ic_flags & modeflags) == modeflags)
816 break;
817 }
818 }
819 if (i > IEEE80211_CHAN_MAX) {
820 IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY,
821 "%s: no channels found for mode %u\n", __func__, mode);
822 return EINVAL;
823 }
824
825 /*
826 * Calculate the active channel set.
827 */
828 memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active));
829 for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
830 c = &ic->ic_channels[i];
815 break;
816 } else {
817 if ((c->ic_flags & modeflags) == modeflags)
818 break;
819 }
820 }
821 if (i > IEEE80211_CHAN_MAX) {
822 IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY,
823 "%s: no channels found for mode %u\n", __func__, mode);
824 return EINVAL;
825 }
826
827 /*
828 * Calculate the active channel set.
829 */
830 memset(ic->ic_chan_active, 0, sizeof(ic->ic_chan_active));
831 for (i = 0; i <= IEEE80211_CHAN_MAX; i++) {
832 c = &ic->ic_channels[i];
833 if (c->ic_flags == 0)
834 continue;
831 if (mode == IEEE80211_MODE_AUTO) {
832 /* take anything but pure turbo channels */
835 if (mode == IEEE80211_MODE_AUTO) {
836 /* take anything but pure turbo channels */
833 if ((c->ic_flags &~ IEEE80211_CHAN_TURBO) != 0)
837 if ((c->ic_flags & IEEE80211_CHAN_TURBO) == 0)
834 setbit(ic->ic_chan_active, i);
835 } else {
836 if ((c->ic_flags & modeflags) == modeflags)
837 setbit(ic->ic_chan_active, i);
838 }
839 }
840 /*
841 * If no current/default channel is setup or the current

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

900 * Return the phy mode for with the specified channel so the
901 * caller can select a rate set. This is problematic for channels
902 * where multiple operating modes are possible (e.g. 11g+11b).
903 * In those cases we defer to the current operating mode when set.
904 */
905enum ieee80211_phymode
906ieee80211_chan2mode(struct ieee80211com *ic, struct ieee80211_channel *chan)
907{
838 setbit(ic->ic_chan_active, i);
839 } else {
840 if ((c->ic_flags & modeflags) == modeflags)
841 setbit(ic->ic_chan_active, i);
842 }
843 }
844 /*
845 * If no current/default channel is setup or the current

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

904 * Return the phy mode for with the specified channel so the
905 * caller can select a rate set. This is problematic for channels
906 * where multiple operating modes are possible (e.g. 11g+11b).
907 * In those cases we defer to the current operating mode when set.
908 */
909enum ieee80211_phymode
910ieee80211_chan2mode(struct ieee80211com *ic, struct ieee80211_channel *chan)
911{
908 if (IEEE80211_IS_CHAN_5GHZ(chan)) {
909 /*
910 * This assumes all 11a turbo channels are also
911 * usable withut turbo, which is currently true.
912 */
913 if (ic->ic_curmode == IEEE80211_MODE_TURBO_A)
914 return IEEE80211_MODE_TURBO_A;
912 if (IEEE80211_IS_CHAN_T(chan)) {
913 return IEEE80211_MODE_TURBO_A;
914 } else if (IEEE80211_IS_CHAN_5GHZ(chan)) {
915 return IEEE80211_MODE_11A;
916 } else if (IEEE80211_IS_CHAN_FHSS(chan))
917 return IEEE80211_MODE_FH;
918 else if (chan->ic_flags & (IEEE80211_CHAN_OFDM|IEEE80211_CHAN_DYN)) {
919 /*
920 * This assumes all 11g channels are also usable
921 * for 11b, which is currently true.
922 */

--- 113 unchanged lines hidden ---
915 return IEEE80211_MODE_11A;
916 } else if (IEEE80211_IS_CHAN_FHSS(chan))
917 return IEEE80211_MODE_FH;
918 else if (chan->ic_flags & (IEEE80211_CHAN_OFDM|IEEE80211_CHAN_DYN)) {
919 /*
920 * This assumes all 11g channels are also usable
921 * for 11b, which is currently true.
922 */

--- 113 unchanged lines hidden ---