Re: [PATCH] cfg80211: cap 20MHz VHT bitrate at MCS 8

2016-09-16 Thread Pedersen, Thomas
On Tue, 2016-09-13 at 20:02 +0200, Johannes Berg wrote:
> > Yeah so apparently the overhead involved in 256-QAM 5/6 (MCS 9)
> > results in lower effective bitrate than just using MCS 8 (unless
> > you're using 3 spatial streams).
> 
> Ah. I took a - very brief - look at why this one is invalid and
> couldn't figure it out.

I don't know what I'm talking about. This was a miscommunication from
the systems team. I think it was because EVM targets were too high, but
LDPC fixes that, see below.

> >  Sounds like a rate control or reporting bug then.
> > Please drop this.
> > 
> Ok, thanks.

Actually, can you apply the v2 (cfg80211: add bitrate for 20MHz MCS 9)
of this? Systems guys confirmed they use MCS 9 @ 20MHz when LDPC is
enabled. Also confirmed bitrate should be ok.

Thanks,

thomas


Re: wireless.wiki.kernel.org: lingering status of http://linuxwireless.org/en/users/Drivers/wl12xx/calibrator/

2016-09-16 Thread Andreas Mohr
Hi,

On Fri, Sep 16, 2016 at 11:31:28AM +0200, Johannes Berg wrote:
> > The apparent underlying reason for this surfaces when going through
> > the en ... users ... Drivers hierarchy to
> > https://wireless.wiki.kernel.org/en/users/drivers/wl12xx
> > where it says
> > "
> > For relicensing, the content of this page was removed.
> > 
> > The old website for now has a copy of the old content:
> > 
> > http://linuxwireless.sipsolutions.net/en/users/Drivers/wl12xx/·
> > "
> 
> Right, so there were some people who couldn't be reached for
> relicensing of their submissions under the license the new wiki
> requires. The wl1251 and wl12xx pages were removed since I couldn't
> reach Gery Kahn and Oz Krakowski, or they couldn't agree to
> relicensing, I don't remember. I still have the Google spreadsheet that
> tells me who it was though :-)

Hmm, would be nice if that situation were sufficiently easily improvable 
still...
(however sometimes RL ain't that easy after all).


> I have no intention of removing it, since it's a static HTML site and
> has no maintenance overhead.

Sufficiently solid intentions, given status quo.
(so that content likely won't be available in one hundred years,
but now there's hope that it will remain available
over a "sane" remaining lifetime span of these devices... ;)


> > So, are there some ways to improve the content situation,
> > or will this job then eventually need to be done by last-ditch
> > efforts (web.archive.org etc.)?
> 
> I can't side-step the licensing issue, so no. You can download and
> store locally everything you need, I guess.

Dito.


(I already had the same thought and had acted accordingly)

Thank you for your service!

Andreas Mohr


[PATCH -next] ath10k: fix error return code in ahb

2016-09-16 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return a negative error code from the error handling case
instead of 0, as done elsewhere in function ath10k_ahb_probe() or
ath10k_ahb_resource_init().

Signed-off-by: Wei Yongjun 
---
 drivers/net/wireless/ath/ath10k/ahb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index b99ad5d..6dc1c60 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -572,6 +572,7 @@ static int ath10k_ahb_resource_init(struct ath10k *ar)
ar_ahb->irq = platform_get_irq_byname(pdev, "legacy");
if (ar_ahb->irq < 0) {
ath10k_err(ar, "failed to get irq number: %d\n", ar_ahb->irq);
+   ret = ar_ahb->irq;
goto err_clock_deinit;
}
 
@@ -850,6 +851,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
chip_id = ath10k_ahb_soc_read32(ar, SOC_CHIP_ID_ADDRESS);
if (chip_id == 0x) {
ath10k_err(ar, "failed to get chip id\n");
+   ret = -ENODEV;
goto err_halt_device;
}



Re: [PATCH] cfg80211: add helper to find an IE that matches a byte-array

2016-09-16 Thread Johannes Berg
On Thu, 2016-09-15 at 18:15 +0300, Luca Coelho wrote:
> From: Luca Coelho 
> 
> There are a few places where an IE that matches not only the EID, but
> also other bytes inside the element, needs to be found.  To simplify
> that and reduce the amount of similar code, implement a new helper
> function to match the EID and an extra array of bytes.
> 
Applied.

johannes


pull-request: mac80211-next 2016-09-16

2016-09-16 Thread Johannes Berg
Hi Dave,

And here's another set for net-next, it's been a month or so and we have a
reasonably large number of patches (for a change, mostly because I cleaned
up some WEP crypto thing and a few static checkers.)

Let me know if there's any problem.

Thanks,
johannes



The following changes since commit 02154927c115c7599677df57203988e05b576346:

  net: dsa: bcm_sf2: Get VLAN_PORT_MASK from b53_device (2016-09-11 19:37:02 
-0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
tags/mac80211-next-for-davem-2016-09-16

for you to fetch changes up to fbd05e4a6e82fd573d3aa79e284e424b8d78c149:

  cfg80211: add helper to find an IE that matches a byte-array (2016-09-16 
14:49:52 +0200)


This time we have various things - all across the board:
 * MU-MIMO sniffer support in mac80211
 * a create_singlethread_workqueue() cleanup
 * interface dump filtering that was documented but not implemented
 * support for the new radiotap timestamp field
 * send delBA in two unexpected conditions (as required by the spec)
 * connect keys cleanups - allow only WEP with index 0-3
 * per-station aggregation limit to work around broken APs
 * debugfs improvement for the integrated codel algorithm
and various other small improvements and cleanups.


Aviya Erenfeld (2):
  mac80211: refactor monitor representation in sdata
  mac80211: add support for MU-MIMO air sniffer

Bhaktipriya Shridhar (1):
  cfg80211: Remove deprecated create_singlethread_workqueue

Denis Kenzior (1):
  nl80211: Allow GET_INTERFACE dumps to be filtered

Emmanuel Grumbach (2):
  cfg80211: clarify the requirements of .disconnect()
  mac80211: allow using AP_LINK_PS with mac80211-generated TIM IE

Johannes Berg (21):
  mac80211: add support for radiotap timestamp field
  mac80211: send delBA on unexpected BlockAck data frames
  mac80211: send delBA on unexpected BlockAck Request
  mac80211: simplify TDLS RA lookup
  mac80211: remove useless open_count check
  cfg80211: disallow shared key authentication with key index 4
  nl80211: fix connect keys range check
  nl80211: only allow WEP keys during connect command
  cfg80211: wext: only allow WEP keys to be configured before connected
  cfg80211: validate key index better
  cfg80211: reduce connect key caching struct size
  cfg80211: allow connect keys only with default (TX) key
  mac80211: fix possible out-of-bounds access
  mac80211: fix scan completed tracing
  nl80211: always check nla_nest_start() return value
  nl80211: always check nla_put* return values
  mac80211: remove unused assignment
  mac80211: remove pointless chanctx NULL check
  mac80211: remove sta_remove_debugfs driver callback
  cfg80211: remove unnecessary pointer-of
  mac80211_hwsim: statically initialize hwsim_radios list

Luca Coelho (1):
  cfg80211: add helper to find an IE that matches a byte-array

Maxim Altshul (1):
  mac80211: RX BA support for sta max_rx_aggregation_subframes

Rajkumar Manoharan (1):
  mac80211: allow driver to handle packet-loss mechanism

Toke Høiland-Jørgensen (1):
  mac80211: Re-structure aqm debugfs output and keep CoDel stats per txq

 drivers/net/wireless/mac80211_hwsim.c |   3 +-
 include/net/cfg80211.h|  36 +++-
 include/net/ieee80211_radiotap.h  |  21 +
 include/net/mac80211.h|  33 ++--
 net/mac80211/agg-rx.c |  11 ++-
 net/mac80211/cfg.c|  35 ++--
 net/mac80211/debugfs.c| 152 ++
 net/mac80211/debugfs_netdev.c |  37 -
 net/mac80211/debugfs_sta.c|  56 -
 net/mac80211/driver-ops.c |   2 +-
 net/mac80211/driver-ops.h |  18 +---
 net/mac80211/ieee80211_i.h|  11 ++-
 net/mac80211/iface.c  |  21 +++--
 net/mac80211/main.c   |   3 +
 net/mac80211/mlme.c   |  12 ++-
 net/mac80211/pm.c |   3 +-
 net/mac80211/rx.c |  69 ++-
 net/mac80211/scan.c   |   2 +-
 net/mac80211/sta_info.c   |   5 +-
 net/mac80211/sta_info.h   |   3 +
 net/mac80211/status.c |   8 +-
 net/mac80211/tx.c |  21 ++---
 net/mac80211/util.c   |   3 +-
 net/wireless/core.c   |   2 +-
 net/wireless/core.h   |   6 +-
 net/wireless/ibss.c   |  11 +--
 net/wireless/mlme.c   |   2 +-
 net/wireless/nl80211.c|  85 ---
 net/wireless/scan.c   |  58 ++---
 net/wireless/sme.c|   3 +
 net/wireless/sysfs.c 

Re: [PATCH 1/2] mac80211: allow to support AP_LINK_PS when the set_tim is still needed

2016-09-16 Thread Johannes Berg
Both applied.

johannes


pull-request: mac80211 2016-09-16

2016-09-16 Thread Johannes Berg
Hi Dave,

Sorry - I know you only just pulled my tree for the previous fixes,
but we found two more problems in the last few days; it'd be great
to get those fixes in as well.

Let me know if there's any problem.

Thanks,
johannes



The following changes since commit ad5987b47e96a0fb6d13fea250e936aed93c:

  nl80211: validate number of probe response CSA counters (2016-09-13 20:19:27 
+0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git 
tags/mac80211-for-davem-2016-09-16

for you to fetch changes up to 85d5313ed717ad60769491c7c072d23bc0a68e7a:

  mac80211: reject TSPEC TIDs (TSIDs) for aggregation (2016-09-15 10:08:52 
+0200)


Two more fixes:
 * reject aggregation sessions for TSID/TID 8-16 that we
   can never use anyway and which could confuse drivers
 * check return value of skb_linearize()


Johannes Berg (2):
  mac80211: check skb_linearize() return value
  mac80211: reject TSPEC TIDs (TSIDs) for aggregation

 net/mac80211/agg-rx.c | 8 +++-
 net/mac80211/agg-tx.c | 3 +++
 net/mac80211/tx.c | 8 ++--
 3 files changed, 16 insertions(+), 3 deletions(-)


Re: [PATCH v6 1/3] Documentation: dt: net: add ath9k wireless device binding

2016-09-16 Thread Rob Herring
On Fri, Sep 09, 2016 at 10:57:06PM +0200, Martin Blumenstingl wrote:
> On Fri, Sep 9, 2016 at 9:48 AM, Oleksij Rempel  wrote:
> >> +Optional properties:
> >> +- reg: Address and length of the register set for the device.
> >> +- qca,clk-25mhz: Defines that a 25MHz clock is used
> >
> > Some SoCs even Atheros WiSoCs use WiFi clock for System Clock. In this
> > case we need to use clock framework any way, so why not in this case too?
> > Provide dummy static clock in DT and connect it with this node?
> >
> > osc25m: oscillator {
> > compatible = "fixed-clock";
> > #clock-cells = <0>;
> > clock-frequency = <2500>;
> > clock-accuracy = <3>;
> > };
> >
> > acc: clock-controller@8004 {
> > compatible = "some-clock-controller";
> > #clock-cells = <1>;
> > clocks = <>;
> > reg = <0x8004 0x204>;
> > };
> >
> >
> >  {
> > ath9k@168c,002d {
> > compatible = "pci168c,002d";
> > reg = <0x7000 0 0 0 0x1000>;
> > clocks = <>;
> > qca,disable-5ghz;
> > };
> > };
> >
> >
> > driver will need to use clk_get and compare frequency instead of
> > of_property_read_bool(np, "qca,clk-25mhz"). In this case you will need
> > to define source clock only one time and reuse it by all affected DT
> > nodes. If we have 40MHz clock you will only need to change it in
> > fixed-clock.
> that does sound like a good idea, thanks for that input!
> However, I will remove the property for the first version because I am
> trying to get PCI(e) devices supported. OF support for AHB (WiSoC)
> needs more work (in other places, like ahb.c) anyways.
> But this suggestion should be remembered!
> 
> >> +- qca,no-eeprom: Indicates that there is no physical EEPROM connected to 
> >> the
> >> + ath9k wireless chip (in this case the calibration /
> >> + EEPROM data will be loaded from userspace using the
> >> + kernel firmware loader).
> >> +- qca,disable-2ghz: Overrides the settings from the EEPROM and disables 
> >> the
> >> + 2.4GHz band. Setting this property is only needed
> >> + when the RF circuit does not support the 2.4GHz band
> >> + while it is enabled nevertheless in the EEPROM.
> >> +- qca,disable-5ghz: Overrides the settings from the EEPROM and disables 
> >> the
> >> + 5GHz band. Setting this property is only needed when
> >> + the RF circuit does not support the 5GHz band while
> >> + it is enabled nevertheless in the EEPROM.
> >
> > This option can be reused for every WiFi controller. Not only for qca.
> > So may be instead of adding vendor specific name, make it reusable for
> > all vendors. Instead of qca,disable-5ghz and qca,disable-2ghz make
> > disable-5ghz and disable-2ghz?

Fine, but if you do this then document in a common location.

> I am personally fine with anything that fits best into the grand
> scheme of things.
> There are three scenarios I can think of which may be influenced by
> devicetree configuration:
> a) let the driver decide automatically whether the 2.4GHz and/or 5GHz
> band is/are enabled
> b) explicitly disable either bands (because the driver thinks due to
> whatever reason that a band is supported while in reality it isn't)
> c) explicitly enable a band (for example because the driver cannot
> automagically detect which band should be enabled)
> 
> for ath9k we default to a) but also allow b): the EEPROM (device
> specific calibration data) contains information about which bands are
> enabled (or not). But some manufacturers are shipping devices for
> example with the 5G band enabled, while the actual hardware doesn't
> support it.

And you can't determine that based on different device IDs? If you can 
use vendor/device ID, then you should. If not, then this is fine.

Is it possible to have no EEPROM at all? If so, you might want to just 
put the raw EEPROM data into DT rather than a property for every field 
(I'm assuming there's more than just what you have properties for now).

Rob


Re: [PATCH v6 1/3] Documentation: dt: net: add ath9k wireless device binding

2016-09-16 Thread Rob Herring
On Tue, Sep 06, 2016 at 11:46:21PM +0200, Martin Blumenstingl wrote:
> Add documentation how devicetree can be used to configure ath9k based
> devices.
> 
> Signed-off-by: Martin Blumenstingl 
> ---
>  .../devicetree/bindings/net/wireless/qca,ath9k.txt | 39 
> ++
>  1 file changed, 39 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt 
> b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
> new file mode 100644
> index 000..77b9202
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
> @@ -0,0 +1,39 @@
> +* Qualcomm Atheros ath9k wireless devices
> +
> +This node provides properties for configuring the ath9k wireless device. The
> +node is expected to be specified as a child node of the PCI controller to
> +which the wireless chip is connected.
> +
> +Required properties:
> +- compatible: For PCI and PCIe devices this should be an identifier following
> + the format as defined in "PCI Bus Binding to Open Firmware"
> + Revision 2.1. One of the possible formats is "pci,"
> + where  is the PCI vendor ID and  is PCI device ID.
> +
> +Optional properties:
> +- reg: Address and length of the register set for the device.

reg is not optional.

> +- qca,clk-25mhz: Defines that a 25MHz clock is used
> +- qca,no-eeprom: Indicates that there is no physical EEPROM connected to the
> + ath9k wireless chip (in this case the calibration /
> + EEPROM data will be loaded from userspace using the
> + kernel firmware loader).
> +- qca,disable-2ghz: Overrides the settings from the EEPROM and disables the
> + 2.4GHz band. Setting this property is only needed
> + when the RF circuit does not support the 2.4GHz band
> + while it is enabled nevertheless in the EEPROM.
> +- qca,disable-5ghz: Overrides the settings from the EEPROM and disables the
> + 5GHz band. Setting this property is only needed when
> + the RF circuit does not support the 5GHz band while
> + it is enabled nevertheless in the EEPROM.
> +- mac-address: See ethernet.txt in the parent directory
> +- local-mac-address: See ethernet.txt in the parent directory
> +
> +
> +In this example, the node is defined as child node of the PCI controller:
> + {
> + ath9k@168c,002d {

unit address is not the vendor/device ID, but the reg value. So 
'@7000,0,0' I think in this case. Double check the OF PCI bus binding.


> + compatible = "pci168c,002d";
> + reg = <0x7000 0 0 0 0x1000>;
> + qca,disable-5ghz;
> + };
> +};
> -- 
> 2.9.3
> 


Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func

2016-09-16 Thread kbuild test robot
Hi Ayala,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on next-20160916]
[cannot apply to v4.8-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Luca-Coelho/Add-support-for-Neighbor-Awareness-Networking/20160916-164553
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
master
config: x86_64-randconfig-v0-09161926 (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 warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/uapi/linux/if.h:23,
from net/wireless/nl80211.c:9:
   net/wireless/nl80211.c: In function 'nl80211_nan_add_func':
   net/wireless/nl80211.c:10588:30: error: implicit declaration of function 
'genl_info_snd_portid' [-Werror=implicit-function-declaration]
 wdev->owner_nlportid != genl_info_snd_portid(info))
 ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
>> net/wireless/nl80211.c:10587:2: note: in expansion of macro 'if'
 if (wdev->owner_nlportid &&
 ^~
   net/wireless/nl80211.c:10785:6: error: implicit declaration of function 
'nla_put_u64' [-Werror=implicit-function-declaration]
 if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie))
 ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
   net/wireless/nl80211.c:10785:2: note: in expansion of macro 'if'
 if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie))
 ^~
   cc1: some warnings being treated as errors

vim +/if +10587 net/wireless/nl80211.c

 10571  struct wireless_dev *wdev = info->user_ptr[1];
 10572  struct nlattr *tb[NUM_NL80211_NAN_FUNC_ATTR], *func_attr;
 10573  struct cfg80211_nan_func *func;
 10574  struct sk_buff *msg = NULL;
 10575  void *hdr = NULL;
 10576  int err = 0;
 10577  
 10578  if (wdev->iftype != NL80211_IFTYPE_NAN)
 10579  return -EOPNOTSUPP;
 10580  
 10581  if (!wdev->nan_started)
 10582  return -ENOTCONN;
 10583  
 10584  if (!info->attrs[NL80211_ATTR_NAN_FUNC])
 10585  return -EINVAL;
 10586  
 10587  if (wdev->owner_nlportid &&
 10588  wdev->owner_nlportid != genl_info_snd_portid(info))
 10589  return -ENOTCONN;
 10590  
 10591  err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX,
 10592  nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]),
 10593  nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]),
 10594  nl80211_nan_func_policy);
 10595  if (err)

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


.config.gz
Description: Binary data


[PATCH] ath10k: add cc_wraparound type for QCA9888 and QCA9884

2016-09-16 Thread akolli
From: Anilkumar Kolli 

During offchannel scan, iw survey dump shows wrong values.
Fix this by assigning cycle counter wranarround type for
QCA9888 and QCA9884, they share same config with QCA4019.

Signed-off-by: Anilkumar Kolli 
---
 drivers/net/wireless/ath/ath10k/core.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 3a8984ba9f74..93168d9f8902 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -191,6 +191,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.name = "qca9984/qca9994 hw1.0",
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
+   .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
.cck_rate_map_rev2 = true,
@@ -215,6 +216,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.name = "qca9888 hw2.0",
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
+   .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
.otp_exe_param = 0x0700,
.continuous_frag_desc = true,
.channel_counters_freq_hz = 15,
-- 
1.7.9.5



Re: [PATCH v2 2/9] mac80211: add boilerplate code for start / stop NAN

2016-09-16 Thread Arend Van Spriel
On 16-9-2016 10:33, Luca Coelho wrote:
> From: Ayala Beker 
> 
> This code doesn't do much besides allowing to start and
> stop the vif.
> 
> Signed-off-by: Andrei Otcheretianski 
> Signed-off-by: Emmanuel Grumbach 
> Signed-off-by: Ayala Beker 
> Signed-off-by: Luca Coelho 
> ---
>  include/net/mac80211.h|  9 +
>  net/mac80211/cfg.c| 36 ++
>  net/mac80211/chan.c   |  3 +++
>  net/mac80211/driver-ops.h | 29 ++-
>  net/mac80211/iface.c  |  8 ++--
>  net/mac80211/main.c   |  5 +
>  net/mac80211/offchannel.c |  3 ++-
>  net/mac80211/trace.h  | 50 
> +++
>  net/mac80211/util.c   |  3 ++-
>  9 files changed, 141 insertions(+), 5 deletions(-)

[...]

> diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
> index fe35a1c..67b42c8 100644
> --- a/net/mac80211/driver-ops.h
> +++ b/net/mac80211/driver-ops.h
> @@ -163,7 +163,8 @@ static inline void drv_bss_info_changed(struct 
> ieee80211_local *local,
>  
>   if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
>(sdata->vif.type == NL80211_IFTYPE_MONITOR &&
> -   !sdata->vif.mu_mimo_owner)))
> +   !sdata->vif.mu_mimo_owner) ||
> +  sdata->vif.type == NL80211_IFTYPE_NAN))

Might be more clear to move this up right after P2P_DEVICE check.

>   return;
>  
>   if (!check_sdata_in_driver(sdata))
> @@ -1165,4 +1166,30 @@ static inline void drv_wake_tx_queue(struct 
> ieee80211_local *local,
>   local->ops->wake_tx_queue(>hw, >txq);
>  }
>  
> +static inline int drv_start_nan(struct ieee80211_local *local,
> + struct ieee80211_sub_if_data *sdata,
> + struct cfg80211_nan_conf *conf)
> +{
> + int ret;
> +
> + might_sleep();
> + check_sdata_in_driver(sdata);
> +
> + trace_drv_start_nan(local, sdata, conf);
> + ret = local->ops->start_nan(>hw, >vif, conf);
> + trace_drv_return_int(local, ret);
> + return ret;
> +}
> +
> +static inline void drv_stop_nan(struct ieee80211_local *local,
> + struct ieee80211_sub_if_data *sdata)
> +{
> + might_sleep();
> + check_sdata_in_driver(sdata);
> +
> + trace_drv_stop_nan(local, sdata);
> + local->ops->stop_nan(>hw, >vif);
> + trace_drv_return_void(local);
> +}
> +
>  #endif /* __MAC80211_DRIVER_OPS */
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index e694ca2..507f46a 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -327,6 +327,9 @@ static int ieee80211_check_queues(struct 
> ieee80211_sub_if_data *sdata,
>   int n_queues = sdata->local->hw.queues;
>   int i;
>  
> + if (iftype == NL80211_IFTYPE_NAN)
> + return 0;
> +
>   if (iftype != NL80211_IFTYPE_P2P_DEVICE) {
>   for (i = 0; i < IEEE80211_NUM_ACS; i++) {
>   if (WARN_ON_ONCE(sdata->vif.hw_queue[i] ==
> @@ -647,7 +650,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool 
> coming_up)
>   local->fif_probe_req++;
>   }
>  
> - if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE)
> + if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
> + sdata->vif.type != NL80211_IFTYPE_NAN)

similar check keeps reoccuring in various places so maybe we can create
a helper function for it.

>   changed |= ieee80211_reset_erp_info(sdata);
>   ieee80211_bss_info_change_notify(sdata, changed);
>  

Regards,
Arend


Re: [PATCH v2 1/9] cfg80211: add start / stop NAN commands

2016-09-16 Thread Johannes Berg

> I think NUM_NL80211_IFTYPES should not be in the switch. If it must I
> would leave it as last one here.
> 

It just suppresses compiler warnings :)

johannes


Re: [PATCH v2 1/9] cfg80211: add start / stop NAN commands

2016-09-16 Thread Arend Van Spriel
On 16-9-2016 10:33, Luca Coelho wrote:
> From: Ayala Beker 
> 
> This allows user space to start/stop NAN interface.
> A NAN interface is like P2P device in a few aspects: it
> doesn't have a netdev associated to it.
> Add the new interface type and prevent operations that
> can't be executed on NAN interface like scan.
> 
> Define several attributes that may be configured by user space
> when starting NAN functionality (master preference and dual
> band operation)
> 
> Signed-off-by: Andrei Otcheretianski 
> Signed-off-by: Emmanuel Grumbach 
> Signed-off-by: Luca Coelho 
> ---
>  include/net/cfg80211.h   | 21 +-
>  include/uapi/linux/nl80211.h | 52 +
>  net/mac80211/cfg.c   |  2 +
>  net/mac80211/chan.c  |  3 ++
>  net/mac80211/iface.c |  4 ++
>  net/mac80211/offchannel.c|  1 +
>  net/mac80211/rx.c|  3 ++
>  net/mac80211/util.c  |  1 +
>  net/wireless/chan.c  |  2 +
>  net/wireless/core.c  | 34 
>  net/wireless/core.h  |  3 ++
>  net/wireless/mlme.c  |  1 +
>  net/wireless/nl80211.c   | 93 
> ++--
>  net/wireless/rdev-ops.h  | 20 ++
>  net/wireless/trace.h | 27 +
>  net/wireless/util.c  |  6 ++-
>  16 files changed, 267 insertions(+), 6 deletions(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index d5e7f69..ca64d69 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -2293,6 +2293,19 @@ struct cfg80211_qos_map {
>  };

[...]

> +/**
> + * enum nl80211_nan_dual_band_conf - NAN dual band configuration
> + *
> + * Defines the NAN dual band mode of operation

Does it make sense to have such a notion of bands in use. And what does
5.2GHz mean. Is this a subband within 5G channels? Probably I should
read the NAN spec to understand what is meant here. I would consider
5.2G as lower 5G, ie. discovery on channel 44 but not sure if that is
meant here.

> + * @NL80211_NAN_BAND_DEFAULT: device default mode
> + * @NL80211_NAN_BAND_SINGLE: 2.4GHz only mode
> + * @NL80211_NAN_BAND_DUAL: 2.4GHz and 5.2GHz mode
> +  */
> +enum nl80211_nan_dual_band_conf {
> + NL80211_NAN_BAND_DEFAULT,
> + NL80211_NAN_BAND_SINGLE,
> + NL80211_NAN_BAND_DUAL,
> +
> + /* keep last */
> + __NL80211_NAN_BAND_AFTER_LAST,
> + NL80211_NAN_BAND_MAX =
> + __NL80211_NAN_BAND_AFTER_LAST - 1,
> +};
> +
>  #endif /* __LINUX_NL80211_H */
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index e29ff57..a74027f 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -257,6 +257,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct 
> net_device *dev,
>   case NL80211_IFTYPE_WDS:
>   case NL80211_IFTYPE_MONITOR:
>   case NL80211_IFTYPE_P2P_DEVICE:
> + case NL80211_IFTYPE_NAN:
>   case NL80211_IFTYPE_UNSPECIFIED:
>   case NUM_NL80211_IFTYPES:

Huh? What is this doing here? Not yours but weird still.

>   case NL80211_IFTYPE_P2P_CLIENT:
> @@ -2036,6 +2037,7 @@ static int ieee80211_scan(struct wiphy *wiphy,
>!(req->flags & NL80211_SCAN_FLAG_AP)))
>   return -EOPNOTSUPP;
>   break;
> + case NL80211_IFTYPE_NAN:
>   default:
>   return -EOPNOTSUPP;
>   }
> diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
> index 74142d0..acb50f8 100644
> --- a/net/mac80211/chan.c
> +++ b/net/mac80211/chan.c
> @@ -274,6 +274,7 @@ ieee80211_get_chanctx_max_required_bw(struct 
> ieee80211_local *local,
>   ieee80211_get_max_required_bw(sdata));
>   break;
>   case NL80211_IFTYPE_P2P_DEVICE:
> + case NL80211_IFTYPE_NAN:
>   continue;
>   case NL80211_IFTYPE_ADHOC:
>   case NL80211_IFTYPE_WDS:
> @@ -718,6 +719,7 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local 
> *local,
>  
>   switch (sdata->vif.type) {
>   case NL80211_IFTYPE_P2P_DEVICE:
> + case NL80211_IFTYPE_NAN:
>   continue;
>   case NL80211_IFTYPE_STATION:
>   if (!sdata->u.mgd.associated)
> @@ -981,6 +983,7 @@ ieee80211_vif_chanctx_reservation_complete(struct 
> ieee80211_sub_if_data *sdata)
>   case NL80211_IFTYPE_P2P_GO:
>   case NL80211_IFTYPE_P2P_DEVICE:
>   case NUM_NL80211_IFTYPES:

I think NUM_NL80211_IFTYPES should not be in the switch. If it must I
would leave it as last one here.

> + case NL80211_IFTYPE_NAN:
>   WARN_ON(1);
>   break;
>   }

Regards,
Arend



ath10k mesh mode issue

2016-09-16 Thread Matteo Grandi
Hello all,

I'm using Gateworks Ventana 5410 boards
(http://www.gateworks.com/product/item/ventana-gw5410-network-processor)
running Ubuntu Trusty-Ventana kernel v3.14 with a Compex WLE600V5-27
miniPCIe Qualcomm Atheros QCA9882 wifi dongle installed
https://www.landashop.com/compex-wle-600v5.html?___store=english&___from_store=default

The aim is to use some of these boards to build a mesh network and
perform some HT test (it's a part of my MSc thesis).
I'm trying to configure the devices in mesh mode, but I've encountered
some problems, this is the dmesg output:

root@Yazi:~# iw dev wlan1 interface add mp1 type mp
root@Yazi:~# iw dev mp1 set freq 5240
root@Yazi:~# dmesg | grep ath
[7.134520] ath10k_pci :07:00.0: pci irq legacy interrupts 0
irq_mode 0 reset_mode 0
[7.349228] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.349245] ath10k_pci :07:00.0: Falling back to user helper
[7.417170] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.417189] ath10k_pci :07:00.0: Falling back to user helper
[8.589474] ath10k_pci :07:00.0: qca988x hw2.0 (0x4100016c,
0x043222ff sub :) fw 10.2.4.70.54 fwapi 5 bdapi 1 htt-ver 2.1
wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1 features
no-p2p,raw-mode
[8.589491] ath10k_pci :07:00.0: debug 1 debugfs 1 tracing 0
dfs 0 testmode 1
[8.691670] ath: EEPROM regdomain: 0x0
[8.691680] ath: EEPROM indicates default country code should be used
[8.691686] ath: doing EEPROM country->regdmn map search
[8.691695] ath: country maps to regdmn code: 0x3a
[8.691702] ath: Country alpha2 being used: US
[8.691706] ath: Regpair used: 0x3a
root@Yazi:~# ifconfig mp1 up
SIOCSIFFLAGS: Invalid argument
root@Yazi:~# dmesg | grep ath
[7.134520] ath10k_pci :07:00.0: pci irq legacy interrupts 0
irq_mode 0 reset_mode 0
[7.349228] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.349245] ath10k_pci :07:00.0: Falling back to user helper
[7.417170] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.417189] ath10k_pci :07:00.0: Falling back to user helper
[8.589474] ath10k_pci :07:00.0: qca988x hw2.0 (0x4100016c,
0x043222ff sub :) fw 10.2.4.70.54 fwapi 5 bdapi 1 htt-ver 2.1
wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1 features
no-p2p,raw-mode
[8.589491] ath10k_pci :07:00.0: debug 1 debugfs 1 tracing 0
dfs 0 testmode 1
[8.691670] ath: EEPROM regdomain: 0x0
[8.691680] ath: EEPROM indicates default country code should be used
[8.691686] ath: doing EEPROM country->regdmn map search
[8.691695] ath: country maps to regdmn code: 0x3a
[8.691702] ath: Country alpha2 being used: US
[8.691706] ath: Regpair used: 0x3a
[  176.983250] ath10k_pci :07:00.0: must load driver with
rawmode=1 to add mesh interfaces

It seems that the rowmode is NOT enable, but 8 lines above it's seems
to be ok...

Let me give you some useful details:
- the lspci output:
root@Yazi:~# lspci
00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01)
01:00.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
01:00.1 System peripheral: PLX Technology, Inc. PEX 8609 8-lane,
8-Port PCI Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:01.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:04.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:05.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:06.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:07.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:08.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:09.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
07:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac
Wireless Network Adapter
08:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8057
PCI-E Gigabit Ethernet Controller

-the lsmod output:
root@Yazi:~# lsmod
Module  Size  Used by
arc41687  2
ath10k_pci 34340  0
ath10k_core   289147  1 ath10k_pci
sky2   53987  0
mac80211  458056  1 ath10k_core
ath21573  1 ath10k_core
cfg80211  218260  3 ath,mac80211,ath10k_core
compat 24039  4 cfg80211,mac80211,ath10k_pci,ath10k_core

- the firmware currently in use is the firmware-5.bin_10.2.4.70.54
(renamed firmware-5.bin and with executable permission) located in
/lib/firmware/ath10k/QCA988X/hw2.0. I 

ath10k mesh mode issue

2016-09-16 Thread Matteo Grandi
Hello all,

I'm using Gateworks Ventana 5410 boards
(http://www.gateworks.com/product/item/ventana-gw5410-network-processor)
running Ubuntu Trusty-Ventana kernel v3.14 with a Compex WLE600V5-27
miniPCIe Qualcomm Atheros QCA9882 wifi dongle installed
https://www.landashop.com/compex-wle-600v5.html?___store=english&___from_store=default

The aim is to use some of these boards to build a mesh network and
perform some HT test (it's a part of my MSc thesis).
I'm trying to configure the devices in mesh mode, but I've encountered
some problems, this is the dmesg output:

root@Yazi:~# iw dev wlan1 interface add mp1 type mp
root@Yazi:~# iw dev mp1 set freq 5240
root@Yazi:~# dmesg | grep ath
[7.134520] ath10k_pci :07:00.0: pci irq legacy interrupts 0
irq_mode 0 reset_mode 0
[7.349228] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.349245] ath10k_pci :07:00.0: Falling back to user helper
[7.417170] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.417189] ath10k_pci :07:00.0: Falling back to user helper
[8.589474] ath10k_pci :07:00.0: qca988x hw2.0 (0x4100016c,
0x043222ff sub :) fw 10.2.4.70.54 fwapi 5 bdapi 1 htt-ver 2.1
wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1 features
no-p2p,raw-mode
[8.589491] ath10k_pci :07:00.0: debug 1 debugfs 1 tracing 0
dfs 0 testmode 1
[8.691670] ath: EEPROM regdomain: 0x0
[8.691680] ath: EEPROM indicates default country code should be used
[8.691686] ath: doing EEPROM country->regdmn map search
[8.691695] ath: country maps to regdmn code: 0x3a
[8.691702] ath: Country alpha2 being used: US
[8.691706] ath: Regpair used: 0x3a
root@Yazi:~# ifconfig mp1 up
SIOCSIFFLAGS: Invalid argument
root@Yazi:~# dmesg | grep ath
[7.134520] ath10k_pci :07:00.0: pci irq legacy interrupts 0
irq_mode 0 reset_mode 0
[7.349228] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.349245] ath10k_pci :07:00.0: Falling back to user helper
[7.417170] ath10k_pci :07:00.0: Direct firmware load failed
with error -2
[7.417189] ath10k_pci :07:00.0: Falling back to user helper
[8.589474] ath10k_pci :07:00.0: qca988x hw2.0 (0x4100016c,
0x043222ff sub :) fw 10.2.4.70.54 fwapi 5 bdapi 1 htt-ver 2.1
wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1 features
no-p2p,raw-mode
[8.589491] ath10k_pci :07:00.0: debug 1 debugfs 1 tracing 0
dfs 0 testmode 1
[8.691670] ath: EEPROM regdomain: 0x0
[8.691680] ath: EEPROM indicates default country code should be used
[8.691686] ath: doing EEPROM country->regdmn map search
[8.691695] ath: country maps to regdmn code: 0x3a
[8.691702] ath: Country alpha2 being used: US
[8.691706] ath: Regpair used: 0x3a
[  176.983250] ath10k_pci :07:00.0: must load driver with
rawmode=1 to add mesh interfaces

It seems that the rowmode is NOT enable, but 8 lines above it's seems
to be ok...

Let me give you some useful details:
- the lspci output:
root@Yazi:~# lspci
00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01)
01:00.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
01:00.1 System peripheral: PLX Technology, Inc. PEX 8609 8-lane,
8-Port PCI Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:01.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:04.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:05.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:06.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:07.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:08.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
02:09.0 PCI bridge: PLX Technology, Inc. PEX 8609 8-lane, 8-Port PCI
Express Gen 2 (5.0 GT/s) Switch with DMA (rev ba)
07:00.0 Network controller: Qualcomm Atheros QCA986x/988x 802.11ac
Wireless Network Adapter
08:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8057
PCI-E Gigabit Ethernet Controller

-the lsmod output:
root@Yazi:~# lsmod
Module  Size  Used by
arc41687  2
ath10k_pci 34340  0
ath10k_core   289147  1 ath10k_pci
sky2   53987  0
mac80211  458056  1 ath10k_core
ath21573  1 ath10k_core
cfg80211  218260  3 ath,mac80211,ath10k_core
compat 24039  4 cfg80211,mac80211,ath10k_pci,ath10k_core

- the firmware currently in use is the firmware-5.bin_10.2.4.70.54
(renamed firmware-5.bin and with executable permission) located in
/lib/firmware/ath10k/QCA988X/hw2.0. I 

Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func

2016-09-16 Thread kbuild test robot
Hi Ayala,

[auto build test ERROR on mac80211-next/master]
[also build test ERROR on next-20160916]
[cannot apply to v4.8-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Luca-Coelho/Add-support-for-Neighbor-Awareness-Networking/20160916-164553
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
master
config: x86_64-lkp (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/wireless/nl80211.c: In function 'nl80211_nan_add_func':
>> net/wireless/nl80211.c:10588:30: error: implicit declaration of function 
>> 'genl_info_snd_portid' [-Werror=implicit-function-declaration]
 wdev->owner_nlportid != genl_info_snd_portid(info))
 ^~~~
>> net/wireless/nl80211.c:10785:6: error: implicit declaration of function 
>> 'nla_put_u64' [-Werror=implicit-function-declaration]
 if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie))
 ^~~
   cc1: some warnings being treated as errors

vim +/genl_info_snd_portid +10588 net/wireless/nl80211.c

 10582  return -ENOTCONN;
 10583  
 10584  if (!info->attrs[NL80211_ATTR_NAN_FUNC])
 10585  return -EINVAL;
 10586  
 10587  if (wdev->owner_nlportid &&
 10588  wdev->owner_nlportid != genl_info_snd_portid(info))
 10589  return -ENOTCONN;
 10590  
 10591  err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX,
 10592  nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]),
 10593  nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]),
 10594  nl80211_nan_func_policy);
 10595  if (err)
 10596  return err;
 10597  
 10598  func = kzalloc(sizeof(*func), GFP_KERNEL);
 10599  if (!func)
 10600  return -ENOMEM;
 10601  
 10602  func->cookie = wdev->wiphy->cookie_counter++;
 10603  
 10604  if (!tb[NL80211_NAN_FUNC_TYPE] ||
 10605  nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]) > 
NL80211_NAN_FUNC_MAX_TYPE) {
 10606  err = -EINVAL;
 10607  goto out;
 10608  }
 10609  
 10610  
 10611  func->type = nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]);
 10612  
 10613  if (!tb[NL80211_NAN_FUNC_SERVICE_ID]) {
 10614  err = -EINVAL;
 10615  goto out;
 10616  }
 10617  
 10618  memcpy(func->service_id, 
nla_data(tb[NL80211_NAN_FUNC_SERVICE_ID]),
 10619 sizeof(func->service_id));
 10620  
 10621  func->close_range =
 10622  nla_get_flag(tb[NL80211_NAN_FUNC_CLOSE_RANGE]);
 10623  
 10624  if (tb[NL80211_NAN_FUNC_SERVICE_INFO]) {
 10625  func->serv_spec_info_len =
 10626  nla_len(tb[NL80211_NAN_FUNC_SERVICE_INFO]);
 10627  func->serv_spec_info =
 10628  
kmemdup(nla_data(tb[NL80211_NAN_FUNC_SERVICE_INFO]),
 10629  func->serv_spec_info_len,
 10630  GFP_KERNEL);
 10631  if (!func->serv_spec_info) {
 10632  err = -ENOMEM;
 10633  goto out;
 10634  }
 10635  }
 10636  
 10637  if (tb[NL80211_NAN_FUNC_TTL])
 10638  func->ttl = nla_get_u32(tb[NL80211_NAN_FUNC_TTL]);
 10639  
 10640  switch (func->type) {
 10641  case NL80211_NAN_FUNC_PUBLISH:
 10642  if (!tb[NL80211_NAN_FUNC_PUBLISH_TYPE]) {
 10643  err = -EINVAL;
 10644  goto out;
 10645  }
 10646  
 10647  func->publish_type =
 10648  nla_get_u8(tb[NL80211_NAN_FUNC_PUBLISH_TYPE]);
 10649  func->publish_bcast =
 10650  
nla_get_flag(tb[NL80211_NAN_FUNC_PUBLISH_BCAST]);
 10651  
 10652  if ((!(func->publish_type & 
NL80211_NAN_SOLICITED_PUBLISH)) &&
 10653  func->publish_bcast) {
 10654  err = -EINVAL;
 10655  goto out;
 10656  }
 10657  break;
 10658  case NL80211_NAN_FUNC_SUBSCRIBE:
 10659  func->subscribe_active =
 10660

Re: [PATCH v2 0/9] Add support for Neighbor Awareness Networking

2016-09-16 Thread Luca Coelho
On Fri, 2016-09-16 at 11:00 +0200, Arend Van Spriel wrote:
> On 16-9-2016 10:33, Luca Coelho wrote:
> > 
> > From: Luca Coelho 
> > 
> > Hi,
> > 
> > This is v2 of the NAN patches that Emmanuel sent a while
> > back[1].  In
> > this version, we squashed some patches and took care of some
> > comments
> > after reviews (both internal and public).
> 
> Hi Luca,
> 
> You may have missed some as I think this should be v4.

Right... I saw those other ones, but they didn't have a cover-letter,
this series is sort of the v2 of "Add support for Neighbor Awareness
Networking".  Or something... :)

In any case, this new series should include all the changes done on the
way.

--
Luca.


Re: brcmfmac MAC address change delay and 500ms down delay

2016-09-16 Thread Arend Van Spriel
On 15-9-2016 16:42, Dan Williams wrote:
> Hi,
> 
> While refining NetworkManager's MAC address randomization behavior we
> came across two issues with brcmfmac:
> 
> 1) when changing the MAC address, the driver schedules work for the new
> change and returns success, but doesn't actually change the MAC until
> the work is scheduled.  Because it returns 0 from the
> ndo_set_mac_address hook the net core will generate a NETDEV_CHANGEADDR
> event and rtnetlink will send out an RTM_NEWLINK with the old MAC
> address.  No event for the new address will be sent.  So it's pretty
> hard to figure out when the address actually changed, and when its safe
> to associate, without polling the device's MAC address.  Ugly.

And apparently unnecessary. I recalled we had this as the
ndo_set_mac_address callback could be called in atomic context. So we
are using a worker because we are grabbing a mutex upon sending the
control info to the device. Looking into the core network code it seems
the callback is not called in atomic context so it seems we can get rid
of the worker here. I made a patch

> 2) when closing the device (eg, set !IFF_UP) the driver unconditionally
> blocks for 500ms in __brcmf_cfg80211_down():
> 
>   if (check_vif_up(ifp->vif)) {
>   brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED);
> 
>   /* Make sure WPA_Supplicant receives all the event
>  generated due to DISASSOC call to the fw to keep
>  the state fw and WPA_Supplicant state consistent
>*/
>   brcmf_delay(500);
>   }

This is actually a bogus delay as we are under an RTNL lock here so I
think the events will not go out until after the delay has finished. I
did submit a patch long ago removing this delay, but the change was not
accepted. Let me revisit that.

> Should I dump these into kernel bugzilla, or is there some internal bug
> tracker they could get stuffed into?

Kernel bugzilla is fine although I check it rather infrequently.

Regards,
Arend


[PATCH][V2] mwifiex: fix null pointer deference when adapter is null

2016-09-16 Thread Colin King
From: Colin Ian King 

If adapter is null the error exit path in mwifiex_shutdown_sw is
to down the semaphore sem and print some debug via mwifiex_dbg.
However, passing a NULL adapter to mwifiex_dbg causes a null
pointer deference when accessing adapter->dev.  This fix checks
for a null adapter at the start of the function and to exit
without the need to up the semaphore and we also skip the debug
to avoid the null pointer dereference.

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/marvell/mwifiex/main.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
b/drivers/net/wireless/marvell/mwifiex/main.c
index 9b2e98c..2478ccd 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -1369,12 +1369,12 @@ mwifiex_shutdown_sw(struct mwifiex_adapter *adapter, 
struct semaphore *sem)
struct mwifiex_private *priv;
int i;
 
+   if (!adapter)
+   goto exit_return;
+
if (down_interruptible(sem))
goto exit_sem_err;
 
-   if (!adapter)
-   goto exit_remove;
-
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
mwifiex_deauthenticate(priv, NULL);
 
@@ -1430,10 +1430,10 @@ mwifiex_shutdown_sw(struct mwifiex_adapter *adapter, 
struct semaphore *sem)
rtnl_unlock();
}
 
-exit_remove:
up(sem);
 exit_sem_err:
mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__);
+exit_return:
return 0;
 }
 
-- 
2.7.4



Re: wireless.wiki.kernel.org: lingering status of http://linuxwireless.org/en/users/Drivers/wl12xx/calibrator/

2016-09-16 Thread Johannes Berg
Hi,

> since we are working with TI WL12xx hardware,
> I keep a reference on
> http://linuxwireless.org/en/users/Drivers/wl12xx/calibrator/ ,
> where it now says:
> "NOTE: this page is for archival only, see the note at the end of the
> page."
> "This is a static dump of the old wiki, taken after locking it in
> January 2015. The new wiki is at https://wireless.wiki.kernel.org/.;

Indeed, we migrated the wiki to new infrastructure hosted on kernel.org
back then.

> Trying to find related information by searching for "calibrator" on
> https://wireless.wiki.kernel.org will yield
> https://wireless.wiki.kernel.org/en/developers/documentation/nl80211?
> s[]=calibrator where "wl12xx calibrator" is a *dead link*.
> The apparent underlying reason for this surfaces when going through
> the en ... users ... Drivers hierarchy to
> https://wireless.wiki.kernel.org/en/users/drivers/wl12xx
> where it says
> "
> For relicensing, the content of this page was removed.
> 
> The old website for now has a copy of the old content:
> 
> http://linuxwireless.sipsolutions.net/en/users/Drivers/wl12xx/·
> "

Right, so there were some people who couldn't be reached for
relicensing of their submissions under the license the new wiki
requires. The wl1251 and wl12xx pages were removed since I couldn't
reach Gery Kahn and Oz Krakowski, or they couldn't agree to
relicensing, I don't remember. I still have the Google spreadsheet that
tells me who it was though :-)

> Somehow I am not quite feeling entirely well with this status quo
> (I would expect that that content *will* get lost, and possibly
> rather sooner than later, since someone is bound to eventually say
> "the old site copy is not needed any more").

I have no intention of removing it, since it's a static HTML site and
has no maintenance overhead.

> So, are there some ways to improve the content situation,
> or will this job then eventually need to be done by last-ditch
> efforts (web.archive.org etc.)?

I can't side-step the licensing issue, so no. You can download and
store locally everything you need, I guess.

johannes


Re: [PATCH v2 0/9] Add support for Neighbor Awareness Networking

2016-09-16 Thread Arend Van Spriel
On 16-9-2016 10:33, Luca Coelho wrote:
> From: Luca Coelho 
> 
> Hi,
> 
> This is v2 of the NAN patches that Emmanuel sent a while back[1].  In
> this version, we squashed some patches and took care of some comments
> after reviews (both internal and public).

Hi Luca,

You may have missed some as I think this should be v4.

Regards,
Arend

[1]
http://mid.gmane.org/1458845547-28762-1-git-send-email-emmanuel.grumb...@intel.com

> NAN was described in the original post[2].
> 
> I hope they're good for merging now, because I'm tired of carrying
> this changes forward in our internal trees. :P
> 
> Nevertheless, comments are welcome, as always.
> 
> [1] 
> http://mid.gmane.org/1456752313-5792-1-git-send-email-emmanuel.grumb...@intel.com
> [2] 
> http://mid.gmane.org/1442500351-8780-1-git-send-email-andrei.otcheretian...@intel.com
> 
> Cheers,
> Luca.
> 
> 
> Ayala Beker (9):
>   cfg80211: add start / stop NAN commands
>   mac80211: add boilerplate code for start / stop NAN
>   cfg80211: add add_nan_func / rm_nan_func
>   cfg80211: allow the user space to change current NAN configuration
>   cfg80211: provide a function to report a match for NAN
>   cfg80211: Provide an API to report NAN function termination
>   mac80211: implement nan_change_conf
>   mac80211: Implement add_nan_func and rm_nan_func
>   mac80211: Add API to report NAN function match
> 
>  include/net/cfg80211.h   | 184 -
>  include/net/mac80211.h   |  65 +
>  include/uapi/linux/nl80211.h | 258 +
>  net/mac80211/cfg.c   | 208 ++
>  net/mac80211/chan.c  |   6 +
>  net/mac80211/driver-ops.h|  82 +-
>  net/mac80211/ieee80211_i.h   |  17 ++
>  net/mac80211/iface.c |  28 +-
>  net/mac80211/main.c  |   8 +
>  net/mac80211/offchannel.c|   4 +-
>  net/mac80211/rx.c|   3 +
>  net/mac80211/trace.h | 133 +
>  net/mac80211/util.c  |  50 +++-
>  net/wireless/chan.c  |   2 +
>  net/wireless/core.c  |  35 +++
>  net/wireless/core.h  |   3 +
>  net/wireless/mlme.c  |   1 +
>  net/wireless/nl80211.c   | 642 
> ++-
>  net/wireless/rdev-ops.h  |  58 
>  net/wireless/trace.h |  90 ++
>  net/wireless/util.c  |  28 +-
>  21 files changed, 1894 insertions(+), 11 deletions(-)
> 


[PATCH v2 5/9] cfg80211: provide a function to report a match for NAN

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

Provide a function the driver can call to report a match.
This will send the event to the user space.
If the NAN instance is tied to the owner, the notifications will be
sent to the socket that started the NAN interface only.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/cfg80211.h   | 37 +
 include/uapi/linux/nl80211.h | 31 ++
 net/wireless/nl80211.c   | 78 
 3 files changed, 146 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b819e32..a08d7da 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5639,6 +5639,43 @@ wiphy_ext_feature_isset(struct wiphy *wiphy,
  */
 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
 
+/**
+ * struct cfg80211_nan_match_params - NAN match parameters
+ * @type: the type of the function that triggered a match. If it is
+ *  %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
+ *  If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
+ *  result.
+ *  If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
+ * @inst_id: the local instance id
+ * @peer_inst_id: the instance id of the peer's function
+ * @addr: the MAC address of the peer
+ * @info_len: the length of the 
+ * @info: the Service Specific Info from the peer (if any)
+ * @cookie: unique identifier of the corresponding function
+ */
+struct cfg80211_nan_match_params {
+   enum nl80211_nan_function_type type;
+   u8 inst_id;
+   u8 peer_inst_id;
+   const u8 *addr;
+   u8 info_len;
+   const u8 *info;
+   u64 cookie;
+};
+
+/**
+ * cfg80211_nan_match - report a match for a NAN function.
+ * @wdev: the wireless device reporting the match
+ * @match: match notification parameters
+ * @gfp: allocation flags
+ *
+ * This function reports that the a NAN function had a match. This
+ * can be a subscribe that had a match or a solicited publish that
+ * was sent. It can also be a follow up that was received.
+ */
+void cfg80211_nan_match(struct wireless_dev *wdev,
+   struct cfg80211_nan_match_params *match, gfp_t gfp);
+
 /* ethtool helper */
 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo 
*info);
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 9cf1744..badb4a6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -48,6 +48,7 @@
 #define NL80211_MULTICAST_GROUP_REG"regulatory"
 #define NL80211_MULTICAST_GROUP_MLME   "mlme"
 #define NL80211_MULTICAST_GROUP_VENDOR "vendor"
+#define NL80211_MULTICAST_GROUP_NAN"nan"
 #define NL80211_MULTICAST_GROUP_TESTMODE   "testmode"
 
 /**
@@ -869,6 +870,9 @@
  * must be operational (%NL80211_CMD_START_NAN was executed).
  * It must contain at least one of the following attributes:
  * %NL80211_ATTR_NAN_MASTER_PREF, %NL80211_ATTR_NAN_DUAL.
+ * @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported.
+ * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
+ * %NL80211_ATTR_COOKIE.
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1063,6 +1067,7 @@ enum nl80211_commands {
NL80211_CMD_ADD_NAN_FUNCTION,
NL80211_CMD_RM_NAN_FUNCTION,
NL80211_CMD_CHANGE_NAN_CONFIG,
+   NL80211_CMD_NAN_MATCH,
 
/* add new commands above here */
 
@@ -1923,6 +1928,8 @@ enum nl80211_commands {
  * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
  *  nl80211_nan_func_attributes for description of this nested
  * attribute.
+ * @NL80211_ATTR_NAN_MATCH: used to report a match. This is a nested attribute.
+ * See  nl80211_nan_match_attributes.
  *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2321,6 +2328,7 @@ enum nl80211_attrs {
NL80211_ATTR_NAN_MASTER_PREF,
NL80211_ATTR_NAN_DUAL,
NL80211_ATTR_NAN_FUNC,
+   NL80211_ATTR_NAN_MATCH,
 
/* add attributes here, update the policy in nl80211.c */
 
@@ -5067,4 +5075,27 @@ enum nl80211_nan_srf_attributes {
NL80211_NAN_SRF_ATTR_MAX = NUM_NL80211_NAN_SRF_ATTR - 1,
 };
 
+/**
+ * enum nl80211_nan_match_attributes - NAN match attributes
+ * @__NL80211_NAN_MATCH_INVALID: invalid
+ * @NL80211_NAN_MATCH_FUNC_LOCAL: the local function that had the
+ * match. This is a nested attribute.
+ * See  nl80211_nan_func_attributes.
+ * @NL80211_NAN_MATCH_FUNC_PEER: the peer function
+ * that caused the match. This is a nested attribute.
+ * See  nl80211_nan_func_attributes.
+ *
+ * @NUM_NL80211_NAN_MATCH_ATTR: 

[PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

A NAN function can be either publish, subscribe or follow
up. Make all the necessary verifications and just pass the
request to the driver.
Allow the user space application that starts NAN to
forbid any other socket to add or remove functions.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Ayala Beker 
Signed-off-by: Luca Coelho 
---
 include/net/cfg80211.h   |  91 +++
 include/uapi/linux/nl80211.h | 153 ++
 net/wireless/core.c  |   3 +-
 net/wireless/nl80211.c   | 368 +++
 net/wireless/rdev-ops.h  |  21 +++
 net/wireless/trace.h |  39 +
 net/wireless/util.c  |  22 +++
 7 files changed, 696 insertions(+), 1 deletion(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ca64d69..ced5b8a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2306,6 +2306,73 @@ struct cfg80211_nan_conf {
 };
 
 /**
+ * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
+ *
+ * @filter: the content of the filter
+ * @len: the length of the filter
+ */
+struct cfg80211_nan_func_filter {
+   const u8 *filter;
+   u8 len;
+};
+
+/**
+ * struct cfg80211_nan_func - a NAN function
+ *
+ * @type:  nl80211_nan_function_type
+ * @service_id: the service ID of the function
+ * @publish_type: _nan_publish_type
+ * @close_range: if true, the range should be limited. Threshold is
+ * implementation specific.
+ * @publish_bcast: if true, the solicited publish should be broadcasted
+ * @subscribe_active: if true, the subscribe is active
+ * @followup_id: the instance ID for follow up
+ * @followup_reqid: the requestor instance ID for follow up
+ * @followup_dest: MAC address of the recipient of the follow up
+ * @ttl: time to live counter in DW.
+ * @serv_spec_info: Service Specific Info
+ * @serv_spec_info_len: Service Specific Info length
+ * @srf_include: if true, SRF is inclusive
+ * @srf_bf: Bloom Filter
+ * @srf_bf_len: Bloom Filter length
+ * @srf_bf_idx: Bloom Filter index
+ * @srf_macs: SRF MAC addresses
+ * @srf_num_macs: number of MAC addresses in SRF
+ * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
+ * @tx_filters: filters that should be transmitted in the SDF.
+ * @num_rx_filters: length of _filters.
+ * @num_tx_filters: length of _filters.
+ * @instance_id: driver allocated id of the function.
+ * @cookie: unique NAN function identifier.
+ */
+struct cfg80211_nan_func {
+   enum nl80211_nan_function_type type;
+   u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
+   u8 publish_type;
+   bool close_range;
+   bool publish_bcast;
+   bool subscribe_active;
+   u8 followup_id;
+   u8 followup_reqid;
+   struct mac_address followup_dest;
+   u32 ttl;
+   const u8 *serv_spec_info;
+   u8 serv_spec_info_len;
+   bool srf_include;
+   const u8 *srf_bf;
+   u8 srf_bf_len;
+   u8 srf_bf_idx;
+   struct mac_address *srf_macs;
+   int srf_num_macs;
+   struct cfg80211_nan_func_filter *rx_filters;
+   struct cfg80211_nan_func_filter *tx_filters;
+   u8 num_tx_filters;
+   u8 num_rx_filters;
+   u8 instance_id;
+   u64 cookie;
+};
+
+/**
  * struct cfg80211_ops - backend description for wireless configuration
  *
  * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2595,6 +2662,14 @@ struct cfg80211_nan_conf {
  * peers must be on the base channel when the call completes.
  * @start_nan: Start the NAN interface.
  * @stop_nan: Stop the NAN interface.
+ * @add_nan_func: Add a NAN function. Returns negative value on failure.
+ * On success @nan_func ownership is transferred to the driver and
+ * it may access it outside of the scope of this function. The driver
+ * should free the @nan_func when no longer needed by calling
+ * cfg80211_free_nan_func().
+ * On success the driver should assign an instance_id in the
+ * provided @nan_func.
+ * @rm_nan_func: Remove a NAN function.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2863,6 +2938,10 @@ struct cfg80211_ops {
int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
 struct cfg80211_nan_conf *conf);
void(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
+   int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
+   struct cfg80211_nan_func *nan_func);
+   void(*rm_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
+  u64 cookie);
 };
 
 /*
@@ -3311,6 +3390,8 @@ struct wiphy_iftype_ext_capab {
  * @bss_select_support: bitmask indicating the 

[PATCH v2 4/9] cfg80211: allow the user space to change current NAN configuration

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

Some NAN configuration paramaters may change during the operation of
the NaN device. For example, a user may want to update master preference
value when the device gets plugged/unplugged to the power.
Add API that allows to do so.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/cfg80211.h   | 19 +++
 include/uapi/linux/nl80211.h | 11 +--
 net/wireless/nl80211.c   | 45 
 net/wireless/rdev-ops.h  | 17 +
 net/wireless/trace.h | 24 +++
 5 files changed, 114 insertions(+), 2 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ced5b8a..b819e32 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2306,6 +2306,18 @@ struct cfg80211_nan_conf {
 };
 
 /**
+ * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
+ * configuration
+ *
+ * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
+ * @CFG80211_NAN_CONF_CHANGED_DUAL: dual band operation
+ */
+enum cfg80211_nan_conf_changes {
+   CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
+   CFG80211_NAN_CONF_CHANGED_DUAL = BIT(1),
+};
+
+/**
  * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
  *
  * @filter: the content of the filter
@@ -2670,6 +2682,9 @@ struct cfg80211_nan_func {
  * On success the driver should assign an instance_id in the
  * provided @nan_func.
  * @rm_nan_func: Remove a NAN function.
+ * @nan_change_conf: changes NAN configuration. The changed parameters must
+ * be specified in @changes (using  cfg80211_nan_conf_changes);
+ * All other parameters must be ignored.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2942,6 +2957,10 @@ struct cfg80211_ops {
struct cfg80211_nan_func *nan_func);
void(*rm_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
   u64 cookie);
+   int (*nan_change_conf)(struct wiphy *wiphy,
+  struct wireless_dev *wdev,
+  struct cfg80211_nan_conf *conf,
+  u32 changes);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index ab16c8e..9cf1744 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -865,6 +865,10 @@
  * This command is also used as a notification sent when a NAN function is
  * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID
  * and %NL80211_ATTR_COOKIE attributes.
+ * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN configuration. NAN
+ * must be operational (%NL80211_CMD_START_NAN was executed).
+ * It must contain at least one of the following attributes:
+ * %NL80211_ATTR_NAN_MASTER_PREF, %NL80211_ATTR_NAN_DUAL.
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1058,6 +1062,7 @@ enum nl80211_commands {
NL80211_CMD_STOP_NAN,
NL80211_CMD_ADD_NAN_FUNCTION,
NL80211_CMD_RM_NAN_FUNCTION,
+   NL80211_CMD_CHANGE_NAN_CONFIG,
 
/* add new commands above here */
 
@@ -1907,12 +1912,14 @@ enum nl80211_commands {
  * used to pull the stored data for mesh peer in power save state.
  *
  * @NL80211_ATTR_NAN_MASTER_PREF: the master preference to be used by
- * %NL80211_CMD_START_NAN. Its type is u8 and it can't be 0.
+ * %NL80211_CMD_START_NAN and optionally with
+ * %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0.
  * Also, values 1 and 255 are reserved for certification purposes and
  * should not be used during a normal device operation.
  * @NL80211_ATTR_NAN_DUAL: NAN dual band operation config (see
  *  nl80211_nan_dual_band_conf). This attribute is used with
- * %NL80211_CMD_START_NAN.
+ * %NL80211_CMD_START_NAN and optionally with
+ * %NL80211_CMD_CHANGE_NAN_CONFIG.
  * @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
  *  nl80211_nan_func_attributes for description of this nested
  * attribute.
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 58b3127..d627527 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10830,6 +10830,43 @@ static int nl80211_nan_rm_func(struct sk_buff *skb,
return 0;
 }
 
+static int nl80211_nan_change_config(struct sk_buff *skb,
+struct genl_info *info)
+{
+   struct cfg80211_registered_device *rdev = info->user_ptr[0];
+   struct wireless_dev *wdev = info->user_ptr[1];
+   struct cfg80211_nan_conf conf = {};
+   u32 changed = 0;
+
+   if (wdev->iftype != NL80211_IFTYPE_NAN)
+ 

[PATCH v2 9/9] mac80211: Add API to report NAN function match

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

Provide an API to report NAN function match. Mac80211 will lookup the
corresponding cookie and report the match to cfg80211.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/mac80211.h | 16 
 net/mac80211/cfg.c | 25 +
 2 files changed, 41 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5b74229..1b6271e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5777,4 +5777,20 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif 
*vif,
   u8 inst_id,
   enum nl80211_nan_func_term_reason reason,
   gfp_t gfp);
+
+/**
+ * ieee80211_nan_func_match - notify about NAN function match event.
+ *
+ * This function is used to notify mac80211 about NAN function match. The
+ * cookie inside the match struct will be assigned by mac80211.
+ * Note that this function can't be called from hard irq.
+ *
+ * @vif:  ieee80211_vif pointer from the add_interface callback.
+ * @match: match event information
+ * @gfp: allocation flags
+ */
+void ieee80211_nan_func_match(struct ieee80211_vif *vif,
+ struct cfg80211_nan_match_params *match,
+ gfp_t gfp);
+
 #endif /* MAC80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index aee0e25c..20ac00f 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3555,6 +3555,31 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif 
*vif,
 }
 EXPORT_SYMBOL(ieee80211_nan_func_terminated);
 
+void ieee80211_nan_func_match(struct ieee80211_vif *vif,
+ struct cfg80211_nan_match_params *match,
+ gfp_t gfp)
+{
+   struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+   struct cfg80211_nan_func *func;
+
+   if (WARN_ON(vif->type != NL80211_IFTYPE_NAN))
+   return;
+
+   spin_lock_bh(>u.nan.func_lock);
+
+   func = idr_find(>u.nan.function_inst_ids,  match->inst_id);
+   if (WARN_ON(!func)) {
+   spin_unlock_bh(>u.nan.func_lock);
+   return;
+   }
+   match->cookie = func->cookie;
+
+   spin_unlock_bh(>u.nan.func_lock);
+
+   cfg80211_nan_match(ieee80211_vif_to_wdev(vif), match, gfp);
+}
+EXPORT_SYMBOL(ieee80211_nan_func_match);
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
-- 
2.9.3



[PATCH v2 2/9] mac80211: add boilerplate code for start / stop NAN

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

This code doesn't do much besides allowing to start and
stop the vif.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Ayala Beker 
Signed-off-by: Luca Coelho 
---
 include/net/mac80211.h|  9 +
 net/mac80211/cfg.c| 36 ++
 net/mac80211/chan.c   |  3 +++
 net/mac80211/driver-ops.h | 29 ++-
 net/mac80211/iface.c  |  8 ++--
 net/mac80211/main.c   |  5 +
 net/mac80211/offchannel.c |  3 ++-
 net/mac80211/trace.h  | 50 +++
 net/mac80211/util.c   |  3 ++-
 9 files changed, 141 insertions(+), 5 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5296100..df9b5cf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3420,6 +3420,9 @@ enum ieee80211_reconfig_type {
  * synchronization which is needed in case driver has in its RSS queues
  * pending frames that were received prior to the control path action
  * currently taken (e.g. disassociation) but are not processed yet.
+ *
+ * @start_nan: join an existing NAN cluster, or create a new one.
+ * @stop_nan: leave the NAN cluster.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3655,6 +3658,12 @@ struct ieee80211_ops {
void (*wake_tx_queue)(struct ieee80211_hw *hw,
  struct ieee80211_txq *txq);
void (*sync_rx_queues)(struct ieee80211_hw *hw);
+
+   int (*start_nan)(struct ieee80211_hw *hw,
+struct ieee80211_vif *vif,
+struct cfg80211_nan_conf *conf);
+   int (*stop_nan)(struct ieee80211_hw *hw,
+   struct ieee80211_vif *vif);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a74027f..9aabb09 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3,6 +3,7 @@
  *
  * Copyright 2006-2010 Johannes Berg 
  * Copyright 2013-2015  Intel Mobile Communications GmbH
+ * Copyright (C) 2015-2016 Intel Deutschland GmbH
  *
  * This file is GPLv2 as found in COPYING.
  */
@@ -152,6 +153,39 @@ static void ieee80211_stop_p2p_device(struct wiphy *wiphy,
ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev));
 }
 
+static int ieee80211_start_nan(struct wiphy *wiphy,
+  struct wireless_dev *wdev,
+  struct cfg80211_nan_conf *conf)
+{
+   struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+   int ret;
+
+   mutex_lock(>local->chanctx_mtx);
+   ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
+   mutex_unlock(>local->chanctx_mtx);
+   if (ret < 0)
+   return ret;
+
+   ret = ieee80211_do_open(wdev, true);
+   if (ret)
+   return ret;
+
+   ret = drv_start_nan(sdata->local, sdata, conf);
+   if (ret)
+   ieee80211_sdata_stop(sdata);
+
+   return ret;
+}
+
+static void ieee80211_stop_nan(struct wiphy *wiphy,
+  struct wireless_dev *wdev)
+{
+   struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+   drv_stop_nan(sdata->local, sdata);
+   ieee80211_sdata_stop(sdata);
+}
+
 static int ieee80211_set_noack_map(struct wiphy *wiphy,
  struct net_device *dev,
  u16 noack_map)
@@ -3464,4 +3498,6 @@ const struct cfg80211_ops mac80211_config_ops = {
.set_ap_chanwidth = ieee80211_set_ap_chanwidth,
.add_tx_ts = ieee80211_add_tx_ts,
.del_tx_ts = ieee80211_del_tx_ts,
+   .start_nan = ieee80211_start_nan,
+   .stop_nan = ieee80211_stop_nan,
 };
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index acb50f8..e4d147e 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -647,6 +647,9 @@ static int ieee80211_assign_vif_chanctx(struct 
ieee80211_sub_if_data *sdata,
struct ieee80211_chanctx *curr_ctx = NULL;
int ret = 0;
 
+   if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN))
+   return -ENOTSUPP;
+
conf = rcu_dereference_protected(sdata->vif.chanctx_conf,
 lockdep_is_held(>chanctx_mtx));
 
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index fe35a1c..67b42c8 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -163,7 +163,8 @@ static inline void drv_bss_info_changed(struct 
ieee80211_local *local,
 
if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
- !sdata->vif.mu_mimo_owner)))
+ !sdata->vif.mu_mimo_owner) ||
+   

[PATCH v2 6/9] cfg80211: Provide an API to report NAN function termination

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

Provide a function that reports NAN DE function termination. The function
may be terminated due to one of the following reasons: user request,
ttl expiration or failure.
If the NAN instance is tied to the owner, the notification will be
sent to the socket that started the NAN interface only

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/cfg80211.h   | 16 
 include/uapi/linux/nl80211.h | 15 
 net/wireless/nl80211.c   | 58 
 3 files changed, 89 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a08d7da..81770d6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5676,6 +5676,22 @@ struct cfg80211_nan_match_params {
 void cfg80211_nan_match(struct wireless_dev *wdev,
struct cfg80211_nan_match_params *match, gfp_t gfp);
 
+/**
+ * cfg80211_nan_func_terminated - notify about NAN function termination.
+ *
+ * @wdev: the wireless device reporting the match
+ * @inst_id: the local instance id
+ * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
+ * @cookie: unique NAN function identifier
+ * @gfp: allocation flags
+ *
+ * This function reports that the a NAN function is terminated.
+ */
+void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
+ u8 inst_id,
+ enum nl80211_nan_func_term_reason reason,
+ u64 cookie, gfp_t gfp);
+
 /* ethtool helper */
 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo 
*info);
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index badb4a6..fd86be6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4978,6 +4978,21 @@ enum nl80211_nan_publish_type {
NL80211_NAN_UNSOLICITED_PUBLISH = 1 << 1,
 };
 
+/**
+ * enum nl80211_nan_func_term_reason - NAN functions termination reason
+ *
+ * Defines termination reasons of a NAN function
+ *
+ * @NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST: requested by user
+ * @NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED: timeout
+ * @NL80211_NAN_FUNC_TERM_REASON_ERROR: errored
+ */
+enum nl80211_nan_func_term_reason {
+   NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST,
+   NL80211_NAN_FUNC_TERM_REASON_TTL_EXPIRED,
+   NL80211_NAN_FUNC_TERM_REASON_ERROR,
+};
+
 #define NL80211_NAN_FUNC_SERVICE_ID_LEN 6
 #define NL80211_NAN_FUNC_SERVICE_SPEC_INFO_MAX_LEN 0xff
 #define NL80211_NAN_FUNC_SRF_MAX_LEN 0xff
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4d37717..f817105 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10945,6 +10945,64 @@ nla_put_failure:
 }
 EXPORT_SYMBOL(cfg80211_nan_match);
 
+void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
+ u8 inst_id,
+ enum nl80211_nan_func_term_reason reason,
+ u64 cookie, gfp_t gfp)
+{
+   struct wiphy *wiphy = wdev->wiphy;
+   struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+   struct sk_buff *msg;
+   struct nlattr *func_attr;
+   void *hdr;
+
+   if (WARN_ON(!inst_id))
+   return;
+
+   msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
+   if (!msg)
+   return;
+
+   hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_RM_NAN_FUNCTION);
+   if (!hdr) {
+   nlmsg_free(msg);
+   return;
+   }
+
+   if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+   (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
+wdev->netdev->ifindex)) ||
+   nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)))
+   goto nla_put_failure;
+
+   if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie))
+   goto nla_put_failure;
+
+   func_attr = nla_nest_start(msg, NL80211_ATTR_NAN_FUNC);
+   if (!func_attr)
+   goto nla_put_failure;
+
+   if (nla_put_u8(msg, NL80211_NAN_FUNC_INSTANCE_ID, inst_id) ||
+   nla_put_u8(msg, NL80211_NAN_FUNC_TERM_REASON, reason))
+   goto nla_put_failure;
+
+   nla_nest_end(msg, func_attr);
+   genlmsg_end(msg, hdr);
+
+   if (!wdev->owner_nlportid)
+   genlmsg_multicast_netns(_fam, wiphy_net(>wiphy),
+   msg, 0, NL80211_MCGRP_NAN, gfp);
+   else
+   genlmsg_unicast(wiphy_net(>wiphy), msg,
+   wdev->owner_nlportid);
+
+   return;
+
+nla_put_failure:
+   nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_nan_func_terminated);
+
 static int nl80211_get_protocol_features(struct sk_buff *skb,
   

[PATCH v2 0/9] Add support for Neighbor Awareness Networking

2016-09-16 Thread Luca Coelho
From: Luca Coelho 

Hi,

This is v2 of the NAN patches that Emmanuel sent a while back[1].  In
this version, we squashed some patches and took care of some comments
after reviews (both internal and public).

NAN was described in the original post[2].

I hope they're good for merging now, because I'm tired of carrying
this changes forward in our internal trees. :P

Nevertheless, comments are welcome, as always.

[1] 
http://mid.gmane.org/1456752313-5792-1-git-send-email-emmanuel.grumb...@intel.com
[2] 
http://mid.gmane.org/1442500351-8780-1-git-send-email-andrei.otcheretian...@intel.com

Cheers,
Luca.


Ayala Beker (9):
  cfg80211: add start / stop NAN commands
  mac80211: add boilerplate code for start / stop NAN
  cfg80211: add add_nan_func / rm_nan_func
  cfg80211: allow the user space to change current NAN configuration
  cfg80211: provide a function to report a match for NAN
  cfg80211: Provide an API to report NAN function termination
  mac80211: implement nan_change_conf
  mac80211: Implement add_nan_func and rm_nan_func
  mac80211: Add API to report NAN function match

 include/net/cfg80211.h   | 184 -
 include/net/mac80211.h   |  65 +
 include/uapi/linux/nl80211.h | 258 +
 net/mac80211/cfg.c   | 208 ++
 net/mac80211/chan.c  |   6 +
 net/mac80211/driver-ops.h|  82 +-
 net/mac80211/ieee80211_i.h   |  17 ++
 net/mac80211/iface.c |  28 +-
 net/mac80211/main.c  |   8 +
 net/mac80211/offchannel.c|   4 +-
 net/mac80211/rx.c|   3 +
 net/mac80211/trace.h | 133 +
 net/mac80211/util.c  |  50 +++-
 net/wireless/chan.c  |   2 +
 net/wireless/core.c  |  35 +++
 net/wireless/core.h  |   3 +
 net/wireless/mlme.c  |   1 +
 net/wireless/nl80211.c   | 642 ++-
 net/wireless/rdev-ops.h  |  58 
 net/wireless/trace.h |  90 ++
 net/wireless/util.c  |  28 +-
 21 files changed, 1894 insertions(+), 11 deletions(-)

-- 
2.9.3



[PATCH v2 1/9] cfg80211: add start / stop NAN commands

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

This allows user space to start/stop NAN interface.
A NAN interface is like P2P device in a few aspects: it
doesn't have a netdev associated to it.
Add the new interface type and prevent operations that
can't be executed on NAN interface like scan.

Define several attributes that may be configured by user space
when starting NAN functionality (master preference and dual
band operation)

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/cfg80211.h   | 21 +-
 include/uapi/linux/nl80211.h | 52 +
 net/mac80211/cfg.c   |  2 +
 net/mac80211/chan.c  |  3 ++
 net/mac80211/iface.c |  4 ++
 net/mac80211/offchannel.c|  1 +
 net/mac80211/rx.c|  3 ++
 net/mac80211/util.c  |  1 +
 net/wireless/chan.c  |  2 +
 net/wireless/core.c  | 34 
 net/wireless/core.h  |  3 ++
 net/wireless/mlme.c  |  1 +
 net/wireless/nl80211.c   | 93 ++--
 net/wireless/rdev-ops.h  | 20 ++
 net/wireless/trace.h | 27 +
 net/wireless/util.c  |  6 ++-
 16 files changed, 267 insertions(+), 6 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d5e7f69..ca64d69 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2293,6 +2293,19 @@ struct cfg80211_qos_map {
 };
 
 /**
+ * struct cfg80211_nan_conf - NAN configuration
+ *
+ * This struct defines NAN configuration parameters
+ *
+ * @master_pref: master preference (1 - 255)
+ * @dual: dual band operation mode
+ */
+struct cfg80211_nan_conf {
+   u8 master_pref;
+   enum nl80211_nan_dual_band_conf dual;
+};
+
+/**
  * struct cfg80211_ops - backend description for wireless configuration
  *
  * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2580,6 +2593,8 @@ struct cfg80211_qos_map {
  * and returning to the base channel for communication with the AP.
  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
  * peers must be on the base channel when the call completes.
+ * @start_nan: Start the NAN interface.
+ * @stop_nan: Stop the NAN interface.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2845,6 +2860,9 @@ struct cfg80211_ops {
void(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
  struct net_device *dev,
  const u8 *addr);
+   int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
+struct cfg80211_nan_conf *conf);
+   void(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
 };
 
 /*
@@ -3602,6 +3620,7 @@ struct cfg80211_cached_keys;
  * beacons, 0 when not valid
  * @address: The address for this device, valid only if @netdev is %NULL
  * @p2p_started: true if this is a P2P Device that has been started
+ * @nan_started: true if this is a NAN interface that has been started
  * @cac_started: true if DFS channel availability check has been started
  * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
  * @cac_time_ms: CAC time in ms
@@ -3633,7 +3652,7 @@ struct wireless_dev {
 
struct mutex mtx;
 
-   bool use_4addr, p2p_started;
+   bool use_4addr, p2p_started, nan_started;
 
u8 address[ETH_ALEN] __aligned(sizeof(u16));
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 2206941..7ab18c8 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -838,6 +838,16 @@
  * not running. The driver indicates the status of the scan through
  * cfg80211_scan_done().
  *
+ * @NL80211_CMD_START_NAN: Start NAN operation, identified by its
+ * %NL80211_ATTR_WDEV interface. This interface must have been previously
+ * created with %NL80211_CMD_NEW_INTERFACE. After it has been started, the
+ * NAN interface will create or join a cluster. This command must have a
+ * valid %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
+ * %NL80211_ATTR_NAN_DUAL attributes.
+ * After this command NAN functions can be added.
+ * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
+ * its %NL80211_ATTR_WDEV interface.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1026,6 +1036,9 @@ enum nl80211_commands {
 
NL80211_CMD_ABORT_SCAN,
 
+   NL80211_CMD_START_NAN,
+   NL80211_CMD_STOP_NAN,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -1733,6 +1746,12 @@ enum nl80211_commands {
  * regulatory indoor configuration would be 

[PATCH v2 8/9] mac80211: Implement add_nan_func and rm_nan_func

2016-09-16 Thread Luca Coelho
From: Ayala Beker 

Implement add/rm_nan_func functions and handle NAN function
termination notifications. Handle instance_id allocation for
NAN functions and implement the reconfig flow.

Signed-off-by: Andrei Otcheretianski 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luca Coelho 
---
 include/net/mac80211.h |  31 
 net/mac80211/cfg.c | 114 +
 net/mac80211/driver-ops.h  |  32 +
 net/mac80211/ieee80211_i.h |   7 +++
 net/mac80211/iface.c   |  20 +++-
 net/mac80211/main.c|   3 ++
 net/mac80211/trace.h   |  52 +
 net/mac80211/util.c|  48 ++-
 8 files changed, 304 insertions(+), 3 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ef8d02a..5b74229 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2177,6 +2177,8 @@ enum ieee80211_hw_flags {
  * @n_cipher_schemes: a size of an array of cipher schemes definitions.
  * @cipher_schemes: a pointer to an array of cipher scheme definitions
  * supported by HW.
+ * @max_nan_de_entries: maximum number of NAN DE functions supported by the
+ * device.
  */
 struct ieee80211_hw {
struct ieee80211_conf conf;
@@ -2211,6 +2213,7 @@ struct ieee80211_hw {
u8 uapsd_max_sp_len;
u8 n_cipher_schemes;
const struct ieee80211_cipher_scheme *cipher_schemes;
+   u8 max_nan_de_entries;
 };
 
 static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
@@ -3429,6 +3432,12 @@ enum ieee80211_reconfig_type {
  * The driver gets both full configuration and the changed parameters since
  * some devices may need the full configuration while others need only the
  * changed parameters.
+ * @add_nan_func: Add a NAN function. Returns 0 on success. The data in
+ * cfg80211_nan_func must not be referenced outside the scope of
+ * this call.
+ * @rm_nan_func: Remove a NAN function. The driver must call
+ * ieee80211_nan_func_terminated() with
+ * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3673,6 +3682,12 @@ struct ieee80211_ops {
int (*nan_change_conf)(struct ieee80211_hw *hw,
   struct ieee80211_vif *vif,
   struct cfg80211_nan_conf *conf, u32 changes);
+   int (*add_nan_func)(struct ieee80211_hw *hw,
+   struct ieee80211_vif *vif,
+   const struct cfg80211_nan_func *nan_func);
+   void (*rm_nan_func)(struct ieee80211_hw *hw,
+   struct ieee80211_vif *vif,
+   u8 instance_id);
 };
 
 /**
@@ -5746,4 +5761,20 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw 
*hw,
 void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
 unsigned long *frame_cnt,
 unsigned long *byte_cnt);
+
+/**
+ * ieee80211_nan_func_terminated - notify about NAN function termination.
+ *
+ * This function is used to notify mac80211 about NAN function termination.
+ * Note that this function can't be called from hard irq.
+ *
+ * @vif:  ieee80211_vif pointer from the add_interface callback.
+ * @inst_id: the local instance id
+ * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
+ * @gfp: allocation flags
+ */
+void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
+  u8 inst_id,
+  enum nl80211_nan_func_term_reason reason,
+  gfp_t gfp);
 #endif /* MAC80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 38fdb53..aee0e25c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -174,6 +174,8 @@ static int ieee80211_start_nan(struct wiphy *wiphy,
if (ret)
ieee80211_sdata_stop(sdata);
 
+   sdata->u.nan.conf = *conf;
+
return ret;
 }
 
@@ -216,6 +218,84 @@ static int ieee80211_nan_change_conf(struct wiphy *wiphy,
return ret;
 }
 
+static int ieee80211_add_nan_func(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ struct cfg80211_nan_func *nan_func)
+{
+   struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+   int ret;
+
+   if (sdata->vif.type != NL80211_IFTYPE_NAN)
+   return -EOPNOTSUPP;
+
+   if (!ieee80211_sdata_running(sdata))
+   return -ENETDOWN;
+
+   spin_lock_bh(>u.nan.func_lock);
+
+   ret = idr_alloc(>u.nan.function_inst_ids,
+   nan_func, 1, sdata->local->hw.max_nan_de_entries + 1,
+   GFP_ATOMIC);
+   spin_unlock_bh(>u.nan.func_lock);
+
+   if (ret 

[PATCH v2 07/25] iwlwifi: introduce trans API to get byte count table

2016-09-16 Thread Luca Coelho
From: Sara Sharon 

In future HW the byte count table address will be configured
by ucode per queue. Add API to expose the byte count table to
the opmode

Signed-off-by: Sara Sharon 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 11 +++
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h |  1 +
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c|  2 ++
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c   |  8 
 4 files changed, 22 insertions(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 883cb487b..04e998d 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -645,6 +645,8 @@ struct iwl_trans_ops {
void (*txq_set_shared_mode)(struct iwl_trans *trans, u32 txq_id,
bool shared);
 
+   dma_addr_t (*get_txq_byte_table)(struct iwl_trans *trans, int txq_id);
+
int (*wait_tx_queue_empty)(struct iwl_trans *trans, u32 txq_bm);
void (*freeze_txq_timer)(struct iwl_trans *trans, unsigned long txqs,
 bool freeze);
@@ -1069,6 +1071,15 @@ static inline void iwl_trans_txq_set_shared_mode(struct 
iwl_trans *trans,
trans->ops->txq_set_shared_mode(trans, queue, shared_mode);
 }
 
+static inline dma_addr_t iwl_trans_get_txq_byte_table(struct iwl_trans *trans,
+ int queue)
+{
+   /* we should never be called if the trans doesn't support it */
+   BUG_ON(!trans->ops->get_txq_byte_table);
+
+   return trans->ops->get_txq_byte_table(trans, queue);
+}
+
 static inline void iwl_trans_txq_enable(struct iwl_trans *trans, int queue,
int fifo, int sta_id, int tid,
int frame_limit, u16 ssn,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
index 975900a..b9dc82b 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
@@ -476,6 +476,7 @@ void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, 
int queue,
bool configure_scd);
 void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans *trans, u32 txq_id,
bool shared_mode);
+dma_addr_t iwl_trans_pcie_get_txq_byte_table(struct iwl_trans *trans, int txq);
 void iwl_trans_pcie_log_scd_error(struct iwl_trans *trans,
  struct iwl_txq *txq);
 int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 0c2ccbe..21b1be1 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -2803,6 +2803,8 @@ static const struct iwl_trans_ops trans_ops_pcie = {
.txq_disable = iwl_trans_pcie_txq_disable,
.txq_enable = iwl_trans_pcie_txq_enable,
 
+   .get_txq_byte_table = iwl_trans_pcie_get_txq_byte_table,
+
.txq_set_shared_mode = iwl_trans_pcie_txq_set_shared_mode,
 
.wait_tx_queue_empty = iwl_trans_pcie_wait_txq_empty,
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
index 1c46f14..57a657a 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
@@ -1352,6 +1352,14 @@ void iwl_trans_pcie_txq_set_shared_mode(struct iwl_trans 
*trans, u32 txq_id,
txq->ampdu = !shared_mode;
 }
 
+dma_addr_t iwl_trans_pcie_get_txq_byte_table(struct iwl_trans *trans, int txq)
+{
+   struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+
+   return trans_pcie->scd_bc_tbls.dma +
+  txq * sizeof(struct iwlagn_scd_bc_tbl);
+}
+
 void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id,
bool configure_scd)
 {
-- 
2.9.3



pull-request: iwlwifi-next 2016-09-15-2

2016-09-16 Thread Luca Coelho
Hi Kalle,

This is v2 of my pull-request.  I have fixed the compilation error with
alpha (and possibly other) platforms.

I'll send v2 of the changed patch as a reply to this email.

Let me know if everything's fine (or not). :)

Luca.


The following changes since commit 76f8c0e17edc6eba43f84952e5a87c7f50f69370:

  iwlwifi: pcie: remove dead code (2016-08-30 14:16:43 +0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git 
tags/iwlwifi-next-for-kalle-2016-09-15-2

for you to fetch changes up to fd659f8e75b7f8214b4f323d46248205b4566e10:

  iwlwifi: mvm: tighten BAID range check (2016-09-16 09:10:35 +0300)


* work for new hardware support continues
* dynamic queue allocation stabilization
* improvements in the MSIx code
* multiqueue support work continues
* new firmware version support
* general cleanups and improvements


Emmanuel Grumbach (1):
  iwlwifi: mvm: bump max API to 26

Haim Dreyfuss (3):
  iwlwifi: pcie: Configure shared interrupt vector in MSIX mode
  iwlwifi: pcie: Set affinity mask for rx interrupt vectors per cpu
  iwlwifi: pcie: replace possible_cpus() with online_cpus() in MSIX mode

Johannes Berg (3):
  iwlwifi: mvm: make RSS RX more robust
  iwlwifi: mvm: remove pointless _bh from spinlock in timer
  iwlwifi: mvm: tighten BAID range check

Liad Kaufman (3):
  iwlwifi: mvm: don't free queue after delba in dqa
  iwlwifi: mvm: fix pending frames tracking on tx resp
  iwlwifi: mvm: free reserved queue on STA removal

Oren Givon (2):
  iwlwifi: add the new 9560 series
  iwlwifi: add the new 8275 series

Sara Sharon (10):
  iwlwifi: mvm: call a different txq_enable function
  iwlwifi: pcie: introduce new tfd and tb formats
  iwlwifi: mvm: remove dump of locked registers
  iwlwifi: mvm: support new shared memory config API
  iwlwifi: introduce trans API to get byte count table
  iwlwifi: pcie: assign and access a000 TFD & TBs
  iwlwifi: change byte count table for a000 devices
  iwlwifi: pcie: merge iwl_queue and iwl_txq
  iwlwifi: mvm: support new BA notification response
  iwlwifi: pcie: change indentation of iwl_pcie_set_interrupt_capa()

Sharon Dvir (1):
  iwlwifi: unify iwl_get_ucode_image() implementations

Wei Yongjun (1):
  iwlwifi: mvm: use setup_timer instead of init_timer and data fields

kbuild test robot (1):
  iwlwifi: fix semicolon.cocci warnings

 drivers/net/wireless/intel/iwlwifi/dvm/ucode.c |  11 +--
 drivers/net/wireless/intel/iwlwifi/iwl-7000.c  |   4 +-
 drivers/net/wireless/intel/iwlwifi/iwl-8000.c  |  15 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-9000.c  |  13 ++-
 drivers/net/wireless/intel/iwlwifi/iwl-a000.c  |   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-config.h|   2 +
 drivers/net/wireless/intel/iwlwifi/iwl-csr.h   |   2 +
 drivers/net/wireless/intel/iwlwifi/iwl-fh.h|  57 +---
 drivers/net/wireless/intel/iwlwifi/iwl-fw.h|   9 ++
 drivers/net/wireless/intel/iwlwifi/iwl-io.c|   2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.c |   1 +
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h |  15 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h |  79 
 drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h|  22 -
 drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c|   4 +-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c| 109 --
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h   |   9 +-
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c   |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c  |   8 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   |  36 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 175 
+++
 drivers/net/wireless/intel/iwlwifi/pcie/drv.c  |   5 +
 drivers/net/wireless/intel/iwlwifi/pcie/internal.h | 127 
+++--
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c   |  16 +++-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c| 247 
+
 drivers/net/wireless/intel/iwlwifi/pcie/tx.c   | 384 
+---
 26 files changed, 897 insertions(+), 459 deletions(-)

signature.asc
Description: This is a digitally signed message part


Hello

2016-09-16 Thread Hasher Al Maktoum
Dear Friend,

Your contact details came to me by recommendation, I am interested in investing 
in your country and I believe you have the capabilities of providing the needed 
assistance, solutions and advise in actualizing this, Let me know if you are 
willing to understake this task for me so we can discuss more. I hope to hear 
from you soon.

Regards,
Hasher Al Maktoum
Chairman/Chief Executive Officer
Dubai International Holding Company.


RE: [PATCH v8] cfg80211: Provision to allow the support for different beacon intervals

2016-09-16 Thread Undekari, Sunil Dutt
>In order to validate a new beacon interval, you're first looking up the min 
>GCD value of all the combinations that allow the *current* scenario, but doing 
>that matching without the right # of channels or >radar detect parameters? And 
>then you're trying to match that to the new beacon interval?
Yes . Please allow us to explain the rationale for doing so. 
1. The intention here is to ensure that the beacon interval configured for any 
single interface is greater than the "diff_beacon_int_gcd_min"  specified in 
the respective combinations.  
2. Since "diff_beacon_int_gcd_min"  is only specified / advertised in the 
interface combinations , our logic was to get the minimal 
"diff_beacon_int_gcd_min" of all the matching combinations and later 
compare with the new beacon interval. (API "cfg80211_iter_combinations" has 
to be invoked to get the corresponding "diff_beacon_int_gcd_min")
3. If the beacon interval configured needs to be ensured to be greater than the 
"diff_beacon_int_gcd_min" configured for both the "single interface" and 
"interface combination" , we have resorted to 
 "2"  (get the minimal of "diff_beacon_int_gcd_min" among all the matched 
interface combinations and then compare it with the configured beacon 
interval). 

>If the driver specified diff_beacon_int_gcd_min, then don't do anything in 
>cfg80211_validate_beacon_int(), other than perhaps a minimal range check 
>against the minimum of all >diff_beacon_int_gcd_min values for all 
>combinations.
> That new argument could be made the GCD of all existing beaconing interfaces 
> (or 0 if no such exists), since that's sufficient for checking against a new 
> min_gcd.
If I understand this correctly , are you saying that this new argument to 
cfg80211_iter_combinations shall be the GCD of all the existing beacon 
intervals and would be used to match with the corresponding 
"diff_beacon_int_gcd_min" of the interface combinations in 
"cfg80211_iter_combinations". 
If yes , this GCD argument does not represent , if the beacon intervals of all 
the existing interfaces differ or not , isn’t ? If the 
"diff_beacon_int_gcd_min"  of the all the matching interface combinations is 0 
, such differed beacon intervals would pass the check , contradicting the 
existing logic ( not allowing the differed beacon intervals), isn't ? 

Thus, wouldn't it be a better option to first get the "diff_beacon_int_gcd_min" 
advertised by the respective interface combinations and then later compare it 
with the configured / calculated beacon 
interval's GCD . 
Also , not quite sure how would your comment " matching without the right # of 
channels or radar detect parameters" get addressed with your new proposal ( 
adding a new argument to "cfg80211_iter_combinations" ) 

Regards,
Sunil





-Original Message-
From: Johannes Berg [mailto:johan...@sipsolutions.net] 
Sent: Monday, September 12, 2016 3:54 PM
To: Kushwaha, Purushottam 
Cc: linux-wireless@vger.kernel.org; Malinen, Jouni ; 
Undekari, Sunil Dutt ; Hullur Subramanyam, Amarnath 

Subject: Re: [PATCH v8] cfg80211: Provision to allow the support for different 
beacon intervals

Hmm. Apart from some misleading documentation, that doesn't mention "GCD" at 
all, the logic seems odd.

In order to validate a new beacon interval, you're first looking up the min GCD 
value of all the combinations that allow the *current* scenario, but doing that 
matching without the right # of channels or radar detect parameters? And then 
you're trying to match that to the new beacon interval?

It seems to me that the logic should be something like:

If the driver specified diff_beacon_int_gcd_min, then don't do anything in 
cfg80211_validate_beacon_int(), other than perhaps a minimal range check 
against the minimum of all diff_beacon_int_gcd_min values for all combinations.

Then, add a new argument to cfg80211_check_combinations() (and
cfg80211_iter_combinations()) to have the beacon intervals for each beaconing 
interface, and use that in order to match if a combination fits, inside 
cfg80211_iter_combinations().

That new argument could be made the GCD of all existing beaconing interfaces 
(or 0 if no such exists), since that's sufficient for checking against a new 
min_gcd.

johannes