Re: [PATCH 4/5] staging: wilc1000: SendConfigPkt(): replace integer with void pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:
 This patch replaces a integer argument of SendConfigPkt function with
 void type pointer and fix code that the function is called.

 Because tstrWILC_WFIDrv structure is defined after SendConfigPkt function
 is defined, the function can not refer to the structure type.
 So this patch change the argument to void type pointer.

Same comments again, why not move the structure definition?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] staging: wilc1000: wilc_wlan_cfg_set(): replace integer with void pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:
 Last argument of wilc_wlan_cfg_set function is actually structure's address.
 This should be changed to be compatible with 64bit machine.
 Because wilc_wlan_cfg_set function is mapped by function pointer later,
 wilc_wlan_oup_t.wlan_cfg_set should be changed together.

 tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_set
 is defined. So, this patch changes the argument to void type pointer.

Same question, why not move the structure definition before this op is defined?

 Signed-off-by: Johnny Kim johnny@atmel.com
 ---
  drivers/staging/wilc1000/coreconfigurator.c | 2 +-
  drivers/staging/wilc1000/linux_wlan.c   | 2 +-
  drivers/staging/wilc1000/wilc_wlan.c| 2 +-
  drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
  4 files changed, 4 insertions(+), 4 deletions(-)

 diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
 b/drivers/staging/wilc1000/coreconfigurator.c
 index 141d7b4..5c1096d 100644
 --- a/drivers/staging/wilc1000/coreconfigurator.c
 +++ b/drivers/staging/wilc1000/coreconfigurator.c
 @@ -2117,7 +2117,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
 if (!gpstrWlanOps-wlan_cfg_set(!counter,
 
 pstrWIDs[counter].u16WIDid, pstrWIDs[counter].ps8WidVal,
 
 pstrWIDs[counter].s32ValueSize,
 -   (counter == 
 u32WIDsCount - 1), drvHandler)) {
 +   (counter == 
 u32WIDsCount - 1), (void *)drvHandler)) {

Again, you shouldn't need a void * cast.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:
 A argument of wilc_wlan_cfg_commit() is address of structure.
 But because the size is restricted to 32bit, it is not correct
 for 64bit machine.

 So, this changes the interger value to obvious structure pointer.

 Signed-off-by: Johnny Kim johnny@atmel.com
 ---
  drivers/staging/wilc1000/wilc_wlan.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

 diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
 b/drivers/staging/wilc1000/wilc_wlan.c
 index def72fd..d32e45e 100644
 --- a/drivers/staging/wilc1000/wilc_wlan.c
 +++ b/drivers/staging/wilc1000/wilc_wlan.c
 @@ -1862,13 +1862,13 @@ static void wilc_wlan_cleanup(void)

  }

 -static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler)
 +static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler)
  {
 wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan;
 wilc_cfg_frame_t *cfg = p-cfg_frame;
 int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
 int seq_no = p-cfg_seq_no % 256;
 -   int driver_handler = (u32)drvHandler;
 +   uintptr_t driver_handler = (uintptr_t)drvHandler;

Er, why not just remove this variable and use drvHandler directly?

 @@ -1923,7 +1923,7 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, 
 uint8_t *buffer, uint32_t
 p-cfg_frame_in_use = 1;

 /*Edited by Amr - BugID_4720*/
 -   if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
 +   if (wilc_wlan_cfg_commit(WILC_CFG_SET, (tstrWILC_WFIDrv 
 *)drvHandler))

No need to cast it to it's own type.

 ret_size = 0;   /* BugID_5213 */

 if (p-os_func.os_wait(p-cfg_wait, CFG_PKTS_TIMEOUT)) {
 @@ -1960,7 +1960,7 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, 
 int commit, uint32_t drvHa
 p-cfg_frame_in_use = 1;

 /*Edited by Amr - BugID_4720*/
 -   if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler))
 +   if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, (tstrWILC_WFIDrv 
 *)drvHandler))

Ditto.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:
 Last argument of wilc_wlan_cfg_get function is actually structure's address.
 This should be changed to be compatible with 64bit machine.
 Because wilc_wlan_cfg_get function is mapped by function pointer later,
 wilc_wlan_oup_t.wlan_cfg_get should be changed together.

 tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_get
 is defined. So, this patch changes the argument to void type pointer.

Why not add a patch moving the structure definition before
wilc_wlan_oup_t.wlan_cfg_get is defined?

 Signed-off-by: Johnny Kim johnny@atmel.com
 ---
  drivers/staging/wilc1000/coreconfigurator.c | 2 +-
  drivers/staging/wilc1000/wilc_wlan.c| 2 +-
  drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)

 diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
 b/drivers/staging/wilc1000/coreconfigurator.c
 index b069614..141d7b4 100644
 --- a/drivers/staging/wilc1000/coreconfigurator.c
 +++ b/drivers/staging/wilc1000/coreconfigurator.c
 @@ -2094,7 +2094,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
(counter == u32WIDsCount - 1));
 if (!gpstrWlanOps-wlan_cfg_get(!counter,
 
 pstrWIDs[counter].u16WIDid,
 -   (counter == 
 u32WIDsCount - 1), drvHandler)) {
 +   (counter == 
 u32WIDsCount - 1), (void *)drvHandler)) {

If I recall correctly, you shouldn't need void * casts.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] nfc: Drop owner assignment from i2c_driver

2015-07-10 Thread Krzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 drivers/nfc/nxp-nci/i2c.c  | 1 -
 drivers/nfc/pn544/i2c.c| 1 -
 drivers/nfc/st-nci/i2c.c   | 1 -
 drivers/nfc/st21nfca/i2c.c | 1 -
 4 files changed, 4 deletions(-)

diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 2f77f1d03638..6c5e63cd0022 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -450,7 +450,6 @@ MODULE_DEVICE_TABLE(acpi, acpi_id);
 static struct i2c_driver nxp_nci_i2c_driver = {
.driver = {
   .name = NXP_NCI_I2C_DRIVER_NAME,
-  .owner  = THIS_MODULE,
   .acpi_match_table = ACPI_PTR(acpi_id),
   .of_match_table = of_match_ptr(of_nxp_nci_i2c_match),
  },
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index fa75c53f3fa5..a095523309cf 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -1162,7 +1162,6 @@ MODULE_DEVICE_TABLE(of, of_pn544_i2c_match);
 static struct i2c_driver pn544_hci_i2c_driver = {
.driver = {
   .name = PN544_HCI_I2C_DRIVER_NAME,
-  .owner  = THIS_MODULE,
   .of_match_table = of_match_ptr(of_pn544_i2c_match),
   .acpi_match_table = ACPI_PTR(pn544_hci_i2c_acpi_match),
  },
diff --git a/drivers/nfc/st-nci/i2c.c b/drivers/nfc/st-nci/i2c.c
index 06175ce769bb..c21c45c656c0 100644
--- a/drivers/nfc/st-nci/i2c.c
+++ b/drivers/nfc/st-nci/i2c.c
@@ -370,7 +370,6 @@ MODULE_DEVICE_TABLE(of, of_st_nci_i2c_match);
 
 static struct i2c_driver st_nci_i2c_driver = {
.driver = {
-   .owner = THIS_MODULE,
.name = ST_NCI_I2C_DRIVER_NAME,
.of_match_table = of_match_ptr(of_st_nci_i2c_match),
},
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index a32143951616..6f987fa36371 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -680,7 +680,6 @@ MODULE_DEVICE_TABLE(of, of_st21nfca_i2c_match);
 
 static struct i2c_driver st21nfca_hci_i2c_driver = {
.driver = {
-   .owner = THIS_MODULE,
.name = ST21NFCA_HCI_I2C_DRIVER_NAME,
.of_match_table = of_match_ptr(of_st21nfca_i2c_match),
},
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ath10k: Delay device access after cold reset

2015-07-10 Thread Kalle Valo
Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com writes:

 It is observed that during cold reset pcie access right
 after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
 Data Bus Error and system hard lockup. The reason
 for bus error is that pcie needs some time to get
 back to stable state for any transaction during cold reset. Add
 delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
 to fix this issue.

 Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com

On what devices did you test this? That should be documented in the
commit log.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ath10k: Delay device access after cold reset

2015-07-10 Thread Vasanthakumar Thiagarajan
It is observed that during cold reset pcie access right
after a write operation to SOC_GLOBAL_RESET_ADDRESS causes
Data Bus Error and system hard lockup. The reason
for bus error is that pcie needs some time to get
back to stable state for any transaction during cold reset. Add
delay of 20 msecs after write of SOC_GLOBAL_RESET_ADDRESS
to fix this issue. This patch is tested on QCA988X. This is
also tested on QCA99X0 which is WIP.

Signed-off-by: Vasanthakumar Thiagarajan vthia...@qti.qualcomm.com
---

V2:
- Include tested hw in commit log.

 drivers/net/wireless/ath/ath10k/pci.c | 20 +++-
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 1b4634a..130746b 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2761,7 +2761,6 @@ static int ath10k_pci_wait_for_target_init(struct ath10k 
*ar)
 
 static int ath10k_pci_cold_reset(struct ath10k *ar)
 {
-   int i;
u32 val;
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, boot cold reset\n);
@@ -2777,23 +2776,18 @@ static int ath10k_pci_cold_reset(struct ath10k *ar)
val |= 1;
ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
 
-   for (i = 0; i  ATH_PCI_RESET_WAIT_MAX; i++) {
-   if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) 
- RTC_STATE_COLD_RESET_MASK)
-   break;
-   msleep(1);
-   }
+   /* After writing into SOC_GLOBAL_RESET to put device into
+* reset and pulling out of reset pcie may not be stable
+* for any immediate pcie register access and cause bus error,
+* add delay before any pcie access request to fix this issue.
+*/
+   msleep(20);
 
/* Pull Target, including PCIe, out of RESET. */
val = ~1;
ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
 
-   for (i = 0; i  ATH_PCI_RESET_WAIT_MAX; i++) {
-   if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) 
-   RTC_STATE_COLD_RESET_MASK))
-   break;
-   msleep(1);
-   }
+   msleep(20);
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, boot cold reset complete\n);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] brcmfmac: dhd_sdio.c: use existing atomic_or primitive

