2015-12-04 14:14:36

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 1/6] mwifiex: parse adhoc start/join result

Even if ADHOC start or join attempt is failed, these commands
are returned with success status by firmware. Actual connection
result is provided inside command response.

This patch parses the adhoc connection result and resets
connection state variables if connection is not successful.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/fw.h | 11 +++++++++--
drivers/net/wireless/marvell/mwifiex/join.c | 20 +++++++++++++-------
2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
index 1e1e81a..89938f6 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -1092,9 +1092,15 @@ struct host_cmd_ds_802_11_ad_hoc_start {
u8 data_rate[HOSTCMD_SUPPORTED_RATES];
} __packed;

-struct host_cmd_ds_802_11_ad_hoc_result {
+struct host_cmd_ds_802_11_ad_hoc_start_result {
u8 pad[3];
u8 bssid[ETH_ALEN];
+ u8 pad2[2];
+ u8 result;
+} __packed;
+
+struct host_cmd_ds_802_11_ad_hoc_join_result {
+ u8 result;
} __packed;

struct adhoc_bss_desc {
@@ -2124,7 +2130,8 @@ struct host_cmd_ds_command {
struct host_cmd_ds_802_11_associate_rsp associate_rsp;
struct host_cmd_ds_802_11_deauthenticate deauth;
struct host_cmd_ds_802_11_ad_hoc_start adhoc_start;
- struct host_cmd_ds_802_11_ad_hoc_result adhoc_result;
+ struct host_cmd_ds_802_11_ad_hoc_start_result start_result;
+ struct host_cmd_ds_802_11_ad_hoc_join_result join_result;
struct host_cmd_ds_802_11_ad_hoc_join adhoc_join;
struct host_cmd_ds_802_11d_domain_info domain_info;
struct host_cmd_ds_802_11d_domain_info_rsp domain_info_resp;
diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c
index 3cda1f9..cc09a81 100644
--- a/drivers/net/wireless/marvell/mwifiex/join.c
+++ b/drivers/net/wireless/marvell/mwifiex/join.c
@@ -1247,20 +1247,26 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
{
int ret = 0;
struct mwifiex_adapter *adapter = priv->adapter;
- struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
+ struct host_cmd_ds_802_11_ad_hoc_start_result *start_result =
+ &resp->params.start_result;
+ struct host_cmd_ds_802_11_ad_hoc_join_result *join_result =
+ &resp->params.join_result;
struct mwifiex_bssdescriptor *bss_desc;
- u16 reason_code;
+ u16 cmd = le16_to_cpu(resp->command);
+ u8 result;

- adhoc_result = &resp->params.adhoc_result;
+ if (cmd == HostCmd_CMD_802_11_AD_HOC_START)
+ result = start_result->result;
+ else
+ result = join_result->result;

bss_desc = priv->attempted_bss_desc;

/* Join result code 0 --> SUCCESS */
- reason_code = le16_to_cpu(resp->result);
- if (reason_code) {
+ if (result) {
mwifiex_dbg(priv->adapter, ERROR, "ADHOC_RESP: failed\n");
if (priv->media_connected)
- mwifiex_reset_connect_state(priv, reason_code);
+ mwifiex_reset_connect_state(priv, result);

memset(&priv->curr_bss_params.bss_descriptor,
0x00, sizeof(struct mwifiex_bssdescriptor));
@@ -1278,7 +1284,7 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,

/* Update the created network descriptor with the new BSSID */
memcpy(bss_desc->mac_address,
- adhoc_result->bssid, ETH_ALEN);
+ start_result->bssid, ETH_ALEN);

priv->adhoc_state = ADHOC_STARTED;
} else {
--
1.8.1.4



2015-12-04 14:14:44

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 4/6] mwifiex: don't follow AP if country code received from EEPROM

If device has already received country information from
EEPROM, we won't parse AP's country IE and download it to
firmware. We will also set regulatory flags to disable beacon
hints and ignore country IE.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 4 ++++
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 9b570e1..65dd85d 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3802,6 +3802,10 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
wiphy->cipher_suites = mwifiex_cipher_suites;
wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites);

+ if (adapter->region_code)
+ wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS |
+ REGULATORY_COUNTRY_IE_IGNORE;
+
ether_addr_copy(wiphy->perm_addr, adapter->perm_addr);
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index a6c8a4f..78cb1d7 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -272,7 +272,8 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
priv->scan_block = false;

if (bss) {
- mwifiex_process_country_ie(priv, bss);
+ if (adapter->region_code == 0x00)
+ mwifiex_process_country_ie(priv, bss);

/* Allocate and fill new bss descriptor */
bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor),
--
1.8.1.4


2015-12-11 09:33:32

by Amitkumar Karwar

[permalink] [raw]
Subject: RE: [PATCH 5/6] mwifiex: add iw vendor command support

Hi Kalle,

> -----Original Message-----
> From: Kalle Valo [mailto:[email protected]]
> Sent: Friday, December 11, 2015 2:32 PM
> To: Amitkumar Karwar
> Cc: [email protected]; Cathy Luo; Nishant Sarmukadam; Jeff
> CF Chen
> Subject: Re: [PATCH 5/6] mwifiex: add iw vendor command support
>
> Amitkumar Karwar <[email protected]> writes:
>
> > From: chunfan chen <[email protected]>
> >
> > The patch allows user to
> > 1. Enable turbo mode in firmware using following command.
> > iw dev mlan0 vendor send 0x005043 0x00 0x01
> >
> > 2. Download configuration data to FW using following command iw dev
> > mlan0 vendor send 0x005043 0x01 filename
> >
> > Signed-off-by: chunfan chen <[email protected]>
> > Signed-off-by: Amitkumar Karwar <[email protected]>
>
> Stuff like this gives me nightmares and I'm going to put this patch to
> deferred state for now as I don't want to even think what to do. In the
> mean time people can convince me should I take this or not.
>

Actually we intend to download following types of configuration data in hex format to firmware.
1) Txpower limit table - It includes information about maximum allowed transmit power limits for all data rates and channels combination.
2) Device calibration data

I support "iw vendor" gives an option to download hex data.

Could you please guide how can we improve this patch? OR Any other better approach to meet the requirement?

Regards,
Amitkumar


2015-12-11 09:02:29

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 5/6] mwifiex: add iw vendor command support

