Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bnxt/bnxt.h
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
#define NETXTREME_E_VF3 0x16dc | #define NETXTREME_E_VF3 0x16dc | ||||
#define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ | #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ | ||||
CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ | CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ | ||||
CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) | CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) | ||||
#define BNXT_MAX_MTU 9000 | #define BNXT_MAX_MTU 9000 | ||||
#define BNXT_RSS_HASH_TYPE_TCPV4 0 | |||||
#define BNXT_RSS_HASH_TYPE_UDPV4 1 | |||||
#define BNXT_RSS_HASH_TYPE_IPV4 2 | |||||
#define BNXT_RSS_HASH_TYPE_TCPV6 3 | |||||
#define BNXT_RSS_HASH_TYPE_UDPV6 4 | |||||
#define BNXT_RSS_HASH_TYPE_IPV6 5 | |||||
#define BNXT_GET_RSS_PROFILE_ID(rss_hash_type) ((rss_hash_type >> 1) & 0x1F) | |||||
#define BNXT_NO_MORE_WOL_FILTERS 0xFFFF | |||||
#define bnxt_wol_supported(softc) (!((softc)->flags & BNXT_FLAG_VF) && \ | |||||
((softc)->flags & BNXT_FLAG_WOL_CAP )) | |||||
/* Completion related defines */ | /* Completion related defines */ | ||||
#define CMP_VALID(cmp, v_bit) \ | #define CMP_VALID(cmp, v_bit) \ | ||||
((!!(((struct cmpl_base *)(cmp))->info3_v & htole32(CMPL_BASE_V))) == !!(v_bit) ) | ((!!(((struct cmpl_base *)(cmp))->info3_v & htole32(CMPL_BASE_V))) == !!(v_bit) ) | ||||
#define NEXT_CP_CONS_V(ring, cons, v_bit) do { \ | #define NEXT_CP_CONS_V(ring, cons, v_bit) do { \ | ||||
if (__predict_false(++(cons) == (ring)->ring_size)) \ | if (__predict_false(++(cons) == (ring)->ring_size)) \ | ||||
((cons) = 0, (v_bit) = !v_bit); \ | ((cons) = 0, (v_bit) = !v_bit); \ | ||||
} while (0) | } while (0) | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | |||||
/* Lock macros */ | /* Lock macros */ | ||||
#define BNXT_HWRM_LOCK_INIT(_softc, _name) \ | #define BNXT_HWRM_LOCK_INIT(_softc, _name) \ | ||||
mtx_init(&(_softc)->hwrm_lock, _name, "BNXT HWRM Lock", MTX_DEF) | mtx_init(&(_softc)->hwrm_lock, _name, "BNXT HWRM Lock", MTX_DEF) | ||||
#define BNXT_HWRM_LOCK(_softc) mtx_lock(&(_softc)->hwrm_lock) | #define BNXT_HWRM_LOCK(_softc) mtx_lock(&(_softc)->hwrm_lock) | ||||
#define BNXT_HWRM_UNLOCK(_softc) mtx_unlock(&(_softc)->hwrm_lock) | #define BNXT_HWRM_UNLOCK(_softc) mtx_unlock(&(_softc)->hwrm_lock) | ||||
#define BNXT_HWRM_LOCK_DESTROY(_softc) mtx_destroy(&(_softc)->hwrm_lock) | #define BNXT_HWRM_LOCK_DESTROY(_softc) mtx_destroy(&(_softc)->hwrm_lock) | ||||
#define BNXT_HWRM_LOCK_ASSERT(_softc) mtx_assert(&(_softc)->hwrm_lock, \ | #define BNXT_HWRM_LOCK_ASSERT(_softc) mtx_assert(&(_softc)->hwrm_lock, \ | ||||
MA_OWNED) | MA_OWNED) | ||||
#define BNXT_IS_FLOW_CTRL_CHANGED(link_info) \ | |||||
((link_info->last_flow_ctrl.tx != link_info->flow_ctrl.tx) || \ | |||||
(link_info->last_flow_ctrl.rx != link_info->flow_ctrl.rx) || \ | |||||
(link_info->last_flow_ctrl.autoneg != link_info->flow_ctrl.autoneg)) | |||||
/* Chip info */ | /* Chip info */ | ||||
#define BNXT_TSO_SIZE UINT16_MAX | #define BNXT_TSO_SIZE UINT16_MAX | ||||
#define min_t(type, x, y) ({ \ | |||||
type __min1 = (x); \ | |||||
type __min2 = (y); \ | |||||
__min1 < __min2 ? __min1 : __min2; }) | |||||
#define max_t(type, x, y) ({ \ | |||||
type __max1 = (x); \ | |||||
type __max2 = (y); \ | |||||
__max1 > __max2 ? __max1 : __max2; }) | |||||
#define clamp_t(type, _x, min, max) min_t(type, max_t(type, _x, min), max) | |||||
#define BNXT_IFMEDIA_ADD(supported, fw_speed, ifm_speed) do { \ | |||||
if ((supported) & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_ ## fw_speed) \ | |||||
ifmedia_add(softc->media, IFM_ETHER | (ifm_speed), 0, NULL); \ | |||||
} while(0) | |||||
#define BNXT_MIN_FRAME_SIZE 52 /* Frames must be padded to this size for some A0 chips */ | |||||
/* NVRAM access */ | /* NVRAM access */ | ||||
enum bnxt_nvm_directory_type { | enum bnxt_nvm_directory_type { | ||||
BNX_DIR_TYPE_UNUSED = 0, | BNX_DIR_TYPE_UNUSED = 0, | ||||
BNX_DIR_TYPE_PKG_LOG = 1, | BNX_DIR_TYPE_PKG_LOG = 1, | ||||
BNX_DIR_TYPE_UPDATE = 2, | BNX_DIR_TYPE_UPDATE = 2, | ||||
BNX_DIR_TYPE_CHIMP_PATCH = 3, | BNX_DIR_TYPE_CHIMP_PATCH = 3, | ||||
BNX_DIR_TYPE_BOOTCODE = 4, | BNX_DIR_TYPE_BOOTCODE = 4, | ||||
BNX_DIR_TYPE_VPD = 5, | BNX_DIR_TYPE_VPD = 5, | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
struct bnxt_bar_info { | struct bnxt_bar_info { | ||||
struct resource *res; | struct resource *res; | ||||
bus_space_tag_t tag; | bus_space_tag_t tag; | ||||
bus_space_handle_t handle; | bus_space_handle_t handle; | ||||
bus_size_t size; | bus_size_t size; | ||||
int rid; | int rid; | ||||
}; | }; | ||||
struct bnxt_flow_ctrl { | |||||
bool rx; | |||||
bool tx; | |||||
bool autoneg; | |||||
}; | |||||
struct bnxt_link_info { | struct bnxt_link_info { | ||||
uint8_t media_type; | uint8_t media_type; | ||||
uint8_t transceiver; | uint8_t transceiver; | ||||
uint8_t phy_addr; | uint8_t phy_addr; | ||||
uint8_t phy_link_status; | uint8_t phy_link_status; | ||||
uint8_t wire_speed; | uint8_t wire_speed; | ||||
uint8_t loop_back; | uint8_t loop_back; | ||||
uint8_t link_up; | uint8_t link_up; | ||||
uint8_t last_link_up; | uint8_t last_link_up; | ||||
uint8_t duplex; | uint8_t duplex; | ||||
uint8_t last_duplex; | uint8_t last_duplex; | ||||
uint8_t pause; | struct bnxt_flow_ctrl flow_ctrl; | ||||
uint8_t last_pause; | struct bnxt_flow_ctrl last_flow_ctrl; | ||||
uint8_t auto_pause; | |||||
uint8_t force_pause; | |||||
uint8_t duplex_setting; | uint8_t duplex_setting; | ||||
uint8_t auto_mode; | uint8_t auto_mode; | ||||
#define PHY_VER_LEN 3 | #define PHY_VER_LEN 3 | ||||
uint8_t phy_ver[PHY_VER_LEN]; | uint8_t phy_ver[PHY_VER_LEN]; | ||||
uint8_t phy_type; | uint8_t phy_type; | ||||
uint16_t link_speed; | uint16_t link_speed; | ||||
uint16_t support_speeds; | uint16_t support_speeds; | ||||
uint16_t auto_link_speeds; | uint16_t auto_link_speeds; | ||||
uint16_t auto_link_speed; | uint16_t auto_link_speed; | ||||
uint16_t force_link_speed; | uint16_t force_link_speed; | ||||
uint32_t preemphasis; | uint32_t preemphasis; | ||||
/* copy of requested setting */ | /* copy of requested setting */ | ||||
uint8_t autoneg; | uint8_t autoneg; | ||||
#define BNXT_AUTONEG_SPEED 1 | #define BNXT_AUTONEG_SPEED 1 | ||||
#define BNXT_AUTONEG_FLOW_CTRL 2 | #define BNXT_AUTONEG_FLOW_CTRL 2 | ||||
uint8_t req_duplex; | uint8_t req_duplex; | ||||
uint8_t req_flow_ctrl; | |||||
uint16_t req_link_speed; | uint16_t req_link_speed; | ||||
}; | }; | ||||
enum bnxt_cp_type { | enum bnxt_cp_type { | ||||
BNXT_DEFAULT, | BNXT_DEFAULT, | ||||
BNXT_TX, | BNXT_TX, | ||||
BNXT_RX, | BNXT_RX, | ||||
BNXT_SHARED | BNXT_SHARED | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | #define BNXT_VF_LINK_UP 0x8 | ||||
uint32_t flags; | uint32_t flags; | ||||
uint32_t func_flags; /* func cfg flags */ | uint32_t func_flags; /* func cfg flags */ | ||||
uint32_t min_tx_rate; | uint32_t min_tx_rate; | ||||
uint32_t max_tx_rate; | uint32_t max_tx_rate; | ||||
void *hwrm_cmd_req_addr; | void *hwrm_cmd_req_addr; | ||||
bus_addr_t hwrm_cmd_req_dma_addr; | bus_addr_t hwrm_cmd_req_dma_addr; | ||||
}; | }; | ||||
#define BNXT_FLAG_VF (1<<1) | |||||
#define BNXT_PF(softc) (!((softc)->flags & BNXT_FLAG_VF)) | #define BNXT_PF(softc) (!((softc)->flags & BNXT_FLAG_VF)) | ||||
#define BNXT_VF(softc) ((softc)->flags & BNXT_FLAG_VF) | #define BNXT_VF(softc) ((softc)->flags & BNXT_FLAG_VF) | ||||
struct bnxt_vlan_tag { | struct bnxt_vlan_tag { | ||||
SLIST_ENTRY(bnxt_vlan_tag) next; | SLIST_ENTRY(bnxt_vlan_tag) next; | ||||
uint16_t tpid; | uint16_t tpid; | ||||
uint16_t tag; | uint16_t tag; | ||||
Show All 40 Lines | |||||
struct bnxt_ring { | struct bnxt_ring { | ||||
uint64_t paddr; | uint64_t paddr; | ||||
vm_offset_t doorbell; | vm_offset_t doorbell; | ||||
caddr_t vaddr; | caddr_t vaddr; | ||||
struct bnxt_softc *softc; | struct bnxt_softc *softc; | ||||
uint32_t ring_size; /* Must be a power of two */ | uint32_t ring_size; /* Must be a power of two */ | ||||
uint16_t id; /* Logical ID */ | uint16_t id; /* Logical ID */ | ||||
uint16_t phys_id; | uint16_t phys_id; | ||||
struct bnxt_full_tpa_start *tpa_start; | |||||
}; | }; | ||||
struct bnxt_cp_ring { | struct bnxt_cp_ring { | ||||
struct bnxt_ring ring; | struct bnxt_ring ring; | ||||
struct if_irq irq; | struct if_irq irq; | ||||
uint32_t cons; | uint32_t cons; | ||||
bool v_bit; /* Value of valid bit */ | bool v_bit; /* Value of valid bit */ | ||||
struct ctx_hw_stats *stats; | struct ctx_hw_stats *stats; | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | struct bnxt_nvram_info { | ||||
uint32_t size; | uint32_t size; | ||||
uint32_t reserved_size; | uint32_t reserved_size; | ||||
uint32_t available_size; | uint32_t available_size; | ||||
struct sysctl_ctx_list nvm_ctx; | struct sysctl_ctx_list nvm_ctx; | ||||
struct sysctl_oid *nvm_oid; | struct sysctl_oid *nvm_oid; | ||||
}; | }; | ||||
struct bnxt_func_qcfg { | |||||
uint16_t alloc_completion_rings; | |||||
uint16_t alloc_tx_rings; | |||||
uint16_t alloc_rx_rings; | |||||
uint16_t alloc_vnics; | |||||
}; | |||||
struct bnxt_hw_lro { | |||||
uint16_t enable; | |||||
uint16_t is_mode_gro; | |||||
uint16_t max_agg_segs; | |||||
uint16_t max_aggs; | |||||
uint32_t min_agg_len; | |||||
}; | |||||
struct bnxt_softc { | struct bnxt_softc { | ||||
device_t dev; | device_t dev; | ||||
if_ctx_t ctx; | if_ctx_t ctx; | ||||
if_softc_ctx_t scctx; | if_softc_ctx_t scctx; | ||||
if_shared_ctx_t sctx; | if_shared_ctx_t sctx; | ||||
struct ifmedia *media; | struct ifmedia *media; | ||||
struct bnxt_bar_info hwrm_bar; | struct bnxt_bar_info hwrm_bar; | ||||
struct bnxt_bar_info doorbell_bar; | struct bnxt_bar_info doorbell_bar; | ||||
struct bnxt_link_info link_info; | struct bnxt_link_info link_info; | ||||
#define BNXT_FLAG_NPAR 1 | #define BNXT_FLAG_VF 0x0001 | ||||
#define BNXT_FLAG_NPAR 0x0002 | |||||
#define BNXT_FLAG_WOL_CAP 0x0004 | |||||
#define BNXT_FLAG_SHORT_CMD 0x0008 | |||||
uint32_t flags; | uint32_t flags; | ||||
uint32_t total_msix; | uint32_t total_msix; | ||||
struct bnxt_func_info func; | struct bnxt_func_info func; | ||||
struct bnxt_func_qcfg fn_qcfg; | |||||
struct bnxt_pf_info pf; | struct bnxt_pf_info pf; | ||||
struct bnxt_vf_info vf; | struct bnxt_vf_info vf; | ||||
uint16_t hwrm_cmd_seq; | uint16_t hwrm_cmd_seq; | ||||
uint32_t hwrm_cmd_timeo; /* milliseconds */ | uint32_t hwrm_cmd_timeo; /* milliseconds */ | ||||
struct iflib_dma_info hwrm_cmd_resp; | struct iflib_dma_info hwrm_cmd_resp; | ||||
struct iflib_dma_info hwrm_short_cmd_req_addr; | |||||
/* Interrupt info for HWRM */ | /* Interrupt info for HWRM */ | ||||
struct if_irq irq; | struct if_irq irq; | ||||
struct mtx hwrm_lock; | struct mtx hwrm_lock; | ||||
uint16_t hwrm_max_req_len; | uint16_t hwrm_max_req_len; | ||||
#define BNXT_MAX_QUEUE 8 | #define BNXT_MAX_QUEUE 8 | ||||
uint8_t max_tc; | uint8_t max_tc; | ||||
struct bnxt_cos_queue q_info[BNXT_MAX_QUEUE]; | struct bnxt_cos_queue q_info[BNXT_MAX_QUEUE]; | ||||
uint64_t admin_ticks; | |||||
struct iflib_dma_info hw_rx_port_stats; | struct iflib_dma_info hw_rx_port_stats; | ||||
struct iflib_dma_info hw_tx_port_stats; | struct iflib_dma_info hw_tx_port_stats; | ||||
struct rx_port_stats *rx_port_stats; | struct rx_port_stats *rx_port_stats; | ||||
struct tx_port_stats *tx_port_stats; | struct tx_port_stats *tx_port_stats; | ||||
int num_cp_rings; | int num_cp_rings; | ||||
struct bnxt_ring *tx_rings; | struct bnxt_ring *tx_rings; | ||||
Show All 10 Lines | #define BNXT_MAX_QUEUE 8 | ||||
int nrxqsets; | int nrxqsets; | ||||
struct bnxt_cp_ring def_cp_ring; | struct bnxt_cp_ring def_cp_ring; | ||||
struct iflib_dma_info def_cp_ring_mem; | struct iflib_dma_info def_cp_ring_mem; | ||||
struct grouptask def_cp_task; | struct grouptask def_cp_task; | ||||
struct sysctl_ctx_list hw_stats; | struct sysctl_ctx_list hw_stats; | ||||
struct sysctl_oid *hw_stats_oid; | struct sysctl_oid *hw_stats_oid; | ||||
struct sysctl_ctx_list hw_lro_ctx; | |||||
struct sysctl_oid *hw_lro_oid; | |||||
struct sysctl_ctx_list flow_ctrl_ctx; | |||||
struct sysctl_oid *flow_ctrl_oid; | |||||
struct bnxt_full_tpa_start *tpa_start; | |||||
struct bnxt_ver_info *ver_info; | struct bnxt_ver_info *ver_info; | ||||
struct bnxt_nvram_info *nvm_info; | struct bnxt_nvram_info *nvm_info; | ||||
bool wol; | |||||
struct bnxt_hw_lro hw_lro; | |||||
uint8_t wol_filter_id; | |||||
uint16_t rx_coal_usecs; | |||||
uint16_t rx_coal_usecs_irq; | |||||
uint16_t rx_coal_frames; | |||||
uint16_t rx_coal_frames_irq; | |||||
uint16_t tx_coal_usecs; | |||||
uint16_t tx_coal_usecs_irq; | |||||
uint16_t tx_coal_frames; | |||||
uint16_t tx_coal_frames_irq; | |||||
#define BNXT_USEC_TO_COAL_TIMER(x) ((x) * 25 / 2) | |||||
#define BNXT_DEF_STATS_COAL_TICKS 1000000 | |||||
#define BNXT_MIN_STATS_COAL_TICKS 250000 | |||||
#define BNXT_MAX_STATS_COAL_TICKS 1000000 | |||||
}; | }; | ||||
struct bnxt_filter_info { | struct bnxt_filter_info { | ||||
STAILQ_ENTRY(bnxt_filter_info) next; | STAILQ_ENTRY(bnxt_filter_info) next; | ||||
uint64_t fw_l2_filter_id; | uint64_t fw_l2_filter_id; | ||||
#define INVALID_MAC_INDEX ((uint16_t)-1) | #define INVALID_MAC_INDEX ((uint16_t)-1) | ||||
uint16_t mac_index; | uint16_t mac_index; | ||||
Show All 27 Lines |