diff options
author | Felix Fietkau <nbd@nbd.name> | 2021-12-03 18:01:52 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2021-12-19 15:24:02 +0100 |
commit | fbe50d9aff0c7dfb0665dd18f606b9ddbbb3ace7 (patch) | |
tree | b78c14c36c5c18f96e255a40902b4af783c2ebf6 /drivers/net/wireless/mediatek/mt76/dma.c | |
parent | mt76: mt7663: disable 4addr capability (diff) | |
download | linux-fbe50d9aff0c7dfb0665dd18f606b9ddbbb3ace7.tar.xz linux-fbe50d9aff0c7dfb0665dd18f606b9ddbbb3ace7.zip |
mt76: allow drivers to drop rx packets early
This can be used to free received events without allocating an extra skb
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/dma.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/dma.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c index 5e1c1506a4c6..3a9af8931c35 100644 --- a/drivers/net/wireless/mediatek/mt76/dma.c +++ b/drivers/net/wireless/mediatek/mt76/dma.c @@ -572,9 +572,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) if (data_len < len + q->buf_offset) { dev_kfree_skb(q->rx_head); q->rx_head = NULL; - - skb_free_frag(data); - continue; + goto free_frag; } if (q->rx_head) { @@ -582,11 +580,14 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) continue; } + if (!more && dev->drv->rx_check && + !(dev->drv->rx_check(dev, data, len))) + goto free_frag; + skb = build_skb(data, q->buf_size); - if (!skb) { - skb_free_frag(data); - continue; - } + if (!skb) + goto free_frag; + skb_reserve(skb, q->buf_offset); if (q == &dev->q_rx[MT_RXQ_MCU]) { @@ -603,6 +604,10 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) } dev->drv->rx_skb(dev, q - dev->q_rx, skb); + continue; + +free_frag: + skb_free_frag(data); } mt76_dma_rx_fill(dev, q); |