| From f322c87d1e0634ec86acb5b254220918842132c6 Mon Sep 17 00:00:00 2001 |
| From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| Date: Wed, 26 Jul 2023 16:33:43 +0800 |
| Subject: [PATCH 73/98] wifi: mt76: drop packet based on ind_reason |
| |
| Driver should drop packet which ind_reason is REPEAT and OLDPKT. |
| |
| Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com> |
| --- |
| dma.c | 15 +++++++++++++-- |
| dma.h | 9 +++++++++ |
| 2 files changed, 22 insertions(+), 2 deletions(-) |
| |
| diff --git a/dma.c b/dma.c |
| index 3983ebb..69e314a 100644 |
| --- a/dma.c |
| +++ b/dma.c |
| @@ -435,8 +435,19 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, |
| |
| if (drop) { |
| *drop = !!(ctrl & (MT_DMA_CTL_TO_HOST_A | MT_DMA_CTL_DROP)); |
| - if (ctrl & MT_DMA_CTL_VER_MASK) |
| - *drop = !!(ctrl & MT_DMA_CTL_PN_CHK_FAIL); |
| + if (ctrl & MT_DMA_CTL_VER_MASK) { |
| + switch (le32_get_bits(desc->buf1, MT_DMA_IND_REASON)) { |
| + case IND_REASON_REPEAT: |
| + *drop = true; |
| + break; |
| + case IND_REASON_OLDPKT: |
| + *drop = !le32_get_bits(desc->info, MT_DMA_INFO_DMA_FRAG); |
| + break; |
| + default: |
| + *drop = !!(ctrl & MT_DMA_CTL_PN_CHK_FAIL); |
| + break; |
| + } |
| + } |
| } |
| |
| if (mt76_queue_is_wed_rx(q)) { |
| diff --git a/dma.h b/dma.h |
| index 22b79d5..afcbcdd 100644 |
| --- a/dma.h |
| +++ b/dma.h |
| @@ -23,6 +23,7 @@ |
| |
| #define MT_DMA_PPE_CPU_REASON GENMASK(15, 11) |
| #define MT_DMA_PPE_ENTRY GENMASK(30, 16) |
| +#define MT_DMA_INFO_DMA_FRAG BIT(9) |
| #define MT_DMA_INFO_PPE_VLD BIT(31) |
| |
| #define MT_DMA_CTL_PN_CHK_FAIL BIT(13) |
| @@ -31,6 +32,7 @@ |
| #define MT_DMA_RRO_EN BIT(13) |
| |
| #define MT_DMA_WED_IND_CMD_CNT 8 |
| +#define MT_DMA_IND_REASON GENMASK(15, 12) |
| |
| #define MT_DMA_HDR_LEN 4 |
| #define MT_RX_INFO_LEN 4 |
| @@ -66,6 +68,13 @@ enum mt76_mcu_evt_type { |
| EVT_EVENT_DFS_DETECT_RSP, |
| }; |
| |
| +enum ind_reason { |
| + IND_REASON_NORMAL, |
| + IND_REASON_REPEAT, |
| + IND_REASON_OLDPKT, |
| + IND_REASON_MAX |
| +}; |
| + |
| int mt76_dma_rx_poll(struct napi_struct *napi, int budget); |
| void mt76_dma_attach(struct mt76_dev *dev); |
| void mt76_dma_cleanup(struct mt76_dev *dev); |
| -- |
| 2.18.0 |
| |