41#include <sys/buf_ring.h>
43#include <sys/protosw.h>
44#include <sys/socket.h>
45#include <sys/malloc.h>
46#include <sys/kernel.h>
47#include <sys/module.h>
48#include <sys/sockio.h>
49#include <sys/eventhandler.h>
52#include <net/if_var.h>
53#include <net/if_arp.h>
55#include <net/ethernet.h>
57#include <net/if_media.h>
59#include <net/if_types.h>
60#include <net/if_vlan_var.h>
63#include <netinet/in_systm.h>
64#include <netinet/in.h>
65#include <netinet/if_ether.h>
68#include <machine/bus.h>
70#include <machine/resource.h>
73#include <machine/clock.h>
74#include <dev/pci/pcivar.h>
75#include <dev/pci/pcireg.h>
77#include <sys/sysctl.h>
78#include <sys/endian.h>
79#include <sys/gtaskqueue.h>
82#include <machine/smp.h>
100#define DEFAULT_TXD 2048
101#define PERFORM_TXD 2048
115#define DEFAULT_RXD 2048
116#define PERFORM_RXD 2048
128#define IXGBE_WATCHDOG (10 * hz)
134#define IXGBE_TX_CLEANUP_THRESHOLD(_a) ((_a)->num_tx_desc / 8)
135#define IXGBE_TX_OP_THRESHOLD(_a) ((_a)->num_tx_desc / 32)
138#define IXGBE_MAX_FRAME_SIZE 9728
139#define IXGBE_MTU_HDR (ETHER_HDR_LEN + ETHER_CRC_LEN)
140#define IXGBE_MTU_HDR_VLAN (ETHER_HDR_LEN + ETHER_CRC_LEN + \
141 ETHER_VLAN_ENCAP_LEN)
142#define IXGBE_MAX_MTU (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR)
143#define IXGBE_MAX_MTU_VLAN (IXGBE_MAX_FRAME_SIZE - IXGBE_MTU_HDR_VLAN)
146#define IXGBE_FC_PAUSE 0xFFFF
147#define IXGBE_FC_HI 0x20000
148#define IXGBE_FC_LO 0x10000
160#define IXGBE_MPKTHSIZE (sizeof(struct m_hdr) + sizeof(struct pkthdr))
162#define IXGBE_RX_COPY_HDR_PADDED ((((IXGBE_MPKTHSIZE - 1) / 32) + 1) * 32)
163#define IXGBE_RX_COPY_LEN (MSIZE - IXGBE_RX_COPY_HDR_PADDED)
164#define IXGBE_RX_COPY_ALIGN (IXGBE_RX_COPY_HDR_PADDED - IXGBE_MPKTHSIZE)
171#define INIT_DEBUGOUT(S) if (DEBUG_INIT) printf(S "\n")
172#define INIT_DEBUGOUT1(S, A) if (DEBUG_INIT) printf(S "\n", A)
173#define INIT_DEBUGOUT2(S, A, B) if (DEBUG_INIT) printf(S "\n", A, B)
174#define IOCTL_DEBUGOUT(S) if (DEBUG_IOCTL) printf(S "\n")
175#define IOCTL_DEBUGOUT1(S, A) if (DEBUG_IOCTL) printf(S "\n", A)
176#define IOCTL_DEBUGOUT2(S, A, B) if (DEBUG_IOCTL) printf(S "\n", A, B)
177#define HW_DEBUGOUT(S) if (DEBUG_HW) printf(S "\n")
178#define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A)
179#define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B)
181#define MAX_NUM_MULTICAST_ADDRESSES 128
182#define IXGBE_82598_SCATTER 100
183#define IXGBE_82599_SCATTER 32
184#define IXGBE_TSO_SIZE 262140
185#define IXGBE_RX_HDR 128
186#define IXGBE_VFTA_SIZE 128
187#define IXGBE_BR_SIZE 4096
188#define IXGBE_QUEUE_MIN_FREE 32
189#define IXGBE_MAX_TX_BUSY 10
190#define IXGBE_QUEUE_HUNG 0x80000000
192#define IXGBE_EITR_DEFAULT 128
195#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
196 CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
197 CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)
199#define IXGBE_CAPS (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | IFCAP_TSO | \
200 IFCAP_LRO | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | \
201 IFCAP_VLAN_HWCSUM | IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU | \
202 IFCAP_VLAN_HWFILTER | IFCAP_WOL)
205#define DEVMETHOD_END { NULL, NULL }
211#define IXGBE_LOW_LATENCY 128
212#define IXGBE_AVE_LATENCY 400
213#define IXGBE_BULK_LATENCY 1200
216#define IXGBE_LINK_ITR_QUANTA 0x1FF
217#define IXGBE_LINK_ITR ((IXGBE_LINK_ITR_QUANTA << 3) & \
218 IXGBE_EITR_ITR_INT_MASK)
336#define IXGBE_MAX_VF_MC 30
357#define num_tx_queues shared->isc_ntxqsets
358#define num_rx_queues shared->isc_nrxqsets
359#define max_frame_size shared->isc_max_frame_size
360#define intr_type shared->isc_intr
467#define ETHERTYPE_IEEE1588 0x88F7
468#define PICOSECS_PER_TICK 20833
469#define TSYNC_UDP_PORT 319
470#define IXGBE_ADVTXD_TSTAMP 0x00080000
473#define IXGBE_SET_IPACKETS(sc, count) (sc)->ipackets = (count)
474#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count)
475#define IXGBE_SET_OPACKETS(sc, count) (sc)->opackets = (count)
476#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count)
477#define IXGBE_SET_COLLISIONS(sc, count)
478#define IXGBE_SET_IBYTES(sc, count) (sc)->ibytes = (count)
479#define IXGBE_SET_OBYTES(sc, count) (sc)->obytes = (count)
480#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count)
481#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count)
482#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count)
485#define IXGBE_PHY_CURRENT_TEMP 0xC820
486#define IXGBE_PHY_OVERTEMP_STATUS 0xC830
489#define IXGBE_SYSCTL_DESC_ADV_SPEED \
490 "\nControl advertised link speed using these flags:\n" \
491 "\t0x1 - advertise 100M\n" \
492 "\t0x2 - advertise 1G\n" \
493 "\t0x4 - advertise 10G\n" \
494 "\t0x8 - advertise 10M\n\n" \
495 "\t0x10 - advertise 2.5G\n" \
496 "\t0x20 - advertise 5G\n\n" \
497 "\t100M and 10M are only supported on certain adapters.\n"
499#define IXGBE_SYSCTL_DESC_SET_FC \
500 "\nSet flow control mode using these values:\n" \
504 "\t3 - tx and rx pause"
506#define IXGBE_SYSCTL_DESC_RX_ERRS \
507 "\nSum of the following RX errors counters:\n" \
509 " * illegal byte error count,\n" \
510 " * checksum error count,\n" \
511 " * missed packet count,\n" \
512 " * length error count,\n" \
513 " * undersized packets count,\n" \
514 " * fragmented packets count,\n" \
515 " * oversized packets count,\n" \
527 if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 &&
528 addr[3] == 0 && addr[4]== 0 && addr[5] == 0))
struct _ixgbe_vendor_info_t ixgbe_vendor_info_t
int ixgbe_setup_receive_structures(struct ixgbe_softc *)
int ixgbe_setup_transmit_structures(struct ixgbe_softc *)
int ixgbe_get_regs(SYSCTL_HANDLER_ARGS)
void ixgbe_free_transmit_structures(struct ixgbe_softc *)
void ixgbe_free_receive_structures(struct ixgbe_softc *)
int ixgbe_allocate_queues(struct ixgbe_softc *)
static bool ixv_check_ether_addr(u8 *addr)
#define IXGBE_ETH_LENGTH_OF_ADDRESS
unsigned int subvendor_id
unsigned int subdevice_id
bus_dma_segment_t dma_seg
u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS]
unsigned long dropped_pkts
union ixgbe_softc::@0 stats
struct ixgbe_bp_data bypass
struct resource * pci_mem
struct ix_tx_queue * tx_queues
struct ix_rx_queue * rx_queues
struct ixgbevf_hw_stats vf
unsigned long mbuf_header_failed
u32 shadow_vfta[IXGBE_VFTA_SIZE]
unsigned long watchdog_events
unsigned long mbuf_packet_failed
struct ixgbe_mc_addr * mta
uint16_t mc_hash[IXGBE_MAX_VF_MC]
uint8_t ether_addr[ETHER_ADDR_LEN]
union ixgbe_adv_rx_desc * rx_base
union ixgbe_adv_tx_desc * tx_base