Re: IPW2200 Driver for Linux

2015-10-21 Thread Rafał Miłecki
On 21 October 2015 at 15:19, Christoph Sauer  wrote:
> Hello, do you still have the IPW2200 Linux driver for Lenovo Thinkpad t42
> notebook? I have an old notebook from a friend which i want to install linux
> on it, and i am searching for the wifi driver for days.
>
> http://ipw2200.sourceforge.net/index.php

It's part of the upstream kernel for *years*:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/net/wireless/ipw2x00
--
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] fixup! staging/wilc1000: split out bus specific modules

2015-10-21 Thread Arnd Bergmann
The patch to split out bus modules causes new valid build warnings without this.

Signed-off-by: Arnd Bergmann 

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..fe3b464f0d5c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,7 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct 
wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
+void wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
if (wilc_debugfs_init() < 0)
@@ -1606,7 +1606,7 @@ void __init wilc1000_init_driver(void)
 }
 EXPORT_SYMBOL_GPL(wilc1000_init_driver);
 
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,7 +1653,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
-void __exit wilc1000_exit_driver(void)
+void wilc1000_exit_driver(void)
 {
kfree(wilc1000_dev);
wilc1000_dev = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..b460b7f6971a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,7 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
+void wilc1000_init_driver(void);
+void wilc1000_exit_driver(void);
 
 #endif



--
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: mac80211-next 2015-10-21

2015-10-21 Thread Johannes Berg
Hi,

Here's another, likely final, pull request for -next. I finally caved
in and cleaned up the regulatory code a bit, which is the bulk of the
changes.

There's a new Kconfig which allows turning off CRDA, but it's hidden
behind having the internal regdb enabled, which in turn is hidden
behind EXPERT, so hopefully you won't even see that :) (although I am
hoping to get rid of the internal regdb sooner rather than later)

Let me know if you see any problems.

Thanks,
johannes




The following changes since commit 6623c60dc28ee966cd85c6f12aa2fc3c952d0179:

  bridge: vlan: enforce no pvid flag in vlan ranges (2015-10-12 19:59:15 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
tags/mac80211-next-for-davem-2015-10-21

for you to fetch changes up to e5a9f8d04660da7ef3a98260aa74c3976f9cb4cd:

  mac80211: move station statistics into sub-structs (2015-10-21 10:08:22 +0200)


Here's another set of patches for the current cycle:
 * I merged net-next back to avoid a conflict with the
 * cfg80211 scheduled scan API extensions
 * preparations for better scan result timestamping
 * regulatory cleanups
 * mac80211 statistics cleanups
 * a few other small cleanups and fixes


Avraham Stern (2):
  cfg80211: Add multiple scan plans for scheduled scan
  mac80211: Do not restart scheduled scan if multiple scan plans are set

Dmitry Shmidt (1):
  nl80211: allow BSS data to include CLOCK_BOOTTIME timestamp

Felix Fietkau (1):
  mac80211: add missing struct ieee80211_txq tid field initialization

Johannes Berg (25):
  Merge remote-tracking branch 'net-next/master' into mac80211-next
  wireless: update robust action frame list
  wireless: add WNM action frame categories
  mac80211: use new cfg80211_inform_bss_frame_data() API
  mac80211: remove PM-QoS listener
  mac80211: clean up ieee80211_rx_h_check_dup code
  mac80211: move sta_set_rate_info_rx() and make it static
  mac80211: remove cfg.h
  mac80211: remove event.c
  cfg80211: fix gHz to GHz
  cfg80211: reg: remove useless non-NULL check
  cfg80211: reg: fix reg_call_crda() return value bug
  cfg80211: reg: rename reg_call_crda to reg_query_database
  cfg80211: reg: search built-in database directly
  cfg80211: reg: remove useless reg_timeout scheduling
  cfg80211: reg: make CRDA support optional
  cfg80211: reg: rename reg_regdb_query() to reg_query_builtin()
  cfg80211: reg: clarify 'treatment' handling in reg_process_hint()
  cfg80211: reg: centralize freeing ignored requests
  cfg80211: reg: fix antenna gain in chan_reg_rule_print_dbg()
  cfg80211: reg: reduce chan_reg_rule_print_dbg() ifdef
  cfg80211: reg: fix reg_ignore_cell_hint return type
  mac80211: remove sta->last_ack_signal
  mac80211: move beacon_loss_count into ifmgd
  mac80211: move station statistics into sub-structs

Tamizh chelvam (1):
  Revert "mac80211: remove exposing 'mfp' to drivers"

 Documentation/DocBook/80211.tmpl   |   5 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c |   2 +-
 drivers/net/wireless/iwlwifi/mvm/ops.c |   1 +
 drivers/net/wireless/iwlwifi/mvm/scan.c|   4 +-
 drivers/net/wireless/rt2x00/rt2x00config.c |   2 +-
 drivers/net/wireless/ti/wl12xx/scan.c  |   3 +-
 drivers/net/wireless/ti/wl18xx/scan.c  |   8 +-
 include/linux/ieee80211.h  |   5 +
 include/net/cfg80211.h | 126 ++---
 include/net/mac80211.h |   8 +-
 include/uapi/linux/nl80211.h   |  57 +-
 net/mac80211/Makefile  |   1 -
 net/mac80211/cfg.c |  45 +
 net/mac80211/cfg.h |   9 -
 net/mac80211/debugfs_sta.c |   8 +-
 net/mac80211/ethtool.c |  29 ++-
 net/mac80211/event.c   |  27 ---
 net/mac80211/ibss.c|  24 +--
 net/mac80211/ieee80211_i.h |  13 +-
 net/mac80211/iface.c   |   4 +-
 net/mac80211/main.c|  14 --
 net/mac80211/mesh_hwmp.c   |   2 +-
 net/mac80211/mesh_plink.c  |   6 +-
 net/mac80211/mlme.c|  85 +++--
 net/mac80211/ocb.c |   2 +-
 net/mac80211/rx.c  |  81 
 net/mac80211/scan.c|  20 +-
 net/mac80211/sta_info.c| 101 +++---
 net/mac80211/sta_info.h| 103 --
 net/mac80211/status.c  |  53 +++---
 net/mac80211/trace.h   |   2 -
 net/mac80211/tx.c  |  20 +-
 net/mac80211/util.c|  12 +-
 net/mac80211/wpa.c

[PATCH] staging: rtl8723au: core: rtw_wlan_util: fix misleading indentation

2015-10-21 Thread Luis de Bethencourt
For loop is outside of the else branch of the above conditional statement.
Fixing misleading indentation.

Fix a smatch warning:
drivers/staging/rtl8723au/core/rtw_wlan_util.c:528
WMMOnAssocRsp23a() warn: curly braces intended?

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 5e87360..cc2b84b 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -525,7 +525,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
else
aSifsTime = 16;
 
-   for (i = 0; i < 4; i++) {
+   for (i = 0; i < 4; i++) {
ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03;
ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
 
-- 
2.5.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


[RFC v3 2/2] iwlwifi: mvm: send large SKBs to the transport

2015-10-21 Thread Emmanuel Grumbach
Now that PCIe knows how to create A-MSDUs, use this
capability and prepare SKBs that are large enough to
build an A-MSDU.
Advertise TSO support towards the network stack and
segment the packet with gso_size set to be the maximal
A-MSDU length (after having taken the headers to be added
into account) to make sure that the skb that is passed
down to the transport are not longer than the maximal
A-MSDU allowed.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/mvm/tx.c | 143 --
 1 file changed, 135 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c 
b/drivers/net/wireless/iwlwifi/mvm/tx.c
index be9d7e4..4f23149 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -65,6 +65,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "iwl-trans.h"
 #include "iwl-eeprom-parse.h"
@@ -181,7 +182,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
tx_cmd->tx_flags = cpu_to_le32(tx_flags);
/* Total # bytes to be transmitted */
-   tx_cmd->len = cpu_to_le16((u16)skb->len);
+   tx_cmd->len = cpu_to_le16((u16)skb->len +
+   (uintptr_t)info->driver_data[0]);
tx_cmd->next_frame_len = 0;
tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
tx_cmd->sta_id = sta_id;
@@ -356,7 +358,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff 
*skb,
 
memset(>status, 0, sizeof(info->status));
 
-   info->driver_data[0] = NULL;
info->driver_data[1] = dev_cmd;
 
return dev_cmd;
@@ -379,6 +380,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
  info->hw_queue != info->control.vif->cab_queue)))
return -1;
 
