Commit Graph

296 Commits

Author SHA1 Message Date
Surabhi Vishnoi
8cc36ff7cf qcacmn: Fix field-spanning kernel warning during driver load
Currently, driver passes void pointer to wmsg as source buffer
in memcpy API to copy the local log_msg to nlmsg data buffer
in ptt_sock_send_msg_to_app(). This leads to kernel warn as
kernel is unable to calculate the size of variable length source
buffer.

To fix this issue, pass the data buffer of nlmsg in memcpy API
so that kernel is able to calculate the size of source buffer
and verify for buffer overflow before copy.

Change-Id: I91e2e1b0b8e58428ed5ba20c7caf4ec3b45a6428
CRs-Fixed: 3749523
2024-03-12 09:07:15 -07:00
Surabhi Vishnoi
5d71abe754 qcacmn: Fix field-spanning kernel warning during driver load
Currently, driver passes void pointer to wmsg as source buffer
in memcpy API to copy the local log_msg to nlmsg data buffer
in send_filled_buffers_to_user(). This leads to kernel warn
as kernel is unable to calculate the size of variable length
source buffer.

To fix this issue, pass the data buffer of nlmsg in memcpy API
so that kernel is able to calculate the size of source buffer
and verify for buffer overflow before copy.

Change-Id: Ief089f4a834aa89a0be75fcf201ad56ca9cba7d8
CRs-Fixed: 3749520
2024-03-12 07:57:08 -07:00
Lin Bai
737b028eea qcacmn: Fix code indent
Fix code indent issue, to avoid compiler complain.

Change-Id: I21729bf9aaa6561d6282bb456451e1e1a0748609
CRs-Fixed: 3674783
2024-01-16 08:15:56 -08:00
Vijay Raj
fb436899e2 qcacmn: Introduce Events for MLO diag logging
Introduce event to support STA info and MLO specific
event for diag logging

New events:
EVENT_WLAN_STA_INFO: Sta info event
EVENT_WLAN_MLO_SETUP: MLO Setup event
EVENT_WLAN_MLO_RECONFIG: MLO Reconfig event
EVENT_WLAN_MLO_T2LM_STATUS: MLO T2LM Status event
EVENT_WLAN_MLO_T2LM_REQ_RESP: MLO T2LM Req/Resp event
EVENT_WLAN_MLO_T2LM_TEARDOWN: MLO T2LM teardown event
EVENT_WLAN_MLO_LINK_STATUS: MLO Link status event

Change-Id: I0482b2c65a3ae261b6031931e44ece7611d5e123
CRs-Fixed: 3564196
2023-08-29 15:04:57 -07:00
Aditya Kodukula
d3be64a66d qcacmn: Add wlan_logging structure to wlan minidump
Add wlan_logging structure to wlan minidump regions.

Change-Id: I03f8aea58f0521e97ab7470db3b6280ea2fa627c
CRs-Fixed: 3559452
2023-07-17 16:33:52 -07:00
Namita Nair
5db38f1713 qcacmn: Hold wakelock during Optional wifi dp
To prevent APPS from suspending hold a wakelock
at the time of filter reserve and release at filter
release.

Change-Id: I5c15c50ccf2cebce677abd8ff6b568b7fafab49b
CRs-Fixed: 3498105
2023-06-14 22:02:55 -07:00
Amit Mehta
dd5f5c1afa qcacmn: Get wow nack reason code
Currently, Fw did not set NACK reason code
to Host when Fw is not ready for WoW.

As part of the new change, Fw will send NACK
reason code along with WoW NACK to host.
Make changes in host to parse NACK reason
code from the received message.

Change-Id: I17ee99cb302ff546731a46d3ce03977c3c3d5a67
CRs-Fixed: 3481189
2023-05-18 04:35:41 -07:00
Aditya Kodukula
b223cb5534 qcacmn: Fix field-spanning issue in ptt_sock_send_msg_to_app()
Currently in the function ptt_sock_send_msg_to_app(), memcpy()
is used to copy data into multiple fields of the struct tAniHdr.
When FORTIFY_SOURCE feature is enabled, kernel warns of field-spanning.

To resolve this issue, assign a void pointer to the struct and use it
in memcpy().

Change-Id: I30311b063e735a89dfd38e029dacc80d6808a4af
CRs-Fixed: 3488513
2023-05-11 18:02:20 -07:00
KARTHIK KUMAR T
3b082b0bf8 qcacmn: add recommended err/debug function
add recommended err/debug function

Change-Id: I8d564a155485be4b997ecd8ba8325e3e4d72d7b1
CRs-Fixed: 3490031
2023-05-11 06:31:37 -07:00
Aditya Kodukula
0e1360e358 qcacmn: Fix field-spanning kernel warning during driver load
Currently in driver, we use memcpy() to copy data stored
in log buffers to multiple fields in the struct tAniHdr.
But from kernel 6.1, if FORTIFY_SOURCE feature is enabled,
then kernel warns of field-spanning.

To resolve this issue, assign a void pointer to the struct
and use it in memcpy().

Change-Id: If4d089f4118c573ef57b87b83f9a350da1674b2b
CRs-Fixed: 3465600
2023-05-01 12:10:10 -07:00
Jeff Johnson
4612e27f35 qcacmn: Replace use of WLAN_OPEN_SOURCE
Currently the DebugFS logic in utils/fwlog/dbglog_host.c is protected
by the flag WLAN_OPEN_SOURCE. The WLAN_OPEN_SOURCE flag is a legacy
flag which had a specific use that is no longer valid. So replace the
use of WLAN_OPEN_SOURCE with a feature-specific flag.

Change-Id: I82c51efff8dfe6673c6b9d956f974cae2d21bb69
CRs-Fixed: 3464911
2023-04-20 21:28:06 -07:00
Jeff Johnson
8b0dc8c2bb qcacmn: epping: Remove use of WLAN_OPEN_SOURCE
The macro WLAN_OPEN_SOURCE served a legacy purpose which is no longer
required, so remove the usage.

Change-Id: I28c8225d6a9d132f2492665463be385ad139864c
CRs-Fixed: 3463713
2023-04-20 15:58:58 -07:00
Jeff Johnson
b62151f8dd qcacmn: Fix utils/host_diag_log documentation
The kernel-doc script has identified multiple documentation issues in
the utils/host_diag_log folder, so fix them.

Change-Id: Iaaa241e7f2a18dd7952d491b31487c0b048cca52
CRs-Fixed: 3461770
2023-04-19 18:12:22 -07:00
Jeff Johnson
c7eaf5ac98 qcacmn: Fix pktlog_ac_api.h documentation
The kernel-doc script has identified a couple of documentation issues
in pktlog_ac_api.h, so fix them to the best of our ability.

Change-Id: If5db73e7d019def46d0ba71fb0b01fe4327a521a
CRs-Fixed: 3451053
2023-04-07 19:50:38 -07:00
Jeff Johnson
839714c413 qcacmn: Remove obsolete struct ol_pktlog_dev_t references
There are two references to struct ol_pktlog_dev_t even though the
struct itself no longer exists in the code. Remove those references.

Change-Id: Ibf94e86c44d9c84c6a51ee554b457878f0a0b7ba
CRs-Fixed: 3421798
2023-03-15 22:39:19 -07:00
Asutosh Mohapatra
de1e7e7e12 qcacmn: Enhance hang reason code mappings
Currently many host hang reason codes are not mapped to corresponding
userspace codes as a result these hang reason code will be invalid
for userspace and also QDF_REASON_UNSPECIFIED is used in some places
in host.

To add mappings for host hang codes to corresponding to userspace
hang codes and also add new hang codes.

Change-Id: Idb21ccb4a34c9c94872798404912bdb743e9270b
CRs-Fixed: 3381229
2023-02-10 12:21:38 -08:00
Mohammed Ahmed
cef49bdf89 qcacmn: add SSR host log collection API usage
Current code does not use the SSR host log collection API.
Fix this by adding SSR host log collection API usage.

Change-Id: I9dfb0bd7054986760a711d0752f37f4327c706b2
CRs-Fixed: 3339933
2023-01-19 20:44:09 -08:00
Vijay Raj
06d0b53489 qcacmn: Add event id for Neighbor and beacon report logging
Add event id to support Neighbor report and beacon report for
diag logging.

Add EVENT_WLAN_NBR_RPT event to send Neighbor report diag logs
and EVENT_WLAN_BCN_RPT event to send Beacon report diag logs.

Change-Id: I5c7207667e2bad803389e160912357bc87196131
CRs-Fixed: 3370803
2023-01-17 01:41:49 -08:00
Jingxiang Ge
7d007034fb qcacmn: Add debug timestamp for wlan_logging_thread
Add more log for wlan_logging_thread to monitor
thread start/exit.
and also add memory barrier wmb to make sure exit
flag/shutdown_comp have been set done.

