Date: Fri, 5 Aug 2016 14:03:10 GMT From: vincenzo@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r307228 - soc2016/vincenzo/head/usr.sbin/bhyve Message-ID: <201608051403.u75E3A3w096280@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vincenzo Date: Fri Aug 5 14:03:10 2016 New Revision: 307228 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307228 Log: bhyve: ptnet: implement PTNET_IO_PTFEAT register write Modified: soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.h soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Modified: soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.h ============================================================================== --- soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.h Fri Aug 5 14:02:19 2016 (r307227) +++ soc2016/vincenzo/head/usr.sbin/bhyve/net_backends.h Fri Aug 5 14:03:10 2016 (r307228) @@ -112,10 +112,12 @@ uint16_t num_rx_slots; }; +int ptn_memdev_attach(void *mem_ptr, uint32_t mem_size, uint16_t mem_id); int ptnetmap_get_netmap_if(struct ptnetmap_state *ptn, struct netmap_if_info *nif); struct ptnetmap_state * get_ptnetmap(struct net_backend *be); -int ptn_memdev_attach(void *mem_ptr, uint32_t mem_size, uint16_t mem_id); +uint32_t ptnetmap_ack_features(struct ptnetmap_state *ptn, + uint32_t wanted_features); #include "pci_emul.h" Modified: soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c ============================================================================== --- soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Fri Aug 5 14:02:19 2016 (r307227) +++ soc2016/vincenzo/head/usr.sbin/bhyve/pci_ptnetmap_netif.c Fri Aug 5 14:03:10 2016 (r307228) @@ -98,7 +98,7 @@ if (sc == NULL) return 0; - offset = offset & PTNET_IO_MASK; + offset &= PTNET_IO_MASK; if (baridx == PTNETMAP_IO_PCI_BAR && offset < PTNET_IO_END) { switch (offset) { @@ -127,10 +127,24 @@ int baridx, uint64_t offset, int size, uint64_t value) { struct ptnet_softc *sc = pi->pi_arg; + unsigned int index; if (sc == NULL) return; + offset &= PTNET_IO_MASK; + index = offset >> 2; + + if (baridx == PTNETMAP_IO_PCI_BAR && offset < PTNET_IO_END) { + switch (offset) { + case PTNET_IO_PTFEAT: + value = ptnetmap_ack_features(sc->ptbe, value); + sc->ioregs[index] = value; + break; + } + return; + } + fprintf(stderr, "%s: Unexpected register write [bar %u, offset %lx " "size %d value %lx]\n", __func__, baridx, offset, size, value); } @@ -181,6 +195,7 @@ sc->be = netbe_init(devname, NULL, sc); if (!sc->be) { fprintf(stderr, "net backend initialization failed\n"); + return -1; } free(devname);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608051403.u75E3A3w096280>