Amitkumar Karwar <[email protected]> writes:

> From: chunfan chen <[email protected]>
>
> The patch allows user to
> 1. Enable turbo mode in firmware using
> following command.
> iw dev mlan0 vendor send 0x005043 0x00 0x01
>
> 2. Download configuration data to FW using
> following command
> iw dev mlan0 vendor send 0x005043 0x01 filename
>
> Signed-off-by: chunfan chen <[email protected]>
> Signed-off-by: Amitkumar Karwar <[email protected]>

Stuff like this gives me nightmares and I'm going to put this patch to
deferred state for now as I don't want to even think what to do. In the
mean time people can convince me should I take this or not.

--
Kalle Valo

2015-12-04 14:14:39

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 2/6] mwifiex: handle start AP error paths correctly

It's been observed that even if firmware returns an error
for a configuration command, we go ahead and start AP.

This patch changes the command type from async to sync
so that threads waits for command response and return
failure start AP.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/ie.c | 2 +-
drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c b/drivers/net/wireless/marvell/mwifiex/ie.c
index abf52d2..c488c30 100644
--- a/drivers/net/wireless/marvell/mwifiex/ie.c
+++ b/drivers/net/wireless/marvell/mwifiex/ie.c
@@ -140,7 +140,7 @@ mwifiex_update_autoindex_ies(struct mwifiex_private *priv,
if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)
return mwifiex_send_cmd(priv, HostCmd_CMD_UAP_SYS_CONFIG,
HostCmd_ACT_GEN_SET,
- UAP_CUSTOM_IE_I, ie_list, false);
+ UAP_CUSTOM_IE_I, ie_list, true);

return 0;
}
diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
index 759a6ad..e791166 100644
--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
@@ -848,9 +848,9 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv,

if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_SYS_CONFIG,
HostCmd_ACT_GEN_SET,
- UAP_BSS_PARAMS_I, bss_cfg, false)) {
+ UAP_BSS_PARAMS_I, bss_cfg, true)) {
mwifiex_dbg(priv->adapter, ERROR,
- "Failed to set the SSID\n");
+ "Failed to set AP configuration\n");
return -1;
}

@@ -865,7 +865,7 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv,
}

