xref: /freebsd/sys/dev/ixgbe/ixgbe.h (revision f5dc2263ab1be8a35a7e27e82103f9ccd41ae584)
1 /*****************************************************************************
2   SPDX-License-Identifier: BSD-3-Clause
3 
4   Copyright (c) 2001-2017, Intel Corporation
5   All rights reserved.
6 
7   Redistribution and use in source and binary forms, with or without
8   modification, are permitted provided that the following conditions are met:
9 
10    1. Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12 
13    2. Redistributions in binary form must reproduce the above copyright
14       notice, this list of conditions and the following disclaimer in the
15       documentation and/or other materials provided with the distribution.
16 
17    3. Neither the name of the Intel Corporation nor the names of its
18       contributors may be used to endorse or promote products derived from
19       this software without specific prior written permission.
20 
21   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31   POSSIBILITY OF SUCH DAMAGE.
32 
33 *****************************************************************************/
34 
35 #ifndef _IXGBE_H_
36 #define _IXGBE_H_
37 
38 #include <sys/param.h>
39 #include <sys/systm.h>
40 #include <sys/buf_ring.h>
41 #include <sys/mbuf.h>
42 #include <sys/protosw.h>
43 #include <sys/socket.h>
44 #include <sys/malloc.h>
45 #include <sys/kernel.h>
46 #include <sys/module.h>
47 #include <sys/sockio.h>
48 #include <sys/eventhandler.h>
49 #include <sys/priv.h>
50 
51 #include <net/if.h>
52 #include <net/if_var.h>
53 #include <net/if_arp.h>
54 #include <net/bpf.h>
55 #include <net/ethernet.h>
56 #include <net/if_dl.h>
57 #include <net/if_media.h>
58 
59 #include <net/if_types.h>
60 #include <net/if_vlan_var.h>
61 #include <net/iflib.h>
62 
63 #include <netinet/in_systm.h>
64 #include <netinet/in.h>
65 #include <netinet/if_ether.h>
66 
67 #include <sys/bus.h>
68 #include <machine/bus.h>
69 #include <sys/rman.h>
70 #include <machine/resource.h>
71 #include <vm/vm.h>
72 #include <vm/pmap.h>
73 #include <machine/clock.h>
74 #include <dev/pci/pcivar.h>
75 #include <dev/pci/pcireg.h>
76 #include <sys/proc.h>
77 #include <sys/sysctl.h>
78 #include <sys/endian.h>
79 #include <sys/gtaskqueue.h>
80 #include <sys/pcpu.h>
81 #include <sys/smp.h>
82 #include <machine/smp.h>
83 #include <sys/sbuf.h>
84 
85 #include "ixgbe_api.h"
86 #include "ixgbe_common.h"
87 #include "ixgbe_phy.h"
88 #include "ixgbe_vf.h"
89 #include "ixgbe_features.h"
90 #include "ixgbe_e610.h"
91 
92 /* Tunables */
93 
94 /*
95  * TxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
96  * number of transmit descriptors allocated by the driver. Increasing this
97  * value allows the driver to queue more transmits. Each descriptor is 16
98  * bytes. Performance tests have show the 2K value to be optimal for top
99  * performance.
100  */
101 #define DEFAULT_TXD		2048
102 #define PERFORM_TXD		2048
103 #define MAX_TXD			4096
104 #define MIN_TXD			64
105 
106 /*
107  * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
108  * number of receive descriptors allocated for each RX queue. Increasing this
109  * value allows the driver to buffer more incoming packets. Each descriptor
110  * is 16 bytes.  A receive buffer is also allocated for each descriptor.
111  *
112  * Note: with 8 rings and a dual port card, it is possible to bump up
113  *       against the system mbuf pool limit, you can tune nmbclusters
114  *       to adjust for this.
115  */
116 #define DEFAULT_RXD		2048
117 #define PERFORM_RXD		2048
118 #define MAX_RXD			4096
119 #define MIN_RXD			64
120 
121 /* Alignment for rings */
122 #define DBA_ALIGN		128
123 
124 /*
125  * iflib uses the RS bit to select the descriptors whose status it polls.
126  * Keep WTHRESH zero so the hardware honors RS, and retain the driver's
127  * established descriptor-prefetch settings.
128  */
129 #define IXGBE_TXDCTL_THRESH_MASK		0x007f7f7f
130 #define IXGBE_TXDCTL_THRESH_DEFAULT	((32 << 0) | (1 << 8))
131 
132 /*
133  * This is the max watchdog interval, ie. the time that can
134  * pass between any two TX clean operations, such only happening
135  * when the TX hardware is functioning.
136  */
137 #define IXGBE_WATCHDOG	(10 * hz)
138 
139 /*
140  * This parameters control when the driver calls the routine to reclaim
141  * transmit descriptors.
142  */
143 #define IXGBE_TX_CLEANUP_THRESHOLD(_a)	((_a)->num_tx_desc / 8)
144 #define IXGBE_TX_OP_THRESHOLD(_a)	((_a)->num_tx_desc / 32)
145 
146 /* These defines are used in MTU calculations */
147 #define IXGBE_MAX_FRAME_SIZE	9728
148 #define IXGBE_MTU_HDR		(ETHER_HDR_LEN + ETHER_CRC_LEN)
149 #define IXGBE_MTU_HDR_VLAN	(ETHER_HDR_LEN + ETHER_CRC_LEN + \
150 							    ETHER_VLAN_ENCAP_LEN)
151 #define IXGBE_MAX_MTU		(IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR)
152 #define IXGBE_MAX_MTU_VLAN	(IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN)
153 
154 /* Flow control constants */
155 #define IXGBE_FC_PAUSE		0xFFFF
156 #define IXGBE_FC_HI		0x20000
157 #define IXGBE_FC_LO		0x10000
158 
159 /*
160  * Used for optimizing small rx mbufs.  Effort is made to keep the copy
161  * small and aligned for the CPU L1 cache.
162  *
163  * MHLEN is typically 168 bytes, giving us 8-byte alignment.  Getting
164  * 32 byte alignment needed for the fast bcopy results in 8 bytes being
165  * wasted.  Getting 64 byte alignment, which _should_ be ideal for
166  * modern Intel CPUs, results in 40 bytes wasted and a significant drop
167  * in observed efficiency of the optimization, 97.9% -> 81.8%.
168  */
169 #define IXGBE_MPKTHSIZE		(sizeof(struct m_hdr) + sizeof(struct pkthdr))
170 
171 #define IXGBE_RX_COPY_HDR_PADDED	((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32)
172 #define IXGBE_RX_COPY_LEN		(MSIZE - IXGBE_RX_COPY_HDR_PADDED)
173 #define IXGBE_RX_COPY_ALIGN		(IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE)
174 
175 /* Defines for printing debug information */
176 #define DEBUG_INIT		0
177 #define DEBUG_IOCTL		0
178 #define DEBUG_HW		0
179 
180 #define INIT_DEBUGOUT(S)		if (DEBUG_INIT)  printf(S "\n")
181 #define INIT_DEBUGOUT1(S, A)		if (DEBUG_INIT)  printf(S "\n", A)
182 #define INIT_DEBUGOUT2(S, A, B)		if (DEBUG_INIT)  printf(S "\n", A, B)
183 #define IOCTL_DEBUGOUT(S)		if (DEBUG_IOCTL) printf(S "\n")
184 #define IOCTL_DEBUGOUT1(S, A)		if (DEBUG_IOCTL) printf(S "\n", A)
185 #define IOCTL_DEBUGOUT2(S, A, B)	if (DEBUG_IOCTL) printf(S "\n", A, B)
186 #define HW_DEBUGOUT(S)			if (DEBUG_HW) printf(S "\n")
187 #define HW_DEBUGOUT1(S, A)		if (DEBUG_HW) printf(S "\n", A)
188 #define HW_DEBUGOUT2(S, A, B)		if (DEBUG_HW) printf(S "\n", A, B)
189 
190 #define MAX_NUM_MULTICAST_ADDRESSES	128
191 #define IXGBE_82598_SCATTER		100
192 #define IXGBE_82599_SCATTER		32
193 #define IXGBE_TSO_SIZE			262140
194 #define IXGBE_RX_HDR			128
195 #define IXGBE_VFTA_SIZE			128
196 #define IXGBE_BR_SIZE			4096
197 #define IXGBE_QUEUE_MIN_FREE		32
198 #define IXGBE_MAX_TX_BUSY		10
199 #define IXGBE_QUEUE_HUNG		0x80000000
200 
201 #define IXGBE_EITR_DEFAULT		128
202 
203 /* Supported offload bits in mbuf flag */
204 #define CSUM_OFFLOAD	(CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
205 			    CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
206 			    CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
207 
208 /* All BASE-T Physical layers */
209 #define IXGBE_PHYSICAL_LAYERS_BASE_T_ALL \
210 	(IXGBE_PHYSICAL_LAYER_10GBASE_T |\
211 	 IXGBE_PHYSICAL_LAYER_5000BASE_T |\
212 	 IXGBE_PHYSICAL_LAYER_2500BASE_T |\
213 	 IXGBE_PHYSICAL_LAYER_1000BASE_T |\
214 	 IXGBE_PHYSICAL_LAYER_100BASE_TX |\
215 	 IXGBE_PHYSICAL_LAYER_10BASE_T)
216 
217 #define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \
218 		    IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \
219 		    IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \
220 		    IFCAP_VLAN_HWFILTER | IFCAP_WOL)
221 
222 #ifndef DEVMETHOD_END
223 #define DEVMETHOD_END	{ NULL, NULL }
224 #endif
225 
226 /*
227  * Interrupt Moderation parameters
228  */
229 #define IXGBE_LOW_LATENCY		128
230 #define IXGBE_AVE_LATENCY		400
231 #define IXGBE_BULK_LATENCY		1200
232 
233 /* Using 1FF (the max value), the interval is ~1.05ms */
234 #define IXGBE_LINK_ITR_QUANTA	0x1FF
235 #define IXGBE_LINK_ITR		((IXGBE_LINK_ITR_QUANTA << 3) & \
236 				    IXGBE_EITR_ITR_INT_MASK)
237 
238 
239 /************************************************************************
240  * vendor_info_array
241  *
242  *   Contains the list of Subvendor/Subdevice IDs on
243  *   which the driver should load.
244  ************************************************************************/
245 typedef struct _ixgbe_vendor_info_t {
246 	unsigned int		vendor_id;
247 	unsigned int		device_id;
248 	unsigned int		subvendor_id;
249 	unsigned int		subdevice_id;
250 	unsigned int		index;
251 } ixgbe_vendor_info_t;
252 
253 struct ixgbe_bp_data {
254 	u32		low;
255 	u32		high;
256 	u32		log;
257 };
258 
259 
260 /*
261  */
262 struct ixgbe_dma_alloc {
263 	bus_addr_t		dma_paddr;
264 	caddr_t			dma_vaddr;
265 	bus_dma_tag_t		dma_tag;
266 	bus_dmamap_t		dma_map;
267 	bus_dma_segment_t 	dma_seg;
268 	bus_size_t		dma_size;
269 	int			dma_nseg;
270 };
271 
272 struct ixgbe_mc_addr {
273 	u8		addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
274 	u32		vmdq;
275 };
276 
277 /*
278  * The transmit ring, one per queue
279  */
280 struct tx_ring {
281 	struct ixgbe_softc	*sc;
282 	union ixgbe_adv_tx_desc *tx_base;
283 	uint64_t		tx_paddr;
284 	u32			tail;
285 	qidx_t			*tx_rsq;
286 	qidx_t			tx_rs_cidx;
287 	qidx_t			tx_rs_pidx;
288 	qidx_t			tx_cidx_processed;
289 	uint8_t			me;
290 
291 	/* Flow Director */
292 	u16			atr_sample;
293 	u16			atr_count;
294 
295 	u32			bytes;	/* used for AIM */
296 	u32			packets;
297 	/* Soft Stats */
298 	u64			tso_tx;
299 	u64			total_packets;
300 };
301 
302 
303 /*
304  * The Receive ring, one per rx queue
305  */
306 struct rx_ring {
307 	struct ix_rx_queue	*que;
308 	struct ixgbe_softc	*sc;
309 	u32			me;
310 	u32			tail;
311 	union ixgbe_adv_rx_desc *rx_base;
312 	bool			hw_rsc;
313 	bool			vtag_strip;
314 	uint64_t		rx_paddr;
315 	bus_dma_tag_t		ptag;
316 
317 	u32			bytes;	/* Used for AIM calc */
318 	u32			packets;
319 
320 	/* Soft stats */
321 	u64			rx_irq;
322 	u64			rx_copies;
323 	u64			rx_packets;
324 	u64			rx_bytes;
325 	u64			rx_discarded;
326 	u64			rsc_num;
327 
328 	/* Flow Director */
329 	u64			flm;
330 };
331 
332 /*
333  * Driver queue struct: this is the interrupt container
334  *  for the associated tx and rx ring.
335  */
336 struct ix_rx_queue {
337 	struct ixgbe_softc	*sc;
338 	u32			msix;	/* This queue's MSIX vector */
339 	u32			eitr_setting;
340 	struct resource		*res;
341 	void			*tag;
342 	int			busy;
343 	struct rx_ring		rxr;
344 	struct if_irq		que_irq;
345 	u64			irqs;
346 };
347 
348 struct ix_tx_queue {
349 	struct ixgbe_softc	*sc;
350 	u32			msix;	/* This queue's MSIX vector */
351 	struct tx_ring		txr;
352 };
353 
354 #define IXGBE_MAX_VF_MC	30	/* Max number of multicast entries */
355 
356 struct ixgbe_vf_mac_filter {
357 	uint16_t	rar_index;
358 	uint16_t	pool;
359 	bool		active;
360 	uint8_t		mac[ETHER_ADDR_LEN];
361 };
362 
363 struct ixgbe_vf {
364 	u_int		pool;
365 	u_int		rar_index;
366 	u_int		maximum_frame_size;
367 	uint32_t	flags;
368 	struct timeval	last_mdd_log;
369 	struct timeval	last_dma_abort_log;
370 	uint8_t		ether_addr[ETHER_ADDR_LEN];
371 	uint16_t	mc_hash[IXGBE_MAX_VF_MC];
372 	uint32_t	vlans[IXGBE_VFTA_SIZE];
373 	uint16_t	num_mc_hashes;
374 	uint16_t	num_mac_filters;
375 	uint16_t	num_vlans;
376 	uint16_t	default_vlan;
377 	uint16_t	api_ver;
378 	uint16_t	pci_saved_command;
379 	uint32_t	recovery_tx_head[IXGBE_VF_MAX_TX_QUEUES];
380 	uint8_t		xcast_mode;
381 	uint8_t		primary_abort_count;
382 	uint8_t		recovery_tx_pending;
383 	sbintime_t	mbx_cleanup_deadline;
384 };
385 
386 /* Our softc structure */
387 struct ixgbe_softc {
388 	struct ixgbe_hw		hw;
389 	struct ixgbe_osdep	osdep;
390 	if_ctx_t		ctx;
391 	if_softc_ctx_t		shared;
392 #define num_tx_queues		shared->isc_ntxqsets
393 #define num_rx_queues		shared->isc_nrxqsets
394 #define max_frame_size		shared->isc_max_frame_size
395 #define intr_type		shared->isc_intr
396 
397 	device_t		dev;
398 	struct ifnet		*ifp;
399 
400 	struct resource		*pci_mem;
401 
402 	/*
403 	 * Interrupt resources: this set is
404 	 * either used for legacy, or for Link
405 	 * when doing MSI-X
406 	 */
407 	struct if_irq		irq;
408 	void			*tag;
409 	struct resource		*res;
410 
411 	struct ifmedia		*media;
412 	int			if_flags;
413 	int			msix;
414 
415 	u16			num_vlans;
416 
417 	/*
418 	 * Shadow VFTA table, this is needed because
419 	 * the real vlan filter table gets cleared during
420 	 * a soft reset and the driver needs to be able
421 	 * to repopulate it.
422 	 */
423 	u32			shadow_vfta[IXGBE_VFTA_SIZE];
424 	u32			vf_vfta_retry[IXGBE_VFTA_SIZE];
425 	sbintime_t		vf_vlan_retry_deadline;
426 	u32			vf_vlan_retry_tick;
427 	u16			vf_vlan_retry_cursor;
428 	bool			vf_mcast_overflow_warned;
429 
430 	/* Info about the interface */
431 	int			advertise;	/* link speeds */
432 	int			enable_aim;	/* adaptive interrupt moderation */
433 	bool			link_active;
434 	u16			num_segs;
435 	u32			link_speed;
436 	bool			link_up;
437 	bool			link_enabled;
438 	u32			vector;
439 	u16			dmac;
440 	u32			phy_layer;
441 
442 	/* Power management-related */
443 	bool			wol_support;
444 	u32			wufc;
445 
446 	/* Mbuf cluster size */
447 	u32			rx_mbuf_sz;
448 
449 	/* Support for pluggable optics */
450 	bool			sfp_probe;
451 
452 	/* Flow Director */
453 	int			fdir_reinit;
454 
455 	u32			task_requests;
456 
457 	/*
458 	 * Queues:
459 	 *   This is the irq holder, it has
460 	 *   and RX/TX pair or rings associated
461 	 *   with it.
462 	 */
463 	struct ix_tx_queue	*tx_queues;
464 	struct ix_rx_queue	*rx_queues;
465 
466 	/* Multicast array memory */
467 	struct ixgbe_mc_addr	*mta;
468 
469 	/* SR-IOV */
470 	int			iov_mode;
471 	int			num_vfs;
472 	int			pool;
473 	struct ixgbe_vf		*vfs;
474 	struct ixgbe_vf_mac_filter *vf_mac_filters;
475 	int			num_vf_mac_filters;
476 	bool			iov_mta_valid;
477 	bool			iov_vfta_valid;
478 	bool			iov_vlan_promisc;
479 	bool			iov_mbx_cleanup_pending;
480 	bool			iov_pf_mdd_reset_pending;
481 	struct timeval		iov_last_mdd_log;
482 	struct task		iov_recovery_task;
483 	sbintime_t		iov_recovery_time;
484 	bool			iov_recovery_stop;
485 	uint8_t			iov_recovery_cursor;
486 	uint64_t		iov_dma_abort_events;
487 	uint64_t		iov_dma_abort_flr_failures;
488 	uint64_t		iov_dma_abort_quarantines;
489 	uint64_t		iov_quarantined_vfs;
490 
491 	/* Bypass */
492 	struct ixgbe_bp_data	bypass;
493 
494 	/* Firmware error check */
495 	int			recovery_mode;
496 	struct callout		fw_mode_timer;
497 
498 	/* Misc stats maintained by the driver */
499 	unsigned long		dropped_pkts;
500 	unsigned long		mbuf_header_failed;
501 	unsigned long		mbuf_packet_failed;
502 	unsigned long		link_irq;
503 	union {
504 		struct ixgbe_hw_stats pf;
505 		struct ixgbevf_hw_stats vf;
506 	} stats;
507 
508 	/* counter(9) stats */
509 	u64			ipackets;
510 	u64			ierrors;
511 	u64			opackets;
512 	u64			oerrors;
513 	u64			ibytes;
514 	u64			obytes;
515 	u64			imcasts;
516 	u64			omcasts;
517 	u64			iqdrops;
518 	u64			noproto;
519 
520 	/* Feature capable/enabled flags.  See ixgbe_features.h */
521 	u32			feat_cap;
522 	u32			feat_en;
523 	u16                     lse_mask;
524 
525 	struct sysctl_oid       *debug_sysctls;
526 	u32                     debug_dump_cluster_mask;
527 	bool                    do_debug_dump;
528 };
529 
530 struct ixgbe_debug_dump_cmd {
531 	u32 offset;		/* offset to read/write from table, in bytes */
532 	u8 cluster_id;		/* also used to get next cluster id */
533 	u16 table_id;
534 	u16 data_size;		/* size of data field, in bytes */
535 	u16 reserved1;
536 	u32 reserved2;
537 	u8 data[];
538 };
539 
540 /* Precision Time Sync (IEEE 1588) defines */
541 #define ETHERTYPE_IEEE1588		0x88F7
542 #define PICOSECS_PER_TICK		20833
543 #define TSYNC_UDP_PORT			319 /* UDP port for the protocol */
544 #define IXGBE_ADVTXD_TSTAMP		0x00080000
545 
546 /* Stats macros */
547 #define IXGBE_SET_IPACKETS(sc, count)	(sc)->ipackets = (count)
548 #define IXGBE_SET_IERRORS(sc, count)	(sc)->ierrors = (count)
549 #define IXGBE_SET_OPACKETS(sc, count)	(sc)->opackets = (count)
550 #define IXGBE_SET_OERRORS(sc, count)	(sc)->oerrors = (count)
551 #define IXGBE_SET_COLLISIONS(sc, count)
552 #define IXGBE_SET_IBYTES(sc, count)	(sc)->ibytes = (count)
553 #define IXGBE_SET_OBYTES(sc, count)	(sc)->obytes = (count)
554 #define IXGBE_SET_IMCASTS(sc, count)	(sc)->imcasts = (count)
555 #define IXGBE_SET_OMCASTS(sc, count)	(sc)->omcasts = (count)
556 #define IXGBE_SET_IQDROPS(sc, count)	(sc)->iqdrops = (count)
557 
558 /* External PHY register addresses */
559 #define IXGBE_PHY_CURRENT_TEMP		0xC820
560 #define IXGBE_PHY_OVERTEMP_STATUS	0xC830
561 
562 /**
563  * The ioctl command number used by NVM update for accessing the driver for
564  * NVM access commands.
565  */
566 #define IXGBE_NVM_ACCESS \
567 	(((((((('E' << 4) + '1') << 4) + 'K') << 4) + 'G') << 4) | 5)
568 
569 /*
570  * The ioctl command number used by a userspace tool for accessing the driver
571  * for getting debug dump data from the firmware.
572  */
573 #define IXGBE_DEBUG_DUMP \
574 	(((((((('E' << 4) + '1') << 4) + 'K') << 4) + 'G') << 4) | 6)
575 
576 /* Debug Dump related definitions */
577 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_INVALID	0xFFFFFF
578 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_BASE	50
579 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_MAX	1
580 
581 #define IXGBE_DBG_DUMP_VALID_CLUSTERS_MASK	0x3
582 #define IXGBE_DBG_DUMP_BASE_SIZE		(2 * 1024 * 1024)
583 
584 #define IXGBE_SYSCTL_DESC_DEBUG_DUMP_SET_CLUSTER		\
585 "\nSelect clusters to dump with \"dump\" sysctl"		\
586 "\nFlags:"							\
587 "\n\t      0x1 - Link"						\
588 "\n\t      0x2 - Full CSR Space, excluding RCW registers"	\
589 "\n\t"								\
590 "\nUse \"sysctl -x\" to view flags properly."
591 
592 #define IXGBE_SYSCTL_DESC_DUMP_DEBUG_DUMP 			\
593 "\nWrite 1 to output a FW debug dump containing the clusters " 	\
594 "specified by the \"clusters\" sysctl" 				\
595 "\nThe \"-b\" flag must be used in order to dump this data " 	\
596 "as binary data because" 					\
597 "\nthis data is opaque and not a string."
598 
599 /* Sysctl help messages; displayed with sysctl -d */
600 #define IXGBE_SYSCTL_DESC_ADV_SPEED	\
601     "\nControl advertised link speed using these flags:\n" \
602     "\t0x1 - advertise 100M\n" \
603     "\t0x2 - advertise 1G\n" \
604     "\t0x4 - advertise 10G\n" \
605     "\t0x8 - advertise 10M\n\n" \
606     "\t0x10  - advertise 2.5G\n" \
607     "\t0x20  - advertise 5G\n\n" \
608     "\t100M and 10M are only supported on certain adapters.\n"
609 
610 #define IXGBE_SYSCTL_DESC_SET_FC	\
611     "\nSet flow control mode using these values:\n" \
612     "\t0 - off\n" \
613     "\t1 - rx pause\n" \
614     "\t2 - tx pause\n" \
615     "\t3 - tx and rx pause"
616 
617 #define IXGBE_SYSCTL_DESC_RX_ERRS	\
618     "\nSum of the following RX errors counters:\n" \
619     " * CRC errors,\n" \
620     " * illegal byte error count,\n" \
621     " * missed packet count,\n" \
622     " * length error count,\n" \
623     " * undersized packets count,\n" \
624     " * fragmented packets count,\n" \
625     " * oversized packets count,\n" \
626     " * jabber count."
627 
628 /*
629  * This checks for a zero mac addr, something that will be likely
630  * unless the Admin on the Host has created one.
631  */
632 static inline bool
633 ixv_check_ether_addr(u8 *addr)
634 {
635 	bool status = true;
636 
637 	if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 &&
638 	    addr[3] == 0 && addr[4]== 0 && addr[5] == 0))
639 		status = false;
640 
641 	return (status);
642 }
643 
644 uint64_t ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed);
645 
646 /* Shared Prototypes */
647 
648 int  ixgbe_allocate_queues(struct ixgbe_softc *);
649 int  ixgbe_setup_transmit_structures(struct ixgbe_softc *);
650 void ixgbe_free_transmit_structures(struct ixgbe_softc *);
651 int  ixgbe_setup_receive_structures(struct ixgbe_softc *);
652 void ixgbe_free_receive_structures(struct ixgbe_softc *);
653 int  ixgbe_get_regs(SYSCTL_HANDLER_ARGS);
654 void ixgbe_setup_vlan_hw_support(if_ctx_t);
655 
656 void ixgbe_add_fw_logging_tunables(struct ixgbe_softc *sc,
657 	struct sysctl_oid *parent);
658 
659 #define IXGBE_STR_BUF_LEN 32
660 
661 #include "ixgbe_bypass.h"
662 #include "ixgbe_fdir.h"
663 #include "ixgbe_rss.h"
664 
665 #endif /* _IXGBE_H_ */
666