Commit Graph

61 Commits

Author SHA1 Message Date
sheenam monga
727bee12fc qcacmn: Fix possible OOB in wmi_extract_dbr_buf_release_entry
Currently in function wmi_extract_dbr_buf_release_entry,
num_buf_release_entry & num_meta_data_entry are copied
to direct_buf_rx_rsp structure without any validation which
may cause out of bound issue if num_buf_release_entry or
num_meta_data_entries provided in fixed param becomes greater
than actual number of entries.

Fix is to validate num_entries and num_meta_data before populating
param->num_buf_release_entry and param->num_meta_data_entry.

Change-Id: I18050fd4f90f8815d7eceb5f715fdbaa09130d3a
CRs-Fixed: 3000875
2021-08-05 08:29:06 -07:00
Wu Gao
edb2db465f qcacmn: Add exit log for target_if_dbr_fill_ring
It takes long time to init DBR, so add more log to trace the time when
exit target_if_dbr_fill_ring.

Change-Id: I9ec76c92db209a44c277b0f9e1840e6dd0132559
CRs-Fixed: 3002654
2021-08-02 07:06:36 -07:00
Wu Gao
e7c7eb280a qcacmn: Add more debug information when get invalid paddr
When host failed to find out vaddr by paddr from FW, output more
information for debug further.

Change-Id: I65c4965c12c2ffa3fe2a26a82df01d1b91501c73
CRs-Fixed: 2925194
2021-05-04 15:04:24 -07:00
Shashikala Prabhu
6dac66bcbf qcacmn: Fix compilation error when DIRECT_BUF_RX is disabled
Fix compilation errors when DIRECT_BUF_RX_ENABLE compile-time flag is
disabled.

Change-Id: I2bbce6eb8838ecab02b6462c1c0ee28877accdb4
CRs-Fixed: 2883310
2021-03-02 05:36:48 -08:00
Karthik Kantamneni
93f7aa1869 qcacmn: Fix DBR srng undefined address passed to F.W
DBR srng details are not sent properly to F.W via WMI_DMA_CFG_REQ
msg, this leads to F.W accessing undefined address.
Fix this by passing DBR srng details properly.

Change-Id: I15b393ad809dc0757e3637558f0bddd05530149d
CRs-Fixed: 2861621
2021-01-25 17:00:49 -08:00
Shiva Krishna Pittala
8f4dceb4bc qcacmn: Direct Buf Rx changes to support big-endain platform
Use the hal_srng APIs that handle byte-order conversion of ring pointers
for big-endian platforms.

Change-Id: I2664636d5d2a1abfd7b643ea4c4d63d328a9880f
CRs-Fixed: 2845047
2020-12-28 13:07:06 -08:00
Shiva Krishna Pittala
ee5f45a176 qcacmn: Read the Direct Buf Rx tail pointer in the Host order
Direct Buf Rx has a source ring to communicate with the target.
The target updates its tail pointer in little-endian format and this update
doesn't go through any byte-order conversion at the target. On a big-endian
Host platform, this tail pointer will be read in reverse order of bytes.
To fix this, convert the tail pointer to the Host order before using it.

Change-Id: Ibcaf3d7507910ea81eeb895772241ab9861ee45a
CRs-Fixed: 2843259
2020-12-22 10:44:16 -08:00
suresh velagapudi
e3d67b3edc qcacmn: Sanity Check to avoid NULL pointer dereference
If module is not registered for dbr in any platform it
results into  Null pointer dereference.

Added Sanity check to avoid Null pointer dereference for
cfg80211tool wifi0 g_dbr_ring_status.

Change-Id: I9e68dfc9d58d70693184f53913cd7f2324d788c1
2020-12-09 10:55:31 -08:00
Shiva Krishna Pittala
d78db319d7 qcacmn: Direct DMA changes for big endian Host
WLAN chip components are little-endian based. When such a chip is attached
to a big-endian Host platform, there will be a mismatch in the order of
bytes for the data that is transferred between the Host and target.

Direct DMA framework writes 64-bit values to its DMA ring entries.
These DMA ring entries are present in the shared memory between the Host
and the FW and the data transfer doesn't go through any copy engine.
So, to avoid invalid reads at the FW side on a big-endian platform, write
ring entries in little-endian format so that the FW reads them correctly.

Change-Id: I9c9189f914fdda335723c25fc05484487985447c
CRs-Fixed: 2828746
2020-12-07 07:06:43 -08:00
Alok Singh
8ae5bcc124 qcacmn: Change return type to QDF_STATUS
wmi_unified_register_event return QDF_STATUS
Handle same return type in caller function

