Lines Matching +full:d +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2020-2023 Intel Corporation
23 #include "driver-ops.h"
36 struct ieee80211_if_read_sdata_data *d = data; in ieee80211_if_read_sdata_handler() local
38 return d->format(d->sdata, buf, bufsize); in ieee80211_if_read_sdata_handler()
47 struct ieee80211_sub_if_data *sdata = file->private_data; in ieee80211_if_read_sdata()
54 return wiphy_locked_debugfs_read(sdata->local->hw.wiphy, in ieee80211_if_read_sdata()
72 struct ieee80211_if_write_sdata_data *d = data; in ieee80211_if_write_sdata_handler() local
74 return d->write(d->sdata, buf, count); in ieee80211_if_write_sdata_handler()
83 struct ieee80211_sub_if_data *sdata = file->private_data; in ieee80211_if_write_sdata()
90 return wiphy_locked_debugfs_write(sdata->local->hw.wiphy, in ieee80211_if_write_sdata()
99 struct ieee80211_link_data *link; member
108 struct ieee80211_if_read_link_data *d = data; in ieee80211_if_read_link_handler() local
110 return d->format(d->link, buf, bufsize); in ieee80211_if_read_link_handler()
117 ssize_t (*format)(const struct ieee80211_link_data *link, char *, int)) in ieee80211_if_read_link() argument
119 struct ieee80211_link_data *link = file->private_data; in ieee80211_if_read_link() local
122 .link = link, in ieee80211_if_read_link()
126 return wiphy_locked_debugfs_read(link->sdata->local->hw.wiphy, in ieee80211_if_read_link()
135 struct ieee80211_link_data *link; member
144 struct ieee80211_if_write_sdata_data *d = data; in ieee80211_if_write_link_handler() local
146 return d->write(d->sdata, buf, count); in ieee80211_if_write_link_handler()
153 ssize_t (*write)(struct ieee80211_link_data *link, const char *, int)) in ieee80211_if_write_link() argument
155 struct ieee80211_link_data *link = file->private_data; in ieee80211_if_write_link() local
158 .link = link, in ieee80211_if_write_link()
162 return wiphy_locked_debugfs_write(link->sdata->local->hw.wiphy, in ieee80211_if_write_link()
174 return scnprintf(buf, buflen, format_string, data->field); \
177 IEEE80211_IF_FMT(name, type, field, "%d\n")
190 for (i = 0; i < sizeof(data->field); i++) { \
191 p += scnprintf(p, buflen + buf - p, "%.2x ", \
192 data->field[i]); \
194 p += scnprintf(p, buflen + buf - p, "\n"); \
195 return p - buf; \
203 return scnprintf(buf, buflen, "%d\n", atomic_read(&data->field));\
211 return scnprintf(buf, buflen, "%pM\n", data->field); \
219 return scnprintf(buf, buflen, "%d\n", \
220 jiffies_to_msecs(data->field)); \
322 const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_2GHZ]; in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz()
325 len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]); in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz()
326 len += scnprintf(buf + len, buflen - len, "\n"); in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_2ghz()
338 const u16 *mask = sdata->rc_rateidx_vht_mcs_mask[NL80211_BAND_5GHZ]; in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz()
341 len += scnprintf(buf + len, buflen - len, "%04x ", mask[i]); in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz()
342 len += scnprintf(buf + len, buflen - len, "\n"); in ieee80211_if_fmt_rc_rateidx_vht_mcs_mask_5ghz()
351 IEEE80211_IF_LINK_FILE(txpower, conf->txpower, DEC);
361 len = scnprintf(buf, buflen, "AC queues: VO:%d VI:%d BE:%d BK:%d\n", in ieee80211_if_fmt_hw_queues()
362 sdata->vif.hw_queue[IEEE80211_AC_VO], in ieee80211_if_fmt_hw_queues()
363 sdata->vif.hw_queue[IEEE80211_AC_VI], in ieee80211_if_fmt_hw_queues()
364 sdata->vif.hw_queue[IEEE80211_AC_BE], in ieee80211_if_fmt_hw_queues()
365 sdata->vif.hw_queue[IEEE80211_AC_BK]); in ieee80211_if_fmt_hw_queues()
367 if (sdata->vif.type == NL80211_IFTYPE_AP) in ieee80211_if_fmt_hw_queues()
368 len += scnprintf(buf + len, buflen - len, "cab queue: %d\n", in ieee80211_if_fmt_hw_queues()
369 sdata->vif.cab_queue); in ieee80211_if_fmt_hw_queues()
380 static int ieee80211_set_smps(struct ieee80211_link_data *link, in ieee80211_set_smps() argument
383 struct ieee80211_sub_if_data *sdata = link->sdata; in ieee80211_set_smps()
384 struct ieee80211_local *local = sdata->local; in ieee80211_set_smps()
389 if (sdata->vif.driver_flags & IEEE80211_VIF_EML_ACTIVE) in ieee80211_set_smps()
390 return -EOPNOTSUPP; in ieee80211_set_smps()
392 if (!(local->hw.wiphy->features & NL80211_FEATURE_STATIC_SMPS) && in ieee80211_set_smps()
394 return -EINVAL; in ieee80211_set_smps()
397 if (!(local->hw.wiphy->features & NL80211_FEATURE_DYNAMIC_SMPS) && in ieee80211_set_smps()
400 return -EINVAL; in ieee80211_set_smps()
402 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_set_smps()
403 return -EOPNOTSUPP; in ieee80211_set_smps()
405 return __ieee80211_request_smps_mgd(link->sdata, link, smps_mode); in ieee80211_set_smps()
415 static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_link_data *link, in ieee80211_if_fmt_smps() argument
418 if (link->sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_if_fmt_smps()
420 smps_modes[link->u.mgd.req_smps], in ieee80211_if_fmt_smps()
421 smps_modes[link->smps_mode]); in ieee80211_if_fmt_smps()
422 return -EINVAL; in ieee80211_if_fmt_smps()
425 static ssize_t ieee80211_if_parse_smps(struct ieee80211_link_data *link, in ieee80211_if_parse_smps() argument
432 int err = ieee80211_set_smps(link, mode); in ieee80211_if_parse_smps()
439 return -EINVAL; in ieee80211_if_parse_smps()
446 struct ieee80211_local *local = sdata->local; in ieee80211_if_parse_tkip_mic_test()
453 return -EINVAL; in ieee80211_if_parse_tkip_mic_test()
456 return -ENOTCONN; in ieee80211_if_parse_tkip_mic_test()
458 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 100); in ieee80211_if_parse_tkip_mic_test()
460 return -ENOMEM; in ieee80211_if_parse_tkip_mic_test()
461 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_if_parse_tkip_mic_test()
466 switch (sdata->vif.type) { in ieee80211_if_parse_tkip_mic_test()
470 memcpy(hdr->addr1, addr, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
471 memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
472 memcpy(hdr->addr3, sdata->vif.addr, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
477 if (!sdata->u.mgd.associated) { in ieee80211_if_parse_tkip_mic_test()
479 return -ENOTCONN; in ieee80211_if_parse_tkip_mic_test()
481 memcpy(hdr->addr1, sdata->deflink.u.mgd.bssid, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
482 memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
483 memcpy(hdr->addr3, addr, ETH_ALEN); in ieee80211_if_parse_tkip_mic_test()
487 return -EOPNOTSUPP; in ieee80211_if_parse_tkip_mic_test()
489 hdr->frame_control = fc; in ieee80211_if_parse_tkip_mic_test()
498 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_TKIP_MIC_FAILURE; in ieee80211_if_parse_tkip_mic_test()
509 if (!ieee80211_sdata_running(sdata) || !sdata->vif.cfg.assoc) in ieee80211_if_parse_beacon_loss()
510 return -ENOTCONN; in ieee80211_if_parse_beacon_loss()
512 ieee80211_beacon_loss(&sdata->vif); in ieee80211_if_parse_beacon_loss()
521 const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_fmt_uapsd_queues()
523 return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_queues); in ieee80211_if_fmt_uapsd_queues()
529 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_parse_uapsd_queues()
538 return -ERANGE; in ieee80211_if_parse_uapsd_queues()
540 ifmgd->uapsd_queues = val; in ieee80211_if_parse_uapsd_queues()
549 const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_fmt_uapsd_max_sp_len()
551 return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_max_sp_len); in ieee80211_if_fmt_uapsd_max_sp_len()
557 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_parse_uapsd_max_sp_len()
563 return -EINVAL; in ieee80211_if_parse_uapsd_max_sp_len()
566 return -ERANGE; in ieee80211_if_parse_uapsd_max_sp_len()
568 ifmgd->uapsd_max_sp_len = val; in ieee80211_if_parse_uapsd_max_sp_len()
577 const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_fmt_tdls_wider_bw()
580 tdls_wider_bw = ieee80211_hw_check(&sdata->local->hw, TDLS_WIDER_BW) && in ieee80211_if_fmt_tdls_wider_bw()
581 !ifmgd->tdls_wider_bw_prohibited; in ieee80211_if_fmt_tdls_wider_bw()
583 return snprintf(buf, buflen, "%d\n", tdls_wider_bw); in ieee80211_if_fmt_tdls_wider_bw()
589 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; in ieee80211_if_parse_tdls_wider_bw()
597 ifmgd->tdls_wider_bw_prohibited = !val; in ieee80211_if_parse_tdls_wider_bw()
612 skb_queue_len(&sdata->u.ap.ps.bc_buf)); in ieee80211_if_fmt_num_buffered_multicast()
619 struct ieee80211_local *local = sdata->local; in ieee80211_if_fmt_aqm()
623 if (!sdata->vif.txq) in ieee80211_if_fmt_aqm()
626 txqi = to_txq_info(sdata->vif.txq); in ieee80211_if_fmt_aqm()
628 spin_lock_bh(&local->fq.lock); in ieee80211_if_fmt_aqm()
633 …"ac backlog-bytes backlog-packets new-flows drops marks overlimit collisions tx-bytes tx-packets\n" in ieee80211_if_fmt_aqm()
635 txqi->txq.ac, in ieee80211_if_fmt_aqm()
636 txqi->tin.backlog_bytes, in ieee80211_if_fmt_aqm()
637 txqi->tin.backlog_packets, in ieee80211_if_fmt_aqm()
638 txqi->tin.flows, in ieee80211_if_fmt_aqm()
639 txqi->cstats.drop_count, in ieee80211_if_fmt_aqm()
640 txqi->cstats.ecn_mark, in ieee80211_if_fmt_aqm()
641 txqi->tin.overlimit, in ieee80211_if_fmt_aqm()
642 txqi->tin.collisions, in ieee80211_if_fmt_aqm()
643 txqi->tin.tx_bytes, in ieee80211_if_fmt_aqm()
644 txqi->tin.tx_packets); in ieee80211_if_fmt_aqm()
647 spin_unlock_bh(&local->fq.lock); in ieee80211_if_fmt_aqm()
659 struct ieee80211_local *local = sdata->local; in ieee80211_if_fmt_tsf()
670 struct ieee80211_local *local = sdata->local; in ieee80211_if_parse_tsf()
676 if (local->ops->reset_tsf) { in ieee80211_if_parse_tsf()
678 wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); in ieee80211_if_parse_tsf()
684 else if (buf[0] == '-') in ieee80211_if_parse_tsf()
685 tsf_is_delta = -1; in ieee80211_if_parse_tsf()
687 return -EINVAL; in ieee80211_if_parse_tsf()
693 if (tsf_is_delta && local->ops->offset_tsf) { in ieee80211_if_parse_tsf()
695 wiphy_info(local->hw.wiphy, in ieee80211_if_parse_tsf()
698 } else if (local->ops->set_tsf) { in ieee80211_if_parse_tsf()
703 wiphy_info(local->hw.wiphy, in ieee80211_if_parse_tsf()
716 return snprintf(buf, buflen, "0x%x\n", sdata->vif.valid_links); in ieee80211_if_fmt_valid_links()
723 return snprintf(buf, buflen, "0x%x\n", sdata->vif.active_links); in ieee80211_if_fmt_active_links()
732 return -EINVAL; in ieee80211_if_parse_active_links()
734 return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen; in ieee80211_if_parse_active_links()
738 IEEE80211_IF_LINK_FILE(addr, conf->addr, MAC);
805 debugfs_create_file(#name, mode, sdata->vif.debugfs_dir, \
809 debugfs_create_x##_bits(#_name, _mode, sdata->vif.debugfs_dir, \
810 &sdata->vif._name)
833 if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && in add_common_files()
834 sdata->vif.type != NL80211_IFTYPE_NAN) in add_common_files()
866 debugfs_create_file("num_mcast_sta", 0400, sdata->vif.debugfs_dir, in add_vlan_files()
886 sdata->vif.debugfs_dir); in add_mesh_stats()
901 sdata->vif.debugfs_dir); in add_mesh_config()
941 if (!sdata->vif.debugfs_dir) in add_files()
947 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) in add_files()
950 switch (sdata->vif.type) { in add_files()
980 link, &link_##name##_ops)
984 static void add_link_files(struct ieee80211_link_data *link, in add_link_files() argument
991 switch (link->sdata->vif.type) { in add_link_files()
1005 sprintf(buf, "netdev:%s", sdata->name); in ieee80211_debugfs_add_netdev()
1006 sdata->vif.debugfs_dir = debugfs_create_dir(buf, in ieee80211_debugfs_add_netdev()
1007 sdata->local->hw.wiphy->debugfsdir); in ieee80211_debugfs_add_netdev()
1009 sdata->deflink.debugfs_dir = sdata->vif.debugfs_dir; in ieee80211_debugfs_add_netdev()
1010 sdata->debugfs.subdir_stations = debugfs_create_dir("stations", in ieee80211_debugfs_add_netdev()
1011 sdata->vif.debugfs_dir); in ieee80211_debugfs_add_netdev()
1014 add_link_files(&sdata->deflink, sdata->vif.debugfs_dir); in ieee80211_debugfs_add_netdev()
1019 if (!sdata->vif.debugfs_dir) in ieee80211_debugfs_remove_netdev()
1022 debugfs_remove_recursive(sdata->vif.debugfs_dir); in ieee80211_debugfs_remove_netdev()
1023 sdata->vif.debugfs_dir = NULL; in ieee80211_debugfs_remove_netdev()
1024 sdata->debugfs.subdir_stations = NULL; in ieee80211_debugfs_remove_netdev()
1032 dir = sdata->vif.debugfs_dir; in ieee80211_debugfs_rename_netdev()
1037 sprintf(buf, "netdev:%s", sdata->name); in ieee80211_debugfs_rename_netdev()
1038 debugfs_rename(dir->d_parent, dir, dir->d_parent, buf); in ieee80211_debugfs_rename_netdev()
1047 if (sdata->flags & IEEE80211_SDATA_IN_DRIVER) { in ieee80211_debugfs_recreate_netdev()
1048 drv_vif_add_debugfs(sdata->local, sdata); in ieee80211_debugfs_recreate_netdev()
1050 ieee80211_link_debugfs_drv_add(&sdata->deflink); in ieee80211_debugfs_recreate_netdev()
1054 void ieee80211_link_debugfs_add(struct ieee80211_link_data *link) in ieee80211_link_debugfs_add() argument
1058 if (WARN_ON(!link->sdata->vif.debugfs_dir || link->debugfs_dir)) in ieee80211_link_debugfs_add()
1061 /* For now, this should not be called for non-MLO capable drivers */ in ieee80211_link_debugfs_add()
1062 if (WARN_ON(!(link->sdata->local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))) in ieee80211_link_debugfs_add()
1066 "link-%d", link->link_id); in ieee80211_link_debugfs_add()
1068 link->debugfs_dir = in ieee80211_link_debugfs_add()
1070 link->sdata->vif.debugfs_dir); in ieee80211_link_debugfs_add()
1072 DEBUGFS_ADD(link->debugfs_dir, addr); in ieee80211_link_debugfs_add()
1073 add_link_files(link, link->debugfs_dir); in ieee80211_link_debugfs_add()
1076 void ieee80211_link_debugfs_remove(struct ieee80211_link_data *link) in ieee80211_link_debugfs_remove() argument
1078 if (!link->sdata->vif.debugfs_dir || !link->debugfs_dir) { in ieee80211_link_debugfs_remove()
1079 link->debugfs_dir = NULL; in ieee80211_link_debugfs_remove()
1083 if (link->debugfs_dir == link->sdata->vif.debugfs_dir) { in ieee80211_link_debugfs_remove()
1084 WARN_ON(link != &link->sdata->deflink); in ieee80211_link_debugfs_remove()
1085 link->debugfs_dir = NULL; in ieee80211_link_debugfs_remove()
1089 debugfs_remove_recursive(link->debugfs_dir); in ieee80211_link_debugfs_remove()
1090 link->debugfs_dir = NULL; in ieee80211_link_debugfs_remove()
1093 void ieee80211_link_debugfs_drv_add(struct ieee80211_link_data *link) in ieee80211_link_debugfs_drv_add() argument
1095 if (link->sdata->vif.type == NL80211_IFTYPE_MONITOR || in ieee80211_link_debugfs_drv_add()
1096 WARN_ON(!link->debugfs_dir)) in ieee80211_link_debugfs_drv_add()
1099 drv_link_add_debugfs(link->sdata->local, link->sdata, in ieee80211_link_debugfs_drv_add()
1100 link->conf, link->debugfs_dir); in ieee80211_link_debugfs_drv_add()
1103 void ieee80211_link_debugfs_drv_remove(struct ieee80211_link_data *link) in ieee80211_link_debugfs_drv_remove() argument
1105 if (!link || !link->debugfs_dir) in ieee80211_link_debugfs_drv_remove()
1108 if (WARN_ON(link->debugfs_dir == link->sdata->vif.debugfs_dir)) in ieee80211_link_debugfs_drv_remove()
1112 debugfs_remove_recursive(link->debugfs_dir); in ieee80211_link_debugfs_drv_remove()
1113 link->debugfs_dir = NULL; in ieee80211_link_debugfs_drv_remove()
1115 ieee80211_link_debugfs_add(link); in ieee80211_link_debugfs_drv_remove()