Commit Graph

35 Commits

Author SHA1 Message Date
Tallapragada Kalyan
b265fdd7fc qcacmn: introduce simple nbuf_free API in RX path
simple Alloc is being used in RX path which avoids
certain debug logic. during free of nbuf we should
avoid this debug logic else it will report it as
double free, this will be triggered only when debug
is enabled

Change-Id: Iadb40071fb733cc4de3291784df5075d5a099a8e
2022-02-02 12:06:34 -08:00
aloksing
c60b9619a3 qcacmn: Conditionally compile monitor related features and issue fixes
PATCH[7/7]:
This patch consists following changes:
 -Conditionally compile all monitor destination ring related code
  Macro used QCA_MONITOR_PKT_SUPPORT
 -Add QCA_ENHANCED_STATS_SUPPORT macro to conditionally compile
  enhanced stats support
 -Use QCA_MCOPY_SUPPORT and QCA_TX_CAPTURE_SUPPORT macros
  to conditionally compile MCOPY and Tx capture features
  respectively
 -Use QCN_IE macro to conditionally compile BPR
  feature
 -Use QCA_ADVANCE_MON_FILTER_SUPPORT macro to conditionally
  compile advance monitor filter feature
 -Fix vdev attach issue for special and smart monitor vap
 -Fix status ring initialization issue.

Change-Id: I0deaa28a9a54bf34b0f41e6dd510fdd8d4992db2
CRs-Fixed: 2983780
2021-07-30 21:51:26 -07:00
Jinwei Chen
4083155141 qcacmn: Add support for HW cookie conversion
Support HW cookie conversion for BE platform.

Change-Id: I39058fbf256266557f5e734ba376db4db0731b24
CRs-Fixed: 2929533
2021-06-23 23:32:49 -07:00
Ananya Gupta
218ec1c24e qcacmn: Lock rx_desc_pool to collect nbufs and delete later
When multi page alloc is activated, spinlock for rx_desc_pool
is being held for more than 2 seconds, resulting in QDF_BUG.
The major proportion of the time period is used in unmapping
the nbufs.
To fix this, lock rx_desc_pool only to collect nbufs from
rx_desc in a list and unmap and free the nbufs after releasing
the lock.

Change-Id: Iff2078a0de56b51712e2f9a7c5ace7a959e2445d
CRs-Fixed: 2779498
2020-09-30 01:26:05 -07:00
Jinwei Chen
18989f8ede qcacmn: support multiple pages prealloc for descriptor
Support multiple pages prealloc for DP descriptor

Change-Id: I66d4cef3acf69acf4b6fc8e5a6d01c3d67921dca
CRs-Fixed: 2751338
2020-09-21 01:33:16 -07:00
Ankit Kumar
526bbe81de qcacmn: Handle frag based ops based on rx_Desc_pool flag
Rx desc pool have a flag to identify whether frag or nbuf
operation needs to be performed for alloc, map, prep and
free buffer for monitor dest buffer.

This flag will be set only for mon destination desc pool,
if RX_MON_MEM_FRAG feature is enabled.
In all other case, It will be set to Zero and default nbuf
operation will be taken.
This flag get initialized at the time of pdev rx_desc_pool
initialization and gets reset while pdev deinit.

Mon destination buffer will have support for frag if
RX_MON_MEM_FRAG flag is set.

Change-Id: I67c6c823ee4f114035b884c024a1a9054a40665b
CRs-Fixed: 2741757
2020-08-11 14:09:08 -07:00
Jinwei Chen
f3bffbfdd2 qcacmn: handle IPA buffer smmu map/unmap correctly
Handle ipa buffer smmu map/unmap with below changes,
(1) Do IPA smmu unmap for RX buffer received from REO
exception/WBM RX release/REO DST/RXDMA DST ring.
(2) Align IPA smmu map length to qdf_nbuf_map_nytes_single()
with fixed length.

