Skip to content

Commit a7e2058

Browse files
wlootPixelBoot
authored andcommitted
qcacld-3.0: Free a bunch of pkts at once
It is too bad to do a tight loop every adding pkt. When the hotspot is turned on, I notice that the htt_htc_misc_pkt_list_trim() function consumes at least 5% of CPU time. By caching the head of pkt queue and freeing multiple pkts at once to reduce CPU consumption. Signed-off-by: Julian Liu <wlootlxt123@gmail.com> Change-Id: Ifc814cb5412aad6a5732201cfae784b9f4cdf525
1 parent 03af5c6 commit a7e2058

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

drivers/staging/qcacld-3.0/core/dp/htt/htt.c

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,32 +122,28 @@ void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev)
122122

123123
#ifdef ATH_11AC_TXCOMPACT
124124

125-
void
126-
htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level)
125+
void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev)
127126
{
128-
struct htt_htc_pkt_union *pkt, *next, *prev = NULL;
129-
int i = 0;
127+
struct htt_htc_pkt_union *pkt, *next;
130128
qdf_nbuf_t netbuf;
131129

132-
HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex);
133-
pkt = pdev->htt_htc_pkt_misclist;
130+
// skip if first come
131+
if(!pdev->last_misc_pkt->u.next)
132+
goto out;
133+
134+
pkt = pdev->last_misc_pkt->u.next;
135+
pdev->last_misc_pkt->u.next = NULL;
134136
while (pkt) {
135137
next = pkt->u.next;
136-
/* trim the out grown list*/
137-
if (++i > level) {
138-
netbuf =
139-
(qdf_nbuf_t)(pkt->u.pkt.htc_pkt.pNetBufContext);
140-
qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE);
141-
qdf_nbuf_free(netbuf);
142-
qdf_mem_free(pkt);
143-
pkt = NULL;
144-
if (prev)
145-
prev->u.next = NULL;
146-
}
147-
prev = pkt;
138+
netbuf = (qdf_nbuf_t) (pkt->u.pkt.htc_pkt.pNetBufContext);
139+
qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE);
140+
qdf_nbuf_free(netbuf);
141+
qdf_mem_free(pkt);
148142
pkt = next;
149143
}
150-
HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
144+
out:
145+
pdev->last_misc_pkt = pdev->htt_htc_pkt_misclist;
146+
pdev->last_misc_num = 1;
151147
}
152148

153149
void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
@@ -161,15 +157,16 @@ void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
161157
if (pdev->htt_htc_pkt_misclist) {
162158
u_pkt->u.next = pdev->htt_htc_pkt_misclist;
163159
pdev->htt_htc_pkt_misclist = u_pkt;
160+
pdev->last_misc_num++;
164161
} else {
165162
pdev->htt_htc_pkt_misclist = u_pkt;
163+
pdev->last_misc_pkt = u_pkt;
164+
pdev->last_misc_num = 1;
166165
}
167-
HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
168166

169-
/* only ce pipe size + tx_queue_depth could possibly be in use
170-
* free older packets in the msiclist
171-
*/
172-
htt_htc_misc_pkt_list_trim(pdev, misclist_trim_level);
167+
if (pdev->last_misc_num > misclist_trim_level)
168+
htt_htc_misc_pkt_list_trim(pdev);
169+
HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
173170
}
174171

175172
void htt_htc_misc_pkt_pool_free(struct htt_pdev_t *pdev)

drivers/staging/qcacld-3.0/core/dp/htt/htt_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ void htt_htc_pkt_free(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt);
548548
void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev);
549549

550550
#ifdef ATH_11AC_TXCOMPACT
551-
void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level);
551+
void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev);
552552

553553
void
554554
htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt);

drivers/staging/qcacld-3.0/core/dp/htt/htt_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ struct htt_pdev_t {
438438
tp_rx_pkt_dump_cb rx_pkt_dump_cb;
439439

440440
struct mon_channel mon_ch_info;
441+
442+
struct htt_htc_pkt_union *last_misc_pkt;
443+
int last_misc_num;
441444
};
442445

443446
#define HTT_EPID_GET(_htt_pdev_hdl) \

0 commit comments

Comments
 (0)