Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/hv_net_vsc.c
Show First 20 Lines • Show All 846 Lines • ▼ Show 20 Lines | hv_nv_on_receive(netvsc_dev *net_dev, struct hn_rx_ring *rxr, | ||||
struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) | struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) | ||||
{ | { | ||||
const struct vmbus_chanpkt_rxbuf *pkt; | const struct vmbus_chanpkt_rxbuf *pkt; | ||||
const struct hn_nvs_hdr *nvs_hdr; | const struct hn_nvs_hdr *nvs_hdr; | ||||
netvsc_packet vsc_pkt; | netvsc_packet vsc_pkt; | ||||
netvsc_packet *net_vsc_pkt = &vsc_pkt; | netvsc_packet *net_vsc_pkt = &vsc_pkt; | ||||
int count = 0; | int count = 0; | ||||
int i = 0; | int i = 0; | ||||
int status = nvsp_status_success; | int status = HN_NVS_STATUS_OK; | ||||
/* Make sure that this is a RNDIS message. */ | /* Make sure that this is a RNDIS message. */ | ||||
nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); | nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); | ||||
if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { | if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { | ||||
if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", | if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", | ||||
nvs_hdr->nvs_type); | nvs_hdr->nvs_type); | ||||
return; | return; | ||||
} | } | ||||
pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; | pkt = (const struct vmbus_chanpkt_rxbuf *)pkthdr; | ||||
if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { | if (pkt->cp_rxbuf_id != NETVSC_RECEIVE_BUFFER_ID) { | ||||
if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", | if_printf(rxr->hn_ifp, "rxbuf_id %d is invalid!\n", | ||||
pkt->cp_rxbuf_id); | pkt->cp_rxbuf_id); | ||||
return; | return; | ||||
} | } | ||||
count = pkt->cp_rxbuf_cnt; | count = pkt->cp_rxbuf_cnt; | ||||
/* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ | /* Each range represents 1 RNDIS pkt that contains 1 Ethernet frame */ | ||||
for (i = 0; i < count; i++) { | for (i = 0; i < count; i++) { | ||||
net_vsc_pkt->status = nvsp_status_success; | net_vsc_pkt->status = HN_NVS_STATUS_OK; | ||||
net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + | net_vsc_pkt->data = ((uint8_t *)net_dev->rx_buf + | ||||
pkt->cp_rxbuf[i].rb_ofs); | pkt->cp_rxbuf[i].rb_ofs); | ||||
net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; | net_vsc_pkt->tot_data_buf_len = pkt->cp_rxbuf[i].rb_len; | ||||
hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); | hv_rf_on_receive(net_dev, rxr, net_vsc_pkt); | ||||
if (net_vsc_pkt->status != nvsp_status_success) { | |||||
status = nvsp_status_failure; | /* XXX pretty broken; whack it */ | ||||
} | if (net_vsc_pkt->status != HN_NVS_STATUS_OK) | ||||
status = HN_NVS_STATUS_FAILED; | |||||
} | } | ||||
/* | /* | ||||
* Moved completion call back here so that all received | * Moved completion call back here so that all received | ||||
* messages (not just data messages) will trigger a response | * messages (not just data messages) will trigger a response | ||||
* message back to the host. | * message back to the host. | ||||
*/ | */ | ||||
hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid, status); | hv_nv_on_receive_completion(chan, pkt->cp_hdr.cph_xactid, status); | ||||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |