2016-11-17 09:10:35

by Arend Van Spriel

[permalink] [raw]
Subject: [PATCH 1/2] cfg80211: get rid of name indirection trick for ieee80211_get_channel()

The comment on the name indirection suggested an issue but turned out
to be untrue. Digging in older kernel version showed issue with ipw2x00
but that is no longer true so get rid on the name indirection.

Signed-off-by: Arend van Spriel <[email protected]>
---
include/net/cfg80211.h | 17 +++--------------
net/wireless/util.c | 5 ++---
2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 2019310..ef42749 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3955,26 +3955,15 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
*/
int ieee80211_frequency_to_channel(int freq);

-/*
- * Name indirection necessary because the ieee80211 code also has
- * a function named "ieee80211_get_channel", so if you include
- * cfg80211's header file you get cfg80211's version, if you try
- * to include both header files you'll (rightfully!) get a symbol
- * clash.
- */
-struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
- int freq);
/**
* ieee80211_get_channel - get channel struct from wiphy for specified frequency
+ *
* @wiphy: the struct wiphy to get the channel for
* @freq: the center frequency of the channel
+ *
* Return: The channel struct from @wiphy at @freq.
*/
-static inline struct ieee80211_channel *
-ieee80211_get_channel(struct wiphy *wiphy, int freq)
-{
- return __ieee80211_get_channel(wiphy, freq);
-}
+struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);

/**
* ieee80211_get_response_rate - get basic rate for a given rate
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 88725f8..f717694 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -114,8 +114,7 @@ int ieee80211_frequency_to_channel(int freq)
}
EXPORT_SYMBOL(ieee80211_frequency_to_channel);

-struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
- int freq)
+struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq)
{
enum nl80211_band band;
struct ieee80211_supported_band *sband;
@@ -135,7 +134,7 @@ struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,

return NULL;
}
-EXPORT_SYMBOL(__ieee80211_get_channel);
+EXPORT_SYMBOL(ieee80211_get_channel);

static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
enum nl80211_band band)
--
1.9.1


2016-11-21 12:48:19

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/2] nl80211: check NL80211_ATTR_SCHED_SCAN_INTERVAL only once

On Thu, 2016-11-17 at 09:02 +0000, Arend van Spriel wrote:
> The presence of the NL80211_ATTR_SCHED_SCAN_INTERVAL attribute was
> checked in nl80211_parse_sched_scan() and
> nl80211_parse_sched_scan_plans() which might be a bit redundant
> so removing one.
>
makes sense, applied.

johannes

2016-11-17 09:10:35

by Arend Van Spriel

[permalink] [raw]
Subject: [PATCH 2/2] nl80211: check NL80211_ATTR_SCHED_SCAN_INTERVAL only once

The presence of the NL80211_ATTR_SCHED_SCAN_INTERVAL attribute was
checked in nl80211_parse_sched_scan() and
nl80211_parse_sched_scan_plans() which might be a bit redundant
so removing one.

Signed-off-by: Arend van Spriel <[email protected]>
---
net/wireless/nl80211.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 24ab199..051cd5a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6761,13 +6761,10 @@ static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info)

/*
* If scan plans are not specified,
- * %NL80211_ATTR_SCHED_SCAN_INTERVAL must be specified. In this
+ * %NL80211_ATTR_SCHED_SCAN_INTERVAL will be specified. In this
* case one scan plan will be set with the specified scan
* interval and infinite number of iterations.
*/
- if (!attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL])
- return -EINVAL;
-
interval = nla_get_u32(attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]);
if (!interval)
return -EINVAL;
--
1.9.1

2016-11-17 17:54:36

by Arend Van Spriel

[permalink] [raw]
Subject: Re: [PATCH 1/2] cfg80211: get rid of name indirection trick for ieee80211_get_channel()

On 17-11-2016 13:32, kbuild test robot wrote:
> Hi Arend,
>
> [auto build test ERROR on mac80211-next/master]
> [also build test ERROR on v4.9-rc5 next-20161117]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Arend-van-Spriel/cfg80211-get-rid-of-name-indirection-trick-for-ieee80211_get_channel/20161117-175449
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64

Ah. Two drivers that are not fooled by the indirection. Will create a V2.

Regards,
Arend

> All error/warnings (new ones prefixed by >>):
>
> drivers/net/wireless/ath/ath10k/htt_rx.c: In function 'ath10k_htt_t2h_msg_handler':
>>> drivers/net/wireless/ath/ath10k/htt_rx.c:2333:4: error: implicit declaration of function '__ieee80211_get_channel' [-Werror=implicit-function-declaration]
> __ieee80211_get_channel(ar->hw->wiphy, freq);
> ^~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/net/wireless/ath/ath10k/htt_rx.c:2332:21: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
> ar->tgt_oper_chan =
> ^
> cc1: some warnings being treated as errors
>
> vim +/__ieee80211_get_channel +2333 drivers/net/wireless/ath/ath10k/htt_rx.c
>
> c545070e Michal Kazior 2015-01-24 2326 case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
> 8348db29 Rajkumar Manoharan 2015-03-25 2327 break;
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2328 case HTT_T2H_MSG_TYPE_CHAN_CHANGE: {
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2329 u32 phymode = __le32_to_cpu(resp->chan_change.phymode);
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2330 u32 freq = __le32_to_cpu(resp->chan_change.freq);
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2331
> 2ce9b25c Rajkumar Manoharan 2016-03-08 @2332 ar->tgt_oper_chan =
> 2ce9b25c Rajkumar Manoharan 2016-03-08 @2333 __ieee80211_get_channel(ar->hw->wiphy, freq);
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2334 ath10k_dbg(ar, ATH10K_DBG_HTT,
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2335 "htt chan change freq %u phymode %s\n",
> 2ce9b25c Rajkumar Manoharan 2016-03-08 2336 freq, ath10k_wmi_phymode_str(phymode));
>
> :::::: The code at line 2333 was first introduced by commit
> :::::: 2ce9b25cefa64f11bcb21b21cf4a5e8c58c6d0af ath10k: handle channel change htt event
>
> :::::: TO: Rajkumar Manoharan <[email protected]>
> :::::: CC: Kalle Valo <[email protected]>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>

2016-11-17 16:58:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/2] cfg80211: get rid of name indirection trick for ieee80211_get_channel()