+   /* This holds the amsdu headers length */
+   info->driver_data[0] = (void *)(uintptr_t)0;
+
/*
 * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used
 * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel
@@ -435,29 +439,148 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct 
sk_buff *skb)
return 0;
 }
 
-static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb_gso,
+static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
  struct ieee80211_sta *sta,
  struct sk_buff_head *mpdus_skb)
 {
+   struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+   struct ieee80211_hdr *hdr = (void *)skb->data;
+   unsigned int mss = skb_shinfo(skb)->gso_size;
struct sk_buff *tmp, *next;
-   char cb[sizeof(skb_gso->cb)];
+   char cb[sizeof(skb->cb)];
+   unsigned int num_subframes, tcp_payload_len, subf_len;
+   u16 amsdu_add, snap_ip_tcp, pad, i = 0;
+
+   snap_ip_tcp = 8 + skb_transport_header(skb) - skb_network_header(skb) +
+   tcp_hdrlen(skb);
+
+   if (!sta->max_amsdu_len ||
+   !ieee80211_is_data_qos(hdr->frame_control)) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /*
+* Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not
+* supported. This is a spec requirement (IEEE 802.11-2015
+* section 8.7.3 NOTE 3).
+*/
+
+   /* TODO: for now, disable A-MSDU inside AMPDU */
+   if (info->flags & IEEE80211_TX_CTL_AMPDU) {
+   num_subframes = 1;
+   /* TODO: for the compiler... */
+   pad = 0;
+   goto segment;
+   }
+
+   /* Sub frame header + SNAP + IP header + TCP header + MSS */
+   subf_len = sizeof(struct ethhdr) + snap_ip_tcp + mss;
+   pad = (4 - subf_len) & 0x3;
+
+   /*
+* If we have N subframes in the A-MSDU, then the A-MSDU's size is
+* N * subf_len + (N - 1) * pad.
+*/
+   num_subframes = (sta->max_amsdu_len + pad) / (subf_len + pad);
+   if (num_subframes > 1) {
+   u8 *qc = ieee80211_get_qos_ctl((void *)skb->data);
+
+   *qc |= IEEE80211_QOS_CTL_A_MSDU_PRESENT;
+   }
+
+   tcp_payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
+   tcp_hdrlen(skb) + skb->data_len;
+
+   /*
+* Make sure we have enough TBs for the A-MSDU:
+*  2 for each subframe
+*  1 more for each fragment
+*  1 more for the potential data in the header
+*/
+   num_subframes =
+   min_t(unsigned int, num_subframes,
+ (mvm->trans->max_skb_frags - 1 -
+  skb_shinfo(skb)->nr_frags) / 2);
+
+   /* This skb fits in one single A-MSDU */
+   if (num_subframes * mss >= tcp_payload_len) {
+   /*
+* Compute the length of all the data added for the A-MSDU.
+* 

[RFC v3 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-21 Thread Emmanuel Grumbach
When the op_mode sends an skb whose payload is bigger than
MSS, PCIe will create an A-MSDU out of it. PCIe assumes
that the skb that is coming from the op_mode can fit in one
A-MSDU. It is the op_mode's responsibility to make sure
that this guarantee holds.

Additional headers need to be built for the subframes.
The TSO core code takes care of the IP / TCP headers and
the driver takes care of the 802.11 subframe headers.

These headers are stored on a per-cpu page that is re-used
for all the packets handled on that same CPU. Each skb
holds a reference to that page and releases the page when
it is reclaimed. When the page gets full, it is released
and a new one is allocated.

Since any SKB that doesn't go through the fast-xmit path
of mac80211 will be segmented, we can assume here that the
packet is not WEP / TKIP and has a proper SNAP header.

Signed-off-by: Emmanuel Grumbach 
---
 drivers/net/wireless/iwlwifi/iwl-devtrace-data.h |  16 ++
 drivers/net/wireless/iwlwifi/iwl-trans.h |   6 +-
 drivers/net/wireless/iwlwifi/pcie/internal.h |   7 +
 drivers/net/wireless/iwlwifi/pcie/trans.c|  20 +-
 drivers/net/wireless/iwlwifi/pcie/tx.c   | 286 ++-
 5 files changed, 329 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h 
b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
index 71a78ce..59d9edf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
@@ -51,6 +51,22 @@ TRACE_EVENT(iwlwifi_dev_tx_data,
TP_printk("[%s] TX frame data", __get_str(dev))
 );
 
+TRACE_EVENT(iwlwifi_dev_tx_tso_chunk,
+   TP_PROTO(const struct device *dev,
+u8 *data_src, size_t data_len),
+   TP_ARGS(dev, data_src, data_len),
+   TP_STRUCT__entry(
+   DEV_ENTRY
+
+   __dynamic_array(u8, data, data_len)
+   ),
+   TP_fast_assign(
+   DEV_ASSIGN;
+   memcpy(__get_dynamic_array(data), data_src, data_len);
+   ),
+   TP_printk("[%s] TX frame data", __get_str(dev))
+);
+
 TRACE_EVENT(iwlwifi_dev_rx_data,
TP_PROTO(const struct device *dev,
 const struct iwl_trans *trans,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 0ceff69..6919243 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -379,7 +379,11 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer 
*r)
 }
 
 #define MAX_NO_RECLAIM_CMDS6
-
+/*
+ * The first entry in driver_data array in ieee80211_tx_info
+ * that can be used by the transport.
+ */
+#define IWL_FIRST_DRIVER_DATA 2
 #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo
 
 /*
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h 
b/drivers/net/wireless/iwlwifi/pcie/internal.h
index be168d1..7da5643 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -295,6 +295,11 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
   sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
 }
 
+struct iwl_tso_hdr_page {
+   struct page *page;
+   u8 *pos;
+};
+
 /**
  * struct iwl_trans_pcie - PCIe transport specific data
  * @rxq: all the RX queue data
@@ -332,6 +337,8 @@ struct iwl_trans_pcie {
struct net_device napi_dev;
struct napi_struct napi;
 
+   struct __percpu iwl_tso_hdr_page *tso_hdr_page;
+
/* INT ICT Table */
__le32 *ict_tbl;
dma_addr_t ict_tbl_dma;
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
b/drivers/net/wireless/iwlwifi/pcie/trans.c
index a275318..5bd678b 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1601,6 +1601,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans 
*trans,
 void iwl_trans_pcie_free(struct iwl_trans *trans)
 {
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+   int i;
 
 #ifdef CPTCFG_IWLWIFI_PLATFORM_DATA
/* Make sure the device is on before calling pci functions again.
@@ -1631,6 +1632,15 @@ void iwl_trans_pcie_free(struct iwl_trans *trans)
 
iwl_pcie_free_fw_monitor(trans);
 
+   for_each_possible_cpu(i) {
+   struct iwl_tso_hdr_page *p =
+   per_cpu_ptr(trans_pcie->tso_hdr_page, i);
+
+   if (p->page)
+   __free_pages(p->page, 0);
+   }
+
+   free_percpu(trans_pcie->tso_hdr_page);
iwl_trans_free(trans);
 }
 
@@ -2822,7 +2832,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev 
*pdev,
struct iwl_trans_pcie *trans_pcie;
struct iwl_trans *trans;
u16 pci_cmd;
-   int ret;
+   int i, ret;
 
trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie),
>dev, cfg, _ops_pcie, 0);

[PATCH v2 08/15] net: wireless: simplify return flow for usb_control_msg

2015-10-21 Thread Punit Vara
remove int ret suggested by Jiri Slaby
This patch is to the at76c50x-usb.c file that fixes up warning
reported by coccicheck:

WARNING: end returns can be simplified if negative or 0 value

Prefer direct return value instead of writing 2-3 more sentence.

Signed-off-by: Punit Vara 
---
 drivers/net/wireless/at76c50x-usb.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/wireless/at76c50x-usb.c 
b/drivers/net/wireless/at76c50x-usb.c
index dab2513..b4aa062 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -543,14 +543,10 @@ static void at76_ledtrig_tx_activity(void)
 
 static int at76_remap(struct usb_device *udev)
 {
-   int ret;
-   ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0a,
+   return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0a,
  USB_TYPE_VENDOR | USB_DIR_OUT |
  USB_RECIP_INTERFACE, 0, 0, NULL, 0,
  USB_CTRL_GET_TIMEOUT);
-   if (ret < 0)
-   return ret;
-   return 0;
 }
 
 static int at76_get_op_mode(struct usb_device *udev)
-- 
2.5.3

--
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 05/15] net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate

2015-10-21 Thread Punit Vara
Remove int ret suggested by kbuild test robot

This patch is to the wlcore/acx.c file that fixes up warning
reported by coccicheck:

WARNING: end returns can be simplified if negative or 0 value

Prefer direct return value instead of writing 2-3 more sentence.

Signed-off-by: Punit Vara 
---
 drivers/net/wireless/ti/wlcore/acx.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/acx.c 
b/drivers/net/wireless/ti/wlcore/acx.c
index f28fa3b..6b566d9 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -158,16 +158,11 @@ out:
 int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
   size_t len)
 {
-   int ret;
 
wl1271_debug(DEBUG_ACX, "acx mem map");
 
-   ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
+   return wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
 sizeof(struct acx_header), len);
-   if (ret < 0)
-   return ret;
-
-   return 0;
 }
 
 int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)
-- 
2.5.3

--
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] rtl8xxxu: Debugging for RXFLTMAP0,1,2

2015-10-21 Thread Bruno Randolf
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 54 
 1 file changed, 54 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
index 324ab8a..4d0e121 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
@@ -5657,7 +5657,58 @@ rtl8xxxu_rcr_read(void *data, u64 *val)
return 0;
 }
 
+static int
+rtl8xxxu_RXFLTMAP0_write(void *data, u64 val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   rtl8xxxu_write16(priv, REG_RXFLTMAP0, val);
+   return 0;
+}
+
+static int
+rtl8xxxu_RXFLTMAP0_read(void *data, u64 *val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   *val = rtl8xxxu_read16(priv, REG_RXFLTMAP0);
+   return 0;
+}
+
+static int
+rtl8xxxu_RXFLTMAP1_write(void *data, u64 val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   rtl8xxxu_write16(priv, REG_RXFLTMAP1, val);
+   return 0;
+}
+
+static int
+rtl8xxxu_RXFLTMAP1_read(void *data, u64 *val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   *val = rtl8xxxu_read16(priv, REG_RXFLTMAP1);
+   return 0;
+}
+
+static int
+rtl8xxxu_RXFLTMAP2_write(void *data, u64 val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   rtl8xxxu_write16(priv, REG_RXFLTMAP2, val);
+   return 0;
+}
+
+static int
+rtl8xxxu_RXFLTMAP2_read(void *data, u64 *val)
+{
+   struct rtl8xxxu_priv *priv = data;
+   *val = rtl8xxxu_read16(priv, REG_RXFLTMAP2);
+   return 0;
+}
+
 DEFINE_SIMPLE_ATTRIBUTE(fops_rcr, rtl8xxxu_rcr_read, rtl8xxxu_rcr_write, 
"0x%08llx\n");
+DEFINE_SIMPLE_ATTRIBUTE(fops_RXFLTMAP0, rtl8xxxu_RXFLTMAP0_read, 
rtl8xxxu_RXFLTMAP0_write, "0x%08llx\n");
+DEFINE_SIMPLE_ATTRIBUTE(fops_RXFLTMAP1, rtl8xxxu_RXFLTMAP1_read, 
rtl8xxxu_RXFLTMAP1_write, "0x%08llx\n");
+DEFINE_SIMPLE_ATTRIBUTE(fops_RXFLTMAP2, rtl8xxxu_RXFLTMAP2_read, 
rtl8xxxu_RXFLTMAP2_write, "0x%08llx\n");
 
 void rtl8xxxu_init_debugfs(struct rtl8xxxu_priv *priv)
 {
@@ -5668,6 +5719,9 @@ void rtl8xxxu_init_debugfs(struct rtl8xxxu_priv *priv)
return;
 
debugfs_create_file("rcr", S_IRUSR | S_IWUSR, dir, priv, _rcr);
+   debugfs_create_file("RXFLTMAP0", S_IRUSR | S_IWUSR, dir, priv, 
_RXFLTMAP0);
+   debugfs_create_file("RXFLTMAP1", S_IRUSR | S_IWUSR, dir, priv, 
_RXFLTMAP1);
+   debugfs_create_file("RXFLTMAP2", S_IRUSR | S_IWUSR, dir, priv, 
_RXFLTMAP2);
 }
 
 static int rtl8xxxu_probe(struct usb_interface *interface,
-- 
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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-21 Thread Bruno Randolf
mac80211 documentation says, the ieee80211_ops.start callback "must turn on
frame reception (for possibly enabled monitor interfaces.)". If not a single
monitor interface does not receive data frames.

Similarly we should not change the data reception based on the association
state.

Signed-off-by: Bruno Randolf 
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
index 0399b1e..ae490e7 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
@@ -4475,9 +4475,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
 
rtl8xxxu_update_rate_mask(priv, ramask, sgi);
 
-   /* Enable RX of data frames */
-   rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
-
rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff);
 
rtl8723a_stop_tx_beacon(priv);
@@ -4492,8 +4489,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif,
val8 |= BEACON_DISABLE_TSF_UPDATE;
rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8);
 
-   /* Disable RX of data frames */
-   rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
h2c.joinbss.data = H2C_JOIN_BSS_DISCONNECT;
}
h2c.joinbss.cmd = H2C_JOIN_BSS_REPORT;
@@ -5495,12 +5490,9 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
}
 exit:
/*
-* Disable all data frames
-*/
-   rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
-   /*
-* Accept all mgmt frames
+* Accept all data and mgmt frames
 */
+   rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0x);
 
rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e);
-- 
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] rtl8xxxu: Debugging for RXFLTMAP0,1,2

2015-10-21 Thread Bruno Randolf
Sorry that was a mistake. Please ignore...

bruno
--
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/3] ath6k: fix firmware version assignment.

2015-10-21 Thread greearb
From: Ben Greear 

Improper use of strlcpy caused garbage to be appended to the
firmware version string.  Fix this by paying attention to the
ie_lenth.

Signed-off-by: Ben Greear 
---
 drivers/net/wireless/ath/ath6kl/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c 
b/drivers/net/wireless/ath/ath6kl/init.c
index 6e473fa..e3f3a6a 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -994,7 +994,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const 
char *name)
switch (ie_id) {
case ATH6KL_FW_IE_FW_VERSION:
strlcpy(ar->wiphy->fw_version, data,
-   sizeof(ar->wiphy->fw_version));
+   min(sizeof(ar->wiphy->fw_version), ie_len+1));
 
ath6kl_dbg(ATH6KL_DBG_BOOT,
   "found fw version %s\n",
-- 
2.4.3

--
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/3] ath6k: report antenna configuration.

2015-10-21 Thread greearb
From: Ben Greear 

This lets 'iw phy phy0 info' report antennas for
the radio device:

...
Available Antennas: TX 0x2 RX 0x2
Configured Antennas: TX 0x2 RX 0x2
...

Signed-off-by: Ben Greear 
---

This patch series is on top of my various local patches in a 4.2.3 kernel.

 drivers/net/wireless/ath/ath6kl/cfg80211.c | 17 +
 drivers/net/wireless/ath/ath6kl/core.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c 
b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 5b3d79e..ed25ad6 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3231,6 +3231,15 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct 
wireless_dev *wdev,
wait, buf, len, no_cck);
 }
 
+static int ath6kl_get_antenna(struct wiphy *wiphy,
+ u32 *tx_ant, u32 *rx_ant)
+{
+   struct ath6kl *ar = wiphy_priv(wiphy);
+   *tx_ant = ar->hw.tx_ant;
+   *rx_ant = ar->hw.rx_ant;
+   return 0;
+}
+
 static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,
   struct wireless_dev *wdev,
   u16 frame_type, bool reg)
@@ -3448,6 +3457,7 @@ static struct cfg80211_ops ath6kl_cfg80211_ops = {
.cancel_remain_on_channel = ath6kl_cancel_remain_on_channel,
.mgmt_tx = ath6kl_mgmt_tx,
.mgmt_frame_register = ath6kl_mgmt_frame_register,
+   .get_antenna = ath6kl_get_antenna,
.sched_scan_start = ath6kl_cfg80211_sscan_start,
.sched_scan_stop = ath6kl_cfg80211_sscan_stop,
.set_bitrate_mask = ath6kl_cfg80211_set_bitrate,
@@ -3795,11 +3805,18 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
ath6kl_band_2ghz.ht_cap.mcs.rx_mask[1] = 0xff;
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[1] = 0xff;
+   ar->hw.tx_ant = 2;
+   ar->hw.rx_ant = 2;
} else {
ath6kl_band_2ghz.ht_cap.mcs.rx_mask[0] = 0xff;
ath6kl_band_5ghz.ht_cap.mcs.rx_mask[0] = 0xff;
+   ar->hw.tx_ant = 1;
+   ar->hw.rx_ant = 1;
}
 
+   wiphy->available_antennas_tx = ar->hw.tx_ant;
+   wiphy->available_antennas_rx = ar->hw.rx_ant;
+
if (band_2gig)
wiphy->bands[IEEE80211_BAND_2GHZ] = _band_2ghz;
if (band_5gig)
diff --git a/drivers/net/wireless/ath/ath6kl/core.h 
b/drivers/net/wireless/ath/ath6kl/core.h
index 2b78c86..5f3acfe 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -782,6 +782,8 @@ struct ath6kl {
u32 refclk_hz;
u32 uarttx_pin;
u32 testscript_addr;
+   u8 tx_ant;
+   u8 rx_ant;
enum wmi_phy_cap cap;
 
u32 flags;
-- 
2.4.3

--
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] staging: wilc1000: return -ENOMEM when kmalloc failed

