Re: [PATCH] wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.

2015-10-30 Thread Kalle Valo
yfw  writes:

> On Fri, Oct 30, 2015 at 06:59:46AM +0200, Kalle Valo wrote:
>> Nicolas Dechesne  writes:
>> 
>> > fwiw.. I applied the original patch from the list locally, and I don't
>> > see this issue after git am :
>> >
>> > $ git shortlog -1
>> > Yin, Fengwei (1):
>> >   wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.
>> 
>> Ah, I think it's coming from patchwork:
>> 
>> "Submitter   yfw"
>> 
>> https://patchwork.kernel.org/patch/7484791/
>> 
>> Fengwei, please fix your name in patchwork. It should be easy to do.
>
> Kalle, any clue about how to change the name in patchwork? I can't find
> how on the patchwork website.

Not sure. I think first need to register with the same email address:

https://patchwork.kernel.org/register/

>> Anyway, my original comment still stands. The correct format for name
>> is:
>> 
>> Random J Developer 
>> 
>> NOT:
>> 
>> Developer, Random J 
>> 
>> See SubmittingPatches.
>
> Will update the patch. Thanks.

It's too late for this patch as I already applied it.

-- 
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] wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.

2015-10-30 Thread Fengwei Yin
arm64 has requirement that all the dma operations have actual device.
Otherwise, following warnning message shown and dma allocation fails:

WARNING: CPU: 0 PID: 954 at arch/arm64/mm/dma-mapping.c:106 
__dma_alloc+0x24c/0x258()
Use an actual device structure for DMA allocation
Modules linked in: wcn36xx wcn36xx_platform
CPU: 0 PID: 954 Comm: ifconfig Not tainted 4.0.0+ #14
Hardware name: Qualcomm Technologies, Inc. MSM 8916 MTP (DT)
Call trace:
[] dump_backtrace+0x0/0x124
[] show_stack+0x10/0x1c
[] dump_stack+0x80/0xc4
[] warn_slowpath_common+0x98/0xd0
[] warn_slowpath_fmt+0x4c/0x58
[] __dma_alloc+0x248/0x258
[] wcn36xx_dxe_allocate_mem_pools+0xc4/0x108 [wcn36xx]
[] wcn36xx_start+0x38/0x240 [wcn36xx]
[] ieee80211_do_open+0x1b0/0x9a4
[] ieee80211_open+0x58/0x68
[] __dev_open+0xb0/0x120
[] __dev_change_flags+0x88/0x150
[] dev_change_flags+0x1c/0x5c
[] devinet_ioctl+0x644/0x6f0

Signed-off-by: Fengwei Yin 
Acked-by: Bjorn Andersson 
---
 v2: Update the submitter name according to suggestion from Kalle Valo.

 drivers/net/wireless/ath/wcn36xx/dxe.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/dxe.c 
b/drivers/net/wireless/ath/wcn36xx/dxe.c
index 086549b..9bff361 100644
--- a/drivers/net/wireless/ath/wcn36xx/dxe.c
+++ b/drivers/net/wireless/ath/wcn36xx/dxe.c
@@ -169,7 +169,7 @@ void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn)
wcn36xx_dxe_free_ctl_block(>dxe_rx_h_ch);
 }
 
-static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch *wcn_ch)
+static int wcn36xx_dxe_init_descs(struct device *dev, struct wcn36xx_dxe_ch 
*wcn_ch)
 {
struct wcn36xx_dxe_desc *cur_dxe = NULL;
struct wcn36xx_dxe_desc *prev_dxe = NULL;
@@ -178,7 +178,7 @@ static int wcn36xx_dxe_init_descs(struct wcn36xx_dxe_ch 
*wcn_ch)
int i;
 
size = wcn_ch->desc_num * sizeof(struct wcn36xx_dxe_desc);
-   wcn_ch->cpu_addr = dma_alloc_coherent(NULL, size, _ch->dma_addr,
+   wcn_ch->cpu_addr = dma_alloc_coherent(dev, size, _ch->dma_addr,
  GFP_KERNEL);
if (!wcn_ch->cpu_addr)
return -ENOMEM;
@@ -270,7 +270,7 @@ static int wcn36xx_dxe_enable_ch_int(struct wcn36xx *wcn, 
u16 wcn_ch)
return 0;
 }
 
-static int wcn36xx_dxe_fill_skb(struct wcn36xx_dxe_ctl *ctl)
+static int wcn36xx_dxe_fill_skb(struct device *dev, struct wcn36xx_dxe_ctl 
*ctl)
 {
struct wcn36xx_dxe_desc *dxe = ctl->desc;
struct sk_buff *skb;
@@ -279,7 +279,7 @@ static int wcn36xx_dxe_fill_skb(struct wcn36xx_dxe_ctl *ctl)
if (skb == NULL)
return -ENOMEM;
 
-   dxe->dst_addr_l = dma_map_single(NULL,
+   dxe->dst_addr_l = dma_map_single(dev,
 skb_tail_pointer(skb),
 WCN36XX_PKT_SIZE,
 DMA_FROM_DEVICE);
@@ -297,7 +297,7 @@ static int wcn36xx_dxe_ch_alloc_skb(struct wcn36xx *wcn,
cur_ctl = wcn_ch->head_blk_ctl;
 
for (i = 0; i < wcn_ch->desc_num; i++) {
-   wcn36xx_dxe_fill_skb(cur_ctl);
+   wcn36xx_dxe_fill_skb(wcn->dev, cur_ctl);
cur_ctl = cur_ctl->next;
}
 
@@ -358,7 +358,7 @@ static void reap_tx_dxes(struct wcn36xx *wcn, struct 
wcn36xx_dxe_ch *ch)
if (ctl->desc->ctrl & WCN36XX_DXE_CTRL_VALID_MASK)
break;
if (ctl->skb) {
-   dma_unmap_single(NULL, ctl->desc->src_addr_l,
+   dma_unmap_single(wcn->dev, ctl->desc->src_addr_l,
 ctl->skb->len, DMA_TO_DEVICE);
info = IEEE80211_SKB_CB(ctl->skb);
if (!(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
@@ -474,7 +474,7 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
while (!(dxe->ctrl & WCN36XX_DXE_CTRL_VALID_MASK)) {
skb = ctl->skb;
dma_addr = dxe->dst_addr_l;
-   wcn36xx_dxe_fill_skb(ctl);
+   wcn36xx_dxe_fill_skb(wcn->dev, ctl);
 
switch (ch->ch_type) {
case WCN36XX_DXE_CH_RX_L:
@@ -491,7 +491,7 @@ static int wcn36xx_rx_handle_packets(struct wcn36xx *wcn,
wcn36xx_warn("Unknown channel\n");
}
 
-   dma_unmap_single(NULL, dma_addr, WCN36XX_PKT_SIZE,
+   dma_unmap_single(wcn->dev, dma_addr, WCN36XX_PKT_SIZE,
 DMA_FROM_DEVICE);
wcn36xx_rx_skb(wcn, skb);
ctl = ctl->next;
@@ -540,7 +540,7 @@ int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
16 - (WCN36XX_BD_CHUNK_SIZE % 8);
 
s = wcn->mgmt_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_H;
-   cpu_addr = dma_alloc_coherent(NULL, s, >mgmt_mem_pool.phy_addr,
+   

Re: [PATCH 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan

2015-10-30 Thread glen lee



On 2015년 10월 30일 17:35, Dan Carpenter wrote:

On Fri, Oct 30, 2015 at 12:10:42PM +0900, Glen Lee wrote:

/*create the common structure*/
-   g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
-   if (!g_linux_wlan)
+   wl = kzalloc(sizeof(struct wilc), GFP_KERNEL);

This introduces a checkpatch.pl warning.  The prefered style is:

wl = kzalloc(sizeof(*wl), GFP_KERNEL);

But the larger point is that please use checkpatch.pl.


Thank you for the review, I will use preferred style in v2.

regards,

glen lee



regards,
dan carpenter



--
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] wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.

2015-10-30 Thread fengwei.yin



On 2015/10/30 14:02, Kalle Valo wrote:

yfw  writes:


On Fri, Oct 30, 2015 at 06:59:46AM +0200, Kalle Valo wrote:

Nicolas Dechesne  writes:


fwiw.. I applied the original patch from the list locally, and I don't
see this issue after git am :

$ git shortlog -1
Yin, Fengwei (1):
   wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.


Ah, I think it's coming from patchwork:

"Submitter yfw"

https://patchwork.kernel.org/patch/7484791/

Fengwei, please fix your name in patchwork. It should be easy to do.


Kalle, any clue about how to change the name in patchwork? I can't find
how on the patchwork website.


Not sure. I think first need to register with the same email address:

https://patchwork.kernel.org/register/


v2 was updated here:
https://patchwork.kernel.org/patch/7524381/

Regards
Yin, Fengwei




Anyway, my original comment still stands. The correct format for name
is:

 Random J Developer 

NOT:

 Developer, Random J 

See SubmittingPatches.


Will update the patch. Thanks.


It's too late for this patch as I already applied it.


--
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] wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.

2015-10-30 Thread fengwei.yin



On 2015/10/30 14:02, Kalle Valo wrote:

yfw  writes:


On Fri, Oct 30, 2015 at 06:59:46AM +0200, Kalle Valo wrote:

Nicolas Dechesne  writes:


fwiw.. I applied the original patch from the list locally, and I don't
see this issue after git am :

$ git shortlog -1
Yin, Fengwei (1):
   wcn36xx: Remove warning message when dev is NULL for arm64 dma_alloc.


Ah, I think it's coming from patchwork:

"Submitter yfw"

https://patchwork.kernel.org/patch/7484791/

Fengwei, please fix your name in patchwork. It should be easy to do.


Kalle, any clue about how to change the name in patchwork? I can't find
how on the patchwork website.


Not sure. I think first need to register with the same email address:

https://patchwork.kernel.org/register/

Thanks. Yes. Register/Login and update the profile give me correct submitter.
I will resend the patch soon.

Regards
Yin, Fengwei



Anyway, my original comment still stands. The correct format for name
is:

 Random J Developer 

NOT:

 Developer, Random J 

See SubmittingPatches.


Will update the patch. Thanks.


It's too late for this patch as I already applied it.


--
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 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan

2015-10-30 Thread Dan Carpenter
On Fri, Oct 30, 2015 at 12:10:42PM +0900, Glen Lee wrote:
>   /*create the common structure*/
> - g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
> - if (!g_linux_wlan)
> + wl = kzalloc(sizeof(struct wilc), GFP_KERNEL);

This introduces a checkpatch.pl warning.  The prefered style is:

wl = kzalloc(sizeof(*wl), GFP_KERNEL);

But the larger point is that please use checkpatch.pl.

regards,
dan carpenter

--
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


[RFC] mac80211_hwsim: Implements a check for ATTR_FREQ inside hwsim_cloned_frame_received_nl

2015-10-30 Thread arwelle
From: Adam Welle 

If a frame is received from netlink with this value set it is checked against 
the current radio's frequency and discarded if different.

Signed-off-by: Adam Welle 
---
 drivers/net/wireless/mac80211_hwsim.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index ee46f46..78faa72 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2827,10 +2827,17 @@ static int hwsim_cloned_frame_received_nl(struct 
sk_buff *skb_2,
 
/* A frame is received from user space */
memset(_status, 0, sizeof(rx_status));
-   /* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel
-* packets?
-*/
-   rx_status.freq = data2->channel->center_freq;
+
+   /* Check ATTR_FREQ if it exists, and throw away off-channel packets */
+   if (info->attrs[HWSIM_ATTR_FREQ])
+   rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]);
+   else
+   rx_status.freq = data2->channel->center_freq;
+
+   /* Drop packet if not on the same frequency as this radio */
+   if (rx_status.freq != data2->channel->center_freq)
+   goto out;
+
rx_status.band = data2->channel->band;
rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]);
-- 
2.1.4

--
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


[RFC] mac80211_hwsim: Adds parameter use_hwsim_mon which can be used to disable hwism0

2015-10-30 Thread arwelle
From: Adam Welle 

A new parameter, use_hwsim_mon has been created to implement new 
functionalilty. use_hwsim_mon defaults to true so that normal operation remains 
the same. When set to false, the hwsim0 device is not created. This value is 
also checked before calling functions which would transmit data to the hwsim0 
device.

Signed-off-by: Adam Welle 
---
 drivers/net/wireless/mac80211_hwsim.c | 49 +--
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index ee46f46..8e48869 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -61,6 +61,10 @@ static bool support_p2p_device = true;
 module_param(support_p2p_device, bool, 0444);
 MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type");
 
+static bool use_hwsim_mon = true;
+module_param(use_hwsim_mon, bool, 0444);
+MODULE_PARM_DESC(use_hwsim_mon, "Create and use hwsim0 monitor device");
+
 /**
  * enum hwsim_regtest - the type of regulatory tests we offer
  *
@@ -1292,7 +1296,8 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
   ARRAY_SIZE(txi->control.rates));
 
txi->rate_driver_data[0] = channel;
-   mac80211_hwsim_monitor_rx(hw, skb, channel);
+   if (use_hwsim_mon)
+   mac80211_hwsim_monitor_rx(hw, skb, channel);
 
/* wmediumd mode check */
_portid = ACCESS_ONCE(wmediumd_portid);
@@ -1305,7 +1310,7 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
data->tx_bytes += skb->len;
ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
 
-   if (ack && skb->len >= 16) {
+   if (ack && skb->len >= 16 && use_hwsim_mon) {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
mac80211_hwsim_monitor_ack(channel, hdr->addr2);
}
@@ -1402,7 +1407,8 @@ static void mac80211_hwsim_tx_frame(struct ieee80211_hw 
*hw,
   ARRAY_SIZE(txi->control.rates));
}
 
-   mac80211_hwsim_monitor_rx(hw, skb, chan);
+   if (use_hwsim_mon)
+   mac80211_hwsim_monitor_rx(hw, skb, chan);
 
if (_pid)
return mac80211_hwsim_tx_frame_nl(hw, skb, _pid);
@@ -3260,26 +3266,28 @@ static int __init init_mac80211_hwsim(void)
goto out_free_radios;
}
 
-   hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN,
+   if (use_hwsim_mon) {
+   hwsim_mon = alloc_netdev(0, "hwsim%d", NET_NAME_UNKNOWN,
 hwsim_mon_setup);
-   if (hwsim_mon == NULL) {
-   err = -ENOMEM;
-   goto out_free_radios;
-   }
+   if (hwsim_mon == NULL) {
+   err = -ENOMEM;
+   goto out_free_radios;
+   }
 
-   rtnl_lock();
-   err = dev_alloc_name(hwsim_mon, hwsim_mon->name);
-   if (err < 0) {
-   rtnl_unlock();
-   goto out_free_radios;
-   }
+   rtnl_lock();
+   err = dev_alloc_name(hwsim_mon, hwsim_mon->name);
+   if (err < 0) {
+   rtnl_unlock();
+   goto out_free_radios;
+   }
 
-   err = register_netdevice(hwsim_mon);
-   if (err < 0) {
+   err = register_netdevice(hwsim_mon);
+   if (err < 0) {
+   rtnl_unlock();
+   goto out_free_mon;
+   }
rtnl_unlock();
-   goto out_free_mon;
}
-   rtnl_unlock();
 
return 0;
 
@@ -3300,7 +3308,10 @@ static void __exit exit_mac80211_hwsim(void)
hwsim_exit_netlink();
 
mac80211_hwsim_free();
-   unregister_netdev(hwsim_mon);
+
+   if (hwsim_mon)
+   unregister_netdev(hwsim_mon);
+
platform_driver_unregister(_hwsim_driver);
 }
 module_exit(exit_mac80211_hwsim);
-- 
2.1.4

--
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/2] cfg80211: Add support for aborting an ongoing scan

2015-10-30 Thread Johannes Berg

>   *
> + * @NL80211_CMD_ABORT_SCAN: stop an ongoing scan. Returns -ENOENT if a scan 
> is
> + *   not running.


I think we might need to indicate in nl80211 exported capabilities
whether or not this command is available?

The return code requirement should probably also be documented in
cfg80211.h, and the fact that you get a scan-done message should be
here as well.

Or is that not necessary - i.e. no relevant races are possible - and
the function return can be void?

johannes
--
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/2] cfg80211: Add support for aborting an ongoing scan

2015-10-30 Thread Jouni Malinen
On Fri, Oct 30, 2015 at 10:34:00AM +0100, Johannes Berg wrote:
> > + * @NL80211_CMD_ABORT_SCAN: stop an ongoing scan. Returns -ENOENT if a 
> > scan is
> > + * not running.

> I think we might need to indicate in nl80211 exported capabilities
> whether or not this command is available?
> 
> The return code requirement should probably also be documented in
> cfg80211.h, and the fact that you get a scan-done message should be
> here as well.
> 
> Or is that not necessary - i.e. no relevant races are possible - and
> the function return can be void?

The currently identified use cases do not seem to care much about the
actual result of this command since there is going to be a wait for the
scan completed event anyway and the call is not even used unless there
is a known ongoing scan. As such, even the difference of a driver
supporting this command or not is not that significant taken into
account this is used only as an optimization to speed up the following
operation when a long scan operation was in progress. Things work fine
(though without that speed benefit) even if the driver does not
support this. Anyway, making cfg80211 advertise whether the new command
is available could obviously be done should someone come up with a use
case that depends on knowing that the optimization is available.

The wpa_supplicant patches I'm planning on pushing in as soon as the
nl80211 command ID gets assigned are here:
http://w1.fi/p/scan/

-- 
Jouni MalinenPGP id EFC895FA
--
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 14/17] staging: wilc1000: acquire_bus: add new argument struct wilc

2015-10-30 Thread Glen Lee
This patch adds struct wilc and use it instead of g_linux_wlan, pass dev
to the functions as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 47 ++--
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 894466f..a61dbea 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -109,10 +109,10 @@ static CHIP_PS_STATE_T genuChipPSstate = CHIP_WAKEDUP;
 /*acquire_bus() and release_bus() are made static inline functions*/
 /*as a temporary workaround to fix a problem of receiving*/
 /*unknown interrupt from FW*/
-static inline void acquire_bus(BUS_ACQUIRE_T acquire)
+static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
 {
 
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (genuChipPSstate != CHIP_WAKEDUP)
#endif
@@ -812,11 +812,16 @@ static inline void chip_wakeup(void)
 #endif
 void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime)
 {
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
+
+   wilc = nic->wilc;
+
if (genuChipPSstate != CHIP_WAKEDUP) {
/* chip is already sleeping. Do nothing */
return;
}
-   acquire_bus(ACQUIRE_ONLY);
+   acquire_bus(wilc, ACQUIRE_ONLY);
 
 #ifdef WILC_OPTIMIZE_SLEEP_INT
chip_allow_sleep();
@@ -921,7 +926,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
PRINT_D(TX_DBG, "Mark the last entry in VMM table - 
number of previous entries = %d\n", i);
vmm_table[i] = 0x0; /* mark the last element to 0 */
}
-   acquire_bus(ACQUIRE_AND_WAKEUP);
+   acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0;
do {
 
@@ -951,7 +956,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm 
table not clear yet, wait...\n");
release_bus(RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
-   acquire_bus(ACQUIRE_AND_WAKEUP);
+   acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
}
} while (!p->quit);
 
@@ -999,7 +1004,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
} else {
release_bus(RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
-   acquire_bus(ACQUIRE_AND_WAKEUP);
+   acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM 
entery - reg = %2x\n", reg);
}
} while (--timeout);
@@ -1102,7 +1107,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
/**
 *  lock the bus
 **/
-   acquire_bus(ACQUIRE_AND_WAKEUP);
+   acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
ret = p->hif_func.hif_clear_int_ext(ENABLE_TX_VMM);
if (!ret) {
@@ -1385,7 +1390,7 @@ void wilc_handle_isr(void *wilc)
 {
u32 int_status;
 
-   acquire_bus(ACQUIRE_AND_WAKEUP);
+   acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
g_wlan.hif_func.hif_read_int(_status);
 
if (int_status & PLL_INT_EXT)
@@ -1423,6 +1428,10 @@ int wilc_wlan_firmware_download(struct net_device *dev, 
const u8 *buffer,
u32 addr, size, size2, blksz;
u8 *dma_buffer;
int ret = 0;
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
+
+   wilc = nic->wilc;
 
blksz = BIT(12);
/* Allocate a DMA coherent  buffer. */
@@ -1447,7 +1456,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, 
const u8 *buffer,
addr = BYTE_SWAP(addr);
size = BYTE_SWAP(size);
 #endif
-   acquire_bus(ACQUIRE_ONLY);
+   acquire_bus(wilc, ACQUIRE_ONLY);
offset += 8;
while (((int)size) && (offset < buffer_size)) {
if (size <= blksz)
@@ -1495,6 +1504,10 @@ int wilc_wlan_start(struct net_device *dev)
u32 reg = 0;
int ret;
u32 chipid;
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
+
+   wilc = nic->wilc;
 
/**
 *  Set the host interface
@@ -1505,7 +1518,7 @@ int wilc_wlan_start(struct net_device *dev)
} else if (p->io_func.io_type == HIF_SPI) {
reg = 1;
}

[PATCH V2 17/17] staging: wilc1000: wilc_netdev_init: use wilc instead of g_linux_wlan

2015-10-30 Thread Glen Lee
Use wilc instead of g_linux_wlan. g_liux_wlan is not used anymore, just
delete it.

Signed-off-by: Glen Lee 
---
Changes in v2: use sizeof(*wl) instead of sizeof(struct wilc).

 drivers/staging/wilc1000/linux_wlan.c | 22 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 -
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 3801a00..3422d99 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -112,7 +112,6 @@ static void wilc_set_multicast_list(struct net_device *dev);
  * for now - in frmw_to_linux there should be private data to be passed to it
  * and this data should be pointer to net device
  */
-struct wilc *g_linux_wlan;
 bool bEnablePS = true;
 
 static const struct net_device_ops wilc_netdev_ops = {
@@ -1702,15 +1701,16 @@ int wilc_netdev_init(struct wilc **wilc)
int i;
perInterface_wlan_t *nic;
struct net_device *ndev;
+   struct wilc *wl;
 
sema_init(_exit_sync, 0);
 
/*create the common structure*/
-   g_linux_wlan = kzalloc(sizeof(*g_linux_wlan), GFP_KERNEL);
-   if (!g_linux_wlan)
+   wl = kzalloc(sizeof(*wl), GFP_KERNEL);
+   if (!wl)
return -ENOMEM;
 
-   *wilc = g_linux_wlan;
+   *wilc = wl;
 
register_inetaddr_notifier(_dev_notifier);
 
@@ -1737,11 +1737,11 @@ int wilc_netdev_init(struct wilc **wilc)
} else
strcpy(ndev->name, "p2p%d");
 
-   nic->u8IfIdx = g_linux_wlan->vif_num;
+   nic->u8IfIdx = wl->vif_num;
nic->wilc_netdev = ndev;
-   nic->wilc = *wilc;
-   g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
-   g_linux_wlan->vif_num++;
+   nic->wilc = wl;
+   wl->vif[wl->vif_num].ndev = ndev;
+   wl->vif_num++;
ndev->netdev_ops = _netdev_ops;
 
{
@@ -1781,13 +1781,13 @@ int wilc_netdev_init(struct wilc **wilc)
}
 
#ifndef WILC_SDIO
-   if (!linux_spi_init(_linux_wlan->wilc_spidev)) {
+   if (!linux_spi_init(>wilc_spidev)) {
PRINT_ER("Can't initialize SPI\n");
return -1; /* ERROR */
}
-   g_linux_wlan->wilc_spidev = wilc_spi_dev;
+   wl->wilc_spidev = wilc_spi_dev;
#else
-   g_linux_wlan->wilc_sdio_func = local_sdio_func;
+   wl->wilc_sdio_func = local_sdio_func;
#endif
 
return 0;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 31d5ac9..54d798c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -206,7 +206,6 @@ struct WILC_WFI_mon_priv {
struct net_device *real_ndev;
 };
 
-extern struct wilc *g_linux_wlan;
 extern struct net_device *WILC_WFI_devs[];
 void frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
 void linux_wlan_mac_indicate(struct wilc *wilc, int flag);
-- 
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 V2 15/17] staging: wilc1000: release_bus: add argument struct wilc

2015-10-30 Thread Glen Lee
This patch adds new argument struct wilc and use it instead of g_linux_wlan,
pass wilc to the functions as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a61dbea..898f60e 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -122,13 +122,13 @@ static inline void acquire_bus(struct wilc *wilc, 
BUS_ACQUIRE_T acquire)
}
 
 }
-static inline void release_bus(BUS_RELEASE_T release)
+static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
 {
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep();
#endif
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
 }
 /
  *
@@ -831,7 +831,7 @@ void chip_sleep_manually(struct net_device *dev, u32 
u32SleepTime)
g_wlan.hif_func.hif_write_reg(0x10a8, 1);
 
genuChipPSstate = CHIP_SLEEPING_MANUAL;
-   release_bus(RELEASE_ONLY);
+   release_bus(wilc, RELEASE_ONLY);
 
 }
 
@@ -954,7 +954,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
 *  wait for vmm table is ready
 **/
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm 
table not clear yet, wait...\n");
-   release_bus(RELEASE_ALLOW_SLEEP);
+   release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
}
@@ -1002,7 +1002,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
entries = ((reg >> 3) & 0x3f);
break;
} else {
-   release_bus(RELEASE_ALLOW_SLEEP);
+   release_bus(wilc, RELEASE_ALLOW_SLEEP);
usleep_range(3000, 3000);
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
PRINT_WRN(GENERIC_DBG, "Can't get VMM 
entery - reg = %2x\n", reg);
@@ -1047,7 +1047,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
 
/* since copying data into txb takes some time, then
 * allow the bus lock to be released let the RX task go. */
-   release_bus(RELEASE_ALLOW_SLEEP);
+   release_bus(wilc, RELEASE_ALLOW_SLEEP);
 
/**
 *  Copy data to the TX buffer
@@ -1126,7 +1126,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 
*pu32TxqCount)
 
 _end_:
 
-   release_bus(RELEASE_ALLOW_SLEEP);
+   release_bus(wilc, RELEASE_ALLOW_SLEEP);
if (ret != 1)
break;
} while (0);
@@ -1412,7 +1412,7 @@ void wilc_handle_isr(void *wilc)
 #endif
wilc_unknown_isr_ext();
}
-   release_bus(RELEASE_ALLOW_SLEEP);
+   release_bus(wilc, RELEASE_ALLOW_SLEEP);
 }
 
 /
@@ -1473,7 +1473,7 @@ int wilc_wlan_firmware_download(struct net_device *dev, 
const u8 *buffer,
offset += size2;
size -= size2;
}
-   release_bus(RELEASE_ONLY);
+   release_bus(wilc, RELEASE_ONLY);
 
if (!ret) {
/*EIO   5*/
@@ -1522,7 +1522,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_write_reg(WILC_VMM_CORE_CFG, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg 
vmm_core_cfg...\n");
-   release_bus(RELEASE_ONLY);
+   release_bus(wilc, RELEASE_ONLY);
/* EIO  5*/
ret = -5;
return ret;
@@ -1563,7 +1563,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_write_reg(WILC_GP_REG_1, reg);
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 
...\n");
-   release_bus(RELEASE_ONLY);
+   release_bus(wilc, RELEASE_ONLY);
/* EIO  5*/
ret = -5;
return ret;
@@ -1577,7 +1577,7 @@ int wilc_wlan_start(struct net_device *dev)
ret = p->hif_func.hif_read_reg(0x1000, );
if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
-   release_bus(RELEASE_ONLY);
+   release_bus(wilc, RELEASE_ONLY);
/* EIO  

[PATCH V2 16/17] staging: wilc1000: linux_wlan_get_num_conn_ifcs: add argument net_device

2015-10-30 Thread Glen Lee
This patch add new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c |  4 +---
 drivers/staging/wilc1000/linux_wlan.c | 10 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 1263b5e..2a8330e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -271,8 +271,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern int linux_wlan_get_num_conn_ifcs(void);
-
 static int add_handler_in_list(struct host_if_drv *handler)
 {
int i;
@@ -2991,7 +2989,7 @@ static int hostIFthread(void *pvArg)
del_timer(_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
 
-   if (!linux_wlan_get_num_conn_ifcs())
+   if (!linux_wlan_get_num_conn_ifcs(hif_drv->priv->dev))
chip_sleep_manually(hif_drv->priv->dev,
INFINITE_SLEEP_TIME);
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2226ddb..3801a00 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -421,14 +421,18 @@ int linux_wlan_set_bssid(struct net_device *wilc_netdev, 
u8 *pBSSID)
 }
 
 /*Function to get number of connected interfaces*/
-int linux_wlan_get_num_conn_ifcs(void)
+int linux_wlan_get_num_conn_ifcs(struct net_device *dev)
 {
u8 i = 0;
u8 null_bssid[6] = {0};
u8 ret_val = 0;
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
 
-   for (i = 0; i < g_linux_wlan->vif_num; i++)
-   if (memcmp(g_linux_wlan->vif[i].bssid, null_bssid, 6))
+   wilc = nic->wilc;
+
+   for (i = 0; i < wilc->vif_num; i++)
+   if (memcmp(wilc->vif[i].bssid, null_bssid, 6))
ret_val++;
 
return ret_val;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 07917ea..31d5ac9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -219,4 +219,5 @@ void wilc1000_wlan_deinit(struct net_device *dev);
 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
 u16 Set_machw_change_vir_if(struct net_device *dev, bool bValue);
 int linux_wlan_get_firmware(struct net_device *dev);
+int linux_wlan_get_num_conn_ifcs(struct net_device *dev);
 #endif
-- 
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 V2 09/17] staging: wilc1000: wilc_wlan_stop: add argument struct net_device

2015-10-30 Thread Glen Lee
This patch adds new argument struct net_device and pass dev to the functions.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 6ffa2a1..1019a19 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -935,7 +935,7 @@ void wilc1000_wlan_deinit(struct net_device *dev)
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
deinit_irq(dev);
 
-   wilc_wlan_stop();
+   wilc_wlan_stop(dev);
 
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup(dev);
@@ -1176,7 +1176,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
return 0; /*success*/
 
 _fail_fw_start_:
-   wilc_wlan_stop();
+   wilc_wlan_stop(dev);
 
 _fail_irq_enable_:
 #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index c8ce1f6..d4eef3d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1598,7 +1598,7 @@ void wilc_wlan_global_reset(void)
p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
release_bus(RELEASE_ONLY);
 }
-int wilc_wlan_stop(void)
+int wilc_wlan_stop(struct net_device *dev)
 {
wilc_wlan_dev_t *p = _wlan;
u32 reg = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 519f352..fa66783 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -297,7 +297,7 @@ typedef struct {
 
 int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
 int wilc_wlan_start(void);
-int wilc_wlan_stop(void);
+int wilc_wlan_stop(struct net_device *dev);
 int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
  u32 buffer_size, wilc_tx_complete_func_t func);
 int wilc_wlan_handle_txq(struct net_device *dev, u32 *pu32TxqCount);
-- 
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 V2 10/17] staging: wilc1000: remove unused function wilc_wlan_global_reset

2015-10-30 Thread Glen Lee
Remove unused function wilc_wlan_global_reset.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index d4eef3d..c464cd7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1589,15 +1589,6 @@ int wilc_wlan_start(void)
return (ret < 0) ? ret : 0;
 }
 
-void wilc_wlan_global_reset(void)
-{
-
-   wilc_wlan_dev_t *p = _wlan;
-
-   acquire_bus(ACQUIRE_AND_WAKEUP);
-   p->hif_func.hif_write_reg(WILC_GLB_RESET_0, 0x0);
-   release_bus(RELEASE_ONLY);
-}
 int wilc_wlan_stop(struct net_device *dev)
 {
wilc_wlan_dev_t *p = _wlan;
-- 
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 V2 08/17] staging: wilc1000: remove unused function remove_TCP_related

2015-10-30 Thread Glen Lee
Just remove unused function remove_TCP_related.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index b503f07..c8ce1f6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -349,16 +349,6 @@ static inline int add_TCP_Pending_Ack(u32 Ack, u32 
Session_index, struct txq_ent
}
return 0;
 }
-static inline int remove_TCP_related(void)
-{
-   wilc_wlan_dev_t *p = _wlan;
-   unsigned long flags;
-
-   spin_lock_irqsave(_linux_wlan->txq_spinlock, flags);
-
-   spin_unlock_irqrestore(_linux_wlan->txq_spinlock, flags);
-   return 0;
-}
 
 static inline int tcp_process(struct net_device *dev, struct txq_entry_t *tqe)
 {
-- 
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 V2 12/17] staging: wilc1000: chip_sleep_manually: add argument struct net_device

2015-10-30 Thread Glen Lee
This patch add new argument struct net_device and pass dev to the function
as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h  | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 3a4fdc0..1263b5e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -271,7 +271,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern void chip_sleep_manually(u32 u32SleepTime);
 extern int linux_wlan_get_num_conn_ifcs(void);
 
 static int add_handler_in_list(struct host_if_drv *handler)
@@ -2993,7 +2992,8 @@ static int hostIFthread(void *pvArg)
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
 
if (!linux_wlan_get_num_conn_ifcs())
-   chip_sleep_manually(INFINITE_SLEEP_TIME);
+   chip_sleep_manually(hif_drv->priv->dev,
+   INFINITE_SLEEP_TIME);
 
Handle_ScanDone(msg.drv, SCAN_EVENT_DONE);
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index e8afa6b..93fae34 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -810,7 +810,7 @@ static inline void chip_wakeup(void)
genuChipPSstate = CHIP_WAKEDUP;
 }
 #endif
-void chip_sleep_manually(u32 u32SleepTime)
+void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime)
 {
if (genuChipPSstate != CHIP_WAKEDUP) {
/* chip is already sleeping. Do nothing */
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 194c24c..c948c25 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -311,4 +311,5 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, 
u32 wid, int commit,
 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
 int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
   u32 buffer_size, wilc_tx_complete_func_t func);
+void chip_sleep_manually(struct net_device *dev, u32 u32SleepTime);
 #endif
-- 
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 V2 11/17] staging: wilc1000: wilc_wlan_firmware_download: add argument net_device

2015-10-30 Thread Glen Lee
Add new argument struct net_device and pass dev to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 3 ++-
 drivers/staging/wilc1000/wilc_wlan.h  | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1019a19..bb37f5b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -624,7 +624,7 @@ static int linux_wlan_firmware_download(struct net_device 
*dev)
 *  do the firmware download
 **/
PRINT_D(INIT_DBG, "Downloading Firmware ...\n");
-   ret = wilc_wlan_firmware_download(wilc->firmware->data,
+   ret = wilc_wlan_firmware_download(dev, wilc->firmware->data,
  wilc->firmware->size);
if (ret < 0)
goto _FAIL_;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index c464cd7..e8afa6b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1415,7 +1415,8 @@ void wilc_handle_isr(void *wilc)
  *  Firmware download
  *
  /
-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size)
+int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
+   u32 buffer_size)
 {
wilc_wlan_dev_t *p = _wlan;
u32 offset;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index fa66783..194c24c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -295,7 +295,8 @@ typedef struct {
u32 seq_no;
 } wilc_cfg_rsp_t;
 
-int wilc_wlan_firmware_download(const u8 *buffer, u32 buffer_size);
+int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
+   u32 buffer_size);
 int wilc_wlan_start(void);
 int wilc_wlan_stop(struct net_device *dev);
 int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
