From 9a6927e4ed98e4f55b3f079528d72447e5e9fd2e Mon Sep 17 00:00:00 2001 From: Subrat Dash Date: Sun, 27 Jun 2021 21:10:18 +0530 Subject: [PATCH] qcacmn: Add check to discard multicast echo packets The bridge forwards the multicast packets to all the interfaces attached the bridge. When the STA network interface receives such packets from bridge and send it to the AP, it is echoed back from the BSS. These packets are not intended for the bridge as it will lead to looping. Add a check to detect and drop such packets when received back from the BSS. Change-Id: I5a4a2a3e015df2b9c78de405d7d917216baed051 CRs-Fixed: 2997189 --- dp/wifi3.0/dp_rx.c | 26 -------------------------- dp/wifi3.0/li/dp_li_rx.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 26a43c1ee6..b109446df8 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -2097,32 +2097,6 @@ void dp_rx_deliver_to_pkt_capture_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf, #endif -#if defined(FEATURE_MCL_REPEATER) && defined(FEATURE_MEC) -/** - * dp_rx_mec_check_wrapper() - wrapper to dp_rx_mcast_echo_check - * @soc: core DP main context - * @peer: dp peer handler - * @rx_tlv_hdr: start of the rx TLV header - * @nbuf: pkt buffer - * - * Return: bool (true if it is a looped back pkt else false) - */ -static inline bool dp_rx_mec_check_wrapper(struct dp_soc *soc, - struct dp_peer *peer, - uint8_t *rx_tlv_hdr, - qdf_nbuf_t nbuf) -{ - return dp_rx_mcast_echo_check(soc, peer, rx_tlv_hdr, nbuf); -} -#else -static inline bool dp_rx_mec_check_wrapper(struct dp_soc *soc, - struct dp_peer *peer, - uint8_t *rx_tlv_hdr, - qdf_nbuf_t nbuf) -{ - return false; -} -#endif #endif /* QCA_HOST_MODE_WIFI_DISABLED */ QDF_STATUS dp_rx_vdev_detach(struct dp_vdev *vdev) diff --git a/dp/wifi3.0/li/dp_li_rx.c b/dp/wifi3.0/li/dp_li_rx.c index b809d5593c..1d2ac4f5e7 100644 --- a/dp/wifi3.0/li/dp_li_rx.c +++ b/dp/wifi3.0/li/dp_li_rx.c @@ -54,6 +54,35 @@ bool is_sa_da_idx_valid(struct dp_soc *soc, uint8_t *rx_tlv_hdr, return true; } +#ifndef QCA_HOST_MODE_WIFI_DISABLED +#if defined(FEATURE_MCL_REPEATER) && defined(FEATURE_MEC) +/** + * dp_rx_mec_check_wrapper() - wrapper to dp_rx_mcast_echo_check + * @soc: core DP main context + * @peer: dp peer handler + * @rx_tlv_hdr: start of the rx TLV header + * @nbuf: pkt buffer + * + * Return: bool (true if it is a looped back pkt else false) + */ +static inline bool dp_rx_mec_check_wrapper(struct dp_soc *soc, + struct dp_peer *peer, + uint8_t *rx_tlv_hdr, + qdf_nbuf_t nbuf) +{ + return dp_rx_mcast_echo_check(soc, peer, rx_tlv_hdr, nbuf); +} +#else +static inline bool dp_rx_mec_check_wrapper(struct dp_soc *soc, + struct dp_peer *peer, + uint8_t *rx_tlv_hdr, + qdf_nbuf_t nbuf) +{ + return false; +} +#endif +#endif + /** * dp_rx_process_li() - Brain of the Rx processing functionality * Called from the bottom half (tasklet/NET_RX_SOFTIRQ) @@ -702,6 +731,17 @@ done: DP_STATS_INC(soc, rx.err.invalid_sa_da_idx, 1); continue; } + if (qdf_unlikely(dp_rx_mec_check_wrapper(soc, + peer, + rx_tlv_hdr, + nbuf))) { + /* this is a looped back MCBC pkt,drop it */ + DP_STATS_INC_PKT(peer, rx.mec_drop, 1, + QDF_NBUF_CB_RX_PKT_LEN(nbuf)); + qdf_nbuf_free(nbuf); + nbuf = next; + continue; + } /* WDS Source Port Learning */ if (qdf_likely(vdev->wds_enabled)) dp_rx_wds_srcport_learn(soc,