All of lore.kernel.org
 help / color / mirror / Atom feed
From: mabbas <mabbas@linux.intel.com>
To: netdev@vger.kernel.org
Cc: jbenc@suse.cz
Subject: [PATCH 3/7] d80211: report supported rates and channels in SIOCGIWRANGE
Date: Mon, 28 Aug 2006 13:47:34 -0700	[thread overview]
Message-ID: <44F35666.3070503@linux.intel.com> (raw)

[-- 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;
 }
 

                 reply	other threads:[~2006-08-28 20:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44F35666.3070503@linux.intel.com \
    --to=mabbas@linux.intel.com \
    --cc=jbenc@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.