if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_START,
- HostCmd_ACT_GEN_SET, 0, NULL, false)) {
+ HostCmd_ACT_GEN_SET, 0, NULL, true)) {
mwifiex_dbg(priv->adapter, ERROR,
"Failed to start the BSS\n");
return -1;
--
1.8.1.4


2015-12-11 11:24:50

by Kalle Valo

[permalink] [raw]
Subject: Re: [1/6] mwifiex: parse adhoc start/join result


> Even if ADHOC start or join attempt is failed, these commands
> are returned with success status by firmware. Actual connection
> result is provided inside command response.
>
> This patch parses the adhoc connection result and resets
> connection state variables if connection is not successful.
>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Signed-off-by: Cathy Luo <[email protected]>

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

d5556e87610e mwifiex: parse adhoc start/join result
d2b0c735ebac mwifiex: handle start AP error paths correctly
658cb59232b1 mwifiex: set regulatory info from EEPROM
947d315257f9 mwifiex: don't follow AP if country code received from EEPROM
7cfd829cfe55 mwifiex: correction in region code to country mapping

Kalle Valo

2015-12-04 14:14:51

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 6/6] mwifiex: correction in region code to country mapping

EU is not a valid country in db.txt file. Hence regulatory_hint
returns failure if EEPROM provides region code as 0x30. Let's
use FR for 0x30.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/cfp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c
index dd3adc5..beb564f 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfp.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfp.c
@@ -168,7 +168,7 @@ struct region_code_mapping {
static struct region_code_mapping region_code_mapping_t[] = {
{ 0x10, "US " }, /* US FCC */
{ 0x20, "CA " }, /* IC Canada */
- { 0x30, "EU " }, /* ETSI */
+ { 0x30, "FR " }, /* France */
{ 0x31, "ES " }, /* Spain */
{ 0x32, "FR " }, /* France */
{ 0x40, "JP " }, /* Japan */
--
1.8.1.4


2015-12-04 14:14:47

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 5/6] mwifiex: add iw vendor command support

From: chunfan chen <[email protected]>

The patch allows user to
1. Enable turbo mode in firmware using
following command.
iw dev mlan0 vendor send 0x005043 0x00 0x01

2. Download configuration data to FW using
following command
iw dev mlan0 vendor send 0x005043 0x01 filename

Signed-off-by: chunfan chen <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/Makefile | 1 +
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +
drivers/net/wireless/marvell/mwifiex/fw.h | 1 +
drivers/net/wireless/marvell/mwifiex/main.h | 4 ++
drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 20 ++++--
drivers/net/wireless/marvell/mwifiex/vendor.c | 83 +++++++++++++++++++++++++
drivers/net/wireless/marvell/mwifiex/vendor.h | 28 +++++++++
7 files changed, 134 insertions(+), 5 deletions(-)
create mode 100644 drivers/net/wireless/marvell/mwifiex/vendor.c
create mode 100644 drivers/net/wireless/marvell/mwifiex/vendor.h

diff --git a/drivers/net/wireless/marvell/mwifiex/Makefile b/drivers/net/wireless/marvell/mwifiex/Makefile
index fdfd9bf..8b34ce9 100644
--- a/drivers/net/wireless/marvell/mwifiex/Makefile
+++ b/drivers/net/wireless/marvell/mwifiex/Makefile
@@ -42,6 +42,7 @@ mwifiex-y += cfg80211.o
mwifiex-y += ethtool.o
mwifiex-y += 11h.o
mwifiex-y += tdls.o
+mwifiex-y += vendor.o
mwifiex-$(CONFIG_DEBUG_FS) += debugfs.o
obj-$(CONFIG_MWIFIEX) += mwifiex.o

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 65dd85d..2057024 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3842,6 +3842,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
if (adapter->fw_api_ver == MWIFIEX_FW_V15)
wiphy->features |= NL80211_FEATURE_SK_TX_STATUS;

+ marvell_set_vendor_commands(wiphy);
+
/* Reserve space for mwifiex specific private data for BSS */
wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv);

diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
index 89938f6..d7beac4 100644
--- a/drivers/net/wireless/marvell/mwifiex/fw.h
+++ b/drivers/net/wireless/marvell/mwifiex/fw.h
@@ -1212,6 +1212,7 @@ enum SNMP_MIB_INDEX {
FRAG_THRESH_I = 8,
DOT11D_I = 9,
DOT11H_I = 10,
+ TURBO_MODE_I = 39,
};

enum mwifiex_assocmd_failurepoint {
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index a86e2ae..b3cfdcf 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -994,6 +994,8 @@ struct mwifiex_adapter {
u8 active_scan_triggered;
bool usb_mc_status;
bool usb_mc_setup;
+ u8 *cfg_data;
+ int cfg_len;
};

void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter);
@@ -1569,6 +1571,8 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
struct sk_buff *event_skb);
void mwifiex_multi_chan_resync(struct mwifiex_adapter *adapter);

+void marvell_set_vendor_commands(struct wiphy *wiphy);
+
#ifdef CONFIG_DEBUG_FS
void mwifiex_debugfs_init(void);
void mwifiex_debugfs_remove(void);
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index d28a53f..803e711 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -1498,9 +1498,10 @@ static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv,
{
struct mwifiex_adapter *adapter = priv->adapter;
struct property *prop = data_buf;
- u32 len;
+ u32 len = 0;
u8 *data = (u8 *)cmd + S_DS_GEN;
int ret;
+ const struct firmware *cal_data = adapter->cal_data;

if (prop) {
len = prop->length;
@@ -1511,11 +1512,20 @@ static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv,
mwifiex_dbg(adapter, INFO,
"download cfg_data from device tree: %s\n",
prop->name);
- } else if (adapter->cal_data->data && adapter->cal_data->size > 0) {
- len = mwifiex_parse_cal_cfg((u8 *)adapter->cal_data->data,
- adapter->cal_data->size, data);
+ } else if (cal_data) {
+ if (cal_data->data && cal_data->size > 0) {
+ len = mwifiex_parse_cal_cfg((u8 *)cal_data->data,
+ cal_data->size, data);
+ mwifiex_dbg(adapter, INFO,
+ "download cfg_data from config file\n");
+ } else {
+ return -1;
+ }
+ } else if (adapter->cfg_data && adapter->cfg_len > 0) {
+ len = mwifiex_parse_cal_cfg(adapter->cfg_data,
+ adapter->cfg_len, data);
mwifiex_dbg(adapter, INFO,
- "download cfg_data from config file\n");
+ "download cfg_data from iw vendor command\n");
} else {
return -1;
}
diff --git a/drivers/net/wireless/marvell/mwifiex/vendor.c b/drivers/net/wireless/marvell/mwifiex/vendor.c
new file mode 100644
index 0000000..662531c
--- /dev/null
+++ b/drivers/net/wireless/marvell/mwifiex/vendor.c
@@ -0,0 +1,83 @@
+/* Marvell Wireless LAN device driver: TDLS handling
+ *
+ * Copyright (C) 2014, Marvell International Ltd.
+ *
+ * This software file (the "File") is distributed by Marvell International
+ * Ltd. under the terms of the GNU General Public License Version 2, June 1991
+ * (the "License"). You may use, redistribute and/or modify this File in
+ * accordance with the terms and conditions of the License, a copy of which
+ * is available on the worldwide web at
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
+ * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
+ * this warranty disclaimer.
+ */
+
+#include <net/mac80211.h>
+#include <net/netlink.h>
+#include "vendor.h"
+#include "main.h"
+
+static int
+marvell_vendor_cmd_set_turbo_mode(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data, int data_len)
+{
+ struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
+ u8 mode = *(u8 *)data;
+ int ret;
+
+ ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
+ HostCmd_ACT_GEN_SET, TURBO_MODE_I, &mode, true);
+
+ return 0;
+}
+
+static int
+mwifiex_vendor_cmd_set_cfg_data(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data, int data_len)
+{
+ struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
+ int ret;
+
+ priv->adapter->cfg_data = (u8 *)data;
+ priv->adapter->cfg_len = data_len;
+
+ ret = mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA,
+ HostCmd_ACT_GEN_SET, 0, NULL, true);
+
+ priv->adapter->cfg_data = NULL;
+ priv->adapter->cfg_len = 0;
+
+ return 0;
+}
+
+static const struct wiphy_vendor_command marvell_vendor_commands[] = {
+ {
+ .info = {
+ .vendor_id = MARVELL_OUI,
+ .subcmd = MARVELL_VENDOR_CMD_SET_TURBO_MODE,
+ },
+ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
+ WIPHY_VENDOR_CMD_NEED_RUNNING,
+ .doit = marvell_vendor_cmd_set_turbo_mode,
+ },
+ {
+ .info = {
+ .vendor_id = MARVELL_OUI,
+ .subcmd = MARVELL_VENDOR_CMD_SET_CONF_DATA,
+ },
+ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
+ WIPHY_VENDOR_CMD_NEED_RUNNING,
+ .doit = mwifiex_vendor_cmd_set_cfg_data,
+ },
+};
+
+void marvell_set_vendor_commands(struct wiphy *wiphy)
+{
+ wiphy->vendor_commands = marvell_vendor_commands;
+ wiphy->n_vendor_commands = ARRAY_SIZE(marvell_vendor_commands);
+}
diff --git a/drivers/net/wireless/marvell/mwifiex/vendor.h b/drivers/net/wireless/marvell/mwifiex/vendor.h
new file mode 100644
index 0000000..be723f6
--- /dev/null
+++ b/drivers/net/wireless/marvell/mwifiex/vendor.h
@@ -0,0 +1,28 @@
+/* Marvell Wireless LAN device driver: TDLS handling
+ *
+ * Copyright (C) 2014, Marvell International Ltd.
+ *
+ * This software file (the "File") is distributed by Marvell International
+ * Ltd. under the terms of the GNU General Public License Version 2, June 1991
+ * (the "License"). You may use, redistribute and/or modify this File in
+ * accordance with the terms and conditions of the License, a copy of which
+ * is available on the worldwide web at
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
+ * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
+ * this warranty disclaimer.
+ */
+
+#ifndef __MARVELL_VENDOR_H__
+#define __MARVELL_VENDOR_H__
+
+#define MARVELL_OUI 0x005043
+
+enum marvell_vendor_commands {
+ MARVELL_VENDOR_CMD_SET_TURBO_MODE,
+ MARVELL_VENDOR_CMD_SET_CONF_DATA,
+};
+
+#endif /* __MARVELL_VENDOR_H__ */
--
1.8.1.4