Hi Arend,

[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.9-rc5 next-20161117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arend-van-Spriel/cfg80211-get-rid-of-name-indirection-trick-for-ieee80211_get_channel/20161117-175449
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

drivers/net/wireless/ath/ath10k/htt_rx.c: In function 'ath10k_htt_t2h_msg_handler':
>> drivers/net/wireless/ath/ath10k/htt_rx.c:2333:4: error: implicit declaration of function '__ieee80211_get_channel' [-Werror=implicit-function-declaration]
__ieee80211_get_channel(ar->hw->wiphy, freq);
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/ath/ath10k/htt_rx.c:2332:21: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
ar->tgt_oper_chan =
^
cc1: some warnings being treated as errors

vim +/__ieee80211_get_channel +2333 drivers/net/wireless/ath/ath10k/htt_rx.c

c545070e Michal Kazior 2015-01-24 2326 case HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND:
8348db29 Rajkumar Manoharan 2015-03-25 2327 break;
2ce9b25c Rajkumar Manoharan 2016-03-08 2328 case HTT_T2H_MSG_TYPE_CHAN_CHANGE: {
2ce9b25c Rajkumar Manoharan 2016-03-08 2329 u32 phymode = __le32_to_cpu(resp->chan_change.phymode);
2ce9b25c Rajkumar Manoharan 2016-03-08 2330 u32 freq = __le32_to_cpu(resp->chan_change.freq);
2ce9b25c Rajkumar Manoharan 2016-03-08 2331
2ce9b25c Rajkumar Manoharan 2016-03-08 @2332 ar->tgt_oper_chan =
2ce9b25c Rajkumar Manoharan 2016-03-08 @2333 __ieee80211_get_channel(ar->hw->wiphy, freq);
2ce9b25c Rajkumar Manoharan 2016-03-08 2334 ath10k_dbg(ar, ATH10K_DBG_HTT,
2ce9b25c Rajkumar Manoharan 2016-03-08 2335 "htt chan change freq %u phymode %s\n",
2ce9b25c Rajkumar Manoharan 2016-03-08 2336 freq, ath10k_wmi_phymode_str(phymode));

:::::: The code at line 2333 was first introduced by commit
:::::: 2ce9b25cefa64f11bcb21b21cf4a5e8c58c6d0af ath10k: handle channel change htt event

:::::: TO: Rajkumar Manoharan <[email protected]>
:::::: CC: Kalle Valo <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.58 kB)
.config.gz (55.40 kB)
Download all attachments

2016-11-17 11:55:13

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/2] cfg80211: get rid of name indirection trick for ieee80211_get_channel()

Hi Arend,

[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.9-rc5 next-20161117]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arend-van-Spriel/cfg80211-get-rid-of-name-indirection-trick-for-ieee80211_get_channel/20161117-175449
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

drivers/net/wireless/marvell/mwifiex/cfg80211.c: In function 'mwifiex_cfg80211_inform_ibss_bss':
>> drivers/net/wireless/marvell/mwifiex/cfg80211.c:2075:9: error: implicit declaration of function '__ieee80211_get_channel' [-Werror=implicit-function-declaration]
chan = __ieee80211_get_channel(priv->wdev.wiphy,
^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/wireless/marvell/mwifiex/cfg80211.c:2075:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
chan = __ieee80211_get_channel(priv->wdev.wiphy,
^
cc1: some warnings being treated as errors

vim +/__ieee80211_get_channel +2075 drivers/net/wireless/marvell/mwifiex/cfg80211.c

5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2069
5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2070 memcpy(&ie_buf[sizeof(struct ieee_types_header)],
aea0701e drivers/net/wireless/mwifiex/cfg80211.c Yogesh Ashok Powar 2012-03-13 2071 &bss_info.ssid.ssid, bss_info.ssid.ssid_len);
5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2072 ie_len = ie_buf[1] + sizeof(struct ieee_types_header);
5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2073
4ed5d521 drivers/net/wireless/mwifiex/cfg80211.c Amitkumar Karwar 2011-09-21 2074 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
4facc34a drivers/net/wireless/mwifiex/cfg80211.c Avinash Patil 2015-01-28 @2075 chan = __ieee80211_get_channel(priv->wdev.wiphy,
5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2076 ieee80211_channel_to_frequency(bss_info.bss_chan,
4ed5d521 drivers/net/wireless/mwifiex/cfg80211.c Amitkumar Karwar 2011-09-21 2077 band));
5e6e3a92 drivers/net/wireless/mwifiex/cfg80211.c Bing Zhao 2011-03-21 2078

:::::: The code at line 2075 was first introduced by commit
:::::: 4facc34a1f1d6ba8fafc9afdb84f9c6ed4334c4c mwifiex: do not declare wdev as pointer

:::::: TO: Avinash Patil <[email protected]>
:::::: CC: Kalle Valo <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.92 kB)
.config.gz (36.91 kB)
Download all attachments