Search Linux Wireless

[RFC v1 176/256] cl8k: add rx/rx_filter.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Viktor Barna <viktor.barna@xxxxxxxxxx>

(Part of the split. Please, take a look at the cover letter for more
details).

Signed-off-by: Viktor Barna <viktor.barna@xxxxxxxxxx>
---
 .../net/wireless/celeno/cl8k/rx/rx_filter.c   | 88 +++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 drivers/net/wireless/celeno/cl8k/rx/rx_filter.c

diff --git a/drivers/net/wireless/celeno/cl8k/rx/rx_filter.c b/drivers/net/wireless/celeno/cl8k/rx/rx_filter.c
new file mode 100644
index 000000000000..95415ec6aad0
--- /dev/null
+++ b/drivers/net/wireless/celeno/cl8k/rx/rx_filter.c
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: MIT
+/* Copyright(c) 2019-2021, Celeno Communications Ltd. */
+
+#include "rx/rx_filter.h"
+#include "fw/msg_tx.h"
+#include "ieee80211_i.h"
+
+u32 cl_rx_filter_update_flags(struct cl_hw *cl_hw, u32 filter)
+{
+       u32 rx_filter = 0;
+
+       if (filter & FIF_ALLMULTI)
+               rx_filter |= RX_CNTRL_ACCEPT_MULTICAST_BIT;
+
+       if (filter & (FIF_FCSFAIL | FIF_PLCPFAIL))
+               rx_filter |= RX_CNTRL_ACCEPT_ERROR_FRAMES_BIT;
+
+       if (filter & FIF_BCN_PRBRESP_PROMISC)
+               rx_filter |= RX_CNTRL_ACCEPT_OTHER_BSSID_BIT;
+
+       if (filter & FIF_CONTROL)
+               rx_filter |= RX_CNTRL_ACCEPT_OTHER_CNTRL_FRAMES_BIT |
+                            RX_CNTRL_ACCEPT_CF_END_BIT |
+                            RX_CNTRL_ACCEPT_ACK_BIT |
+                            RX_CNTRL_ACCEPT_CTS_BIT |
+                            RX_CNTRL_ACCEPT_RTS_BIT |
+                            RX_CNTRL_ACCEPT_BA_BIT | RX_CNTRL_ACCEPT_BAR_BIT;
+
+       if (filter & FIF_OTHER_BSS)
+               rx_filter |= RX_CNTRL_ACCEPT_OTHER_BSSID_BIT;
+
+       if (filter & FIF_PSPOLL)
+               rx_filter |= RX_CNTRL_ACCEPT_PS_POLL_BIT;
+
+       if (filter & FIF_PROBE_REQ)
+               rx_filter |= RX_CNTRL_ACCEPT_PROBE_REQ_BIT;
+
+       /* Add the filter flags that are set by default and cannot be changed here */
+       rx_filter |= CL_MAC80211_NOT_CHANGEABLE;
+
+       if (ieee80211_hw_check(cl_hw->hw, AMPDU_AGGREGATION))
+               rx_filter |= RX_CNTRL_ACCEPT_BA_BIT;
+
+       /*
+        * work around for HW bug (AD 14672)
+        * In order for the response frames to BAR and RTS be with correct
+        * power they should always be accepted and found in the KSR
+        */
+       rx_filter |= RX_CNTRL_ACCEPT_BAR_BIT | RX_CNTRL_ACCEPT_RTS_BIT;
+
+       return rx_filter;
+}
+
+static u32 cl_filter_get_flags(struct net_device *dev)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       return sdata->local->filter_flags;
+}
+
+void cl_rx_filter_restore_flags(struct cl_hw *cl_hw)
+{
+       struct net_device *dev = cl_vif_get_first_net_device(cl_hw);
+       u32 filter = 0;
+
+       if (!dev)
+               return;
+
+       filter = cl_filter_get_flags(dev);
+       cl_dbg_verbose(cl_hw, "Restoring filter flags to 0x%x\n", filter);
+       cl_msg_tx_set_filter(cl_hw, filter, false);
+}
+
+void cl_rx_filter_set_promiscuous_off(unsigned long data)
+{
+       struct cl_hw *cl_hw = (struct cl_hw *)data;
+
+       cl_rx_filter_restore_flags(cl_hw);
+}
+
+void cl_rx_filter_set_promiscuous(struct cl_hw *cl_hw)
+{
+       u32 filter = ~(FIF_FCSFAIL | FIF_PLCPFAIL | (1 << 31));
+
+       cl_dbg_verbose(cl_hw, "set promiscuous mode 0x%x\n", filter);
+       cl_msg_tx_set_filter(cl_hw, filter, false);
+}
+
--
2.30.0

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux