Report link as up only if we managed to open tap device.

It would be cool to report tap device status, but it has no such API.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2015-04-20 14:23:18 +00:00
parent 7144875388
commit f2c58daab8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281766

View File

@ -644,8 +644,8 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK);
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
/* link always up */
sc->vsc_config.status = 1;
/* Link is up if we managed to open tap device. */
sc->vsc_config.status = (sc->vsc_tapfd >= 0);
/* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix()))