2015-07-10 Thread Arend van Spriel

On 07/10/2015 06:49 AM, Vineet Gupta wrote:

On Thursday 09 July 2015 11:55 PM, Arend van Spriel wrote:

On 07/09/2015 10:13 AM, Vineet Gupta wrote:

There's already a generic implementation so use that instead.

There is or there was? If there is now I am fine with this patch, but if
it already was there the author might have had a reason for adding a
local function and I would like to hear that reason.



atomic_orr() was introduced to this driver with

2014-03-06 5cbb9c285bdc brcmfmac: Use atomic functions for intstatus update.

as it seems atomic_set_mask() was not available cross arch. And atomic_or() in
generic code was indeed introduced after that

2014-04-23 560cb12a4080 locking,arch: Rewrite generic atomic support

Hence likely the reason author went with home grown atomic_orr()


Hi Vineet

Thanks for looking into the timeline. Will look into it and let you know.

Regards,
Arend


-Vineet



--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: WARNING: brcmfmac/core.c:1144 brcmf_netdev_wait_pend8021x

2015-07-10 Thread Arend van Spriel

On 07/09/2015 09:12 PM, Rafał Miłecki wrote:

On 9 July 2015 at 20:48, Arend van Spriel ar...@broadcom.com wrote:

On 07/09/2015 08:01 PM, Rafał Miłecki wrote:

After fixing user space - brcmfmac communication for using valid MACs:
[PATCH] brcmfmac: set wiphy's addresses to provide valid MACs
i started testing multiple interfaces.

It seems there are many bugs in brcmfmac :(



Well, you are using the device outside its capability, because brcmfmac does
not properly announce interface combinations. I will submit patches for
that.


Really? I'm just running 3 interfaces, all of them in AP mode, nothing
unexpected I believe.


Ok. But for Multiple-BSS feature there are more limitations regarding 
configuration. So I am not sure what the firmware requirements are in 
this, but I will look into that.



So after running 3 AP interfaces and switching my STA device between them
I
started seeing WARNINGs triggered by brcmf_netdev_wait_pend8021x. It was
brcmf_cfg80211_del_key that was calling above function.

The problem is that brcmf_netdev_start_xmit increases interfaces's
pend_8021x_cnt on every transmission of ETH_P_PAE but brcmf_txfinalize
fails
(from time to time?) do decrease it.

There is a bug in brcmf_txfinalize that stops it from finding an interface
for
the received TX transmission success. I added some debugging to brcmfmac
as you
can see below and this is what I got:
[   39.394022] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c72c1dc0 on ifidx:0
[   39.413251] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c72c1dc0 on ifidx:2
[   39.421887] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c725a7c0 on ifidx:1
[   39.431720] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c6a78a00 on ifidx:0
[   39.442829] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c725a7c0 but got invalid ifidx:1
[   39.451773] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c726ee80 on ifidx:2
[   39.460384] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c725a7c0 on ifidx:1
[   39.536224] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c725a7c0 but got invalid ifidx:1
[   51.884737] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c714cd00 on ifidx:1
[   51.895577] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c714cd00 but got invalid ifidx:1
[   51.904592] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c707de80 on ifidx:2
[   51.913195] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c7011e80 on ifidx:0
[   51.922900] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c725a280 on ifidx:1
[   51.933988] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c725a280 but got invalid ifidx:1
[   51.942979] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c714cd00 on ifidx:2
[   51.951602] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c707de80 on ifidx:0
[   55.228402] brcmfmac: [brcmf_netdev_wait_pend8021x] WARNING
pend_8021x_cnt:4
[   55.278395] brcmfmac: [brcmf_netdev_wait_pend8021x] WARNING
pend_8021x_cnt:4
[   55.328394] brcmfmac: [brcmf_netdev_wait_pend8021x] WARNING
pend_8021x_cnt:4
[   55.336211] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c7070b80 on ifidx:2
[   55.347075] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c7070b80 and decreased pend_8021x_cnt for ifidx:2 but got negative count
-1!
[   55.387991] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c6a78a00 on ifidx:1
[   55.396601] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c7070b80 on ifidx:0
[   55.406245] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c707d400 on ifidx:2
[   55.417257] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c6a78a00 but got invalid ifidx:1
[   55.426144] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c707d400 and decreased pend_8021x_cnt for ifidx:2 but got negative count
-1!
[   55.439019] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c714cd00 on ifidx:1
[   55.447611] brcmfmac: [brcmf_netdev_start_xmit] Transmitting ETH_P_PAE
skb:c72c2580 on ifidx:0
[   55.498397] brcmfmac: [brcmf_netdev_wait_pend8021x] WARNING
pend_8021x_cnt:6
[   55.504785] brcmfmac: [brcmf_txfinalize] Finalized ETH_P_PAE
skb:c714cd00 but got invalid ifidx:1

As you can see brcmf_txfinalize fails to find interface for ifidx:1. Why
is
that? It seems that drvr-iflist is an array indexed by bssidx, but
brcmf_txfinalize uses ifidx to access it. Obviously ifidx != bssidx.

This also results in decreasing pend_8021x_cnt for wrong interfaces and
some
negative values.

Will you fix this?



I have some patches reworking the driver using drvr-iflist. One of the
fixes involves calling brcmf_txfinalize with brcmf_if instance. I need to do
more testing on those patches before submitting them. If you are willing to
give them a try as well I can provide them.


Yes, please! :)