CRs-Fixed: 2764185
Change-Id: If77efc6a5b451bf2cf4acb59d5a2126ce486f02f
2020-09-15 18:24:52 -07:00
Rakshith Suresh Patkar
2bd4ec3c09 qcacmn: Add debug log to trap unsuccessful dbr vaddr lookup
In direct buf rx, if physical address is not intact or
is corrupt, the dbr lookup for vaddr will fail and result
in vaddr being NULL. There is no validation for this vaddr
in the caller and hence results in NULL access in the
callstack.

Add debug log and return error status when dbr
vaddr lookup fails, which indicates that there is
corruption in paddr received and avoid NULL access.

Change-Id: I76ee300ce3e686765dd5c4ee73fa71d1735c163a
CRs-Fixed: 2748529
2020-08-05 17:35:15 -07:00
Surabhi Vishnoi
bb9b9ec907 qcacmn: Compilation fixes when WLAN_CFR_ENABLE config is enabled
For adrastea targets, enhanced CFR is not supported. When only
CONFIG_WLAN_CFR_ENABLE is set, some compilation errors are
observed as CONFIG_WLAN_ENH_CFR_ENABLE is not set true.

Fix these compilation errors when only CONFIG_WLAN_CFR_ENABLE
is set for targets which do not support enhanced CFR.

Change-Id: I96a769d8f10144033e48e123bb68d48a54cdf8ab
CRs-Fixed: 2706904
2020-07-17 17:23:23 -07:00
Neha Bisht
4bda764146 qcacmn: remove dependency of public files from wlan_objmgr_psoc_obj.h
Remove dependency of wlan_lmac_if_def headerfiles from
wlan_objmgr_psoc_obj.h

Change-Id: Ibe2f22c4b4f22b15eef201d1a42844ccf2931fef
2020-05-15 10:41:50 -07:00
Arun Kumar Khandavalli
7c3ce2d05f qcacmn: Selectively reduce the dbr logs
Reduce loglevel of some logs from info to debug.

Change-Id: Id4cc241b48defeb5abb122a8c50ef4e81fff9760
CRs-Fixed: 2607982
2020-01-27 02:39:05 -08:00
Surya Prakash Raajen
ed8ea05a7e qcacmn: Clear console log boot up error prints
Clear console log boot up error prints by removing unnecessary
prints, modifying prints to appropriate info or debug and
by fixing the errors

Change-Id: Ica3f126280399eef59b894236849e2079a62565f
CRs-Fixed: 2597026
2020-01-21 00:29:08 -08:00
Manoj Ekbote
b91d7bee26 qcacmn: Store DBR pdev objects in psoc
In dynamic HW mode switch feature, DBR pdev object of primary device
needs to be re-assigned after HW mode change. Store the DBR objects
in psoc for all devs and then use the mapped pdev to retrieve the
corresponding DBR object.

Change-Id: Ie56bdf9d430a5a3ca7e4e9a872018257d032c908
CRs-Fixed: 2589447
2020-01-02 13:09:39 -08:00
Shwetha G K
29121213c8 qcacmn: Add debugfs support for DBR ring debug
For each DBR ring, add debugfs entry to dump at real-time the ring
parameters like head, tail index, the timestamps at which a buffer is
received and replenished. Issues that are specific to tail index
movement from the target can be identified with this debugfs entry.

CRs-Fixed: 2466514
Change-Id: Iafbc61726264464212cb783a1cce46e16b8a48ff
2019-12-02 00:42:54 -08:00
Shwetha G K
215bac70f5 qcacmn: Add poisoning support for DBR buffers
Improper/incomplete DMA by the target affects the functionality of modules
that are using DBR framework. Add debug infrastructure to poison DBR
buffers with a given poison value before handing buffers over to
the target. Buffer owner modules can explicitly check for the poison
value in order to detect the improper DMA.
All modules that use DBR framework can use this debug infrastructure.

Change-Id: Ib3923c13202990e0f1198645b680c44a20736167
CRs-Fixed: 2466518
2019-12-02 00:42:41 -08:00
Shwetha G K
df696de7cc qcacmn: Add support to track DBR ring index movement
Add debug infrastructure to track the movement of head and tail pointers
of the DBR ring along with the time at which each buffer is received and
replenished. All modules that use DBR framework can use this
infrastructure. Issues that are specific to tail index movement from
the target can be identified with this debug infrastructure.

