.. | .. |
---|
18 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | 19 | * General Public License for more details. |
---|
20 | 20 | * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with this program; if not, write to the Free Software |
---|
23 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
---|
24 | | - * USA |
---|
25 | | - * |
---|
26 | 21 | * The full GNU General Public License is included in this distribution |
---|
27 | 22 | * in the file called COPYING. |
---|
28 | 23 | * |
---|
.. | .. |
---|
65 | 60 | * |
---|
66 | 61 | *****************************************************************************/ |
---|
67 | 62 | #include "mvm.h" |
---|
68 | | -#include "fw/api/tof.h" |
---|
69 | 63 | #include "debugfs.h" |
---|
70 | 64 | |
---|
71 | 65 | static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, |
---|
.. | .. |
---|
531 | 525 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
532 | 526 | } |
---|
533 | 527 | |
---|
534 | | -static ssize_t iwl_dbgfs_tof_enable_write(struct ieee80211_vif *vif, |
---|
535 | | - char *buf, |
---|
536 | | - size_t count, loff_t *ppos) |
---|
537 | | -{ |
---|
538 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
539 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
540 | | - u32 value; |
---|
541 | | - int ret = -EINVAL; |
---|
542 | | - char *data; |
---|
543 | | - |
---|
544 | | - mutex_lock(&mvm->mutex); |
---|
545 | | - |
---|
546 | | - data = iwl_dbgfs_is_match("tof_disabled=", buf); |
---|
547 | | - if (data) { |
---|
548 | | - ret = kstrtou32(data, 10, &value); |
---|
549 | | - if (ret == 0) |
---|
550 | | - mvm->tof_data.tof_cfg.tof_disabled = value; |
---|
551 | | - goto out; |
---|
552 | | - } |
---|
553 | | - |
---|
554 | | - data = iwl_dbgfs_is_match("one_sided_disabled=", buf); |
---|
555 | | - if (data) { |
---|
556 | | - ret = kstrtou32(data, 10, &value); |
---|
557 | | - if (ret == 0) |
---|
558 | | - mvm->tof_data.tof_cfg.one_sided_disabled = value; |
---|
559 | | - goto out; |
---|
560 | | - } |
---|
561 | | - |
---|
562 | | - data = iwl_dbgfs_is_match("is_debug_mode=", buf); |
---|
563 | | - if (data) { |
---|
564 | | - ret = kstrtou32(data, 10, &value); |
---|
565 | | - if (ret == 0) |
---|
566 | | - mvm->tof_data.tof_cfg.is_debug_mode = value; |
---|
567 | | - goto out; |
---|
568 | | - } |
---|
569 | | - |
---|
570 | | - data = iwl_dbgfs_is_match("is_buf=", buf); |
---|
571 | | - if (data) { |
---|
572 | | - ret = kstrtou32(data, 10, &value); |
---|
573 | | - if (ret == 0) |
---|
574 | | - mvm->tof_data.tof_cfg.is_buf_required = value; |
---|
575 | | - goto out; |
---|
576 | | - } |
---|
577 | | - |
---|
578 | | - data = iwl_dbgfs_is_match("send_tof_cfg=", buf); |
---|
579 | | - if (data) { |
---|
580 | | - ret = kstrtou32(data, 10, &value); |
---|
581 | | - if (ret == 0 && value) { |
---|
582 | | - ret = iwl_mvm_tof_config_cmd(mvm); |
---|
583 | | - goto out; |
---|
584 | | - } |
---|
585 | | - } |
---|
586 | | - |
---|
587 | | -out: |
---|
588 | | - mutex_unlock(&mvm->mutex); |
---|
589 | | - |
---|
590 | | - return ret ?: count; |
---|
591 | | -} |
---|
592 | | - |
---|
593 | | -static ssize_t iwl_dbgfs_tof_enable_read(struct file *file, |
---|
594 | | - char __user *user_buf, |
---|
595 | | - size_t count, loff_t *ppos) |
---|
596 | | -{ |
---|
597 | | - struct ieee80211_vif *vif = file->private_data; |
---|
598 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
599 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
600 | | - char buf[256]; |
---|
601 | | - int pos = 0; |
---|
602 | | - const size_t bufsz = sizeof(buf); |
---|
603 | | - struct iwl_tof_config_cmd *cmd; |
---|
604 | | - |
---|
605 | | - cmd = &mvm->tof_data.tof_cfg; |
---|
606 | | - |
---|
607 | | - mutex_lock(&mvm->mutex); |
---|
608 | | - |
---|
609 | | - pos += scnprintf(buf + pos, bufsz - pos, "tof_disabled = %d\n", |
---|
610 | | - cmd->tof_disabled); |
---|
611 | | - pos += scnprintf(buf + pos, bufsz - pos, "one_sided_disabled = %d\n", |
---|
612 | | - cmd->one_sided_disabled); |
---|
613 | | - pos += scnprintf(buf + pos, bufsz - pos, "is_debug_mode = %d\n", |
---|
614 | | - cmd->is_debug_mode); |
---|
615 | | - pos += scnprintf(buf + pos, bufsz - pos, "is_buf_required = %d\n", |
---|
616 | | - cmd->is_buf_required); |
---|
617 | | - |
---|
618 | | - mutex_unlock(&mvm->mutex); |
---|
619 | | - |
---|
620 | | - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
621 | | -} |
---|
622 | | - |
---|
623 | | -static ssize_t iwl_dbgfs_tof_responder_params_write(struct ieee80211_vif *vif, |
---|
624 | | - char *buf, |
---|
625 | | - size_t count, loff_t *ppos) |
---|
626 | | -{ |
---|
627 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
628 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
629 | | - u32 value; |
---|
630 | | - int ret = 0; |
---|
631 | | - char *data; |
---|
632 | | - |
---|
633 | | - mutex_lock(&mvm->mutex); |
---|
634 | | - |
---|
635 | | - data = iwl_dbgfs_is_match("burst_period=", buf); |
---|
636 | | - if (data) { |
---|
637 | | - ret = kstrtou32(data, 10, &value); |
---|
638 | | - if (!ret) |
---|
639 | | - mvm->tof_data.responder_cfg.burst_period = |
---|
640 | | - cpu_to_le16(value); |
---|
641 | | - goto out; |
---|
642 | | - } |
---|
643 | | - |
---|
644 | | - data = iwl_dbgfs_is_match("min_delta_ftm=", buf); |
---|
645 | | - if (data) { |
---|
646 | | - ret = kstrtou32(data, 10, &value); |
---|
647 | | - if (ret == 0) |
---|
648 | | - mvm->tof_data.responder_cfg.min_delta_ftm = value; |
---|
649 | | - goto out; |
---|
650 | | - } |
---|
651 | | - |
---|
652 | | - data = iwl_dbgfs_is_match("burst_duration=", buf); |
---|
653 | | - if (data) { |
---|
654 | | - ret = kstrtou32(data, 10, &value); |
---|
655 | | - if (ret == 0) |
---|
656 | | - mvm->tof_data.responder_cfg.burst_duration = value; |
---|
657 | | - goto out; |
---|
658 | | - } |
---|
659 | | - |
---|
660 | | - data = iwl_dbgfs_is_match("num_of_burst_exp=", buf); |
---|
661 | | - if (data) { |
---|
662 | | - ret = kstrtou32(data, 10, &value); |
---|
663 | | - if (ret == 0) |
---|
664 | | - mvm->tof_data.responder_cfg.num_of_burst_exp = value; |
---|
665 | | - goto out; |
---|
666 | | - } |
---|
667 | | - |
---|
668 | | - data = iwl_dbgfs_is_match("abort_responder=", buf); |
---|
669 | | - if (data) { |
---|
670 | | - ret = kstrtou32(data, 10, &value); |
---|
671 | | - if (ret == 0) |
---|
672 | | - mvm->tof_data.responder_cfg.abort_responder = value; |
---|
673 | | - goto out; |
---|
674 | | - } |
---|
675 | | - |
---|
676 | | - data = iwl_dbgfs_is_match("get_ch_est=", buf); |
---|
677 | | - if (data) { |
---|
678 | | - ret = kstrtou32(data, 10, &value); |
---|
679 | | - if (ret == 0) |
---|
680 | | - mvm->tof_data.responder_cfg.get_ch_est = value; |
---|
681 | | - goto out; |
---|
682 | | - } |
---|
683 | | - |
---|
684 | | - data = iwl_dbgfs_is_match("recv_sta_req_params=", buf); |
---|
685 | | - if (data) { |
---|
686 | | - ret = kstrtou32(data, 10, &value); |
---|
687 | | - if (ret == 0) |
---|
688 | | - mvm->tof_data.responder_cfg.recv_sta_req_params = value; |
---|
689 | | - goto out; |
---|
690 | | - } |
---|
691 | | - |
---|
692 | | - data = iwl_dbgfs_is_match("channel_num=", buf); |
---|
693 | | - if (data) { |
---|
694 | | - ret = kstrtou32(data, 10, &value); |
---|
695 | | - if (ret == 0) |
---|
696 | | - mvm->tof_data.responder_cfg.channel_num = value; |
---|
697 | | - goto out; |
---|
698 | | - } |
---|
699 | | - |
---|
700 | | - data = iwl_dbgfs_is_match("bandwidth=", buf); |
---|
701 | | - if (data) { |
---|
702 | | - ret = kstrtou32(data, 10, &value); |
---|
703 | | - if (ret == 0) |
---|
704 | | - mvm->tof_data.responder_cfg.bandwidth = value; |
---|
705 | | - goto out; |
---|
706 | | - } |
---|
707 | | - |
---|
708 | | - data = iwl_dbgfs_is_match("rate=", buf); |
---|
709 | | - if (data) { |
---|
710 | | - ret = kstrtou32(data, 10, &value); |
---|
711 | | - if (ret == 0) |
---|
712 | | - mvm->tof_data.responder_cfg.rate = value; |
---|
713 | | - goto out; |
---|
714 | | - } |
---|
715 | | - |
---|
716 | | - data = iwl_dbgfs_is_match("bssid=", buf); |
---|
717 | | - if (data) { |
---|
718 | | - u8 *mac = mvm->tof_data.responder_cfg.bssid; |
---|
719 | | - |
---|
720 | | - if (!mac_pton(data, mac)) { |
---|
721 | | - ret = -EINVAL; |
---|
722 | | - goto out; |
---|
723 | | - } |
---|
724 | | - } |
---|
725 | | - |
---|
726 | | - data = iwl_dbgfs_is_match("tsf_timer_offset_msecs=", buf); |
---|
727 | | - if (data) { |
---|
728 | | - ret = kstrtou32(data, 10, &value); |
---|
729 | | - if (ret == 0) |
---|
730 | | - mvm->tof_data.responder_cfg.tsf_timer_offset_msecs = |
---|
731 | | - cpu_to_le16(value); |
---|
732 | | - goto out; |
---|
733 | | - } |
---|
734 | | - |
---|
735 | | - data = iwl_dbgfs_is_match("toa_offset=", buf); |
---|
736 | | - if (data) { |
---|
737 | | - ret = kstrtou32(data, 10, &value); |
---|
738 | | - if (ret == 0) |
---|
739 | | - mvm->tof_data.responder_cfg.toa_offset = |
---|
740 | | - cpu_to_le16(value); |
---|
741 | | - goto out; |
---|
742 | | - } |
---|
743 | | - |
---|
744 | | - data = iwl_dbgfs_is_match("center_freq=", buf); |
---|
745 | | - if (data) { |
---|
746 | | - struct iwl_tof_responder_config_cmd *cmd = |
---|
747 | | - &mvm->tof_data.responder_cfg; |
---|
748 | | - |
---|
749 | | - ret = kstrtou32(data, 10, &value); |
---|
750 | | - if (ret == 0 && value) { |
---|
751 | | - enum nl80211_band band = (cmd->channel_num <= 14) ? |
---|
752 | | - NL80211_BAND_2GHZ : |
---|
753 | | - NL80211_BAND_5GHZ; |
---|
754 | | - struct ieee80211_channel chn = { |
---|
755 | | - .band = band, |
---|
756 | | - .center_freq = ieee80211_channel_to_frequency( |
---|
757 | | - cmd->channel_num, band), |
---|
758 | | - }; |
---|
759 | | - struct cfg80211_chan_def chandef = { |
---|
760 | | - .chan = &chn, |
---|
761 | | - .center_freq1 = |
---|
762 | | - ieee80211_channel_to_frequency(value, |
---|
763 | | - band), |
---|
764 | | - }; |
---|
765 | | - |
---|
766 | | - cmd->ctrl_ch_position = iwl_mvm_get_ctrl_pos(&chandef); |
---|
767 | | - } |
---|
768 | | - goto out; |
---|
769 | | - } |
---|
770 | | - |
---|
771 | | - data = iwl_dbgfs_is_match("ftm_per_burst=", buf); |
---|
772 | | - if (data) { |
---|
773 | | - ret = kstrtou32(data, 10, &value); |
---|
774 | | - if (ret == 0) |
---|
775 | | - mvm->tof_data.responder_cfg.ftm_per_burst = value; |
---|
776 | | - goto out; |
---|
777 | | - } |
---|
778 | | - |
---|
779 | | - data = iwl_dbgfs_is_match("ftm_resp_ts_avail=", buf); |
---|
780 | | - if (data) { |
---|
781 | | - ret = kstrtou32(data, 10, &value); |
---|
782 | | - if (ret == 0) |
---|
783 | | - mvm->tof_data.responder_cfg.ftm_resp_ts_avail = value; |
---|
784 | | - goto out; |
---|
785 | | - } |
---|
786 | | - |
---|
787 | | - data = iwl_dbgfs_is_match("asap_mode=", buf); |
---|
788 | | - if (data) { |
---|
789 | | - ret = kstrtou32(data, 10, &value); |
---|
790 | | - if (ret == 0) |
---|
791 | | - mvm->tof_data.responder_cfg.asap_mode = value; |
---|
792 | | - goto out; |
---|
793 | | - } |
---|
794 | | - |
---|
795 | | - data = iwl_dbgfs_is_match("send_responder_cfg=", buf); |
---|
796 | | - if (data) { |
---|
797 | | - ret = kstrtou32(data, 10, &value); |
---|
798 | | - if (ret == 0 && value) { |
---|
799 | | - ret = iwl_mvm_tof_responder_cmd(mvm, vif); |
---|
800 | | - goto out; |
---|
801 | | - } |
---|
802 | | - } |
---|
803 | | - |
---|
804 | | -out: |
---|
805 | | - mutex_unlock(&mvm->mutex); |
---|
806 | | - |
---|
807 | | - return ret ?: count; |
---|
808 | | -} |
---|
809 | | - |
---|
810 | | -static ssize_t iwl_dbgfs_tof_responder_params_read(struct file *file, |
---|
811 | | - char __user *user_buf, |
---|
812 | | - size_t count, loff_t *ppos) |
---|
813 | | -{ |
---|
814 | | - struct ieee80211_vif *vif = file->private_data; |
---|
815 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
816 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
817 | | - char buf[256]; |
---|
818 | | - int pos = 0; |
---|
819 | | - const size_t bufsz = sizeof(buf); |
---|
820 | | - struct iwl_tof_responder_config_cmd *cmd; |
---|
821 | | - |
---|
822 | | - cmd = &mvm->tof_data.responder_cfg; |
---|
823 | | - |
---|
824 | | - mutex_lock(&mvm->mutex); |
---|
825 | | - |
---|
826 | | - pos += scnprintf(buf + pos, bufsz - pos, "burst_period = %d\n", |
---|
827 | | - le16_to_cpu(cmd->burst_period)); |
---|
828 | | - pos += scnprintf(buf + pos, bufsz - pos, "burst_duration = %d\n", |
---|
829 | | - cmd->burst_duration); |
---|
830 | | - pos += scnprintf(buf + pos, bufsz - pos, "bandwidth = %d\n", |
---|
831 | | - cmd->bandwidth); |
---|
832 | | - pos += scnprintf(buf + pos, bufsz - pos, "channel_num = %d\n", |
---|
833 | | - cmd->channel_num); |
---|
834 | | - pos += scnprintf(buf + pos, bufsz - pos, "ctrl_ch_position = 0x%x\n", |
---|
835 | | - cmd->ctrl_ch_position); |
---|
836 | | - pos += scnprintf(buf + pos, bufsz - pos, "bssid = %pM\n", |
---|
837 | | - cmd->bssid); |
---|
838 | | - pos += scnprintf(buf + pos, bufsz - pos, "min_delta_ftm = %d\n", |
---|
839 | | - cmd->min_delta_ftm); |
---|
840 | | - pos += scnprintf(buf + pos, bufsz - pos, "num_of_burst_exp = %d\n", |
---|
841 | | - cmd->num_of_burst_exp); |
---|
842 | | - pos += scnprintf(buf + pos, bufsz - pos, "rate = %d\n", cmd->rate); |
---|
843 | | - pos += scnprintf(buf + pos, bufsz - pos, "abort_responder = %d\n", |
---|
844 | | - cmd->abort_responder); |
---|
845 | | - pos += scnprintf(buf + pos, bufsz - pos, "get_ch_est = %d\n", |
---|
846 | | - cmd->get_ch_est); |
---|
847 | | - pos += scnprintf(buf + pos, bufsz - pos, "recv_sta_req_params = %d\n", |
---|
848 | | - cmd->recv_sta_req_params); |
---|
849 | | - pos += scnprintf(buf + pos, bufsz - pos, "ftm_per_burst = %d\n", |
---|
850 | | - cmd->ftm_per_burst); |
---|
851 | | - pos += scnprintf(buf + pos, bufsz - pos, "ftm_resp_ts_avail = %d\n", |
---|
852 | | - cmd->ftm_resp_ts_avail); |
---|
853 | | - pos += scnprintf(buf + pos, bufsz - pos, "asap_mode = %d\n", |
---|
854 | | - cmd->asap_mode); |
---|
855 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
856 | | - "tsf_timer_offset_msecs = %d\n", |
---|
857 | | - le16_to_cpu(cmd->tsf_timer_offset_msecs)); |
---|
858 | | - pos += scnprintf(buf + pos, bufsz - pos, "toa_offset = %d\n", |
---|
859 | | - le16_to_cpu(cmd->toa_offset)); |
---|
860 | | - |
---|
861 | | - mutex_unlock(&mvm->mutex); |
---|
862 | | - |
---|
863 | | - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
864 | | -} |
---|
865 | | - |
---|
866 | | -static ssize_t iwl_dbgfs_tof_range_request_write(struct ieee80211_vif *vif, |
---|
867 | | - char *buf, size_t count, |
---|
868 | | - loff_t *ppos) |
---|
869 | | -{ |
---|
870 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
871 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
872 | | - u32 value; |
---|
873 | | - int ret = 0; |
---|
874 | | - char *data; |
---|
875 | | - |
---|
876 | | - mutex_lock(&mvm->mutex); |
---|
877 | | - |
---|
878 | | - data = iwl_dbgfs_is_match("request_id=", buf); |
---|
879 | | - if (data) { |
---|
880 | | - ret = kstrtou32(data, 10, &value); |
---|
881 | | - if (ret == 0) |
---|
882 | | - mvm->tof_data.range_req.request_id = value; |
---|
883 | | - goto out; |
---|
884 | | - } |
---|
885 | | - |
---|
886 | | - data = iwl_dbgfs_is_match("initiator=", buf); |
---|
887 | | - if (data) { |
---|
888 | | - ret = kstrtou32(data, 10, &value); |
---|
889 | | - if (ret == 0) |
---|
890 | | - mvm->tof_data.range_req.initiator = value; |
---|
891 | | - goto out; |
---|
892 | | - } |
---|
893 | | - |
---|
894 | | - data = iwl_dbgfs_is_match("one_sided_los_disable=", buf); |
---|
895 | | - if (data) { |
---|
896 | | - ret = kstrtou32(data, 10, &value); |
---|
897 | | - if (ret == 0) |
---|
898 | | - mvm->tof_data.range_req.one_sided_los_disable = value; |
---|
899 | | - goto out; |
---|
900 | | - } |
---|
901 | | - |
---|
902 | | - data = iwl_dbgfs_is_match("req_timeout=", buf); |
---|
903 | | - if (data) { |
---|
904 | | - ret = kstrtou32(data, 10, &value); |
---|
905 | | - if (ret == 0) |
---|
906 | | - mvm->tof_data.range_req.req_timeout = value; |
---|
907 | | - goto out; |
---|
908 | | - } |
---|
909 | | - |
---|
910 | | - data = iwl_dbgfs_is_match("report_policy=", buf); |
---|
911 | | - if (data) { |
---|
912 | | - ret = kstrtou32(data, 10, &value); |
---|
913 | | - if (ret == 0) |
---|
914 | | - mvm->tof_data.range_req.report_policy = value; |
---|
915 | | - goto out; |
---|
916 | | - } |
---|
917 | | - |
---|
918 | | - data = iwl_dbgfs_is_match("macaddr_random=", buf); |
---|
919 | | - if (data) { |
---|
920 | | - ret = kstrtou32(data, 10, &value); |
---|
921 | | - if (ret == 0) |
---|
922 | | - mvm->tof_data.range_req.macaddr_random = value; |
---|
923 | | - goto out; |
---|
924 | | - } |
---|
925 | | - |
---|
926 | | - data = iwl_dbgfs_is_match("num_of_ap=", buf); |
---|
927 | | - if (data) { |
---|
928 | | - ret = kstrtou32(data, 10, &value); |
---|
929 | | - if (ret == 0) |
---|
930 | | - mvm->tof_data.range_req.num_of_ap = value; |
---|
931 | | - goto out; |
---|
932 | | - } |
---|
933 | | - |
---|
934 | | - data = iwl_dbgfs_is_match("macaddr_template=", buf); |
---|
935 | | - if (data) { |
---|
936 | | - u8 mac[ETH_ALEN]; |
---|
937 | | - |
---|
938 | | - if (!mac_pton(data, mac)) { |
---|
939 | | - ret = -EINVAL; |
---|
940 | | - goto out; |
---|
941 | | - } |
---|
942 | | - memcpy(mvm->tof_data.range_req.macaddr_template, mac, ETH_ALEN); |
---|
943 | | - goto out; |
---|
944 | | - } |
---|
945 | | - |
---|
946 | | - data = iwl_dbgfs_is_match("macaddr_mask=", buf); |
---|
947 | | - if (data) { |
---|
948 | | - u8 mac[ETH_ALEN]; |
---|
949 | | - |
---|
950 | | - if (!mac_pton(data, mac)) { |
---|
951 | | - ret = -EINVAL; |
---|
952 | | - goto out; |
---|
953 | | - } |
---|
954 | | - memcpy(mvm->tof_data.range_req.macaddr_mask, mac, ETH_ALEN); |
---|
955 | | - goto out; |
---|
956 | | - } |
---|
957 | | - |
---|
958 | | - data = iwl_dbgfs_is_match("ap=", buf); |
---|
959 | | - if (data) { |
---|
960 | | - struct iwl_tof_range_req_ap_entry ap = {}; |
---|
961 | | - int size = sizeof(struct iwl_tof_range_req_ap_entry); |
---|
962 | | - u16 burst_period; |
---|
963 | | - u8 *mac = ap.bssid; |
---|
964 | | - unsigned int i; |
---|
965 | | - |
---|
966 | | - if (sscanf(data, "%u %hhd %hhd %hhd" |
---|
967 | | - "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" |
---|
968 | | - "%hhd %hhd %hd" |
---|
969 | | - "%hhd %hhd %d" |
---|
970 | | - "%hhx %hhd %hhd %hhd", |
---|
971 | | - &i, &ap.channel_num, &ap.bandwidth, |
---|
972 | | - &ap.ctrl_ch_position, |
---|
973 | | - mac, mac + 1, mac + 2, mac + 3, mac + 4, mac + 5, |
---|
974 | | - &ap.measure_type, &ap.num_of_bursts, |
---|
975 | | - &burst_period, |
---|
976 | | - &ap.samples_per_burst, &ap.retries_per_sample, |
---|
977 | | - &ap.tsf_delta, &ap.location_req, &ap.asap_mode, |
---|
978 | | - &ap.enable_dyn_ack, &ap.rssi) != 20) { |
---|
979 | | - ret = -EINVAL; |
---|
980 | | - goto out; |
---|
981 | | - } |
---|
982 | | - if (i >= IWL_MVM_TOF_MAX_APS) { |
---|
983 | | - IWL_ERR(mvm, "Invalid AP index %d\n", i); |
---|
984 | | - ret = -EINVAL; |
---|
985 | | - goto out; |
---|
986 | | - } |
---|
987 | | - |
---|
988 | | - ap.burst_period = cpu_to_le16(burst_period); |
---|
989 | | - |
---|
990 | | - memcpy(&mvm->tof_data.range_req.ap[i], &ap, size); |
---|
991 | | - goto out; |
---|
992 | | - } |
---|
993 | | - |
---|
994 | | - data = iwl_dbgfs_is_match("send_range_request=", buf); |
---|
995 | | - if (data) { |
---|
996 | | - ret = kstrtou32(data, 10, &value); |
---|
997 | | - if (ret == 0 && value) |
---|
998 | | - ret = iwl_mvm_tof_range_request_cmd(mvm, vif); |
---|
999 | | - goto out; |
---|
1000 | | - } |
---|
1001 | | - |
---|
1002 | | - ret = -EINVAL; |
---|
1003 | | -out: |
---|
1004 | | - mutex_unlock(&mvm->mutex); |
---|
1005 | | - return ret ?: count; |
---|
1006 | | -} |
---|
1007 | | - |
---|
1008 | | -static ssize_t iwl_dbgfs_tof_range_request_read(struct file *file, |
---|
1009 | | - char __user *user_buf, |
---|
1010 | | - size_t count, loff_t *ppos) |
---|
1011 | | -{ |
---|
1012 | | - struct ieee80211_vif *vif = file->private_data; |
---|
1013 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1014 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1015 | | - char buf[512]; |
---|
1016 | | - int pos = 0; |
---|
1017 | | - const size_t bufsz = sizeof(buf); |
---|
1018 | | - struct iwl_tof_range_req_cmd *cmd; |
---|
1019 | | - int i; |
---|
1020 | | - |
---|
1021 | | - cmd = &mvm->tof_data.range_req; |
---|
1022 | | - |
---|
1023 | | - mutex_lock(&mvm->mutex); |
---|
1024 | | - |
---|
1025 | | - pos += scnprintf(buf + pos, bufsz - pos, "request_id= %d\n", |
---|
1026 | | - cmd->request_id); |
---|
1027 | | - pos += scnprintf(buf + pos, bufsz - pos, "initiator= %d\n", |
---|
1028 | | - cmd->initiator); |
---|
1029 | | - pos += scnprintf(buf + pos, bufsz - pos, "one_sided_los_disable = %d\n", |
---|
1030 | | - cmd->one_sided_los_disable); |
---|
1031 | | - pos += scnprintf(buf + pos, bufsz - pos, "req_timeout= %d\n", |
---|
1032 | | - cmd->req_timeout); |
---|
1033 | | - pos += scnprintf(buf + pos, bufsz - pos, "report_policy= %d\n", |
---|
1034 | | - cmd->report_policy); |
---|
1035 | | - pos += scnprintf(buf + pos, bufsz - pos, "macaddr_random= %d\n", |
---|
1036 | | - cmd->macaddr_random); |
---|
1037 | | - pos += scnprintf(buf + pos, bufsz - pos, "macaddr_template= %pM\n", |
---|
1038 | | - cmd->macaddr_template); |
---|
1039 | | - pos += scnprintf(buf + pos, bufsz - pos, "macaddr_mask= %pM\n", |
---|
1040 | | - cmd->macaddr_mask); |
---|
1041 | | - pos += scnprintf(buf + pos, bufsz - pos, "num_of_ap= %d\n", |
---|
1042 | | - cmd->num_of_ap); |
---|
1043 | | - for (i = 0; i < cmd->num_of_ap; i++) { |
---|
1044 | | - struct iwl_tof_range_req_ap_entry *ap = &cmd->ap[i]; |
---|
1045 | | - |
---|
1046 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1047 | | - "ap %.2d: channel_num=%hhd bw=%hhd" |
---|
1048 | | - " control=%hhd bssid=%pM type=%hhd" |
---|
1049 | | - " num_of_bursts=%hhd burst_period=%hd ftm=%hhd" |
---|
1050 | | - " retries=%hhd tsf_delta=%d" |
---|
1051 | | - " tsf_delta_direction=%hhd location_req=0x%hhx " |
---|
1052 | | - " asap=%hhd enable=%hhd rssi=%hhd\n", |
---|
1053 | | - i, ap->channel_num, ap->bandwidth, |
---|
1054 | | - ap->ctrl_ch_position, ap->bssid, |
---|
1055 | | - ap->measure_type, ap->num_of_bursts, |
---|
1056 | | - ap->burst_period, ap->samples_per_burst, |
---|
1057 | | - ap->retries_per_sample, ap->tsf_delta, |
---|
1058 | | - ap->tsf_delta_direction, |
---|
1059 | | - ap->location_req, ap->asap_mode, |
---|
1060 | | - ap->enable_dyn_ack, ap->rssi); |
---|
1061 | | - } |
---|
1062 | | - |
---|
1063 | | - mutex_unlock(&mvm->mutex); |
---|
1064 | | - |
---|
1065 | | - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
1066 | | -} |
---|
1067 | | - |
---|
1068 | | -static ssize_t iwl_dbgfs_tof_range_req_ext_write(struct ieee80211_vif *vif, |
---|
1069 | | - char *buf, |
---|
1070 | | - size_t count, loff_t *ppos) |
---|
1071 | | -{ |
---|
1072 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1073 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1074 | | - u32 value; |
---|
1075 | | - int ret = 0; |
---|
1076 | | - char *data; |
---|
1077 | | - |
---|
1078 | | - mutex_lock(&mvm->mutex); |
---|
1079 | | - |
---|
1080 | | - data = iwl_dbgfs_is_match("tsf_timer_offset_msec=", buf); |
---|
1081 | | - if (data) { |
---|
1082 | | - ret = kstrtou32(data, 10, &value); |
---|
1083 | | - if (ret == 0) |
---|
1084 | | - mvm->tof_data.range_req_ext.tsf_timer_offset_msec = |
---|
1085 | | - cpu_to_le16(value); |
---|
1086 | | - goto out; |
---|
1087 | | - } |
---|
1088 | | - |
---|
1089 | | - data = iwl_dbgfs_is_match("min_delta_ftm=", buf); |
---|
1090 | | - if (data) { |
---|
1091 | | - ret = kstrtou32(data, 10, &value); |
---|
1092 | | - if (ret == 0) |
---|
1093 | | - mvm->tof_data.range_req_ext.min_delta_ftm = value; |
---|
1094 | | - goto out; |
---|
1095 | | - } |
---|
1096 | | - |
---|
1097 | | - data = iwl_dbgfs_is_match("ftm_format_and_bw20M=", buf); |
---|
1098 | | - if (data) { |
---|
1099 | | - ret = kstrtou32(data, 10, &value); |
---|
1100 | | - if (ret == 0) |
---|
1101 | | - mvm->tof_data.range_req_ext.ftm_format_and_bw20M = |
---|
1102 | | - value; |
---|
1103 | | - goto out; |
---|
1104 | | - } |
---|
1105 | | - |
---|
1106 | | - data = iwl_dbgfs_is_match("ftm_format_and_bw40M=", buf); |
---|
1107 | | - if (data) { |
---|
1108 | | - ret = kstrtou32(data, 10, &value); |
---|
1109 | | - if (ret == 0) |
---|
1110 | | - mvm->tof_data.range_req_ext.ftm_format_and_bw40M = |
---|
1111 | | - value; |
---|
1112 | | - goto out; |
---|
1113 | | - } |
---|
1114 | | - |
---|
1115 | | - data = iwl_dbgfs_is_match("ftm_format_and_bw80M=", buf); |
---|
1116 | | - if (data) { |
---|
1117 | | - ret = kstrtou32(data, 10, &value); |
---|
1118 | | - if (ret == 0) |
---|
1119 | | - mvm->tof_data.range_req_ext.ftm_format_and_bw80M = |
---|
1120 | | - value; |
---|
1121 | | - goto out; |
---|
1122 | | - } |
---|
1123 | | - |
---|
1124 | | - data = iwl_dbgfs_is_match("send_range_req_ext=", buf); |
---|
1125 | | - if (data) { |
---|
1126 | | - ret = kstrtou32(data, 10, &value); |
---|
1127 | | - if (ret == 0 && value) |
---|
1128 | | - ret = iwl_mvm_tof_range_request_ext_cmd(mvm, vif); |
---|
1129 | | - goto out; |
---|
1130 | | - } |
---|
1131 | | - |
---|
1132 | | - ret = -EINVAL; |
---|
1133 | | -out: |
---|
1134 | | - mutex_unlock(&mvm->mutex); |
---|
1135 | | - return ret ?: count; |
---|
1136 | | -} |
---|
1137 | | - |
---|
1138 | | -static ssize_t iwl_dbgfs_tof_range_req_ext_read(struct file *file, |
---|
1139 | | - char __user *user_buf, |
---|
1140 | | - size_t count, loff_t *ppos) |
---|
1141 | | -{ |
---|
1142 | | - struct ieee80211_vif *vif = file->private_data; |
---|
1143 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1144 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1145 | | - char buf[256]; |
---|
1146 | | - int pos = 0; |
---|
1147 | | - const size_t bufsz = sizeof(buf); |
---|
1148 | | - struct iwl_tof_range_req_ext_cmd *cmd; |
---|
1149 | | - |
---|
1150 | | - cmd = &mvm->tof_data.range_req_ext; |
---|
1151 | | - |
---|
1152 | | - mutex_lock(&mvm->mutex); |
---|
1153 | | - |
---|
1154 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1155 | | - "tsf_timer_offset_msec = %hd\n", |
---|
1156 | | - cmd->tsf_timer_offset_msec); |
---|
1157 | | - pos += scnprintf(buf + pos, bufsz - pos, "min_delta_ftm = %hhd\n", |
---|
1158 | | - cmd->min_delta_ftm); |
---|
1159 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1160 | | - "ftm_format_and_bw20M = %hhd\n", |
---|
1161 | | - cmd->ftm_format_and_bw20M); |
---|
1162 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1163 | | - "ftm_format_and_bw40M = %hhd\n", |
---|
1164 | | - cmd->ftm_format_and_bw40M); |
---|
1165 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1166 | | - "ftm_format_and_bw80M = %hhd\n", |
---|
1167 | | - cmd->ftm_format_and_bw80M); |
---|
1168 | | - |
---|
1169 | | - mutex_unlock(&mvm->mutex); |
---|
1170 | | - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
1171 | | -} |
---|
1172 | | - |
---|
1173 | | -static ssize_t iwl_dbgfs_tof_range_abort_write(struct ieee80211_vif *vif, |
---|
1174 | | - char *buf, |
---|
1175 | | - size_t count, loff_t *ppos) |
---|
1176 | | -{ |
---|
1177 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1178 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1179 | | - u32 value; |
---|
1180 | | - int abort_id, ret = 0; |
---|
1181 | | - char *data; |
---|
1182 | | - |
---|
1183 | | - mutex_lock(&mvm->mutex); |
---|
1184 | | - |
---|
1185 | | - data = iwl_dbgfs_is_match("abort_id=", buf); |
---|
1186 | | - if (data) { |
---|
1187 | | - ret = kstrtou32(data, 10, &value); |
---|
1188 | | - if (ret == 0) |
---|
1189 | | - mvm->tof_data.last_abort_id = value; |
---|
1190 | | - goto out; |
---|
1191 | | - } |
---|
1192 | | - |
---|
1193 | | - data = iwl_dbgfs_is_match("send_range_abort=", buf); |
---|
1194 | | - if (data) { |
---|
1195 | | - ret = kstrtou32(data, 10, &value); |
---|
1196 | | - if (ret == 0 && value) { |
---|
1197 | | - abort_id = mvm->tof_data.last_abort_id; |
---|
1198 | | - ret = iwl_mvm_tof_range_abort_cmd(mvm, abort_id); |
---|
1199 | | - goto out; |
---|
1200 | | - } |
---|
1201 | | - } |
---|
1202 | | - |
---|
1203 | | -out: |
---|
1204 | | - mutex_unlock(&mvm->mutex); |
---|
1205 | | - return ret ?: count; |
---|
1206 | | -} |
---|
1207 | | - |
---|
1208 | | -static ssize_t iwl_dbgfs_tof_range_abort_read(struct file *file, |
---|
1209 | | - char __user *user_buf, |
---|
1210 | | - size_t count, loff_t *ppos) |
---|
1211 | | -{ |
---|
1212 | | - struct ieee80211_vif *vif = file->private_data; |
---|
1213 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1214 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1215 | | - char buf[32]; |
---|
1216 | | - int pos = 0; |
---|
1217 | | - const size_t bufsz = sizeof(buf); |
---|
1218 | | - int last_abort_id; |
---|
1219 | | - |
---|
1220 | | - mutex_lock(&mvm->mutex); |
---|
1221 | | - last_abort_id = mvm->tof_data.last_abort_id; |
---|
1222 | | - mutex_unlock(&mvm->mutex); |
---|
1223 | | - |
---|
1224 | | - pos += scnprintf(buf + pos, bufsz - pos, "last_abort_id = %d\n", |
---|
1225 | | - last_abort_id); |
---|
1226 | | - return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
1227 | | -} |
---|
1228 | | - |
---|
1229 | | -static ssize_t iwl_dbgfs_tof_range_response_read(struct file *file, |
---|
1230 | | - char __user *user_buf, |
---|
1231 | | - size_t count, loff_t *ppos) |
---|
1232 | | -{ |
---|
1233 | | - struct ieee80211_vif *vif = file->private_data; |
---|
1234 | | - struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1235 | | - struct iwl_mvm *mvm = mvmvif->mvm; |
---|
1236 | | - char *buf; |
---|
1237 | | - int pos = 0; |
---|
1238 | | - const size_t bufsz = sizeof(struct iwl_tof_range_rsp_ntfy) + 256; |
---|
1239 | | - struct iwl_tof_range_rsp_ntfy *cmd; |
---|
1240 | | - int i, ret; |
---|
1241 | | - |
---|
1242 | | - buf = kzalloc(bufsz, GFP_KERNEL); |
---|
1243 | | - if (!buf) |
---|
1244 | | - return -ENOMEM; |
---|
1245 | | - |
---|
1246 | | - mutex_lock(&mvm->mutex); |
---|
1247 | | - cmd = &mvm->tof_data.range_resp; |
---|
1248 | | - |
---|
1249 | | - pos += scnprintf(buf + pos, bufsz - pos, "request_id = %d\n", |
---|
1250 | | - cmd->request_id); |
---|
1251 | | - pos += scnprintf(buf + pos, bufsz - pos, "status = %d\n", |
---|
1252 | | - cmd->request_status); |
---|
1253 | | - pos += scnprintf(buf + pos, bufsz - pos, "last_in_batch = %d\n", |
---|
1254 | | - cmd->last_in_batch); |
---|
1255 | | - pos += scnprintf(buf + pos, bufsz - pos, "num_of_aps = %d\n", |
---|
1256 | | - cmd->num_of_aps); |
---|
1257 | | - for (i = 0; i < cmd->num_of_aps; i++) { |
---|
1258 | | - struct iwl_tof_range_rsp_ap_entry_ntfy *ap = &cmd->ap[i]; |
---|
1259 | | - |
---|
1260 | | - pos += scnprintf(buf + pos, bufsz - pos, |
---|
1261 | | - "ap %.2d: bssid=%pM status=%hhd bw=%hhd" |
---|
1262 | | - " rtt=%d rtt_var=%d rtt_spread=%d" |
---|
1263 | | - " rssi=%hhd rssi_spread=%hhd" |
---|
1264 | | - " range=%d range_var=%d" |
---|
1265 | | - " time_stamp=%d\n", |
---|
1266 | | - i, ap->bssid, ap->measure_status, |
---|
1267 | | - ap->measure_bw, |
---|
1268 | | - ap->rtt, ap->rtt_variance, ap->rtt_spread, |
---|
1269 | | - ap->rssi, ap->rssi_spread, ap->range, |
---|
1270 | | - ap->range_variance, ap->timestamp); |
---|
1271 | | - } |
---|
1272 | | - mutex_unlock(&mvm->mutex); |
---|
1273 | | - |
---|
1274 | | - ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
---|
1275 | | - kfree(buf); |
---|
1276 | | - return ret; |
---|
1277 | | -} |
---|
1278 | | - |
---|
1279 | 528 | static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf, |
---|
1280 | 529 | size_t count, loff_t *ppos) |
---|
1281 | 530 | { |
---|
.. | .. |
---|
1297 | 546 | return count; |
---|
1298 | 547 | } |
---|
1299 | 548 | |
---|
| 549 | +static ssize_t |
---|
| 550 | +iwl_dbgfs_low_latency_force_write(struct ieee80211_vif *vif, char *buf, |
---|
| 551 | + size_t count, loff_t *ppos) |
---|
| 552 | +{ |
---|
| 553 | + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
| 554 | + struct iwl_mvm *mvm = mvmvif->mvm; |
---|
| 555 | + u8 value; |
---|
| 556 | + int ret; |
---|
| 557 | + |
---|
| 558 | + ret = kstrtou8(buf, 0, &value); |
---|
| 559 | + if (ret) |
---|
| 560 | + return ret; |
---|
| 561 | + |
---|
| 562 | + if (value > NUM_LOW_LATENCY_FORCE) |
---|
| 563 | + return -EINVAL; |
---|
| 564 | + |
---|
| 565 | + mutex_lock(&mvm->mutex); |
---|
| 566 | + if (value == LOW_LATENCY_FORCE_UNSET) { |
---|
| 567 | + iwl_mvm_update_low_latency(mvm, vif, false, |
---|
| 568 | + LOW_LATENCY_DEBUGFS_FORCE); |
---|
| 569 | + iwl_mvm_update_low_latency(mvm, vif, false, |
---|
| 570 | + LOW_LATENCY_DEBUGFS_FORCE_ENABLE); |
---|
| 571 | + } else { |
---|
| 572 | + iwl_mvm_update_low_latency(mvm, vif, |
---|
| 573 | + value == LOW_LATENCY_FORCE_ON, |
---|
| 574 | + LOW_LATENCY_DEBUGFS_FORCE); |
---|
| 575 | + iwl_mvm_update_low_latency(mvm, vif, true, |
---|
| 576 | + LOW_LATENCY_DEBUGFS_FORCE_ENABLE); |
---|
| 577 | + } |
---|
| 578 | + mutex_unlock(&mvm->mutex); |
---|
| 579 | + return count; |
---|
| 580 | +} |
---|
| 581 | + |
---|
1300 | 582 | static ssize_t iwl_dbgfs_low_latency_read(struct file *file, |
---|
1301 | 583 | char __user *user_buf, |
---|
1302 | 584 | size_t count, loff_t *ppos) |
---|
1303 | 585 | { |
---|
1304 | 586 | struct ieee80211_vif *vif = file->private_data; |
---|
1305 | 587 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
---|
1306 | | - char buf[30] = {}; |
---|
| 588 | + char format[] = "traffic=%d\ndbgfs=%d\nvcmd=%d\nvif_type=%d\n" |
---|
| 589 | + "dbgfs_force_enable=%d\ndbgfs_force=%d\nactual=%d\n"; |
---|
| 590 | + |
---|
| 591 | + /* |
---|
| 592 | + * all values in format are boolean so the size of format is enough |
---|
| 593 | + * for holding the result string |
---|
| 594 | + */ |
---|
| 595 | + char buf[sizeof(format) + 1] = {}; |
---|
1307 | 596 | int len; |
---|
1308 | 597 | |
---|
1309 | | - len = scnprintf(buf, sizeof(buf) - 1, |
---|
1310 | | - "traffic=%d\ndbgfs=%d\nvcmd=%d\n", |
---|
| 598 | + len = scnprintf(buf, sizeof(buf) - 1, format, |
---|
1311 | 599 | !!(mvmvif->low_latency & LOW_LATENCY_TRAFFIC), |
---|
1312 | 600 | !!(mvmvif->low_latency & LOW_LATENCY_DEBUGFS), |
---|
1313 | | - !!(mvmvif->low_latency & LOW_LATENCY_VCMD)); |
---|
| 601 | + !!(mvmvif->low_latency & LOW_LATENCY_VCMD), |
---|
| 602 | + !!(mvmvif->low_latency & LOW_LATENCY_VIF_TYPE), |
---|
| 603 | + !!(mvmvif->low_latency & |
---|
| 604 | + LOW_LATENCY_DEBUGFS_FORCE_ENABLE), |
---|
| 605 | + !!(mvmvif->low_latency & LOW_LATENCY_DEBUGFS_FORCE), |
---|
| 606 | + !!(mvmvif->low_latency_actual)); |
---|
1314 | 607 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
---|
1315 | 608 | } |
---|
1316 | 609 | |
---|
.. | .. |
---|
1448 | 741 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
---|
1449 | 742 | } |
---|
1450 | 743 | |
---|
1451 | | -static const char * const chanwidths[] = { |
---|
1452 | | - [NL80211_CHAN_WIDTH_20_NOHT] = "noht", |
---|
1453 | | - [NL80211_CHAN_WIDTH_20] = "ht20", |
---|
1454 | | - [NL80211_CHAN_WIDTH_40] = "ht40", |
---|
1455 | | - [NL80211_CHAN_WIDTH_80] = "vht80", |
---|
1456 | | - [NL80211_CHAN_WIDTH_80P80] = "vht80p80", |
---|
1457 | | - [NL80211_CHAN_WIDTH_160] = "vht160", |
---|
1458 | | -}; |
---|
1459 | | - |
---|
1460 | 744 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
---|
1461 | 745 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
---|
1462 | 746 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
---|
1463 | 747 | _MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
---|
1464 | 748 | #define MVM_DEBUGFS_ADD_FILE_VIF(name, parent, mode) do { \ |
---|
1465 | | - if (!debugfs_create_file(#name, mode, parent, vif, \ |
---|
1466 | | - &iwl_dbgfs_##name##_ops)) \ |
---|
1467 | | - goto err; \ |
---|
| 749 | + debugfs_create_file(#name, mode, parent, vif, \ |
---|
| 750 | + &iwl_dbgfs_##name##_ops); \ |
---|
1468 | 751 | } while (0) |
---|
1469 | 752 | |
---|
1470 | 753 | MVM_DEBUGFS_READ_FILE_OPS(mac_params); |
---|
.. | .. |
---|
1472 | 755 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); |
---|
1473 | 756 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); |
---|
1474 | 757 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); |
---|
| 758 | +MVM_DEBUGFS_WRITE_FILE_OPS(low_latency_force, 10); |
---|
1475 | 759 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(uapsd_misbehaving, 20); |
---|
1476 | 760 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10); |
---|
1477 | | -MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_enable, 32); |
---|
1478 | | -MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_request, 512); |
---|
1479 | | -MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_req_ext, 32); |
---|
1480 | | -MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_abort, 32); |
---|
1481 | | -MVM_DEBUGFS_READ_FILE_OPS(tof_range_response); |
---|
1482 | | -MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32); |
---|
1483 | 761 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); |
---|
1484 | 762 | MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff); |
---|
1485 | 763 | |
---|
.. | .. |
---|
1498 | 776 | return; |
---|
1499 | 777 | |
---|
1500 | 778 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); |
---|
1501 | | - |
---|
1502 | | - if (!mvmvif->dbgfs_dir) { |
---|
| 779 | + if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) { |
---|
1503 | 780 | IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n", |
---|
1504 | 781 | dbgfs_dir); |
---|
1505 | 782 | return; |
---|
.. | .. |
---|
1513 | 790 | MVM_DEBUGFS_ADD_FILE_VIF(tx_pwr_lmt, mvmvif->dbgfs_dir, 0400); |
---|
1514 | 791 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, 0400); |
---|
1515 | 792 | MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir, 0600); |
---|
| 793 | + MVM_DEBUGFS_ADD_FILE_VIF(low_latency_force, mvmvif->dbgfs_dir, 0600); |
---|
1516 | 794 | MVM_DEBUGFS_ADD_FILE_VIF(uapsd_misbehaving, mvmvif->dbgfs_dir, 0600); |
---|
1517 | 795 | MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, 0600); |
---|
1518 | 796 | MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir, 0600); |
---|
.. | .. |
---|
1521 | 799 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
---|
1522 | 800 | mvmvif == mvm->bf_allowed_vif) |
---|
1523 | 801 | MVM_DEBUGFS_ADD_FILE_VIF(bf_params, mvmvif->dbgfs_dir, 0600); |
---|
1524 | | - |
---|
1525 | | - if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_TOF_SUPPORT) && |
---|
1526 | | - !vif->p2p && (vif->type != NL80211_IFTYPE_P2P_DEVICE)) { |
---|
1527 | | - if (IWL_MVM_TOF_IS_RESPONDER && vif->type == NL80211_IFTYPE_AP) |
---|
1528 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_responder_params, |
---|
1529 | | - mvmvif->dbgfs_dir, 0600); |
---|
1530 | | - |
---|
1531 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_range_request, mvmvif->dbgfs_dir, |
---|
1532 | | - 0600); |
---|
1533 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_range_req_ext, mvmvif->dbgfs_dir, |
---|
1534 | | - 0600); |
---|
1535 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_enable, mvmvif->dbgfs_dir, |
---|
1536 | | - 0600); |
---|
1537 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_range_abort, mvmvif->dbgfs_dir, |
---|
1538 | | - 0600); |
---|
1539 | | - MVM_DEBUGFS_ADD_FILE_VIF(tof_range_response, mvmvif->dbgfs_dir, |
---|
1540 | | - 0400); |
---|
1541 | | - } |
---|
1542 | 802 | |
---|
1543 | 803 | /* |
---|
1544 | 804 | * Create symlink for convenience pointing to interface specific |
---|
.. | .. |
---|
1553 | 813 | |
---|
1554 | 814 | mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, |
---|
1555 | 815 | mvm->debugfs_dir, buf); |
---|
1556 | | - if (!mvmvif->dbgfs_slink) |
---|
1557 | | - IWL_ERR(mvm, "Can't create debugfs symbolic link under %pd\n", |
---|
1558 | | - dbgfs_dir); |
---|
1559 | | - return; |
---|
1560 | | -err: |
---|
1561 | | - IWL_ERR(mvm, "Can't create debugfs entity\n"); |
---|
1562 | 816 | } |
---|
1563 | 817 | |
---|
1564 | 818 | void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
---|