I 

Re: [PATCH 1/3] staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer

2015-07-10 Thread Johnny Kim


On 2015년 07월 10일 15:20, Julian Calaby wrote:

Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:

A argument of wilc_wlan_cfg_commit() is address of structure.
But because the size is restricted to 32bit, it is not correct
for 64bit machine.

So, this changes the interger value to obvious structure pointer.

Signed-off-by: Johnny Kim johnny@atmel.com
---
  drivers/staging/wilc1000/wilc_wlan.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index def72fd..d32e45e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1862,13 +1862,13 @@ static void wilc_wlan_cleanup(void)

  }

-static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler)
+static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler)
  {
 wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan;
 wilc_cfg_frame_t *cfg = p-cfg_frame;
 int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
 int seq_no = p-cfg_seq_no % 256;
-   int driver_handler = (u32)drvHandler;
+   uintptr_t driver_handler = (uintptr_t)drvHandler;

Er, why not just remove this variable and use drvHandler directly?

A control packet with the address value is sent to chipset.
Namely, it is used to distinguish various packet via the address finally.

@@ -1923,7 +1923,7 @@ static int wilc_wlan_cfg_set(int start, uint32_t wid, 
uint8_t *buffer, uint32_t
 p-cfg_frame_in_use = 1;

 /*Edited by Amr - BugID_4720*/
-   if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
+   if (wilc_wlan_cfg_commit(WILC_CFG_SET, (tstrWILC_WFIDrv 
*)drvHandler))

No need to cast it to it's own type.
drvHandler value is u32 integer. So I thought I need to cast it. I will 
remove the patch as your opinion.

 ret_size = 0;   /* BugID_5213 */

 if (p-os_func.os_wait(p-cfg_wait, CFG_PKTS_TIMEOUT)) {
@@ -1960,7 +1960,7 @@ static int wilc_wlan_cfg_get(int start, uint32_t wid, int 
commit, uint32_t drvHa
 p-cfg_frame_in_use = 1;

 /*Edited by Amr - BugID_4720*/
-   if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler))
+   if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, (tstrWILC_WFIDrv 
*)drvHandler))

Ditto.

Thanks,


Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer

2015-07-10 Thread Johnny Kim


On 2015년 07월 10일 15:25, Julian Calaby wrote:

Hi Johnny,

On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:

Last argument of wilc_wlan_cfg_get function is actually structure's address.
This should be changed to be compatible with 64bit machine.
Because wilc_wlan_cfg_get function is mapped by function pointer later,
wilc_wlan_oup_t.wlan_cfg_get should be changed together.

tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_get
is defined. So, this patch changes the argument to void type pointer.

Why not add a patch moving the structure definition before
wilc_wlan_oup_t.wlan_cfg_get is defined?

Current patch focus on accessing 64bit address rightly.
The define order you and I mentioned should be repaired with another subject
because of complexity among files.

Signed-off-by: Johnny Kim johnny@atmel.com
---
  drivers/staging/wilc1000/coreconfigurator.c | 2 +-
  drivers/staging/wilc1000/wilc_wlan.c| 2 +-
  drivers/staging/wilc1000/wilc_wlan_if.h | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index b069614..141d7b4 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -2094,7 +2094,7 @@ s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
(counter == u32WIDsCount - 1));
 if (!gpstrWlanOps-wlan_cfg_get(!counter,
 
pstrWIDs[counter].u16WIDid,
-   (counter == 
u32WIDsCount - 1), drvHandler)) {
+   (counter == 
u32WIDsCount - 1), (void *)drvHandler)) {

If I recall correctly, you shouldn't need void * casts.

Thanks,


Thanks.
Johnny.
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] staging: wilc1000: wilc_wlan_cfg_commit(): replace integer with pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 5:58 PM, Johnny Kim johnny@atmel.com wrote:

 On 2015년 07월 10일 15:20, Julian Calaby wrote:

 Hi Johnny,

 On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:

 A argument of wilc_wlan_cfg_commit() is address of structure.
 But because the size is restricted to 32bit, it is not correct
 for 64bit machine.

 So, this changes the interger value to obvious structure pointer.

 Signed-off-by: Johnny Kim johnny@atmel.com
 ---
   drivers/staging/wilc1000/wilc_wlan.c | 8 
   1 file changed, 4 insertions(+), 4 deletions(-)

 diff --git a/drivers/staging/wilc1000/wilc_wlan.c
 b/drivers/staging/wilc1000/wilc_wlan.c
 index def72fd..d32e45e 100644
 --- a/drivers/staging/wilc1000/wilc_wlan.c
 +++ b/drivers/staging/wilc1000/wilc_wlan.c
 @@ -1862,13 +1862,13 @@ static void wilc_wlan_cleanup(void)

   }

 -static int wilc_wlan_cfg_commit(int type, uint32_t drvHandler)
 +static int wilc_wlan_cfg_commit(int type, tstrWILC_WFIDrv *drvHandler)
   {
  wilc_wlan_dev_t *p = (wilc_wlan_dev_t *)g_wlan;
  wilc_cfg_frame_t *cfg = p-cfg_frame;
  int total_len = p-cfg_frame_offset + 4 + DRIVER_HANDLER_SIZE;
  int seq_no = p-cfg_seq_no % 256;
 -   int driver_handler = (u32)drvHandler;
 +   uintptr_t driver_handler = (uintptr_t)drvHandler;

 Er, why not just remove this variable and use drvHandler directly?

 A control packet with the address value is sent to chipset.
 Namely, it is used to distinguish various packet via the address finally.

Yes, and why does this require another variable?

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] staging: wilc1000: wilc_wlan_cfg_get(): replace integer with void pointer

2015-07-10 Thread Julian Calaby
Hi Johnny,

On Fri, Jul 10, 2015 at 6:11 PM, Johnny Kim johnny@atmel.com wrote:

 On 2015년 07월 10일 15:25, Julian Calaby wrote:

 Hi Johnny,

 On Fri, Jul 10, 2015 at 3:55 PM, Johnny Kim johnny@atmel.com wrote:

 Last argument of wilc_wlan_cfg_get function is actually structure's
 address.
 This should be changed to be compatible with 64bit machine.
 Because wilc_wlan_cfg_get function is mapped by function pointer later,
 wilc_wlan_oup_t.wlan_cfg_get should be changed together.

 tstrWILC_WFIDrv structure is defined after wilc_wlan_oup_t.wlan_cfg_get
 is defined. So, this patch changes the argument to void type pointer.

 Why not add a patch moving the structure definition before
 wilc_wlan_oup_t.wlan_cfg_get is defined?

 Current patch focus on accessing 64bit address rightly.
 The define order you and I mentioned should be repaired with another subject
 because of complexity among files.

I'm not saying it should be part of this patch, I'm saying that it
should be a patch in this series. Some of the changes you're making
look like you're fixing one bug only to replace it with another
different one.

But back to the whole issue of order:

tstrWILC_WFIDrv is defined in host_interface.h

wlan_cfg_get is defined in wilc_wlan_if.h

A patch ensuring that host_interface.h is included before
wilc_wlan_if.h in all files should be pretty easy to produce, assuming
that host_interface.h doesn't use anything in wilc_wlan_if.h.

If you include this patch, you can avoid patches later to change the
void pointers to typed pointers.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ath9k_htc: virtual interfaces, AP connection drop kernel warning

2015-07-10 Thread Oleksij Rempel
Hi,

Am 08.07.2015 um 17:28 schrieb Rolf Anderegg:
 I am having trouble with the following setup using ath9k_htc (AR9271): I
 would like to setup two virtual interfaces on a TP-Link Wireless USB
 adapter (TL-WN722N).
 
 ath0: AP (access point/master mode) with hostapd [1], on bridge br0
 ath1: STA (station/managed mode) with wpa_supplicant
 
 AP works fine when STA is omitted (or wpa_supplicant is stopped). But
 when I try to operate both simultaneously (on the same channel), while
 the STA is up and stable, the AP can no longer hold a connection for
 longer than a few seconds. The hostapd syslogs either say that
 connection is dropped due to inactivity or failure to authenticate.
 Also, sometimes a slowpath kernel warning is dumped [2].
 Kernel version is 3.12.10-rt15 (more environment info: [3]).
 
 When I try the same setup with a D-Link PCI card (DWL-G520) running with
 ath5k, AP and STA work smoothly side by side. So I'm wondering whether
 there are any known limitations or pitfalls when using virtual
 interfaces with ath9k_htc?
 
 Any hints or ideas would be greatly appreciated.
 Cheers,

First of all, you are using ancient kernel and firmware. Please update
it. Firmware should be at leas 1.4 and kernel probably 4.1 or later. i'm
not sure which include patch with support of RMW command introduced by
new FW.

Then you can try to disable LED blinking which is stealing your usb
bandwidth.

 
 
 [1] hostapd.conf:
 interface=ath0
 bridge=br0
 driver=nl80211
 ssid=MAN301-0099_LAN
 hw_mode=g
 channel=8
 auth_algs=3
 wmm_enabled=1
 wpa=3
 wpa_psk_file=/etc/hostapd.wpa_psk
 wpa_key_mgmt=WPA-PSK
 wpa_pairwise=TKIP CCMP
 
 
 [2] kernel warning:
 [ 4142.857848] [ cut here ]
 [ 4142.857917] WARNING: CPU: 0 PID: 19211 at net/mac80211/agg-tx.c:699 
 ieee80211_start_tx_ba_cb+0xa5/0xf8 [mac80211]()
 [ 4142.857970] Modules linked in: bridge stp llc ipv6 snd_seq_dummy ppdev 
 snd_dice snd_firewire_lib snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm 
 snd_page_alloc snd_seq_oss snd_seq_midi ath9k_htc snd_rawmidi ath9k_common 
 ath9k_hw snd_seq_midi_event ath joydev snd_seq mac80211 microcode 
 snd_seq_device snd_timer cfg80211 rfkill snd serio_raw soundcore lpc_ich 
 mfd_core parport_pc fuse w83627hf hwmon_vid shpchp coretemp lp parport 
 firewire_ohci ata_generic firewire_core pata_acpi r8169 mii
 [ 4142.857977] CPU: 0 PID: 19211 Comm: kworker/u8:0 Tainted: GW
 3.12.10-rt15 #2
 [ 4142.857980] Hardware name:  /D510MO, BIOS 
 MOPNV10N.86A.0516.2011.0331.1730 03/31/2011
 [ 4142.858051] Workqueue: phy0 ieee80211_iface_work [mac80211]
 [ 4142.858063]    f625beb8 c15dba8f  f625bed0 
 c102d255 f95cfb0c
 [ 4142.858073]   f2e62534 f27f3ad0 f625bee0 c102d2e1 0009 
  f625bf00
 [ 4142.858082]  f95cfb0c f3f48c18 f2e62360 f27f3800 f26bfc80 f3f48c00 
 f3fb28c0 f625bf28
 [ 4142.858084] Call Trace:
 [ 4142.858096]  [c15dba8f] dump_stack+0x49/0x80
 [ 4142.858104]  [c102d255] warn_slowpath_common+0x66/0x7d
 [ 4142.858146]  [f95cfb0c] ? ieee80211_start_tx_ba_cb+0xa5/0xf8 [mac80211]
 [ 4142.858152]  [c102d2e1] warn_slowpath_null+0x14/0x18
 [ 4142.858192]  [f95cfb0c] ieee80211_start_tx_ba_cb+0xa5/0xf8 [mac80211]
 [ 4142.858234]  [f95d3183] ieee80211_iface_work+0x99/0x253 [mac80211]
 [ 4142.858243]  [c1040112] process_one_work+0x146/0x253
 [ 4142.858249]  [c10405ab] worker_thread+0x137/0x1d9
 [ 4142.858255]  [c1040474] ? rescuer_thread+0x22f/0x22f
 [ 4142.858260]  [c1044a1e] kthread+0x74/0x79
 [ 4142.858268]  [c15e4e77] ret_from_kernel_thread+0x1b/0x28
 [ 4142.858274]  [c10449aa] ? __kthread_parkme+0x59/0x59
 [ 4142.858289] ---[ end trace 0003 ]---
 
 
 [3] environment summary:
 :~$ uname -srvmpio
 Linux 3.12.10-rt15 #2 SMP PREEMPT RT Tue Jun 9 16:17:55 CEST 2015 i686 i686 
 i686 GNU/Linux
 
 :~$ lsusb -s 1:3
 Bus 001 Device 003: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
 
 :~$ wpa_supplicant -v
 wpa_supplicant v2.4
 
 :~$ sudo wpa_cli status
 Selected interface 'ath1'
 bssid=b8:a3:86:14:d3:ee
 freq=2447
 ssid=Kakofon
 id=0
 id_str=ath1
 mode=station
 pairwise_cipher=CCMP
 group_cipher=TKIP
 key_mgmt=WPA2-PSK
 wpa_state=COMPLETED
 ip_address=192.168.1.102
 address=c6:4a:00:1b:c2:98
 
 :~$ hostapd -v
 hostapd v2.4
 
 :~$ sudo hostapd_cli status
 Selected interface 'ath0'
 state=ENABLED
 phy=phy0
 freq=2447
 num_sta_non_erp=0
 num_sta_no_short_slot_time=0
 num_sta_no_short_preamble=0
 olbc=0
 num_sta_ht_no_gf=0
 num_sta_no_ht=0
 num_sta_ht_20_mhz=0
 num_sta_ht40_intolerant=0
 olbc_ht=0
 ht_op_mode=0x0
 cac_time_seconds=0
 cac_time_left_seconds=N/A
 channel=8
 secondary_channel=0
 ieee80211n=0
 ieee80211ac=0
 vht_oper_chwidth=0
 vht_oper_centr_freq_seg0_idx=0
 vht_oper_centr_freq_seg1_idx=0
 bss[0]=ath0
 bssid[0]=c0:4a:00:1b:c2:98
 ssid[0]=MAN301-0099_LAN
 num_sta[0]=0
 
 :~$ cat /sys/module/ath9k_htc/parameters/nohwcrypt
 1
 
 :~$ lsmod | grep ath9k
 ath9k_htc  46002  0
 ath9k_common2153  1 ath9k_htc
 

Re: How is AP supposed to handle power-save packets from peer?

2015-07-10 Thread Ben Greear

On 07/09/2015 10:20 PM, Michal Kazior wrote:

On 10 July 2015 at 02:03, Ben Greear gree...@candelatech.com wrote:

Suppose one is doing heavy download (AP - peer traffic), and there are lots of 
frames in the
NIC's tx buffers (ath10k firmware, in this case).

Then, peer sends a power-save pkt telling AP it is going off-channel or 
otherwise
will be unavailable.


I assume you're exploring the worst-case scenario when all tx buffers
are consumed and peer goes to sleep, am I correct?


Even if not absolutely all...seems like we should flush them quick and
let the OS do the buffering by having it re-send when PS is disabled
again.  A few stations in PS could quickly eat all firmware tx buffers, not even
including the wmi-mgt-frame issue.  I've fixed the tx-status in my CT firmware 
now...could possibly
add another tx-status (like tx-dropped-PS) to better deal with this?  I think
I may try to make my firmware able to transmit mgt frames over htt as well,
which should help with some of this as well.

In current testing, it actually seems like ath10k firmware (or maybe higher up) 
is completely
ignoring the PS bit..but I have a lot more debugging to do before I'm
certain of this.  Possibly peer is being dodgy.



What is the appropriate behaviour from the AP?  Can the firmware just drop all 
those tx frames to
make room to handle other stations?  Maybe report ACK failure and hope the 
upper level stacks
retransmit as appropriate?

Or, is the host supposed to flush the peer's packets to clear out the frames?

Or, is firmware somehow supposed to keep all the frames for when the peer comes 
back?


Firmware will keep frames buffered until station wakes up again.

There's a timeout to detect stale stations as far as I'm aware and the
default value is 10s (sounds familiar? this goes back to mgmt tx/
credit starvation). This makes to handle stations that go to sleep and
then out of range/away. AP doesn't need to keep frames buffered till
the end of time. Once the timeout is hit firmware stops caring about
station's last seen sleep state transition and marks it as awake and
just sends frames to it (with tons of retransmits if it's really not
there anymore since there'd be noone to ACK) - in which case you'll
get no_ack=1 in tx status.


We do see lots of no-ack, had to tell hostapd to ignore noack failures
or connection to peer was lost.  But, peer should not have been gone for
10+ seconds in this case.

That seems like a horrible waste of time retransmitting packets, by the way.



See: WMI_10X_VDEV_PARAM_AP_DETECT_OUT_OF_SYNC_SLEEPING_STA_TIME_SECS

Ideally there should be little to no buffer bloat but it's difficult
to do that considering aggregation sizes of 11ac..


Ath10k will not aggregate more than about 30 frames as far as I can tell,
(maybe 3 times that if amsdu is happening as well?).  Standard driver is using
more than 1000 buffers, and stock firmware won't even let you configure this
to be smaller than about 1024 (though maybe driver could still use less
and firmware wouldn't care, not sure).
But fixing buffer bloat in ath10k is not my primary concern at the moment.

Thanks,
Ben




Michał

___
ath10k mailing list
ath...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k




--
Ben Greear gree...@candelatech.com
Candela Technologies Inc  http://www.candelatech.com

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] brcmfmac: block the correct flowring when backup queue overflow

2015-07-10 Thread Arend van Spriel
From: Franky Lin fran...@broadcom.com

brcmf_flowring_block blocks the last active flowring under the same
interface instead of the one provided by caller. This could lead to a
dead lock of netif stop if there are more than one flowring under the
interface and the traffic is high enough so brcmf_flowring_enqueue can
not unblock the ring right away.

Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Reviewed-by: Hante Meuleman meule...@broadcom.com
Signed-off-by: Franky Lin fran...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c 
b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
index e30f8fa..5b7a8ee 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
@@ -198,11 +198,15 @@ static void brcmf_flowring_block(struct brcmf_flowring 
*flow, u16 flowid,
spin_lock_irqsave(flow-block_lock, flags);
 
ring = flow-rings[flowid];
+   if (ring-blocked == blocked) {
+   spin_unlock_irqrestore(flow-block_lock, flags);
+   return;
+   }
ifidx = brcmf_flowring_ifidx_get(flow, flowid);
 
currently_blocked = false;
for (i = 0; i  flow-nrofrings; i++) {
-   if (flow-rings[i]) {
+   if ((flow-rings[i])  (i != flowid)) {
ring = flow-rings[i];
if ((ring-status == RING_OPEN) 
(brcmf_flowring_ifidx_get(flow, i) == ifidx)) {
@@ -213,8 +217,8 @@ static void brcmf_flowring_block(struct brcmf_flowring 
*flow, u16 flowid,
}
}
}
-   ring-blocked = blocked;
-   if (currently_blocked == blocked) {
+   flow-rings[flowid]-blocked = blocked;
+   if (currently_blocked) {
spin_unlock_irqrestore(flow-block_lock, flags);
return;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/7] brcmfmac: consolidate ifp lookup in driver core

2015-07-10 Thread Arend van Spriel
In rx path the firmware provide an interface index which is used to
map to a struct brcmf_if instance. However, this involves some trick
that is done in two places. This is changed by having driver core
providing brcmf_get_ifp() function.

Reviewed-by: Hante Meuleman meule...@broadcom.com
Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c   | 25 ++--
 drivers/net/wireless/brcm80211/brcmfmac/core.c   | 19 ++
 drivers/net/wireless/brcm80211/brcmfmac/core.h   |  2 +-
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 12 ++--
 4 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c 
b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
index 8e0e91c..83aa6a0 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.c
@@ -276,6 +276,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool 
do_fws, u8 *ifidx,
 struct sk_buff *pktbuf)
 {
struct brcmf_proto_bcdc_header *h;
+   struct brcmf_if *ifp;
 
brcmf_dbg(BCDC, Enter\n);
 
@@ -289,30 +290,21 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool 
do_fws, u8 *ifidx,
trace_brcmf_bcdchdr(pktbuf-data);
h = (struct brcmf_proto_bcdc_header *)(pktbuf-data);
 
-   *ifidx = BCDC_GET_IF_IDX(h);
-   if (*ifidx = BRCMF_MAX_IFS) {
-   brcmf_err(rx data ifnum out of range (%d)\n, *ifidx);
+   ifp = brcmf_get_ifp(drvr, BCDC_GET_IF_IDX(h));
+   if (IS_ERR_OR_NULL(ifp)) {
+   brcmf_dbg(INFO, no matching ifp found\n);
return -EBADE;
}
-   /* The ifidx is the idx to map to matching netdev/ifp. When receiving
-* events this is easy because it contains the bssidx which maps
-* 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
-* bssidx 1 is used for p2p0 and no data can be received or
-* transmitted on it. Therefor bssidx is ifidx + 1 if ifidx  0
-*/
-   if (*ifidx)
-   (*ifidx)++;
-
if (((h-flags  BCDC_FLAG_VER_MASK)  BCDC_FLAG_VER_SHIFT) !=
BCDC_PROTO_VER) {
brcmf_err(%s: non-BCDC packet received, flags 0x%x\n,
- brcmf_ifname(drvr, *ifidx), h-flags);
+ brcmf_ifname(drvr, ifp-ifidx), h-flags);
return -EBADE;
}
 
if (h-flags  BCDC_FLAG_SUM_GOOD) {
brcmf_dbg(BCDC, %s: BDC rcv, good checksum, flags 0x%x\n,
- brcmf_ifname(drvr, *ifidx), h-flags);
+ brcmf_ifname(drvr, ifp-ifidx), h-flags);
pktbuf-ip_summed = CHECKSUM_UNNECESSARY;
}
 
@@ -320,12 +312,15 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool 
do_fws, u8 *ifidx,
 
skb_pull(pktbuf, BCDC_HEADER_LEN);
if (do_fws)
-   brcmf_fws_hdrpull(drvr, *ifidx, h-data_offset  2, pktbuf);
+   brcmf_fws_hdrpull(drvr, ifp-ifidx, h-data_offset  2,
+ pktbuf);
else
skb_pull(pktbuf, h-data_offset  2);
 
if (pktbuf-len == 0)
return -ENODATA;
+
+   *ifidx = ifp-ifidx;
return 0;
 }
 
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/core.c 
b/drivers/net/wireless/brcm80211/brcmfmac/core.c
index fe9d3fb..1747d59 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.c
@@ -83,6 +83,25 @@ char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx)
return if_none;
 }
 
+struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx)
+{
+   if (ifidx  0 || ifidx = BRCMF_MAX_IFS) {
+   brcmf_err(ifidx %d out of range\n, ifidx);
+   return ERR_PTR(-ERANGE);
+   }
+
+   /* The ifidx is the idx to map to matching netdev/ifp. When receiving
+* events this is easy because it contains the bssidx which maps
+* 1-on-1 to the netdev/ifp. But for data frames the ifidx is rcvd.
+* bssidx 1 is used for p2p0 and no data can be received or
+* transmitted on it. Therefor bssidx is ifidx + 1 if ifidx  0
+*/
+   if (ifidx)
+   ifidx++;
+
+   return drvr-iflist[ifidx];
+}
+
 static void _brcmf_set_multicast_list(struct work_struct *work)
 {
struct brcmf_if *ifp;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/core.h 
b/drivers/net/wireless/brcm80211/brcmfmac/core.h
index fd74a9c..e49c6bf 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/core.h
@@ -199,7 +199,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp);
 
 /* Return pointer to interface name */
 char *brcmf_ifname(struct brcmf_pub *drvr, int 

[PATCH 5/7] brcmfmac: make use of cfg80211_check_combinations()

2015-07-10 Thread Arend van Spriel
Use cfg80211_check_combinations() so we can bail out early when an
interface add or change results in an invalid combination.

Reviewed-by: Hante Meuleman meule...@broadcom.com
Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 44 +-
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index ae54b66..f9ea360 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -469,6 +469,36 @@ brcmf_find_wpsie(const u8 *parse, u32 len)
return NULL;
 }
 
+static int brcmf_vif_change_validate(struct brcmf_cfg80211_info *cfg,
+struct brcmf_cfg80211_vif *vif,
+enum nl80211_iftype new_type)
+{
+   int iftype_num[NUM_NL80211_IFTYPES];
+   struct brcmf_cfg80211_vif *pos;
+
+   memset(iftype_num[0], 0, sizeof(iftype_num));
+   list_for_each_entry(pos, cfg-vif_list, list)
+   if (pos == vif)
+   iftype_num[new_type]++;
+   else
+   iftype_num[pos-wdev.iftype]++;
+
+   return cfg80211_check_combinations(cfg-wiphy, 1, 0, iftype_num);
+}
+
+static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg,
+ enum nl80211_iftype new_type)
+{
+   int iftype_num[NUM_NL80211_IFTYPES];
+   struct brcmf_cfg80211_vif *pos;
+
+   memset(iftype_num[0], 0, sizeof(iftype_num));
+   list_for_each_entry(pos, cfg-vif_list, list)
+   iftype_num[pos-wdev.iftype]++;
+
+   iftype_num[new_type]++;
+   return cfg80211_check_combinations(cfg-wiphy, 1, 0, iftype_num);
+}
 
 static void convert_key_from_CPU(struct brcmf_wsec_key *key,
 struct brcmf_wsec_key_le *key_le)
