svn commit: r326503 - in head/sys/dev: rtwn/usb usb

2017-12-03 Thread George V. Neville-Neil
Author: gnn
Date: Sun Dec  3 22:02:30 2017
New Revision: 326503
URL: https://svnweb.freebsd.org/changeset/base/326503

Log:
  Add support for RealTek 8812 over USB
  
  Tested with ALFA AWUS036ACH
  
  MFC after:1 week

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_attach.h
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/rtwn/usb/rtwn_usb_attach.h
==
--- head/sys/dev/rtwn/usb/rtwn_usb_attach.h Sun Dec  3 20:36:36 2017
(r326502)
+++ head/sys/dev/rtwn/usb/rtwn_usb_attach.h Sun Dec  3 22:02:30 2017
(r326503)
@@ -134,6 +134,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = {
RTWN_RTL8812AU_DEV(MELCO,   WIU3866D),
RTWN_RTL8812AU_DEV(NEC, WL900U),
RTWN_RTL8812AU_DEV(PLANEX2, GW900D),
+   RTWN_RTL8812AU_DEV(REALTEK, RTL8812AU),
RTWN_RTL8812AU_DEV(SENAO,   EUB1200AC),
RTWN_RTL8812AU_DEV(SITECOMEU,   WLA7100),
RTWN_RTL8812AU_DEV(TPLINK,  T4U),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSun Dec  3 20:36:36 2017(r326502)
+++ head/sys/dev/usb/usbdevsSun Dec  3 22:02:30 2017(r326503)
@@ -3886,6 +3886,7 @@ product REALTEK RTL8713   0x8713  RTL8713
 product REALTEK RTL8188CU_COMBO0x8754  RTL8188CU
 product REALTEK RTL8723BU  0xb720  RTL8723BU
 product REALTEK RTL8192SU  0xc512  RTL8192SU
+product REALTEK RTL8812AU  0x8812  RTL8812AU Wireless Adapter
 
 /* RedOctane products */
 product REDOCTANE DUMMY0x  Dummy product
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319803 - head/share/man/man4

2017-06-10 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jun 10 20:41:53 2017
New Revision: 319803
URL: https://svnweb.freebsd.org/changeset/base/319803

Log:
  Manual page for the DTrace lockstat provider
  
  Reviewed by:  markj
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D11128

Added:
  head/share/man/man4/dtrace_lockstat.4   (contents, props changed)

Added: head/share/man/man4/dtrace_lockstat.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/dtrace_lockstat.4   Sat Jun 10 20:41:53 2017
(r319803)
@@ -0,0 +1,251 @@
+.\" Copyright (c) 2017 George V. Neville-Neil 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 9, 2017
+.Dt DTRACE_LOCKSTAT 4
+.Os
+.Sh NAME
+.Nm dtrace_lockstat
+.Nd a DTrace provider for tracing CPU scheduling events
+.Sh SYNOPSIS
+.Fn lockstat:::adaptive-acquire "struct mtx *"
+.Fn lockstat:::adaptive-release "struct mtx *"
+.Fn lockstat:::adaptive-spin "struct mtx *" "uint64_t"
+.Fn lockstat:::adaptive-block "struct mtx *" "uint64_t"
+.Fn lockstat:::spin-acquire "struct mtx *"
+.Fn lockstat:::spin-release "struct mtx *"
+.Fn lockstat:::spin-spin "struct mtx *" "uint64_t"
+.Fn lockstat:::rw-acquire "struct rwlock *" "int"
+.Fn lockstat:::rw-release "struct rwlock *" "int"
+.Fn lockstat:::rw-block "struct rwlock *" "uint64_t" "int" "int" "int"
+.Fn lockstat:::rw-spin "struct rwlock *" "uint64_t"
+.Fn lockstat:::rw-upgrade "struct rwlock *"
+.Fn lockstat:::rw-downgrade "struct rwlock *"
+.Fn lockstat:::sx-acquire "struct sx *" "int"
+.Fn lockstat:::sx-release "struct sx *" "int"
+.Fn lockstat:::sx-block "struct sx *" "uint64_t" "int" "int" "int"
+.Fn lockstat:::sx-spin "struct sx *" "uint64_t"
+.Fn lockstat:::sx-upgrade "struct sx *"
+.Fn lockstat:::sx-downgrade "struct sx *"
+.Fn lockstat:::thread-spin "struct mtx *" "uint64"
+.Sh DESCRIPTION
+The DTrace
+.Nm lockstat
+provider allows the tracing of events related to locking on FreeBSD.
+.Pp
+The
+.Nm lockstat
+provider contains DTrace probe for inspecting the kernel's lock
+state transitions.
+Tracepoints exist for several types of kernel
+locking primitives, including mutexes, spin, reader-writer, 
+and shared exclusive locks.
+An attempt has been made to provide a regular and easy to understand
+interface to the
+.Nm lockstat
+provider.
+Each type of lock has an
+.Fn acquire
+and
+.Fn release
+probe which exposes the lock structure that is being operated upon.
+.Pp
+Whenever an MTX_DEF mutex is acquired the
+.Fn lockstat:::adaptive-acquire
+probe fires.
+The only argument is a pointer to the lock structure which describes
+the lock that is being acquired.
+.Pp
+The
+.Fn lockstat:::adaptive-release
+probe fires whenever an adaptive lock is released.
+The only argument is a pointer to the lock structure which describes
+the lock that is being released.
+.Pp
+The
+.Fn lockstat:::adaptive-spin
+probe fires when an adaptive lock is acquired.
+The first argument is a pointer to the lock structure that describes
+the lock and the second argument is the amount of time,
+in nanoseco

svn commit: r319804 - head/share/man/man4

2017-06-10 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jun 10 20:47:37 2017
New Revision: 319804
URL: https://svnweb.freebsd.org/changeset/base/319804

Log:
  Update Makefile to contain the new DTrace lockstat manual page.

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Jun 10 20:41:53 2017
(r319803)
+++ head/share/man/man4/MakefileSat Jun 10 20:47:37 2017
(r319804)
@@ -137,6 +137,7 @@ MAN=aac.4 \
ds3231.4 \
${_dtrace_io.4} \
${_dtrace_ip.4} \
+   ${_dtrace_lockstat.4} \
${_dtrace_proc.4} \
${_dtrace_sched.4} \
${_dtrace_tcp.4} \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319805 - head/share/man/man4

2017-06-10 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jun 10 20:50:50 2017
New Revision: 319805
URL: https://svnweb.freebsd.org/changeset/base/319805

Log:
  Update the variables as well.

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSat Jun 10 20:47:37 2017
(r319804)
+++ head/share/man/man4/MakefileSat Jun 10 20:50:50 2017
(r319805)
@@ -876,6 +876,7 @@ _ccd.4= ccd.4
 .if ${MK_CDDL} != "no"
 _dtrace_io.4=  dtrace_io.4
 _dtrace_ip.4=  dtrace_ip.4
+_dtrace_lockstat.4=dtrace_lockstat.4
 _dtrace_proc.4=dtrace_proc.4
 _dtrace_sched.4= dtrace_sched.4
 _dtrace_tcp.4= dtrace_tcp.4
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307541 - head/sys/netinet6

2016-10-17 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct 17 23:25:31 2016
New Revision: 307541
URL: https://svnweb.freebsd.org/changeset/base/307541

Log:
  Limit the number of mbufs that can be allocated for IPV6_2292PKTOPTIONS
  (and IPV6_PKTOPTIONS).
  
  PR:   100219
  Submitted by: Joseph Kong
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D5157

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Mon Oct 17 22:57:41 2016
(r307540)
+++ head/sys/netinet6/ip6_output.c  Mon Oct 17 23:25:31 2016
(r307541)
@@ -1393,6 +1393,15 @@ ip6_ctloutput(struct socket *so, struct 
int retval;
 #endif
 
+/*
+ * Don't use more than a quarter of mbuf clusters.  N.B.:
+ * nmbclusters is an int, but nmbclusters * MCLBYTES may overflow
+ * on LP64 architectures, so cast to u_long to avoid undefined
+ * behavior.  ILP32 architectures cannot have nmbclusters
+ * large enough to overflow for other reasons.
+ */
+#define IPV6_PKTOPTIONS_MBUF_LIMIT ((u_long)nmbclusters * MCLBYTES / 4)
+
level = sopt->sopt_level;
op = sopt->sopt_dir;
optname = sopt->sopt_name;
@@ -1448,6 +1457,12 @@ ip6_ctloutput(struct socket *so, struct 
{
struct mbuf *m;
 
+   if (optlen > IPV6_PKTOPTIONS_MBUF_LIMIT) {
+   printf("ip6_ctloutput: mbuf limit 
hit\n");
+   error = ENOBUFS;
+   break;
+   }
+
error = soopt_getm(sopt, &m); /* XXX */
if (error != 0)
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309069 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace

2016-11-23 Thread George V. Neville-Neil
Author: gnn
Date: Wed Nov 23 22:50:20 2016
New Revision: 309069
URL: https://svnweb.freebsd.org/changeset/base/309069

Log:
  Add tunable to disable destructive dtrace
  
  Submitted by: Joerg Pernfuss 
  Reviewed by:  rstone, markj
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D8624

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/dev/dtrace/dtrace_load.c
  head/sys/cddl/dev/dtrace/dtrace_sysctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cWed Nov 
23 20:21:53 2016(r309068)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cWed Nov 
23 22:50:20 2016(r309069)
@@ -157,6 +157,10 @@
  * /etc/system.
  */
 intdtrace_destructive_disallow = 0;
+#ifndef illumos
+/* Positive logic version of dtrace_destructive_disallow for loader tunable */
+intdtrace_allow_destructive = 1;
+#endif
 dtrace_optval_tdtrace_nonroot_maxsize = (16 * 1024 * 1024);
 size_t dtrace_difo_maxsize = (256 * 1024);
 dtrace_optval_tdtrace_dof_maxsize = (8 * 1024 * 1024);

Modified: head/sys/cddl/dev/dtrace/dtrace_load.c
==
--- head/sys/cddl/dev/dtrace/dtrace_load.c  Wed Nov 23 20:21:53 2016
(r309068)
+++ head/sys/cddl/dev/dtrace/dtrace_load.c  Wed Nov 23 22:50:20 2016
(r309069)
@@ -52,6 +52,17 @@ dtrace_load(void *dummy)
int i;
 #endif
 
+#ifndef illumos
+   /*
+* DTrace uses negative logic for the destructive mode switch, so it
+* is required to translate from the sysctl which uses positive logic.
+*/ 
+   if (dtrace_allow_destructive)
+   dtrace_destructive_disallow = 0;
+   else
+   dtrace_destructive_disallow = 1;
+#endif
+
/* Hook into the trap handler. */
dtrace_trap_func = dtrace_trap;
 

Modified: head/sys/cddl/dev/dtrace/dtrace_sysctl.c
==
--- head/sys/cddl/dev/dtrace/dtrace_sysctl.cWed Nov 23 20:21:53 2016
(r309068)
+++ head/sys/cddl/dev/dtrace/dtrace_sysctl.cWed Nov 23 22:50:20 2016
(r309069)
@@ -92,3 +92,6 @@ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_
 
 SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW,
 &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions");
+
+SYSCTL_INT(_security_bsd, OID_AUTO, allow_destructive_dtrace, CTLFLAG_RDTUN,
+&dtrace_allow_destructive, 1, "Allow destructive mode DTrace scripts");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309669 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2016-12-06 Thread George V. Neville-Neil
Author: gnn
Date: Wed Dec  7 07:27:47 2016
New Revision: 309669
URL: https://svnweb.freebsd.org/changeset/base/309669

Log:
  Fix a kernel panic in DTrace's rw_iswriter subroutine.
  On FreeBSD the sense of rw_write_held() and rw_iswriter() were reversed,
  probably due to a cut and paste error. Using rw_iswriter() would cause
  the kernel to panic.
  
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8718

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cWed Dec 
 7 06:57:08 2016(r309668)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cWed Dec 
 7 07:27:47 2016(r309669)
@@ -4391,8 +4391,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
break;
}
l.lx = dtrace_loadptr(tupregs[0].dttk_value);
-   LOCK_CLASS(l.li)->lc_owner(l.li, &lowner);
-   regs[rd] = (lowner == curthread);
+   regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) &&
+   lowner != NULL;
break;
 
case DIF_SUBR_RW_ISWRITER:
@@ -4403,8 +4403,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
break;
}
l.lx = dtrace_loadptr(tupregs[0].dttk_value);
-   regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, &lowner) &&
-   lowner != NULL;
+   LOCK_CLASS(l.li)->lc_owner(l.li, &lowner);
+   regs[rd] = (lowner == curthread);
break;
 #endif /* illumos */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309791 - head/sys/arm64/conf

2016-12-10 Thread George V. Neville-Neil
Author: gnn
Date: Sat Dec 10 10:00:27 2016
New Revision: 309791
URL: https://svnweb.freebsd.org/changeset/base/309791

Log:
  This adds a configuration for arm64 users that track CURRENT but
  don't need the extra debug facilities.  Copied from the amd64
  configuration of the same name.
  
  Submitted by: Nikolai Lifanov
  Reviewed by: emaste
  MFC after: 2 weeks

Added:
  head/sys/arm64/conf/GENERIC-NODEBUG
 - copied, changed from r309790, head/sys/amd64/conf/GENERIC-NODEBUG

Copied and modified: head/sys/arm64/conf/GENERIC-NODEBUG (from r309790, 
head/sys/amd64/conf/GENERIC-NODEBUG)
==
--- head/sys/amd64/conf/GENERIC-NODEBUG Sat Dec 10 09:10:48 2016
(r309790, copy source)
+++ head/sys/arm64/conf/GENERIC-NODEBUG Sat Dec 10 10:00:27 2016
(r309791)
@@ -1,6 +1,6 @@
 #
 # GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file 
-#   for FreeBSD/amd64
+#   for FreeBSD/arm64
 #
 # This configuration file removes several debugging options, including
 # WITNESS and INVARIANTS checking, which are known to have significant
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r350557 - head/sys/net

2019-08-03 Thread George V. Neville-Neil
Author: gnn
Date: Sat Aug  3 14:42:07 2019
New Revision: 350557
URL: https://svnweb.freebsd.org/changeset/base/350557

Log:
  Properly validte arguments for route deletion
  
  Reported by: Liang Zhuo brightiup.z...@gmail.com
  MFC after:1 week

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cSat Aug  3 13:53:14 2019(r350556)
+++ head/sys/net/route.cSat Aug  3 14:42:07 2019(r350557)
@@ -1590,6 +1590,8 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, stru
switch (req) {
case RTM_DELETE:
if (netmask) {
+   if (dst->sa_len > sizeof(mdst))
+   return (EINVAL);
rt_maskedcopy(dst, (struct sockaddr *)&mdst, netmask);
dst = (struct sockaddr *)&mdst;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367628 - head/sys/netinet

2020-11-12 Thread George V. Neville-Neil
Author: gnn
Date: Thu Nov 12 21:58:47 2020
New Revision: 367628
URL: https://svnweb.freebsd.org/changeset/base/367628

Log:
  An earlier commit effectively turned out the fast forwading path
  due to its lack of support for ICMP redirects. The following commit
  adds redirects to the fastforward path, again allowing for decent
  forwarding performance in the kernel.
  
  Reviewed by: ae, melifaro
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/netinet/ip_fastfwd.c
  head/sys/netinet/ip_input.c
  head/sys/netinet/ip_var.h

Modified: head/sys/netinet/ip_fastfwd.c
==
--- head/sys/netinet/ip_fastfwd.c   Thu Nov 12 20:22:58 2020
(r367627)
+++ head/sys/netinet/ip_fastfwd.c   Thu Nov 12 21:58:47 2020
(r367628)
@@ -111,6 +111,43 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#defineV_ipsendredirects   VNET(ipsendredirects)
+
+static struct mbuf *
+ip_redir_alloc(struct mbuf *m, struct nhop_object *nh,
+struct ip *ip, in_addr_t *addr)
+{
+   struct mbuf *mcopy = m_gethdr(M_NOWAIT, m->m_type);
+   if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) {
+   /*
+* It's probably ok if the pkthdr dup fails (because
+* the deep copy of the tag chain failed), but for now
+* be conservative and just discard the copy since
+* code below may some day want the tags.
+*/
+   m_free(mcopy);
+   return (NULL);
+   } 
+   mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy));
+   mcopy->m_pkthdr.len = mcopy->m_len;
+   m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t));
+   
+   if (nh != NULL &&
+   ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) {
+   struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa);
+   u_long src = ntohl(ip->ip_src.s_addr);
+   
+   if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == 
nh_ia->ia_subnet) {
+   if (nh->nh_flags & NHF_GATEWAY)
+   *addr = nh->gw4_sa.sin_addr.s_addr;
+   else
+   *addr = ip->ip_dst.s_addr;
+   }
+   }
+   return (mcopy);
+}
+
+
 static int
 ip_findroute(struct nhop_object **pnh, struct in_addr dest, struct mbuf *m)
 {
@@ -156,13 +193,14 @@ ip_tryforward(struct mbuf *m)
 {
struct ip *ip;
struct mbuf *m0 = NULL;
-   struct nhop_object *nh;
+   struct nhop_object *nh = NULL;
struct sockaddr_in dst;
struct in_addr dest, odest, rtdest;
uint16_t ip_len, ip_off;
int error = 0;
struct m_tag *fwd_tag = NULL;
-
+   struct mbuf *mcopy = NULL;
+   struct in_addr redest;
/*
 * Are we active and forwarding packets?
 */
@@ -387,6 +425,13 @@ passout:
dst.sin_addr = dest;
 
/*
+* Handle redirect case.
+*/
+   redest.s_addr = 0;
+   if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif))
+   mcopy = ip_redir_alloc(m, nh, ip, &redest.s_addr);
+
+   /*
 * Check if packet fits MTU or if hardware will fragment for us
 */
if (ip_len <= nh->nh_mtu) {
@@ -455,7 +500,16 @@ passout:
IPSTAT_INC(ips_forward);
IPSTAT_INC(ips_fastforward);
}
+
+   /* Send required redirect */
+   if (mcopy != NULL) {
+   icmp_error(mcopy, ICMP_REDIRECT, ICMP_REDIRECT_HOST, 
redest.s_addr, 0);
+   mcopy = NULL; /* Freed by caller */
+   }
+
 consumed:
+   if (mcopy != NULL)
+   m_freem(mcopy);
return NULL;
 drop:
if (m)

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Thu Nov 12 20:22:58 2020(r367627)
+++ head/sys/netinet/ip_input.c Thu Nov 12 21:58:47 2020(r367628)
@@ -111,8 +111,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDING, forwarding,
 &VNET_NAME(ipforwarding), 0,
 "Enable IP forwarding between interfaces");
 
-VNET_DEFINE_STATIC(int, ipsendredirects) = 1;  /* XXX */
-#defineV_ipsendredirects   VNET(ipsendredirects)
+/* 
+ * Respond with an ICMP host redirect when we forward a packet out of
+ * the same interface on which it was received.  See RFC 792.
+ */
+VNET_DEFINE(int, ipsendredirects) = 1;
 SYSCTL_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_VNET | 
CTLFLAG_RW,
 &VNET_NAME(ipsendredirects), 0,
 "Enable sending IP redirects");
@@ -571,7 +574,7 @@ tooshort:
 * case skip another inbound firewall processing and update
 * ip pointer.
 */
