]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: mwifiex: add iw vendor command support
authorchunfan chen <jeffc@marvell.com>
Mon, 4 Jan 2016 08:37:31 +0000 (16:37 +0800)
committerKamal Mostafa <kamal@canonical.com>
Fri, 10 Jun 2016 13:32:25 +0000 (06:32 -0700)
BugLink: https://launchpad.net/bugs/1528910
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 <jeffc@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
Reviewed-By: AceLan Kao <acelan.kao@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/net/wireless/mwifiex/Makefile
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_cmd.c
drivers/net/wireless/mwifiex/vendor.c [new file with mode: 0644]
drivers/net/wireless/mwifiex/vendor.h [new file with mode: 0644]

index fdfd9bf15ed462194f1aa76a5de0b463025d816c..8b34ce90496c14d0dc92af33104d0c6d6f356e4a 100644 (file)
@@ -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
 
index 65dd85d4fb1437b10ea6c4f9ed787796c485a713..205702465bc4e1a7d1e6a1175bbdeb912fb76e13 100644 (file)
@@ -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);
 
index 89938f61717a796d2149a490f5e92641c6cec2d7..d7beac49e9f024c63e8a2d485e476d9c42d015c8 100644 (file)
@@ -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 {
index 36ad9894599f5ec4bc05933024470c9d8d42b2fe..667bbb0d7798fc305b70f9453c79a69c21205dec 100644 (file)
@@ -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);
index e486867a4c67520fc2a8a8520368009975fd8878..fd7db0cccf0b89e9d14c328b41a7ba88f97c2aae 100644 (file)
@@ -1487,9 +1487,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;
@@ -1500,11 +1501,19 @@ 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);
-               mwifiex_dbg(adapter, INFO,
-                           "download cfg_data from config file\n");
+       } 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 iw vendor command\n");
        } else {
                return -1;
        }
diff --git a/drivers/net/wireless/mwifiex/vendor.c b/drivers/net/wireless/mwifiex/vendor.c
new file mode 100644 (file)
index 0000000..662531c
--- /dev/null
@@ -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/mwifiex/vendor.h b/drivers/net/wireless/mwifiex/vendor.h
new file mode 100644 (file)
index 0000000..be723f6
--- /dev/null
@@ -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__ */