Commit Graph

86 Commits

Author SHA1 Message Date
Yeshwanth Sriram Guntuka
b2fa2a1dbd qcacmn: Increment htc runtime cnt prior to hif_send_head
HTC runtime count is incremented after posting the HTT
ver req message to CE4. There could be possibility of
processing the ver response message from FW even before
htc_runtime_cnt is incremented. This can casue RTPM put
to not happen causing imbalance in get/put count.

Fix is to increment htc_runtime_cnt before enqueuing
the HTT message to CE.

Change-Id: Ib9b69910cd14193c41ecfee804b390f8a6cdef49
CRs-Fixed: 2794451
2020-10-12 15:06:33 -07:00
hqu
ba45fe7e2c qcacmn: Fix implicit-fallthrough compile error casued by gcc 9.3
Compiling with gcc 9.3 will cause many implicit-fallthrough
compile errors.

Fix is to add keyword fallthrough to resolve such compile error.

Change-Id: I2e7dd1525861d951e3be44f6665e149499f0f5d6
CRs-Fixed: 2785178
2020-10-08 12:24:02 -07:00
Yeshwanth Sriram Guntuka
478749a365 qcacmn: Do RTPM put during cleanup when HTT ver resp is not received
For HTT h2t message which has a response from FW, runtime
get is done in HTC layer and the corresponding runtime_put
is done as part of the HTT response processing. In a scenario
where the HTT response is not received from FW or not processed
by host, runtime_put is not done as part of cleanup and panic
is triggered due to get/put imbalance.

Fix is to do RTPM put as part of htc cleanup when the HTT
response from FW is not received or processed.

Change-Id: I17ccb7c3e2293c95f5f233d36c6ef38a75733cce
CRs-Fixed: 2779113
2020-10-02 10:37:14 -07:00
Yeshwanth Sriram Guntuka
86084af159 qcacmn: Do runtime_get_sync in htc_kick_queues
Interface down is received when wlan is in runtime
suspend state. The wmi commands that have to be sent
as part of this cause a runtime resume and the htc tx
queues are processed within runtime_resume callback.
The work that is scheduled for this tries to do a
runtime_get as part of htc_try_send but the runtime_status
is still in resuming state causing EINPROGRESS return
value. This will result in the wmi commands to be not sent
to firmware and eventually resulting wmi command timeout.

Fix is to do runtime_get_sync in htc_kick_queues.

Change-Id: I1f4ba1c3dad32f7c407c4416529424be6d4bf18d
CRs-Fixed: 2711998
2020-06-25 18:14:01 -07:00
Neha Bisht
f224d5dc91 qcacmn: Introduce counters per endpoint to improve HTC debuggability
To introduce counters htc_send_cnt and htc_comp_cnt per endpoint to
enhance pdev level debugging in HTC path.

Change-Id: I8d31e3a533e0f8de4c89d3609b20c148aef3a4ff
2020-06-25 15:08:09 -07:00
Ke Huang
b404458d20 qcacmn: Add NULL pointer check for KW issues
Add NULL pointer check in function hif_send_single() and
htc_dump_counter_info() for KW issues.

Change-Id: I4b020c566b14b28a825c13752dccf67b5f8bb837
CRs-Fixed: 2675205
2020-05-29 03:13:53 -07:00
Jingxiang Ge
b75ec972c4 qcacmn: Fix regression issue for EAPOL fail
This is regression issue.
regression cause I24cddb9d10e4cb675c8375cbd0f589c7718bd680.

Issue happens in get_htc_send_packets, and it is possible
htc_packet_dequeue but hif_pm_runtime_get failed as suspend
state.

Revise to original logical before regression change.

Change-Id: I74c309d7a3decdd6fe905e9f1e61916905876aec
CRs-Fixed: 2663338
2020-04-19 01:14:01 -07:00
Jingxiang Ge
e7d41574f3 qcacmn: Add dbgid for each runtime put/get
This is to enhance statics for runtime put/get, which is
to detect if there is mismatch for usage_count.

Change-Id: I24cddb9d10e4cb675c8375cbd0f589c7718bd680
CRs-Fixed: 2647972
2020-04-07 01:20:41 -07:00
Manoj Ekbote
1c1ef8c2bd qcacmn: Print re-queue message based on threshold
When packet tx fails at transport layer, packet is re-queued and given to
HIF layer again. In this change, print the warning message about re-queue
only when tx fails for 5 consecutive attempts due to no resources
available at HIF layer.
Since re-queuing is not fatal, it need not be printed on every attempt.

