svn commit: r213909 - user/weongyo/usb/sys/dev/usb

Weongyo Jeong weongyo at FreeBSD.org
Sat Oct 16 01:35:15 UTC 2010


Author: weongyo
Date: Sat Oct 16 01:35:15 2010
New Revision: 213909
URL: http://svn.freebsd.org/changeset/base/213909

Log:
  Adds UIOCGSTATS.

Modified:
  user/weongyo/usb/sys/dev/usb/usb_pf.c
  user/weongyo/usb/sys/dev/usb/usb_pf.h

Modified: user/weongyo/usb/sys/dev/usb/usb_pf.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_pf.c	Fri Oct 15 23:34:31 2010	(r213908)
+++ user/weongyo/usb/sys/dev/usb/usb_pf.c	Sat Oct 16 01:35:15 2010	(r213909)
@@ -1213,6 +1213,19 @@ usbpf_ioctl(struct cdev *dev, u_long cmd
 			break;
 		}
 
+	/*
+	 * Get packet stats.
+	 */
+	case UIOCGSTATS:
+		{
+			struct usbpf_stat *us = (struct usbpf_stat *)addr;
+
+			/* XXXCSJP overflow */
+			us->us_recv = ud->ud_rcount;
+			us->us_drop = ud->ud_dcount;
+			break;
+		}
+
 	case UIOCVERSION:
 		{
 			struct usbpf_version *uv = (struct usbpf_version *)addr;

Modified: user/weongyo/usb/sys/dev/usb/usb_pf.h
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_pf.h	Fri Oct 15 23:34:31 2010	(r213908)
+++ user/weongyo/usb/sys/dev/usb/usb_pf.h	Sat Oct 16 01:35:15 2010	(r213909)
@@ -258,12 +258,21 @@ struct usbpf_program {
 	struct usbpf_insn	*uf_insns;
 };
 
+/*
+ * Struct returned by UIOCGSTATS.
+ */
+struct usbpf_stat {
+	u_int us_recv;		/* number of packets received */
+	u_int us_drop;		/* number of packets dropped */
+};
+
 #define	UIOCGBLEN	_IOR('U', 102, u_int)
 #define	UIOCSBLEN	_IOWR('U', 102, u_int)
 #define	UIOCSETF	_IOW('U', 103, struct usbpf_program)
 #define	UIOCSETIF	_IOW('U', 108, struct usbpf_ifreq)
 #define	UIOCSRTIMEOUT	_IOW('U', 109, struct timeval)
 #define	UIOCGRTIMEOUT	_IOR('U', 110, struct timeval)
+#define	UIOCGSTATS	_IOR('U', 111, struct usbpf_stat)
 #define	UIOCVERSION	_IOR('U', 113, struct usbpf_version)
 #define	UIOCSETWF	_IOW('U', 123, struct usbpf_program)
 


More information about the svn-src-user mailing list