Change-Id: I1ed46b31ed31f5b7e4e2484d519bc85d35ce1e69
CRs-Fixed: 2728644
2020-07-23 13:17:09 -07:00
Guisen Yang
4676e72c02 qcacmn: Change nbuf unmap API when free rx nbuf
The DMA Map/Unmap was restricted to buffer size in rx process.
But the Unmap API was not changed when free nbuf in rx desc,
apply the new unmap API.

Change-Id: Id10d746776aa9e41ef3425e166ba0207851358d6
CRs-Fixed: 2716690
2020-06-30 02:33:58 -07:00
Yeshwanth Sriram Guntuka
261d19bcb4 qcacmn: Set local rx_desc list head to NULL
The issue sceanrio is as follows:

1) Packets are received in the rx exception ring and the
rx_descs processed are put into the pdev rx_desc freelist.

2) In the buffers replenish path, the above pdev rx_desc
freelist, on nbuf allocation or map error, is moved to the
soc rx_desc_pool freelist. The tail of the pdev rx_desc
freelist is set to NULL but not the head.

3) On receiving packets in the rx exception ring post above,
the new rx_desc are added to the pdev rx_desc freelist but
since the head of the list was not NULL prior to this, the
tail of the new list will have its next pointing to the
previous stale rx_desc list which is already moved to the soc
rx_desc_pool list.

4) In the replenish path, the buffers would be replenished
till tail of the new list but the desc_list would point
to the same aforementioned stale rx_desc list instead of NULL.
So even though replenish is successful, the desc_list check to
add the list back to soc rx_desc_pool freelist would be true.
This would cause next pointer of the tail and in effect the nbuf
pointer of the rx_desc pointed by tail to get updated.

5) On receiving the rx_desc mentioned in the previous step, nbuf
sanity check fails since nbuf address is pointing to another
rx_desc.

Fix is to set the local_desc_list also to NULL in
dp_rx_add_desc_list_to_free_list.

Change-Id: I984a4c122592547492b9d9625a71c0a90142b442
CRs-Fixed: 2704771
2020-06-16 04:14:08 -07:00
Yeshwanth Sriram Guntuka
8a2c60e8f5 qcacmn: Add debug info support for rx descriptors
Add debug info support for rx descriptors to log
the caller func name and timestamp in replenish
and free scenario.

Change-Id: I1d9b855d14f705094f241bae653f33a94d0e39b7
CRs-Fixed: 2677288
2020-05-13 12:39:51 -07:00
phadiman
1f3652debc qcacmn: Datapath init-deinit changes
Do a logical split of dp_soc_attach and
dp_pdev_attach into Allocation and initialization
and dp_soc_detach and dp_pdev_detach into
de-initialization and free routines

Change-Id: I23bdca0ca86db42a4d0b2554cd60d99bb207a647
2020-05-02 21:59:42 -07:00
Tallapragada Kalyan
8186e7d0cf qcacmn: fix qdf trace print during desc allocation
fix qdf trace print during desc allocation

Change-Id: I6d786a20a7bc65dcc67a62e784825f72a64a6565
2020-04-29 17:56:12 -07:00
phadiman
b133d310ec qcacmn: Split dp_rx_pdev_attach and dp_rx_pdev_detach
Split dp_rx_pdev_attach into dp_rx_pdev_desc_pool_alloc,
dp_rx_pdev_desc_pool_init, dp_rx_pdev_buffers_alloc and
dp_rx_pdev_detach into dp_rx_pdev_desc_pool_free, dp_rx
_pdev_desc_pool_deinit, dp_rx_pdev_buffers_free APIs

This split is made because dp_pdev_init is introduced
as part of this FR and these APIs will be called from
dp_pdev_init/dp_pdev_deinit or dp_pdev_attach/dp_pdev_
detach accordingly to maintain the symmetry to DP init
and deinit path