Change-Id: I00082470420e29dfe4fb7a745ac709a682ba032e
CRs-Fixed: 2621763
2020-03-26 20:18:56 -07:00
Yeshwanth Sriram Guntuka
e71aeae1bd qcacmn: Set FIXUP_NBUF flag only on successful nbuf map
In the scenario where nbuf_map fails during packet
send in htc_issue_packets, restore_tx_packet done
as part of cleanup, does nbuf unmap even though map
failed.

Fix is to set the fixup_netbuf flag only if nbuf map
is successful.

Change-Id: I642eff15792a7e374434e5a7a05ad546af376b3a
CRs-Fixed: 2625765
2020-02-26 13:31:07 -08:00
Alok Kumar
9cc180ec26 qcacmn: Avoid NULL pointer dereference in send_packet_completion
If cds_dp_open fails during driver load time, cds_close is
called in clean up path. During cds_close, HTC cleanup happens
which makes target->hif_dev = NULL and in send_packet_completion
target->hif_dev is dereferenced without NULL check.

Add NULL check before dereferencing target->hif_dev during
send_packet_completion.

Change-Id: I236a083e194bf1f16d261e6334ac512c4f6bcd94
CRs-Fixed: 2625690
2020-02-25 06:23:56 -08:00
Rakesh Pillai
4863352e53 qcacmn: Unmap the htc connect buffer after connect failure
The htc connect message buffer is not unmapped,
if the firmware does not send wmi ready event to the
host.

Scenario:
- Host sends htc init command.
- The command is queued into the src ring.
- The firmware has crashed before the Copy Engine
  could copy the message to the destination ring
- Due to the above point, no copy completion
  interrupt is received.
- The host times out during its wait for the wmi
  ready event.
- Hence the htc init command buffer stays unmapped
  and unfreed.

As a part of the wma ready event missing cleanup,
the htc connect buffer is not unmapped. Fix this
to avoid missing to unmap the buffer.

To avoid a side effect of sending a completion for
HTC connect command, all the commands are freed in
the htc completion handler in case of SSR.

CRs-Fixed: 2512344
Change-Id: I05026b3cbb764197e6df85c41634002d271a50e5
2019-12-25 22:11:36 -08:00
Nirav Shah
eb26831637 qcacmn: Update tx/rx bundle statistics for USB interface
Update tx/rx bundle statistics for USB interface.

Change-Id: Ia7951f9feb88ca28e055d9f32f0dfee65c7f0bf9
CRs-Fixed: 2571550
2019-12-06 08:40:56 -08:00
Visweswara Tanuku
b3518aff5c qcacmn: Genoa: SDIO: Revert WAR - Do not use HTC_FLAGS_SEND_BUNDLE
Remove the WAR, which doesnot use HTC_FLAGS_SEND_BUNDLE

This reverts commit 68f186311d

Change-Id: I7d350faca8645a5d65af708cb3fb231895a3fe37
CRs-Fixed: 2522724
2019-10-31 10:08:21 -07:00
Visweswara Tanuku
957b63aec6 qcacmn: Genoa: SDIO: Handle Tx Padding & Credits
In Genoa SDIO ADMA implementation Host sends packets to FW in
multiples of SDIO Block size.

If the packet/bundle is not block aligned Host adds padding at the
end of Packet/Bundle.

If the TX packet plus padding exceeds one FW TX Buffer, Padding data
will occupy the next FW TX buffer. Same applies for bundle TX packet.

For above scenario, HTC_FLAGS_PADDING_CHECK of HTC header Flags is used
to notify the FW that - Padding data follows the currentHTC packet

Since the padding data will take one extra FW Tx Buffer, host need to
handle the extra Tx credit being used by the padding data/buffer

CRs-Fixed: 2516617
Change-Id: I1eb394859689b281653bfd6d681804eb016a14cf
2019-09-08 07:37:36 -07:00
Visweswara Tanuku
68f186311d qcacmn: Genoa: SDIO: Tx - Do not use HTC_FLAGS_SEND_BUNDLE
Genoa SDIO FW doesn't use the HTC_FLAGS_SEND_BUNDLE
in send direction, host to fw

Do not set this flag during Tx bundling for HTC Packets
This is a WAR to avoid FW crash, until fix available from FW

Crs-Fixed: 2511297
Change-Id: Iaf178f9e1a9c07ca25a8b801c667fb0d16fac85c
2019-09-08 07:37:33 -07:00
Nirav Shah
31435bbef5 qcacmn: Fix DHCP indication to FW feature in SAP for HL
In case of HL, send tx completion bit in HTT tx descriptor
to receive tx completion from FW and disable DHCP indication
to FW properly.

