svn commit: r192936 - projects/pnet/sys/net

Robert Watson rwatson at FreeBSD.org
Wed May 27 22:23:17 UTC 2009


Author: rwatson
Date: Wed May 27 22:23:16 2009
New Revision: 192936
URL: http://svn.freebsd.org/changeset/base/192936

Log:
  Be more specific about whether a 'cpu' is a CPU ID or not.

Modified:
  projects/pnet/sys/net/netisr2.c
  projects/pnet/sys/net/netisr2.h

Modified: projects/pnet/sys/net/netisr2.c
==============================================================================
--- projects/pnet/sys/net/netisr2.c	Wed May 27 22:15:54 2009	(r192935)
+++ projects/pnet/sys/net/netisr2.c	Wed May 27 22:23:16 2009	(r192936)
@@ -181,7 +181,7 @@ struct netisr_proto {
 	const char	*np_name;	/* Character string protocol name. */
 	netisr_t	*np_handler;	/* Protocol handler. */
 	netisr_m2flow_t	*np_m2flow;	/* Query flow for untagged packet. */
-	netisr_m2cpu_t	*np_m2cpu;	/* Query CPU to process packet on. */
+	netisr_m2cpuid_t	*np_m2cpuid;	/* Query CPU to process packet on. */
 	u_int		 np_qlimit;	/* Maximum per-CPU queue depth. */
 	u_int		 np_policy;	/* Work placement policy. */
 };
@@ -358,11 +358,11 @@ netisr2_register(const struct netisr_han
 	    nhp->nh_m2flow == NULL,
 	    ("netisr2_register: nh_policy != FLOW but m2flow defined for %s",
 	    name));