Change-Id: Ib543ddae90b90f4706004080b1f2b7d0e5cfbfbc
CRs-Fixed: 2663595
2020-04-27 18:02:37 -07:00
Jinwei Chen
3222184e14 qcacmn: fix RX desc is using but freed back to pool
Crash scenario:
(1) frag data A is dropped and related RX desc A is replenished
and reused, but pdev->free_list_tail is still pointed to RX desc A.
(2) frag data B/C is coming, defrag fails then pdev->free_list_head
will point to B-->C RX desc, but pdev->free_list_tail still point to A.
(3) for defrag failing case, host only will replenish 1 RX buffer for
current case, RX desc B is replenished, while C will be free back to
RX desc pool.
(4) dp_rx_add_desc_list_to_free_list will set RX desc A-->next =
free_list, free_list point to C insted.
(5) when step (1) RX desc A replenished buffer indicated to host by
REO2Dst ring, RX desc A -->nbuf actually is pointed to another RX
desc, invalid skb accessing will happen.

Solution:
a. reset tail pointer in dp_rx_add_desc_list_to_free_list at last.
b. reset tail pointer same as head in dp_rx_add_to_free_desc_list
if head->next is NULL.
c. set correct rx_bufs number for replenish when dp_rx_defrag fails.

Change-Id: Ib297baea3605a09dd7d85d1f5ceb95db48a2e1f1
CRs-Fixed: 2603676
2020-01-25 07:43:47 -08:00
Varsha Mishra
10b86d636a qcacmn: Set in_use bit of last allocated descriptor as 0
With current implementation in_use bit for last descriptor is not
getting set as 0. Removing redundant code and setting in_use bit
for last descriptor as 0.

Change-Id: Ia1945fcb814136128d18a8aec473ed1b4786dd9e
2019-09-08 01:07:32 -07:00
Varun Reddy Yeturu
a7c21dc7f3 qcacmn: Allocate multi page memory for dp_rx_desc_pool_alloc
Allocate memory in multiple smaller chunks for dp_rx_desc_pool_alloc,
and link the pages instead of allocating one big contiguous memory to
avoid memory allocation failures.

Change-Id: Id81de10727555c4ca78963a6f01ed3b992ce9924
CRs-Fixed: 2443999
2019-05-23 20:35:07 -07:00
Ankit Kumar
0ae4abc97b qcacmn: Replace QDF_DMA_BIDIRECTIONAL to QDF_DMA_FROM_DEVICE in rx
In Rx path, We really don't need to flush data and invalidate.
Hence replacing map/unmap flag to QDF_DMA_FROM_DEVICE.

Change-Id: I3de0c73e11a08a875114167a55fe9fe4432f1dd4
CRs-fixed: 2449712
2019-05-20 11:22:21 -07:00
jiad
3b8104bdd3 qcacmn: Support WLAN IPA WDI 3.0 SMMU
Support WLAN IPA WDI 3.0 with SMMU-S1 enabled. Key design
considerations are captured below.

- ring base addresses are passed as struct sg_table and IPA
driver will do the IOVA mapping to IPA domain.
- ring doorbell addresses are passed as physical address and
IPA driver will do the IOVA mapping to IPA domain.
- TX/RX buffers need to be mapped to IPA domain by WLAN driver
via ipa_wdi_create|release_smmu_mapping API.
- IPA doorbell addresses returned from ipa_wdi_conn_pipes are
DDR addresses and WLAN driver needs to do the IOVA mapping
to WLAN domain.

Change-Id: I2398df58c9a9d002af7035f239eda37a86f5d00f
CRs-Fixed: 2422155
2019-03-30 04:53:25 -07:00
phadiman
7dd261d614 qcacmn: Free Rx Desc during WiFi unload
Rx desc pools are reused across wifi up
and wifi down, only nbufs part of these
pools are free during down

Free Rx desc pools during WiFi Unload

CRs-Fixed: 2418941
Change-Id: I5cc3a82d99efd84f51f9eb048cf06da5a4495e55
2019-03-26 04:13:12 -07:00
phadiman
449a268392 qcacmn: Reuse Rx Descriptor Pool Array
wifi up/down will cause soc stop and soc
start which will allocate rx desc pool
array memory for each wifi up

This creates memory fragmentation issue
hence reuse Rx descriptor pool array
across wifi up/down and free only nbufs

CRs-Fixed: 2394666
Change-Id: Ic897c733dfba3d8829e2f2f51099cd615b8a7ea2
2019-03-08 20:19:16 -08:00
Mohit Khanna
705149946b qcacmn: Fix large RX desc pool memory allocation
During dp_rx_pdev_attach and dp_rx_pdev_mon_buf_attach we are allocating
three times as many rx descriptors as there are entries in the ring for
AP usecase. This is not needed for MCL and may need to kmalloc
failures for allocating that much contiguous memory

Allocate only as many RX descriptors as there are ring entries for MCL
usecase.

Change-Id: I8b559a85c3899bcbdc520e71ba5da409314db160
CRs-Fixed: 2342957
2018-12-15 10:07:15 -08:00
Aditya Sathish
ded018e406 qcacmn: Clean up dp component prints
Clean up datapath component prints by correcting trace levels for
regularly occurring prints and removing newlines from converged
print APIs since qdf_trace_msh appends them by default.

Change-Id: Ie8fe319fcb737720f7400a165e134b6a18bd15b5
CRs-Fixed: 2243843
2018-08-10 18:11:21 -07:00
Venkata Sharath Chandra Manchala
bcfa6d8683 qcacmn: Add lock to protect rx_desc_pool
Create a lock for protecting rx descriptor
pool allocation during initialization and destroy it
during unloading the driver.

Change-Id: Icd489e400dab9bb648709134dcaa24c4d7724aa6
CRs-Fixed: 2215430
2018-04-01 21:02:38 -07:00
Chaithanya Garrepalli
8e5e2f86c4 qcacmn: Fix for the rx_desc leak
In dp_rx_get_free_desc_list() corrected the
return value in case when the number of requested
rx_desc are not available in the pool

Change-Id: I3de026726e885b8fe707f7c7318cc1936be73e65
CRs-Fixed: 2202247
2018-03-28 06:26:42 -07:00
jinweic chen
e87355474f qcacmn: fix monitor nbuf double unmap when rmmod
When reaping rx monitor msdu in dp_rx_mon_mpdu_pop, if msdu_ppdu_id >
ppdu_id, then the corresbonding dp_rx_desc will not be added to free list,
and in_use flag still is 1 but it has done nbuf unmap which linked
to this rx desc. meantime, if rmmod triggered then it will go through the
rx desc pool and unmap the linked nbuf that in_use flag is 1, panic
happened. add unmapped flag checking to avoid double unmap.

CRs-fixed: 2201071

Change-Id: Idead32b189f513897deebf646b72585b257151c2
2018-03-13 19:49:13 -07:00
jiad
78e34459fd qcacmn: Unmap DMA region mapped for nbuf in rx_desc
In attach and replenish path, nbuf maps a DMA region for device access.
But the DMA region mapped is not unmapped in detach path.

Fix is to unmap the DMA region when rx_desc_pool is freed.

Change-Id: If3e93113e59c7eec4419cb1d9228ee95c5b74b39
CRs-Fixed: 2149014
2017-11-28 19:39:08 -08:00
Karunakar Dasineni
87f0c5d850 qcacmn: Replenish Rx buffers on low threshold intr
Replenish buffers in RXDMA refill ring based on low threshold
interrupts in addition to regular Rx processing. Also increased
RXDMA refill ring size to 4096.

Change-Id: If1f4592c815fe2404c4952a96b721cb6d4fdfcd0
2017-11-08 07:41:26 -08:00
Jeff Johnson
3f217e2a81 qcacmn: dp: Replace instances of unadorned %p
Replace instances of unadorned %p in dp.