CRs-Fixed: 2439460
Change-Id: I6b486a73cf6a3174dfa297f8fb370fd298b46b67
2019-12-02 00:42:31 -08:00
Guisen Yang
2b07141773 qcacmn: Fix the build failure of illegal usage of log
In function target_if_direct_buf_rx_register_events(), the
API direct_buf_rx_info() is used to record log, but the
format is wrong. Fix the log format.

Change-Id: I81bc128e110570d96ca95dfbe773121272eb2588
CRs-Fixed: 2547235
2019-10-28 04:16:27 -07:00
Wu Gao
5988e8b7d2 qcacmn: Remove unnecessary logs in loop
There is unnecessary logs in loop which affect useful log capturing.

Change-Id: I37b2c8123a280e4ec080ac1fb75e43135936fd79
CRs-Fixed: 2552104
2019-10-27 19:27:56 -07:00
Nisha Menon
5acef23430 qcacmn: Assert due to excessive logs
Exceeded 500 logs per second in target_if_get_dbr_data().
Move the info level logs to debug level in direct buf rx as
heavy logging is triggering an assert.

Change-Id: I725bd50f83dc65f4e5378c4a882829a0ad1b7893
CRs-Fixed: 2534298
2019-10-03 00:21:04 -07:00
Wu Gao
b63edc6a49 qcacmn: Fix compilation issue about dbr_get_pdev_and_srng_id
There is compilation issue about dbr_get_pdev_and_srng_id on hasting
platform, fix it in this change.

Change-Id: Icd5612c31341e6a5f71c65f1ec10533c164798c3
CRs-Fixed: 2530729
2019-09-23 06:03:56 -07:00
Wu Gao
fe2a6185ad qcacmn: Support multiple srng per module in DBR
It required to support multiple srng per module in direct buffer rx
component.So extend the array "dbr_mod_param" in dbr pdev object and
let it to support two more srngs per module.

Change-Id: Ia2c649dacc3787cdc13b06f0b22c1c175fb451cc
CRs-Fixed: 2523365
2019-09-17 16:30:21 -07:00
Debasis Das
285561b9ab qcacmn: Support dma_ring_caps info processing
EXT2 event carries the dma_ring_caps info.Necessary
support to process the same is being provided.

Change-Id: Id8ef1840470b272db00fa5e8f98d1fe9dc273a7e
2019-09-17 12:12:43 -07:00
Edayilliam Jayadev
78285d3861 qcacmn: Get WMI handle from pdev instead of psoc
Get WMI handle from pdev instead of psoc.

CRs-Fixed: 2510822
Change-Id: If6f191403b7f3245b3f26969d195ab4ec8793fc4
2019-08-29 22:11:04 -07:00
Shashikala Prabhu
ec527358c2 qcacmn: Fix issues in qdf aligned memory alloc function
1. Alloc size should be passed as input and output parameter since we need
   to pass the exact alloc_size while freeing the memory.

2. use qdf_align() to calculate the aligned physical address.

3. In DBR component, pass correct arguments to qdf_aligned_malloc() to fix
   the compilation errors.
   Alloc size should be passed as input and output parameter since we need
   to pass the exact alloc_size while freeing the DMA memory.

Change-Id: I83051b8aa54bbf3bb663902d8f17f2c3c55e57bf
CRs-Fixed: 2462441
2019-08-26 00:26:56 -07:00
Wu Gao
46aa5afbb3 qcacmn: Fix compilation errors for DBR enable
Fix compilation errors for direct buffer rx component enable.

Change-Id: If0913b8357267fa65e61e0c7d197025ff850930b
CRs-Fixed: 2497783
2019-08-09 13:04:45 -07:00
Wu Gao
c86454bc00 qcacmn: Reduce the log level in direct buffer rx
Frequent log in direct buffer rx component will cause platform assert,
so lower the log level. Get wmi handler by psoc since since pdev
creation is in progress and it doesn't have related information yet.

Change-Id: Iaaf5a43642f9b6dfaf07ddd3f158abd346903a87
CRs-Fixed: 2495249
2019-08-08 11:38:03 -07:00
Himanshu Batra
0a35a6afb8 qcacmn: Replace void * wmi_hdl with abstract type (6/10)
Replace void * wmi handle with abstract type handles
provided by wmi component

Change-Id: I503438fbaf3bc2d475798bc908a70902d11881af
CRs-Fixed: 2482568
2019-07-18 14:23:04 -07:00
Akshay Kosigi
dc8e095f30 qcacmn: Fix for removal of common_wmi_handle
Add changes to remove usage of common_wmi_handle
Instead use wmi_unified_t as opaque pointer

Change-Id: I85ae8581ce8e4f7fd02fb753e3f482f8a6edebac
2019-06-20 12:00:00 -07:00
Pragaspathi Thilagaraj
a7c83f7401 qcacmn: Fix possible OOB in target_if_direct_buf_rx_rsp_event_handler
The function target_if_direct_buf_rx_rsp_event_handler() handles
the WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID event from target.
This function calls extract_dbr_buf_release_fixed_tlv() to copy
the module id, pdev id number of buffer release entry and number
of meta data release entries. The value of module id is used to
index the array dbr_mod_param to get the value of mod_param.
So if the module id value greater than dbr_pdev_obj->num_modules
could result in possible OOB.

Validate mod_id received in the fixed param of the event
WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID against
dbr_pdev_obj->num_modules.

Change-Id: I1c2c0a2a9c98d8b787496aba7a7c4f8fd781de16
CRs-Fixed: 2428798
2019-05-16 12:43:19 -07:00
Abhiram Jogadenu
d2077da875 qcacmn: Add direct rx buffer changes for CFR requirements
CFR requires to configure the number of DBRs that can be packed
in a single DBR event. Currently, this is fixed value.
Make this configurable at the time of registration.

CRs-Fixed: 2415489
Change-Id: Ifcd606641f986a5345f8ccb361c3f45db07fdc37
2019-04-02 15:16:01 -07:00
Jeff Johnson
eee26f7b76 qcacmn: target_if: 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 target_if replace any such comparisons with
logical operations performed on the pointer itself.

Change-Id: I436bb3ec12d331df2260507b6a9afbab84a8a54f
CRs-Fixed: 2418256
2019-03-29 00:48:05 -07:00
Abhiram Jogadenu
c528145962 qcacmn: Add support for peer tx event param extraction
Add host's copy of peer cfr tx completion event param and prototype for
extract API.

CRs-Fixed: 2406064
Change-Id: I433171fc90d3c5dbb92dd525e8b5b2c441cc1bf9
2019-03-04 15:48:08 -08:00
Kiran Venkatappa
22b6ccb1ae qcacmn: Add direct rx buffer changes for CFR requirements
CFR needs to correlate data received from direct dma ring and WMI event
for tx completion. These two events can come in any order. To facilitate
correlation CFR module has to hold on to the buffer until both events
are received and then replenish buffer back to direct dma ring. To
facilitate this requirement direct rx buf module is modified to change
callback return to bool to indicate whether buffer can be replenished
immediatley or not. Also add API to indiciate buffer release/replenish
later.

Change-Id: I848c0e7cf0118156fff7cf37ac9027cdf8e2e416
CRs-Fixed: 2403395
2019-03-04 04:00:43 -08:00
Abhiram Jogadenu
db3bb4b4a7 qcacmn: Add extract API for ring params from DBR
Extract ring parameters using dbr_rx_ops for functions in umac.

CRs-Fixed: 2404710
Change-Id: I6fa02668b4fead35ace9e1b4886954ca4cca09c6
2019-02-27 03:13:49 -08:00
Abhiram Jogadenu
880ba01add qcacmn: Add target_if support for CFR
Add target_if support for CFR.

CRs-Fixed: 2372061
Change-Id: I8ad14d714306acc20c9a7e09c8d6f17f7caeae16
2019-02-20 06:21:18 -08:00
Madhvapathi Sriram
0c5bdd7e73 qcacmn: Remove error log for qdf_mem_malloc in target_if files
qdf layer already has the error trace

Change-Id: I2d752fafb6ee805206047bae9711aa0387f22f69
CRs-Fixed: 2376430
2019-02-11 02:30:02 -08:00
Edayilliam Jayadev
2bee1aa8ad qcacmn: Add unregister API for direct buf ring
Add Unregister API to de-register and free resources in direct buf
module. Existing logic of freeing all resources as part of pdev destroy
does not take care of soc_start and soc_stop scenarios. Add this API to
enable modules to de-register as part of soc_stop and register during
start.

CRs-Fixed: 2385313
Change-Id: Ibe6f6bc5f4bd2acc5a9fe71eee09c151853073bc
2019-02-01 10:33:51 -08:00
Edayilliam Jayadev
33b7c9a31d qcacmn: Fix KW isssues in Direct DMA
Fix KW issues in Direct DMA module.

