Ubuntu (kernel 4.4) + Intel 7265N = cannot pair bluetooth

2017-05-01 Thread Luis Pablo Gallo
I have a notebook with Ubuntu installed, and an Intel 7265N driver for
WiFi and bluetooth. I cannot pair any device to it. Ubuntu finds the
devices, but doesn't get their name, and doesn't allow me to pair them
either.
Is there a fix for this? Should it be working?
Thanks!

--
Luis Pablo


[PATCH] [ath10k] go back to using dma_alloc_coherent() for firmware scratch memory.

2017-05-01 Thread Adrian Chadd
This reverts b057886524be060021e3cfad0ba8458c850330cd in 2015
which converted this allocation from dma_map_coherent() to
kzalloc() / dma_map_single().

The current problem manifests when using later model NICs with larger
(>700KiB) scratch spaces in memory.  Although the kzalloc call
succeeds, the software IOMMU TLB code (via dma_map_single()) panics
because it can't find 700KiB of linear physmem bounce buffers for DMA.
Now, this is a bit of a silly failure mode for the dma map API,
but it's what we currently have to play with.

In these cases, doing kzalloc() works fine, but the dma_map_single()
call fails.

After chatting with Linus briefly about this, it indeed should be
using dma_alloc_coherent() for doing larger device memory allocation
that requires some kind of physical address mapping.

You're not supposed to be using kzalloc and dma_map_* calls for
large memory regions, and I'm guessing not for long-held mappings
either.  Typically dma mappings should be temporary for DMA,
not long held like these.

Now, since hopefully the major annoying underlying problem has also been
addressed (ie, ath10k is no longer tears down all of these allocations
and reallocates them every time the vdevs are brought down) fragmentation
should stop being such a touchy issue.  If it is though, using
dma_alloc_coherent() use gets us access to the CMB APIs too relatively
easily and ideally we would be allocating memory early in boot for
exactly these reasons.

Signed-off-by: Adrian Chadd 
---
 drivers/net/wireless/ath/ath10k/wmi.c | 35 ++-
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 6afc8d2..cc89f53 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4482,31 +4482,17 @@ static int ath10k_wmi_alloc_chunk(struct ath10k *ar, 
u32 req_id,
  u32 num_units, u32 unit_len)
 {
dma_addr_t paddr;
-   u32 pool_size = 0;
+   u32 pool_size;
int idx = ar->wmi.num_mem_chunks;
-   void *vaddr = NULL;
-
-   if (ar->wmi.num_mem_chunks == ARRAY_SIZE(ar->wmi.mem_chunks))
-   return -ENOMEM;
+   void *vaddr;
 
-   while (!vaddr && num_units) {
-   pool_size = num_units * round_up(unit_len, 4);
-   if (!pool_size)
-   return -EINVAL;
+   pool_size = num_units * round_up(unit_len, 4);
+   vaddr = dma_alloc_coherent(ar->dev, pool_size, , GFP_KERNEL);
 
-   vaddr = kzalloc(pool_size, GFP_KERNEL | __GFP_NOWARN);
-   if (!vaddr)
-   num_units /= 2;
-   }
-
-   if (!num_units)
+   if (!vaddr)
return -ENOMEM;
 
-   paddr = dma_map_single(ar->dev, vaddr, pool_size, DMA_BIDIRECTIONAL);
-   if (dma_mapping_error(ar->dev, paddr)) {
-   kfree(vaddr);
-   return -ENOMEM;
-   }
+   memset(vaddr, 0, pool_size);
 
ar->wmi.mem_chunks[idx].vaddr = vaddr;
ar->wmi.mem_chunks[idx].paddr = paddr;
@@ -8290,11 +8276,10 @@ void ath10k_wmi_free_host_mem(struct ath10k *ar)
 
/* free the host memory chunks requested by firmware */
for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
-   dma_unmap_single(ar->dev,
-ar->wmi.mem_chunks[i].paddr,
-ar->wmi.mem_chunks[i].len,
-DMA_BIDIRECTIONAL);
-   kfree(ar->wmi.mem_chunks[i].vaddr);
+   dma_free_coherent(ar->dev,
+   ar->wmi.mem_chunks[i].len,
+   ar->wmi.mem_chunks[i].vaddr,
+   ar->wmi.mem_chunks[i].paddr);
}
 
ar->wmi.num_mem_chunks = 0;
-- 
2.10.1 (Apple Git-78)



Re: [PATCH v3 2/2] mwifiex: pcie: add card_reset() support

2017-05-01 Thread Dmitry Torokhov
On Mon, May 01, 2017 at 12:37:00PM -0700, Brian Norris wrote:
> Similar to the SDIO driver, we should implement this so that we will
> automatically reset the device whenever there's a command timeout or
> similar.
> 
> Signed-off-by: Brian Norris 

Reviewed-by: Dmitry Torokhov 

> ---
> v3: keep all the new reset code in patch 2, not patch 1
> 
> v2: use atomic test/set, based on Dmitry's suggestion
> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
> b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index 5f56e8e6d612..78688ff6ecd0 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -2822,6 +2822,13 @@ static void mwifiex_pcie_device_dump_work(struct 
> mwifiex_adapter *adapter)
>   mwifiex_upload_device_dump(adapter, drv_info, drv_info_size);
>  }
>  
> +static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
> +{
> + struct pcie_service_card *card = adapter->card;
> +
> + pci_reset_function(card->dev);
> +}
> +
>  static void mwifiex_pcie_work(struct work_struct *work)
>  {
>   struct pcie_service_card *card =
> @@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work)
>   if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
>  >work_flags))
>   mwifiex_pcie_device_dump_work(card->adapter);
> + if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET,
> +>work_flags))
> + mwifiex_pcie_card_reset_work(card->adapter);
>  }
>  
>  /* This function dumps FW information */
> @@ -2842,6 +2852,14 @@ static void mwifiex_pcie_device_dump(struct 
> mwifiex_adapter *adapter)
>   schedule_work(>work);
>  }
>  
> +static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter)
> +{
> + struct pcie_service_card *card = adapter->card;
> +
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
> + schedule_work(>work);
> +}
> +
>  static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
>  {
>   struct pcie_service_card *card = adapter->card;
> @@ -3271,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = {
>   .cleanup_mpa_buf =  NULL,
>   .init_fw_port = mwifiex_pcie_init_fw_port,
>   .clean_pcie_ring =  mwifiex_clean_pcie_ring_buf,
> + .card_reset =   mwifiex_pcie_card_reset,
>   .reg_dump = mwifiex_pcie_reg_dump,
>   .device_dump =  mwifiex_pcie_device_dump,
>   .down_dev = mwifiex_pcie_down_dev,
> -- 
> 2.13.0.rc0.306.g87b477812d-goog
> 

-- 
Dmitry


Re: [PATCH v3 1/2] mwifiex: initiate card-specific work atomically

2017-05-01 Thread Dmitry Torokhov
On Mon, May 01, 2017 at 12:36:59PM -0700, Brian Norris wrote:
> The non-atomic test + set is a little awkward here, and it technically
> means we might double-schedule work unnecessarily. AFAICT, this is not
> really a problem, since the extra "work" will be a no-op (the flag(s)
> will be cleared by then), but it's still an anti-pattern.
> 
> Rewrite this to use the atomic test_and_set_bit() helper instead.
> 
> Signed-off-by: Brian Norris 

Reviewed-by: Dmitry Torokhov 

> ---
> v3: fix bisectability (unused code warning) -- some code from patch 2
> crept in here
> 
> v2: new
> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c |  9 +++--
>  drivers/net/wireless/marvell/mwifiex/sdio.c | 16 +---
>  2 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
> b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index ac62bce50e96..5f56e8e6d612 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -2837,12 +2837,9 @@ static void mwifiex_pcie_device_dump(struct 
> mwifiex_adapter *adapter)
>  {
>   struct pcie_service_card *card = adapter->card;
>  
> - if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
> - return;
> -
> - set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
> -
> - schedule_work(>work);
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
> +   >work_flags))
> + schedule_work(>work);
>  }
>  
>  static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
> b/drivers/net/wireless/marvell/mwifiex/sdio.c
> index 0af1c6733c92..d38d31bb9b79 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> @@ -2533,12 +2533,8 @@ static void mwifiex_sdio_card_reset(struct 
> mwifiex_adapter *adapter)
>  {
>   struct sdio_mmc_card *card = adapter->card;
>  
> - if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
> - return;
> -
> - set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags);
> -
> - schedule_work(>work);
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
> + schedule_work(>work);
>  }
>  
>  /* This function dumps FW information */
> @@ -2546,11 +2542,9 @@ static void mwifiex_sdio_device_dump(struct 
> mwifiex_adapter *adapter)
>  {
>   struct sdio_mmc_card *card = adapter->card;
>  
> - if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
> - return;
> -
> - set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
> - schedule_work(>work);
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
> +   >work_flags))
> + schedule_work(>work);
>  }
>  
>  /* Function to dump SDIO function registers and SDIO scratch registers in 
> case
> -- 
> 2.13.0.rc0.306.g87b477812d-goog
> 

-- 
Dmitry


[PATCH v3 1/2] mwifiex: initiate card-specific work atomically

2017-05-01 Thread Brian Norris
The non-atomic test + set is a little awkward here, and it technically
means we might double-schedule work unnecessarily. AFAICT, this is not
really a problem, since the extra "work" will be a no-op (the flag(s)
will be cleared by then), but it's still an anti-pattern.

Rewrite this to use the atomic test_and_set_bit() helper instead.

Signed-off-by: Brian Norris 
---
v3: fix bisectability (unused code warning) -- some code from patch 2
crept in here

v2: new
---
 drivers/net/wireless/marvell/mwifiex/pcie.c |  9 +++--
 drivers/net/wireless/marvell/mwifiex/sdio.c | 16 +---
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
b/drivers/net/wireless/marvell/mwifiex/pcie.c
index ac62bce50e96..5f56e8e6d612 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2837,12 +2837,9 @@ static void mwifiex_pcie_device_dump(struct 
mwifiex_adapter *adapter)
 {
struct pcie_service_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
-   return;
-
-   set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
-
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
+ >work_flags))
+   schedule_work(>work);
 }
 
 static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 0af1c6733c92..d38d31bb9b79 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2533,12 +2533,8 @@ static void mwifiex_sdio_card_reset(struct 
mwifiex_adapter *adapter)
 {
struct sdio_mmc_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
-   return;
-
-   set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags);
-
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
+   schedule_work(>work);
 }
 
 /* This function dumps FW information */