-   if (V_ipforwarding != 0 && V_ipsendredirects == 0
+   if (V_ipforwarding != 0
 #if defined(IPSEC) || defined(IPSEC_SUPPOR

svn commit: r367635 - head/sys/netinet

2020-11-13 Thread George V. Neville-Neil
Author: gnn
Date: Fri Nov 13 13:07:44 2020
New Revision: 367635
URL: https://svnweb.freebsd.org/changeset/base/367635

Log:
  Followup pointed out by ae@

Modified:
  head/sys/netinet/ip_fastfwd.c

Modified: head/sys/netinet/ip_fastfwd.c
==
--- head/sys/netinet/ip_fastfwd.c   Fri Nov 13 09:49:22 2020
(r367634)
+++ head/sys/netinet/ip_fastfwd.c   Fri Nov 13 13:07:44 2020
(r367635)
@@ -118,7 +118,11 @@ ip_redir_alloc(struct mbuf *m, struct nhop_object *nh,
 struct ip *ip, in_addr_t *addr)
 {
struct mbuf *mcopy = m_gethdr(M_NOWAIT, m->m_type);
-   if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) {
+
+   if (mcopy == NULL)
+   return (NULL);
+
+   if (m_dup_pkthdr(mcopy, m, M_NOWAIT) == 0) {
/*
 * It's probably ok if the pkthdr dup fails (because
 * the deep copy of the tag chain failed), but for now
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356913 - head/sys/dev/e1000

2020-01-20 Thread George V. Neville-Neil
Author: gnn
Date: Mon Jan 20 12:53:02 2020
New Revision: 356913
URL: https://svnweb.freebsd.org/changeset/base/356913

Log:
  Add support for latest Intel I219 device, supported in Lenovo Carbon X1 v7
  
  MFC after:2 weeks

Modified:
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/e1000_api.c
==
--- head/sys/dev/e1000/e1000_api.c  Mon Jan 20 12:16:32 2020
(r356912)
+++ head/sys/dev/e1000/e1000_api.c  Mon Jan 20 12:53:02 2020
(r356913)
@@ -319,6 +319,7 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
case E1000_DEV_ID_PCH_ICP_I219_V8:
case E1000_DEV_ID_PCH_ICP_I219_LM9:
case E1000_DEV_ID_PCH_ICP_I219_V9:
+   case E1000_DEV_ID_PCH_ICP_I219_V10:
mac->type = e1000_pch_cnp;
break;
case E1000_DEV_ID_82575EB_COPPER:

Modified: head/sys/dev/e1000/e1000_hw.h
==
--- head/sys/dev/e1000/e1000_hw.h   Mon Jan 20 12:16:32 2020
(r356912)
+++ head/sys/dev/e1000/e1000_hw.h   Mon Jan 20 12:53:02 2020
(r356913)
@@ -155,6 +155,7 @@ struct e1000_hw;
 #define E1000_DEV_ID_PCH_ICP_I219_V8   0x15E0
 #define E1000_DEV_ID_PCH_ICP_I219_LM9  0x15E1
 #define E1000_DEV_ID_PCH_ICP_I219_V9   0x15E2
+#define E1000_DEV_ID_PCH_ICP_I219_V10  0x0D4F
 #define E1000_DEV_ID_82576 0x10C9
 #define E1000_DEV_ID_82576_FIBER   0x10E6
 #define E1000_DEV_ID_82576_SERDES  0x10E7

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Mon Jan 20 12:16:32 2020(r356912)
+++ head/sys/dev/e1000/if_em.c  Mon Jan 20 12:53:02 2020(r356913)
@@ -174,6 +174,7 @@ static pci_vendor_info_t em_vendor_info_array[] =
PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_V8, "Intel(R) PRO/1000 Network 
Connection"),
PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_LM9, "Intel(R) PRO/1000 Network 
Connection"),
PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_V9, "Intel(R) PRO/1000 Network 
Connection"),
+   PVID(0x8086, E1000_DEV_ID_PCH_ICP_I219_V10, "Intel(R) PRO/1000 Network 
Connection"),
/* required last entry */
PVID_END
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324434 - in head/sys: dev/iwm modules/iwmfw/iwm8265fw

2017-10-09 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  9 15:48:56 2017
New Revision: 324434
URL: https://svnweb.freebsd.org/changeset/base/324434

Log:
  Add support for Intel 8265 WiFi
  
  Obtained from:OpenBSD
  MFC after:1 month

Added:
  head/sys/modules/iwmfw/iwm8265fw/
  head/sys/modules/iwmfw/iwm8265fw/Makefile   (contents, props changed)
Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_8000.c
  head/sys/dev/iwm/if_iwm_config.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Oct  9 15:39:43 2017(r324433)
+++ head/sys/dev/iwm/if_iwm.c   Mon Oct  9 15:48:56 2017(r324434)
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwm.c,v 1.42 2015/05/30 02:49:23 deraadt Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.167 2017/04/04 00:40:52 claudio Exp $*/
 
 /*
  * Copyright (c) 2014 genua mbh 
@@ -5690,6 +5690,7 @@ iwm_intr(void *arg)
 #definePCI_PRODUCT_INTEL_WL_7265_2 0x095b
 #definePCI_PRODUCT_INTEL_WL_8260_1 0x24f3
 #definePCI_PRODUCT_INTEL_WL_8260_2 0x24f4
+#definePCI_PRODUCT_INTEL_WL_8265_1 0x24fd
 
 static const struct iwm_devices {
uint16_tdevice;
@@ -5705,6 +5706,7 @@ static const struct iwm_devices {
{ PCI_PRODUCT_INTEL_WL_7265_2, &iwm7265_cfg },
{ PCI_PRODUCT_INTEL_WL_8260_1, &iwm8260_cfg },
{ PCI_PRODUCT_INTEL_WL_8260_2, &iwm8260_cfg },
+   { PCI_PRODUCT_INTEL_WL_8265_1, &iwm8265_cfg },
 };
 
 static int

Modified: head/sys/dev/iwm/if_iwm_8000.c
==
--- head/sys/dev/iwm/if_iwm_8000.c  Mon Oct  9 15:39:43 2017
(r324433)
+++ head/sys/dev/iwm/if_iwm_8000.c  Mon Oct  9 15:48:56 2017
(r324434)
@@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$");
 #include "if_iwm_config.h"
 
 #define IWM8000_FW "iwm8000Cfw"
+#define IWM8265_FW "iwm8265fw"
 
 #define IWM_NVM_HW_SECTION_NUM_FAMILY_8000 10
 
@@ -90,6 +91,13 @@ __FBSDID("$FreeBSD$");
 const struct iwm_cfg iwm8260_cfg = {
.name = "Intel(R) Dual Band Wireless AC 8260",
.fw_name = IWM8000_FW,
+   IWM_DEVICE_8000_COMMON,
+   .host_interrupt_operation_mode = 0,
+};
+
+const struct iwm_cfg iwm8265_cfg = {
+   .name = "Intel(R) Dual Band Wireless AC 8265",
+   .fw_name = IWM8265_FW,
IWM_DEVICE_8000_COMMON,
.host_interrupt_operation_mode = 0,
 };

Modified: head/sys/dev/iwm/if_iwm_config.h
==
--- head/sys/dev/iwm/if_iwm_config.hMon Oct  9 15:39:43 2017
(r324433)
+++ head/sys/dev/iwm/if_iwm_config.hMon Oct  9 15:48:56 2017
(r324434)
@@ -131,5 +131,6 @@ extern const struct iwm_cfg iwm3165_cfg;
 extern const struct iwm_cfg iwm7265_cfg;
 extern const struct iwm_cfg iwm7265d_cfg;
 extern const struct iwm_cfg iwm8260_cfg;
+extern const struct iwm_cfg iwm8265_cfg;
 
 #endif /* __IWM_CONFIG_H__ */

Added: head/sys/modules/iwmfw/iwm8265fw/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/iwmfw/iwm8265fw/Makefile   Mon Oct  9 15:48:56 2017
(r324434)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+KMOD=  iwm8265fw
+IMG=   iwm-8265-22
+
+.include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324435 - head/sys/contrib/dev/iwm

2017-10-09 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  9 15:54:57 2017
New Revision: 324435
URL: https://svnweb.freebsd.org/changeset/base/324435

Log:
  Add the firmware for the Intel 8265 WiFi device.
  
  MFC after:1 month

Added:
  head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu

Added: head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/contrib/dev/iwm/iwm-8265-22.fw.uu  Mon Oct  9 15:54:57 2017
(r324435)
@@ -0,0 +1,40270 @@
+begin 644 iwm-8265-22.fw
+M`$E73`IS=')E86TZ0V]R94-Y8VQE,3E?"`$`'@@"
+MCWX#`!P0`!L$`@```#,,
+M@```@`$`,PP!``"(``"S#`(`
+M`$```(`&`!,```"\`@```$!```8```"A```!``"&@P<6
+M(`#/`0!`0`$$A`4`
+M
+MU7?1O$KMC1P!%L)AM`1@'DT[FA#1
+MOWMZR()DJ-L;GQEBIN9H[A^ZS%KH6MG.(:=CV\&$V<0:'I[5@L7;]O#+S6])Q;OTUZ`
+M@Q9O#\ZQZUROU1XL3>@GIX0A'ZLQS3.]EM]`#)-:.@LH#44.K^C\7[\`!P3D
+MY4F9W;8[]70ZRI8T>H?6RDCG3OM
+M8]KY^9H/)$3]O$5[L'!Q8_7B]),MEL2SE/;3@!]'*Q0B!J
+MSTEZ*8)Z!0@S6DLP1!FVOW/)J9&S#<5HT&$4S<7=^@(C/O$<4EJ.EO9XL_%E
+MT>4]#<7,[9G60.1^$&L="\AYAH+6D>M<"8*SB6+Z(O@K2S"E-V&#A#J=*)YQ
+M?A=_2W+\0QR``+XRI7=42EPB2)(!`2I!$9U:;0F'*M._3+OF[>!&+"-+#-'H
+M\PZ#!\0+`..6,0`#S%^8W8&G25#,,I>V=BW:]"V:&%%;OYJG`P<(
+M@`$```"```"``0`'"``%``4`!P```%"Y@$0`2+D``!,`
+M```$@`$```"6!(0%```!S-:``"0H@`!`_(``Q/.`
+M`)04@`"`<($`;"#`$`\;"2+<'<`0
+M"@`;0"``&VX,``!A@``;;D```&$``1MN4P``80`"&VYC``!A``0;;GX``&$0
+M`!MN`0``88```&%[``!A```;)"``&R7D'<`12`GA&!\`"&(``!LE`0`;)```
+M!24!``4D``@%.0$`!6*((,`1`@`%)``(!3D!``5BC"#`$00`!20`"`4Y`0`%
+M8I`@P!$(``4D``@%.0$`!6*4(,`1$``%)``(!3D!``5BF"#`$2``!20`"`4Y
+M`0`%8IP@P!%```4D``@%.0$`!6*@(,`1```()0``""1(">$91`GA&10)P!(!
+M`!MP"@``80\<'2($`!TF)`G`$@$;(R+H'<`0`0`C<`$``&$1`!LP`0`;,.@=
+MP!&Z#P!A```;)(``&R7D'<`1"`!?<`D``&'0",`2``D;*,P(@($``,`7U`C`
+M$@`)&RC("("!``#`%ZP/`&',",`2X`B`@0``P!?(",`2W`B`@0``P!>E#P!A
+M```;)``!&R7D'<`1"`!?<*`/`&$```4EX@0%)-0(P!(`"1LH``4;*=P(@($`
+M`,`7T`C`$@`)&R@`!1LIX`B`@0``P!>3#P!A```;)``"&R7D'<`1"`!?<`P`
+M`&'L'\`0__\;,^P?P!'.[@TE@ID-)`\--R)L(,`0#QLW(O__#24._PTD#PTW
+M(H(/`&'L'\`0```;,>P?P!'.[@TE@ID-)`\--R)L(,`0#QLW(O__#26._PTD
+M#PTW(G8/`&$```!A```;)2``&R1<',`18=P=P!```!TD(0$`6#'.
+M[@TE`8$-)`\--R(/1#$7`$`$`$W`,``!A"`!8,-@>P!`*`!-``@`3;@0`
+M`&$!``@D```()40)X1D!``!A`(!8,`@`9#$```!A"`!8;N,/`&$``!,E```3
+M)"00P!$`@!,D```3)3@!,B
+M``#&$0,``20```$E#T4`(@!<`#GO_P`R%P``9`"`$R0!`!,E.!S`$0]W$R+@
+M',`1`@`!8@\!$R($",`1?`S`$LA)QQ&0"\`2`0`!;@,`$S`,`,T1"`!8,0\4
+M%2($`!4F`P`3)```$R4$",`1```3)#A%P!$%``!A``!8.`0`6#$``!,D`0`3
+M)3@P!`*`!-``@`3;@0``&$!``@D```()40)X1D$``!A`(!8
+M,`(``&$`(%@P8>@=P!#F_Q,R__\3,^@=P!$```$D"``!)0\!8R(!`%(D
+M"``';@(``&$``!4D#P``80X``&'H'<`0^^K=[OOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^
+MK=[OOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=X`
+M
+M`-`'
+M``$!`0$!`0$!O1\``&,N``#_
+M```(```!
+M`0``
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M
+M```S,```$1``
+M``HH
+M
+M
+M
+M
+M
+M`$0`@"0H+#`T.```
+M`#P```!`1$@```!,4%0```!87&!D
+M:&P```!P='@```!\@(0```"(C)"5
+MF0```)T```"AI0```*D```"ML0```"HZ2@```%H`
+M``!J>@```(H```";JP($!@,+$P``
+M`!LC*P```#,Z0@$`!`4`
+M`/\```#^`0```O\```/_``$`_P$``0(!`@+_`@#_`P(`_@0"
+M``/_"

svn commit: r221167 - in head: share/man/man4 sys/conf sys/dev/vxge sys/dev/vxge/include sys/dev/vxge/vxgehal sys/modules/vxge

2011-04-28 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr 28 14:33:15 2011
New Revision: 221167
URL: http://svn.freebsd.org/changeset/base/221167

Log:
  Exar driver for X3100 10GbE Server/Storage adapters
  
  Features: Jumbo frames (up to 9600), LRO (Large Receive Offload),
TSO (TCP segmentation offload), RTH (Receive Traffic Hash).
  
  Submitted by: Sriram Rapuru at Exar
  MFC after:2 weeks

Added:
  head/share/man/man4/vxge.4   (contents, props changed)
  head/sys/dev/vxge/
  head/sys/dev/vxge/LICENSE   (contents, props changed)
  head/sys/dev/vxge/README   (contents, props changed)
  head/sys/dev/vxge/include/
  head/sys/dev/vxge/include/build-version.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-debug.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-defs.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-list.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-os-debug.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-os-pal.h   (contents, props changed)
  head/sys/dev/vxge/include/vxge-queue.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-config.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-ll.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-mgmt.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-mgmtaux.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-stats.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-status.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-types.h   (contents, props changed)
  head/sys/dev/vxge/include/vxgehal-version.h   (contents, props changed)
  head/sys/dev/vxge/vxge-firmware.h   (contents, props changed)
  head/sys/dev/vxge/vxge-osdep.h   (contents, props changed)
  head/sys/dev/vxge/vxge.c   (contents, props changed)
  head/sys/dev/vxge/vxge.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/
  head/sys/dev/vxge/vxgehal/vxge-queue.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-blockpool.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-blockpool.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-channel.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-channel.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-common-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-config-priv.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-config.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-debug.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-device.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-device.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-doorbells.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-doorbells.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-driver.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-driver.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-fifo.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-fifo.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-ifmsg.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-ifmsg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-legacy-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-memrepair-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mgmt.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mgmtaux.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mm.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mm.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mrpcim-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mrpcim.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-mrpcim.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-pcicfgmgmt-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-regdefs.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-regs.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-ring.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-ring.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-srpcim-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-srpcim.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-srpcim.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-swapper.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-swapper.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-toc-reg.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-virtualpath.c   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vxgehal-virtualpath.h   (contents, props changed)
  head/sys/dev/vxge/vxgehal/vx

svn commit: r221175 - in head/tools/tools: . vxge

2011-04-28 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr 28 16:29:19 2011
New Revision: 221175
URL: http://svn.freebsd.org/changeset/base/221175

Log:
  A diagnostic tool to go along with the vxge(4) 10GbE driver.
  This tool can be used to print statistics, registers, and
  other device specific information once the driver is loaded
  into the kernel.
  
  Submitted by: Sriram Rapuru from Exar
  MFC after:2 weeks

Added:
  head/tools/tools/vxge/
  head/tools/tools/vxge/Makefile   (contents, props changed)
  head/tools/tools/vxge/vxge_cmn.h   (contents, props changed)
  head/tools/tools/vxge/vxge_info.c   (contents, props changed)
  head/tools/tools/vxge/vxge_info.h   (contents, props changed)
  head/tools/tools/vxge/vxge_log.c   (contents, props changed)
  head/tools/tools/vxge/vxge_log.h   (contents, props changed)
Modified:
  head/tools/tools/README

Modified: head/tools/tools/README
==
--- head/tools/tools/README Thu Apr 28 16:18:30 2011(r221174)
+++ head/tools/tools/README Thu Apr 28 16:29:19 2011(r221175)
@@ -66,4 +66,5 @@ vimageAn interim utility for managing 
stack infrastructure.
 vop_table  Generates a HTML document that shows all the VOP's in
the kernel.
+vxge   A diagnostic tool for the vxge(4) driver
 whereintheworldSummarizes "make world" output.

Added: head/tools/tools/vxge/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/vxge/Makefile  Thu Apr 28 16:29:19 2011
(r221175)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+PROG= vxge-manage
+SRCS= vxge_info.c vxge_log.c
+NO_MAN=
+ 
+.include 

Added: head/tools/tools/vxge/vxge_cmn.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/vxge/vxge_cmn.hThu Apr 28 16:29:19 2011
(r221175)
@@ -0,0 +1,260 @@
+/*-
+ * Copyright(c) 2002-2011 Exar Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification are permitted provided the following conditions are met:
+ *
+ *1. Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ *
+ *2. Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ *3. Neither the name of the Exar Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*$FreeBSD$*/
+
+#ifndef_VXGE_CMN_H_
+#define_VXGE_CMN_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#if BYTE_ORDER == BIG_ENDIAN
+#defineVXGE_OS_HOST_BIG_ENDIAN
+#else
+#defineVXGE_OS_HOST_LITTLE_ENDIAN
+#endif
+
+#if defined(VXGE_OS_HOST_BIG_ENDIAN)
+
+#defineGET_OFFSET_STATS(index) statsInfo[(index)].be_offset
+#defineGET_OFFSET_PCICONF(index)   pciconfInfo[(index)].be_offset
+
+#else
+
+#defineGET_OFFSET_STATS(index) statsInfo[(index)].le_offset
+#defineGET_OFFSET_PCICONF(index)   pciconfInfo[(index)].le_offset
+
+#endif
+
+#definevxge_mem_free(x)\
+   if (NULL != x) { free(x); x = NULL; }
+
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef unsigned long long u64;
+typedef u_long ulong_t;
+
+typedef enum _vxge_query_device_info_e {
+
+   VXGE_GET_PCI_CONF = 100,
+   VXGE_GET_MRPCIM_STATS = 101,
+   VXGE_GET_DEVICE_STATS = 102,
+   VXGE_GET_DEVICE_HWINFO = 103,
+   VXGE_GET_DRIVER_STATS = 104,
+   VXGE_GET_INTR_STATS = 105,
+   VXGE_GET_VERSION = 106,
+   VXGE_GET_TCODE = 107,
+   VXGE_GET_VPATH_CO

svn commit: r221389 - in head/sys/dev/vxge: . include

2011-05-03 Thread George V. Neville-Neil
Author: gnn
Date: Tue May  3 15:58:24 2011
New Revision: 221389
URL: http://svn.freebsd.org/changeset/base/221389

Log:
  Add in support for multicast.
  
  Submitted by: Sriram Rapuru at @ Wipro for Exar Inc.
  MFC after:2 weeks

Modified:
  head/sys/dev/vxge/include/build-version.h
  head/sys/dev/vxge/vxge.c
  head/sys/dev/vxge/vxge.h

Modified: head/sys/dev/vxge/include/build-version.h
==
--- head/sys/dev/vxge/include/build-version.h   Tue May  3 15:50:22 2011
(r221388)
+++ head/sys/dev/vxge/include/build-version.h   Tue May  3 15:58:24 2011
(r221389)
@@ -3,5 +3,5 @@
 #ifndefBUILD_VERSION_H
 #defineBUILD_VERSION_H
 /* Do not edit! Automatically generated when released. */
-#defineGENERATED_BUILD_VERSION 22708
+#defineGENERATED_BUILD_VERSION 22770
 #endif /* BUILD_VERSION_H */

Modified: head/sys/dev/vxge/vxge.c
==
--- head/sys/dev/vxge/vxge.cTue May  3 15:50:22 2011(r221388)
+++ head/sys/dev/vxge/vxge.cTue May  3 15:58:24 2011(r221389)
@@ -357,6 +357,9 @@ vxge_init_locked(vxge_dev_t *vdev)
if (!vpath_handle)
continue;
 
+   /* Enabling mcast for all vpath */
+   vxge_hal_vpath_mcast_enable(vpath_handle);
+
/* Enabling bcast for all vpath */
status = vxge_hal_vpath_bcast_enable(vpath_handle);
if (status != VXGE_HAL_OK)
@@ -2879,26 +2882,6 @@ vxge_promisc_set(vxge_dev_t *vdev)
 
ifp = vdev->ifp;
 
-   if ((ifp->if_flags & IFF_ALLMULTI) && (!vdev->all_multi_flag)) {
-   for (i = 0; i < vdev->no_of_vpath; i++) {
-   vpath_handle = vxge_vpath_handle_get(vdev, i);
-   if (!vpath_handle)
-   continue;
-
-   vxge_hal_vpath_mcast_enable(vpath_handle);
-   vdev->all_multi_flag = 1;
-   }
-
-   } else if (!(ifp->if_flags & IFF_ALLMULTI) && (vdev->all_multi_flag)) {
-   for (i = 0; i < vdev->no_of_vpath; i++) {
-   vpath_handle = vxge_vpath_handle_get(vdev, i);
-   if (!vpath_handle)
-   continue;
-
-   vxge_hal_vpath_mcast_disable(vpath_handle);
-   vdev->all_multi_flag = 0;
-   }
-   }
for (i = 0; i < vdev->no_of_vpath; i++) {
vpath_handle = vxge_vpath_handle_get(vdev, i);
if (!vpath_handle)

Modified: head/sys/dev/vxge/vxge.h
==
--- head/sys/dev/vxge/vxge.hTue May  3 15:50:22 2011(r221388)
+++ head/sys/dev/vxge/vxge.hTue May  3 15:58:24 2011(r221389)
@@ -406,7 +406,6 @@ struct vxge_dev_t {
int no_of_vpath;
u64 active_port;
u32 no_of_func;
-   u32 all_multi_flag;
u32 hw_fw_version;
u32 max_supported_vpath;
int rx_mbuf_sz;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r221391 - head/tools/tools/vxge

2011-05-03 Thread George V. Neville-Neil
Author: gnn
Date: Tue May  3 16:00:36 2011
New Revision: 221391
URL: http://svn.freebsd.org/changeset/base/221391

Log:
  Give some sort of message when the program is not run as root.
  Root privileges are required to talk to the device.
  
  Submitted by: Sriram Rapuru at Wipro for Exar Inc.
  MFC after:2 weeks

Modified:
  head/tools/tools/vxge/vxge_info.c

Modified: head/tools/tools/vxge/vxge_info.c
==
--- head/tools/tools/vxge/vxge_info.c   Tue May  3 16:00:26 2011
(r221390)
+++ head/tools/tools/vxge/vxge_info.c   Tue May  3 16:00:36 2011
(r221391)
@@ -31,6 +31,7 @@
 /*$FreeBSD$*/
 
 #include "vxge_info.h"
+#include 
 
 static int sockfd;
 static struct ifreq ifr;
@@ -38,6 +39,15 @@ static struct ifreq ifr;
 int
 main(int argc, char *argv[])
 {
+   uid_t uid;
+   
+   uid = getuid();
+
+   if (uid) {
+   printf("vxge-manage: Operation not permitted.\nExiting...\n");
+   goto _exit0;
+   }
+
if (argc >= 4) {
if (!((strcasecmp(argv[2], "regs") == 0) ||
(strcasecmp(argv[2], "stats") == 0) ||
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r209241 - head/sys/dev/e1000

2010-06-16 Thread George V. Neville-Neil
Author: gnn
Date: Wed Jun 16 17:36:53 2010
New Revision: 209241
URL: http://svn.freebsd.org/changeset/base/209241

Log:
  Move statistics into the sysctl tree making it easier to find
  and use them.
  Add previously hidden statistics, some of which include interrupt
  and host/card communication counters.

Modified:
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_igb.h

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Wed Jun 16 16:52:35 2010(r209240)
+++ head/sys/dev/e1000/if_igb.c Wed Jun 16 17:36:53 2010(r209241)
@@ -212,7 +212,6 @@ static bool igb_tso_setup(struct tx_ring
 static voidigb_set_promisc(struct adapter *);
 static voidigb_disable_promisc(struct adapter *);
 static voidigb_set_multi(struct adapter *);
-static voidigb_print_hw_stats(struct adapter *);
 static voidigb_update_link_status(struct adapter *);
 static voidigb_refresh_mbufs(struct rx_ring *, int);
 
@@ -224,11 +223,10 @@ static intigb_xmit(struct tx_ring *, st
 static int igb_dma_malloc(struct adapter *, bus_size_t,
struct igb_dma_alloc *, int);
 static voidigb_dma_free(struct adapter *, struct igb_dma_alloc *);
-static voidigb_print_debug_info(struct adapter *);
+static int igb_sysctl_nvm_info(SYSCTL_HANDLER_ARGS);
 static voidigb_print_nvm_info(struct adapter *);
 static int igb_is_valid_ether_addr(u8 *);
-static int igb_sysctl_stats(SYSCTL_HANDLER_ARGS);
-static int igb_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
+static void igb_add_hw_stats(struct adapter *adapter);
 /* Management and WOL Support */
 static voidigb_init_manageability(struct adapter *);
 static voidigb_release_manageability(struct adapter *);
@@ -411,13 +409,8 @@ igb_attach(device_t dev)
/* SYSCTL stuff */
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-   OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-   igb_sysctl_debug_info, "I", "Debug Information");
-
-   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-   OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-   igb_sysctl_stats, "I", "Statistics");
+   OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+   igb_sysctl_nvm_info, "I", "NVM Information");
 
SYSCTL_ADD_INT(device_get_sysctl_ctx(adapter->dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)),
@@ -583,6 +576,8 @@ igb_attach(device_t dev)
adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
 igb_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST);
 
+   igb_add_hw_stats(adapter);
+
/* Tell the stack that the interface is not active */
adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 
@@ -1881,7 +1876,6 @@ static void
 igb_local_timer(void *arg)
 {
struct adapter  *adapter = arg;
-   struct ifnet*ifp = adapter->ifp;
device_tdev = adapter->dev;
struct tx_ring  *txr = adapter->tx_rings;
 
@@ -1891,9 +1885,6 @@ igb_local_timer(void *arg)
igb_update_link_status(adapter);
igb_update_stats_counters(adapter);
 
-   if (igb_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING)
-   igb_print_hw_stats(adapter);
-
 /*
 ** Watchdog: check for time since any descriptor was cleaned
 */
@@ -4741,8 +4732,10 @@ igb_update_stats_counters(struct adapter
/* For the 64-bit byte counters the low dword must be read first. */
/* Both registers clear on the read of the high dword */
 
-   adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCH);
-   adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCH);
+   adapter->stats.gorc += E1000_READ_REG(&adapter->hw, E1000_GORCL) +
+ ((u64)E1000_READ_REG(&adapter->hw, E1000_GORCH) << 32);
+   adapter->stats.gotc += E1000_READ_REG(&adapter->hw, E1000_GOTCL) +
+ ((u64)E1000_READ_REG(&adapter->hw, E1000_GOTCH) << 32) ;
 
adapter->stats.rnbc += E1000_READ_REG(&adapter->hw, E1000_RNBC);
adapter->stats.ruc += E1000_READ_REG(&adapter->hw, E1000_RUC);
@@ -4764,6 +4757,38 @@ igb_update_stats_counters(struct adapter
adapter->stats.mptc += E1000_READ_REG(&adapter->hw, E1000_MPTC);
adapter->stats.bptc += E1000_READ_REG(&adapter->hw, E1000_BPTC);
 
+   /* Interrupt Counts */
+
+   adapter->stats.iac += E1000_READ_REG(&adapter->hw, E1000_IAC);
+   adapter->stats.icrxptc += E1000_READ_REG(&adapter->hw, E1000_ICRXPTC);
+   adapter->stats.icrxatc += E1000_READ_REG(&adapter->hw, E1000_ICRXATC);
+   adapter->stats.ictxptc += E1000_READ_REG(&adapter->hw, E1000_ICTXPTC);
+   adapter->stats.ictxatc += E1000_READ_REG

svn commit: r209242 - head/sys/dev/e1000

2010-06-16 Thread George V. Neville-Neil
Author: gnn
Date: Wed Jun 16 20:57:41 2010
New Revision: 209242
URL: http://svn.freebsd.org/changeset/base/209242

Log:
  Move statistics into the sysctl tree making it easier to find
  and use them.
  Add previously hidden statistics, some of which include interrupt
  and host/card communication counters.

Modified:
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Wed Jun 16 17:36:53 2010(r209241)
+++ head/sys/dev/e1000/if_em.c  Wed Jun 16 20:57:41 2010(r209242)
@@ -230,6 +230,7 @@ static void em_free_receive_buffers(stru
 static voidem_enable_intr(struct adapter *);
 static voidem_disable_intr(struct adapter *);
 static voidem_update_stats_counters(struct adapter *);
+static voidem_add_hw_stats(struct adapter *adapter);
 static boolem_txeof(struct tx_ring *);
 static boolem_rxeof(struct rx_ring *, int, int *);
 #ifndef __NO_STRICT_ALIGNMENT
@@ -242,7 +243,6 @@ static bool em_tso_setup(struct tx_ring 
 static voidem_set_promisc(struct adapter *);
 static voidem_disable_promisc(struct adapter *);
 static voidem_set_multi(struct adapter *);
-static voidem_print_hw_stats(struct adapter *);
 static voidem_update_link_status(struct adapter *);
 static voidem_refresh_mbufs(struct rx_ring *, int);
 static voidem_register_vlan(void *, struct ifnet *, u16);
@@ -252,11 +252,9 @@ static int em_xmit(struct tx_ring *, str
 static int em_dma_malloc(struct adapter *, bus_size_t,
struct em_dma_alloc *, int);
 static voidem_dma_free(struct adapter *, struct em_dma_alloc *);
-static voidem_print_debug_info(struct adapter *);
+static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS);
 static voidem_print_nvm_info(struct adapter *);
 static int em_is_valid_ether_addr(u8 *);
-static int em_sysctl_stats(SYSCTL_HANDLER_ARGS);
-static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS);
 static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS);
 static voidem_add_int_delay_sysctl(struct adapter *, const char *,
const char *, struct em_int_delay_info *, int, int);
@@ -452,13 +450,8 @@ em_attach(device_t dev)
/* SYSCTL stuff */
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-   OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-   em_sysctl_debug_info, "I", "Debug Information");
-
-   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
-   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
-   OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-   em_sysctl_stats, "I", "Statistics");
+   OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+   em_sysctl_nvm_info, "I", "NVM Information");
 
callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0);
 
@@ -656,6 +649,8 @@ em_attach(device_t dev)
adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
em_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); 
 
+   em_add_hw_stats(adapter);
+
/* Non-AMT based hardware can now take control from firmware */
if (adapter->has_manage && !adapter->has_amt)
em_get_hw_control(adapter);
@@ -2068,9 +2063,6 @@ em_local_timer(void *arg)
if (e1000_get_laa_state_82571(&adapter->hw) == TRUE)
e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
 
-   if (em_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING)
-   em_print_hw_stats(adapter);
-
/*
** Check for time since any descriptor was cleaned
*/
@@ -4867,114 +4859,291 @@ em_update_stats_counters(struct adapter 
 }
 
 
-/**
- *
- *  This routine is called only when em_display_debug_stats is enabled.
- *  This routine provides a way to take a look at important statistics
- *  maintained by the driver and hardware.
- *
- **/
+/*
+ * Add sysctl variables, one per statistic, to the system.
+ */
 static void
-em_print_debug_info(struct adapter *adapter)
+em_add_hw_stats(struct adapter *adapter)
 {
+
device_t dev = adapter->dev;
-   u8 *hw_addr = adapter->hw.hw_addr;
-   struct rx_ring *rxr = adapter->rx_rings;
-   struct tx_ring *txr = adapter->tx_rings;
 
-   device_printf(dev, "Adapter hardware address = %p \n", hw_addr);
-   device_printf(dev, "CTRL = 0x%x RCTL = 0x%x \n",
-   E1000_READ_REG(&adapter->hw, E1000_CTRL),
-   E1000_READ_REG(&adapter->hw, E1000_RCTL));
-   device_printf(dev, "Packet buffer = Tx=%dk Rx=%dk \n",
-   ((E1000_READ_REG(&adapter->hw, E1000_PBA) & 0x) >> 16),\
-   (E1000_READ_REG(&adapter->hw, E1000_PBA) & 0x) );
-   device_printf(dev, "Flow control water

svn commit: r209512 - head/sys/dev/e1000

2010-06-24 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jun 24 21:17:58 2010
New Revision: 209512
URL: http://svn.freebsd.org/changeset/base/209512

Log:
  Make sure that all the exposed counters and variables are actually
  being updated.
  
  Pointed out by:   jfv

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Thu Jun 24 17:53:25 2010(r209511)
+++ head/sys/dev/e1000/if_igb.c Thu Jun 24 21:17:58 2010(r209512)
@@ -4814,6 +4814,18 @@ igb_update_stats_counters(struct adapter
/* Tx Errors */
ifp->if_oerrors = adapter->stats.ecol +
adapter->stats.latecol + adapter->watchdog_events;
+
+   /* Driver specific counters */
+   adapter->device_control = E1000_READ_REG(&adapter->hw, E1000_CTRL);
+   adapter->rx_control = E1000_READ_REG(&adapter->hw, E1000_RCTL);
+   adapter->int_mask = E1000_READ_REG(&adapter->hw, E1000_IMS);
+   adapter->eint_mask = E1000_READ_REG(&adapter->hw, E1000_EIMS);
+   adapter->packet_buf_alloc_tx = ((E1000_READ_REG(&adapter->hw, E1000_PBA)
+   & 0x) >> 16);
+
+   adapter->packet_buf_alloc_rx = (E1000_READ_REG(&adapter->hw, E1000_PBA) 
+   & 0x);
+
 }
 
 
@@ -4897,6 +4909,11 @@ igb_add_hw_stats(struct adapter *adapter
}
 
for (int i = 0; i < adapter->num_queues; i++, rxr++) {
+   snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
+   queue_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, namebuf, 
+   CTLFLAG_RD, NULL, "Queue Name");
+   queue_list = SYSCTL_CHILDREN(queue_node);
+
struct lro_ctrl *lro = &rxr->lro;
 
snprintf(namebuf, QUEUE_NAME_LEN, "queue%d", i);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r229965 - head/sys/dev/null

2012-01-11 Thread George V. Neville-Neil
Author: gnn
Date: Wed Jan 11 15:00:16 2012
New Revision: 229965
URL: http://svn.freebsd.org/changeset/base/229965

Log:
  Fix for PR 138526.
  
  Add the ability for /dev/null and /dev/zero to accept
  being set into non blocking mode via fcntl().  This
  brings the code into compliance with IEEE Std 1003.1-2001
  as referenced in another PR, 94729.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/dev/null/null.c

Modified: head/sys/dev/null/null.c
==
--- head/sys/dev/null/null.cWed Jan 11 14:24:03 2012(r229964)
+++ head/sys/dev/null/null.cWed Jan 11 15:00:16 2012(r229965)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -49,6 +50,7 @@ static struct cdev *zero_dev;
 
 static d_write_t null_write;
 static d_ioctl_t null_ioctl;
+static d_ioctl_t zero_ioctl;
 static d_read_t zero_read;
 
 static struct cdevsw null_cdevsw = {
@@ -63,6 +65,7 @@ static struct cdevsw zero_cdevsw = {
.d_version =D_VERSION,
.d_read =   zero_read,
.d_write =  null_write,
+   .d_ioctl =  zero_ioctl,
.d_name =   "zero",
.d_flags =  D_MMAP_ANON,
 };
@@ -82,17 +85,50 @@ null_ioctl(struct cdev *dev __unused, u_
 int flags __unused, struct thread *td)
 {
int error;
+   error = 0;
 
-   if (cmd != DIOCSKERNELDUMP)
-   return (ENOIOCTL);
-   error = priv_check(td, PRIV_SETDUMPER);
-   if (error)
-   return (error);
-   return (set_dumper(NULL));
+   switch (cmd) {
+   case DIOCSKERNELDUMP:
+   error = priv_check(td, PRIV_SETDUMPER);
+   if (error == 0)
+   error = set_dumper(NULL);
+   break;
+   case FIONBIO:
+   break;
+   case FIOASYNC:
+   if (*(int *)data != 0)
+   error = EINVAL;
+   break;
+   default:
+   error = ENOIOCTL;
+   }
+   return (error);
 }
 
 /* ARGSUSED */
 static int
+zero_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused,
+  int flags __unused, struct thread *td)
+{
+   int error;
+   error = 0;
+
+   switch (cmd) {
+   case FIONBIO:
+   break;
+   case FIOASYNC:
+   if (*(int *)data != 0)
+   error = EINVAL;
+   break;
+   default:
+   error = ENOIOCTL;
+   }
+   return (error);
+}
+
+
+/* ARGSUSED */
+static int
 zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused)
 {
void *zbuf;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230063 - head/sys/dev/hwpmc

2012-01-13 Thread George V. Neville-Neil
Author: gnn
Date: Fri Jan 13 17:13:46 2012
New Revision: 230063
URL: http://svn.freebsd.org/changeset/base/230063

Log:
  Clean up a switch statement for uncore events on Westmere processors.
  
  Submitted by: Davide Italiano
  Reviewed by:  gnn
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_uncore.h

Modified: head/sys/dev/hwpmc/hwpmc_uncore.c
==
--- head/sys/dev/hwpmc/hwpmc_uncore.c   Fri Jan 13 16:01:34 2012
(r230062)
+++ head/sys/dev/hwpmc/hwpmc_uncore.c   Fri Jan 13 17:13:46 2012
(r230063)
@@ -974,26 +974,18 @@ ucp_start_pmc(int cpu, int ri)
/* Event specific configuration. */
switch (pm->pm_event) {
case PMC_EV_UCP_EVENT_0CH_04H_E:
+   case PMC_EV_UCP_EVENT_0CH_08H_E:
wrmsr(MSR_GQ_SNOOP_MESF,0x2);
break;
case PMC_EV_UCP_EVENT_0CH_04H_F:
+   case PMC_EV_UCP_EVENT_0CH_08H_F:
wrmsr(MSR_GQ_SNOOP_MESF,0x8);
break;
case PMC_EV_UCP_EVENT_0CH_04H_M:
-   wrmsr(MSR_GQ_SNOOP_MESF,0x1);
-   break;
-   case PMC_EV_UCP_EVENT_0CH_04H_S:
-   wrmsr(MSR_GQ_SNOOP_MESF,0x4);
-   break;
-   case PMC_EV_UCP_EVENT_0CH_08H_E:
-   wrmsr(MSR_GQ_SNOOP_MESF,0x2);
-   break;
-   case PMC_EV_UCP_EVENT_0CH_08H_F:
-   wrmsr(MSR_GQ_SNOOP_MESF,0x8);
-   break;  
case PMC_EV_UCP_EVENT_0CH_08H_M:
wrmsr(MSR_GQ_SNOOP_MESF,0x1);
break;
+   case PMC_EV_UCP_EVENT_0CH_04H_S:
case PMC_EV_UCP_EVENT_0CH_08H_S:
wrmsr(MSR_GQ_SNOOP_MESF,0x4);
break;

Modified: head/sys/dev/hwpmc/hwpmc_uncore.h
==
--- head/sys/dev/hwpmc/hwpmc_uncore.h   Fri Jan 13 16:01:34 2012
(r230062)
+++ head/sys/dev/hwpmc/hwpmc_uncore.h   Fri Jan 13 17:13:46 2012
(r230063)
@@ -87,7 +87,6 @@ struct pmc_md_ucp_op_pmcallocate {
 #defineUC_GLOBAL_CTRL  0x391
 #defineUC_GLOBAL_OVF_CTRL  0x393
 
-
 #defineUC_GLOBAL_STATUS_FLAG_CLRCHG(1ULL << 63)
 #defineUC_GLOBAL_STATUS_FLAG_OVFPMI(1ULL << 61)
 #defineUC_GLOBAL_CTRL_FLAG_FRZ (1ULL << 63)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r224246 - head/lib/libc/amd64/string

2011-07-21 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 21 16:32:13 2011
New Revision: 224246
URL: http://svn.freebsd.org/changeset/base/224246

Log:
  Make both stpcpy and strcpy be assembly language implementations
  on amd64.
  
  Submitted by: Guillaume Morin (guillaume at morinfr.org)
  Reviewed by:  kib, jhb
  Approved by:  re (bz)
  MFC after:1 month

Added:
  head/lib/libc/amd64/string/stpcpy.S
 - copied, changed from r223967, head/lib/libc/amd64/string/strcpy.S
  head/lib/libc/amd64/string/strcpy.c   (contents, props changed)
Deleted:
  head/lib/libc/amd64/string/strcpy.S
Modified:
  head/lib/libc/amd64/string/Makefile.inc

Modified: head/lib/libc/amd64/string/Makefile.inc
==
--- head/lib/libc/amd64/string/Makefile.inc Thu Jul 21 14:25:12 2011
(r224245)
+++ head/lib/libc/amd64/string/Makefile.inc Thu Jul 21 16:32:13 2011
(r224246)
@@ -1,4 +1,4 @@
 # $FreeBSD$
 
 MDSRCS+= bcmp.S bcopy.S bzero.S memcmp.S memcpy.S memmove.S memset.S \
-   strcat.S strcmp.S strcpy.S
+   strcat.S strcmp.S stpcpy.S strcpy.c

Copied and modified: head/lib/libc/amd64/string/stpcpy.S (from r223967, 
head/lib/libc/amd64/string/strcpy.S)
==
--- head/lib/libc/amd64/string/strcpy.S Tue Jul 12 20:38:42 2011
(r223967, copy source)
+++ head/lib/libc/amd64/string/stpcpy.S Thu Jul 21 16:32:13 2011
(r224246)
@@ -1,17 +1,14 @@
 /*
- * Written by J.T. Conklin 
+ * Adapted by Guillaume Morin  from strcpy.S
+ * written by J.T. Conklin 
  * Public domain.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
-#if 0
-   RCSID("$NetBSD: strcpy.S,v 1.3 2004/07/19 20:04:41 drochner Exp $")
-#endif
-
 /*
- * This strcpy implementation copies a byte at a time until the
+ * This stpcpy implementation copies a byte at a time until the
  * source pointer is aligned to a word boundary, it then copies by
  * words until it finds a word containing a zero byte, and finally
  * copies by bytes until the end of the string is reached.
@@ -23,10 +20,11 @@ __FBSDID("$FreeBSD$");
  * requirements.
  */
 
-ENTRY(strcpy)
-   movq%rdi,%rax
-   movabsq $0x0101010101010101,%r8
-   movabsq $0x8080808080808080,%r9
+   .globl  stpcpy,__stpcpy
+ENTRY(stpcpy)
+__stpcpy:
+   movabsq $0x0101010101010101,%r8
+   movabsq $0x8080808080808080,%r9
 
/*
 * Align source to a word boundary.
@@ -41,6 +39,8 @@ ENTRY(strcpy)
incq%rdi
testb   %dl,%dl
jne .Lalign
+   movq%rdi,%rax
+   dec %rax
ret
 
.p2align 4
@@ -61,54 +61,56 @@ ENTRY(strcpy)
 */
 
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 1st byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 2nd byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 3rd byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 4th byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 5th byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 6th byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
-   incq%rdi
testb   %dl,%dl /* 7th byte == 0? */
je  .Ldone
+   incq%rdi
 
shrq$8,%rdx
movb%dl,(%rdi)
incq%rdi
testb   %dl,%dl /* 8th byte == 0? */
jne .Lword_aligned
+   decq%rdi
 
 .Ldone:
+   movq%rdi,%rax
ret
-END(strcpy)
-
+END(stpcpy)
+   
.section .note.GNU-stack,"",%progbits

Added: head/lib/libc/amd64/string/strcpy.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/amd64/string/strcpy.c Thu Jul 21 16:32:13 2011
(r224246)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2011 George V. Neville-Neil. All rights reserved.
+ *
+ * The compilation of software known as FreeBSD is distributed under the
+ * following terms:
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistrib

svn commit: r224253 - head/lib/libc/amd64/string

2011-07-21 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 21 20:06:14 2011
New Revision: 224253
URL: http://svn.freebsd.org/changeset/base/224253

Log:
  Remove incorrect attribution.
  
  Approved by:  re (kib)
  Pointed out by: brueffer
  Pointy hat to: gnn

Modified:
  head/lib/libc/amd64/string/stpcpy.S

Modified: head/lib/libc/amd64/string/stpcpy.S
==
--- head/lib/libc/amd64/string/stpcpy.S Thu Jul 21 20:02:22 2011
(r224252)
+++ head/lib/libc/amd64/string/stpcpy.S Thu Jul 21 20:06:14 2011
(r224253)
@@ -1,5 +1,5 @@
 /*
- * Adapted by Guillaume Morin  from strcpy.S
+ * Adapted by Guillaume Morin  from strcpy.S
  * written by J.T. Conklin 
  * Public domain.
  */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r210012 - head/sys/dev/hwpmc

2010-07-13 Thread George V. Neville-Neil
Author: gnn
Date: Tue Jul 13 19:37:45 2010
New Revision: 210012
URL: http://svn.freebsd.org/changeset/base/210012

Log:
  Fix a panic brought about by writing an MSR without a proper mask.
  All of the necessary wrmsr calls are now preceded by a rdmsr
  and we leave the reserved bits alone.
  Document the bits in the relevant registers for future reference.
  
  Tested by:mdf
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_core.h

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Tue Jul 13 19:33:46 2010
(r210011)
+++ head/sys/dev/hwpmc/hwpmc_core.c Tue Jul 13 19:37:45 2010
(r210012)
@@ -147,6 +147,7 @@ core_pcpu_fini(struct pmc_mdep *md, int 
int core_ri, n, npmc;
struct pmc_cpu *pc;
struct core_cpu *cc;
+   uint64_t msr = 0;
 
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[core,%d] insane cpu number (%d)", __LINE__, cpu));
@@ -166,11 +167,14 @@ core_pcpu_fini(struct pmc_mdep *md, int 
npmc = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_num;
core_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_ri;
 
-   for (n = 0; n < npmc; n++)
-   wrmsr(IAP_EVSEL0 + n, 0);
+   for (n = 0; n < npmc; n++) {
+   msr = rdmsr(IAP_EVSEL0 + n);
+   wrmsr(IAP_EVSEL0 + n, msr & ~IAP_EVSEL_MASK);
+   }
 
if (core_cputype != PMC_CPU_INTEL_CORE) {
-   wrmsr(IAF_CTRL, 0);
+   msr = rdmsr(IAF_CTRL);
+   wrmsr(IAF_CTRL, msr & ~IAF_CTRL_MASK);
npmc += md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAF].pcd_num;
}
 
@@ -374,6 +378,7 @@ iaf_start_pmc(int cpu, int ri)
 {
struct pmc *pm;
struct core_cpu *iafc;
+   uint64_t msr = 0;
 
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[core,%d] illegal CPU value %d", __LINE__, cpu));
@@ -387,12 +392,15 @@ iaf_start_pmc(int cpu, int ri)
 
iafc->pc_iafctrl |= pm->pm_md.pm_iaf.pm_iaf_ctrl;
 
-   wrmsr(IAF_CTRL, iafc->pc_iafctrl);
+   msr = rdmsr(IAF_CTRL);
+   wrmsr(IAF_CTRL, msr | (iafc->pc_iafctrl & IAF_CTRL_MASK));
 
do {
iafc->pc_resync = 0;
iafc->pc_globalctrl |= (1ULL << (ri + IAF_OFFSET));
-   wrmsr(IA_GLOBAL_CTRL, iafc->pc_globalctrl);
+   msr = rdmsr(IA_GLOBAL_CTRL);
+   wrmsr(IA_GLOBAL_CTRL, msr | (iafc->pc_globalctrl & 
+IAF_GLOBAL_CTRL_MASK));
} while (iafc->pc_resync != 0);
 
PMCDBG(MDP,STA,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
@@ -407,6 +415,7 @@ iaf_stop_pmc(int cpu, int ri)
 {
uint32_t fc;
struct core_cpu *iafc;
+   uint64_t msr = 0;
 
PMCDBG(MDP,STO,1,"iaf-stop cpu=%d ri=%d", cpu, ri);
 
@@ -425,12 +434,15 @@ iaf_stop_pmc(int cpu, int ri)
iafc->pc_iafctrl &= ~fc;
 
PMCDBG(MDP,STO,1,"iaf-stop iafctrl=%x", iafc->pc_iafctrl);
-   wrmsr(IAF_CTRL, iafc->pc_iafctrl);
+   msr = rdmsr(IAF_CTRL);
+   wrmsr(IAF_CTRL, msr | (iafc->pc_iafctrl & IAF_CTRL_MASK));
 
do {
iafc->pc_resync = 0;
iafc->pc_globalctrl &= ~(1ULL << (ri + IAF_OFFSET));
-   wrmsr(IA_GLOBAL_CTRL, iafc->pc_globalctrl);
+   msr = rdmsr(IA_GLOBAL_CTRL);
+   wrmsr(IA_GLOBAL_CTRL, msr | (iafc->pc_globalctrl &
+IAF_GLOBAL_CTRL_MASK));
} while (iafc->pc_resync != 0);
 
PMCDBG(MDP,STO,1,"iafctrl=%x(%x) globalctrl=%jx(%jx)",
@@ -445,6 +457,7 @@ iaf_write_pmc(int cpu, int ri, pmc_value
 {
struct core_cpu *cc;
struct pmc *pm;
+   uint64_t msr;
 
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[core,%d] illegal cpu value %d", __LINE__, cpu));
@@ -460,9 +473,11 @@ iaf_write_pmc(int cpu, int ri, pmc_value
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
v = iaf_reload_count_to_perfctr_value(v);
 
-   wrmsr(IAF_CTRL, 0); /* Turn off fixed counters */
-   wrmsr(IAF_CTR0 + ri, v);
-   wrmsr(IAF_CTRL, cc->pc_iafctrl);
+   msr = rdmsr(IAF_CTRL);
+   wrmsr(IAF_CTRL, msr & ~IAF_CTRL_MASK);
+   wrmsr(IAF_CTR0 + ri, v & ((1ULL << core_iaf_width) - 1));
+   msr = rdmsr(IAF_CTRL);
+   wrmsr(IAF_CTRL, msr | (cc->pc_iafctrl & IAF_CTRL_MASK));
 
PMCDBG(MDP,WRI,1, "iaf-write cpu=%d ri=%d msr=0x%x v=%jx iafctrl=%jx "
"pmc=%jx", cpu, ri, IAF_RI_TO_MSR(ri), v,
@@ -1879,6 +1894,7 @@ iap_stop_pmc(int cpu, int ri)
 {
struct pmc *pm;
struct core_cpu *cc;
+   uint64_t msr;
 
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[core,%d] illegal cpu value %d", __LINE__, cpu));
@@ -1894,7 +1910,8 @@ iap_stop_pmc(int cpu, int ri)
 
PMCDBG(MDP,STO,1, "iap-stop cpu=%d ri=%d", cpu, ri);
 
-  

svn commit: r210428 - head/sys/dev/e1000

2010-07-23 Thread George V. Neville-Neil
Author: gnn
Date: Fri Jul 23 17:53:39 2010
New Revision: 210428
URL: http://svn.freebsd.org/changeset/base/210428

Log:
  Fix a bug in the statistics code for tracking the head and
  tail pointers of the tx and rx queues.   We needed a SYSCTL_PROC
  to correctly get the values at run time.
  
  Submitted by: Andrew Boyer aboyer at averesystems.com
  MFC after:1 week

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Fri Jul 23 17:44:01 2010(r210427)
+++ head/sys/dev/e1000/if_igb.c Fri Jul 23 17:53:39 2010(r210428)
@@ -4927,6 +4927,74 @@ igb_update_vf_stats_counters(struct adap
 }
 
 
+/** igb_sysctl_tdh_handler - Handler function
+ *  Retrieves the TDH value from the hardware
+ */
+static int igb_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1);
+   if (!txr) return 0;
+
+   unsigned val = E1000_READ_REG(&txr->adapter->hw, E1000_TDH(txr->me));
+   error = sysctl_handle_int(oidp, &val, 0, req);
+   if (error || !req->newptr)
+   return error;
+   return 0;
+}
+
+/** igb_sysctl_tdt_handler - Handler function
+ *  Retrieves the TDT value from the hardware
+ */
+static int igb_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   struct tx_ring *txr = ((struct tx_ring *)oidp->oid_arg1);
+   if (!txr) return 0;
+
+   unsigned val = E1000_READ_REG(&txr->adapter->hw, E1000_TDT(txr->me));
+   error = sysctl_handle_int(oidp, &val, 0, req);
+   if (error || !req->newptr)
+   return error;
+   return 0;
+}
+
+/** igb_sysctl_rdh_handler - Handler function
+ *  Retrieves the RDH value from the hardware
+ */
+static int igb_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1);
+   if (!rxr) return 0;
+
+   unsigned val = E1000_READ_REG(&rxr->adapter->hw, E1000_RDH(rxr->me));
+   error = sysctl_handle_int(oidp, &val, 0, req);
+   if (error || !req->newptr)
+   return error;
+   return 0;
+}
+
+/** igb_sysctl_rdt_handler - Handler function
+ *  Retrieves the RDT value from the hardware
+ */
+static int igb_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   struct rx_ring *rxr = ((struct rx_ring *)oidp->oid_arg1);
+   if (!rxr) return 0;
+
+   unsigned val = E1000_READ_REG(&rxr->adapter->hw, E1000_RDT(rxr->me));
+   error = sysctl_handle_int(oidp, &val, 0, req);
+   if (error || !req->newptr)
+   return error;
+   return 0;
+}
+
 /*
  * Add sysctl variables, one per statistic, to the system.
  */
@@ -4992,12 +5060,14 @@ igb_add_hw_stats(struct adapter *adapter
CTLFLAG_RD, NULL, "Queue Name");
queue_list = SYSCTL_CHILDREN(queue_node);
 
-   SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "txd_head",
-   CTLFLAG_RD, &txr->tdh, 0,
-   "Transmit Descriptor Head");
-   SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "txd_tail",
-   CTLFLAG_RD, &txr->tdt, 0,
-   "Transmit Descriptor Tail");
+   SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_head", 
+   CTLFLAG_RD, txr, sizeof(txr),
+   igb_sysctl_tdh_handler, "IU",
+   "Transmit Descriptor Head");
+   SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "txd_tail", 
+   CTLFLAG_RD, txr, sizeof(txr),
+   igb_sysctl_tdt_handler, "IU",
+   "Transmit Descriptor Tail");
SYSCTL_ADD_QUAD(ctx, queue_list, OID_AUTO, "no_desc_avail", 
CTLFLAG_RD, &txr->no_desc_avail,
"Queue No Descriptor Available");
@@ -5019,11 +5089,13 @@ igb_add_hw_stats(struct adapter *adapter
CTLFLAG_RD, NULL, "Queue Name");
queue_list = SYSCTL_CHILDREN(queue_node);
 
-   SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "rxd_head",
-   CTLFLAG_RD, &rxr->rdh, 0,
+   SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_head", 
+   CTLFLAG_RD, rxr, sizeof(rxr),
+   igb_sysctl_rdh_handler, "IU",
"Receive Descriptor Head");
-   SYSCTL_ADD_UINT(ctx, queue_list, OID_AUTO, "rxd_tail",
-   CTLFLAG_RD, &rxr->rdt, 0,
+   SYSCTL_ADD_PROC(ctx, queue_list, OID_AUTO, "rxd_tail", 
+   CTLFLAG_RD, rxr, sizeof(rxr),
+   igb_sysct

svn commit: r210452 - head/sys/dev/e1000

2010-07-24 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul 24 18:53:46 2010
New Revision: 210452
URL: http://svn.freebsd.org/changeset/base/210452

Log:
  style(9) fix
  
  MFC after:1 week

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Sat Jul 24 18:14:34 2010(r210451)
+++ head/sys/dev/e1000/if_igb.c Sat Jul 24 18:53:46 2010(r210452)
@@ -4930,7 +4930,8 @@ igb_update_vf_stats_counters(struct adap
 /** igb_sysctl_tdh_handler - Handler function
  *  Retrieves the TDH value from the hardware
  */
-static int igb_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS)
+static int 
+igb_sysctl_tdh_handler(SYSCTL_HANDLER_ARGS)
 {
int error;
 
@@ -4947,7 +4948,8 @@ static int igb_sysctl_tdh_handler(SYSCTL
 /** igb_sysctl_tdt_handler - Handler function
  *  Retrieves the TDT value from the hardware
  */
-static int igb_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS)
+static int 
+igb_sysctl_tdt_handler(SYSCTL_HANDLER_ARGS)
 {
int error;
 
@@ -4964,7 +4966,8 @@ static int igb_sysctl_tdt_handler(SYSCTL
 /** igb_sysctl_rdh_handler - Handler function
  *  Retrieves the RDH value from the hardware
  */
-static int igb_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS)
+static int 
+igb_sysctl_rdh_handler(SYSCTL_HANDLER_ARGS)
 {
int error;
 
@@ -4981,7 +4984,8 @@ static int igb_sysctl_rdh_handler(SYSCTL
 /** igb_sysctl_rdt_handler - Handler function
  *  Retrieves the RDT value from the hardware
  */
-static int igb_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS)
+static int 
+igb_sysctl_rdt_handler(SYSCTL_HANDLER_ARGS)
 {
int error;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r210621 - head/sys/dev/hwpmc

2010-07-29 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 29 17:52:23 2010
New Revision: 210621
URL: http://svn.freebsd.org/changeset/base/210621

Log:
  Make sure that we clear the correct bits when we turn off
  a PMC.  It was possible that we could have turned a bit on but
  never cleared it.
  
  Extend the calls to rdmsr() to all necessary functions, not
  just those which previously caused a panic.
  
  Pointed out by: jhb@
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_core.h

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Thu Jul 29 17:37:35 2010
(r210620)
+++ head/sys/dev/hwpmc/hwpmc_core.c Thu Jul 29 17:52:23 2010
(r210621)
@@ -168,13 +168,13 @@ core_pcpu_fini(struct pmc_mdep *md, int 
core_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAP].pcd_ri;
 
for (n = 0; n < npmc; n++) {
-   msr = rdmsr(IAP_EVSEL0 + n);
-   wrmsr(IAP_EVSEL0 + n, msr & ~IAP_EVSEL_MASK);
+   msr = rdmsr(IAP_EVSEL0 + n) & ~IAP_EVSEL_MASK;
+   wrmsr(IAP_EVSEL0 + n, msr);
}
 
if (core_cputype != PMC_CPU_INTEL_CORE) {
-   msr = rdmsr(IAF_CTRL);
-   wrmsr(IAF_CTRL, msr & ~IAF_CTRL_MASK);
+   msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
+   wrmsr(IAF_CTRL, msr);
npmc += md->pmd_classdep[PMC_MDEP_CLASS_INDEX_IAF].pcd_num;
}
 
@@ -392,13 +392,13 @@ iaf_start_pmc(int cpu, int ri)
 
iafc->pc_iafctrl |= pm->pm_md.pm_iaf.pm_iaf_ctrl;
 
-   msr = rdmsr(IAF_CTRL);
+   msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
wrmsr(IAF_CTRL, msr | (iafc->pc_iafctrl & IAF_CTRL_MASK));
 
do {
iafc->pc_resync = 0;
iafc->pc_globalctrl |= (1ULL << (ri + IAF_OFFSET));
-   msr = rdmsr(IA_GLOBAL_CTRL);
+   msr = rdmsr(IA_GLOBAL_CTRL) & ~IAF_GLOBAL_CTRL_MASK;
wrmsr(IA_GLOBAL_CTRL, msr | (iafc->pc_globalctrl & 
 IAF_GLOBAL_CTRL_MASK));
} while (iafc->pc_resync != 0);
@@ -434,13 +434,13 @@ iaf_stop_pmc(int cpu, int ri)
iafc->pc_iafctrl &= ~fc;
 
PMCDBG(MDP,STO,1,"iaf-stop iafctrl=%x", iafc->pc_iafctrl);
-   msr = rdmsr(IAF_CTRL);
+   msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
wrmsr(IAF_CTRL, msr | (iafc->pc_iafctrl & IAF_CTRL_MASK));
 
do {
iafc->pc_resync = 0;
iafc->pc_globalctrl &= ~(1ULL << (ri + IAF_OFFSET));
-   msr = rdmsr(IA_GLOBAL_CTRL);
+   msr = rdmsr(IA_GLOBAL_CTRL) & ~IAF_GLOBAL_CTRL_MASK;
wrmsr(IA_GLOBAL_CTRL, msr | (iafc->pc_globalctrl &
 IAF_GLOBAL_CTRL_MASK));
} while (iafc->pc_resync != 0);
@@ -473,10 +473,14 @@ iaf_write_pmc(int cpu, int ri, pmc_value
if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
v = iaf_reload_count_to_perfctr_value(v);
 
-   msr = rdmsr(IAF_CTRL);
-   wrmsr(IAF_CTRL, msr & ~IAF_CTRL_MASK);
+   /* Turn off fixed counters */
+   msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
+   wrmsr(IAF_CTRL, msr); 
+
wrmsr(IAF_CTR0 + ri, v & ((1ULL << core_iaf_width) - 1));
-   msr = rdmsr(IAF_CTRL);
+
+   /* Turn on fixed counters */
+   msr = rdmsr(IAF_CTRL) & ~IAF_CTRL_MASK;
wrmsr(IAF_CTRL, msr | (cc->pc_iafctrl & IAF_CTRL_MASK));
 
PMCDBG(MDP,WRI,1, "iaf-write cpu=%d ri=%d msr=0x%x v=%jx iafctrl=%jx "
@@ -1910,15 +1914,17 @@ iap_stop_pmc(int cpu, int ri)
 
PMCDBG(MDP,STO,1, "iap-stop cpu=%d ri=%d", cpu, ri);
 
-   msr = rdmsr(IAP_EVSEL0 + ri);
-   wrmsr(IAP_EVSEL0 + ri, msr & IAP_EVSEL_MASK);   /* stop hw */
+   msr = rdmsr(IAP_EVSEL0 + ri) & ~IAP_EVSEL_MASK;
+   wrmsr(IAP_EVSEL0 + ri, msr);/* stop hw */
 
if (core_cputype == PMC_CPU_INTEL_CORE)
return (0);
 
+   msr = 0;
do {
cc->pc_resync = 0;
cc->pc_globalctrl &= ~(1ULL << ri);
+   msr = rdmsr(IA_GLOBAL_CTRL) & ~IA_GLOBAL_CTRL_MASK;
wrmsr(IA_GLOBAL_CTRL, cc->pc_globalctrl);
} while (cc->pc_resync != 0);
 
@@ -2004,7 +2010,7 @@ core_intr(int cpu, struct trapframe *tf)
struct pmc *pm;
struct core_cpu *cc;
int error, found_interrupt, ri;
-   uint64_t msr = 0;
+   uint64_t msr;
 
PMCDBG(MDP,INT, 1, "cpu=%d tf=0x%p um=%d", cpu, (void *) tf,
TRAPF_USERMODE(tf));
@@ -2036,15 +2042,15 @@ core_intr(int cpu, struct trapframe *tf)
 * Stop the counter, reload it but only restart it if
 * the PMC is not stalled.
 */
-   msr = rdmsr(IAP_EVSEL0 + ri);
-   wrmsr(IAP_EVSEL0 + ri, msr & ~IAP_EVSEL_MASK);
+   msr = rdmsr(IAP_EVSEL0 + ri) & ~IAP_EVSEL_MASK;
+   wrmsr

svn commit: r213327 - head/tools/tools/mctest

2010-10-01 Thread George V. Neville-Neil
Author: gnn
Date: Fri Oct  1 14:36:36 2010
New Revision: 213327
URL: http://svn.freebsd.org/changeset/base/213327

Log:
  Change the output of mctest to give a summary of the results instead
  of printing a long list.
  
  Add a default base port, and default mulitcast address to the
  runner script.
  
  Add support for specifying a different local and remote interface
  in the runner script.
  
  MFC after:1 week

Modified:
  head/tools/tools/mctest/mctest.cc
  head/tools/tools/mctest/mctest_run.sh

Modified: head/tools/tools/mctest/mctest.cc
==
--- head/tools/tools/mctest/mctest.cc   Fri Oct  1 13:10:11 2010
(r213326)
+++ head/tools/tools/mctest/mctest.cc   Fri Oct  1 14:36:36 2010
(r213327)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 // C++ STL and other related includes
 #include 
 #include 
+#include 
+#include 
 
 // Operating System and other C based includes
 #include 
@@ -400,15 +402,31 @@ int source(char *interface, struct in_ad
 }
 
 timeval result;
+vector deltas;
+double idx[] = { .0001, .001, .01, .1, .5, .9, .99, .999, ., 0.0 };
+
 for (int client = 0;client < clients; client++) {
+   deltas.clear();
cout << "Results from client #" << client << endl;
+   cout << "in usecs" << endl;
 for (int i = 0; i < number; i++) {
-   if (i % clients != client) 
-   continue;
+// if (i % clients != client) 
+// continue;
+if (&args[client].packets[i].tv_sec == 0)
+   continue;
timersub(&args[client].packets[i], &sent[i], &result);
-   cout << "sec: " << result.tv_sec;
-   cout << " usecs: " << result.tv_usec << endl;
+   deltas.push_back(result.tv_usec);
+// cout << "sec: " << result.tv_sec;
+// cout << " usecs: " << result.tv_usec << endl;
 }
+   cout << "comparing %lu deltas" << long(deltas.size()) << endl;
+   cout << "number represents usecs of round-trip time" << endl;
+   sort(deltas.begin(), deltas.end());
+   for (int i = 0; idx[i] != 0; ++i) {
+   printf("%s% 5d", (i == 0) ? "" : " ", 
+  deltas[(int) (idx[i] * deltas.size())]); 
+   }
+   printf("\n");   
 }
 
 return 0;

Modified: head/tools/tools/mctest/mctest_run.sh
==
--- head/tools/tools/mctest/mctest_run.sh   Fri Oct  1 13:10:11 2010
(r213326)
+++ head/tools/tools/mctest/mctest_run.sh   Fri Oct  1 14:36:36 2010
(r213327)
@@ -7,19 +7,19 @@
 # Defaults
 size=1024
 number=100
-base=""
-group=""
+base=
+group="239.255.255.101"
 interface="cxgb0"
 remote="ssh"
-command="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest"
+command="/zoo/tank/users/gnn/svn/Projects/head-exar/src/tools/tools/mctest/mctest"
 gap=1000
 
 # Arguments are s (size), g (group), n (number), and c (command) followed
 # by a set of hostnames.
-args=`getopt s:g:n:c:i:b: $*`
+args=`getopt s:g:n:c:l:f:b: $*`
 if [ $? != 0 ]
 then
-echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 
host2 hostN'
+echo 'Usage: mctest_run -l local_interface -f foreign_interface -s size -g 
group -n number -c remote command host1 host2 hostN'
 exit 2
 fi
 set == $args
@@ -40,8 +40,11 @@ do
   -c)
  command=$3;
  shift 2;;
-  -i)
- interface=$3;
+  -l)
+ local_interface=$3;
+ shift 2;;
+  -f)
+ foreign_interface=$3;
  shift 2;;
   -b) 
  base=$3;
@@ -60,7 +63,7 @@ now=`date "+%Y%m%d%H%M"`
 for host in $*
 do
   output=$host\_$interface\_$size\_$number\.$now
-  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s 
$size -i $interface > $output &
+  $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s 
$size -i $foreign_interface > $output &
   sleep 1
   current=`expr $current + 1 `;
 done
@@ -68,4 +71,4 @@ done
 #
 # Start the source/collector on this machine
 #
-$command -M $# -b $base -g $group -n $number -s $size -i $interface -t $gap > 
`uname -n`\_$size\_$number\.$now
+$command -M $# -b $base -g $group -n $number -s $size -i $local_interface -t 
$gap > `uname -n`\_$size\_$number\.$now
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r213402 - head/lib/libpmc

2010-10-04 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  4 14:32:14 2010
New Revision: 213402
URL: http://svn.freebsd.org/changeset/base/213402

Log:
  Fix punctuation and grammar, mostly by ending sentences with a period.
  
  MFC after:1 day

Modified:
  head/lib/libpmc/pmc.westmere.3
  head/lib/libpmc/pmc.westmereuc.3

Modified: head/lib/libpmc/pmc.westmere.3
==
--- head/lib/libpmc/pmc.westmere.3  Mon Oct  4 10:48:47 2010
(r213401)
+++ head/lib/libpmc/pmc.westmere.3  Mon Oct  4 14:32:14 2010
(r213402)
@@ -388,7 +388,7 @@ requests include both L1D demand RFO mis
 .It Li L2_RQSTS.RFOS
 .Pq Event 24H , Umask 0CH
 Counts all L2 store RFO requests. L2 RFO requests include both L1D demand
-RFO misses as well as L1D RFO prefetches..
+RFO misses as well as L1D RFO prefetches.
 .It Li L2_RQSTS.IFETCH_HIT
 .Pq Event 24H , Umask 10H
 Counts number of instruction fetches that hit the L2 cache. L2 instruction
@@ -474,13 +474,13 @@ This is a demand RFO request
 .It Li L2_WRITE.RFO.S_STATE
 .Pq Event 27H , Umask 02H
 Counts number of L2 store RFO requests where the cache line to be loaded is
-in the S (shared) state. The L1D prefetcher does not issue a RFO prefetch,.
-This is a demand RFO request
+in the S (shared) state. The L1D prefetcher does not issue a RFO prefetch.
+This is a demand RFO request.
 .It Li L2_WRITE.RFO.M_STATE
 .Pq Event 27H , Umask 08H
 Counts number of L2 store RFO requests where the cache line to be loaded is
 in the M (modified) state. The L1D prefetcher does not issue a RFO prefetch.
-This is a demand RFO request
+This is a demand RFO request.
 .It Li L2_WRITE.RFO.HIT
 .Pq Event 27H , Umask 0EH
 Counts number of L2 store RFO requests where the cache line to be loaded is
@@ -491,7 +491,7 @@ This is a demand RFO request
 .Pq Event 27H , Umask 0FH
 Counts all L2 store RFO requests.The L1D prefetcher does not issue a RFO
 prefetch.
-This is a demand RFO request
+This is a demand RFO request.
 .It Li L2_WRITE.LOCK.I_STATE
 .Pq Event 27H , Umask 10H
 Counts number of L2 demand lock RFO requests where the cache line to be
@@ -539,13 +539,13 @@ Counts all L1 writebacks to the L2.
 Counts uncore Last Level Cache references. Because cache hierarchy, cache
 sizes and other implementation-specific characteristics; value comparison to
 estimate performance differences is not recommended.
-see Table A-1
+See Table A-1.
 .It Li L3_LAT_CACHE.MISS
 .Pq Event 2EH , Umask 01H
 Counts uncore Last Level Cache misses. Because cache hierarchy, cache sizes
 and other implementation-specific characteristics; value comparison to
 estimate performance differences is not recommended.
-see Table A-1
+See Table A-1.
 .It Li CPU_CLK_UNHALTED.THREAD_P
 .Pq Event 3CH , Umask 00H
 Counts the number of thread cycles while the thread is not in a halt state.
@@ -601,16 +601,16 @@ Counts Extended Page walk cycles.
 .It Li L1D.REPL
 .Pq Event 51H , Umask 01H
 Counts the number of lines brought into the L1 data cache.
-Counter 0, 1 only
+Counter 0, 1 only.
 .It Li L1D.M_REPL
 .Pq Event 51H , Umask 02H
 Counts the number of modified lines brought into the L1 data cache.
-Counter 0, 1 only
+Counter 0, 1 only.
 .It Li L1D.M_EVICT
 .Pq Event 51H , Umask 04H
 Counts the number of modified lines evicted from the L1 data cache due to
 replacement.
-Counter 0, 1 only
+Counter 0, 1 only.
 .It Li L1D.M_SNOOP_EVICT
 .Pq Event 51H , Umask 08H
 Counts the number of modified lines evicted from the L1 data cache due to
@@ -628,22 +628,22 @@ accepted into the fill buffer.
 .Pq Event 60H , Umask 01H
 Counts weighted cycles of offcore demand data read requests. Does not
 include L2 prefetch requests.
-counter 0
+Counter 0.
 .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_CODE
 .Pq Event 60H , Umask 02H
 Counts weighted cycles of offcore demand code read requests. Does not
 include L2 prefetch requests.
-counter 0
+Counter 0.
 .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.RFO
 .Pq Event 60H , Umask 04H
 Counts weighted cycles of offcore demand RFO requests. Does not include L2
 prefetch requests.
-counter 0
+Counter 0.
 .It Li OFFCORE_REQUESTS_OUTSTANDING.ANY.READ
 .Pq Event 60H , Umask 08H
 Counts weighted cycles of offcore read requests of any kind. Include L2
 prefetch requests.
-counter 0
+Ccounter 0.
 .It Li CACHE_LOCK_CYCLES.L1D_L2
 .Pq Event 63H , Umask 01H
 Cycle count during which the L1D and L2 are locked. A lock is asserted when
@@ -915,7 +915,7 @@ ports. This is a core count only and can
 .It Li UOPS_EXECUTED.PORT015
 .Pq Event B1H , Umask 40H
 Counts number of Uops executed that where issued on port 0, 1, or 5.
-use cmask=1, invert=1 to count stall cycles
+Use cmask=1, invert=1 to count stall cycles.
 .It Li UOPS_EXECUTED.PORT234
 .Pq Event B1H , Umask 80H
 Counts number of Uops executed that where issued on port 2, 3, or 4.
@@ -928,18 +928,18 @@ Counts weighted cycles of snoopq request
 Use cmask=1 to count cycles not empty.
 .It Li SNOOPQ_REQUESTS_OUTSTANDING.INVALID

svn commit: r213409 - head/sys/dev/hwpmc

2010-10-04 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct  4 17:22:18 2010
New Revision: 213409
URL: http://svn.freebsd.org/changeset/base/213409

Log:
  Fix two aliases that had the same name but were pointing to different
  events.  These are now disamiguated.
  
  MFC after:1 week

Modified:
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/sys/dev/hwpmc/pmc_events.h
==
--- head/sys/dev/hwpmc/pmc_events.h Mon Oct  4 16:49:40 2010
(r213408)
+++ head/sys/dev/hwpmc/pmc_events.h Mon Oct  4 17:22:18 2010
(r213409)
@@ -2243,11 +2243,11 @@ __PMC_EV_ALIAS("UOPS_RETIRED.MACRO_FUSED
 __PMC_EV_ALIAS("MACHINE_CLEARS.CYCLES", IAP_EVENT_C3H_01H) \
 __PMC_EV_ALIAS("MACHINE_CLEARS.MEM_ORDER", IAP_EVENT_C3H_02H)  \
 __PMC_EV_ALIAS("MACHINE_CLEARS.SMC", IAP_EVENT_C3H_04H)
\
-__PMC_EV_ALIAS("BR_INST_RETIRED.ALL_BRANCHES", IAP_EVENT_C4H_00H)  \
+__PMC_EV_ALIAS("BR_INST_RETIRED.ANY_P", IAP_EVENT_C4H_00H) \
 __PMC_EV_ALIAS("BR_INST_RETIRED.CONDITIONAL", IAP_EVENT_C4H_01H)   \
 __PMC_EV_ALIAS("BR_INST_RETIRED.NEAR_CALL", IAP_EVENT_C4H_02H) \
 __PMC_EV_ALIAS("BR_INST_RETIRED.ALL_BRANCHES", IAP_EVENT_C4H_04H)  \
-__PMC_EV_ALIAS("BR_MISP_RETIRED.ALL_BRANCHES", IAP_EVENT_C5H_00H)  \
+__PMC_EV_ALIAS("BR_MISP_RETIRED.ANY_P", IAP_EVENT_C5H_00H) \
 __PMC_EV_ALIAS("BR_MISP_RETIRED.CONDITIONAL", IAP_EVENT_C5H_01H)   \
 __PMC_EV_ALIAS("BR_MISP_RETIRED.NEAR_CALL", IAP_EVENT_C5H_02H) \
 __PMC_EV_ALIAS("BR_MISP_RETIRED.ALL_BRANCHES", IAP_EVENT_C5H_04H)  \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r213691 - head/usr.sbin/pmccontrol

2010-10-11 Thread George V. Neville-Neil
Author: gnn
Date: Mon Oct 11 14:31:24 2010
New Revision: 213691
URL: http://svn.freebsd.org/changeset/base/213691

Log:
  Add code to print the number and type of the CPU that is present in
  the system as well has how many PMCs there are per CPU.  In this code
  CPU and core are equivalent.
  
  MFC after:1 day

Modified:
  head/usr.sbin/pmccontrol/pmccontrol.c

Modified: head/usr.sbin/pmccontrol/pmccontrol.c
==
--- head/usr.sbin/pmccontrol/pmccontrol.c   Mon Oct 11 13:31:09 2010
(r213690)
+++ head/usr.sbin/pmccontrol/pmccontrol.c   Mon Oct 11 14:31:24 2010
(r213691)
@@ -243,6 +243,10 @@ pmcc_do_list_state(void)
if (pmc_cpuinfo(&pc) != 0)
err(EX_OSERR, "Unable to determine CPU information");
 
+   printf("%d %s CPUs present, with %d PMCs per CPU\n", pc->pm_ncpu, 
+  pmc_name_of_cputype(pc->pm_cputype),
+   pc->pm_npmc);
+
dummy = sizeof(logical_cpus_mask);
if (sysctlbyname("machdep.logical_cpus_mask", &logical_cpus_mask,
&dummy, NULL, 0) < 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215207 - in head: sys/net sys/netinet tools/regression/netinet/arphold

2010-11-12 Thread George V. Neville-Neil
Author: gnn
Date: Fri Nov 12 22:03:02 2010
New Revision: 215207
URL: http://svn.freebsd.org/changeset/base/215207

Log:
  Add a queue to hold packets while we await an ARP reply.
  
  When a fast machine first brings up some non TCP networking program
  it is quite possible that we will drop packets due to the fact that
  only one packet can be held per ARP entry.  This leads to packets
  being missed when a program starts or restarts if the ARP data is
  not currently in the ARP cache.
  
  This code adds a new sysctl, net.link.ether.inet.maxhold, which defines
  a system wide maximum number of packets to be held in each ARP entry.
  Up to maxhold packets are queued until an ARP reply is received or
  the ARP times out.  The default setting is the old value of 1
  which has been part of the BSD networking code since time
  immemorial.
  
  Expose the time we hold an incomplete ARP entry by adding
  the sysctl net.link.ether.inet.wait, which defaults to 20
  seconds, the value used when the new ARP code was added..
  
  Reviewed by:  bz, rpaulo
  MFC after: 3 weeks

Added:
  head/tools/regression/netinet/arphold/
  head/tools/regression/netinet/arphold/Makefile   (contents, props changed)
  head/tools/regression/netinet/arphold/arphold.c   (contents, props changed)
  head/tools/regression/netinet/arphold/arphold.t   (contents, props changed)
Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/in.c

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cFri Nov 12 21:47:36 2010(r215206)
+++ head/sys/net/if_llatbl.cFri Nov 12 22:03:02 2010(r215207)
@@ -100,18 +100,34 @@ done:
  * This function is called by the timer functions
  * such as arptimer() and nd6_llinfo_timer(), and
  * the caller does the locking.
+ *
+ * Returns the number of held packets, if any, that were dropped.
  */
-void
+size_t
 llentry_free(struct llentry *lle)
 {
-   
+   size_t pkts_dropped;
+   struct mbuf *next;
+
+   pkts_dropped = 0;
LLE_WLOCK_ASSERT(lle);
LIST_REMOVE(lle, lle_next);
 
-   if (lle->la_hold != NULL)
+   while ((lle->la_numheld > 0) && (lle->la_hold != NULL)) {
+   next = lle->la_hold->m_nextpkt;
m_freem(lle->la_hold);
+   lle->la_hold = next;
+   lle->la_numheld--;
+   pkts_dropped++;
+   }
+
+   KASSERT(lle->la_numheld == 0, 
+   ("%s: la_numheld %d > 0, pkts_droped %ld", __func__, 
+lle->la_numheld, pkts_dropped));
 
LLE_FREE_LOCKED(lle);
+
+   return (pkts_dropped);
 }
 
 /*
@@ -412,6 +428,7 @@ llatbl_lle_show(struct llentry_sa *la)
db_printf(" lle_tbl=%p\n", lle->lle_tbl);
db_printf(" lle_head=%p\n", lle->lle_head);
db_printf(" la_hold=%p\n", lle->la_hold);
+   db_printf(" la_numheld=%d\n", lle->la_numheld);
db_printf(" la_expire=%ju\n", (uintmax_t)lle->la_expire);
db_printf(" la_flags=0x%04x\n", lle->la_flags);
db_printf(" la_asked=%u\n", lle->la_asked);

Modified: head/sys/net/if_llatbl.h
==
--- head/sys/net/if_llatbl.hFri Nov 12 21:47:36 2010(r215206)
+++ head/sys/net/if_llatbl.hFri Nov 12 22:03:02 2010(r215207)
@@ -58,6 +58,7 @@ struct llentry {
struct lltable   *lle_tbl;
struct llentries *lle_head;
struct mbuf  *la_hold;
+   int  la_numheld;  /* # of packets currently held */
time_t   la_expire;
uint16_t la_flags;
uint16_t la_asked;
@@ -191,7 +192,7 @@ voidlltable_drain(int);
 #endif
 intlltable_sysctl_dumparp(int, struct sysctl_req *);
 
-void   llentry_free(struct llentry *);
+size_t llentry_free(struct llentry *);
 intllentry_update(struct llentry **, struct lltable *,
struct sockaddr_storage *, struct ifnet *);
 

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Fri Nov 12 21:47:36 2010(r215206)
+++ head/sys/netinet/if_ether.c Fri Nov 12 22:03:02 2010(r215207)
@@ -89,13 +89,16 @@ VNET_DEFINE(int, useloopback) = 1;  /* us
 static VNET_DEFINE(int, arp_proxyall) = 0;
 static VNET_DEFINE(int, arpt_down) = 20;  /* keep incomplete entries for
   * 20 seconds */
-static VNET_DEFINE(struct arpstat, arpstat);  /* ARP statistics, see if_arp.h 
*/
+VNET_DEFINE(struct arpstat, arpstat);  /* ARP statistics, see if_arp.h */
+
+static VNET_DEFINE(int, arp_maxhold) = 1;
 
 #defineV_arpt_keep VNET(arpt_keep)
 #defineV_arpt_down   

svn commit: r215409 - head/tools/tools/mctest

2010-11-16 Thread George V. Neville-Neil
Author: gnn
Date: Tue Nov 16 20:39:52 2010
New Revision: 215409
URL: http://svn.freebsd.org/changeset/base/215409

Log:
  Fix an error in our results printing.

Modified:
  head/tools/tools/mctest/mctest.cc

Modified: head/tools/tools/mctest/mctest.cc
==
--- head/tools/tools/mctest/mctest.cc   Tue Nov 16 20:38:41 2010
(r215408)
+++ head/tools/tools/mctest/mctest.cc   Tue Nov 16 20:39:52 2010
(r215409)
@@ -419,7 +419,7 @@ int source(char *interface, struct in_ad
 // cout << "sec: " << result.tv_sec;
 // cout << " usecs: " << result.tv_usec << endl;
 }
-   cout << "comparing %lu deltas" << long(deltas.size()) << endl;
+   cout << "comparing " << long(deltas.size()) << " deltas" << endl;
cout << "number represents usecs of round-trip time" << endl;
sort(deltas.begin(), deltas.end());
for (int i = 0; idx[i] != 0; ++i) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r215434 - in head: sys/netinet usr.bin/netstat

2010-11-17 Thread George V. Neville-Neil
Author: gnn
Date: Wed Nov 17 18:55:12 2010
New Revision: 215434
URL: http://svn.freebsd.org/changeset/base/215434

Log:
  Add new, per connection, statistics for TCP, including:
  Retransmitted Packets
  Zero Window Advertisements
  Out of Order Receives
  
  These statistics are available via the -T argument to
  netstat(1).
  MFC after:2 weeks

Modified:
  head/sys/netinet/tcp.h
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_reass.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/main.c
  head/usr.bin/netstat/netstat.1
  head/usr.bin/netstat/netstat.h

Modified: head/sys/netinet/tcp.h
==
--- head/sys/netinet/tcp.h  Wed Nov 17 18:21:29 2010(r215433)
+++ head/sys/netinet/tcp.h  Wed Nov 17 18:55:12 2010(r215434)
@@ -225,9 +225,12 @@ struct tcp_info {
u_int32_t   tcpi_snd_nxt;   /* Next egress seqno */
u_int32_t   tcpi_rcv_nxt;   /* Next ingress seqno */
u_int32_t   tcpi_toe_tid;   /* HWTID for TOE endpoints */
+   u_int32_t   tcpi_snd_rexmitpack;/* Retransmitted packets */
+   u_int32_t   tcpi_rcv_ooopack;   /* Out-of-order packets */
+   u_int32_t   tcpi_snd_zerowin;   /* Zero-sized windows sent */

/* Padding to grow without breaking ABI. */
-   u_int32_t   __tcpi_pad[29]; /* Padding. */
+   u_int32_t   __tcpi_pad[26]; /* Padding. */
 };
 #endif
 

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Wed Nov 17 18:21:29 2010
(r215433)
+++ head/sys/netinet/tcp_output.c   Wed Nov 17 18:55:12 2010
(r215434)
@@ -803,6 +803,7 @@ send:
if ((tp->t_flags & TF_FORCEDATA) && len == 1)
TCPSTAT_INC(tcps_sndprobe);
else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) {
+   tp->t_sndrexmitpack++;
TCPSTAT_INC(tcps_sndrexmitpack);
TCPSTAT_ADD(tcps_sndrexmitbyte, len);
} else {
@@ -1027,9 +1028,10 @@ send:
 * to read more data than can be buffered prior to transmitting on
 * the connection.
 */
-   if (th->th_win == 0)
+   if (th->th_win == 0) {
+   tp->t_sndzerowin++;
tp->t_flags |= TF_RXWIN0SENT;
-   else
+   } else
tp->t_flags &= ~TF_RXWIN0SENT;
if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));

Modified: head/sys/netinet/tcp_reass.c
==
--- head/sys/netinet/tcp_reass.cWed Nov 17 18:21:29 2010
(r215433)
+++ head/sys/netinet/tcp_reass.cWed Nov 17 18:55:12 2010
(r215434)
@@ -266,6 +266,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
th->th_seq += i;
}
}
+   tp->t_rcvoopack++;
TCPSTAT_INC(tcps_rcvoopack);
TCPSTAT_ADD(tcps_rcvoobyte, *tlenp);
 

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Wed Nov 17 18:21:29 2010
(r215433)
+++ head/sys/netinet/tcp_usrreq.c   Wed Nov 17 18:55:12 2010
(r215434)
@@ -1218,6 +1218,9 @@ tcp_fill_info(struct tcpcb *tp, struct t
ti->tcpi_rcv_mss = tp->t_maxseg;
if (tp->t_flags & TF_TOE)
ti->tcpi_options |= TCPI_OPT_TOE;
+   ti->tcpi_snd_rexmitpack = tp->t_sndrexmitpack;
+   ti->tcpi_rcv_ooopack = tp->t_rcvoopack;
+   ti->tcpi_snd_zerowin = tp->t_sndzerowin;
 }
 
 /*

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Wed Nov 17 18:21:29 2010(r215433)
+++ head/sys/netinet/tcp_var.h  Wed Nov 17 18:55:12 2010(r215434)
@@ -177,6 +177,7 @@ struct tcpcb {
u_long  snd_cwnd_prev;  /* cwnd prior to retransmit */
u_long  snd_ssthresh_prev;  /* ssthresh prior to retransmit */
tcp_seq snd_recover_prev;   /* snd_recover prior to retransmit */
+   int t_sndzerowin;   /* zero-window updates sent */
u_int   t_badrxtwin;/* window for retransmit recovery */
u_char  snd_limited;/* segments limited transmitted */
 /* SACK related state */
@@ -193,6 +194,8 @@ struct tcpcb {
u_int32_t   rfbuf_ts;   /* recv buffer autoscaling timestamp */
int rfbuf_cnt;  /* recv buffer autoscaling byte count */
struct toe_usrreqs *t_tu;   /* offload operations vector */
+   int t_sndrexmitpack;  

svn commit: r215724 - head/usr.bin/netstat

2010-11-22 Thread George V. Neville-Neil
Author: gnn
Date: Mon Nov 22 22:55:43 2010
New Revision: 215724
URL: http://svn.freebsd.org/changeset/base/215724

Log:
  Restore the (state) and \n printout when not using -T.
  
  Pointed out by:   brucec@
  MFC after:3 weeks

Modified:
  head/usr.bin/netstat/inet.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Mon Nov 22 22:41:43 2010(r215723)
+++ head/usr.bin/netstat/inet.c Mon Nov 22 22:55:43 2010(r215724)
@@ -428,13 +428,14 @@ protopr(u_long off, const char *name, in
   "2msl", "delack", "rcvtime",
   "(state)");
}
-   if (!xflag && !Tflag) 
+   if (!xflag && !Tflag) {
printf((Aflag && !Wflag) ? 
   "%-5.5s %-6.6s %-6.6s  %-18.18s 
%-18.18s" :
   "%-5.5s %-6.6s %-6.6s  %-22.22s 
%-22.22s",
   "Proto", "Recv-Q", "Send-Q",
   "Local Address", "Foreign Address");
-
+   printf("(state)\n");
+   }
first = 0;
}
if (Lflag && so->so_qlimit == 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r217113 - head/sys/netinet

2011-01-07 Thread George V. Neville-Neil
Author: gnn
Date: Fri Jan  7 18:14:58 2011
New Revision: 217113
URL: http://svn.freebsd.org/changeset/base/217113

Log:
  Adjust ARP hold queue locking.
  
  Submitted by: Rozhuk Ivan, jhb
  MFC after:2 weeks

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Fri Jan  7 16:54:29 2011(r217112)
+++ head/sys/netinet/if_ether.c Fri Jan  7 18:14:58 2011(r217113)
@@ -731,6 +731,9 @@ match:
if (la->la_hold != NULL) {
struct mbuf *m_hold, *m_hold_next;
 
+   m_hold = la->la_hold;
+   la->la_hold = NULL;
+   la->la_numheld = 0;
memcpy(&sa, L3_ADDR(la), sizeof(sa));
LLE_WUNLOCK(la);
for (m_hold = la->la_hold, la->la_hold = NULL;
@@ -741,8 +744,6 @@ match:
}
} else
LLE_WUNLOCK(la);
-   la->la_hold = NULL;
-   la->la_numheld = 0;
} /* end of FIB loop */
 reply:
if (op != ARPOP_REQUEST)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r217121 - head/sys/netinet

2011-01-07 Thread George V. Neville-Neil
Author: gnn
Date: Fri Jan  7 20:02:05 2011
New Revision: 217121
URL: http://svn.freebsd.org/changeset/base/217121

Log:
  Fix a memory leak in ARP queues.
  
  Pointed out by: jhb@
  MFC after:2 weeks

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Fri Jan  7 18:54:08 2011(r217120)
+++ head/sys/netinet/if_ether.c Fri Jan  7 20:02:05 2011(r217121)
@@ -736,8 +736,7 @@ match:
la->la_numheld = 0;
memcpy(&sa, L3_ADDR(la), sizeof(sa));
LLE_WUNLOCK(la);
-   for (m_hold = la->la_hold, la->la_hold = NULL;
-m_hold != NULL; m_hold = m_hold_next) {
+   for (; m_hold != NULL; m_hold = m_hold_next) {
m_hold_next = m_hold->m_nextpkt;
m_hold->m_nextpkt = NULL;
(*ifp->if_output)(ifp, m_hold, &sa, NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r217315 - head/sys/netinet

2011-01-12 Thread George V. Neville-Neil
Author: gnn
Date: Wed Jan 12 19:11:17 2011
New Revision: 217315
URL: http://svn.freebsd.org/changeset/base/217315

Log:
  Fix several bugs in the ARP code related to improperly formatted
  packets.
  
  *) Reject requests with a protocol length not equal to 4.  This is IPv4
  and there is no reason to accept anything else.
  
  *) Reject packets that have a multicast source hardware address.
  
  *) Drop requests where the hardware address length is not equal
  to the hardware address length of the interface.
  
  Pointed out by:   Rozhuk Ivan
  MFC after:1 week

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Wed Jan 12 19:06:59 2011(r217314)
+++ head/sys/netinet/if_ether.c Wed Jan 12 19:11:17 2011(r217315)
@@ -531,6 +531,21 @@ in_arpinput(struct mbuf *m)
}
 
ah = mtod(m, struct arphdr *);
+   /* 
+* ARP is only for IPv4 so we can reject packets with
+* a protocol length not equal to an IPv4 address.
+*/
+   if (ah->ar_pln != sizeof(struct in_addr)) {
+   log(LOG_ERR, "in_arp: requested protocol length != %ld\n",
+   sizeof(struct in_addr));
+   return;
+   }
+
+   if (ETHER_IS_MULTICAST(ar_sha(ah))) {
+   log(LOG_ERR, "in_arp: source hardware address is multicast.");
+   return;
+   }
+
op = ntohs(ah->ar_op);
(void)memcpy(&isaddr, ar_spa(ah), sizeof (isaddr));
(void)memcpy(&itaddr, ar_tpa(ah), sizeof (itaddr));
@@ -702,7 +717,7 @@ match:
"arp from %*D: addr len: new %d, i/f %d (ignored)",
ifp->if_addrlen, (u_char *) ar_sha(ah), ":",
ah->ar_hln, ifp->if_addrlen);
-   goto reply;
+   goto drop;
}
(void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen);
la->la_flags |= LLE_VALID;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r217922 - head/sys/fs/nfs

2011-01-26 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jan 27 03:32:16 2011
New Revision: 217922
URL: http://svn.freebsd.org/changeset/base/217922

Log:
  Quick fix to a comment.

Modified:
  head/sys/fs/nfs/nfsport.h

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Thu Jan 27 02:56:03 2011(r217921)
+++ head/sys/fs/nfs/nfsport.h   Thu Jan 27 03:32:16 2011(r217922)
@@ -639,9 +639,9 @@ int nfsmsleep(void *, void *, int, const
 #defineTAILQ_END(head) NULL
 
 /*
- * This must be defined to be a global variable the increments once
+ * This must be defined to be a global variable that increments once
  * per second, but never stops or goes backwards, even when a "date"
- * command changes the tod clock. It is used for delta times for
+ * command changes the TOD clock. It is used for delta times for
  * leases, etc.
  */
 #defineNFSD_MONOSECtime_uptime
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r304825 - head/cddl/lib/libdtrace

2016-08-25 Thread George V. Neville-Neil
Author: gnn
Date: Thu Aug 25 23:24:57 2016
New Revision: 304825
URL: https://svnweb.freebsd.org/changeset/base/304825

Log:
  Unlike Solaris, in FreeBSD p_args can be 0 so check for that
  instead of walking down to ar_args blindly.
  
  Reported by:  Amanda Strnad
  Reviewed by:  markj, jhb
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/cddl/lib/libdtrace/psinfo.d

Modified: head/cddl/lib/libdtrace/psinfo.d
==
--- head/cddl/lib/libdtrace/psinfo.dThu Aug 25 23:06:12 2016
(r304824)
+++ head/cddl/lib/libdtrace/psinfo.dThu Aug 25 23:24:57 2016
(r304825)
@@ -59,7 +59,7 @@ translator psinfo_t < struct proc *T > {
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_addr = 0;
-   pr_psargs = (T->p_args->ar_args == 0) ? "" :
+   pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
pr_arglen = T->p_args->ar_length;
pr_jailid = T->p_ucred->cr_prison->pr_id;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305066 - head/tools/tools/crypto

2016-08-30 Thread George V. Neville-Neil
Author: gnn
Date: Tue Aug 30 14:28:35 2016
New Revision: 305066
URL: https://svnweb.freebsd.org/changeset/base/305066

Log:
  Update cryptotest for modern algorithms
  
  Reviewed by:  cem
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D7598

Modified:
  head/tools/tools/crypto/cryptotest.c

Modified: head/tools/tools/crypto/cryptotest.c
==
--- head/tools/tools/crypto/cryptotest.cTue Aug 30 14:09:24 2016
(r305065)
+++ head/tools/tools/crypto/cryptotest.cTue Aug 30 14:28:35 2016
(r305066)
@@ -126,9 +126,10 @@ struct alg {
{ "blf",0,  8,  5,  56, CRYPTO_BLF_CBC },
{ "cast",   0,  8,  5,  16, CRYPTO_CAST_CBC },
{ "skj",0,  8,  10, 10, CRYPTO_SKIPJACK_CBC },
-   { "aes",0,  16, 16, 16, CRYPTO_RIJNDAEL128_CBC},
-   { "aes192", 0,  16, 24, 24, CRYPTO_RIJNDAEL128_CBC},
-   { "aes256", 0,  16, 32, 32, CRYPTO_RIJNDAEL128_CBC},
+   { "rij",0,  16, 16, 16, CRYPTO_RIJNDAEL128_CBC},
+   { "aes",0,  16, 16, 16, CRYPTO_AES_CBC},
+   { "aes192", 0,  16, 24, 24, CRYPTO_AES_CBC},
+   { "aes256", 0,  16, 32, 32, CRYPTO_AES_CBC},
 #ifdef notdef
{ "arc4",   0,  8,  1,  32, CRYPTO_ARC4 },
 #endif
@@ -139,19 +140,20 @@ struct alg {
{ "sha512", 1,  8,  64, 64, CRYPTO_SHA2_512_HMAC },
 };
 
-static void
+void
 usage(const char* cmd)
 {
printf("usage: %s [-czsbv] [-d dev] [-a algorithm] [count] [size 
...]\n",
cmd);
printf("where algorithm is one of:\n");
-   printf("des 3des (default) blowfish cast skipjack\n");
-   printf("aes (aka rijndael) aes192 aes256 arc4\n");
+   printf("des 3des (default) blowfish cast skipjack rij\n");
+   printf("aes aes192 aes256 arc4\n");
printf("count is the number of encrypt/decrypt ops to do\n");
printf("size is the number of bytes of text to encrypt+decrypt\n");
printf("\n");
printf("-c check the results (slows timing)\n");
-   printf("-d use specific device\n");
+   printf("-d use specific device, specify 'soft' for testing software 
implementations\n");
+   printf("\tNOTE: to use software you must set:\n\t sysctl 
kern.cryptodevallowsoft=1\n");
printf("-z run all available algorithms on a variety of sizes\n");
printf("-v be verbose\n");
printf("-b mark operations for batching\n");
@@ -159,7 +161,7 @@ usage(const char* cmd)
exit(-1);
 }
 
-static struct alg*
+struct alg*
 getalgbycode(int cipher)
 {
int i;
@@ -170,7 +172,7 @@ getalgbycode(int cipher)
return NULL;
 }
 
-static struct alg*
+struct alg*
 getalgbyname(const char* name)
 {
int i;
@@ -181,10 +183,10 @@ getalgbyname(const char* name)
return NULL;
 }
 
-static int
+int
 devcrypto(void)
 {
-   static int fd = -1;
+   int fd = -1;
 
if (fd < 0) {
fd = open(_PATH_DEV "crypto", O_RDWR, 0);
@@ -196,11 +198,14 @@ devcrypto(void)
return fd;
 }
 
-static int
+int
 crlookup(const char *devname)
 {
struct crypt_find_op find;
 
+   if (strncmp(devname, "soft", 4) == 0)
+   return CRYPTO_FLAG_SOFTWARE;
+
find.crid = -1;
strlcpy(find.name, devname, sizeof(find.name));
if (ioctl(devcrypto(), CIOCFINDDEV, &find) == -1)
@@ -208,10 +213,10 @@ crlookup(const char *devname)
return find.crid;
 }
 
-static const char *
+const char *
 crfind(int crid)
 {
-   static struct crypt_find_op find;
+   struct crypt_find_op find;
 
bzero(&find, sizeof(find));
find.crid = crid;
@@ -220,7 +225,7 @@ crfind(int crid)
return find.name;
 }
 
-static int
+int
 crget(void)
 {
int fd;
@@ -232,7 +237,7 @@ crget(void)
return fd;
 }
 
-static char
+char
 rdigit(void)
 {
const char a[] = {
@@ -242,7 +247,7 @@ rdigit(void)
return 0x20+a[random()%nitems(a)];
 }
 
-static void
+void
 runtest(struct alg *alg, int count, int size, u_long cmd, struct timeval *tv)
 {
int i, fd = crget();
@@ -386,7 +391,7 @@ runtest(struct alg *alg, int count, int 
 }
 
 #ifdef __FreeBSD__
-static void
+void
 resetstats()
 {
struct cryptostats stats;
@@ -409,7 +414,7 @@ resetstats()
perror("kern.cryptostats");
 }
 
-static void
+void
 printt(const char* tag, struct cryptotstat *ts)
 {
uint64_t avg, min, max;
@@ -424,7 +429,7 @@ printt(const char* tag, struct cryptotst
 }
 #endif
 
-static void
+void
 runtests(struct alg *alg, int count, int size, u_long cmd, int threads, int 
profile)
 {
int i, status;
_

svn commit: r305304 - head/tools/tools/crypto

2016-09-02 Thread George V. Neville-Neil
Author: gnn
Date: Fri Sep  2 21:11:37 2016
New Revision: 305304
URL: https://svnweb.freebsd.org/changeset/base/305304

Log:
  Clean up the usage message and remove dead code.
  
  Reviewed by:  cem
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D7765

Modified:
  head/tools/tools/crypto/cryptotest.c

Modified: head/tools/tools/crypto/cryptotest.c
==
--- head/tools/tools/crypto/cryptotest.cFri Sep  2 20:41:43 2016
(r305303)
+++ head/tools/tools/crypto/cryptotest.cFri Sep  2 21:11:37 2016
(r305304)
@@ -84,6 +84,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -130,9 +131,6 @@ struct alg {
{ "aes",0,  16, 16, 16, CRYPTO_AES_CBC},
{ "aes192", 0,  16, 24, 24, CRYPTO_AES_CBC},
{ "aes256", 0,  16, 32, 32, CRYPTO_AES_CBC},
-#ifdef notdef
-   { "arc4",   0,  8,  1,  32, CRYPTO_ARC4 },
-#endif
{ "md5",1,  8,  16, 16, CRYPTO_MD5_HMAC },
{ "sha1",   1,  8,  20, 20, CRYPTO_SHA1_HMAC },
{ "sha256", 1,  8,  32, 32, CRYPTO_SHA2_256_HMAC },
@@ -146,8 +144,8 @@ usage(const char* cmd)
printf("usage: %s [-czsbv] [-d dev] [-a algorithm] [count] [size 
...]\n",
cmd);
printf("where algorithm is one of:\n");
-   printf("des 3des (default) blowfish cast skipjack rij\n");
-   printf("aes aes192 aes256 arc4\n");
+   printf("null des 3des (default) blowfish cast skipjack rij\n");
+   printf("aes aes192 aes256 md5 sha1 sha256 sha384 sha512\n");
printf("count is the number of encrypt/decrypt ops to do\n");
printf("size is the number of bytes of text to encrypt+decrypt\n");
printf("\n");
@@ -158,6 +156,7 @@ usage(const char* cmd)
printf("-v be verbose\n");
printf("-b mark operations for batching\n");
printf("-p profile kernel crypto operation (must be root)\n");
+   printf("-t n for n threads and run tests concurrently\n");
exit(-1);
 }
 
@@ -483,17 +482,10 @@ runtests(struct alg *alg, int count, int
if (t) {
int nops = alg->ishash ? count : 2*count;
 
-#if 0
-   t /= threads;
-   printf("%6.3lf sec, %7d %6s crypts, %7d bytes, %8.0lf byte/sec, 
%7.1lf Mb/sec\n",
-   t, nops, alg->name, size, (double)nops*size / t,
-   (double)nops*size / t * 8 / 1024 / 1024);
-#else
nops *= threads;
printf("%8.3lf sec, %7d %6s crypts, %7d bytes, %8.0lf byte/sec, 
%7.1lf Mb/sec\n",
t, nops, alg->name, size, (double)nops*size / t,
(double)nops*size / t * 8 / 1024 / 1024);
-#endif
}
 #ifdef __FreeBSD__
if (profile) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305307 - head/tools/tools/crypto

2016-09-02 Thread George V. Neville-Neil
Author: gnn
Date: Fri Sep  2 21:35:32 2016
New Revision: 305307
URL: https://svnweb.freebsd.org/changeset/base/305307

Log:
  Add a runner script for cryptotest.
  
  Althought cryptotest itself has a -z mode to test all algorithms at a variety
  of sizes, this script allows us to be more selective.  Threads and buffer 
sizes
  move in powers of two from 1, for threads, and 256 for buffer sizes.
  
  e.g.  cryptorun.sh aes 4 512
  
  Test aes with 1, 2 and 4 processes, and at sizes of 256 and 512 bytes.
  
  Sponsored by: Rubicon Communications, LLC (Netgate)

Added:
  head/tools/tools/crypto/cryptorun.sh   (contents, props changed)

Added: head/tools/tools/crypto/cryptorun.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/tools/crypto/cryptorun.shFri Sep  2 21:35:32 2016
(r305307)
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# A simple test runner for cryptotest
+#
+# Althought cryptotest itself has a -z mode to test all algorithms at
+# a variety of sizes, this script allows us to be more selective.
+# Threads and buffer sizes move in powers of two from 1, for threads,
+# and 256 for buffer sizes.
+#
+# e.g.  cryptorun.sh aes 4 512
+#
+# Test aes with 1, 2 and 4 processes, and at sizes of 256 and 512 bytes.
+#
+# $FreeBSD$
+#
+
+threads=1
+size=256
+iterations=100
+crypto="/tank/users/gnn/Repos/svn/FreeBSD.HEAD/tools/tools/crypto/cryptotest"
+max_threads=$2
+max_size=$3 
+
+while [ "$threads" -le "$max_threads" ]; do
+   echo "Testing with $threads processes."
+   while [ "$size" -le "$max_size" ]; do
+   $crypto -t $threads -a $1 $iterations $size
+   size=$(($size * 2))
+   done
+   size=256
+   threads=$(($threads * 2))
+done
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r305312 - head/tools/tools/crypto

2016-09-02 Thread George V. Neville-Neil
Author: gnn
Date: Sat Sep  3 00:22:42 2016
New Revision: 305312
URL: https://svnweb.freebsd.org/changeset/base/305312

Log:
  Add cpuset support to separate forked processes.
  
  Reviewed by:  cem
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D7766

Modified:
  head/tools/tools/crypto/cryptotest.c

Modified: head/tools/tools/crypto/cryptotest.c
==
--- head/tools/tools/crypto/cryptotest.cFri Sep  2 22:47:57 2016
(r305311)
+++ head/tools/tools/crypto/cryptotest.cSat Sep  3 00:22:42 2016
(r305312)
@@ -97,6 +97,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -468,6 +469,11 @@ runtests(struct alg *alg, int count, int
if (threads > 1) {
for (i = 0; i < threads; i++)
if (fork() == 0) {
+   cpuset_t mask;
+   CPU_ZERO(&mask);
+   CPU_SET(i, &mask);
+   cpuset_setaffinity(CPU_LEVEL_WHICH, 
CPU_WHICH_PID,
+   -1, sizeof(mask), &mask);
runtest(alg, count, size, cmd, &tvp[i]);
exit(0);
}
@@ -573,6 +579,9 @@ main(int argc, char **argv)
}
argc--, argv++;
}
+   if (maxthreads > CPU_SETSIZE)
+   errx(EX_USAGE, "Too many threads, %d, choose fewer.", 
maxthreads);
+   
if (nsizes == 0) {
if (alg)
sizes[nsizes++] = alg->blocksize;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r307044 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-10-11 Thread George V. Neville-Neil
Author: gnn
Date: Tue Oct 11 16:12:12 2016
New Revision: 307044
URL: https://svnweb.freebsd.org/changeset/base/307044

Log:
  Corrected non-portable reuse of va_list in dt_printf()
  
  Submitted by: Graeme Jenkinson
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8157

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.cTue Oct 
11 15:55:45 2016(r307043)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.cTue Oct 
11 16:12:12 2016(r307044)
@@ -581,6 +581,7 @@ int
 dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
 {
va_list ap;
+   va_list ap2;
int n;
 
 #ifndef illumos
@@ -605,11 +606,13 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
len = dtp->dt_sprintf_buflen - len;
assert(len >= 0);
 
-   if ((n = vsnprintf(buf, len, format, ap)) < 0)
+   va_copy(ap2, ap);
+   if ((n = vsnprintf(buf, len, format, ap2)) < 0)
n = dt_set_errno(dtp, errno);
 
+   va_end(ap2);
va_end(ap);
-
+   
return (n);
}
 
@@ -640,11 +643,14 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_buf[0] = '\0';
}
 
-   if ((needed = vsnprintf(NULL, 0, format, ap)) < 0) {
+   va_copy(ap2, ap);
+   if ((needed = vsnprintf(NULL, 0, format, ap2)) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
if (needed == 0) {
va_end(ap);
@@ -670,12 +676,15 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
dtp->dt_buffered_size <<= 1;
}
 
+   va_copy(ap2, ap);
if (vsnprintf(&dtp->dt_buffered_buf[dtp->dt_buffered_offs],
-   avail, format, ap) < 0) {
+   avail, format, ap2) < 0) {
rval = dt_set_errno(dtp, errno);
+   va_end(ap2);
va_end(ap);
return (rval);
}
+   va_end(ap2);
 
dtp->dt_buffered_offs += needed;
assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
@@ -683,8 +692,10 @@ dt_printf(dtrace_hdl_t *dtp, FILE *fp, c
return (0);
}
 
-   n = vfprintf(fp, format, ap);
+   va_copy(ap2, ap);
+   n = vfprintf(fp, format, ap2);
fflush(fp);
+   va_end(ap2);
va_end(ap);
 
if (n < 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313045 - in head: cddl/lib/libdtrace sys/netinet

2017-02-01 Thread George V. Neville-Neil
Author: gnn
Date: Wed Feb  1 19:33:00 2017
New Revision: 313045
URL: https://svnweb.freebsd.org/changeset/base/313045

Log:
  Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP 
probes.
  
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9401

Modified:
  head/cddl/lib/libdtrace/ip.d
  head/sys/netinet/in_kdtrace.c

Modified: head/cddl/lib/libdtrace/ip.d
==
--- head/cddl/lib/libdtrace/ip.dWed Feb  1 16:15:23 2017
(r313044)
+++ head/cddl/lib/libdtrace/ip.dWed Feb  1 19:33:00 2017
(r313045)
@@ -238,6 +238,24 @@ translator ipinfo_t < uint8_t *p > {
inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst);
 };
 
+#pragma D binding "1.13" translator
+translator ipinfo_t < struct mbuf *m > {
+   ip_ver =m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v;
+   ip_plength =m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   ntohs(((struct ip *)m->m_data)->ip_len) - 
+   (((struct ip *)m->m_data)->ip_hl << 2):
+   ntohs(((struct ip6_hdr 
*)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen);
+   ip_saddr =  m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) :
+   inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src);
+   ip_daddr =  m == NULL ? 0 :
+   ((struct ip *)m->m_data)->ip_v == 4 ?
+   inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) :
+   inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst);
+};
+
 #pragma D binding "1.5" IFF_LOOPBACK
 inline int IFF_LOOPBACK =  0x8;
 

Modified: head/sys/netinet/in_kdtrace.c
==
--- head/sys/netinet/in_kdtrace.c   Wed Feb  1 16:15:23 2017
(r313044)
+++ head/sys/netinet/in_kdtrace.c   Wed Feb  1 19:33:00 2017
(r313045)
@@ -56,28 +56,28 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send,
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfo_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
 SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
@@ -91,7 +91,7 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , connect
 SDT_PROBE_DEFINE5_XLATE(tcp, , , receive,
 "void *", "pktinfo_t *",
 "struct tcpcb *", "csinfo_t *",
-"uint8_t *", "ipinfo_t *",
+"struct mbuf *", "ipinfo_t *",
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfoh_t *");
 
@@ -113,7 +113,7 @@ SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__
 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__output,
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfo_t *",
-"uint8_t *", "ipinfo_t *");
+"struct mbuf *", "ipinfo_t *");
 
 SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__user,
 "struct tcpcb *", "tcpsinfo_t *" ,
@@ -122,7 +122,7 @@ SDT_PROBE_DEFINE2_XLATE(tcp, , , debug__
 SDT_PROBE_DEFINE3_XLATE(tcp, , , debug__drop,
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfo_t *",
-"uint8_t *", "ipinfo_t *");
+"struct mbuf *", "ipinfo_t *");
 
 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
 "void *", "void *",
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r313176 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/sys modules/dtrace/dtrace modules/dtrace/fasttrap modules/dtrace/systrace

2017-02-03 Thread George V. Neville-Neil
Author: gnn
Date: Fri Feb  3 22:26:19 2017
New Revision: 313176
URL: https://svnweb.freebsd.org/changeset/base/313176

Log:
  Replace the implementation of DTrace's RAND subroutine for generating
  low-quality random numbers with a modern implementation (xoroshiro128+)
  that is capable of generating better quality randomness without compromising 
performance.
  
  Submitted by: Graeme Jenkinson
  Reviewed by:  markj
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D9051

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
  head/sys/modules/dtrace/dtrace/Makefile
  head/sys/modules/dtrace/fasttrap/Makefile
  head/sys/modules/dtrace/systrace/Makefile

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cFri Feb 
 3 21:37:27 2017(r313175)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cFri Feb 
 3 22:26:19 2017(r313176)
@@ -124,6 +124,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -136,6 +137,8 @@
 #include "dtrace_debug.c"
 #endif
 
+#include "dtrace_xoroshiro128_plus.h"
+
 /*
  * DTrace Tunable Variables
  *
@@ -298,7 +301,6 @@ static kmutex_t dtrace_meta_lock;   /* me
 #define vuprintf   vprintf
 #define ttoproc(_a)((_a)->td_proc)
 #define crgetzoneid(_a)0
-#defineNCPUMAXCPU
 #define SNOCD  0
 #define CPU_ON_INTR(_a)0
 
@@ -4236,7 +4238,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
 
switch (subr) {
case DIF_SUBR_RAND:
-   regs[rd] = (dtrace_gethrtime() * 2416 + 374441) % 1771875;
+   regs[rd] = dtrace_xoroshiro128_plus_next(
+   state->dts_rstate[curcpu]);
break;
 
 #ifdef illumos
@@ -14495,6 +14498,7 @@ dtrace_state_create(struct cdev *dev, st
dtrace_state_t *state;
dtrace_optval_t *opt;
int bufsize = NCPU * sizeof (dtrace_buffer_t), i;
+   int cpu_it;
 
ASSERT(MUTEX_HELD(&dtrace_lock));
ASSERT(MUTEX_HELD(&cpu_lock));
@@ -14550,6 +14554,21 @@ dtrace_state_create(struct cdev *dev, st
state->dts_buffer = kmem_zalloc(bufsize, KM_SLEEP);
state->dts_aggbuffer = kmem_zalloc(bufsize, KM_SLEEP);
 
+   /*
+ * Allocate and initialise the per-process per-CPU random state.
+* SI_SUB_RANDOM < SI_SUB_DTRACE_ANON therefore entropy device is
+ * assumed to be seeded at this point (if from Fortuna seed file).
+*/
+   (void) read_random(&state->dts_rstate[0], 2 * sizeof(uint64_t));
+   for (cpu_it = 1; cpu_it < NCPU; cpu_it++) {
+   /*
+* Each CPU is assigned a 2^64 period, non-overlapping
+* subsequence.
+*/
+   dtrace_xoroshiro128_plus_jump(state->dts_rstate[cpu_it-1],
+   state->dts_rstate[cpu_it]); 
+   }
+
 #ifdef illumos
state->dts_cleaner = CYCLIC_NONE;
state->dts_deadman = CYCLIC_NONE;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h  Fri Feb 
 3 21:37:27 2017(r313175)
+++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h  Fri Feb 
 3 22:26:19 2017(r313176)
@@ -50,6 +50,7 @@ extern "C" {
  */
 
 #include 
+
 #ifndef illumos
 #ifdef __sparcv9
 typedef uint32_t   pc_t;
@@ -65,6 +66,10 @@ typedef  u_long  greg_t;
 #defineDTRACE_MAXPROPLEN   128
 #defineDTRACE_DYNVAR_CHUNKSIZE 256
 
+#ifdef __FreeBSD__
+#defineNCPUMAXCPU
+#endif /* __FreeBSD__ */
+
 struct dtrace_probe;
 struct dtrace_ecb;
 struct dtrace_predicate;
@@ -1169,6 +1174,7 @@ struct dtrace_state {
dtrace_cred_t dts_cred; /* credentials */
size_t dts_nretained;   /* number of retained enabs */
int dts_getf;   /* number of getf() calls */
+   uint64_t dts_rstate[NCPU][2];   /* per-CPU random state */
 };
 
 struct dtrace_provider {

Modified: head/sys/modules/dtrace/dtrace/Makefile
==
--- head/sys/modules/dtrace/dtrace/Makefile Fri Feb  3 21:37:27 2017
(r313175)
+++ head/sys/modules/dtrace/dtrace/Makefile Fri Feb  3 22:26:19 2017
(r313176)
@@ -12,6 +12,7 @@ ARCHDIR=  ${MACHINE_CPUARCH}
 
 KMOD=  dtrace
 SRCS=  dtrace.c \
+   dtrace_xoroshiro128_plus.c \
dtrace_asm.S \
dtrace_subr.c

svn commit: r313177 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2017-02-03 Thread George V. Neville-Neil
Author: gnn
Date: Fri Feb  3 22:40:13 2017
New Revision: 313177
URL: https://svnweb.freebsd.org/changeset/base/313177

Log:
  Files which implement the new random number system code for DTrace
  
  Submitted by: Graeme Jenkinson
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Added:
  
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.c  
 (contents, props changed)
  
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h  
 (contents, props changed)

Added: 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.c  
Fri Feb  3 22:40:13 2017(r313177)
@@ -0,0 +1,89 @@
+/*-
+ * Copyright (c) 2016 (Graeme Jenkinson)
+ * All rights reserved.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include 
+
+#include "dtrace_xoroshiro128_plus.h"
+
+static __inline uint64_t
+rotl(const uint64_t x, int k)
+{
+   return (x << k) | (x >> (64 - k));
+}
+
+/*
+ * This is the jump function for the generator. It is equivalent to 2^64 calls
+ * to next(); it can be used to generate 2^64 non-overlapping subsequences for
+ * parallel computations.
+ */
+void
+dtrace_xoroshiro128_plus_jump(uint64_t * const state,
+   uint64_t * const jump_state)
+{
+   static const uint64_t JUMP[] = { 0xbeac0467eba5facb,
+   0xd86b048b86aa9922 };
+
+   uint64_t s0 = 0;
+   uint64_t s1 = 0;
+   int i = 0;
+   int b = 0;
+   for (i = 0; i < sizeof JUMP / sizeof *JUMP; i++) {
+   for (b = 0; b < 64; b++) {
+   if (JUMP[i] & 1ULL << b) {
+   s0 ^= state[0];
+   s1 ^= state[1];
+   }
+   dtrace_xoroshiro128_plus_next(state);
+   }
+   }
+   jump_state[0] = s0;
+   jump_state[1] = s1;
+}
+
+/*
+ * xoroshiro128+ - XOR/rotate/shift/rotate
+ * xorshift.di.unimi.it
+ */
+uint64_t
+dtrace_xoroshiro128_plus_next(uint64_t * const state)
+{
+   const uint64_t s0 = state[0];
+   uint64_t s1 = state[1];
+   uint64_t result;
+   result = s0 + s1;
+
+   s1 ^= s0;
+   state[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14);
+   state[1] = rotl(s1, 36);
+
+   return result;
+}

Added: 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h  
Fri Feb  3 22:40:13 2017(r313177)
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2016 (Graeme Jenkinson)
+ * All rights reserved.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of condition

svn commit: r313359 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2017-02-06 Thread George V. Neville-Neil
Author: gnn
Date: Tue Feb  7 01:21:18 2017
New Revision: 313359
URL: https://svnweb.freebsd.org/changeset/base/313359

Log:
  Fix the ifdef protection and remove superfluous extern statements
  
  Reported by:  Konstantin Belousov
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h

Modified: 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h
==
--- 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h  
Tue Feb  7 00:47:33 2017(r313358)
+++ 
head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace_xoroshiro128_plus.h  
Tue Feb  7 01:21:18 2017(r313359)
@@ -32,9 +32,10 @@
 
 #ifndef _DTRACE_XOROSHIRO128_PLUS_H
 #define _DTRACE_XOROSHIRO128_PLUS_H
-#endif
 
 #include 
 
-extern void dtrace_xoroshiro128_plus_jump(uint64_t * const, uint64_t * const);
-extern uint64_t dtrace_xoroshiro128_plus_next(uint64_t * const);
+void dtrace_xoroshiro128_plus_jump(uint64_t * const, uint64_t * const);
+uint64_t dtrace_xoroshiro128_plus_next(uint64_t * const);
+
+#endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r323253 - head/cddl/lib/libdtrace

2017-09-06 Thread George V. Neville-Neil
Author: gnn
Date: Thu Sep  7 03:05:16 2017
New Revision: 323253
URL: https://svnweb.freebsd.org/changeset/base/323253

Log:
  Add D definitions for the named values in socket.h
  
  Reviewed by:  markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D12241

Added:
  head/cddl/lib/libdtrace/socket.d   (contents, props changed)
Modified:
  head/cddl/lib/libdtrace/Makefile

Modified: head/cddl/lib/libdtrace/Makefile
==
--- head/cddl/lib/libdtrace/MakefileThu Sep  7 00:20:17 2017
(r323252)
+++ head/cddl/lib/libdtrace/MakefileThu Sep  7 03:05:16 2017
(r323253)
@@ -54,6 +54,7 @@ DSRCS=errno.d \
siftr.d \
signal.d\
tcp.d   \
+   socket.d\
udp.d   \
unistd.d
 

Added: head/cddl/lib/libdtrace/socket.d
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/lib/libdtrace/socket.dThu Sep  7 03:05:16 2017
(r323253)
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2017 George V. Neville-Neil
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ * Translators and flags for the socket structure.  FreeBSD specific code.
+ */
+
+#pragma D depends_on module kernel
+
+/*
+ * Option flags per-socket.
+ */
+#pragma D binding "1.13" SO_DEBUG
+inline int SO_DEBUG =  0x0001; /* turn on debugging info 
recording */
+#pragma D binding "1.13" SO_ACCEPTCONN
+inline int SO_ACCEPTCONN = 0x0002; /* socket has had listen() */
+#pragma D binding "1.13" SO_REUSEADDR
+inline int SO_REUSEADDR =  0x0004; /* allow local address reuse */
+#pragma D binding "1.13" SO_KEEPALIVE
+inline int SO_KEEPALIVE =  0x0008; /* keep connections alive */
+#pragma D binding "1.13" SO_DONTROUTE
+inline int SO_DONTROUTE =  0x0010; /* just use interface addresses 
*/
+#pragma D binding "1.13" SO_BROADCAST
+inline int SO_BROADCAST =  0x0020; /* permit sending of broadcast 
msgs */
+#pragma D binding "1.13" SO_USELOOPBACK
+inline int SO_USELOOPBACK =0x0040; /* bypass hardware when 
possible */
+#pragma D binding "1.13" SO_LINGER
+inline int SO_LINGER = 0x0080; /* linger on close if data 
present */
+#pragma D binding "1.13" SO_OOBINLINE
+inline int SO_OOBINLINE =  0x0100; /* leave received OOB data in 
line */
+#pragma D binding "1.13" SO_REUSEPORT
+inline int SO_REUSEPORT =  0x0200; /* allow local address & port 
reuse */
+#pragma D binding "1.13" SO_TIMESTAMP
+inline int SO_TIMESTAMP =  0x0400; /* timestamp received dgram 
traffic */
+#pragma D binding "1.13" SO_NOSIGPIPE
+inline int SO_NOSIGPIPE =  0x0800; /* no SIGPIPE from EPIPE */
+#pragma D binding "1.13" SO_ACCEPTFILTER
+inline int SO_ACCEPTFILTER =   0x1000; /* there is an accept filter */
+#pragma D binding "1.13" SO_BINTIME
+inline int SO_BINTIME =0x2000; /* timestamp received 
dgram traffic */
+#pragma D binding "1.13" SO_NO_OFFLOAD
+inline int SO_NO_OFFLOAD = 0x4000; /* socket cannot be offloaded */
+#pragma D binding "1.13" SO_NO_DDP
+inline int SO_NO_DDP = 0x8000; /* disable direct data 
placement */
+

svn commit: r342139 - in head: . bin/date libexec/rc/rc.d share/man/man5 tools/build/mk tools/build/options usr.sbin usr.sbin/timed

2018-12-15 Thread George V. Neville-Neil
Author: gnn
Date: Sat Dec 15 21:34:40 2018
New Revision: 342139
URL: https://svnweb.freebsd.org/changeset/base/342139

Log:
  Remove, the now very outdated, timed.
  
  Submitted by: Kyle Spiers ksspiers at gmail
  Reviewed by:  bcr,brooks,bz,sbruno
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D18505

Deleted:
  head/bin/date/extern.h
  head/bin/date/netdate.c
  head/libexec/rc/rc.d/timed
  head/tools/build/options/WITHOUT_TIMED
  head/usr.sbin/timed/
Modified:
  head/ObsoleteFiles.inc
  head/UPDATING
  head/bin/date/Makefile
  head/bin/date/Makefile.depend
  head/bin/date/date.c
  head/libexec/rc/rc.d/Makefile
  head/share/man/man5/src.conf.5
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Sat Dec 15 20:07:32 2018(r342138)
+++ head/ObsoleteFiles.inc  Sat Dec 15 21:34:40 2018(r342139)
@@ -38,6 +38,12 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20181214: Remove timed files
+OLD_FILES+=etc/rc.d/timed
+OLD_FILES+=usr/sbin/timed
+OLD_FILES+=usr/sbin/timedc
+OLD_FILES+=usr/share/man/man8/timed.8.gz
+OLD_FILES+=usr/share/man/man8/timedc.8.gz
 # 20181211: new clang import which bumps version from 6.0.1 to 7.0.1.
 OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/asan_interface.h

Modified: head/UPDATING
==
--- head/UPDATING   Sat Dec 15 20:07:32 2018(r342138)
+++ head/UPDATING   Sat Dec 15 21:34:40 2018(r342139)
@@ -37,6 +37,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
prerequisites and upgrading, if you are not already using clang 3.5.0
or higher.
 
+20181211:
+   Remove the timed and netdate programs from the base tree.  Setting
+   the time with these deamons has been obsolete for over a decade.
+
 20181126:
On amd64, arm64 and armv7 (architectures that install LLVM's ld.lld
linker as /usr/bin/ld) GNU ld is no longer installed as ld.bfd, as

Modified: head/bin/date/Makefile
==
--- head/bin/date/Makefile  Sat Dec 15 20:07:32 2018(r342138)
+++ head/bin/date/Makefile  Sat Dec 15 21:34:40 2018(r342139)
@@ -5,7 +5,7 @@
 
 PACKAGE=runtime
 PROG=  date
-SRCS=  date.c netdate.c vary.c
+SRCS=  date.c vary.c
 
 HAS_TESTS=
 SUBDIR.${MK_TESTS}+= tests

Modified: head/bin/date/Makefile.depend
==
--- head/bin/date/Makefile.depend   Sat Dec 15 20:07:32 2018
(r342138)
+++ head/bin/date/Makefile.depend   Sat Dec 15 21:34:40 2018
(r342139)
@@ -4,7 +4,6 @@
 DIRDEPS = \
gnu/lib/csu \
include \
-   include/protocols \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \

Modified: head/bin/date/date.c
==
--- head/bin/date/date.cSat Dec 15 20:07:32 2018(r342138)
+++ head/bin/date/date.cSat Dec 15 21:34:40 2018(r342139)
@@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "extern.h"
 #include "vary.h"
 
 #ifndefTM_YEAR_BASE
@@ -67,7 +66,6 @@ __FBSDID("$FreeBSD$");
 #endif
 
 static time_t tval;
-int retval;
 
 static void badformat(void);
 static void iso8601_usage(const char *);
@@ -248,7 +246,7 @@ printdate(const char *buf)
(void)printf("%s\n", buf);
if (fflush(stdout))
err(1, "stdout");
-   exit(retval);
+   exit(EXIT_SUCCESS);
 }
 
 static void
@@ -370,7 +368,7 @@ setthetime(const char *fmt, const char *p, int jflag, 
 
if (!jflag) {
/* set the time */
-   if (nflag || netsettime(tval)) {
+   if (nflag) {
utx.ut_type = OLD_TIME;
memset(utx.ut_id, 0, sizeof(utx.ut_id));
(void)gettimeofday(&utx.ut_tv, NULL);

Modified: head/libexec/rc/rc.d/Makefile
==
--- head/libexec/rc/rc.d/Makefile   Sat Dec 15 20:07:32 2018
(r342138)
+++ head/libexec/rc/rc.d/Makefile   Sat Dec 15 21:34:40 2018
(r342139)
@@ -291,10 +291,6 @@ SMRCD= sendmail
 SMRCDPACKAGE=  sendmail
 .endif
 
-.if ${MK_TIMED} != "no"
-CONFS+=timed
-.endif
-
 .if ${MK_UNBOUND} != "no"
 CONFGROUPS+=   UNBOUND
 UNBOUND+=  local_unbound

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Sat Dec 15 20:07:32 2018
(r342138)
+++ head/share/man/man5/src.conf.5  Sat Dec

svn commit: r269140 - head/cddl/contrib/dtracetoolkit

2014-07-26 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul 26 19:21:53 2014
New Revision: 269140
URL: http://svnweb.freebsd.org/changeset/base/269140

Log:
  Port the rwsnoop DTrace Toolkit script to FreeBSD.
  Remove dependency on the Korn Shell.
  Remove Zones in favor of Jails.
  Remove support (for now) for filename printing.

Modified:
  head/cddl/contrib/dtracetoolkit/rwsnoop

Modified: head/cddl/contrib/dtracetoolkit/rwsnoop
==
--- head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 19:08:52 2014
(r269139)
+++ head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 19:21:53 2014
(r269140)
@@ -1,10 +1,10 @@
-#!/usr/bin/ksh
+#!/bin/sh
 #
 # rwsnoop - snoop read/write events.
-#   Written using DTrace (Solaris 10 3/05).
+#   Originally written using DTrace (Solaris 10 3/05).
 #
 # This is measuring reads and writes at the application level. This matches
-# the syscalls read, write, pread and pwrite.
+# the syscalls read, and write.
 #
 # $Id: rwsnoop 3 2007-08-01 10:50:08Z brendan $
 #
@@ -12,15 +12,14 @@
 # 
 #  rwsnoop # default output
 #
-#  -j  # print project ID
 #  -P  # print parent process ID
 #  -t  # print timestamp, us
 #  -v  # print time, string
-#  -Z  # print zone ID
+#  -J  # print jail ID
 #  -n name # this process name only
 #  -p PID  # this PID only
 #  eg,
-#  rwsnoop -Z  # print zone ID
+#  rwsnoop -J  # print jail ID
 #  rwsnoop -n bash # monitor processes named "bash"
 #  rwsnoop > out.txt   # recommended
 #
@@ -32,8 +31,7 @@
 # FIELDS:
 #  TIMETimestamp, us
 #  TIMESTR Time, string
-#  ZONEZone ID
-#  PROJProject ID
+#  JAILJAIL ID
 #  UID User ID
 #  PID Process ID
 #  PPIDParent Process ID
@@ -71,6 +69,7 @@
 # 24-Jul-2005   Brendan Gregg   Created this.
 # 17-Sep-2005 "  " Increased switchrate.
 # 17-Sep-2005 "  " Last update.
+# 26-Jul-2014   George Neville-NeilPort to FreeBSD
 #
 
 
@@ -78,9 +77,11 @@
 # --- Process Arguments ---
 #
 
+set -x
+set -v
 ### default variables
-opt_name=0; opt_pid=0; opt_proj=0; opt_zone=0; opt_time=0; opt_timestr=0
-opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0
+opt_name=0; opt_pid=0; opt_jailid=0; opt_time=0; opt_timestr=0
+opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0;
 
 ### process options
 while getopts n:Pp:jtvZ name
@@ -89,23 +90,21 @@ do
n)  opt_name=1; pname=$OPTARG ;;
p)  opt_pid=1; pid=$OPTARG ;;
P)  opt_ppid=1 ;;
-   j)  opt_proj=1 ;;
t)  opt_time=1 ;;
v)  opt_timestr=1 ;;
-   Z)  opt_zone=1 ;;
+   J)  opt_jailid=1 ;;
h|?)cat <<-END >&2
USAGE: rwsnoop [-jPtvZ] [-n name] [-p pid]
  
-   -j   # print project ID
-P   # print parent process ID
-t   # print timestamp, us
-v   # print time, string
-   -Z   # print zone ID
+   -J   # print jail ID
-n name  # this process name only
-p PID   # this PID only
   eg,
rwsnoop  # default output
-   rwsnoop -Z   # print zone ID
+   rwsnoop -J   # print jail ID
rwsnoop -n bash  # monitor processes named "bash"
END
exit 1
@@ -115,11 +114,13 @@ done
 shift $(( $OPTIND - 1 ))
 
 ### option logic
-if (( opt_name || opt_pid )); then
+if [ $opt_name -ne 0 ]; then
filter=1
 fi
 
-
+if [ $opt_pid -ne 0 ]; then
+   filter=1
+fi
 
 #
 # --- Main Program, DTrace ---
@@ -128,8 +129,7 @@ fi
  /*
   * Command line arguments
   */
- inline int OPT_proj   = '$opt_proj';
- inline int OPT_zone   = '$opt_zone';
+ inline int OPT_jailid = '$opt_jailid';
  inline int OPT_bytes  = '$opt_bytes';
  inline int OPT_name   = '$opt_name';
  inline int OPT_ppid   = '$opt_ppid';
@@ -151,8 +151,7 @@ fi
/* print header */
OPT_time? printf("%-14s ", "TIME") : 1;
OPT_timestr ? printf("%-20s ", "TIMESTR") : 1;
-   OPT_proj? printf("%5s ", "PROJ") : 1;
-   OPT_zone? printf("%5s ", "ZONE") : 1;
+   OPT_jailid? printf("%5s ", "JAILID") : 1;
OPT_ppid? printf("%6s ", "PPID") : 1;
printf("%5s %6s %-12s %1s %7s %s\

svn commit: r269141 - head/cddl/contrib/dtracetoolkit

2014-07-26 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul 26 19:25:52 2014
New Revision: 269141
URL: http://svnweb.freebsd.org/changeset/base/269141

Log:
  Remove debugging options from the rwsnoop script.

Modified:
  head/cddl/contrib/dtracetoolkit/rwsnoop

Modified: head/cddl/contrib/dtracetoolkit/rwsnoop
==
--- head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 19:21:53 2014
(r269140)
+++ head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 19:25:52 2014
(r269141)
@@ -77,8 +77,6 @@
 # --- Process Arguments ---
 #
 
-set -x
-set -v
 ### default variables
 opt_name=0; opt_pid=0; opt_jailid=0; opt_time=0; opt_timestr=0
 opt_bytes=1; filter=0; pname=.; pid=0; opt_ppid=0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r269144 - head/cddl/contrib/dtracetoolkit

2014-07-26 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul 26 20:11:36 2014
New Revision: 269144
URL: http://svnweb.freebsd.org/changeset/base/269144

Log:
  Since we cannot yet display the name print the file descriptor so that
  it can be looked up manually using procstat(1).

Modified:
  head/cddl/contrib/dtracetoolkit/rwsnoop

Modified: head/cddl/contrib/dtracetoolkit/rwsnoop
==
--- head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 19:44:45 2014
(r269143)
+++ head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 20:11:36 2014
(r269144)
@@ -152,7 +152,7 @@ fi
OPT_jailid? printf("%5s ", "JAILID") : 1;
OPT_ppid? printf("%6s ", "PPID") : 1;
printf("%5s %6s %-12s %1s %7s %s\n",
-   "UID", "PID", "CMD", "D", "BYTES", "FILE");
+   "UID", "PID", "CMD", "FD", "D", "BYTES");
  }
 
  /*
@@ -221,8 +221,8 @@ fi
OPT_timestr ? printf("%-20Y ", walltimestamp) : 1;
OPT_jailid? printf("%5d ", curpsinfo->pr_jailid) : 1;
OPT_ppid? printf("%6d ", ppid) : 1;
-   printf("%5d %6d %-12.12s %1s %7d \n",
-   uid, pid, execname, self->rw, (int)self->size);
+   printf("%5d %6d %-12.12s %4d %1s %7d\n",
+   uid, pid, execname, self->fd, self->rw, (int)self->size);

self->ok = 0;
self->fd = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r269145 - head/cddl/contrib/dtracetoolkit

2014-07-26 Thread George V. Neville-Neil
Author: gnn
Date: Sat Jul 26 20:42:54 2014
New Revision: 269145
URL: http://svnweb.freebsd.org/changeset/base/269145

Log:
  Update the header printing to match the rest of the output.
  
  Pointed out by: mdf

Modified:
  head/cddl/contrib/dtracetoolkit/rwsnoop

Modified: head/cddl/contrib/dtracetoolkit/rwsnoop
==
--- head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 20:11:36 2014
(r269144)
+++ head/cddl/contrib/dtracetoolkit/rwsnoop Sat Jul 26 20:42:54 2014
(r269145)
@@ -151,7 +151,7 @@ fi
OPT_timestr ? printf("%-20s ", "TIMESTR") : 1;
OPT_jailid? printf("%5s ", "JAILID") : 1;
OPT_ppid? printf("%6s ", "PPID") : 1;
-   printf("%5s %6s %-12s %1s %7s %s\n",
+   printf("%5s %6s %-12s %4s %1s %7s\n",
"UID", "PID", "CMD", "FD", "D", "BYTES");
  }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r269182 - head/lib/libpmc

2014-07-28 Thread George V. Neville-Neil
Author: gnn
Date: Mon Jul 28 10:17:41 2014
New Revision: 269182
URL: http://svnweb.freebsd.org/changeset/base/269182

Log:
  Update the list of cross references to include the more modern set of
  processors that we now support.

Modified:
  head/lib/libpmc/pmc.3

Modified: head/lib/libpmc/pmc.3
==
--- head/lib/libpmc/pmc.3   Mon Jul 28 10:01:23 2014(r269181)
+++ head/lib/libpmc/pmc.3   Mon Jul 28 10:17:41 2014(r269182)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 24, 2008
+.Dd July 28, 2014
 .Dt PMC 3
 .Os
 .Sh NAME
@@ -525,14 +525,26 @@ API is
 .Xr pmc.atom 3 ,
 .Xr pmc.core 3 ,
 .Xr pmc.core2 3 ,
+.Xr pmc.haswell 3 ,
+.Xr pmc.haswelluc 3 ,
 .Xr pmc.iaf 3 ,
+.Xr pmc.ivybridge 3 ,
+.Xr pmc.ivybridgexeon 3 ,
 .Xr pmc.k7 3 ,
 .Xr pmc.k8 3 ,
+.Xr pmc.mips24k 3 ,
+.Xr pmc.octeon 3 ,
 .Xr pmc.p4 3 ,
 .Xr pmc.p5 3 ,
 .Xr pmc.p6 3 ,
+.Xr pmc.sandybridge 3 ,
+.Xr pmc.sandybridgeuc 3 ,
+.Xr pmc.sandybridgexeon 3 ,
 .Xr pmc.soft 3 ,
 .Xr pmc.tsc 3 ,
+.Xr pmc.westmere 3 ,
+.Xr pmc.westmereuc 3 ,
+.Xr pmc.xscale 3 ,
 .Xr pmclog 3 ,
 .Xr hwpmc 4 ,
 .Xr pmccontrol 8 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r269327 - head/share/examples/hwpmc

2014-07-31 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 31 09:18:15 2014
New Revision: 269327
URL: http://svnweb.freebsd.org/changeset/base/269327

Log:
  Add an example program to show how to use libpmc from a program.
  This particular program attempts to use the TSC to measure how long
  certainly libpmc operations take.  Depending on the quality of
  the rdtsc() macro on a particular architecture this may work
  more or less well.

Added:
  head/share/examples/hwpmc/Makefile   (contents, props changed)
  head/share/examples/hwpmc/overhead.c   (contents, props changed)
Modified:
  head/share/examples/hwpmc/README

Added: head/share/examples/hwpmc/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/hwpmc/Makefile  Thu Jul 31 09:18:15 2014
(r269327)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PROG=  overhead
+LDFLAGS+= -lpmc
+MAN=
+
+install:
+
+.include 

Modified: head/share/examples/hwpmc/README
==
--- head/share/examples/hwpmc/READMEThu Jul 31 08:28:42 2014
(r269326)
+++ head/share/examples/hwpmc/READMEThu Jul 31 09:18:15 2014
(r269327)
@@ -3,6 +3,4 @@
 Examples illustrating the use of the hwpmc(4) driver and pmc(3)
 library interface.
 
-While there is nothing here yet, the source code for pmccontrol(8)
-and pmcstat(8) could serve as examples.
 

Added: head/share/examples/hwpmc/overhead.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/hwpmc/overhead.cThu Jul 31 09:18:15 2014
(r269327)
@@ -0,0 +1,115 @@
+/* 
+ * Copyright (c) 2014, Neville-Neil Consulting
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 
+ * Neither the name of Neville-Neil Consulting nor the names of its 
+ * contributors may be used to endorse or promote products derived from 
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ * Author: George V. Neville-Neil
+ *
+ *
+ */
+
+#ifndef lint
+static char rcsid [] = "$Header:$" ;
+#endif
+
+/*
+ * Calculate the time overhead of starting, stopping, and recording
+ * pmc counters.
+ *
+ * The only argument is a counter name, such as "instruction-retired"
+ * which is CPU dependent and can be found with pmmcontrol(8) using
+ * pmccontrol -L.
+ *
+ * The start, stop, read and write operations are timed using the
+ * rdtsc() macro which reads the Time Stamp Counter on the CPU.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main(int argc, char **argv)
+{
+   pmc_id_t pmcid;
+   pmc_value_t read_value;
+   pmc_value_t read_clear_value;
+   uint64_t tsc1, write_cyc, start_cyc, read_cyc, stop_cyc;
+   char *counter_name;
+   
+   if (argc != 2)
+   err(EX_USAGE, "counter-name required");
+
+   counter_name = argv[1];
+   
+   if (pmc_init() != 0)
+   err(EX_OSERR, "hwpmc(4) not loaded, kldload or update your 
kernel");
+
+   if (pmc_allocate(counter_name, PMC_MODE_SC, 0, 0, &pmcid) < 0)
+   err(EX_OSERR, "failed to allocate %s as a system counter in 
counting mode",
+   counter_name);
+
+   tsc1 = rdtsc();
+   if (pmc_write(pmcid, 0) < 0)
+   err(EX_OSERR, "failed to zero counter %s", counter_name);
+   write_cyc = rdtsc() - tsc1;
+
+   tsc1 = rdtsc();
+   if (pmc_start(pmcid) < 0)
+   err(EX_OSE

svn commit: r269345 - head/share/examples/hwpmc

2014-07-31 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 31 18:02:38 2014
New Revision: 269345
URL: http://svnweb.freebsd.org/changeset/base/269345

Log:
  Various style(9) and related fixes.
  Update the copyright to be more in line with the current version in
  our tree.
  Remove the ancient rcsid.
  Add a proper return from the main function
  
  Pointed out by: bz

Modified:
  head/share/examples/hwpmc/overhead.c

Modified: head/share/examples/hwpmc/overhead.c
==
--- head/share/examples/hwpmc/overhead.cThu Jul 31 17:18:40 2014
(r269344)
+++ head/share/examples/hwpmc/overhead.cThu Jul 31 18:02:38 2014
(r269345)
@@ -1,45 +1,34 @@
-/* 
+/*-
  * Copyright (c) 2014, Neville-Neil Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * 
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 
- * Neither the name of Neville-Neil Consulting nor the names of its 
- * contributors may be used to endorse or promote products derived from 
- * this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  *
  * Author: George V. Neville-Neil
  *
- *
  */
 
-#ifndef lint
-static char rcsid [] = "$Header:$" ;
-#endif
-
 /*
  * Calculate the time overhead of starting, stopping, and recording
  * pmc counters.
@@ -59,7 +48,8 @@ static char rcsid [] = "$Header:$" ;
 #include 
 #include 
 
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
 {
pmc_id_t pmcid;
pmc_value_t read_value;
@@ -111,5 +101,6 @@ int main(int argc, char **argv)
printf("Cycles to start: %ld\tstop: %ld\tread: %ld\twrite: %ld\n",
start_cyc, stop_cyc, read_cyc, stop_cyc);
 
+   return(0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r269360 - head/cddl/contrib/dtracetoolkit/Apps

2014-07-31 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jul 31 23:19:01 2014
New Revision: 269360
URL: http://svnweb.freebsd.org/changeset/base/269360

Log:
  Update shellsnoop to work on FreeBSD.
  
  Contributed by: skreuzer

Modified:
  head/cddl/contrib/dtracetoolkit/Apps/shellsnoop

Modified: head/cddl/contrib/dtracetoolkit/Apps/shellsnoop
==
--- head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Thu Jul 31 23:17:59 
2014(r269359)
+++ head/cddl/contrib/dtracetoolkit/Apps/shellsnoop Thu Jul 31 23:19:01 
2014(r269360)
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
 #
 # shellsnoop - A program to print read/write details from shells,
 # such as keystrokes and command outputs.
@@ -140,18 +140,14 @@ dtrace -n '
  /*
   * Remember this PID is a shell child
   */
- syscall::exec:entry, syscall::exece:entry
+ syscall::execve:entry
  /execname == "sh"   || execname == "ksh"  || execname == "csh"  || 
   execname == "tcsh" || execname == "zsh"  || execname == "bash"/
  {
child[pid] = 1;
  
-   /* debug */
-   this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
-   OPT_debug == 1 ? printf("PID %d CMD %s started. (%s)\n",
-   pid, execname, stringof(this->parent)) : 1;
  }
- syscall::exec:entry, syscall::exece:entry
+ syscall::execve:entry
  /(OPT_pid == 1 && PID != ppid) || (OPT_uid == 1 && UID != uid)/
  {
/* forget if filtered */
@@ -256,12 +252,12 @@ dtrace -n '
  /*
   *  Cleanup
   */
- syscall::rexit:entry
+ syscall::exit:entry
  {
child[pid] = 0;
 
/* debug */
-   this->parent = (char *)curthread->t_procp->p_parent->p_user.u_comm;
+   this->parent = (char *)curthread->td_proc->p_pptr->p_comm;
OPT_debug == 1 ? printf("PID %d CMD %s exited. (%s)\n",
 pid, execname, stringof(this->parent)) : 1;
  }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261242 - head/sys/netinet

2014-01-28 Thread George V. Neville-Neil
Author: gnn
Date: Tue Jan 28 20:28:32 2014
New Revision: 261242
URL: http://svnweb.freebsd.org/changeset/base/261242

Log:
  Decrease lock contention within the TCP accept case by removing
  the INP_INFO lock from tcp_usr_accept.  As the PR/patch states
  this was following the advice already in the code.
  See the PR below for a full disucssion of this change and its
  measured effects.
  
  PR:   183659
  Submitted by: Julian Charbon
  Reviewed by:  jhb

Modified:
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Tue Jan 28 19:12:31 2014
(r261241)
+++ head/sys/netinet/tcp_syncache.c Tue Jan 28 20:28:32 2014
(r261242)
@@ -682,7 +682,7 @@ syncache_socket(struct syncache *sc, str
 * connection when the SYN arrived.  If we can't create
 * the connection, abort it.
 */
-   so = sonewconn(lso, SS_ISCONNECTED);
+   so = sonewconn(lso, 0);
if (so == NULL) {
/*
 * Drop the connection; we will either send a RST or
@@ -922,6 +922,8 @@ syncache_socket(struct syncache *sc, str
 
INP_WUNLOCK(inp);
 
+   soisconnected(so);
+
TCPSTAT_INC(tcps_accepts);
return (so);
 

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Tue Jan 28 19:12:31 2014
(r261241)
+++ head/sys/netinet/tcp_usrreq.c   Tue Jan 28 20:28:32 2014
(r261242)
@@ -610,13 +610,6 @@ out:
 /*
  * Accept a connection.  Essentially all the work is done at higher levels;
  * just return the address of the peer, storing through addr.
- *
- * The rationale for acquiring the tcbinfo lock here is somewhat complicated,
- * and is described in detail in the commit log entry for r175612.  Acquiring
- * it delays an accept(2) racing with sonewconn(), which inserts the socket
- * before the inpcb address/port fields are initialized.  A better fix would
- * prevent the socket from being placed in the listen queue until all fields
- * are fully initialized.
  */
 static int
 tcp_usr_accept(struct socket *so, struct sockaddr **nam)
@@ -633,7 +626,6 @@ tcp_usr_accept(struct socket *so, struct
 
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
-   INP_INFO_RLOCK(&V_tcbinfo);
INP_WLOCK(inp);
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
error = ECONNABORTED;
@@ -653,7 +645,6 @@ tcp_usr_accept(struct socket *so, struct
 out:
TCPDEBUG2(PRU_ACCEPT);
INP_WUNLOCK(inp);
-   INP_INFO_RUNLOCK(&V_tcbinfo);
if (error == 0)
*nam = in_sockaddr(port, &addr);
return error;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261291 - head/sys/dev/e1000

2014-01-30 Thread George V. Neville-Neil
Author: gnn
Date: Thu Jan 30 18:32:33 2014
New Revision: 261291
URL: http://svnweb.freebsd.org/changeset/base/261291

Log:
  The timestamp bit is number 17, and not number 9, in the stat error
  field of the receive descriptor.
  
  MFC after:1 week

Modified:
  head/sys/dev/e1000/e1000_defines.h

Modified: head/sys/dev/e1000/e1000_defines.h
==
--- head/sys/dev/e1000/e1000_defines.h  Thu Jan 30 18:04:39 2014
(r261290)
+++ head/sys/dev/e1000/e1000_defines.h  Thu Jan 30 18:32:33 2014
(r261291)
@@ -131,7 +131,7 @@
 #define E1000_RXD_ERR_RXE  0x80/* Rx Data Error */
 #define E1000_RXD_SPC_VLAN_MASK0x0FFF  /* VLAN ID is in lower 12 bits 
*/
 
-#define E1000_RXDEXT_STATERR_TST   0x0100 /* Time Stamp taken */
+#define E1000_RXDEXT_STATERR_TST   0x0001 /* Time Stamp taken */
 #define E1000_RXDEXT_STATERR_LB0x0004
 #define E1000_RXDEXT_STATERR_CE0x0100
 #define E1000_RXDEXT_STATERR_SE0x0200
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r261943 - head/sys/netpfil/ipfw

2014-02-15 Thread George V. Neville-Neil
Author: gnn
Date: Sat Feb 15 18:36:31 2014
New Revision: 261943
URL: http://svnweb.freebsd.org/changeset/base/261943

Log:
  Summary: Two quick edits to the implementation notes as they're no
  longer stored in netinet but in netpfil.

Modified:
  head/sys/netpfil/ipfw/dummynet.txt

Modified: head/sys/netpfil/ipfw/dummynet.txt
==
--- head/sys/netpfil/ipfw/dummynet.txt  Sat Feb 15 18:07:31 2014
(r261942)
+++ head/sys/netpfil/ipfw/dummynet.txt  Sat Feb 15 18:36:31 2014
(r261943)
@@ -202,10 +202,10 @@ Almost all objects in this implementatio
 Files
 -
 The dummynet code is split in several files.
-All kernel code is in sys/netinet/ipfw except ip_dummynet.h
+All kernel code is in sys/netpfil/ipfw except ip_dummynet.h
 All userland code is in sbin/ipfw.
 Files are
-- sys/netinet/ip_dummynet.h defines the kernel-userland API
+- sys/netpfil/ip_dummynet.h defines the kernel-userland API
 - ip_dn_private.h contains the kernel-specific APIs
   and data structures
 - dn_sched.h defines the scheduler API
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262727 - head/sys/net

2014-03-03 Thread George V. Neville-Neil
Author: gnn
Date: Tue Mar  4 05:09:46 2014
New Revision: 262727
URL: http://svnweb.freebsd.org/changeset/base/262727

Log:
  Naming consistency fix. The routing code defines
  RADIX_NODE_HEAD_LOCK as grabbing the write lock,
  but RADIX_NODE_HEAD_LOCK_ASSERT as checking the read lock.
  
  Submitted by: Vijay Singh 
  MFC after:1 month

Modified:
  head/sys/net/radix.h
  head/sys/net/route.c

Modified: head/sys/net/radix.h
==
--- head/sys/net/radix.hTue Mar  4 03:19:36 2014(r262726)
+++ head/sys/net/radix.hTue Mar  4 05:09:46 2014(r262727)
@@ -149,7 +149,8 @@ struct radix_node_head {
 
 
 #defineRADIX_NODE_HEAD_DESTROY(rnh)rw_destroy(&(rnh)->rnh_lock)
-#defineRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_LOCKED)
+#define RADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
+#define RADIX_NODE_HEAD_RLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_RLOCKED)
 #defineRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
 #endif /* _KERNEL */
 

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Mar  4 03:19:36 2014(r262726)
+++ head/sys/net/route.cTue Mar  4 05:09:46 2014(r262727)
@@ -381,7 +381,7 @@ rtalloc1_fib(struct sockaddr *dst, int r
RADIX_NODE_HEAD_RLOCK(rnh);
 #ifdef INVARIANTS  
else
-   RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
+   RADIX_NODE_HEAD_RLOCK_ASSERT(rnh);
 #endif
rn = rnh->rnh_matchaddr(dst, rnh);
if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
@@ -1000,9 +1000,10 @@ rn_mpath_update(int req, struct rt_addri
 * a matching RTAX_GATEWAY.
 */
struct rtentry *rt, *rto = NULL;
-   register struct radix_node *rn;
+   struct radix_node *rn;
int error = 0;
 
+   RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
rn = rnh->rnh_lookup(dst, netmask, rnh);
if (rn == NULL)
return (ESRCH);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r262758 - head/sys/net

2014-03-04 Thread George V. Neville-Neil
Author: gnn
Date: Tue Mar  4 23:55:04 2014
New Revision: 262758
URL: http://svnweb.freebsd.org/changeset/base/262758

Log:
  Revert previous commit (262727) and bounce patch back to the
  submitter.
  
  Pointed out by: jhb

Modified:
  head/sys/net/radix.h
  head/sys/net/route.c

Modified: head/sys/net/radix.h
==
--- head/sys/net/radix.hTue Mar  4 23:27:27 2014(r262757)
+++ head/sys/net/radix.hTue Mar  4 23:55:04 2014(r262758)
@@ -149,8 +149,7 @@ struct radix_node_head {
 
 
 #defineRADIX_NODE_HEAD_DESTROY(rnh)rw_destroy(&(rnh)->rnh_lock)
-#define RADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
-#define RADIX_NODE_HEAD_RLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_RLOCKED)
+#defineRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_LOCKED)
 #defineRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, 
RA_WLOCKED)
 #endif /* _KERNEL */
 

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Mar  4 23:27:27 2014(r262757)
+++ head/sys/net/route.cTue Mar  4 23:55:04 2014(r262758)
@@ -381,7 +381,7 @@ rtalloc1_fib(struct sockaddr *dst, int r
RADIX_NODE_HEAD_RLOCK(rnh);
 #ifdef INVARIANTS  
else
-   RADIX_NODE_HEAD_RLOCK_ASSERT(rnh);
+   RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
 #endif
rn = rnh->rnh_matchaddr(dst, rnh);
if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
@@ -1000,10 +1000,9 @@ rn_mpath_update(int req, struct rt_addri
 * a matching RTAX_GATEWAY.
 */
struct rtentry *rt, *rto = NULL;
-   struct radix_node *rn;
+   register struct radix_node *rn;
int error = 0;
 
-   RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
rn = rnh->rnh_lookup(dst, netmask, rnh);
if (rn == NULL)
return (ESRCH);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r263302 - head/sys/dev/sfxge

2014-03-18 Thread George V. Neville-Neil
Author: gnn
Date: Tue Mar 18 15:01:32 2014
New Revision: 263302
URL: http://svnweb.freebsd.org/changeset/base/263302

Log:
  fix mbuf leak if it does not fit in software queue
  
  mbuf should be owned by if_transmit function in any case.
  
  Submitted-by:   Andrew Rybchenko 
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 18 14:41:18 2014
(r263301)
+++ head/sys/dev/sfxge/sfxge_tx.c   Tue Mar 18 15:01:32 2014
(r263302)
@@ -536,6 +536,7 @@ sfxge_tx_packet_add(struct sfxge_txq *tx
return (0);
 
 fail:
+   m_freem(m);
return (rc);

 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r264016 - head/tools/test/ppsapi

2014-04-01 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr  1 18:37:00 2014
New Revision: 264016
URL: http://svnweb.freebsd.org/changeset/base/264016

Log:
  Silence an unnecessary warning.
  
  MFC after:2 weeks

Modified:
  head/tools/test/ppsapi/Makefile

Modified: head/tools/test/ppsapi/Makefile
==
--- head/tools/test/ppsapi/Makefile Tue Apr  1 18:24:40 2014
(r264015)
+++ head/tools/test/ppsapi/Makefile Tue Apr  1 18:37:00 2014
(r264016)
@@ -7,5 +7,7 @@ WARNS?= 5
 
 .include 
 
+CFLAGS+=-Wno-format-security
+
 test:  ${PROG}
./${PROG} /dev/cuau0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r264174 - head/usr.sbin/arp

2014-04-05 Thread George V. Neville-Neil
Author: gnn
Date: Sat Apr  5 22:13:32 2014
New Revision: 264174
URL: http://svnweb.freebsd.org/changeset/base/264174

Log:
  Speed up the lookup of interfaces when there are a large number
  of them, such in a system with a large number of VLANs.
  
  Submitted by: Nick Rogers
  MFC after: 2 weeks

Modified:
  head/usr.sbin/arp/arp.c

Modified: head/usr.sbin/arp/arp.c
==
--- head/usr.sbin/arp/arp.c Sat Apr  5 20:44:52 2014(r264173)
+++ head/usr.sbin/arp/arp.c Sat Apr  5 22:13:32 2014(r264174)
@@ -104,6 +104,8 @@ static char *rifname;
 static time_t  expire_time;
 static int flags, doing_proxy;
 
+struct if_nameindex *ifnameindex;
+
 /* which function we're supposed to do */
 #define F_GET  1
 #define F_SET  2
@@ -200,6 +202,9 @@ main(int argc, char *argv[])
break;
}
 
+   if (ifnameindex != NULL)
+   if_freenameindex(ifnameindex);
+
return (rtn);
 }
 
@@ -558,8 +563,6 @@ search(u_long addr, action_fn *action)
 /*
  * Display an arp entry
  */
-static char lifname[IF_NAMESIZE];
-static int64_t lifindex = -1;
 
 static void
 print_entry(struct sockaddr_dl *sdl,
@@ -568,8 +571,13 @@ print_entry(struct sockaddr_dl *sdl,
const char *host;
struct hostent *hp;
struct iso88025_sockaddr_dl_data *trld;
+   struct if_nameindex *p;
int seg;
 
+   if (ifnameindex == NULL) 
+   if ((ifnameindex = if_nameindex()) == NULL)
+   err(1, "cannot retrieve interface names");
+
if (nflag == 0)
hp = gethostbyaddr((caddr_t)&(addr->sin_addr),
sizeof addr->sin_addr, AF_INET);
@@ -596,12 +604,15 @@ print_entry(struct sockaddr_dl *sdl,
}
} else
printf("(incomplete)");
-   if (sdl->sdl_index != lifindex &&
-   if_indextoname(sdl->sdl_index, lifname) != NULL) {
-   lifindex = sdl->sdl_index;
-   printf(" on %s", lifname);
-} else if (sdl->sdl_index == lifindex)
-   printf(" on %s", lifname);
+
+   for (p = ifnameindex; p && ifnameindex->if_index &&
+ifnameindex->if_name; p++) {
+   if (p->if_index == sdl->sdl_index) {
+   printf(" on %s", p->if_name);
+   break;
+   }
+   }
+
if (rtm->rtm_rmx.rmx_expire == 0)
printf(" permanent");
else {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r272906 - in head/sys: conf libkern netpfil/pf sys

2014-10-10 Thread George V. Neville-Neil
Author: gnn
Date: Fri Oct 10 19:26:26 2014
New Revision: 272906
URL: https://svnweb.freebsd.org/changeset/base/272906

Log:
  Change the PF hash from Jenkins to Murmur3.  In forwarding tests
  this showed a conservative 3% incrase in PPS.
  
  Differential Revision:https://reviews.freebsd.org/D461
  Submitted by: des
  Reviewed by:  emaste
  MFC after:1 month

Added:
  head/sys/libkern/murmur3_32.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/netpfil/pf/pf.c
  head/sys/sys/hash.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Oct 10 19:18:52 2014(r272905)
+++ head/sys/conf/files Fri Oct 10 19:26:26 2014(r272906)
@@ -3175,6 +3175,7 @@ libkern/inet_ntoa.c   standard
 libkern/inet_ntop.cstandard
 libkern/inet_pton.cstandard
 libkern/jenkins_hash.c standard
+libkern/murmur3_32.c   standard
 libkern/mcount.c   optional profiling-routine
 libkern/memcchr.c  standard
 libkern/memchr.c   optional fdt | gdb

Added: head/sys/libkern/murmur3_32.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/libkern/murmur3_32.c   Fri Oct 10 19:26:26 2014
(r272906)
@@ -0,0 +1,74 @@
+/*-
+ * Copyright (c) 2014 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#define rol32(i32, n) ((i32) << (n) | (i32) >> (32 - (n)))
+
+/*
+ * $FreeBSD$
+ * Simple implementation of the Murmur3-32 hash function optimized for
+ * aligned sequences of 32-bit words.  If len is not a multiple of 4, it
+ * will be rounded down, droping trailer bytes.
+ */
+uint32_t
+murmur3_aligned_32(const void *data, size_t len, uint32_t seed)
+{
+   const uint32_t *data32;
+   uint32_t hash, k;
+   size_t res;
+
+   /* initialize */
+   len -= len % sizeof(*data32);
+   res = len;
+   data32 = data;
+   hash = seed;
+
+   /* iterate */
+   for (res = 0; res < len; res += sizeof(*data32), data32++) {
+   k = le32toh(*data32);
+   k *= 0xcc9e2d51;
+   k = rol32(k, 15);
+   k *= 0x1b873593;
+   hash ^= k;
+   hash = rol32(hash, 13);
+   hash *= 5;
+   hash += 0xe6546b64;
+   }
+
+   /* finalize */
+   hash ^= (uint32_t)len;
+   hash ^= hash >> 16;
+   hash *= 0x85ebca6b;
+   hash ^= hash >> 13;
+   hash *= 0xc2b2ae35;
+   hash ^= hash >> 16;
+   return (hash);
+}
+

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cFri Oct 10 19:18:52 2014(r272905)
+++ head/sys/netpfil/pf/pf.cFri Oct 10 19:26:26 2014(r272906)
@@ -374,9 +374,9 @@ pf_hashkey(struct pf_state_key *sk)
 {
uint32_t h;
 
-   h = jenkins_hash32((uint32_t *)sk,
-   sizeof(struct pf_state_key_cmp)/sizeof(uint32_t),
-   V_pf_hashseed);
+   h = murmur3_aligned_32((uint32_t *)sk,
+  sizeof(struct pf_state_key_cmp),
+  V_pf_hashseed);
 
return (h & pf_hashmask);
 }
@@ -388,12 +388,12 @@ pf_hashsrc(struct pf_addr *addr, sa_fami
 
switch (af) {
case AF_INET:
-   h = jenkins_hash32((uint32_t *)&addr->v4,
-   sizeof(addr->v4)/sizeof(uint32_t), V_pf_hashseed);
+   h = murmur3_aligned_32((uint32_t *)&addr->v4,
+

svn commit: r272962 - head/tools/tools/netmap

2014-10-11 Thread George V. Neville-Neil
Author: gnn
Date: Sat Oct 11 21:43:05 2014
New Revision: 272962
URL: https://svnweb.freebsd.org/changeset/base/272962

Log:
  Add a new option, -P, to pkt-gen which reads a single packet from a stored
  pcap file and transmits it instead of the default UDP packet.
  
  Reviewed by:  luigi
  MFC after:2 weeks

Modified:
  head/tools/tools/netmap/pkt-gen.c

Modified: head/tools/tools/netmap/pkt-gen.c
==
--- head/tools/tools/netmap/pkt-gen.c   Sat Oct 11 20:46:06 2014
(r272961)
+++ head/tools/tools/netmap/pkt-gen.c   Sat Oct 11 21:43:05 2014
(r272962)
@@ -202,6 +202,7 @@ struct glob_arg {
int dummy_send;
int virt_header;/* send also the virt_header */
int extra_bufs; /* goes in nr_arg3 */
+   char *packet_file;  /* -P option */
 };
 enum dev_type { DEV_NONE, DEV_NETMAP, DEV_PCAP, DEV_TAP };
 
@@ -224,6 +225,7 @@ struct targ {
int affinity;
 
struct pkt pkt;
+   void *frame;
 };
 
 
@@ -613,6 +615,28 @@ initialize_packet(struct targ *targ)
indirect_payload : default_payload;
int i, l0 = strlen(payload);
 
+   char errbuf[PCAP_ERRBUF_SIZE];
+   pcap_t *file;
+   struct pcap_pkthdr *header;
+   const unsigned char *packet;
+   
+   /* Read a packet from a PCAP file if asked. */
+   if (targ->g->packet_file != NULL) {
+   if ((file = pcap_open_offline(targ->g->packet_file,
+   errbuf)) == NULL)
+   D("failed to open pcap file %s",
+   targ->g->packet_file);
+   if (pcap_next_ex(file, &header, &packet) < 0)
+   D("failed to read packet from %s",
+   targ->g->packet_file);
+   if ((targ->frame = malloc(header->caplen)) == NULL)
+   D("out of memory");
+   bcopy(packet, (unsigned char *)targ->frame, header->caplen);
+   targ->g->pkt_size = header->caplen;
+   pcap_close(file);
+   return;
+   }
+
/* create a nice NUL-terminated string */
for (i = 0; i < paylen; i += l0) {
if (l0 > paylen - i)
@@ -783,7 +807,6 @@ pinger_body(void *data)
frame += sizeof(targ->pkt.vh) - targ->g->virt_header;
size = targ->g->pkt_size + targ->g->virt_header;
 
-
if (targ->g->nthreads > 1) {
D("can only ping with 1 thread");
return NULL;
@@ -1038,10 +1061,15 @@ sender_body(void *data)
void *frame;
int size;
 
-   frame = pkt;
-   frame += sizeof(pkt->vh) - targ->g->virt_header;
-   size = targ->g->pkt_size + targ->g->virt_header;
-
+   if (targ->frame == NULL) {
+   frame = pkt;
+   frame += sizeof(pkt->vh) - targ->g->virt_header;
+   size = targ->g->pkt_size + targ->g->virt_header;
+   } else {
+   frame = targ->frame;
+   size = targ->g->pkt_size;
+   }
+   
D("start, fd %d main_fd %d", targ->fd, targ->g->main_fd);
if (setaffinity(targ->thread, targ->affinity))
goto quit;
@@ -1366,6 +1394,7 @@ usage(void)
"\t-R rate  in packets per second\n"
"\t-X   dump payload\n"
"\t-H len   add empty virtio-net-header with size 
'len'\n"
+   "\t-P file  load packet from pcap file"
"",
cmd);
 
@@ -1638,7 +1667,7 @@ main(int arc, char **argv)
g.virt_header = 0;
 
while ( (ch = getopt(arc, argv,
-   "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:m:")) != 
-1) {
+   "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:m:P:")) != 
-1) {
struct sf *fn;
 
switch(ch) {
@@ -1781,7 +1810,11 @@ main(int arc, char **argv)
D("unrecognized monitor mode %s", optarg);
}
break;
+   case 'P':
+   g.packet_file = strdup(optarg);
+   break;
}
+
}
 
if (g.ifname == NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r273279 - in head/sys/cam: ata scsi

2014-10-19 Thread George V. Neville-Neil
Author: gnn
Date: Sun Oct 19 16:46:36 2014
New Revision: 273279
URL: https://svnweb.freebsd.org/changeset/base/273279

Log:
  Add new quirks for the latest Samsung SSD, model 850.
  
  Submitted by: sbruno
  MFC after:2 weeks

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Sun Oct 19 16:26:49 2014(r273278)
+++ head/sys/cam/ata/ata_da.c   Sun Oct 19 16:46:36 2014(r273279)
@@ -457,6 +457,14 @@ static struct ada_quirk_entry ada_quirk_
{ T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7WD*", "*" },
/*quirks*/ADA_Q_4K
},
+   {
+   /*
+* Samsung 850 SSDs
+* 4k optimised
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "Samsung SSD 850*", "*" },
+   /*quirks*/ADA_Q_4K
+   },
{
/*
 * Samsung PM853T Series SSDs

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:26:49 2014(r273278)
+++ head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:46:36 2014(r273279)
@@ -1132,6 +1132,14 @@ static struct da_quirk_entry da_quirk_ta
{ T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7WD*", "*" },
/*quirks*/DA_Q_4K
},
+   {
+   /*
+* Samsung 850 SSDs
+* 4k optimised & trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Samsung SSD 850*", "*" },
+   /*quirks*/DA_Q_4K
+   },
{
/*
 * Samsung PM853T Series SSDs
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r273293 - head/cddl/lib/libdtrace

2014-10-19 Thread George V. Neville-Neil
Author: gnn
Date: Sun Oct 19 23:13:16 2014
New Revision: 273293
URL: https://svnweb.freebsd.org/changeset/base/273293

Log:
  Update the TCP structure used by DTrace to show the smoothed RTT.
  This will allow similar functionality to SIFTR to be built with DTrace.
  
  Submitted by: Grenville Armitage
  MFC after:2 weeks

Modified:
  head/cddl/lib/libdtrace/tcp.d

Modified: head/cddl/lib/libdtrace/tcp.d
==
--- head/cddl/lib/libdtrace/tcp.d   Sun Oct 19 23:05:18 2014
(r273292)
+++ head/cddl/lib/libdtrace/tcp.d   Sun Oct 19 23:13:16 2014
(r273293)
@@ -116,6 +116,7 @@ typedef struct tcpsinfo {
uint32_t tcps_rto;  /* round-trip timeout, msec */
uint32_t tcps_mss;  /* max segment size */
int tcps_retransmit;/* retransmit send event, boolean */
+   int tcps_srtt;  /* smoothed RTT in units of 
(TCP_RTT_SCALE*hz) */
 } tcpsinfo_t;
 
 /*
@@ -200,6 +201,7 @@ translator tcpsinfo_t < struct tcpcb *p 
tcps_rto =  p == NULL ? -1  : p->t_rxtcur / 1000; /* XXX */
tcps_mss =  p == NULL ? -1  : p->t_maxseg;
tcps_retransmit =   p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0;
+   tcps_srtt = p == NULL ? -1  : p->t_srtt;   /* smoothed RTT 
in units of (TCP_RTT_SCALE*hz) */
 };
 
 #pragma D binding "1.6.3" translator
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r274129 - head/sys/amd64/conf

2014-11-04 Thread George V. Neville-Neil
Author: gnn
Date: Wed Nov  5 06:22:37 2014
New Revision: 274129
URL: https://svnweb.freebsd.org/changeset/base/274129

Log:
  Add support for netmap in GENERIC by default.

Modified:
  head/sys/amd64/conf/GENERIC

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Wed Nov  5 04:25:23 2014(r274128)
+++ head/sys/amd64/conf/GENERIC Wed Nov  5 06:22:37 2014(r274129)
@@ -361,3 +361,7 @@ device  xenpci  # Xen HVM 
Hypervisor se
 
 # VMware support
 device vmx # VMware VMXNET3 Ethernet
+
+# Netmap provides direct access to TX/RX rings on supported NICs
+device netmap  # netmap(4) support
+
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r275422 - in head/sys: amd64/conf i386/conf pc98/conf powerpc/conf sparc64/conf

2014-12-02 Thread George V. Neville-Neil
Author: gnn
Date: Tue Dec  2 19:55:43 2014
New Revision: 275422
URL: https://svnweb.freebsd.org/changeset/base/275422

Log:
  This configuration file removes several debugging options, including
  WITNESS and INVARIANTS checking, which are known to have significant
  performance impact on running systems.  When benchmarking new features
  this kernel should be used instead of the standard GENERIC.
  This kernel configuration should never appear outside of the HEAD
  of the FreeBSD tree.

Added:
  head/sys/amd64/conf/GENERIC-NODEBUG   (contents, props changed)
  head/sys/i386/conf/GENERIC-NODEBUG   (contents, props changed)
  head/sys/pc98/conf/GENERIC-NODEBUG   (contents, props changed)
  head/sys/powerpc/conf/GENERIC-NODEBUG   (contents, props changed)
  head/sys/sparc64/conf/GENERIC-NODEBUG   (contents, props changed)

Added: head/sys/amd64/conf/GENERIC-NODEBUG
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/conf/GENERIC-NODEBUG Tue Dec  2 19:55:43 2014
(r275422)
@@ -0,0 +1,38 @@
+#
+# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file 
+#   for FreeBSD/amd64
+#
+# This configuration file removes several debugging options, including
+# WITNESS and INVARIANTS checking, which are known to have significant
+# performance impact on running systems.  When benchmarking new features
+# this kernel should be used instead of the standard GENERIC.
+# This kernel configuration should never appear outside of the HEAD
+# of the FreeBSD tree.
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
+#
+#
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+
+include GENERIC
+
+ident   GENERIC-NODEBUG
+
+nooptions   INVARIANTS
+nooptions   INVARIANT_SUPPORT
+nooptions   WITNESS
+nooptions   WITNESS_SKIPSPIN
+nooptions   DEADLKRES
+

Added: head/sys/i386/conf/GENERIC-NODEBUG
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/i386/conf/GENERIC-NODEBUG  Tue Dec  2 19:55:43 2014
(r275422)
@@ -0,0 +1,38 @@
+#
+# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file 
+#   for FreeBSD/i386
+#
+# This configuration file removes several debugging options, including
+# WITNESS and INVARIANTS checking, which are known to have significant
+# performance impact on running systems.  When benchmarking new features
+# this kernel should be used instead of the standard GENERIC.
+# This kernel configuration should never appear outside of the HEAD
+# of the FreeBSD tree.
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
+#
+#
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+
+include GENERIC
+
+ident   GENERIC-NODEBUG
+
+nooptions   INVARIANTS
+nooptions   INVARIANT_SUPPORT
+nooptions   WITNESS
+nooptions   WITNESS_SKIPSPIN
+nooptions   DEADLKRES
+

Added: head/sys/pc98/conf/GENERIC-NODEBUG
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/pc98/conf/GENERIC-NODEBUG  Tue Dec  2 19:55:43 2014
(r275422)
@@ -0,0 +1,38 @@
+#
+# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file 
+#   for FreeBSD/pc98
+#
+# This configuration file removes several debugging options, including
+# WITNESS and INVARIANTS checking, which are known to have significant
+# performance impact on running systems.  When benchmarking new features
+# this kernel should be used instead of the standard GENERIC.
+# This kernel configuration should never appear outside of th

svn commit: r281276 - head/sys/net

2015-04-08 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr  8 20:25:51 2015
New Revision: 281276
URL: https://svnweb.freebsd.org/changeset/base/281276

Log:
  Add support for a netisr polling tunable, which allows run time switching of
  device polling rather than having it only be controlled by the compile
  time option.
  
  Summary: Rubicon Communications (Netgate)
  
  Reviewers: #network, hiren
  
  Reviewed By: #network, hiren
  
  Subscribers: hiren
  
  Differential Revision: https://reviews.freebsd.org/D2258

Modified:
  head/sys/net/netisr.c

Modified: head/sys/net/netisr.c
==
--- head/sys/net/netisr.c   Wed Apr  8 20:10:42 2015(r281275)
+++ head/sys/net/netisr.c   Wed Apr  8 20:25:51 2015(r281276)
@@ -126,6 +126,13 @@ static struct rmlock   netisr_rmlock;
 
 static SYSCTL_NODE(_net, OID_AUTO, isr, CTLFLAG_RW, 0, "netisr");
 
+#ifdef DEVICE_POLLING
+static int netisr_polling = 0; /* Enable Polling. */
+TUNABLE_INT("net.isr.polling_enable", &netisr_polling);
+SYSCTL_INT(_net_isr, OID_AUTO, polling_enable, CTLFLAG_RW,
+&netisr_polling, 0, "Enable polling");
+#endif
+
 /*-
  * Three global direct dispatch policies are supported:
  *
@@ -789,9 +796,11 @@ swi_net(void *arg)
nwsp = arg;
 
 #ifdef DEVICE_POLLING
-   KASSERT(nws_count == 1,
-   ("%s: device_polling but nws_count != 1", __func__));
-   netisr_poll();
+   if (netisr_polling) {
+   KASSERT(nws_count == 1,
+   ("%s: device_polling but nws_count != 1", __func__));
+   netisr_poll();
+   }
 #endif
 #ifdef NETISR_LOCKING
NETISR_RLOCK(&tracker);
@@ -816,7 +825,8 @@ out:
NETISR_RUNLOCK(&tracker);
 #endif
 #ifdef DEVICE_POLLING
-   netisr_pollmore();
+   if (netisr_polling)
+   netisr_pollmore();
 #endif
 }
 
@@ -1071,6 +1081,9 @@ netisr_sched_poll(void)
 {
struct netisr_workstream *nwsp;
 
+   if (!netisr_polling)
+   return;
+
nwsp = DPCPU_ID_PTR(nws_array[0], nws);
NWS_SIGNAL(nwsp);
 }
@@ -1138,7 +1151,7 @@ netisr_init(void *arg)
 * multiple netisr threads, so for the time being compiling in device
 * polling disables parallel netisr workers.
 */
-   if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
+   if (netisr_polling && (netisr_maxthreads != 1 || netisr_bindthreads != 
0)) {
printf("netisr_init: forcing maxthreads to 1 and "
"bindthreads to 0 for device polling\n");
netisr_maxthreads = 1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281312 - head/sys/net

2015-04-09 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr  9 14:44:30 2015
New Revision: 281312
URL: https://svnweb.freebsd.org/changeset/base/281312

Log:
  Revert 281276 as unnecessary.  Proper change to be committed
  to the base polling code in a subsequent commit.
  
  Pointed out by: glebius
  
  Sponsored by: Rubicon Communications (NetGate)

Modified:
  head/sys/net/netisr.c

Modified: head/sys/net/netisr.c
==
--- head/sys/net/netisr.c   Thu Apr  9 13:45:17 2015(r281311)
+++ head/sys/net/netisr.c   Thu Apr  9 14:44:30 2015(r281312)
@@ -126,13 +126,6 @@ static struct rmlock   netisr_rmlock;
 
 static SYSCTL_NODE(_net, OID_AUTO, isr, CTLFLAG_RW, 0, "netisr");
 
-#ifdef DEVICE_POLLING
-static int netisr_polling = 0; /* Enable Polling. */
-TUNABLE_INT("net.isr.polling_enable", &netisr_polling);
-SYSCTL_INT(_net_isr, OID_AUTO, polling_enable, CTLFLAG_RW,
-&netisr_polling, 0, "Enable polling");
-#endif
-
 /*-
  * Three global direct dispatch policies are supported:
  *
@@ -796,11 +789,9 @@ swi_net(void *arg)
nwsp = arg;
 
 #ifdef DEVICE_POLLING
-   if (netisr_polling) {
-   KASSERT(nws_count == 1,
-   ("%s: device_polling but nws_count != 1", __func__));
-   netisr_poll();
-   }
+   KASSERT(nws_count == 1,
+   ("%s: device_polling but nws_count != 1", __func__));
+   netisr_poll();
 #endif
 #ifdef NETISR_LOCKING
NETISR_RLOCK(&tracker);
@@ -825,8 +816,7 @@ out:
NETISR_RUNLOCK(&tracker);
 #endif
 #ifdef DEVICE_POLLING
-   if (netisr_polling)
-   netisr_pollmore();
+   netisr_pollmore();
 #endif
 }
 
@@ -1081,9 +1071,6 @@ netisr_sched_poll(void)
 {
struct netisr_workstream *nwsp;
 
-   if (!netisr_polling)
-   return;
-
nwsp = DPCPU_ID_PTR(nws_array[0], nws);
NWS_SIGNAL(nwsp);
 }
@@ -1151,7 +1138,7 @@ netisr_init(void *arg)
 * multiple netisr threads, so for the time being compiling in device
 * polling disables parallel netisr workers.
 */
-   if (netisr_polling && (netisr_maxthreads != 1 || netisr_bindthreads != 
0)) {
+   if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
printf("netisr_init: forcing maxthreads to 1 and "
"bindthreads to 0 for device polling\n");
netisr_maxthreads = 1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281528 - head/sys/kern

2015-04-14 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr 14 14:22:34 2015
New Revision: 281528
URL: https://svnweb.freebsd.org/changeset/base/281528

Log:
  When a kernel has DEVICE_POLLING turned on but no drivers have
  the capability do not try to take the mutex at all.
  
  Replaces misbegotten attempt from reverted commit 281276
  
  Pointed out by: glebius
  Sponsored by: Rubicon Communications (Netgate)
  Differential Revision:https://reviews.freebsd.org/D2262

Modified:
  head/sys/kern/kern_poll.c

Modified: head/sys/kern/kern_poll.c
==
--- head/sys/kern/kern_poll.c   Tue Apr 14 14:15:14 2015(r281527)
+++ head/sys/kern/kern_poll.c   Tue Apr 14 14:22:34 2015(r281528)
@@ -367,6 +367,9 @@ netisr_pollmore()
struct timeval t;
int kern_load;
 
+   if (poll_handlers == 0)
+   return;
+
mtx_lock(&poll_mtx);
if (!netisr_pollmore_scheduled) {
mtx_unlock(&poll_mtx);
@@ -424,6 +427,9 @@ netisr_poll(void)
int i, cycles;
enum poll_cmd arg = POLL_ONLY;
 
+   if (poll_handlers == 0)
+   return;
+
mtx_lock(&poll_mtx);
if (!netisr_poll_scheduled) {
mtx_unlock(&poll_mtx);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281529 - head/sys/netpfil/pf

2015-04-14 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr 14 14:43:42 2015
New Revision: 281529
URL: https://svnweb.freebsd.org/changeset/base/281529

Log:
  I can find no reason to allow packets with both SYN and FIN bits
  set past this point in the code. The packet should be dropped and
  not massaged as it is here.
  
  Differential Revision:  https://reviews.freebsd.org/D2266
  Submitted by: eri
  Sponsored by: Rubicon Communications (Netgate)

Modified:
  head/sys/netpfil/pf/pf_norm.c

Modified: head/sys/netpfil/pf/pf_norm.c
==
--- head/sys/netpfil/pf/pf_norm.c   Tue Apr 14 14:22:34 2015
(r281528)
+++ head/sys/netpfil/pf/pf_norm.c   Tue Apr 14 14:43:42 2015
(r281529)
@@ -1643,7 +1643,7 @@ pf_normalize_tcp(int dir, struct pfi_kif
goto tcp_drop;
 
if (flags & TH_FIN)
-   flags &= ~TH_FIN;
+   goto tcp_drop;
} else {
/* Illegal packet */
if (!(flags & (TH_ACK|TH_RST)))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281530 - head/sys/net

2015-04-14 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr 14 15:21:20 2015
New Revision: 281530
URL: https://svnweb.freebsd.org/changeset/base/281530

Log:
  Document internal interface types which are specific to FreeBSD.

Modified:
  head/sys/net/if_types.h

Modified: head/sys/net/if_types.h
==
--- head/sys/net/if_types.h Tue Apr 14 14:43:42 2015(r281529)
+++ head/sys/net/if_types.h Tue Apr 14 15:21:20 2015(r281530)
@@ -243,10 +243,10 @@
 
 #defineIFT_STF0xd7 /* 6to4 interface */
 
-/* not based on IANA assignments */
-#defineIFT_GIF 0xf0
-#defineIFT_PVC 0xf1
-#defineIFT_ENC 0xf4
-#defineIFT_PFLOG   0xf6
-#defineIFT_PFSYNC  0xf7
+/* FreeBSD specific, not based on IANA assignments */
+#defineIFT_GIF 0xf0 /* Generic tunnel interface */
+#defineIFT_PVC 0xf1 /* Unused */
+#defineIFT_ENC 0xf4 /* Encapsulating interface */
+#defineIFT_PFLOG   0xf6 /* PF packet filter logging */
+#defineIFT_PFSYNC  0xf7 /* PF packet filter synchronization */
 #endif /* !_NET_IF_TYPES_H_ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r281558 - head/sys/net

2015-04-15 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr 15 14:46:45 2015
New Revision: 281558
URL: https://svnweb.freebsd.org/changeset/base/281558

Log:
  Minor change to the macros to make sure that if an AF is passed that is 
neither AF_INET6 nor AF_INET that we don't touch random bits of memory.
  
  Differential Revision:https://reviews.freebsd.org/D2291

Modified:
  head/sys/net/pfvar.h

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hWed Apr 15 14:30:07 2015(r281557)
+++ head/sys/net/pfvar.hWed Apr 15 14:46:45 2015(r281558)
@@ -192,21 +192,20 @@ extern struct rwlock pf_rules_lock;
 
 #define PF_AEQ(a, b, c) \
((c == AF_INET && (a)->addr32[0] == (b)->addr32[0]) || \
-   ((a)->addr32[3] == (b)->addr32[3] && \
+   (c == AF_INET6 && (a)->addr32[3] == (b)->addr32[3] && \
(a)->addr32[2] == (b)->addr32[2] && \
(a)->addr32[1] == (b)->addr32[1] && \
(a)->addr32[0] == (b)->addr32[0])) \
 
 #define PF_ANEQ(a, b, c) \
-   ((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \
-   ((a)->addr32[3] != (b)->addr32[3] || \
-   (a)->addr32[2] != (b)->addr32[2] || \
+   ((a)->addr32[0] != (b)->addr32[0] || \
(a)->addr32[1] != (b)->addr32[1] || \
-   (a)->addr32[0] != (b)->addr32[0])) \
+   (a)->addr32[2] != (b)->addr32[2] || \
+   (a)->addr32[3] != (b)->addr32[3]) \
 
 #define PF_AZERO(a, c) \
((c == AF_INET && !(a)->addr32[0]) || \
-   (!(a)->addr32[0] && !(a)->addr32[1] && \
+   (c == AF_INET6 && !(a)->addr32[0] && !(a)->addr32[1] && \
!(a)->addr32[2] && !(a)->addr32[3] )) \
 
 #define PF_MATCHA(n, a, m, b, f) \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r282215 - head/sys/conf

2015-04-29 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr 29 12:37:45 2015
New Revision: 282215
URL: https://svnweb.freebsd.org/changeset/base/282215

Log:
  Make it possible to statically link SIFTR into the kernel
  as a new option.
  
  Reviewed by:  bz
  Discussed with:   lstewart
  MFC after:2 weeks

Modified:
  head/sys/conf/files
  head/sys/conf/options

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Apr 29 12:33:00 2015(r282214)
+++ head/sys/conf/files Wed Apr 29 12:37:45 2015(r282215)
@@ -3502,6 +3502,7 @@ netinet/sctp_sysctl.c optional inet sct
 netinet/sctp_timer.c   optional inet sctp | inet6 sctp
 netinet/sctp_usrreq.c  optional inet sctp | inet6 sctp
 netinet/sctputil.c optional inet sctp | inet6 sctp
+netinet/siftr.coptional inet siftr alq | inet6 siftr 
alq
 netinet/tcp_debug.coptional tcpdebug
 netinet/tcp_hostcache.coptional inet | inet6
 netinet/tcp_input.coptional inet | inet6

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Wed Apr 29 12:33:00 2015(r282214)
+++ head/sys/conf/options   Wed Apr 29 12:37:45 2015(r282215)
@@ -432,6 +432,7 @@ ROUTETABLES opt_route.h
 RSSopt_rss.h
 SLIP_IFF_OPTS  opt_slip.h
 TCPDEBUG
+SIFTR
 TCP_OFFLOADopt_inet.h # Enable code to dispatch TCP offloading
 TCP_SIGNATURE  opt_inet.h
 VLAN_ARRAY opt_vlan.h
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r282240 - in head: cddl/lib/libdtrace sys/netinet

2015-04-29 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr 29 17:19:55 2015
New Revision: 282240
URL: https://svnweb.freebsd.org/changeset/base/282240

Log:
  Brief demo script showing the various values that can be read via
  the new SIFTR statically defined tracepoint (SDT).
  
  Differential Revision:https://reviews.freebsd.org/D2387
  Reviewed by:  bz, markj

Modified:
  head/cddl/lib/libdtrace/tcp.d
  head/sys/netinet/in_kdtrace.c
  head/sys/netinet/in_kdtrace.h
  head/sys/netinet/siftr.c

Modified: head/cddl/lib/libdtrace/tcp.d
==
--- head/cddl/lib/libdtrace/tcp.d   Wed Apr 29 17:18:41 2015
(r282239)
+++ head/cddl/lib/libdtrace/tcp.d   Wed Apr 29 17:19:55 2015
(r282240)
@@ -241,3 +241,78 @@ translator tcpinfoh_t < struct tcphdr *p
 translator tcplsinfo_t < int s > {
tcps_state =s;
 };
+
+/*
+ * Convert a SIFTR direction value to a string
+ */
+#pragma D binding "1.12.1" SIFTR_IN
+inline int SIFTR_IN =  1;
+#pragma D binding "1.12.1" SIFTR_OUT
+inline int SIFTR_OUT = 2;
+
+/* SIFTR direction strings. */
+#pragma D binding "1.12.1" siftr_dir_string
+inline string siftr_dir_string[uint8_t direction] =
+   direction == SIFTR_IN ? "in" :
+   direction == SIFTR_OUT ? "out" :
+   "unknown" ;
+
+typedef struct siftrinfo {
+   struct timeval  tval;
+   uint8_t direction;
+   uint8_t ipver;
+   uint32_thash;
+   uint16_ttcp_localport;
+   uint16_ttcp_foreignport;
+   uint64_tsnd_cwnd;
+   u_long  snd_wnd;
+   u_long  rcv_wnd;
+   u_long  snd_bwnd;
+   u_long  snd_ssthresh;
+   int conn_state;
+   u_int   max_seg_size;
+   int smoothed_rtt;
+   u_char  sack_enabled;
+   u_char  snd_scale;
+   u_char  rcv_scale;
+   u_int   flags;
+   int rxt_length;
+   u_int   snd_buf_hiwater;
+   u_int   snd_buf_cc;
+   u_int   rcv_buf_hiwater;
+   u_int   rcv_buf_cc;
+   u_int   sent_inflight_bytes;
+   int t_segqlen;
+   u_int   flowid;
+   u_int   flowtype;
+} siftrinfo_t;
+
+#pragma D binding "1.12.1" translator
+translator siftrinfo_t < struct pkt_node *p > {
+   direction = p == NULL ? 0 : p->direction;
+   ipver = p == NULL ? 0 : p->ipver;
+   hash =  p == NULL ? 0 : p->hash;
+   tcp_localport = p == NULL ? 0 : ntohs(p->tcp_localport);
+   tcp_foreignport =   p == NULL ? 0 : ntohs(p->tcp_foreignport);
+   snd_cwnd =  p == NULL ? 0 : p->snd_cwnd;
+   snd_wnd =   p == NULL ? 0 : p->snd_wnd;
+   rcv_wnd =   p == NULL ? 0 : p->rcv_wnd;
+   snd_bwnd =  p == NULL ? 0 : p->snd_bwnd;
+   snd_ssthresh =  p == NULL ? 0 : p->snd_ssthresh;
+   conn_state =p == NULL ? 0 : p->conn_state;
+   max_seg_size =  p == NULL ? 0 : p->max_seg_size;
+   smoothed_rtt =  p == NULL ? 0 : p->smoothed_rtt;
+   sack_enabled =  p == NULL ? 0 : p->sack_enabled;
+   snd_scale = p == NULL ? 0 : p->snd_scale;
+   rcv_scale = p == NULL ? 0 : p->rcv_scale;
+   flags = p == NULL ? 0 : p->flags;
+   rxt_length =p == NULL ? 0 : p->rxt_length;
+   snd_buf_hiwater =   p == NULL ? 0 : p->snd_buf_hiwater;
+   snd_buf_cc =p == NULL ? 0 : p->snd_buf_cc;
+   rcv_buf_hiwater =   p == NULL ? 0 : p->rcv_buf_hiwater;
+   rcv_buf_cc =p == NULL ? 0 : p->rcv_buf_cc;
+   sent_inflight_bytes =   p == NULL ? 0 : p->sent_inflight_bytes;
+   t_segqlen = p == NULL ? 0 : p->t_segqlen;
+   flowid =p == NULL ? 0 : p->flowid;
+   flowtype =  p == NULL ? 0 : p->flowtype;
+};

Modified: head/sys/netinet/in_kdtrace.c
==
--- head/sys/netinet/in_kdtrace.c   Wed Apr 29 17:18:41 2015
(r282239)
+++ head/sys/netinet/in_kdtrace.c   Wed Apr 29 17:19:55 2015
(r282240)
@@ -102,6 +102,9 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , send,
 "struct tcpcb *", "tcpsinfo_t *" ,
 "struct tcphdr *", "tcpinfo_t *");
 
+SDT_PROBE_DEFINE1_XLATE(tcp, , , siftr,
+"struct pkt_node *", "siftrinfo_t *");
+
 SDT_PROBE_DEFINE6_XLATE(tcp, , , state__change,
 "void *", "void *",
 "struct tcpcb *", "csinfo_t *",

Modified: head/sys/netinet/in_kdtrace.h

svn commit: r282242 - head/share/dtrace

2015-04-29 Thread George V. Neville-Neil
Author: gnn
Date: Wed Apr 29 18:07:58 2015
New Revision: 282242
URL: https://svnweb.freebsd.org/changeset/base/282242

Log:
  Brief demo script showing the various values that can be read via the new 
SIFTR statically defined tracepoint (SDT).
  
  Reviewed by:  bz, markj

Added:
  head/share/dtrace/siftr   (contents, props changed)

Added: head/share/dtrace/siftr
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/dtrace/siftr Wed Apr 29 18:07:58 2015(r282242)
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -s
+/*-
+ * Copyright (c) 2015 George V. Neville-Neil
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ * The siftr D script collects data from the SIFTR kernel module.
+ *
+ * Usage: siftr
+ */
+
+#pragma D option quiet
+tcp:kernel::siftr
+{
+   printf("direction %s state %s local %d remote %d\n",
+  siftr_dir_string[args[0]->direction],
+  tcp_state_string[args[0]->conn_state],
+  args[0]->tcp_localport,
+  args[0]->tcp_foreignport);
+   printf("snd_cwnd %d snd_wnd %d rcv_wnd %d snd_bwnd %d snd_ssthresh 
%d\n",
+  args[0]->snd_cwnd,
+  args[0]->snd_wnd,
+  args[0]->rcv_wnd,
+  args[0]->snd_bwnd,
+  args[0]->snd_ssthresh);
+   printf("\tmax_seg_size %u smoothed_rtt %d sack_enabled %d\n",
+  args[0]->max_seg_size,
+  args[0]->smoothed_rtt,
+  args[0]->sack_enabled);
+   printf("\tsnd_scale %d rcv_scale %d flags 0x%x rxt_length %d\n",
+  args[0]->snd_scale,
+  args[0]->rcv_scale,
+  args[0]->flags,
+  args[0]->rxt_length);
+   printf("\tsnd_buf_hiwater %u snd_buf_cc %u rcv_buf_hiwater %u\n",
+  args[0]->snd_buf_hiwater,
+  args[0]->snd_buf_cc,
+  args[0]->rcv_buf_hiwater);
+   printf("\trcv_buf_cc %u sent_inflight_bytes %u t_segqlen %d\n",
+  args[0]->rcv_buf_cc,
+  args[0]->sent_inflight_bytes,
+  args[0]->t_segqlen);
+   printf("\tflowid %u flowtype %u\n",
+  args[0]->flowid,
+  args[0]->flowtype);
+}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r282276 - head/sys/netinet

2015-04-30 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr 30 17:43:40 2015
New Revision: 282276
URL: https://svnweb.freebsd.org/changeset/base/282276

Log:
  Move the SIFTR DTrace probe out of the writing thread context
  and directly into the place where the data is collected.

Modified:
  head/sys/netinet/siftr.c

Modified: head/sys/netinet/siftr.c
==
--- head/sys/netinet/siftr.cThu Apr 30 16:08:47 2015(r282275)
+++ head/sys/netinet/siftr.cThu Apr 30 17:43:40 2015(r282276)
@@ -549,7 +549,6 @@ siftr_process_pkt(struct pkt_node * pkt_
}
 #endif
 
-   TCP_PROBE1(siftr, pkt_node);
alq_post_flags(siftr_alq, log_buf, 0);
 }
 
@@ -814,6 +813,8 @@ siftr_siftdata(struct pkt_node *pn, stru
 * maximum pps throughput processing when SIFTR is loaded and enabled.
 */
microtime(&pn->tval);
+   TCP_PROBE1(siftr, &pn);
+
 }
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r282300 - head/sys/netinet

2015-05-01 Thread George V. Neville-Neil
Author: gnn
Date: Fri May  1 12:49:03 2015
New Revision: 282300
URL: https://svnweb.freebsd.org/changeset/base/282300

Log:
  Add a state transition call to show that we have entered TIME_WAIT.
  Although this is not important to the rest of the TCP processing
  it is a conveneint way to make the DTrace state-transition probe
  catch this important state change.
  
  MFC after:1 week

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Fri May  1 12:10:36 2015
(r282299)
+++ head/sys/netinet/tcp_timewait.c Fri May  1 12:49:03 2015
(r282300)
@@ -251,6 +251,13 @@ tcp_twstart(struct tcpcb *tp)
}
}
 
+
+   /*
+* For use only by DTrace.  We do not reference the state
+* after this point so modifying it in place is not a problem.
+*/
+   tcp_state_change(tp, TCPS_TIME_WAIT);
+
tw = uma_zalloc(V_tcptw_zone, M_NOWAIT);
if (tw == NULL) {
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r282982 - head/sys/netipsec

2015-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Fri May 15 18:04:49 2015
New Revision: 282982
URL: https://svnweb.freebsd.org/changeset/base/282982

Log:
  Summary: Remove spurious, extra, next header comments.
  Correct the name of the pad length field.

Modified:
  head/sys/netipsec/esp.h

Modified: head/sys/netipsec/esp.h
==
--- head/sys/netipsec/esp.h Fri May 15 17:51:03 2015(r282981)
+++ head/sys/netipsec/esp.h Fri May 15 18:04:49 2015(r282982)
@@ -42,8 +42,7 @@ struct esp {
/*variable size, 32bit bound*/  /* Initialization Vector */
/*variable size*/   /* Payload data */
/*variable size*/   /* padding */
-   /*8bit*//* pad size */
-   /*8bit*//* next header */
+   /*8bit*//* pad length */
/*8bit*//* next header */
/*variable size, 32bit bound*/  /* Authentication data (new IPsec) */
 };
@@ -53,8 +52,7 @@ struct newesp {
u_int32_t   esp_seq;/* Sequence number */
/*variable size*/   /* (IV and) Payload data */
/*variable size*/   /* padding */
-   /*8bit*//* pad size */
-   /*8bit*//* next header */
+   /*8bit*//* pad length */
/*8bit*//* next header */
/*variable size, 32bit bound*/  /* Authentication data */
 };
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r264461 - in head/sys/dev/sfxge: . common

2014-04-14 Thread George V. Neville-Neil
Author: gnn
Date: Mon Apr 14 16:31:56 2014
New Revision: 264461
URL: http://svnweb.freebsd.org/changeset/base/264461

Log:
  Commit various fixes for the SolarFlare drivers, in particular
  this set of patches fixes support for systems with > 32 cores.
  
  Details include
  
  sfxge: RXQ index (not label) comes from FW in flush done/failed events
  
  Change the second argument name of the efx_rxq_flush_done_ev_t and
  efx_rxq_flush_failed_ev_t prototypes to highlight that RXQ index (not label)
  comes from FW in flush done and failed events.
  
  sfxge: TXQ index (not label) comes from FW in flush done event
  
  Change the second argument name of the efx_txq_flush_done_ev_t prototype to
  highlight that TXQ index (not label) comes from FW in flush done event.
  
  sfxge: use TXQ type as label to support more than 32 TXQs
  
  There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload)
  in all other event queues.
  
  Submitted by: Andrew Rybchenko 
  Sponsored by:   Solarflare Communications, Inc.

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_tx.c
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Mon Apr 14 16:15:11 2014
(r264460)
+++ head/sys/dev/sfxge/common/efx.h Mon Apr 14 16:31:56 2014
(r264461)
@@ -1360,17 +1360,17 @@ typedef __checkReturn   boolean_t
 typedef__checkReturn   boolean_t
 (*efx_rxq_flush_done_ev_t)(
__in_optvoid *arg,
-   __inuint32_t label);
+   __inuint32_t rxq_index);
 
 typedef__checkReturn   boolean_t
 (*efx_rxq_flush_failed_ev_t)(
__in_optvoid *arg,
-   __inuint32_t label);
+   __inuint32_t rxq_index);
 
 typedef__checkReturn   boolean_t
 (*efx_txq_flush_done_ev_t)(
__in_optvoid *arg,
-   __inuint32_t label);
+   __inuint32_t txq_index);
 
 typedef__checkReturn   boolean_t
 (*efx_software_ev_t)(

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Mon Apr 14 16:15:11 2014
(r264460)
+++ head/sys/dev/sfxge/common/efx_ev.c  Mon Apr 14 16:31:56 2014
(r264461)
@@ -407,24 +407,24 @@ efx_ev_driver(
 
switch (EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_SUBCODE)) {
case FSE_AZ_TX_DESCQ_FLS_DONE_EV: {
-   uint32_t label;
+   uint32_t txq_index;
 
EFX_EV_QSTAT_INCR(eep, EV_DRIVER_TX_DESCQ_FLS_DONE);
 
-   label = EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_SUBDATA);
+   txq_index = EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_SUBDATA);
 
-   EFSYS_PROBE1(tx_descq_fls_done, uint32_t, label);
+   EFSYS_PROBE1(tx_descq_fls_done, uint32_t, txq_index);
 
EFSYS_ASSERT(eecp->eec_txq_flush_done != NULL);
-   should_abort = eecp->eec_txq_flush_done(arg, label);
+   should_abort = eecp->eec_txq_flush_done(arg, txq_index);
 
break;
}
case FSE_AZ_RX_DESCQ_FLS_DONE_EV: {
-   uint32_t label;
+   uint32_t rxq_index;
uint32_t failed;
 
-   label = EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_RX_DESCQ_ID);
+   rxq_index = EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_RX_DESCQ_ID);
failed = EFX_QWORD_FIELD(*eqp, FSF_AZ_DRIVER_EV_RX_FLUSH_FAIL);
 
EFSYS_ASSERT(eecp->eec_rxq_flush_done != NULL);
@@ -433,15 +433,15 @@ efx_ev_driver(
if (failed) {
EFX_EV_QSTAT_INCR(eep, EV_DRIVER_RX_DESCQ_FLS_FAILED);
 
-   EFSYS_PROBE1(rx_descq_fls_failed, uint32_t, label);
+   EFSYS_PROBE1(rx_descq_fls_failed, uint32_t, rxq_index);
 
-   should_abort = eecp->eec_rxq_flush_failed(arg, label);
+   should_abort = eecp->eec_rxq_flush_failed(arg, 
rxq_index);
} else {
EFX_EV_QSTAT_INCR(eep, EV_DRIVER_RX_DESCQ_FLS_DONE);
 
-   EFSYS_PROBE1(rx_descq_fls_done, uint32_t, label);
+   EFSYS_PROBE1(rx_descq_fls_done, uint32_t, rxq_index);
 
-   should_abort = eecp->eec_rxq_flush_done(arg, label);
+   should_abort = eecp->eec_rxq_flush_done(arg, rxq_index);
}
 
break;

Modified: head/sys/dev/sfxge/common/efx_tx.c
==
--- head/sys/dev/sfxge/common/efx_tx.c  Mon Apr 14 16:15:11 2014
(r264460)
+++ head/sys/dev/sfxge/common/efx_tx.c  Mon Apr 14 16:31:56 2014
(r264461)
@@ -2

svn commit: r264772 - head/sys/dev/sfxge

2014-04-22 Thread George V. Neville-Neil
Author: gnn
Date: Tue Apr 22 20:19:09 2014
New Revision: 264772
URL: http://svnweb.freebsd.org/changeset/base/264772

Log:
  Check that port is started when MAC filter is set
  
  The MAC filter set may be called without softc_lock held in the case of
  SIOCADDMULTI and SIOCDELMULTI ioctls. The ioctl handler checks IFF_DRV_RUNNING
  flag which implies port started, but it is not guaranteed to remain.
  softc_lock shared lock can't be held in the case of these ioctls processing,
  since it results in failure where kernel complains that non-sleepable
  lock is held in sleeping thread.
  
  Both problems are repeatable on LAG with LACP proto bring up.
  
  Submitted by:   Andrew Rybchenko 
  Sponsored by:   Solarflare Communications, Inc.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/sfxge/sfxge_port.c

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Tue Apr 22 20:17:05 2014
(r264771)
+++ head/sys/dev/sfxge/sfxge_port.c Tue Apr 22 20:19:09 2014
(r264772)
@@ -320,10 +320,21 @@ sfxge_mac_filter_set(struct sfxge_softc 
struct sfxge_port *port = &sc->port;
int rc;
 
-   KASSERT(port->init_state == SFXGE_PORT_STARTED, ("port not started"));
-
mtx_lock(&port->lock);
-   rc = sfxge_mac_filter_set_locked(sc);
+   /*
+* The function may be called without softc_lock held in the
+* case of SIOCADDMULTI and SIOCDELMULTI ioctls. ioctl handler
+* checks IFF_DRV_RUNNING flag which implies port started, but
+* it is not guaranteed to remain. softc_lock shared lock can't
+* be held in the case of these ioctls processing, since it
+* results in failure where kernel complains that non-sleepable
+* lock is held in sleeping thread. Both problems are repeatable
+* on LAG with LACP proto bring up.
+*/
+   if (port->init_state == SFXGE_PORT_STARTED)
+   rc = sfxge_mac_filter_set_locked(sc);
+   else
+   rc = 0;
mtx_unlock(&port->lock);
return rc;
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266166 - head/usr.sbin/pmcannotate

2014-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Thu May 15 18:12:47 2014
New Revision: 266166
URL: http://svnweb.freebsd.org/changeset/base/266166

Log:
  Extend the size of the function or symbol that can be annotated.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/pmcannotate/pmcannotate.c

Modified: head/usr.sbin/pmcannotate/pmcannotate.c
==
--- head/usr.sbin/pmcannotate/pmcannotate.c Thu May 15 18:07:35 2014
(r266165)
+++ head/usr.sbin/pmcannotate/pmcannotate.c Thu May 15 18:12:47 2014
(r266166)
@@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#defineFNBUFF  161
-#defineLNBUFF  161
+#defineFNBUFF  512
+#defineLNBUFF  512
 
 #defineTMPPATH "/tmp/pmcannotate.XX"
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266171 - head/sys/sys

2014-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Thu May 15 18:46:16 2014
New Revision: 266171
URL: http://svnweb.freebsd.org/changeset/base/266171

Log:
  Update the amount of data we can collect for hwpmc(4) by default
  to work with modern processors and available memory.
  
  Submitted by: Julien Charbon
  MFC after:2 weeks

Modified:
  head/sys/sys/pmc.h

Modified: head/sys/sys/pmc.h
==
--- head/sys/sys/pmc.h  Thu May 15 18:38:19 2014(r266170)
+++ head/sys/sys/pmc.h  Thu May 15 18:46:16 2014(r266171)
@@ -598,11 +598,11 @@ struct pmc_op_getdyneventinfo {
 
 #include 
 
-#definePMC_HASH_SIZE   16
-#definePMC_MTXPOOL_SIZE32
+#definePMC_HASH_SIZE   1024
+#definePMC_MTXPOOL_SIZE2048
 #definePMC_LOG_BUFFER_SIZE 4
-#definePMC_NLOGBUFFERS 64
-#definePMC_NSAMPLES512
+#definePMC_NLOGBUFFERS 1024
+#definePMC_NSAMPLES1024
 #definePMC_CALLCHAIN_DEPTH 8
 
 #define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "."
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266174 - head/sys/sys

2014-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Thu May 15 18:53:02 2014
New Revision: 266174
URL: http://svnweb.freebsd.org/changeset/base/266174

Log:
  Upgrade the default callchain depth
  
  MFC after:2 weeks

Modified:
  head/sys/sys/pmc.h

Modified: head/sys/sys/pmc.h
==
--- head/sys/sys/pmc.h  Thu May 15 18:51:01 2014(r266173)
+++ head/sys/sys/pmc.h  Thu May 15 18:53:02 2014(r266174)
@@ -603,7 +603,7 @@ struct pmc_op_getdyneventinfo {
 #definePMC_LOG_BUFFER_SIZE 4
 #definePMC_NLOGBUFFERS 1024
 #definePMC_NSAMPLES1024
-#definePMC_CALLCHAIN_DEPTH 8
+#definePMC_CALLCHAIN_DEPTH 16
 
 #define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "."
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266209 - head/usr.sbin/pmcstat

2014-05-15 Thread George V. Neville-Neil
Author: gnn
Date: Fri May 16 03:18:09 2014
New Revision: 266209
URL: http://svnweb.freebsd.org/changeset/base/266209

Log:
  Add a command line argument (-l) to end event collection after some
  number of seconds.  The number of seconds may be a fraction.
  
  Submitted by: Julien Charbon 
  MFC after:2 weeks
  Relnotes: yes

Modified:
  head/usr.sbin/pmcstat/pmcstat.8
  head/usr.sbin/pmcstat/pmcstat.c
  head/usr.sbin/pmcstat/pmcstat.h

Modified: head/usr.sbin/pmcstat/pmcstat.8
==
--- head/usr.sbin/pmcstat/pmcstat.8 Fri May 16 03:05:53 2014
(r266208)
+++ head/usr.sbin/pmcstat/pmcstat.8 Fri May 16 03:18:09 2014
(r266209)
@@ -52,6 +52,7 @@
 .Op Fl f Ar pluginopt
 .Op Fl g
 .Op Fl k Ar kerneldir
+.Op Fl l Ar secs
 .Op Fl m Ar pathname
 .Op Fl n Ar rate
 .Op Fl o Ar outputfile
@@ -274,6 +275,13 @@ This directory specifies where
 should look for the kernel and its modules.
 The default is
 .Pa /boot/kernel .
+.It Fl l Ar secs
+Set system-wide performance measurement duration for
+.Ar secs
+seconds.
+The argument
+.Ar secs
+may be a fractional value.
 .It Fl m Ar pathname
 Print the sampled PCs with the name, the start and ending addresses
 of the function within they live.

Modified: head/usr.sbin/pmcstat/pmcstat.c
==
--- head/usr.sbin/pmcstat/pmcstat.c Fri May 16 03:05:53 2014
(r266208)
+++ head/usr.sbin/pmcstat/pmcstat.c Fri May 16 03:18:09 2014
(r266209)
@@ -509,6 +509,7 @@ pmcstat_show_usage(void)
"\t -f spec\t pass \"spec\" to as plugin option\n"
"\t -g\t\t produce gprof(1) compatible profiles\n"
"\t -k dir\t\t set the path to the kernel\n"
+   "\t -l secs\t set duration time\n"
"\t -m file\t print sampled PCs to \"file\"\n"
"\t -n rate\t set sampling rate\n"
"\t -o file\t send print output to \"file\"\n"
@@ -551,6 +552,7 @@ main(int argc, char **argv)
 {
cpuset_t cpumask;
double interval;
+   double duration;
int hcpu, option, npmc, ncpu;
int c, check_driver_stats, current_sampling_count;
int do_callchain, do_descendants, do_logproccsw, do_logprocexit;
@@ -600,6 +602,7 @@ main(int argc, char **argv)
args.pa_toptty  = 0;
args.pa_topcolor= 0;
args.pa_mergepmc= 0;
+   args.pa_duration= 0.0;
STAILQ_INIT(&args.pa_events);
SLIST_INIT(&args.pa_targets);
bzero(&ds_start, sizeof(ds_start));
@@ -618,7 +621,7 @@ main(int argc, char **argv)
CPU_SET(hcpu, &cpumask);
 
while ((option = getopt(argc, argv,
-   "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:m:n:o:p:qr:s:t:vw:z:")) != -1)
+   "CD:EF:G:M:NO:P:R:S:TWa:c:df:gk:l:m:n:o:p:qr:s:t:vw:z:")) != -1)
switch (option) {
case 'a':   /* Annotate + callgraph */
args.pa_flags |= FLAG_DO_ANNOTATE;
@@ -692,6 +695,15 @@ main(int argc, char **argv)
args.pa_flags|= FLAG_HAS_KERNELPATH;
break;
 
+   case 'l':   /* time duration in seconds */
+   duration = strtod(optarg, &end);
+   if (*end != '\0' || duration <= 0)
+   errx(EX_USAGE, "ERROR: Illegal duration time "
+   "value \"%s\".", optarg);
+   args.pa_flags |= FLAG_HAS_DURATION;
+   args.pa_duration = duration;
+   break;
+
case 'm':
args.pa_flags |= FLAG_DO_ANNOTATE;
args.pa_plugin = PMCSTAT_PL_ANNOTATE;
@@ -922,6 +934,12 @@ main(int argc, char **argv)
errx(EX_USAGE,
"ERROR: options -O and -R are mutually exclusive.");
 
+   /* disallow -T and -l together */
+   if ((args.pa_flags & FLAG_HAS_DURATION) &&
+   (args.pa_flags & FLAG_DO_TOP))
+   errx(EX_USAGE, "ERROR: options -T and -l are mutually "
+   "exclusive.");
+
/* -m option is allowed with -R only. */
if (args.pa_flags & FLAG_DO_ANNOTATE && args.pa_inputpath == NULL)
errx(EX_USAGE, "ERROR: option %s requires an input file",
@@ -1279,6 +1297,20 @@ main(int argc, char **argv)
"ERROR: Cannot register kevent for timer");
}
 
+   /*
+* Setup a duration timer if we have sampling mode PMCs and
+* a duration time is set
+*/
+   if ((args.pa_flags & FLAG_HAS_SAMPLING_PMCS) &&
+   (args.pa_flags & FLAG_HAS_DURATION)) {
+   EV_SET(&kev, 0, EVFILT_TIMER, EV_ADD, 0,
+   args.pa_duration * 1000, NULL);
+
+   if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0)
+ 

svn commit: r266403 - head/usr.sbin/pmcstat

2014-05-18 Thread George V. Neville-Neil
Author: gnn
Date: Sun May 18 15:31:53 2014
New Revision: 266403
URL: http://svnweb.freebsd.org/changeset/base/266403

Log:
  Update the date on the manual page.
  
  Pointed out by: bz

Modified:
  head/usr.sbin/pmcstat/pmcstat.8

Modified: head/usr.sbin/pmcstat/pmcstat.8
==
--- head/usr.sbin/pmcstat/pmcstat.8 Sun May 18 15:31:02 2014
(r266402)
+++ head/usr.sbin/pmcstat/pmcstat.8 Sun May 18 15:31:53 2014
(r266403)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 29, 2014
+.Dd May 16, 2014
 .Dt PMCSTAT 8
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266983 - head/sys/dev/hwpmc

2014-06-02 Thread George V. Neville-Neil
Author: gnn
Date: Mon Jun  2 20:50:08 2014
New Revision: 266983
URL: http://svnweb.freebsd.org/changeset/base/266983

Log:
  Add missing Ivy Bridge and Haswell events.
  
  Submitted by: Anton Rang 
  MFC: 2 weeks

Modified:
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/sys/dev/hwpmc/pmc_events.h
==
--- head/sys/dev/hwpmc/pmc_events.h Mon Jun  2 20:23:41 2014
(r266982)
+++ head/sys/dev/hwpmc/pmc_events.h Mon Jun  2 20:50:08 2014
(r266983)
@@ -2573,6 +2573,7 @@ __PMC_EV_ALIAS("SIMD_INT_64.SHUFFLE_MOVE
  * Aliases for Haswell core PMC events
  */
 #define __PMC_EV_ALIAS_HASWELL()   \
+__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()   \
 __PMC_EV_ALIAS("LD_BLOCKS.STORE_FORWARD", IAP_EVENT_03H_02H)   \
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.LOADS", IAP_EVENT_05H_01H)\
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.STORES", IAP_EVENT_05H_02H)   \
@@ -2794,6 +2795,7 @@ __PMC_EV_ALIAS("L2_LINES_OUT.DEMAND_DIRT
 
 
 #define __PMC_EV_ALIAS_IVYBRIDGE() \
+__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()   \
 __PMC_EV_ALIAS("LD_BLOCKS.STORE_FORWARD", IAP_EVENT_03H_02H)   \
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.LOADS", IAP_EVENT_05H_01H)\
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.STORES", IAP_EVENT_05H_02H)   \
@@ -3002,6 +3004,7 @@ __PMC_EV_ALIAS("L2_LINES_OUT.PF_DIRTY", 
  * Aliases for Ivy Bridge Xeon PMC events (325462-045US January 2013)
  */
 #define __PMC_EV_ALIAS_IVYBRIDGE_XEON()
\
+__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()   \
 __PMC_EV_ALIAS("LD_BLOCKS.STORE_FORWARD", IAP_EVENT_03H_02H)   \
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.LOADS", IAP_EVENT_05H_01H)\
 __PMC_EV_ALIAS("MISALIGN_MEM_REF.STORES", IAP_EVENT_05H_02H)   \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r258141 - head/sys/net

2013-11-14 Thread George V. Neville-Neil
Author: gnn
Date: Thu Nov 14 19:53:35 2013
New Revision: 258141
URL: http://svnweb.freebsd.org/changeset/base/258141

Log:
  The FreeBSD Project now has its own, Ogranizationally Unique Identifier,
  assigned by the IEEE.  This file includes documentation on how developers
  must carve up the space as well as an initial allocation for bhyve.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/net/ieee_oui.h   (contents, props changed)

Added: head/sys/net/ieee_oui.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/net/ieee_oui.h Thu Nov 14 19:53:35 2013(r258141)
@@ -0,0 +1,66 @@
+/* 
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials provided
+ *with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ *
+ * Author: George V. Neville-Neil
+ *
+ */
+
+/* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */
+#define OUI_FREEBSD 0x589cfc
+
+/* 
+ * OUIs are most often used to uniquely identify network interfaces
+ * and occupy the first 3 bytes of both destination and source MAC
+ * addresses.  The following allocations exist so that various
+ * software systems associated with FreeBSD can have unique IDs in the
+ * absence of hardware.  The use of OUIs for this purpose is not fully
+ * fleshed out but is now in common use in virtualization technology.
+ * 
+ * Allocations from this range are expected to be made using COMMON
+ * SENSE by developers.  Do NOT take a large range just because
+ * they're currently wide open.  Take the smallest useful range for
+ * your system.  We have (2^24 - 2) available addresses (see Reserved
+ * Values below) but that is far from infinite.
+ *
+ * In the event of a conflict arbitration of allocation in this file
+ * is subject to core@ approval
+ * 
+ * Applications are differentiated based on the high order bit(s) of
+ * the remaining three bytes.  Our first allocation has all 0s, the
+ * next allocation has the highest bit set.  Allocating in this way
+ * gives us 254 allocations of 64K addresses.  Address blocks can be
+ * concatenated if necessary.
+ *
+ * Reserved Values: 0x00 and 0xff are reserved and MUST NOT BE
+ * allocated for any reason.
+ */
+
+/* Allocate 64K to bhyve */
+#define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD + 0x01
+#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD + 0x00
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r258142 - head/sys/net

2013-11-14 Thread George V. Neville-Neil
Author: gnn
Date: Thu Nov 14 20:07:17 2013
New Revision: 258142
URL: http://svnweb.freebsd.org/changeset/base/258142

Log:
  Shift our OUI correctly.
  
  Pointed out by: emaste

Modified:
  head/sys/net/ieee_oui.h

Modified: head/sys/net/ieee_oui.h
==
--- head/sys/net/ieee_oui.h Thu Nov 14 19:53:35 2013(r258141)
+++ head/sys/net/ieee_oui.h Thu Nov 14 20:07:17 2013(r258142)
@@ -62,5 +62,5 @@
  */
 
 /* Allocate 64K to bhyve */
-#define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD + 0x01
-#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD + 0x00
+#define OUI_FREEBSD_BHYVE_LOW  ((OUI_FREEBSD << 3) + 0x01)
+#define OUI_FREEBSD_BHYVE_HIGH ((OUI_FREEBSD << 3) + 0x00)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r258147 - head/sys/net

2013-11-14 Thread George V. Neville-Neil
Author: gnn
Date: Thu Nov 14 21:57:37 2013
New Revision: 258147
URL: http://svnweb.freebsd.org/changeset/base/258147

Log:
  Put in the correct bit shifting and add a type to prevent clang from 
complaining.
  While here fix up a grammar nit.
  
  Pointed out by: Sergey Kandaurov and bz@ respectively.

Modified:
  head/sys/net/ieee_oui.h

Modified: head/sys/net/ieee_oui.h
==
--- head/sys/net/ieee_oui.h Thu Nov 14 21:31:58 2013(r258146)
+++ head/sys/net/ieee_oui.h Thu Nov 14 21:57:37 2013(r258147)
@@ -49,7 +49,7 @@
  * Values below) but that is far from infinite.
  *
  * In the event of a conflict arbitration of allocation in this file
- * is subject to core@ approval
+ * is subject to core@ approval.
  * 
  * Applications are differentiated based on the high order bit(s) of
  * the remaining three bytes.  Our first allocation has all 0s, the
@@ -62,5 +62,5 @@
  */
 
 /* Allocate 64K to bhyve */
-#define OUI_FREEBSD_BHYVE_LOW  ((OUI_FREEBSD << 3) + 0x01)
-#define OUI_FREEBSD_BHYVE_HIGH ((OUI_FREEBSD << 3) + 0x00)
+#define OUI_FREEBSD_BHYVE_LOW  (((uint64_t)OUI_FREEBSD << 24) | 0x01)
+#define OUI_FREEBSD_BHYVE_HIGH (((uint64_t)OUI_FREEBSD << 24) | 0x00)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r258175 - head/sys/net

2013-11-15 Thread George V. Neville-Neil
Author: gnn
Date: Fri Nov 15 16:03:32 2013
New Revision: 258175
URL: http://svnweb.freebsd.org/changeset/base/258175

Log:
  Clean up the macros to avoid using casts.
  
  Suggested by: bde and jhb

Modified:
  head/sys/net/ieee_oui.h

Modified: head/sys/net/ieee_oui.h
==
--- head/sys/net/ieee_oui.h Fri Nov 15 15:29:53 2013(r258174)
+++ head/sys/net/ieee_oui.h Fri Nov 15 16:03:32 2013(r258175)
@@ -32,7 +32,8 @@
  */
 
 /* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */
-#define OUI_FREEBSD 0x589cfc
+#define OUI_FREEBSD_BASE 0x589cfc00
+#define OUI_FREEBSD(nic) (OUI_FREEBSD_BASE | (nic))
 
 /* 
  * OUIs are most often used to uniquely identify network interfaces
@@ -62,5 +63,5 @@
  */
 
 /* Allocate 64K to bhyve */
-#define OUI_FREEBSD_BHYVE_LOW  (((uint64_t)OUI_FREEBSD << 24) | 0x01)
-#define OUI_FREEBSD_BHYVE_HIGH (((uint64_t)OUI_FREEBSD << 24) | 0x00)
+#define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD(0x01)
+#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD(0x00)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r258328 - head/sys/net

2013-11-18 Thread George V. Neville-Neil
Author: gnn
Date: Mon Nov 18 22:58:14 2013
New Revision: 258328
URL: http://svnweb.freebsd.org/changeset/base/258328

Log:
  Allow ethernet drivers to pass in packets connected via the nextpkt pointer.
  Handling packets in this way allows drivers to amortize work during packet 
reception.
  
  Submitted by: Vijay Singh
  Sponsored by: NetApp

Modified:
  head/sys/net/if_ethersubr.c

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Mon Nov 18 22:55:50 2013(r258327)
+++ head/sys/net/if_ethersubr.c Mon Nov 18 22:58:14 2013(r258328)
@@ -708,13 +708,25 @@ static void
 ether_input(struct ifnet *ifp, struct mbuf *m)
 {
 
+   struct mbuf *mn;
+
/*
-* We will rely on rcvif being set properly in the deferred context,
-* so assert it is correct here.
+* The drivers are allowed to pass in a chain of packets linked with
+* m_nextpkt. We split them up into separate packets here and pass
+* them up. This allows the drivers to amortize the receive lock.
 */
-   KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__));
+   while (m) {
+   mn = m->m_nextpkt;
+   m->m_nextpkt = NULL;
 
-   netisr_dispatch(NETISR_ETHER, m);
+   /*
+* We will rely on rcvif being set properly in the deferred 
context,
+* so assert it is correct here.
+*/
+   KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", 
__func__));
+   netisr_dispatch(NETISR_ETHER, m);
+   m = mn;
+   }
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


  1   2   3   >