-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 10250 b: refs/heads/master c: 02cda6a h: refs/heads/master v: v3
- Loading branch information
James Ketrenos
authored and
Jeff Garzik
committed
Sep 22, 2005
1 parent
9a263e0
commit 10b919d
Showing
4 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 9e8571affd1c54b9638b4ff9844e47aae07310f6 | ||
refs/heads/master: 02cda6ae01814f58422c45259fb48136fbd7bcc1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/****************************************************************************** | ||
Copyright(c) 2005 Intel Corporation. All rights reserved. | ||
This program is free software; you can redistribute it and/or modify it | ||
under the terms of version 2 of the GNU General Public License as | ||
published by the Free Software Foundation. | ||
This program is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
more details. | ||
You should have received a copy of the GNU General Public License along with | ||
this program; if not, write to the Free Software Foundation, Inc., 59 | ||
Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
The full GNU General Public License is included in this distribution in the | ||
file called LICENSE. | ||
Contact Information: | ||
James P. Ketrenos <ipw2100-admin@linux.intel.com> | ||
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||
******************************************************************************/ | ||
#include <linux/compiler.h> | ||
#include <linux/config.h> | ||
#include <linux/errno.h> | ||
#include <linux/if_arp.h> | ||
#include <linux/in6.h> | ||
#include <linux/in.h> | ||
#include <linux/ip.h> | ||
#include <linux/kernel.h> | ||
#include <linux/module.h> | ||
#include <linux/netdevice.h> | ||
#include <linux/proc_fs.h> | ||
#include <linux/skbuff.h> | ||
#include <linux/slab.h> | ||
#include <linux/tcp.h> | ||
#include <linux/types.h> | ||
#include <linux/version.h> | ||
#include <linux/wireless.h> | ||
#include <linux/etherdevice.h> | ||
#include <asm/uaccess.h> | ||
|
||
#include <net/ieee80211.h> | ||
|
||
int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel) | ||
{ | ||
int i; | ||
|
||
/* Driver needs to initialize the geography map before using | ||
* these helper functions */ | ||
BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
|
||
if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
for (i = 0; i < ieee->geo.bg_channels; i++) | ||
/* NOTE: If G mode is currently supported but | ||
* this is a B only channel, we don't see it | ||
* as valid. */ | ||
if ((ieee->geo.bg[i].channel == channel) && | ||
(!(ieee->mode & IEEE_G) || | ||
!(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) | ||
return IEEE80211_24GHZ_BAND; | ||
|
||
if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
for (i = 0; i < ieee->geo.a_channels; i++) | ||
if (ieee->geo.a[i].channel == channel) | ||
return IEEE80211_52GHZ_BAND; | ||
|
||
return 0; | ||
} | ||
|
||
int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel) | ||
{ | ||
int i; | ||
|
||
/* Driver needs to initialize the geography map before using | ||
* these helper functions */ | ||
BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
|
||
if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
for (i = 0; i < ieee->geo.bg_channels; i++) | ||
if (ieee->geo.bg[i].channel == channel) | ||
return i; | ||
|
||
if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
for (i = 0; i < ieee->geo.a_channels; i++) | ||
if (ieee->geo.a[i].channel == channel) | ||
return i; | ||
|
||
return -1; | ||
} | ||
|
||
u8 ieee80211_freq_to_channel(struct ieee80211_device * ieee, u32 freq) | ||
{ | ||
int i; | ||
|
||
/* Driver needs to initialize the geography map before using | ||
* these helper functions */ | ||
BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); | ||
|
||
freq /= 100000; | ||
|
||
if (ieee->freq_band & IEEE80211_24GHZ_BAND) | ||
for (i = 0; i < ieee->geo.bg_channels; i++) | ||
if (ieee->geo.bg[i].freq == freq) | ||
return ieee->geo.bg[i].channel; | ||
|
||
if (ieee->freq_band & IEEE80211_52GHZ_BAND) | ||
for (i = 0; i < ieee->geo.a_channels; i++) | ||
if (ieee->geo.a[i].freq == freq) | ||
return ieee->geo.a[i].channel; | ||
|
||
return 0; | ||
} | ||
|
||
int ieee80211_set_geo(struct ieee80211_device *ieee, | ||
const struct ieee80211_geo *geo) | ||
{ | ||
memcpy(ieee->geo.name, geo->name, 3); | ||
ieee->geo.name[3] = '\0'; | ||
ieee->geo.bg_channels = geo->bg_channels; | ||
ieee->geo.a_channels = geo->a_channels; | ||
memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * | ||
sizeof(struct ieee80211_channel)); | ||
memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * | ||
sizeof(struct ieee80211_channel)); | ||
return 0; | ||
} | ||
|
||
const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee) | ||
{ | ||
return &ieee->geo; | ||
} | ||
|
||
EXPORT_SYMBOL(ieee80211_is_valid_channel); | ||
EXPORT_SYMBOL(ieee80211_freq_to_channel); | ||
EXPORT_SYMBOL(ieee80211_channel_to_index); | ||
EXPORT_SYMBOL(ieee80211_set_geo); | ||
EXPORT_SYMBOL(ieee80211_get_geo); |