Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Aug 2011 12:43:45 GMT
From:      Takuya ASADA <syuu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 197505 for review
Message-ID:  <201108111243.p7BChjTL011452@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@197505?ac=10

Change 197505 by syuu@kikurage on 2011/08/11 12:42:40

	mq_bpf support for mxge

Affected files ...

.. //depot/projects/soc2011/mq_bpf/src/sys/dev/mxge/if_mxge.c#2 edit
.. //depot/projects/soc2011/mq_bpf/src/tools/regression/bpf/mq_bpf/test_sqbpf/test_sqbpf.c#4 edit

Differences ...

==== //depot/projects/soc2011/mq_bpf/src/sys/dev/mxge/if_mxge.c#2 (text+ko) ====

@@ -119,6 +119,11 @@
 static int mxge_shutdown(device_t dev);
 static void mxge_intr(void *arg);
 
+static int mxge_get_rxqueue_len(struct ifnet *);
+static int mxge_get_txqueue_len(struct ifnet *);
+static int mxge_get_rxqueue_affinity(struct ifnet *, int);
+static int mxge_get_txqueue_affinity(struct ifnet *, int);
+
 static device_method_t mxge_methods[] =
 {
   /* Device interface */
@@ -2231,6 +2236,9 @@
 		if (m == NULL) {
 			return;
 		}
+		m->m_pkthdr.rxqueue = (uint32_t)-1;
+		m->m_pkthdr.txqueue = (ss - sc->ss);
+
 		/* let BPF see it */
 		BPF_MTAP(ifp, m);
 
@@ -2265,6 +2273,9 @@
 
 	if (!drbr_needs_enqueue(ifp, tx->br) &&
 	    ((tx->mask - (tx->req - tx->done)) > tx->max_desc)) {
+		m->m_pkthdr.rxqueue = (uint32_t)-1;
+		m->m_pkthdr.txqueue = (ss - sc->ss);
+
 		/* let BPF see it */
 		BPF_MTAP(ifp, m);
 		/* give it to the nic */
@@ -2603,6 +2614,8 @@
 	if (sc->num_slices > 1) {
 		m->m_pkthdr.flowid = (ss - sc->ss);
 		m->m_flags |= M_FLOWID;
+		m->m_pkthdr.rxqueue = (ss - sc->ss);
+		m->m_pkthdr.txqueue = (uint32_t)-1;
 	}
 	/* pass the frame up the stack */
 	(*ifp->if_input)(ifp, m);
@@ -4355,6 +4368,7 @@
 
 	/* see how many MSI-X interrupts are available */
 	msix_cnt = pci_msix_count(sc->dev);
+	printf("%s: msix_cnt:%d\n", __func__, msix_cnt);
 	if (msix_cnt < 2)
 		return;
 
@@ -4364,6 +4378,7 @@
 		sc->fw_name = mxge_fw_rss_aligned;
 	else
 		sc->fw_name = mxge_fw_rss_unaligned;
+	printf("%s: fw aligned?:%d\n", __func__, old_fw == mxge_fw_aligned);
 	status = mxge_load_firmware(sc, 0);
 	if (status != 0) {
 		device_printf(sc->dev, "Falling back to a single slice\n");
@@ -4389,6 +4404,7 @@
 
 	/* tell it the size of the interrupt queues */
 	cmd.data0 = max_intr_slots * sizeof (struct mcp_slot);
+	printf("%s: intrq_size:%d\n", __func__, cmd.data0);
 	status = mxge_send_cmd(sc, MXGEFW_CMD_SET_INTRQ_SIZE, &cmd);
 	if (status != 0) {
 		device_printf(sc->dev, "failed MXGEFW_CMD_SET_INTRQ_SIZE\n");
@@ -4402,6 +4418,7 @@
 			      "failed MXGEFW_CMD_GET_MAX_RSS_QUEUES\n");
 		goto abort_with_fw;
 	}
+	printf("%s: max_rss_queues:%d\n", __func__, cmd.data0);
 	sc->num_slices = cmd.data0;
 	if (sc->num_slices > msix_cnt)
 		sc->num_slices = msix_cnt;
@@ -4790,6 +4807,7 @@
 	    sc->fw_ver_tiny >= 32)
 		ifp->if_capabilities |= IFCAP_VLAN_HWTSO;
 #endif
+	ifp->if_capabilities |= IFCAP_MULTIQUEUE;
 
 	sc->max_mtu = mxge_max_mtu(sc);
 	if (sc->max_mtu >= 9000)
@@ -4808,6 +4826,11 @@
         ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
         ifp->if_ioctl = mxge_ioctl;
         ifp->if_start = mxge_start;
+	ifp->if_get_rxqueue_len = mxge_get_rxqueue_len;
+	ifp->if_get_txqueue_len = mxge_get_txqueue_len;
+	ifp->if_get_rxqueue_affinity = mxge_get_rxqueue_affinity;
+	ifp->if_get_txqueue_affinity = mxge_get_txqueue_affinity;
+
 	/* Initialise the ifmedia structure */
 	ifmedia_init(&sc->media, 0, mxge_media_change, 
 		     mxge_media_status);
@@ -4904,6 +4927,33 @@
 	return 0;
 }
 
