socsvn commit: r305834 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Fri Jul 8 15:45:16 UTC 2016


Author: vincenzo
Date: Fri Jul  8 15:45:14 2016
New Revision: 305834
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305834

Log:
   freebsd: ptnet_attach: add optional virtio-net header negotiation

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

Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri Jul  8 15:45:02 2016	(r305833)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri Jul  8 15:45:14 2016	(r305834)
@@ -94,6 +94,9 @@
 #define DBG(x)
 #endif  /* !DEBUG */
 
+/* Tunable parameters. */
+static bool ptnet_vnet_hdr = false;
+
 struct ptnet_softc;
 
 struct ptnet_queue {
@@ -269,6 +272,9 @@
 
 	/* Check if we are supported by the hypervisor. If not,
 	 * bail out immediately. */
+	if (ptnet_vnet_hdr) {
+		ptfeatures |= NET_PTN_FEATURES_VNET_HDR;
+	}
 	bus_write_4(sc->iomem, PTNET_IO_PTFEAT, ptfeatures); /* wanted */
 	ptfeatures = bus_read_4(sc->iomem, PTNET_IO_PTFEAT); /* acked */
 	if (!(ptfeatures & NET_PTN_FEATURES_BASE)) {
@@ -410,6 +416,13 @@
 	sc->ptna_nm = (struct netmap_pt_guest_adapter *)NA(ifp);
 	sc->ptna_nm->csb = sc->csb;
 
+	/* If virtio-net header was negotiated, set the virt_hdr_len field in
+	 * the netmap adapter, to inform users that this netmap adapter requires
+	 * the application to deal with the headers. */
+	if (sc->ptfeatures & NET_PTN_FEATURES_VNET_HDR) {
+		sc->ptna_nm->hwup.up.virt_hdr_len = PTNET_HDR_SIZE;
+	}
+
 	/* Initialize a separate pass-through netmap adapter that is going to
 	 * be used by this driver only, and so never exposed to netmap. We
 	 * only need a subset of the available fields. */


More information about the svn-soc-all mailing list