Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Eliad Peller and committed by
John W. Linville
ccb1df94 936c50dd

+127 -1
+89
drivers/net/wireless/ti/wl18xx/cmd.c
··· 78 78 out: 79 79 return ret; 80 80 } 81 + 82 + int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap) 83 + { 84 + struct wl18xx_cmd_smart_config_start *cmd; 85 + int ret = 0; 86 + 87 + wl1271_debug(DEBUG_CMD, "cmd smart config start group_bitmap=0x%x", 88 + group_bitmap); 89 + 90 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 91 + if (!cmd) { 92 + ret = -ENOMEM; 93 + goto out; 94 + } 95 + 96 + cmd->group_id_bitmask = cpu_to_le32(group_bitmap); 97 + 98 + ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_START, cmd, sizeof(*cmd), 0); 99 + if (ret < 0) { 100 + wl1271_error("failed to send smart config start command"); 101 + goto out_free; 102 + } 103 + 104 + out_free: 105 + kfree(cmd); 106 + out: 107 + return ret; 108 + } 109 + 110 + int wl18xx_cmd_smart_config_stop(struct wl1271 *wl) 111 + { 112 + struct wl1271_cmd_header *cmd; 113 + int ret = 0; 114 + 115 + wl1271_debug(DEBUG_CMD, "cmd smart config stop"); 116 + 117 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 118 + if (!cmd) { 119 + ret = -ENOMEM; 120 + goto out; 121 + } 122 + 123 + ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_STOP, cmd, sizeof(*cmd), 0); 124 + if (ret < 0) { 125 + wl1271_error("failed to send smart config stop command"); 126 + goto out_free; 127 + } 128 + 129 + out_free: 130 + kfree(cmd); 131 + out: 132 + return ret; 133 + } 134 + 135 + int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id, 136 + u8 key_len, u8 *key) 137 + { 138 + struct wl18xx_cmd_smart_config_set_group_key *cmd; 139 + int ret = 0; 140 + 141 + wl1271_debug(DEBUG_CMD, "cmd smart config set group key id=0x%x", 142 + group_id); 143 + 144 + if (key_len != sizeof(cmd->key)) { 145 + wl1271_error("invalid group key size: %d", key_len); 146 + return -E2BIG; 147 + } 148 + 149 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 150 + if (!cmd) { 151 + ret = -ENOMEM; 152 + goto out; 153 + } 154 + 155 + cmd->group_id = cpu_to_le32(group_id); 156 + memcpy(cmd->key, key, key_len); 157 + 158 + ret = wl1271_cmd_send(wl, CMD_SMART_CONFIG_SET_GROUP_KEY, cmd, 159 + sizeof(*cmd), 0); 160 + if (ret < 0) { 161 + wl1271_error("failed to send smart config set group key cmd"); 162 + goto out_free; 163 + } 164 + 165 + out_free: 166 + kfree(cmd); 167 + out: 168 + return ret; 169 + }
+4 -1
drivers/net/wireless/ti/wl18xx/cmd.h
··· 62 62 int wl18xx_cmd_channel_switch(struct wl1271 *wl, 63 63 struct wl12xx_vif *wlvif, 64 64 struct ieee80211_channel_switch *ch_switch); 65 - 65 + int wl18xx_cmd_smart_config_start(struct wl1271 *wl, u32 group_bitmap); 66 + int wl18xx_cmd_smart_config_stop(struct wl1271 *wl); 67 + int wl18xx_cmd_smart_config_set_group_key(struct wl1271 *wl, u16 group_id, 68 + u8 key_len, u8 *key); 66 69 #endif
+3
drivers/net/wireless/ti/wl18xx/main.c
··· 1687 1687 .convert_hwaddr = wl18xx_convert_hwaddr, 1688 1688 .lnk_high_prio = wl18xx_lnk_high_prio, 1689 1689 .lnk_low_prio = wl18xx_lnk_low_prio, 1690 + .smart_config_start = wl18xx_cmd_smart_config_start, 1691 + .smart_config_stop = wl18xx_cmd_smart_config_stop, 1692 + .smart_config_set_group_key = wl18xx_cmd_smart_config_set_group_key, 1690 1693 }; 1691 1694 1692 1695 /* HT cap appropriate for wide channels in 2Ghz */
+27
drivers/net/wireless/ti/wlcore/hw_ops.h
··· 260 260 return wl->ops->lnk_low_prio(wl, hlid, lnk); 261 261 } 262 262 263 + static inline int 264 + wlcore_smart_config_start(struct wl1271 *wl, u32 group_bitmap) 265 + { 266 + if (!wl->ops->smart_config_start) 267 + return -EINVAL; 268 + 269 + return wl->ops->smart_config_start(wl, group_bitmap); 270 + } 271 + 272 + static inline int 273 + wlcore_smart_config_stop(struct wl1271 *wl) 274 + { 275 + if (!wl->ops->smart_config_stop) 276 + return -EINVAL; 277 + 278 + return wl->ops->smart_config_stop(wl); 279 + } 280 + 281 + static inline int 282 + wlcore_smart_config_set_group_key(struct wl1271 *wl, u16 group_id, 283 + u8 key_len, u8 *key) 284 + { 285 + if (!wl->ops->smart_config_set_group_key) 286 + return -EINVAL; 287 + 288 + return wl->ops->smart_config_set_group_key(wl, group_id, key_len, key); 289 + } 263 290 #endif
+4
drivers/net/wireless/ti/wlcore/wlcore.h
··· 117 117 struct wl1271_link *lnk); 118 118 bool (*lnk_low_prio)(struct wl1271 *wl, u8 hlid, 119 119 struct wl1271_link *lnk); 120 + int (*smart_config_start)(struct wl1271 *wl, u32 group_bitmap); 121 + int (*smart_config_stop)(struct wl1271 *wl); 122 + int (*smart_config_set_group_key)(struct wl1271 *wl, u16 group_id, 123 + u8 key_len, u8 *key); 120 124 }; 121 125 122 126 enum wlcore_partitions {