Re: [PATCH v2] mwifiex: fw download does not release sdio bus during failure

2016-04-20 Thread Julian Calaby
Hi All,

On Wed, Apr 20, 2016 at 2:20 PM, Marty Faltesek  wrote:
> Signed-off-by: Marty Faltesek 

This looks right to me.

Reviewed-by: Julian Calaby 

Thanks,

Julian Calaby


> ---
>  drivers/net/wireless/marvell/mwifiex/sdio.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
> b/drivers/net/wireless/marvell/mwifiex/sdio.c
> index 4c8cae6..d6ef34f 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> @@ -1026,13 +1026,12 @@ static int mwifiex_prog_fw_w_helper(struct 
> mwifiex_adapter *adapter,
> offset += txlen;
> } while (true);
>
> -   sdio_release_host(card->func);
> -
> mwifiex_dbg(adapter, MSG,
> "info: FW download over, size %d bytes\n", offset);
>
> ret = 0;
>  done:
> +   sdio_release_host(card->func);
> kfree(fwbuf);
> return ret;
>  }
> --
> 2.8.0.rc3.226.g39d4020
>
> --
> 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



-- 
Julian Calaby

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


[RESEND] Re: updating carl9170-1.fw in linux-firmware.git

2016-04-20 Thread Christian Lamparter
On Wednesday, April 20, 2016 10:59:44 AM Kalle Valo wrote:
> Christian Lamparter  writes:
> 
> > On Monday, April 18, 2016 07:42:05 PM Kalle Valo wrote:
> >> Christian Lamparter  writes:
> >> 
> >> > On Monday, April 18, 2016 06:45:09 PM Kalle Valo wrote:
> >> >
> >> >> Why even mention anything about a "special firmware" as the firmware is
> >> >> already available from linux-firmware.git? 
> >> >
> >> > Yes and no. 1.9.6 is in linux-firmware.git. I've tried to add 1.9.9 too
> >> > but that failed.
> >> > 
> >> 
> >> Rick's comment makes sense to me, better just to provide the latest
> >> version. No need to unnecessary confuse the users. And if someone really
> >> wants to use an older version that she can retrieve it from the git
> >> history.
> >
> > Part of the fun here is that firmware is GPLv2. The linux-firmware.git has
> > to point to or add the firmware source to their tree. They have added every
> > single source file to it instead of "packaging" it in a tar.bz2/gz/xz
> > like you normally do for release sources.
> >
> > If you want to read more about it:
> > 
> 
> Yeah, that's more work. I get that. But I'm still not understanding
> what's the actual problem which prevents us from updating carl9170
> firmware in linux-firmware.
I'm not sure, but why not ask? I've added the cc'ed Linux Firmware
Maintainers. So for those people reading the fw list:

What would it take to update the carl9170-1.fw firmware file in your
repository to the latest version?

Who has to sent the firmware update. Does it have to be the person who
sent the first request? (Xose)? The maintainer of the firmware (me)?
someone from Qualcomm Atheros? Or someone else (specific)? (the 
firmware is licensed as GPLv2 - in theory anyone should be able to
do that)

How should the firmware source update be handled? Currently the latest
.tar.xz of the firmware has ~130kb. The formated patches from 1.9.6 to
latest are about ~100kb (182 individual patches).

How does linux-firmware handle new binary firmware images and new 
sources? What if carl9170fw-2.bin is added. Do we need another
source directory for this in the current tree then? Because 
carl9170fw-1.bin will still be needed for backwards compatibility
so we basically need to duplicate parts of the source?

Also, how's the situation with ath9k_htc? The 1.4.0 image contains
some GPLv2 code as well? So, why is there no source in the tree, but 
just the link to it? Because, I would like to do basically the same
for carl9170fw and just add a link to the carl9170fw repository and
save everyone this source update "song and dance".

Regards,
Christian
--
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: RSS configuration in iwlwifi

2016-04-20 Thread Johannes Berg
On Wed, 2016-04-20 at 18:05 +0100, Ben Hutchings wrote:
> 
> I see.  You could make this work when the interface is down and
> return -EBUSY if the interface is up.
> 

It's slightly more complicated, since it doesn't just affect a single
netdev but possibly more than one (since the table is shared by all
virtual interfaces) - but yes, it could be done.

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: RSS configuration in iwlwifi

2016-04-20 Thread Ben Hutchings
On Wed, 2016-04-20 at 16:22 +, Grumbach, Emmanuel wrote:
> On Wed, 2016-04-20 at 16:47 +0100, Ben Hutchings wrote:
> > 
> > On Wed, 2016-04-20 at 15:30 +, Grumbach, Emmanuel wrote:
> > > 
> > > Hi Ben,
> > > 
> > > 
> > > Thanks for looking at our code.
> > > 
> > > 
> > > On Wed, 2016-04-20 at 16:08 +0100, Ben Hutchings wrote:
> > > > 
> > > > 
> > > > I'm not sure if you were aware, but there is a standard API for
> > > > configuring RSS in network drivers, part of ethtool_ops.  I think
> > > > iwlwifi should implement that rather than a driver-specific
> > > > debugfs
> > > > interface.
> > > > 
> > > You are right, this is why Sara made this commit:
> > > 
> > > commit 854d773e4ab586924af4ca5d851730849903
> > > Author: Sara Sharon 
> > > Date:   Tue Mar 22 15:55:58 2016 +0200
> > > 
> > > iwlwifi: mvm: improve RSS configuration
> > > 
> > > Improve current RSS configuration:
> > >  * Use netdev_rss_key instead of keeping a local copy.
> > >  * Configure also UDP hashing to have UDP traffic spread across
> > > queues.
> > >  Do not direct RSS traffic to our fallback queue.
> > > 
> > > Signed-off-by: Sara Sharon 
> > > Signed-off-by: Emmanuel Grumbach 
> > That doesn't really address what I said.  Yes, it's using the common
> > RSS key, but it's not implementing the ethtool operations to get and
> > set the indirection table and the types of flow hashing that are
> > enabled.
> > 
> Hm.. I think that setting the indirection table is a problem in our
> case because the PN check is done in the driver. The PN check is the
> way WiFi addresses the replay attack, and since the PN check relies on
> per-cpu variables, we cannot *safely* allow users to modify the
> indirection table while traffic is flowing.

I see.  You could make this work when the interface is down and return
-EBUSY if the interface is up.

Ben.

-- 
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.

signature.asc
Description: This is a digitally signed message part


Re: ap + adhoc not working with Mwifiex driver for sd8887

2016-04-20 Thread Luana Borgia
Hi Amitkumar,

thanks for the quick reply..

That's really sad, I hoped that you came with a way to setup the adhoc
in ahdemo, like atheros is doing. :(

Do you know if there is any plan to manage this in future?

Thanks for all support
best regards
Luana


2016-04-20 9:18 GMT-05:00 Amitkumar Karwar :
> Hi Luana,
>
>> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
>> ow...@vger.kernel.org] On Behalf Of Luana Borgia
>> Sent: Wednesday, April 20, 2016 11:14 AM
>> To: linux-wireless@vger.kernel.org; Avinash Patil
>> Subject: Fwd: ap + adhoc not working with Mwifiex driver for sd8887
>>
>> Hi,
>> I've successfully managed to get this driver working in adhoc with olsrd
>> on mlan0 interface, now I'm trying to add a uap0 working at the same
>> time, with all this command:
>>
>> rfkill unblock wlan
>> ip link set uap0 down
>> ip link set mlan0 down
>> iw dev mlan0 set type ibss
>> ip link set mlan0 up
>> iw dev mlan0 ibss join mesh 2437 fe:de:fe:de:fe:de olsrd-start.sh cat
>> < /etc/hostapd.conf ssid=PCM_AP_fede
>> interface=uap0
>> driver=nl80211
>> hw_mode=g
>> channel=6
>> EOF
>> iw phy phy0 interface add uap0 type __ap hostapd /etc/hostapd.conf &
>> dnsmasq --interface=uap0 --except-interface=lo --bind-interfaces --dhcp-
>> range=192.168.3.2,192.168.3.10,12h --conf-file=/dev/null ip addr add
>> 192.168.3.1/24 broadcast 192.168.3.255 dev uap0
>>
>> but I get this error after run the hostapd command:
>>
>> [ 4980.201096] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
>> [ 4983.335467] IPv6: ADDRCONF(NETDEV_UP): uap0: link is not ready [
>> 4983.358879] mwifiex_sdio mmc0:0001:1: CMD_RESP: cmd 0xb1 error,
>> result=0x1
>>
>> adhoc is fine, with the above order of command but if I run before
>> hostapd and than adhoc part than the issue occur in the adhoc part.
>>
>> I'm using the firmware
>> http://git.marvell.com/?p=mwifiex-
>> firmware.git;a=blob;f=mrvl/sd8887_uapsta.bin;h=165e6c3d34b0c2a630252907a
>> 7ac4daf6e13c9d5;hb=HEAD
>>
>> and the mwifiex from kernel linux 4.1.1
>>
>
> I checked with our team. We don’t support simultaneous operations of Adhoc 
> and AP network.
> Only one at a time can be used.
>
> Regards,
> Amitkumar
--
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 7/8] ath10k: switch testmode to use ath10k_core_fetch_firmware_api_n()

