Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixl/ixlv.h
Show All 30 Lines | |||||
******************************************************************************/ | ******************************************************************************/ | ||||
/*$FreeBSD$*/ | /*$FreeBSD$*/ | ||||
#ifndef _IXLV_H_ | #ifndef _IXLV_H_ | ||||
#define _IXLV_H_ | #define _IXLV_H_ | ||||
#include "ixlv_vc_mgr.h" | #include "ixl.h" | ||||
#define IXLV_AQ_MAX_ERR 200 | #define IXLV_AQ_MAX_ERR 200 | ||||
#define IXLV_MAX_FILTERS 128 | #define IXLV_MAX_FILTERS 128 | ||||
#define IXLV_MAX_QUEUES 16 | #define IXLV_MAX_QUEUES 16 | ||||
#define IXLV_AQ_TIMEOUT (1 * hz) | #define IXLV_AQ_TIMEOUT (1 * hz) | ||||
#define IXLV_CALLOUT_TIMO (hz / 50) /* 20 msec */ | #define IXLV_CALLOUT_TIMO (hz / 50) /* 20 msec */ | ||||
#define IXLV_FLAG_AQ_ENABLE_QUEUES (u32)(1 << 0) | #define IXLV_FLAG_AQ_ENABLE_QUEUES (u32)(1 << 0) | ||||
Show All 12 Lines | |||||
#define IXLV_FLAG_AQ_GET_RSS_HENA_CAPS (u32)(1 << 13) | #define IXLV_FLAG_AQ_GET_RSS_HENA_CAPS (u32)(1 << 13) | ||||
#define IXLV_FLAG_AQ_CONFIG_RSS_LUT (u32)(1 << 14) | #define IXLV_FLAG_AQ_CONFIG_RSS_LUT (u32)(1 << 14) | ||||
/* printf %b arg */ | /* printf %b arg */ | ||||
#define IXLV_FLAGS \ | #define IXLV_FLAGS \ | ||||
"\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \ | "\20\1ENABLE_QUEUES\2DISABLE_QUEUES\3ADD_MAC_FILTER" \ | ||||
"\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \ | "\4ADD_VLAN_FILTER\5DEL_MAC_FILTER\6DEL_VLAN_FILTER" \ | ||||
"\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \ | "\7CONFIGURE_QUEUES\10MAP_VECTORS\11HANDLE_RESET" \ | ||||
"\12CONFIGURE_PROMISC\13GET_STATS" | "\12CONFIGURE_PROMISC\13GET_STATS\14CONFIG_RSS_KEY" \ | ||||
"\15SET_RSS_HENA\16GET_RSS_HENA_CAPS\17CONFIG_RSS_LUT" | |||||
#define IXLV_PRINTF_VF_OFFLOAD_FLAGS \ | #define IXLV_PRINTF_VF_OFFLOAD_FLAGS \ | ||||
"\20\1I40E_VIRTCHNL_VF_OFFLOAD_L2" \ | "\20\1L2" \ | ||||
"\2I40E_VIRTCHNL_VF_OFFLOAD_IWARP" \ | "\2IWARP" \ | ||||
"\3I40E_VIRTCHNL_VF_OFFLOAD_FCOE" \ | "\3RSVD" \ | ||||
"\4I40E_VIRTCHNL_VF_OFFLOAD_RSS_AQ" \ | "\4RSS_AQ" \ | ||||
"\5I40E_VIRTCHNL_VF_OFFLOAD_RSS_REG" \ | "\5RSS_REG" \ | ||||
"\6I40E_VIRTCHNL_VF_OFFLOAD_WB_ON_ITR" \ | "\6WB_ON_ITR" \ | ||||
"\21I40E_VIRTCHNL_VF_OFFLOAD_VLAN" \ | "\7REQ_QUEUES" \ | ||||
"\22I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING" \ | "\21VLAN" \ | ||||
"\23I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2" \ | "\22RX_POLLING" \ | ||||
"\24I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF" | "\23RSS_PCTYPE_V2" \ | ||||
"\24RSS_PF" \ | |||||
"\25ENCAP" \ | |||||
"\26ENCAP_CSUM" \ | |||||
"\27RX_ENCAP_CSUM" | |||||
static MALLOC_DEFINE(M_IXLV, "ixlv", "ixlv driver allocations"); | static MALLOC_DEFINE(M_IXLV, "ixlv", "ixlv driver allocations"); | ||||
/* Driver state */ | /* Driver state */ | ||||
enum ixlv_state_t { | enum ixlv_state_t { | ||||
IXLV_START, | |||||
IXLV_FAILED, | |||||
IXLV_RESET_REQUIRED, | IXLV_RESET_REQUIRED, | ||||
IXLV_RESET_PENDING, | IXLV_RESET_PENDING, | ||||
IXLV_VERSION_CHECK, | |||||
IXLV_GET_RESOURCES, | |||||
IXLV_INIT_READY, | IXLV_INIT_READY, | ||||
IXLV_INIT_START, | |||||
IXLV_INIT_CONFIG, | |||||
IXLV_INIT_MAPPING, | |||||
IXLV_INIT_ENABLE, | |||||
IXLV_INIT_COMPLETE, | |||||
IXLV_RUNNING, | IXLV_RUNNING, | ||||
}; | }; | ||||
/* Structs */ | /* Structs */ | ||||
struct ixlv_mac_filter { | struct ixlv_mac_filter { | ||||
SLIST_ENTRY(ixlv_mac_filter) next; | SLIST_ENTRY(ixlv_mac_filter) next; | ||||
u8 macaddr[ETHER_ADDR_LEN]; | u8 macaddr[ETHER_ADDR_LEN]; | ||||
u16 flags; | u16 flags; | ||||
}; | }; | ||||
SLIST_HEAD(mac_list, ixlv_mac_filter); | SLIST_HEAD(mac_list, ixlv_mac_filter); | ||||
struct ixlv_vlan_filter { | struct ixlv_vlan_filter { | ||||
SLIST_ENTRY(ixlv_vlan_filter) next; | SLIST_ENTRY(ixlv_vlan_filter) next; | ||||
u16 vlan; | u16 vlan; | ||||
u16 flags; | u16 flags; | ||||
}; | }; | ||||
SLIST_HEAD(vlan_list, ixlv_vlan_filter); | SLIST_HEAD(vlan_list, ixlv_vlan_filter); | ||||
/* Software controller structure */ | /* Software controller structure */ | ||||
struct ixlv_sc { | struct ixlv_sc { | ||||
struct ixl_vsi vsi; | |||||
struct i40e_hw hw; | struct i40e_hw hw; | ||||
struct i40e_osdep osdep; | struct i40e_osdep osdep; | ||||
device_t dev; | device_t dev; | ||||
struct resource *pci_mem; | struct resource *pci_mem; | ||||
struct resource *msix_mem; | |||||
enum ixlv_state_t init_state; | enum ixlv_state_t init_state; | ||||
int init_in_progress; | |||||
/* | |||||
* Interrupt resources | |||||
*/ | |||||
void *tag; | |||||
struct resource *res; /* For the AQ */ | |||||
struct ifmedia media; | struct ifmedia media; | ||||
struct callout timer; | struct virtchnl_version_info version; | ||||
int msix; | enum ixl_dbg_mask dbg_mask; | ||||
int pf_version; | u16 promisc_flags; | ||||
int if_flags; | |||||
bool link_up; | bool link_up; | ||||
enum virtchnl_link_speed link_speed; | enum virtchnl_link_speed link_speed; | ||||
struct mtx mtx; | /* Tunable settings */ | ||||
int tx_itr; | |||||
int rx_itr; | |||||
int dynamic_tx_itr; | |||||
int dynamic_rx_itr; | |||||
u32 qbase; | |||||
u32 admvec; | |||||
struct timeout_task timeout; | |||||
#ifdef notyet | |||||
struct task aq_irq; | |||||
struct task aq_sched; | |||||
#endif | |||||
struct ixl_vsi vsi; | |||||
/* Filter lists */ | /* Filter lists */ | ||||
struct mac_list *mac_filters; | struct mac_list *mac_filters; | ||||
struct vlan_list *vlan_filters; | struct vlan_list *vlan_filters; | ||||
/* Promiscuous mode */ | |||||
u32 promiscuous_flags; | |||||
/* Admin queue task flags */ | |||||
u32 aq_wait_count; | |||||
struct ixl_vc_mgr vc_mgr; | |||||
struct ixl_vc_cmd add_mac_cmd; | |||||
struct ixl_vc_cmd del_mac_cmd; | |||||
struct ixl_vc_cmd config_queues_cmd; | |||||
struct ixl_vc_cmd map_vectors_cmd; | |||||
struct ixl_vc_cmd enable_queues_cmd; | |||||
struct ixl_vc_cmd add_vlan_cmd; | |||||
struct ixl_vc_cmd del_vlan_cmd; | |||||
struct ixl_vc_cmd add_multi_cmd; | |||||
struct ixl_vc_cmd del_multi_cmd; | |||||
struct ixl_vc_cmd config_rss_key_cmd; | |||||
struct ixl_vc_cmd get_rss_hena_caps_cmd; | |||||
struct ixl_vc_cmd set_rss_hena_cmd; | |||||
struct ixl_vc_cmd config_rss_lut_cmd; | |||||
/* Virtual comm channel */ | /* Virtual comm channel */ | ||||
struct virtchnl_vf_resource *vf_res; | struct virtchnl_vf_resource *vf_res; | ||||
struct virtchnl_vsi_resource *vsi_res; | struct virtchnl_vsi_resource *vsi_res; | ||||
/* Misc stats maintained by the driver */ | /* Misc stats maintained by the driver */ | ||||
u64 watchdog_events; | |||||
u64 admin_irq; | u64 admin_irq; | ||||
/* Buffer used for reading AQ responses */ | |||||
u8 aq_buffer[IXL_AQ_BUF_SZ]; | u8 aq_buffer[IXL_AQ_BUF_SZ]; | ||||
}; | }; | ||||
/* | /* | ||||
** 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 | ||||
ixlv_check_ether_addr(u8 *addr) | ixlv_check_ether_addr(u8 *addr) | ||||
{ | { | ||||
bool status = TRUE; | bool status = TRUE; | ||||
if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 && | if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 && | ||||
addr[3] == 0 && addr[4]== 0 && addr[5] == 0)) | addr[3] == 0 && addr[4]== 0 && addr[5] == 0)) | ||||
status = FALSE; | status = FALSE; | ||||
return (status); | return (status); | ||||
} | } | ||||
/* Debug printing */ | |||||
#define ixlv_dbg(sc, m, s, ...) ixl_debug_core(sc->dev, sc->dbg_mask, m, s, ##__VA_ARGS__) | |||||
#define ixlv_dbg_init(sc, s, ...) ixl_debug_core(sc->dev, sc->dbg_mask, IXLV_DBG_INIT, s, ##__VA_ARGS__) | |||||
#define ixlv_dbg_info(sc, s, ...) ixl_debug_core(sc->dev, sc->dbg_mask, IXLV_DBG_INFO, s, ##__VA_ARGS__) | |||||
#define ixlv_dbg_vc(sc, s, ...) ixl_debug_core(sc->dev, sc->dbg_mask, IXLV_DBG_VC, s, ##__VA_ARGS__) | |||||
/* | /* | ||||
** VF Common function prototypes | ** VF Common function prototypes | ||||
*/ | */ | ||||
void ixlv_if_init(if_ctx_t ctx); | void ixlv_if_init(if_ctx_t ctx); | ||||
int ixlv_send_api_ver(struct ixlv_sc *); | int ixlv_send_api_ver(struct ixlv_sc *); | ||||
int ixlv_verify_api_ver(struct ixlv_sc *); | int ixlv_verify_api_ver(struct ixlv_sc *); | ||||
int ixlv_send_vf_config_msg(struct ixlv_sc *); | int ixlv_send_vf_config_msg(struct ixlv_sc *); | ||||
int ixlv_get_vf_config(struct ixlv_sc *); | int ixlv_get_vf_config(struct ixlv_sc *); | ||||
void ixlv_init(void *); | void ixlv_init(void *); | ||||
int ixlv_reinit_locked(struct ixlv_sc *); | int ixlv_reinit_locked(struct ixlv_sc *); | ||||
void ixlv_configure_queues(struct ixlv_sc *); | int ixlv_configure_queues(struct ixlv_sc *); | ||||
void ixlv_enable_queues(struct ixlv_sc *); | int ixlv_enable_queues(struct ixlv_sc *); | ||||
void ixlv_disable_queues(struct ixlv_sc *); | int ixlv_disable_queues(struct ixlv_sc *); | ||||
void ixlv_map_queues(struct ixlv_sc *); | int ixlv_map_queues(struct ixlv_sc *); | ||||
void ixlv_enable_intr(struct ixl_vsi *); | void ixlv_enable_intr(struct ixl_vsi *); | ||||
void ixlv_disable_intr(struct ixl_vsi *); | void ixlv_disable_intr(struct ixl_vsi *); | ||||
void ixlv_add_ether_filters(struct ixlv_sc *); | int ixlv_add_ether_filters(struct ixlv_sc *); | ||||
void ixlv_del_ether_filters(struct ixlv_sc *); | int ixlv_del_ether_filters(struct ixlv_sc *); | ||||
void ixlv_request_stats(struct ixlv_sc *); | int ixlv_request_stats(struct ixlv_sc *); | ||||
void ixlv_request_reset(struct ixlv_sc *); | int ixlv_request_reset(struct ixlv_sc *); | ||||
void ixlv_vc_completion(struct ixlv_sc *, | void ixlv_vc_completion(struct ixlv_sc *, | ||||
enum virtchnl_ops, enum virtchnl_status_code, | enum virtchnl_ops, enum virtchnl_status_code, | ||||
u8 *, u16); | u8 *, u16); | ||||
void ixlv_add_ether_filter(struct ixlv_sc *); | int ixlv_add_ether_filter(struct ixlv_sc *); | ||||
void ixlv_add_vlans(struct ixlv_sc *); | int ixlv_add_vlans(struct ixlv_sc *); | ||||
void ixlv_del_vlans(struct ixlv_sc *); | int ixlv_del_vlans(struct ixlv_sc *); | ||||
void ixlv_update_stats_counters(struct ixlv_sc *, | void ixlv_update_stats_counters(struct ixlv_sc *, | ||||
struct i40e_eth_stats *); | struct i40e_eth_stats *); | ||||
void ixlv_update_link_status(struct ixlv_sc *); | void ixlv_update_link_status(struct ixlv_sc *); | ||||
void ixlv_get_default_rss_key(u32 *, bool); | int ixlv_get_default_rss_key(u32 *, bool); | ||||
void ixlv_config_rss_key(struct ixlv_sc *); | int ixlv_config_rss_key(struct ixlv_sc *); | ||||
void ixlv_set_rss_hena(struct ixlv_sc *); | int ixlv_set_rss_hena(struct ixlv_sc *); | ||||
void ixlv_config_rss_lut(struct ixlv_sc *); | int ixlv_config_rss_lut(struct ixlv_sc *); | ||||
int ixlv_config_promisc_mode(struct ixlv_sc *); | |||||
int ixl_vc_send_cmd(struct ixlv_sc *sc, uint32_t request); | |||||
int ixlv_send_vc_msg(struct ixlv_sc *sc, u32 op); | |||||
char *ixlv_vc_speed_to_string(enum virtchnl_link_speed link_speed); | |||||
#endif /* _IXLV_H_ */ | #endif /* _IXLV_H_ */ |