int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) { struct wl1271 *wl = hw->priv; struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; int err; err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy); if (err) return err; if (!tb[WL1271_TM_ATTR_CMD_ID]) return -EINVAL; switch (nla_get_u32(tb[WL1271_TM_ATTR_CMD_ID])) { case WL1271_TM_CMD_TEST: return wl1271_tm_cmd_test(wl, tb); case WL1271_TM_CMD_INTERROGATE: return wl1271_tm_cmd_interrogate(wl, tb); case WL1271_TM_CMD_CONFIGURE: return wl1271_tm_cmd_configure(wl, tb); case WL1271_TM_CMD_SET_PLT_MODE: return wl1271_tm_cmd_set_plt_mode(wl, tb); case WL1271_TM_CMD_RECOVER: return wl1271_tm_cmd_recover(wl, tb); case WL1271_TM_CMD_GET_MAC: return wl12xx_tm_cmd_get_mac(wl, tb); default: return -EOPNOTSUPP; } }
int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void *data, int len) { struct wl1271 *wl = hw->priv; struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; u32 nla_cmd; int err; err = nla_parse(tb, WL1271_TM_ATTR_MAX, data, len, wl1271_tm_policy); if (err) return err; if (!tb[WL1271_TM_ATTR_CMD_ID]) return -EINVAL; nla_cmd = nla_get_u32(tb[WL1271_TM_ATTR_CMD_ID]); /* Only SET_PLT_MODE is allowed in case of mode PLT_CHIP_AWAKE */ if (wl->plt_mode == PLT_CHIP_AWAKE && nla_cmd != WL1271_TM_CMD_SET_PLT_MODE) return -EOPNOTSUPP; switch (nla_cmd) { case WL1271_TM_CMD_TEST: return wl1271_tm_cmd_test(wl, tb); case WL1271_TM_CMD_INTERROGATE: return wl1271_tm_cmd_interrogate(wl, tb); case WL1271_TM_CMD_CONFIGURE: return wl1271_tm_cmd_configure(wl, tb); case WL1271_TM_CMD_SET_PLT_MODE: return wl1271_tm_cmd_set_plt_mode(wl, tb); case WL1271_TM_CMD_GET_MAC: return wl12xx_tm_cmd_get_mac(wl, tb); case WL1271_TM_CMD_SMART_CONFIG_START: return wlcore_tm_cmd_smart_config_start(wl, tb); case WL1271_TM_CMD_SMART_CONFIG_STOP: return wlcore_tm_cmd_smart_config_stop(wl, tb); case WL1271_TM_CMD_SMART_CONFIG_SET_GROUP_KEY: return wlcore_tm_cmd_smart_config_set_group_key(wl, tb); default: return -EOPNOTSUPP; } }