@@ -663,8 +693,14 @@ static struct wireless_dev 
*brcmf_cfg80211_add_iface(struct wiphy *wiphy,
 struct vif_params *params)
 {
struct wireless_dev *wdev;
+   int err;
 
brcmf_dbg(TRACE, enter: %s type %d\n, name, type);
+   err = brcmf_vif_add_validate(wiphy_to_cfg(wiphy), type);
+   if (err) {
+   brcmf_err(iface validation failed: err=%d\n, err);
+   return ERR_PTR(err);
+   }
switch (type) {
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_STATION:
@@ -823,8 +859,12 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct 
net_device *ndev,
s32 ap = 0;
s32 err = 0;
 
-   brcmf_dbg(TRACE, Enter, ndev=%p, type=%d\n, ndev, type);
-
+   brcmf_dbg(TRACE, Enter, idx=%d, type=%d\n, ifp-bssidx, type);
+   err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type);
+   if (err) {
+   brcmf_err(iface validation failed: err=%d\n, err);
+   return err;
+   }
switch (type) {
case NL80211_IFTYPE_MONITOR:
case NL80211_IFTYPE_WDS:
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/7] brcmfmac: Add support for host platform NVRAM loading.

2015-07-10 Thread Arend van Spriel
From: Hante Meuleman meule...@broadcom.com

Host platforms such as routers supported by OpenWRT can
support NVRAM reading directly from internal NVRAM store.
With this patch the nvram load routines will fall back to
this method when there is no nvram file and support is
available in the kernel.

Cc: Rafał Miłecki zaj...@gmail.com
Reviewed-by: Arend Van Spriel ar...@broadcom.com
Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Reviewed-by: Daniel (Deognyoun) Kim de...@broadcom.com
Signed-off-by: Hante Meuleman meule...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
Hi Rafał,

Hopefully I resolved the merge conflicts properly. It still works as
intended for x86. Can you verify this patch for MIPS?

Regards,
Arend
---
 drivers/net/wireless/brcm80211/brcmfmac/firmware.c | 43 ++
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c 
b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index 743f16b..1503937 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
@@ -19,6 +19,7 @@
 #include linux/device.h
 #include linux/firmware.h
 #include linux/module.h
+#include linux/bcm47xx_nvram.h
 
 #include debug.h
 #include firmware.h
@@ -146,7 +147,7 @@ brcmf_nvram_handle_value(struct nvram_parser *nvp)
u32 cplen;
 
c = nvp-data[nvp-pos];
-   if (!is_nvram_char(c)) {
+   if (!is_nvram_char(c)  (c != ' ')) {
/* key,value pair complete */
ekv = (u8 *)nvp-data[nvp-pos];
skv = (u8 *)nvp-data[nvp-entry];
@@ -207,6 +208,7 @@ static int brcmf_init_nvram_parser(struct nvram_parser *nvp,
 
memset(nvp, 0, sizeof(*nvp));
nvp-data = data;
+
/* Limit size to MAX_NVRAM_SIZE, some files contain lot of comment */
if (data_len  BRCMF_FW_MAX_NVRAM_SIZE)
size = BRCMF_FW_MAX_NVRAM_SIZE;
@@ -426,19 +428,34 @@ static void brcmf_fw_request_nvram_done(const struct 
firmware *fw, void *ctx)
struct brcmf_fw *fwctx = ctx;
u32 nvram_length = 0;
void *nvram = NULL;
+   u8 *data = NULL;
+   size_t data_len;
+   bool raw_nvram;
 
brcmf_dbg(TRACE, enter: dev=%s\n, dev_name(fwctx-dev));
-   if (!fw  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if ((fw)  (fw-data)) {
+   data = (u8 *)fw-data;
+   data_len = fw-size;
+   raw_nvram = false;
+   } else {
+   data = bcm47xx_nvram_get_contents(data_len);
+   if (!data  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
+   goto fail;
+   raw_nvram = true;
+   }
 
-   if (fw) {
-   nvram = brcmf_fw_nvram_strip(fw-data, fw-size, nvram_length,
+   if (data) {
+   nvram = brcmf_fw_nvram_strip(data, data_len, nvram_length,
 fwctx-domain_nr, fwctx-bus_nr);
-   release_firmware(fw);
-   if (!nvram  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if (raw_nvram)
+   bcm47xx_nvram_release_contents(data);
}
 
+   if (fw)
+   release_firmware(fw);
+   if (!nvram  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
+   goto fail;
+
fwctx-done(fwctx-dev, fwctx-code, nvram, nvram_length);
kfree(fwctx);
return;
@@ -473,15 +490,9 @@ static void brcmf_fw_request_code_done(const struct 
firmware *fw, void *ctx)
if (!ret)
return;
 
-   /* when nvram is optional call .done() callback here */
-   if (fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL) {
-   fwctx-done(fwctx-dev, fw, NULL, 0);
-   kfree(fwctx);
-   return;
-   }
+   brcmf_fw_request_nvram_done(NULL, fwctx);
+   return;
 
-   /* failed nvram request */
-   release_firmware(fw);
 fail:
brcmf_dbg(TRACE, failed: dev=%s\n, dev_name(fwctx-dev));
device_release_driver(fwctx-dev);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/7] brcmfmac: correct interface combination info

2015-07-10 Thread Arend van Spriel
The interface combination provided by brcmfmac did not truly reflect
the combinations supported by driver and/or firmware.

Reviewed-by: Hante Meuleman meule...@broadcom.com
Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Reviewed-by: Pontus Fuchs pont...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 151 +++--
 1 file changed, 112 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index d86d1f1..ae54b66 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -5695,63 +5695,132 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = {
}
 };
 
+/**
+ * brcmf_setup_ifmodes() - determine interface modes and combinations.
+ *
+ * @wiphy: wiphy object.
+ * @ifp: interface object needed for feat module api.
+ *
+ * The interface modes and combinations are determined dynamically here
+ * based on firmware functionality.
+ *
+ * no p2p and no mbss:
+ *
+ * #STA = 1, #AP = 1, channels = 1, 2 total
+ *
+ * no p2p and mbss:
+ *
+ * #STA = 1, #AP = 1, channels = 1, 2 total
+ * #AP = 4, matching BI, channels = 1, 4 total
+ *
+ * p2p, no mchan, and mbss:
+ *
+ * #STA = 1, #P2P-DEV = 1, #{P2P-CL, P2P-GO} = 1, channels = 1, 3 total
+ * #STA = 1, #P2P-DEV = 1, #AP = 1, #P2P-CL = 1, channels = 1, 4 total
+ * #AP = 4, matching BI, channels = 1, 4 total
+ *
+ * p2p, mchan, and mbss:
+ *
+ * #STA = 1, #P2P-DEV = 1, #{P2P-CL, P2P-GO} = 1, channels = 2, 3 total
+ * #STA = 1, #P2P-DEV = 1, #AP = 1, #P2P-CL = 1, channels = 1, 4 total
+ * #AP = 4, matching BI, channels = 1, 4 total
+ */
 static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp)
 {
struct ieee80211_iface_combination *combo = NULL;
-   struct ieee80211_iface_limit *limits = NULL;
-   int i = 0, max_iface_cnt;
+   struct ieee80211_iface_limit *c0_limits = NULL;
+   struct ieee80211_iface_limit *p2p_limits = NULL;
+   struct ieee80211_iface_limit *mbss_limits = NULL;
+   bool mbss, p2p;
+   int i, c, n_combos;
+
+   mbss = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS);
+   p2p = brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P);
 
-   combo = kzalloc(sizeof(*combo), GFP_KERNEL);
+   n_combos = 1 + !!p2p + !!mbss;
+   combo = kcalloc(n_combos, sizeof(*combo), GFP_KERNEL);
if (!combo)
goto err;
 
-   limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL);
-   if (!limits)
+   c0_limits = kcalloc(p2p ? 3 : 2, sizeof(*c0_limits), GFP_KERNEL);
+   if (!c0_limits)
goto err;
 
+   if (p2p) {
+   p2p_limits = kcalloc(4, sizeof(*p2p_limits), GFP_KERNEL);
+   if (!p2p_limits)
+   goto err;
+   }
+
+   if (mbss) {
+   mbss_limits = kcalloc(1, sizeof(*mbss_limits), GFP_KERNEL);
+   if (!mbss_limits)
+   goto err;
+   }
+
wiphy-interface_modes = BIT(NL80211_IFTYPE_STATION) |
 BIT(NL80211_IFTYPE_ADHOC) |
 BIT(NL80211_IFTYPE_AP);
 
-   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
-   combo-num_different_channels = 2;
-   else
-   combo-num_different_channels = 1;
-
-   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) {
-   limits[i].max = 1;
-   limits[i++].types = BIT(NL80211_IFTYPE_STATION);
-   limits[i].max = 4;
-   limits[i++].types = BIT(NL80211_IFTYPE_AP);
-   max_iface_cnt = 5;
-   } else {
-   limits[i].max = 2;
-   limits[i++].types = BIT(NL80211_IFTYPE_STATION) |
-   BIT(NL80211_IFTYPE_AP);
-   max_iface_cnt = 2;
-   }
-
-   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) {
+   c = 0;
+   i = 0;
+   combo[c].num_different_channels = 1;
+   c0_limits[i].max = 1;
+   c0_limits[i++].types = BIT(NL80211_IFTYPE_STATION);
+   if (p2p) {
+   if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN))
+   combo[c].num_different_channels = 2;
wiphy-interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
  BIT(NL80211_IFTYPE_P2P_GO) |
  BIT(NL80211_IFTYPE_P2P_DEVICE);
-   limits[i].max = 1;
-   limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
-   BIT(NL80211_IFTYPE_P2P_GO);
-   limits[i].max = 1;
-   limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE);
-   max_iface_cnt += 2;
-   }
-   combo-max_interfaces = max_iface_cnt;
-   

[PATCH 4/7] brcmfmac: add debugfs entry for msgbuf statistics

2015-07-10 Thread Arend van Spriel
From: Franky Lin fran...@broadcom.com

Expose ring buffer read/write pointers and other useful statistics
through debugfs.

Reviewed-by: Arend Van Spriel ar...@broadcom.com
Reviewed-by: Hante Meuleman meule...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Signed-off-by: Franky Lin fran...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | 56 
 1 file changed, 56 insertions(+)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c 
b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
index 363a31e..d0e1ce5 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
@@ -1360,6 +1360,60 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub 
*drvr, u16 flowid)
}
 }
 
+#ifdef DEBUG
+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
+{
+   struct brcmf_bus *bus_if = dev_get_drvdata(seq-private);
+   struct brcmf_pub *drvr = bus_if-drvr;
+   struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr-proto-pd;
+   struct brcmf_commonring *commonring;
+   u16 i;
+   struct brcmf_flowring_ring *ring;
+   struct brcmf_flowring_hash *hash;
+
+   commonring = msgbuf-commonrings[BRCMF_H2D_MSGRING_CONTROL_SUBMIT];
+   seq_printf(seq, h2d_ctl_submit: rp %4u, wp %4u, depth %4u\n,
+  commonring-r_ptr, commonring-w_ptr, commonring-depth);
+   commonring = msgbuf-commonrings[BRCMF_H2D_MSGRING_RXPOST_SUBMIT];
+   seq_printf(seq, h2d_rx_submit:  rp %4u, wp %4u, depth %4u\n,
+  commonring-r_ptr, commonring-w_ptr, commonring-depth);
+   commonring = msgbuf-commonrings[BRCMF_D2H_MSGRING_CONTROL_COMPLETE];
+   seq_printf(seq, d2h_ctl_cmplt:  rp %4u, wp %4u, depth %4u\n,
+  commonring-r_ptr, commonring-w_ptr, commonring-depth);
+   commonring = msgbuf-commonrings[BRCMF_D2H_MSGRING_TX_COMPLETE];
+   seq_printf(seq, d2h_tx_cmplt:   rp %4u, wp %4u, depth %4u\n,
+  commonring-r_ptr, commonring-w_ptr, commonring-depth);
+   commonring = msgbuf-commonrings[BRCMF_D2H_MSGRING_RX_COMPLETE];
+   seq_printf(seq, d2h_rx_cmplt:   rp %4u, wp %4u, depth %4u\n,
+  commonring-r_ptr, commonring-w_ptr, commonring-depth);
+
+   seq_printf(seq, \nh2d_flowrings: depth %u\n,
+  BRCMF_H2D_TXFLOWRING_MAX_ITEM);
+   seq_puts(seq, Active flowrings:\n);
+   hash = msgbuf-flow-hash;
+   for (i = 0; i  msgbuf-flow-nrofrings; i++) {
+   if (!msgbuf-flow-rings[i])
+   continue;
+   ring = msgbuf-flow-rings[i];
+   if (ring-status != RING_OPEN)
+   continue;
+   commonring = msgbuf-flowrings[i];
+   hash = msgbuf-flow-hash[ring-hash_id];
+   seq_printf(seq, id %3u: rp %4u, wp %4u, qlen %4u, blocked %u\n
+   ifidx %u, fifo %u, da %pM\n,
+   i, commonring-r_ptr, commonring-w_ptr,
+   skb_queue_len(ring-skblist), ring-blocked,
+   hash-ifidx, hash-fifo, hash-mac);
+   }
+
+   return 0;
+}
+#else
+static int brcmf_msgbuf_stats_read(struct seq_file *seq, void *data)
+{
+   return 0;
+}
+#endif
 
 int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
 {
@@ -1467,6 +1521,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
spin_lock_init(msgbuf-flowring_work_lock);
INIT_LIST_HEAD(msgbuf-work_queue);
 
+   brcmf_debugfs_add_entry(drvr, msgbuf_stats, brcmf_msgbuf_stats_read);
+
return 0;
 
 fail:
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/7] brcmfmac: Increase nr of supported flowrings.

