* [RFC] mac80211: sample survey implementation for mac80211 & hwsim
@ 2010-04-19 8:23 Holger Schurig
2010-04-19 8:58 ` Holger Schurig
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Holger Schurig @ 2010-04-19 8:23 UTC (permalink / raw)
To: linux-wireless
This adds the survey function to both mac80211 itself and to mac80211_hwsim.
For the latter driver, we simply invent some noise level.A real driver which
cannot determine the real channel noise MUST NOT report any noise, especially
not a magically conjured one :-)
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
---
drivers/net/wireless/mac80211_hwsim.c | 28 ++++++++++++++++++++++++++++
include/net/mac80211.h | 3 ++-
net/mac80211/cfg.c | 12 ++++++++++++
net/mac80211/driver-ops.h | 9 +++++++++
4 files changed, 51 insertions(+), 1 deletion(-)
--- linux-wl.orig/include/net/mac80211.h
+++ linux-wl/include/net/mac80211.h
@@ -1673,7 +1673,8 @@ struct ieee80211_ops {
struct ieee80211_vif *vif,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta, u16 tid, u16 *ssn);
-
+ int (*get_survey)(struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey);
void (*rfkill_poll)(struct ieee80211_hw *hw);
void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
#ifdef CONFIG_NL80211_TESTMODE
--- linux-wl.orig/net/mac80211/cfg.c
+++ linux-wl/net/mac80211/cfg.c
@@ -411,6 +411,17 @@ static int ieee80211_dump_station(struct
return ret;
}
+static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
+ int idx, struct survey_info *survey)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+
+ if (!local->ops->get_survey)
+ return -EOPNOTSUPP;
+
+ return drv_get_survey(local, idx, survey);
+}
+
static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
u8 *mac, struct station_info *sinfo)
{
@@ -1508,6 +1519,7 @@ struct cfg80211_ops mac80211_config_ops
.change_station = ieee80211_change_station,
.get_station = ieee80211_get_station,
.dump_station = ieee80211_dump_station,
+ .dump_survey = ieee80211_dump_survey,
#ifdef CONFIG_MAC80211_MESH
.add_mpath = ieee80211_add_mpath,
.del_mpath = ieee80211_del_mpath,
--- linux-wl.orig/net/mac80211/driver-ops.h
+++ linux-wl/net/mac80211/driver-ops.h
@@ -346,6 +346,15 @@ static inline int drv_ampdu_action(struc
return ret;
}
+static inline int drv_get_survey(struct ieee80211_local *local, int idx,
+ struct survey_info *survey)
+{
+ int ret = -EOPNOTSUPP;
+ if (local->ops->conf_tx)
+ ret = local->ops->get_survey(&local->hw, idx, survey);
+ /* trace_drv_get_survey(local, idx, survey, ret); */
+ return ret;
+}
static inline void drv_rfkill_poll(struct ieee80211_local *local)
{
--- linux-wl.orig/drivers/net/wireless/mac80211_hwsim.c
+++ linux-wl/drivers/net/wireless/mac80211_hwsim.c
@@ -830,6 +830,33 @@ static int mac80211_hwsim_conf_tx(
return 0;
}
+static int mac80211_hwsim_get_survey(
+ struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey)
+{
+ struct ieee80211_conf *conf = &hw->conf;
+
+ printk(KERN_DEBUG "%s:%s (idx=%d)\n",
+ wiphy_name(hw->wiphy), __func__, idx);
+
+ if (idx != 0)
+ return -ENOENT;
+
+ /* Current channel */
+ survey->channel = conf->channel;
+
+ /*
+ * Magically conjured noise level --- this is only ok for simulated hardware.
+ *
+ * A real driver which cannot determine the real channel noise MUST NOT
+ * report any noise, especially not a magically conjured one :-)
+ */
+ survey->filled = SURVEY_INFO_NOISE_DBM;
+ survey->noise = -92;
+
+ return 0;
+}
+
#ifdef CONFIG_NL80211_TESTMODE
/*
* This section contains example code for using netlink
@@ -1013,6 +1040,7 @@ static struct ieee80211_ops mac80211_hws
.sta_notify = mac80211_hwsim_sta_notify,
.set_tim = mac80211_hwsim_set_tim,
.conf_tx = mac80211_hwsim_conf_tx,
+ .get_survey = mac80211_hwsim_get_survey,
CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
.ampdu_action = mac80211_hwsim_ampdu_action,
.sw_scan_start = mac80211_hwsim_sw_scan,
--
DH3HS, http://www.holgerschurig.de
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] mac80211: sample survey implementation for mac80211 & hwsim
2010-04-19 8:23 [RFC] mac80211: sample survey implementation for mac80211 & hwsim Holger Schurig
@ 2010-04-19 8:58 ` Holger Schurig
2010-04-19 9:02 ` Johannes Berg
2010-04-22 8:04 ` [RFC] mac80211: sample survey implementation for mac80211 & hwsim Joerg Pommnitz
2 siblings, 0 replies; 9+ messages in thread
From: Holger Schurig @ 2010-04-19 8:58 UTC (permalink / raw)
To: linux-wireless
Oh, that should have been [PATCH].
So much to copying subject lines from quilt patches without really reading.
--
DH3HS, http://www.holgerschurig.de
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] mac80211: sample survey implementation for mac80211 & hwsim
2010-04-19 8:23 [RFC] mac80211: sample survey implementation for mac80211 & hwsim Holger Schurig
2010-04-19 8:58 ` Holger Schurig
@ 2010-04-19 9:02 ` Johannes Berg
2010-04-22 8:04 ` [RFC] mac80211: sample survey implementation for mac80211 & hwsim Joerg Pommnitz
2 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2010-04-19 9:02 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless
How does this work with multiple channels? And how about knowing how old
the info is?
> +static inline int drv_get_survey(struct ieee80211_local *local, int idx,
> + struct survey_info *survey)
> +{
> + int ret = -EOPNOTSUPP;
> + if (local->ops->conf_tx)
> + ret = local->ops->get_survey(&local->hw, idx, survey);
> + /* trace_drv_get_survey(local, idx, survey, ret); */
Lazy huh? :)
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] mac80211: sample survey implementation for mac80211 & hwsim
2010-04-19 8:23 [RFC] mac80211: sample survey implementation for mac80211 & hwsim Holger Schurig
2010-04-19 8:58 ` Holger Schurig
2010-04-19 9:02 ` Johannes Berg
@ 2010-04-22 8:04 ` Joerg Pommnitz
2010-05-26 20:43 ` Johannes Berg
2 siblings, 1 reply; 9+ messages in thread
From: Joerg Pommnitz @ 2010-04-22 8:04 UTC (permalink / raw)
To: linux-wireless
Holger Schurig <holgerschurig@...> writes:
>
> +static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
> + int idx, struct survey_info *survey)
> +{
> + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> +
> + if (!local->ops->get_survey)
> + return -EOPNOTSUPP;
The check for the function is duplicated in drv_get_survey. I think the
wrapper should be called unconditionally.
> +
> + return drv_get_survey(local, idx, survey);
> +}
> +
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] mac80211: sample survey implementation for mac80211 & hwsim
2010-04-22 8:04 ` [RFC] mac80211: sample survey implementation for mac80211 & hwsim Joerg Pommnitz
@ 2010-05-26 20:43 ` Johannes Berg
2010-06-29 19:00 ` [PATCH] mac80211: remove unnecessary check in ieee80211_dump_survey John W. Linville
2010-06-29 19:00 ` [PATCH] mac80211: add basic tracing to drv_get_survey John W. Linville
0 siblings, 2 replies; 9+ messages in thread
From: Johannes Berg @ 2010-05-26 20:43 UTC (permalink / raw)
To: Joerg Pommnitz; +Cc: linux-wireless, Holger Schurig
Holger,
> > +static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
> > + int idx, struct survey_info *survey)
> > +{
> > + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
> > +
> > + if (!local->ops->get_survey)
> > + return -EOPNOTSUPP;
>
> The check for the function is duplicated in drv_get_survey. I think the
> wrapper should be called unconditionally.
Please address this comment and add tracing. Your patch was merged, so
that needs to be an add-on patch.
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] mac80211: remove unnecessary check in ieee80211_dump_survey
2010-05-26 20:43 ` Johannes Berg
@ 2010-06-29 19:00 ` John W. Linville
2010-06-29 19:00 ` [PATCH] mac80211: add basic tracing to drv_get_survey John W. Linville
1 sibling, 0 replies; 9+ messages in thread
From: John W. Linville @ 2010-06-29 19:00 UTC (permalink / raw)
To: linux-wireless; +Cc: Holger Schurig, Johannes Berg, John W. Linville
This check is duplicated in drv_get_survey.
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
net/mac80211/cfg.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f4efbfa..e55970b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -413,9 +413,6 @@ static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
- if (!local->ops->get_survey)
- return -EOPNOTSUPP;
-
return drv_get_survey(local, idx, survey);
}
--
1.7.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] mac80211: add basic tracing to drv_get_survey
2010-05-26 20:43 ` Johannes Berg
2010-06-29 19:00 ` [PATCH] mac80211: remove unnecessary check in ieee80211_dump_survey John W. Linville
@ 2010-06-29 19:00 ` John W. Linville
1 sibling, 0 replies; 9+ messages in thread
From: John W. Linville @ 2010-06-29 19:00 UTC (permalink / raw)
To: linux-wireless; +Cc: Holger Schurig, Johannes Berg, John W. Linville
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
net/mac80211/driver-ops.h | 7 ++++++-
net/mac80211/driver-trace.h | 22 ++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index c333173..14123dc 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -375,9 +375,14 @@ static inline int drv_get_survey(struct ieee80211_local *local, int idx,
struct survey_info *survey)
{
int ret = -EOPNOTSUPP;
+
+ trace_drv_get_survey(local, idx, survey);
+
if (local->ops->get_survey)
ret = local->ops->get_survey(&local->hw, idx, survey);
- /* trace_drv_get_survey(local, idx, survey, ret); */
+
+ trace_drv_return_int(local, ret);
+
return ret;
}
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 8da31ca..5d5d2a9 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -761,6 +761,28 @@ TRACE_EVENT(drv_ampdu_action,
)
);
+TRACE_EVENT(drv_get_survey,
+ TP_PROTO(struct ieee80211_local *local, int idx,
+ struct survey_info *survey),
+
+ TP_ARGS(local, idx, survey),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ __field(int, idx)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ __entry->idx = idx;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT " idx:%d",
+ LOCAL_PR_ARG, __entry->idx
+ )
+);
+
TRACE_EVENT(drv_flush,
TP_PROTO(struct ieee80211_local *local, bool drop),
--
1.7.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [RFC] mac80211: sample survey implementation for mac80211_hwsim
2009-11-10 16:23 [RFC] mac80211: sample survey implementation for mac80211_hwsim Holger Schurig
@ 2009-11-10 17:11 ` Johannes Berg
0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2009-11-10 17:11 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
On Tue, 2009-11-10 at 17:23 +0100, Holger Schurig wrote:
> This adds the survey function to both mac80211 itself and to mac80211_hwsim.
> For the latter driver, we simply invent some noise level.
I guess I'd prefer to keep that out for now until we have drivers that
do it and we know whether mac80211 should aggregate the information or
the driver needs to (like this patch requires).
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC] mac80211: sample survey implementation for mac80211_hwsim
@ 2009-11-10 16:23 Holger Schurig
2009-11-10 17:11 ` Johannes Berg
0 siblings, 1 reply; 9+ messages in thread
From: Holger Schurig @ 2009-11-10 16:23 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
This adds the survey function to both mac80211 itself and to mac80211_hwsim.
For the latter driver, we simply invent some noise level.
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
--- linux-wl.orig/include/net/mac80211.h
+++ linux-wl/include/net/mac80211.h
@@ -1507,7 +1507,8 @@
int (*ampdu_action)(struct ieee80211_hw *hw,
enum ieee80211_ampdu_mlme_action action,
struct ieee80211_sta *sta, u16 tid, u16 *ssn);
-
+ int (*get_survey)(struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey);
void (*rfkill_poll)(struct ieee80211_hw *hw);
#ifdef CONFIG_NL80211_TESTMODE
int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len);
--- linux-wl.orig/net/mac80211/cfg.c
+++ linux-wl/net/mac80211/cfg.c
@@ -395,6 +395,17 @@
return ret;
}
+static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,
+ int idx, struct survey_info *survey)
+{
+ struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+
+ if (!local->ops->get_survey)
+ return -EOPNOTSUPP;
+
+ return drv_get_survey(local, idx, survey);
+}
+
static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
u8 *mac, struct station_info *sinfo)
{
@@ -1375,6 +1386,7 @@
.change_station = ieee80211_change_station,
.get_station = ieee80211_get_station,
.dump_station = ieee80211_dump_station,
+ .dump_survey = ieee80211_dump_survey,
#ifdef CONFIG_MAC80211_MESH
.add_mpath = ieee80211_add_mpath,
.del_mpath = ieee80211_del_mpath,
--- linux-wl.orig/net/mac80211/driver-ops.h
+++ linux-wl/net/mac80211/driver-ops.h
@@ -251,6 +251,15 @@
return ret;
}
+static inline int drv_get_survey(struct ieee80211_local *local, int idx,
+ struct survey_info *survey)
+{
+ int ret = -EOPNOTSUPP;
+ if (local->ops->conf_tx)
+ ret = local->ops->get_survey(&local->hw, idx, survey);
+ /* trace_drv_get_survey(local, idx, survey, ret); */
+ return ret;
+}
static inline void drv_rfkill_poll(struct ieee80211_local *local)
{
--- linux-wl.orig/drivers/net/wireless/mac80211_hwsim.c
+++ linux-wl/drivers/net/wireless/mac80211_hwsim.c
@@ -759,6 +759,28 @@
return 0;
}
+static int mac80211_hwsim_get_survey(
+ struct ieee80211_hw *hw, int idx,
+ struct survey_info *survey)
+{
+ struct ieee80211_conf *conf = &hw->conf;
+
+ printk(KERN_DEBUG "%s:%s (idx=%d)\n",
+ wiphy_name(hw->wiphy), __func__, idx);
+
+ if (idx != 0)
+ return -ENOENT;
+
+ /* Current channel */
+ survey->channel = conf->channel;
+
+ /* Magically conjured noise level */
+ survey->filled = SURVEY_INFO_NOISE_DBM;
+ survey->noise = -92;
+
+ return 0;
+}
+
#ifdef CONFIG_NL80211_TESTMODE
/*
* This section contains example code for using netlink
@@ -840,6 +862,7 @@
.sta_notify = mac80211_hwsim_sta_notify,
.set_tim = mac80211_hwsim_set_tim,
.conf_tx = mac80211_hwsim_conf_tx,
+ .get_survey = mac80211_hwsim_get_survey,
CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd)
};
--
http://www.holgerschurig.de
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-06-29 19:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-19 8:23 [RFC] mac80211: sample survey implementation for mac80211 & hwsim Holger Schurig
2010-04-19 8:58 ` Holger Schurig
2010-04-19 9:02 ` Johannes Berg
2010-04-22 8:04 ` [RFC] mac80211: sample survey implementation for mac80211 & hwsim Joerg Pommnitz
2010-05-26 20:43 ` Johannes Berg
2010-06-29 19:00 ` [PATCH] mac80211: remove unnecessary check in ieee80211_dump_survey John W. Linville
2010-06-29 19:00 ` [PATCH] mac80211: add basic tracing to drv_get_survey John W. Linville
-- strict thread matches above, loose matches on Subject: below --
2009-11-10 16:23 [RFC] mac80211: sample survey implementation for mac80211_hwsim Holger Schurig
2009-11-10 17:11 ` Johannes Berg
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).