1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2012-2014 Intel Corporation 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 */ 7 #ifndef __iwl_fw_api_filter_h__ 8 #define __iwl_fw_api_filter_h__ 9 10 #include "fw/api/mac.h" 11 12 #define MAX_PORT_ID_NUM 2 13 #define MAX_MCAST_FILTERING_ADDRESSES 256 14 15 /** 16 * struct iwl_mcast_filter_cmd - configure multicast filter. 17 * @filter_own: Set 1 to filter out multicast packets sent by station itself 18 * @port_id: Multicast MAC addresses array specifier. This is a strange way 19 * to identify network interface adopted in host-device IF. 20 * It is used by FW as index in array of addresses. This array has 21 * MAX_PORT_ID_NUM members. 22 * @count: Number of MAC addresses in the array 23 * @pass_all: Set 1 to pass all multicast packets. 24 * @bssid: current association BSSID. 25 * @reserved: reserved 26 * @addr_list: Place holder for array of MAC addresses. 27 * IMPORTANT: add padding if necessary to ensure DWORD alignment. 28 */ 29 struct iwl_mcast_filter_cmd { 30 u8 filter_own; 31 u8 port_id; 32 u8 count; 33 u8 pass_all; 34 u8 bssid[6]; 35 u8 reserved[2]; 36 u8 addr_list[0]; 37 } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ 38 39 #define MAX_BCAST_FILTERS 8 40 #define MAX_BCAST_FILTER_ATTRS 2 41 42 /** 43 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet 44 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start. 45 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e. 46 * start of ip payload). 47 */ 48 enum iwl_mvm_bcast_filter_attr_offset { 49 BCAST_FILTER_OFFSET_PAYLOAD_START = 0, 50 BCAST_FILTER_OFFSET_IP_END = 1, 51 }; 52 53 /** 54 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute 55 * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset. 56 * @offset: starting offset of this pattern. 57 * @reserved1: reserved 58 * @val: value to match - big endian (MSB is the first 59 * byte to match from offset pos). 60 * @mask: mask to match (big endian). 61 */ 62 struct iwl_fw_bcast_filter_attr { 63 u8 offset_type; 64 u8 offset; 65 __le16 reserved1; 66 __be32 val; 67 __be32 mask; 68 } __packed; /* BCAST_FILTER_ATT_S_VER_1 */ 69 70 /** 71 * enum iwl_mvm_bcast_filter_frame_type - filter frame type 72 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames. 73 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames 74 */ 75 enum iwl_mvm_bcast_filter_frame_type { 76 BCAST_FILTER_FRAME_TYPE_ALL = 0, 77 BCAST_FILTER_FRAME_TYPE_IPV4 = 1, 78 }; 79 80 /** 81 * struct iwl_fw_bcast_filter - broadcast filter 82 * @discard: discard frame (1) or let it pass (0). 83 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type. 84 * @reserved1: reserved 85 * @num_attrs: number of valid attributes in this filter. 86 * @attrs: attributes of this filter. a filter is considered matched 87 * only when all its attributes are matched (i.e. AND relationship) 88 */ 89 struct iwl_fw_bcast_filter { 90 u8 discard; 91 u8 frame_type; 92 u8 num_attrs; 93 u8 reserved1; 94 struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS]; 95 } __packed; /* BCAST_FILTER_S_VER_1 */ 96 97 /** 98 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration. 99 * @default_discard: default action for this mac (discard (1) / pass (0)). 100 * @reserved1: reserved 101 * @attached_filters: bitmap of relevant filters for this mac. 102 */ 103 struct iwl_fw_bcast_mac { 104 u8 default_discard; 105 u8 reserved1; 106 __le16 attached_filters; 107 } __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */ 108 109 /** 110 * struct iwl_bcast_filter_cmd - broadcast filtering configuration 111 * @disable: enable (0) / disable (1) 112 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS) 113 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER) 114 * @reserved1: reserved 115 * @filters: broadcast filters 116 * @macs: broadcast filtering configuration per-mac 117 */ 118 struct iwl_bcast_filter_cmd { 119 u8 disable; 120 u8 max_bcast_filters; 121 u8 max_macs; 122 u8 reserved1; 123 struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS]; 124 struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER]; 125 } __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */ 126 127 #endif /* __iwl_fw_api_filter_h__ */ 128