2015-10-21 Thread Luis de Bethencourt
The driver is using -1 instead of the -ENOMEM defined macro to specify that
a buffer allocation failed.

Fixes smatch warning and similars:
drivers/staging/wilc1000/host_interface.c:1782 Handle_Key() warn:
returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/wilc1000/host_interface.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 38fead4..ec47a28 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1756,7 +1756,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
-   return -1;
+   return -ENOMEM;
}
 
kfree(pstrHostIFkeyAttr->attr.wep.key);
@@ -1779,7 +1779,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len 
+ 2, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
-   return -1;
+   return -ENOMEM;
}
pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
memcpy(pu8keybuf + 1, 
>attr.wep.key_len, 1);
@@ -1826,7 +1826,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
 
@@ -1861,7 +1861,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
 
@@ -1890,7 +1890,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 _WPARxGtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
kfree(pstrHostIFkeyAttr->attr.wpa.seq);
-   if (ret == -1)
+   if (ret)
return ret;
 
break;
@@ -1905,7 +1905,7 @@ _WPARxGtk_end_case_:
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPAPtk_end_case_;
 
}
@@ -1940,7 +1940,7 @@ _WPARxGtk_end_case_:
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPAPtk_end_case_;
 
}
@@ -1963,7 +1963,7 @@ _WPARxGtk_end_case_:
 
 _WPAPtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
-   if (ret == -1)
+   if (ret)
return ret;
 
break;
@@ -1976,7 +1976,7 @@ _WPAPtk_end_case_:
pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * 
PMKSA_KEY_LEN) + 1, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PMKSA Key\n");
-   return -1;
+   return -ENOMEM;
}
 
pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid;
-- 
2.5.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] rtl8xxxu: Enable data frame reception in rtl8xxxu_start

2015-10-21 Thread Jes Sorensen
Bruno Randolf  writes:
> mac80211 documentation says, the ieee80211_ops.start callback "must turn on
> frame reception (for possibly enabled monitor interfaces.)". If not a single
> monitor interface does not receive data frames.
>
> Similarly we should not change the data reception based on the association
> state.
>
> Signed-off-by: Bruno Randolf 
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)

Bruno,

Thanks - I am not 100% convinced about this one. I don't think we should
tell the firmware to pass up data frames before we have negotiated the
connection.

It's true that for monitor mode, we need to enable it if all packets
are requested. Looking at iw there is an option where it only requests
control packets, and one for all, etc. However for non monitor mode, we
shouldn't pass all data packets up to the stack, resulting and have
mac80211 parse them all.

Cheers,
Jes


>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> index 0399b1e..ae490e7 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
> @@ -4475,9 +4475,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, 
> struct ieee80211_vif *vif,
>  
>   rtl8xxxu_update_rate_mask(priv, ramask, sgi);
>  
> - /* Enable RX of data frames */
> - rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
> -
>   rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff);
>  
>   rtl8723a_stop_tx_beacon(priv);
> @@ -4492,8 +4489,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, 
> struct ieee80211_vif *vif,
>   val8 |= BEACON_DISABLE_TSF_UPDATE;
>   rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8);
>  
> - /* Disable RX of data frames */
> - rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
>   h2c.joinbss.data = H2C_JOIN_BSS_DISCONNECT;
>   }
>   h2c.joinbss.cmd = H2C_JOIN_BSS_REPORT;
> @@ -5495,12 +5490,9 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)
>   }
>  exit:
>   /*
> -  * Disable all data frames
> -  */
> - rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
> - /*
> -  * Accept all mgmt frames
> +  * Accept all data and mgmt frames
>*/
> + rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
>   rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0x);
>  
>   rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e);
--
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 05/15] net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate

2015-10-21 Thread Sergei Shtylyov

On 10/21/2015 10:07 PM, Punit Vara wrote:


Remove int ret suggested by kbuild test robot

This patch is to the wlcore/acx.c file that fixes up warning
reported by coccicheck:

WARNING: end returns can be simplified if negative or 0 value

Prefer direct return value instead of writing 2-3 more sentence.

Signed-off-by: Punit Vara 
---
  drivers/net/wireless/ti/wlcore/acx.c | 7 +--
  1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/acx.c 
b/drivers/net/wireless/ti/wlcore/acx.c
index f28fa3b..6b566d9 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -158,16 +158,11 @@ out:
  int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
   size_t len)
  {
-   int ret;



   You now need to kill this empty line as well.

[...]

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 v3 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-21 Thread Eric Dumazet
On Thu, 2015-10-22 at 00:14 +, Grumbach, Emmanuel wrote:

> 
> Well. I guess I should at least check, but even with very small MSS, our
> device supports up to 20 pointers for the same 802.11 packet: 2 are for
> metadata. So basically, so leaves me only 18 pointers. for each MSS I
> need at least 2 (one for the headers and one for the payload), so I will
> have at most 9 of these for one packet, even with a tiny MSS.
> 

I did not see in your patch where you made the checks about 18 segs in a
TSO packet ?

> I agree that all this should be added to the code in a comment.
> Speaking of which...
> int tso_count_descs(struct sk_buff *skb)
> {
> /* The Marvell Way */
> return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags;
> }
> 
> What if there is some payload in the header?
> To me it sounds safer to return:
> 
> skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags + 1;
> 
> or maybe to test if there is some payload in the header and then add 1?
> If there is payload in the header, it should be considered as another
> frag, shouldn't it?

Minimal count is gso_segs (one per MSS)

Then you have to add extra for the cases we have a mss spanning a frag
in skb.

Thats a max of (skb_shinfo(skb)->nr_frags - 1) + (data_in_head() ? 1 :
0);

So I believe formula would be correct.


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


Re: [PATCH 2/2] ath6k: implement ethtool stats.

2015-10-21 Thread kbuild test robot
Hi Ben,

[auto build test WARNING on net/master -- if it's inappropriate base, please 
suggest rules for selecting the more suitable base]

url:
https://github.com/0day-ci/linux/commits/greearb-candelatech-com/ath6k-break-stats-gathering-code-into-separate-method/20151022-075558
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/ath/ath6kl/cfg80211.c:3750:26: sparse: symbol 
>> 'ath6k_ethtool_ops' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
--
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 v3 1/2] iwlwifi: pcie: allow to build an A-MSDU using TSO core

