Commit Graph

219 Commits

Author SHA1 Message Date
Rajeev Kumar
fd2ba9f34e qcacmn: Log qmi event id in hex for easier debugging
Log wmi event id received in QMI stats response in hex for
easier debugging.

Change-Id: I7812f6aa31ccaa8c186679cac49e7a0a192ac7f5
CRs-Fixed: 3199171
2022-05-18 23:01:53 -07:00
Kiran Venkatappa
ae6d816cbf qcacmn: Enable copy engine 14 for diag on qcn9224
Copy Engine(CE14) is used for diag events on qcn9224. Add changes to
configure this CE as dest ring and fix diag event handler to use
wmi_handle from first pdev similar to other WMI events.

Change-Id: I314939169f9be32cd277af68dcd3ef7a0eb06187
CRs-Fixed: 3177987
2022-04-28 06:50:18 -07:00
Manoj Ekbote
52cb1a0916 qcacmn: Change the return value for non-TLV targets
When non-TLV targets are used, the WMI event table is not populated.
So, it shouldn't be treated as fatal and WMI event register/unregister
functions can return NOSUPPORT instead of FAILURE.
Handle this value in TWT code.

Change-Id: I5bc8e7aae2e572c84ea0333c967cff527d5cbcc3
CRs-Fixed: 3145077
2022-03-29 12:22:35 -07:00
Vinod Kumar Myadam
212a7a89b8 qcacmn: Validate len param to fix ASSERT
Fix to validate the length param before calling wmi_buf_alloc

Change-Id: Iec4551576135aa8c4ed1597a1360804d55fddf96
CRs-Fixed: 3134025
2022-03-14 04:56:51 -07:00
Arun Kumar Khandavalli
d4239b89f6 qcacmn: Dont add the wmi header size while allocating the wmi buff
Currently whenever the wmi message is allocated the wmi header
length is also added to check with against the max size supported
by the firmware, there is no need to add the extra wmi header size
as the max length shared by firmware has the wmi header size
included.

Below is the breakdown:

Max CE2 transfer size is 2048 bytes
HTC header is 8 bytes
WMI header is 4 bytes

