From: Johannes Berg <johannes@sipsolutions.net>
To: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Cc: linux-wireless@vger.kernel.org, victorg@ti.com,
linville@tuxdriver.com, kgiori@qca.qualcomm.com,
zefir.kurtisi@neratec.com, adrian@freebsd.org, j@w1.fi,
coelho@ti.com, igalc@ti.com, nbd@nbd.name,
mathias.kretschmer@fokus.fraunhofer.de,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: Re: [PATCHv8 1/3] nl80211/cfg80211: add radar detection command/event
Date: Wed, 06 Feb 2013 18:24:08 +0100 [thread overview]
Message-ID: <1360171448.7910.43.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1359982200-2321-2-git-send-email-siwu@hrz.tu-chemnitz.de>
On Mon, 2013-02-04 at 13:49 +0100, Simon Wunderlich wrote:
> /**
> + * cfg80211_chandef_dfs_required - checks if radar detection
> + * is required on any of the channels
pretty sure this isn't valid kernel-doc, I think it has to fit into one
line
> @@ -3663,6 +3694,21 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
> gfp_t gfp);
>
> /**
> + * cfg80211_radar_event - radar detection event
> + * @dev: network device
> + * @chandef: chandef for the current channel
> + * @event: type of event
> + * @gfp: context flags
> + *
> + * This function is called when a radar is detected or a CAC event occured
occurred :)
> @@ -2014,6 +2029,7 @@ enum nl80211_band_attr {
> * (100 * dBm).
> * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
> * currently defined
> + * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS
missed docs for _DFS_TIME, maybe should put it before _MAX :)
also, what values does this take?
> +/**
> + * enum nl80211_dfs_state - DFS states for channels
> + *
> + * Channel states used by the DFS code.
> + *
> + * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability
> + * check (CAC) must be performed before using it for AP or IBSS.
> + * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
> + * is therefore marked as not available.
> + * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
> + */
> +
> +enum nl80211_dfs_state {
> + NL80211_DFS_USABLE = 0,
I don't really see a reason for explicit values?
> +static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)
no need for inline
> +int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
> + const struct cfg80211_chan_def *chandef)
> +{
> + int width;
> + int r;
> +
> + if (WARN_ON(!cfg80211_chandef_valid(chandef)))
> + return -EINVAL;
> +
> + width = cfg80211_chandef_get_width(chandef);
> + if (width < 0)
> + return -EINVAL;
> +
> + r = cfg80211_get_chans_dfs_required(wiphy, chandef->center_freq1,
> + width);
> + if (r)
> + return r;
> +
> + if (!chandef->center_freq2)
> + return 0;
> +
> + return cfg80211_get_chans_dfs_required(wiphy, chandef->center_freq2,
> + width);
> +}
If you don't export it why is it in the public header file -- either you
need to export it as well or it doesn't need to be in cfg80211.h :)
> @@ -454,6 +462,16 @@ cfg80211_can_use_chan(struct cfg80211_registered_device *rdev,
> chan, chanmode, 0);
> }
>
> +static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
> +{
> + unsigned long end = jiffies;
> +
> + if (end >= start)
> + return jiffies_to_msecs(end - start);
> +
> + return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1);
> +}
That seems a bit magic, like it should be hidden away in jiffies.h. Is
there really no function already to do something like this?
> +static void cfg80211_notify_nop_ended(struct cfg80211_registered_device *rdev,
> + struct ieee80211_channel *c)
indentation :)
> +{
> + struct wireless_dev *wdev;
> + struct cfg80211_chan_def chandef;
> +
> + cfg80211_chandef_create(&chandef, c, NL80211_CHAN_NO_HT);
> +
> + mutex_lock(&rdev->devlist_mtx);
> + list_for_each_entry(wdev, &rdev->wdev_list, list) {
> + if (!wdev->netdev)
> + continue;
> +
> + if (!netif_running(wdev->netdev))
> + continue;
> +
> + nl80211_radar_notify(rdev, &chandef,
> + NL80211_RADAR_NOP_FINISHED,
> + wdev->netdev, GFP_ATOMIC);
> + }
Why for all interfaces? This is multicast anyway, so why not just send
the event without an interface index instead?
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -1155,16 +1155,6 @@ static void ieee80211_scan_add_ies(struct iw_request_info *info,
> }
> }
>
> -static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
> -{
> - unsigned long end = jiffies;
> -
> - if (end >= start)
> - return jiffies_to_msecs(end - start);
> -
> - return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1);
> -}
Oh, heh. Oh well ...
I think I should probably look at locking too ...
johannes
next prev parent reply other threads:[~2013-02-06 17:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 12:49 [PATCHv8 0/3] Add DFS master ability Simon Wunderlich
2013-02-04 12:49 ` [PATCHv8 1/3] nl80211/cfg80211: add radar detection command/event Simon Wunderlich
2013-02-06 17:24 ` Johannes Berg [this message]
2013-02-07 11:00 ` Simon Wunderlich
2013-02-07 11:07 ` Johannes Berg
2013-02-04 12:49 ` [PATCHv8 2/3] mac80211: " Simon Wunderlich
2013-02-06 17:33 ` Johannes Berg
2013-02-07 11:08 ` Simon Wunderlich
2013-02-06 17:36 ` Johannes Berg
2013-02-07 11:10 ` Simon Wunderlich
2013-02-04 12:49 ` [PATCHv8 3/3] nl80211: allow DFS in start_ap Simon Wunderlich
2013-02-06 17:36 ` Johannes Berg
2013-02-07 11:11 ` Simon Wunderlich
2013-02-04 12:49 ` [PATCH 1/2] iw: add radar detect widths to phy info Simon Wunderlich
2013-02-04 12:50 ` [PATCH 2/2] iw: print DFS states for channels if available Simon Wunderlich
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=1360171448.7910.43.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=adrian@freebsd.org \
--cc=coelho@ti.com \
--cc=igalc@ti.com \
--cc=j@w1.fi \
--cc=kgiori@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mathias.kretschmer@fokus.fraunhofer.de \
--cc=nbd@nbd.name \
--cc=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=siwu@hrz.tu-chemnitz.de \
--cc=victorg@ti.com \
--cc=zefir.kurtisi@neratec.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox