mirror of https://gitee.com/openkylin/linux.git
ath6kl: Add debugfs files for roaming control
Roaming mode can be changed by writing roam mode (default, bssbias, or lock) to roam_mode. Forced roam can be requested by writing the BSSID into force_roam. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
4b28a80dd6
commit
1261875f7a
|
@ -1071,6 +1071,84 @@ static const struct file_operations fops_roam_table = {
|
||||||
.llseek = default_llseek,
|
.llseek = default_llseek,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ssize_t ath6kl_force_roam_write(struct file *file,
|
||||||
|
const char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ath6kl *ar = file->private_data;
|
||||||
|
int ret;
|
||||||
|
char buf[20];
|
||||||
|
size_t len;
|
||||||
|
u8 bssid[ETH_ALEN];
|
||||||
|
int i;
|
||||||
|
int addr[ETH_ALEN];
|
||||||
|
|
||||||
|
len = min(count, sizeof(buf) - 1);
|
||||||
|
if (copy_from_user(buf, user_buf, len))
|
||||||
|
return -EFAULT;
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
if (sscanf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
&addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5])
|
||||||
|
!= ETH_ALEN)
|
||||||
|
return -EINVAL;
|
||||||
|
for (i = 0; i < ETH_ALEN; i++)
|
||||||
|
bssid[i] = addr[i];
|
||||||
|
|
||||||
|
ret = ath6kl_wmi_force_roam_cmd(ar->wmi, bssid);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations fops_force_roam = {
|
||||||
|
.write = ath6kl_force_roam_write,
|
||||||
|
.open = ath6kl_debugfs_open,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.llseek = default_llseek,
|
||||||
|
};
|
||||||
|
|
||||||
|
static ssize_t ath6kl_roam_mode_write(struct file *file,
|
||||||
|
const char __user *user_buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ath6kl *ar = file->private_data;
|
||||||
|
int ret;
|
||||||
|
char buf[20];
|
||||||
|
size_t len;
|
||||||
|
enum wmi_roam_mode mode;
|
||||||
|
|
||||||
|
len = min(count, sizeof(buf) - 1);
|
||||||
|
if (copy_from_user(buf, user_buf, len))
|
||||||
|
return -EFAULT;
|
||||||
|
buf[len] = '\0';
|
||||||
|
if (len > 0 && buf[len - 1] == '\n')
|
||||||
|
buf[len - 1] = '\0';
|
||||||
|
|
||||||
|
if (strcasecmp(buf, "default") == 0)
|
||||||
|
mode = WMI_DEFAULT_ROAM_MODE;
|
||||||
|
else if (strcasecmp(buf, "bssbias") == 0)
|
||||||
|
mode = WMI_HOST_BIAS_ROAM_MODE;
|
||||||
|
else if (strcasecmp(buf, "lock") == 0)
|
||||||
|
mode = WMI_LOCK_BSS_MODE;
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
ret = ath6kl_wmi_set_roam_mode_cmd(ar->wmi, mode);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations fops_roam_mode = {
|
||||||
|
.write = ath6kl_roam_mode_write,
|
||||||
|
.open = ath6kl_debugfs_open,
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.llseek = default_llseek,
|
||||||
|
};
|
||||||
|
|
||||||
int ath6kl_debug_init(struct ath6kl *ar)
|
int ath6kl_debug_init(struct ath6kl *ar)
|
||||||
{
|
{
|
||||||
ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
|
ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
|
||||||
|
@ -1132,6 +1210,12 @@ int ath6kl_debug_init(struct ath6kl *ar)
|
||||||
debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
|
debugfs_create_file("roam_table", S_IRUSR, ar->debugfs_phy, ar,
|
||||||
&fops_roam_table);
|
&fops_roam_table);
|
||||||
|
|
||||||
|
debugfs_create_file("force_roam", S_IWUSR, ar->debugfs_phy, ar,
|
||||||
|
&fops_force_roam);
|
||||||
|
|
||||||
|
debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
|
||||||
|
&fops_roam_mode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -682,6 +682,46 @@ int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid)
|
||||||
|
{
|
||||||
|
struct sk_buff *skb;
|
||||||
|
struct roam_ctrl_cmd *cmd;
|
||||||
|
|
||||||
|
skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
|
||||||
|
if (!skb)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
cmd = (struct roam_ctrl_cmd *) skb->data;
|
||||||
|
memset(cmd, 0, sizeof(*cmd));
|
||||||
|
|
||||||
|
memcpy(cmd->info.bssid, bssid, ETH_ALEN);
|
||||||
|
cmd->roam_ctrl = WMI_FORCE_ROAM;
|
||||||
|
|
||||||
|
ath6kl_dbg(ATH6KL_DBG_WMI, "force roam to %pM\n", bssid);
|
||||||
|
return ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_ROAM_CTRL_CMDID,
|
||||||
|
NO_SYNC_WMIFLAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode)
|
||||||
|
{
|
||||||
|
struct sk_buff *skb;
|
||||||
|
struct roam_ctrl_cmd *cmd;
|
||||||
|
|
||||||
|
skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
|
||||||
|
if (!skb)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
cmd = (struct roam_ctrl_cmd *) skb->data;
|
||||||
|
memset(cmd, 0, sizeof(*cmd));
|
||||||
|
|
||||||
|
cmd->info.roam_mode = mode;
|
||||||
|
cmd->roam_ctrl = WMI_SET_ROAM_MODE;
|
||||||
|
|
||||||
|
ath6kl_dbg(ATH6KL_DBG_WMI, "set roam mode %d\n", mode);
|
||||||
|
return ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_ROAM_CTRL_CMDID,
|
||||||
|
NO_SYNC_WMIFLAG);
|
||||||
|
}
|
||||||
|
|
||||||
static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len)
|
static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len)
|
||||||
{
|
{
|
||||||
struct wmi_connect_event *ev;
|
struct wmi_connect_event *ev;
|
||||||
|
|
|
@ -1354,14 +1354,20 @@ enum wmi_roam_ctrl {
|
||||||
WMI_SET_LRSSI_SCAN_PARAMS,
|
WMI_SET_LRSSI_SCAN_PARAMS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wmi_roam_mode {
|
||||||
|
WMI_DEFAULT_ROAM_MODE = 1, /* RSSI based roam */
|
||||||
|
WMI_HOST_BIAS_ROAM_MODE = 2, /* Host bias based roam */
|
||||||
|
WMI_LOCK_BSS_MODE = 3, /* Lock to the current BSS */
|
||||||
|
};
|
||||||
|
|
||||||
struct bss_bias {
|
struct bss_bias {
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
u8 bias;
|
s8 bias;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct bss_bias_info {
|
struct bss_bias_info {
|
||||||
u8 num_bss;
|
u8 num_bss;
|
||||||
struct bss_bias bss_bias[1];
|
struct bss_bias bss_bias[0];
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
struct low_rssi_scan_params {
|
struct low_rssi_scan_params {
|
||||||
|
@ -1374,10 +1380,11 @@ struct low_rssi_scan_params {
|
||||||
|
|
||||||
struct roam_ctrl_cmd {
|
struct roam_ctrl_cmd {
|
||||||
union {
|
union {
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN]; /* WMI_FORCE_ROAM */
|
||||||
u8 roam_mode;
|
u8 roam_mode; /* WMI_SET_ROAM_MODE */
|
||||||
struct bss_bias_info bss;
|
struct bss_bias_info bss; /* WMI_SET_HOST_BIAS */
|
||||||
struct low_rssi_scan_params params;
|
struct low_rssi_scan_params params; /* WMI_SET_LRSSI_SCAN_PARAMS
|
||||||
|
*/
|
||||||
} __packed info;
|
} __packed info;
|
||||||
u8 roam_ctrl;
|
u8 roam_ctrl;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
@ -2237,6 +2244,8 @@ s32 ath6kl_wmi_get_rate(s8 rate_index);
|
||||||
|
|
||||||
int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd);
|
int ath6kl_wmi_set_ip_cmd(struct wmi *wmi, struct wmi_set_ip_cmd *ip_cmd);
|
||||||
int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi);
|
int ath6kl_wmi_set_roam_lrssi_cmd(struct wmi *wmi, u8 lrssi);
|
||||||
|
int ath6kl_wmi_force_roam_cmd(struct wmi *wmi, const u8 *bssid);
|
||||||
|
int ath6kl_wmi_set_roam_mode_cmd(struct wmi *wmi, enum wmi_roam_mode mode);
|
||||||
|
|
||||||
/* AP mode */
|
/* AP mode */
|
||||||
int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, struct wmi_connect_cmd *p);
|
int ath6kl_wmi_ap_profile_commit(struct wmi *wmip, struct wmi_connect_cmd *p);
|
||||||
|
|
Loading…
Reference in New Issue