CRs-Fixed: 2366231
Change-Id: I091d6b451c142928743ff29a1e463321bad7bf4c
2018-12-16 21:36:46 -08:00
Shashikala Prabhu
dae5623949 qcacmn: Use qdf API to allocate aligned memory for direct buffers
In target_if_dbr_fill_ring(), min_buf_align (8 bytes) was added to
min_buf_size before allocating the memory for dbr_buf_pool. This leads to
extra 1MB allocation.

To avoid this extra allocation, call qdf_aligned_malloc() to allocate
aligned memory for direct rx buffers.

Change-Id: I72f7c616c7a699437b081de7149a4a67a3ad30c4
Acked-by: Shashikala Prabhu <pshashik@codeaurora.org>
CRs-Fixed : 2336697
2018-11-22 00:43:55 -08:00
Venkata Sharath Chandra Manchala
443b9b4da2 qcacmn: Print HP/TP Stats
Extend txrx_stats to print current HP/TP
Status for UMAC rings.

Change-Id: I50332f7507fdf1841dee51f0b1e97ef4ea68f04f
CRs-Fixed: 2332191
2018-11-13 06:56:15 -08:00
Shiva Krishna Pittala
3e4f08be93 qcacmn: Increase the DBR_NUM_RESP_PER_EVENT to 2
Increase the number of repsonses per dbr event to 2 to
support Spectral scan in 160MHz mode

Change-Id: I47ee933b06d94a9a02f7d448b631dfdb99e297c4
CRs-Fixed: 2297498
2018-10-31 11:50:48 -07:00
Sathish Kumar
a8dcd50683 qcacmn: Featurize WMI APIs and TLVs that are specific to WIN
In the existing converged component, WMI TLV APIs are implemented in
a generic manner without proper featurization. All the APIs exposed
outside of WMI are implemented in wmi_unified_api.c and all the APIs
forming the CMD or extracting the EVT is implemented in wmi_unified_tlv.c.

Since WIN and MCL have a unified WMI layer in the converged component and
there are features within WIN and MCL that are not common, there exists a
good number of WMI APIs which are specific to WIN but compiled by MCL and
vice-versa. Due to this inadvertent problem, there is a chunk of code and
memory used up by WIN and MCL for features that are not used in their
products.

Featurize WMI APIs and TLVs that are specific to WIN
- Air Time Fareness (ATF)
- Direct Buffer Rx (DBR)
- Smart Antenna (SMART_ANT)
- Generic WIN specific WMI (AP)

Change-Id: I7b27c8993da04c9e9651a9682de370daaa40d187
CRs-Fixed: 2320273
2018-10-05 02:14:04 -07:00
Nirav Shah
1b9674e21e qcacmn: umac: Add logging macros without function/line info
Add per module logging macros without function/line info
to avoid adding function/line info where it is not required.

Change-Id: I34ba6f6485f9b506264daf4e116052d2858bed40
CRs-Fixed: 2278876
2018-08-14 21:44:21 -07:00
Nirav Shah
87668f872b qcacmn: Add compilation flag for enter/exit macros
Map all enter/exit log macros to enter/exit QDF TRACE macro
to provide option to compile out enter/exit logs if required

Change-Id: I913ef0fb2486fde6b2ec4dfe8465884ca4d66ce4
CRs-Fixed: 2274857
2018-07-25 09:40:54 -07:00
Shiva Krishna Pittala
0baf52bdf7 qcacmn: Fix buffer alignment check in target_if_dbr_replenish_ring
target_if_dbr_replenish_ring should check the mapped physical address for
agreed byte boundary alignment. Fix the logic in the check.

Change-Id: I05058ae69df8a2ee2caf9ce1295c0a2e9026511c
CRs-Fixed: 2283230
2018-07-25 04:34:46 -07:00
Nirav Shah
a175314c51 qcacmn: Map all module logs to per-level log APIs
Map all module level log APIs to per-level log APIs
to compile out specific log level if required.

Change-Id: I4072b6740cb43200fd95c40943b66e1d5f8f1847
CRs-Fixed: 2266719
2018-07-13 10:36:22 -07:00
Sathish Kumar
5cf9805bc3 qcacmn: Changes in direct buffer Rx module
1. Add support upto 2048 buffers in the ring
2. Add API to print current ring status per module per pdev
3. Start module ID numbering from 0

Change-Id: I7954007c6c486877ffb2ab91724885af2fbaab8c
CRs-Fixed: 2263968
2018-06-25 03:17:55 -07:00