All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211_hwsim: add support for 5 GHz
@ 2009-03-06  5:13 Luis R. Rodriguez
  2009-03-06  5:13 ` [PATCH 2/2] mac80211_hwsim: add regulatory_hint support Luis R. Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2009-03-06  5:13 UTC (permalink / raw)
  To: j, linville; +Cc: Luis R. Rodriguez, linux-wireless

ACME Inc. is now selling a dual band radio.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/mac80211_hwsim.c |  138 ++++++++++++++++++++++++---------
 1 files changed, 102 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index fce49ba..d8716be 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -10,7 +10,6 @@
 /*
  * TODO:
  * - IBSS mode simulation (Beacon transmission with competition for "air time")
- * - IEEE 802.11a and 802.11n modes
  * - RX filtering based on filter configuration (data->rx_filter)
  */
 
@@ -86,22 +85,65 @@ static struct class *hwsim_class;
 
 static struct net_device *hwsim_mon; /* global monitor netdev */
 
+#define CHAN2G(_freq)  { \
+	.band = IEEE80211_BAND_2GHZ, \
+	.center_freq = (_freq), \
+	.hw_value = (_freq), \
+	.max_power = 20, \
+}
+
+#define CHAN5G(_freq) { \
+	.band = IEEE80211_BAND_5GHZ, \
+	.center_freq = (_freq), \
+	.hw_value = (_freq), \
+	.max_power = 20, \
+}
+
+static const struct ieee80211_channel hwsim_channels_2ghz[] = {
+	CHAN2G(2412), /* Channel 1 */
+	CHAN2G(2417), /* Channel 2 */
+	CHAN2G(2422), /* Channel 3 */
+	CHAN2G(2427), /* Channel 4 */
+	CHAN2G(2432), /* Channel 5 */
+	CHAN2G(2437), /* Channel 6 */
+	CHAN2G(2442), /* Channel 7 */
+	CHAN2G(2447), /* Channel 8 */
+	CHAN2G(2452), /* Channel 9 */
+	CHAN2G(2457), /* Channel 10 */
+	CHAN2G(2462), /* Channel 11 */
+	CHAN2G(2467), /* Channel 12 */
+	CHAN2G(2472), /* Channel 13 */
+	CHAN2G(2484), /* Channel 14 */
+};
 
-static const struct ieee80211_channel hwsim_channels[] = {
-	{ .center_freq = 2412 },
-	{ .center_freq = 2417 },
-	{ .center_freq = 2422 },
-	{ .center_freq = 2427 },
-	{ .center_freq = 2432 },
-	{ .center_freq = 2437 },
-	{ .center_freq = 2442 },
-	{ .center_freq = 2447 },
-	{ .center_freq = 2452 },
-	{ .center_freq = 2457 },
-	{ .center_freq = 2462 },
-	{ .center_freq = 2467 },
-	{ .center_freq = 2472 },
-	{ .center_freq = 2484 },
+static const struct ieee80211_channel hwsim_channels_5ghz[] = {
+	CHAN5G(5180), /* Channel 36 */
+	CHAN5G(5200), /* Channel 40 */
+	CHAN5G(5220), /* Channel 44 */
+	CHAN5G(5240), /* Channel 48 */
+
+	CHAN5G(5260), /* Channel 52 */
+	CHAN5G(5280), /* Channel 56 */
+	CHAN5G(5300), /* Channel 60 */
+	CHAN5G(5320), /* Channel 64 */
+
+	CHAN5G(5500), /* Channel 100 */
+	CHAN5G(5520), /* Channel 104 */
+	CHAN5G(5540), /* Channel 108 */
+	CHAN5G(5560), /* Channel 112 */
+	CHAN5G(5580), /* Channel 116 */
+	CHAN5G(5600), /* Channel 120 */
+	CHAN5G(5620), /* Channel 124 */
+	CHAN5G(5640), /* Channel 128 */
+	CHAN5G(5660), /* Channel 132 */
+	CHAN5G(5680), /* Channel 136 */
+	CHAN5G(5700), /* Channel 140 */
+
+	CHAN5G(5745), /* Channel 149 */
+	CHAN5G(5765), /* Channel 153 */
+	CHAN5G(5785), /* Channel 157 */
+	CHAN5G(5805), /* Channel 161 */
+	CHAN5G(5825), /* Channel 165 */
 };
 
 static const struct ieee80211_rate hwsim_rates[] = {
@@ -126,8 +168,9 @@ struct mac80211_hwsim_data {
 	struct list_head list;
 	struct ieee80211_hw *hw;
 	struct device *dev;
-	struct ieee80211_supported_band band;
-	struct ieee80211_channel channels[ARRAY_SIZE(hwsim_channels)];
+	struct ieee80211_supported_band bands[2];
+	struct ieee80211_channel channels_2ghz[ARRAY_SIZE(hwsim_channels_2ghz)];
+	struct ieee80211_channel channels_5ghz[ARRAY_SIZE(hwsim_channels_5ghz)];
 	struct ieee80211_rate rates[ARRAY_SIZE(hwsim_rates)];
 
 	struct ieee80211_channel *channel;
@@ -728,6 +771,7 @@ static int __init init_mac80211_hwsim(void)
 	u8 addr[ETH_ALEN];
 	struct mac80211_hwsim_data *data;
 	struct ieee80211_hw *hw;
+	enum ieee80211_band band;
 
 	if (radios < 1 || radios > 100)
 		return -EINVAL;
@@ -785,25 +829,47 @@ static int __init init_mac80211_hwsim(void)
 		hw->vif_data_size = sizeof(struct hwsim_vif_priv);
 		hw->sta_data_size = sizeof(struct hwsim_sta_priv);
 
-		memcpy(data->channels, hwsim_channels, sizeof(hwsim_channels));
+		memcpy(data->channels_2ghz, hwsim_channels_2ghz,
+			sizeof(hwsim_channels_2ghz));
+		memcpy(data->channels_5ghz, hwsim_channels_5ghz,
+			sizeof(hwsim_channels_5ghz));
 		memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
-		data->band.channels = data->channels;
-		data->band.n_channels = ARRAY_SIZE(hwsim_channels);
-		data->band.bitrates = data->rates;
-		data->band.n_bitrates = ARRAY_SIZE(hwsim_rates);
-		data->band.ht_cap.ht_supported = true;
-		data->band.ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
-			IEEE80211_HT_CAP_GRN_FLD |
-			IEEE80211_HT_CAP_SGI_40 |
-			IEEE80211_HT_CAP_DSSSCCK40;
-		data->band.ht_cap.ampdu_factor = 0x3;
-		data->band.ht_cap.ampdu_density = 0x6;
-		memset(&data->band.ht_cap.mcs, 0,
-		       sizeof(data->band.ht_cap.mcs));
-		data->band.ht_cap.mcs.rx_mask[0] = 0xff;
-		data->band.ht_cap.mcs.rx_mask[1] = 0xff;
-		data->band.ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
-		hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &data->band;
+
+		for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
+			struct ieee80211_supported_band *sband = &data->bands[band];
+			switch (band) {
+			case IEEE80211_BAND_2GHZ:
+				sband->channels = data->channels_2ghz;
+				sband->n_channels =
+					ARRAY_SIZE(hwsim_channels_2ghz);
+				break;
+			case IEEE80211_BAND_5GHZ:
+				sband->channels = data->channels_5ghz;
+				sband->n_channels =
+					ARRAY_SIZE(hwsim_channels_5ghz);
+				break;
+			default:
+				break;
+			}
+
+			sband->bitrates = data->rates;
+			sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
+
+			sband->ht_cap.ht_supported = true;
+			sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
+				IEEE80211_HT_CAP_GRN_FLD |
+				IEEE80211_HT_CAP_SGI_40 |
+				IEEE80211_HT_CAP_DSSSCCK40;
+			sband->ht_cap.ampdu_factor = 0x3;
+			sband->ht_cap.ampdu_density = 0x6;
+			memset(&sband->ht_cap.mcs, 0,
+			       sizeof(sband->ht_cap.mcs));
+			sband->ht_cap.mcs.rx_mask[0] = 0xff;
+			sband->ht_cap.mcs.rx_mask[1] = 0xff;
+			sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
+
+			hw->wiphy->bands[band] = sband;
+		}
 
 		err = ieee80211_register_hw(hw);
 		if (err < 0) {
-- 
1.6.1.2.253.ga34a


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mac80211_hwsim: add regulatory_hint support
  2009-03-06  5:13 [PATCH 1/2] mac80211_hwsim: add support for 5 GHz Luis R. Rodriguez
@ 2009-03-06  5:13 ` Luis R. Rodriguez
  2009-03-06 22:09   ` Luis R. Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2009-03-06  5:13 UTC (permalink / raw)
  To: j, linville; +Cc: Luis R. Rodriguez, linux-wireless

ACME Inc. only sells these in Finland.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/mac80211_hwsim.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index d8716be..395f13d 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -878,6 +878,12 @@ static int __init init_mac80211_hwsim(void)
 			goto failed_hw;
 		}
 
+		/*
+		 * We have no EEPROM but we know ACME Inc. only sells
+		 * these in Finland.
+		 */
+		regulatory_hint(hw->wiphy, "FI");
+
 		printk(KERN_DEBUG "%s: hwaddr %pM registered\n",
 		       wiphy_name(hw->wiphy),
 		       hw->wiphy->perm_addr);
-- 
1.6.1.2.253.ga34a


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mac80211_hwsim: add regulatory_hint support
  2009-03-06  5:13 ` [PATCH 2/2] mac80211_hwsim: add regulatory_hint support Luis R. Rodriguez
