]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mwifiex: add CHAN_REGION_CFG command
authorAmitkumar Karwar <akarwar@marvell.com>
Tue, 9 Aug 2016 14:50:45 +0000 (20:20 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 3 Sep 2016 10:05:45 +0000 (13:05 +0300)
This patch adds command preparation and response handling for
CHAN_REGION_CFG command. These changes are prerequisites for adding
custom regulatory domain support.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/fw.h
drivers/net/wireless/marvell/mwifiex/sta_cmd.c
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c

index a88030a747b312c8a56212f87ad55e8fed6ef703..085db9921c385ba1b59b4cfe5bf08fa598da8f6d 100644 (file)
@@ -190,6 +190,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define TLV_BTCOEX_WL_SCANTIME      (PROPRIETARY_TLV_BASE_ID + 203)
 #define TLV_TYPE_BSS_MODE           (PROPRIETARY_TLV_BASE_ID + 206)
 #define TLV_TYPE_RANDOM_MAC         (PROPRIETARY_TLV_BASE_ID + 236)
+#define TLV_TYPE_CHAN_ATTR_CFG      (PROPRIETARY_TLV_BASE_ID + 237)
 
 #define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048
 
@@ -382,6 +383,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 #define HostCmd_CMD_MC_POLICY                         0x0121
 #define HostCmd_CMD_TDLS_OPER                         0x0122
 #define HostCmd_CMD_SDIO_SP_RX_AGGR_CFG               0x0223
+#define HostCmd_CMD_CHAN_REGION_CFG                  0x0242
 
 #define PROTOCOL_NO_SECURITY        0x01
 #define PROTOCOL_STATIC_WEP         0x02
@@ -2224,6 +2226,10 @@ struct host_cmd_ds_gtk_rekey_params {
        __le32 replay_ctr_high;
 } __packed;
 
+struct host_cmd_ds_chan_region_cfg {
+       __le16 action;
+} __packed;
+
 struct host_cmd_ds_command {
        __le16 command;
        __le16 size;
@@ -2298,6 +2304,7 @@ struct host_cmd_ds_command {
                struct host_cmd_ds_robust_coex coex;
                struct host_cmd_ds_wakeup_reason hs_wakeup_reason;
                struct host_cmd_ds_gtk_rekey_params rekey;
+               struct host_cmd_ds_chan_region_cfg reg_cfg;
        } params;
 } __packed;
 
index 1d8f2844a8785a5862d9b59a893b41d037c5167a..49048b41fd3693469e03da6043a7d69cf28ba5ae 100644 (file)
@@ -1594,6 +1594,21 @@ static int mwifiex_cmd_gtk_rekey_offload(struct mwifiex_private *priv,
        return 0;
 }
 
+static int mwifiex_cmd_chan_region_cfg(struct mwifiex_private *priv,
+                                      struct host_cmd_ds_command *cmd,
+                                      u16 cmd_action)
+{
+       struct host_cmd_ds_chan_region_cfg *reg = &cmd->params.reg_cfg;
+
+       cmd->command = cpu_to_le16(HostCmd_CMD_CHAN_REGION_CFG);
+       cmd->size = cpu_to_le16(sizeof(*reg) + S_DS_GEN);
+
+       if (cmd_action == HostCmd_ACT_GEN_GET)
+               reg->action = cpu_to_le16(cmd_action);
+
+       return 0;
+}
+
 static int
 mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv,
                         struct host_cmd_ds_command *cmd,
@@ -2134,6 +2149,9 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
                ret = mwifiex_cmd_gtk_rekey_offload(priv, cmd_ptr, cmd_action,
                                                    data_buf);
                break;
+       case HostCmd_CMD_CHAN_REGION_CFG:
+               ret = mwifiex_cmd_chan_region_cfg(priv, cmd_ptr, cmd_action);
+               break;
        default:
                mwifiex_dbg(priv->adapter, ERROR,
                            "PREP_CMD: unknown cmd- %#x\n", cmd_no);
@@ -2271,6 +2289,9 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
                        if (ret)
                                return -1;
                }
+
+               mwifiex_send_cmd(priv, HostCmd_CMD_CHAN_REGION_CFG,
+                                HostCmd_ACT_GEN_GET, 0, NULL, true);
        }
 
        /* get tx rate */
index 90e191bf1343a1c71c0e266bf8a3c9efddf9cc39..db85330ffb20b67e3b39d17d91cde43a9edcbbff 100644 (file)
@@ -1022,6 +1022,44 @@ static int mwifiex_ret_robust_coex(struct mwifiex_private *priv,
        return 0;
 }
 
+static int mwifiex_ret_chan_region_cfg(struct mwifiex_private *priv,
+                                      struct host_cmd_ds_command *resp)
+{
+       struct host_cmd_ds_chan_region_cfg *reg = &resp->params.reg_cfg;
+       u16 action = le16_to_cpu(reg->action);
+       u16 tlv, tlv_buf_len, tlv_buf_left;
+       struct mwifiex_ie_types_header *head;
+       u8 *tlv_buf;
+
+       if (action != HostCmd_ACT_GEN_GET)
+               return 0;
+
+       tlv_buf = (u8 *)reg + sizeof(*reg);
+       tlv_buf_left = le16_to_cpu(resp->size) - S_DS_GEN - sizeof(*reg);
+
+       while (tlv_buf_left >= sizeof(*head)) {
+               head = (struct mwifiex_ie_types_header *)tlv_buf;
+               tlv = le16_to_cpu(head->type);
+               tlv_buf_len = le16_to_cpu(head->len);
+
+               if (tlv_buf_left < (sizeof(*head) + tlv_buf_len))
+                       break;
+
+               switch (tlv) {
+               case TLV_TYPE_CHAN_ATTR_CFG:
+                       mwifiex_dbg_dump(priv->adapter, CMD_D, "CHAN:",
+                                        (u8 *)head + sizeof(*head),
+                                        tlv_buf_len);
+                       break;
+               }
+
+               tlv_buf += (sizeof(*head) + tlv_buf_len);
+               tlv_buf_left -= (sizeof(*head) + tlv_buf_len);
+       }
+
+       return 0;
+}
+
 /*
  * This function handles the command responses.
  *
@@ -1239,6 +1277,9 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
                break;
        case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG:
                break;
+       case HostCmd_CMD_CHAN_REGION_CFG:
+               ret = mwifiex_ret_chan_region_cfg(priv, resp);
+               break;
        default:
                mwifiex_dbg(adapter, ERROR,
                            "CMD_RESP: unknown cmd response %#x\n",