Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2015 18:40:51 +0000 (UTC)
From:      Hiren Panchasara <hiren@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r281161 - in stable/10: sys/netinet usr.bin/netstat
Message-ID:  <201504061840.t36Iep2j090462@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hiren
Date: Mon Apr  6 18:40:50 2015
New Revision: 281161
URL: https://svnweb.freebsd.org/changeset/base/281161

Log:
  MFC r266418, r266448
  
  Add the flowtype to the inpcb.
  Add -R to netstat to dump RSS/flow information.
  
  Reviewed by:	delphij
  Relnotes:	yes (for r266448)
  Sponsored by:	Limelight Networks

Modified:
  stable/10/sys/netinet/in_pcb.h
  stable/10/usr.bin/netstat/inet.c
  stable/10/usr.bin/netstat/main.c
  stable/10/usr.bin/netstat/netstat.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/in_pcb.h
==============================================================================
--- stable/10/sys/netinet/in_pcb.h	Mon Apr  6 18:03:35 2015	(r281160)
+++ stable/10/sys/netinet/in_pcb.h	Mon Apr  6 18:40:50 2015	(r281161)
@@ -180,7 +180,8 @@ struct inpcb {
 	uint32_t inp_flowid;		/* (x) flow id / queue id */
 	u_int	inp_refcount;		/* (i) refcount */
 	void	*inp_pspare[5];		/* (x) route caching / general use */
-	u_int	inp_ispare[6];		/* (x) route caching / user cookie /
+	uint32_t inp_flowtype;		/* (x) M_HASHTYPE value */
+	u_int	inp_ispare[5];		/* (x) route caching / user cookie /
 					 *     general use */
 
 	/* Local and foreign ports, local and foreign addr. */

Modified: stable/10/usr.bin/netstat/inet.c
==============================================================================
--- stable/10/usr.bin/netstat/inet.c	Mon Apr  6 18:03:35 2015	(r281160)
+++ stable/10/usr.bin/netstat/inet.c	Mon Apr  6 18:40:50 2015	(r281161)
@@ -429,7 +429,7 @@ protopr(u_long off, const char *name, in
 				       "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
 				       "Proto", "Recv-Q", "Send-Q",
 				       "Local Address", "Foreign Address");
-				if (!xflag)
+				if (!xflag && !Rflag)
 					printf(" (state)");
 			}
 			if (xflag) {
@@ -441,6 +441,9 @@ protopr(u_long off, const char *name, in
 				printf(" %7.7s %7.7s %7.7s %7.7s %7.7s %7.7s",
 				       "rexmt", "persist", "keep",
 				       "2msl", "delack", "rcvtime");
+			} else if (Rflag) {
+				printf ("  %8.8s %5.5s",
+				    "flowid", "ftype");
 			}
 			putchar('\n');
 			first = 0;
@@ -549,7 +552,7 @@ protopr(u_long off, const char *name, in
 				    timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
 				    timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
 		}
-		if (istcp && !Lflag && !xflag && !Tflag) {
+		if (istcp && !Lflag && !xflag && !Tflag && !Rflag) {
 			if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
 				printf("%d", tp->t_state);
 			else {
@@ -560,7 +563,12 @@ protopr(u_long off, const char *name, in
 					putchar('*');
 #endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
 			}
-		} 		
+		}
+		if (Rflag) {
+			printf(" %08x %5d",
+			    inp->inp_flowid,
+			    inp->inp_flowtype);
+		}
 		putchar('\n');
 	}
 	if (xig != oxig && xig->xig_gen != oxig->xig_gen) {

Modified: stable/10/usr.bin/netstat/main.c
==============================================================================
--- stable/10/usr.bin/netstat/main.c	Mon Apr  6 18:03:35 2015	(r281160)
+++ stable/10/usr.bin/netstat/main.c	Mon Apr  6 18:40:50 2015	(r281161)
@@ -326,6 +326,7 @@ int	numeric_port;	/* show ports numerica
 static int pflag;	/* show given protocol */
 int	Qflag;		/* show netisr information */
 int	rflag;		/* show routing tables (or routing stats) */
+int	Rflag;		/* show flow / RSS statistics */
 int	sflag;		/* show protocol statistics */
 int	Wflag;		/* wide display */
 int	Tflag;		/* TCP Information */
@@ -350,7 +351,7 @@ main(int argc, char *argv[])
 
 	af = AF_UNSPEC;
 
-	while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
+	while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:RrSTsuWw:xz"))
 	    != -1)
 		switch(ch) {
 		case '4':
@@ -468,6 +469,9 @@ main(int argc, char *argv[])
 		case 'r':
 			rflag = 1;
 			break;
+		case 'R':
+			Rflag = 1;
+			break;
 		case 's':
 			++sflag;
 			break;
@@ -864,7 +868,7 @@ static void
 usage(void)
 {
 	(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
-"usage: netstat [-46AaLnSTWx] [-f protocol_family | -p protocol]\n"
+"usage: netstat [-46AaLnRSTWx] [-f protocol_family | -p protocol]\n"
 "               [-M core] [-N system]",
 "       netstat -i | -I interface [-46abdhnW] [-f address_family]\n"
 "               [-M core] [-N system]",

Modified: stable/10/usr.bin/netstat/netstat.h
==============================================================================
--- stable/10/usr.bin/netstat/netstat.h	Mon Apr  6 18:03:35 2015	(r281160)
+++ stable/10/usr.bin/netstat/netstat.h	Mon Apr  6 18:40:50 2015	(r281161)
@@ -45,6 +45,7 @@ extern int	noutputs;	/* how much outputs
 extern int	numeric_addr;	/* show addresses numerically */
 extern int	numeric_port;	/* show ports numerically */
 extern int	rflag;	/* show routing tables (or routing stats) */
+extern int	Rflag;	/* show flowid / RSS information */
 extern int	sflag;	/* show protocol statistics */
 extern int	Tflag;  /* show TCP control block info */
 extern int	Wflag;	/* wide display */



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