+
+static int
+mxge_get_rxqueue_len(struct ifnet *ifp)
+{
+	mxge_softc_t *sc = ifp->if_softc;
+	return (sc->num_slices);
+}
+
+static int
+mxge_get_txqueue_len(struct ifnet *ifp)
+{
+	mxge_softc_t *sc = ifp->if_softc;
+	return (sc->num_slices);
+}
+
+static int
+mxge_get_rxqueue_affinity(struct ifnet *ifp, int queid)
+{
+	return (queid);
+}
+
+static int
+mxge_get_txqueue_affinity(struct ifnet *ifp, int queid)
+{
+	return (queid);
+}
+
 /*
   This file uses Myri10GE driver indentation.
 

==== //depot/projects/soc2011/mq_bpf/src/tools/regression/bpf/mq_bpf/test_sqbpf/test_sqbpf.c#4 (text+ko) ====

@@ -311,10 +311,23 @@
 static int
 bpf_zbuf_init(struct bpf_zbuf *bz)
 {
-	int bmode;
+	int bmode, zmax;
 
 	if ((bflag % getpagesize()) != 0)
 		errx(1, "-b must be multiple of system page size");
+	bmode = BPF_BUFMODE_ZBUF;
+	if (ioctl(bpffd, BIOCSETBUFMODE, &bmode) < 0)
+		err(1, "ioctl(BIOCGSETBUFMODE)");
+#if 0
+	if (ioctl(bpffd, BIOCGETZMAX, &zmax) < 0)
+		err(1, "ioctl(BIOCGETZMAX)");
+	if (bflag > zmax) {
+		(void) fprintf(stderr,
+			"buffer size is too big, truncated to %d\n",
+			zmax);
+		bflag = zmax;
+	}
+#endif
 	bz->bz_buflen = bflag;
 	bufa = mmap(NULL, bz->bz_buflen, PROT_READ | PROT_WRITE,
 	    MAP_ANON, -1, 0);
@@ -326,9 +339,6 @@
 		err(1, "mmap(bufb)");
 	bz->bz_bufa = bufa;
 	bz->bz_bufb = bufb;
-	bmode = BPF_BUFMODE_ZBUF;
-	if (ioctl(bpffd, BIOCSETBUFMODE, &bmode) < 0)
-		err(1, "ioctl(BIOCGSETBUFMODE)");
 	if (ioctl(bpffd, BIOCSETZBUF, bz) < 0)
 		err(1, "ioctl(BIOCSETZBUF)");
 	if (vflag)



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