2016-04-20 Thread Kalle Valo
Now that all firmware-N.bin related are within struct ath10k_fw_file we can
switch to use ath10k_core_fetch_firmware_api_n() and delete almost identical
ath10k_tm_fetch_utf_firmware_api_2().

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |4 -
 drivers/net/wireless/ath/ath10k/core.h |2 
 drivers/net/wireless/ath/ath10k/testmode.c |  124 
 3 files changed, 6 insertions(+), 124 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 4af01afdaf6c..db9437a72ba4 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -976,8 +976,8 @@ success:
return 0;
 }
 
-static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char 
*name,
-   struct ath10k_fw_file *fw_file)
+int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
+struct ath10k_fw_file *fw_file)
 {
size_t magic_len, len, ie_len;
int ie_id, i, index, bit, ret;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index faa106654abd..1379054000f9 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -933,6 +933,8 @@ void ath10k_core_destroy(struct ath10k *ar);
 void ath10k_core_get_fw_features_str(struct ath10k *ar,
 char *buf,
 size_t max_len);
+int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
+struct ath10k_fw_file *fw_file);
 
 int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
  const struct ath10k_fw_components *fw_components);
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c 
b/drivers/net/wireless/ath/ath10k/testmode.c
index daf04d74c6d0..120f4234d3b0 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -139,127 +139,6 @@ static int ath10k_tm_cmd_get_version(struct ath10k *ar, 
struct nlattr *tb[])
return cfg80211_testmode_reply(skb);
 }
 
-static int ath10k_tm_fetch_utf_firmware_api_2(struct ath10k *ar,
- struct ath10k_fw_file *fw_file)
-{
-   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(_file->firmware, filename, ar->dev);
-   if (ret) {
-   ath10k_warn(ar, "failed to retrieve utf firmware '%s': %d\n",
-   filename, ret);
-   return ret;
-   }
-
-   data = fw_file->firmware->data;
-   len = fw_file->firmware->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);
-
-   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:
-   if (ie_len > sizeof(fw_file->fw_version) - 1)
-   break;
-
-   memcpy(fw_file->fw_version, data, ie_len);
-   fw_file->fw_version[ie_len] = '\0';
-
-   ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
-  "testmode found fw utf version %s\n",
-  fw_file->fw_version);
-   break;
-   case ATH10K_FW_IE_TIMESTAMP:
-   /* ignore timestamp, 

[PATCH v2 6/8] ath10k: move htt_op_version to struct ath10k_fw_file

2016-04-20 Thread Kalle Valo
Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |   12 ++--
 drivers/net/wireless/ath/ath10k/core.h |1 +
 drivers/net/wireless/ath/ath10k/debug.c|2 +-
 drivers/net/wireless/ath/ath10k/htt.c  |2 +-
 drivers/net/wireless/ath/ath10k/htt.h  |1 -
 drivers/net/wireless/ath/ath10k/mac.c  |2 +-
 drivers/net/wireless/ath/ath10k/testmode.c |1 +
 7 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index a7c99355a7c2..4af01afdaf6c 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1117,10 +1117,10 @@ static int ath10k_core_fetch_firmware_api_n(struct 
ath10k *ar, const char *name,
 
version = (__le32 *)data;
 
-   ar->htt.op_version = le32_to_cpup(version);
+   fw_file->htt_op_version = le32_to_cpup(version);
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie htt op 
version %d\n",
-  ar->htt.op_version);
+  fw_file->htt_op_version);
break;
case ATH10K_FW_IE_FW_CODE_SWAP_IMAGE:
ath10k_dbg(ar, ATH10K_DBG_BOOT,
@@ -1569,18 +1569,18 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
/* Backwards compatibility for firmwares without
 * ATH10K_FW_IE_HTT_OP_VERSION.
 */
