Home | History | Annotate | Line # | Download | only in ixgbe
ixgbe.h revision 1.7
      1 /******************************************************************************
      2 
      3   Copyright (c) 2001-2012, 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 244514 2012-12-20 22:26:03Z luigi $*/
     62 /*$NetBSD: ixgbe.h,v 1.7 2015/04/24 07:00:51 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 IXGBE_RX_COPY_LEN	160
    184 #define IXGBE_RX_COPY_ALIGN	(MHLEN - IXGBE_RX_COPY_LEN)
    185 
    186 /* Keep older OS drivers building... */
    187 #if !defined(SYSCTL_ADD_UQUAD)
    188 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
    189 #endif
    190 
    191 /* Defines for printing debug information */
    192 #define DEBUG_INIT  0
    193 #define DEBUG_IOCTL 0
    194 #define DEBUG_HW    0
    195 
    196 #define INIT_DEBUGOUT(S)            if (DEBUG_INIT)  printf(S "\n")
    197 #define INIT_DEBUGOUT1(S, A)        if (DEBUG_INIT)  printf(S "\n", A)
    198 #define INIT_DEBUGOUT2(S, A, B)     if (DEBUG_INIT)  printf(S "\n", A, B)
    199 #define IOCTL_DEBUGOUT(S)           if (DEBUG_IOCTL) printf(S "\n")
    200 #define IOCTL_DEBUGOUT1(S, A)       if (DEBUG_IOCTL) printf(S "\n", A)
    201 #define IOCTL_DEBUGOUT2(S, A, B)    if (DEBUG_IOCTL) printf(S "\n", A, B)
    202 #define HW_DEBUGOUT(S)              if (DEBUG_HW) printf(S "\n")
    203 #define HW_DEBUGOUT1(S, A)          if (DEBUG_HW) printf(S "\n", A)
    204 #define HW_DEBUGOUT2(S, A, B)       if (DEBUG_HW) printf(S "\n", A, B)
    205 
    206 #define MAX_NUM_MULTICAST_ADDRESSES     128
    207 #define IXGBE_82598_SCATTER		100
    208 #define IXGBE_82599_SCATTER		32
    209 #define MSIX_82598_BAR			3
    210 #define MSIX_82599_BAR			4
    211 #define IXGBE_TSO_SIZE			262140
    212 #define IXGBE_TX_BUFFER_SIZE		((u32) 1514)
    213 #define IXGBE_RX_HDR			128
    214 #define IXGBE_VFTA_SIZE			128
    215 #define IXGBE_BR_SIZE			4096
    216 #define IXGBE_QUEUE_MIN_FREE		32
    217 
    218 /* IOCTL define to gather SFP+ Diagnostic data */
    219 #define SIOCGI2C	SIOCGIFGENERIC
    220 
    221 /* Offload bits in mbuf flag */
    222 #define	M_CSUM_OFFLOAD	\
    223     (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4|M_CSUM_UDPv6|M_CSUM_TCPv6)
    224 
    225 /*
    226  * Interrupt Moderation parameters
    227  */
    228 #define IXGBE_LOW_LATENCY	128
    229 #define IXGBE_AVE_LATENCY	400
    230 #define IXGBE_BULK_LATENCY	1200
    231 #define IXGBE_LINK_ITR		2000
    232 
    233 /*
    234  *****************************************************************************
    235  * vendor_info_array
    236  *
    237  * This array contains the list of Subvendor/Subdevice IDs on which the driver
    238  * should load.
    239  *
    240  *****************************************************************************
    241  */
    242 typedef struct _ixgbe_vendor_info_t {
    243 	unsigned int    vendor_id;
    244 	unsigned int    device_id;
    245 	unsigned int    subvendor_id;
    246 	unsigned int    subdevice_id;
    247 	unsigned int    index;
    248 } ixgbe_vendor_info_t;
    249 
    250 /* This is used to get SFP+ module data */
    251 struct ixgbe_i2c_req {
    252         u8 dev_addr;
    253         u8 offset;
    254         u8 len;
    255         u8 data[8];
    256 };
    257 
    258 struct ixgbe_tx_buf {
    259 	union ixgbe_adv_tx_desc	*eop;
    260 	struct mbuf	*m_head;
    261 	bus_dmamap_t	map;
    262 };
    263 
    264 struct ixgbe_rx_buf {
    265 	struct mbuf	*buf;
    266 	struct mbuf	*fmp;
    267 	bus_dmamap_t	pmap;
    268 	u_int		flags;
    269 #define IXGBE_RX_COPY	0x01
    270 	uint64_t	addr;
    271 };
    272 
    273 /*
    274  * Bus dma allocation structure used by ixgbe_dma_malloc and ixgbe_dma_free.
    275  */
    276 struct ixgbe_dma_alloc {
    277 	bus_addr_t		dma_paddr;
    278 	void			*dma_vaddr;
    279 	ixgbe_dma_tag_t		*dma_tag;
    280 	bus_dmamap_t		dma_map;
    281 	bus_dma_segment_t	dma_seg;
    282 	bus_size_t		dma_size;
    283 };
    284 
    285 /*
    286 ** Driver queue struct: this is the interrupt container
    287 **  for the associated tx and rx ring.
    288 */
    289 struct ix_queue {
    290 	struct adapter		*adapter;
    291 	u32			msix;           /* This queue's MSIX vector */
    292 	u32			eims;           /* This queue's EIMS bit */
    293 	u32			eitr_setting;
    294 	struct resource		*res;
    295 	void			*tag;
    296 	struct tx_ring		*txr;
    297 	struct rx_ring		*rxr;
    298 	void			*que_si;
    299 	u64			irqs;
    300 	char			namebuf[32];
    301 	char			evnamebuf[32];
    302 };
    303 
    304 /*
    305  * The transmit ring, one per queue
    306  */
    307 struct tx_ring {
    308         struct adapter		*adapter;
    309 	kmutex_t		tx_mtx;
    310 	u32			me;
    311 	struct timeval		watchdog_time;
    312 	union ixgbe_adv_tx_desc	*tx_base;
    313 	struct ixgbe_tx_buf	*tx_buffers;
    314 	struct ixgbe_dma_alloc	txdma;
    315 	volatile u16		tx_avail;
    316 	u16			next_avail_desc;
    317 	u16			next_to_clean;
    318 	u32			process_limit;
    319 	u16			num_desc;
    320 	enum {
    321 	    IXGBE_QUEUE_IDLE,
    322 	    IXGBE_QUEUE_WORKING,
    323 	    IXGBE_QUEUE_HUNG,
    324 	}			queue_status;
    325 	u32			txd_cmd;
    326 	ixgbe_dma_tag_t		*txtag;
    327 	char			mtx_name[16];
    328 #ifndef IXGBE_LEGACY_TX
    329 	struct buf_ring		*br;
    330 	void			*txq_si;
    331 #endif
    332 #ifdef IXGBE_FDIR
    333 	u16			atr_sample;
    334 	u16			atr_count;
    335 #endif
    336 	u32			bytes;  /* used for AIM */
    337 	u32			packets;
    338 	/* Soft Stats */
    339 	struct evcnt	   	tso_tx;
    340 	struct evcnt	   	no_tx_map_avail;
    341 	struct evcnt		no_desc_avail;
    342 	struct evcnt		total_packets;
    343 };
    344 
    345 
    346 /*
    347  * The Receive ring, one per rx queue
    348  */
    349 struct rx_ring {
    350         struct adapter		*adapter;
    351 	kmutex_t		rx_mtx;
    352 	u32			me;
    353 	union ixgbe_adv_rx_desc	*rx_base;
    354 	struct ixgbe_dma_alloc	rxdma;
    355 #ifdef LRO
    356 	struct lro_ctrl		lro;
    357 #endif /* LRO */
    358 	bool			lro_enabled;
    359 	bool			hw_rsc;
    360 	bool			discard;
    361 	bool			vtag_strip;
    362         u16			next_to_refresh;
    363         u16 			next_to_check;
    364 	u16			num_desc;
    365 	u16			mbuf_sz;
    366 	u32			process_limit;
    367 	char			mtx_name[16];
    368 	struct ixgbe_rx_buf	*rx_buffers;
    369 	ixgbe_dma_tag_t		*ptag;
    370 
    371 	u32			bytes; /* Used for AIM calc */
    372 	u32			packets;
    373 
    374 	/* Soft stats */
    375 	struct evcnt		rx_irq;
    376 	struct evcnt		rx_copies;
    377 	struct evcnt		rx_packets;
    378 	struct evcnt 		rx_bytes;
    379 	struct evcnt 		rx_discarded;
    380 	struct evcnt 		no_jmbuf;
    381 	u64 			rsc_num;
    382 #ifdef IXGBE_FDIR
    383 	u64			flm;
    384 #endif
    385 };
    386 
    387 /* Our adapter structure */
    388 struct adapter {
    389 	struct ifnet		*ifp;
    390 	struct ixgbe_hw		hw;
    391 
    392 	struct ixgbe_osdep	osdep;
    393 	device_t		dev;
    394 
    395 	struct resource		*pci_mem;
    396 	struct resource		*msix_mem;
    397 
    398 	/*
    399 	 * Interrupt resources: this set is
    400 	 * either used for legacy, or for Link
    401 	 * when doing MSIX
    402 	 */
    403 	void			*tag;
    404 	struct resource 	*res;
    405 
    406 	struct ifmedia		media;
    407 	callout_t		timer;
    408 	int			msix;
    409 	int			if_flags;
    410 
    411 	kmutex_t		core_mtx;
    412 
    413 	unsigned int		num_queues;
    414 
    415 	/*
    416 	** Shadow VFTA table, this is needed because
    417 	** the real vlan filter table gets cleared during
    418 	** a soft reset and the driver needs to be able
    419 	** to repopulate it.
    420 	*/
    421 	u32			shadow_vfta[IXGBE_VFTA_SIZE];
    422 
    423 	/* Info about the interface */
    424 	u32			optics;
    425 	u32			fc; /* local flow ctrl setting */
    426 	int			advertise;  /* link speeds */
    427 	bool			link_active;
    428 	u16			max_frame_size;
    429 	u16			num_segs;
    430 	u32			link_speed;
    431 	bool			link_up;
    432 	u32 			linkvec;
    433 
    434 	/* Mbuf cluster size */
    435 	u32			rx_mbuf_sz;
    436 
    437 	/* Support for pluggable optics */
    438 	bool			sfp_probe;
    439 	void			*link_si;  /* Link tasklet */
    440 	void			*mod_si;   /* SFP tasklet */
    441 	void			*msf_si;   /* Multispeed Fiber */
    442 #ifdef IXGBE_FDIR
    443 	int			fdir_reinit;
    444 	void			*fdir_si;
    445 #endif
    446 
    447 	/*
    448 	** Queues:
    449 	**   This is the irq holder, it has
    450 	**   and RX/TX pair or rings associated
    451 	**   with it.
    452 	*/
    453 	struct ix_queue		*queues;
    454 
    455 	/*
    456 	 * Transmit rings:
    457 	 *	Allocated at run time, an array of rings.
    458 	 */
    459 	struct tx_ring		*tx_rings;
    460 	u32			num_tx_desc;
    461 
    462 	/*
    463 	 * Receive rings:
    464 	 *	Allocated at run time, an array of rings.
    465 	 */
    466 	struct rx_ring		*rx_rings;
    467 	u64			que_mask;
    468 	u32			num_rx_desc;
    469 
    470 	/* Multicast array memory */
    471 	u8			*mta;
    472 
    473 	/* Misc stats maintained by the driver */
    474 	struct evcnt   		dropped_pkts;
    475 	struct evcnt   		mbuf_defrag_failed;
    476 	struct evcnt	   	mbuf_header_failed;
    477 	struct evcnt	   	mbuf_packet_failed;
    478 	struct evcnt	   	efbig_tx_dma_setup;
    479 	struct evcnt	   	efbig2_tx_dma_setup;
    480 	struct evcnt	   	m_defrag_failed;
    481 	struct evcnt	   	einval_tx_dma_setup;
    482 	struct evcnt	   	other_tx_dma_setup;
    483 	struct evcnt	   	eagain_tx_dma_setup;
    484 	struct evcnt	   	enomem_tx_dma_setup;
    485 	struct evcnt	   	watchdog_events;
    486 	struct evcnt	   	tso_err;
    487 	struct evcnt		link_irq;
    488 	struct evcnt		morerx;
    489 	struct evcnt		moretx;
    490 	struct evcnt		txloops;
    491 	struct evcnt		handleq;
    492 	struct evcnt		req;
    493 
    494 	struct ixgbe_hw_stats 	stats;
    495 	struct sysctllog	*sysctllog;
    496 	ixgbe_extmem_head_t jcl_head;
    497 };
    498 
    499 /* Precision Time Sync (IEEE 1588) defines */
    500 #define ETHERTYPE_IEEE1588      0x88F7
    501 #define PICOSECS_PER_TICK       20833
    502 #define TSYNC_UDP_PORT          319 /* UDP port for the protocol */
    503 #define IXGBE_ADVTXD_TSTAMP	0x00080000
    504 
    505 
    506 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
    507         mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
    508 #define IXGBE_CORE_LOCK_DESTROY(_sc)      mutex_destroy(&(_sc)->core_mtx)
    509 #define IXGBE_TX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->tx_mtx)
    510 #define IXGBE_RX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->rx_mtx)
    511 #define IXGBE_CORE_LOCK(_sc)              mutex_enter(&(_sc)->core_mtx)
    512 #define IXGBE_TX_LOCK(_sc)                mutex_enter(&(_sc)->tx_mtx)
    513 #define IXGBE_TX_TRYLOCK(_sc)             mutex_tryenter(&(_sc)->tx_mtx)
    514 #define IXGBE_RX_LOCK(_sc)                mutex_enter(&(_sc)->rx_mtx)
    515 #define IXGBE_CORE_UNLOCK(_sc)            mutex_exit(&(_sc)->core_mtx)
    516 #define IXGBE_TX_UNLOCK(_sc)              mutex_exit(&(_sc)->tx_mtx)
    517 #define IXGBE_RX_UNLOCK(_sc)              mutex_exit(&(_sc)->rx_mtx)
    518 #define IXGBE_CORE_LOCK_ASSERT(_sc)       KASSERT(mutex_owned(&(_sc)->core_mtx))
    519 #define IXGBE_TX_LOCK_ASSERT(_sc)         KASSERT(mutex_owned(&(_sc)->tx_mtx))
    520 
    521 
    522 static inline bool
    523 ixgbe_is_sfp(struct ixgbe_hw *hw)
    524 {
    525 	switch (hw->phy.type) {
    526 	case ixgbe_phy_sfp_avago:
    527 	case ixgbe_phy_sfp_ftl:
    528 	case ixgbe_phy_sfp_intel:
    529 	case ixgbe_phy_sfp_unknown:
    530 	case ixgbe_phy_sfp_passive_tyco:
    531 	case ixgbe_phy_sfp_passive_unknown:
    532 		return TRUE;
    533 	default:
    534 		return FALSE;
    535 	}
    536 }
    537 
    538 /* Workaround to make 8.0 buildable */
    539 #if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
    540 static __inline int
    541 drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
    542 {
    543 #ifdef ALTQ
    544         if (ALTQ_IS_ENABLED(&ifp->if_snd))
    545                 return (1);
    546 #endif
    547         return (!buf_ring_empty(br));
    548 }
    549 #endif
    550 
    551 /*
    552 ** Find the number of unrefreshed RX descriptors
    553 */
    554 static inline u16
    555 ixgbe_rx_unrefreshed(struct rx_ring *rxr)
    556 {
    557 	if (rxr->next_to_check > rxr->next_to_refresh)
    558 		return (rxr->next_to_check - rxr->next_to_refresh - 1);
    559 	else
    560 		return ((rxr->num_desc + rxr->next_to_check) -
    561 		    rxr->next_to_refresh - 1);
    562 }
    563 
    564 #endif /* _IXGBE_H_ */
    565