Commit Graph

43 Commits

Author SHA1 Message Date
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
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
Debasis Das
77a23e8f71 qcacmn: Use abstraction APIs for kernel APIs
Use non-inline OS-abstraction APIs to avoid direct
usage of kernel API's.

Use non-inline OS-abstraction APIs instead of OS APIs.

Change-Id: Ie4acfedc63a0e0e8ecbe358db711148db92bd8b6
2021-01-22 12:07:41 -08:00
Alan Chen
8a27ffb4ad qcacmn: Rate limit error logs from send_diag_netlink_data
Introduce proper logging APIs for diag module and also rate limit error
logs when skb allocation fails in low memory conditions to avoid excessive
logging side effects

Change-Id: Ia41ff7cfd526180825df61a43f1f59163947f257
CRs-Fixed: 2836681
2020-12-11 22:45:11 -08:00
Srinivas Girigowda
f7248d774e qcacmn: Fix possible OOB read in cnss_diag_cmd_handler
The nla_data coming from user space is a variable length data,
but the driver is checking nla_len() against a fixed length struct only.
It is possible that the nla_len() check against fixed length struct
may pass and if the nla_data does not have the payload and it may
result in possible out-of-bound read (slot->payload).

Hence the fix is to, check if nla_len() is atleast more than
the fixed length struct and also account for payload length.

Change-Id: I2e68d55c0411cff55908c1704031e3c070f3316e
CRs-Fixed: 2825763
2020-12-04 02:50:42 -08:00
Bapiraju Alla
b130521bd3 qcacmn: Process FW diag events in a separate worker thread
Currently, FW diag logs, management frames and stats responses are
processed in worker context. Because of this, there is a possible
out of memory scenario when there are huge number of diag events
waiting in work queue.

To address this, process diag events in a separate worker thread and
set the limit for the number of diag events that can be queued in
work queue.

Change-Id: Ie6e5b905a3b591cf724cd6b024bec0612f9e2e0c
CRs-Fixed: 2818013
2020-11-21 00:20:27 -08:00
Aditya Kodukula
74b41a6d6a qcacmn: Add WMI command to enable wow mode logging
Add the WMI command WMI_DBGLOG_MOD_WOW_LOG_LEVEL to enable
debug logs while in wow mode.

Change-Id: Ia1902d989964a5e35f590a075a2de64a9f66d5b7
CRs-Fixed: 2810326
2020-11-05 01:20:46 -08:00
aloksing
f1ebce2cec qcacmn: Change return type to QDF_STATUS
wmi_unified_register_event return QDF_STATUS

Change-Id: Ie65a3707aa24213daf97c2bf36310d6471b31733
2020-09-15 18:24:59 -07:00
Hangtian Zhu
7788a89ccd qcacmn: Fix compile issues when some features are disabled
Fix compile issues when some features are disabled, the features are:
BUILD_DEBUG_VERSION
CONFIG_CP_STATS
CONFIG_HOST_OPCLASS
CONFIG_FEATURE_ROAM_DEBUG
There are some other features depends on each other, so enabled features to
qcs40x.snoc.perf_defconfig, the features are:
CONFIG_WLAN_FEATURE_FILS
CONFIG_WMI_ROAM_SUPPORT
CONFIG_WMI_STA_SUPPORT
CONFIG_REG_CLIENT
CONFIG_WLAN_FEATURE_DP_BUS_BANDWIDTH
CONFIG_WMI_CONCURRENCY_SUPPORT
CONFIG_LL_DP_SUPPORT

Change-Id: I6fa1eacb79576a955e593dbb9ac52083742275e3
CRs-Fixed: 2584839
2019-12-18 23:55:00 -08:00
Yeshwanth Sriram Guntuka
e854c377d6 qcacmn: Use GFP_ATOMIC flag for skb alloc for diag data
Diag event processing is stuck due to skb allocation failure.
SKb allocation is done using flag GFP_KERNEL which results
in the kworker thread to sleep and results in wmi workqueue
timer to expire.

Fix is to use GFP_ATOMIC flag for skb allocation for
diag data.

Change-Id: Ifa715df89ae06b17d4dc1506ea4f3c4e2af31f33
CRs-Fixed: 2559679
2019-11-16 23:59:11 -08:00
Vivek
0c4e20ff82 qcacmn: Replace printk with qdf_nofl_info
Replace printk with qdf_nofl_info in qdf folder.
So if we wish to change from printing on console
to other location, based on a logging daemon, we
can do that by only changing at the implementation
of QDF print API's

Change-Id: I6db67cee416ebbe0f2c51b2d4dbf2b3a335e972a
CRs-Fixed: 2442689
2019-10-29 04:07:12 -07:00
Ashish Kumar Dhanotiya
bf9d06fab1 qcacmn: Use vzalloc instead of vmalloc
Currently driver is using vmalloc to allocate the memory
inside dbglog_block_read api and this buffer is copied to
userspace buffer which may lead to use of uninitialized
buffer.

To avoid above issue use vzalloc to allocated the buffer
which initializes the memory to zero.

Change-Id: Iebc530b000c908231ef8718e79054801d294dd8f
CRs-Fixed: 2470385
2019-06-19 10:33:09 -07:00
Jeff Johnson
4c5ac90746 qcacmn: utils: Replace explicit comparison to NULL
Per the Linux Kernel coding style, as enforced by the kernel
checkpatch script, pointers should not be explicitly compared to
NULL. Therefore within utils replace any such comparisons with logical
operations performed on the pointer itself.

Change-Id: Iae6c2f2f0b3041a9397dd13092ea500a8b995fd2
CRs-Fixed: 2418251
2019-03-26 10:30:31 -07:00
Chaitanya Kiran Godavarthi
6df18d4da8 qcacmn: Remove service ready callback for smartlog enable
Remove service ready callback for smartlog enable.

Change-Id: I1d2807b0ec59b4f38bb8e2ac5365f3b57cf37437
2019-02-17 08:41:20 -08:00
Paul Zhang
976c92285c qcacmn: Remove the CONFIG_MCL
Cleaning up cmn code by getting rid of CONFIG_MCL
in file utils/fwlog/dbglog_host.h.

Change-Id: I01cc1805ef2a2d57935216da79a4294a89be1411
CRs-Fixed: 2359889
2018-12-24 20:24:29 -08:00
Pavankumar Nandeshwar
ad5e0bd66f qcacmn: Change fwlogs API for smartlogs
Add function pointers for calling smartlogs init and deinit.

CRs-Fixed: 2008290
Change-Id: I4734e490394a24f5a39eb50f3ac386ad99834cb3
2018-11-19 11:05:49 -08:00
Pratik Gandhi
8af026a2ca qcacmn: Abstract BMI and add export symbols for ko separation
Abstract BMI callback from common module and move it to specific component.
Add Export symbols to support modularization in WIN. (BMI)

CRs-Fixed: 2324081
Change-Id: I1ec463d41d238ce81254ecc1f0bb1dc545e1248e
2018-10-18 06:32:45 -07:00
Alok Kumar
e7ac594b6a qcacmn: Fix information leak issue during memcpy
The buffer allocated with length "ATH6KL_FWLOG_PAYLOAD_SIZE"
is not initialized, this may lead to information leak during
memcpy when len < ATH6KL_FWLOG_PAYLOAD_SIZE.

To resolve this issue, memset the buffer for length
(ATH6KL_FWLOG_PAYLOAD_SIZE - len) to 0

Change-Id: If4a49347d674ad2af0438b408a4a4b9308c61026
CRs-Fixed: 2255083
2018-06-29 17:27:48 -07:00
Vignesh Viswanathan
4c9e971f8e qcacmn: Deregister NL MSG handlers during hdd_wlan_exit
Currently the NL MSG handlers for WLAN_NL_MSG_CNSS_DIAG, ANI_NL_MSG_PUMAC
and ANI_NL_MSG_PTT are not deregistered during hdd_wlan_exit which can
causes a page fault if NL issues cld80211_doit for these NL messages
when the WLAN is not up.

Add Deregsiter APIs for all the NL MSGs to call as part of
hdd_exit_netlink_services during hdd_wlan_exit.

Change-Id: I231e2f32e708e9a14305f0a8f9f2f603aa42b031
CRs-Fixed: 2243993
2018-06-18 16:33:47 -07:00
Wen Gong
583a3b1b18 qcacmn: Featurize dbglog_host
Featurize parsing support for WLAN firmware logs in WLAN host driver

Change-Id: I94a75a0ab09f086209298bdd4870df78e9733a3f
CRs-Fixed: 2228370
2018-05-30 01:42:30 -07:00
Jeff Johnson
c7bfa72ec1 qcacmn: utils: Fix misspellings
Address the following issues in the utils folder:
CHECK: 'interupt' may be misspelled - perhaps 'interrupt'?
CHECK: 'ommitted' may be misspelled - perhaps 'omitted'?
CHECK: 'TRESHOLD' may be misspelled - perhaps 'THRESHOLD'?