@ 2009-03-06 22:09   ` Luis R. Rodriguez
  2009-03-07  3:05     ` Luis R. Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2009-03-06 22:09 UTC (permalink / raw)
  To: j, linville; +Cc: Luis R. Rodriguez, linux-wireless

On Thu, Mar 5, 2009 at 9:13 PM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> ACME Inc. only sells these in Finland.

On second thought this is not such a good idea as simply loading it
would change your regulatory domain which is not the desired effect
for testing purposes. I will resend with some other things to avoid
undesired regulatory changes.

  Luis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mac80211_hwsim: add regulatory_hint support
  2009-03-06 22:09   ` Luis R. Rodriguez
@ 2009-03-07  3:05     ` Luis R. Rodriguez
  2009-03-07 19:25       ` John W. Linville
  0 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2009-03-07  3:05 UTC (permalink / raw)
  To: j, linville; +Cc: Luis R. Rodriguez, linux-wireless

On Fri, Mar 6, 2009 at 2:09 PM, Luis R. Rodriguez
<lrodriguez@atheros.com> wrote:
> On Thu, Mar 5, 2009 at 9:13 PM, Luis R. Rodriguez
> <lrodriguez@atheros.com> wrote:
>> ACME Inc. only sells these in Finland.
>
> On second thought this is not such a good idea as simply loading it
> would change your regulatory domain which is not the desired effect
> for testing purposes. I will resend with some other things to avoid
> undesired regulatory changes.

I see this was merged already - its ok, I'll just send a patch on top.

  Luis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mac80211_hwsim: add regulatory_hint support
  2009-03-07  3:05     ` Luis R. Rodriguez
