aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wil6210
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/wil6210')
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c71
1 files changed, 54 insertions, 17 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index 68bbb569d4b4..05f9620c260d 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -564,17 +564,19 @@ static const struct file_operations fops_rxon = {
564 .open = simple_open, 564 .open = simple_open,
565}; 565};
566 566
567/* block ack for vring 0 567/* block ack control, write:
568 * write 0 to it to trigger DELBA 568 * - "add <ringid> <agg_size> <timeout>" to trigger ADDBA
569 * write positive agg_wsize to trigger ADDBA 569 * - "del_tx <ringid> <reason>" to trigger DELBA for Tx side
570 * - "del_rx <CID> <TID> <reason>" to trigger DELBA for Rx side
570 */ 571 */
571static ssize_t wil_write_addba(struct file *file, const char __user *buf, 572static ssize_t wil_write_back(struct file *file, const char __user *buf,
572 size_t len, loff_t *ppos) 573 size_t len, loff_t *ppos)
573{ 574{
574 struct wil6210_priv *wil = file->private_data; 575 struct wil6210_priv *wil = file->private_data;
575 int rc; 576 int rc;
576 uint agg_wsize;
577 char *kbuf = kmalloc(len + 1, GFP_KERNEL); 577 char *kbuf = kmalloc(len + 1, GFP_KERNEL);
578 char cmd[8];
579 int p1, p2, p3;
578 580
579 if (!kbuf) 581 if (!kbuf)
580 return -ENOMEM; 582 return -ENOMEM;
@@ -586,25 +588,60 @@ static ssize_t wil_write_addba(struct file *file, const char __user *buf,
586 } 588 }
587 589
588 kbuf[len] = '\0'; 590 kbuf[len] = '\0';
589 rc = kstrtouint(kbuf, 0, &agg_wsize); 591 rc = sscanf(kbuf, "%8s %d %d %d", cmd, &p1, &p2, &p3);
590 kfree(kbuf); 592 kfree(kbuf);
591 593
592 if (rc) 594 if (rc < 0)
593 return rc; 595 return rc;
594 596 if (rc < 2)
595 if (!wil->vring_tx[0].va)
596 return -EINVAL; 597 return -EINVAL;
597 598
598 if (agg_wsize > 0) 599 if (0 == strcmp(cmd, "add")) {
599 wmi_addba(wil, 0, agg_wsize, 0); 600 if (rc < 3) {
600 else 601 wil_err(wil, "BACK: add require at least 2 params\n");
601 wmi_delba_tx(wil, 0, 0); 602 return -EINVAL;
603 }
604 if (rc < 4)
605 p3 = 0;
606 wmi_addba(wil, p1, p2, p3);
607 } else if (0 == strcmp(cmd, "del_tx")) {
608 if (rc < 3)
609 p2 = WLAN_REASON_QSTA_LEAVE_QBSS;
610 wmi_delba_tx(wil, p1, p2);
611 } else if (0 == strcmp(cmd, "del_rx")) {
612 if (rc < 3) {
613 wil_err(wil,
614 "BACK: del_rx require at least 2 params\n");
615 return -EINVAL;
616 }
617 if (rc < 4)
618 p3 = WLAN_REASON_QSTA_LEAVE_QBSS;
619 wmi_delba_rx(wil, mk_cidxtid(p1, p2), p3);
620 } else {
621 wil_err(wil, "BACK: Unrecognized command \"%s\"\n", cmd);
622 return -EINVAL;
623 }
602 624
603 return len; 625 return len;
604} 626}
605 627
606static const struct file_operations fops_addba = { 628static ssize_t wil_read_back(struct file *file, char __user *user_buf,
607 .write = wil_write_addba, 629 size_t count, loff_t *ppos)
630{
631 static const char text[] = "block ack control, write:\n"
632 " - \"add <ringid> <agg_size> <timeout>\" to trigger ADDBA\n"
633 "If missing, <timeout> defaults to 0\n"
634 " - \"del_tx <ringid> <reason>\" to trigger DELBA for Tx side\n"
635 " - \"del_rx <CID> <TID> <reason>\" to trigger DELBA for Rx side\n"
636 "If missing, <reason> set to \"STA_LEAVING\" (36)\n";
637
638 return simple_read_from_buffer(user_buf, count, ppos, text,
639 sizeof(text));
640}
641
642static const struct file_operations fops_back = {
643 .read = wil_read_back,
644 .write = wil_write_back,
608 .open = simple_open, 645 .open = simple_open,
609}; 646};
610 647
@@ -1268,7 +1305,7 @@ static const struct {
1268 {"rxon", S_IWUSR, &fops_rxon}, 1305 {"rxon", S_IWUSR, &fops_rxon},
1269 {"tx_mgmt", S_IWUSR, &fops_txmgmt}, 1306 {"tx_mgmt", S_IWUSR, &fops_txmgmt},
1270 {"wmi_send", S_IWUSR, &fops_wmi}, 1307 {"wmi_send", S_IWUSR, &fops_wmi},
1271 {"addba", S_IWUSR, &fops_addba}, 1308 {"back", S_IRUGO | S_IWUSR, &fops_back},
1272 {"temp", S_IRUGO, &fops_temp}, 1309 {"temp", S_IRUGO, &fops_temp},
1273 {"freq", S_IRUGO, &fops_freq}, 1310 {"freq", S_IRUGO, &fops_freq},
1274 {"link", S_IRUGO, &fops_link}, 1311 {"link", S_IRUGO, &fops_link},