Change-Id: Ic9c2fdf2566f3bdd8c37906e52ed65d4dc1d1563
CRs-Fixed: 2241587
2018-05-19 22:14:43 -07:00
Jeff Johnson
5f255001d9 qcacmn: utils: Remove legacy markings
Per current guidance remove legacy markings.

Change-Id: I0bb870b4c83129d2466aeb4741d27783de888008
CRs-Fixed: 2230684
2018-05-18 02:17:50 -07:00
Pratik Gandhi
b002f889e7 qcacmn: Converge dbglog and diag_event_log
Converge dbglog and diag_event_log component through fwlog api
interface. It abstracts dbglog and diag_event_log from other
components.

Change-Id: I8f86a4381fbb9af8386320906337638113c8f189
CRs-Fixed: 2217556
2018-05-01 23:01:44 -07:00
Manjunathappa Prakash
9eaa6f099b qcacmn: Remove redefinition of *tx_flow_control_fp
ol_txrx_tx_flow_control_fp and ol_txrx_tx_flow_control_is_pause_fp are
redefined dp/inc/cdp_txrx_mob_def.h, original definition is in
dp/inc/cdp_txrx_cmn_struct.h. Remove duplicate redefinition.

Change-Id: I2c2af59d8b24360cd09efeb12ea19c0340771bb8
CRs-Fixed: 2215678
2018-04-04 04:02:08 -07:00
Vivek
2b109825ac qcacmn: Replace A_UINT with appropriate types
There are instances of use of older A_UINT/A_INT.
Replace all such instances with the qdf u_int*_t/int*_t.

Change-Id: I7ce29b03f29a0d1a0cf87cfd3c846f4694da4c2a
CR's-Fixed: 2210869
2018-03-26 04:58:12 -07:00
Rajeev Kumar Sirasanagandla
448e07a99e qcacmn: Fix integer underflow and buffer over-read in fwlog
Currently, there is no check of:
1) Firmware event parameters in dbglog_parse_debug_logs(), which can
result in integer underflow.
2) Number of dbg log args against the total length, which can result in
buffer over-read.

To fix this, compare size of firmware event parameters and number of
dbg log args with total buffer length.

Change-Id: I7fbc684ec9e80cfc66220755a1ad6b9394194735
CRs-Fixed: 2197246
2018-03-06 03:53:44 -08:00
Mukul Sharma
396cef7bcf qcacmn: Converge on wmi event registration / unregistration
Converge on wmi event registration / unregistration method.

Change-Id: If03a38d74a47cc1d900bc5734a7c8f950513efaa
CRs-Fixed: 2148479
2017-11-30 03:40:33 -08:00
Amar Singhal
287c86433e qcacmn: Check for buffer overflow for diag messages
Check for buffer overflow from diag messages.

Change-Id: I5ff85b24b0e26393343dc4cc4c41a9f84e6ba8e9
CRs-Fixed: 2129586
2017-10-31 17:39:04 -07:00
Amar Singhal
009d7f1ab2 qcacmn: Add size checks in diag_fw_handler
Correct the invalid type conversions in diag_fw_handler.

Change-Id: I930c8602c0f98d19b7276987cbb4d42e4757e267
CRs-Fixed: 2129581
2017-10-28 19:36:37 -07:00
Ajit Vaishya
2636384f2c qcacmn: Fix kernel check patch warnings in fwlog
Fix msm-4.4 kernel check patch warnings for fwlog module.

Change-Id: I84656de36b4b32d4e139021174ad8220cd6d845e
CRs-Fixed: 2041367
2017-10-12 14:22:09 -07:00
Dustin Brown
a46d9c69f2 qcacmn: Fix compilation issue when CNSS_GENL is enabled
A recent change added a wrapper to nla_parse. When CNSS_GENL is enabled,
this new wrapper API is not defined in cnss_diag_cmd_handler, causing a
compilation failure. Include the appropriate header file when CNSS_GENL
is enabled.

Change-Id: I2e929b48e306fb1426eb6e59011cd821922bb8dd
CRs-Fixed: 2112767
2017-09-22 13:20:45 -07:00
Linux Build Service Account
5b6fb9d48f Merge "qcacmn: Add ini param to control the crash inject" 2017-09-21 11:28:36 -07:00
Dustin Brown
1b57dba257 qcacmn: Add wrapper for nla_parse()
The Linux kernel version 4.12 introduced an API change to nla_parse().
Add conditional compilation to call nla_parse with the correct
parameters based on the version of the linux kernel being compiled
against.

Change-Id: Ie904d217a42a2396f8245251a9c90a15dac2c0c9
CRs-Fixed: 2093354
2017-09-15 15:26:31 -07:00
Ashish Kumar Dhanotiya
edd0890445 qcacmn: Add ini param to control the crash inject
qcacld-2.0 to qcacld-3.0 propagation

Currently the crash can be injected by iwpriv command and FW
gets crashed.
Changes are done to add the gEnableCrashInject ini parameter

1) This ini param is disabled by default.
2) If this param is disabled the crash inject is ignored.

Change-Id: I082ca4101806033958b10869f151d6085ca7a2d6
CRs-Fixed: 2084606
2017-09-06 00:09:37 -07:00
Sandeep Puligilla
5c1cc50c22 qcacmn: Fix compilation errors
Fix compilation errors after updating
latest dbglog.h file from fw.

Change-Id: I3defd4242d922364849041b35bddb3cca4f9a39a
CRs-Fixed: 2066361
2017-08-11 19:38:18 -07:00
wadesong
6211cb6b56 qcacmn: Fix build errors generated by gcc 6
Gcc 6 introduces some stricter checking for bool value
comparison, causing build errors when a certain code
block in CLD3.x driver is compiled.

Change-Id: I270e20dab8410f45e734c15d5365e30e314b55c8
CRs-Fixed: 2051383
2017-07-23 09:58:38 -07:00
Rajeev Kumar
e501f2c62f qcacmn: Create WMI debugfs only if WLAN_DEBUGFS is defined
WMI FW log debug FS is created irrespective of WLAN_DEBUGFS is defined
or not. Make sure to only create WMI log debugfs only if WLAN_DEBUGFS
is defined.

Change-Id: I8d7d5ef160ce2674b3f01dc7afa3ac4761538cab
CRs-Fixed: 2066664
2017-07-18 23:46:22 -07:00
Tushnim Bhattacharyya
3db6b3cc4e qcacmn: Avoid buffer overread when retrieving cnss diag cmd
In cnss_diag_cmd_handler(), add length check for the command attribute.
This prevents possibility of a buffer overread or underrun.
Also add audit comment to express the intent why policy table
is not used in this API.

Change-Id: I023bbf3789498f315fd1bff8db8ef8257abb2b04
CRs-Fixed: 2058580
2017-06-27 18:12:59 -07:00
Adil Saeed Musthafa
5a0a7073fd qcacmn: Limiting a function declaration within CONFIG_MCL
Function dbglog_set_log_lvl needs to be commented out for WIN compilation
since enum DBG_LOG_LVL is not converged. Functions nl_srv_bcast and
nl_srv_is_initialized needs to be exported out for pushing FW Diag Log
events to user-space (cnss-diag)

CRs-Fixed: 2048651
Change-Id: I57a4bd3d78680b97bd75191ca58349abeb77240a
2017-05-22 09:39:52 -07:00
Selvaraj, Sridhar
7c6b935c64 qcacmn: Add support to use generic netlink sockets for userspace apps
Currently user space communication functions[cnss diag, PTT socket app]
in host driver uses netlink user sockets which is a security concern from
Linux Android SE policies.

Add support for to use netlink family cld80211 which uses generic
netlink sockets.

Change-Id: Ia833249c1f312415e38563d90214979cea3d9f0e
CRs-Fixed: 2015931
2017-03-14 00:13:26 -07:00
Nishank Aggarwal
7aad6f68c7 qcacmn: Change default firmware log levels
Change default log level for all firmware modules and
also per module with a specific log level.

Change-Id: I33275f2737e0e56daea4e2edd8debca8016f1ed0
CRs-Fixed: 2013439
2017-03-04 16:57:13 +05:30
Srinivas Girigowda
60644c29e6 qcacmn: Add core\utils directory and files to qcacmn
As a part of UMAC convergence, move the core\utils logging to qcacmn.

CRs-Fixed: 1109855
Change-Id: I499a392f74f3e52e99df4d03e4a27bce6cf5be7c
2017-02-17 22:13:07 -08:00