Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hyperkit.1
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ 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.
.It Fl M
Print MAC address and exit if using vmnet.
.It Fl p Ar vcpu:hostcpu
Pin guest's virtual CPU
.Em vcpu
Expand Down
6 changes: 6 additions & 0 deletions src/hyperkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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: <slot,driver,configinfo> PCI slot config\n"
" -u: RTC keeps UTC time\n"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/include/xhyve/xhyve.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define VMEXIT_ABORT (-1)

extern int guest_ncpus;
extern int print_mac;
extern char *guest_uuid_str;
extern char *vmname;

Expand Down
10 changes: 9 additions & 1 deletion src/lib/pci_virtio_net_vmnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

/*
Expand All @@ -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];
Expand Down