2015-07-10 Thread Arend van Spriel
From: Hante Meuleman meule...@broadcom.com

Next generation devices will have firmware which will have more
than 256 flowrings. This patch increases the maximum number of
supported flowrings to 512.

Reviewed-by: Arend Van Spriel ar...@broadcom.com
Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
Signed-off-by: Hante Meuleman meule...@broadcom.com
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c | 38 --
 drivers/net/wireless/brcm80211/brcmfmac/flowring.h | 20 ++--
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   | 11 +--
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h   |  2 +-
 4 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c 
b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
index 5944063..e30f8fa 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/flowring.c
@@ -32,7 +32,7 @@
 #define BRCMF_FLOWRING_LOW (BRCMF_FLOWRING_HIGH - 256)
 #define BRCMF_FLOWRING_INVALID_IFIDX   0xff
 
-#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] + fifo + ifidx * 16)
+#define BRCMF_FLOWRING_HASH_AP(da, fifo, ifidx) (da[5] * 2 + fifo + ifidx * 16)
 #define BRCMF_FLOWRING_HASH_STA(fifo, ifidx) (fifo + ifidx * 16)
 
 static const u8 brcmf_flowring_prio2fifo[] = {
@@ -68,7 +68,7 @@ u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
  u8 prio, u8 ifidx)
 {
struct brcmf_flowring_hash *hash;
-   u8 hash_idx;
+   u16 hash_idx;
u32 i;
bool found;
bool sta;
@@ -88,6 +88,7 @@ u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
}
hash_idx =  sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
+   hash_idx = (BRCMF_FLOWRING_HASHSIZE - 1);
found = false;
hash = flow-hash;
for (i = 0; i  BRCMF_FLOWRING_HASHSIZE; i++) {
@@ -98,6 +99,7 @@ u32 brcmf_flowring_lookup(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
break;
}
hash_idx++;
+   hash_idx = (BRCMF_FLOWRING_HASHSIZE - 1);
}
if (found)
return hash[hash_idx].flowid;
@@ -111,7 +113,7 @@ u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
 {
struct brcmf_flowring_ring *ring;
struct brcmf_flowring_hash *hash;
-   u8 hash_idx;
+   u16 hash_idx;
u32 i;
bool found;
u8 fifo;
@@ -131,6 +133,7 @@ u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
}
hash_idx =  sta ? BRCMF_FLOWRING_HASH_STA(fifo, ifidx) :
  BRCMF_FLOWRING_HASH_AP(mac, fifo, ifidx);
+   hash_idx = (BRCMF_FLOWRING_HASHSIZE - 1);
found = false;
hash = flow-hash;
for (i = 0; i  BRCMF_FLOWRING_HASHSIZE; i++) {
@@ -140,6 +143,7 @@ u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
break;
}
hash_idx++;
+   hash_idx = (BRCMF_FLOWRING_HASHSIZE - 1);
}
if (found) {
for (i = 0; i  flow-nrofrings; i++) {
@@ -169,7 +173,7 @@ u32 brcmf_flowring_create(struct brcmf_flowring *flow, u8 
da[ETH_ALEN],
 }
 
 
-u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 flowid)
+u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u16 flowid)
 {
struct brcmf_flowring_ring *ring;
 
@@ -179,7 +183,7 @@ u8 brcmf_flowring_tid(struct brcmf_flowring *flow, u8 
flowid)
 }
 
 
-static void brcmf_flowring_block(struct brcmf_flowring *flow, u8 flowid,
+static void brcmf_flowring_block(struct brcmf_flowring *flow, u16 flowid,
 bool blocked)
 {
struct brcmf_flowring_ring *ring;
@@ -224,10 +228,10 @@ static void brcmf_flowring_block(struct brcmf_flowring 
*flow, u8 flowid,
 }
 
 
-void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 flowid)
+void brcmf_flowring_delete(struct brcmf_flowring *flow, u16 flowid)
 {
struct brcmf_flowring_ring *ring;
-   u8 hash_idx;
+   u16 hash_idx;
struct sk_buff *skb;
 
ring = flow-rings[flowid];
@@ -249,7 +253,7 @@ void brcmf_flowring_delete(struct brcmf_flowring *flow, u8 
flowid)
 }
 
 
-u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 flowid,
+u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u16 flowid,
   struct sk_buff *skb)
 {
struct brcmf_flowring_ring *ring;
@@ -275,7 +279,7 @@ u32 brcmf_flowring_enqueue(struct brcmf_flowring *flow, u8 
flowid,
 }
 
 
-struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u8 flowid)
+struct sk_buff *brcmf_flowring_dequeue(struct brcmf_flowring *flow, u16 flowid)
 {
   

[PATCH 0/7] brcmfmac: nvram loading and code rework

2015-07-10 Thread Arend van Spriel
This series comprises of following changes:
- support NVRAM loading for bcm47xx platform.
- revise announced interface combinations and validate against it.
- new debugfs entry for msgbuf protocol layer used with PCIe devices.
- couple of PCIe fixes.
- rework dealing with interface instances.

The series is intended for v4.3 kernel and applies to the master branch
of the wireless-drivers-next repository. The first patch has been compile
tested against 4.2-rc1 as it relies on change introduced in last merge
window. Assuming wireless-drivers-next/master will move to 4.2-rc1 before
applying this series.

Arend van Spriel (3):
  brcmfmac: correct interface combination info
  brcmfmac: make use of cfg80211_check_combinations()
  brcmfmac: consolidate ifp lookup in driver core

Franky Lin (2):
  brcmfmac: add debugfs entry for msgbuf statistics
  brcmfmac: block the correct flowring when backup queue overflow

Hante Meuleman (2):
  brcmfmac: Add support for host platform NVRAM loading.
  brcmfmac: Increase nr of supported flowrings.

 drivers/net/wireless/brcm80211/brcmfmac/bcdc.c |  25 ++-
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 195 -
 drivers/net/wireless/brcm80211/brcmfmac/core.c |  19 ++
 drivers/net/wireless/brcm80211/brcmfmac/core.h |   2 +-
 drivers/net/wireless/brcm80211/brcmfmac/firmware.c |  43 +++--
 drivers/net/wireless/brcm80211/brcmfmac/flowring.c |  48 ++---
 drivers/net/wireless/brcm80211/brcmfmac/flowring.h |  20 +--
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c   |  79 +++--
 drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h   |   2 +-
 9 files changed, 317 insertions(+), 116 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-wireless in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html