diff options
author | Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> | 2014-06-16 12:36:59 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-06-19 15:49:23 -0400 |
commit | 0b39aaf2f2035b1c42b805a786a8b42f7501b82f (patch) | |
tree | 07512595306e2dfef071973004ff19c4413a36d6 /drivers/net/wireless/ath/wil6210/debugfs.c | |
parent | e8c58e7a5a106c3d557fccd01cd4d1128f9bab38 (diff) |
wil6210: Tx mgmt frame from debugfs
Provide 2 files on the debugfs:
- "rxon": write channel (1..4) to open Rx on it, 0 to rxoff
- "tx_mgmt": write binary frame, starting from MAC header
one need to care about turning receiver on/off before/after tx_mgmt
Correct sequence is:
echo $channel > rxon
cat mfmt_frame > tx_mgmt
echo 0 > rxon
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/wil6210/debugfs.c')
-rw-r--r-- | drivers/net/wireless/ath/wil6210/debugfs.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 8d4bc4bfb664..9d5db0472f4b 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -397,6 +397,84 @@ static const struct file_operations fops_reset = { | |||
397 | .write = wil_write_file_reset, | 397 | .write = wil_write_file_reset, |
398 | .open = simple_open, | 398 | .open = simple_open, |
399 | }; | 399 | }; |
400 | /*---write channel 1..4 to rxon for it, 0 to rxoff---*/ | ||
401 | static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf, | ||
402 | size_t len, loff_t *ppos) | ||
403 | { | ||
404 | struct wil6210_priv *wil = file->private_data; | ||
405 | int rc; | ||
406 | long channel; | ||
407 | bool on; | ||
408 | |||
409 | char *kbuf = kmalloc(len + 1, GFP_KERNEL); | ||
410 | if (!kbuf) | ||
411 | return -ENOMEM; | ||
412 | if (copy_from_user(kbuf, buf, len)) | ||
413 | return -EIO; | ||
414 | |||
415 | kbuf[len] = '\0'; | ||
416 | rc = kstrtol(kbuf, 0, &channel); | ||
417 | kfree(kbuf); | ||
418 | if (rc) | ||
419 | return rc; | ||
420 | |||
421 | if ((channel < 0) || (channel > 4)) { | ||
422 | wil_err(wil, "Invalid channel %ld\n", channel); | ||
423 | return -EINVAL; | ||
424 | } | ||
425 | on = !!channel; | ||
426 | |||
427 | if (on) { | ||
428 | rc = wmi_set_channel(wil, (int)channel); | ||
429 | if (rc) | ||
430 | return rc; | ||
431 | } | ||
432 | |||
433 | rc = wmi_rxon(wil, on); | ||
434 | if (rc) | ||
435 | return rc; | ||
436 | |||
437 | return len; | ||
438 | } | ||
439 | |||
440 | static const struct file_operations fops_rxon = { | ||
441 | .write = wil_write_file_rxon, | ||
442 | .open = simple_open, | ||
443 | }; | ||
444 | /*---tx_mgmt---*/ | ||
445 | /* Write mgmt frame to this file to send it */ | ||
446 | static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, | ||
447 | size_t len, loff_t *ppos) | ||
448 | { | ||
449 | struct wil6210_priv *wil = file->private_data; | ||
450 | struct wiphy *wiphy = wil_to_wiphy(wil); | ||
451 | struct wireless_dev *wdev = wil_to_wdev(wil); | ||
452 | struct cfg80211_mgmt_tx_params params; | ||
453 | int rc; | ||
454 | |||
455 | void *frame = kmalloc(len, GFP_KERNEL); | ||
456 | if (!frame) | ||
457 | return -ENOMEM; | ||
458 | |||
459 | if (copy_from_user(frame, buf, len)) | ||
460 | return -EIO; | ||
461 | |||
462 | params.buf = frame; | ||
463 | params.len = len; | ||
464 | params.chan = wdev->preset_chandef.chan; | ||
465 | |||
466 | rc = wil_cfg80211_mgmt_tx(wiphy, wdev, ¶ms, NULL); | ||
467 | |||
468 | kfree(frame); | ||
469 | wil_info(wil, "%s() -> %d\n", __func__, rc); | ||
470 | |||
471 | return len; | ||
472 | } | ||
473 | |||
474 | static const struct file_operations fops_txmgmt = { | ||
475 | .write = wil_write_file_txmgmt, | ||
476 | .open = simple_open, | ||
477 | }; | ||
400 | 478 | ||
401 | static void wil_seq_hexdump(struct seq_file *s, void *p, int len, | 479 | static void wil_seq_hexdump(struct seq_file *s, void *p, int len, |
402 | const char *prefix) | 480 | const char *prefix) |
@@ -719,6 +797,8 @@ int wil6210_debugfs_init(struct wil6210_priv *wil) | |||
719 | debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); | 797 | debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); |
720 | 798 | ||
721 | debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); | 799 | debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); |
800 | debugfs_create_file("rxon", S_IWUSR, dbg, wil, &fops_rxon); | ||
801 | debugfs_create_file("tx_mgmt", S_IWUSR, dbg, wil, &fops_txmgmt); | ||
722 | debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); | 802 | debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp); |
723 | 803 | ||
724 | wil->rgf_blob.data = (void * __force)wil->csr + 0; | 804 | wil->rgf_blob.data = (void * __force)wil->csr + 0; |