linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mac80211_hwsim: Group radios
@ 2009-05-17 18:19 Daniel Wagner
  2009-05-17 20:59 ` Luis R. Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Wagner @ 2009-05-17 18:19 UTC (permalink / raw)
  To: linux-wireless

Currently all radios receive all traffic on the simulated air
if they are tuned to the same channel. This patch introduces
the concept of grouping, which allows to assign a radio to
certain group. Only radios in the same group can 'see' each other.

Each bit in /debug/ieee80211/phy*/hwsim/group
represents one group. By default all radios belong to the same group "1",
e.g. bit 1 is set. Additionally a radio can belong to several groups.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
v2: Explain the patch a bit better in the commit message.

 drivers/net/wireless/mac80211_hwsim.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 61a4ad7..58fd29e 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -291,6 +291,9 @@ struct mac80211_hwsim_data {
 	bool ps_poll_pending;
 	struct dentry *debugfs;
 	struct dentry *debugfs_ps;
+
+	u64 group;
+	struct dentry *debugfs_group;
 };
 
 
@@ -412,7 +415,8 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
 
 		if (!data2->started || !data2->radio_enabled ||
 		    !hwsim_ps_rx_ok(data2, skb) ||
-		    data->channel->center_freq != data2->channel->center_freq)
+		    data->channel->center_freq != data2->channel->center_freq ||
+		    !(data->group & data2->group))
 			continue;
 
 		nskb = skb_copy(skb, GFP_ATOMIC);
@@ -720,6 +724,7 @@ static void mac80211_hwsim_free(void)
 	spin_unlock_bh(&hwsim_radio_lock);
 
 	list_for_each_entry(data, &tmplist, list) {
+		debugfs_remove(data->debugfs_group);
 		debugfs_remove(data->debugfs_ps);
 		debugfs_remove(data->debugfs);
 		ieee80211_unregister_hw(data->hw);
@@ -872,6 +877,24 @@ DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write,
 			"%llu\n");
 
 
+static int hwsim_fops_group_read(void *dat, u64 *val)
+{
+	struct mac80211_hwsim_data *data = dat;
+	*val = data->group;
+	return 0;
+}
+
+static int hwsim_fops_group_write(void *dat, u64 val)
+{
+	struct mac80211_hwsim_data *data = dat;
+	data->group = val;
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_group,
+			hwsim_fops_group_read, hwsim_fops_group_write,
+			"%llx\n");
+
 static int __init init_mac80211_hwsim(void)
 {
 	int i, err = 0;
@@ -976,6 +999,8 @@ static int __init init_mac80211_hwsim(void)
 
 			hw->wiphy->bands[band] = sband;
 		}
+		/* By default all radios are belonging to the first group */
+		data->group = 1;
 
 		/* Work to be done prior to ieee80211_register_hw() */
 		switch (regtest) {
@@ -1100,6 +1125,9 @@ static int __init init_mac80211_hwsim(void)
 		data->debugfs_ps = debugfs_create_file("ps", 0666,
 						       data->debugfs, data,
 						       &hwsim_fops_ps);
+		data->debugfs_group = debugfs_create_file("group", 0666,
+							data->debugfs, data,
+							&hwsim_fops_group);
 
 		setup_timer(&data->beacon_timer, mac80211_hwsim_beacon,
 			    (unsigned long) hw);
-- 
1.6.2.4


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

* Re: [PATCH v2] mac80211_hwsim: Group radios
  2009-05-17 18:19 [PATCH v2] mac80211_hwsim: Group radios Daniel Wagner
@ 2009-05-17 20:59 ` Luis R. Rodriguez
  2009-05-18 17:45   ` Daniel Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: Luis R. Rodriguez @ 2009-05-17 20:59 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: linux-wireless

On Sun, May 17, 2009 at 11:19 AM, Daniel Wagner <wagi@monom.org> wrote:
> Currently all radios receive all traffic on the simulated air
> if they are tuned to the same channel. This patch introduces
> the concept of grouping, which allows to assign a radio to
> certain group. Only radios in the same group can 'see' each other.
>
> Each bit in /debug/ieee80211/phy*/hwsim/group
> represents one group. By default all radios belong to the same group "1",
> e.g. bit 1 is set. Additionally a radio can belong to several groups.
>
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
> v2: Explain the patch a bit better in the commit message.
>
>  drivers/net/wireless/mac80211_hwsim.c |   30 +++++++++++++++++++++++++++++-
>  1 files changed, 29 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index 61a4ad7..58fd29e 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -291,6 +291,9 @@ struct mac80211_hwsim_data {
>        bool ps_poll_pending;
>        struct dentry *debugfs;
>        struct dentry *debugfs_ps;

How about some

/*
  * comments heres explaining what a group is too
  * otherwise one will have to guess by looking at the code
  */
> +
> +       u64 group;
> +       struct dentry *debugfs_group;
>  };
>
>
> @@ -412,7 +415,8 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
>
>                if (!data2->started || !data2->radio_enabled ||
>                    !hwsim_ps_rx_ok(data2, skb) ||
> -                   data->channel->center_freq != data2->channel->center_freq)
> +                   data->channel->center_freq != data2->channel->center_freq ||
> +                   !(data->group & data2->group))
>                        continue;
>
>                nskb = skb_copy(skb, GFP_ATOMIC);
> @@ -720,6 +724,7 @@ static void mac80211_hwsim_free(void)
>        spin_unlock_bh(&hwsim_radio_lock);
>
>        list_for_each_entry(data, &tmplist, list) {
> +               debugfs_remove(data->debugfs_group);
>                debugfs_remove(data->debugfs_ps);
>                debugfs_remove(data->debugfs);
>                ieee80211_unregister_hw(data->hw);
> @@ -872,6 +877,24 @@ DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write,
>                        "%llu\n");
>
>
> +static int hwsim_fops_group_read(void *dat, u64 *val)
> +{
> +       struct mac80211_hwsim_data *data = dat;
> +       *val = data->group;
> +       return 0;
> +}
> +
> +static int hwsim_fops_group_write(void *dat, u64 val)
> +{
> +       struct mac80211_hwsim_data *data = dat;
> +       data->group = val;
> +       return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_group,
> +                       hwsim_fops_group_read, hwsim_fops_group_write,
> +                       "%llx\n");
> +
>  static int __init init_mac80211_hwsim(void)
>  {
>        int i, err = 0;
> @@ -976,6 +999,8 @@ static int __init init_mac80211_hwsim(void)
>
>                        hw->wiphy->bands[band] = sband;
>                }
> +               /* By default all radios are belonging to the first group */
> +               data->group = 1;
>
>                /* Work to be done prior to ieee80211_register_hw() */
>                switch (regtest) {
> @@ -1100,6 +1125,9 @@ static int __init init_mac80211_hwsim(void)
>                data->debugfs_ps = debugfs_create_file("ps", 0666,
>                                                       data->debugfs, data,
>                                                       &hwsim_fops_ps);
> +               data->debugfs_group = debugfs_create_file("group", 0666,
> +                                                       data->debugfs, data,
> +                                                       &hwsim_fops_group);
>
>                setup_timer(&data->beacon_timer, mac80211_hwsim_beacon,
>                            (unsigned long) hw);
> --
> 1.6.2.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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] 3+ messages in thread

* Re: [PATCH v2] mac80211_hwsim: Group radios
  2009-05-17 20:59 ` Luis R. Rodriguez
@ 2009-05-18 17:45   ` Daniel Wagner
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Wagner @ 2009-05-18 17:45 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless

Hi Luis,

> How about some
> 
> /*
>   * comments heres explaining what a group is too
>   * otherwise one will have to guess by looking at the code
>   */
> > +
> > +       u64 group;
> > +       struct dentry *debugfs_group;
> >  };
> >
> >

Sure. I should have known :) A update is on the way.

thanks!
daniel

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

end of thread, other threads:[~2009-05-18 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-17 18:19 [PATCH v2] mac80211_hwsim: Group radios Daniel Wagner
2009-05-17 20:59 ` Luis R. Rodriguez
2009-05-18 17:45   ` Daniel Wagner

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).