1 /****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of version 2 of the GNU General Public License as 14 * published by the Free Software Foundation. 15 * 16 * This program is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * General Public License for more details. 20 * 21 * The full GNU General Public License is included in this distribution 22 * in the file called COPYING. 23 * 24 * Contact Information: 25 * Intel Linux Wireless <linuxwifi@intel.com> 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 27 * 28 * BSD LICENSE 29 * 30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * All rights reserved. 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 39 * * Redistributions of source code must retain the above copyright 40 * notice, this list of conditions and the following disclaimer. 41 * * Redistributions in binary form must reproduce the above copyright 42 * notice, this list of conditions and the following disclaimer in 43 * the documentation and/or other materials provided with the 44 * distribution. 45 * * Neither the name Intel Corporation nor the names of its 46 * contributors may be used to endorse or promote products derived 47 * from this software without specific prior written permission. 48 * 49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 60 * 61 *****************************************************************************/ 62 63 #ifndef __iwl_fw_api_filter_h__ 64 #define __iwl_fw_api_filter_h__ 65 66 #include "fw/api/mac.h" 67 68 #define MAX_PORT_ID_NUM 2 69 #define MAX_MCAST_FILTERING_ADDRESSES 256 70 71 /** 72 * struct iwl_mcast_filter_cmd - configure multicast filter. 73 * @filter_own: Set 1 to filter out multicast packets sent by station itself 74 * @port_id: Multicast MAC addresses array specifier. This is a strange way 75 * to identify network interface adopted in host-device IF. 76 * It is used by FW as index in array of addresses. This array has 77 * MAX_PORT_ID_NUM members. 78 * @count: Number of MAC addresses in the array 79 * @pass_all: Set 1 to pass all multicast packets. 80 * @bssid: current association BSSID. 81 * @reserved: reserved 82 * @addr_list: Place holder for array of MAC addresses. 83 * IMPORTANT: add padding if necessary to ensure DWORD alignment. 84 */ 85 struct iwl_mcast_filter_cmd { 86 u8 filter_own; 87 u8 port_id; 88 u8 count; 89 u8 pass_all; 90 u8 bssid[6]; 91 u8 reserved[2]; 92 u8 addr_list[0]; 93 } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */ 94 95 #define MAX_BCAST_FILTERS 8 96 #define MAX_BCAST_FILTER_ATTRS 2 97 98 /** 99 * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet 100 * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start. 101 * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e. 102 * start of ip payload). 103 */ 104 enum iwl_mvm_bcast_filter_attr_offset { 105 BCAST_FILTER_OFFSET_PAYLOAD_START = 0, 106 BCAST_FILTER_OFFSET_IP_END = 1, 107 }; 108 109 /** 110 * struct iwl_fw_bcast_filter_attr - broadcast filter attribute 111 * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset. 112 * @offset: starting offset of this pattern. 113 * @reserved1: reserved 114 * @val: value to match - big endian (MSB is the first 115 * byte to match from offset pos). 116 * @mask: mask to match (big endian). 117 */ 118 struct iwl_fw_bcast_filter_attr { 119 u8 offset_type; 120 u8 offset; 121 __le16 reserved1; 122 __be32 val; 123 __be32 mask; 124 } __packed; /* BCAST_FILTER_ATT_S_VER_1 */ 125 126 /** 127 * enum iwl_mvm_bcast_filter_frame_type - filter frame type 128 * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames. 129 * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames 130 */ 131 enum iwl_mvm_bcast_filter_frame_type { 132 BCAST_FILTER_FRAME_TYPE_ALL = 0, 133 BCAST_FILTER_FRAME_TYPE_IPV4 = 1, 134 }; 135 136 /** 137 * struct iwl_fw_bcast_filter - broadcast filter 138 * @discard: discard frame (1) or let it pass (0). 139 * @frame_type: &enum iwl_mvm_bcast_filter_frame_type. 140 * @reserved1: reserved 141 * @num_attrs: number of valid attributes in this filter. 142 * @attrs: attributes of this filter. a filter is considered matched 143 * only when all its attributes are matched (i.e. AND relationship) 144 */ 145 struct iwl_fw_bcast_filter { 146 u8 discard; 147 u8 frame_type; 148 u8 num_attrs; 149 u8 reserved1; 150 struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS]; 151 } __packed; /* BCAST_FILTER_S_VER_1 */ 152 153 /** 154 * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration. 155 * @default_discard: default action for this mac (discard (1) / pass (0)). 156 * @reserved1: reserved 157 * @attached_filters: bitmap of relevant filters for this mac. 158 */ 159 struct iwl_fw_bcast_mac { 160 u8 default_discard; 161 u8 reserved1; 162 __le16 attached_filters; 163 } __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */ 164 165 /** 166 * struct iwl_bcast_filter_cmd - broadcast filtering configuration 167 * @disable: enable (0) / disable (1) 168 * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS) 169 * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER) 170 * @reserved1: reserved 171 * @filters: broadcast filters 172 * @macs: broadcast filtering configuration per-mac 173 */ 174 struct iwl_bcast_filter_cmd { 175 u8 disable; 176 u8 max_bcast_filters; 177 u8 max_macs; 178 u8 reserved1; 179 struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS]; 180 struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER]; 181 } __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */ 182 183 #endif /* __iwl_fw_api_filter_h__ */