Change-Id: I2540a125c84c322507acdc0647ee8839d21067ce
CRs-Fixed: 2506020
2019-08-20 14:38:41 -07:00
Yue Ma
4986b2588b qcacmn: Log runtime PM resume source
It is very critical to know the source of who requests runtime
PM resume to debug all kinds of runtime PM related issues. Hence
log them accordingly.

Change-Id: I9551830b1cb567fd29e9d9bbec18705f9cc5e9ec
CRs-fixed: 2496481
2019-07-27 02:49:10 -07:00
Himanshu Batra
032d352263 qcacmn: Replace void * Host Target Communications handle with abstract type
Replace void * Host Target Communications handle with abstract type handles
provided by Host Target Communications component

Change-Id: I16ca87e4f9716791d340da2fda0a8a640fa2ec34
CRs-Fixed: 2487151
2019-07-25 00:25:49 -07:00
Ajit Pal Singh
5c3ba8908f qcacmn: dp: hl: Read tx resources after single thread check
Bus TX resources are being read before the single thread check.
If the thread is pre-empted, the tx_resource variable may not
match with actual TX resources.

Change-Id: I7e8af58a5702172a4cfbea9175f333aad4a57238
CRs-Fixed: 2459253
2019-07-02 08:39:20 -07:00
Alok Kumar
5d4c6f2f17 qcacmn: Avoid NULL pointer dereference of pointer 'pPacket'
Pointer 'pPacket' returned from call to the function
'htc_packet_dequeue' may be NULL.

Add a NULL check for pPacket before dereferencing it.

Change-Id: I1ecb82cce0fc00877b3ec2de2676027dde261186
CRs-Fixed: 2478206
2019-06-28 11:08:59 -07:00
Nirav Shah
03c409d4a2 qcacmn: Add error handling in case of hif_send_head failure
In case of SDIO/USB TX bundling if there is hif_send_head failure
packets are not added back to Endpoint tx queue and resulting in
packet drop.

Add packet back to tx queue if hif_send_head send failure
for bundled packet.

Change-Id: Id613a414f0caa71a33c79186ae726550cb710c4a
CRs-Fixed: 2468882
2019-06-24 14:26:27 -07:00
Nirav Shah
0811d82877 qcacmn: Fix multiple unmap of same netbuf
Clear HTC_TX_PACKET_FLAG_FIXUP_NETBUF flag in
hif_send_head failure scenario to avoid
multiple unamap of same netbuf.

Change-Id: Id7f6aeba1eff0d23b76927fcbb03643409fc7859
CRs-Fixed: 2437034
2019-05-14 23:57:59 -07:00
Jeff Johnson
5a6cc79b9e qcacmn: htc: 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 htc replace any such comparisons with logical
operations performed on the pointer itself.

Change-Id: Ibb6d24aff9824d7e7cf253c1fe3081443cbfb63b
CRs-Fixed: 2418252
2019-03-27 06:09:57 -07:00
Ajit Pal Singh
3fcc082eac qcacmn: Do not call get_htc_send_packets if no TX resource
For USB, do not call get_htc_send_packets() in htc_send_data_pkt()
if no TX resource is available.

Change-Id: I17a3dd54c2582620ab2be1e0f6c156904dc52d30
CRs-Fixed: 2412376
2019-03-26 12:02:29 -07:00
Frank Liu
d2cc13ede9 qcacmn: Restore the correct credit for EP
qcacld-2.0 to qcacmn propagation

Restore the correct credit for the flow control endpoint, add back
all the credits consumed by the queue, if fail to send packet by
HIFSend_head.

Change-Id: I480f7aba5ce8c8d1e57caaae5b2bfcd77209091c
CRs-Fixed: 2360669
2019-03-01 09:24:06 -08:00
Vivek Natarajan
ed3bf79dd4 qcacmn: Use htc_lock while accessing TxLookupQueue
There are other places where txLookupQueue is protected
with htc_lock instead of lookup_queue_lock.

Change-Id: I91497ce4593a14033871d3e8c3a97deab222d365
2019-01-14 08:38:17 -08:00
Rakshith Suresh Patkar
5aeabd612d qcacmn: Add support to handle new htt format
If FW supports new htt format include only payload length in
the header length.

Change-Id: Ia5ec9a474bc5fe68de28273e6f9615d36de94a7c
CRs-Fixed: 2359253
2018-12-06 08:39:32 -08:00
Debasis Das
5e2539c087 qcacmn: Protect TxLookupqueue while flushing
The htc TxLookupQueue needs to be protected with
relevant lock while flushing.

