diff options
author | Ganapathi Bhat <gbhat@marvell.com> | 2016-04-05 04:04:34 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-04-07 12:42:17 -0400 |
commit | f6b1cbe029f6828bbdac8b54bdcbdc35420e842e (patch) | |
tree | 8e7ee7f1fde69057a50ff1b16de32b21395dbf84 | |
parent | a069caa3c30fc9744a82a6b83503ed93e00e723c (diff) |
mwifiex: add support for GTK rekey offload
Added driver functionality to offload GTK rekey to firmware. When
AP sends new GTK, firmware will update it.
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/cfg80211.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/fw.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 28 | ||||
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 |
5 files changed, 55 insertions, 1 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 108e64137826..ca8cdd2ec409 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c | |||
@@ -3416,6 +3416,16 @@ static void mwifiex_cfg80211_set_wakeup(struct wiphy *wiphy, | |||
3416 | 3416 | ||
3417 | device_set_wakeup_enable(adapter->dev, enabled); | 3417 | device_set_wakeup_enable(adapter->dev, enabled); |
3418 | } | 3418 | } |
3419 | |||
3420 | static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, | ||
3421 | struct cfg80211_gtk_rekey_data *data) | ||
3422 | { | ||
3423 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | ||
3424 | |||
3425 | return mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, | ||
3426 | HostCmd_ACT_GEN_SET, 0, data, true); | ||
3427 | } | ||
3428 | |||
3419 | #endif | 3429 | #endif |
3420 | 3430 | ||
3421 | static int mwifiex_get_coalesce_pkt_type(u8 *byte_seq) | 3431 | static int mwifiex_get_coalesce_pkt_type(u8 *byte_seq) |
@@ -3938,6 +3948,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
3938 | .suspend = mwifiex_cfg80211_suspend, | 3948 | .suspend = mwifiex_cfg80211_suspend, |
3939 | .resume = mwifiex_cfg80211_resume, | 3949 | .resume = mwifiex_cfg80211_resume, |
3940 | .set_wakeup = mwifiex_cfg80211_set_wakeup, | 3950 | .set_wakeup = mwifiex_cfg80211_set_wakeup, |
3951 | .set_rekey_data = mwifiex_set_rekey_data, | ||
3941 | #endif | 3952 | #endif |
3942 | .set_coalesce = mwifiex_cfg80211_set_coalesce, | 3953 | .set_coalesce = mwifiex_cfg80211_set_coalesce, |
3943 | .tdls_mgmt = mwifiex_cfg80211_tdls_mgmt, | 3954 | .tdls_mgmt = mwifiex_cfg80211_tdls_mgmt, |
@@ -3954,7 +3965,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
3954 | #ifdef CONFIG_PM | 3965 | #ifdef CONFIG_PM |
3955 | static const struct wiphy_wowlan_support mwifiex_wowlan_support = { | 3966 | static const struct wiphy_wowlan_support mwifiex_wowlan_support = { |
3956 | .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT | | 3967 | .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT | |
3957 | WIPHY_WOWLAN_NET_DETECT, | 3968 | WIPHY_WOWLAN_NET_DETECT | WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, |
3958 | .n_patterns = MWIFIEX_MEF_MAX_FILTERS, | 3969 | .n_patterns = MWIFIEX_MEF_MAX_FILTERS, |
3959 | .pattern_min_len = 1, | 3970 | .pattern_min_len = 1, |
3960 | .pattern_max_len = MWIFIEX_MAX_PATTERN_LEN, | 3971 | .pattern_max_len = MWIFIEX_MAX_PATTERN_LEN, |
diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index c134cf865291..8703d24eaa9e 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h | |||
@@ -372,6 +372,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
372 | #define HostCmd_CMD_COALESCE_CFG 0x010a | 372 | #define HostCmd_CMD_COALESCE_CFG 0x010a |
373 | #define HostCmd_CMD_MGMT_FRAME_REG 0x010c | 373 | #define HostCmd_CMD_MGMT_FRAME_REG 0x010c |
374 | #define HostCmd_CMD_REMAIN_ON_CHAN 0x010d | 374 | #define HostCmd_CMD_REMAIN_ON_CHAN 0x010d |
375 | #define HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG 0x010f | ||
375 | #define HostCmd_CMD_11AC_CFG 0x0112 | 376 | #define HostCmd_CMD_11AC_CFG 0x0112 |
376 | #define HostCmd_CMD_HS_WAKEUP_REASON 0x0116 | 377 | #define HostCmd_CMD_HS_WAKEUP_REASON 0x0116 |
377 | #define HostCmd_CMD_TDLS_CONFIG 0x0100 | 378 | #define HostCmd_CMD_TDLS_CONFIG 0x0100 |
@@ -2183,6 +2184,14 @@ struct host_cmd_ds_wakeup_reason { | |||
2183 | u16 wakeup_reason; | 2184 | u16 wakeup_reason; |
2184 | } __packed; | 2185 | } __packed; |
2185 | 2186 | ||
2187 | struct host_cmd_ds_gtk_rekey_params { | ||
2188 | __le16 action; | ||
2189 | u8 kck[NL80211_KCK_LEN]; | ||
2190 | u8 kek[NL80211_KEK_LEN]; | ||
2191 | __le32 replay_ctr_low; | ||
2192 | __le32 replay_ctr_high; | ||
2193 | } __packed; | ||
2194 | |||
2186 | struct host_cmd_ds_command { | 2195 | struct host_cmd_ds_command { |
2187 | __le16 command; | 2196 | __le16 command; |
2188 | __le16 size; | 2197 | __le16 size; |
@@ -2256,6 +2265,7 @@ struct host_cmd_ds_command { | |||
2256 | struct host_cmd_ds_multi_chan_policy mc_policy; | 2265 | struct host_cmd_ds_multi_chan_policy mc_policy; |
2257 | struct host_cmd_ds_robust_coex coex; | 2266 | struct host_cmd_ds_robust_coex coex; |
2258 | struct host_cmd_ds_wakeup_reason hs_wakeup_reason; | 2267 | struct host_cmd_ds_wakeup_reason hs_wakeup_reason; |
2268 | struct host_cmd_ds_gtk_rekey_params rekey; | ||
2259 | } params; | 2269 | } params; |
2260 | } __packed; | 2270 | } __packed; |
2261 | 2271 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index 30f152601c57..8cb895b7f2ee 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c | |||
@@ -1558,6 +1558,30 @@ static int mwifiex_cmd_robust_coex(struct mwifiex_private *priv, | |||
1558 | return 0; | 1558 | return 0; |
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | static int mwifiex_cmd_gtk_rekey_offload(struct mwifiex_private *priv, | ||
1562 | struct host_cmd_ds_command *cmd, | ||
1563 | u16 cmd_action, | ||
1564 | struct cfg80211_gtk_rekey_data *data) | ||
1565 | { | ||
1566 | struct host_cmd_ds_gtk_rekey_params *rekey = &cmd->params.rekey; | ||
1567 | u64 rekey_ctr; | ||
1568 | |||
1569 | cmd->command = cpu_to_le16(HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG); | ||
1570 | cmd->size = cpu_to_le16(sizeof(*rekey) + S_DS_GEN); | ||
1571 | |||
1572 | rekey->action = cpu_to_le16(cmd_action); | ||
1573 | if (cmd_action == HostCmd_ACT_GEN_SET) { | ||
1574 | memcpy(rekey->kek, data->kek, NL80211_KEK_LEN); | ||
1575 | memcpy(rekey->kck, data->kck, NL80211_KCK_LEN); | ||
1576 | rekey_ctr = be64_to_cpup((__be64 *)data->replay_ctr); | ||
1577 | rekey->replay_ctr_low = cpu_to_le32((u32)rekey_ctr); | ||
1578 | rekey->replay_ctr_high = | ||
1579 | cpu_to_le32((u32)((u64)rekey_ctr >> 32)); | ||
1580 | } | ||
1581 | |||
1582 | return 0; | ||
1583 | } | ||
1584 | |||
1561 | static int | 1585 | static int |
1562 | mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv, | 1586 | mwifiex_cmd_coalesce_cfg(struct mwifiex_private *priv, |
1563 | struct host_cmd_ds_command *cmd, | 1587 | struct host_cmd_ds_command *cmd, |
@@ -2094,6 +2118,10 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no, | |||
2094 | ret = mwifiex_cmd_robust_coex(priv, cmd_ptr, cmd_action, | 2118 | ret = mwifiex_cmd_robust_coex(priv, cmd_ptr, cmd_action, |
2095 | data_buf); | 2119 | data_buf); |
2096 | break; | 2120 | break; |
2121 | case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG: | ||
2122 | ret = mwifiex_cmd_gtk_rekey_offload(priv, cmd_ptr, cmd_action, | ||
2123 | data_buf); | ||
2124 | break; | ||
2097 | default: | 2125 | default: |
2098 | mwifiex_dbg(priv->adapter, ERROR, | 2126 | mwifiex_dbg(priv->adapter, ERROR, |
2099 | "PREP_CMD: unknown cmd- %#x\n", cmd_no); | 2127 | "PREP_CMD: unknown cmd- %#x\n", cmd_no); |
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c index d96523e10eb4..434b9776db45 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | |||
@@ -1244,6 +1244,8 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no, | |||
1244 | case HostCmd_CMD_ROBUST_COEX: | 1244 | case HostCmd_CMD_ROBUST_COEX: |
1245 | ret = mwifiex_ret_robust_coex(priv, resp, data_buf); | 1245 | ret = mwifiex_ret_robust_coex(priv, resp, data_buf); |
1246 | break; | 1246 | break; |
1247 | case HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG: | ||
1248 | break; | ||
1247 | default: | 1249 | default: |
1248 | mwifiex_dbg(adapter, ERROR, | 1250 | mwifiex_dbg(adapter, ERROR, |
1249 | "CMD_RESP: unknown cmd response %#x\n", | 1251 | "CMD_RESP: unknown cmd response %#x\n", |
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index 070bce401151..0104108b4ea2 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c | |||
@@ -147,6 +147,9 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) | |||
147 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); | 147 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
148 | if (netif_carrier_ok(priv->netdev)) | 148 | if (netif_carrier_ok(priv->netdev)) |
149 | netif_carrier_off(priv->netdev); | 149 | netif_carrier_off(priv->netdev); |
150 | |||
151 | mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG, | ||
152 | HostCmd_ACT_GEN_REMOVE, 0, NULL, false); | ||
150 | } | 153 | } |
151 | 154 | ||
152 | static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, | 155 | static int mwifiex_parse_tdls_event(struct mwifiex_private *priv, |