xref: /freebsd/sys/dev/iavf/iavf_lib.h (revision 4530e0c3e78d0616367d37273d6c1f47f627839b)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*  Copyright (c) 2021, Intel Corporation
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *
8  *   1. Redistributions of source code must retain the above copyright notice,
9  *      this list of conditions and the following disclaimer.
10  *
11  *   2. Redistributions in binary form must reproduce the above copyright
12  *      notice, this list of conditions and the following disclaimer in the
13  *      documentation and/or other materials provided with the distribution.
14  *
15  *   3. Neither the name of the Intel Corporation nor the names of its
16  *      contributors may be used to endorse or promote products derived from
17  *      this software without specific prior written permission.
18  *
19  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *  POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*$FreeBSD$*/
32 
33 /**
34  * @file iavf_lib.h
35  * @brief header for structures and functions common to legacy and iflib
36  *
37  * Contains definitions and function declarations which are shared between the
38  * legacy and iflib driver implementation.
39  */
40 #ifndef _IAVF_LIB_H_
41 #define _IAVF_LIB_H_
42 
43 #include <sys/malloc.h>
44 #include <machine/stdarg.h>
45 #include <sys/sysctl.h>
46 #ifdef RSS
47 #include <net/rss_config.h>
48 #endif
49 
50 #include "iavf_debug.h"
51 #include "iavf_osdep.h"
52 #include "iavf_type.h"
53 #include "iavf_prototype.h"
54 
55 MALLOC_DECLARE(M_IAVF);
56 
57 /*
58  * Ring Descriptors Valid Range: 32-4096 Default Value: 1024 This value is the
59  * number of tx/rx descriptors allocated by the driver. Increasing this
60  * value allows the driver to queue more operations.
61  *
62  * Tx descriptors are always 16 bytes, but Rx descriptors can be 32 bytes.
63  * The driver currently always uses 32 byte Rx descriptors.
64  */
65 #define IAVF_DEFAULT_RING	1024
66 #define IAVF_MAX_RING		4096
67 #define IAVF_MIN_RING		64
68 #define IAVF_RING_INCREMENT	32
69 
70 #define IAVF_AQ_LEN		256
71 #define IAVF_AQ_LEN_MAX		1024
72 
73 /*
74 ** Default number of entries in Tx queue buf_ring.
75 */
76 #define DEFAULT_TXBRSZ		4096
77 
78 /* Alignment for rings */
79 #define DBA_ALIGN		128
80 
81 /*
82  * Max number of multicast MAC addrs added to the driver's
83  * internal lists before converting to promiscuous mode
84  */
85 #define MAX_MULTICAST_ADDR	128
86 
87 /* Byte alignment for Tx/Rx descriptor rings */
88 #define DBA_ALIGN		128
89 
90 #define IAVF_MSIX_BAR		3
91 #define IAVF_ADM_LIMIT		2
92 #define IAVF_TSO_SIZE		((255*1024)-1)
93 #define IAVF_AQ_BUF_SZ		((u32) 4096)
94 #define IAVF_RX_HDR		128
95 #define IAVF_RX_LIMIT		512
96 #define IAVF_RX_ITR		0
97 #define IAVF_TX_ITR		1
98 /**
99  * The maximum packet length allowed to be sent or received by the adapter.
100  */
101 #define IAVF_MAX_FRAME		9728
102 /**
103  * The minimum packet length allowed to be sent by the adapter.
104  */
105 #define IAVF_MIN_FRAME		17
106 #define IAVF_MAX_TX_SEGS	8
107 #define IAVF_MAX_RX_SEGS	5
108 #define IAVF_MAX_TSO_SEGS	128
109 #define IAVF_SPARSE_CHAIN	7
110 #define IAVF_MIN_TSO_MSS	64
111 #define IAVF_MAX_TSO_MSS	9668
112 #define IAVF_MAX_DMA_SEG_SIZE	((16 * 1024) - 1)
113 #define IAVF_AQ_MAX_ERR		30
114 #define IAVF_MAX_INIT_WAIT	120
115 #define IAVF_AQ_TIMEOUT		(1 * hz)
116 #define IAVF_ADV_LINK_SPEED_SCALE	((u64)1000000)
117 #define IAVF_MAX_DIS_Q_RETRY	10
118 
119 #define IAVF_RSS_KEY_SIZE_REG		13
120 #define IAVF_RSS_KEY_SIZE		(IAVF_RSS_KEY_SIZE_REG * 4)
121 #define IAVF_RSS_VSI_LUT_SIZE		64	/* X722 -> VSI, X710 -> VF */
122 #define IAVF_RSS_VSI_LUT_ENTRY_MASK	0x3F
123 #define IAVF_RSS_VF_LUT_ENTRY_MASK	0xF
124 
125 /* Maximum MTU size */
126 #define IAVF_MAX_MTU (IAVF_MAX_FRAME - \
127 		     ETHER_HDR_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)
128 
129 /*
130  * Hardware requires that TSO packets have an segment size of at least 64
131  * bytes. To avoid sending bad frames to the hardware, the driver forces the
132  * MSS for all TSO packets to have a segment size of at least 64 bytes.
133  *
134  * However, if the MTU is reduced below a certain size, then the resulting
135  * larger MSS can result in transmitting segmented frames with a packet size
136  * larger than the MTU.
137  *
138  * Avoid this by preventing the MTU from being lowered below this limit.
139  * Alternative solutions require changing the TCP stack to disable offloading
140  * the segmentation when the requested segment size goes below 64 bytes.
141  */
142 #define IAVF_MIN_MTU 112
143 
144 /*
145  * Interrupt Moderation parameters
146  * Multiply ITR values by 2 for real ITR value
147  */
148 #define IAVF_MAX_ITR		0x0FF0
149 #define IAVF_ITR_100K		0x0005
150 #define IAVF_ITR_20K		0x0019
151 #define IAVF_ITR_8K		0x003E
152 #define IAVF_ITR_4K		0x007A
153 #define IAVF_ITR_1K		0x01F4
154 #define IAVF_ITR_DYNAMIC	0x8000
155 #define IAVF_LOW_LATENCY	0
156 #define IAVF_AVE_LATENCY	1
157 #define IAVF_BULK_LATENCY	2
158 
159 /* MacVlan Flags */
160 #define IAVF_FILTER_USED	(u16)(1 << 0)
161 #define IAVF_FILTER_VLAN	(u16)(1 << 1)
162 #define IAVF_FILTER_ADD		(u16)(1 << 2)
163 #define IAVF_FILTER_DEL		(u16)(1 << 3)
164 #define IAVF_FILTER_MC		(u16)(1 << 4)
165 /* used in the vlan field of the filter when not a vlan */
166 #define IAVF_VLAN_ANY		-1
167 
168 #define CSUM_OFFLOAD_IPV4	(CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
169 #define CSUM_OFFLOAD_IPV6	(CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6)
170 #define CSUM_OFFLOAD		(CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO)
171 
172 /* Misc flags for iavf_vsi.flags */
173 #define IAVF_FLAGS_KEEP_TSO4	(1 << 0)
174 #define IAVF_FLAGS_KEEP_TSO6	(1 << 1)
175 
176 #define IAVF_DEFAULT_RSS_HENA_BASE (\
177 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_UDP) |	\
178 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_TCP) |	\
179 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_SCTP) |	\
180 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_OTHER) |	\
181 	BIT_ULL(IAVF_FILTER_PCTYPE_FRAG_IPV4) |		\
182 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_UDP) |	\
183 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_TCP) |	\
184 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_SCTP) |	\
185 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_OTHER) |	\
186 	BIT_ULL(IAVF_FILTER_PCTYPE_FRAG_IPV6))
187 
188 #define IAVF_DEFAULT_ADV_RSS_HENA (\
189 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \
190 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \
191 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \
192 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP) | \
193 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \
194 	BIT_ULL(IAVF_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK))
195 
196 #define IAVF_DEFAULT_RSS_HENA_XL710 (\
197 	IAVF_DEFAULT_RSS_HENA_BASE |			\
198 	BIT_ULL(IAVF_FILTER_PCTYPE_L2_PAYLOAD))
199 
200 #define IAVF_DEFAULT_RSS_HENA_X722 (\
201 	IAVF_DEFAULT_RSS_HENA_XL710 |			\
202 	IAVF_DEFAULT_ADV_RSS_HENA)
203 
204 #define IAVF_DEFAULT_RSS_HENA_AVF (\
205 	IAVF_DEFAULT_RSS_HENA_BASE |			\
206 	IAVF_DEFAULT_ADV_RSS_HENA)
207 
208 /* Pre-11 counter(9) compatibility */
209 #define IAVF_SET_IPACKETS(vsi, count)	(vsi)->ipackets = (count)
210 #define IAVF_SET_IERRORS(vsi, count)	(vsi)->ierrors = (count)
211 #define IAVF_SET_OPACKETS(vsi, count)	(vsi)->opackets = (count)
212 #define IAVF_SET_OERRORS(vsi, count)	(vsi)->oerrors = (count)
213 #define IAVF_SET_COLLISIONS(vsi, count)	/* Do nothing; collisions is always 0. */
214 #define IAVF_SET_IBYTES(vsi, count)	(vsi)->ibytes = (count)
215 #define IAVF_SET_OBYTES(vsi, count)	(vsi)->obytes = (count)
216 #define IAVF_SET_IMCASTS(vsi, count)	(vsi)->imcasts = (count)
217 #define IAVF_SET_OMCASTS(vsi, count)	(vsi)->omcasts = (count)
218 #define IAVF_SET_IQDROPS(vsi, count)	(vsi)->iqdrops = (count)
219 #define IAVF_SET_OQDROPS(vsi, count)	(vsi)->oqdrops = (count)
220 #define IAVF_SET_NOPROTO(vsi, count)	(vsi)->noproto = (count)
221 
222 /* For stats sysctl naming */
223 #define IAVF_QUEUE_NAME_LEN 32
224 
225 #define IAVF_FLAG_AQ_ENABLE_QUEUES            (u32)(1 << 0)
226 #define IAVF_FLAG_AQ_DISABLE_QUEUES           (u32)(1 << 1)
227 #define IAVF_FLAG_AQ_ADD_MAC_FILTER           (u32)(1 << 2)
228 #define IAVF_FLAG_AQ_ADD_VLAN_FILTER          (u32)(1 << 3)
229 #define IAVF_FLAG_AQ_DEL_MAC_FILTER           (u32)(1 << 4)
230 #define IAVF_FLAG_AQ_DEL_VLAN_FILTER          (u32)(1 << 5)
231 #define IAVF_FLAG_AQ_CONFIGURE_QUEUES         (u32)(1 << 6)
232 #define IAVF_FLAG_AQ_MAP_VECTORS              (u32)(1 << 7)
233 #define IAVF_FLAG_AQ_HANDLE_RESET             (u32)(1 << 8)
234 #define IAVF_FLAG_AQ_CONFIGURE_PROMISC        (u32)(1 << 9)
235 #define IAVF_FLAG_AQ_GET_STATS                (u32)(1 << 10)
236 #define IAVF_FLAG_AQ_CONFIG_RSS_KEY           (u32)(1 << 11)
237 #define IAVF_FLAG_AQ_SET_RSS_HENA             (u32)(1 << 12)
238 #define IAVF_FLAG_AQ_GET_RSS_HENA_CAPS        (u32)(1 << 13)
239 #define IAVF_FLAG_AQ_CONFIG_RSS_LUT           (u32)(1 << 14)
240 
241 #define IAVF_CAP_ADV_LINK_SPEED(_sc) \
242     ((_sc)->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_ADV_LINK_SPEED)
243 
244 #define IAVF_NRXQS(_vsi) ((_vsi)->num_rx_queues)
245 #define IAVF_NTXQS(_vsi) ((_vsi)->num_tx_queues)
246 
247 /**
248  * printf %b flag args
249  */
250 #define IAVF_FLAGS \
251     "\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \
252     "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \
253     "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \
254     "\12CONFIGURE_PROMISC\13GET_STATS\14CONFIG_RSS_KEY" \
255     "\15SET_RSS_HENA\16GET_RSS_HENA_CAPS\17CONFIG_RSS_LUT"
256 /**
257  * printf %b flag args for offloads from virtchnl.h
258  */
259 #define IAVF_PRINTF_VF_OFFLOAD_FLAGS \
260     "\20\1L2" \
261     "\2IWARP" \
262     "\3FCOE" \
263     "\4RSS_AQ" \
264     "\5RSS_REG" \
265     "\6WB_ON_ITR" \
266     "\7REQ_QUEUES" \
267     "\10ADV_LINK_SPEED" \
268     "\21VLAN" \
269     "\22RX_POLLING" \
270     "\23RSS_PCTYPE_V2" \
271     "\24RSS_PF" \
272     "\25ENCAP" \
273     "\26ENCAP_CSUM" \
274     "\27RX_ENCAP_CSUM" \
275     "\30ADQ"
276 
277 /**
278  * @enum iavf_ext_link_speed
279  * @brief Extended link speed enumeration
280  *
281  * Enumeration of possible link speeds that the device could be operating in.
282  * Contains an extended list compared to the virtchnl_link_speed, including
283  * additional higher speeds such as 50GB, and 100GB.
284  *
285  * The enumeration is used to convert between the old virtchnl_link_speed, the
286  * newer advanced speed reporting value specified in Mb/s, and the ifmedia
287  * link speeds reported to the operating system.
288  */
289 enum iavf_ext_link_speed {
290 	IAVF_EXT_LINK_SPEED_UNKNOWN,
291 	IAVF_EXT_LINK_SPEED_10MB,
292 	IAVF_EXT_LINK_SPEED_100MB,
293 	IAVF_EXT_LINK_SPEED_1000MB,
294 	IAVF_EXT_LINK_SPEED_2500MB,
295 	IAVF_EXT_LINK_SPEED_5GB,
296 	IAVF_EXT_LINK_SPEED_10GB,
297 	IAVF_EXT_LINK_SPEED_20GB,
298 	IAVF_EXT_LINK_SPEED_25GB,
299 	IAVF_EXT_LINK_SPEED_40GB,
300 	IAVF_EXT_LINK_SPEED_50GB,
301 	IAVF_EXT_LINK_SPEED_100GB,
302 };
303 
304 /**
305  * @struct iavf_sysctl_info
306  * @brief sysctl statistic info
307  *
308  * Structure describing a single statistics sysctl, used for reporting
309  * specific hardware and software statistics via the sysctl interface.
310  */
311 struct iavf_sysctl_info {
312 	u64	*stat;
313 	char	*name;
314 	char	*description;
315 };
316 
317 /* Forward struct declarations */
318 struct iavf_sc;
319 struct iavf_vsi;
320 
321 /**
322  * @enum iavf_state
323  * @brief Driver state flags
324  *
325  * Used to indicate the status of various driver events. Intended to be
326  * modified only using atomic operations, so that we can use it even in places
327  * which aren't locked.
328  */
329 enum iavf_state {
330 	IAVF_STATE_INITIALIZED,
331 	IAVF_STATE_RESET_REQUIRED,
332 	IAVF_STATE_RESET_PENDING,
333 	IAVF_STATE_RUNNING,
334 	/* This entry must be last */
335 	IAVF_STATE_LAST,
336 };
337 
338 /* Functions for setting and checking driver state. Note the functions take
339  * bit positions, not bitmasks. The atomic_testandset_32 and
340  * atomic_testandclear_32 operations require bit positions, while the
341  * atomic_set_32 and atomic_clear_32 require bitmasks. This can easily lead to
342  * programming error, so we provide wrapper functions to avoid this.
343  */
344 
345 /**
346  * iavf_set_state - Set the specified state
347  * @s: the state bitmap
348  * @bit: the state to set
349  *
350  * Atomically update the state bitmap with the specified bit set.
351  */
352 static inline void
353 iavf_set_state(volatile u32 *s, enum iavf_state bit)
354 {
355 	/* atomic_set_32 expects a bitmask */
356 	atomic_set_32(s, BIT(bit));
357 }
358 
359 /**
360  * iavf_clear_state - Clear the specified state
361  * @s: the state bitmap
362  * @bit: the state to clear
363  *
364  * Atomically update the state bitmap with the specified bit cleared.
365  */
366 static inline void
367 iavf_clear_state(volatile u32 *s, enum iavf_state bit)
368 {
369 	/* atomic_clear_32 expects a bitmask */
370 	atomic_clear_32(s, BIT(bit));
371 }
372 
373 /**
374  * iavf_testandset_state - Test and set the specified state
375  * @s: the state bitmap
376  * @bit: the bit to test
377  *
378  * Atomically update the state bitmap, setting the specified bit.
379  *
380  * @returns the previous value of the bit.
381  */
382 static inline u32
383 iavf_testandset_state(volatile u32 *s, enum iavf_state bit)
384 {
385 	/* atomic_testandset_32 expects a bit position */
386 	return atomic_testandset_32(s, bit);
387 }
388 
389 /**
390  * iavf_testandclear_state - Test and clear the specified state
391  * @s: the state bitmap
392  * @bit: the bit to test
393  *
394  * Atomically update the state bitmap, clearing the specified bit.
395  *
396  * @returns the previous value of the bit.
397  */
398 static inline u32
399 iavf_testandclear_state(volatile u32 *s, enum iavf_state bit)
400 {
401 	/* atomic_testandclear_32 expects a bit position */
402 	return atomic_testandclear_32(s, bit);
403 }
404 
405 /**
406  * iavf_test_state - Test the specified state
407  * @s: the state bitmap
408  * @bit: the bit to test
409  *
410  * @returns true if the state is set, false otherwise.
411  *
412  * @remark Use this only if the flow does not need to update the state. If you
413  * must update the state as well, prefer iavf_testandset_state or
414  * iavf_testandclear_state.
415  */
416 static inline u32
417 iavf_test_state(volatile u32 *s, enum iavf_state bit)
418 {
419 	return (*s & BIT(bit)) ? true : false;
420 }
421 
422 /**
423  * cmp_etheraddr - Compare two ethernet addresses
424  * @ea1: first ethernet address
425  * @ea2: second ethernet address
426  *
427  * Compares two ethernet addresses.
428  *
429  * @returns true if the addresses are equal, false otherwise.
430  */
431 static inline bool
432 cmp_etheraddr(const u8 *ea1, const u8 *ea2)
433 {
434 	bool cmp = FALSE;
435 
436 	if ((ea1[0] == ea2[0]) && (ea1[1] == ea2[1]) &&
437 	    (ea1[2] == ea2[2]) && (ea1[3] == ea2[3]) &&
438 	    (ea1[4] == ea2[4]) && (ea1[5] == ea2[5]))
439 		cmp = TRUE;
440 
441 	return (cmp);
442 }
443 
444 int iavf_send_vc_msg(struct iavf_sc *sc, u32 op);
445 int iavf_send_vc_msg_sleep(struct iavf_sc *sc, u32 op);
446 void iavf_update_link_status(struct iavf_sc *);
447 bool iavf_driver_is_detaching(struct iavf_sc *sc);
448 void iavf_msec_pause(int msecs);
449 void iavf_get_default_rss_key(u32 *key);
450 int iavf_allocate_pci_resources_common(struct iavf_sc *sc);
451 int iavf_reset_complete(struct iavf_hw *hw);
452 int iavf_setup_vc(struct iavf_sc *sc);
453 int iavf_reset(struct iavf_sc *sc);
454 void iavf_enable_adminq_irq(struct iavf_hw *hw);
455 void iavf_disable_adminq_irq(struct iavf_hw *hw);
456 int iavf_vf_config(struct iavf_sc *sc);
457 void iavf_print_device_info(struct iavf_sc *sc);
458 int iavf_get_vsi_res_from_vf_res(struct iavf_sc *sc);
459 void iavf_set_mac_addresses(struct iavf_sc *sc);
460 void iavf_init_filters(struct iavf_sc *sc);
461 void iavf_free_filters(struct iavf_sc *sc);
462 void iavf_add_device_sysctls_common(struct iavf_sc *sc);
463 void iavf_configure_tx_itr(struct iavf_sc *sc);
464 void iavf_configure_rx_itr(struct iavf_sc *sc);
465 struct sysctl_oid_list *
466     iavf_create_debug_sysctl_tree(struct iavf_sc *sc);
467 void iavf_add_debug_sysctls_common(struct iavf_sc *sc,
468     struct sysctl_oid_list *debug_list);
469 void iavf_add_vsi_sysctls(device_t dev, struct iavf_vsi *vsi,
470     struct sysctl_ctx_list *ctx, const char *sysctl_name);
471 void iavf_add_sysctls_eth_stats(struct sysctl_ctx_list *ctx,
472     struct sysctl_oid_list *child, struct iavf_eth_stats *eth_stats);
473 void iavf_media_status_common(struct iavf_sc *sc,
474     struct ifmediareq *ifmr);
475 int iavf_media_change_common(if_t ifp);
476 void iavf_set_initial_baudrate(if_t ifp);
477 u64 iavf_max_vc_speed_to_value(u8 link_speeds);
478 void iavf_config_rss_reg(struct iavf_sc *sc);
479 void iavf_config_rss_pf(struct iavf_sc *sc);
480 void iavf_config_rss(struct iavf_sc *sc);
481 int iavf_config_promisc(struct iavf_sc *sc, int flags);
482 void iavf_init_multi(struct iavf_sc *sc);
483 void iavf_multi_set(struct iavf_sc *sc);
484 int iavf_add_mac_filter(struct iavf_sc *sc, u8 *macaddr, u16 flags);
485 struct iavf_mac_filter *
486     iavf_find_mac_filter(struct iavf_sc *sc, u8 *macaddr);
487 struct iavf_mac_filter *
488     iavf_get_mac_filter(struct iavf_sc *sc);
489 u64 iavf_baudrate_from_link_speed(struct iavf_sc *sc);
490 void iavf_add_vlan_filter(struct iavf_sc *sc, u16 vtag);
491 int iavf_mark_del_vlan_filter(struct iavf_sc *sc, u16 vtag);
492 void iavf_update_msix_devinfo(device_t dev);
493 void iavf_disable_queues_with_retries(struct iavf_sc *);
494 
495 int iavf_sysctl_current_speed(SYSCTL_HANDLER_ARGS);
496 int iavf_sysctl_tx_itr(SYSCTL_HANDLER_ARGS);
497 int iavf_sysctl_rx_itr(SYSCTL_HANDLER_ARGS);
498 int iavf_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS);
499 
500 #endif /* _IAVF_LIB_H_ */
501