Change-Id: Ib6c8878c024ef623dfb63ca0745d41b140f2b1c3
2018-11-23 02:00:17 -08:00
Aditya Sathish
648ce114ab qcacmn: Clean up hif and htc component prints
Clean up hif and htc component prints by correcting trace levels
for regularly occurring prints and removing newlines from converged
print APIs since qdf_trace_msg appends them by default.

Change-Id: I45b1bbe7b16ab7fb8e229b59a094c7382561d658
CRs-Fixed: 2243843
2018-08-10 18:11:24 -07:00
Yun Park
c353d6b87c qcacmn: Fix null pointer dereferenc in __htc_send_pkt
In __htc_send_pkt, pointer is checked against null but then
dereferenced later.
Fix it by checking null before dereference it.

Change-Id: I8a0dcfccbe458f5b85b8c930eb9685a75b64829b
CRs-Fixed: 2232835
2018-08-01 20:37:39 -07:00
Zhang Qian
edaa38708e qcacmn: Flush TxLookupQueue for WMI_CONTROL_SVC during htc_stop
TX comletion for WMI_FORCE_FW_HANG_CMDID would come after
TARGET_STATUS_RESET is set. In such a senario, there would
be memory leak.

Flush TxLookupQueue for WMI_CONTROL_SVC during htc_stop.
Since netbuf is freed in ISR, just free HTC frame here.

Change-Id: I5fab3effda1db70fa9b1208c854231a88b48309b
CRs-Fixed: 2242862
2018-07-13 08:27:21 -07:00
Dustin Brown
942f939848 qcacmn: Conditionally unmap nbuf in htc_issue_packets
htc_issue_packets currently unmaps all nbufs during error handling.
However, htc_issue_packets only maps nbufs under some situations. Make
the criteria for unmapping match the criteria for mapping.

Change-Id: Ia77cffb30edbdb4d1378af38368f860c6f8c0b18
CRs-Fixed: 2266437
2018-06-27 17:41:17 -07:00
Alok Kumar
9bd8152057 qcacmn: Flush TxLookupQueue for ENDPOINT_0 during htc_cleanup
When driver unload is triggered, check_for_leaks complains,
saying it finds pending entries in TxLookupQueue of ENDPOINT_0.

Flush pending entries in TxLookupQueue for ENDPOINT_0 during htc_cleanup.

Change-Id: Ica661453d5cef283526cfa1e7267d5349b5e2310
CRs-Fixed: 2249980
2018-06-23 20:10:16 -07:00
jitiphil
4a8f66f382 qcacmn: NULL pointer dereference in htc_issue_packets()
Inside htc_issue_packets() if the HTC frame header
associated with a packet is NULL, a NULL pointer dereference
can occur.

Add check to verify that HTC frame header is not NULL before
dereferencing.

Change-Id: I4169035286b582a91e5963c20a11c8ad0f375d17
Crs-Fixed: 2232846
2018-06-14 15:20:40 -07:00
jitiphil
fcc2488d25 qcacmn: NULL pointer dereference in free_htc_bundle_packet()
Inside free_htc_bundle_packet() if the HTC packet queue
associated with a packet is NULL, a NULL pointer dereference
can occur.

Add check to verify that HTC packet queue is not NULL before
dereferencing.

Change-Id: I1965a66de74b8954fdc59733e5ef86120f4f8898
Crs-Fixed: 2232839
2018-06-13 12:30:58 -07:00
Jeff Johnson
4b253f0e56 qcacmn: htc: Fix misspellings
Address the following issues in the htc folder:
CHECK: 'mesage' may be misspelled - perhaps 'message'?
CHECK: 'packtes' may be misspelled - perhaps 'packets'?
CHECK: 'throught' may be misspelled - perhaps 'through'?

Change-Id: Ied03e5a720ca1cd872c88df4e5cb4e014210b729
CRs-Fixed: 2241577
2018-05-19 19:40:29 -07:00
Jeff Johnson
19a4014b6b qcacmn: htc: Remove legacy markings
Per current guidance remove legacy markings.

Change-Id: Ieacfc963de0aa362d695ebddcd1231ca5128f55e
CRs-Fixed: 2230684
2018-05-18 02:17:30 -07:00
Kabilan Kannan
2c0da266be qcacmn: Block WMI cmds before issuing HTC stop
WMI cmds should be blocked, before calling HTC stop
to avoid the race condition in the system

Change-Id: I015b154a3bc422f50d4ed82bc861dd9e054c47a3
CRs-Fixed: 2194234
2018-04-16 16:57:01 -07:00
Tiger Yu
054a6a4fd4 qcacmn: Initialize the local variable do_pm_get to false
Initialize the local variable do_pm_get to false to avoid using the
uninitialized variable potentially.