Change-Id: I8d9c0f6efe5f03a582a36d7ff39a905a5de576a7
CRs-Fixed: 2111274
2017-09-28 04:48:10 -07:00
Pramod Simha
59fcb31d81 qcacmn: check for in use flag during free
Add a in_use flag to identify if a rx desc is associated
with a valid nbuf and use this flag while freeing the nbuf.

Change-Id: Iace002ecadfd95ce60b7d1eaebc42194a433963b
CRs-fixed: 2044907
2017-06-30 20:14:16 -07:00
Venkata Sharath Chandra Manchala
9dfc3874f1 qcacmn: Fix for Rx descriptor pool
Remove the statement nbuf pointing to NULL
during allocation of descriptors as nbuf in rx_desc and next
pointer in dp_rx_desc_list_elem_t share the same address
space and pointing to NULL will not allocate the
rx descriptors.

Change-Id: If4c35202c2489aed1711173b37192f565f7c3d7b
CRs-Fixed: 2061564
2017-06-15 18:09:27 -07:00
Manikandan Mohan
b01696ba61 qcacmn: Fix mem leaks in datapath
Fix mem leaks reported in datapath code during module unload.

Change-Id: Ife95426df11d61b253110ed7153fe8f8981006ed
CRs-fixed: 2044907
2017-06-01 15:21:34 -07:00
Kai Chen
6eca1a62da qcacmn: Monitor mode configuration and processing
This change is for supporting monitor mode VAP.  All the monitor mode ring
is configured. The related monitor mode ring includes:
-monitor mode buffer ring
-monitor mode destination ring
-monitor mode status ring
-monitor mode link descriptor ring
The packet is not sent to monitor mode ring unless the monitor mode VAP is
configured. This release support Multiple VAP - AP/STA VAP plus Monitor
VAP configuration. The status ring is not used in this release. However,
the ring is tested and the ring is moving and there are TLV's in the ring.

Change-Id: I782ee0c3b998d8b3bbac79b5e7fdecdbff15fa93
CRs-Fixed: 2013049
2017-03-29 05:58:52 -07:00
Tallapragada Kalyan
aae8c4177e qcacmn: modify RX path to support multi-radio
replenish buffers to the respective RXDMA pool.

Change-Id: Ib9e366efa098482419a4eac4579786bd0eb13946
CRs-Fixed: 2008301
2017-03-03 05:42:13 -08:00
Dhanashri Atre
7351d17b41 qcacmn: MCL Buffer Replenishment
Add support for replenishing the rx buffers using the host to
firmware buffer ring.

This includes adding a flag QCA_HOST2FW_RXBUF_RING:
When QCA_HOST2FW_RXBUF_RING is enabled the host will do the following:
- Allocate the refill buffer ring (HTT_HOST1_TO_FW_RXBUF_RING) and
populate it with
 rx buffers
- Send the refill buffer ring configuration to the firmware
- Allocate the rx DMA ring (HTT_RXDMA_HOST_BUF_RING), leave it empty.
- Send the rx DMA ring configuration to the firmware

When QCA_HOST2FW_RXBUF_RING is disabled, the host will do the following:
- Allocate the rx DMA ring (HTT_RXDMA_HOST_BUF_RING), and populate it with
 rx buffers
- Send the rx DMA ring configuration to the firmware

CRs-Fixed: 1074199
Change-Id: Iec05a973cd9d628c742e3aaa16b8dabc7797625d
2016-10-28 05:21:59 -07:00
Debashis Dutt
c4c52dc1fd qcacmn: Add Lithium RX Core Processing Infrastructure
Add Lithium Rx basic packet processing path from REO.
Implement the following in this patch:

 - Rx buffer replenishment directly to RxDMA rings (WIN)

 - Rx descriptor management

 - Rx Path Processing for non-error packets

 - RxDMA optimization (access on 128 byte boundary)

Change-Id: I25aea3a79d5494a0447bc7ca919acb87b74f2760
CRs-Fixed: 1074199
2016-10-28 04:36:42 -07:00