2010-04-22 08:04:17

by Joerg

[permalink] [raw]
Subject: Re: [RFC] mac80211: sample survey implementation for mac80211 & hwsim

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);
> +}
> +




2010-05-26 20:43:32

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC] mac80211: sample survey implementation for mac80211 &amp; hwsim

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


2010-06-29 19:15:15

by John W. Linville

[permalink] [raw]
Subject: [PATCH] mac80211: add basic tracing to drv_get_survey

Reported-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
---
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


2010-06-29 19:15:15

by John W. Linville

[permalink] [raw]
Subject: [PATCH] mac80211: remove unnecessary check in ieee80211_dump_survey

This check is duplicated in drv_get_survey.

Reported-by: Johannes Berg <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
---
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