Change-Id: I6549f344f50bdd9df3a29c4ab724ea67213670de
CRs-Fixed: 3320274
2022-11-22 07:49:45 -08:00
David Oladunjoye
3ccef6c0a6 qcacmn: Fix list iterators to match upstream discussion
List iterators should conform to upstream discussion. List iterators that
reach end of list do not point to NULL but rather they point to list_head.
Dereferencing the iterator in this case would break the list. The scope of
the list iterator should be confined to the loop. Solution is to use assign
ptr to iterator when condition is met, this ptr can be used outside of the
loop.

Change-Id: I896b85bbd24b63e6b1562d35ffec8abc920f1b6d
CRs-Fixed: 3331681
2022-11-19 01:03:24 -08:00
Liangwei Dong
436c73ee60 qcacmn: Add WAKELOCK_DYN_MAC_ADDR_UPDATE wake lock reason
Add new enum WIFI_POWER_EVENT_WAKELOCK_DYN_MAC_ADDR_UPDATE
for dynamic MAC address update wake lock reason code.

Change-Id: I61b9b54b2aca30eec9aa1d153a40877bfda88af9
CRs-Fixed: 3327592
2022-11-10 11:35:24 -08:00
Jeff Johnson
cfe8cda786 qcacmn: Use renamed QDF suppressed logging APIs
Several QDF suppressed logging APIs were originally named with a
misspelling of "suppressed." New correctly-spelled functions are
available, so call those instead.

Change-Id: I4fcd506b39cedd6f094f93ee900cf9ce8be759c1
CRs-Fixed: 3313686
2022-10-25 20:10:38 -07:00
Jeff Johnson
b26f2f678c qcacmn: utils: Fix misspellings
Fix misspellings in utils/...

Change-Id: I092dfff26e16e7c660e6652a652268256d1d1517
CRs-Fixed: 3304703
2022-10-12 13:19:26 -07:00
Rajesh Chauhan
e895717ffb qcacmn: add a new function to update net_device->dev_addr
In kernel 5.17, net_device->dev_addr is changed to const unsigned char*
and can only be updated via dev_addr_mod(). Add a new function
qdf_net_update_net_device_dev_addr() to call kernel API dev_addr_mod().

Change-Id: Ifecfb453f5dc6b066892c04f4bdbec3759e32c53
CRs-Fixed: 3298120
2022-10-05 17:51:44 -07:00
Rajesh Chauhan
1cb111d3bc qcacmn: replace PDE_DATA() with pde_data()
In kernel 5.17, PDE_DATA() is replaced with pde_data(). Make
matching change in ath_procfs.c and linux_ac.c files.

Change-Id: Ia198545322146d4adde9330c19b43f5c2ed0dfa2
CRs-Fixed: 3298062
2022-10-05 17:51:38 -07:00
Rajesh Chauhan
c85603d008 qcacmn: replace complete_and_exit with kthread_complete_and_exit
In kernel 5.17, complete_and_exit is replaced with
kthread_complete_and_exit. So if kernel version is >= 5.17,
then use kthread_complete_and_exit.

Change-Id: I4e9a98373197eba4931a8dafe77040448ffb40eb
CRs-Fixed: 3297481
2022-10-05 17:51:25 -07:00
Jeff Johnson
88c15dadbb qcacmn: Fix misspelling "recevied"
Multiple instances of the misspelling "recevied" are present, so
replace them with the correct spelling "received."

Change-Id: Ibd7f4a136541be8aa98f5bee4db7f75af0271f53
CRs-Fixed: 3273526
2022-08-28 19:08:26 -07:00
VIJAY RAJ
0e1e696425 qcacmn: Add Roam reason and Roam sub-reason for Diag logging
The roam reason and roam sub-reason code sent and expected
reason codes at supplicant are diffent which results in
wrong interpretation of reason code.

Add roam reason and roam sub-reason code enum in order
to aid the converion from fw roam reason code to supplicant
understandable reason code.

Change-Id: I3432793965e325ddbf90ab90a1532a0726650d8c
CRs-Fixed: 3238496
2022-07-19 03:34:08 -07:00
VIJAY RAJ
a103471347 qcacmn: Add new diag events in enum event_id_enum_type
The existing design is to send connectivity event logs
via vendor command.

New diag events are  introduced to maintain single
logging infrastructure.

Change-Id: I162680b40127826cd74e7b437b7cdaeb81b96bc1
CRs-Fixed: 3220081
2022-07-07 21:43:18 -07:00
Vinod Kumar Myadam
b721690039 qcacmn: Add flag CONNECTIVITY_PKTLOG
Add new flag CONNECTIVITY_PKTLOG to make independent of
FEATURE_PKTLOG and REMOVE_PKT_LOG for packet logging.