2015-10-21 Thread Eric Dumazet
On Wed, 2015-10-21 at 21:34 +0300, Emmanuel Grumbach wrote:
> When the op_mode sends an skb whose payload is bigger than
> MSS, PCIe will create an A-MSDU out of it. PCIe assumes
> that the skb that is coming from the op_mode can fit in one
> A-MSDU. It is the op_mode's responsibility to make sure
> that this guarantee holds.
> 
> Additional headers need to be built for the subframes.
> The TSO core code takes care of the IP / TCP headers and
> the driver takes care of the 802.11 subframe headers.
> 
> These headers are stored on a per-cpu page that is re-used
> for all the packets handled on that same CPU. Each skb
> holds a reference to that page and releases the page when
> it is reclaimed. When the page gets full, it is released
> and a new one is allocated.
> 
> Since any SKB that doesn't go through the fast-xmit path
> of mac80211 will be segmented, we can assume here that the
> packet is not WEP / TKIP and has a proper SNAP header.
> 
> Signed-off-by: Emmanuel Grumbach 
> ---
>  drivers/net/wireless/iwlwifi/iwl-devtrace-data.h |  16 ++
>  drivers/net/wireless/iwlwifi/iwl-trans.h |   6 +-
>  drivers/net/wireless/iwlwifi/pcie/internal.h |   7 +
>  drivers/net/wireless/iwlwifi/pcie/trans.c|  20 +-
>  drivers/net/wireless/iwlwifi/pcie/tx.c   | 286 
> ++-
>  5 files changed, 329 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h 
> b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
> index 71a78ce..59d9edf 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace-data.h
> @@ -51,6 +51,22 @@ TRACE_EVENT(iwlwifi_dev_tx_data,
>   TP_printk("[%s] TX frame data", __get_str(dev))
>  );
>  
> +TRACE_EVENT(iwlwifi_dev_tx_tso_chunk,
> + TP_PROTO(const struct device *dev,
> +  u8 *data_src, size_t data_len),
> + TP_ARGS(dev, data_src, data_len),
> + TP_STRUCT__entry(
> + DEV_ENTRY
> +
> + __dynamic_array(u8, data, data_len)
> + ),
> + TP_fast_assign(
> + DEV_ASSIGN;
> + memcpy(__get_dynamic_array(data), data_src, data_len);
> + ),
> + TP_printk("[%s] TX frame data", __get_str(dev))
> +);
> +
>  TRACE_EVENT(iwlwifi_dev_rx_data,
>   TP_PROTO(const struct device *dev,
>const struct iwl_trans *trans,
> diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h 
> b/drivers/net/wireless/iwlwifi/iwl-trans.h
> index 0ceff69..6919243 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-trans.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
> @@ -379,7 +379,11 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer 
> *r)
>  }
>  
>  #define MAX_NO_RECLAIM_CMDS  6
> -
> +/*
> + * The first entry in driver_data array in ieee80211_tx_info
> + * that can be used by the transport.
> + */
> +#define IWL_FIRST_DRIVER_DATA 2
>  #define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo
>  
>  /*
> diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h 
> b/drivers/net/wireless/iwlwifi/pcie/internal.h
> index be168d1..7da5643 100644
> --- a/drivers/net/wireless/iwlwifi/pcie/internal.h
> +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
> @@ -295,6 +295,11 @@ iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
>  sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
>  }
>  
> +struct iwl_tso_hdr_page {
> + struct page *page;
> + u8 *pos;
> +};
> +
>  /**
>   * struct iwl_trans_pcie - PCIe transport specific data
>   * @rxq: all the RX queue data
> @@ -332,6 +337,8 @@ struct iwl_trans_pcie {
>   struct net_device napi_dev;
>   struct napi_struct napi;
>  
> + struct __percpu iwl_tso_hdr_page *tso_hdr_page;
> +
>   /* INT ICT Table */
>   __le32 *ict_tbl;
>   dma_addr_t ict_tbl_dma;
> diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c 
> b/drivers/net/wireless/iwlwifi/pcie/trans.c
> index a275318..5bd678b 100644
> --- a/drivers/net/wireless/iwlwifi/pcie/trans.c
> +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
> @@ -1601,6 +1601,7 @@ static void iwl_trans_pcie_configure(struct iwl_trans 
> *trans,
>  void iwl_trans_pcie_free(struct iwl_trans *trans)
>  {
>   struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
> + int i;
>  
>  #ifdef CPTCFG_IWLWIFI_PLATFORM_DATA
>   /* Make sure the device is on before calling pci functions again.
> @@ -1631,6 +1632,15 @@ void iwl_trans_pcie_free(struct iwl_trans *trans)
>  
>   iwl_pcie_free_fw_monitor(trans);
>  
> + for_each_possible_cpu(i) {
> + struct iwl_tso_hdr_page *p =
> + per_cpu_ptr(trans_pcie->tso_hdr_page, i);
> +
> + if (p->page)
> + __free_pages(p->page, 0);
> + }
> +
> + free_percpu(trans_pcie->tso_hdr_page);
>   iwl_trans_free(trans);
>  }
>  
> @@ -2822,7 +2832,7 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev 
> *pdev,

[PATCH 1/2] ath6k: break stats gathering code into separate method.

2015-10-21 Thread greearb
From: Ben Greear 

This will allow us to call it from elsewhere when implementing
ethtool stats.

Signed-off-by: Ben Greear 
---
 drivers/net/wireless/ath/ath6kl/debug.c | 55 +++--
 drivers/net/wireless/ath/ath6kl/debug.h |  2 ++
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/debug.c 
b/drivers/net/wireless/ath/ath6kl/debug.c
index 81ba48d..91ff6a5 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -98,6 +98,33 @@ void ath6kl_warn(const char *fmt, ...)
 }
 EXPORT_SYMBOL(ath6kl_warn);
 
+int ath6k_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif)
+{
+   long left;
+
+   if (down_interruptible(>sem))
+   return -EBUSY;
+
+   set_bit(STATS_UPDATE_PEND, >flags);
+
+   if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
+   up(>sem);
+   return -EIO;
+   }
+
+   left = wait_event_interruptible_timeout(ar->event_wq,
+   !test_bit(STATS_UPDATE_PEND,
+   >flags), WMI_TIMEOUT);
+
+   up(>sem);
+
+   if (left <= 0)
+   return -ETIMEDOUT;
+
+   return 0;
+}
+EXPORT_SYMBOL(ath6k_read_tgt_stats);
+
 #ifdef CONFIG_ATH6KL_DEBUG
 
 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
@@ -544,42 +571,24 @@ static ssize_t read_file_tgt_stats(struct file *file, 
char __user *user_buf,
char *buf;
unsigned int len = 0, buf_len = 1500;
int i;
-   long left;
ssize_t ret_cnt;
+   int rv;
 
vif = ath6kl_vif_first(ar);
if (!vif)
return -EIO;
 
-   tgt_stats = >target_stats;
-
buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
 
-   if (down_interruptible(>sem)) {
+   rv = ath6k_read_tgt_stats(ar, vif);
+   if (rv < 0) {
kfree(buf);
-   return -EBUSY;
+   return rv;
}
 
-   set_bit(STATS_UPDATE_PEND, >flags);
-
-   if (ath6kl_wmi_get_stats_cmd(ar->wmi, 0)) {
-   up(>sem);
-   kfree(buf);
-   return -EIO;
-   }
-
-   left = wait_event_interruptible_timeout(ar->event_wq,
-   !test_bit(STATS_UPDATE_PEND,
-   >flags), WMI_TIMEOUT);
-
-   up(>sem);
-
-   if (left <= 0) {
-   kfree(buf);
-   return -ETIMEDOUT;
-   }
+   tgt_stats = >target_stats;
 
len += scnprintf(buf + len, buf_len - len, "\n");
len += scnprintf(buf + len, buf_len - len, "%25s\n",
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h 
b/drivers/net/wireless/ath/ath6kl/debug.h
index 19106ed..be54f19 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -59,6 +59,8 @@ enum ath6kl_war {
ATH6KL_WAR_INVALID_RATE,
 };
 
+int ath6k_read_tgt_stats(struct ath6kl *ar, struct ath6kl_vif *vif);
+
 #ifdef CONFIG_ATH6KL_DEBUG
 
 void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...);
-- 
2.4.3

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


IPW2200 Driver for Linux

2015-10-21 Thread Christoph Sauer
Hello, do you still have the IPW2200 Linux driver for Lenovo Thinkpad 
t42 notebook? I have an old notebook from a friend which i want to 
install linux on it, and i am searching for the wifi driver for days.


http://ipw2200.sourceforge.net/index.php

--
--
Mit freundlichen Grüßen
Christoph Sauer
35444 Biebertal,
Rodheimerstraße 28
Handy: 0171-8686473
E-Mail: i...@sauer-chris.de
www.it-sauer.de

--
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] ath10k: add FW API support to test mode

2015-10-21 Thread Michal Kazior
On 20 October 2015 at 09:01, Manikanta Pubbisetty
 wrote:
>
>
> On 10/20/2015 04:55 PM, Kalle Valo wrote:
>>
>> From: Alan Liu 
>>
>> Add WMI-TLV and FW API support in ath10k testmode.
>> Ath10k can get right wmi command format from UTF image
>> to communicate UTF firmware.
>>
>> Signed-off-by: Alan Liu 
>> Signed-off-by: Kalle Valo 
>> ---
>>   drivers/net/wireless/ath/ath10k/core.c |4 -
>>   drivers/net/wireless/ath/ath10k/core.h |5 +
>>   drivers/net/wireless/ath/ath10k/hw.h   |1
>>   drivers/net/wireless/ath/ath10k/testmode.c |  202
>> ++--
>>   drivers/net/wireless/ath/ath10k/wmi-tlv.c  |   14 ++
>>   5 files changed, 205 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath10k/core.c
>> b/drivers/net/wireless/ath/ath10k/core.c
>> index 13de3617d5ab..b7a82ae3b3fa 100644
>> --- a/drivers/net/wireless/ath/ath10k/core.c
>> +++ b/drivers/net/wireless/ath/ath10k/core.c
>> @@ -568,8 +568,8 @@ static int ath10k_download_fw(struct ath10k *ar, enum
>> ath10k_firmware_mode mode)
>> }
>> break;
>> case ATH10K_FIRMWARE_MODE_UTF:
>> -   data = ar->testmode.utf->data;
>> -   data_len = ar->testmode.utf->size;
>> +   data = ar->testmode.utf_firmware_data;
>> +   data_len = ar->testmode.utf_firmware_len;
>> mode_name = "utf";
>> break;
>> default:
>> diff --git a/drivers/net/wireless/ath/ath10k/core.h
>> b/drivers/net/wireless/ath/ath10k/core.h
>> index 7cc7cdd56c95..a6371108be9b 100644
>> --- a/drivers/net/wireless/ath/ath10k/core.h
>> +++ b/drivers/net/wireless/ath/ath10k/core.h
>> @@ -814,9 +814,12 @@ struct ath10k {
>> struct {
>> /* protected by conf_mutex */
>> const struct firmware *utf;
>> +   char utf_version[32];
>> +   const void *utf_firmware_data;
>> +   size_t utf_firmware_len;
>> DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT);
>> enum ath10k_fw_wmi_op_version orig_wmi_op_version;
>> -
>> +   enum ath10k_fw_wmi_op_version op_version;
>> /* protected by data_lock */
>> bool utf_monitor;
>> } testmode;
>> diff --git a/drivers/net/wireless/ath/ath10k/hw.h
>> b/drivers/net/wireless/ath/ath10k/hw.h
>> index 2d87737e35ff..0c8ea0226684 100644
>> --- a/drivers/net/wireless/ath/ath10k/hw.h
>> +++ b/drivers/net/wireless/ath/ath10k/hw.h
>> @@ -94,6 +94,7 @@ enum qca6174_chip_id_rev {
>>   #define ATH10K_FW_API5_FILE   "firmware-5.bin"
>>
>>   #define ATH10K_FW_UTF_FILE"utf.bin"
>> +#define ATH10K_FW_UTF_API2_FILE"utf-2.bin"
>>
>>   /* includes also the null byte */
>>   #define ATH10K_FIRMWARE_MAGIC   "QCA-ATH10K"
>> diff --git a/drivers/net/wireless/ath/ath10k/testmode.c
>> b/drivers/net/wireless/ath/ath10k/testmode.c
>> index b084f88da102..1d5a2fdcbf56 100644
>> --- a/drivers/net/wireless/ath/ath10k/testmode.c
>> +++ b/drivers/net/wireless/ath/ath10k/testmode.c
>> @@ -139,11 +139,181 @@ static int ath10k_tm_cmd_get_version(struct ath10k
>> *ar, struct nlattr *tb[])
>> return cfg80211_testmode_reply(skb);
>>   }
>>
>> -static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr
>> *tb[])
>> +static int ath10k_tm_fetch_utf_firmware_api_2(struct ath10k *ar)
>> +{
>> +   size_t len, magic_len, ie_len;
>> +   struct ath10k_fw_ie *hdr;
>> +   char filename[100];
>> +   __le32 *version;
>> +   const u8 *data;
>> +   int ie_id, ret;
>> +
>> +   snprintf(filename, sizeof(filename), "%s/%s",
>> +ar->hw_params.fw.dir, ATH10K_FW_UTF_API2_FILE);
>> +
>> +   /* load utf firmware image */
>> +   ret = request_firmware(>testmode.utf, filename, ar->dev);
>> +   if (ret) {
>> +   ath10k_warn(ar, "failed to retrieve utf firmware '%s':
>> %d\n",
>> +   filename, ret);
>> +   return ret;
>> +   }
>> +
>> +   data = ar->testmode.utf->data;
>> +   len = ar->testmode.utf->size;
>> +
>> +   /* FIXME: call release_firmware() in error cases */
>> +
>> +   /* magic also includes the null byte, check that as well */
>> +   magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
>> +
>> +   if (len < magic_len) {
>> +   ath10k_err(ar, "utf firmware file is too small to contain
>> magic\n");
>> +   ret = -EINVAL;
>> +   goto err;
>> +   }
>> +
>> +   if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
>> +   ath10k_err(ar, "invalid firmware magic\n");
>> +   ret = -EINVAL;
>> +   goto err;
>> +   }
>> +
>> +   /* jump over the padding */
>> +   magic_len = ALIGN(magic_len, 4);
>> +
>> + 

Re: [PATCH v2] ath10k: add FW API support to test mode

2015-10-21 Thread Manikanta


On Wednesday 21 October 2015 12:36 PM, Michal Kazior wrote:

On 20 October 2015 at 09:01, Manikanta Pubbisetty
 wrote:


On 10/20/2015 04:55 PM, Kalle Valo wrote:

From: Alan Liu 

Add WMI-TLV and FW API support in ath10k testmode.
Ath10k can get right wmi command format from UTF image
to communicate UTF firmware.

Signed-off-by: Alan Liu 
Signed-off-by: Kalle Valo 
---
   drivers/net/wireless/ath/ath10k/core.c |4 -
   drivers/net/wireless/ath/ath10k/core.h |5 +
   drivers/net/wireless/ath/ath10k/hw.h   |1
   drivers/net/wireless/ath/ath10k/testmode.c |  202
++--
   drivers/net/wireless/ath/ath10k/wmi-tlv.c  |   14 ++
   5 files changed, 205 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c
b/drivers/net/wireless/ath/ath10k/core.c
index 13de3617d5ab..b7a82ae3b3fa 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -568,8 +568,8 @@ static int ath10k_download_fw(struct ath10k *ar, enum
ath10k_firmware_mode mode)
 }
 break;
 case ATH10K_FIRMWARE_MODE_UTF:
-   data = ar->testmode.utf->data;
-   data_len = ar->testmode.utf->size;
+   data = ar->testmode.utf_firmware_data;
+   data_len = ar->testmode.utf_firmware_len;
 mode_name = "utf";
 break;
 default:
diff --git a/drivers/net/wireless/ath/ath10k/core.h
b/drivers/net/wireless/ath/ath10k/core.h
index 7cc7cdd56c95..a6371108be9b 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -814,9 +814,12 @@ struct ath10k {
 struct {
 /* protected by conf_mutex */
 const struct firmware *utf;
+   char utf_version[32];
+   const void *utf_firmware_data;
+   size_t utf_firmware_len;
 DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT);
 enum ath10k_fw_wmi_op_version orig_wmi_op_version;
-
+   enum ath10k_fw_wmi_op_version op_version;
 /* protected by data_lock */
 bool utf_monitor;
 } testmode;
diff --git a/drivers/net/wireless/ath/ath10k/hw.h
b/drivers/net/wireless/ath/ath10k/hw.h
index 2d87737e35ff..0c8ea0226684 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -94,6 +94,7 @@ enum qca6174_chip_id_rev {
   #define ATH10K_FW_API5_FILE   "firmware-5.bin"

   #define ATH10K_FW_UTF_FILE"utf.bin"
+#define ATH10K_FW_UTF_API2_FILE"utf-2.bin"

   /* includes also the null byte */
   #define ATH10K_FIRMWARE_MAGIC   "QCA-ATH10K"
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c
b/drivers/net/wireless/ath/ath10k/testmode.c
index b084f88da102..1d5a2fdcbf56 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -139,11 +139,181 @@ static int ath10k_tm_cmd_get_version(struct ath10k
*ar, struct nlattr *tb[])
 return cfg80211_testmode_reply(skb);
   }

