mwifiex: add support for GTK rekey offload
[deliverable/linux.git] / drivers / net / wireless / marvell / mwifiex / sta_cmd.c
index e486867a4c67520fc2a8a8520368009975fd8878..8cb895b7f2ee49f623fa76c4a2c437d4ff01702e 100644 (file)
@@ -1558,6 +1558,30 @@ static int mwifiex_cmd_robust_coex(struct mwifiex_private *priv,
        return 0;
 }
 
+static int mwifiex_cmd_gtk_rekey_offload(struct mwifiex_private *priv,
+                                        struct host_cmd_ds_command *cmd,
+                                        u16 cmd_action,
+                                        struct cfg80211_gtk_rekey_data *data)
+{
+       struct host_cmd_ds_gtk_rekey_params *rekey = &cmd->params.rekey;
+       u64 rekey_ctr;
+
+       cmd->command = cpu_to_le16(HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG);
+       cmd->size = cpu_to_le16(sizeof(*rekey) + S_DS_GEN);
+
+       rekey->action = cpu_to_le16(cmd_action);
+       if (cmd_action == HostCmd_ACT_GEN_SET) {
+               memcpy(rekey->kek, data->kek, NL80211_KEK_LEN);
+               memcpy(rekey->kck, data->kck, NL80211_KCK_LEN);
+               rekey_ctr = be64_to_cpup((__be64 *)data->replay_ctr);
+               rekey->replay_ctr_low = cpu_to_le32((u32)rekey_ctr);
+               rekey->replay_ctr_high =
+                       cpu_to_le32((u32)((u64)rekey_ctr >> 32));
+       }
+
+       return 0;
+}
+
 static int
 mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv,
                         struct host_cmd_ds_command *cmd,
@@ -1813,6 +1837,22 @@ static int mwifiex_cmd_sdio_rx_aggr_cfg(struct host_cmd_ds_command *cmd,
        return 0;
 }
 
+/* This function prepares command to get HS wakeup reason.
+ *
+ * Preparation includes -
+ *      - Setting command ID, action and proper size
+ *      - Ensuring correct endian-ness
+ */
+static int mwifiex_cmd_get_wakeup_reason(struct mwifiex_private *priv,
+                                        struct host_cmd_ds_command *cmd)
+{
+       cmd->command = cpu_to_le16(HostCmd_CMD_HS_WAKEUP_REASON);
+       cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_wakeup_reason) +
+                               S_DS_GEN);
+
+       return 0;
+}
+
 /*
  * This function prepares the commands before sending them to the firmware.
  *
@@ -1873,6 +1913,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
        case HostCmd_CMD_802_11_SCAN:
                ret = mwifiex_cmd_802_11_scan(cmd_ptr, data_buf);
                break;
+       case HostCmd_CMD_802_11_BG_SCAN_CONFIG:
+               ret = mwifiex_cmd_802_11_bg_scan_config(priv, cmd_ptr,
+                                                       data_buf);
+               break;
        case HostCmd_CMD_802_11_BG_SCAN_QUERY:
                ret = mwifiex_cmd_802_11_bg_scan_query(cmd_ptr);
                break;
@@ -2063,6 +2107,9 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
                ret = mwifiex_cmd_sdio_rx_aggr_cfg(cmd_ptr, cmd_action,
                                                   data_buf);
                break;
+       case HostCmd_CMD_HS_WAKEUP_REASON:
+               ret = mwifiex_cmd_get_wakeup_reason(priv, cmd_ptr);
+               break;
        case HostCmd_CMD_MC_POLICY:
                ret = mwifiex_cmd_set_mc_policy(priv, cmd_ptr, cmd_action,
                                                data_buf);
@@ -2071,6 +2118,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
                ret = mwifiex_cmd_robust_coex(priv, cmd_ptr, cmd_action,
                                              data_buf);
                break;
+       case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG:
+               ret = mwifiex_cmd_gtk_rekey_offload(priv, cmd_ptr, cmd_action,
+                                                   data_buf);
+               break;
        default:
                mwifiex_dbg(priv->adapter, ERROR,
                            "PREP_CMD: unknown cmd- %#x\n", cmd_no);
This page took 0.028174 seconds and 5 git commands to generate.