Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hnvar.h
Show All 24 Lines | |||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _IF_HNVAR_H_ | #ifndef _IF_HNVAR_H_ | ||||
#define _IF_HNVAR_H_ | #define _IF_HNVAR_H_ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <dev/hyperv/include/vmbus.h> | |||||
#include <dev/hyperv/netvsc/hv_net_vsc.h> | #include <dev/hyperv/netvsc/hv_net_vsc.h> | ||||
struct netvsc_dev_; | struct netvsc_dev_; | ||||
struct nvsp_msg_; | struct nvsp_msg_; | ||||
struct vmbus_channel; | struct vmbus_channel; | ||||
struct hn_send_ctx; | struct hn_send_ctx; | ||||
Show All 15 Lines | #define HN_SEND_CTX_INITIALIZER(cb, cbarg) \ | ||||
.hn_chim_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, \ | .hn_chim_idx = NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, \ | ||||
.hn_chim_sz = 0 \ | .hn_chim_sz = 0 \ | ||||
} | } | ||||
static __inline void | static __inline void | ||||
hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, | hn_send_ctx_init(struct hn_send_ctx *sndc, hn_sent_callback_t cb, | ||||
void *cbarg, uint32_t chim_idx, int chim_sz) | void *cbarg, uint32_t chim_idx, int chim_sz) | ||||
{ | { | ||||
sndc->hn_cb = cb; | sndc->hn_cb = cb; | ||||
sndc->hn_cbarg = cbarg; | sndc->hn_cbarg = cbarg; | ||||
sndc->hn_chim_idx = chim_idx; | sndc->hn_chim_idx = chim_idx; | ||||
sndc->hn_chim_sz = chim_sz; | sndc->hn_chim_sz = chim_sz; | ||||
} | } | ||||
static __inline void | static __inline void | ||||
hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, | hn_send_ctx_init_simple(struct hn_send_ctx *sndc, hn_sent_callback_t cb, | ||||
void *cbarg) | void *cbarg) | ||||
{ | { | ||||
hn_send_ctx_init(sndc, cb, cbarg, | hn_send_ctx_init(sndc, cb, cbarg, | ||||
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, 0); | NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX, 0); | ||||
} | |||||
static __inline int | |||||
hn_nvs_send(struct vmbus_channel *chan, uint16_t flags, | |||||
void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) | |||||
{ | |||||
return (vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, flags, | |||||
nvs_msg, nvs_msglen, (uint64_t)(uintptr_t)sndc)); | |||||
} | |||||
static __inline int | |||||
hn_nvs_send_sglist(struct vmbus_channel *chan, struct vmbus_gpa sg[], int sglen, | |||||
void *nvs_msg, int nvs_msglen, struct hn_send_ctx *sndc) | |||||
{ | |||||
return (vmbus_chan_send_sglist(chan, sg, sglen, nvs_msg, nvs_msglen, | |||||
(uint64_t)(uintptr_t)sndc)); | |||||
} | } | ||||
void hn_nvs_sent_xact(struct hn_send_ctx *sndc, | void hn_nvs_sent_xact(struct hn_send_ctx *sndc, | ||||
struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, | struct netvsc_dev_ *net_dev, struct vmbus_channel *chan, | ||||
const struct nvsp_msg_ *msg, int dlen); | const struct nvsp_msg_ *msg, int dlen); | ||||
void hn_chim_free(struct netvsc_dev_ *net_dev, uint32_t chim_idx); | void hn_chim_free(struct netvsc_dev_ *net_dev, uint32_t chim_idx); | ||||
#endif /* !_IF_HNVAR_H_ */ | #endif /* !_IF_HNVAR_H_ */ |