Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jun 2011 08:27:37 GMT
From:      Takuya ASADA <syuu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 195501 for review
Message-ID:  <201106290827.p5T8RbF5073986@skunkworks.freebsd.org>

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

Change 195501 by syuu@x200 on 2011/06/29 08:27:06

	queue len, queue affinity ioctls moved from bpf to NIC device.

Affected files ...

.. //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_igb.c#7 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.c#10 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.h#6 edit
.. //depot/projects/soc2011/mq_bpf/src/sys/sys/sockio.h#2 edit

Differences ...

==== //depot/projects/soc2011/mq_bpf/src/sys/dev/e1000/if_igb.c#7 (text+ko) ====

@@ -37,6 +37,7 @@
 #include "opt_device_polling.h"
 #include "opt_inet.h"
 #include "opt_altq.h"
+#include "opt_kdtrace.h"
 #endif
 
 #include <sys/param.h>
@@ -55,6 +56,7 @@
 #include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
+#include <sys/sdt.h>
 #include <sys/taskqueue.h>
 #include <sys/eventhandler.h>
 #include <sys/pcpu.h>
@@ -92,6 +94,13 @@
 #include "e1000_82575.h"
 #include "if_igb.h"
 
+SDT_PROVIDER_DECLARE(igb);
+SDT_PROVIDER_DEFINE(igb);
+SDT_PROBE_DEFINE1(igb, functions, igb_ioctl_rxqlen, entry, entry, "int");
+SDT_PROBE_DEFINE1(igb, functions, igb_ioctl_txqlen, entry, entry, "int");
+SDT_PROBE_DEFINE2(igb, functions, igb_ioctl_rxqaffinity, entry, entry, "int", "int");
+SDT_PROBE_DEFINE2(igb, functions, igb_ioctl_txqaffinity, entry, entry, "int", "int");
+
 /*********************************************************************
  *  Set this to one to display debug statistics
  *********************************************************************/
@@ -1173,6 +1182,60 @@
 		break;
 	    }
 
+	case SIOCGIFRXQLEN:
+		*(int *)data = ifp->if_rxq_num;
+		SDT_PROBE1(igb, functions, igb_ioctl_rxqlen, entry, ifp->if_rxq_num);
+		break;
+
+	case SIOCGIFTXQLEN:
+		*(int *)data = ifp->if_txq_num;
+		SDT_PROBE1(igb, functions, igb_ioctl_txqlen, entry, ifp->if_txq_num);
+		break;
+
+	case SIOCGIFRXQAFFINITY:
+	    {
+		u_long index;
+
+		index = *(u_long *)data;
+		if (index > ifp->if_rxq_num) {
+			log(LOG_ERR, "SIOCGIFRXQAFFINITY: index too large index:%lx rxq_num:%d\n", index, ifp->if_rxq_num);
+			error = EINVAL;
+			SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, -1, -1);
+			break;
+		}
+		if (!ifp->if_rxq_affinity) {
+			log(LOG_ERR, "!ifp->if_rxq_affinity\n");
+			error = EINVAL;
+			SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, -1, -1);
+			break;
+		}
+		*(u_long *)data = ifp->if_rxq_affinity[index];
+		SDT_PROBE2(igb, functions, igb_ioctl_rxqaffinity, entry, index, ifp->if_rxq_affinity[index]);
+		break;
+	    }
+
+	case SIOCGIFTXQAFFINITY:
+	    {
+		u_long index;
+
+		index = *(u_long *)data;
+		if (index > ifp->if_txq_num) {
+			log(LOG_ERR, "SIOCGIFTXQAFFINITY: index too large index:%lx txq_num:%x\n", index, ifp->if_txq_num);
+			error = EINVAL;
+			SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, -1, -1);
+			break;
+		}
+		if (!ifp->if_txq_affinity) {
+			log(LOG_ERR, "!ifp->if_txq_affinity\n");
+			error = EINVAL;
+			SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, -1, -1);
+			break;
+		}
+		*(u_long *)data = ifp->if_txq_affinity[index];
+		SDT_PROBE2(igb, functions, igb_ioctl_txqaffinity, entry, index, ifp->if_txq_affinity[index]);
+		break;
+	    }
+
 	default:
 		error = ether_ioctl(ifp, command, data);
 		break;

==== //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.c#10 (text+ko) ====

