Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jun 2016 14:10:01 GMT
From:      vincenzo@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r304520 - soc2016/vincenzo/head/sys/dev/netmap
Message-ID:  <201606031410.u53EA1ce061574@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vincenzo
Date: Fri Jun  3 14:10:01 2016
New Revision: 304520
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304520

Log:
   freebsd: ptnetmap memdev: a few rearrangements

Modified:
  soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c

Modified: soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c	Fri Jun  3 14:09:49 2016	(r304519)
+++ soc2016/vincenzo/head/sys/dev/netmap/netmap_freebsd.c	Fri Jun  3 14:10:01 2016	(r304520)
@@ -562,8 +562,8 @@
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>
 /*
- * ptnetmap memory device (memdev) for freebsd guest
- * Used to expose host memory to the guest through PCI-BAR
+ * ptnetmap memory device (memdev) for freebsd guest,
+ * ssed to expose host netmap memory to the guest through a PCI BAR.
  */
 
 /*
@@ -582,7 +582,6 @@
 static int	ptn_memdev_shutdown(device_t);
 
 static device_method_t ptn_memdev_methods[] = {
-	/* Device interface */
 	DEVMETHOD(device_probe, ptn_memdev_probe),
 	DEVMETHOD(device_attach, ptn_memdev_attach),
 	DEVMETHOD(device_detach, ptn_memdev_detach),
@@ -591,12 +590,13 @@
 };
 
 static driver_t ptn_memdev_driver = {
-	PTN_MEMDEV_NAME, ptn_memdev_methods, sizeof(struct ptnetmap_memdev),
+	PTN_MEMDEV_NAME,
+	ptn_memdev_methods,
+	sizeof(struct ptnetmap_memdev),
 };
 
 static devclass_t ptnetmap_devclass;
 DRIVER_MODULE(netmap, pci, ptn_memdev_driver, ptnetmap_devclass, 0, 0);
-
 MODULE_DEPEND(netmap, pci, 1, 1, 1);
 
 /*
@@ -613,9 +613,8 @@
 #endif /* unused */
 
 /*
- * map host netmap memory through PCI-BAR in the guest OS
- *
- * return physical (nm_paddr) and virtual (nm_addr) addresses
+ * Map host netmap memory through PCI-BAR in the guest OS,
+ * returning physical (nm_paddr) and virtual (nm_addr) addresses
  * of the netmap memory mapped in the guest.
  */
 int
@@ -649,9 +648,7 @@
 	return (0);
 }
 
-/*
- * unmap PCI-BAR
- */
+/* Unmap host netmap memory. */
 void
 nm_os_pt_memdev_iounmap(struct ptnetmap_memdev *ptn_dev)
 {
@@ -664,14 +661,8 @@
 	}
 }
 
-/*********************************************************************
- *  Device identification routine
- *
- *  ixgbe_probe determines if the driver should be loaded on
- *  adapter based on PCI vendor/device id of the adapter.
- *
- *  return BUS_PROBE_DEFAULT on success, positive on failure
- *********************************************************************/
+/* Device identification routine, return BUS_PROBE_DEFAULT on success,
+ * positive on failure */
 static int
 ptn_memdev_probe(device_t dev)
 {
@@ -690,15 +681,7 @@
 	return (BUS_PROBE_DEFAULT);
 }
 
-/*********************************************************************
- *  Device initialization routine
- *
- *  The attach entry point is called when the driver is being loaded.
- *  This routine identifies the type of hardware, allocates all resources
- *  and initializes the hardware.
- *
- *  return 0 on success, positive on failure
- *********************************************************************/
+/* Device initialization routine. */
 static int
 ptn_memdev_attach(device_t dev)
 {
@@ -715,7 +698,7 @@
 
 	rid = PCIR_BAR(PTNETMAP_IO_PCI_BAR);
 	ptn_dev->pci_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
-			RF_ACTIVE);
+						 RF_ACTIVE);
 	if (ptn_dev->pci_io == NULL) {
 	        device_printf(dev, "cannot map I/O space\n");
 	        return (ENXIO);
@@ -736,15 +719,7 @@
 	return (0);
 }
 
-/*********************************************************************
- *  Device removal routine
- *
- *  The detach entry point is called when the driver is being removed.
- *  This routine stops the adapter and deallocates all the resources
- *  that were allocated for driver operation.
- *
- *  return 0 on success, positive on failure
- *********************************************************************/
+/* Device removal routine. */
 static int
 ptn_memdev_detach(device_t dev)
 {
@@ -771,29 +746,18 @@
 	return (0);
 }
 
-/*********************************************************************
- *
- *  Shutdown entry point
- *
- **********************************************************************/
 static int
 ptn_memdev_shutdown(device_t dev)
 {
-	D("ptn_memdev_driver shutsown");
+	D("ptn_memdev_driver shutdown");
 	return bus_generic_shutdown(dev);
 }
 
 int
-nm_os_pt_memdev_init(void)
-{
-	return 0;
-}
+nm_os_pt_memdev_init(void) { return 0; }
 
 void
-nm_os_pt_memdev_uninit(void)
-{
-
-}
+nm_os_pt_memdev_uninit(void) { }
 #endif /* WITH_PTNETMAP_GUEST */
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606031410.u53EA1ce061574>