@@ -2546,11 +2542,9 @@ static void mwifiex_sdio_device_dump(struct 
mwifiex_adapter *adapter)
 {
struct sdio_mmc_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
-   return;
-
-   set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
+ >work_flags))
+   schedule_work(>work);
 }
 
 /* Function to dump SDIO function registers and SDIO scratch registers in case
-- 
2.13.0.rc0.306.g87b477812d-goog



[PATCH v3 2/2] mwifiex: pcie: add card_reset() support

2017-05-01 Thread Brian Norris
Similar to the SDIO driver, we should implement this so that we will
automatically reset the device whenever there's a command timeout or
similar.

Signed-off-by: Brian Norris 
---
v3: keep all the new reset code in patch 2, not patch 1

v2: use atomic test/set, based on Dmitry's suggestion
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 5f56e8e6d612..78688ff6ecd0 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2822,6 +2822,13 @@ static void mwifiex_pcie_device_dump_work(struct 
mwifiex_adapter *adapter)
mwifiex_upload_device_dump(adapter, drv_info, drv_info_size);
 }
 
+static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
+{
+   struct pcie_service_card *card = adapter->card;
+
+   pci_reset_function(card->dev);
+}
+
 static void mwifiex_pcie_work(struct work_struct *work)
 {
struct pcie_service_card *card =
@@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work)
if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
   >work_flags))
mwifiex_pcie_device_dump_work(card->adapter);
+   if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET,
+  >work_flags))
+   mwifiex_pcie_card_reset_work(card->adapter);
 }
 
 /* This function dumps FW information */
@@ -2842,6 +2852,14 @@ static void mwifiex_pcie_device_dump(struct 
mwifiex_adapter *adapter)
schedule_work(>work);
 }
 
+static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter)
+{
+   struct pcie_service_card *card = adapter->card;
+
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
+   schedule_work(>work);
+}
+
 static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
 {
struct pcie_service_card *card = adapter->card;
@@ -3271,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = {
.cleanup_mpa_buf =  NULL,
.init_fw_port = mwifiex_pcie_init_fw_port,
.clean_pcie_ring =  mwifiex_clean_pcie_ring_buf,
+   .card_reset =   mwifiex_pcie_card_reset,
.reg_dump = mwifiex_pcie_reg_dump,
.device_dump =  mwifiex_pcie_device_dump,
.down_dev = mwifiex_pcie_down_dev,
-- 
2.13.0.rc0.306.g87b477812d-goog



Re: [PATCH v2 1/2] mwifiex: initiate card-specific work atomically

2017-05-01 Thread Brian Norris
On Mon, May 01, 2017 at 11:45:48AM -0700, Brian Norris wrote:
> The non-atomic test + set is a little awkward here, and it technically
> means we might double-schedule work unnecessarily. AFAICT, this is not
> really a problem, since the extra "work" will be a no-op (the flag(s)
> will be cleared by then), but it's still an anti-pattern.
> 
> Rewrite this to use the atomic test_and_set_bit() helper instead.
> 
> Signed-off-by: Brian Norris 
> ---
> new in v2
> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c | 13 +
>  drivers/net/wireless/marvell/mwifiex/sdio.c | 16 +---
>  2 files changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
> b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index ac62bce50e96..8e7d6f41a952 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -2837,12 +2837,17 @@ static void mwifiex_pcie_device_dump(struct 
> mwifiex_adapter *adapter)
>  {
>   struct pcie_service_card *card = adapter->card;
>  
> - if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
> - return;
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
> +   >work_flags))
> + schedule_work(>work);
> +}
>  
> - set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
> +static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter)
> +{
> + struct pcie_service_card *card = adapter->card;
>  
> - schedule_work(>work);
> + if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
> + schedule_work(>work);
>  }
>  
>  static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)

Ooops, mis-split on patch 1 vs. 2. This won't be bisectable! Sorry,
please ignore! Will send v3 soon.



[PATCH v2 2/2] mwifiex: pcie: add card_reset() support

2017-05-01 Thread Brian Norris
Similar to the SDIO driver, we should implement this so that we will
automatically reset the device whenever there's a command timeout or
similar.

Signed-off-by: Brian Norris 
---
v2: use atomic test/set, based on Dmitry's suggestion
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 8e7d6f41a952..78688ff6ecd0 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2822,6 +2822,13 @@ static void mwifiex_pcie_device_dump_work(struct 
mwifiex_adapter *adapter)
mwifiex_upload_device_dump(adapter, drv_info, drv_info_size);
 }
 
+static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter)
+{
+   struct pcie_service_card *card = adapter->card;
+
+   pci_reset_function(card->dev);
+}
+
 static void mwifiex_pcie_work(struct work_struct *work)
 {
struct pcie_service_card *card =
@@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work)
if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
   >work_flags))
mwifiex_pcie_device_dump_work(card->adapter);
+   if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET,
+  >work_flags))
+   mwifiex_pcie_card_reset_work(card->adapter);
 }
 
 /* This function dumps FW information */
@@ -3279,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = {
.cleanup_mpa_buf =  NULL,
.init_fw_port = mwifiex_pcie_init_fw_port,
.clean_pcie_ring =  mwifiex_clean_pcie_ring_buf,
+   .card_reset =   mwifiex_pcie_card_reset,
.reg_dump = mwifiex_pcie_reg_dump,
.device_dump =  mwifiex_pcie_device_dump,
.down_dev = mwifiex_pcie_down_dev,
-- 
2.13.0.rc0.306.g87b477812d-goog



[PATCH v2 1/2] mwifiex: initiate card-specific work atomically

2017-05-01 Thread Brian Norris
The non-atomic test + set is a little awkward here, and it technically
means we might double-schedule work unnecessarily. AFAICT, this is not
really a problem, since the extra "work" will be a no-op (the flag(s)
will be cleared by then), but it's still an anti-pattern.

Rewrite this to use the atomic test_and_set_bit() helper instead.

Signed-off-by: Brian Norris 
---
new in v2
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 13 +
 drivers/net/wireless/marvell/mwifiex/sdio.c | 16 +---
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c 
b/drivers/net/wireless/marvell/mwifiex/pcie.c
index ac62bce50e96..8e7d6f41a952 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2837,12 +2837,17 @@ static void mwifiex_pcie_device_dump(struct 
mwifiex_adapter *adapter)
 {
struct pcie_service_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
-   return;
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
+ >work_flags))
+   schedule_work(>work);
+}
 
-   set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
+static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter)
+{
+   struct pcie_service_card *card = adapter->card;
 
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
+   schedule_work(>work);
 }
 
 static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 0af1c6733c92..d38d31bb9b79 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2533,12 +2533,8 @@ static void mwifiex_sdio_card_reset(struct 
mwifiex_adapter *adapter)
 {
struct sdio_mmc_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
-   return;
-
-   set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags);
-
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, >work_flags))
+   schedule_work(>work);
 }
 
 /* This function dumps FW information */
@@ -2546,11 +2542,9 @@ static void mwifiex_sdio_device_dump(struct 
mwifiex_adapter *adapter)
 {
struct sdio_mmc_card *card = adapter->card;
 
-   if (test_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags))
-   return;
-
-   set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, >work_flags);
-   schedule_work(>work);
+   if (!test_and_set_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
+ >work_flags))
+   schedule_work(>work);
 }
 
 /* Function to dump SDIO function registers and SDIO scratch registers in case
-- 
2.13.0.rc0.306.g87b477812d-goog



Re: [PATCH 5/9] cfg80211/nl80211: add authorized flag to roaming event

2017-05-01 Thread Arend van Spriel

On 4/28/2017 11:02 PM, Johannes Berg wrote:

On Wed, 2017-04-26 at 12:05 +0200, Arend van Spriel wrote:



the mobility domain does not require new 802.1X authentication, but
roaming to another mobility domain does.


Not sure about the terminology here. Is "mobility domain" the same
as  "ESS" which stands for extended service set as definced in
802.11  standard. If so, I would prefer use of that term here.


No. "Mobility domain" was defined in 802.11r, it's unrelated to ESS.


Thanks for the reference. So a "Mobility domain" is a group of BSSes 
within the same ESS. Noted.



+ * @authorized: true if the 802.1X authentication was done by the
driver or is
+ * not needed (e.g., when Fast Transition protocol was
used), false
+ * otherwise. Ignored for networks that don't use 802.1X
authentication.


It is not ignored in this patch so it is expected user-space
behavior you are describing, which is not really needed here in
cfg80211 driver api.


Still kinda makes sense though to give that hint to the driver authors,
don't you think? Though it should be pretty clear ...


I tend to look further than the cfg80211 API ;-) Agree that is good to 
have it within the scope of the cfg80211 driver API.



*   well to remain backwards compatible.
* @NL80211_CMD_ROAM: request that the card roam (currently not
implemented),


Do we want to keep this comment about the request scenario. Is it
likely implemented soon/ever?


Heh, good question. Probably not, but it's kinda an unrelated cleanup,
no?


True. It just seems a good time to do it.


*   sent as an event when the card/driver roamed by itself.
+ * When used as an event, and the driver roamed in a
network that requires
+ * 802.1X authentication,
%NL80211_ATTR_CONNECTION_AUTHORIZED should be set
+ * if the 802.1X authentication was done by the driver or
if roaming was
+ * done using Fast Transition protocol (in which case
802.1X authentication
+ * is not needed). If %NL80211_ATTR_CONNECTION_AUTHORIZED
is not set,
+ * user space is responsible for the 802.1X authentication.


Would you consider using NL80211_ATTR_PORT_AUTHORIZED instead
referring to the 802.1X port entities.


I guess that makes sense, yeah.


So I will include this patch in my patchset for PSK/1X offloading taken 
above into account.


Regards,
Arend