mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 13:57:54 -04:00
wifi: mt76: set page_pool napi pointer for mmio devices
In order to recycle skbs in the page_pool "hot" cache in napi_pp_put_page routine, set napi pointer for MMIO devices in mt76_create_page_pool(). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
committed by
Felix Fietkau
parent
8a7386e787
commit
3c37da5713
@@ -579,13 +579,18 @@ EXPORT_SYMBOL_GPL(mt76_unregister_phy);
|
||||
|
||||
int mt76_create_page_pool(struct mt76_dev *dev, struct mt76_queue *q)
|
||||
{
|
||||
bool is_qrx = mt76_queue_is_rx(dev, q);
|
||||
struct page_pool_params pp_params = {
|
||||
.order = 0,
|
||||
.flags = 0,
|
||||
.nid = NUMA_NO_NODE,
|
||||
.dev = dev->dma_dev,
|
||||
};
|
||||
int idx = q - dev->q_rx;
|
||||
int idx = is_qrx ? q - dev->q_rx : -1;
|
||||
|
||||
/* Allocate page_pools just for rx/wed_tx_free queues */
|
||||
if (!is_qrx && !mt76_queue_is_wed_tx_free(q))
|
||||
return 0;
|
||||
|
||||
switch (idx) {
|
||||
case MT_RXQ_MAIN:
|
||||
@@ -604,6 +609,9 @@ int mt76_create_page_pool(struct mt76_dev *dev, struct mt76_queue *q)
|
||||
pp_params.dma_dir = DMA_FROM_DEVICE;
|
||||
pp_params.max_len = PAGE_SIZE;
|
||||
pp_params.offset = 0;
|
||||
/* NAPI is available just for rx queues */
|
||||
if (idx >= 0 && idx < ARRAY_SIZE(dev->napi))
|
||||
pp_params.napi = &dev->napi[idx];
|
||||
}
|
||||
|
||||
q->page_pool = page_pool_create(&pp_params);
|
||||
|
||||
@@ -1607,6 +1607,18 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
|
||||
struct mt76_power_limits *dest,
|
||||
s8 target_power);
|
||||
|
||||
static inline bool mt76_queue_is_rx(struct mt76_dev *dev, struct mt76_queue *q)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++) {
|
||||
if (q == &dev->q_rx[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool mt76_queue_is_wed_tx_free(struct mt76_queue *q)
|
||||
{
|
||||
return (q->flags & MT_QFLAG_WED) &&
|
||||
|
||||
Reference in New Issue
Block a user