@@ -210,10 +210,6 @@
 SDT_PROBE_DEFINE3(bpf, functions, bpf_mtap_tx, entry, entry, "void *", "uint32_t", "uint32_t");
 SDT_PROBE_DEFINE3(bpf, functions, bpf_mtap2_rx, entry, entry, "void *", "uint32_t", "uint32_t");
 SDT_PROBE_DEFINE3(bpf, functions, bpf_mtap2_tx, entry, entry, "void *", "uint32_t", "uint32_t");
-SDT_PROBE_DEFINE1(bpf, functions, bpfioctl_biocrxqlen, entry, entry, "int");
-SDT_PROBE_DEFINE1(bpf, functions, bpfioctl_bioctxqlen, entry, entry, "int");
-SDT_PROBE_DEFINE2(bpf, functions, bpfioctl_biocrxqaffinity, entry, entry, "int", "int");
-SDT_PROBE_DEFINE2(bpf, functions, bpfioctl_bioctxqaffinity, entry, entry, "int", "int");
 SDT_PROBE_DEFINE1(bpf, functions, bpfioctl_biocenaqmask, entry, entry, "int");
 SDT_PROBE_DEFINE1(bpf, functions, bpfioctl_biocdisqmask, entry, entry, "int");
 SDT_PROBE_DEFINE1(bpf, functions, bpfioctl_biocstrxqmask, entry, entry, "int");
@@ -1544,107 +1540,6 @@
 		error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr);
 		break;
 
-	case BIOCRXQLEN:
-		{
-			struct ifnet *ifp;
-
-			if (d->bd_bif == NULL) {
-				/*
-				 * No interface attached yet.
-				 */
-				error = EINVAL;
-				SDT_PROBE1(bpf, functions, bpfioctl_biocrxqlen, entry, -1);
-				break;
-			}
-			ifp = d->bd_bif->bif_ifp;
-			*(int *)addr = ifp->if_rxq_num;
-			SDT_PROBE1(bpf, functions, bpfioctl_biocrxqlen, entry, ifp->if_rxq_num);
-			break;
-		}
-
-	case BIOCTXQLEN:
-		{
-			struct ifnet *ifp;
-
-			if (d->bd_bif == NULL) {
-				/*
-				 * No interface attached yet.
-				 */
-				error = EINVAL;
-				SDT_PROBE1(bpf, functions, bpfioctl_bioctxqlen, entry, -1);
-				break;
-			}
-			ifp = d->bd_bif->bif_ifp;
-			*(int *)addr = ifp->if_txq_num;
-			SDT_PROBE1(bpf, functions, bpfioctl_bioctxqlen, entry, ifp->if_txq_num);
-			break;
-		}
-
-	case BIOCRXQAFFINITY:
-		{
-			u_long index;
-			struct ifnet *ifp;
-
-			if (d->bd_bif == NULL) {
-				/*
-				 * No interface attached yet.
-				 */
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_biocrxqaffinity, entry, -1, -1);
-				break;
-			}
-			ifp = d->bd_bif->bif_ifp;
-			index = *(u_long *)addr;
-			if (index > ifp->if_rxq_num) {
-				log(LOG_ERR, "BIOCRXQAFFINITY: index too large index:%lx rxq_num:%d\n", index, ifp->if_rxq_num);
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_biocrxqaffinity, entry, -1, -1);
-				break;
-			}
-			if (!ifp->if_rxq_affinity) {
-				log(LOG_ERR, "!ifp->if_rxq_affinity\n");
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_biocrxqaffinity, entry, -1, -1);
-				break;
-			}
-			*(u_long *)addr = ifp->if_rxq_affinity[index];
-			SDT_PROBE2(bpf, functions, bpfioctl_biocrxqaffinity, entry, index, ifp->if_rxq_affinity[index]);
-			break;
-		}
-
-	case BIOCTXQAFFINITY:
-		{
-			u_long index;
-			struct ifnet *ifp;
-
-			if (d->bd_bif == NULL) {
-				log(LOG_ERR, "d->bd_bif == NULL\n");
-				/*
-				 * No interface attached yet.
-				 */
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_bioctxqaffinity, entry, -1, -1);
-				break;
-			}
-			ifp = d->bd_bif->bif_ifp;
-			index = *(u_long *)addr;
-			if (index > ifp->if_txq_num) {
-				log(LOG_ERR, "BIOCTXQAFFINITY: index too large index:%lx txq_num:%x\n", index, ifp->if_txq_num);
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_bioctxqaffinity, entry, -1, -1);
-				break;
-			}
-			if (!ifp->if_txq_affinity) {
-				log(LOG_ERR, "!ifp->if_txq_affinity\n");
-				error = EINVAL;
-				SDT_PROBE2(bpf, functions, bpfioctl_bioctxqaffinity, entry, -1, -1);
-				break;
-			}
-			*(u_long *)addr = ifp->if_txq_affinity[index];
-			SDT_PROBE2(bpf, functions, bpfioctl_bioctxqaffinity, entry, index, ifp->if_txq_affinity[index]);
-			break;
-		}
-
 	case BIOCENAQMASK:
 		{
 			int i;

==== //depot/projects/soc2011/mq_bpf/src/sys/net/bpf.h#6 (text+ko) ====

@@ -150,21 +150,17 @@
 #define	BIOCSETFNR	_IOW('B', 130, struct bpf_program)
 #define	BIOCGTSTAMP	_IOR('B', 131, u_int)
 #define	BIOCSTSTAMP	_IOW('B', 132, u_int)
-#define BIOCRXQLEN 	_IOR('B', 133, int)
-#define BIOCTXQLEN 	_IOR('B', 134, int)
-#define BIOCRXQAFFINITY _IOWR('B', 135, u_long)
-#define BIOCTXQAFFINITY _IOWR('B', 136, u_long)
-#define BIOCENAQMASK	_IO('B', 137)
-#define BIOCDISQMASK	_IO('B', 138)
-#define BIOCSTRXQMASK	_IOWR('B', 139, uint32_t)
-#define BIOCCRRXQMASK	_IOWR('B', 140, uint32_t)
-#define BIOCGTRXQMASK	_IOR('B', 141, uint32_t)
-#define BIOCSTTXQMASK	_IOWR('B', 141, uint32_t)
-#define BIOCCRTXQMASK	_IOWR('B', 142, uint32_t)
-#define BIOCGTTXQMASK	_IOR('B', 143, uint32_t)
-#define BIOCSTOTHERMASK	_IO('B', 143)
-#define BIOCCROTHERMASK	_IO('B', 144)
-#define BIOCGTOTHERMASK	_IOR('B', 145, uint32_t)
+#define BIOCENAQMASK	_IO('B', 133)
+#define BIOCDISQMASK	_IO('B', 134)
+#define BIOCSTRXQMASK	_IOWR('B', 135, uint32_t)
+#define BIOCCRRXQMASK	_IOWR('B', 136, uint32_t)
+#define BIOCGTRXQMASK	_IOR('B', 137, uint32_t)
+#define BIOCSTTXQMASK	_IOWR('B', 138, uint32_t)
+#define BIOCCRTXQMASK	_IOWR('B', 139, uint32_t)
+#define BIOCGTTXQMASK	_IOR('B', 140, uint32_t)
+#define BIOCSTOTHERMASK	_IO('B', 141)
+#define BIOCCROTHERMASK	_IO('B', 142)
+#define BIOCGTOTHERMASK	_IOR('B', 143, uint32_t)
 
 /* Obsolete */
 #define	BIOCGSEESENT	BIOCGDIRECTION

==== //depot/projects/soc2011/mq_bpf/src/sys/sys/sockio.h#2 (text+ko) ====

@@ -97,6 +97,11 @@
 #define	SIOCGIFSTATUS	_IOWR('i', 59, struct ifstat)	/* get IF status */
 #define	SIOCSIFLLADDR	 _IOW('i', 60, struct ifreq)	/* set linklevel addr */
 
+#define SIOCGIFRXQLEN 	_IOR('B', 61, int)		/* get IF rx queue len */
+#define SIOCGIFTXQLEN 	_IOR('B', 62, int)		/* get IF tx queue len */
+#define SIOCGIFRXQAFFINITY _IOWR('B', 63, u_long)	/* get IF rx queue affinity */
+#define SIOCGIFTXQAFFINITY _IOWR('B', 64, u_long)	/* get IF tx queue affinity */
+
 #define	SIOCSIFPHYADDR	 _IOW('i', 70, struct ifaliasreq) /* set gif addres */
 #define	SIOCGIFPSRCADDR	_IOWR('i', 71, struct ifreq)	/* get gif psrc addr */
 #define	SIOCGIFPDSTADDR	_IOWR('i', 72, struct ifreq)	/* get gif pdst addr */



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