wlcore/wl18xx: add smart config commands
authorEliad Peller <eliad@wizery.com>
Fri, 11 Jul 2014 00:01:31 +0000 (03:01 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 15 Jul 2014 19:59:56 +0000 (15:59 -0400)
These commands configures the fw to set key,
enter smart config mode, and exit it.

Add relevant hw ops as well.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ti/wl18xx/cmd.c
drivers/net/wireless/ti/wl18xx/cmd.h
drivers/net/wireless/ti/wl18xx/main.c
drivers/net/wireless/ti/wlcore/hw_ops.h
drivers/net/wireless/ti/wlcore/wlcore.h

index 7649c75cd68dfd9d189fc724a57522fbad2b9bce..44f0b205b065efa06233387e6545c8021fcf9931 100644 (file)
@@ -78,3 +78,92 @@ out_free:
 out:
        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;
+}
index 03b746bf84f77d66277a25eb7e3409314992327f..92499e2dfa83206a83c7992e24fa21157cf776aa 100644 (file)
@@ -62,5 +62,8 @@ struct wl18xx_cmd_smart_config_set_group_key {
 int wl18xx_cmd_channel_switch(struct wl1271 *wl,
                              struct wl12xx_vif *wlvif,
                              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
index de5b4fa5d1666b9a5af57b8312da487a037ebdf4..2727ca38807c34650e19d7724bb28fb249330e53 100644 (file)
@@ -1687,6 +1687,9 @@ static struct wlcore_ops wl18xx_ops = {
        .convert_hwaddr = wl18xx_convert_hwaddr,
        .lnk_high_prio  = wl18xx_lnk_high_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 */
index 1555ff9700509186e43996ffb4a7c5bbe106522f..aa9f82c7229673a6c509a7a9fef38287675f083a 100644 (file)
@@ -260,4 +260,31 @@ wlcore_hw_lnk_low_prio(struct wl1271 *wl, u8 hlid,
        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
index 71320509b56d5bc3133d602888092a6e566cb89e..13459c4f74d00836b1da7ac47c39abf5571a491a 100644 (file)
@@ -117,6 +117,10 @@ struct wlcore_ops {
                              struct wl1271_link *lnk);
        bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid,
                             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 {