Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278022
b: refs/heads/master
c: ff0b007
h: refs/heads/master
v: v3
  • Loading branch information
Jouni Malinen authored and Kalle Valo committed Nov 11, 2011
1 parent f41784b commit 4b22b3b
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1261875f7a0a22d0d47bd400b9e9a5cf99909bbf
refs/heads/master: ff0b007573c70be88c4efd3c1d8b41e9ba9710b3
3 changes: 3 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ struct ath6kl {

u8 *roam_tbl;
unsigned int roam_tbl_len;

u8 keepalive;
u8 disc_timeout;
} debug;
#endif /* CONFIG_ATH6KL_DEBUG */
};
Expand Down
95 changes: 95 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,95 @@ static const struct file_operations fops_roam_mode = {
.llseek = default_llseek,
};

void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
{
ar->debug.keepalive = keepalive;
}

static ssize_t ath6kl_keepalive_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
char buf[16];
int len;

len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.keepalive);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static ssize_t ath6kl_keepalive_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
int ret;
u8 val;

ret = kstrtou8_from_user(user_buf, count, 0, &val);
if (ret)
return ret;

ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, val);
if (ret)
return ret;

return count;
}

static const struct file_operations fops_keepalive = {
.open = ath6kl_debugfs_open,
.read = ath6kl_keepalive_read,
.write = ath6kl_keepalive_write,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout)
{
ar->debug.disc_timeout = timeout;
}

static ssize_t ath6kl_disconnect_timeout_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
char buf[16];
int len;

len = snprintf(buf, sizeof(buf), "%u\n", ar->debug.disc_timeout);

return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}

static ssize_t ath6kl_disconnect_timeout_write(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath6kl *ar = file->private_data;
int ret;
u8 val;

ret = kstrtou8_from_user(user_buf, count, 0, &val);
if (ret)
return ret;

ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, val);
if (ret)
return ret;

return count;
}

static const struct file_operations fops_disconnect_timeout = {
.open = ath6kl_debugfs_open,
.read = ath6kl_disconnect_timeout_read,
.write = ath6kl_disconnect_timeout_write,
.owner = THIS_MODULE,
.llseek = default_llseek,
};

int ath6kl_debug_init(struct ath6kl *ar)
{
ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
Expand Down Expand Up @@ -1216,6 +1305,12 @@ int ath6kl_debug_init(struct ath6kl *ar)
debugfs_create_file("roam_mode", S_IWUSR, ar->debugfs_phy, ar,
&fops_roam_mode);

debugfs_create_file("keepalive", S_IRUSR | S_IWUSR, ar->debugfs_phy, ar,
&fops_keepalive);

debugfs_create_file("disconnect_timeout", S_IRUSR | S_IWUSR,
ar->debugfs_phy, ar, &fops_disconnect_timeout);

return 0;
}

Expand Down
11 changes: 11 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void ath6kl_debug_fwlog_event(struct ath6kl *ar, const void *buf, size_t len);
void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war);
int ath6kl_debug_roam_tbl_event(struct ath6kl *ar, const void *buf,
size_t len);
void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive);
void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar, u8 timeout);
int ath6kl_debug_init(struct ath6kl *ar);
void ath6kl_debug_cleanup(struct ath6kl *ar);

Expand Down Expand Up @@ -133,6 +135,15 @@ static inline int ath6kl_debug_roam_tbl_event(struct ath6kl *ar,
return 0;
}

static inline void ath6kl_debug_set_keepalive(struct ath6kl *ar, u8 keepalive)
{
}

static inline void ath6kl_debug_set_disconnect_timeout(struct ath6kl *ar,
u8 timeout)
{
}

static inline int ath6kl_debug_init(struct ath6kl *ar)
{
return 0;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/net/wireless/ath/ath6kl/wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,8 @@ int ath6kl_wmi_disctimeout_cmd(struct wmi *wmi, u8 timeout)

ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_DISC_TIMEOUT_CMDID,
NO_SYNC_WMIFLAG);
if (ret == 0)
ath6kl_debug_set_disconnect_timeout(wmi->parent_dev, timeout);
return ret;
}

Expand Down Expand Up @@ -2524,6 +2526,8 @@ int ath6kl_wmi_set_keepalive_cmd(struct wmi *wmi, u8 keep_alive_intvl)

ret = ath6kl_wmi_cmd_send(wmi, skb, WMI_SET_KEEPALIVE_CMDID,
NO_SYNC_WMIFLAG);
if (ret == 0)
ath6kl_debug_set_keepalive(wmi->parent_dev, keep_alive_intvl);
return ret;
}

Expand Down

0 comments on commit 4b22b3b

Please sign in to comment.