1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @brief Header containing code to support promiscuous mode 9 * for the FMAC IF Layer of the Wi-Fi driver. 10 */ 11 #ifndef __FMAC_PROMISC_H__ 12 #define __FMAC_PROMISC_H__ 13 #include "system/fmac_structs.h" 14 #include "common/pack_def.h" 15 16 /** 802.11 Packet-type */ 17 enum nrf_wifi_fmac_frame_type { 18 /** 802.11 management packet type */ 19 NRF_WIFI_MGMT_PKT_TYPE = 0x0, 20 /** 802.11 control packet type */ 21 NRF_WIFI_CTRL_PKT_TYPE, 22 /** 802.11 data packet type */ 23 NRF_WIFI_DATA_PKT_TYPE, 24 }; 25 26 /** Packet filter settings in driver */ 27 enum nrf_wifi_packet_filter { 28 /** Filter management packets only */ 29 FILTER_MGMT_ONLY = 0x2, 30 /** Filter data packets only */ 31 FILTER_DATA_ONLY = 0x4, 32 /** Filter data and management packets */ 33 FILTER_DATA_MGMT = 0x6, 34 /** Filter control packets only */ 35 FILTER_CTRL_ONLY = 0x8, 36 /** Filter control and management packets */ 37 FILTER_CTRL_MGMT = 0xa, 38 /** Filter data and control packets */ 39 FILTER_DATA_CTRL = 0xc 40 }; 41 42 /** Frame Control structure which 43 * depends on the endianness in the system. 44 * For example 0x8842 in big endian would 45 * become 0x4288 in little endian. The bytes 46 * are swapped. 47 **/ 48 #if defined(CONFIG_LITTLE_ENDIAN) 49 struct nrf_wifi_fmac_frame_ctrl { 50 unsigned short protocolVersion : 2; 51 unsigned short type : 2; 52 unsigned short subtype : 4; 53 unsigned short toDS : 1; 54 unsigned short fromDS : 1; 55 unsigned short moreFragments : 1; 56 unsigned short retry : 1; 57 unsigned short powerManagement : 1; 58 unsigned short moreData : 1; 59 unsigned short protectedFrame : 1; 60 unsigned short order : 1; 61 } __NRF_WIFI_PKD; 62 #else 63 struct nrf_wifi_fmac_frame_ctrl { 64 unsigned short toDS : 1; 65 unsigned short fromDS : 1; 66 unsigned short moreFragments : 1; 67 unsigned short retry : 1; 68 unsigned short powerManagement : 1; 69 unsigned short moreData : 1; 70 unsigned short protectedFrame : 1; 71 unsigned short order : 1; 72 unsigned short protocolVersion : 2; 73 unsigned short type : 2; 74 unsigned short subtype : 4; 75 } __NRF_WIFI_PKD; 76 #endif 77 78 bool nrf_wifi_util_check_filt_setting(struct nrf_wifi_fmac_vif_ctx *vif, 79 unsigned short *frame_control); 80 #endif /* __FMAC_PROMISC_H__ */ 81