Re: [PATCH] ath10k: add missing mutex unlock on failpath

2015-08-19 Thread Michal Kazior
On 19 August 2015 at 13:23, Kalle Valo kv...@qca.qualcomm.com wrote:
 Michal Kazior michal.kaz...@tieto.com writes:

 Kernel would complain about leaving a held lock
 after going back to userspace and would
 subsequently deadlock.

 Fixes: e04cafbc38c7 (ath10k: fix peer limit enforcement)
 Reported-by: Dan Carpenter dan.carpen...@oracle.com
 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

 commit e04cafbc38c7 is currently going to 4.3-rc1 (it's in
 wireless-drivers-next currently). I think we should send this to 4.3 as
 well, right?

It does make sense to do so, yes.


Michał
--
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] staging: wilc1000: Set all options in region debugfs file

2015-08-19 Thread Chandra Gorentla
On Tue, Aug 18, 2015 at 08:01:00PM -0700, Greg KH wrote:
 On Tue, Aug 18, 2015 at 10:32:17PM +0530, Chandra S Gorentla wrote:
  This patch allows setting all options in the module's debug region
  options file 'wilc_debug_region'.  This functionality allows the user
  to enable logging from all regions (initialization, locks, firmware
  etc.) of the driver.  Logging from the following regions is enabled
  during the driver initialization:
  
  INIT_DBG, GENERIC_DBG, CFG80211_DBG, FIRM_DBG and HOSTAPD_DBG
  
  Before this change, the numerical value set is equal first byte of 
  input minus 0x30 (ASCII value of '0').  Because of this, after a write 
  to this debugfs file, it is difficult to predict the regions on which
  logging is enabled.
  
  The DBG_REGION_ALL now includes 3 additional regions TCP_ENH, SPIN_DEBUG
  and FIRM_DBG.
 
 Why did you add these extra ones?
I added them because there is code support them and to avoid a holes in
the range of the options.
 
 All of this should eventually just be deleted, as network drivers need
 to use the networking driver debug interfaces, not their own crazy ones.
In that case, can I assume that we are not going forward with this change?
 
 thanks,
 
 greg k-h

Thank you,
chandra
--
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 v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Emmanuel Grumbach
This allows to release the backpressure on the socket only
when the last segment is released.
Now the truesize looks like this:
if the truesize of the original skb is 65420, all the
segments will have a truesize of 704 (skb itself) and the
last one will have 65420.

Change-Id: I3c894cf2afc0aedfe7b2a5b992ba41653ff79c0e
Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 5046833..046e50d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -764,7 +764,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
sk_buff *skb_gso,
bool ipv6 = skb_shinfo(skb_gso)-gso_type  SKB_GSO_TCPV6;
struct iwl_lso_splitter s = {};
struct page *hdr_page;
-   unsigned int mpdu_sz;
+   unsigned int mpdu_sz, sum_truesize = 0;
u8 *hdr_page_pos, *qc, tid;
int i, ret;
 
@@ -898,6 +898,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
sk_buff *skb_gso,
mpdu_sz, tcp_hdrlen(skb_gso));
 
__skb_queue_tail(mpdus_skb, skb_gso);
+   sum_truesize += skb_gso-truesize;
 
/* mss bytes have been consumed from the data */
s.gso_payload_pos = s.mss;
@@ -1034,6 +1035,20 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
sk_buff *skb_gso,
}
 
__skb_queue_tail(mpdus_skb, skb);
+   sum_truesize += skb-truesize;
+   }
+
+   /* Release the backpressure on the socket only when
+* the last segment is released.
+*/
+   if (skb_gso-destructor == sock_wfree) {
+   struct sk_buff *tail = mpdus_skb-prev;
+
+   swap(tail-truesize, skb_gso-truesize);
+   swap(tail-destructor, skb_gso-destructor);
+   swap(tail-sk, skb_gso-sk);
+atomic_add(sum_truesize - skb_gso-truesize,
+   skb_gso-sk-sk_wmem_alloc);
}
 
ret = 0;
-- 
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


[PATCH] rtlwifi: rtl8192cu: Add new device ID

2015-08-19 Thread Adrien Schildknecht
The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht adrien+...@schischi.me
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23806c2..8b4238a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+   {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NetGear 
WNA1000Mv2*/
{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CCC*/
{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
-- 
2.5.0

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

2015-08-19 Thread Kalle Valo
Kalle Valo kv...@codeaurora.org writes:

 here's one more pull request for 4.3. More info in the signed tag below.

 This time I had to merge mac80211-next.git due to some iwlwifi
 dependencies and apparently that broke git-request-pull's diffstat
 again, it was showing changes which were not really coming from my tree.
 I think that's just a bug in my old git and really should update the
 tool. This time I just fixed the diffstat manually.

 But please be extra careful with this pull request and please let me
 know if you have any problems.

Oh, I forgot to mention that I saw this build error when I did a test
merge:

net/ipv4/fib_semantics.c:553:3: error: implicit declaration of function 
lwtstate_free [-Werror=implicit-function-declaration]

But I see that also with unmodified net-next so I'm assuming I didn't
cause that :)

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


Re: [PATCH] rtlwifi: rtl8192cu: Add new device ID

2015-08-19 Thread Larry Finger

On 08/19/2015 08:51 AM, Adrien Schildknecht wrote:

The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht adrien+...@schischi.me
---


Has this ID been tested with the Netgear device?

Larry


  drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23806c2..8b4238a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+   {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NetGear 
WNA1000Mv2*/
{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CCC*/
{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/



--
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] ath10k: fix dma_mapping_error() handling

2015-08-19 Thread Michal Kazior
The function returns 1 when DMA mapping fails. The
driver would return bogus values and could
possibly confuse itself if DMA failed.

Fixes: 767d34fc67af (ath10k: remove DMA mapping wrappers)
Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/htc.c| 4 +++-
 drivers/net/wireless/ath/ath10k/htt_tx.c | 8 ++--
 drivers/net/wireless/ath/ath10k/pci.c| 8 ++--
 drivers/net/wireless/ath/ath10k/wmi.c| 1 +
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 85bfa2acb801..32d9ff1b19dc 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -145,8 +145,10 @@ int ath10k_htc_send(struct ath10k_htc *htc,
skb_cb-eid = eid;
skb_cb-paddr = dma_map_single(dev, skb-data, skb-len, DMA_TO_DEVICE);
ret = dma_mapping_error(dev, skb_cb-paddr);
-   if (ret)
+   if (ret) {
+   ret = -EIO;
goto err_credits;
+   }
 
sg_item.transfer_id = ep-eid;
sg_item.transfer_context = skb;
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index 704bb5e07193..43aa5e2d1b87 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -442,8 +442,10 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct 
sk_buff *msdu)
skb_cb-paddr = dma_map_single(dev, msdu-data, msdu-len,
   DMA_TO_DEVICE);
res = dma_mapping_error(dev, skb_cb-paddr);
-   if (res)
+   if (res) {
+   res = -EIO;
goto err_free_txdesc;
+   }
 
skb_put(txdesc, len);
cmd = (struct htt_cmd *)txdesc-data;
@@ -533,8 +535,10 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff 
*msdu)
skb_cb-paddr = dma_map_single(dev, msdu-data, msdu-len,
   DMA_TO_DEVICE);
res = dma_mapping_error(dev, skb_cb-paddr);
-   if (res)
+   if (res) {
+   res = -EIO;
goto err_free_txbuf;
+   }
 
switch (skb_cb-txmode) {
case ATH10K_HW_TXRX_RAW:
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index f00b251ec9ce..826220f795c7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1667,8 +1667,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k 
*ar,
 
req_paddr = dma_map_single(ar-dev, treq, req_len, DMA_TO_DEVICE);
ret = dma_mapping_error(ar-dev, req_paddr);
-   if (ret)
+   if (ret) {
+   ret = -EIO;
goto err_dma;
+   }
 
if (resp  resp_len) {
tresp = kzalloc(*resp_len, GFP_KERNEL);
@@ -1680,8 +1682,10 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k 
*ar,
resp_paddr = dma_map_single(ar-dev, tresp, *resp_len,
DMA_FROM_DEVICE);
ret = dma_mapping_error(ar-dev, resp_paddr);
-   if (ret)
+   if (ret) {
+   ret = EIO;
goto err_req;
+   }
 
xfer.wait_for_resp = true;
xfer.resp_len = 0;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 42c0aba04fb2..6ac016dc28f8 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -3238,6 +3238,7 @@ void ath10k_wmi_event_host_swba(struct ath10k *ar, struct 
sk_buff *skb)
ath10k_warn(ar, failed to map beacon: %d\n,
ret);
dev_kfree_skb_any(bcn);
+   ret = -EIO;
goto skip;
}
 
-- 
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: [RFC v2 1/3] iwlwifi: mvm: add real TSO implementation

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 15:59 +0300, Emmanuel Grumbach wrote:
 The segmentation is done completely in software. The
 driver creates several MPDUs out of a single large send.
 Each MPDU is a newly allocated SKB.
 A page is allocated to create the headers that need to be
 duplicated (SNAP / IP / TCP). The WiFi header is in the
 header of the newly created SKBs.
 
 type=feature
 
 Change-Id: I238ffa79cacc5bbdacdfbf3e9673c8d4f02b462a
 Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
 ---
  drivers/net/wireless/iwlwifi/mvm/tx.c | 513 
 +++---
  1 file changed, 481 insertions(+), 32 deletions(-)

Ouch dynamic allocations while doing xmit are certainly not needed.
Your driver should pre-allocated space for headers.

Drivers willing to implement tso have to use net/core/tso.c provided
helpers.

$ git grep -n tso_build_hdr
drivers/net/ethernet/cavium/thunder/nicvf_queues.c:1030:
tso_build_hdr(skb, hdr, tso, data_left, total_len == 0);
drivers/net/ethernet/freescale/fec_main.c:729:  tso_build_hdr(skb, hdr, 
tso, data_left, total_len == 0);
drivers/net/ethernet/marvell/mv643xx_eth.c:842: tso_build_hdr(skb, hdr, 
tso, data_left, total_len == 0);
drivers/net/ethernet/marvell/mvneta.c:1650: tso_build_hdr(skb, hdr, 
tso, data_left, total_len == 0);
include/net/tso.h:15:void tso_build_hdr(struct sk_buff *skb, char *hdr, struct 
tso_t *tso,
net/core/tso.c:14:void tso_build_hdr(struct sk_buff *skb, char *hdr, struct 
tso_t *tso,
net/core/tso.c:37:EXPORT_SYMBOL(tso_build_hdr);


--
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 v2 1/3] iwlwifi: mvm: add real TSO implementation

2015-08-19 Thread Emmanuel Grumbach
The segmentation is done completely in software. The
driver creates several MPDUs out of a single large send.
Each MPDU is a newly allocated SKB.
A page is allocated to create the headers that need to be
duplicated (SNAP / IP / TCP). The WiFi header is in the
header of the newly created SKBs.

type=feature

Change-Id: I238ffa79cacc5bbdacdfbf3e9673c8d4f02b462a
Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 513 +++---
 1 file changed, 481 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 90f0ea1..a63686c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -65,6 +65,7 @@
 #include linux/ieee80211.h
 #include linux/etherdevice.h
 #include net/tcp.h
+#include net/ip.h
 
 #include iwl-trans.h
 #include iwl-eeprom-parse.h
@@ -435,32 +436,471 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
return 0;
 }
 
+/*
+ * Update the IP / TCP headers and recompute the IP header CSUM +
+ * pseudo header CSUM.
+ */
+static void iwl_update_ip_tcph(void *iph, struct tcphdr *tcph, bool ipv6,
+  unsigned int len, unsigned int tcp_seq_offset,
+  u16 num_segment)
+{
+   be32_add_cpu(tcph-seq, tcp_seq_offset);
+
+   if (ipv6) {
+   struct ipv6hdr *iphv6 = iph;
+
+   iphv6-payload_len = cpu_to_be16(len + tcph-doff * 4);
+
+   /* Compute CSUM on the the pseudo-header */
+   tcph-check = ~csum_ipv6_magic(iphv6-saddr, iphv6-daddr,
+  len + tcph-doff * 4,
+  IPPROTO_TCP, 0);
+   } else {
+   struct iphdr *iphv4 = iph;
+
+   iphv4-tot_len =
+   cpu_to_be16(len + tcph-doff * 4 + iphv4-ihl * 4);
+   be16_add_cpu(iphv4-id, num_segment);
+   ip_send_check(iphv4);
+
+   /* Compute CSUM on the the pseudo-header */
+   tcph-check = ~csum_tcpudp_magic(iphv4-saddr, iphv4-daddr,
+len + tcph-doff * 4,
+IPPROTO_TCP, 0);
+   }
+}
+
+/**
+ * struct iwl_lso_splitter - state of the split.
+ * @linear_payload_len: The length of the payload inside the header of the
+ * original GSO skb.
+ * @gso_frag_num: The fragment number from which to take the data in the
+ * original GSO skb.
+ * @gso_payload_len: The length of the payload in the original GSO skb.
+ * @gso_payload_pos: The incrementing position in the payload of the original
+ * GSO skb.
+ * @gso_offset_in_page: The offset in the page of gso_frag_num.
+ * @gso_current_frag_size: The size of gso_frag_num.
+ * @gso_offset_in_frag: The offset in the gso_frag_num.
+ * @frag_in_mpdu: The index of the frag inside the new (split) MPDU.
+ * @mss: The maximal segment size.
+ * @si: Points to the the shared info of the original GSO skb.
+ * @ieee80211_hdr *hdr: Points to the WiFi header.
+ * @gso_nr_frags: The number of frags in the original GSO skb.
+ * @wifi_hdr_iv_len: The length of the WiFi header including IV.
+ * @tcp_fin: True if TCP_FIN is set in the original GSO skb.
+ * @tcp_push: True if TCP_PSH is set in the original GSO skb.
+ */
+struct iwl_lso_splitter {
+   unsigned int linear_payload_len;
+   unsigned int gso_frag_num;
+   unsigned int gso_payload_len;
+   unsigned int gso_payload_pos;
+   unsigned int gso_offset_in_page;
+   unsigned int gso_current_frag_size;
+   unsigned int gso_offset_in_frag;
+   unsigned int frag_in_mpdu;
+   unsigned int mss;
+   struct skb_shared_info *si;
+   struct ieee80211_hdr *hdr;
+   u8 gso_nr_frags;
+   u8 wifi_hdr_iv_len;
+   bool tcp_fin;
+   bool tcp_push;
+};
+
+/*
+ * Adds a TCP segment from skb_gso to skb. All the state is taken from
+ * and fed back to p. This function takes care about the payload only.
+ * This MSDU might already have msdu_sz bytes of payload that come from
+ * the original GSO skb's header.
+ */
+static unsigned int
+iwl_add_tcp_segment(struct iwl_mvm *mvm, struct sk_buff *skb_gso,
+   struct sk_buff *skb, struct iwl_lso_splitter *p,
+   unsigned int msdu_sz)
+{
+   while (msdu_sz  p-mss) {
+   unsigned int frag_sz =
+   min_t(unsigned int, p-gso_current_frag_size,
+ p-mss - msdu_sz);
+
+   if (p-frag_in_mpdu = mvm-trans-max_skb_frags)
+   return msdu_sz;
+
+   skb_add_rx_frag(skb, p-frag_in_mpdu,
+   skb_frag_page(p-si-frags[p-gso_frag_num]),
+   p-gso_offset_in_page, frag_sz, 0);
+
+   /* We just added one frag to the mpdu ... */

[RFC v2 0/3] add TSO / A-MSDU TX for iwlwifi

2015-08-19 Thread Emmanuel Grumbach
We enable TSO to get a lot of data at once to build A-MSDUs.
Our hardware doesn't have (yet) TCP CSUM offload, so we do
it manually. TSO won't be enabled on hardware that don't
support CSUM offload in release code, computing TCP CSUM
in the driver is just a way to start coding the flows.
This is why the CSUM offload implementation in the driver
in so bad in terms of efficiency. I preferred to have the
flows as close as they will be when the hardware will be
able to the CSUM than to try to seek efficiency.
The hardware that will have CSUM offload will still require
the driver to split the skb in software including the
IP / TCP header copy and update etc...

We could have enabled A-MSDU based on xmit-more, but the
rationale of using LSO is that when using pfifo-fast,
the Qdisc gets one packet and dequeues is straight away
which limits the possibility to get a lot of packets at
once. (Am I right here?).

A note about A-MSDUs for non-wireless people:
*
An A-MSDU is a aggregated frame. It is one big 802.11
packet that contains several subframes. Each subframe
is a TCP segment. One A-MSDU is represented by one single
skb which means that we need to copy / duplicate the TCP
/ IP / SNAP headers in one single skb. This is why those
headers are copied to a separate page: that page is added
multiple times to the skb with different offsets. Each
subframes needs at least 2 frags: 1 for the headers, 1 (or
more) for the payload.

I am quite a newbie in skb handling, so I guess that this
code can be improved. I have tested it decently using iperf,
but this doesn't mean that there are no issues using other
applications. We are enabling pktgen on TCP (using patches
that were sent a year ago or so) to test the different
layouts of the skb (payload partition amongst the header
and the different frags).

I'll be very happy to get comments on that code, this is
why I am sending it to netdev as well since the TSO experts
are there :)

Emmanuel Grumbach (3):
  iwlwifi: mvm: add real TSO implementation
  iwlwifi: mvm: allow to create A-MSDUs from a large send
  iwlwifi: mvm: transfer the truesize to the last TSO segment

 drivers/net/wireless/iwlwifi/mvm/mac80211.c |   3 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c  |   4 +-
 drivers/net/wireless/iwlwifi/mvm/sta.h  |   6 +-
 drivers/net/wireless/iwlwifi/mvm/tx.c   | 669 ++--
 4 files changed, 647 insertions(+), 35 deletions(-)

-- 
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 v2 2/3] iwlwifi: mvm: allow to create A-MSDUs from a large send

2015-08-19 Thread Emmanuel Grumbach
Now that we can get a big chunk of data from the network
stack, we can create an A-MSDU out of it. The purpose is to
get a throughput improvement since sending one single A-MSDU
is more efficient than sending several MSDUs at least under
ideal link conditions.

type=feature

Change-Id: I5ea1b1132a57542187cd4c34c5299dbf44fe8b01
Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
 drivers/net/wireless/iwlwifi/mvm/mac80211.c |   3 +-
 drivers/net/wireless/iwlwifi/mvm/sta.c  |   4 +-
 drivers/net/wireless/iwlwifi/mvm/sta.h  |   6 +-
 drivers/net/wireless/iwlwifi/mvm/tx.c   | 159 ++--
 4 files changed, 160 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c 
b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 3dd4e97..dd15e04 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -925,7 +925,8 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
ret = iwl_mvm_sta_tx_agg_flush(mvm, vif, sta, tid);
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
-   ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid, buf_size);
+   ret = iwl_mvm_sta_tx_agg_oper(mvm, vif, sta, tid,
+ buf_size, amsdu);
break;
default:
WARN_ON_ONCE(1);
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c 
b/drivers/net/wireless/iwlwifi/mvm/sta.c
index df216cd..606fc09 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -976,7 +976,8 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
 }
 
 int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-   struct ieee80211_sta *sta, u16 tid, u8 buf_size)
+   struct ieee80211_sta *sta, u16 tid, u8 buf_size,
+   bool amsdu)
 {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_mvm_tid_data *tid_data = mvmsta-tid_data[tid];
@@ -995,6 +996,7 @@ int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct 
ieee80211_vif *vif,
queue = tid_data-txq_id;
tid_data-state = IWL_AGG_ON;
mvmsta-agg_tids |= BIT(tid);
+   tid_data-amsdu_in_ampdu_allowed = amsdu;
tid_data-ssn = 0x;
spin_unlock_bh(mvmsta-lock);
 
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.h 
b/drivers/net/wireless/iwlwifi/mvm/sta.h
index eedb215..26d1e31 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.h
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.h
@@ -258,6 +258,8 @@ enum iwl_mvm_agg_state {
  * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA).
  * @reduced_tpc: Reduced tx power. Holds the data between the
  * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA).
+ * @amsdu_in_ampdu_allowed: true if A-MSDU in A-MPDU is allowed. Relevant only
+ * if state is %IWL_AGG_ON.
  * @state: state of the BA agreement establishment / tear down.
  * @txq_id: Tx queue used by the BA session
  * @ssn: the first packet to be sent in AGG HW queue in Tx AGG start flow, or
@@ -272,6 +274,7 @@ struct iwl_mvm_tid_data {
/* The rest is Tx AGG related */
u32 rate_n_flags;
u8 reduced_tpc;
+   bool amsdu_in_ampdu_allowed;
enum iwl_mvm_agg_state state;
u16 txq_id;
u16 ssn;
@@ -387,7 +390,8 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct 
ieee80211_sta *sta,
 int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid, u16 *ssn);
 int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-   struct ieee80211_sta *sta, u16 tid, u8 buf_size);
+   struct ieee80211_sta *sta, u16 tid, u8 buf_size,
+   bool amsdu);
 int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, u16 tid);
 int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index a63686c..5046833 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -488,8 +488,10 @@ static void iwl_update_ip_tcph(void *iph, struct tcphdr 
*tcph, bool ipv6,
  * @ieee80211_hdr *hdr: Points to the WiFi header.
  * @gso_nr_frags: The number of frags in the original GSO skb.
  * @wifi_hdr_iv_len: The length of the WiFi header including IV.
+ * @amsdu_pad: Number of bytes for the A-MSDU subframe
  * @tcp_fin: True if TCP_FIN is set in the original GSO skb.
  * @tcp_push: True if TCP_PSH is set in the original GSO skb.
+ * @amsdu: True if we are building an A-MSDU
  */
 struct iwl_lso_splitter {
unsigned int 

Re: [RFC v2 0/3] add TSO / A-MSDU TX for iwlwifi

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 15:59 +0300, Emmanuel Grumbach wrote:

 We could have enabled A-MSDU based on xmit-more, but the
 rationale of using LSO is that when using pfifo-fast,
 the Qdisc gets one packet and dequeues is straight away
 which limits the possibility to get a lot of packets at
 once. (Am I right here?).

No, you are not ;)

Key point for xmit_more is BQL being implemented in your driver.

Relevant code is in try_bulk_dequeue_skb()


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


Re: [PATCH] ath10k: add missing mutex unlock on failpath

2015-08-19 Thread Kalle Valo
Michal Kazior michal.kaz...@tieto.com writes:

 Kernel would complain about leaving a held lock
 after going back to userspace and would
 subsequently deadlock.

 Fixes: e04cafbc38c7 (ath10k: fix peer limit enforcement)
 Reported-by: Dan Carpenter dan.carpen...@oracle.com
 Signed-off-by: Michal Kazior michal.kaz...@tieto.com

commit e04cafbc38c7 is currently going to 4.3-rc1 (it's in
wireless-drivers-next currently). I think we should send this to 4.3 as
well, right?

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


Re: [PATCH] ath10k: Make fw stats prints specific to firmware version

2015-08-19 Thread Kalle Valo
Manikanta Pubbisetty c_mpu...@qti.qualcomm.com writes:

 Currently fw stats printing in ath10k is common to all firmware
 versions. Eventually we end up printing the stats which are not
 intended to be printed. For example, we might print stats of 10.2.4
 in 10.2, additional stats will have the value of zeros and this
 might lead to confusion.

 The patch makes debug stats prints fw specific by adding a new member
 in wmi_ops.

 Signed-off-by: Manikanta Pubbisetty c_mpu...@qti.qualcomm.com

kbuild found quite a few warnings:

 drivers/built-in.o:(.rodata+0x7ca10): undefined reference to 
 `ath10k_debug_10x_fw_stats_fill'
   drivers/built-in.o:(.rodata+0x7cb30): undefined reference to 
`ath10k_debug_10x_fw_stats_fill'
   drivers/built-in.o:(.rodata+0x7cc50): undefined reference to 
`ath10k_debug_10x_fw_stats_fill'
 drivers/built-in.o:(.rodata+0x7cd70): undefined reference to 
 `ath10k_debug_fw_stats_fill'
   drivers/built-in.o:(.rodata+0x7ced0): undefined reference to 
`ath10k_debug_fw_stats_fill'

   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_pdev_base_stats_fill':
 drivers/net/wireless/ath/ath10k/debug.c:2045:16: error: 
 'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c:2045:16: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_pdev_extra_stats_fill':
   drivers/net/wireless/ath/ath10k/debug.c:2076:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_pdev_tx_stats_fill':
   drivers/net/wireless/ath/ath10k/debug.c:2098:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_pdev_rx_stats_fill':
   drivers/net/wireless/ath/ath10k/debug.c:2159:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_vdev_stats_fill_common':
   drivers/net/wireless/ath/ath10k/debug.c:2203:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_peer_stats_fill_common':
   drivers/net/wireless/ath/ath10k/debug.c:2264:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
   drivers/net/wireless/ath/ath10k/debug.c: At top level:
 drivers/net/wireless/ath/ath10k/debug.c:2278:6: error: redefinition of 
 'ath10k_debug_fw_stats_fill'
void ath10k_debug_fw_stats_fill(struct ath10k *ar,
 ^
   In file included from drivers/net/wireless/ath/ath10k/debug.c:24:0:
   drivers/net/wireless/ath/ath10k/debug.h:138:1: note: previous definition of 
'ath10k_debug_fw_stats_fill' was here
ath10k_debug_fw_stats_fill(struct ath10k *ar,
^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_fw_stats_fill':
   drivers/net/wireless/ath/ath10k/debug.c:2283:16: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 int buf_len = ATH10K_FW_STATS_BUF_SIZE;
   ^
 drivers/net/wireless/ath/ath10k/debug.c:2299:2: error: implicit declaration 
 of function 'ath10k_debug_fw_stats_num_peers' 
 [-Werror=implicit-function-declaration]
 num_peers = ath10k_debug_fw_stats_num_peers(fw_stats-peers);
 ^
 drivers/net/wireless/ath/ath10k/debug.c:2300:2: error: implicit declaration 
 of function 'ath10k_debug_fw_stats_num_vdevs' 
 [-Werror=implicit-function-declaration]
 num_vdevs = ath10k_debug_fw_stats_num_vdevs(fw_stats-vdevs);
 ^
   drivers/net/wireless/ath/ath10k/debug.c: At top level:
 drivers/net/wireless/ath/ath10k/debug.c:2335:6: error: redefinition of 
 'ath10k_debug_10x_fw_stats_fill'
void ath10k_debug_10x_fw_stats_fill(struct ath10k *ar,
 ^
   In file included from drivers/net/wireless/ath/ath10k/debug.c:24:0:
   drivers/net/wireless/ath/ath10k/debug.h:145:1: note: previous definition of 
'ath10k_debug_10x_fw_stats_fill' was here
ath10k_debug_10x_fw_stats_fill(struct ath10k *ar,
^
   drivers/net/wireless/ath/ath10k/debug.c: In function 
'ath10k_debug_10x_fw_stats_fill':
   drivers/net/wireless/ath/ath10k/debug.c:2340:25: error: 
'ATH10K_FW_STATS_BUF_SIZE' undeclared (first use in this function)
 unsigned int buf_len = ATH10K_FW_STATS_BUF_SIZE;
^
   cc1: some warnings being treated as errors

 --- 

Telegrafische Überweisung HINWEIS

2015-08-19 Thread Standard Charterd Bank UAE
Standard Chartered Bank Dubai Main Branch,
Al Fardan Gebäude, Al Mankhool Road,
P.O. Box 999, Dubai,
Vereinigte Arabische Emirate

Sehr geehrte Kunden,


Telegrafische Überweisung HINWEIS.

Wir sind hiermit offiziell informieren Sie über Ihre Fondstelegrafische 
Überweisung durch unsere Bank, Standard Chartered Bank, auf Ihr Bankkonto, die 
offiziell von der Leitung der Weltbank Swiss (WBS) genehmigt worden ist, um die 
Summe von $ 5.500,000.00 USD in Credit Ihrer Bank Konto.
Beachten Sie, dass ich die Bearbeitung Ihrer Zahlung und alles über die 
sofortige Überweisung von Ihrem Fonds wird innerhalb kürzester Zeit von der 
Zeit, die wir Ihren Unten benötigten Informationen erhalten geführt werden 
gestartet.
Auch darüber informiert, dass der Gouverneur von Standard Chartered Bank (UAE) 
Plc auf Ihrer Avis unterschreiben und eine Kopie der Beratung wird bei der 
Weltbank in der Schweiz für einige Aufzeichnungszwecke versandt werden. 
Inzwischen Ihrer Information und Ihre vollständigen Kontaktdaten wurden aus 
unserer Forschung manager.Barrister Paul Dean eingehen, werden in Ihrem Namen, 
um eine zu erhalten, zu handeln
AFIDAVIT ANSPRUCHS zur sofortigen Veröffentlichung Ihres Fonds.

Dieser Fonds war Teil der eingereichten verstorbenen Präsidenten Saddam Hussein 
im Irak Discovery Fund der Weltbank der Schweiz, die die Schweizer Bank hat 
beschlossen, es zu großzügig verteilen
helfen wenigen glücklichen Menschen, und die Europäische Union wird im 
Einvernehmen mit der Schweizerischen Bank, den Fonds auf 700 hunderttausend 
Menschen in Amerika, Europa und Asien, Naher Osten Afrika in andere zu 
verteilen, um zur Verbesserung ihrer Unternehmen.

Daher bestätigen die die unten angegebenen Informationen genau, denn dieses Amt 
nicht leisten können, haftet für falsche Übertragung von Mitteln oder Haftung 
eines Fonds in ein unbekanntes Konto gutgeschrieben gehalten werden.
Das einzige, was von Ihnen verlangt wird, um die eidesstattliche Erklärung 
ANSPRUCH zu erhalten, damit wir Ihrem Konto direkt durch telegrafische 
Überweisung oder über eine unserer entsprechenden Banken und schickt Kopien der 
Geldtransfer Freigabedokumente für Sie und Ihre Banker zur Bestätigung.

Sollten Sie unsere Richtlinien befolgen, werden Ihre Fonds gutgeschrieben und 
beziehen sich auf Ihrem Bankkonto innerhalb von fünf (5) Bankarbeitstagen ab 
dem Tag, Sie diese eidesstattliche Erklärung ANSPRUCH erhalten.

Für weitere Informationen und Unterstützung auf dieser Remittance Mitteilung 
Bitte leiten Sie Ihre

VOLLER NAME:

FULL KONTAKTADRESSE:

Telefon- und Faxnummern:

Direkt an meine E-Mail: standchart_orgb...@asia.com

Mit freundlichen Grüßen,
Mr. Rajesh Arora
Finanzvorstand,
UAE.
--
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: set channel from radiotap headers during injection

2015-08-19 Thread Johannes Berg
On Fri, 2015-08-14 at 14:39 -0700, Allan Matthew wrote:
 Anyone have any thoughts on this?
 
 Is it possible with channel context enabled somehow?
 

I don't think it's possible - per-packet configuration would have to be
basically instantaneous (cannot sleep etc.) and setting the channel is
necessarily a much longer operation.

If your device supports channel contexts, you might be able to *pick*
the channel you want to inject on, but you could probably achieve that
through the existing MAC address selection that picks an interface.
It's also not clear how monitor + chanctx would work at all, since
monitor expects to be on the channel all the time.

You could possibly select other parameters like the bitrate, but the
channel width - especially 5/10 MHz - doesn't seem feasible.

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: [RFC v2 1/3] iwlwifi: mvm: add real TSO implementation

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 07:17 -0700, Eric Dumazet wrote:
 On Wed, 2015-08-19 at 15:59 +0300, Emmanuel Grumbach wrote:
  The segmentation is done completely in software. The
  driver creates several MPDUs out of a single large send.
  Each MPDU is a newly allocated SKB.
  A page is allocated to create the headers that need to be
  duplicated (SNAP / IP / TCP). The WiFi header is in the
  header of the newly created SKBs.
  
  type=feature
  
  Change-Id: I238ffa79cacc5bbdacdfbf3e9673c8d4f02b462a
  Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
  ---
   drivers/net/wireless/iwlwifi/mvm/tx.c | 513 
  +++---
   1 file changed, 481 insertions(+), 32 deletions(-)
 
 Ouch dynamic allocations while doing xmit are certainly not needed.
 Your driver should pre-allocated space for headers.
 
 Drivers willing to implement tso have to use net/core/tso.c provided
 helpers.
 
 $ git grep -n tso_build_hdr
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c:1030:
 tso_build_hdr(skb, hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/freescale/fec_main.c:729:  tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/marvell/mv643xx_eth.c:842: tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/marvell/mvneta.c:1650: tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 include/net/tso.h:15:void tso_build_hdr(struct sk_buff *skb, char *hdr, 
 struct tso_t *tso,
 net/core/tso.c:14:void tso_build_hdr(struct sk_buff *skb, char *hdr, struct 
 tso_t *tso,
 net/core/tso.c:37:EXPORT_SYMBOL(tso_build_hdr);
 

Look at commit 2adb719d74f6e174071e5c913290b9bbd8c2c0e8 for a typical
use of these helpers.


--
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 v2] rtlwifi: rtl8192cu: Add new device ID

2015-08-19 Thread Larry Finger

On 08/19/2015 10:33 AM, Adrien Schildknecht wrote:

The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht adrien+...@schischi.me
Cc: Stable sta...@vger.kernel.org
---
  drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
  1 file changed, 1 insertion(+)


Acked-by: Larry Finger larry.fin...@lwfinger.net

Thanks,

Larry



diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23806c2..fd4a535 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+   {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CCC*/
{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/



--
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] staging: wilc1000: Set all options in region debugfs file

2015-08-19 Thread Greg KH
On Wed, Aug 19, 2015 at 06:00:12PM +0530, Chandra Gorentla wrote:
 On Tue, Aug 18, 2015 at 08:01:00PM -0700, Greg KH wrote:
  On Tue, Aug 18, 2015 at 10:32:17PM +0530, Chandra S Gorentla wrote:
   This patch allows setting all options in the module's debug region
   options file 'wilc_debug_region'.  This functionality allows the user
   to enable logging from all regions (initialization, locks, firmware
   etc.) of the driver.  Logging from the following regions is enabled
   during the driver initialization:
   
   INIT_DBG, GENERIC_DBG, CFG80211_DBG, FIRM_DBG and HOSTAPD_DBG
   
   Before this change, the numerical value set is equal first byte of 
   input minus 0x30 (ASCII value of '0').  Because of this, after a write 
   to this debugfs file, it is difficult to predict the regions on which
   logging is enabled.
   
   The DBG_REGION_ALL now includes 3 additional regions TCP_ENH, SPIN_DEBUG
   and FIRM_DBG.
  
  Why did you add these extra ones?
 I added them because there is code support them and to avoid a holes in
 the range of the options.

But why do you need to debug such things?

  All of this should eventually just be deleted, as network drivers need
  to use the networking driver debug interfaces, not their own crazy ones.
 In that case, can I assume that we are not going forward with this change?

I hope not, please work on fixing the driver up to work properly (i.e.
not with this type of stuff...)

thanks,

greg k-h
--
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] rtlwifi: rtl8192cu: Add new device ID

2015-08-19 Thread Adrien Schildknecht
The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht adrien+...@schischi.me
Cc: Stable sta...@vger.kernel.org
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23806c2..fd4a535 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+   {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CCC*/
{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
-- 
2.5.0

--
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] rtlwifi: rtl8192cu: Add new device ID

2015-08-19 Thread Larry Finger

On 08/19/2015 08:51 AM, Adrien Schildknecht wrote:

The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht adrien+...@schischi.me


Add a Cc: Stable sta...@vger.kernel.org line here. That way the new ID will 
be available with older kernels.


The new line exceeds 80 characters. You might abbreviate Netgear as NG.

When you resubmit, do so as [PATCH V2].

Thanks,

Larry


---
  drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c 
b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 23806c2..8b4238a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -321,6 +321,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+   {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NetGear 
WNA1000Mv2*/
{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CCC*/
{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/



--
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: [RFC v2 0/3] add TSO / A-MSDU TX for iwlwifi

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 17:00 +, Grumbach, Emmanuel wrote:
 
 On 08/19/2015 07:08 PM, Eric Dumazet wrote:
  On Wed, 2015-08-19 at 15:07 +, Grumbach, Emmanuel wrote:
  
  I'll look at it.
  I was almost starting to implement that but then I thought with another
  (good?) reason to use LSO. LSO gives me the guarantee that the packet is
  directed to one peer, which might not be the case with xmit_more since
  we have one Qdisc for several clients in case we are in AP mode.
  Building an A-MSDU for several clients is not possible, at least not for
  several client in the L2 (different MAC addresses).
  LSO avoids this problem completely.
  
  Then, simply calling skb_gso_segment() from the driver might be enough,
  and less work for you.
  
  This would even support TSO on IPv6
  
 
 Well... I did take care of IPv6.

net/core/tso.c does not yet handle IPv6


--
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 V2 1/7] brcmfmac: Add support for host platform NVRAM loading.

2015-08-19 Thread Rafał Miłecki
On 16 August 2015 at 08:55, Arend van Spriel ar...@broadcom.com wrote:
 From: Hante Meuleman meule...@broadcom.com

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

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

Well, you dropped unneeded change to the brcmf_nvram_handle_value
function, but you ignored the rest of my comments. Take a look at them
again please:
https://patchwork.kernel.org/patch/6767961/
--
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: [RFC v2 0/3] add TSO / A-MSDU TX for iwlwifi

2015-08-19 Thread Grumbach, Emmanuel


On 08/19/2015 07:08 PM, Eric Dumazet wrote:
 On Wed, 2015-08-19 at 15:07 +, Grumbach, Emmanuel wrote:
 
 I'll look at it.
 I was almost starting to implement that but then I thought with another
 (good?) reason to use LSO. LSO gives me the guarantee that the packet is
 directed to one peer, which might not be the case with xmit_more since
 we have one Qdisc for several clients in case we are in AP mode.
 Building an A-MSDU for several clients is not possible, at least not for
 several client in the L2 (different MAC addresses).
 LSO avoids this problem completely.
 
 Then, simply calling skb_gso_segment() from the driver might be enough,
 and less work for you.
 
 This would even support TSO on IPv6
 

Well... I did take care of IPv6.

 segs = skb_gso_segment(skb, tp-dev-features 
 ~(NETIF_F_TSO | NETIF_F_TSO6));
 
 

Thing is that our HW layers are currently implemented to receive one skb
per 802.11 packet. So that if I call skb_gso_segment, I'd have to
re-assemble the segs into one A-MSDU which would translate one skb.
I guess I could change the HW layer in the driver to be able to get a
list of skbs and make a single packet out of it, but that'd be tricky or
wasteful. skb_gso_segment will duplicate the wifi header while it is not
needed. Only the TCP / IP / SNAP headers need to be duplicated.
Moreover, each subframe in the A-MSDU needs it own subframe header (same
format as ethhdr) and there is also some padding in there. So that would
be even more complicated IMHO.
My code doesn't copy any payload. Only the headers. This is why I
thought it'd be better than segmenting and then re-assembling.
I did call skb_gso_segment if I get lots of payload in the header (more
than 2 * mss) in order to simplify the implementation.
--
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: [RFC v2 0/3] add TSO / A-MSDU TX for iwlwifi

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 17:56 +, Grumbach, Emmanuel wrote:
 

 So I feel that making net/core/tso.c more complicated just because of
 our craziness seems an overkill to me.
 I'll try a bit harder to see how I can use net/core/tso.c, but I have to
 say I am pessimistic.

net/core/tso.c is WIP, feel free to expand it to make it more generic
and meet your needs.

The point is : we want a core infrastructure, not something that each
individual driver implements in ~500 lines of code :(


--
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: set channel from radiotap headers during injection

2015-08-19 Thread Johannes Berg
On Wed, 2015-08-19 at 10:44 -0700, Ben Greear wrote:
 
 At least with ath9k, it is possible to send HT20 frames
 when the radio has other vifs on the same radio sending HT40 frames, 
 for instance.
 (And rate-ctrl will do the same thing even for an 'ht40' vif).

Yes, but that's pure rate control.

 ath10k hardware has same general ability, but you have no good way to
 get radiotap info to the firmware at this time.
 
 As long as the center freq is the same, it might also be possible to 
 do smaller bandwith encodings as well.

I don't think this is true - I believe the clock settings are different
for 5 and 10 MHz (vs. each other and higher bandwidths)


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: [RFC v2 1/3] iwlwifi: mvm: add real TSO implementation

2015-08-19 Thread Grumbach, Emmanuel


On 08/19/2015 05:18 PM, Eric Dumazet wrote:
 On Wed, 2015-08-19 at 15:59 +0300, Emmanuel Grumbach wrote:
 The segmentation is done completely in software. The
 driver creates several MPDUs out of a single large send.
 Each MPDU is a newly allocated SKB.
 A page is allocated to create the headers that need to be
 duplicated (SNAP / IP / TCP). The WiFi header is in the
 header of the newly created SKBs.

 type=feature

 Change-Id: I238ffa79cacc5bbdacdfbf3e9673c8d4f02b462a
 Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
 ---
  drivers/net/wireless/iwlwifi/mvm/tx.c | 513 
 +++---
  1 file changed, 481 insertions(+), 32 deletions(-)
 
 Ouch dynamic allocations while doing xmit are certainly not needed.
 Your driver should pre-allocated space for headers.

This is right as long as you don't need *several* headers in one single
skb. In the case of A-MSDU, I need to have several TCP / IP / SNAP
headers in the same skb. At least that's how my HW layer in the driver
is built. See the other thread.

 
 Drivers willing to implement tso have to use net/core/tso.c provided
 helpers.
 
 $ git grep -n tso_build_hdr
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c:1030:
 tso_build_hdr(skb, hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/freescale/fec_main.c:729:  tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/marvell/mv643xx_eth.c:842: tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 drivers/net/ethernet/marvell/mvneta.c:1650: tso_build_hdr(skb, 
 hdr, tso, data_left, total_len == 0);
 include/net/tso.h:15:void tso_build_hdr(struct sk_buff *skb, char *hdr, 
 struct tso_t *tso,
 net/core/tso.c:14:void tso_build_hdr(struct sk_buff *skb, char *hdr, struct 
 tso_t *tso,
 net/core/tso.c:37:EXPORT_SYMBOL(tso_build_hdr);
 
 

This looks promising indeed. I'll take a close look.
Thanks a bunch.
--
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: set channel from radiotap headers during injection

2015-08-19 Thread Johannes Berg
On Wed, 2015-08-19 at 09:37 -0700, Allan Matthew wrote:

 It seems like the functionality for this (maybe not the monitor mode)
 must be available in order to support the multiple 802.11p channels 
 in the 5.8ghz band.

Not sure - I haven't looked at WAVE/11p in a long time, but the code we
have certainly assumes that the channel configuration is fixed, i.e.
only done once when joining the network.

 It sounds like what you are proposing is to create a non-monitor vif,
 select its channel, bitrate, bandwidth and then use the MAC address 
 to
 select it as the transmitting interface.  Is that correct?  I'm
 guessing I could do this with raw sockets and prepend the ieee80211
 header (but not the radiotap header)?
 

No - radiotap injection has code to select the interfaces. So if you
have hardware that's capable of, say, having two AP interfaces on
different channels, then injection would select the channel by
selecting the interface. However, this isn't really a good way of
handling this either.

If you can be more specific what this would be used for, perhaps kernel
modifications would be appropriate to support it more correctly (rather
than relying on injection.)

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: set channel from radiotap headers during injection

2015-08-19 Thread Allan Matthew
Thank you Johannes,

It seems like the functionality for this (maybe not the monitor mode)
must be available in order to support the multiple 802.11p channels in
the 5.8ghz band.

It sounds like what you are proposing is to create a non-monitor vif,
select its channel, bitrate, bandwidth and then use the MAC address to
select it as the transmitting interface.  Is that correct?  I'm
guessing I could do this with raw sockets and prepend the ieee80211
header (but not the radiotap header)?

Thanks for the help!

On Wed, Aug 19, 2015 at 4:24 AM, Johannes Berg
johan...@sipsolutions.net wrote:
 On Fri, 2015-08-14 at 14:39 -0700, Allan Matthew wrote:
 Anyone have any thoughts on this?

 Is it possible with channel context enabled somehow?


 I don't think it's possible - per-packet configuration would have to be
 basically instantaneous (cannot sleep etc.) and setting the channel is
 necessarily a much longer operation.

 If your device supports channel contexts, you might be able to *pick*
 the channel you want to inject on, but you could probably achieve that
 through the existing MAC address selection that picks an interface.
 It's also not clear how monitor + chanctx would work at all, since
 monitor expects to be on the channel all the time.

 You could possibly select other parameters like the bitrate, but the
 channel width - especially 5/10 MHz - doesn't seem feasible.

 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: set channel from radiotap headers during injection

2015-08-19 Thread Johannes Berg
On Wed, 2015-08-19 at 12:50 -0700, Allan Matthew wrote:
 Regarding the AP clients, could the AP send a power save or sleep
 notification telling clients its going away for awhile, then come 
 back after the specified time?
 

No, the protocol has no such provision for the AP.

[also, please try to format your emails more readable, instead of just
tacking on something on the top]

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


Using ath5k/ath9k radio for constant-tx noise source.

2015-08-19 Thread Ben Greear

I have a commercial AP that is using a CM9 ath5k radio (evidently, I could be 
wrong)
and it has the ability to do a constant transmit of raw noise (RF probe shows
noise, but a monitor-port sniffer does not see any frames from the CM9).

I don't know the low-level details of how it is doing this, but I suspect
it is using something like madwifi for a driver.

Does anyone know how this can be done with modern software and
ath5k or ath9k NICs?

Thanks,
Ben

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

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


Re: [RFC v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Sergei Shtylyov

Hello.

On 08/19/2015 03:59 PM, Emmanuel Grumbach wrote:


This allows to release the backpressure on the socket only
when the last segment is released.
Now the truesize looks like this:
if the truesize of the original skb is 65420, all the
segments will have a truesize of 704 (skb itself) and the
last one will have 65420.

Change-Id: I3c894cf2afc0aedfe7b2a5b992ba41653ff79c0e
Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
  drivers/net/wireless/iwlwifi/mvm/tx.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 5046833..046e50d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c

[...]

@@ -1034,6 +1035,20 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
sk_buff *skb_gso,
}

__skb_queue_tail(mpdus_skb, skb);
+   sum_truesize += skb-truesize;
+   }
+
+   /* Release the backpressure on the socket only when
+* the last segment is released.
+*/
+   if (skb_gso-destructor == sock_wfree) {
+   struct sk_buff *tail = mpdus_skb-prev;
+
+   swap(tail-truesize, skb_gso-truesize);
+   swap(tail-destructor, skb_gso-destructor);
+   swap(tail-sk, skb_gso-sk);
+atomic_add(sum_truesize - skb_gso-truesize,


   Please indent using tabs, not spaces.


+   skb_gso-sk-sk_wmem_alloc);
}

ret = 0;


MBR, Sergei

--
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: [RFC v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Grumbach, Emmanuel


On 08/19/2015 05:24 PM, Eric Dumazet wrote:
 On Wed, 2015-08-19 at 15:59 +0300, Emmanuel Grumbach wrote:
 This allows to release the backpressure on the socket only
 when the last segment is released.
 Now the truesize looks like this:
 if the truesize of the original skb is 65420, all the
 segments will have a truesize of 704 (skb itself) and the
 last one will have 65420.

 Change-Id: I3c894cf2afc0aedfe7b2a5b992ba41653ff79c0e
 Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
 ---
  drivers/net/wireless/iwlwifi/mvm/tx.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

 diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
 b/drivers/net/wireless/iwlwifi/mvm/tx.c
 index 5046833..046e50d 100644
 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c
 +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
 @@ -764,7 +764,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
 sk_buff *skb_gso,
  bool ipv6 = skb_shinfo(skb_gso)-gso_type  SKB_GSO_TCPV6;
  struct iwl_lso_splitter s = {};
  struct page *hdr_page;
 -unsigned int mpdu_sz;
 +unsigned int mpdu_sz, sum_truesize = 0;
  u8 *hdr_page_pos, *qc, tid;
  int i, ret;
  
 @@ -898,6 +898,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
 sk_buff *skb_gso,
  mpdu_sz, tcp_hdrlen(skb_gso));
  
  __skb_queue_tail(mpdus_skb, skb_gso);
 +sum_truesize += skb_gso-truesize;
  
  /* mss bytes have been consumed from the data */
  s.gso_payload_pos = s.mss;
 @@ -1034,6 +1035,20 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
 sk_buff *skb_gso,
  }
  
  __skb_queue_tail(mpdus_skb, skb);
 +sum_truesize += skb-truesize;
 +}
 +
 +/* Release the backpressure on the socket only when
 + * the last segment is released.
 + */
 +if (skb_gso-destructor == sock_wfree) {
 +struct sk_buff *tail = mpdus_skb-prev;
 +
 +swap(tail-truesize, skb_gso-truesize);
 +swap(tail-destructor, skb_gso-destructor);
 +swap(tail-sk, skb_gso-sk);
 +atomic_add(sum_truesize - skb_gso-truesize,
 +   skb_gso-sk-sk_wmem_alloc);
  }
  
  ret = 0;
 
 Using existing net/core/tso.c helpers would avoid using this.

Hm.. how would net/core/tso.c avoid this?
I can't see anything related to truesize there.
Note that this work since it is guaranteed that we release the skbs in
order.

 
 (BTW TCP packets do not have sock_wfree as destructor but tcp_wfree(),
 yet we want backpressure mostly for TCP stack (TCP Small Queues))
 
 

I am not sure I follow here.
You want me to test:
if (skb_gso-destructor == tcp_wfree) ?

I checked that code using iperf and saw that I don't get into this if,
but I (probably wrongly) assumed that other applications would set a
flag on the socket (forgive my ignorance) that would make this if be taken.
--
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: set channel from radiotap headers during injection

2015-08-19 Thread Allan Matthew
Regarding the AP clients, could the AP send a power save or sleep
notification telling clients its going away for awhile, then come back
after the specified time?

On Wed, Aug 19, 2015 at 12:41 PM, Johannes Berg
johan...@sipsolutions.net wrote:
 On Wed, 2015-08-19 at 12:00 -0700, Allan Matthew wrote:

 I operate an AP on one channel that talks to some set of devices.

 On another channel (maybe just different BW) I use packet injection
 to send data to and from a separate device.

 The bitrate to the 2nd device (on the 2nd channel) is much lower than
 that of the AP, and I'd like to get longer range out of it.  The idea
 is that I use narrower bandwidth and fixed, low bitrates with control
 over the retries to get really tight control over that link.


 It might be somewhat feasible to set up the second one as a regular
 client/AP link as well, with a different channel context...

 However, the clients on the original AP might not be amused - their AP
 would mysteriously disappear every once a while, something they're not
 expecting (unless you restrict it to P2P GO/client operation)

 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: [RFC v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Eric Dumazet
On Wed, 2015-08-19 at 19:17 +, Grumbach, Emmanuel wrote:

 Hm.. how would net/core/tso.c avoid this?

Because a driver using these helpers keep around the original LSO packet
and frees it normally at TX completion time.

 I can't see anything related to truesize there.
 Note that this work since it is guaranteed that we release the skbs in
 order.
 
  
  (BTW TCP packets do not have sock_wfree as destructor but tcp_wfree(),
  yet we want backpressure mostly for TCP stack (TCP Small Queues))
  
  
 
 I am not sure I follow here.
 You want me to test:
 if (skb_gso-destructor == tcp_wfree) ?


Yes.

Look for example at tcp_gso_segment() (called from skb_gso_segment())

copy_destructor = gso_skb-destructor == tcp_wfree;
...
/* Following permits TCP Small Queues to work well with GSO :
 * The callback to TCP stack will be called at the time last frag
 * is freed at TX completion, and not right now when gso_skb
 * is freed by GSO engine
 */
if (copy_destructor) {
swap(gso_skb-sk, skb-sk);
swap(gso_skb-destructor, skb-destructor);
sum_truesize += skb-truesize;
atomic_add(sum_truesize - gso_skb-truesize,
   skb-sk-sk_wmem_alloc);
}


 
 I checked that code using iperf and saw that I don't get into this if,
 but I (probably wrongly) assumed that other applications would set a
 flag on the socket (forgive my ignorance) that would make this if be taken.

If you do not see skb-destructor == tcp_wfree, then something is
definitely wrong on your setup.



--
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: [RFC v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Grumbach, Emmanuel
Hi,

On 08/19/2015 10:10 PM, Sergei Shtylyov wrote:
 Hello.
 
 On 08/19/2015 03:59 PM, Emmanuel Grumbach wrote:
 
 This allows to release the backpressure on the socket only
 when the last segment is released.
 Now the truesize looks like this:
 if the truesize of the original skb is 65420, all the
 segments will have a truesize of 704 (skb itself) and the
 last one will have 65420.

 Change-Id: I3c894cf2afc0aedfe7b2a5b992ba41653ff79c0e
 Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
 ---
   drivers/net/wireless/iwlwifi/mvm/tx.c | 17 -
   1 file changed, 16 insertions(+), 1 deletion(-)

 diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
 b/drivers/net/wireless/iwlwifi/mvm/tx.c
 index 5046833..046e50d 100644
 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c
 +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
 [...]
 @@ -1034,6 +1035,20 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
 sk_buff *skb_gso,
  }

  __skb_queue_tail(mpdus_skb, skb);
 +sum_truesize += skb-truesize;
 +}
 +
 +/* Release the backpressure on the socket only when
 + * the last segment is released.
 + */
 +if (skb_gso-destructor == sock_wfree) {

I need to change the destructor function here as per Eric's comment.

 +struct sk_buff *tail = mpdus_skb-prev;
 +
 +swap(tail-truesize, skb_gso-truesize);
 +swap(tail-destructor, skb_gso-destructor);
 +swap(tail-sk, skb_gso-sk);
 +atomic_add(sum_truesize - skb_gso-truesize,
 
 Please indent using tabs, not spaces.

I am happy this is the only flaw you found ;)

Sure - I'll fix. And I'll remove the Change-ID and checkpatch will be
happy. No worries ;)

 
 +   skb_gso-sk-sk_wmem_alloc);
  }

  ret = 0;
 
 MBR, Sergei
 
 
--
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: [RFC v2 3/3] iwlwifi: mvm: transfer the truesize to the last TSO segment

2015-08-19 Thread Sergei Shtylyov

On 08/19/2015 10:12 PM, Grumbach, Emmanuel wrote:


This allows to release the backpressure on the socket only
when the last segment is released.
Now the truesize looks like this:
if the truesize of the original skb is 65420, all the
segments will have a truesize of 704 (skb itself) and the
last one will have 65420.

Change-Id: I3c894cf2afc0aedfe7b2a5b992ba41653ff79c0e
Signed-off-by: Emmanuel Grumbach emmanuel.grumb...@intel.com
---
   drivers/net/wireless/iwlwifi/mvm/tx.c | 17 -
   1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 5046833..046e50d 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c

[...]

@@ -1034,6 +1035,20 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct 
sk_buff *skb_gso,
}

__skb_queue_tail(mpdus_skb, skb);
+   sum_truesize += skb-truesize;
+   }
+
+   /* Release the backpressure on the socket only when
+* the last segment is released.
+*/
+   if (skb_gso-destructor == sock_wfree) {


I need to change the destructor function here as per Eric's comment.


+   struct sk_buff *tail = mpdus_skb-prev;
+
+   swap(tail-truesize, skb_gso-truesize);
+   swap(tail-destructor, skb_gso-destructor);
+   swap(tail-sk, skb_gso-sk);
+atomic_add(sum_truesize - skb_gso-truesize,


 Please indent using tabs, not spaces.


I am happy this is the only flaw you found ;)


   It just jumped into my eyes. :-)


Sure - I'll fix. And I'll remove the Change-ID and checkpatch will be
happy.


   DaveM allows that tag in the networking patches, IIRC.


No worries ;)





+   skb_gso-sk-sk_wmem_alloc);
}

ret = 0;


MBR, Sergei

--
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: set channel from radiotap headers during injection

2015-08-19 Thread Allan Matthew
On Wed, Aug 19, 2015 at 12:53 PM, Johannes Berg
johan...@sipsolutions.net wrote:
 No, the protocol has no such provision for the AP.

 [also, please try to format your emails more readable, instead of just
 tacking on something on the top]

 johannes

Understood, thanks for the help.  Apologies for the poor formatting!
--
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: mac80211: add rate mask logic for vht rates

2015-08-19 Thread Lorenzo Bianconi
 Hello Lorenzo Bianconi,

Hi Dan,


 The patch b119ad6e726c: mac80211: add rate mask logic for vht rates
 from Aug 6, 2015, leads to the following static checker warning:

 net/mac80211/cfg.c:2520 ieee80211_set_bitrate_mask()
 error: buffer overflow 'sdata-rc_rateidx_vht_mcs_mask[i]' 8 = 9

 net/mac80211/cfg.c
   2516  for (j = 0; j  IEEE80211_HT_MCS_MASK_LEN; j++) {
 ^
 This is 10.

   2517  if (~sdata-rc_rateidx_mcs_mask[i][j])
   2518  sdata-rc_has_mcs_mask[i] = true;
   2519
   2520  if (~sdata-rc_rateidx_vht_mcs_mask[i][j])
 ^^
 This only has 8 elements.

   2521  sdata-rc_has_vht_mcs_mask[i] = true;
   2522
   2523  if (sdata-rc_has_mcs_mask[i] 
   2524  sdata-rc_has_vht_mcs_mask[i])
   2525  break;

 Maybe we always break out before we get to the last two iterations?


you are right, this chunk is wrong. We have to use to different for
loops to initialize rc_has_vht_mcs_mask array. I will send a patch in
few days. Thanks.

   2526  }

 regards,
 dan carpenter

Best regards,

Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep
--
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: set channel from radiotap headers during injection

2015-08-19 Thread Johannes Berg
On Wed, 2015-08-19 at 12:00 -0700, Allan Matthew wrote:
 
 I operate an AP on one channel that talks to some set of devices.
 
 On another channel (maybe just different BW) I use packet injection
 to send data to and from a separate device.
 
 The bitrate to the 2nd device (on the 2nd channel) is much lower than
 that of the AP, and I'd like to get longer range out of it.  The idea
 is that I use narrower bandwidth and fixed, low bitrates with control
 over the retries to get really tight control over that link.
 

It might be somewhat feasible to set up the second one as a regular
client/AP link as well, with a different channel context...

However, the clients on the original AP might not be amused - their AP
would mysteriously disappear every once a while, something they're not
expecting (unless you restrict it to P2P GO/client operation)

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 V2 1/7] brcmfmac: Add support for host platform NVRAM loading.

2015-08-19 Thread Arend van Spriel

On 08/19/2015 06:38 PM, Rafał Miłecki wrote:

On 16 August 2015 at 08:55, Arend van Spriel ar...@broadcom.com wrote:

From: Hante Meuleman meule...@broadcom.com

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

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


Well, you dropped unneeded change to the brcmf_nvram_handle_value
function, but you ignored the rest of my comments. Take a look at them
again please:
https://patchwork.kernel.org/patch/6767961/


Kalle,

Can you remove this patch from the series and apply the rest. Just 
verified over here the remaining patches apply cleanly on 
wireless-drivers-next.


Regards,
Arend
--
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 v2 1/7] brcmfmac: Add support for host platform NVRAM loading.

2015-08-19 Thread Arend van Spriel

On 08/19/2015 11:21 PM, Arend van Spriel wrote:

subject changed to v2. So let's go over your beef.

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

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

@@ -146,7 +147,7 @@ brcmf_nvram_handle_value(struct nvram_parser *nvp)
 u32 cplen;

 c = nvp-data[nvp-pos];
-   if (!is_nvram_char(c)) {
+   if (!is_nvram_char(c)  (c != ' ')) {


This is redundant, please drop this change.
See fc23e81eb8f4 (brcmfmac: allow NVRAM values to contain spaces)


done


@@ -426,19 +428,34 @@ static void brcmf_fw_request_nvram_done(const
struct firmware *fw, void *ctx)
 struct brcmf_fw *fwctx = ctx;
 u32 nvram_length = 0;
 void *nvram = NULL;
+   u8 *data = NULL;


This can be const.


done


Actually this is not done, but either way will require a cast because 
bcm47xx_nvram_release_contents expects char* so there is nothing gained. 
Unless someone will change bcm47xx_nvram_get/release_contents api to 
const char*.


Regards,
Arend


+   size_t data_len;
+   bool raw_nvram;

 brcmf_dbg(TRACE, enter: dev=%s\n, dev_name(fwctx-dev));
-   if (!fw  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if ((fw)  (fw-data)) {


I think I was already pointing similar coding issue to you. There is
no need for these extra braces. And if they are not needed, don't use
them. There is no point in using if (((foo))) schema just because it
works. You could be confused by macros where we sometimes need tricks
like this, but this is a standard part of code.


No confusion, just paranoid. You clearly have never been on road of
chasing compiler issues with logical condition, but indeed it can be
removed although checkpatch does not seem to be bothered with it. Will
change it.


+   data = (u8 *)fw-data;


Don't cast to workaround const != const. You won't need casting after
making local data a const variable.


done


+   data_len = fw-size;
+   raw_nvram = false;
+   } else {
+   data = bcm47xx_nvram_get_contents(data_len);
+   if (!data  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
+   goto fail;
+   raw_nvram = true;
+   }

-   if (fw) {
-   nvram = brcmf_fw_nvram_strip(fw-data, fw-size,
nvram_length,
+   if (data) {
+   nvram = brcmf_fw_nvram_strip(data, data_len,
nvram_length,
  fwctx-domain_nr,
fwctx-bus_nr);
-   release_firmware(fw);
-   if (!nvram  !(fwctx-flags 
BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if (raw_nvram)
+   bcm47xx_nvram_release_contents(data);


This is cosmetical but maybe you could move above 2 lines next to the
release_firmware? So we have all freeing code at one please? Do you
think it would improve readability?
Nothing important thought. Feel free to ignore me here.


confused! The release_firmware call is removed here, right?


@@ -473,15 +490,9 @@ static void brcmf_fw_request_code_done(const
struct firmware *fw, void *ctx)
 if (!ret)
 return;

-   /* when nvram is optional call .done() callback here */
-   if (fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL) {
-   fwctx-done(fwctx-dev, fw, NULL, 0);
-   kfree(fwctx);
-   return;
-   }
+   brcmf_fw_request_nvram_done(NULL, fwctx);
+   return;


It gave me a 5 minutes headache ;) Could you add a short comment why
you call _done anyway? Something like
/* Even if we failed to init user space fw request we may get a
platform one */


For the resulting code I don't see value adding such comment. Reading
this patch you might want Hante to explain this change, but you figured
it out. Sorry for the headache ;-)

Regards,
Arend



--
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 0/7] brcmfmac: nvram loading and code rework

2015-08-19 Thread Rafał Miłecki
On 12 August 2015 at 10:58, Arend van Spriel ar...@broadcom.com wrote:
 You did a warm reboot of the device, right? There seems to be an issue
 because on OpenWrt the brcmfmac is not unloaded upon warm reboot, which
 makes the device unaccessible. Because on OpenWrt the firmware request is
 synchronous (OpenWrt patch on top of upstream brcmfmac) it results in probe
 failing on invalid access making the issue OpenWrt specific. Hante created a
 fix for the warm reboot issue.

Hante could you share your fix?
--
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 v2 1/7] brcmfmac: Add support for host platform NVRAM loading.

2015-08-19 Thread Arend van Spriel

subject changed to v2. So let's go over your beef.

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

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

@@ -146,7 +147,7 @@ brcmf_nvram_handle_value(struct nvram_parser *nvp)
 u32 cplen;

 c = nvp-data[nvp-pos];
-   if (!is_nvram_char(c)) {
+   if (!is_nvram_char(c)  (c != ' ')) {


This is redundant, please drop this change.
See fc23e81eb8f4 (brcmfmac: allow NVRAM values to contain spaces)


done


@@ -426,19 +428,34 @@ static void brcmf_fw_request_nvram_done(const struct 
firmware *fw, void *ctx)
 struct brcmf_fw *fwctx = ctx;
 u32 nvram_length = 0;
 void *nvram = NULL;
+   u8 *data = NULL;


This can be const.


done


+   size_t data_len;
+   bool raw_nvram;

 brcmf_dbg(TRACE, enter: dev=%s\n, dev_name(fwctx-dev));
-   if (!fw  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if ((fw)  (fw-data)) {


I think I was already pointing similar coding issue to you. There is
no need for these extra braces. And if they are not needed, don't use
them. There is no point in using if (((foo))) schema just because it
works. You could be confused by macros where we sometimes need tricks
like this, but this is a standard part of code.


No confusion, just paranoid. You clearly have never been on road of 
chasing compiler issues with logical condition, but indeed it can be 
removed although checkpatch does not seem to be bothered with it. Will 
change it.



+   data = (u8 *)fw-data;


Don't cast to workaround const != const. You won't need casting after
making local data a const variable.


done


+   data_len = fw-size;
+   raw_nvram = false;
+   } else {
+   data = bcm47xx_nvram_get_contents(data_len);
+   if (!data  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
+   goto fail;
+   raw_nvram = true;
+   }

-   if (fw) {
-   nvram = brcmf_fw_nvram_strip(fw-data, fw-size, nvram_length,
+   if (data) {
+   nvram = brcmf_fw_nvram_strip(data, data_len, nvram_length,
  fwctx-domain_nr, fwctx-bus_nr);
-   release_firmware(fw);
-   if (!nvram  !(fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL))
-   goto fail;
+   if (raw_nvram)
+   bcm47xx_nvram_release_contents(data);


This is cosmetical but maybe you could move above 2 lines next to the
release_firmware? So we have all freeing code at one please? Do you
think it would improve readability?
Nothing important thought. Feel free to ignore me here.


confused! The release_firmware call is removed here, right?


@@ -473,15 +490,9 @@ static void brcmf_fw_request_code_done(const struct 
firmware *fw, void *ctx)
 if (!ret)
 return;

-   /* when nvram is optional call .done() callback here */
-   if (fwctx-flags  BRCMF_FW_REQ_NV_OPTIONAL) {
-   fwctx-done(fwctx-dev, fw, NULL, 0);
-   kfree(fwctx);
-   return;
-   }
+   brcmf_fw_request_nvram_done(NULL, fwctx);
+   return;


It gave me a 5 minutes headache ;) Could you add a short comment why
you call _done anyway? Something like
/* Even if we failed to init user space fw request we may get a platform one */


For the resulting code I don't see value adding such comment. Reading 
this patch you might want Hante to explain this change, but you figured 
it out. Sorry for the headache ;-)


Regards,
Arend

--
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 V2 3/7] brcmfmac: Increase nr of supported flowrings.

2015-08-19 Thread Rafał Miłecki
On 16 August 2015 at 08:55, Arend van Spriel ar...@broadcom.com wrote:
 From: Hante Meuleman meule...@broadcom.com

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

 Reviewed-by: Arend Van Spriel ar...@broadcom.com
 Reviewed-by: Franky (Zhenhui) Lin fran...@broadcom.com
 Reviewed-by: Pieter-Paul Giesberts piete...@broadcom.com
 Signed-off-by: Hante Meuleman meule...@broadcom.com
 Signed-off-by: Arend van Spriel ar...@broadcom.com

This is a patch that for my device triggers:
Unable to handle kernel NULL pointer dereference at virtual address 0014

It seems to happen even when using only 1 AP interface.
[   87.010649] [ cut here ]
[   87.015303] WARNING: CPU: 1 PID: 1026 at 
/home/zajec/openwrt/openwrt-arm.git/build_dir/target-arm_cortex-a9_musl-1.1.10_eabi/linux-bcm53xx/compat-wireless-2015-07-21/drivers/net/wireless/brcm80211/brcmfmac/core.c:1144
 brcmf_netdev_wait_pend8021x+0xf0/0x100 [brcmfmac])
[   87.039039] Modules linked in: pppoe ppp_async iptable_nat brcmfmac b43 
pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 mac80211 
ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat 
xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntn
[   87.105219] CPU: 1 PID: 1026 Comm: hostapd Not tainted 3.18.20 #16
[   87.111382] Backtrace: 
[   87.113853] [c0015490] (dump_backtrace) from [c001569c] 
(show_stack+0x18/0x1c)
[   87.121395]  r6:bf285f6d r5:0009 r4: r3:dc8cb014
[   87.127072] [c0015684] (show_stack) from [c01638d0] 
(dump_stack+0x7c/0x98)
[   87.134289] [c0163854] (dump_stack) from [c001fe3c] 
(warn_slowpath_common+0x70/0x94)
[   87.142357]  r4: r3:dc8cb014
[   87.145942] [c001fdcc] (warn_slowpath_common) from [c001ff04] 
(warn_slowpath_null+0x24/0x2c)
[   87.154690]  r8: r7:c68c r6:c721dd24 r5:c721dc80 r4:0001
[   87.161437] [c001fee0] (warn_slowpath_null) from [bf279958] 
(brcmf_netdev_wait_pend8021x+0xf0/0x100 [brcmfmac])
[   87.171858] [bf279868] (brcmf_netdev_wait_pend8021x [brcmfmac]) from 
[bf26a210] (brcmf_cfg80211_get_key+0x1dc/0x3e0 [brcmfmac])
[   87.183634]  r6:c6493b88 r5:c03a7008 r4:c721dc80
[   87.188278] [bf26a170] (brcmf_cfg80211_get_key [brcmfmac]) from 
[bf26a47c] (brcmf_cfg80211_del_key+0x68/0x98 [brcmfmac])
[   87.199445]  r6:c721dc80 r5:c03a7008 r4:
[   87.204127] [bf26a414] (brcmf_cfg80211_del_key [brcmfmac]) from 
[bf168360] (nl80211_del_key+0xe4/0x144 [cfg80211])
[   87.214782]  r6: r5:c6ab9920 r4:c721d800
[   87.219435] [bf16827c] (nl80211_del_key [cfg80211]) from [c024e550] 
(genl_rcv_msg+0x25c/0x2f4)
[   87.228355]  r7:c6af1040 r6:c6ab9914 r5:bf17d134 r4:bf185c78
[   87.234041] [c024e2f4] (genl_rcv_msg) from [c024da20] 
(netlink_rcv_skb+0x60/0xb4)
[   87.241841]  r10:c6493dd0 r9: r8:c6493d0c r7:0030 r6:c024e2f4 
r5:c6af1040
[   87.249669]  r4:c6ab9900
[   87.252209] [c024d9c0] (netlink_rcv_skb) from [c024e2e0] 
(genl_rcv+0x28/0x3c)
[   87.259656]  r6:c6921000 r5:c6af1040 r4:c03baf78 r3:0001
[   87.265333] [c024e2b8] (genl_rcv) from [c024d394] 
(netlink_unicast+0x138/0x22c)
[   87.272966]  r5:c6af1040 r4:c79fbc00
[   87.276548] [c024d25c] (netlink_unicast) from [c024d85c] 
(netlink_sendmsg+0x32c/0x394)
[   87.284787]  r9:0030 r8:c6493f5c r7:c6921000 r6: r5: 
r4:c6af1040
[   87.292562] [c024d530] (netlink_sendmsg) from [c0215234] 
(sock_sendmsg+0x78/0x8c)
[   87.300352]  r10:c6493e3c r9:c74de340 r8: r7:c78fd0c0 r6:c6493f5c 
r5:0030
[   87.308196]  r4:c74de340
[   87.310739] [c02151bc] (sock_sendmsg) from [c0216a6c] 
(___sys_sendmsg.part.30+0x198/0x238)
[   87.319308]  r7:c6493e7c r6: r5:0030 r4:c6493f5c
[   87.324986] [c02168d4] (___sys_sendmsg.part.30) from [c0217ba4] 
(__sys_sendmsg+0x54/0x78)
[   87.333477]  r10: r9:c6492000 r8:c0008aa4 r7:0128 r6:be9a2b90 
r5:
[   87.341312]  r4:c74de340
[   87.343846] [c0217b50] (__sys_sendmsg) from [c0217bd8] 
(SyS_sendmsg+0x10/0x14)
[   87.351387]  r6:b6fded70 r5: r4:
[   87.356013] [c0217bc8] (SyS_sendmsg) from [c0008900] 
(ret_fast_syscall+0x0/0x38)
[   87.363727] ---[ end trace 1cbe7afa5aa428d1 ]---
[   87.420645] [ cut here ]
[   87.425294] WARNING: CPU: 1 PID: 1026 at 
/home/zajec/openwrt/openwrt-arm.git/build_dir/target-arm_cortex-a9_musl-1.1.10_eabi/linux-bcm53xx/compat-wireless-2015-07-21/drivers/net/wireless/brcm80211/brcmfmac/core.c:1144
 brcmf_netdev_wait_pend8021x+0xf0/0x100 [brcmfmac])
[   87.449004] Modules linked in: pppoe ppp_async iptable_nat brcmfmac b43 
pppox ppp_generic nf_nat_ipv4 nf_conntrack_ipv6 nf_conntrack_ipv4 mac80211 
ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat 
xt_multiport xt_mark xt_mac xt_limit xt_id xt_conntn
[   87.515056] CPU: 1 PID: 1026 Comm: hostapd Tainted: GW  3.18.20 
#16
[   87.522342] Backtrace: 
[   87.524809] 

[PATCH] brcmfmac: check all combinations when setting wiphy's addresses

2015-08-19 Thread Rafał Miłecki
Broadcom is working on better reflection of interface combinations. With
upcoming patches we may have 1st combination supporting less interfaces
than others.
To don't run out of addresses check all combinations to find the one
with the greatest max_interfaces value.

Signed-off-by: Rafał Miłecki zaj...@gmail.com
---
I believe this patch should be applied before:
brcmfmac: correct interface combination info
---
 drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c 
b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
index ffe5260..c85e2db 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(struct wiphy *wiphy)
 static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 {
struct brcmf_pub *drvr = ifp-drvr;
+   const struct ieee80211_iface_combination *combo;
struct ieee80211_supported_band *band;
+   u16 max_interfaces = 0;
__le32 bandlist[3];
u32 n_bands;
int err, i;
@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct 
brcmf_if *ifp)
if (err)
return err;
 
-   for (i = 0; i  wiphy-iface_combinations-max_interfaces 
-i  ARRAY_SIZE(drvr-addresses); i++) {
+   for (i = 0, combo = wiphy-iface_combinations;
+i  wiphy-n_iface_combinations; i++, combo++) {
+   max_interfaces = max(max_interfaces, combo-max_interfaces);
+   }
+
+   for (i = 0; i  max_interfaces  i  ARRAY_SIZE(drvr-addresses);
+i++) {
u8 *addr = drvr-addresses[i].addr;
 
memcpy(addr, drvr-mac, ETH_ALEN);
-- 
1.8.4.5

--
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 V2 2/7] brcmfmac: correct interface combination info

2015-08-19 Thread Rafał Miłecki
On 16 August 2015 at 08:55, Arend van Spriel ar...@broadcom.com wrote:
 The interface combination provided by brcmfmac did not truly reflect
 the combinations supported by driver and/or firmware.

This is OK in general but may conflict a bit with my recent:
brcmfmac: set wiphy's addresses to provide valid MACs

My implementation was designed for a one combo only, I'll submit a fix for that.
--
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 V2 2/7] brcmfmac: correct interface combination info

2015-08-19 Thread Arend van Spriel

On 08/19/2015 11:49 PM, Rafał Miłecki wrote:

On 16 August 2015 at 08:55, Arend van Spriel ar...@broadcom.com wrote:

The interface combination provided by brcmfmac did not truly reflect
the combinations supported by driver and/or firmware.


This is OK in general but may conflict a bit with my recent:
brcmfmac: set wiphy's addresses to provide valid MACs


Actually had to dive into firmware and the mask on ea[5] is determined 
by allowed number of AP interfaces by MBSS.


Regards,
Arend


My implementation was designed for a one combo only, I'll submit a fix for that.



--
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] ath9k: fix AR_RX_FILTER for ar9462/ar9565 when rx stopped

2015-08-19 Thread miaoqing
From: Miaoqing Pan miaoq...@qca.qualcomm.com

When rx stopped, AR_RX_FILTER should be cleared, but in
ath9k_hw_setrxfilter(), ATH9K_RX_FILTER_CONTROL_WRAPPER will always
be set for ar9462/ar9565.

Fix this by moving the code in ath9k_hw_setrxfilter() to
ath_calcrxfilter().

Signed-off-by: Miaoqing Pan miaoq...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/hw.c   | 3 ---
 drivers/net/wireless/ath/ath9k/recv.c | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index a31a680..0e2b28c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2760,9 +2760,6 @@ void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
 
ENABLE_REGWRITE_BUFFER(ah);
 
-   if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
-   bits |= ATH9K_RX_FILTER_CONTROL_WRAPPER;
-
REG_WRITE(ah, AR_RX_FILTER, bits);
 
phybits = 0;
diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
b/drivers/net/wireless/ath/ath9k/recv.c
index d3189da..0689f6b 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -424,6 +424,9 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
AR_SREV_9561(sc-sc_ah))
rfilt |= ATH9K_RX_FILTER_4ADDRESS;
 
+   if (AR_SREV_9462(sc-sc_ah) || AR_SREV_9565(sc-sc_ah))
+   rfilt |= ATH9K_RX_FILTER_CONTROL_WRAPPER;
+
if (ath9k_is_chanctx_enabled() 
test_bit(ATH_OP_SCANNING, common-op_flags))
rfilt |= ATH9K_RX_FILTER_BEACON;
-- 
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 2/2] ath9k: fix incorrect calibration initial for ar9561

2015-08-19 Thread miaoqing
From: Miaoqing Pan miaoq...@qca.qualcomm.com

One stuck issue was found on AP152, the root cause is using wrong
calibration initial function.

Signed-off-by: Miaoqing Pan miaoq...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c 
b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 174442b..3880df7 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -1310,7 +1310,8 @@ static void ar9003_hw_do_pcoem_manual_peak_cal(struct 
ath_hw *ah,
struct ath9k_hw_cal_data *caldata = ah-caldata;
int i;
 
-   if (!AR_SREV_9462(ah)  !AR_SREV_9565(ah)  !AR_SREV_9485(ah))
+   if (!AR_SREV_9462(ah)  !AR_SREV_9565(ah)  !AR_SREV_9485(ah) 
+   !AR_SREV_9561(ah))
return;
 
if ((ah-caps.hw_caps  ATH9K_HW_CAP_RTT)  !run_rtt_cal)
@@ -1707,7 +1708,8 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah)
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
struct ath_hw_ops *ops = ath9k_hw_ops(ah);
 
-   if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah))
+   if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah) ||
+   AR_SREV_9561(ah))
priv_ops-init_cal = ar9003_hw_init_cal_pcoem;
else
priv_ops-init_cal = ar9003_hw_init_cal_soc;
-- 
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


CT firmware beta-15 now has better monitor mode.

2015-08-19 Thread Ben Greear

Here is the changelog note.  This particular improvement does not require
any driver patches as far as I know.  I tested this on my 4.0.4+ kernel.

Should be useful for anyone doing sniffing with ath10k.

  *  Allow monitor mode to receive 'Association Request', block-ack action 
frames,
 nodata frames, TYPE-CTL frames.  Previously, these were not delivered to
 the WMI interface, and the kernel driver is configured to drop mgmt frames 
in
 the normal RX htt datapath, so host never saw them.

 This makes sniffing with ath10k a lot more useful.  When no monitor 
devices are
 active, the firmware reverts to the previous behaviour.  I guess the idea 
is that
 this is an optimization and keeps some un-needed frames off the host.

http://www.candelatech.com/ath10k.php

I'd be curious to know if anyone finds any bugs with this.  It is possible
that my changes could cause duplicate frames to be received in monitor mode,
so please keep an eye out for that.

Thanks,
Ben

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

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


Re: [PATCH 1/2] ath10k: ensure pktlog disable cmd reaches fw before pdev suspend

2015-08-19 Thread Kalle Valo
Raja Mani rm...@qti.qualcomm.com writes:

 Found incorrect sequence in ath10k_core_stop() where wmi pktlog
 disable cmd is passed from ath10k_debug_stop() to firmware
 immediately after wmi pdev suspend cmd. Firmware will not accept
 any wmi cmd after receiving wmi pdev suspend cmd.

 Fix this issue in ath10k_core_stop() by moving ath10k_debug_stop()
 just before sending pdev suspend cmd. So that pktlog disable cmd
 will get passed before pdev suspend cmd.

 Signed-off-by: Raja Mani rm...@qti.qualcomm.com

Thanks, applied.

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


Re: [PATCH] ath10k: add pktlog support for 10.4 firmware

2015-08-19 Thread Kalle Valo
Raja Mani rm...@qti.qualcomm.com writes:

 10.4 firmware uses dedicated copy engine for pktlog transaction.
 Whatever the data received in that dedicated copy engine will
 have only pkt log header and followed by pktlog payload (will not
 have htc header). In the current design, htc layer callback
 registered with hif are acting as default receiver for all copy
 engine. We need to change the design in a way dedicated copy
 engine assigned for pktlog directly goes to pktlog module
 (bypassing htc) and rest of copy engine data goes to htc layer.
 In order to meet this, hif layer is changed to maintain copy
 engine specific tx and rx callbacks.

 Also, new firmware ie is added to get copy engine number used
 for pktlog in the firmware. Based this, pktlog receiver callback
 handler will be plugged into hif layer.

 pktlog.c/h are newly added to have pktlog related stuff.
 10.4 firmware pktlog header differs from non 10.4 firmware.
 So, new pktlog header is added for 10.4.

 This patch enables pktlog to capture only TX related info on
 10.4 firmware. Some more effort is need to capture RX related
 info in pktlog which is not covered in this patch.

 Signed-off-by: Raja Mani rm...@qti.qualcomm.com

Like discussed privately, let's drop this now and revisit later.

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


pull-request: wireless-drivers-next 2015-08-19

2015-08-19 Thread Kalle Valo
Hi Dave,

here's one more pull request for 4.3. More info in the signed tag below.

This time I had to merge mac80211-next.git due to some iwlwifi
dependencies and apparently that broke git-request-pull's diffstat
again, it was showing changes which were not really coming from my tree.
I think that's just a bug in my old git and really should update the
tool. This time I just fixed the diffstat manually.

But please be extra careful with this pull request and please let me
know if you have any problems.

The following changes since commit 8f9c98df949333f08b74e5df1caacf7e2c5e8552:

  mac80211: fix BIT position for TDLS WIDE extended cap (2015-08-14 17:49:53 
+0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
tags/wireless-drivers-next-for-davem-2015-08-19

for you to fetch changes up to a6bf49db8c94d194d1c197deba2935468026ec89:

  Merge tag 'iwlwifi-next-for-kalle-2015-08-18' of 
https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next 
(2015-08-18 17:20:11 +0300)



Major changes:

ath10k:

* add support for qca99x0 family of devices
* improve performance of tx_lock
* add support for raw mode (802.11 frame format) and software crypto
  engine enabled via a module parameter

ath9k:

* add fast-xmit support

wil6210:

* implement TSO support
* support bootloader v1 and onwards

iwlwifi:

* Deprecate -10.ucode
* Clean ups towards multiple Rx queues
* Add support for longer CMD IDs. This will be required by new
  firmwares since we are getting close to the u8 limit.
* bugfixes for the D0i3 power state
* Add basic support for FTM
* polish the Miracast operation
* fix a few power consumption issues
* scan cleanup
* fixes for D0i3 system state
* add paging for devices that support it
* add again the new RBD allocation model
* add more options to the firmware debug system
* add support for frag SKBs in Tx


Adrien Schildknecht (2):
  rt2x00: adjust EEPROM_SIZE for rt2500usb
  iwlwifi: out-of-bounds access in iwl_init_sband_channels

Alexander Bondar (2):
  iwlwifi: Add max TX aggregation size for 8260 SDIO devices series
  iwlwifi: rs: disable MIMO only if allowed in configuration

Amitkumar Karwar (3):
  mwifiex: corrections in PCIe event skb handling
  mwifiex: add missing skb_push() in mwifiex_check_uap_capabilties
  mwifiex: correct TDLS link delete failure message priority

Andreas Fenkart (5):
  mwifiex: sdio: reset adapter using mmc_hw_reset
  mwifiex: remove explicit mwifiex_complete_cmd calls
  mwifiex: remove redundant reset of cmd_wait_q status
  mwifiex: remove CMD_F_CANCELED flag
  mwifiex: simplify mwifiex_complete_cmd

Andy Shevchenko (1):
  iwlwifi: convert hex_dump_to_buffer() to %*ph

Aniket Nagarnaik (1):
  mwifiex: claim sdio bus while downloading the firmware

Arik Nemtsov (1):
  iwlwifi: mvm: support TDLS wider-bandwidth

Assaf Krauss (1):
  iwlwifi: mvm: ToF - Set correct range request cmd id

Aviya Erenfeld (1):
  iwlwifi: add wide firmware command infrastructure for TX

Avraham Stern (2):
  iwlwifi: mvm: add wide firmware command infrastructure for RX
  iwlwifi: add new TLV capability flag for gscan support

Avri Altman (5):
  iwlwifi: mvm: update comment of power_scheme module parameter
  iwlwifi: mvm: Enable Rx Checksum hw
  iwlwifi: mvm: revert to our old skip over dtim policy
  iwlwifi: mvm: set different pm_timeout for action frames
  iwlwifi: mvm: Enable power management on low-latency bss

Ayala Beker (1):
  iwlwifi: mvm: add debug info to schedule scan complete message.

Bertold Van den Bergh (1):
  ath: Make ath_opmode_to_string understand OCB mode

Cheolhyun Park (1):
  rtlwifi: misspelled code and comments corrected.

Dan Carpenter (2):
  mwifiex: usb: return an error if kmalloc fails
  iwlwifi: mvm: fix a range check in debugfs code

David Liu (1):
  ath10k: enable raw encap mode and software crypto engine

David Spinadel (4):
  iwlwifi: mvm: clean up fw-api-scan.h
  iwlwifi: mvm: simplify calculating scan dwells and other timing values
  iwlwifi: mvm: remove partial and full scan lists from lmac sched scan
  iwlwifi: mvm: don't disconnect on beacon loss in D0I3

Dedy Lansky (1):
  wil6210: treat unhandled event as warning instead of error

Dor Shaish (1):
  iwlwifi: mvm: print secboot status registers on alive timeout

Eliad Peller (9):
  Revert iwlwifi: mvm: move deferred d0i3 exit to resume_complete op
  iwlwifi: return error if d0i3 was aborted
  iwlwifi: call d3_suspend/resume in d0i3 case as well
  iwlwifi: pcie: reset write pointer on ict reset
  wl18xx: use long intervals in sched scan
  wlcore: add generic_cfg_feature command definitions
  wlcore: add p2p device support
  iwlwifi: 

[PATCH] ath10k: add missing mutex unlock on failpath

2015-08-19 Thread Michal Kazior
Kernel would complain about leaving a held lock
after going back to userspace and would
subsequently deadlock.

Fixes: e04cafbc38c7 (ath10k: fix peer limit enforcement)
Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Michal Kazior michal.kaz...@tieto.com
---
 drivers/net/wireless/ath/ath10k/mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index 9bca37820848..64674c955d44 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4144,7 +4144,8 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
 
if (ar-num_peers = ar-max_num_peers) {
ath10k_warn(ar, refusing vdev creation due to insufficient 
peer entry resources in firmware\n);
-   return -ENOBUFS;
+   ret = -ENOBUFS;
+   goto err;
}
 
if (ar-free_vdev_map == 0) {
-- 
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


[PATCH] ath10k: Add spectral scan support for 10.4 fw

2015-08-19 Thread Raja Mani
To enable/configure spectral scan parameters in 10.4 firmware, existing
wmi spectral related functions can be reused. Link those functions in
10.4 wmi ops table.

In addition, adjust bin size (only when size is 68 bytes) before reporting
bin samples to user space. The background for this adjustment is that
qca99x0 reports bin size as 68 bytes (64 bytes + 4 bytes) in report
mode 2. First 64 bytes carries in-band tones (-32 to +31) and last 4 byte
carries band edge detection data (+32) mainly used in radar detection
purpose. Additional last 4 bytes are stripped to make bin size valid one.

This bin size adjustment will happen only for qca99x0, all other chipsets
will report proper bin sizes (64/128) without extra 4 bytes being added
at the end. The changes are validated in qca99x0 using 10.4 firmware.

Signed-off-by: Raja Mani rm...@qti.qualcomm.com
---
 drivers/net/wireless/ath/ath10k/spectral.c | 9 +
 drivers/net/wireless/ath/ath10k/wmi.c  | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/spectral.c 
b/drivers/net/wireless/ath/ath10k/spectral.c
index e4219b1..4671cfb 100644
--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -73,6 +73,15 @@ int ath10k_spectral_process_fft(struct ath10k *ar,
if (bin_len  64 || bin_len  SPECTRAL_ATH10K_MAX_NUM_BINS)
return -EINVAL;
 
+   /* qca99x0 reports bin size as 68 bytes (64 bytes + 4 bytes) in
+* report mode 2. First 64 bytes carries inband tones (-32 to +31)
+* and last 4 byte carries band edge detection data (+32) mainly
+* used in radar detection purpose. Strip last 4 byte to make bin
+* size is valid one.
+*/
+   if (bin_len == 68)
+   bin_len -= 4;
+
reg0 = __le32_to_cpu(fftr-reg0);
reg1 = __le32_to_cpu(fftr-reg1);
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c 
b/drivers/net/wireless/ath/ath10k/wmi.c
index 42c0aba..5d19c87 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -6581,6 +6581,8 @@ static const struct wmi_ops wmi_10_4_ops = {
.gen_vdev_down = ath10k_wmi_op_gen_vdev_down,
.gen_vdev_set_param = ath10k_wmi_op_gen_vdev_set_param,
.gen_vdev_install_key = ath10k_wmi_op_gen_vdev_install_key,
+   .gen_vdev_spectral_conf = ath10k_wmi_op_gen_vdev_spectral_conf,
+   .gen_vdev_spectral_enable = ath10k_wmi_op_gen_vdev_spectral_enable,
.gen_peer_create = ath10k_wmi_op_gen_peer_create,
.gen_peer_delete = ath10k_wmi_op_gen_peer_delete,
.gen_peer_flush = ath10k_wmi_op_gen_peer_flush,
-- 
1.8.1.2

--
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 03/13] staging: wilc1000: wilc_msgqueue.c: remove multiple blank lines

2015-08-19 Thread Chaehyun Lim
This patch removes multiple blank lines.
CHECK: Please don't use multiple blank lines

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 7718c481..e7c4a9a 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -76,7 +76,6 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
WILC_NULLCHECK(s32RetStatus, pstrMessage-pvBuffer);
memcpy(pstrMessage-pvBuffer, pvSendBuffer, u32SendBufferSize);
 
-
/* add it to the message queue */
if (pHandle-pstrMessageList == NULL) {
pHandle-pstrMessageList  = pstrMessage;
@@ -107,8 +106,6 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
return s32RetStatus;
 }
 
-
-
 /*!
  *  @authorsyounan
  *  @date  1 Sep 2010
-- 
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 11/13] staging: wilc1000: rename WILC_MsgQueueSend to wilc_mq_send

2015-08-19 Thread Chaehyun Lim
This patch replaces WILC_MsgQueueSend with wilc_mq_send to
shorten function name and avoid CamelCase.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/host_interface.c | 98 +++
 drivers/staging/wilc1000/wilc_msgqueue.c  |  2 +-
 drivers/staging/wilc1000/wilc_msgqueue.h  |  2 +-
 3 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 159734f..6be2348 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3997,7 +3997,7 @@ static void ListenTimerCB(unsigned long arg)
strHostIFmsg.uniHostIFmsgBody.strHostIfRemainOnChan.u32ListenSessionID 
= pstrWFIDrv-strHostIfRemainOnChan.u32ListenSessionID;
 
/* send the message */
-   s32Error = WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   s32Error = wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
if (s32Error)
WILC_ERRORREPORT(s32Error, s32Error);
WILC_CATCH(s32Error)
@@ -4344,13 +4344,13 @@ static int hostIFthread(void *pvArg)
if ((!g_wilc_initialized)) {
PRINT_D(GENERIC_DBG, --WAIT--);
usleep_range(200 * 1000, 200 * 1000);
-   WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
continue;
}
 
if (strHostIFmsg.u16MsgId == HOST_IF_MSG_CONNECT  
pstrWFIDrv-strWILC_UsrScanReq.pfUserScanResult != NULL) {
PRINT_D(HOSTINF_DBG, Requeue connect request till scan 
done received\n);
-   WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
usleep_range(2 * 1000, 2 * 1000);
continue;
}
@@ -4557,7 +4557,7 @@ static void TimerCB_Scan(unsigned long arg)
strHostIFmsg.u16MsgId = HOST_IF_MSG_SCAN_TIMER_FIRED;
 
/* send the message */
-   WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, sizeof(tstrHostIFmsg));
+   wilc_mq_send(gMsgQHostIF, strHostIFmsg, sizeof(tstrHostIFmsg));
 }
 
 static void TimerCB_Connect(unsigned long arg)
@@ -4571,7 +4571,7 @@ static void TimerCB_Connect(unsigned long arg)
strHostIFmsg.u16MsgId = HOST_IF_MSG_CONNECT_TIMER_FIRED;
 
/* send the message */
-   WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, sizeof(tstrHostIFmsg));
+   wilc_mq_send(gMsgQHostIF, strHostIFmsg, sizeof(tstrHostIFmsg));
 }
 
 
@@ -4642,7 +4642,7 @@ s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 
u8keyIdx)
uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx;
 
/* send the message */
-   s32Error = WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   s32Error = wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
if (s32Error)
PRINT_ER(Error in sending message queue : Request to remove 
WEP key\n);
down((pstrWFIDrv-hSemTestKeyBlock));
@@ -4690,7 +4690,7 @@ s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv 
*hWFIDrv, u8 u8Index)
uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index;
 
/* send the message */
-   s32Error = WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   s32Error = wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
if (s32Error)
PRINT_ER(Error in sending message queue : Default key 
index\n);
down((pstrWFIDrv-hSemTestKeyBlock));
@@ -4757,7 +4757,7 @@ s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv 
*hWFIDrv, const u8 *pu8WepKey,
uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx;
 
/* send the message */
-   s32Error = WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   s32Error = wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
if (s32Error)
PRINT_ER(Error in sending message queue :WEP Key\n);
down((pstrWFIDrv-hSemTestKeyBlock));
@@ -4832,7 +4832,7 @@ s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, 
const u8 *pu8WepKey, u
strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.
uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type;
/* send the message */
-   s32Error = WILC_MsgQueueSend(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
+   s32Error = wilc_mq_send(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg));
 
if (s32Error)
PRINT_ER(Error in sending message queue :WEP Key\n);
@@ -4931,7 +4931,7 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 
*pu8Ptk, u8 u8PtkKeylen,
strHostIFmsg.drvHandler = 

[PATCH 04/13] staging: wilc1000: wilc_msgqueue.c: remove blank line before a close brace

2015-08-19 Thread Chaehyun Lim
This patch removes blank line before a close brace }
CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index e7c4a9a..8cb74d1 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -173,7 +173,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
kfree(pstrMessage);
 
spin_unlock_irqrestore(pHandle-strCriticalSection, flags);
-
}
 
WILC_CATCH(s32RetStatus)
-- 
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 09/13] staging: wilc1000: replace WILC_ErrNo by int type

2015-08-19 Thread Chaehyun Lim
This patch replaces WILC_ErrNo with int type.
WILC_ErrNo typedef is also removed.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_errorsupport.h |  2 --
 drivers/staging/wilc1000/wilc_msgqueue.c | 12 ++--
 drivers/staging/wilc1000/wilc_msgqueue.h |  8 
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_errorsupport.h 
b/drivers/staging/wilc1000/wilc_errorsupport.h
index b9517dc..6012ec4 100644
--- a/drivers/staging/wilc1000/wilc_errorsupport.h
+++ b/drivers/staging/wilc1000/wilc_errorsupport.h
@@ -36,8 +36,6 @@
 #define WILC_FILE_EOF  -116
 
 
-/* Error type */
-typedef s32 WILC_ErrNo;
 
 #define WILC_IS_ERR(__status__) (__status__  WILC_SUCCESS)
 
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index f974f85..f528f98 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -8,7 +8,7 @@
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
+int WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
 {
spin_lock_init(pHandle-strCriticalSection);
sema_init(pHandle-hSem, 0);
@@ -24,7 +24,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
+int WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
 {
pHandle-bExiting = true;
 
@@ -50,10 +50,10 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle 
*pHandle)
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+int WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize)
 {
-   WILC_ErrNo s32RetStatus = WILC_SUCCESS;
+   int s32RetStatus = WILC_SUCCESS;
unsigned long flags;
Message *pstrMessage = NULL;
 
@@ -110,12 +110,12 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength)
 {
Message *pstrMessage;
-   WILC_ErrNo s32RetStatus = WILC_SUCCESS;
+   int s32RetStatus = WILC_SUCCESS;
unsigned long flags;
 
if ((!pHandle) || (u32RecvBufferSize == 0)
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h 
b/drivers/staging/wilc1000/wilc_msgqueue.h
index ef1d2fa..a32c6db 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.h
+++ b/drivers/staging/wilc1000/wilc_msgqueue.h
@@ -27,7 +27,7 @@
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle);
+int WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle);
 
 /*!
  *  @brief Sends a message
@@ -44,7 +44,7 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle);
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
+int WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
 const void *pvSendBuffer, u32 u32SendBufferSize);
 
 /*!
@@ -63,7 +63,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength);
 
@@ -76,6 +76,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle);
+int WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle);
 
 #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 05/13] staging: wilc1000: wilc_msgqueue.c: remove unnecessary parentheses

2015-08-19 Thread Chaehyun Lim
This patch remove unnecessary parentheses found by checkpatch.pl
CHECK: Unnecessary parentheses around pHandle-hSem

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 8cb74d1..53ce586 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -30,7 +30,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
 
/* Release any waiting receiver thread. */
while (pHandle-u32ReceiversCount  0) {
-   up((pHandle-hSem));
+   up(pHandle-hSem);
pHandle-u32ReceiversCount--;
}
 
@@ -133,7 +133,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
pHandle-u32ReceiversCount++;
spin_unlock_irqrestore(pHandle-strCriticalSection, flags);
 
-   down((pHandle-hSem));
+   down(pHandle-hSem);
 
if (s32RetStatus == WILC_TIMEOUT) {
/* timed out, just exit without consumeing the message */
-- 
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 07/13] staging: wilc1000: wilc_msgqueue.c: remove kfree NULL check

2015-08-19 Thread Chaehyun Lim
This patch removes kfree NULL check.
WARNING: kfree(NULL) is safe and this check is probably not required.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 0770ff6..d97dd70 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -96,9 +96,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
{
/* error occured, free any allocations */
if (pstrMessage) {
-   if (pstrMessage-pvBuffer)
-   kfree(pstrMessage-pvBuffer);
-
+   kfree(pstrMessage-pvBuffer);
kfree(pstrMessage);
}
}
-- 
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 08/13] staging: wilc1000: wilc_msgqueue.c: fix bool comparison style

2015-08-19 Thread Chaehyun Lim
This patch changes bool comparison style found by checkpatch.pl
CHECK: Using comparison to true is error prone

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index d97dd70..f974f85 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -61,7 +61,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
}
 
-   if (pHandle-bExiting == true) {
+   if (pHandle-bExiting) {
WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
}
 
@@ -123,7 +123,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
}
 
-   if (pHandle-bExiting == true) {
+   if (pHandle-bExiting) {
WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
}
 
-- 
1.9.1

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


[PATCH 06/13] staging: wilc1000: wilc_msgqueue.c: use ! operator instead of NULL comparison

2015-08-19 Thread Chaehyun Lim
This patch uses ! operator instead of NULL comparison.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 53ce586..0770ff6 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -34,7 +34,7 @@ WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
pHandle-u32ReceiversCount--;
}
 
-   while (pHandle-pstrMessageList != NULL) {
+   while (pHandle-pstrMessageList) {
Message *pstrMessge = pHandle-pstrMessageList-pstrNext;
 
kfree(pHandle-pstrMessageList);
@@ -57,7 +57,7 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
unsigned long flags;
Message *pstrMessage = NULL;
 
-   if ((pHandle == NULL) || (u32SendBufferSize == 0) || (pvSendBuffer == 
NULL)) {
+   if ((!pHandle) || (u32SendBufferSize == 0) || (!pvSendBuffer)) {
WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
}
 
@@ -77,12 +77,12 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
memcpy(pstrMessage-pvBuffer, pvSendBuffer, u32SendBufferSize);
 
/* add it to the message queue */
-   if (pHandle-pstrMessageList == NULL) {
+   if (!pHandle-pstrMessageList) {
pHandle-pstrMessageList  = pstrMessage;
} else {
Message *pstrTailMsg = pHandle-pstrMessageList;
 
-   while (pstrTailMsg-pstrNext != NULL)
+   while (pstrTailMsg-pstrNext)
pstrTailMsg = pstrTailMsg-pstrNext;
 
pstrTailMsg-pstrNext = pstrMessage;
@@ -95,8 +95,8 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
WILC_CATCH(s32RetStatus)
{
/* error occured, free any allocations */
-   if (pstrMessage != NULL) {
-   if (pstrMessage-pvBuffer != NULL)
+   if (pstrMessage) {
+   if (pstrMessage-pvBuffer)
kfree(pstrMessage-pvBuffer);
 
kfree(pstrMessage);
@@ -120,8 +120,8 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
WILC_ErrNo s32RetStatus = WILC_SUCCESS;
unsigned long flags;
 
-   if ((pHandle == NULL) || (u32RecvBufferSize == 0)
-   || (pvRecvBuffer == NULL) || (pu32ReceivedLength == NULL)) {
+   if ((!pHandle) || (u32RecvBufferSize == 0)
+   || (!pvRecvBuffer) || (!pu32ReceivedLength)) {
WILC_ERRORREPORT(s32RetStatus, WILC_INVALID_ARGUMENT);
}
 
@@ -151,7 +151,7 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
spin_lock_irqsave(pHandle-strCriticalSection, flags);
 
pstrMessage = pHandle-pstrMessageList;
-   if (pstrMessage == NULL) {
+   if (!pstrMessage) {
spin_unlock_irqrestore(pHandle-strCriticalSection, 
flags);
WILC_ERRORREPORT(s32RetStatus, WILC_FAIL);
}
-- 
1.9.1

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


[PATCH 01/13] staging: wilc1000: wilc_msgqueue.c: remove braces for single statement

2015-08-19 Thread Chaehyun Lim
This patch removes braces for single statement blocks.
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index f047d62..fcf3a29 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -84,9 +84,9 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
} else {
Message *pstrTailMsg = pHandle-pstrMessageList;
 
-   while (pstrTailMsg-pstrNext != NULL) {
+   while (pstrTailMsg-pstrNext != NULL)
pstrTailMsg = pstrTailMsg-pstrNext;
-   }
+
pstrTailMsg-pstrNext = pstrMessage;
}
 
@@ -98,9 +98,9 @@ WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
{
/* error occured, free any allocations */
if (pstrMessage != NULL) {
-   if (pstrMessage-pvBuffer != NULL) {
+   if (pstrMessage-pvBuffer != NULL)
kfree(pstrMessage-pvBuffer);
-   }
+
kfree(pstrMessage);
}
}
-- 
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 12/13] staging: wilc1000: rename WILC_MsgQueueRecv to wilc_mq_recv

2015-08-19 Thread Chaehyun Lim
This patch replaces WILC_MsgQueueRecv with wilc_mq_recv
to shorten function name and avoid CamelCase.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 drivers/staging/wilc1000/wilc_msgqueue.c  | 2 +-
 drivers/staging/wilc1000/wilc_msgqueue.h  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 6be2348..f0a1383 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4332,7 +4332,7 @@ static int hostIFthread(void *pvArg)
memset(strHostIFmsg, 0, sizeof(tstrHostIFmsg));
 
while (1) {
-   WILC_MsgQueueRecv(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg), u32Ret);
+   wilc_mq_recv(gMsgQHostIF, strHostIFmsg, 
sizeof(tstrHostIFmsg), u32Ret);
pstrWFIDrv = (tstrWILC_WFIDrv *)strHostIFmsg.drvHandler;
if (strHostIFmsg.u16MsgId == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, THREAD: Exiting HostIfThread\n);
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index b5d230b..6015098 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -110,7 +110,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-int WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength)
 {
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h 
b/drivers/staging/wilc1000/wilc_msgqueue.h
index 197b0a9..143fba4 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.h
+++ b/drivers/staging/wilc1000/wilc_msgqueue.h
@@ -63,7 +63,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-int WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
+int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength);
 
-- 
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 13/13] staging: wilc1000: rename WILC_MsgQueueDestroy to wilc_mq_destroy

2015-08-19 Thread Chaehyun Lim
This patch replaces WILC_MsgQueueDestroy to wilc_mq_destroy to
shorten function name and avoid CamelCase.

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/host_interface.c | 4 ++--
 drivers/staging/wilc1000/wilc_msgqueue.c  | 2 +-
 drivers/staging/wilc1000/wilc_msgqueue.h  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f0a1383..d411847 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6616,7 +6616,7 @@ _fail_timer_2:
del_timer_sync(pstrWFIDrv-hScanTimer);
kthread_stop(HostIFthreadHandler);
 _fail_mq_:
-   WILC_MsgQueueDestroy(gMsgQHostIF);
+   wilc_mq_destroy(gMsgQHostIF);
 _fail_:
return s32Error;
 
@@ -6717,7 +6717,7 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv)
 
down(hSemHostIFthrdEnd);
 
-   WILC_MsgQueueDestroy(gMsgQHostIF);
+   wilc_mq_destroy(gMsgQHostIF);
msgQ_created = 0;
}
 
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index 6015098..76d2e63 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -24,7 +24,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle)
  *  @note  copied from FLO glue implementatuion
  *  @version   1.0
  */
-int WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
+int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)
 {
pHandle-bExiting = true;
 
diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h 
b/drivers/staging/wilc1000/wilc_msgqueue.h
index 143fba4..fc65dfe 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.h
+++ b/drivers/staging/wilc1000/wilc_msgqueue.h
@@ -76,6 +76,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,
  *  @date  30 Aug 2010
  *  @version   1.0
  */
-int WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle);
+int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle);
 
 #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 02/13] staging: wilc1000: wilc_msgqueue.c: remove blank line after open brace

2015-08-19 Thread Chaehyun Lim
This patch removes a blank line for open brace {
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Chaehyun Lim chaehyun@gmail.com
---
 drivers/staging/wilc1000/wilc_msgqueue.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c 
b/drivers/staging/wilc1000/wilc_msgqueue.c
index fcf3a29..7718c481 100644
--- a/drivers/staging/wilc1000/wilc_msgqueue.c
+++ b/drivers/staging/wilc1000/wilc_msgqueue.c
@@ -26,7 +26,6 @@ WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle)
  */
 WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle)
 {
-
pHandle-bExiting = true;
 
/* Release any waiting receiver thread. */
@@ -120,7 +119,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
 void *pvRecvBuffer, u32 u32RecvBufferSize,
 u32 *pu32ReceivedLength)
 {
-
Message *pstrMessage;
WILC_ErrNo s32RetStatus = WILC_SUCCESS;
unsigned long flags;
-- 
1.9.1

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


[PATCH 1/2] ath9k: fix AR_RX_FILTER for ar9462/ar9565 when rx stopped

2015-08-19 Thread miaoqing
From: Miaoqing Pan miaoq...@qca.qualcomm.com

When rx stopped, AR_RX_FILTER should be cleared, but in
ath9k_hw_setrxfilter(), ATH9K_RX_FILTER_CONTROL_WRAPPER will always
be set for ar9462/ar9565.

Fix this by moving the code in ath9k_hw_setrxfilter() to
ath_calcrxfilter().

Signed-off-by: Miaoqing Pan miaoq...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/hw.c   | 3 ---
 drivers/net/wireless/ath/ath9k/recv.c | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index a31a680..0e2b28c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2760,9 +2760,6 @@ void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
 
ENABLE_REGWRITE_BUFFER(ah);
 
-   if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
-   bits |= ATH9K_RX_FILTER_CONTROL_WRAPPER;
-
REG_WRITE(ah, AR_RX_FILTER, bits);
 
phybits = 0;
diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
b/drivers/net/wireless/ath/ath9k/recv.c
index d3189da..bb11d5a 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -424,6 +424,9 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
AR_SREV_9561(sc-sc_ah))
rfilt |= ATH9K_RX_FILTER_4ADDRESS;
 
+   if (AR_SREV_9462(ah) || AR_SREV_9565(ah))
+   bits |= ATH9K_RX_FILTER_CONTROL_WRAPPER;
+
if (ath9k_is_chanctx_enabled() 
test_bit(ATH_OP_SCANNING, common-op_flags))
rfilt |= ATH9K_RX_FILTER_BEACON;
-- 
1.9.1

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


[PATCH 2/2] ath9k: fix incorrect calibration initial for ar9561

2015-08-19 Thread miaoqing
From: Miaoqing Pan miaoq...@qca.qualcomm.com

One stuck issue was found on AP152, the root cause is using wrong
calibration initial function.

Signed-off-by: Miaoqing Pan miaoq...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/ar9003_calib.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c 
b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 174442b..3880df7 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -1310,7 +1310,8 @@ static void ar9003_hw_do_pcoem_manual_peak_cal(struct 
ath_hw *ah,
struct ath9k_hw_cal_data *caldata = ah-caldata;
int i;
 
-   if (!AR_SREV_9462(ah)  !AR_SREV_9565(ah)  !AR_SREV_9485(ah))
+   if (!AR_SREV_9462(ah)  !AR_SREV_9565(ah)  !AR_SREV_9485(ah) 
+   !AR_SREV_9561(ah))
return;
 
if ((ah-caps.hw_caps  ATH9K_HW_CAP_RTT)  !run_rtt_cal)
@@ -1707,7 +1708,8 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah)
struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
struct ath_hw_ops *ops = ath9k_hw_ops(ah);
 
-   if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah))
+   if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah) ||
+   AR_SREV_9561(ah))
priv_ops-init_cal = ar9003_hw_init_cal_pcoem;
else
priv_ops-init_cal = ar9003_hw_init_cal_soc;
-- 
1.9.1

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


Re: [PATCH 5/5] staging: wilc1000: use id value as argument

2015-08-19 Thread Dan Carpenter

 Real ID value means the value mapped to an alive NIC handler.

Who is mapping it?  It's all within the driver so it is not real
unless there external requirements.

 And when the driver transmits and receives some data frame with chipset,
 the ID is used to distinguish the data frame's owner. Just like the driver,
 chipset uses the appointed identifier. the data frame always includes the
 identifier.

Yes.  But it uses whatever we give it, otherwise it will break when we
change this.

 You know, current driver is using 32bit pointer address as the identifier.
 So, this patch converts the address value to integer value. As mentioned
 earlier, '0' value is the reserved value to terminate an alive NIC handler
 and inform it to chipset.

Ah... I see now.  In the original code we used pointers and NULL meant
disconnect.  Now we are using integers but we still want zero to be
disconnect.  Fine, just make the array one pointer larger, it's not
worth the extra headache (the first version had off by one bugs, and the
second version still had an off by one bug even after I pointed them out
in the first version), just to save 8 bytes:

/* Zero is not used, because a zero ID means disconnect */
static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1];

static int add_handler_in_list(tstrWILC_WFIDrv *handler)
{
int i;

for (i = 1; i  ARRAY_SIZE(wfidrv_list); i++) {
if (!wfidrv_list[i]) {
wfidrv_list[i] = handler;
return 0;
}
}

return -ENOBUFS;
}

static int remove_handler_in_list(tstrWILC_WFIDrv *handler)
{
int i;

for (i = 1; i  ARRAY_SIZE(wfidrv_list); i++) {
if (wfidrv_list[i] == handler) {
wfidrv_list[i] = NULL;
return 0;
}
}

return -EINVAL;
}

static int get_id_from_handler(tstrWILC_WFIDrv *handler)
{
int i;

if (!handler)
return 0;

for (i = 1; i  ARRAY_SIZE(wfidrv_list); i++) {
if (wfidrv_list[i] == handler)
return i;
}

return 0;
}

static tstrWILC_WFIDrv *get_handler_from_id(int id)
{
if (id = 0 || id = ARRAY_SIZE(wfidrv_list))
return NULL;

return wfidrv_list[id];
}

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


[PATCH 2/4] ath5k: use DECLARE_EWMA

2015-08-19 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

This reduces code size slightly (at least on x86/64) while also
removing memory consumption by two unsigned long values for each
ath5k device.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 drivers/net/wireless/ath/ath5k/Kconfig | 1 -
 drivers/net/wireless/ath/ath5k/ani.c   | 4 ++--
 drivers/net/wireless/ath/ath5k/ath5k.h | 4 +++-
 drivers/net/wireless/ath/ath5k/base.c  | 4 ++--
 drivers/net/wireless/ath/ath5k/debug.c | 2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/Kconfig 
b/drivers/net/wireless/ath/ath5k/Kconfig
index 2399a3921762..b1278f9f24ba 100644
--- a/drivers/net/wireless/ath/ath5k/Kconfig
+++ b/drivers/net/wireless/ath/ath5k/Kconfig
@@ -5,7 +5,6 @@ config ATH5K
select MAC80211_LEDS
select LEDS_CLASS
select NEW_LEDS
-   select AVERAGE
select ATH5K_AHB if ATH25
select ATH5K_PCI if !ATH25
---help---
diff --git a/drivers/net/wireless/ath/ath5k/ani.c 
b/drivers/net/wireless/ath/ath5k/ani.c
index 5c008757662b..38be2702c0e2 100644
--- a/drivers/net/wireless/ath/ath5k/ani.c
+++ b/drivers/net/wireless/ath/ath5k/ani.c
@@ -223,7 +223,7 @@ static void
 ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
 bool ofdm_trigger)
 {
-   int rssi = ewma_read(ah-ah_beacon_rssi_avg);
+   int rssi = ewma_beacon_rssi_read(ah-ah_beacon_rssi_avg);
 
ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, raise immunity (%s),
ofdm_trigger ? ODFM : CCK);
@@ -309,7 +309,7 @@ ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct 
ath5k_ani_state *as,
 static void
 ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
 {
-   int rssi = ewma_read(ah-ah_beacon_rssi_avg);
+   int rssi = ewma_beacon_rssi_read(ah-ah_beacon_rssi_avg);
 
ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, lower immunity);
 
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h 
b/drivers/net/wireless/ath/ath5k/ath5k.h
index e22b0e778927..fa6e89e5c421 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1252,6 +1252,8 @@ struct ath5k_statistics {
 #define ATH5K_TXQ_LEN_MAX  (ATH_TXBUF / 4) /* bufs per queue */
 #define ATH5K_TXQ_LEN_LOW  (ATH5K_TXQ_LEN_MAX / 2) /* low mark */
 
+DECLARE_EWMA(beacon_rssi, 1024, 8)
+
 /* Driver state associated with an instance of a device */
 struct ath5k_hw {
struct ath_common   common;
@@ -1432,7 +1434,7 @@ struct ath5k_hw {
struct ath5k_nfcal_hist ah_nfcal_hist;
 
/* average beacon RSSI in our BSS (used by ANI) */
-   struct ewma ah_beacon_rssi_avg;
+   struct ewma_beacon_rssi ah_beacon_rssi_avg;
 
/* noise floor from last periodic calibration */
s32 ah_noise_floor;
diff --git a/drivers/net/wireless/ath/ath5k/base.c 
b/drivers/net/wireless/ath/ath5k/base.c
index 23552f43d125..342563a3706f 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1430,7 +1430,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff 
*skb,
trace_ath5k_rx(ah, skb);
 
if (ath_is_mybeacon(common, (struct ieee80211_hdr *)skb-data)) {
-   ewma_add(ah-ah_beacon_rssi_avg, rs-rs_rssi);
+   ewma_beacon_rssi_add(ah-ah_beacon_rssi_avg, rs-rs_rssi);
 
/* check beacons in IBSS mode */
if (ah-opmode == NL80211_IFTYPE_ADHOC)
@@ -2936,7 +2936,7 @@ ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel 
*chan,
ah-ah_cal_next_short = jiffies +
msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT);
 
-   ewma_init(ah-ah_beacon_rssi_avg, 1024, 8);
+   ewma_beacon_rssi_init(ah-ah_beacon_rssi_avg);
 
/* clear survey data and cycle counters */
memset(ah-survey, 0, sizeof(ah-survey));
diff --git a/drivers/net/wireless/ath/ath5k/debug.c 
b/drivers/net/wireless/ath/ath5k/debug.c
index c70782e8f07b..654a1e33f827 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -722,7 +722,7 @@ static ssize_t read_file_ani(struct file *file, char __user 
*user_buf,
st-mib_intr);
len += snprintf(buf + len, sizeof(buf) - len,
beacon RSSI average:\t%d\n,
-   (int)ewma_read(ah-ah_beacon_rssi_avg));
+   (int)ewma_beacon_rssi_read(ah-ah_beacon_rssi_avg));
 
 #define CC_PRINT(_struct, _field) \
_struct._field, \
-- 
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


[PATCH 0/4] average: convert users to inline implementation

2015-08-19 Thread Johannes Berg
Since there's very little benefit of the out-of-line implementation
(a single byte of .text in one driver as far as I've seen), convert
all drivers to the inline implementation, saving memory, and remove
the out-of-line implementation.

Perhaps the easiest would be for Dave to take all of these patches?

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


[PATCH 3/4] rt2x00: use DECLARE_EWMA

2015-08-19 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

Instead of using the out-of-line EWMA calculation, use DECLARE_EWMA()
to create static inlines. On x86/64 this results in code that's one
byte larger (for me), but reduces struct link_ant and struct link
size by the two unsigned long values that store the parameters each.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 drivers/net/wireless/rt2x00/Kconfig  |  1 -
 drivers/net/wireless/rt2x00/rt2x00.h |  6 --
 drivers/net/wireless/rt2x00/rt2x00link.c | 18 ++
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/Kconfig 
b/drivers/net/wireless/rt2x00/Kconfig
index 2b4ef256c6b9..de62f5dcb62f 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -240,7 +240,6 @@ config RT2X00_LIB_USB
 
 config RT2X00_LIB
tristate
-   select AVERAGE
 
 config RT2X00_LIB_FIRMWARE
bool
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h 
b/drivers/net/wireless/rt2x00/rt2x00.h
index 9bb398bed9bb..3282ddb766f4 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -254,6 +254,8 @@ struct link_qual {
int tx_failed;
 };
 
+DECLARE_EWMA(rssi, 1024, 8)
+
 /*
  * Antenna settings about the currently active link.
  */
@@ -285,7 +287,7 @@ struct link_ant {
 * Similar to the avg_rssi in the link_qual structure
 * this value is updated by using the walking average.
 */
-   struct ewma rssi_ant;
+   struct ewma_rssi rssi_ant;
 };
 
 /*
@@ -314,7 +316,7 @@ struct link {
/*
 * Currently active average RSSI value
 */
-   struct ewma avg_rssi;
+   struct ewma_rssi avg_rssi;
 
/*
 * Work structure for scheduling periodic link tuning.
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c 
b/drivers/net/wireless/rt2x00/rt2x00link.c
index 9b941c0c1264..017188e5a736 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -33,15 +33,11 @@
  */
 #define DEFAULT_RSSI   -128
 
-/* Constants for EWMA calculations. */
-#define RT2X00_EWMA_FACTOR 1024
-#define RT2X00_EWMA_WEIGHT 8
-
-static inline int rt2x00link_get_avg_rssi(struct ewma *ewma)
+static inline int rt2x00link_get_avg_rssi(struct ewma_rssi *ewma)
 {
unsigned long avg;
 
-   avg = ewma_read(ewma);
+   avg = ewma_rssi_read(ewma);
if (avg)
return -avg;
 
@@ -76,8 +72,7 @@ static void rt2x00link_antenna_update_rssi_history(struct 
rt2x00_dev *rt2x00dev,
 
 static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
 {
-   ewma_init(rt2x00dev-link.ant.rssi_ant, RT2X00_EWMA_FACTOR,
- RT2X00_EWMA_WEIGHT);
+   ewma_rssi_init(rt2x00dev-link.ant.rssi_ant);
 }
 
 static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
@@ -225,12 +220,12 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
/*
 * Update global RSSI
 */
-   ewma_add(link-avg_rssi, -rxdesc-rssi);
+   ewma_rssi_add(link-avg_rssi, -rxdesc-rssi);
 
/*
 * Update antenna RSSI
 */
-   ewma_add(ant-rssi_ant, -rxdesc-rssi);
+   ewma_rssi_add(ant-rssi_ant, -rxdesc-rssi);
 }
 
 void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
@@ -285,8 +280,7 @@ void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, 
bool antenna)
 */
rt2x00dev-link.count = 0;
memset(qual, 0, sizeof(*qual));
-   ewma_init(rt2x00dev-link.avg_rssi, RT2X00_EWMA_FACTOR,
- RT2X00_EWMA_WEIGHT);
+   ewma_rssi_init(rt2x00dev-link.avg_rssi);
 
/*
 * Restore the VGC level as stored in the registers,
-- 
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


[PATCH 1/4] virtio_net: use DECLARE_EWMA

2015-08-19 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

Instead of using the out-of-line EWMA calculation, use DECLARE_EWMA()
to create static inlines. On x86/64 this results in no change in code
size for me, but reduces the struct receive_queue size by the two
unsigned long values that store the parameters.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 drivers/net/Kconfig  |  1 -
 drivers/net/virtio_net.c | 22 +++---
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index e58468b02987..f50373645ab4 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -282,7 +282,6 @@ config VETH
 config VIRTIO_NET
tristate Virtio network driver
depends on VIRTIO
-   select AVERAGE
---help---
  This is the virtual network driver for virtio.  It can be used with
  lguest or QEMU based VMMs (like KVM or Xen).  Say Y or M.
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 546b669fbfdd..9b950f2db836 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -40,12 +40,12 @@ module_param(gso, bool, 0444);
 #define GOOD_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
 #define GOOD_COPY_LEN  128
 
-/* Weight used for the RX packet size EWMA. The average packet size is used to
- * determine the packet buffer size when refilling RX rings. As the entire RX
- * ring may be refilled at once, the weight is chosen so that the EWMA will be
- * insensitive to short-term, transient changes in packet size.
+/* RX packet size EWMA. The average packet size is used to determine the packet
+ * buffer size when refilling RX rings. As the entire RX ring may be refilled
+ * at once, the weight is chosen so that the EWMA will be insensitive to short-
+ * term, transient changes in packet size.
  */
-#define RECEIVE_AVG_WEIGHT 64
+DECLARE_EWMA(pkt_len, 1, 64)
 
 /* Minimum alignment for mergeable packet buffers. */
 #define MERGEABLE_BUFFER_ALIGN max(L1_CACHE_BYTES, 256)
@@ -85,7 +85,7 @@ struct receive_queue {
struct page *pages;
 
/* Average packet length for mergeable receive buffers. */
-   struct ewma mrg_avg_pkt_len;
+   struct ewma_pkt_len mrg_avg_pkt_len;
 
/* Page frag for packet buffer allocation. */
struct page_frag alloc_frag;
@@ -407,7 +407,7 @@ static struct sk_buff *receive_mergeable(struct net_device 
*dev,
}
}
 
-   ewma_add(rq-mrg_avg_pkt_len, head_skb-len);
+   ewma_pkt_len_add(rq-mrg_avg_pkt_len, head_skb-len);
return head_skb;
 
 err_skb:
@@ -600,12 +600,12 @@ static int add_recvbuf_big(struct virtnet_info *vi, 
struct receive_queue *rq,
return err;
 }
 
-static unsigned int get_mergeable_buf_len(struct ewma *avg_pkt_len)
+static unsigned int get_mergeable_buf_len(struct ewma_pkt_len *avg_pkt_len)
 {
const size_t hdr_len = sizeof(struct virtio_net_hdr_mrg_rxbuf);
unsigned int len;
 
-   len = hdr_len + clamp_t(unsigned int, ewma_read(avg_pkt_len),
+   len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len),
GOOD_PACKET_LEN, PAGE_SIZE - hdr_len);
return ALIGN(len, MERGEABLE_BUFFER_ALIGN);
 }
@@ -1615,7 +1615,7 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
napi_hash_add(vi-rq[i].napi);
 
sg_init_table(vi-rq[i].sg, ARRAY_SIZE(vi-rq[i].sg));
-   ewma_init(vi-rq[i].mrg_avg_pkt_len, 1, RECEIVE_AVG_WEIGHT);
+   ewma_pkt_len_init(vi-rq[i].mrg_avg_pkt_len);
sg_init_table(vi-sq[i].sg, ARRAY_SIZE(vi-sq[i].sg));
}
 
@@ -1658,7 +1658,7 @@ static ssize_t mergeable_rx_buffer_size_show(struct 
netdev_rx_queue *queue,
 {
struct virtnet_info *vi = netdev_priv(queue-dev);
unsigned int queue_index = get_netdev_rx_queue_index(queue);
-   struct ewma *avg;
+   struct ewma_pkt_len *avg;
 
BUG_ON(queue_index = vi-max_queue_pairs);
avg = vi-rq[queue_index].mrg_avg_pkt_len;
-- 
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


[PATCH 4/4] average: remove out-of-line implementation

2015-08-19 Thread Johannes Berg
From: Johannes Berg johannes.b...@intel.com

Since all users are now converted to the inline implementation,
remove the out-of-line implementation entirely.

Signed-off-by: Johannes Berg johannes.b...@intel.com
---
 include/linux/average.h | 24 ---
 lib/Kconfig | 10 
 lib/average.c   | 64 -
 3 files changed, 98 deletions(-)
 delete mode 100644 lib/average.c

diff --git a/include/linux/average.h b/include/linux/average.h
index 60f8226c5652..d04aa58280de 100644
--- a/include/linux/average.h
+++ b/include/linux/average.h
@@ -3,30 +3,6 @@
 
 /* Exponentially weighted moving average (EWMA) */
 
-/* For more documentation see lib/average.c */
-
-struct ewma {
-   unsigned long internal;
-   unsigned long factor;
-   unsigned long weight;
-};
-
-extern void ewma_init(struct ewma *avg, unsigned long factor,
- unsigned long weight);
-
-extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);
-
-/**
- * ewma_read() - Get average value
- * @avg: Average structure
- *
- * Returns the average value held in @avg.
- */
-static inline unsigned long ewma_read(const struct ewma *avg)
-{
-   return avg-internal  avg-factor;
-}
-
 #define DECLARE_EWMA(name, _factor, _weight)   \
struct ewma_##name {\
unsigned long internal; \
diff --git a/lib/Kconfig b/lib/Kconfig
index 3a2ef67db6c7..278890dd1049 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -460,16 +460,6 @@ config ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 config LRU_CACHE
tristate
 
-config AVERAGE
-   bool Averaging functions
-   help
- This option is provided for the case where no in-kernel-tree
- modules require averaging functions, but a module built outside
- the kernel tree does. Such modules that use library averaging
- functions require Y here.
-
- If unsure, say N.
-
 config CLZ_TAB
bool
 
diff --git a/lib/average.c b/lib/average.c
deleted file mode 100644
index 114d1beae0c7..
--- a/lib/average.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * lib/average.c
- *
- * This source code is licensed under the GNU General Public License,
- * Version 2.  See the file COPYING for more details.
- */
-
-#include linux/export.h
-#include linux/average.h
-#include linux/kernel.h
-#include linux/bug.h
-#include linux/log2.h
-
-/**
- * DOC: Exponentially Weighted Moving Average (EWMA)
- *
- * These are generic functions for calculating Exponentially Weighted Moving
- * Averages (EWMA). We keep a structure with the EWMA parameters and a scaled
- * up internal representation of the average value to prevent rounding errors.
- * The factor for scaling up and the exponential weight (or decay rate) have to
- * be specified thru the init fuction. The structure should not be accessed
- * directly but only thru the helper functions.
- */
-
-/**
- * ewma_init() - Initialize EWMA parameters
- * @avg: Average structure
- * @factor: Factor to use for the scaled up internal value. The maximum value
- * of averages can be ULONG_MAX/(factor*weight). For performance reasons
- * factor has to be a power of 2.
- * @weight: Exponential weight, or decay rate. This defines how fast the
- * influence of older values decreases. For performance reasons weight has
- * to be a power of 2.
- *
- * Initialize the EWMA parameters for a given struct ewma @avg.
- */
-void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight)
-{
-   WARN_ON(!is_power_of_2(weight) || !is_power_of_2(factor));
-
-   avg-weight = ilog2(weight);
-   avg-factor = ilog2(factor);
-   avg-internal = 0;
-}
-EXPORT_SYMBOL(ewma_init);
-
-/**
- * ewma_add() - Exponentially weighted moving average (EWMA)
- * @avg: Average structure
- * @val: Current value
- *
- * Add a sample to the average.
- */
-struct ewma *ewma_add(struct ewma *avg, unsigned long val)
-{
-   unsigned long internal = ACCESS_ONCE(avg-internal);
-
-   ACCESS_ONCE(avg-internal) = internal ?
-   (((internal  avg-weight) - internal) +
-   (val  avg-factor))  avg-weight :
-   (val  avg-factor);
-   return avg;
-}
-EXPORT_SYMBOL(ewma_add);
-- 
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 5/5] staging: wilc1000: use id value as argument

2015-08-19 Thread Johnny Kim

Hello Dan.
On 2015년 08월 18일 18:12, Dan Carpenter wrote:

On Tue, Aug 18, 2015 at 12:10:53PM +0900, Johnny Kim wrote:

Hello Dan.

On 2015년 08월 13일 23:49, Dan Carpenter wrote:

On Thu, Aug 13, 2015 at 01:41:23PM +0900, Tony Cho wrote:

+static u32 get_id_from_handler(tstrWILC_WFIDrv *handler)
+{
+   u32 id;
+
+   if (!handler)
+   return 0;
+
+   for (id = 0; id  NUM_CONCURRENT_IFC; id++) {
+   if (wfidrv_list[id] == handler) {
+   id += 1;
+   break;
+   }
+   }
+
+   if (id  NUM_CONCURRENT_IFC)
+   return 0;
+   else
+   return id;
+}
+

This still has an off by one bug.  Just use zero offset arrays
throughout.

static int get_id_from_handler(tstrWILC_WFIDrv *handler)
{
int id;

if (!handler)
return -ENOBUFS;

for (id = 0; id  NUM_CONCURRENT_IFC; id++) {
if (wfidrv_list[id] == handler)
return id;
}

return -ENOBUFS;
}

Thanks for your review. The return value of this function has from 0 till 2.
1 and 2 value is real ID value. only 0 value is reserved to remove a
registered id.
But I also think that error handling should be added about the
overflowed value
as your opinion.

I thought we had created id here in this patch so we don't have to
pass function pointers through a u32 value (which can't fit a 64 bit
pointer).  What do you mean it is a real ID value?  Is it there in
the hardware spec?

Real ID value means the value mapped to an alive NIC handler.
And when the driver transmits and receives some data frame with chipset,
the ID is used to distinguish the data frame's owner. Just like the driver,
chipset uses the appointed identifier. the data frame always includes the
identifier.
You know, current driver is using 32bit pointer address as the identifier.
So, this patch converts the address value to integer value. As mentioned
earlier, '0' value is the reserved value to terminate an alive NIC handler
and inform it to chipset.

Anyway, this code is buggy and messy.  Please find a different way to
write it.


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


Re: [PATCH v2 2/2] ath9k: fix incorrect calibration initial for ar9561

2015-08-19 Thread Sujith Manoharan
miaoq...@qti.qualcomm.com wrote:
 - if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah))
 + if (AR_SREV_9485(ah) || AR_SREV_9462(ah) || AR_SREV_9565(ah) ||
 + AR_SREV_9561(ah))
   priv_ops-init_cal = ar9003_hw_init_cal_pcoem;
   else
   priv_ops-init_cal = ar9003_hw_init_cal_soc;

Are you sure about this ? AR9561 is not a PCOEM chip, IIRC.
Maybe the SoC routine is missing some code changes for AR956x ?

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