-   if (ar->htt.op_version == ATH10K_FW_HTT_OP_VERSION_UNSET) {
+   if (fw_file->htt_op_version == ATH10K_FW_HTT_OP_VERSION_UNSET) {
switch (fw_file->wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
-   ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_MAIN;
+   fw_file->htt_op_version = ATH10K_FW_HTT_OP_VERSION_MAIN;
break;
case ATH10K_FW_WMI_OP_VERSION_10_1:
case ATH10K_FW_WMI_OP_VERSION_10_2:
case ATH10K_FW_WMI_OP_VERSION_10_2_4:
-   ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_10_1;
+   fw_file->htt_op_version = ATH10K_FW_HTT_OP_VERSION_10_1;
break;
case ATH10K_FW_WMI_OP_VERSION_TLV:
-   ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
+   fw_file->htt_op_version = ATH10K_FW_HTT_OP_VERSION_TLV;
break;
case ATH10K_FW_WMI_OP_VERSION_10_4:
case ATH10K_FW_WMI_OP_VERSION_UNSET:
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 412e01f77658..faa106654abd 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -634,6 +634,7 @@ struct ath10k_fw_file {
DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
 
enum ath10k_fw_wmi_op_version wmi_op_version;
+   enum ath10k_fw_htt_op_version htt_op_version;
 
const void *firmware_data;
size_t firmware_len;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 8a63ce5c6e09..e2511550fbb8 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -179,7 +179,7 @@ void ath10k_debug_print_boot_info(struct ath10k *ar)
ar->htt.target_version_major,
ar->htt.target_version_minor,
ar->normal_mode_fw.fw_file.wmi_op_version,
-   ar->htt.op_version,
+   ar->normal_mode_fw.fw_file.htt_op_version,
ath10k_cal_mode_str(ar->cal_mode),
ar->max_num_stations,
test_bit(ATH10K_FLAG_RAW_MODE, >dev_flags),
diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index ee79512b1fcc..130cd9502021 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -183,7 +183,7 @@ int ath10k_htt_init(struct ath10k *ar)
8 + /* llc snap */
2; /* ip4 dscp or ip6 priority */
 
-   switch (ar->htt.op_version) {
+   switch (ar->running_fw->fw_file.htt_op_version) {
case ATH10K_FW_HTT_OP_VERSION_10_4:
ar->htt.t2h_msg_types = htt_10_4_t2h_msg_types;
ar->htt.t2h_msg_types_max = HTT_10_4_T2H_NUM_MSGS;
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index ee7c8f8f8073..911c535d0863 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1562,7 +1562,6 @@ struct ath10k_htt {
u8 target_version_major;
u8 target_version_minor;
struct completion 

[PATCH v2 8/8] ath10k: remove enum ath10k_swap_code_seg_bin_type

2016-04-20 Thread Kalle Valo
It's not needed for anything so just get rid of it.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |3 +--
 drivers/net/wireless/ath/ath10k/swap.c |   22 ++
 drivers/net/wireless/ath/ath10k/swap.h |9 +
 3 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index db9437a72ba4..e94cb87380d2 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -647,8 +647,7 @@ static int ath10k_download_fw(struct ath10k *ar)
data = ar->running_fw->fw_file.firmware_data;
data_len = ar->running_fw->fw_file.firmware_len;
 
-   ret = ath10k_swap_code_seg_configure(ar,
-ATH10K_SWAP_CODE_SEG_BIN_TYPE_FW);
+   ret = ath10k_swap_code_seg_configure(ar);
if (ret) {
ath10k_err(ar, "failed to configure fw code swap: %d\n",
   ret);
diff --git a/drivers/net/wireless/ath/ath10k/swap.c 
b/drivers/net/wireless/ath/ath10k/swap.c
index 47d449bac86d..0c5f5863dac8 100644
--- a/drivers/net/wireless/ath/ath10k/swap.c
+++ b/drivers/net/wireless/ath/ath10k/swap.c
@@ -134,27 +134,17 @@ ath10k_swap_code_seg_alloc(struct ath10k *ar, size_t 
swap_bin_len)
return seg_info;
 }
 
-int ath10k_swap_code_seg_configure(struct ath10k *ar,
-  enum ath10k_swap_code_seg_bin_type type)
+int ath10k_swap_code_seg_configure(struct ath10k *ar)
 {
int ret;
struct ath10k_swap_code_seg_info *seg_info = NULL;
 
-   switch (type) {
-   case ATH10K_SWAP_CODE_SEG_BIN_TYPE_FW:
-   if (!ar->swap.firmware_swap_code_seg_info)
-   return 0;
-
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot found firmware code swap 
binary\n");
-   seg_info = ar->swap.firmware_swap_code_seg_info;
-   break;
-   default:
-   case ATH10K_SWAP_CODE_SEG_BIN_TYPE_OTP:
-   case ATH10K_SWAP_CODE_SEG_BIN_TYPE_UTF:
-   ath10k_warn(ar, "ignoring unknown code swap binary type %d\n",
-   type);
+   if (!ar->swap.firmware_swap_code_seg_info)
return 0;
-   }
+
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot found firmware code swap 
binary\n");
+
+   seg_info = ar->swap.firmware_swap_code_seg_info;
 
ret = ath10k_bmi_write_memory(ar, seg_info->target_addr,
  _info->seg_hw_info,
diff --git a/drivers/net/wireless/ath/ath10k/swap.h 
b/drivers/net/wireless/ath/ath10k/swap.h
index 5c89952dd20f..36991c7b07a0 100644
--- a/drivers/net/wireless/ath/ath10k/swap.h
+++ b/drivers/net/wireless/ath/ath10k/swap.h
@@ -39,12 +39,6 @@ union ath10k_swap_code_seg_item {
struct ath10k_swap_code_seg_tail tail;
 } __packed;
 
-enum ath10k_swap_code_seg_bin_type {
-ATH10K_SWAP_CODE_SEG_BIN_TYPE_OTP,
-ATH10K_SWAP_CODE_SEG_BIN_TYPE_FW,
-ATH10K_SWAP_CODE_SEG_BIN_TYPE_UTF,
-};
-
 struct ath10k_swap_code_seg_hw_info {
/* Swap binary image size */
__le32 swap_size;
@@ -64,8 +58,7 @@ struct ath10k_swap_code_seg_info {
dma_addr_t paddr[ATH10K_SWAP_CODE_SEG_NUM_SUPPORTED];
 };
 
-int ath10k_swap_code_seg_configure(struct ath10k *ar,
-  enum ath10k_swap_code_seg_bin_type type);
+int ath10k_swap_code_seg_configure(struct ath10k *ar);
 void ath10k_swap_code_seg_release(struct ath10k *ar);
 int ath10k_swap_code_seg_init(struct ath10k *ar);
 

--
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 4/8] ath10k: move fw_features to struct ath10k_fw_file

2016-04-20 Thread Kalle Valo
Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |   28 +++-
 drivers/net/wireless/ath/ath10k/core.h |5 ++---
 drivers/net/wireless/ath/ath10k/htt_rx.c   |2 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c   |9 ++---
 drivers/net/wireless/ath/ath10k/mac.c  |   14 --
 drivers/net/wireless/ath/ath10k/testmode.c |   14 --
 drivers/net/wireless/ath/ath10k/wmi.c  |5 +++--
 drivers/net/wireless/ath/ath10k/wow.c  |7 ---
 8 files changed, 39 insertions(+), 45 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 015241aec608..71b8ca71d1da 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -261,7 +261,7 @@ void ath10k_core_get_fw_features_str(struct ath10k *ar,
int i;
 
for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) {
-   if (test_bit(i, ar->fw_features)) {
+   if (test_bit(i, ar->normal_mode_fw.fw_file.fw_features)) {
if (len > 0)
len += scnprintf(buf + len, buf_len - len, ",");
 
@@ -627,7 +627,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
 
if (!(skip_otp || test_bit(ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
-  ar->fw_features)) &&
+  ar->running_fw->fw_file.fw_features)) &&
result != 0) {
ath10k_err(ar, "otp calibration failed: %d", result);
return -EINVAL;
@@ -1074,13 +1074,13 @@ static int ath10k_core_fetch_firmware_api_n(struct 
ath10k *ar, const char *name,
ath10k_dbg(ar, ATH10K_DBG_BOOT,
   "Enabling feature bit: %i\n",
   i);
-   __set_bit(i, ar->fw_features);
+   __set_bit(i, fw_file->fw_features);
}
}
 
ath10k_dbg_dump(ar, ATH10K_DBG_BOOT, "features", "",
-   ar->fw_features,
-   sizeof(ar->fw_features));
+   ar->running_fw->fw_file.fw_features,
+   sizeof(fw_file->fw_features));
break;
case ATH10K_FW_IE_FW_IMAGE:
ath10k_dbg(ar, ATH10K_DBG_BOOT,
@@ -1430,8 +1430,10 @@ static void ath10k_core_restart(struct work_struct *work)
 
 static int ath10k_core_init_firmware_features(struct ath10k *ar)
 {
-   if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features) &&
-   !test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
+   struct ath10k_fw_file *fw_file = >normal_mode_fw.fw_file;
+
+   if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) &&
+   !test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
ath10k_err(ar, "feature bits corrupted: 10.2 feature requires 
10.x feature to be set as well");
return -EINVAL;
}
@@ -1450,7 +1452,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
break;
case ATH10K_CRYPT_MODE_SW:
if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
- ar->fw_features)) {
+ fw_file->fw_features)) {
ath10k_err(ar, "cryptmode > 0 requires raw mode support 
from firmware");
return -EINVAL;
}
@@ -1469,7 +1471,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
 
if (rawmode) {
if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
- ar->fw_features)) {
+ fw_file->fw_features)) {
ath10k_err(ar, "rawmode = 1 requires support from 
firmware");
return -EINVAL;
}
@@ -1495,9 +1497,9 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
 * ATH10K_FW_IE_WMI_OP_VERSION.
 */
if (ar->wmi.op_version == ATH10K_FW_WMI_OP_VERSION_UNSET) {
-   if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
+   if (test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2,
-ar->fw_features))
+fw_file->fw_features))
ar->wmi.op_version = 
ATH10K_FW_WMI_OP_VERSION_10_2;
 

[PATCH v2 5/8] ath10k: move wmi_op_version to struct ath10k_fw_file

2016-04-20 Thread Kalle Valo
Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |   20 ++--
 drivers/net/wireless/ath/ath10k/core.h |5 ++---
 drivers/net/wireless/ath/ath10k/debug.c|2 +-
 drivers/net/wireless/ath/ath10k/mac.c  |2 +-
 drivers/net/wireless/ath/ath10k/testmode.c |   17 ++---
 drivers/net/wireless/ath/ath10k/wmi.c  |4 ++--
 6 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 71b8ca71d1da..a7c99355a7c2 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1106,10 +1106,10 @@ static int ath10k_core_fetch_firmware_api_n(struct 
ath10k *ar, const char *name,
 
version = (__le32 *)data;
 
-   ar->wmi.op_version = le32_to_cpup(version);
+   fw_file->wmi_op_version = le32_to_cpup(version);
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "found fw ie wmi op 
version %d\n",
-  ar->wmi.op_version);
+  fw_file->wmi_op_version);
break;
case ATH10K_FW_IE_HTT_OP_VERSION:
if (ie_len != sizeof(u32))
@@ -1438,9 +1438,9 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
return -EINVAL;
}
 
-   if (ar->wmi.op_version >= ATH10K_FW_WMI_OP_VERSION_MAX) {
+   if (fw_file->wmi_op_version >= ATH10K_FW_WMI_OP_VERSION_MAX) {
ath10k_err(ar, "unsupported WMI OP version (max %d): %d\n",
-  ATH10K_FW_WMI_OP_VERSION_MAX, ar->wmi.op_version);
+  ATH10K_FW_WMI_OP_VERSION_MAX, 
fw_file->wmi_op_version);
return -EINVAL;
}
 
@@ -1496,19 +1496,19 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
/* Backwards compatibility for firmwares without
 * ATH10K_FW_IE_WMI_OP_VERSION.
 */
-   if (ar->wmi.op_version == ATH10K_FW_WMI_OP_VERSION_UNSET) {
+   if (fw_file->wmi_op_version == ATH10K_FW_WMI_OP_VERSION_UNSET) {
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2,
 fw_file->fw_features))
-   ar->wmi.op_version = 
ATH10K_FW_WMI_OP_VERSION_10_2;
+   fw_file->wmi_op_version = 
ATH10K_FW_WMI_OP_VERSION_10_2;
else
-   ar->wmi.op_version = 
ATH10K_FW_WMI_OP_VERSION_10_1;
+   fw_file->wmi_op_version = 
ATH10K_FW_WMI_OP_VERSION_10_1;
} else {
-   ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_MAIN;
+   fw_file->wmi_op_version = ATH10K_FW_WMI_OP_VERSION_MAIN;
}
}
 
-   switch (ar->wmi.op_version) {
+   switch (fw_file->wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->max_num_peers = TARGET_NUM_PEERS;
ar->max_num_stations = TARGET_NUM_STATIONS;
@@ -1570,7 +1570,7 @@ static int ath10k_core_init_firmware_features(struct 
ath10k *ar)
 * ATH10K_FW_IE_HTT_OP_VERSION.
 */
if (ar->htt.op_version == ATH10K_FW_HTT_OP_VERSION_UNSET) {
-   switch (ar->wmi.op_version) {
+   switch (fw_file->wmi_op_version) {
case ATH10K_FW_WMI_OP_VERSION_MAIN:
ar->htt.op_version = ATH10K_FW_HTT_OP_VERSION_MAIN;
break;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 0ee6ae4fbae0..412e01f77658 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -139,7 +139,6 @@ struct ath10k_mem_chunk {
 };
 
 struct ath10k_wmi {
-   enum ath10k_fw_wmi_op_version op_version;
enum ath10k_htc_ep_id eid;
struct completion service_ready;
struct completion unified_ready;
@@ -634,6 +633,8 @@ struct ath10k_fw_file {
 
DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
 
+   enum ath10k_fw_wmi_op_version wmi_op_version;
+
const void *firmware_data;
size_t firmware_len;
 
@@ -895,8 +896,6 @@ struct ath10k {
struct {
/* protected by conf_mutex */
struct ath10k_fw_components utf_mode_fw;
-   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;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 27787d23b2bd..8a63ce5c6e09 100644

[PATCH v2 3/8] ath10k: move fw_version inside struct ath10k_fw_file

2016-04-20 Thread Kalle Valo
Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n().

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |   13 +
 drivers/net/wireless/ath/ath10k/core.h |3 ++-
 drivers/net/wireless/ath/ath10k/testmode.c |   12 ++--
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index b2efece5b32d..015241aec608 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1039,15 +1039,15 @@ static int ath10k_core_fetch_firmware_api_n(struct 
ath10k *ar, const char *name,
 
switch (ie_id) {
case ATH10K_FW_IE_FW_VERSION:
-   if (ie_len > sizeof(ar->hw->wiphy->fw_version) - 1)
+   if (ie_len > sizeof(fw_file->fw_version) - 1)
break;
 
-   memcpy(ar->hw->wiphy->fw_version, data, ie_len);
-   ar->hw->wiphy->fw_version[ie_len] = '\0';
+   memcpy(fw_file->fw_version, data, ie_len);
+   fw_file->fw_version[ie_len] = '\0';
 
ath10k_dbg(ar, ATH10K_DBG_BOOT,
   "found fw version %s\n",
-   ar->hw->wiphy->fw_version);
+   fw_file->fw_version);
break;
case ATH10K_FW_IE_TIMESTAMP:
if (ie_len != sizeof(u32))
@@ -1866,6 +1866,11 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
goto err_power_down;
}
 
+   BUILD_BUG_ON(sizeof(ar->hw->wiphy->fw_version) !=
+sizeof(ar->normal_mode_fw.fw_file.fw_version));
+   memcpy(ar->hw->wiphy->fw_version, ar->normal_mode_fw.fw_file.fw_version,
+  sizeof(ar->hw->wiphy->fw_version));
+
ath10k_debug_print_hwfw_info(ar);
 
ret = ath10k_core_pre_cal_download(ar);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 16d6069c361f..e99f664bde9e 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -630,6 +630,8 @@ enum ath10k_tx_pause_reason {
 struct ath10k_fw_file {
const struct firmware *firmware;
 
+   char fw_version[ETHTOOL_FWVERS_LEN];
+
const void *firmware_data;
size_t firmware_len;
 
@@ -893,7 +895,6 @@ struct ath10k {
struct {
/* protected by conf_mutex */
struct ath10k_fw_components utf_mode_fw;
-   char utf_version[32];
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;
diff --git a/drivers/net/wireless/ath/ath10k/testmode.c 
b/drivers/net/wireless/ath/ath10k/testmode.c
index 480fad301fad..2c4a5d31cf0c 100644
--- a/drivers/net/wireless/ath/ath10k/testmode.c
+++ b/drivers/net/wireless/ath/ath10k/testmode.c
@@ -205,15 +205,15 @@ static int ath10k_tm_fetch_utf_firmware_api_2(struct 
ath10k *ar,
 
switch (ie_id) {
case ATH10K_FW_IE_FW_VERSION:
-   if (ie_len > sizeof(ar->testmode.utf_version) - 1)
+   if (ie_len > sizeof(fw_file->fw_version) - 1)
break;
 
-   memcpy(ar->testmode.utf_version, data, ie_len);
-   ar->testmode.utf_version[ie_len] = '\0';
+   memcpy(fw_file->fw_version, data, ie_len);
+   fw_file->fw_version[ie_len] = '\0';
 
ath10k_dbg(ar, ATH10K_DBG_TESTMODE,
   "testmode found fw utf version %s\n",
-  ar->testmode.utf_version);
+  fw_file->fw_version);
break;
case ATH10K_FW_IE_TIMESTAMP:
/* ignore timestamp, but don't warn about it either */
@@ -392,8 +392,8 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, 
struct nlattr *tb[])
 
ar->state = ATH10K_STATE_UTF;
 
-   if (strlen(ar->testmode.utf_version) > 0)
-   ver = ar->testmode.utf_version;
+   if (strlen(ar->testmode.utf_mode_fw.fw_file.fw_version) > 0)
+   ver = ar->testmode.utf_mode_fw.fw_file.fw_version;
else
ver = "API 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/8] ath10k: refactor firmware images to struct ath10k_fw_components

2016-04-20 Thread Kalle Valo
To make it easier to share ath10k_core_fetch_board_data_api_n() with testmode.c
refactor all firmware components to struct ath10k_fw_components. This structure
will hold firmware related files, for example firmware-N.bin and board-N.bin.

For firmware-N.bin create a new struct ath10k_fw_file which contains the actual
firmware image as well as the parsed data from the image.

Modify ath10k_core_start() to take struct ath10k_fw_components() as an argument
which makes it possible in following patches to drop some ugly hacks from
testmode.c.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |  176 +++-
 drivers/net/wireless/ath/ath10k/core.h |   46 +--
 drivers/net/wireless/ath/ath10k/debug.c|   28 +++-
 drivers/net/wireless/ath/ath10k/mac.c  |3 
 drivers/net/wireless/ath/ath10k/swap.c |   22 ++--
 drivers/net/wireless/ath/ath10k/testmode.c |   61 ++
 6 files changed, 199 insertions(+), 137 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 48389e0b87f6..b2efece5b32d 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -538,7 +538,8 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k 
*ar)
 
address = ar->hw_params.patch_load_addr;
 
-   if (!ar->otp_data || !ar->otp_len) {
+   if (!ar->normal_mode_fw.fw_file.otp_data ||
+   !ar->normal_mode_fw.fw_file.otp_len) {
ath10k_warn(ar,
"failed to retrieve board id because of invalid 
otp\n");
return -ENODATA;
@@ -546,9 +547,11 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k 
*ar)
 
ath10k_dbg(ar, ATH10K_DBG_BOOT,
   "boot upload otp to 0x%x len %zd for board id\n",
-  address, ar->otp_len);
+  address, ar->normal_mode_fw.fw_file.otp_len);
 
-   ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
+   ret = ath10k_bmi_fast_download(ar, address,
+  ar->normal_mode_fw.fw_file.otp_data,
+  ar->normal_mode_fw.fw_file.otp_len);
if (ret) {
ath10k_err(ar, "could not write otp for board id check: %d\n",
   ret);
@@ -586,7 +589,9 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
u32 bmi_otp_exe_param = ar->hw_params.otp_exe_param;
int ret;
 
-   ret = ath10k_download_board_data(ar, ar->board_data, ar->board_len);
+   ret = ath10k_download_board_data(ar,
+ar->running_fw->board_data,
+ar->running_fw->board_len);
if (ret) {
ath10k_err(ar, "failed to download board data: %d\n", ret);
return ret;
@@ -594,16 +599,20 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
 
/* OTP is optional */
 
-   if (!ar->otp_data || !ar->otp_len) {
+   if (!ar->running_fw->fw_file.otp_data ||
+   !ar->running_fw->fw_file.otp_len) {
ath10k_warn(ar, "Not running otp, calibration will be incorrect 
(otp-data %p otp_len %zd)!\n",
-   ar->otp_data, ar->otp_len);
+   ar->running_fw->fw_file.otp_data,
+   ar->running_fw->fw_file.otp_len);
return 0;
}
 
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n",
-  address, ar->otp_len);
+  address, ar->running_fw->fw_file.otp_len);
 
-   ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
+   ret = ath10k_bmi_fast_download(ar, address,
+  ar->running_fw->fw_file.otp_data,
+  ar->running_fw->fw_file.otp_len);
if (ret) {
ath10k_err(ar, "could not write otp (%d)\n", ret);
return ret;
@@ -627,46 +636,33 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
return 0;
 }
 
-static int ath10k_download_fw(struct ath10k *ar, enum ath10k_firmware_mode 
mode)
+static int ath10k_download_fw(struct ath10k *ar)
 {
u32 address, data_len;
-   const char *mode_name;
const void *data;
int ret;
 
address = ar->hw_params.patch_load_addr;
 
-   switch (mode) {
-   case ATH10K_FIRMWARE_MODE_NORMAL:
-   data = ar->firmware_data;
-   data_len = ar->firmware_len;
-   mode_name = "normal";
-   ret = ath10k_swap_code_seg_configure(ar,
-
ATH10K_SWAP_CODE_SEG_BIN_TYPE_FW);
-   if (ret) {
-   ath10k_err(ar, "failed to configure fw code swap: %d\n",
-  ret);
-   

[PATCH v2 1/8] ath10k: remove deprecated firmware API 1 support

2016-04-20 Thread Kalle Valo
This has ben deprecated years ago, I haven't heard anyone using it since and
most likely it won't even work anymore. So just remove all of it.

Signed-off-by: Kalle Valo 
---
 drivers/net/wireless/ath/ath10k/core.c |   73 
 drivers/net/wireless/ath/ath10k/core.h |3 -
 drivers/net/wireless/ath/ath10k/hw.h   |   12 -
 drivers/net/wireless/ath/ath10k/pci.c  |1 
 drivers/net/wireless/ath/ath10k/wmi.c  |4 --
 5 files changed, 93 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 1c4106b84a35..48389e0b87f6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -63,8 +63,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.cal_data_len = 2116,
.fw = {
.dir = QCA988X_HW_2_0_FW_DIR,
-   .fw = QCA988X_HW_2_0_FW_FILE,
-   .otp = QCA988X_HW_2_0_OTP_FILE,
.board = QCA988X_HW_2_0_BOARD_DATA_FILE,
.board_size = QCA988X_BOARD_DATA_SZ,
.board_ext_size = QCA988X_BOARD_EXT_DATA_SZ,
@@ -82,8 +80,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
-   .fw = QCA6174_HW_2_1_FW_FILE,
-   .otp = QCA6174_HW_2_1_OTP_FILE,
.board = QCA6174_HW_2_1_BOARD_DATA_FILE,
.board_size = QCA6174_BOARD_DATA_SZ,
.board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
@@ -102,8 +98,6 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] 
= {
.cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_2_1_FW_DIR,
-   .fw = QCA6174_HW_2_1_FW_FILE,
-   .otp = QCA6174_HW_2_1_OTP_FILE,
.board = QCA6174_HW_2_1_BOARD_DATA_FILE,
.board_size = QCA6174_BOARD_DATA_SZ,
.board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
@@ -122,8 +116,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.cal_data_len = 8124,
.fw = {
.dir = QCA6174_HW_3_0_FW_DIR,
-   .fw = QCA6174_HW_3_0_FW_FILE,
-   .otp = QCA6174_HW_3_0_OTP_FILE,
.board = QCA6174_HW_3_0_BOARD_DATA_FILE,
.board_size = QCA6174_BOARD_DATA_SZ,
.board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
@@ -143,8 +135,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.fw = {
/* uses same binaries as hw3.0 */
.dir = QCA6174_HW_3_0_FW_DIR,
-   .fw = QCA6174_HW_3_0_FW_FILE,
-   .otp = QCA6174_HW_3_0_OTP_FILE,
.board = QCA6174_HW_3_0_BOARD_DATA_FILE,
.board_size = QCA6174_BOARD_DATA_SZ,
.board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
@@ -167,8 +157,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.cal_data_len = 12064,
.fw = {
.dir = QCA99X0_HW_2_0_FW_DIR,
-   .fw = QCA99X0_HW_2_0_FW_FILE,
-   .otp = QCA99X0_HW_2_0_OTP_FILE,
.board = QCA99X0_HW_2_0_BOARD_DATA_FILE,
.board_size = QCA99X0_BOARD_DATA_SZ,
.board_ext_size = QCA99X0_BOARD_EXT_DATA_SZ,
@@ -186,8 +174,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.cal_data_len = 8124,
.fw = {
.dir = QCA9377_HW_1_0_FW_DIR,
-   .fw = QCA9377_HW_1_0_FW_FILE,
-   .otp = QCA9377_HW_1_0_OTP_FILE,
.board = QCA9377_HW_1_0_BOARD_DATA_FILE,
.board_size = QCA9377_BOARD_DATA_SZ,
.board_ext_size = QCA9377_BOARD_EXT_DATA_SZ,
@@ -205,8 +191,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.cal_data_len = 8124,
.fw = {
.dir = QCA9377_HW_1_0_FW_DIR,
-   .fw = QCA9377_HW_1_0_FW_FILE,
-   .otp = QCA9377_HW_1_0_OTP_FILE,
.board = QCA9377_HW_1_0_BOARD_DATA_FILE,
.board_size = QCA9377_BOARD_DATA_SZ,
.board_ext_size = QCA9377_BOARD_EXT_DATA_SZ,
@@ -229,8 +213,6 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.cal_data_len = 12064,
.fw = {
.dir = 

[PATCH v2 0/8] ath10k: refactor firmware components

2016-04-20 Thread Kalle Valo
This series refactors various ath10k firmware components into struct
ath10k_fw_components which contains everything firmware related (board
files, meta data and so on). This makes it possible to kill
ath10k_tm_fetch_utf_firmware_api_2() from testmode.c.

Also REALLY old FW API 1 (firmware.bin and otp.bin) support is
removed.

v2:

o patch 1: remove all unused "firmware.bin" and "otp.bin" defines

o patch 2: remove a lefover FIXME comment, create local variable for
  ar->normal_mode_fw.fw_file.firmware

o patch 2: fix block comment styles

o patch 2: fix long lines

drivers/net/wireless/ath/ath10k/testmode.c:200: line over 90 characters
drivers/net/wireless/ath/ath10k/testmode.c:201: line over 90 characters

---

Kalle Valo (8):
  ath10k: remove deprecated firmware API 1 support
  ath10k: refactor firmware images to struct ath10k_fw_components
  ath10k: move fw_version inside struct ath10k_fw_file
  ath10k: move fw_features to struct ath10k_fw_file
  ath10k: move wmi_op_version to struct ath10k_fw_file
  ath10k: move htt_op_version to struct ath10k_fw_file
  ath10k: switch testmode to use ath10k_core_fetch_firmware_api_n()
  ath10k: remove enum ath10k_swap_code_seg_bin_type


 drivers/net/wireless/ath/ath10k/core.c |  321 
 drivers/net/wireless/ath/ath10k/core.h |   65 +++---
 drivers/net/wireless/ath/ath10k/debug.c|   32 ++-
 drivers/net/wireless/ath/ath10k/htt.c  |2 
 drivers/net/wireless/ath/ath10k/htt.h  |1 
 drivers/net/wireless/ath/ath10k/htt_rx.c   |2 
 drivers/net/wireless/ath/ath10k/htt_tx.c   |9 +
 drivers/net/wireless/ath/ath10k/hw.h   |   12 -
 drivers/net/wireless/ath/ath10k/mac.c  |   21 +-
 drivers/net/wireless/ath/ath10k/pci.c  |1 
 drivers/net/wireless/ath/ath10k/swap.c |   44 ++--
 drivers/net/wireless/ath/ath10k/swap.h |9 -
 drivers/net/wireless/ath/ath10k/testmode.c |  197 +++--
 drivers/net/wireless/ath/ath10k/wmi.c  |   13 -
 drivers/net/wireless/ath/ath10k/wow.c  |7 -
 15 files changed, 282 insertions(+), 454 deletions(-)

--
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] rt2800usb: enable MFP if hw crypt is disabled

2016-04-20 Thread Yeoh Chun-Yeow
Noted. Patch v2 sent.


Chun-Yeow

On Thu, Apr 21, 2016 at 12:04 AM, Stanislaw Gruszka  wrote:
> On Wed, Apr 20, 2016 at 02:59:32PM +0800, Chun-Yeow Yeoh wrote:
>> If rt2800usb is loaded with nohwcrypt=1, mac80211 takes
>> care of the crypto with software encryption/decryption
>> and thus, MFP can be used.
>>
>> Tested for secured mesh using ath9k_htc and ath9k.
>>
>> Signed-off-by: Chun-Yeow Yeoh 
>> ---
>>  drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 
>> b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
>> index 4b0bb6b..84ea329 100644
>> --- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
>> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
>> @@ -48,6 +48,7 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware 
>> encryption.");
>>
>>  static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
>>  {
>> + ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE);
>>   return modparam_nohwcrypt;
>
> You set MFP feature regardless if actually hwcrypt is disabled or not.
> Beside this should not be done in function which is intended to test
> if hw crypto is disabled. Please set the future in place where other
> hw->flags are set.
>
> Thanks
> Stanislaw
--
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] rt2800lib: enable MFP if hw crypt is disabled

2016-04-20 Thread Chun-Yeow Yeoh
If rt2800usb is loaded with nohwcrypt=1, mac80211 takes
care of the crypto with software encryption/decryption
and thus, MFP can be used.

Tested for secured mesh using ath9k_htc and ath9k.

Signed-off-by: Chun-Yeow Yeoh 

v2: set MFP correctly (Stanislaw Gruszka)
---
 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c 
b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 7fa0128..716468a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -7492,6 +7492,10 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev 
*rt2x00dev)
if (!rt2x00_is_usb(rt2x00dev))
ieee80211_hw_set(rt2x00dev->hw, HOST_BROADCAST_PS_BUFFERING);
 
+   /* Set MFP if HW crypto is disabled. */
+   if (rt2800_hwcrypt_disabled(rt2x00dev))
+   ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE);
+
SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
rt2800_eeprom_addr(rt2x00dev,
-- 
2.3.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: RSS configuration in iwlwifi

2016-04-20 Thread Grumbach, Emmanuel
On Wed, 2016-04-20 at 19:22 +0300, Emmanuel Grumbach wrote:
> On Wed, 2016-04-20 at 16:47 +0100, Ben Hutchings wrote:
> > On Wed, 2016-04-20 at 15:30 +, Grumbach, Emmanuel wrote:
> > > Hi Ben,
> > > 
> > > 
> > > Thanks for looking at our code.
> > > 
> > > 
> > > On Wed, 2016-04-20 at 16:08 +0100, Ben Hutchings wrote:
> > > > 
> > > > I'm not sure if you were aware, but there is a standard API for
> > > > configuring RSS in network drivers, part of ethtool_ops.  I
> > > > think
> > > > iwlwifi should implement that rather than a driver-specific
> > > > debugfs
> > > > interface.
> > > > 
> > > You are right, this is why Sara made this commit:
> > > 
> > > commit 854d773e4ab586924af4ca5d851730849903
> > > Author: Sara Sharon 
> > > Date:   Tue Mar 22 15:55:58 2016 +0200
> > > 
> > > iwlwifi: mvm: improve RSS configuration
> > > 
> > > Improve current RSS configuration:
> > >  * Use netdev_rss_key instead of keeping a local copy.
> > >  * Configure also UDP hashing to have UDP traffic spread
> > > across
> > > queues.
> > >  Do not direct RSS traffic to our fallback queue.
> > > 
> > > Signed-off-by: Sara Sharon 
> > > Signed-off-by: Emmanuel Grumbach  > > >
> > 
> > That doesn't really address what I said.  Yes, it's using the
> > common
> > RSS key, but it's not implementing the ethtool operations to get
> > and
> > set the indirection table and the types of flow hashing that are
> > enabled.
> > 
> 
> Hm.. I think that setting the indirection table is a problem in our
> case because the PN check is done in the driver. The PN check is the
> way WiFi addresses the replay attack, and since the PN check relies
> on
> per-cpu variables, we cannot *safely* allow users to modify the
> indirection table while traffic is flowing.
> 

Oh - and yes, we do have a debugfs hook for that. It was meant for the
very early testing phases. I guess that we should remove it at some
point, unless we decide that whoever wants to play with the indirection
table while inbound traffic is flowing puts himself at risk.

> > Ben.
> > 

Re: RSS configuration in iwlwifi

2016-04-20 Thread Grumbach, Emmanuel
On Wed, 2016-04-20 at 16:47 +0100, Ben Hutchings wrote:
> On Wed, 2016-04-20 at 15:30 +, Grumbach, Emmanuel wrote:
> > Hi Ben,
> > 
> > 
> > Thanks for looking at our code.
> > 
> > 
> > On Wed, 2016-04-20 at 16:08 +0100, Ben Hutchings wrote:
> > > 
> > > I'm not sure if you were aware, but there is a standard API for
> > > configuring RSS in network drivers, part of ethtool_ops.  I think
> > > iwlwifi should implement that rather than a driver-specific
> > > debugfs
> > > interface.
> > > 
> > You are right, this is why Sara made this commit:
> > 
> > commit 854d773e4ab586924af4ca5d851730849903
> > Author: Sara Sharon 
> > Date:   Tue Mar 22 15:55:58 2016 +0200
> > 
> > iwlwifi: mvm: improve RSS configuration
> > 
> > Improve current RSS configuration:
> >  * Use netdev_rss_key instead of keeping a local copy.
> >  * Configure also UDP hashing to have UDP traffic spread across
> > queues.
> >  Do not direct RSS traffic to our fallback queue.
> >
> > Signed-off-by: Sara Sharon 
> > Signed-off-by: Emmanuel Grumbach 
> 
> That doesn't really address what I said.  Yes, it's using the common
> RSS key, but it's not implementing the ethtool operations to get and
> set the indirection table and the types of flow hashing that are
> enabled.
> 

Hm.. I think that setting the indirection table is a problem in our
case because the PN check is done in the driver. The PN check is the
way WiFi addresses the replay attack, and since the PN check relies on
per-cpu variables, we cannot *safely* allow users to modify the
indirection table while traffic is flowing.

> Ben.
> 

Re: [PATCH] rt2800usb: enable MFP if hw crypt is disabled

2016-04-20 Thread Stanislaw Gruszka
On Wed, Apr 20, 2016 at 02:59:32PM +0800, Chun-Yeow Yeoh wrote:
> If rt2800usb is loaded with nohwcrypt=1, mac80211 takes
> care of the crypto with software encryption/decryption
> and thus, MFP can be used.
> 
> Tested for secured mesh using ath9k_htc and ath9k.
> 
> Signed-off-by: Chun-Yeow Yeoh 
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800usb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c 
> b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
> index 4b0bb6b..84ea329 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
> @@ -48,6 +48,7 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
> 
>  static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
>  {
> + ieee80211_hw_set(rt2x00dev->hw, MFP_CAPABLE);
>   return modparam_nohwcrypt;

You set MFP feature regardless if actually hwcrypt is disabled or not.
Beside this should not be done in function which is intended to test
if hw crypto is disabled. Please set the future in place where other
hw->flags are set.

Thanks
Stanislaw
--
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: RSS configuration in iwlwifi

2016-04-20 Thread Ben Hutchings
On Wed, 2016-04-20 at 15:30 +, Grumbach, Emmanuel wrote:
> Hi Ben,
> 
> 
> Thanks for looking at our code.
> 
> 
> On Wed, 2016-04-20 at 16:08 +0100, Ben Hutchings wrote:
> > 
> > I'm not sure if you were aware, but there is a standard API for
> > configuring RSS in network drivers, part of ethtool_ops.  I think
> > iwlwifi should implement that rather than a driver-specific debugfs
> > interface.
> > 
> You are right, this is why Sara made this commit:
> 
> commit 854d773e4ab586924af4ca5d851730849903
> Author: Sara Sharon 
> Date:   Tue Mar 22 15:55:58 2016 +0200
> 
> iwlwifi: mvm: improve RSS configuration
> 
> Improve current RSS configuration:
>  * Use netdev_rss_key instead of keeping a local copy.
>  * Configure also UDP hashing to have UDP traffic spread across queues.
>  * Do not direct RSS traffic to our fallback queue.
> 
> Signed-off-by: Sara Sharon 
> Signed-off-by: Emmanuel Grumbach 

That doesn't really address what I said.  Yes, it's using the common
RSS key, but it's not implementing the ethtool operations to get and
set the indirection table and the types of flow hashing that are
enabled.

Ben.

-- 
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.

signature.asc
Description: This is a digitally signed message part


Re: RSS configuration in iwlwifi

2016-04-20 Thread Grumbach, Emmanuel
Hi Ben,


Thanks for looking at our code.


On Wed, 2016-04-20 at 16:08 +0100, Ben Hutchings wrote:
> I'm not sure if you were aware, but there is a standard API for
> configuring RSS in network drivers, part of ethtool_ops.  I think
> iwlwifi should implement that rather than a driver-specific debugfs
> interface.
> 

You are right, this is why Sara made this commit:

commit 854d773e4ab586924af4ca5d851730849903
Author: Sara Sharon 
Date:   Tue Mar 22 15:55:58 2016 +0200

iwlwifi: mvm: improve RSS configuration

Improve current RSS configuration:
 * Use netdev_rss_key instead of keeping a local copy.
 * Configure also UDP hashing to have UDP traffic spread across queues.
 * Do not direct RSS traffic to our fallback queue.

Signed-off-by: Sara Sharon 
Signed-off-by: Emmanuel Grumbach 


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

RSS configuration in iwlwifi

2016-04-20 Thread Ben Hutchings
I'm not sure if you were aware, but there is a standard API for
configuring RSS in network drivers, part of ethtool_ops.  I think
iwlwifi should implement that rather than a driver-specific debugfs
interface.

Ben.

-- 
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.


signature.asc
Description: This is a digitally signed message part


[PATCH 3/4] ath10k: Define rx_ppdu_end for QCA9984

2016-04-20 Thread Vasanthakumar Thiagarajan
QCA9984 Rx descriptor has two 32-bit words of location information
when compared to one 32-bit word in QCA99X0. To handle this difference in
rx descriptor ppdu_end, define a new ppdu_end for QCA9984 descriptor
which has the new structure to represent rx_location_info.

Signed-off-by: Vasanthakumar Thiagarajan 
---
 drivers/net/wireless/ath/ath10k/rx_desc.h | 46 +++
 1 file changed, 46 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h 
b/drivers/net/wireless/ath/ath10k/rx_desc.h
index 3e7dfaa..9ceebea 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -996,6 +996,41 @@ struct rx_pkt_end {
__le32 phy_timestamp_2;
 } __packed;
 
+#define RX_LOCATION_INFO0_RTT_FAC_LEGACY_MASK  0x3fff
+#define RX_LOCATION_INFO0_RTT_FAC_LEGACY_LSB   0
+#define RX_LOCATION_INFO0_RTT_FAC_VHT_MASK 0x1fff8000
+#define RX_LOCATION_INFO0_RTT_FAC_VHT_LSB  15
+#define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_MASK 0xc000
+#define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_LSB  30
+#define RX_LOCATION_INFO0_RTT_FAC_LEGACY_STATUSBIT(14)
+#define RX_LOCATION_INFO0_RTT_FAC_VHT_STATUS   BIT(29)
+
+#define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_MASK   0x000c
+#define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_LSB2
+#define RX_LOCATION_INFO1_PKT_BW_MASK  0x0030
+#define RX_LOCATION_INFO1_PKT_BW_LSB   4
+#define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_MASK0xff00
+#define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_LSB 8
+#define RX_LOCATION_INFO1_RTT_MSC_RATE_MASK0x000f
+#define RX_LOCATION_INFO1_RTT_MSC_RATE_LSB 16
+#define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_MASK  0x0030
+#define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_LSB   20
+#define RX_LOCATION_INFO1_TIMING_BACKOFF_MASK  0x07c0
+#define RX_LOCATION_INFO1_TIMING_BACKOFF_LSB   22
+#define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_MASK  0x1800
+#define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_LSB   27
+#define RX_LOCATION_INFO1_RTT_CFR_STATUS   BIT(0)
+#define RX_LOCATION_INFO1_RTT_CIR_STATUS   BIT(1)
+#define RX_LOCATION_INFO1_RTT_GI_TYPE  BIT(7)
+#define RX_LOCATION_INFO1_RTT_MAC_PHY_PHASEBIT(29)
+#define RX_LOCATION_INFO1_RTT_TX_DATA_START_X_PHASEBIT(30)
+#define RX_LOCATION_INFO1_RX_LOCATION_VALIDBIT(31)
+
+struct rx_location_info {
+   __le32 rx_location_info0; /* %RX_LOCATION_INFO0_ */
+   __le32 rx_location_info1; /* %RX_LOCATION_INFO1_ */
+} __packed;
+
 enum rx_phy_ppdu_end_info0 {
RX_PHY_PPDU_END_INFO0_ERR_RADAR   = BIT(2),
RX_PHY_PPDU_END_INFO0_ERR_RX_ABORT= BIT(3),
@@ -1074,12 +1109,23 @@ struct rx_ppdu_end_qca99x0 {
__le16 info1; /* %RX_PPDU_END_INFO1_ */
 } __packed;
 
+struct rx_ppdu_end_qca9984 {
+   struct rx_pkt_end rx_pkt_end;
+   struct rx_location_info rx_location_info;
+   struct rx_phy_ppdu_end rx_phy_ppdu_end;
+   __le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
+   __le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
+   __le16 bb_length;
+   __le16 info1; /* %RX_PPDU_END_INFO1_ */
+} __packed;
+
 struct rx_ppdu_end {
struct rx_ppdu_end_common common;
union {
struct rx_ppdu_end_qca988x qca988x;
struct rx_ppdu_end_qca6174 qca6174;
struct rx_ppdu_end_qca99x0 qca99x0;
+   struct rx_ppdu_end_qca9984 qca9984;
} __packed;
 } __packed;
 
-- 
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/4] ath10k: Clean up growing hw checks during safe and full reset

2016-04-20 Thread Vasanthakumar Thiagarajan
Store pci chip secific reset funtions in struct ath10k_pci
as callbacks during early ath10k_pci_probe() and use the
callback to perform chip specific resets. This patch essentially
adds two callback in ath10k_pci, one for doing soft reset and
the other for hard reset. By using callbacks we can get rid of
those hw revision checks in ath10k_pci_safe_chip_reset() and
ath10k_pci_chip_reset(). As such this patch does not fix
any issue.

Signed-off-by: Vasanthakumar Thiagarajan 
---
 drivers/net/wireless/ath/ath10k/pci.c | 44 ++-
 drivers/net/wireless/ath/ath10k/pci.h |  6 +
 2 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index cdd8a30..6614fd7 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2293,16 +2293,20 @@ static int ath10k_pci_warm_reset(struct ath10k *ar)
return 0;
 }
 
+static int ath10k_pci_qca99x0_soft_chip_reset(struct ath10k *ar)
+{
+   ath10k_pci_irq_disable(ar);
+   return ath10k_pci_qca99x0_chip_reset(ar);
+}
+
 static int ath10k_pci_safe_chip_reset(struct ath10k *ar)
 {
-   if (QCA_REV_988X(ar) || QCA_REV_6174(ar)) {
-   return ath10k_pci_warm_reset(ar);
-   } else if (QCA_REV_99X0(ar)) {
-   ath10k_pci_irq_disable(ar);
-   return ath10k_pci_qca99x0_chip_reset(ar);
-   } else {
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   if (!ar_pci->pci_soft_reset)
return -ENOTSUPP;
-   }
+
+   return ar_pci->pci_soft_reset(ar);
 }
 
 static int ath10k_pci_qca988x_chip_reset(struct ath10k *ar)
@@ -2437,16 +2441,12 @@ static int ath10k_pci_qca99x0_chip_reset(struct ath10k 
*ar)
 
 static int ath10k_pci_chip_reset(struct ath10k *ar)
 {
-   if (QCA_REV_988X(ar))
-   return ath10k_pci_qca988x_chip_reset(ar);
-   else if (QCA_REV_6174(ar))
-   return ath10k_pci_qca6174_chip_reset(ar);
-   else if (QCA_REV_9377(ar))
-   return ath10k_pci_qca6174_chip_reset(ar);
-   else if (QCA_REV_99X0(ar))
-   return ath10k_pci_qca99x0_chip_reset(ar);
-   else
+   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+
+   if (WARN_ON(!ar_pci->pci_hard_reset))
return -ENOTSUPP;
+
+   return ar_pci->pci_hard_reset(ar);
 }
 
 static int ath10k_pci_hif_power_up(struct ath10k *ar)
@@ -2976,24 +2976,34 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
enum ath10k_hw_rev hw_rev;
u32 chip_id;
bool pci_ps;
+   int (*pci_soft_reset)(struct ath10k *ar);
+   int (*pci_hard_reset)(struct ath10k *ar);
 
switch (pci_dev->device) {
case QCA988X_2_0_DEVICE_ID:
hw_rev = ATH10K_HW_QCA988X;
pci_ps = false;
+   pci_soft_reset = ath10k_pci_warm_reset;
+   pci_hard_reset = ath10k_pci_qca988x_chip_reset;
break;
case QCA6164_2_1_DEVICE_ID:
case QCA6174_2_1_DEVICE_ID:
hw_rev = ATH10K_HW_QCA6174;
pci_ps = true;
+   pci_soft_reset = ath10k_pci_warm_reset;
+   pci_hard_reset = ath10k_pci_qca6174_chip_reset;
break;
case QCA99X0_2_0_DEVICE_ID:
hw_rev = ATH10K_HW_QCA99X0;
pci_ps = false;
+   pci_soft_reset = ath10k_pci_qca99x0_soft_chip_reset;
+   pci_hard_reset = ath10k_pci_qca99x0_chip_reset;
break;
case QCA9377_1_0_DEVICE_ID:
hw_rev = ATH10K_HW_QCA9377;
pci_ps = true;
+   pci_soft_reset = NULL;
+   pci_hard_reset = ath10k_pci_qca6174_chip_reset;
break;
default:
WARN_ON(1);
@@ -3018,6 +3028,8 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
ar->dev_id = pci_dev->device;
ar_pci->pci_ps = pci_ps;
ar_pci->bus_ops = _pci_bus_ops;
+   ar_pci->pci_soft_reset = pci_soft_reset;
+   ar_pci->pci_hard_reset = pci_hard_reset;
 
ar->id.vendor = pdev->vendor;
ar->id.device = pdev->device;
diff --git a/drivers/net/wireless/ath/ath10k/pci.h 
b/drivers/net/wireless/ath/ath10k/pci.h
index 959dc32..6eca1df 100644
--- a/drivers/net/wireless/ath/ath10k/pci.h
+++ b/drivers/net/wireless/ath/ath10k/pci.h
@@ -234,6 +234,12 @@ struct ath10k_pci {
 
const struct ath10k_bus_ops *bus_ops;
 
+   /* Chip specific pci reset routine used to do a safe reset */
+   int (*pci_soft_reset)(struct ath10k *ar);
+
+   /* Chip specific pci full reset function */
+   int (*pci_hard_reset)(struct ath10k *ar);
+
/* Keep this entry in the last, memory for struct ath10k_ahb is
 * allocated (ahb support enabled case) in the continuation of
 * this struct.
-- 
1.9.1

--
To unsubscribe from this list: send the line 

[PATCH 1/4] ath10k: Move rx_location_info out of struct rx_pkt_end

2016-04-20 Thread Vasanthakumar Thiagarajan
Define rx_location_info in struct rx_ppdu_end_qca99x0 after
rx_pkt_end. This is to prepare rx_ppdu_end for QCA9984 chip.

Signed-off-by: Vasanthakumar Thiagarajan 
---
 drivers/net/wireless/ath/ath10k/rx_desc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/rx_desc.h 
b/drivers/net/wireless/ath/ath10k/rx_desc.h
index ca8d168..3e7dfaa 100644
--- a/drivers/net/wireless/ath/ath10k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath10k/rx_desc.h
@@ -994,7 +994,6 @@ struct rx_pkt_end {
__le32 info0; /* %RX_PKT_END_INFO0_ */
__le32 phy_timestamp_1;
__le32 phy_timestamp_2;
-   __le32 rx_location_info; /* %RX_LOCATION_INFO_ */
 } __packed;
 
 enum rx_phy_ppdu_end_info0 {
@@ -1067,6 +1066,7 @@ struct rx_phy_ppdu_end {
 
 struct rx_ppdu_end_qca99x0 {
struct rx_pkt_end rx_pkt_end;
+   __le32 rx_location_info; /* %RX_LOCATION_INFO_ */
struct rx_phy_ppdu_end rx_phy_ppdu_end;
__le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
__le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
-- 
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 0/4] Add support for QCA9984

2016-04-20 Thread Vasanthakumar Thiagarajan
This patch set adds QCA9984/QCA9994 1.0 support. Boot sequence is same as
QCA99X0.

Vasanthakumar Thiagarajan (4):
  ath10k: Move rx_location_info out of struct rx_pkt_end
  ath10k: Clean up growing hw checks during safe and full reset
  ath10k: Define rx_ppdu_end for QCA9984
  ath10k: Enable support for QCA9984

 drivers/net/wireless/ath/ath10k/core.c| 23 
 drivers/net/wireless/ath/ath10k/hw.h  | 11 ++
 drivers/net/wireless/ath/ath10k/pci.c | 58 ++-
 drivers/net/wireless/ath/ath10k/pci.h |  6 
 drivers/net/wireless/ath/ath10k/rx_desc.h | 48 -
 5 files changed, 129 insertions(+), 17 deletions(-)

-- 
1.9.1

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


RE: ap + adhoc not working with Mwifiex driver for sd8887

2016-04-20 Thread Amitkumar Karwar
Hi Luana,

> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
> ow...@vger.kernel.org] On Behalf Of Luana Borgia
> Sent: Wednesday, April 20, 2016 11:14 AM
> To: linux-wireless@vger.kernel.org; Avinash Patil
> Subject: Fwd: ap + adhoc not working with Mwifiex driver for sd8887
> 
> Hi,
> I've successfully managed to get this driver working in adhoc with olsrd
> on mlan0 interface, now I'm trying to add a uap0 working at the same
> time, with all this command:
> 
> rfkill unblock wlan
> ip link set uap0 down
> ip link set mlan0 down
> iw dev mlan0 set type ibss
> ip link set mlan0 up
> iw dev mlan0 ibss join mesh 2437 fe:de:fe:de:fe:de olsrd-start.sh cat
> < /etc/hostapd.conf ssid=PCM_AP_fede
> interface=uap0
> driver=nl80211
> hw_mode=g
> channel=6
> EOF
> iw phy phy0 interface add uap0 type __ap hostapd /etc/hostapd.conf &
> dnsmasq --interface=uap0 --except-interface=lo --bind-interfaces --dhcp-
> range=192.168.3.2,192.168.3.10,12h --conf-file=/dev/null ip addr add
> 192.168.3.1/24 broadcast 192.168.3.255 dev uap0
> 
> but I get this error after run the hostapd command:
> 
> [ 4980.201096] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
> [ 4983.335467] IPv6: ADDRCONF(NETDEV_UP): uap0: link is not ready [
> 4983.358879] mwifiex_sdio mmc0:0001:1: CMD_RESP: cmd 0xb1 error,
> result=0x1
> 
> adhoc is fine, with the above order of command but if I run before
> hostapd and than adhoc part than the issue occur in the adhoc part.
> 
> I'm using the firmware
> http://git.marvell.com/?p=mwifiex-
> firmware.git;a=blob;f=mrvl/sd8887_uapsta.bin;h=165e6c3d34b0c2a630252907a
> 7ac4daf6e13c9d5;hb=HEAD
> 
> and the mwifiex from kernel linux 4.1.1
>  

I checked with our team. We don’t support simultaneous operations of Adhoc and 
AP network.
Only one at a time can be used.

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

RE: ap + adhoc not working with Mwifiex driver for sd8887

2016-04-20 Thread Amitkumar Karwar
Hi Luana,

> From: linux-wireless-ow...@vger.kernel.org [mailto:linux-wireless-
> ow...@vger.kernel.org] On Behalf Of Luana Borgia
> Sent: Wednesday, April 20, 2016 11:14 AM
> To: linux-wireless@vger.kernel.org; Avinash Patil
> Subject: Fwd: ap + adhoc not working with Mwifiex driver for sd8887
> 
> Hi,
> I've successfully managed to get this driver working in adhoc with olsrd
> on mlan0 interface, now I'm trying to add a uap0 working at the same
> time, with all this command:
> 
> rfkill unblock wlan
> ip link set uap0 down
> ip link set mlan0 down
> iw dev mlan0 set type ibss
> ip link set mlan0 up
> iw dev mlan0 ibss join mesh 2437 fe:de:fe:de:fe:de olsrd-start.sh cat
> < /etc/hostapd.conf ssid=PCM_AP_fede
> interface=uap0
> driver=nl80211
> hw_mode=g
> channel=6
> EOF
> iw phy phy0 interface add uap0 type __ap hostapd /etc/hostapd.conf &
> dnsmasq --interface=uap0 --except-interface=lo --bind-interfaces --dhcp-
> range=192.168.3.2,192.168.3.10,12h --conf-file=/dev/null ip addr add
> 192.168.3.1/24 broadcast 192.168.3.255 dev uap0
> 
> but I get this error after run the hostapd command:
> 
> [ 4980.201096] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
> [ 4983.335467] IPv6: ADDRCONF(NETDEV_UP): uap0: link is not ready [
> 4983.358879] mwifiex_sdio mmc0:0001:1: CMD_RESP: cmd 0xb1 error,
> result=0x1
> 
> adhoc is fine, with the above order of command but if I run before
> hostapd and than adhoc part than the issue occur in the adhoc part.
> 
> I'm using the firmware
> http://git.marvell.com/?p=mwifiex-
> firmware.git;a=blob;f=mrvl/sd8887_uapsta.bin;h=165e6c3d34b0c2a630252907a
> 7ac4daf6e13c9d5;hb=HEAD
> 
> and the mwifiex from kernel linux 4.1.1
> 

Thanks for reporting the problem.
We have started looking into it.

Regards,
Amitkumar


Re: [patch] brcmfmac: testing the wrong variable in brcmf_rx_hdrpull()

2016-04-20 Thread Arend Van Spriel
On 19-4-2016 16:25, Dan Carpenter wrote:
> Smatch complains about this code:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c:335 
> brcmf_rx_hdrpull()
> error: we previously assumed '*ifp' could be null (see line 333)
> 
> The problem is that we recently changed these from "ifp" to "*ifp" but
> there was one that we didn't update.
> 
> -   if (ret || !ifp || !ifp->ndev) {
> +   if (ret || !(*ifp) || !(*ifp)->ndev) {
> if (ret != -ENODATA && ifp)
>^^^
> -   ifp->stats.rx_errors++;
> +   (*ifp)->stats.rx_errors++;
> 
> I have updated it to *ifp as well.  We always call this function is a
> non-NULL "ifp" pointer, btw.

Great. Maybe we (Broadcom) should consider running smatch on our patch
series or simply rely on your excellent work :-p. Thanks for catching this.

Acked-by: Arend van Spriel 
> Fixes: c462ebcdfe42 ('brcmfmac: create common function for handling 
> brcmf_proto_hdrpull()')
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 
> b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
> index 1b476d1..b590499 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
> @@ -331,7 +331,7 @@ static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, 
> struct sk_buff *skb,
>   ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
>  
>   if (ret || !(*ifp) || !(*ifp)->ndev) {
> - if (ret != -ENODATA && ifp)
> + if (ret != -ENODATA && *ifp)
>   (*ifp)->stats.rx_errors++;
>   brcmu_pkt_buf_free_skb(skb);
>   return -ENODATA;
> 
--
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] carl9170: Clarify kconfig text

2016-04-20 Thread Kalle Valo
Christian Lamparter  writes:

> On Monday, April 18, 2016 07:42:05 PM Kalle Valo wrote:
>> Christian Lamparter  writes:
>> 
>> > On Monday, April 18, 2016 06:45:09 PM Kalle Valo wrote:
>> >
>> >> Why even mention anything about a "special firmware" as the firmware is
>> >> already available from linux-firmware.git? 
>> >
>> > Yes and no. 1.9.6 is in linux-firmware.git. I've tried to add 1.9.9 too
>> > but that failed.
>> > 
>> 
>> Rick's comment makes sense to me, better just to provide the latest
>> version. No need to unnecessary confuse the users. And if someone really
>> wants to use an older version that she can retrieve it from the git
>> history.
>
> Part of the fun here is that firmware is GPLv2. The linux-firmware.git has
> to point to or add the firmware source to their tree. They have added every
> single source file to it instead of "packaging" it in a tar.bz2/gz/xz
> like you normally do for release sources.
>
> If you want to read more about it:
> 

Yeah, that's more work. I get that. But I'm still not understanding
what's the actual problem which prevents us from updating carl9170
firmware in linux-firmware.

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