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)
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 struct callout vf_mbx_retry;
427 struct timeval vf_mbx_last_log;
428 u32 vf_mbx_ready;
429 u32 vf_mbx_retry_pending;
430 u32 vf_vlan_retry_tick;
431 u32 vf_link_update;
432 u16 vf_vlan_retry_cursor;
433 u8 vf_mbx_retry_stage;
434 bool vf_mbx_retry_initialized;
435 bool vf_mcast_overflow_warned;
436 u8 vf_link_mbx_failures;
437 u8 vf_link_poll_tick;
438 /* VF-owned RSS programming, protected by the iflib context lock. */
439 u32 vf_rss_key[10];
440 u32 vf_rss_mrqc;
441
442 /* Info about the interface */
443 int advertise; /* link speeds */
444 int enable_aim; /* adaptive interrupt moderation */
445 bool link_active;
446 u16 num_segs;
447 u32 link_speed;
448 bool link_up;
449 bool link_enabled;
450 bool led_active;
451 u32 vector;
452 u16 dmac;
453 u32 phy_layer;
454 u32 ledctl_default;
455
456 /* Power management-related */
457 u32 wol_filters;
458
459 /* Mbuf cluster size */
460 u32 rx_mbuf_sz;
461
462 /* Support for pluggable optics */
463 bool sfp_probe;
464
465 /* Flow Director */
466 int fdir_reinit;
467 u_int ecc_reset_pending;
468
469 u32 task_requests;
470
471 /*
472 * Queues:
473 * This is the irq holder, it has
474 * and RX/TX pair or rings associated
475 * with it.
476 */
477 struct ix_tx_queue *tx_queues;
478 struct ix_rx_queue *rx_queues;
479
480 /* Multicast array memory */
481 struct ixgbe_mc_addr *mta;
482
483 /* SR-IOV */
484 int iov_mode;
485 int num_vfs;
486 int pool;
487 struct ixgbe_vf *vfs;
488 struct ixgbe_vf_mac_filter *vf_mac_filters;
489 int num_vf_mac_filters;
490 bool iov_attached;
491 bool iov_mta_valid;
492 bool iov_vfta_valid;
493 bool iov_vlan_promisc;
494 bool iov_mbx_cleanup_pending;
495 bool iov_pf_mdd_reset_pending;
496 struct timeval iov_last_mdd_log;
497 struct task iov_recovery_task;
498 sbintime_t iov_recovery_time;
499 bool iov_recovery_stop;
500 uint8_t iov_recovery_cursor;
501 uint64_t iov_dma_abort_events;
502 uint64_t iov_dma_abort_flr_failures;
503 uint64_t iov_dma_abort_quarantines;
504 uint64_t iov_quarantined_vfs;
505
506 /* Bypass */
507 struct ixgbe_bp_data bypass;
508
509 /* Firmware error check */
510 int recovery_mode;
511 u_int fw_mode_timer_paused;
512 bool fw_mode_timer_initialized;
513 bool overtemp_shutdown_pending;
514 struct callout fw_mode_timer;
515
516 /* Misc stats maintained by the driver */
517 unsigned long dropped_pkts;
518 unsigned long mbuf_header_failed;
519 unsigned long mbuf_packet_failed;
520 unsigned long link_irq;
521 union {
522 struct ixgbe_hw_stats pf;
523 struct ixgbevf_hw_stats vf;
524 } stats;
525
526 /* counter(9) stats */
527 u64 ipackets;
528 u64 ierrors;
529 u64 opackets;
530 u64 oerrors;
531 u64 ibytes;
532 u64 obytes;
533 u64 imcasts;
534 u64 omcasts;
535 u64 iqdrops;
536 u64 noproto;
537
538 /* Feature capable/enabled flags. See ixgbe_features.h */
539 u32 feat_cap;
540 u32 feat_en;
541 u16 lse_mask;
542
543 struct sysctl_oid *debug_sysctls;
544 u32 debug_dump_cluster_mask;
545 bool do_debug_dump;
546 };
547
548 struct ixgbe_debug_dump_cmd {
549 u32 offset; /* offset to read/write from table, in bytes */
550 u8 cluster_id; /* also used to get next cluster id */
551 u16 table_id;
552 u16 data_size; /* size of data field, in bytes */
553 u16 reserved1;
554 u32 reserved2;
555 u8 data[];
556 };
557
558 /* Precision Time Sync (IEEE 1588) defines */
559 #define ETHERTYPE_IEEE1588 0x88F7
560 #define PICOSECS_PER_TICK 20833
561 #define TSYNC_UDP_PORT 319 /* UDP port for the protocol */
562 #define IXGBE_ADVTXD_TSTAMP 0x00080000
563
564 /* Stats macros */
565 #define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count)
566 #define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count)
567 #define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count)
568 #define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count)
569 #define IXGBE_SET_COLLISIONS(sc, count)
570 #define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count)
571 #define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count)
572 #define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count)
573 #define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count)
574 #define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count)
575
576 /* External PHY register addresses */
577 #define IXGBE_PHY_CURRENT_TEMP 0xC820
578 #define IXGBE_PHY_OVERTEMP_STATUS 0xC830
579
580 /**
581 * The ioctl command number used by NVM update for accessing the driver for
582 * NVM access commands.
583 */
584 #define IXGBE_NVM_ACCESS \
585 (((((((('E' << 4) + '1') << 4) + 'K') << 4) + 'G') << 4) | 5)
586
587 /*
588 * The ioctl command number used by a userspace tool for accessing the driver
589 * for getting debug dump data from the firmware.
590 */
591 #define IXGBE_DEBUG_DUMP \
592 (((((((('E' << 4) + '1') << 4) + 'K') << 4) + 'G') << 4) | 6)
593
594 /* Debug Dump related definitions */
595 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_INVALID 0xFFFFFF
596 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_BASE 50
597 #define IXGBE_ACI_DBG_DUMP_CLUSTER_ID_MAX 1
598
599 #define IXGBE_DBG_DUMP_VALID_CLUSTERS_MASK 0x3
600 #define IXGBE_DBG_DUMP_BASE_SIZE (2 * 1024 * 1024)
601
602 #define IXGBE_SYSCTL_DESC_DEBUG_DUMP_SET_CLUSTER \
603 "\nSelect clusters to dump with \"dump\" sysctl" \
604 "\nFlags:" \
605 "\n\t 0x1 - Link" \
606 "\n\t 0x2 - Full CSR Space, excluding RCW registers" \
607 "\n\t" \
608 "\nUse \"sysctl -x\" to view flags properly."
609
610 #define IXGBE_SYSCTL_DESC_DUMP_DEBUG_DUMP \
611 "\nWrite 1 to output a FW debug dump containing the clusters " \
612 "specified by the \"clusters\" sysctl" \
613 "\nThe \"-b\" flag must be used in order to dump this data " \
614 "as binary data because" \
615 "\nthis data is opaque and not a string."
616
617 /* Sysctl help messages; displayed with sysctl -d */
618 #define IXGBE_SYSCTL_DESC_ADV_SPEED \
619 "\nControl advertised link speed using these flags:\n" \
620 "\t0x1 - advertise 100M\n" \
621 "\t0x2 - advertise 1G\n" \
622 "\t0x4 - advertise 10G\n" \
623 "\t0x8 - advertise 10M\n\n" \
624 "\t0x10 - advertise 2.5G\n" \
625 "\t0x20 - advertise 5G\n\n" \
626 "\t100M and 10M are only supported on certain adapters.\n"
627
628 #define IXGBE_SYSCTL_DESC_SET_FC \
629 "\nSet flow control mode using these values:\n" \
630 "\t0 - off\n" \
631 "\t1 - rx pause\n" \
632 "\t2 - tx pause\n" \
633 "\t3 - tx and rx pause"
634
635 #define IXGBE_SYSCTL_DESC_RX_ERRS \
636 "\nSum of the following RX errors counters:\n" \
637 " * CRC errors,\n" \
638 " * illegal byte error count,\n" \
639 " * missed packet count,\n" \
640 " * length error count,\n" \
641 " * undersized packets count,\n" \
642 " * fragmented packets count,\n" \
643 " * oversized packets count,\n" \
644 " * jabber count."
645
646 /*
647 * This checks for a zero mac addr, something that will be likely
648 * unless the Admin on the Host has created one.
649 */
650 static inline bool
ixv_check_ether_addr(u8 * addr)651 ixv_check_ether_addr(u8 *addr)
652 {
653 bool status = true;
654
655 if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 &&
656 addr[3] == 0 && addr[4]== 0 && addr[5] == 0))
657 status = false;
658
659 return (status);
660 }
661
662 uint64_t ixgbe_link_speed_to_baudrate(ixgbe_link_speed speed);
663
664 /* Shared Prototypes */
665
666 int ixgbe_allocate_queues(struct ixgbe_softc *);
667 int ixgbe_setup_transmit_structures(struct ixgbe_softc *);
668 void ixgbe_free_transmit_structures(struct ixgbe_softc *);
669 int ixgbe_setup_receive_structures(struct ixgbe_softc *);
670 void ixgbe_free_receive_structures(struct ixgbe_softc *);
671 int ixgbe_get_regs(SYSCTL_HANDLER_ARGS);
672 void ixgbe_setup_vlan_hw_support(if_ctx_t);
673
674 void ixgbe_add_fw_logging_tunables(struct ixgbe_softc *sc,
675 struct sysctl_oid *parent);
676
677 #define IXGBE_STR_BUF_LEN 32
678
679 #include "ixgbe_bypass.h"
680 #include "ixgbe_fdir.h"
681 #include "ixgbe_rss.h"
682
683 #endif /* _IXGBE_H_ */
684