Message ID | 20240411025322.33888-1-quic_lingbok@quicinc.com |
---|---|
Headers | show |
Series | wifi: ath12k: report station mode stats | expand |
On 4/10/2024 7:53 PM, Lingbo Kong wrote: > Currently, the transmit rate, the receive rate and signal strength of > “iw dev xxx station dump” always show an invalid value. > > This is because ath12k has no logic to handle this relevant information. > > To solve this issue, ath12k parses the information passed by the firmware > and passes it to mac80211. > > After that, "iw dev xxx station dump" show the correct value. > Such as: > > Station 00:03:7f:12:03:03 (on wlo1) > inactive time: 600 ms > rx bytes: 4642228 > rx packets: 23796 > tx bytes: 933967 > tx packets: 8761 > tx retries: 66 > tx failed: 0 > beacon loss: 0 > beacon rx: 8925 > rx drop misc: 191 > signal: -20 dBm > beacon signal avg: -18 dBm > tx bitrate: 1441.1 MBit/s 80MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0 > tx duration: 0 us > rx bitrate: 1801.4 MBit/s 80MHz EHT-MCS 11 EHT-NSS 3 EHT-GI 0 > rx duration: 0 us > > Lingbo Kong (3): > wifi: ath12k: report station mode transmit rate > wifi: ath12k: report station mode receive rate for IEEE 802.11be > wifi: ath12k: report station mode signal strength > > drivers/net/wireless/ath/ath12k/core.h | 4 + > drivers/net/wireless/ath/ath12k/dp_rx.c | 20 ++- > drivers/net/wireless/ath/ath12k/dp_rx.h | 3 + > drivers/net/wireless/ath/ath12k/dp_tx.c | 147 +++++++++++++++++- > drivers/net/wireless/ath/ath12k/hal_tx.h | 9 +- > drivers/net/wireless/ath/ath12k/mac.c | 180 +++++++++++++++++++++- > drivers/net/wireless/ath/ath12k/mac.h | 3 + > drivers/net/wireless/ath/ath12k/rx_desc.h | 2 + > drivers/net/wireless/ath/ath12k/wmi.c | 130 ++++++++++++++++ > drivers/net/wireless/ath/ath12k/wmi.h | 48 ++++++ > 10 files changed, 537 insertions(+), 9 deletions(-) > > > base-commit: dc410c4accd2fe64479a1f4ebc47ec9cd3928f4a FYI I'm not able to verify this series since it conflicts with the pending branch. Patch failed at 0003 wifi: ath12k: report station mode signal strength error: patch failed: drivers/net/wireless/ath/ath12k/core.h:607 error: drivers/net/wireless/ath/ath12k/core.h: patch does not apply error: patch failed: drivers/net/wireless/ath/ath12k/mac.c:7561 error: drivers/net/wireless/ath/ath12k/mac.c: patch does not apply Note that wireless-testing doesn't have the following series which conflicts: wifi: ath12k: Add single wiphy support Can you rebase against either ath-next or pending, both of which have that series?
On 4/10/2024 7:53 PM, Lingbo Kong wrote: > Currently, the transmit rate of "iw dev xxx station dump" command > always show an invalid value. > > To address this issue, ath12k parse the info of transmit complete > report from firmware and indicate the transmit rate to mac80211. > > This patch affects the station mode of WCN7850 and QCN9274. > > After that, "iw dev xxx station dump" show the correct transmit rate. > Such as: > > Station 00:03:7f:12:03:03 (on wlo1) > inactive time: 872 ms > rx bytes: 219111 > rx packets: 1133 > tx bytes: 53767 > tx packets: 462 > tx retries: 51 > tx failed: 0 > beacon loss: 0 > beacon rx: 403 > rx drop misc: 74 > signal: -95 dBm > beacon signal avg: -18 dBm > tx bitrate: 1441.1 MBit/s 80MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0 > > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 > Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com> > --- > drivers/net/wireless/ath/ath12k/core.h | 2 + > drivers/net/wireless/ath/ath12k/dp_rx.h | 3 + > drivers/net/wireless/ath/ath12k/dp_tx.c | 147 ++++++++++++++++++++++- > drivers/net/wireless/ath/ath12k/hal_tx.h | 9 +- > drivers/net/wireless/ath/ath12k/mac.c | 124 +++++++++++++++++++ > drivers/net/wireless/ath/ath12k/mac.h | 3 + > 6 files changed, 282 insertions(+), 6 deletions(-) [...] > diff --git a/drivers/net/wireless/ath/ath12k/hal_tx.h b/drivers/net/wireless/ath/ath12k/hal_tx.h > index 7c837094a6f7..7cfc584649ad 100644 > --- a/drivers/net/wireless/ath/ath12k/hal_tx.h > +++ b/drivers/net/wireless/ath/ath12k/hal_tx.h > @@ -1,7 +1,7 @@ > /* SPDX-License-Identifier: BSD-3-Clause-Clear */ > /* > * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. > - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. > + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. per current guidance if the file was not modified in 2023 the range should be 2021-2022, 2024
On 4/10/2024 7:53 PM, Lingbo Kong wrote: > Currently, the signal strength of "iw dev xxx station dump" always show an > invalid value. > > This is because signal strength is only set in ath12k_mgmt_rx_event() > function, and not set for received data packet. So, change to get signal > from firmware and report to mac80211. > > After that, "iw dev xxx station dump" show the correct signal strength. > Such as: > > Station 00:03:7f:12:03:03 (on wlo1) > inactive time: 36 ms > rx bytes: 61571 > rx packets: 336 > tx bytes: 28204 > tx packets: 205 > tx retries: 49 > tx failed: 0 > beacon loss: 0 > beacon rx: 83 > rx drop misc: 66 > signal: -24 dBm > beacon signal avg: -22 dBm > > For WCN7850, the firmware supports db2dbm, so not need to add noise floor. > For QCN9274, the firmware not support db2dbm, so need to add noise floor. > > This patch affects the station mode of WCN7850 and QCN9274. > > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 > Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1 > > Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com> > --- > drivers/net/wireless/ath/ath12k/core.h | 2 + > drivers/net/wireless/ath/ath12k/mac.c | 56 ++++++++++- > drivers/net/wireless/ath/ath12k/wmi.c | 130 +++++++++++++++++++++++++ > drivers/net/wireless/ath/ath12k/wmi.h | 48 +++++++++ > 4 files changed, 234 insertions(+), 2 deletions(-) [...] > diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h > index 78afc94a815d..9016eda03d57 100644 > --- a/drivers/net/wireless/ath/ath12k/wmi.h > +++ b/drivers/net/wireless/ath/ath12k/wmi.h > @@ -4811,6 +4811,52 @@ struct wmi_twt_disable_event { > __le32 status; > } __packed; > > +struct wmi_stats_event { > + __le32 stats_id; > + __le32 num_pdev_stats; > + __le32 num_vdev_stats; > + __le32 num_peer_stats; > + __le32 num_bcnflt_stats; > + __le32 num_chan_stats; > + __le32 num_mib_stats; > + __le32 pdev_id; > + __le32 num_bcn_stats; > + __le32 num_peer_extd_stats; > + __le32 num_peer_extd2_stats; > +} __packed; > + > +enum wmi_stats_id { > + WMI_REQUEST_VDEV_STAT = BIT(3), > +}; > + > +struct wmi_request_stats_cmd { > + __le32 tlv_header; > + __le32 stats_id; > + __le32 vdev_id; > + struct ath12k_wmi_mac_addr_params peer_macaddr; > + __le32 pdev_id; > +} __packed; > + > +#define WLAN_MAX_AC 4 > +#define MAX_TX_RATE_VALUES 10 > + > +struct ath12k_wmi_vdev_stats { this name does not conform to the "Naming conventions for structures" outlined at the beginning of the file: * _params is a structure which is embedded either into _cmd or _event (or * both), it is not sent individually. > + __le32 vdev_id; > + __le32 beacon_snr; > + __le32 data_snr; > + __le32 num_tx_frames[WLAN_MAX_AC]; > + __le32 num_rx_frames; > + __le32 num_tx_frames_retries[WLAN_MAX_AC]; > + __le32 num_tx_frames_failures[WLAN_MAX_AC]; > + __le32 num_rts_fail; > + __le32 num_rts_success; > + __le32 num_rx_err; > + __le32 num_rx_discard; > + __le32 num_tx_not_acked; > + __le32 tx_rate_history[MAX_TX_RATE_VALUES]; > + __le32 beacon_rssi_history[MAX_TX_RATE_VALUES]; > +} __packed;
On 2024/4/12 5:51, Jeff Johnson wrote: > On 4/10/2024 7:53 PM, Lingbo Kong wrote: >> Currently, the signal strength of "iw dev xxx station dump" always show an >> invalid value. >> >> This is because signal strength is only set in ath12k_mgmt_rx_event() >> function, and not set for received data packet. So, change to get signal >> from firmware and report to mac80211. >> >> After that, "iw dev xxx station dump" show the correct signal strength. >> Such as: >> >> Station 00:03:7f:12:03:03 (on wlo1) >> inactive time: 36 ms >> rx bytes: 61571 >> rx packets: 336 >> tx bytes: 28204 >> tx packets: 205 >> tx retries: 49 >> tx failed: 0 >> beacon loss: 0 >> beacon rx: 83 >> rx drop misc: 66 >> signal: -24 dBm >> beacon signal avg: -22 dBm >> >> For WCN7850, the firmware supports db2dbm, so not need to add noise floor. >> For QCN9274, the firmware not support db2dbm, so need to add noise floor. >> >> This patch affects the station mode of WCN7850 and QCN9274. >> >> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 >> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.2.1-00201-QCAHKSWPL_SILICONZ-1 >> >> Signed-off-by: Lingbo Kong <quic_lingbok@quicinc.com> >> --- >> drivers/net/wireless/ath/ath12k/core.h | 2 + >> drivers/net/wireless/ath/ath12k/mac.c | 56 ++++++++++- >> drivers/net/wireless/ath/ath12k/wmi.c | 130 +++++++++++++++++++++++++ >> drivers/net/wireless/ath/ath12k/wmi.h | 48 +++++++++ >> 4 files changed, 234 insertions(+), 2 deletions(-) > [...] >> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h >> index 78afc94a815d..9016eda03d57 100644 >> --- a/drivers/net/wireless/ath/ath12k/wmi.h >> +++ b/drivers/net/wireless/ath/ath12k/wmi.h >> @@ -4811,6 +4811,52 @@ struct wmi_twt_disable_event { >> __le32 status; >> } __packed; >> >> +struct wmi_stats_event { >> + __le32 stats_id; >> + __le32 num_pdev_stats; >> + __le32 num_vdev_stats; >> + __le32 num_peer_stats; >> + __le32 num_bcnflt_stats; >> + __le32 num_chan_stats; >> + __le32 num_mib_stats; >> + __le32 pdev_id; >> + __le32 num_bcn_stats; >> + __le32 num_peer_extd_stats; >> + __le32 num_peer_extd2_stats; >> +} __packed; >> + >> +enum wmi_stats_id { >> + WMI_REQUEST_VDEV_STAT = BIT(3), >> +}; >> + >> +struct wmi_request_stats_cmd { >> + __le32 tlv_header; >> + __le32 stats_id; >> + __le32 vdev_id; >> + struct ath12k_wmi_mac_addr_params peer_macaddr; >> + __le32 pdev_id; >> +} __packed; >> + >> +#define WLAN_MAX_AC 4 >> +#define MAX_TX_RATE_VALUES 10 >> + >> +struct ath12k_wmi_vdev_stats { > > this name does not conform to the "Naming conventions for structures" outlined > at the beginning of the file: > * _params is a structure which is embedded either into _cmd or _event (or > * both), it is not sent individually. > Oh, thanks for pointing out. I get what you mean, but the ath12k_wmi_vdev_stats belongs to event, so, i can changes it to wmi_vdev_stats_event, i will apply it in next version. Best regards Lingbo Kong >> + __le32 vdev_id; >> + __le32 beacon_snr; >> + __le32 data_snr; >> + __le32 num_tx_frames[WLAN_MAX_AC]; >> + __le32 num_rx_frames; >> + __le32 num_tx_frames_retries[WLAN_MAX_AC]; >> + __le32 num_tx_frames_failures[WLAN_MAX_AC]; >> + __le32 num_rts_fail; >> + __le32 num_rts_success; >> + __le32 num_rx_err; >> + __le32 num_rx_discard; >> + __le32 num_tx_not_acked; >> + __le32 tx_rate_history[MAX_TX_RATE_VALUES]; >> + __le32 beacon_rssi_history[MAX_TX_RATE_VALUES]; >> +} __packed; >
On 4/12/2024 2:45 AM, Lingbo Kong wrote: > On 2024/4/12 5:51, Jeff Johnson wrote: >> On 4/10/2024 7:53 PM, Lingbo Kong wrote: >>> +struct ath12k_wmi_vdev_stats { >> >> this name does not conform to the "Naming conventions for structures" outlined >> at the beginning of the file: >> * _params is a structure which is embedded either into _cmd or _event (or >> * both), it is not sent individually. >> > > Oh, thanks for pointing out. > I get what you mean, but the ath12k_wmi_vdev_stats belongs to event, so, > i can changes it to wmi_vdev_stats_event, i will apply it in next version. note that _event should only be used for the first TLV in the event payload. Any subsequent TLVs in either a command or event should use _params