Max payload can be (MAX CE2 Transfer size - (HTC header+ WMI header)
                   (2048 - (8 +4)) =  2036

During the htc handshake this max wmi length is recevied by the host as
2040 bytes which is including the  wmi header so host adding the extra
4 bytes is redundant and can be removed.
HTC buffer->actual_length = 2036 + WMI(4) = 2040 bytes

Change-Id: Ib958a938506c5c96347dec5304ca30aa8690d459
CRs-Fixed: 3130493
2022-02-16 12:50:12 -08:00
Rajeev Kumar
3b085fd248 qcacmn: Clear num stats over QMI once WoW enter/exit
Num stats over QMI indicates how many stats requests are fetched
without triggering RTPM resume. If RTPM resume/suspend happens in
the middle then num stats over QMI counter should reset. Add logic
to reset num stats over QMI counter during WoW enter/exit.

Change-Id: I34fe93759bf8a7a2a6c0d4b389ad96b8e1ba4d6c
CRs-Fixed: 3110590
2022-01-21 20:03:54 -08:00
Karthik Kantamneni
b2d135c7fd qcacmn: Fix WMI DIAG event drop over CE7
When WMI diag events are received over CE7,
wmi handle is mapped to null and all the diag
events are freed without processing.

Fix this by properly mapping wmi handle when
diag events received over CE7.

Change-Id: I3dc4f7ce37981a31cb6f01fc66edf6248682bea3
CRs-Fixed: 3082960
2021-12-02 03:41:41 -08:00
Shwetha G K
926430802a qcacmn: Register DBR & Diag events on new CE
Waikiki facilitates a dedicated CE (CE14) for
direct DMA & diag handling purpose. Changes to
register the respective service handler to process
DBR and DIAG events from the target.

CRs-Fixed: 3057986
Change-Id: I4ae1d5676ac702d1f28f3e4031b47ffcd1d2ad7e
2021-11-14 01:46:03 -08:00
Aditya Kodukula
9e1d64a55f qcacmn: Add WMI Tx completed logs into the minidump
As part of minidump enhancement feature, incorporate
wmi_command_tx_cmp_log_buffer data structure into the minidump.

Change-Id: I323971cc397b3ec710152c774462c85900acc603
CRs-Fixed: 2950790
2021-06-21 23:14:16 -07:00
Jingxiang Ge
816f75d018 qcacmn: Limit rx diag event count in each work process
Current in wmi_rx_diag_event_work, rx diag event is processing
in a while loop, if there is continuous diag event comes from
fw, it is possible that it occupy the work queue, and other work
are not able to run.

Break the while loop so give a chance to other work.

Change-Id: I7af6d60aeb8c0524cc51d663658d5b17349daa60
CRs-Fixed: 2948839
2021-05-19 16:41:33 -07:00
Aditya Kodukula
f0b0951d8a qcacmn: Move Rx diag event processing to dedicated work queue
Firmware generates wmi Rx diag events every few milliseconds,
and processing the same in system shared work queue may lead to
work queue lock-up detection. Hence, move Rx diag event processing
to dedicated work queue.

Change-Id: I10cdde317794e35bc6d10677ab76ea24a66e1880
CRs-Fixed: 2941409
2021-05-11 19:22:07 -07:00
Pavankumar Nandeshwar
635a1c8eb9 qcacmn: update the wmi context during unregister
When unregistering wmi handlers, the position of the
old handler is replaced with the last handler in the table.
But at this stage only handler was getting replaced, but
not the context. Hence, make sure to update the context
as well.

Change-Id: If90ea9d7663fb105e8e8ad7d7e6c70da20264e44
2021-05-06 22:52:38 -07:00
Yeshwanth Sriram Guntuka
6611374cf4 qcacmn: Trigger sys wakeup for WMI command when WOW is enabled
DHCP packet is received in the IPA exception path when
system is suspending. As part of DHCP packet processing,
WMI_PEER_SET_PARAM_CMDID is sent to FW after WOW is
enabled resulting in self recovery getting triggered by
host.

Fix is to do an explicit system wakeup if a WMI command
has to be sent post WOW enablement.

Change-Id: If1904a4fe5c861deed1b35071be10cb8cc8d6407
CRs-Fixed: 2890913
2021-03-31 01:04:01 -07:00
Debasis Das
3c30b6dd2b qcacmn: Update WMI to use non-inline OS abstraction API's
Use non-inline OS-abstraction APIs to avoid direct call to
OS APIs in wmi.

CRs-Fixed: 2742480
Change-Id: Ic87a8e74ba7f8c0095821b0dd2e21f8eecb6833f
2021-01-28 06:19:38 -08:00
Bapiraju Alla
e1846078cd qcacmn: Remove duplicate set packet len for QMI event buffer
For QMI events qdf_nbuf_set_pktlen is invoked twice. Once in
wmi_buf_alloc and again in __wmi_process_qmi_fw_event. Remove
this duplicate set packet length.

Change-Id: I06c7e077fb1d554215a5ebc52f9d69a333a25a84
CRs-Fixed: 2859036
2021-01-22 01:33:04 -08:00
Bapiraju Alla
00678d250a qcacmn: Don't consider WMI_MIN_HEAD_ROOM in WMI msg length
Currently, Host driver assumes WMI_MIN_HEAD_ROOM is part of WMI
messages and Validations are done accordingly. But this
WMI_MIN_HEAD_ROOM is not considered in the firmware. Because of
this host may drop valid events.

To avoid this, Don't consider WMI_MIN_HEAD_ROOM while validating WMI
msg length.

Change-Id: I5f1fe12cfae570e636defb8a4a46ec154f988195
CRs-Fixed: 2844982
2020-12-29 15:49:55 -08:00
Bapiraju Alla
25509a1510 qcacmn: Request stats over qmi only when target suspend is success
Currently, Stats request commands are sent over qmi right from the
target suspend request is sent to FW. This is leading to a crash in
FW since it is trying to access PCI when it is in suspend state.

To address this, send stats request over QMI only after the ack is
received for the target suspend command.

Change-Id: Id7a79d52740916f66476bf911e571c0ff466c7d3
CRs-Fixed: 2838737
2020-12-17 11:44:33 -08:00
Srinivas Girigowda
7db601e3af qcacmn: Introduce wmi_validate_handle()
Introduce wmi_validate_handle() with the caller function name
embedded in it to validate the WMI handle and log incase
of error. Calling functions can avoid logging in case
wmi_validate_handle() returns -EINVAL. This reduces logging and
thereby memory foot print.

Change-Id: Ie0a6a84ffad6e5cf2da8f547c7209dc77cdf5729
CRs-Fixed: 2838960
2020-12-17 11:44:29 -08:00
Bapiraju Alla
97c6bdfd2a qcacmn: Flush Rx diag event work during idle shutdown
Currently, Rx diag event work is not being flushed during idle shutdown.
This may result in use after free access if the scheduled diag event work
gets the chance to execute after driver modules are closed.

To address this, flush diag events work during idle shutdown.

Change-Id: I348e80d2c86a5e070f0fb67d66b758529fede76c
CRs-Fixed: 2838020
2020-12-16 19:08:29 -08:00
Bapiraju Alla
debcd9c86d qcacmn: Discard QMI events when message with invalid length
Currently QMI message length is not being validated before
handling QMI event. This is resulting in illegal memory access
when QMI message length is invalid.

To address this, discard QMI events with invalid length.

Change-Id: Ia9f04bcb4fa3b365cbbf2be8885a8d30f78f8f10
CRs-Fixed: 2839277
2020-12-16 11:55:50 -08:00
Bapiraju Alla
197fc297c3 qcacmn: Add log while dropping FW diag events
FW diag events will be dropped when number FW diag events pending for
processing is reached to configured RX_DIAG_WQ_MAX_SIZE value. Add a
log when these diag events a getting dropped for debugging purpose.

Change-Id: Ifc303991bdf274fa7426794eaf71517722e9f386
CRs-Fixed: 2824458
2020-11-24 08:48:59 -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
Balaganapathy Palanisamy
0d9dc04d48 qcacmn: Stop wmi sequence check during SOC stop
Skip wmi sequence check during SOC stop and enable after
initializing wmi handle. It is required to skip sequence check
during soc stop as the endpoint flush is preceding CE flush.

CRs-Fixed: 2813341

Change-Id: Ieb821483e9786471d033773dc2365ab456345f83
2020-11-12 10:13:15 -08:00
Srinivas Girigowda
1aefc8972b qcacmn: Remove obsolete WMI_LOG(I/E/P/W/D) macros
Remove obsolete WMI_LOG(I/E/P/W/D) macros and
instead use wmi_(err/debug/info/alert/warn).

Change-Id: Ib401c5da873efc7a87323d9857d7f33989c3b29c
CRs-Fixed: 2776741
2020-11-03 13:17:04 -08:00
Bapiraju Alla
bc159feb4e qcacmn: Use wmi msg length to allocate WMI buffer for QMI events
For QMI events, recevid QMI event length is used to allocate wmi buffer
using wmi_buf_alloc. The received QMI event length includes WMI head
room and wmi_buf_alloc also try to reserve WMI head room again.
Because of this, WMI buffer allocation is exceeding max WMI msg length.

To resolve this, use length of the received actual WMI msg to allocate
WMI event buffer using wmi_buf_alloc.

Change-Id: Icd259988c4b1091580a35aaf2c3fabc606e0f2a9
CRs-Fixed: 2786326
2020-10-16 13:46:43 -07:00
Balaganapathy Palanisamy
766838ebaa qcacmn: Reset WMI sequence counter after recovery
Reset the WMI sequence counter after FW recovery to avoid
false assert due to CE pending packets freed in htc layer
instead of WMI completion handler.

CRs-Fixed: 2787424
Change-Id: I109ff56655e5fb428aca637e6420efed5943b3f7
2020-10-13 04:13:39 -07:00
Karthik Kantamneni
e26cc77333 qcacmn: Cleanup WMI DIAG over CE7 change
Cleanup changes for WMI DIAG over CE7 code

Change-Id: I4b2718e37ba16d62b585aa26c56213698078e25a
2020-10-13 04:13:36 -07:00
Manikanta Pubbisetty
f2ce9cfc04 qcacmn: log additional info to WMI TX completion record
Add WMI command buffer address information(DMA/Physical addr) to
the WMI TX completion logging. This will help in debugging issues
when HW DMAs copies data from a different location than the one
configured.

Change-Id: I60586b865a97e7ff88e48606806ec151321ff0aa
CRs-Fixed: 2789492
2020-10-09 02:14:33 -07:00
Rajeev Kumar
0d04766b88 qcacmn: Log WMI work queue call stack on WMI WD bite
Log WMI work queue call stack when WD timer expires to assist
in debugging on non slub debug enabled builds.

Change-Id: Id3dd575700ca586b0738a88ca2af88a757238d1b
CRs-Fixed: 2789114
2020-10-01 19:08:59 -07:00
Karthik Kantamneni
268ab400cd qcacmn: Add support for WMI DIAG events over CE7
Add support for handling firmware WMI DIAG events over CE7.

Change-Id: I3d6c0b08313e816809a65eb77d9728fc4b4488f3
CRs-Fixed: 2787010
2020-09-30 11:10:33 -07:00
Srinivas Girigowda
cdf81dddd3 qcacmn: Replace WMI_LOGD() with wmi_debug()
Replace WMI_LOGD() with wmi_debug().

Change-Id: I9c69cabfd84882fa1daff6e219de5f2643e7d214
CRs-Fixed: 2774563
2020-09-17 10:18:55 -07:00
Srinivas Girigowda
8c756066a7 qcacmn: Replace WMI_LOGE() with wmi_err()
Replace WMI_LOGE() with wmi_err().

Change-Id: I4c2e2c278101224a967080c073c46004ea60f5af
CRs-Fixed: 2774563
2020-09-17 10:18:52 -07:00
Srinivas Girigowda
e6d0bc490d qcacmn: Replace WMI_LOGI() with wmi_* appropriate log level
Replace WMI_LOGI() with wmi_* appropriate log level.

Change-Id: I7b0c32a2aefc5eb300348edbc6a60e7ad0401439
CRs-Fixed: 2774563
2020-09-17 10:18:48 -07:00
aloksing
a9d5d1ee00 qcacmn: Change return type to QDF_STATUS
wmi_unified_register_event return QDF_STATUS

CRs-Fixed: 2764185
Change-Id: I266e5042ff45ba33ab5d53592515bceb4fec92ac
2020-09-15 18:24:32 -07:00
Jhalak Naik
41e8d82db9 qcacmn: Hex dump generation for WMI events and commands
This records all the WMI events and commands, for all
PDEVs. Set WMI_EXT_DBG flag to enable this feature. Refer
Original Change-Id: I18e46f683e35912cad717ca3b9cc3d1885315362

Change-Id: I4c9bdfe6fdd195656ca0c01ca400eba595be24a3
CRs-Fixed: 2762266
2020-09-15 11:38:47 -07:00
Balaganapathy Palanisamy
55650d9c02 qcacmn: Add sequence number for WMI pipe
Add sequence number to each packet queued on wmi pipe and
match it against expected sequence number in wmi completion handler.
WMI packets are consumed internally, use the skb mark field to capture
the sequence number of the wmi packet.

Change-Id: I1421e3fcff0a2b326f6d899780c773950544ef26
CRs-Fixed: 2741465
2020-09-07 03:18:00 -07:00
Balaganapathy Palanisamy
e5b0acba4d qcacmn: Add config option for each WMI log buffer size
Make each WMI debug log buffer size configurable through
compile time config option. Now memory constraint platforms
can use these config options. Use default values if no
values are configured.

Change-Id: Ibc924e12a56ae7d529aea91e55bcc0bbce72ac7e
CRs-Fixed: 2741465
2020-09-03 01:58:47 -07:00
Uraj Sasan
0ba27943fb Revert "qcacmn: Hex dump generation for WMI events and cmds"
This reverts Change-Id: I18e46f683e35912cad717ca3b9cc3d1885315362

Change-Id: I2fffecdee294f08e694b12a744d35cf18d3fd66b
2020-09-01 01:49:45 -07:00
Jhalak Naik
8e4491a9ac qcacmn: Hex dump generation for WMI events and cmds
Support WHUNT FW simulation feature.
Records all the WMI events and commands, for all PDEVs.
Set WMI_EXT_DBG flag to enable this.

Change-Id: I18e46f683e35912cad717ca3b9cc3d1885315362
CRs-Fixed: 2762266
2020-08-28 13:03:54 -07:00
aloksing
f103f00807 qcacmn: Add raw buffer support in WMI layer
To send received raw event buffer to event handler
Send without processed buffer to registered event with buffer
type WMI_RX_RAW_BUFF

Change-Id: I2a401e2e7afbfd8f32d4bd521d184ed9ddcdb264
2020-08-21 02:28:57 -07:00
Min Liu
44150359c9 qcacmn: Move get_peer_info into cp_stats component
Move WMI_REQUEST_PEER_STATS_INFO_CMDID related statistics into
cp_stats component.

Change-Id: Ie57f64e4ee195de30271260887c48ecf76f4a2ff
CRs-Fixed: 2680626
2020-08-14 04:12:25 -07:00
Alan Chen
07789085f8 qcacmn: Add an ini item for stats over QMI
Currently, stats over QMI features can only be disabled over build flags,
which is not flexible. Hence, add a CFG ini item to enable/disable stats
over QMI.

Change-Id: If5d57d2fc781fecc8817c2da8f61a2f7977d9c77
CRs-Fixed: 2752310
2020-08-12 19:53:19 -07:00
Rajeev Kumar
30a3c984d0 qcacmn: log wmi cmd id in hex when cmd is sent over qmi
WMI commands are logged in hex in FW and hence log WMI CMD ID
in hex when stats request is send over QMI to assist in debugging.

Change-Id: I9ce63db30b491f26b9d6ac7ae3c98e6177452d7c
CRs-Fixed: 2733208
2020-08-05 17:35:18 -07:00
Shwetha G K
4876ce33bf qcacmn: Add support for wmi_ext2 service bitmap
Add support for wmi_ext2 service bitmap

Change-Id: I2c147b91e11c2487027a7af88ff1752c7b48730b
2020-07-28 17:39:06 -07:00
Arun Kumar Khandavalli
1eb43f3787 qcacmn: remove panic if the tag length and filled data are not matching
Remove panic when tlv doesn't matching attributes, the following commit
takes away a chance to pass invalid values tlv to test the the wmi event
hence reverting commit ca24670e56.


Change-Id: Iafff2067288c8a6fafa016f21b1d7fdfdcb0753e
CRs-Fixed: 2706245
2020-06-10 11:53:35 -07:00
Arun Kumar Khandavalli
ca24670e56 qcacmn: Crash if the tag length and filled data are not matching
Whenever a wmi even it received the tlv received from the firmware
will be sanitized, if there is any error the event would be dropped.
This dropping of the event can give side effects in the host/firmware
after some time and making it difficult to find the actual reason of
why the tlv is not received properly.

Crash the system if the tlv is not parsed correctly to debug the issues.

Change-Id: Ic56e3f96252ac74917caeebc8296c2b50ae4f3cd
CRs-Fixed: 2695053
2020-06-07 03:13:54 -07:00
Lincoln Tran
d7ffb6df23 qcacmn: Update wmi_discard_fw_event
Update return type of wmi_discard_fw_event to return QDF_STATUS
to match scheduler_msg_process_fn_t.

Change-Id: Iba2d41c4bab2bfd5fb163d82fca6c6b895e5a2a4
CRs-fixed: 2699644
2020-06-02 03:22:52 -07:00
Jianmin Zhu
bd4a9fe637 qcacmn: Handle WMI_REG_CHAN_LIST_CC_EVENTID in worker thread
Somtimes F/W event WMI_REG_CHAN_LIST_CC_EVENTID comes for country
code changed before WMI_READY_EVENTID processed completely in
worker thread, to update current channel list,
hdd_regulatory_dyn_cbk is invoked in scheduler thread and wiphy
is extracted from pdev which isn't attached to pdev yet, assert
will happen.

WMI_READY_EVENTID and WMI_REG_CHAN_LIST_CC_EVENTID
should be serialized, both of them should be handled in same
context, such as worker thread.

Set WMI_REG_CHAN_LIST_CC_EVENTID execution context same as
WMI_READY_EVENTID: WMI_RX_WORK_CTX.

Host F/W handshake during init:

	Host <- FW WMI_SERVICE_READY_EVENTID
	Host <- FW WMI_SERVICE_READY_EXT_EVENTID
	Host -> FW WMI_INIT_CMDID
	Host <- FW WMI_REG_CHAN_LIST_CC_EVENTID
	Host -> FW WMI_SET_CURRENT_COUNTRY_CMDID
	Host <- FW WMI_READY_EVENTID
	Host <- FW WMI_REG_CHAN_LIST_CC_EVENTID

Change-Id: I922e5f2a9722e9b441cc844dd38b1039dd4d8900
CRs-Fixed: 2689274
2020-05-21 14:13:48 -07:00
Balamurugan Mahalingam
049211d0b2 qcacmn: reset tag_crash_inject in wmi_handle during recovery
The stale value of this field blocks driver from sending
FW_HANG wmi messages to target after recovery

Change-Id: Ib44388c5c95c2574c96117b77fdabda26f5890bd
2020-05-07 00:06:58 -07:00
Adil Saeed Musthafa
60d18029b6 qcacmn: Add API to check if WMI is blocked or not
Add API to check if WMI commands have been blocked

Change-Id: I675b102b74d607332acf8a417c0c94955cbd5ecd
CRs-Fixed: 2662158
2020-04-24 08:57:39 -07:00