-- 
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 V2 13/17] staging: wilc1000: wilc_wlan_start: add argument struct net_device

2015-10-30 Thread Glen Lee
This patch adds new argument struct net_device and pass dev to the function.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index bb37f5b..2226ddb 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -584,7 +584,7 @@ static int linux_wlan_start_firmware(struct net_device *dev)
 
/* start firmware */
PRINT_D(INIT_DBG, "Starting Firmware ...\n");
-   ret = wilc_wlan_start();
+   ret = wilc_wlan_start(dev);
if (ret < 0) {
PRINT_ER("Failed to start Firmware\n");
goto _fail_;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 93fae34..894466f 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1489,7 +1489,7 @@ _fail_1:
  *  Common
  *
  /
-int wilc_wlan_start(void)
+int wilc_wlan_start(struct net_device *dev)
 {
wilc_wlan_dev_t *p = _wlan;
u32 reg = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index c948c25..73e01a7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -297,7 +297,7 @@ typedef struct {
 
 int wilc_wlan_firmware_download(struct net_device *dev, const u8 *buffer,
u32 buffer_size);
-int wilc_wlan_start(void);
+int wilc_wlan_start(struct net_device *dev);
 int wilc_wlan_stop(struct net_device *dev);
 int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
  u32 buffer_size, wilc_tx_complete_func_t func);
-- 
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 V2 07/17] staging: wilc1000: wilc_wlan_txq_add_to_head: add new argument net_device

2015-10-30 Thread Glen Lee
This patch adds new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index ec4bff4..b503f07 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -227,15 +227,21 @@ static void wilc_wlan_txq_add_to_tail(struct net_device 
*dev,
up(>txq_event);
 }
 
-static int wilc_wlan_txq_add_to_head(struct txq_entry_t *tqe)
+static int wilc_wlan_txq_add_to_head(struct net_device *dev,
+struct txq_entry_t *tqe)
 {
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
wilc_wlan_dev_t *p = _wlan;
unsigned long flags;
-   if (linux_wlan_lock_timeout(_linux_wlan->txq_add_to_head_cs,
+
+   wilc = nic->wilc;
+
+   if (linux_wlan_lock_timeout(>txq_add_to_head_cs,
CFG_PKTS_TIMEOUT))
return -1;
 
-   spin_lock_irqsave(_linux_wlan->txq_spinlock, flags);
+   spin_lock_irqsave(>txq_spinlock, flags);
 
if (p->txq_head == NULL) {
tqe->next = NULL;
@@ -251,14 +257,14 @@ static int wilc_wlan_txq_add_to_head(struct txq_entry_t 
*tqe)
p->txq_entries += 1;
PRINT_D(TX_DBG, "Number of entries in TxQ = %d\n", p->txq_entries);
 
-   spin_unlock_irqrestore(_linux_wlan->txq_spinlock, flags);
-   up(_linux_wlan->txq_add_to_head_cs);
+   spin_unlock_irqrestore(>txq_spinlock, flags);
+   up(>txq_add_to_head_cs);
 
 
/**
 *  wake up TX queue
 **/
-   up(_linux_wlan->txq_event);
+   up(>txq_event);
PRINT_D(TX_DBG, "Wake up the txq_handler\n");
 
return 0;
@@ -520,7 +526,7 @@ static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev,
 **/
PRINT_D(TX_DBG, "Adding the config packet at the Queue tail\n");
 
-   if (wilc_wlan_txq_add_to_head(tqe))
+   if (wilc_wlan_txq_add_to_head(dev, tqe))
return 0;
return 1;
 }
-- 
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 V2 06/17] staging: wilc1000: wilc_wlan_txq_add_cfg_pkt: add argument net_device

2015-10-30 Thread Glen Lee
This patch adds new argument struct net_device and use netdev private data
member wilc instead of g_linux_wlan, pass dev to the function.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 75b0616..ec4bff4 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -484,15 +484,20 @@ bool is_TCP_ACK_Filter_Enabled(void)
return EnableTCPAckFilter;
 }
 
-static int wilc_wlan_txq_add_cfg_pkt(u8 *buffer, u32 buffer_size)
+static int wilc_wlan_txq_add_cfg_pkt(struct net_device *dev,
+u8 *buffer, u32 buffer_size)
 {
wilc_wlan_dev_t *p = _wlan;
struct txq_entry_t *tqe;
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
+
+   wilc = nic->wilc;
 
PRINT_D(TX_DBG, "Adding config packet ...\n");
if (p->quit) {
PRINT_D(TX_DBG, "Return due to clear function\n");
-   up(_linux_wlan->cfg_event);
+   up(>cfg_event);
return 0;
}
 
@@ -1763,7 +1768,7 @@ static int wilc_wlan_cfg_commit(struct net_device *dev,
 *  Add to TX queue
 **/
 
-   if (!wilc_wlan_txq_add_cfg_pkt(>wid_header[0], total_len))
+   if (!wilc_wlan_txq_add_cfg_pkt(dev, >wid_header[0], total_len))
return -1;
 
return 0;
-- 
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: mwifiex problem: incompatible network settings

2015-10-30 Thread Amitkumar Karwar
Hi Dan,

> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
> ow...@vger.kernel.org] On Behalf Of Dan Williams
> Sent: Thursday, October 29, 2015 8:47 PM
> To: Amitkumar Karwar
> Cc: Julien Cubizolles; linux-wireless@vger.kernel.org; Nishant
> Sarmukadam
> Subject: Re: mwifiex problem: incompatible network settings
> 
> On Thu, 2015-10-29 at 12:27 +, Amitkumar Karwar wrote:
> > Hi Julien,
> >
> > > From: Julien Cubizolles [mailto:j.cubizol...@free.fr]
> > > Sent: Thursday, October 29, 2015 3:09 AM
> > > To: Dan Williams
> > > Cc: Amitkumar Karwar; linux-wireless@vger.kernel.org
> > > Subject: Re: mwifiex problem: incompatible network settings
> > >
> > > Dan Williams  writes:
> > >
> > > > He actually meant the wpa_supplicant configuration file, not the
> > > > supplicant's dbus config file.  But when driven by NetworkManager,
> > > > there is no supplicant configuration file.
> > >
> > > Sorry about that.
> > >
> > > > Instead, you can find out what config NM is pushing to the
> > > > supplicant by checking the NetworkManager logs, where NM will log
> lines like:
> > >
> > > Here are the relevant entries from the syslog file:
> > >
> > > I included the failed attempt to connect to the WPA protected
> > > network named "southcentral" and the successful one to a non
> > > protected one named "FreeWifi".
> > >
> >
> > Thanks for the logs. I compared your network manager log with the one
> on my setup. Both are same. Basically network manager log doesn't show
> security info (WPA/WPA2, encryption mode etc). So we can't rely on that.
> 
> NetworkManager leaves the 'protos' field empty, which allows the
> supplicant to choose the correct WPA/WPA2 mode depending on driver
> support.  What you see in the NM logs is exactly what gets pushed to the
> supplicant in the network block.  So if you don't see "proto" or
> "pairwise" or "group" in the NM logs, then it doesn't get pushed to the
> supplicant, and the supplicant uses its default behavior, which should
> be:
> 
> proto=WPA RSN
> pairwise=CCMP TKIP
> group=CCMP TKIP WEP104 WEP40
> 

Thanks for the inputs. I wasn't aware about this. Log with debug patch would 
make the picture clear by dumping exact configuration received by driver.

Regards,
Amitkumar
N�r��yb�X��ǧv�^�)޺{.n�+{��*ޕ�,�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

[PATCH] NFC: added the sysfs entry for nfcsim workqueue delay

2015-10-30 Thread Saurabh Sengar
added the sysfs entry for nfcsim workqueue delay, as tx_delay

Signed-off-by: Saurabh Sengar 
---
Hi,

As I have understood form TODO comment, I have implemented the sysfs entry
for this device.
Sorry, in case this patch is not meeting the expectation.
I am just finding my way to contribute in linux kernel :)

Regards,
Saurabh

 drivers/nfc/nfcsim.c | 38 +++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c
index 93111fa..d1ace87 100644
--- a/drivers/nfc/nfcsim.c
+++ b/drivers/nfc/nfcsim.c
@@ -32,6 +32,8 @@
 #define NFCSIM_POLL_TARGET 2
 #define NFCSIM_POLL_DUAL   (NFCSIM_POLL_INITIATOR | NFCSIM_POLL_TARGET)
 
+#define TX_DEFAULT_DELAY   5
+
 struct nfcsim {
struct nfc_dev *nfc_dev;
 
@@ -62,12 +64,41 @@ static struct nfcsim *dev1;
 
 static struct workqueue_struct *wq;
 
+
+static int tx_delay = TX_DEFAULT_DELAY;
+
+static ssize_t show_tx_delay(struct device *dev,
+   struct device_attribute *attr,
+   char *buf)
+{
+   int n;
+
+   n = scnprintf(buf, PAGE_SIZE, "%d\n", tx_delay);
+   return n;
+}
+
+static ssize_t store_tx_delay(struct device *dev,
+   struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   if (kstrtouint(buf, 0, _delay) < 0)
+   return -EINVAL;
+
+   if (tx_delay < 0)
+   return -EINVAL;
+
+   return count;
+}
+
+static DEVICE_ATTR(tx_delay, 0644, show_tx_delay, store_tx_delay);
+
 static void nfcsim_cleanup_dev(struct nfcsim *dev, u8 shutdown)
 {
DEV_DBG(dev, "shutdown=%d\n", shutdown);
 
mutex_lock(>lock);
 
+   device_remove_file(>nfc_dev->dev, _attr_tx_delay);
dev->polling_mode = NFCSIM_POLL_NONE;
dev->shutting_down = shutdown;
dev->cb = NULL;
@@ -320,10 +351,8 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct 
nfc_target *target,
 * If packet transmission occurs immediately between them, we have a
 * non-stop flow of several tens of thousands SYMM packets per second
 * and a burning cpu.
-*
-* TODO: Add support for a sysfs entry to control this delay.
 */
-   queue_delayed_work(wq, >recv_work, msecs_to_jiffies(5));
+   queue_delayed_work(wq, >recv_work, msecs_to_jiffies(tx_delay));
 
mutex_unlock(>lock);
 
@@ -461,6 +490,9 @@ static struct nfcsim *nfcsim_init_dev(void)
if (rc)
goto free_nfc_dev;
 
+   rc = device_create_file(>nfc_dev->dev, _attr_tx_delay);
+   if (rc)
+   pr_err("error creating sysfs entry\n");
return dev;
 
 free_nfc_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 V2 03/17] staging: wilc1000: wilc_wlan_cfg_get: add argument struct net_device

2015-10-30 Thread Glen Lee
Adds argument struct net_device and use netdev private data member wilc
instead of g_linux_wlan, pass dev to the functions as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c | 3 ++-
 drivers/staging/wilc1000/linux_wlan.c   | 2 +-
 drivers/staging/wilc1000/wilc_wlan.c| 8 ++--
 drivers/staging/wilc1000/wilc_wlan.h| 3 ++-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 3b4a950..530d64a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -595,7 +595,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct 
wid *wids,
for (counter = 0; counter < count; counter++) {
PRINT_INFO(CORECONFIG_DBG, "Sending CFG packet 
[%d][%d]\n", !counter,
   (counter == count - 1));
-   if (!wilc_wlan_cfg_get(!counter,
+   if (!wilc_wlan_cfg_get(dev,
+  !counter,
   wids[counter].id,
   (counter == count - 1),
   drv)) {
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d0161cd..4ed324c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1153,7 +1153,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 
wilc_bus_set_max_speed();
 
-   if (wilc_wlan_cfg_get(1, WID_FIRMWARE_VERSION, 1, 0)) {
+   if (wilc_wlan_cfg_get(dev, 1, WID_FIRMWARE_VERSION, 1, 0)) {
int size;
char Firmware_ver[20];
 
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 16224ce..768fd30 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1809,12 +1809,16 @@ int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, 
u32 buffer_size,
 
return ret_size;
 }
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler)
+int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
+ u32 drvHandler)
 {
wilc_wlan_dev_t *p = _wlan;
u32 offset;
int ret_size;
+   perInterface_wlan_t *nic = netdev_priv(dev);
+   struct wilc *wilc;
 
+   wilc = nic->wilc;
 
if (p->cfg_frame_in_use)
return 0;
@@ -1834,7 +1838,7 @@ int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 
drvHandler)
ret_size = 0;
 
 
-   if (linux_wlan_lock_timeout(_linux_wlan->cfg_event,
+   if (linux_wlan_lock_timeout(>cfg_event,
CFG_PKTS_TIMEOUT)) {
PRINT_D(TX_DBG, "Get Timed Out\n");
ret_size = 0;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 2eb7e20..2879a93 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -305,7 +305,8 @@ void wilc_handle_isr(void *wilc);
 void wilc_wlan_cleanup(struct net_device *dev);
 int wilc_wlan_cfg_set(int start, u32 wid, u8 *buffer, u32 buffer_size,
  int commit, u32 drvHandler);
-int wilc_wlan_cfg_get(int start, u32 wid, int commit, u32 drvHandler);
+int wilc_wlan_cfg_get(struct net_device *dev, int start, u32 wid, int commit,
+ u32 drvHandler);
 int wilc_wlan_cfg_get_val(u32 wid, u8 *buffer, u32 buffer_size);
 int wilc_wlan_txq_add_mgmt_pkt(struct net_device *dev, void *priv, u8 *buffer,
   u32 buffer_size, wilc_tx_complete_func_t func);
-- 
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 V2 01/17] staging: wilc1000: define wiphy private data priv in struct host_if_drv

2015-10-30 Thread Glen Lee
This patch defines wiphy private data priv in struct host_if_drv and set
priv to priv in host_if_drv to reference it's wiphy private data.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.h | 1 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 72c4797..f9efb5a 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -260,6 +260,7 @@ enum p2p_listen_state {
 };
 
 struct host_if_drv {
+   struct wilc_priv *priv;
struct user_scan_req usr_scan_req;
struct user_conn_req usr_conn_req;
struct remain_ch remain_on_ch;
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 32b93d3..8554f6f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3478,6 +3478,7 @@ int wilc_init_host_int(struct net_device *net)
s32Error = host_int_init(net, >hWILCWFIDrv);
if (s32Error)
PRINT_ER("Error while initializing hostinterface\n");
+   priv->hWILCWFIDrv->priv = priv;
 
return s32Error;
 }
-- 
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 V2 02/17] staging: wilc1000: send_config_pkt: add argument struct net_device

2015-10-30 Thread Glen Lee
This patch adds new argument struct net_device and pass dev to the function
as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c |   3 +-
 drivers/staging/wilc1000/coreconfigurator.h |   3 +-
 drivers/staging/wilc1000/host_interface.c   | 196 +---
 drivers/staging/wilc1000/wilc_wlan_if.h |   1 +
 4 files changed, 156 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index e10c6ff..3b4a950 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -586,7 +586,8 @@ s32 DeallocateAssocRespInfo(tstrConnectRespInfo 
*pstrConnectRespInfo)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv)
+s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
+   u32 count, u32 drv)
 {
s32 counter = 0, ret = 0;
 
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 6294d92..1ea5f47 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -127,7 +127,8 @@ typedef struct {
size_t ie_len;
 } tstrDisconnectNotifInfo;
 
-s32 send_config_pkt(u8 mode, struct wid *wids, u32 count, u32 drv);
+s32 send_config_pkt(struct net_device *dev, u8 mode, struct wid *wids,
+   u32 count, u32 drv);
 s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 17826f3..3a4fdc0 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -329,6 +329,9 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 {
s32 result = 0;
struct wid wid;
+   struct net_device *dev;
+
+   dev = hif_drv->priv->dev;
 
wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -337,7 +340,7 @@ static s32 Handle_SetChannel(struct host_if_drv *hif_drv,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   result = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(dev, SET_CFG, , 1,
 get_id_from_handler(hif_drv));
 
if (result) {
@@ -353,13 +356,17 @@ static s32 Handle_SetWfiDrvHandler(struct host_if_drv 
*hif_drv,
 {
s32 result = 0;
struct wid wid;
+   struct net_device *dev;
+
+   dev = hif_drv->priv->dev;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
wid.val = (s8 *)_drv_handler->handler;
wid.size = sizeof(u32);
 
-   result = send_config_pkt(SET_CFG, , 1, hif_drv_handler->handler);
+   result = send_config_pkt(dev, SET_CFG, , 1,
+hif_drv_handler->handler);
 
if (!hif_drv)
up(_sema_driver);
@@ -377,13 +384,16 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
 {
s32 result = 0;
struct wid wid;
+   struct net_device *dev;
+
+   dev = hif_drv->priv->dev;
 
wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)_op_mode->mode;
wid.size = sizeof(u32);
 
-   result = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(dev, SET_CFG, , 1,
 get_id_from_handler(hif_drv));
 
if ((hif_op_mode->mode) == IDLE_MODE)
@@ -402,6 +412,9 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
s32 result = 0;
struct wid wid;
char firmwareIPAddress[4] = {0};
+   struct net_device *dev;
+
+   dev = hif_drv->priv->dev;
 
if (pu8IPAddr[0] < 192)
pu8IPAddr[0] = 0;
@@ -415,7 +428,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
wid.val = (u8 *)pu8IPAddr;
wid.size = IP_ALEN;
 
-   result = send_config_pkt(SET_CFG, , 1,
+   result = send_config_pkt(dev, SET_CFG, , 1,
 get_id_from_handler(hif_drv));
 
host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx);
@@ -434,13 +447,16 @@ s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
 {
s32 result = 0;
struct wid wid;
+   struct net_device *dev;
+
+   dev = hif_drv->priv->dev;
 
wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
 
-   result = send_config_pkt(GET_CFG, , 1,
+   result = send_config_pkt(dev, GET_CFG, , 1,
 get_id_from_handler(hif_drv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -470,6 +486,9 @@ static 

[PATCH V2 04/17] staging: wilc1000: wilc_wlan_cfg_set: add argument struct net_device

2015-10-30 Thread Glen Lee
This patch adds new argument net_device and use netdev private data member
wilc instead of g_linux_wlan, pass dev to the functions also.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.c |  3 +-
 drivers/staging/wilc1000/linux_wlan.c   | 86 ++---
 drivers/staging/wilc1000/wilc_wlan.c|  9 ++-
 drivers/staging/wilc1000/wilc_wlan.h|  4 +-
 4 files changed, 53 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 530d64a..74fb556 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -616,7 +616,8 @@ s32 send_config_pkt(struct net_device *dev, u8 mode, struct 
wid *wids,
} else if (mode == SET_CFG) {
for (counter = 0; counter < count; counter++) {
PRINT_D(CORECONFIG_DBG, "Sending config SET PACKET 
WID:%x\n", wids[counter].id);
-   if (!wilc_wlan_cfg_set(!counter,
+   if (!wilc_wlan_cfg_set(dev,
+  !counter,
   wids[counter].id,
   wids[counter].val,
   wids[counter].size,
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4ed324c..6ffa2a1 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -662,53 +662,53 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
 
*(int *)c_val = 1;
 
-   if (!wilc_wlan_cfg_set(1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0))
goto _fail_;
 
/*to tell fw that we are going to use PC test - WILC specific*/
c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = INFRASTRUCTURE;
-   if (!wilc_wlan_cfg_set(0, WID_BSS_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_BSS_TYPE, c_val, 1, 0, 0))
goto _fail_;
 
/* c_val[0] = RATE_AUTO; */
c_val[0] = RATE_AUTO;
-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = G_MIXED_11B_2_MODE;
-   if (!wilc_wlan_cfg_set(0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = 1;
-   if (!wilc_wlan_cfg_set(0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = G_SHORT_PREAMBLE;
-   if (!wilc_wlan_cfg_set(0, WID_PREAMBLE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_PREAMBLE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = AUTO_PROT;
-   if (!wilc_wlan_cfg_set(0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = ACTIVE_SCAN;
-   if (!wilc_wlan_cfg_set(0, WID_SCAN_TYPE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_SCAN_TYPE, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = SITE_SURVEY_OFF;
-   if (!wilc_wlan_cfg_set(0, WID_SITE_SURVEY, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_SITE_SURVEY, c_val, 1, 0, 0))
goto _fail_;
 
*((int *)c_val) = 0x; /* Never use RTS-CTS */
-   if (!wilc_wlan_cfg_set(0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
 
*((int *)c_val) = 2346;
-   if (!wilc_wlan_cfg_set(0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0))
goto _fail_;
 
/*  SSID
 */
@@ -719,23 +719,23 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
/*  to enable Broadcast SSID suppport ) 
 */
/*  --  
 */
c_val[0] = 0;
-   if (!wilc_wlan_cfg_set(0, WID_BCAST_SSID, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, WID_BCAST_SSID, c_val, 1, 0, 0))
goto _fail_;
 
c_val[0] = 1;
-   if (!wilc_wlan_cfg_set(0, WID_QOS_ENABLE, c_val, 1, 0, 0))
+   if (!wilc_wlan_cfg_set(dev, 0, 

[PATCH V2 05/17] staging: wilc1000: wilc_wlan_cfg_commit: add argument struct net_device

2015-10-30 Thread Glen Lee
Add argument struct net_device and pass dev to the functions as well.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index a72fa8c..75b0616 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1732,7 +1732,8 @@ void wilc_wlan_cleanup(struct net_device *dev)
 
 }
 
-static int wilc_wlan_cfg_commit(int type, u32 drvHandler)
+static int wilc_wlan_cfg_commit(struct net_device *dev,
+   int type, u32 drvHandler)
 {
wilc_wlan_dev_t *p = _wlan;
wilc_cfg_frame_t *cfg = >cfg_frame;
@@ -1796,7 +1797,7 @@ int wilc_wlan_cfg_set(struct net_device *dev, int start, 
u32 wid, u8 *buffer,
PRINT_D(RX_DBG, "Processing cfg_set()\n");
p->cfg_frame_in_use = 1;
 
-   if (wilc_wlan_cfg_commit(WILC_CFG_SET, drvHandler))
+   if (wilc_wlan_cfg_commit(dev, WILC_CFG_SET, drvHandler))
ret_size = 0;
 
if (linux_wlan_lock_timeout(>cfg_event,
@@ -1837,7 +1838,7 @@ int wilc_wlan_cfg_get(struct net_device *dev, int start, 
u32 wid, int commit,
if (commit) {
p->cfg_frame_in_use = 1;
 
-   if (wilc_wlan_cfg_commit(WILC_CFG_QUERY, drvHandler))
+   if (wilc_wlan_cfg_commit(dev, WILC_CFG_QUERY, drvHandler))
ret_size = 0;
 
 
-- 
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: mwifiex problem: incompatible network settings

2015-10-30 Thread Amitkumar Karwar
> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
> ow...@vger.kernel.org] On Behalf Of Ujjal Roy
> Sent: Thursday, October 29, 2015 7:59 PM
> To: Amitkumar Karwar
> Cc: Julien Cubizolles; Dan Williams; linux-wireless@vger.kernel.org;
> Nishant Sarmukadam
> Subject: Re: mwifiex problem: incompatible network settings
> 
> Hi Amit/Julien,
> 
> On Thu, Oct 29, 2015 at 5:57 PM, Amitkumar Karwar 
> wrote:
> >
> > Hi Julien,
> >
> > > From: Julien Cubizolles [mailto:j.cubizol...@free.fr]
> > > Sent: Thursday, October 29, 2015 3:09 AM
> > > To: Dan Williams
> > > Cc: Amitkumar Karwar; linux-wireless@vger.kernel.org
> > > Subject: Re: mwifiex problem: incompatible network settings
> > >
> > > Dan Williams  writes:
> > >
> > > > He actually meant the wpa_supplicant configuration file, not the
> > > > supplicant's dbus config file.  But when driven by NetworkManager,
> > > > there is no supplicant configuration file.
> > >
> > > Sorry about that.
> > >
> > > > Instead, you can find out what config NM is pushing to the
> > > > supplicant by checking the NetworkManager logs, where NM will log
> lines like:
> > >
> > > Here are the relevant entries from the syslog file:
> > >
> > > I included the failed attempt to connect to the WPA protected
> > > network named "southcentral" and the successful one to a non
> > > protected one named "FreeWifi".
> > >
> >
> > Thanks for the logs. I compared your network manager log with the one
> on my setup. Both are same. Basically network manager log doesn't show
> security info (WPA/WPA2, encryption mode etc). So we can't rely on that.
> > I checked your kernel log shared in previous email. It's incomplete.
> It didn't include information when connection was actually attempted.
> Probably you can run "dmesg -c >> dmesg.log" in loop with some delay to
> capture complete info. Otherwise sharing "/var/log/messages" is also an
> option.
> > I have created a driver debug patch(attached). Could you please apply
> it and share complete dmesg log?
> >
> > Btw, do you see the problem if AP is configured in WPA2 security mode?
> >
> 
> You could check it by disabling the NetworkManager and connect using
> wpa_supplicant manually. Sometimes NetworkManager does some problem
> which is solved by disabling the NetworkManager.
> 

Makes sense. This will narrow down the issue further.
Julien, let me know if any help is needed for this.

Regards,
Amitkumar


Re: [PATCH 1/2] mac80211: add support to set_coalesce

2015-10-30 Thread Johannes Berg

> +++ b/net/mac80211/driver-ops.h
> @@ -1355,4 +1355,16 @@ static inline void drv_wake_tx_queue(struct 
> ieee80211_local *local,
>   local->ops->wake_tx_queue(>hw, >txq);
>  }
>  
> +static inline int drv_set_coalesce(struct ieee80211_local *local,
> +struct cfg80211_coalesce 
> *coalesce)
> +{
> + u32 ret = 0;
> 
This doesn't seem right - now you're accepting any call even if it's
not really done by the driver?

johannes

--
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/2] ath9k: implement set_coalesce callback

2015-10-30 Thread Johannes Berg
On Sat, 2015-10-24 at 11:50 -0700, Olav Haugan wrote:
> implement set_coalesce ieee80211_ops callback. Add default
> wiphy_coalesce_support rules for 9k. These rules are not being used 
> by 9k since 9k can just toggle coalesce as on/off.
> 
This seems extremely strange to me - like you're trying to abuse
set_coalesce, intended for coalescing certain classes of low-importance
packets, for a completely different purpose (interrupt coalescing)?

johannes
--
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: Undocumented Sleep Requirements for ieee80211_ops

2015-10-30 Thread Krishna Chaitanya
On Fri, Oct 30, 2015 at 3:07 PM, Johannes Berg
 wrote:
> On Thu, 2015-10-29 at 12:16 +0530, Krishna Chaitanya wrote:
>> Hi,
>>
>> From the documentation:(mac80211.h) For the ieee80211_ops
>> (un)assign_vif_chanctx, there is no mention of explicit sleep
>> requirements (allowed/disallwoed) for the callback.
>
> Same goes for drv_switch_vif_chanctx().
Yes.
>
>> From a quick glance at the code calling the OP, looks like we can
>> sleep (mutexes are used). So how should we handle such OPS? is it ok
>> to sleep in the callback?
>>
>
> You can sleep, and I'd appreciate if you sent a patch to add
> might_sleep() to the code and the appropriate documentation.
Sure, will send a patch.
--
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: pull-request: wireless-drivers-next 2015-10-29

2015-10-30 Thread David Miller
From: Kalle Valo 
Date: Thu, 29 Oct 2015 21:58:06 +0200

> here's hopefully my last pull request for 4.4. ssb had a new Kconfig
> entry and that's why this touches arch/mips/bcm47xx/Kconfig. ssb also
> did some code shuffling and moved code from b43 to ssb subsystem.
> Otherwise should be business as usual.
> 
> While writing this I noticed that Fengwei Yin had a problem with the
> From field and that's why you see "yfw" in the stats below. I considered
> that this isn't a big enough problem to justify rebasing my tree, but
> let me know if you think otherwise.
> 
> Please let me know if there are any problems.

Pulled, 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 v3 0/1] rtl8xxxu (mac80211) driver for rtl8188[cr]u/rtl8192cu/rtl8723au

2015-10-30 Thread Kalle Valo
Johannes Stezenbach  writes:

> Hi Jes and Larry,
>
> On Wed, Oct 14, 2015 at 08:44:50PM -0400, jes.soren...@redhat.com wrote:
>> Per default only devices I have actually tested will be enabled. If
>> you are interested in trying it out with other 8188cu/8188ru/819[12]cu
>> dongles, you need to enable CONFIG_RTL8XXXU_UNTESTED. Please report
>> test results back to me.
>
> I have one 
> 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter 
> [Realtek RTL8188CUS]
>
> The rtlwifi/rtl8192cu driver turned out to be flaky for this device,
> usually it stalls after a few minutes.  Searching the web it seems
> this is well known and everyone uses a patched vendor driver
> (https://github.com/pvaret/rtl8192cu-fixes.git).
>
> The rtl8xxxu driver ssems to work stable (I tested
> the git branch rtl8xxxu-nextgen, commit 2e23469d74d7).
> However, thoughput is less than one half compared
> to the vendor driver.  FWIW, rtlwifi seems to be a bit
> faster when it works, but thoughput fluctuates a lot
> and eventually it stalls.  (Tested with iperf TCP in both
> directions.)
>
> From dmesg:
> [21725.096068] usb 1-2.1: RTL8188CU rev A (TSMC) 1T1R, TX queues 2, WiFi=1, 
> BT=0, GPS=0, HI PA=0
> [21725.096072] usb 1-2.1: rtl8xxxu: Loading firmware 
> rtlwifi/rtl8192cufw_TMSC.bin
> [21725.096179] usb 1-2.1: Firmware revision 80.0 (signature 0x88c1)

Thank you, these kind of reports are valuable. Please keep them coming.

-- 
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 1/2] cfg80211: Add support for aborting an ongoing scan

2015-10-30 Thread Sunil Dutt
From: Vidyullatha Kanchanapally 

Implement new functionality for aborting an ongoing scan.

Add NL80211_CMD_ABORT_SCAN to the nl80211 interface. After
aborting the scan, driver shall provide the scan status by
calling cfg80211_scan_done().

Reviewed-by: Jouni Malinen 
Signed-off-by: Vidyullatha Kanchanapally 
Signed-off-by: Sunil Dutt 
---
v2: Change return value of abort_scan to void

 include/net/cfg80211.h   |  4 
 include/uapi/linux/nl80211.h |  6 ++
 net/wireless/nl80211.c   | 26 ++
 net/wireless/rdev-ops.h  |  9 +
 net/wireless/trace.h |  5 +
 5 files changed, 50 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 48155be..6cb2e25 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2488,6 +2488,9 @@ 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.
+ *
+ * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
+ * indicate the status of the scan through cfg80211_scan_done().
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2752,6 +2755,7 @@ struct cfg80211_ops {
void(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
  struct net_device *dev,
  const u8 *addr);
+   void (*abort_scan)(struct wiphy *wiphy, struct net_device *dev);
 };
 
 /*
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1f0b4cf..7c8645f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -820,6 +820,10 @@
  * as an event to indicate changes for devices with wiphy-specific regdom
  * management.
  *
+ * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
+ * not running. The driver indicates the status of the scan through
+ * cfg80211_scan_done().
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1006,6 +1010,8 @@ enum nl80211_commands {
 
NL80211_CMD_WIPHY_REG_CHANGE,
 
+   NL80211_CMD_ABORT_SCAN,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index d693c9d..6a7b4cf 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10588,6 +10588,24 @@ static int nl80211_tdls_cancel_channel_switch(struct 
sk_buff *skb,
return 0;
 }
 
+static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info)
+{
+   struct cfg80211_registered_device *rdev = info->user_ptr[0];
+   struct net_device *dev = info->user_ptr[1];
+
+   if (!rdev->ops->abort_scan)
+   return -EOPNOTSUPP;
+
+   if (rdev->scan_msg)
+   return 0;
+
+   if (!rdev->scan_req)
+   return -ENOENT;
+
+   rdev_abort_scan(rdev, dev);
+   return 0;
+}
+
 #define NL80211_FLAG_NEED_WIPHY0x01
 #define NL80211_FLAG_NEED_NETDEV   0x02
 #define NL80211_FLAG_NEED_RTNL 0x04
@@ -11406,6 +11424,14 @@ static const struct genl_ops nl80211_ops[] = {
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
  NL80211_FLAG_NEED_RTNL,
},
+   {
+   .cmd = NL80211_CMD_ABORT_SCAN,
+   .doit = nl80211_abort_scan,
+   .policy = nl80211_policy,
+   .flags = GENL_ADMIN_PERM,
+   .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+ NL80211_FLAG_NEED_RTNL,
+   },
 };
 
 /* notification functions */
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index c23516d..05edf43 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1020,4 +1020,13 @@ rdev_tdls_cancel_channel_switch(struct 
cfg80211_registered_device *rdev,
trace_rdev_return_void(>wiphy);
 }
 
+static inline void
+rdev_abort_scan(struct cfg80211_registered_device *rdev,
+   struct net_device *dev)
+{
+   trace_rdev_abort_scan(>wiphy, dev);
+   rdev->ops->abort_scan(>wiphy, dev);
+   trace_rdev_return_void(>wiphy);
+}
+
 #endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 0c392d3..ceb20eb 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2818,6 +2818,11 @@ TRACE_EVENT(cfg80211_stop_iface,
  WIPHY_PR_ARG, WDEV_PR_ARG)
 );
 
+DEFINE_EVENT(wiphy_netdev_evt, rdev_abort_scan,
+   TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
+   TP_ARGS(wiphy, netdev)
+);
+
 #endif /* !__RDEV_OPS_TRACE || 

[PATCH v2 2/2] mac80211: Add support for aborting an ongoing scan

2015-10-30 Thread Sunil Dutt
From: Vidyullatha Kanchanapally 

This commit adds implementation for abort scan in mac80211.

Reviewed-by: Jouni Malinen 
Signed-off-by: Vidyullatha Kanchanapally 
Signed-off-by: Sunil Dutt 
---
v2: Change return value of ieee80211_abort_scan to void

 net/mac80211/cfg.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 713cdbf..4eda313 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3797,6 +3797,15 @@ static int ieee80211_del_tx_ts(struct wiphy *wiphy, 
struct net_device *dev,
return -ENOENT;
 }
 
+static void ieee80211_abort_scan(struct wiphy *wiphy, struct net_device *dev)
+{
+   struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+   struct ieee80211_local *local = sdata->local;
+
+   /* Cancel the ongoing scan */
+   ieee80211_scan_cancel(local);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3881,4 +3890,5 @@ 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,
+   .abort_scan = ieee80211_abort_scan,
 };
-- 
1.8.2.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 V4] ath10k: Debugfs entry to enable/disable WLAN Coexist feature

2015-10-30 Thread Kalle Valo
Yanbo Li  writes:

> As some radio have no connection with BT modules, enable the WLAN/Bluetooth
> coexist(BTC) feature will has some side effect if the radio's GPIO connect
> with any other HW modules. Add the control switcher "btc_feature" at
> debugfs and set the feature as disable by default to avoid such case.
>
> The FW support this feature since 10.2.4.54 on 2G-only board, dual band
> or 5G boards don't support the feature
>
> To enable this feature, execute:
> echo 1 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
> To disable:
> echo 0 > /sys/kernel/debug/ieee80211/phyX/ath10k/btc_feature
>
> Signed-off-by: Yanbo Li 

You missed some of my comments from v1, especially about the file name.
Let me send v5.

https://patchwork.kernel.org/patch/6313091/

> +static ssize_t ath10k_write_btc_feature(struct file *file,
> + const char __user *ubuf,
> + size_t count, loff_t *ppos)
> +{
> + struct ath10k *ar = file->private_data;
> + char buf[32];
> + size_t buf_size;
> + bool val;
> + int ret;
> +
> + buf_size = min(count, (sizeof(buf) - 1));
> + if (copy_from_user(buf, ubuf, buf_size))
> + return -EFAULT;
> +
> + buf[buf_size] = '\0';
> + if (strtobool(buf, ) != 0) {
> + ath10k_warn(ar, "Wrong BTcoex feature setting\n");
> + return -EINVAL;
> + }
> +
> + mutex_lock(>conf_mutex);
> +
> + if (ar->state != ATH10K_STATE_ON) {
> + ret = -ENETDOWN;
> + goto err_unlock;
> + }
> +
> + if (val != test_bit(ATH10K_FLAG_BTCOEX_ENABLE, >dev_flags)) {
> + if (val)
> + set_bit(ATH10K_FLAG_BTCOEX_ENABLE, >dev_flags);
> + else
> + clear_bit(ATH10K_FLAG_BTCOEX_ENABLE, >dev_flags);
> + queue_work(ar->workqueue, >restart_work);
> + }

I don't think this is a good idea, now you cannot change the value while
interface is down. I think it would be more user friendly to allow
changing the value but obviously not reboot the firmware as it's not
running.

-- 
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


ath6kl reverting to US region after starting AP mode

2015-10-30 Thread Robert Deliën
Dear Experts,

I am experiencing a problem with an ath6kl wireless NIC on a Digi connectcard 
wi-i.mx28. After the Kernel driver is loaded, cfg80211 is calling CRDA to 
update world regulatory domain. Immediately after that, it calls again for 
country US. I'm not sure why, but I can live with that.

A little later, my startup script sets the CRDA world regulatory domain to NL 
and this is accepted. Again a little later hostapd is started, properly 
configured for region NL, but while AP mode is enabled, the world regulatory 
domain reverts back the US again. After that I can put it back to NL again, but 
that doesn't seem appropriate because that's too late to use specific NL 
channels for my AP.

For some time I have though that it was following other APs in the building, 
broadcasting regulatory domain US, but that doesn't seem to be the case. I have 
tried a number of different ath6kl firmware versions, but the problem remains. 
So I have traced the source code a little and it seems like the firmware is 
sending a WMI_REGDOMAIN_EVENTID with US to the driver. Is that how it works?

Is there any way to avoid this switching?

Thanks a lot in advance for any information on this!

Robert.--
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


Intel 7260 - limited in 5GHz spectrum

2015-10-30 Thread Pushpal Sidhu
Hi,

I've been working with the Intel 7260 card which advertises itself as
dual band wireless AC card. However, I cannot get it working in AP
mode in the 5GHz range. An $(iw list) shows that the entire 5GHz band
has 'no IR' next to it so as not to allow device radiation (please see
pastebin here: http://pastebin.com/T4BWnBmn).

After searching around the internet a bit, it seems that the card
doesn't allow for this mode (And is thus not really dual band?). I'd
like to know if this is a firmware limitation and if there's a fix in
place, or if not, why is this card limited to the spectrum it can
radiate at?

Thanks,
- Pushpal
--
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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-30 Thread Jes Sorensen
Larry Finger  writes:
> On 10/23/2015 03:31 PM, Jes Sorensen wrote:
>> Bruno Randolf  writes:
>>> On 10/22/2015 02:42 PM, Jes Sorensen wrote:
 Making things work against random kernel versions of OpenWRT is not
 particularly "credible". If the driver needs hacks to work with older
 kernels, then they should be applied for the older kernels. Linux does
 not have a history of carrying hacks in current drivers to accommodate
 older kernels.
>>>
>>> Well forget OpenWRT. The point is that this is not a hack - it's the
>>> behavior that mac80211 expects and documents and moreover it does NOT
>>> pass more data frames than before.
>>>
>>> It does not pass more data frames before association because the RCR
>>> RCR_ACCEPT_AP bit is not set and the RCR_CHECK_BSSID_* bits are set.
>>
>> I have gone back and looked more at the vendor drivers over this issue.
>> Most versions of the vendor driver consistently mess with both FLTMAP*
>> and RCR, and disable packets when they go into a non-assoc state, but
>> non-assoc to the vendor driver also means non-AP, non-monitor, etc.
>>
>> I really would like to know more about the difference between RCR and
>> FLTMAP registers - Larry is there a chance you could try and ping your
>> Realtek contacts about this?
>
> I will try, but please be aware that the USB group generally tends to
> ignore me. Perhaps the PCI group can help.

Larry,

Much appreciated - I believe the FLTMAP* and RCR registers are the same
on the PCI and USB chips, so any answer should be useful.

Cheers,
Jes
--
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] mac80211: Handle sleep requirements for channel context ops.

2015-10-30 Thread Chaitanya T K
From: Chaitanya T K 

Channel context OPs can sleep, so add might_sleep() and
also document sleep requirements for those OPs.

Signed-off-by: Chaitanya T K 
---
 include/net/mac80211.h|  6 ++
 net/mac80211/driver-ops.c |  2 ++
 net/mac80211/driver-ops.h | 10 ++
 3 files changed, 18 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4b9dd07..3876739 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3170,18 +3170,24 @@ enum ieee80211_reconfig_type {
  * The callback is optional and can sleep.
  *
  * @add_chanctx: Notifies device driver about new channel context creation.
+ * This callback may sleep.
  * @remove_chanctx: Notifies device driver about channel context destruction.
+ * This callback may sleep.
  * @change_chanctx: Notifies device driver about channel context changes that
  * may happen when combining different virtual interfaces on the same
  * channel context with different settings
+ * This callback may sleep.
  * @assign_vif_chanctx: Notifies device driver about channel context being 
bound
  * to vif. Possible use is for hw queue remapping.
+ * This callback may sleep.
  * @unassign_vif_chanctx: Notifies device driver about channel context being
  * unbound from vif.
+ * This callback may sleep.
  * @switch_vif_chanctx: switch a number of vifs from one chanctx to
  * another, as specified in the list of
  * @ieee80211_vif_chanctx_switch passed to the driver, according
  * to the mode defined in _chanctx_switch_mode.
+ * This callback may sleep.
  *
  * @start_ap: Start operation on the AP interface, this is called after all the
  * information in bss_conf is set and beacon can be retrieved. A channel
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index a1d5431..578403a 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -192,6 +192,8 @@ int drv_switch_vif_chanctx(struct ieee80211_local *local,
int ret = 0;
int i;
 
+   might_sleep();
+
if (!local->ops->switch_vif_chanctx)
return -EOPNOTSUPP;
 
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 3098709..5869bc6 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -871,6 +871,8 @@ static inline int drv_add_chanctx(struct ieee80211_local 
*local,
 {
int ret = -EOPNOTSUPP;
 
+   might_sleep();
+
trace_drv_add_chanctx(local, ctx);
if (local->ops->add_chanctx)
ret = local->ops->add_chanctx(>hw, >conf);
@@ -884,6 +886,8 @@ static inline int drv_add_chanctx(struct ieee80211_local 
*local,
 static inline void drv_remove_chanctx(struct ieee80211_local *local,
  struct ieee80211_chanctx *ctx)
 {
+   might_sleep();
+
if (WARN_ON(!ctx->driver_present))
return;
 
@@ -898,6 +902,8 @@ static inline void drv_change_chanctx(struct 
ieee80211_local *local,
  struct ieee80211_chanctx *ctx,
  u32 changed)
 {
+   might_sleep();
+
trace_drv_change_chanctx(local, ctx, changed);
if (local->ops->change_chanctx) {
WARN_ON_ONCE(!ctx->driver_present);
@@ -912,6 +918,8 @@ static inline int drv_assign_vif_chanctx(struct 
ieee80211_local *local,
 {
int ret = 0;
 
+   might_sleep();
+
if (!check_sdata_in_driver(sdata))
return -EIO;
 
@@ -931,6 +939,8 @@ static inline void drv_unassign_vif_chanctx(struct 
ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_chanctx *ctx)
 {
+   might_sleep();
+
if (!check_sdata_in_driver(sdata))
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 v2] ath10k: Add support for pktlog in QCA99X0

2015-10-30 Thread Vivek Natarajan
This patch adds pktlog support for 10.4 fw versions.

Signed-off-by: Vivek Natarajan 
---
v2: Move pktlog_completion_handler to htt_rx.c

 drivers/net/wireless/ath/ath10k/htt.h|  2 ++
 drivers/net/wireless/ath/ath10k/htt_rx.c | 12 
 drivers/net/wireless/ath/ath10k/hw.h | 10 ++
 drivers/net/wireless/ath/ath10k/pci.c| 11 +++
 4 files changed, 35 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 2bad50e..74ccfb29 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1598,5 +1598,7 @@ int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, 
struct sk_buff *skb);
 void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
 int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *);
 int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *);
+void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
+struct sk_buff *skb);
 
 #endif
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c 
b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6060dda..d1dc1ba 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2127,6 +2127,18 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, 
struct sk_buff *skb)
 }
 EXPORT_SYMBOL(ath10k_htt_t2h_msg_handler);
 
+void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
+struct sk_buff *skb)
+{
+   struct ath10k_pktlog_10_4_hdr *hdr =
+   (struct ath10k_pktlog_10_4_hdr *)skb->data;
+
+   trace_ath10k_htt_pktlog(ar, hdr->payload,
+   sizeof(*hdr) + __le16_to_cpu(hdr->size));
+   dev_kfree_skb_any(skb);
+}
+EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler);
+
 static void ath10k_htt_txrx_compl_task(unsigned long ptr)
 {
struct ath10k_htt *htt = (struct ath10k_htt *)ptr;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h 
b/drivers/net/wireless/ath/ath10k/hw.h
index 2d87737..2fd5dc1 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -261,6 +261,16 @@ struct ath10k_pktlog_hdr {
u8 payload[0];
 } __packed;
 
+struct ath10k_pktlog_10_4_hdr {
+   __le16 flags;
+   __le16 missed_cnt;
+   __le16 log_type;
+   __le16 size;
+   __le32 timestamp;
+   __le32 type_specific_data;
+   u8 payload[0];
+} __packed;
+
 enum ath10k_hw_rate_ofdm {
ATH10K_HW_RATE_OFDM_48M = 0,
ATH10K_HW_RATE_OFDM_24M,
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 5c05b0c..5fed194 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -108,6 +108,7 @@ static void ath10k_pci_htc_tx_cb(struct ath10k_ce_pipe 
*ce_state);
 static void ath10k_pci_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
 static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state);
 static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state);
+static void ath10k_pci_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
 
 static const struct ce_attr host_ce_config_wlan[] = {
/* CE0: host->target HTC control and raw streams */
@@ -186,6 +187,7 @@ static const struct ce_attr host_ce_config_wlan[] = {
.src_nentries = 0,
.src_sz_max = 2048,
.dest_nentries = 128,
+   .recv_cb = ath10k_pci_pktlog_rx_cb,
},
 
/* CE9 target autonomous qcache memcpy */
@@ -1230,6 +1232,15 @@ static void ath10k_pci_htc_rx_cb(struct ath10k_ce_pipe 
*ce_state)
ath10k_pci_process_rx_cb(ce_state, ath10k_htc_rx_completion_handler);
 }
 
+/* Called by lower (CE) layer when data is received from the Target.
+ * Only 10.4 firmware uses separate CE to transfer pktlog data.
+ */
+static void ath10k_pci_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state)
+{
+   ath10k_pci_process_rx_cb(ce_state,
+ath10k_htt_rx_pktlog_completion_handler);
+}
+
 /* Called by lower (CE) layer when a send to HTT Target completes. */
 static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state)
 {
-- 
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: Undocumented Sleep Requirements for ieee80211_ops

2015-10-30 Thread Johannes Berg
On Thu, 2015-10-29 at 12:16 +0530, Krishna Chaitanya wrote:
> Hi,
> 
> From the documentation:(mac80211.h) For the ieee80211_ops
> (un)assign_vif_chanctx, there is no mention of explicit sleep
> requirements (allowed/disallwoed) for the callback.

Same goes for drv_switch_vif_chanctx().

> From a quick glance at the code calling the OP, looks like we can
> sleep (mutexes are used). So how should we handle such OPS? is it ok
> to sleep in the callback?
> 

You can sleep, and I'd appreciate if you sent a patch to add
might_sleep() to the code and the appropriate documentation.

johannes
--
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/2] mac80211: Add support for aborting an ongoing scan

2015-10-30 Thread Johannes Berg
On Thu, 2015-10-29 at 13:16 +0530, Sunil Dutt wrote:
> From: Vidyullatha Kanchanapally 
> 
> This commit adds implementation for abort scan in mac80211.
> 
> Reviewed-by: Jouni Malinen 
> Signed-off-by: Vidyullatha Kanchanapally 
> Signed-off-by: Sunil Dutt 
> ---
>  net/mac80211/cfg.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 713cdbf..d4d78e1 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -3797,6 +3797,16 @@ static int ieee80211_del_tx_ts(struct wiphy 
> *wiphy, struct net_device *dev,
>   return -ENOENT;
>  }
>  
> +static int ieee80211_abort_scan(struct wiphy *wiphy, struct 
> net_device *dev)
> +{
> + struct ieee80211_sub_if_data *sdata = 
> IEEE80211_DEV_TO_SUB_IF(dev);
> + struct ieee80211_local *local = sdata->local;
> +
> + /* Cancel the ongoing scan */
> + ieee80211_scan_cancel(local);
> + return 0;
> +}

You're not returning -ENOENT when there's no scan, which could be racy?
I'm not sure those races would be relevant, but you should think about
that and document it.

johannes
--
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/2] cfg80211: Add support for aborting an ongoing scan

2015-10-30 Thread Johannes Berg
On Fri, 2015-10-30 at 12:37 +0200, Jouni Malinen wrote:
> 
> The currently identified use cases do not seem to care much about the
> actual result of this command since there is going to be a wait for 
> the
> scan completed event anyway and the call is not even used unless 
> there
> is a known ongoing scan. As such, even the difference of a driver
> supporting this command or not is not that significant taken into
> account this is used only as an optimization to speed up the 
> following
> operation when a long scan operation was in progress. Things work 
> fine
> (though without that speed benefit) even if the driver does not
> support this. Anyway, making cfg80211 advertise whether the new 
> command
> is available could obviously be done should someone come up with a 
> use
> case that depends on knowing that the optimization is available.
> 

Fair point. In that case though, making the driver operation void would
make sense.

johannes
--
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