From 265f151c4f3c83ed2d3c8b784f166d94c73fa214 Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Mon, 26 Nov 2018 15:57:38 +0530 Subject: [PATCH 1/3] Pulling changes from xhyve Signed-off-by: Noel Georgi --- src/hyperkit.c | 6 ++++++ src/include/xhyve/xhyve.h | 1 + src/lib/pci_virtio_net_vmnet.c | 10 +++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/hyperkit.c b/src/hyperkit.c index 532bd0f2..1d01fa14 100644 --- a/src/hyperkit.c +++ b/src/hyperkit.c @@ -90,6 +90,7 @@ extern int vmexit_task_switch(struct vm_exit *, int *vcpu); char *vmname = "vm"; int guest_ncpus; +int print_mac; char *guest_uuid_str; static char *pidfile; @@ -147,6 +148,7 @@ usage(int code) " -H: vmexit from the guest on hlt\n" " -l: LPC device configuration. Ex: -l com1,stdio -l com2,autopty -l com2,/dev/myownpty\n" " -m: memory size in MB, may be suffixed with one of K, M, G or T\n" + " -M: print MAC address and exit if using vmnet\n" " -P: vmexit from the guest on pause\n" " -s: PCI slot config\n" " -u: RTC keeps UTC time\n" @@ -861,6 +863,7 @@ main(int argc, char *argv[]) progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; + print_mac = 0; memsize = 256 * MB; mptgen = 1; rtc_localtime = 1; @@ -909,6 +912,9 @@ main(int argc, char *argv[]) if (error) errx(EX_USAGE, "invalid memsize '%s'", optarg); break; + case 'M': + print_mac = 1; + break; case 'H': guest_vmexit_on_hlt = 1; break; diff --git a/src/include/xhyve/xhyve.h b/src/include/xhyve/xhyve.h index 4f85664e..5464b2e0 100644 --- a/src/include/xhyve/xhyve.h +++ b/src/include/xhyve/xhyve.h @@ -41,6 +41,7 @@ #define VMEXIT_ABORT (-1) extern int guest_ncpus; +extern int print_mac; extern char *guest_uuid_str; extern char *vmname; diff --git a/src/lib/pci_virtio_net_vmnet.c b/src/lib/pci_virtio_net_vmnet.c index 7c741032..380b59fe 100644 --- a/src/lib/pci_virtio_net_vmnet.c +++ b/src/lib/pci_virtio_net_vmnet.c @@ -715,7 +715,7 @@ pci_vtnet_init(struct pci_devinst *pi, UNUSED char *opts) sc->vsc_queues[VTNET_TXQ].vq_notify = pci_vtnet_ping_txq; #ifdef notyet sc->vsc_queues[VTNET_CTLQ].vq_qsize = VTNET_RINGSZ; - sc->vsc_queues[VTNET_CTLQ].vq_notify = pci_vtnet_ping_ctlq; + sc->vsc_queues[VTNET_CTLQ].vq_notify = pci_vtnet_ping_ctlq; #endif /* @@ -728,6 +728,14 @@ pci_vtnet_init(struct pci_devinst *pi, UNUSED char *opts) return (-1); } + if (print_mac == 1) + { + printf("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n", + sc->vms->mac[0], sc->vms->mac[1], sc->vms->mac[2], + sc->vms->mac[3], sc->vms->mac[4], sc->vms->mac[5]); + exit(0); + } + sc->vsc_config.mac[0] = sc->vms->mac[0]; sc->vsc_config.mac[1] = sc->vms->mac[1]; sc->vsc_config.mac[2] = sc->vms->mac[2]; From dc973ca33f0c66091669cc66c782295fbbf508be Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Mon, 26 Nov 2018 16:51:46 +0530 Subject: [PATCH 2/3] Update man page Signed-off-by: Noel Georgi --- hyperkit.1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hyperkit.1 b/hyperkit.1 index c5f822c3..4b708b68 100644 --- a/hyperkit.1 +++ b/hyperkit.1 @@ -100,6 +100,10 @@ The size argument may be suffixed with one of K, M, G or T (either upper or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes. If no suffix is given, the value is assumed to be in megabytes. +and +.Ar com3. +.It Fl M +Print MAC address and exit if using vmnet. .It Fl p Ar vcpu:hostcpu Pin guest's virtual CPU .Em vcpu From a0ace7f0e7e60e53903a5f542d38493b4482349c Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Mon, 26 Nov 2018 17:20:39 +0530 Subject: [PATCH 3/3] Fix man syntax Signed-off-by: Noel Georgi --- hyperkit.1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/hyperkit.1 b/hyperkit.1 index 4b708b68..bbe7ca1d 100644 --- a/hyperkit.1 +++ b/hyperkit.1 @@ -100,8 +100,6 @@ The size argument may be suffixed with one of K, M, G or T (either upper or lower case) to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes. If no suffix is given, the value is assumed to be in megabytes. -and -.Ar com3. .It Fl M Print MAC address and exit if using vmnet. .It Fl p Ar vcpu:hostcpu