Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | #define HV_RF_RECVINFO_ALL \ | ||||
HV_RF_RECVINFO_HASHINF | \ | HV_RF_RECVINFO_HASHINF | \ | ||||
HV_RF_RECVINFO_HASHVAL) | HV_RF_RECVINFO_HASHVAL) | ||||
/* | /* | ||||
* Forward declarations | * Forward declarations | ||||
*/ | */ | ||||
static int hv_rf_send_request(rndis_device *device, rndis_request *request, | static int hv_rf_send_request(rndis_device *device, rndis_request *request, | ||||
uint32_t message_type); | uint32_t message_type); | ||||
static void hv_rf_receive_response(rndis_device *device, rndis_msg *response); | static void hv_rf_receive_response(rndis_device *device, | ||||
const rndis_msg *response); | |||||
static void hv_rf_receive_indicate_status(rndis_device *device, | static void hv_rf_receive_indicate_status(rndis_device *device, | ||||
rndis_msg *response); | const rndis_msg *response); | ||||
static void hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, | static void hv_rf_receive_data(struct hn_rx_ring *rxr, const rndis_msg *message, | ||||
netvsc_packet *pkt); | netvsc_packet *pkt); | ||||
static int hv_rf_query_device(rndis_device *device, uint32_t oid, | static int hv_rf_query_device(rndis_device *device, uint32_t oid, | ||||
void *result, uint32_t *result_size); | void *result, uint32_t *result_size); | ||||
static inline int hv_rf_query_device_mac(rndis_device *device); | static inline int hv_rf_query_device_mac(rndis_device *device); | ||||
static inline int hv_rf_query_device_link_status(rndis_device *device); | static inline int hv_rf_query_device_link_status(rndis_device *device); | ||||
static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter); | static int hv_rf_set_packet_filter(rndis_device *device, uint32_t new_filter); | ||||
static int hv_rf_init_device(rndis_device *device); | static int hv_rf_init_device(rndis_device *device); | ||||
static int hv_rf_open_device(rndis_device *device); | static int hv_rf_open_device(rndis_device *device); | ||||
▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | sendit: | ||||
return hv_nv_on_send(device->net_dev->sc->hn_prichan, | return hv_nv_on_send(device->net_dev->sc->hn_prichan, | ||||
HN_NVS_RNDIS_MTYPE_CTRL, &request->send_ctx, gpa, gpa_cnt); | HN_NVS_RNDIS_MTYPE_CTRL, &request->send_ctx, gpa, gpa_cnt); | ||||
} | } | ||||
/* | /* | ||||
* RNDIS filter receive response | * RNDIS filter receive response | ||||
*/ | */ | ||||
static void | static void | ||||
hv_rf_receive_response(rndis_device *device, rndis_msg *response) | hv_rf_receive_response(rndis_device *device, const rndis_msg *response) | ||||
{ | { | ||||
rndis_request *request = NULL; | rndis_request *request = NULL; | ||||
rndis_request *next_request; | rndis_request *next_request; | ||||
boolean_t found = FALSE; | boolean_t found = FALSE; | ||||
mtx_lock(&device->req_lock); | mtx_lock(&device->req_lock); | ||||
request = STAILQ_FIRST(&device->myrequest_list); | request = STAILQ_FIRST(&device->myrequest_list); | ||||
while (request != NULL) { | while (request != NULL) { | ||||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | cleanup: | ||||
return (ret); | return (ret); | ||||
} | } | ||||
/* | /* | ||||
* RNDIS filter receive indicate status | * RNDIS filter receive indicate status | ||||
*/ | */ | ||||
static void | static void | ||||
hv_rf_receive_indicate_status(rndis_device *device, rndis_msg *response) | hv_rf_receive_indicate_status(rndis_device *device, const rndis_msg *response) | ||||
{ | { | ||||
rndis_indicate_status *indicate = &response->msg.indicate_status; | const rndis_indicate_status *indicate = &response->msg.indicate_status; | ||||
switch(indicate->status) { | switch(indicate->status) { | ||||
case RNDIS_STATUS_MEDIA_CONNECT: | case RNDIS_STATUS_MEDIA_CONNECT: | ||||
netvsc_linkstatus_callback(device->net_dev->sc, 1); | netvsc_linkstatus_callback(device->net_dev->sc, 1); | ||||
break; | break; | ||||
case RNDIS_STATUS_MEDIA_DISCONNECT: | case RNDIS_STATUS_MEDIA_DISCONNECT: | ||||
netvsc_linkstatus_callback(device->net_dev->sc, 0); | netvsc_linkstatus_callback(device->net_dev->sc, 0); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | skip: | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
/* | /* | ||||
* RNDIS filter receive data | * RNDIS filter receive data | ||||
*/ | */ | ||||
static void | static void | ||||
hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, | hv_rf_receive_data(struct hn_rx_ring *rxr, const rndis_msg *message, | ||||
netvsc_packet *pkt) | netvsc_packet *pkt) | ||||
{ | { | ||||
rndis_packet *rndis_pkt; | const rndis_packet *rndis_pkt; | ||||
uint32_t data_offset; | uint32_t data_offset; | ||||
struct hn_recvinfo info; | struct hn_recvinfo info; | ||||
rndis_pkt = &message->msg.packet; | rndis_pkt = &message->msg.packet; | ||||
/* | /* | ||||
* Fixme: Handle multiple rndis pkt msgs that may be enclosed in this | * Fixme: Handle multiple rndis pkt msgs that may be enclosed in this | ||||
* netvsc packet (ie tot_data_buf_len != message_length) | * netvsc packet (ie tot_data_buf_len != message_length) | ||||
Show All 25 Lines | |||||
/* | /* | ||||
* RNDIS filter on receive | * RNDIS filter on receive | ||||
*/ | */ | ||||
int | int | ||||
hv_rf_on_receive(netvsc_dev *net_dev, | hv_rf_on_receive(netvsc_dev *net_dev, | ||||
struct hn_rx_ring *rxr, netvsc_packet *pkt) | struct hn_rx_ring *rxr, netvsc_packet *pkt) | ||||
{ | { | ||||
rndis_device *rndis_dev; | rndis_device *rndis_dev; | ||||
rndis_msg *rndis_hdr; | const rndis_msg *rndis_hdr; | ||||
/* Make sure the rndis device state is initialized */ | /* Make sure the rndis device state is initialized */ | ||||
if (net_dev->extension == NULL) { | if (net_dev->extension == NULL) { | ||||
pkt->status = HN_NVS_STATUS_FAILED; | pkt->status = HN_NVS_STATUS_FAILED; | ||||
return (ENODEV); | return (ENODEV); | ||||
} | } | ||||
rndis_dev = (rndis_device *)net_dev->extension; | rndis_dev = (rndis_device *)net_dev->extension; | ||||
▲ Show 20 Lines • Show All 718 Lines • Show Last 20 Lines |