version 1.32, 2018/03/02 10:19:20 |
version 1.32.2.5, 2018/05/02 07:20:11 |
|
|
POSSIBILITY OF SUCH DAMAGE. |
POSSIBILITY OF SUCH DAMAGE. |
|
|
******************************************************************************/ |
******************************************************************************/ |
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 320688 2017-07-05 17:27:03Z erj $*/ |
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 327031 2017-12-20 18:15:06Z erj $*/ |
|
|
/* |
/* |
* Copyright (c) 2011 The NetBSD Foundation, Inc. |
* Copyright (c) 2011 The NetBSD Foundation, Inc. |
|
|
#include "ixgbe_netbsd.h" |
#include "ixgbe_netbsd.h" |
#include "ixgbe_api.h" |
#include "ixgbe_api.h" |
#include "ixgbe_common.h" |
#include "ixgbe_common.h" |
#include "ixgbe_phy.h" |
|
#include "ixgbe_vf.h" |
#include "ixgbe_vf.h" |
#include "ixgbe_features.h" |
#include "ixgbe_features.h" |
|
|
|
|
|
|
/* Flow control constants */ |
/* Flow control constants */ |
#define IXGBE_FC_PAUSE 0xFFFF |
#define IXGBE_FC_PAUSE 0xFFFF |
#define IXGBE_FC_HI 0x20000 |
|
#define IXGBE_FC_LO 0x10000 |
|
|
|
/* |
/* |
* Used for optimizing small rx mbufs. Effort is made to keep the copy |
* Used for optimizing small rx mbufs. Effort is made to keep the copy |
|
|
IXGBE_EITR_ITR_INT_MASK) |
IXGBE_EITR_ITR_INT_MASK) |
|
|
|
|
|
|
/************************************************************************ |
/************************************************************************ |
* vendor_info_array |
* vendor_info_array |
* |
* |
Line 324 struct ixgbe_mc_addr { |
|
Line 320 struct ixgbe_mc_addr { |
|
struct ix_queue { |
struct ix_queue { |
struct adapter *adapter; |
struct adapter *adapter; |
u32 msix; /* This queue's MSI-X vector */ |
u32 msix; /* This queue's MSI-X vector */ |
u32 eims; /* This queue's EIMS bit */ |
|
u32 eitr_setting; |
u32 eitr_setting; |
u32 me; |
u32 me; |
struct resource *res; |
struct resource *res; |
void *tag; |
|
int busy; |
int busy; |
struct tx_ring *txr; |
struct tx_ring *txr; |
struct rx_ring *rxr; |
struct rx_ring *rxr; |
|
struct work wq_cookie; |
void *que_si; |
void *que_si; |
struct evcnt irqs; |
/* Per queue event conters */ |
|
struct evcnt irqs; /* Hardware interrupt */ |
|
struct evcnt handleq; /* software_interrupt */ |
|
struct evcnt req; /* deferred */ |
char namebuf[32]; |
char namebuf[32]; |
char evnamebuf[32]; |
char evnamebuf[32]; |
|
|
kmutex_t im_mtx; /* lock for im_nest and this queue's EIMS/EIMC bit */ |
kmutex_t dc_mtx; /* lock for disabled_count and this queue's EIMS/EIMC bit */ |
int im_nest; |
int disabled_count;/* |
|
* means |
struct work wq_cookie; |
* 0 : this queue is enabled |
|
* > 0 : this queue is disabled |
|
* the value is ixgbe_disable_queue() called count |
|
*/ |
|
bool txrx_use_workqueue; |
}; |
}; |
|
|
/* |
/* |
Line 359 struct tx_ring { |
|
Line 361 struct tx_ring { |
|
u16 next_avail_desc; |
u16 next_avail_desc; |
u16 next_to_clean; |
u16 next_to_clean; |
u16 num_desc; |
u16 num_desc; |
u32 txd_cmd; |
|
ixgbe_dma_tag_t *txtag; |
ixgbe_dma_tag_t *txtag; |
char mtx_name[16]; |
#if 0 |
|
char mtx_name[16]; /* NetBSD has no mutex name */ |
|
#endif |
pcq_t *txr_interq; |
pcq_t *txr_interq; |
|
struct work wq_cookie; |
void *txr_si; |
void *txr_si; |
|
|
/* Flow Director */ |
/* Flow Director */ |
u16 atr_sample; |
u16 atr_sample; |
u16 atr_count; |
u16 atr_count; |
|
|
u32 bytes; /* used for AIM */ |
u64 bytes; /* used for AIM */ |
u32 packets; |
u64 packets; |
/* Soft Stats */ |
/* Soft Stats */ |
struct evcnt tso_tx; |
struct evcnt tso_tx; |
struct evcnt no_desc_avail; |
struct evcnt no_desc_avail; |
struct evcnt total_packets; |
struct evcnt total_packets; |
struct evcnt pcq_drops; |
struct evcnt pcq_drops; |
|
/* Per queue conters. The adapter total is in struct adapter */ |
struct work wq_cookie; |
u64 q_efbig_tx_dma_setup; |
|
u64 q_mbuf_defrag_failed; |
|
u64 q_efbig2_tx_dma_setup; |
|
u64 q_einval_tx_dma_setup; |
|
u64 q_other_tx_dma_setup; |
|
u64 q_eagain_tx_dma_setup; |
|
u64 q_enomem_tx_dma_setup; |
|
u64 q_tso_err; |
}; |
}; |
|
|
|
|
Line 401 struct rx_ring { |
|
Line 412 struct rx_ring { |
|
u16 next_to_check; |
u16 next_to_check; |
u16 num_desc; |
u16 num_desc; |
u16 mbuf_sz; |
u16 mbuf_sz; |
char mtx_name[16]; |
#if 0 |
|
char mtx_name[16]; /* NetBSD has no mutex name */ |
|
#endif |
struct ixgbe_rx_buf *rx_buffers; |
struct ixgbe_rx_buf *rx_buffers; |
ixgbe_dma_tag_t *ptag; |
ixgbe_dma_tag_t *ptag; |
|
|
u32 bytes; /* Used for AIM calc */ |
u64 bytes; /* Used for AIM calc */ |
u32 packets; |
u64 packets; |
|
|
/* Soft stats */ |
/* Soft stats */ |
struct evcnt rx_copies; |
struct evcnt rx_copies; |
Line 447 struct adapter { |
|
Line 460 struct adapter { |
|
struct resource *pci_mem; |
struct resource *pci_mem; |
struct resource *msix_mem; |
struct resource *msix_mem; |
|
|
/* |
/* NetBSD: Interrupt resources are in osdep */ |
* Interrupt resources: this set is |
|
* either used for legacy, or for Link |
|
* when doing MSI-X |
|
*/ |
|
void *tag; |
|
struct resource *res; |
|
|
|
struct ifmedia media; |
struct ifmedia media; |
callout_t timer; |
callout_t timer; |
int link_rid; |
|
int if_flags; |
int if_flags; |
|
|
kmutex_t core_mtx; |
kmutex_t core_mtx; |
Line 558 struct adapter { |
|
Line 564 struct adapter { |
|
void (*stop_locked)(void *); |
void (*stop_locked)(void *); |
|
|
/* Misc stats maintained by the driver */ |
/* Misc stats maintained by the driver */ |
struct evcnt mbuf_defrag_failed; |
|
struct evcnt efbig_tx_dma_setup; |
struct evcnt efbig_tx_dma_setup; |
|
struct evcnt mbuf_defrag_failed; |
struct evcnt efbig2_tx_dma_setup; |
struct evcnt efbig2_tx_dma_setup; |
struct evcnt einval_tx_dma_setup; |
struct evcnt einval_tx_dma_setup; |
struct evcnt other_tx_dma_setup; |
struct evcnt other_tx_dma_setup; |
Line 568 struct adapter { |
|
Line 574 struct adapter { |
|
struct evcnt tso_err; |
struct evcnt tso_err; |
struct evcnt watchdog_events; |
struct evcnt watchdog_events; |
struct evcnt link_irq; |
struct evcnt link_irq; |
struct evcnt handleq; |
struct evcnt link_sicount; |
struct evcnt req; |
struct evcnt mod_sicount; |
|
struct evcnt msf_sicount; |
|
struct evcnt phy_sicount; |
|
|
union { |
union { |
struct ixgbe_hw_stats pf; |
struct ixgbe_hw_stats pf; |
Line 597 struct adapter { |
|
Line 605 struct adapter { |
|
ixgbe_extmem_head_t jcl_head; |
ixgbe_extmem_head_t jcl_head; |
}; |
}; |
|
|
|
|
/* Precision Time Sync (IEEE 1588) defines */ |
/* Precision Time Sync (IEEE 1588) defines */ |
#define ETHERTYPE_IEEE1588 0x88F7 |
#define ETHERTYPE_IEEE1588 0x88F7 |
#define PICOSECS_PER_TICK 20833 |
#define PICOSECS_PER_TICK 20833 |
Line 673 static __inline int |
|
Line 680 static __inline int |
|
drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) |
drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) |
{ |
{ |
#ifdef ALTQ |
#ifdef ALTQ |
if (ALTQ_IS_ENABLED(&ifp->if_snd)) |
if (ALTQ_IS_ENABLED(&ifp->if_snd)) |
return (1); |
return (1); |
#endif |
#endif |
return (!buf_ring_empty(br)); |
return (!buf_ring_empty(br)); |
} |
} |
#endif |
#endif |
|
|
/* |
/* |
* Find the number of unrefreshed RX descriptors |
* Find the number of unrefreshed RX descriptors |
*/ |
*/ |
static inline u16 |
static __inline u16 |
ixgbe_rx_unrefreshed(struct rx_ring *rxr) |
ixgbe_rx_unrefreshed(struct rx_ring *rxr) |
{ |
{ |
if (rxr->next_to_check > rxr->next_to_refresh) |
if (rxr->next_to_check > rxr->next_to_refresh) |
Line 693 ixgbe_rx_unrefreshed(struct rx_ring *rxr |
|
Line 700 ixgbe_rx_unrefreshed(struct rx_ring *rxr |
|
rxr->next_to_refresh - 1); |
rxr->next_to_refresh - 1); |
} |
} |
|
|
static inline int |
static __inline int |
ixgbe_legacy_ring_empty(struct ifnet *ifp, pcq_t *dummy) |
ixgbe_legacy_ring_empty(struct ifnet *ifp, pcq_t *dummy) |
{ |
{ |
UNREFERENCED_1PARAMETER(dummy); |
UNREFERENCED_1PARAMETER(dummy); |
Line 701 ixgbe_legacy_ring_empty(struct ifnet *if |
|
Line 708 ixgbe_legacy_ring_empty(struct ifnet *if |
|
return IFQ_IS_EMPTY(&ifp->if_snd); |
return IFQ_IS_EMPTY(&ifp->if_snd); |
} |
} |
|
|
static inline int |
static __inline int |
ixgbe_mq_ring_empty(struct ifnet *dummy, pcq_t *interq) |
ixgbe_mq_ring_empty(struct ifnet *dummy, pcq_t *interq) |
{ |
{ |
UNREFERENCED_1PARAMETER(dummy); |
UNREFERENCED_1PARAMETER(dummy); |
Line 713 ixgbe_mq_ring_empty(struct ifnet *dummy, |
|
Line 720 ixgbe_mq_ring_empty(struct ifnet *dummy, |
|
* This checks for a zero mac addr, something that will be likely |
* This checks for a zero mac addr, something that will be likely |
* unless the Admin on the Host has created one. |
* unless the Admin on the Host has created one. |
*/ |
*/ |
static inline bool |
static __inline bool |
ixv_check_ether_addr(u8 *addr) |
ixv_check_ether_addr(u8 *addr) |
{ |
{ |
bool status = TRUE; |
bool status = TRUE; |
Line 732 int ixgbe_mq_start(struct ifnet *, stru |
|
Line 739 int ixgbe_mq_start(struct ifnet *, stru |
|
int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *); |
int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *); |
void ixgbe_deferred_mq_start(void *); |
void ixgbe_deferred_mq_start(void *); |
void ixgbe_deferred_mq_start_work(struct work *, void *); |
void ixgbe_deferred_mq_start_work(struct work *, void *); |
|
void ixgbe_drain_all(struct adapter *); |
|
|
int ixgbe_allocate_queues(struct adapter *); |
int ixgbe_allocate_queues(struct adapter *); |
int ixgbe_setup_transmit_structures(struct adapter *); |
int ixgbe_setup_transmit_structures(struct adapter *); |
Line 743 bool ixgbe_rxeof(struct ix_queue *); |
|
Line 751 bool ixgbe_rxeof(struct ix_queue *); |
|
|
|
const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *); |
const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *); |
|
|
|
/* For NetBSD */ |
|
void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, int, size_t); |
|
|
#include "ixgbe_bypass.h" |
#include "ixgbe_bypass.h" |
#include "ixgbe_sriov.h" |
|
#include "ixgbe_fdir.h" |
#include "ixgbe_fdir.h" |
#include "ixgbe_rss.h" |
#include "ixgbe_rss.h" |
#include "ixgbe_netmap.h" |
#include "ixgbe_netmap.h" |