Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
#include <dev/hyperv/include/hyperv.h> | #include <dev/hyperv/include/hyperv.h> | ||||
#include <dev/hyperv/include/vmbus_xact.h> | #include <dev/hyperv/include/vmbus_xact.h> | ||||
#include <dev/hyperv/netvsc/hv_net_vsc.h> | #include <dev/hyperv/netvsc/hv_net_vsc.h> | ||||
#include <dev/hyperv/netvsc/hv_rndis.h> | #include <dev/hyperv/netvsc/hv_rndis.h> | ||||
#include <dev/hyperv/netvsc/hv_rndis_filter.h> | #include <dev/hyperv/netvsc/hv_rndis_filter.h> | ||||
#include <dev/hyperv/netvsc/if_hnreg.h> | #include <dev/hyperv/netvsc/if_hnreg.h> | ||||
struct hv_rf_recvinfo { | |||||
const ndis_8021q_info *vlan_info; | |||||
const rndis_tcp_ip_csum_info *csum_info; | |||||
const struct rndis_hash_info *hash_info; | |||||
const struct rndis_hash_value *hash_value; | |||||
}; | |||||
#define HV_RF_RECVINFO_VLAN 0x1 | #define HV_RF_RECVINFO_VLAN 0x1 | ||||
#define HV_RF_RECVINFO_CSUM 0x2 | #define HV_RF_RECVINFO_CSUM 0x2 | ||||
#define HV_RF_RECVINFO_HASHINF 0x4 | #define HV_RF_RECVINFO_HASHINF 0x4 | ||||
#define HV_RF_RECVINFO_HASHVAL 0x8 | #define HV_RF_RECVINFO_HASHVAL 0x8 | ||||
#define HV_RF_RECVINFO_ALL \ | #define HV_RF_RECVINFO_ALL \ | ||||
(HV_RF_RECVINFO_VLAN | \ | (HV_RF_RECVINFO_VLAN | \ | ||||
HV_RF_RECVINFO_CSUM | \ | HV_RF_RECVINFO_CSUM | \ | ||||
HV_RF_RECVINFO_HASHINF | \ | HV_RF_RECVINFO_HASHINF | \ | ||||
▲ Show 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | default: | ||||
/* TODO: */ | /* TODO: */ | ||||
device_printf(device->net_dev->sc->hn_dev, | device_printf(device->net_dev->sc->hn_dev, | ||||
"unknown status %d received\n", indicate->status); | "unknown status %d received\n", indicate->status); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hv_rf_recvinfo *info) | hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info) | ||||
{ | { | ||||
const rndis_per_packet_info *ppi; | const rndis_per_packet_info *ppi; | ||||
uint32_t mask, len; | uint32_t mask, len; | ||||
info->vlan_info = NULL; | info->vlan_info = NULL; | ||||
info->csum_info = NULL; | info->csum_info = NULL; | ||||
info->hash_info = NULL; | info->hash_info = NULL; | ||||
info->hash_value = NULL; | info->hash_value = NULL; | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
* 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, rndis_msg *message, | ||||
netvsc_packet *pkt) | netvsc_packet *pkt) | ||||
{ | { | ||||
rndis_packet *rndis_pkt; | rndis_packet *rndis_pkt; | ||||
uint32_t data_offset; | uint32_t data_offset; | ||||
struct hv_rf_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 12 Lines | hv_rf_receive_data(struct hn_rx_ring *rxr, rndis_msg *message, | ||||
pkt->tot_data_buf_len = rndis_pkt->data_length; | pkt->tot_data_buf_len = rndis_pkt->data_length; | ||||
pkt->data = (void *)((unsigned long)pkt->data + data_offset); | pkt->data = (void *)((unsigned long)pkt->data + data_offset); | ||||
if (hv_rf_find_recvinfo(rndis_pkt, &info)) { | if (hv_rf_find_recvinfo(rndis_pkt, &info)) { | ||||
pkt->status = HN_NVS_STATUS_FAILED; | pkt->status = HN_NVS_STATUS_FAILED; | ||||
if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); | if_printf(rxr->hn_ifp, "recvinfo parsing failed\n"); | ||||
return; | return; | ||||
} | } | ||||
netvsc_recv(rxr, pkt, &info); | |||||
if (info.vlan_info != NULL) | |||||
pkt->vlan_tci = info.vlan_info->u1.s1.vlan_id; | |||||
else | |||||
pkt->vlan_tci = 0; | |||||
netvsc_recv(rxr, pkt, info.csum_info, info.hash_info, info.hash_value); | |||||
} | } | ||||
/* | /* | ||||
* 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) | ||||
▲ Show 20 Lines • Show All 729 Lines • Show Last 20 Lines |