This is because 32 tx/rx pkt logging is connection related
and this feature is independent of pkt log feature. Here
driver will send first 32 tx/rx pkts consisting of mgmt
and data pkts to userspace which can be used for debugging

Change-Id: I006a040546c9709f46e76dcd8630da8569c691c6
CRs-Fixed: 3222971
2022-06-27 12:17:21 -07:00
Amit Mehta
6e1dde7e43 qcacmn: Add QDF packet type enum
Add new QDF enum for packet type and make
changes to pass status and type to packetlog callback APIs as QDF type

Change-Id: I423839e42b316ce43feaae34e297d3d8f0dee7ba
CRs-Fixed: 3224881
2022-06-23 07:04:02 -07:00
Kai Liu
f744f6a4e7 qcacmn: Use default seek for memdump lseek
Kernel change d4455fa 'proc: mandate ->proc_lseek in "struct proc_ops"'
by default use proc_lseek for file operations without any check, so add
default_llseek for all proc ops.

Change-Id: Ia72839cf09ec721fb98f50793b19ec082478d8d7
CRs-Fixed: 3201003
2022-05-24 16:01:15 -07:00
Jianmin Zhu
5a0dd70fc9 qcacmn: Limit netlink log on console
WLAN registers with multicast group 1 which is used by some legacy
infrastructure, may receive some wlan irrelative events, don't need
print on console.

Change-Id: I48fca745a603fd9875e2161d48144b4283fd6493
CRs-Fixed: 3137354
2022-03-01 21:46:02 -08:00
Adwait Nayak
b66eb8977a qcacmn: Rectify LF copyright year
Rectify LF copyright year

Change-Id: Ia021db26a4e528d42f148b0f24258f55e957be54
CRs-Fixed: 3122253
2022-02-10 14:03:08 -08:00
Adwait Nayak
df88a8bdc9 qcacmn: Place pktlog specific code under BE_PKTLOG_SUPPORT
Introduce a new flag "BE_PKTLOG_SUPPORT" for beryllium specific
pktlog support.

Change-Id: If91156541b322905ad5d97cf2d9d7ae687290ecb
CRs-Fixed: 3115832
2022-01-26 10:59:42 -08:00
Liangwei Dong
a5503f36a3 qcacmn: Add DEBUG_CONN_RSO log history
Add new DEBUG_CONN_RSO enum to record RSO state changing.

Change-Id: Ie46ab5d4b32d8b5632aa3c3eaed96d00afda22b3
CRs-Fixed: 3097076
2021-12-27 01:03:55 -08:00
Adwait Nayak
3664b4c5c2 qcacmn: FR65980: Add HYBRID TX support for pktlog
- A new pktlog mode called "hybrid", is added for QCN9224 only.
- Create WDI event for hybrid mode
- Add dummy APIs for monitor filter setting
- Send WMI_PKTLOG_EVENT_HYBRID_TX to FW for umac TLV subscription

Change-Id: I47f4e14bfc766f29a0ab4a8c07ab19e0d919e66b
CRs-Fixed: 3074184
2021-11-26 10:13:12 -08:00
Mohit Khanna
81e29163db qcacmn: Add throughput based RTPM API support
Add support to invoke HIF runtime PM APIs in TX packet path based on
throughput level. Essentially at high throughputs, where runtime PM is
not expected to provide power gains, invoking the APIs is deterimental to
performance.
Hence invoke runtime_pm APIs based on throughput level.

CRs-Fixed: 3059712
Change-Id: I49d111bffa8a37c68abbdd54911f9ecc22430562
2021-11-08 05:19:41 -08:00
Yue Ma
6c387e6f24 qcacmn: Include panic_notifier.h to access panic_notifier_list
From 5.14 kernel, panic_notifier_list is moved from kernel.h to
panic_notifier.h, hence explicitly include the header file in
order to access panic_notifier_list.

Change-Id: Icf546ebea5a19b79602031b4fd92b498db0048c0
CRs-fixed: 3060060
2021-10-25 18:31:21 -07:00
Rajeev Kumar
2d0856d0b2 qcacmn: Add disconnect wake lock reason code
Add disconnect wake lock reason code to add a wake lock
for WiFi disconnection.

Change-Id: I2ac33239c9df76d7c92429b9ada0380ad79fc72c
CRs-Fixed: 3045132
2021-09-28 23:23:37 -07:00
Pragaspathi Thilagaraj
a8d8b663b2 qcacmn: Define QDF API for vzalloc and vfree
Define QDF API for virtual memory allocation and free.
Also add new api to get time of the day in microseconds.

Change-Id: I2921055bbb6b5d2a1105d19448b2a10fa2d6ccc5
CRs-Fixed: 3038180
2021-09-28 21:12:18 -07:00
Pragaspathi Thilagaraj
b001e0e130 qcacmn: Add support to send connectivity logs from logging thread
Add support to send connectivity logs from g_wlan_logging thread.
Add new HOST_LOG_DRIVER_CONNECTIVITY_MSG event flag which wakes up
the gwlan_logging thread when set.
Also register connection manager callbacks to send the logging event.

Check if logging queue is empty whenever the gwlan_logging thread
is woken up and send the logs to userspace if the count doesn't
exceed the allowed threshold.

Change-Id: I3fdb8358f9048a277e2f03894c0e6a17376b0da0
CRs-Fixed: 3029279
2021-09-16 08:28:29 -07:00
Yue Ma
674474c55a qcacmn: Add CONFIG_CNSS_OUT_OF_TREE flag
Use CONFIG_CNSS_OUT_OF_TREE to control if CNSS family drivers are
built from in-kernel-tree source or out-of-kernel-tree source since
the exposed header files will be in different paths. This is also
for backward compatibility.

Change-Id: I698492f175ea140e6854c372f366a63f36de24c9
CRs-fixed: 3022556
2021-08-30 13:38:44 -07:00
abhinav kumar
0df0ae40b0 qcacmn: Possible OOB read in process_fw_diag_event_data
API "fw_diag_data_event_handler" is the handler of an event
WMI_DIAG_DATA_CONTAINER_EVENTID comes from FW. Arguments of
this handler function come from FW.

If num_data may be less than size of(struct wlan_diag_data),
possible OOB while extracting event data.

Fix is to add a sanity check for num_data to avoid the OOB
read.

Change-Id: Ia2eb62dbaa154936bdb4ea34065657d441f12810
CRs-Fixed: 3001178
2021-08-19 22:17:46 -07:00
Jeevan Kukkalli
0343109e97 qcacmn: Print buffered logs one line at a time
Print buffered wlan logs one line at a time to avoid
log split.

Change-Id: Ie35bdee741e7dab430281bb18aea48325118bf23
CRs-Fixed: 2977844
2021-08-17 01:38:44 -07:00
Vevek Venkatesan
6a3c9eaa85 qcacmn: add CDP interface support for pkt_log_exit
Add CDP interface API support for pkt_log_exit,
to cleanup pkt_log_init on failure.

Change-Id: Ib50efaed5997d341d3e76c2e1dbe42856df40191
CRs-Fixed: 3012201
2021-08-14 23:07:04 -07:00
Jia Ding
b1ba62d8e2 qcacmn: Add 320MHz in enum mgmt_ch_width
Add BW_320MHz in mgmt_ch_width in host diag module.

Also remove WLAN_FEATURE_11BE feature flag within enum
mgmt_dot11_mode for 11BE related modes.

Change-Id: I2914735edd5aa21ad1d94b0e5fcf718b189fc432
CRs-Fixed: 3009301
2021-08-11 15:50:55 -07:00
Rajeev Kumar
37ee80923a qcacmn: Add wakelock reasons for sap and go d3 wow
Add wakelock reasons for sap and go d3 wow feature.

Change-Id: I067cb8fd30cc90d4ec0c8b1a26c0b5bc17db966f
CRs-Fixed: 2986291
2021-07-14 17:53:54 -07:00
Ashish Kumar Dhanotiya
fdac28ef95 qcacmn: Add synchronization for flush log completion
Currently there is no synchronization for flush log completion
between fw and userspace. When host driver receives command to
flush logs, it sends the command to fw and releases the control
of the userspace thread, it does not wait for the flush log
completion event from the fw and because of which user space
does not know when the host and fw completes the log flush.

To address above issue add a logic to wait for fw event of
flush log completion before host returns control to userspace.

Change-Id: I04fa0aead146d2b7b8627e4101c6dcd99d3947e9
CRs-Fixed: 2983387
2021-07-12 05:33:17 -07:00
Wu Gao
0971daad9f qcacmn: Add wakelock for enhanced CFR
There is potential risk when starting CFR and resume happens at same
time, so this change adds wake lock for enhanced CFR.

Change-Id: Ifbde12cb73092b7fc4ef517e57051af4ffe7a79f
CRs-Fixed: 2974733
2021-06-28 19:25:58 -07:00