PERFORCE change 111542 for review

Marko Zec zec at FreeBSD.org
Tue Dec 12 04:15:35 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=111542

Change 111542 by zec at zec_tca51 on 2006/12/12 12:10:03

	Virtualize igmpstat.

Affected files ...

.. //depot/projects/vimage/src/sys/netinet/igmp.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/vinet.h#5 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet/igmp.c#6 (text+ko) ====

@@ -81,10 +81,12 @@
 static struct router_info	*find_rti(struct ifnet *ifp);
 static void	igmp_sendpkt(struct in_multi *, int, unsigned long);
 
+#ifndef VIMAGE
 static struct igmpstat igmpstat;
+#endif
 
-SYSCTL_STRUCT(_net_inet_igmp, IGMPCTL_STATS, stats, CTLFLAG_RW, &igmpstat,
-    igmpstat, "");
+SYSCTL_V_STRUCT(V_NET, vnet_inet, _net_inet_igmp, IGMPCTL_STATS,
+    stats, CTLFLAG_RW, igmpstat, igmpstat, "");
 
 /*
  * igmp_mtx protects all mutable global variables in igmp.c, as well as the
@@ -197,7 +199,7 @@
 	int timer; /** timer value in the igmp query header **/
 	INIT_VNET_INET(ifp->if_vnetb);
 
-	++igmpstat.igps_rcv_total;
+	++V_igmpstat.igps_rcv_total;
 
 	ip = mtod(m, struct ip *);
 	igmplen = ip->ip_len;
@@ -206,14 +208,14 @@
 	 * Validate lengths.
 	 */
 	if (igmplen < IGMP_MINLEN) {
-		++igmpstat.igps_rcv_tooshort;
+		++V_igmpstat.igps_rcv_tooshort;
 		m_freem(m);
 		return;
 	}
 	minlen = iphlen + IGMP_MINLEN;
 	if ((m->m_flags & M_EXT || m->m_len < minlen) &&
 	    (m = m_pullup(m, minlen)) == 0) {
-		++igmpstat.igps_rcv_tooshort;
+		++V_igmpstat.igps_rcv_tooshort;
 		return;
 	}
 
@@ -224,7 +226,7 @@
 	m->m_len -= iphlen;
 	igmp = mtod(m, struct igmp *);
 	if (in_cksum(m, igmplen)) {
-		++igmpstat.igps_rcv_badsum;
+		++V_igmpstat.igps_rcv_badsum;
 		m_freem(m);
 		return;
 	}
@@ -249,7 +251,7 @@
 	 */
 	switch (igmp->igmp_type) {
 	case IGMP_MEMBERSHIP_QUERY:
-		++igmpstat.igps_rcv_queries;
+		++V_igmpstat.igps_rcv_queries;
 
 		if (ifp->if_flags & IFF_LOOPBACK)
 			break;
@@ -276,7 +278,7 @@
 
 			if (ip->ip_dst.s_addr != igmp_all_hosts_group ||
 			    igmp->igmp_group.s_addr != 0) {
-				++igmpstat.igps_rcv_badqueries;
+				++V_igmpstat.igps_rcv_badqueries;
 				m_freem(m);
 				return;
 			}
@@ -287,7 +289,7 @@
 			
 			if (igmp->igmp_group.s_addr != 0 &&
 			    !IN_MULTICAST(ntohl(igmp->igmp_group.s_addr))) {
-				++igmpstat.igps_rcv_badqueries;
+				++V_igmpstat.igps_rcv_badqueries;
 				m_freem(m);
 				return;
 			}
@@ -335,13 +337,13 @@
 		    ip->ip_src.s_addr == IA_SIN(ia)->sin_addr.s_addr)
 			break;
 
-		++igmpstat.igps_rcv_reports;
+		++V_igmpstat.igps_rcv_reports;
 
 		if (ifp->if_flags & IFF_LOOPBACK)
 			break;
 
 		if (!IN_MULTICAST(ntohl(igmp->igmp_group.s_addr))) {
-			++igmpstat.igps_rcv_badreports;
+			++V_igmpstat.igps_rcv_badreports;
 			m_freem(m);
 			return;
 		}
@@ -368,7 +370,7 @@
 		IN_LOOKUP_MULTI(igmp->igmp_group, ifp, inm);
 		if (inm != NULL) {
 			inm->inm_timer = 0;
-			++igmpstat.igps_rcv_ourreports;
+			++V_igmpstat.igps_rcv_ourreports;
 			inm->inm_state = IGMP_OTHERMEMBER;
 		}
 		IN_MULTI_UNLOCK();
@@ -530,5 +532,5 @@
 	 */
 	ip_output(m, router_alert, &igmprt, 0, &imo, NULL);
 
-	++igmpstat.igps_snd_reports;
+	++V_igmpstat.igps_snd_reports;
 }

==== //depot/projects/vimage/src/sys/netinet/vinet.h#5 (text+ko) ====

@@ -45,6 +45,7 @@
 #include <netinet/ip.h>
 #include <netinet/ip_icmp.h>
 #include <netinet/icmp_var.h>
+#include <netinet/igmp_var.h>
 #include <netinet/tcp.h>
 #include <netinet/tcp_var.h>
 #include <netinet/tcp_hostcache.h>
@@ -85,6 +86,7 @@
 
 	struct	icmpstat _icmpstat;
 	struct	ipstat _ipstat;
+	struct	igmpstat _igmpstat;
 
 	SLIST_HEAD(, router_info) _router_info_head;
 };
@@ -131,6 +133,7 @@
 
 #define V_icmpstat		VNET_INET(icmpstat)
 #define V_ipstat		VNET_INET(ipstat)
+#define V_igmpstat		VNET_INET(igmpstat)
 
 #define V_router_info_head	VNET_INET(router_info_head)
 


More information about the p4-projects mailing list