Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/utilities/hv_kvp.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include <sys/poll.h> | #include <sys/poll.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/kthread.h> | #include <sys/kthread.h> | ||||
#include <sys/syscallsubr.h> | #include <sys/syscallsubr.h> | ||||
#include <sys/sysproto.h> | #include <sys/sysproto.h> | ||||
#include <sys/un.h> | #include <sys/un.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#include <sys/_null.h> | #include <sys/_null.h> | ||||
#include <sys/sema.h> | |||||
#include <sys/signal.h> | #include <sys/signal.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <net/if.h> | |||||
#include <net/if_arp.h> | |||||
#include <net/if_var.h> | |||||
#include <dev/hyperv/include/hyperv.h> | #include <dev/hyperv/include/hyperv.h> | ||||
#include <dev/hyperv/netvsc/hv_net_vsc.h> | |||||
#include <dev/hyperv/utilities/hv_utilreg.h> | #include <dev/hyperv/utilities/hv_utilreg.h> | ||||
#include "hv_util.h" | #include "hv_util.h" | ||||
#include "unicode.h" | #include "unicode.h" | ||||
#include "hv_kvp.h" | #include "hv_kvp.h" | ||||
#include "vmbus_if.h" | #include "vmbus_if.h" | ||||
/* hv_kvp defines */ | /* hv_kvp defines */ | ||||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | utf16_to_utf8((char *)umsg->body.kvp_ip_val.adapter_id, | ||||
MAX_ADAPTER_ID_SIZE, | MAX_ADAPTER_ID_SIZE, | ||||
UNUSED_FLAG, | UNUSED_FLAG, | ||||
&err_adap); | &err_adap); | ||||
if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) { | if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) { | ||||
for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { | for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) { | ||||
/* XXX access other driver's softc? are you kidding? */ | /* XXX access other driver's softc? are you kidding? */ | ||||
device_t dev = devs[devcnt]; | device_t dev = devs[devcnt]; | ||||
struct hn_softc *sc = device_get_softc(dev); | |||||
struct vmbus_channel *chan; | struct vmbus_channel *chan; | ||||
char buf[HYPERV_GUID_STRLEN]; | char buf[HYPERV_GUID_STRLEN]; | ||||
/* | /* | ||||
* Trying to find GUID of Network Device | * Trying to find GUID of Network Device | ||||
* TODO: need vmbus interface. | |||||
*/ | */ | ||||
chan = vmbus_get_channel(dev); | chan = vmbus_get_channel(dev); | ||||
hyperv_guid2str(vmbus_chan_guid_inst(chan), | hyperv_guid2str(vmbus_chan_guid_inst(chan), | ||||
buf, sizeof(buf)); | buf, sizeof(buf)); | ||||
if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, | if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id, | ||||
HYPERV_GUID_STRLEN - 1) == 0) { | HYPERV_GUID_STRLEN - 1) == 0) { | ||||
strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, | strlcpy((char *)umsg->body.kvp_ip_val.adapter_id, | ||||
sc->hn_ifp->if_xname, MAX_ADAPTER_ID_SIZE); | device_get_nameunit(dev), MAX_ADAPTER_ID_SIZE); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
free(devs, M_TEMP); | free(devs, M_TEMP); | ||||
} | } | ||||
/* Address Family , DHCP , SUBNET, Gateway, DNS */ | /* Address Family , DHCP , SUBNET, Gateway, DNS */ | ||||
umsg->kvp_hdr.operation = host_ip_msg->operation; | umsg->kvp_hdr.operation = host_ip_msg->operation; | ||||
▲ Show 20 Lines • Show All 595 Lines • Show Last 20 Lines |