Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_net_vsc.h
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | |||||
* Data types | * Data types | ||||
*/ | */ | ||||
/* | /* | ||||
* Per netvsc channel-specific | * Per netvsc channel-specific | ||||
*/ | */ | ||||
typedef struct netvsc_dev_ { | typedef struct netvsc_dev_ { | ||||
struct hn_softc *sc; | struct hn_softc *sc; | ||||
/* Send buffer allocated by us but manages by NetVSP */ | |||||
void *send_buf; | |||||
uint32_t send_buf_size; | |||||
uint32_t send_buf_gpadl_handle; | |||||
uint32_t send_section_size; | |||||
uint32_t send_section_count; | |||||
unsigned long bitsmap_words; | |||||
unsigned long *send_section_bitsmap; | |||||
/* Holds rndis device info */ | /* Holds rndis device info */ | ||||
void *extension; | void *extension; | ||||
struct hyperv_dma txbuf_dma; | |||||
} netvsc_dev; | } netvsc_dev; | ||||
struct vmbus_channel; | struct vmbus_channel; | ||||
typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); | typedef void (*pfn_on_send_rx_completion)(struct vmbus_channel *, void *); | ||||
#define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) | #define NETVSC_DEVICE_RING_BUFFER_SIZE (128 * PAGE_SIZE) | ||||
#define NETVSC_PACKET_MAXPAGE 32 | #define NETVSC_PACKET_MAXPAGE 32 | ||||
#define NETVSC_VLAN_PRIO_MASK 0xe000 | #define NETVSC_VLAN_PRIO_MASK 0xe000 | ||||
#define NETVSC_VLAN_PRIO_SHIFT 13 | #define NETVSC_VLAN_PRIO_SHIFT 13 | ||||
#define NETVSC_VLAN_VID_MASK 0x0fff | #define NETVSC_VLAN_VID_MASK 0x0fff | ||||
#define TYPE_IPV4 2 | #define TYPE_IPV4 2 | ||||
#define TYPE_IPV6 4 | #define TYPE_IPV6 4 | ||||
#define TYPE_TCP 2 | #define TYPE_TCP 2 | ||||
#define TYPE_UDP 4 | #define TYPE_UDP 4 | ||||
#define TRANSPORT_TYPE_NOT_IP 0 | #define TRANSPORT_TYPE_NOT_IP 0 | ||||
#define TRANSPORT_TYPE_IPV4_TCP ((TYPE_IPV4 << 16) | TYPE_TCP) | #define TRANSPORT_TYPE_IPV4_TCP ((TYPE_IPV4 << 16) | TYPE_TCP) | ||||
#define TRANSPORT_TYPE_IPV4_UDP ((TYPE_IPV4 << 16) | TYPE_UDP) | #define TRANSPORT_TYPE_IPV4_UDP ((TYPE_IPV4 << 16) | TYPE_UDP) | ||||
#define TRANSPORT_TYPE_IPV6_TCP ((TYPE_IPV6 << 16) | TYPE_TCP) | #define TRANSPORT_TYPE_IPV6_TCP ((TYPE_IPV6 << 16) | TYPE_TCP) | ||||
#define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) | #define TRANSPORT_TYPE_IPV6_UDP ((TYPE_IPV6 << 16) | TYPE_UDP) | ||||
#ifdef __LP64__ | |||||
#define BITS_PER_LONG 64 | |||||
#else | |||||
#define BITS_PER_LONG 32 | |||||
#endif | |||||
typedef struct { | typedef struct { | ||||
uint8_t mac_addr[6]; /* Assumption unsigned long */ | uint8_t mac_addr[6]; /* Assumption unsigned long */ | ||||
uint8_t link_state; | uint8_t link_state; | ||||
} netvsc_device_info; | } netvsc_device_info; | ||||
#ifndef HN_USE_TXDESC_BUFRING | #ifndef HN_USE_TXDESC_BUFRING | ||||
struct hn_txdesc; | struct hn_txdesc; | ||||
SLIST_HEAD(hn_txdesc_list, hn_txdesc); | SLIST_HEAD(hn_txdesc_list, hn_txdesc); | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | #endif | ||||
int hn_oactive; | int hn_oactive; | ||||
int hn_tx_idx; | int hn_tx_idx; | ||||
struct mtx hn_tx_lock; | struct mtx hn_tx_lock; | ||||
struct hn_softc *hn_sc; | struct hn_softc *hn_sc; | ||||
struct vmbus_channel *hn_chan; | struct vmbus_channel *hn_chan; | ||||
int hn_direct_tx_size; | int hn_direct_tx_size; | ||||
int hn_tx_chimney_size; | int hn_chim_size; | ||||
bus_dma_tag_t hn_tx_data_dtag; | bus_dma_tag_t hn_tx_data_dtag; | ||||
uint64_t hn_csum_assist; | uint64_t hn_csum_assist; | ||||
int hn_gpa_cnt; | int hn_gpa_cnt; | ||||
struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; | struct vmbus_gpa hn_gpa[NETVSC_PACKET_MAXPAGE]; | ||||
u_long hn_no_txdescs; | u_long hn_no_txdescs; | ||||
u_long hn_send_failed; | u_long hn_send_failed; | ||||
Show All 32 Lines | typedef struct hn_softc { | ||||
int hn_rx_ring_cnt; | int hn_rx_ring_cnt; | ||||
int hn_rx_ring_inuse; | int hn_rx_ring_inuse; | ||||
struct hn_rx_ring *hn_rx_ring; | struct hn_rx_ring *hn_rx_ring; | ||||
int hn_tx_ring_cnt; | int hn_tx_ring_cnt; | ||||
int hn_tx_ring_inuse; | int hn_tx_ring_inuse; | ||||
struct hn_tx_ring *hn_tx_ring; | struct hn_tx_ring *hn_tx_ring; | ||||
uint8_t *hn_chim; | |||||
u_long *hn_chim_bmap; | |||||
int hn_chim_bmap_cnt; | |||||
int hn_chim_cnt; | |||||
int hn_chim_szmax; | |||||
int hn_cpu; | int hn_cpu; | ||||
int hn_tx_chimney_max; | |||||
struct taskqueue *hn_tx_taskq; | struct taskqueue *hn_tx_taskq; | ||||
struct sysctl_oid *hn_tx_sysctl_tree; | struct sysctl_oid *hn_tx_sysctl_tree; | ||||
struct sysctl_oid *hn_rx_sysctl_tree; | struct sysctl_oid *hn_rx_sysctl_tree; | ||||
struct vmbus_xact_ctx *hn_xact; | struct vmbus_xact_ctx *hn_xact; | ||||
uint32_t hn_nvs_ver; | uint32_t hn_nvs_ver; | ||||
uint32_t hn_flags; | uint32_t hn_flags; | ||||
void *hn_rxbuf; | void *hn_rxbuf; | ||||
uint32_t hn_rxbuf_gpadl; | uint32_t hn_rxbuf_gpadl; | ||||
struct hyperv_dma hn_rxbuf_dma; | struct hyperv_dma hn_rxbuf_dma; | ||||
uint32_t hn_chim_gpadl; | |||||
struct hyperv_dma hn_chim_dma; | |||||
} hn_softc_t; | } hn_softc_t; | ||||
#define HN_FLAG_RXBUF_CONNECTED 0x0001 | #define HN_FLAG_RXBUF_CONNECTED 0x0001 | ||||
#define HN_FLAG_CHIM_CONNECTED 0x0002 | |||||
/* | /* | ||||
* Externs | * Externs | ||||
*/ | */ | ||||
extern int hv_promisc_mode; | extern int hv_promisc_mode; | ||||
struct hn_send_ctx; | struct hn_send_ctx; | ||||
void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); | void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); | ||||
netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, | netvsc_dev *hv_nv_on_device_add(struct hn_softc *sc, | ||||
void *additional_info, struct hn_rx_ring *rxr); | void *additional_info, struct hn_rx_ring *rxr); | ||||
int hv_nv_on_device_remove(struct hn_softc *sc, | int hv_nv_on_device_remove(struct hn_softc *sc, | ||||
boolean_t destroy_channel); | boolean_t destroy_channel); | ||||
int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, | int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, | ||||
struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); | struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); | ||||
int hv_nv_get_next_send_section(netvsc_dev *net_dev); | |||||
void hv_nv_subchan_attach(struct vmbus_channel *chan, | void hv_nv_subchan_attach(struct vmbus_channel *chan, | ||||
struct hn_rx_ring *rxr); | struct hn_rx_ring *rxr); | ||||
#endif /* __HV_NET_VSC_H__ */ | #endif /* __HV_NET_VSC_H__ */ | ||||