From: Luca Coelho <luca@coelho.fi>
To: Eliad Peller <eliad@wizery.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Johannes Berg <johannes@sipsolutions.net>,
Michal Kazior <michal.kazior@tieto.com>,
sw@simonwunderlich.de, andrei.otcheretianski@intel.com
Subject: Re: [PATCH v9 2/5] cfg80211/mac80211: refactor cfg80211_chandef_dfs_required()
Date: Tue, 11 Mar 2014 15:40:41 +0200 [thread overview]
Message-ID: <1394545241.19973.16.camel@dubbel> (raw)
In-Reply-To: <CAB3XZEeEM_cH=+PN-cRm884RYyka+uVsJFvQiBdWaWNmL7U1bA@mail.gmail.com>
On Tue, 2014-03-11 at 12:45 +0200, Eliad Peller wrote:
> On Mon, Mar 10, 2014 at 11:31 PM, Luciano Coelho
> <luciano.coelho@intel.com> wrote:
> > Some interface types don't require DFS (such as STATION, P2P_CLIENT
> > etc). In order to centralize these decisions, make
> > cfg80211_chandef_dfs_required() take the iftype into consideration.
> >
> > Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
> > ---
> [...]
>
> > int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
> > - const struct cfg80211_chan_def *chandef)
> > + const struct cfg80211_chan_def *chandef,
> > + enum nl80211_iftype iftype)
> > {
> > int width;
> > - int r;
> > + int ret;
> >
> > if (WARN_ON(!cfg80211_chandef_valid(chandef)))
> > return -EINVAL;
> >
> > - width = cfg80211_chandef_get_width(chandef);
> > - if (width < 0)
> > - return -EINVAL;
> > + switch (iftype) {
> > + case NL80211_IFTYPE_ADHOC:
> > + case NL80211_IFTYPE_AP:
> > + case NL80211_IFTYPE_P2P_GO:
> > + case NL80211_IFTYPE_MESH_POINT:
> > + width = cfg80211_chandef_get_width(chandef);
> > + if (width < 0)
> > + return -EINVAL;
> >
> it's a matter of style, but i think bailing out in non-relevant cases
> and taking the code out of the switch looks better (less indentation,
> etc.).
Yeah, it's a style issue and I tend to agree with you. But I also think
it's good to have a switch where we can easily see what happens with
each interface type.
I won't change this now, but we can refactor this at a later point if it
starts getting annoying. ;)
> [...]
>
> > + case NL80211_IFTYPE_STATION:
> > + case NL80211_IFTYPE_P2P_CLIENT:
> > + case NL80211_IFTYPE_MONITOR:
> > + case NL80211_IFTYPE_AP_VLAN:
> > + case NL80211_IFTYPE_WDS:
> > + case NL80211_IFTYPE_P2P_DEVICE:
> > + break;
> > + case NL80211_IFTYPE_UNSPECIFIED:
> > + case NUM_NL80211_IFTYPES:
> > + WARN_ON(1);
> > + }
>
> [...]
>
> > @@ -671,7 +700,8 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
> > - if (cfg80211_chandef_dfs_required(wiphy, chandef) > 0 &&
> > + if (cfg80211_chandef_dfs_required(wiphy, chandef,
> > + NL80211_IFTYPE_UNSPECIFIED) > 0 &&
> wouldn't this WARN_ON()?
Yep, you're right. Previously I was calling this and I didn't really
care what was the interface type. But Johannes asked me to change the
cfg80211_dfs_required() code to warn if unspecified was passed and I
forgot to change it here. I'll either have to add the iftype to the
cfg80211_reg_can_beacon() function arguments (which is a bit ugly,
because it's not really needed) or I'll have to move the UNSPECIFIED to
some sort of "don't care" in the cfg80211_chandef_dfs_required()
function.
> > @@ -5796,7 +5799,8 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
> > if (wdev->cac_started)
> > return -EBUSY;
> >
> > - err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef);
> > + err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef,
> > + NL80211_IFTYPE_UNSPECIFIED);
> ditto.
Ditto. :)
--
Cheers,
Luca.
next prev parent reply other threads:[~2014-03-11 13:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 21:31 [PATCH v9 0/5] cfg80211/mac80211: move interface combinations check to mac80211 Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 1/5] cfg80211: refactor cfg80211_can_use_iftype_chan() Luciano Coelho
2014-03-11 10:40 ` Eliad Peller
2014-03-11 13:09 ` Luca Coelho
2014-03-10 21:31 ` [PATCH v9 2/5] cfg80211/mac80211: refactor cfg80211_chandef_dfs_required() Luciano Coelho
2014-03-11 10:45 ` Eliad Peller
2014-03-11 13:40 ` Luca Coelho [this message]
2014-03-10 21:31 ` [PATCH v9 3/5] cfg80211/mac80211: move interface counting for combination check to mac80211 Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 4/5] cfg80211/mac80211: move combination check to mac80211 for ibss Luciano Coelho
2014-03-10 21:31 ` [PATCH v9 5/5] cfg80211/mac80211: move more combination checks to mac80211 Luciano Coelho
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=1394545241.19973.16.camel@dubbel \
--to=luca@coelho.fi \
--cc=andrei.otcheretianski@intel.com \
--cc=eliad@wizery.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=michal.kazior@tieto.com \
--cc=sw@simonwunderlich.de \
/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