Commit ccb1df94 authored by Eliad Peller's avatar Eliad Peller Committed by John W. Linville

wlcore/wl18xx: add smart config commands

These commands configures the fw to set key,
enter smart config mode, and exit it.

Add relevant hw ops as well.
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 936c50dd
...@@ -78,3 +78,92 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl, ...@@ -78,3 +78,92 @@ int wl18xx_cmd_channel_switch(struct wl1271 *wl,
out: out:
return ret; return ret;
} }
int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
{
struct wl18xx_cmd_smart_config_start *cmd;
int ret = 0;
wl1271_debug(DEBUG_CMD, "cmd smart config start group_bitmap=0x%x",
group_bitmap);
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
ret = -ENOMEM;
goto out;
}
cmd->group_id_bitmask = cpu_to_le32(group_bitmap);
ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_START, cmd, sizeof(*cmd), 0);
if (ret < 0) {
wl1271_error("failed to send smart config start command");
goto out_free;
}
out_free:
kfree(cmd);
out:
return ret;
}
int wl18xx_cmd_smart_config_stop(struct wl1271 *wl)
{
struct wl1271_cmd_header *cmd;
int ret = 0;
wl1271_debug(DEBUG_CMD, "cmd smart config stop");
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
ret = -ENOMEM;
goto out;
}
ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_STOP, cmd, sizeof(*cmd), 0);
if (ret < 0) {
wl1271_error("failed to send smart config stop command");
goto out_free;
}
out_free:
kfree(cmd);
out:
return ret;
}
int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
u8 key_len, u8 *key)
{
struct wl18xx_cmd_smart_config_set_group_key *cmd;
int ret = 0;
wl1271_debug(DEBUG_CMD, "cmd smart config set group key id=0x%x",
group_id);
if (key_len != sizeof(cmd->key)) {
wl1271_error("invalid group key size: %d", key_len);
return -E2BIG;
}
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
ret = -ENOMEM;
goto out;
}
cmd->group_id = cpu_to_le32(group_id);
memcpy(cmd->key, key, key_len);
ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_SET_GROUP_KEY, cmd,
sizeof(*cmd), 0);
if (ret < 0) {
wl1271_error("failed to send smart config set group key cmd");
goto out_free;
}
out_free:
kfree(cmd);
out:
return ret;
}
...@@ -62,5 +62,8 @@ struct wl18xx_cmd_smart_config_set_group_key { ...@@ -62,5 +62,8 @@ struct wl18xx_cmd_smart_config_set_group_key {
int wl18xx_cmd_channel_switch(struct wl1271 *wl, int wl18xx_cmd_channel_switch(struct wl1271 *wl,
struct wl12xx_vif *wlvif, struct wl12xx_vif *wlvif,
struct ieee80211_channel_switch *ch_switch); struct ieee80211_channel_switch *ch_switch);
int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap);
int wl18xx_cmd_smart_config_stop(struct wl1271 *wl);
int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
u8 key_len, u8 *key);
#endif #endif
...@@ -1687,6 +1687,9 @@ static struct wlcore_ops wl18xx_ops = { ...@@ -1687,6 +1687,9 @@ static struct wlcore_ops wl18xx_ops = {
.convert_hwaddr = wl18xx_convert_hwaddr, .convert_hwaddr = wl18xx_convert_hwaddr,
.lnk_high_prio = wl18xx_lnk_high_prio, .lnk_high_prio = wl18xx_lnk_high_prio,
.lnk_low_prio = wl18xx_lnk_low_prio, .lnk_low_prio = wl18xx_lnk_low_prio,
.smart_config_start = wl18xx_cmd_smart_config_start,
.smart_config_stop = wl18xx_cmd_smart_config_stop,
.smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key,
}; };
/* HT cap appropriate for wide channels in 2Ghz */ /* HT cap appropriate for wide channels in 2Ghz */
......
...@@ -260,4 +260,31 @@ wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid, ...@@ -260,4 +260,31 @@ wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
return wl->ops->lnk_low_prio(wl, hlid, lnk); return wl->ops->lnk_low_prio(wl, hlid, lnk);
} }
static inline int
wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap)
{
if (!wl->ops->smart_config_start)
return -EINVAL;
return wl->ops->smart_config_start(wl, group_bitmap);
}
static inline int
wlcore_smart_config_stop(struct wl1271 *wl)
{
if (!wl->ops->smart_config_stop)
return -EINVAL;
return wl->ops->smart_config_stop(wl);
}
static inline int
wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id,
u8 key_len, u8 *key)
{
if (!wl->ops->smart_config_set_group_key)
return -EINVAL;
return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key);
}
#endif #endif
...@@ -117,6 +117,10 @@ struct wlcore_ops { ...@@ -117,6 +117,10 @@ struct wlcore_ops {
struct wl1271_link *lnk); struct wl1271_link *lnk);
bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid, bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid,
struct wl1271_link *lnk); struct wl1271_link *lnk);
int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap);
int (*smart_config_stop)(struct wl1271 *wl);
int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id,
u8 key_len, u8 *key);
}; };
enum wlcore_partitions { enum wlcore_partitions {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment