From 1fc0fad0d906a8fae16e8bcadcc0afe6970090ae Mon Sep 17 00:00:00 2001 From: Ahmad Masri Date: Sun, 7 Mar 2021 13:06:08 +0200 Subject: [PATCH] wil6210: Drop unicast sub frame if part of a multicast amsdu Check that for a given multicast amsdu frame, all its sub frames are multicast also, if not, means if found a unicast sub frame, drop it and all the next sub frames for the same multicast amsdu. Change-Id: Ib9bcc45d9fcafec11c9c2a786fcabf278a666cb4 Signed-off-by: Ahmad Masri --- drivers/net/wireless/ath/wil6210/txrx_edma.c | 16 ++++++++++++++-- drivers/net/wireless/ath/wil6210/txrx_edma.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.c b/drivers/net/wireless/ath/wil6210/txrx_edma.c index de77d89beb56..f0bdc41f7553 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.c +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.c @@ -859,9 +859,20 @@ static int wil_check_amsdu(struct wil6210_priv *wil, void *msg, int cid, switch (vif->wdev.iftype) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: + /* check if the MSDU (a sub-frame of AMSDU) is multicast */ if (is_multicast_ether_addr(da)) return 0; + /* check if the current AMSDU (MPDU) frame is a multicast. + * If so we have unicast sub frame as part of a multicast + * AMSDU. Current frame and all sub frames should be dropped. + */ + if (wil_rx_status_get_mcast(msg)) { + wil_dbg_txrx(wil, + "Found unicast sub frame in a multicast mpdu. Drop it\n"); + goto out; + } + /* On client side, DA should be the client mac address */ ndev = vif_to_ndev(vif); if (ether_addr_equal(ndev->dev_addr, da)) @@ -882,12 +893,13 @@ static int wil_check_amsdu(struct wil6210_priv *wil, void *msg, int cid, return 0; } +out: sta->amsdu_drop_sn = seq; sta->amsdu_drop_tid = tid; sta->amsdu_drop = 1; wil_dbg_txrx(wil, - "Drop AMSDU frame, sn=%d. Drop this and all next sub frames\n", - seq); + "Drop AMSDU frame, sn=%d tid=%d. Drop this and all next sub frames\n", + seq, tid); return -EAGAIN; } diff --git a/drivers/net/wireless/ath/wil6210/txrx_edma.h b/drivers/net/wireless/ath/wil6210/txrx_edma.h index 56c5aff5137c..b02d177e7b29 100644 --- a/drivers/net/wireless/ath/wil6210/txrx_edma.h +++ b/drivers/net/wireless/ath/wil6210/txrx_edma.h @@ -372,7 +372,7 @@ static inline u16 wil_rx_status_get_flow_id(void *msg) static inline u8 wil_rx_status_get_mcast(void *msg) { return WIL_GET_BITS(((struct wil_rx_status_compressed *)msg)->d0, - 26, 26); + 25, 26); } /**