Home | History | Annotate | Line # | Download | only in ixgbe
ixgbe.h revision 1.8
      1 /******************************************************************************
      2 
      3   Copyright (c) 2001-2013, Intel Corporation
      4   All rights reserved.
      5 
      6   Redistribution and use in source and binary forms, with or without
      7   modification, are permitted provided that the following conditions are met:
      8 
      9    1. Redistributions of source code must retain the above copyright notice,
     10       this list of conditions and the following disclaimer.
     11 
     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.
     15 
     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.
     19 
     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.
     31 
     32 ******************************************************************************/
     33 /*
     34  * Copyright (c) 2011 The NetBSD Foundation, Inc.
     35  * All rights reserved.
     36  *
     37  * This code is derived from software contributed to The NetBSD Foundation
     38  * by Coyote Point Systems, Inc.
     39  *
     40  * Redistribution and use in source and binary forms, with or without
     41  * modification, are permitted provided that the following conditions
     42  * are met:
     43  * 1. Redistributions of source code must retain the above copyright
     44  *    notice, this list of conditions and the following disclaimer.
     45  * 2. Redistributions in binary form must reproduce the above copyright
     46  *    notice, this list of conditions and the following disclaimer in the
     47  *    documentation and/or other materials provided with the distribution.
     48  *
     49  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     50  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     51  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     52  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     53  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     54  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     55  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     56  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     57  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     58  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     59  * POSSIBILITY OF SUCH DAMAGE.
     60  */
     61 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 279393 2015-02-28 14:57:57Z ngie $*/
     62 /*$NetBSD: ixgbe.h,v 1.8 2015/08/05 04:08:44 msaitoh Exp $*/
     63 
     64 
     65 #ifndef _IXGBE_H_
     66 #define _IXGBE_H_
     67 
     68 
     69 #include <sys/param.h>
     70 #include <sys/reboot.h>
     71 #include <sys/systm.h>
     72 #include <sys/time.h>
     73 #if __FreeBSD_version >= 800000
     74 #include <sys/buf_ring.h>
     75 #endif
     76 #include <sys/mbuf.h>
     77 #include <sys/protosw.h>
     78 #include <sys/socket.h>
     79 #include <sys/malloc.h>
     80 #include <sys/kernel.h>
     81 #include <sys/module.h>
     82 #include <sys/sockio.h>
     83 
     84 #include <net/if.h>
     85 #include <net/if_arp.h>
     86 #include <net/bpf.h>
     87 #include <net/if_ether.h>
     88 #include <net/if_dl.h>
     89 #include <net/if_media.h>
     90 
     91 #include <net/bpf.h>
     92 #include <net/if_types.h>
     93 #include <net/if_vlanvar.h>
     94 
     95 #include <netinet/in_systm.h>
     96 #include <netinet/in.h>
     97 #include <netinet/ip.h>
     98 #include <netinet/ip6.h>
     99 #include <netinet/tcp.h>
    100 #include <netinet/udp.h>
    101 
    102 #include <sys/bus.h>
    103 #include <dev/pci/pcivar.h>
    104 #include <dev/pci/pcireg.h>
    105 #include <sys/proc.h>
    106 #include <sys/sysctl.h>
    107 #include <sys/endian.h>
    108 #include <sys/workqueue.h>
    109 #include <sys/cpu.h>
    110 
    111 #include "ixgbe_netbsd.h"
    112 #include "ixgbe_api.h"
    113 
    114 /* Tunables */
    115 
    116 /*
    117  * TxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
    118  * number of transmit descriptors allocated by the driver. Increasing this
    119  * value allows the driver to queue more transmits. Each descriptor is 16
    120  * bytes. Performance tests have show the 2K value to be optimal for top
    121  * performance.
    122  */
    123 #define DEFAULT_TXD	1024
    124 #define PERFORM_TXD	2048
    125 #define MAX_TXD		4096
    126 #define MIN_TXD		64
    127 
    128 /*
    129  * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
    130  * number of receive descriptors allocated for each RX queue. Increasing this
    131  * value allows the driver to buffer more incoming packets. Each descriptor
    132  * is 16 bytes.  A receive buffer is also allocated for each descriptor.
    133  *
    134  * Note: with 8 rings and a dual port card, it is possible to bump up
    135  *	against the system mbuf pool limit, you can tune nmbclusters
    136  *	to adjust for this.
    137  */
    138 #define DEFAULT_RXD	1024
    139 #define PERFORM_RXD	2048
    140 #define MAX_RXD		4096
    141 #define MIN_RXD		64
    142 
    143 /* Alignment for rings */
    144 #define DBA_ALIGN	128
    145 
    146 /*
    147  * This parameter controls the maximum no of times the driver will loop in
    148  * the isr. Minimum Value = 1
    149  */
    150 #define MAX_LOOP	10
    151 
    152 /*
    153  * This is the max watchdog interval, ie. the time that can
    154  * pass between any two TX clean operations, such only happening
    155  * when the TX hardware is functioning.
    156  */
    157 #define IXGBE_WATCHDOG                   (10 * hz)
    158 
    159 /*
    160  * This parameters control when the driver calls the routine to reclaim
    161  * transmit descriptors.
    162  */
    163 #define IXGBE_TX_CLEANUP_THRESHOLD	(adapter->num_tx_desc / 8)
    164 #define IXGBE_TX_OP_THRESHOLD		(adapter->num_tx_desc / 32)
    165 
    166 #define IXGBE_MAX_FRAME_SIZE	0x3F00
    167 
    168 /* Flow control constants */
    169 #define IXGBE_FC_PAUSE		0xFFFF
    170 #define IXGBE_FC_HI		0x20000
    171 #define IXGBE_FC_LO		0x10000
    172 
    173 /*
    174  * Used for optimizing small rx mbufs.  Effort is made to keep the copy
    175  * small and aligned for the CPU L1 cache.
    176  *
    177  * MHLEN is typically 168 bytes, giving us 8-byte alignment.  Getting
    178  * 32 byte alignment needed for the fast bcopy results in 8 bytes being
    179  * wasted.  Getting 64 byte alignment, which _should_ be ideal for
    180  * modern Intel CPUs, results in 40 bytes wasted and a significant drop
    181  * in observed efficiency of the optimization, 97.9% -> 81.8%.
    182  */
    183 #define	MPKTHSIZE		(offsetof(struct _mbuf_dummy, m_pktdat))
    184 #define IXGBE_RX_COPY_HDR_PADDED	((((MPKTHSIZE - 1) / 32) + 1) * 32)
    185 #define IXGBE_RX_COPY_LEN		(MSIZE - IXGBE_RX_COPY_HDR_PADDED)
    186 #define IXGBE_RX_COPY_ALIGN		(IXGBE_RX_COPY_HDR_PADDED - MPKTHSIZE)
    187 
    188 /* Keep older OS drivers building... */
    189 #if !defined(SYSCTL_ADD_UQUAD)
    190 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
    191 #endif
    192 
    193 /* Defines for printing debug information */
    194 #define DEBUG_INIT  0
    195 #define DEBUG_IOCTL 0
    196 #define DEBUG_HW    0
    197 
    198 #define INIT_DEBUGOUT(S)            if (DEBUG_INIT)  printf(S "\n")
    199 #define INIT_DEBUGOUT1(S, A)        if (DEBUG_INIT)  printf(S "\n", A)
    200 #define INIT_DEBUGOUT2(S, A, B)     if (DEBUG_INIT)  printf(S "\n", A, B)
    201 #define IOCTL_DEBUGOUT(S)           if (DEBUG_IOCTL) printf(S "\n")
    202 #define IOCTL_DEBUGOUT1(S, A)       if (DEBUG_IOCTL) printf(S "\n", A)
    203 #define IOCTL_DEBUGOUT2(S, A, B)    if (DEBUG_IOCTL) printf(S "\n", A, B)
    204 #define HW_DEBUGOUT(S)              if (DEBUG_HW) printf(S "\n")
    205 #define HW_DEBUGOUT1(S, A)          if (DEBUG_HW) printf(S "\n", A)
    206 #define HW_DEBUGOUT2(S, A, B)       if (DEBUG_HW) printf(S "\n", A, B)
    207 
    208 #define MAX_NUM_MULTICAST_ADDRESSES     128
    209 #define IXGBE_82598_SCATTER		100
    210 #define IXGBE_82599_SCATTER		32
    211 #define MSIX_82598_BAR			3
    212 #define MSIX_82599_BAR			4
    213 #define IXGBE_TSO_SIZE			262140
    214 #define IXGBE_TX_BUFFER_SIZE		((u32) 1514)
    215 #define IXGBE_RX_HDR			128
    216 #define IXGBE_VFTA_SIZE			128
    217 #define IXGBE_BR_SIZE			4096
    218 #define IXGBE_QUEUE_MIN_FREE		32
    219 
    220 /* IOCTL define to gather SFP+ Diagnostic data */
    221 #define SIOCGI2C	SIOCGIFGENERIC
    222 
    223 /* Offload bits in mbuf flag */
    224 #define	M_CSUM_OFFLOAD	\
    225     (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4|M_CSUM_UDPv6|M_CSUM_TCPv6)
    226 
    227 /*
    228  * Interrupt Moderation parameters
    229  */
    230 #define IXGBE_LOW_LATENCY	128
    231 #define IXGBE_AVE_LATENCY	400
    232 #define IXGBE_BULK_LATENCY	1200
    233 #define IXGBE_LINK_ITR		2000
    234 
    235 
    236 /*
    237  *****************************************************************************
    238  * vendor_info_array
    239  *
    240  * This array contains the list of Subvendor/Subdevice IDs on which the driver
    241  * should load.
    242  *
    243  *****************************************************************************
    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 /* This is used to get SFP+ module data */
    254 struct ixgbe_i2c_req {
    255         u8 dev_addr;
    256         u8 offset;
    257         u8 len;
    258         u8 data[8];
    259 };
    260 
    261 struct ixgbe_tx_buf {
    262 	union ixgbe_adv_tx_desc	*eop;
    263 	struct mbuf	*m_head;
    264 	bus_dmamap_t	map;
    265 };
    266 
    267 struct ixgbe_rx_buf {
    268 	struct mbuf	*buf;
    269 	struct mbuf	*fmp;
    270 	bus_dmamap_t	pmap;
    271 	u_int		flags;
    272 #define IXGBE_RX_COPY	0x01
    273 	uint64_t	addr;
    274 };
    275 
    276 /*
    277  * Bus dma allocation structure used by ixgbe_dma_malloc and ixgbe_dma_free.
    278  */
    279 struct ixgbe_dma_alloc {
    280 	bus_addr_t		dma_paddr;
    281 	void			*dma_vaddr;
    282 	ixgbe_dma_tag_t		*dma_tag;
    283 	bus_dmamap_t		dma_map;
    284 	bus_dma_segment_t	dma_seg;
    285 	bus_size_t		dma_size;
    286 };
    287 
    288 /*
    289 ** Driver queue struct: this is the interrupt container
    290 **  for the associated tx and rx ring.
    291 */
    292 struct ix_queue {
    293 	struct adapter		*adapter;
    294 	u32			msix;           /* This queue's MSIX vector */
    295 	u32			eims;           /* This queue's EIMS bit */
    296 	u32			eitr_setting;
    297 	struct resource		*res;
    298 	void			*tag;
    299 	struct tx_ring		*txr;
    300 	struct rx_ring		*rxr;
    301 	void			*que_si;
    302 	u64			irqs;
    303 	char			namebuf[32];
    304 	char			evnamebuf[32];
    305 };
    306 
    307 /*
    308  * The transmit ring, one per queue
    309  */
    310 struct tx_ring {
    311         struct adapter		*adapter;
    312 	kmutex_t		tx_mtx;
    313 	u32			me;
    314 	struct timeval		watchdog_time;
    315 	union ixgbe_adv_tx_desc	*tx_base;
    316 	struct ixgbe_tx_buf	*tx_buffers;
    317 	struct ixgbe_dma_alloc	txdma;
    318 	volatile u16		tx_avail;
    319 	u16			next_avail_desc;
    320 	u16			next_to_clean;
    321 	u32			process_limit;
    322 	u16			num_desc;
    323 	enum {
    324 	    IXGBE_QUEUE_IDLE,
    325 	    IXGBE_QUEUE_WORKING,
    326 	    IXGBE_QUEUE_HUNG,
    327 	}			queue_status;
    328 	u32			txd_cmd;
    329 	ixgbe_dma_tag_t		*txtag;
    330 	char			mtx_name[16];
    331 #ifndef IXGBE_LEGACY_TX
    332 	struct buf_ring		*br;
    333 	void			*txq_si;
    334 #endif
    335 #ifdef IXGBE_FDIR
    336 	u16			atr_sample;
    337 	u16			atr_count;
    338 #endif
    339 	u32			bytes;  /* used for AIM */
    340 	u32			packets;
    341 	/* Soft Stats */
    342 	struct evcnt	   	tso_tx;
    343 	struct evcnt	   	no_tx_map_avail;
    344 	struct evcnt		no_desc_avail;
    345 	struct evcnt		total_packets;
    346 };
    347 
    348 
    349 /*
    350  * The Receive ring, one per rx queue
    351  */
    352 struct rx_ring {
    353         struct adapter		*adapter;
    354 	kmutex_t		rx_mtx;
    355 	u32			me;
    356 	union ixgbe_adv_rx_desc	*rx_base;
    357 	struct ixgbe_dma_alloc	rxdma;
    358 #ifdef LRO
    359 	struct lro_ctrl		lro;
    360 #endif /* LRO */
    361 	bool			lro_enabled;
    362 	bool			hw_rsc;
    363 	bool			vtag_strip;
    364         u16			next_to_refresh;
    365         u16 			next_to_check;
    366 	u16			num_desc;
    367 	u16			mbuf_sz;
    368 	u32			process_limit;
    369 	char			mtx_name[16];
    370 	struct ixgbe_rx_buf	*rx_buffers;
    371 	ixgbe_dma_tag_t		*ptag;
    372 
    373 	u32			bytes; /* Used for AIM calc */
    374 	u32			packets;
    375 
    376 	/* Soft stats */
    377 	struct evcnt		rx_irq;
    378 	struct evcnt		rx_copies;
    379 	struct evcnt		rx_packets;
    380 	struct evcnt 		rx_bytes;
    381 	struct evcnt 		rx_discarded;
    382 	struct evcnt 		no_jmbuf;
    383 	u64 			rsc_num;
    384 #ifdef IXGBE_FDIR
    385 	u64			flm;
    386 #endif
    387 };
    388 
    389 /* Our adapter structure */
    390 struct adapter {
    391 	struct ifnet		*ifp;
    392 	struct ixgbe_hw		hw;
    393 
    394 	struct ixgbe_osdep	osdep;
    395 	device_t		dev;
    396 
    397 	struct resource		*pci_mem;
    398 	struct resource		*msix_mem;
    399 
    400 	/*
    401 	 * Interrupt resources: this set is
    402 	 * either used for legacy, or for Link
    403 	 * when doing MSIX
    404 	 */
    405 	void			*tag;
    406 	struct resource 	*res;
    407 
    408 	struct ifmedia		media;
    409 	callout_t		timer;
    410 	int			msix;
    411 	int			if_flags;
    412 
    413 	kmutex_t		core_mtx;
    414 
    415 	unsigned int		num_queues;
    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 
    425 	/* Info about the interface */
    426 	u32			optics;
    427 	u32			fc; /* local flow ctrl setting */
    428 	int			advertise;  /* link speeds */
    429 	bool			link_active;
    430 	u16			max_frame_size;
    431 	u16			num_segs;
    432 	u32			link_speed;
    433 	bool			link_up;
    434 	u32 			linkvec;
    435 
    436 	/* Mbuf cluster size */
    437 	u32			rx_mbuf_sz;
    438 
    439 	/* Support for pluggable optics */
    440 	bool			sfp_probe;
    441 	void			*link_si;  /* Link tasklet */
    442 	void			*mod_si;   /* SFP tasklet */
    443 	void			*msf_si;   /* Multispeed Fiber */
    444 #ifdef IXGBE_FDIR
    445 	int			fdir_reinit;
    446 	void			*fdir_si;
    447 #endif
    448 
    449 	/*
    450 	** Queues:
    451 	**   This is the irq holder, it has
    452 	**   and RX/TX pair or rings associated
    453 	**   with it.
    454 	*/
    455 	struct ix_queue		*queues;
    456 
    457 	/*
    458 	 * Transmit rings:
    459 	 *	Allocated at run time, an array of rings.
    460 	 */
    461 	struct tx_ring		*tx_rings;
    462 	u32			num_tx_desc;
    463 
    464 	/*
    465 	 * Receive rings:
    466 	 *	Allocated at run time, an array of rings.
    467 	 */
    468 	struct rx_ring		*rx_rings;
    469 	u64			que_mask;
    470 	u32			num_rx_desc;
    471 
    472 	/* Multicast array memory */
    473 	u8			*mta;
    474 
    475 
    476 	/* Misc stats maintained by the driver */
    477 	struct evcnt   		dropped_pkts;
    478 	struct evcnt   		mbuf_defrag_failed;
    479 	struct evcnt	   	mbuf_header_failed;
    480 	struct evcnt	   	mbuf_packet_failed;
    481 	struct evcnt	   	efbig_tx_dma_setup;
    482 	struct evcnt	   	efbig2_tx_dma_setup;
    483 	struct evcnt	   	m_defrag_failed;
    484 	struct evcnt	   	einval_tx_dma_setup;
    485 	struct evcnt	   	other_tx_dma_setup;
    486 	struct evcnt	   	eagain_tx_dma_setup;
    487 	struct evcnt	   	enomem_tx_dma_setup;
    488 	struct evcnt	   	watchdog_events;
    489 	struct evcnt	   	tso_err;
    490 	struct evcnt		link_irq;
    491 	struct evcnt		morerx;
    492 	struct evcnt		moretx;
    493 	struct evcnt		txloops;
    494 	struct evcnt		handleq;
    495 	struct evcnt		req;
    496 
    497 	struct ixgbe_hw_stats 	stats;
    498 	struct sysctllog	*sysctllog;
    499 	ixgbe_extmem_head_t jcl_head;
    500 };
    501 
    502 
    503 /* Precision Time Sync (IEEE 1588) defines */
    504 #define ETHERTYPE_IEEE1588      0x88F7
    505 #define PICOSECS_PER_TICK       20833
    506 #define TSYNC_UDP_PORT          319 /* UDP port for the protocol */
    507 #define IXGBE_ADVTXD_TSTAMP	0x00080000
    508 
    509 
    510 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
    511         mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
    512 #define IXGBE_CORE_LOCK_DESTROY(_sc)      mutex_destroy(&(_sc)->core_mtx)
    513 #define IXGBE_TX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->tx_mtx)
    514 #define IXGBE_RX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->rx_mtx)
    515 #define IXGBE_CORE_LOCK(_sc)              mutex_enter(&(_sc)->core_mtx)
    516 #define IXGBE_TX_LOCK(_sc)                mutex_enter(&(_sc)->tx_mtx)
    517 #define IXGBE_TX_TRYLOCK(_sc)             mutex_tryenter(&(_sc)->tx_mtx)
    518 #define IXGBE_RX_LOCK(_sc)                mutex_enter(&(_sc)->rx_mtx)
    519 #define IXGBE_CORE_UNLOCK(_sc)            mutex_exit(&(_sc)->core_mtx)
    520 #define IXGBE_TX_UNLOCK(_sc)              mutex_exit(&(_sc)->tx_mtx)
    521 #define IXGBE_RX_UNLOCK(_sc)              mutex_exit(&(_sc)->rx_mtx)
    522 #define IXGBE_CORE_LOCK_ASSERT(_sc)       KASSERT(mutex_owned(&(_sc)->core_mtx))
    523 #define IXGBE_TX_LOCK_ASSERT(_sc)         KASSERT(mutex_owned(&(_sc)->tx_mtx))
    524 
    525 static inline bool
    526 ixgbe_is_sfp(struct ixgbe_hw *hw)
    527 {
    528 	switch (hw->phy.type) {
    529 	case ixgbe_phy_sfp_avago:
    530 	case ixgbe_phy_sfp_ftl:
    531 	case ixgbe_phy_sfp_intel:
    532 	case ixgbe_phy_sfp_unknown:
    533 	case ixgbe_phy_sfp_passive_tyco:
    534 	case ixgbe_phy_sfp_passive_unknown:
    535 		return TRUE;
    536 	default:
    537 		return FALSE;
    538 	}
    539 }
    540 
    541 /* Workaround to make 8.0 buildable */
    542 #if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
    543 static __inline int
    544 drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
    545 {
    546 #ifdef ALTQ
    547         if (ALTQ_IS_ENABLED(&ifp->if_snd))
    548                 return (1);
    549 #endif
    550         return (!buf_ring_empty(br));
    551 }
    552 #endif
    553 
    554 /*
    555 ** Find the number of unrefreshed RX descriptors
    556 */
    557 static inline u16
    558 ixgbe_rx_unrefreshed(struct rx_ring *rxr)
    559 {
    560 	if (rxr->next_to_check > rxr->next_to_refresh)
    561 		return (rxr->next_to_check - rxr->next_to_refresh - 1);
    562 	else
    563 		return ((rxr->num_desc + rxr->next_to_check) -
    564 		    rxr->next_to_refresh - 1);
    565 }
    566 
    567 #endif /* _IXGBE_H_ */
    568