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>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
fourteen
Julian Liu 4 years ago committed by Jenna
parent 5bb1be3c35
commit a8b2d6f011
  1. 45
      drivers/net/wireless/qualcomm/wcn39xx/qcacld-3.0/core/dp/htt/htt.c
  2. 2
      drivers/net/wireless/qualcomm/wcn39xx/qcacld-3.0/core/dp/htt/htt_internal.h
  3. 3
      drivers/net/wireless/qualcomm/wcn39xx/qcacld-3.0/core/dp/htt/htt_types.h

@ -114,32 +114,28 @@ void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev)
#ifdef ATH_11AC_TXCOMPACT #ifdef ATH_11AC_TXCOMPACT
void void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev)
htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level)
{ {
struct htt_htc_pkt_union *pkt, *next, *prev = NULL; struct htt_htc_pkt_union *pkt, *next;
int i = 0;
qdf_nbuf_t netbuf; qdf_nbuf_t netbuf;
HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex); // skip if first come
pkt = pdev->htt_htc_pkt_misclist; if(!pdev->last_misc_pkt->u.next)
goto out;
pkt = pdev->last_misc_pkt->u.next;
pdev->last_misc_pkt->u.next = NULL;
while (pkt) { while (pkt) {
next = pkt->u.next; next = pkt->u.next;
/* trim the out grown list*/ netbuf = (qdf_nbuf_t) (pkt->u.pkt.htc_pkt.pNetBufContext);
if (++i > level) { qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE);
netbuf = qdf_nbuf_free(netbuf);
(qdf_nbuf_t)(pkt->u.pkt.htc_pkt.pNetBufContext); qdf_mem_free(pkt);
qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE);
qdf_nbuf_free(netbuf);
qdf_mem_free(pkt);
pkt = NULL;
if (prev)
prev->u.next = NULL;
}
prev = pkt;
pkt = next; pkt = next;
} }
HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex); out:
pdev->last_misc_pkt = pdev->htt_htc_pkt_misclist;
pdev->last_misc_num = 1;
} }
void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt) void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
@ -153,15 +149,16 @@ void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
if (pdev->htt_htc_pkt_misclist) { if (pdev->htt_htc_pkt_misclist) {
u_pkt->u.next = pdev->htt_htc_pkt_misclist; u_pkt->u.next = pdev->htt_htc_pkt_misclist;
pdev->htt_htc_pkt_misclist = u_pkt; pdev->htt_htc_pkt_misclist = u_pkt;
pdev->last_misc_num++;
} else { } else {
pdev->htt_htc_pkt_misclist = u_pkt; pdev->htt_htc_pkt_misclist = u_pkt;
pdev->last_misc_pkt = u_pkt;
pdev->last_misc_num = 1;
} }
HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
/* only ce pipe size + tx_queue_depth could possibly be in use if (pdev->last_misc_num > misclist_trim_level)
* free older packets in the msiclist htt_htc_misc_pkt_list_trim(pdev);
*/ HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
htt_htc_misc_pkt_list_trim(pdev, misclist_trim_level);
} }
void htt_htc_misc_pkt_pool_free(struct htt_pdev_t *pdev) void htt_htc_misc_pkt_pool_free(struct htt_pdev_t *pdev)

@ -608,7 +608,7 @@ void htt_htc_pkt_free(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt);
void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev); void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev);
#ifdef ATH_11AC_TXCOMPACT #ifdef ATH_11AC_TXCOMPACT
void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level); void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev);
void void
htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt); htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt);

@ -452,6 +452,9 @@ struct htt_pdev_t {
/* Flag to indicate whether new htt format is supported */ /* Flag to indicate whether new htt format is supported */
bool new_htt_format_enabled; bool new_htt_format_enabled;
struct htt_htc_pkt_union *last_misc_pkt;
int last_misc_num;
}; };
#define HTT_EPID_GET(_htt_pdev_hdl) \ #define HTT_EPID_GET(_htt_pdev_hdl) \

Loading…
Cancel
Save