Change-Id: Ie45126b05afee1d4e5bb061189846bc8e301c2a6
CRs-fixed: 2215809
2018-04-02 15:21:59 -07:00
Dustin Brown
f74576cb84 qcacmn: Add TX credits after WMI logging
While processing a host-to-target credit report, the number of available
credits is incremented before recording the credit report event in the
WMI history log. This can lead to tricky debug scenarios where there is
an available credit, but the WMI history log does not show that a credit
report has been processed. In htc_process_credit_rpt, log the credit
report in the WMI history log before incrementing the available credits
field.

Change-Id: Id8632c85348bec38b6c46549a68f613d102b2ae5
CRs-Fixed: 2204248
2018-03-21 13:52:19 -07:00
Nirav Shah
d9dce6e18c qcacmn: [HIF] Add support for QCA9379 on x86 platform
Add support for QCA9379 chip on x86 platform for
USB and SDIO attach.

Change-Id: I1192e47f6ca186bbcaa6d1fb28d40cb16d6dfe0b
CRs-Fixed: 2181012
2018-03-12 04:15:00 -07:00
Rachit Kankane
1bc1149747 qcacmn: Add HTC Credit History Feature flag
Add compilation flag to compile out HTC credit History
feature cleanly from the cld-3.2 driver binary

Change-Id: I615f0e4d6de150924b99b3444cebf00571ddc088
CRs-Fixed: 2190546
2018-03-08 18:47:17 -08:00
Pratik Gandhi
dc82a77896 qcacmn: Support to WIN for split of kernel modules
Add EXPORT_SYMBOLS to support modularization in WIN.

Change-Id: I587fe6f2c5cce4b54756358de5c488b146f61850
CRs-Fixed: 2179854
2018-02-08 06:58:35 -08:00
wadesong
4b3f37d7dc qcacmn: Stop touching HTC packet after it sent to CE
When HTC packet is sent to CE for physical tx, the tx compl
interrupt can get triggered very quickly, resulting the
HTC buffer being freed at a very early time. Any memory
access into the same HTC buffer after HTC tx compl returns
will be a use-after-free case.

Relocate all HTC packet touching code to places before
it gets populated to CE for tx.

Change-Id: I8bcac16566156104063013c7eb17b2f0debd32e6
CRs-Fixed: 2178880
2018-01-29 05:25:29 -08:00
Dustin Brown
bc9718fea2 qcacmn: Fix HTC packet map/unmap disparity
When a data packet is sent via HTC, it is mapped before being inserted
into the TX queue. However, for control packets, the mapping is done
after being inserted into the queue. This leads to a situation where the
TX queue flush can unmap a pending control packet that was never mapped.
Make sure the TX flush function only unmaps packets that have previously
been mapped.

Change-Id: I48572fb34ae940923012d495625a33a00f74b9ed
CRs-Fixed: 2157006
2018-01-05 15:30:11 -08:00
Dustin Brown
8969ad7fa8 qcacmn: Fix double dmap problem in htc
For control messages, a path in HTC was performing double dmamaps
and this was, in time, causing dmamap failures on SMMU.

Change-Id: I19f7e13a0a19404fe1161127b10f52225b6a4248
CRs-Fixed: 2151773
2018-01-05 15:30:10 -08:00
Houston Hoffman
b899cf8b8e qcacmn: Don't encapsulate packets in htc_send_pkt
Avoid leaking pointers to freed stack memory by not enqueing packets
onto a stack local queue in htc_send_pkt
In particular, the packet was not being removed from the stack queue
when a dma map error occurs.

Change-Id: I4519a302b3d6cc19f52e8cefa71dbd750ede0a0b
CRs-Fixed: 2119792
2018-01-04 07:25:15 -08:00
Manjunathappa Prakash
cb30062355 qcacmn: enqueue back dequeued packet if mmap fails
In htc_issue_packet takecare to enqueue back the dequeued packet.
Otherwise we will be leaking the packet.
Also takecare to unmap the mapped netbuf if we fail to send.

Change-Id: I48dbe537ae5b0fe89785f4309325c7089b2ace56
CRs-Fixed: 2151122
2018-01-04 07:25:10 -08:00
Alok Kumar
967af27196 qcacmn: Add a delay before sending WMI message
Add a delay of 20ms before sending WMI message.

A delay of 20msec was added to slow down sending of WMI message
to give time for processing WMI in Napier FPGA platform.

Change-Id: Ib64972a92e638f2fe92f669657a5ab9eb326e744
CRs-Fixed: 2087330
2017-12-07 15:39:12 -08:00