-	KASSERT(nhp->nh_policy == NETISR_POLICY_CPU || nhp->nh_m2cpu == NULL,
-	    ("netisr2_register: nh_policy != CPU but m2cpu defined for %s",
+	KASSERT(nhp->nh_policy == NETISR_POLICY_CPU || nhp->nh_m2cpuid == NULL,
+	    ("netisr2_register: nh_policy != CPU but m2cpuid defined for %s",
 	    name));
-	KASSERT(nhp->nh_policy != NETISR_POLICY_CPU || nhp->nh_m2cpu != NULL,
-	    ("netisr2_register: nh_policy == CPU but m2cpu not defined for "
+	KASSERT(nhp->nh_policy != NETISR_POLICY_CPU || nhp->nh_m2cpuid != NULL,
+	    ("netisr2_register: nh_policy == CPU but m2cpuid not defined for "
 	    "%s", name));
 	KASSERT(nhp->nh_qlimit != 0,
 	    ("netisr2_register: nh_qlimit 0 for %s", name));
@@ -373,7 +373,7 @@ netisr2_register(const struct netisr_han
 	np[proto].np_name = name;
 	np[proto].np_handler = nhp->nh_handler;
 	np[proto].np_m2flow = nhp->nh_m2flow;
-	np[proto].np_m2cpu = nhp->nh_m2cpu;
+	np[proto].np_m2cpuid = nhp->nh_m2cpuid;
 	if (nhp->nh_qlimit > netisr_maxqlimit) {
 		printf("netisr2_register: %s requested queue limit %u "
 		    "capped to net.isr2.maxqlimit %u\n", name,
@@ -564,7 +564,7 @@ netisr2_unregister(const struct netisr_h
 	np[proto].np_name = NULL;
 	np[proto].np_handler = NULL;
 	np[proto].np_m2flow = NULL;
-	np[proto].np_m2cpu = NULL;
+	np[proto].np_m2cpuid = NULL;
 	np[proto].np_qlimit = 0;
 	np[proto].np_policy = 0;
 	for (i = 0; i < MAXCPU; i++) {
@@ -581,8 +581,8 @@ netisr2_unregister(const struct netisr_h
  * for assistance if required.
  */
 static struct mbuf *
-netisr2_selectcpu(struct netisr_proto *npp, uintptr_t source, struct mbuf *m,
-    u_int *cpuidp)
+netisr2_select_cpuid(struct netisr_proto *npp, uintptr_t source,
+    struct mbuf *m, u_int *cpuidp)
 {
 	struct ifnet *ifp;
 
@@ -604,7 +604,7 @@ netisr2_selectcpu(struct netisr_proto *n
 	 */
 	switch (npp->np_policy) {
 	case NETISR_POLICY_CPU:
-		return (npp->np_m2cpu(m, source, cpuidp));
+		return (npp->np_m2cpuid(m, source, cpuidp));
 
 	case NETISR_POLICY_FLOW:
 		if (!(m->m_flags & M_FLOWID) && npp->np_m2flow != NULL) {
@@ -629,7 +629,7 @@ netisr2_selectcpu(struct netisr_proto *n
 		return (m);
 
 	default:
-		panic("netisr2_selectcpu: invalid policy %u for %s",
+		panic("netisr2_select_cpuid: invalid policy %u for %s",
 		    npp->np_policy, npp->np_name);
 	}
 }
@@ -827,7 +827,7 @@ netisr2_queue_src(u_int proto, uintptr_t
 	KASSERT(np[proto].np_handler != NULL,
 	    ("netisr2_queue_src: invalid proto %d", proto));
 
-	m = netisr2_selectcpu(&np[proto], source, m, &cpuid);
+	m = netisr2_select_cpuid(&np[proto], source, m, &cpuid);
 	if (m != NULL)
 		error = netisr2_queue_internal(proto, m, cpuid);
 	else
@@ -897,7 +897,7 @@ netisr2_dispatch_src(u_int proto, uintpt
 	 * dispatch if we're on the right CPU and the netisr worker isn't
 	 * already running.
 	 */
-	m = netisr2_selectcpu(&np[proto], source, m, &cpuid);
+	m = netisr2_select_cpuid(&np[proto], source, m, &cpuid);
 	if (m == NULL) {
 		NETISR_RUNLOCK(&tracker);
 		return (ENOBUFS);

Modified: projects/pnet/sys/net/netisr2.h
==============================================================================
--- projects/pnet/sys/net/netisr2.h	Wed May 27 22:15:54 2009	(r192935)
+++ projects/pnet/sys/net/netisr2.h	Wed May 27 22:23:16 2009	(r192936)
@@ -35,7 +35,7 @@
 
 /*-
  * Protocols express ordering constraints and affinity preferences by
- * implementing one or neither of nh_m2flow and nh_m2cpu, which are used by
+ * implementing one or neither of nh_m2flow and nh_m2cpuid, which are used by
  * netisr2 to determine which per-CPU workstream to assign mbufs to.
  *
  * The following policies may be used by protocols:
@@ -52,7 +52,7 @@
  *                      flow ID, falling back on source ordering.
  *
  * NETISR_POLICY_CPU - netisr2 will delegate all work placement decisions to
- *                     the protocol, querying nh_m2cpu for each packet.
+ *                     the protocol, querying nh_m2cpuid for each packet.
  *
  * Protocols might make decisions about work placement based on an existing
  * calculated flow ID on the mbuf, such as one provided in hardware, the
@@ -65,7 +65,7 @@
  * protocol handlers to notify them of CPU configuration changes so that they
  * can rebalance work.
  */
-typedef struct mbuf	*netisr_m2cpu_t(struct mbuf *m, uintptr_t source,
+typedef struct mbuf	*netisr_m2cpuid_t(struct mbuf *m, uintptr_t source,
 			 u_int *cpuid);
 typedef	struct mbuf	*netisr_m2flow_t(struct mbuf *m, uintptr_t source);
 
@@ -80,7 +80,7 @@ struct netisr_handler {
 	const char	*nh_name;	/* Character string protocol name. */
 	netisr_t	*nh_handler;	/* Protocol handler. */
 	netisr_m2flow_t	*nh_m2flow;	/* Query flow for untagged packet. */
-	netisr_m2cpu_t	*nh_m2cpu;	/* Query CPU to process packet on. */
+	netisr_m2cpuid_t *nh_m2cpuid;	/* Query CPU to process mbuf on. */
 	u_int		 nh_proto;	/* Integer protocol ID. */
 	u_int		 nh_qlimit;	/* Maximum per-CPU queue depth. */
 	u_int		 nh_policy;	/* Work placement policy. */


More information about the svn-src-projects mailing list