-static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr
*tb[])
+static int ath10k_tm_fetch_utf_firmware_api_2(struct ath10k *ar)
+{
+   size_t len, magic_len, ie_len;
+   struct ath10k_fw_ie *hdr;
+   char filename[100];
+   __le32 *version;
+   const u8 *data;
+   int ie_id, ret;
+
+   snprintf(filename, sizeof(filename), "%s/%s",
+ar->hw_params.fw.dir, ATH10K_FW_UTF_API2_FILE);
+
+   /* load utf firmware image */
+   ret = request_firmware(>testmode.utf, filename, ar->dev);
+   if (ret) {
+   ath10k_warn(ar, "failed to retrieve utf firmware '%s':
%d\n",
+   filename, ret);
+   return ret;
+   }
+
+   data = ar->testmode.utf->data;
+   len = ar->testmode.utf->size;
+
+   /* FIXME: call release_firmware() in error cases */
+
+   /* magic also includes the null byte, check that as well */
+   magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
+
+   if (len < magic_len) {
+   ath10k_err(ar, "utf firmware file is too small to contain
magic\n");
+   ret = -EINVAL;
+   goto err;
+   }
+
+   if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
+   ath10k_err(ar, "invalid firmware magic\n");
+   ret = -EINVAL;
+   goto err;
+   }
+
+   /* jump over the padding */
+   magic_len = ALIGN(magic_len, 4);
+
+   len -= magic_len;
+   data += magic_len;
+
+   /* loop elements */
+   while (len > sizeof(struct ath10k_fw_ie)) {
+   hdr = (struct ath10k_fw_ie *)data;
+
+   ie_id = le32_to_cpu(hdr->id);
+   ie_len = le32_to_cpu(hdr->len);
+
+

Re: [PATCH v2] ath10k: add FW API support to test mode

2015-10-21 Thread Michal Kazior
On 21 October 2015 at 09:22, Manikanta  wrote:
> On Wednesday 21 October 2015 12:36 PM, Michal Kazior wrote:
>> On 20 October 2015 at 09:01, Manikanta Pubbisetty
>>  wrote:
>>> On 10/20/2015 04:55 PM, Kalle Valo wrote:

 From: Alan Liu 

 Add WMI-TLV and FW API support in ath10k testmode.
 Ath10k can get right wmi command format from UTF image
 to communicate UTF firmware.

 Signed-off-by: Alan Liu 
 Signed-off-by: Kalle Valo 
 ---
[...]
 +   /* loop elements */
 +   while (len > sizeof(struct ath10k_fw_ie)) {
 +   hdr = (struct ath10k_fw_ie *)data;
 +
 +   ie_id = le32_to_cpu(hdr->id);
 +   ie_len = le32_to_cpu(hdr->len);
 +
 +   len -= sizeof(*hdr);
 +   data += sizeof(*hdr);
 +
 +   if (len < ie_len) {
 +   ath10k_err(ar, "invalid length for FW IE %d (%zu
 <
 %zu)\n",
 +  ie_id, len, ie_len);
 +   ret = -EINVAL;
 +   goto err;
 +   }
 +
 +   switch (ie_id) {
 +   case ATH10K_FW_IE_FW_VERSION:
>>>
>>>
>>> Something like ATH10K_UTF_IE_FW_VERSION or ATH10K_TESTMODE_IE_FW_VERSION
>>> would be less confusing and better, isn't it?
>>
>> I don't really see a reason to. UTF is just another main program to
>> run on the device.
>>
>> If anything I would suggest to unify the FW API parsing logic to work
>> with a dedicated structure instead of `struct ath10k` directly, i.e.
>>
>>struct ath10k_fw {
>>  void *data;
>>  size_t data_len;
>>  enum wmi_op_version wmi_op_version;
>>  // ...
>>};
>>
>>int ath10k_core_fw_api_parse(struct ath10k *ar,
>> struct ath10k_fw *arfw,
>> struct firmware *fw)
>> {
>>   // parse and fill in `arfw`
>> }
>>
>>struct ath10k {
>>  // ...
>>  struct ath10k_fw fw_normal;
>>  struct ath10k_fw fw_utf;
>>  // ...
>>};
>>
>>
>> Michał
>
> Hmmm, this way we will have a unified firmware parsing logic. Is this a task
> which can be taken up easily or any other hidden complexities are invloved
> ?.

Decoupling the parsing logic should be rather easy. I don't think
there are any gotchas.


> I mean can we do the changes for current parsing logic and then rework the
> test mode patch ? what is your suggestion ?

If you want to do the unified parsing logic approach you should first
decouple the logic (i.e. make it not fill `struct ath10k` directly)
and then rework the testmode patch on top of that.


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 00/19] staging/wilc1000 cleanups

2015-10-21 Thread glen lee

Hi arnd,

Thanks for the all the patches. :)
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl instead of 
wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data
and finally it will be removed. I already posted some of those patches.

Thanks,
Glen.


On 2015년 10월 21일 07:47, Arnd Bergmann wrote:

After I screwed up two or three times trying to get the dependencies
with the SPI and SDIO backends right, I ended up taking the time
to do the real fix and make both coexist.

This is a series of patches that address various issues with the
driver, but is mainly targetted at splitting out the spi and sdio
backends into separate drivers that can be built independent of
one another.

The last patch is more experimental than the others, hence the
[RFC] annotation.

Please review and test.

Arnd

Arnd Bergmann (19):
   staging/wilc1000: remove unused functions
   staging/wilc1000: make symbols static if possible
   staging/wilc1000: use proper naming for global symbols
   staging/wilc1000: move extern declarations to headers
   staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
   staging/wilc1000: avoid static definitions in header
   staging/wilc1000: remove linux_wlan_{device_power,device_detection}
   staging/wilc1000: move wilc_wlan_inp_t into struct wilc
   staging/wilc1000: move init/exit functions to driver files
   staging/wilc1000: unify device pointer
   staging/wilc1000: move wilc1000_ops to drivers
   staging/wilc1000: use device pointer for phy creation
   staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
   staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
   staging/wilc1000: turn enable_irq/disable_irq into callbacks
   staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
   staging/wilc1000: pass hif operations through initialization
   staging/wilc1000: split out bus specific modules
   [RFC] staging/wilc1000: use more regular probing

  drivers/staging/wilc1000/Kconfig  |  66 +-
  drivers/staging/wilc1000/Makefile |  16 +-
  drivers/staging/wilc1000/coreconfigurator.c   |  12 +-
  drivers/staging/wilc1000/coreconfigurator.h   |  12 +-
  drivers/staging/wilc1000/host_interface.c | 501 +++-
  drivers/staging/wilc1000/host_interface.h | 349 ++-
  drivers/staging/wilc1000/linux_mon.c  |  11 +-
  drivers/staging/wilc1000/linux_wlan.c | 695 +++---
  drivers/staging/wilc1000/linux_wlan_common.h  |  18 +-
  drivers/staging/wilc1000/linux_wlan_sdio.c| 202 +--
  drivers/staging/wilc1000/linux_wlan_sdio.h|  14 -
  drivers/staging/wilc1000/linux_wlan_spi.c | 119 ++--
  drivers/staging/wilc1000/linux_wlan_spi.h |   8 -
  drivers/staging/wilc1000/wilc_debugfs.c   |  20 +-
  drivers/staging/wilc1000/wilc_sdio.c  | 213 +++
  drivers/staging/wilc1000/wilc_spi.c   | 276 +
  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++
  drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  21 +-
  drivers/staging/wilc1000/wilc_wlan.c  | 180 +++---
  drivers/staging/wilc1000/wilc_wlan.h  |  49 +-
  drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
  drivers/staging/wilc1000/wilc_wlan_if.h   |  23 +-
  23 files changed, 1171 insertions(+),  deletions(-)
  delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.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] iw: Fix segfault when no args are given to offchannel

2015-10-21 Thread Ola Olsson
The offchannel command assumes that frequency and duration
are given as arguments, otherwise iw segfaults - fix that
by printing help text instead.

Signed-off-by: Ola Olsson 
---
 offch.c |4 
 1 file changed, 4 insertions(+)

diff --git a/offch.c b/offch.c
index 49b101a..04bf4c6 100644
--- a/offch.c
+++ b/offch.c
@@ -15,6 +15,10 @@ static int offchannel(struct nl80211_state *state,
 {
char *end;
 
+   if (argc < 2) {
+   return 1;
+   }
+
/* freq */
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ,
strtoul(argv[0], , 10));
-- 
1.7.9.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] iw: Fix segfault when no args are given to offchannel

2015-10-21 Thread Johannes Berg
On Wed, 2015-10-21 at 14:02 +0200, Ola Olsson wrote:
> The offchannel command assumes that frequency and duration
> are given as arguments, otherwise iw segfaults - fix that
> by printing help text instead.
> 
Thanks! Applied, but I removed the unnecessary braces.

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] iw: remove superfluous includes

2015-10-21 Thread Johannes Berg
I'm always a bit scared of patches like this in case we just start
relying on an include file including something else, but I'll apply it
and we'll see what happens :)

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] iw: Print help text to "set bitrates" in case of no args

2015-10-21 Thread Johannes Berg
This is incorrect - the help states:

"Not passing any arguments would clear the existing mask (if any)."

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] iw: Print help text to "set bitrates" in case of no args

2015-10-21 Thread Ola Olsson
I totally missed that. You are right!

/Ola

On Wed, Oct 21, 2015 at 2:27 PM, Johannes Berg
 wrote:
> This is incorrect - the help states:
>
> "Not passing any arguments would clear the existing mask (if any)."
>
> 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] iw: remove superfluous includes

2015-10-21 Thread Ola Olsson
Signed-off-by: Ola Olsson 
---
 coalesce.c |2 --
 info.c |1 -
 link.c |1 -
 mpp.c  |1 -
 p2p.c  |3 ---
 scan.c |1 -
 survey.c   |2 --
 7 files changed, 11 deletions(-)

diff --git a/coalesce.c b/coalesce.c
index fabf44a..36dcaef 100644
--- a/coalesce.c
+++ b/coalesce.c
@@ -8,8 +8,6 @@
 #include 
 #include 
 
-#include 
-
 #include "nl80211.h"
 #include "iw.h"
 
diff --git a/info.c b/info.c
index 4ac1eab..d724ca2 100644
--- a/info.c
+++ b/info.c
@@ -1,5 +1,4 @@
 #include 
-#include 
 
 #include 
 #include 
diff --git a/link.c b/link.c
index f3bde51..0a32392 100644
--- a/link.c
+++ b/link.c
@@ -1,7 +1,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/mpp.c b/mpp.c
index 8859fd5..58bf28e 100644
--- a/mpp.c
+++ b/mpp.c
@@ -1,6 +1,5 @@
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/p2p.c b/p2p.c
index 2067916..2d4bab0 100644
--- a/p2p.c
+++ b/p2p.c
@@ -1,6 +1,3 @@
-#include 
-#include 
-
 #include 
 #include 
 #include 
diff --git a/scan.c b/scan.c
index d3c7d98..8762784 100644
--- a/scan.c
+++ b/scan.c
@@ -1,7 +1,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/survey.c b/survey.c
index 3e875a8..9325353 100644
--- a/survey.c
+++ b/survey.c
@@ -1,6 +1,4 @@
 #include 
-#include 
-#include 
 
 #include 
 #include 
-- 
1.7.9.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] staging: wilc1000: fix the bug on copying bssid

2015-10-21 Thread Dan Carpenter
On Tue, Oct 20, 2015 at 05:10:46PM +0900, Tony Cho wrote:
> This patch reverts the commit, d79fd35b8c5d927695b48fa35aa586919818cce9.
> 
> The WID_JOIN_REQ_EXTENDED among WIDs needs two parameters for the request to
> be sent to the firmware, which are the SA and the BSSID. For this case, both
> is the same bssid in the handle_connect function. So, it's required to be
> copied twice.
> 

I forsaw this, but I should have been more explicit when I complained
about d79fd35b8c5d927695b48fa35aa586919818cce9...

regards,
dan carpenter

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


[PATCH] iw: Print help text to "set bitrates" in case of no args

2015-10-21 Thread Ola Olsson
Signed-off-by: Ola Olsson 
---
 bitrate.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/bitrate.c b/bitrate.c
index 4a026a4..974b49c 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -110,6 +110,9 @@ static int handle_bitrates(struct nl80211_state *state,
S_GI,
} parser_state = S_NONE;
 
+   if (argc == 0)
+   return 1;
+
for (i = 0; i < argc; i++) {
char *end;
double tmpd;
-- 
1.7.9.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: [1/1] New driver: rtl8xxxu (mac80211)

2015-10-21 Thread Kalle Valo

> From: Jes Sorensen 
> 
> This is an alternate driver for a number of Realtek WiFi USB devices,
> including RTL8723AU, RTL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU.
> It was written from scratch utilizing the Linux mac80211 stack.
> 
> After spending months cleaning up the vendor provided rtl8723au
> driver, which comes with it's own 802.11 stack included, I decided to
> rewrite this driver from the bottom up.
> 
> Many thanks to Johannes Berg for 802.11 insights and help and Larry
> Finger for help with the vendor driver.
> 
> The full git log for the development of this driver can be found here:
> git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git
> branch rtl8723au-mac80211
> 
> This driver is still under development, but has proven to be very
> stable for me. It currently supports station mode only. It has support
> for OFDM and CCK rates. It does lack certain features found in the
> staging driver, such as power management, AMPDU, and 40MHz channel
> support. In addition it does not support AD-HOC, AP, and monitor mode
> support at this point.
> 
> The driver is known to work with the following devices:
> Lenovo Yoga (rtl8723au)
> TP-Link TL-WN823N (rtl8192cu)
> Etekcity 6R (rtl8188cu)
> Daffodil LAN03 (rtl8188cu)
> Alfa AWUS036NHR (rtl8188ru)
> 
> Signed-off-by: Jes Sorensen 

Thanks, applied to wireless-drivers-next.git.

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


[PATCH v2] rtl8xxxu: Enable monitor mode by handling filters

2015-10-21 Thread Bruno Randolf
Monitor mode is enabled by handling the filter flags we get from mac80211 in
rtl8xxxu_configure_filter() and writing them to the RCR register.

By handling the filters, we can also stop setting the BSSID filters in the
association event.

Signed-off-by: Bruno Randolf 
---
v2: Don't modify init table
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 56 +++-
 1 file changed, 45 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c 
b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
index 11fcfda..0399b1e 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c
@@ -4143,7 +4143,6 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
 * Configure initial WMAC settings
 */
val32 = RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_MCAST | RCR_ACCEPT_BCAST |
-   /* RCR_CHECK_BSSID_MATCH | RCR_CHECK_BSSID_BEACON | */
RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL |
RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC;
rtl8xxxu_write32(priv, REG_RCR, val32);
@@ -4476,10 +4475,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, 
struct ieee80211_vif *vif,
 
rtl8xxxu_update_rate_mask(priv, ramask, sgi);
 
-   val32 = rtl8xxxu_read32(priv, REG_RCR);
-   val32 |= RCR_CHECK_BSSID_MATCH | RCR_CHECK_BSSID_BEACON;
-   rtl8xxxu_write32(priv, REG_RCR, val32);
-
/* Enable RX of data frames */
rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0x);
 
@@ -4493,11 +4488,6 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, 
struct ieee80211_vif *vif,
 
h2c.joinbss.data = H2C_JOIN_BSS_CONNECT;
} else {
-   val32 = rtl8xxxu_read32(priv, REG_RCR);
-   val32 &= ~(RCR_CHECK_BSSID_MATCH |
-  RCR_CHECK_BSSID_BEACON);
-   rtl8xxxu_write32(priv, REG_RCR, val32);
-
val8 = rtl8xxxu_read8(priv, REG_BEACON_CTRL);
val8 |= BEACON_DISABLE_TSF_UPDATE;
rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8);
@@ -5272,11 +5262,55 @@ static void rtl8xxxu_configure_filter(struct 
ieee80211_hw *hw,
  unsigned int *total_flags, u64 multicast)
 {
struct rtl8xxxu_priv *priv = hw->priv;
+   u32 rcr = rtl8xxxu_read32(priv, REG_RCR);
 
dev_dbg(>udev->dev, "%s: changed_flags %08x, total_flags %08x\n",
__func__, changed_flags, *total_flags);
 
-   *total_flags &= (FIF_ALLMULTI | FIF_CONTROL | FIF_BCN_PRBRESP_PROMISC);
+   /*
+* FIF_ALLMULTI ignored as all multicast frames are accepted (REG_MAR)
+*/
+
+   if (*total_flags & FIF_FCSFAIL)
+   rcr |= RCR_ACCEPT_CRC32;
+   else
+   rcr &= ~RCR_ACCEPT_CRC32;
+
+   /*
+* FIF_PLCPFAIL not supported?
+*/
+
+   if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
+   rcr &= ~RCR_CHECK_BSSID_BEACON;
+   else
+   rcr |= RCR_CHECK_BSSID_BEACON;
+
+   if (*total_flags & FIF_CONTROL)
+   rcr |= RCR_ACCEPT_CTRL_FRAME;
+   else
+   rcr &= ~RCR_ACCEPT_CTRL_FRAME;
+
+   if (*total_flags & FIF_OTHER_BSS) {
+   rcr |= RCR_ACCEPT_AP;
+   rcr &= ~RCR_CHECK_BSSID_MATCH;
+   } else {
+   rcr &= ~RCR_ACCEPT_AP;
+   rcr |= RCR_CHECK_BSSID_MATCH;
+   }
+
+   if (*total_flags & FIF_PSPOLL)
+   rcr |= RCR_ACCEPT_PM;
+   else
+   rcr &= ~RCR_ACCEPT_PM;
+
+   /*
+* FIF_PROBE_REQ ignored as probe requests always seem to be accepted
+*/
+
+   rtl8xxxu_write32(priv, REG_RCR, rcr);
+
+   *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC | 
\
+FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL | 
FIF_PROBE_REQ);
 }
 
 static int rtl8xxxu_set_rts_threshold(struct ieee80211_hw *hw, u32 rts)
-- 
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: [v3] brcm80211: Add support for brcm4371

2015-10-21 Thread Kalle Valo

> This is a new Broadcom chip and we should be able to recognize it.
> 
> Signed-off-by: Eric Caruso 
> Acked-by: Arend van Spriel 

Thanks, applied to wireless-drivers-next.git.

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: [01/11] brcmfmac: expose device memory to devcoredump subsystem

2015-10-21 Thread Kalle Valo

> Upon PSM watchdog event received from firmware the driver will obtain
> a memory snapshot of the device and expose it to user-space through
> the devcoredump framework. This will trigger a uevent.
> 
> Reviewed-by: Hante Meuleman 
> Reviewed-by: Franky (Zhenhui) Lin 
> Reviewed-by: Pieter-Paul Giesberts 
> Signed-off-by: Arend van Spriel 

Thanks, 11 patches applied to wireless-drivers-next.git:

ff4445a8502c brcmfmac: expose device memory to devcoredump subsystem
185f0eb0b5fa brcmfmac: Fix race condition between USB probe/load and disconnect.
4a3462843f9f brcmfmac: rename firmware_path to alternative_fw_path
43569bfaf6ed brcmfmac: remove conversational comment
2b76acdbc043 brcmfmac: Rework p2p attach, use single method for p2p dev 
creation.
124d517211e4 brcmfmac: Fix station info rate information.
cae355dc90db brcmfmac: Add RSSI information to get_station.
bf2a7e0499b9 brcmfmac: Add dump_station support to cfg80221 ops.
c443e169577c brcmfmac: Move brcmf_c_preinit_dcmds prototype to correct file.
54b499d9ad10 brcmfmac: Remove unused state AP creating.
92121e69de8a brcmfmac: Properly set carrier state of netdev.

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