mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
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 <[email protected]>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user