2015-12-04 14:14:41

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 3/6] mwifiex: set regulatory info from EEPROM

Driver gets country information from EEPROM during
initialization. We will call regulatory_hint to update
current regulatory domain.
As by default world regulatory domain is selected by
cfg80211, country '00' from EEPROM is ignored.

Signed-off-by: Amitkumar Karwar <[email protected]>
Signed-off-by: Cathy Luo <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 +++++++++-----
drivers/net/wireless/marvell/mwifiex/cfp.c | 2 +-
drivers/net/wireless/marvell/mwifiex/main.h | 2 +-
3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 4073116..9b570e1 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3862,11 +3862,15 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
"driver hint alpha2: %2.2s\n", reg_alpha2);
regulatory_hint(wiphy, reg_alpha2);
} else {
- country_code = mwifiex_11d_code_2_region(adapter->region_code);
- if (country_code)
- mwifiex_dbg(adapter, WARN,
- "ignoring F/W country code %2.2s\n",
- country_code);
+ if (adapter->region_code == 0x00) {
+ mwifiex_dbg(adapter, WARN, "Ignore world regulatory domain\n");
+ } else {
+ country_code =
+ mwifiex_11d_code_2_region(adapter->region_code);
+ if (country_code &&
+ regulatory_hint(wiphy, country_code))
+ mwifiex_dbg(priv->adapter, ERROR, "regulatory_hint() failed\n");
+ }
}

mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB,
diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c
index 3ddb8ec..dd3adc5 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfp.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfp.c
@@ -66,7 +66,7 @@ static u8 supported_rates_bg[BG_SUPPORTED_RATES] = { 0x02, 0x04, 0x0b, 0x0c,
0x12, 0x16, 0x18, 0x24, 0x30, 0x48,
0x60, 0x6c, 0 };

-u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30,
+u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x00, 0x10, 0x20, 0x30,
0x32, 0x40, 0x41, 0xff };

static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 };
diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index 3959f1c..a86e2ae 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -84,7 +84,7 @@ enum {

#define MWIFIEX_KEY_BUFFER_SIZE 16
#define MWIFIEX_DEFAULT_LISTEN_INTERVAL 10
-#define MWIFIEX_MAX_REGION_CODE 7
+#define MWIFIEX_MAX_REGION_CODE 8

#define DEFAULT_BCN_AVG_FACTOR 8
#define DEFAULT_DATA_AVG_FACTOR 8
--
1.8.1.4