@ 2009-03-07 19:25       ` John W. Linville
  2009-03-07 21:19         ` Luis R. Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: John W. Linville @ 2009-03-07 19:25 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: j, linux-wireless

On Fri, Mar 06, 2009 at 07:05:30PM -0800, Luis R. Rodriguez wrote:
> On Fri, Mar 6, 2009 at 2:09 PM, Luis R. Rodriguez
> <lrodriguez@atheros.com> wrote:
> > On Thu, Mar 5, 2009 at 9:13 PM, Luis R. Rodriguez
> > <lrodriguez@atheros.com> wrote:
> >> ACME Inc. only sells these in Finland.
> >
> > On second thought this is not such a good idea as simply loading it
> > would change your regulatory domain which is not the desired effect
> > for testing purposes. I will resend with some other things to avoid
> > undesired regulatory changes.
> 
> I see this was merged already - its ok, I'll just send a patch on top.

It is only in wireless-testing -- I can still drop the original
before sending to Dave.  So, it is probably best to just send a
replacement patch.

Thanks,

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mac80211_hwsim: add regulatory_hint support
  2009-03-07 19:25       ` John W. Linville
@ 2009-03-07 21:19         ` Luis R. Rodriguez
  0 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2009-03-07 21:19 UTC (permalink / raw)
  To: John W. Linville; +Cc: j, linux-wireless

On Sat, Mar 7, 2009 at 11:25 AM, John W. Linville
<linville@tuxdriver.com> wrote:
> On Fri, Mar 06, 2009 at 07:05:30PM -0800, Luis R. Rodriguez wrote:
>> On Fri, Mar 6, 2009 at 2:09 PM, Luis R. Rodriguez
>> <lrodriguez@atheros.com> wrote:
>> > On Thu, Mar 5, 2009 at 9:13 PM, Luis R. Rodriguez
>> > <lrodriguez@atheros.com> wrote:
>> >> ACME Inc. only sells these in Finland.
>> >
>> > On second thought this is not such a good idea as simply loading i=
t
>> > would change your regulatory domain which is not the desired effec=
t
>> > for testing purposes. I will resend with some other things to avoi=
d
>> > undesired regulatory changes.
>>
>> I see this was merged already - its ok, I'll just send a patch on to=
p.
>
> It is only in wireless-testing -- I can still drop the original
> before sending to Dave. =C2=A0So, it is probably best to just send a
> replacement patch.

Sure, thanks,

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-07 21:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-06  5:13 [PATCH 1/2] mac80211_hwsim: add support for 5 GHz Luis R. Rodriguez
2009-03-06  5:13 ` [PATCH 2/2] mac80211_hwsim: add regulatory_hint support Luis R. Rodriguez
2009-03-06 22:09   ` Luis R. Rodriguez
2009-03-07  3:05     ` Luis R. Rodriguez
2009-03-07 19:25       ` John W. Linville
2009-03-07 21:19         ` Luis R. Rodriguez

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.