1 /******************************************************************************
3 Copyright (c) 2013-2014, Intel Corporation
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
9 1. Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Intel Corporation nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
32 ******************************************************************************/
39 #define IXLV_AQ_MAX_ERR 100
40 #define IXLV_MAX_FILTERS 128
41 #define IXLV_MAX_QUEUES 16
42 #define IXLV_AQ_TIMEOUT (1 * hz)
43 #define IXLV_CALLOUT_TIMO (hz / 50) // 20 msec
45 #define IXLV_FLAG_AQ_ENABLE_QUEUES (u32)(1)
46 #define IXLV_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1)
47 #define IXLV_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2)
48 #define IXLV_FLAG_AQ_ADD_VLAN_FILTER (u32)(1 << 3)
49 #define IXLV_FLAG_AQ_DEL_MAC_FILTER (u32)(1 << 4)
50 #define IXLV_FLAG_AQ_DEL_VLAN_FILTER (u32)(1 << 5)
51 #define IXLV_FLAG_AQ_CONFIGURE_QUEUES (u32)(1 << 6)
52 #define IXLV_FLAG_AQ_MAP_VECTORS (u32)(1 << 7)
53 #define IXLV_FLAG_AQ_HANDLE_RESET (u32)(1 << 8)
54 #define IXLV_FLAG_AQ_CONFIGURE_PROMISC (u32)(1 << 9)
55 #define IXLV_FLAG_AQ_GET_STATS (u32)(1 << 10)
59 "\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \
60 "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \
61 "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \
62 "\12CONFIGURE_PROMISC\13GET_STATS"
81 struct ixlv_mac_filter {
82 SLIST_ENTRY(ixlv_mac_filter) next;
83 u8 macaddr[ETHER_ADDR_LEN];
86 SLIST_HEAD(mac_list, ixlv_mac_filter);
88 struct ixlv_vlan_filter {
89 SLIST_ENTRY(ixlv_vlan_filter) next;
93 SLIST_HEAD(vlan_list, ixlv_vlan_filter);
95 /* Software controller structure */
98 struct i40e_osdep osdep;
101 struct resource *pci_mem;
102 struct resource *msix_mem;
104 enum ixlv_state_t init_state;
107 * Interrupt resources
110 struct resource *res; /* For the AQ */
112 struct ifmedia media;
113 struct callout timer;
114 struct callout aq_task;
119 struct mtx aq_task_mtx;
123 struct timeout_task timeout;
125 struct task aq_sched;
126 struct taskqueue *tq;
130 /* Mac Filter List */
131 struct mac_list *mac_filters;
133 /* Vlan Filter List */
134 struct vlan_list *vlan_filters;
136 /* Promiscuous mode */
137 u32 promiscuous_flags;
139 /* Admin queue task flags */
144 /* Virtual comm channel */
145 enum i40e_virtchnl_ops current_op;
146 struct i40e_virtchnl_vf_resource *vf_res;
147 struct i40e_virtchnl_vsi_resource *vsi_res;
149 /* Misc stats maintained by the driver */
153 /* Signaling channels */
155 u8 config_queues_done;
157 u8 enable_queues_done;
158 u8 disable_queues_done;
164 ** This checks for a zero mac addr, something that will be likely
165 ** unless the Admin on the Host has created one.
168 ixlv_check_ether_addr(u8 *addr)
172 if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 &&
173 addr[3] == 0 && addr[4]== 0 && addr[5] == 0))
179 ** VF Common function prototypes
181 int ixlv_send_api_ver(struct ixlv_sc *);
182 int ixlv_verify_api_ver(struct ixlv_sc *);
183 int ixlv_send_vf_config_msg(struct ixlv_sc *);
184 int ixlv_get_vf_config(struct ixlv_sc *);
185 void ixlv_init(void *);
186 int ixlv_reinit_locked(struct ixlv_sc *);
187 void ixlv_configure_queues(struct ixlv_sc *);
188 void ixlv_enable_queues(struct ixlv_sc *);
189 void ixlv_disable_queues(struct ixlv_sc *);
190 void ixlv_map_queues(struct ixlv_sc *);
191 void ixlv_enable_intr(struct ixl_vsi *);
192 void ixlv_disable_intr(struct ixl_vsi *);
193 void ixlv_add_ether_filters(struct ixlv_sc *);
194 void ixlv_del_ether_filters(struct ixlv_sc *);
195 void ixlv_request_stats(struct ixlv_sc *);
196 void ixlv_request_reset(struct ixlv_sc *);
197 void ixlv_vc_completion(struct ixlv_sc *,
198 enum i40e_virtchnl_ops, i40e_status, u8 *, u16);
199 void ixlv_add_ether_filter(struct ixlv_sc *);
200 void ixlv_add_vlans(struct ixlv_sc *);
201 void ixlv_del_vlans(struct ixlv_sc *);
202 void ixlv_update_stats_counters(struct ixlv_sc *,
203 struct i40e_eth_stats *);
205 #endif /* _IXLV_H_ */