* [PATCH 3/7] d80211: report supported rates and channels in SIOCGIWRANGE
@ 2006-08-28 20:47 mabbas
0 siblings, 0 replies; only message in thread
From: mabbas @ 2006-08-28 20:47 UTC (permalink / raw)
To: netdev; +Cc: jbenc
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: d80211-wrange.patch --]
[-- Type: text/x-patch, Size: 2015 bytes --]
This patch modify d80211 to report more information like supported
rate and channel in SIOCGIWRANGE command.
Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 89a58e3..3d8156c 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -1566,6 +1566,10 @@ static int ieee80211_ioctl_giwrange(stru
struct iw_point *data, char *extra)
{
struct iw_range *range = (struct iw_range *) extra;
+ int i,j,c,n;
+ int skip = 0;
+ struct ieee80211_local *local = dev->ieee80211_ptr;
+ struct ieee80211_hw_modes *bg = NULL;
data->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
@@ -1581,6 +1585,55 @@ static int ieee80211_ioctl_giwrange(stru
range->min_frag = 256;
range->max_frag = 2346;
+ j = 0;
+ for (i = 0; i < local->num_curr_rates && j < IW_MAX_BITRATES; i++) {
+ struct ieee80211_rate *rate = &local->curr_rates[i];
+
+ if (rate->flags & IEEE80211_RATE_SUPPORTED) {
+ range->bitrate[j] = rate->rate * 100000;
+ j++;
+ }
+ }
+ range->num_bitrates = j;
+
+ c = 0;
+ for (i = 0; i < local->hw->num_modes; i++) {
+ struct ieee80211_hw_modes *mode = &local->hw->modes[i];
+
+ for (j = 0;
+ j < mode->num_channels && c < IW_MAX_FREQUENCIES; j++) {
+ struct ieee80211_channel *chan = &mode->channels[j];
+
+ /* skip any repeated bg channel */
+ skip = 0;
+ if (bg &&
+ ((mode->mode == MODE_IEEE80211G) ||
+ (mode->mode == MODE_IEEE80211B))) {
+
+ for (n = 0; n < bg->num_channels; n++) {
+ if (bg->channels[0].chan == chan->chan){
+ skip = 1;
+ break;
+ }
+ }
+ }
+
+ if (skip)
+ continue;
+
+ range->freq[c].i = chan->chan;
+ range->freq[c].m = chan->freq * 100000;
+ range->freq[c].e = 1;
+ c++;
+ }
+ if (!bg && ((mode->mode == MODE_IEEE80211G) ||
+ (mode->mode == MODE_IEEE80211B)))
+ bg = mode;
+
+ }
+ range->num_channels = c;
+ range->num_frequency = c;
+
return 0;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-28 20:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 20:47 [PATCH 3/7] d80211: report supported rates and channels in SIOCGIWRANGE mabbas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).