Re: svn commit: r278889 - head/lib/libc/include

2015-02-19 Thread Konstantin Belousov
On Thu, Feb 19, 2015 at 11:58:48AM +1100, Bruce Evans wrote:
> On Wed, 18 Feb 2015, Bryan Drewery wrote:
> 
> > On 2/17/2015 2:54 AM, Konstantin Belousov wrote:
> >> ...
> >> Log:
> >>   Restore the extern qualifier on __cleanup.
> >> ...
> >> Modified: head/lib/libc/include/libc_private.h
> >> ==
> >> --- head/lib/libc/include/libc_private.h   Tue Feb 17 08:50:26 2015
> >> (r27)
> >> +++ head/lib/libc/include/libc_private.h   Tue Feb 17 08:54:03 2015
> >> (r278889)
> >> @@ -271,7 +271,7 @@ void _malloc_first_thread(void);
> >>  /*
> >>   * Function to clean up streams, called from abort() and exit().
> >>   */
> >> -void (*__cleanup)(void) __hidden;
> >> +extern void (*__cleanup)(void) __hidden;
> >>
> >>  /*
> >>   * Get kern.osreldate to detect ABI revisions.  Explicitly
> >>
> >
> > Is this a NOP?
> 
> No, since this is a data declaration.  It would be a style bug on a
> prototype.
> 
> BTW, the reason for existence of __cleanup() has been broken by malloc()
> and other bloatware.  It is to avoid linking anything in stdio when
> only exit() is used.  But crtso now links to malloc() and malloc()
> links to stdio and much more.  When correctly (that is, statically)
> linked, this bloats the size of a minimal C program from to 440K + 80K
> symbols on amd64 and to 390K + 60K symbols on i386.  In FreeBSD-4 and
> in my version of FreeBSD-5, __cleanup still works and the minimal C
> program has size 2K + 1.5K symbols.  In FreeBSD-5, malloc() is
> relatively unbloated, so crtso's linking to it costs only 9K + 9K
> symbols instead of 400+K.  The same program written in asm takes about
> 10 bytes in all versions of FreeBSD-x86.  When dynamically linked,
> __cleanup() has little effect.

I briefly looked at the possibility of removing __cleanup (*).  Besides
ensuring that all stdio FILEs are flushed at exit(3), it also ensures
that stdio finalization is performed as the last action, after the whole
chain of atexit(3) handlers was called.  To repeat this behaviour, the
flush handler must be registered very early, which would just mirror
special behaviour of __cleanup, but at the startup.

* Bruce, I do understand that your response is that we should fix malloc
to not depend on stdio instead.
___
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"


Re: svn commit: r278889 - head/lib/libc/include

2015-02-19 Thread Bruce Evans

On Thu, 19 Feb 2015, Konstantin Belousov wrote:


On Thu, Feb 19, 2015 at 11:58:48AM +1100, Bruce Evans wrote:


BTW, the reason for existence of __cleanup() has been broken by malloc()
and other bloatware.  It is to avoid linking anything in stdio when
only exit() is used.  But crtso now links to malloc() and malloc()
links to stdio and much more.  When correctly (that is, statically)
linked, this bloats the size of a minimal C program from to 440K + 80K
symbols on amd64 and to 390K + 60K symbols on i386.  In FreeBSD-4 and
in my version of FreeBSD-5, __cleanup still works and the minimal C
program has size 2K + 1.5K symbols.  In FreeBSD-5, malloc() is
relatively unbloated, so crtso's linking to it costs only 9K + 9K
symbols instead of 400+K.  The same program written in asm takes about
10 bytes in all versions of FreeBSD-x86.  When dynamically linked,
__cleanup() has little effect.


I briefly looked at the possibility of removing __cleanup (*).  Besides
ensuring that all stdio FILEs are flushed at exit(3), it also ensures
that stdio finalization is performed as the last action, after the whole
chain of atexit(3) handlers was called.  To repeat this behaviour, the
flush handler must be registered very early, which would just mirror
special behaviour of __cleanup, but at the startup.

* Bruce, I do understand that your response is that we should fix malloc
to not depend on stdio instead.


Also, malloc to not be so difficult to replace, and atexit() and possibly
other things called by crtso to not be so large and/or not have such a
large closure including calling malloc().

I use this hack for atexit():

X Index: atexit.c
X ===
X RCS file: /home/ncvs/src/lib/libc/stdlib/atexit.c,v
X retrieving revision 1.7
X diff -u -2 -r1.7 atexit.c
X --- atexit.c  19 Dec 2003 17:11:20 -  1.7
X +++ atexit.c  21 Dec 2003 15:20:28 -
X @@ -55,8 +55,15 @@
X  #define  ATEXIT_FN_CXA   2
X 
X +/* XXX how to remove this in non-threaded case? */

X  static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER;
X 
X -#define _MUTEX_LOCK(x)		if (__isthreaded) _pthread_mutex_lock(x)

X -#define _MUTEX_UNLOCK(x) if (__isthreaded) _pthread_mutex_unlock(x)
X +#define  _MUTEX_LOCK(x) do { \
X + if (__isthreaded)   \
X + _pthread_mutex_lock(x); \
X +} while (0)
X +#define _MUTEX_UNLOCK(x) do {\
X + if (__isthreaded)   \
X + _pthread_mutex_unlock(x);   \
X +} while (0)
X 
X  struct atexit {

X @@ -76,4 +83,10 @@
X  static struct atexit *__atexit;  /* points to head of LIFO stack 
*/
X 
X +#pragma weak malloc

X +#pragma weak free
X +#pragma weak __isthreaded
X +#pragma weak _pthread_mutex_lock
X +#pragma weak _pthread_mutex_unlock
X +
X  /*
X   * Register the function described by 'fptr' to be called at application
X @@ -94,6 +107,13 @@
X   old__atexit = __atexit;
X   _MUTEX_UNLOCK(&atexit_mutex);
X - if ((p = (struct atexit *)malloc(sizeof(*p))) == NULL)
X - return (-1);
X + if (&malloc == NULL) {
X + p = sbrk(sizeof(*p));
X + if (p == (struct atexit *)-1)
X + return (-1);
X + } else {
X + p = malloc(sizeof(*p));
X + if (p == NULL)
X + return (-1);
X + }
X   _MUTEX_LOCK(&atexit_mutex);
X   if (old__atexit != __atexit) {

BTW, atexit() has uses a space-saving feature that has been broken by
it calling malloc().  This is the static allocation of ATEXIT_SIZE =
32 entries.  Each entry takes 16 bytes on i386.  Most programs should
never call atexit(), so if malloc() is linked then the static table
just wastes the size of 32 entries.  But crtso calls atexit(), so all
C programs except ones linked with -nostdlib call atexit(), and a
couple of statically allocated entries are useful.  However, these
shouldn't be full entries.  Note that __cleanup() is essentially a
specialized version of atexit().  It plus code to call it costs just
a little more than the space for 1 atexit entry, and costs less to set
up.  for 1 entry.  Perhaps all the atexit() calls in crtso can be
handled similarly, so that atexit() is only linked if the application
proper calls it.  Simply place them in exit() in the correct order
relative to __cxa_finalize() and __cleanup().

Bruce
___
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: r278992 - head/usr.sbin

2015-02-19 Thread Garrett Cooper
Author: ngie
Date: Thu Feb 19 11:17:36 2015
New Revision: 278992
URL: https://svnweb.freebsd.org/changeset/base/278992

Log:
  Unbreak freshly installed worlds by properly "commenting" out ifmcstat
  
  Pointyhat to: glebius

Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Feb 19 10:28:22 2015(r278991)
+++ head/usr.sbin/Makefile  Thu Feb 19 11:17:36 2015(r278992)
@@ -33,7 +33,7 @@ SUBDIR=   adduser \
getpmac \
gstat \
i2c \
-#  ifmcstat \
+   ifmcstat \
iostat \
kldxref \
mailwrapper \
@@ -94,6 +94,8 @@ SUBDIR=   adduser \
watchdogd \
zic
 
+SUBDIR:=   ${SUBDIR:Nifmcstat}
+
 # NB: keep these sorted by MK_* knobs
 
 .if ${MK_ACCT} != "no"
___
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"


Re: svn commit: r278988 - head/usr.sbin

2015-02-19 Thread Garrett Cooper
On Feb 18, 2015, at 22:27, Gleb Smirnoff  wrote:

> Author: glebius
> Date: Thu Feb 19 06:27:14 2015
> New Revision: 278988
> URL: https://svnweb.freebsd.org/changeset/base/278988
> 
> Log:
>  Temporarily disconnect ifmcstat(8) from build, to make world buildable
>  ifmcstat(8) noses in kernel memory too much, and thus is very tentative
>  to any changes in kernel.
> 
>  I will rewrite it to use some API instead of libkvm(3) and connect back
>  to build.
> 
> Modified:
>  head/usr.sbin/Makefile
> 
> Modified: head/usr.sbin/Makefile
> ==
> --- head/usr.sbin/MakefileThu Feb 19 06:24:27 2015(r278987)
> +++ head/usr.sbin/MakefileThu Feb 19 06:27:14 2015(r278988)
> @@ -33,7 +33,7 @@ SUBDIR= adduser \
>   getpmac \
>   gstat \
>   i2c \
> - ifmcstat \
> +#ifmcstat \
>   iostat \
>   kldxref \
>   mailwrapper \
> 

Hi Gleb,

You just broke the build (technically the install) again with this commit. I 
checked in a “fix” in r278992 — please remove the addition I made in r278992 
when ifmcstat is “fixed”.

Thank you,

$ SRCCONF=/dev/null make -VSUBDIR | grep kldxref
$


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r278979 - head/sys/netinet6

2015-02-19 Thread Alastair Hogge
Thanks

On 2015-02-19 Thu 09:28:55 +0300, Gleb Smirnoff wrote:
> On Thu, Feb 19, 2015 at 02:22:33PM +0800, Alastair Hogge wrote:
> A> On 2015-02-19 Thu 07:32:37 +0300, Gleb Smirnoff wrote:
> A> > On Thu, Feb 19, 2015 at 10:49:22AM +0800, Alastair Hogge wrote:
> A> > A> On 2015-02-19 Thu 01:21:24 +, Gleb Smirnoff wrote:
> A> > A>
> A> > A> Hi Gleb,
> A> > A>
> A> > A> I think this commit the whole economy^W buildworld?
> A> >
> A> > Here is preliminary patch, that I'm testing now.
> A>
> A> Ta, the build continues, tho, it breaks on sys/netinet/in_var.h now:
>
> Should be fixed now with r278987 and r278988.
___
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: r278995 - head/sys/ofed/drivers/infiniband/core

2015-02-19 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Feb 19 11:48:00 2015
New Revision: 278995
URL: https://svnweb.freebsd.org/changeset/base/278995

Log:
  Try to unbreak NOIP and NOINET6 LINT builds after r278886
  by placing appropriate #ifdefs around otherwise unused variables
  or sections with functions called which are not available without
  IPv6 support in the kernel.

Modified:
  head/sys/ofed/drivers/infiniband/core/cma.c

Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==
--- head/sys/ofed/drivers/infiniband/core/cma.c Thu Feb 19 11:44:50 2015
(r278994)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Thu Feb 19 11:48:00 2015
(r278995)
@@ -2558,8 +2558,10 @@ int rdma_bind_addr(struct rdma_cm_id *id
 {
struct rdma_id_private *id_priv;
int ret;
+#if defined(INET6)
int ipv6only;
size_t var_size = sizeof(int);
+#endif
 
if (addr->sa_family != AF_INET && addr->sa_family != AF_INET6)
return -EAFNOSUPPORT;
@@ -3222,10 +3224,13 @@ static void cma_set_mgid(struct rdma_id_
unsigned char mc_map[MAX_ADDR_LEN];
struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
struct sockaddr_in *sin = (struct sockaddr_in *) addr;
+#if defined(INET6)
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) addr;
+#endif
 
if (cma_any_addr(addr)) {
memset(mgid, 0, sizeof *mgid);
+#if defined(INET6)
} else if ((addr->sa_family == AF_INET6) &&
   ((be32_to_cpu(sin6->sin6_addr.s6_addr32[0]) & 0xFFF0) ==
 0xFF10A01B)) {
@@ -3236,6 +3241,7 @@ static void cma_set_mgid(struct rdma_id_
if (id_priv->id.ps == RDMA_PS_UDP)
mc_map[7] = 0x01;   /* Use RDMA CM signature */
*mgid = *(union ib_gid *) (mc_map + 4);
+#endif
} else {
ip_ib_mc_map(sin->sin_addr.s_addr, dev_addr->broadcast, mc_map);
if (id_priv->id.ps == RDMA_PS_UDP)
___
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: r278996 - in head/sys: arm/arm arm/include conf

2015-02-19 Thread Andrew Turner
Author: andrew
Date: Thu Feb 19 12:06:57 2015
New Revision: 278996
URL: https://svnweb.freebsd.org/changeset/base/278996

Log:
  Allow the ARM unwinder to work through modules. This will be used to add
  support for unwinding from dtrace.
  
  Tested by:gnn (with dtrace)
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm/arm/db_trace.c
  head/sys/arm/arm/unwind.c
  head/sys/arm/include/stack.h
  head/sys/conf/kmod.mk

Modified: head/sys/arm/arm/db_trace.c
==
--- head/sys/arm/arm/db_trace.c Thu Feb 19 11:48:00 2015(r278995)
+++ head/sys/arm/arm/db_trace.c Thu Feb 19 12:06:57 2015(r278996)
@@ -66,7 +66,7 @@ db_stack_trace_cmd(struct unwind_state *
 
finished = false;
while (!finished) {
-   finished = unwind_stack_one(state);
+   finished = unwind_stack_one(state, 0);
 
/* Print the frame details */
sym = db_search_symbol(state->start_pc, DB_STGY_ANY, &offset);

Modified: head/sys/arm/arm/unwind.c
==
--- head/sys/arm/arm/unwind.c   Thu Feb 19 11:48:00 2015(r278995)
+++ head/sys/arm/arm/unwind.c   Thu Feb 19 12:06:57 2015(r278996)
@@ -33,9 +33,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 
+#include "linker_if.h"
+
 /*
  * Definitions for the instruction interpreter.
  *
@@ -61,7 +64,7 @@ __FBSDID("$FreeBSD$");
  * These are set in the linker script. Their addresses will be
  * either the start or end of the exception table or index.
  */
-extern int extab_start, extab_end, exidx_start, exidx_end;
+extern int exidx_start, exidx_end;
 
 /*
  * Entry types.
@@ -104,13 +107,47 @@ expand_prel31(uint32_t prel31)
return ((int32_t)(prel31 & 0x7fffu) << 1) / 2;
 }
 
+struct search_context {
+   uint32_t addr;
+   caddr_t exidx_start;
+   caddr_t exidx_end;
+};
+
+static int
+module_search(linker_file_t lf, void *context)
+{
+   struct search_context *sc = context;
+   linker_symval_t symval;
+   c_linker_sym_t sym;
+
+   if (lf->address <= (caddr_t)sc->addr &&
+   (lf->address + lf->size) >= (caddr_t)sc->addr) {
+   if ((LINKER_LOOKUP_SYMBOL(lf, "__exidx_start", &sym) == 0 ||
+   LINKER_LOOKUP_SYMBOL(lf, "exidx_start", &sym) == 0) &&
+   LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0)
+   sc->exidx_start = symval.value;
+
+   if ((LINKER_LOOKUP_SYMBOL(lf, "__exidx_end", &sym) == 0 ||
+   LINKER_LOOKUP_SYMBOL(lf, "exidx_end", &sym) == 0) &&
+   LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0)
+   sc->exidx_end = symval.value;
+
+   if (sc->exidx_start != NULL && sc->exidx_end != NULL)
+   return (1);
+   panic("Invalid module %s, no unwind tables\n", lf->filename);
+   }
+   return (0);
+}
+
 /*
  * Perform a binary search of the index table to find the function
  * with the largest address that doesn't exceed addr.
  */
 static struct unwind_idx *
-find_index(uint32_t addr)
+find_index(uint32_t addr, int search_modules)
 {
+   struct search_context sc;
+   caddr_t idx_start, idx_end;
unsigned int min, mid, max;
struct unwind_idx *start;
struct unwind_idx *item;
@@ -118,9 +155,23 @@ find_index(uint32_t addr)
uint32_t func_addr;
 
start = (struct unwind_idx *)&exidx_start;
+   idx_start = (caddr_t)&exidx_start;
+   idx_end = (caddr_t)&exidx_end;
+
+   /* This may acquire a lock */
+   if (search_modules) {
+   bzero(&sc, sizeof(sc));
+   sc.addr = addr;
+   if (linker_file_foreach(module_search, &sc) != 0 &&
+  sc.exidx_start != NULL && sc.exidx_end != NULL) {
+   start = (struct unwind_idx *)sc.exidx_start;
+   idx_start = sc.exidx_start;
+   idx_end = sc.exidx_end;
+   }
+   }
 
min = 0;
-   max = (&exidx_end - &exidx_start) / 2;
+   max = (idx_end - idx_start) / sizeof(struct unwind_idx);
 
while (min != max) {
mid = min + (max - min + 1) / 2;
@@ -332,7 +383,7 @@ unwind_tab(struct unwind_state *state)
 }
 
 int
-unwind_stack_one(struct unwind_state *state)
+unwind_stack_one(struct unwind_state *state, int can_lock)
 {
struct unwind_idx *index;
int finished;
@@ -344,7 +395,7 @@ unwind_stack_one(struct unwind_state *st
state->start_pc = state->registers[PC];
 
/* Find the item to run */
-   index = find_index(state->start_pc);
+   index = find_index(state->start_pc, can_lock);
 
finished = 0;
if (index->insn != EXIDX_CANTUNWIND) {

Modified: head/sys/arm/include/stack.h

svn commit: r278997 - in head/sys: cddl/dev/dtrace/arm conf

2015-02-19 Thread Andrew Turner
Author: andrew
Date: Thu Feb 19 12:20:21 2015
New Revision: 278997
URL: https://svnweb.freebsd.org/changeset/base/278997

Log:
  Use the ARM unwinder with dtrace to extract the stack when asked. With this
  dtrace is able to display a stack trace similar to the one below.
  
  # dtrace -p 603 -n 'tcp:kernel::receive { stack(); }'
0 70 :receive
kernel`ip_input+0x140
kernel`netisr_dispatch_src+0xb8
kernel`ether_demux+0x1c4
kernel`ether_nh_input+0x3a8
kernel`netisr_dispatch_src+0xb8
kernel`ether_input+0x60
kernel`cpsw_intr_rx+0xac
kernel`intr_event_execute_handlers+0x128
kernel`ithread_loop+0xb4
kernel`fork_exit+0x84
kernel`swi_exit
kernel`swi_exit
  
  Tested by:gnn
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/cddl/dev/dtrace/arm/dtrace_isa.c
  head/sys/conf/files.arm

Modified: head/sys/cddl/dev/dtrace/arm/dtrace_isa.c
==
--- head/sys/cddl/dev/dtrace/arm/dtrace_isa.c   Thu Feb 19 12:06:57 2015
(r278996)
+++ head/sys/cddl/dev/dtrace/arm/dtrace_isa.c   Thu Feb 19 12:20:21 2015
(r278997)
@@ -69,9 +69,10 @@ void
 dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
 uint32_t *intrpc)
 {
-   u_int32_t   *frame, *lastframe;
-   int scp_offset;
-   int depth = 0;
+   struct unwind_state state;
+   register_t sp;
+   int scp_offset;
+   int depth = 0;
pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller;
 
if (intrpc != 0)
@@ -79,23 +80,17 @@ dtrace_getpcstack(pc_t *pcstack, int pcs
 
aframes++;
 
-   frame = (u_int32_t *)__builtin_frame_address(0);;
-   lastframe = NULL;
-   scp_offset = -(get_pc_str_offset() >> 2);
-
-   while ((frame != NULL) && (depth < pcstack_limit)) {
-   db_addr_t   scp;
-#if 0 
-   u_int32_t   savecode;
-   int r;
-   u_int32_t   *rp;
-#endif
-
-   /*
-* In theory, the SCP isn't guaranteed to be in the function
-* that generated the stack frame.  We hope for the best.
-*/
-   scp = frame[FR_SCP];
+   __asm __volatile("mov %0, sp" : "=&r" (sp));
+
+   state.registers[FP] = (uint32_t)__builtin_frame_address(0);
+   state.registers[SP] = sp;
+   state.registers[LR] = (uint32_t)__builtin_return_address(0);
+   state.registers[PC] = (uint32_t)dtrace_getpcstack;
+
+   while (depth < pcstack_limit) {
+   int done;
+
+   done = unwind_stack_one(&state, 1);
 
if (aframes > 0) {
aframes--;
@@ -104,39 +99,10 @@ dtrace_getpcstack(pc_t *pcstack, int pcs
}
}
else {
-   pcstack[depth++] = scp;
+   pcstack[depth++] = state.registers[PC];
}
 
-#if 0
-   savecode = ((u_int32_t *)scp)[scp_offset];
-   if ((savecode & 0x0e10) == 0x0800) {
-   /* Looks like an STM */
-   rp = frame - 4;
-   for (r = 10; r >= 0; r--) {
-   if (savecode & (1 << r)) {
-   /* register r == *rp-- */
-   }
-   }
-   }
-#endif
-
-   /*
-* Switch to next frame up
-*/
-   if (frame[FR_RFP] == 0)
-   break; /* Top of stack */
-
-   lastframe = frame;
-   frame = (u_int32_t *)(frame[FR_RFP]);
-
-   if (INKERNEL((int)frame)) {
-   /* staying in kernel */
-   if (frame <= lastframe) {
-   /* bad frame pointer */
-   break;
-   }
-   }
-   else
+   if (done)
break;
}
 
@@ -176,55 +142,28 @@ dtrace_getarg(int arg, int aframes)
 int
 dtrace_getstackdepth(int aframes)
 {
-   u_int32_t   *frame, *lastframe;
-   int scp_offset;
-   int depth = 1;
-
-   frame = (u_int32_t *)__builtin_frame_address(0);;
-   lastframe = NULL;
-   scp_offset = -(get_pc_str_offset() >> 2);
-
-   while (frame != NULL) {
-   db_addr_t   scp;
-#if 0 
-   u_int32_t   savecode;
-   int r;
-   u_int32_t   *rp;
-#endif
-
-   /*
-* In theory, the SCP isn't guaranteed to be in the function
-* that generated the stack frame.  We hope for the best.
- 

svn commit: r278998 - in head/sys: dev/ofw sys

2015-02-19 Thread Andrew Turner
Author: andrew
Date: Thu Feb 19 12:47:48 2015
New Revision: 278998
URL: https://svnweb.freebsd.org/changeset/base/278998

Log:
  Add support to get the cpu ID from its device driver in a generic way.
  This will be needed by arm64 to find the value to pass to the psci (Power
  State Coordination Interface) driver, among other things, used to enable
  cores.
  
  Differential Revision:https://reviews.freebsd.org/D1824
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ofw/ofw_cpu.c
  head/sys/sys/cpu.h

Modified: head/sys/dev/ofw/ofw_cpu.c
==
--- head/sys/dev/ofw/ofw_cpu.c  Thu Feb 19 12:20:21 2015(r278997)
+++ head/sys/dev/ofw/ofw_cpu.c  Thu Feb 19 12:47:48 2015(r278998)
@@ -244,6 +244,7 @@ ofw_cpu_attach(device_t dev)
 static int
 ofw_cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
 {
+   struct ofw_cpulist_softc *psc;
struct ofw_cpu_softc *sc;
 
sc = device_get_softc(dev);
@@ -258,6 +259,16 @@ ofw_cpu_read_ivar(device_t dev, device_t
return (0);
}
break;
+   case CPU_IVAR_CPUID_SIZE:
+   psc = device_get_softc(device_get_parent(dev));
+   *result = psc->sc_addr_cells;
+   return (0);
+   case CPU_IVAR_CPUID:
+   if (sc->sc_reg_valid) {
+   *result = (uintptr_t)sc->sc_reg;
+   return (0);
+   }
+   break;
}
 
return (ENOENT);

Modified: head/sys/sys/cpu.h
==
--- head/sys/sys/cpu.h  Thu Feb 19 12:20:21 2015(r278997)
+++ head/sys/sys/cpu.h  Thu Feb 19 12:47:48 2015(r278998)
@@ -37,6 +37,8 @@
 
 #define CPU_IVAR_PCPU  1
 #define CPU_IVAR_NOMINAL_MHZ   2
+#define CPU_IVAR_CPUID_SIZE3
+#define CPU_IVAR_CPUID 4
 
 static __inline struct pcpu *cpu_get_pcpu(device_t dev)
 {
@@ -54,6 +56,20 @@ static __inline int32_t cpu_get_nominal_
return ((int32_t)v);
 }
 
+static __inline const uint32_t *cpu_get_cpuid(device_t dev, size_t *count)
+{
+   uintptr_t v = 0;
+   if (BUS_READ_IVAR(device_get_parent(dev), dev,
+   CPU_IVAR_CPUID_SIZE, &v) != 0)
+   return (NULL);
+   *count = (size_t)v;
+
+   if (BUS_READ_IVAR(device_get_parent(dev), dev,
+   CPU_IVAR_CPUID, &v) != 0)
+   return (NULL);
+   return ((const uint32_t *)v);
+}
+
 /*
  * CPU frequency control interface.
  */
___
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: r279007 - head/sys/netinet

2015-02-19 Thread Konstantin Belousov
Author: kib
Date: Thu Feb 19 15:41:23 2015
New Revision: 279007
URL: https://svnweb.freebsd.org/changeset/base/279007

Log:
  Fix build with KTR after r278978.

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Thu Feb 19 14:52:01 2015(r279006)
+++ head/sys/netinet/in_mcast.c Thu Feb 19 15:41:23 2015(r279007)
@@ -2978,7 +2978,7 @@ inm_print(const struct in_multi *inm)
inm->inm_timer,
inm_state_str(inm->inm_state),
inm->inm_refcount,
-   inm->inm_scq.ifq_len);
+   inm->inm_scq.mq_len);
printf("igi %p nsrc %lu sctimer %u scrv %u\n",
inm->inm_igi,
inm->inm_nsrc,
___
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: r279012 - head/sys/dev/ofw

2015-02-19 Thread Andrew Turner
Author: andrew
Date: Thu Feb 19 16:34:48 2015
New Revision: 279012
URL: https://svnweb.freebsd.org/changeset/base/279012

Log:
  Adda function to iterate over the cpu nodes in the OFW or FDT data. This
  will be used with arm64 to find which cpus to enable, and could also be
  used with 32-bit arm and mips for the same purpose.
  
  Differential Revision:https://reviews.freebsd.org/D1825
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/ofw/ofw_cpu.h   (contents, props changed)
Modified:
  head/sys/dev/ofw/ofw_cpu.c

Modified: head/sys/dev/ofw/ofw_cpu.c
==
--- head/sys/dev/ofw/ofw_cpu.c  Thu Feb 19 16:25:18 2015(r279011)
+++ head/sys/dev/ofw/ofw_cpu.c  Thu Feb 19 16:34:48 2015(r279012)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 static int ofw_cpulist_probe(device_t);
 static int ofw_cpulist_attach(device_t);
@@ -274,3 +275,50 @@ ofw_cpu_read_ivar(device_t dev, device_t
return (ENOENT);
 }
 
+int
+ofw_cpu_early_foreach(ofw_cpu_foreach_cb callback, boolean_t only_runnable)
+{
+   phandle_t node, child;
+   pcell_t addr_cells, reg[2];
+   char status[16];
+   u_int id;
+   int count, rv;
+
+   count = 0;
+   id = 0;
+
+   node = OF_finddevice("/cpus");
+   if (node == -1)
+   return (-1);
+
+   /* Find the number of cells in the cpu register */
+   if (OF_getencprop(node, "#address-cells", &addr_cells,
+   sizeof(addr_cells)) < 0)
+   return (-1);
+
+   for (child = OF_child(node); child != 0; child = OF_peer(child), id++) {
+   /*
+* If we are filtering by runnable then limit to only
+* those that have been enabled.
+*/
+   if (only_runnable) {
+   status[0] = '\0';
+   OF_getprop(child, "status", status, sizeof(status));
+   if (status[0] != '\0' && strcmp(status, "okay") != 0)
+   continue;
+   }
+
+   /*
+* Check we have a register to identify the cpu
+*/
+   rv = OF_getencprop(child, "reg", reg,
+   addr_cells * sizeof(cell_t));
+   if (rv != addr_cells * sizeof(cell_t))
+   continue;
+
+   if (callback == NULL || callback(id, child, addr_cells, reg))
+   count++;
+   }
+
+   return (only_runnable ? count : id);
+}

Added: head/sys/dev/ofw/ofw_cpu.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/ofw/ofw_cpu.h  Thu Feb 19 16:34:48 2015(r279012)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2015 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Andrew Turner under
+ * sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _DEV_OFW_OFW_CPU_H_
+#define _DEV_OFW_OFW_CPU_H_
+
+typedef boolean_t (*ofw_cpu_foreach_cb)(u_int, phandle_t, u_int, pcell_t *);
+int ofw_cpu_early_foreach(ofw_cpu_foreach_cb, boolean_t);
+
+#endif /* _DEV_OFW_OFW_CPU_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: r279013 - head/sys/conf

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 17:03:13 2015
New Revision: 279013
URL: https://svnweb.freebsd.org/changeset/base/279013

Log:
  Use KTR_COMPILE=(KTR_ALL) for LINTs, to get more code coverage.

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu Feb 19 16:34:48 2015(r279012)
+++ head/sys/conf/NOTES Thu Feb 19 17:03:13 2015(r279013)
@@ -495,7 +495,7 @@ options KTRACE_REQUEST_POOL=101
 optionsKTR
 optionsKTR_BOOT_ENTRIES=1024
 optionsKTR_ENTRIES=(128*1024)
-optionsKTR_COMPILE=(KTR_INTR|KTR_PROC)
+optionsKTR_COMPILE=(KTR_ALL)
 optionsKTR_MASK=KTR_INTR
 optionsKTR_CPUMASK=0x3
 optionsKTR_VERBOSE
___
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"


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Roger Pau Monné
El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
> Author: glebius
> Date: Thu Feb 19 01:19:42 2015
> New Revision: 278977
> URL: https://svnweb.freebsd.org/changeset/base/278977
> 
> Log:
>   Provide a set of inline functions to manage simple mbuf(9) queues, based
>   on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
>   grown implementations.
>   
>   Sponsored by:   Netflix
>   Sponsored by:   Nginx, Inc.

Have you tested this commit on Xen? I'm getting the following:

xn0:  at device/vif/0 on xenbusb_front0
xn0: Ethernet address: 00:16:3e:51:85:e3
xenbusb_back0:  on xenstore0
xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
xn0: backend features: feature-sg feature-gso-tcp4
panic: no mbufs processed
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe007adc3920
vpanic() at vpanic+0x189/frame 0xfe007adc39a0
kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
--- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
KDB: enter: panic
[ thread pid 15 tid 100038 ]
Stopped at  kdb_enter+0x3e: movq$0,kdb_why

Full boot dmesg attached below.

/boot/kernel/kernel text=0x1026770 data=0x12cb20+0x3faf70 
syms=[0x8+0x147270+0x8+0x162fd8]
Booting...
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2015 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #0: Thu Feb 19 19:14:10 CET 2015
root@:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.5.1 (tags/RELEASE_351/final 225668) 20150115
WARNING: WITNESS option enabled, expect reduced performance.
VT: running with driver "vga".
XEN: Hypervisor version 4.6 detected.
CPU: Intel(R) Xeon(R) CPU   W3550  @ 3.07GHz (3066.84-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x106a5  Family=0x6  Model=0x1a  Stepping=5
  
Features=0x1783fbff
  Features2=0x81b82201
  AMD Features=0x20100800
  AMD Features2=0x1
Hypervisor: Origin = "XenVMMXenVMM"
real memory  = 2139095040 (2040 MB)
avail memory = 2031947776 (1937 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table: 
FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs
FreeBSD/SMP: 1 package(s) x 8 core(s)
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  2
 cpu2 (AP): APIC ID:  4
 cpu3 (AP): APIC ID:  6
 cpu4 (AP): APIC ID:  8
 cpu5 (AP): APIC ID: 10
 cpu6 (AP): APIC ID: 12
 cpu7 (AP): APIC ID: 14
ioapic0: Changing APIC ID to 1
MADT: Forcing active-low polarity and level trigger for SCI
ioapic0  irqs 0-47 on motherboard
random: entropy device infrastructure driver
random: selecting highest priority adaptor 
kbd1 at kbdmux0
netmap: loaded module
random: SOFT: yarrow init()
random: selecting highest priority adaptor 
module_register_init: MOD_LOAD (vesa, 0x80dde720, 0) error 19
vtvga0:  on motherboard
xenpv0:  on motherboard
granttable0:  on xenpv0
xen_et0:  on xenpv0
Event timer "XENTIMER" frequency 10 Hz quality 950
Timecounter "XENTIMER" frequency 10 Hz quality 950
xenstore0:  on xenpv0
evtchn0:  on xenpv0
privcmd0:  on xenpv0
isa0:  on xenpv0
acpi0:  on motherboard
acpi0: Power Button (fixed)
acpi0: Sleep Button (fixed)
acpi0: reservation of 0, a (3) failed
cpu0:  on acpi0
cpu1:  on acpi0
cpu2:  on acpi0
cpu3:  on acpi0
cpu4:  on acpi0
cpu5:  on acpi0
cpu6:  on acpi0
cpu7:  on acpi0
hpet0:  iomem 0xfed0-0xfed003ff on acpi0
Timecounter "HPET" frequency 6250 Hz quality 950
attimer0:  port 0x40-0x43 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
atrtc0:  port 0x70-0x71 irq 8 on acpi0
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <32-bit timer at 3.579545MHz> port 0xb008-0xb00b on acpi0
pcib0:  port 0xcf8-0xcff on acpi0
pci0:  on pcib0
isab0:  at device 1.0 on pci0
device_attach: isab0 attach returned 6
atapci0:  port 
0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xc200-0xc20f at device 1.1 on pci0
ata0:  at channel 0 on atapci0
ata1:  at channel 1 on atapci0
pci0:  at device 1.3 (no driver attached)
xenpci0:  port 0xc000-0xc0ff mem 0xf200-0xf2ff irq 
24 at device 2.0 on pci0
vgapci0:  mem 
0xf000-0xf1ff,0xf305-0xf3050fff at device 3.0 on pci0
vgapci0: Boot video device
atkbdc0:  port 0x60,0x64 irq 1 on acpi0
atkbd0:  irq 1 on atkbdc0
kbd

svn commit: r279016 - head/usr.sbin/syslogd

2015-02-19 Thread Ed Schouten
Author: ed
Date: Thu Feb 19 18:56:39 2015
New Revision: 279016
URL: https://svnweb.freebsd.org/changeset/base/279016

Log:
  Make syslogd work in case shutdown() is POSIX-ly correct.
  
  On POSIX conformant systems, shutdown() should return ENOTCONN when not
  connected. We attempted to fix this once (kern/84761), but this change
  got backed out because it 'breaks code' (r150155).
  
  I just reapplied the patch and indeed, syslogd fails on startup. Make it
  easier to re-enable this change in the future by paching up syslogd to
  do the right thing.
  
  MFC after:3 weeks
  Sponsored by: Nuxi

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Thu Feb 19 17:47:42 2015
(r279015)
+++ head/usr.sbin/syslogd/syslogd.c Thu Feb 19 18:56:39 2015
(r279016)
@@ -557,7 +557,8 @@ main(int argc, char *argv[])
if (finet) {
if (SecureMode) {
for (i = 0; i < *finet; i++) {
-   if (shutdown(finet[i+1], SHUT_RD) < 0) {
+   if (shutdown(finet[i+1], SHUT_RD) < 0 &&
+   errno != ENOTCONN) {
logerror("shutdown");
if (!Debug)
die(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: r279017 - head/usr.bin/netstat

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 19:36:54 2015
New Revision: 279017
URL: https://svnweb.freebsd.org/changeset/base/279017

Log:
  Burn bridges to FreeBSD 7.x IGMP stats.

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

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Thu Feb 19 18:56:39 2015(r279016)
+++ head/usr.bin/netstat/inet.c Thu Feb 19 19:36:54 2015(r279017)
@@ -1093,47 +1093,6 @@ icmp_stats(u_long off, const char *name,
}
 }
 
-#ifndef BURN_BRIDGES
-/*
- * Dump IGMP statistics structure (pre 8.x kernel).
- */
-static void
-igmp_stats_live_old(const char *name)
-{
-   struct oigmpstat oigmpstat, zerostat;
-   size_t len = sizeof(oigmpstat);
-
-   if (zflag)
-   memset(&zerostat, 0, len);
-   if (sysctlbyname("net.inet.igmp.stats", &oigmpstat, &len,
-   zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
-   warn("sysctl: net.inet.igmp.stats");
-   return;
-   }
-
-   printf("%s:\n", name);
-
-#definep(f, m) if (oigmpstat.f || sflag <= 1) \
-printf(m, oigmpstat.f, plural(oigmpstat.f))
-#definepy(f, m) if (oigmpstat.f || sflag <= 1) \
-printf(m, oigmpstat.f, oigmpstat.f != 1 ? "ies" : "y")
-   p(igps_rcv_total, "\t%u message%s received\n");
-   p(igps_rcv_tooshort, "\t%u message%s received with too few bytes\n");
-   p(igps_rcv_badsum, "\t%u message%s received with bad checksum\n");
-   py(igps_rcv_queries, "\t%u membership quer%s received\n");
-   py(igps_rcv_badqueries,
-   "\t%u membership quer%s received with invalid field(s)\n");
-   p(igps_rcv_reports, "\t%u membership report%s received\n");
-   p(igps_rcv_badreports,
-   "\t%u membership report%s received with invalid field(s)\n");
-   p(igps_rcv_ourreports,
-"\t%u membership report%s received for groups to which we belong\n");
-p(igps_snd_reports, "\t%u membership report%s sent\n");
-#undef p
-#undef py
-}
-#endif /* !BURN_BRIDGES */
-
 /*
  * Dump IGMP statistics structure.
  */
@@ -1143,27 +1102,6 @@ igmp_stats(u_long off, const char *name,
struct igmpstat igmpstat, zerostat;
size_t len;
 
-#ifndef BURN_BRIDGES
-   if (live) {
-   /*
-* Detect if we are being run against a pre-IGMPv3 kernel.
-* We cannot do this for a core file as the legacy
-* struct igmpstat has no size field, nor does it
-* export it in any readily-available symbols.
-*/
-   len = 0;
-   if (sysctlbyname("net.inet.igmp.stats", NULL, &len, NULL,
-   0) < 0) {
-   warn("sysctl: net.inet.igmp.stats");
-   return;
-   }
-   if (len < sizeof(igmpstat)) {
-   igmp_stats_live_old(name);
-   return;
-   }
-   }
-#endif /* !BURN_BRIDGES */
-
len = sizeof(igmpstat);
if (live) {
if (zflag)
___
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"


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
R> El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
R> > Author: glebius
R> > Date: Thu Feb 19 01:19:42 2015
R> > New Revision: 278977
R> > URL: https://svnweb.freebsd.org/changeset/base/278977
R> > 
R> > Log:
R> >   Provide a set of inline functions to manage simple mbuf(9) queues, based
R> >   on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
R> >   grown implementations.
R> >   
R> >   Sponsored by:Netflix
R> >   Sponsored by:Nginx, Inc.
R> 
R> Have you tested this commit on Xen? I'm getting the following:
R> 
R> xn0:  at device/vif/0 on xenbusb_front0
R> xn0: Ethernet address: 00:16:3e:51:85:e3
R> xenbusb_back0:  on xenstore0
R> xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
R> xn0: backend features: feature-sg feature-gso-tcp4
R> panic: no mbufs processed
R> cpuid = 0
R> KDB: stack backtrace:
R> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
R> vpanic() at vpanic+0x189/frame 0xfe007adc39a0
R> kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
R> network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
R> network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
R> netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
R> xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
R> fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
R> fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
R> --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
R> KDB: enter: panic
R> [ thread pid 15 tid 100038 ]
R> Stopped at  kdb_enter+0x3e: movq$0,kdb_why

Have you got the core? If yes, please do in the network_alloc_rx_buffers() 
frame:

p sc->xn_rx_batch

-- 
Totus tuus, Glebius.
___
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"


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
R> El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
R> > Author: glebius
R> > Date: Thu Feb 19 01:19:42 2015
R> > New Revision: 278977
R> > URL: https://svnweb.freebsd.org/changeset/base/278977
R> > 
R> > Log:
R> >   Provide a set of inline functions to manage simple mbuf(9) queues, based
R> >   on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
R> >   grown implementations.
R> >   
R> >   Sponsored by:Netflix
R> >   Sponsored by:Nginx, Inc.
R> 
R> Have you tested this commit on Xen? I'm getting the following:
R> 
R> xn0:  at device/vif/0 on xenbusb_front0
R> xn0: Ethernet address: 00:16:3e:51:85:e3
R> xenbusb_back0:  on xenstore0
R> xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
R> xn0: backend features: feature-sg feature-gso-tcp4
R> panic: no mbufs processed
R> cpuid = 0
R> KDB: stack backtrace:
R> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
R> vpanic() at vpanic+0x189/frame 0xfe007adc39a0
R> kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
R> network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
R> network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
R> netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
R> xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
R> fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
R> fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
R> --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
R> KDB: enter: panic
R> [ thread pid 15 tid 100038 ]
R> Stopped at  kdb_enter+0x3e: movq$0,kdb_why

I guess the problem is that the queue limit isn't initialized. Please
try the attached patch.

The problem with older mbufq was that it doesn't have any sane limit
on it. So, converting to new, I simply put INT_MAX, which is ugly.

I'd appreciate if you fix mbufq_init()s in netfront.c to some appropriate
values.

-- 
Totus tuus, Glebius.
Index: netfront.c
===
--- netfront.c	(revision 279017)
+++ netfront.c	(working copy)
@@ -2062,6 +2062,9 @@ create_netdev(device_t dev)
 		np->rx_mbufs[i] = NULL;
 		np->grant_rx_ref[i] = GRANT_REF_INVALID;
 	}
+
+	mbufq_init(&np->xn_rx_batch, INT_MAX);
+
 	/* A grant for every tx ring slot */
 	if (gnttab_alloc_grant_references(NET_TX_RING_SIZE,
 	  &np->gref_tx_head) != 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"

Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Navdeep Parhar

On 02/19/15 12:02, Gleb Smirnoff wrote:

On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
R> El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
R> > Author: glebius
R> > Date: Thu Feb 19 01:19:42 2015
R> > New Revision: 278977
R> > URL: https://svnweb.freebsd.org/changeset/base/278977
R> >
R> > Log:
R> >   Provide a set of inline functions to manage simple mbuf(9) queues, based
R> >   on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting home
R> >   grown implementations.
R> >
R> >   Sponsored by:  Netflix
R> >   Sponsored by:  Nginx, Inc.
R>
R> Have you tested this commit on Xen? I'm getting the following:
R>
R> xn0:  at device/vif/0 on xenbusb_front0
R> xn0: Ethernet address: 00:16:3e:51:85:e3
R> xenbusb_back0:  on xenstore0
R> xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited to 8.
R> xn0: backend features: feature-sg feature-gso-tcp4
R> panic: no mbufs processed
R> cpuid = 0
R> KDB: stack backtrace:
R> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
R> vpanic() at vpanic+0x189/frame 0xfe007adc39a0
R> kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
R> network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
R> network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
R> netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
R> xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
R> fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
R> fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
R> --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
R> KDB: enter: panic
R> [ thread pid 15 tid 100038 ]
R> Stopped at  kdb_enter+0x3e: movq$0,kdb_why

I guess the problem is that the queue limit isn't initialized. Please
try the attached patch.

The problem with older mbufq was that it doesn't have any sane limit
on it. So, converting to new, I simply put INT_MAX, which is ugly.


Is mq_len supposed to count the number of mbufs in the mbufq?   Then it 
doesn't work for m_next linked chains.  It pretends to enforce a cap on 
the number of mbufs in the mbufq while doing no such thing.  If it's not 
trying to count the number of mbufs then I'd like to know exactly what 
it does?


Regards,
Navdeep



I'd appreciate if you fix mbufq_init()s in netfront.c to some appropriate
values.




___
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: r279018 - head/share/mk

2015-02-19 Thread Warner Losh
Author: imp
Date: Thu Feb 19 20:22:30 2015
New Revision: 279018
URL: https://svnweb.freebsd.org/changeset/base/279018

Log:
  Only disable gvn on clang 3.5 and newer.

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkThu Feb 19 19:36:54 2015(r279017)
+++ head/share/mk/bsd.sys.mkThu Feb 19 20:22:30 2015(r279018)
@@ -118,7 +118,10 @@ CWARNFLAGS+=   -Wno-unknown-pragmas
 CLANG_NO_IAS=   -no-integrated-as
 .endif
 CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
--mllvm -simplifycfg-dup-ret -mllvm -enable-gvn=false
+-mllvm -simplifycfg-dup-ret -mllvm
+.if ${COMPILER_VERSION} > 30400
+CLANG_OPT_SMALL+= -enable-gvn=false
+.endif
 CFLAGS.clang+=  -Qunused-arguments
 .if ${MACHINE_CPUARCH} == "sparc64"
 # Don't emit .cfi directives, since we must use GNU as on sparc64, for 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"


Re: svn commit: r278977 - in head/sys: dev/cxgb dev/cxgb/sys dev/cxgb/ulp/tom dev/xen/netfront sys

2015-02-19 Thread Gleb Smirnoff
On Thu, Feb 19, 2015 at 12:15:00PM -0800, Navdeep Parhar wrote:
N> On 02/19/15 12:02, Gleb Smirnoff wrote:
N> > On Thu, Feb 19, 2015 at 07:47:18PM +0100, Roger Pau Monné wrote:
N> > R> El 19/02/15 a les 2.19, Gleb Smirnoff ha escrit:
N> > R> > Author: glebius
N> > R> > Date: Thu Feb 19 01:19:42 2015
N> > R> > New Revision: 278977
N> > R> > URL: https://svnweb.freebsd.org/changeset/base/278977
N> > R> >
N> > R> > Log:
N> > R> >   Provide a set of inline functions to manage simple mbuf(9) queues, 
based
N> > R> >   on queue(3)'s STAILQ.  Utilize them in cxgb(4) and Xen, deleting 
home
N> > R> >   grown implementations.
N> > R> >
N> > R> >   Sponsored by:   Netflix
N> > R> >   Sponsored by:   Nginx, Inc.
N> > R>
N> > R> Have you tested this commit on Xen? I'm getting the following:
N> > R>
N> > R> xn0:  at device/vif/0 on xenbusb_front0
N> > R> xn0: Ethernet address: 00:16:3e:51:85:e3
N> > R> xenbusb_back0:  on xenstore0
N> > R> xbd0: Back-end specified ring-pages of 15 is not a power of 2. Limited 
to 8.
N> > R> xn0: backend features: feature-sg feature-gso-tcp4
N> > R> panic: no mbufs processed
N> > R> cpuid = 0
N> > R> KDB: stack backtrace:
N> > R> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe007adc3920
N> > R> vpanic() at vpanic+0x189/frame 0xfe007adc39a0
N> > R> kassert_panic() at kassert_panic+0x132/frame 0xfe007adc3a10
N> > R> network_alloc_rx_buffers() at network_alloc_rx_buffers+0x439/frame 
0xfe007adc3ac0
N> > R> network_connect() at network_connect+0xac1/frame 0xfe007adc3b50
N> > R> netfront_backend_changed() at netfront_backend_changed+0xed/frame 
0xfe007adc3b90
N> > R> xenwatch_thread() at xenwatch_thread+0x1a2/frame 0xfe007adc3bb0
N> > R> fork_exit() at fork_exit+0x84/frame 0xfe007adc3bf0
N> > R> fork_trampoline() at fork_trampoline+0xe/frame 0xfe007adc3bf0
N> > R> --- trap 0, rip = 0, rsp = 0xfe007adc3cb0, rbp = 0 ---
N> > R> KDB: enter: panic
N> > R> [ thread pid 15 tid 100038 ]
N> > R> Stopped at  kdb_enter+0x3e: movq$0,kdb_why
N> >
N> > I guess the problem is that the queue limit isn't initialized. Please
N> > try the attached patch.
N> >
N> > The problem with older mbufq was that it doesn't have any sane limit
N> > on it. So, converting to new, I simply put INT_MAX, which is ugly.
N> 
N> Is mq_len supposed to count the number of mbufs in the mbufq?   Then it 
N> doesn't work for m_next linked chains.  It pretends to enforce a cap on 
N> the number of mbufs in the mbufq while doing no such thing.  If it's not 
N> trying to count the number of mbufs then I'd like to know exactly what 
N> it does?

It counts number of packets. As it did the same in the previous version
of mbufq. And as it did in struct ifqueue.

So, new mbufq doesn't bring any new functionality, it converges what
two copies of mbufq.h and one copy of ifq.h did.

I am not against adding new features to it, if anyone wishes to.

-- 
Totus tuus, Glebius.
___
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: r279024 - head/share/misc

2015-02-19 Thread Bjoern Heidottin
Author: bhd (doc committer)
Date: Thu Feb 19 21:47:31 2015
New Revision: 279024
URL: https://svnweb.freebsd.org/changeset/base/279024

Log:
  Add myself to committers-doc.dot
  
  Approved by:  bcr (mentor)

Modified:
  head/share/misc/committers-doc.dot

Modified: head/share/misc/committers-doc.dot
==
--- head/share/misc/committers-doc.dot  Thu Feb 19 21:10:01 2015
(r279023)
+++ head/share/misc/committers-doc.dot  Thu Feb 19 21:47:31 2015
(r279024)
@@ -53,6 +53,7 @@ node [color=lightblue2, style=filled, bg
 ale [label="Alex Dupre\n...@freebsd.org\n2003/12/22"]
 allanjude [label="Allan Jude\nallanj...@freebsd.org\n2014/05/17"]
 bcr [label="Benedict Reuschling\n...@freebsd.org\n2009/12/24"]
+bhd [label="Björn Heidotting\n...@freebsd.org\n2014/10/14"]
 blackend [label="Marc Fonvieille\nblack...@freebsd.org\n2002/06/16"]
 brd [label="Brad Davis\n...@freebsd.org\n2005/06/01"]
 brueffer [label="Christian Brueffer\nbruef...@freebsd.org\n2003/01/13"]
@@ -102,6 +103,7 @@ bcr -> dru
 bcr -> crees
 bcr -> jgh
 bcr -> allanjude
+bcr -> bhd
 
 blackend -> ale
 
___
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: r279026 - head/sys/netinet

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:35:23 2015
New Revision: 279026
URL: https://svnweb.freebsd.org/changeset/base/279026

Log:
  - Rename 'struct igmp_ifinfo' into 'struct igmp_ifsoftc', since it really
represents a context.
  - Preserve name 'struct igmp_ifinfo' for a new structure, that will be stable
API between userland and kernel.
  - Make sysctl_igmp_ifinfo() return the new 'struct igmp_ifinfo', instead of
old one, which had a bunch of internal kernel structures in it.
  - Move all above declarations from in_var.h to igmp_var.h, since they are
private to IGMP code.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet/igmp_var.h
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Thu Feb 19 22:20:19 2015(r279025)
+++ head/sys/netinet/igmp.c Thu Feb 19 22:35:23 2015(r279026)
@@ -84,15 +84,15 @@ __FBSDID("$FreeBSD$");
 #define KTR_IGMPV3 KTR_INET
 #endif
 
-static struct igmp_ifinfo *
+static struct igmp_ifsoftc *
igi_alloc_locked(struct ifnet *);
 static voidigi_delete_locked(const struct ifnet *);
 static voidigmp_dispatch_queue(struct mbufq *, int, const int);
 static voidigmp_fasttimo_vnet(void);
-static voidigmp_final_leave(struct in_multi *, struct igmp_ifinfo *);
+static voidigmp_final_leave(struct in_multi *, struct igmp_ifsoftc *);
 static int igmp_handle_state_change(struct in_multi *,
-   struct igmp_ifinfo *);
-static int igmp_initial_join(struct in_multi *, struct igmp_ifinfo *);
+   struct igmp_ifsoftc *);
+static int igmp_initial_join(struct in_multi *, struct igmp_ifsoftc *);
 static int igmp_input_v1_query(struct ifnet *, const struct ip *,
const struct igmp *);
 static int igmp_input_v2_query(struct ifnet *, const struct ip *,
@@ -100,7 +100,7 @@ static int  igmp_input_v2_query(struct if
 static int igmp_input_v3_query(struct ifnet *, const struct ip *,
/*const*/ struct igmpv3 *);
 static int igmp_input_v3_group_query(struct in_multi *,
-   struct igmp_ifinfo *, int, /*const*/ struct igmpv3 *);
+   struct igmp_ifsoftc *, int, /*const*/ struct igmpv3 *);
 static int igmp_input_v1_report(struct ifnet *, /*const*/ struct ip *,
/*const*/ struct igmp *);
 static int igmp_input_v2_report(struct ifnet *, /*const*/ struct ip *,
@@ -112,21 +112,21 @@ static struct mbuf *
 #ifdef KTR
 static char *  igmp_rec_type_to_str(const int);
 #endif
-static voidigmp_set_version(struct igmp_ifinfo *, const int);
+static voidigmp_set_version(struct igmp_ifsoftc *, const int);
 static voidigmp_slowtimo_vnet(void);
 static int igmp_v1v2_queue_report(struct in_multi *, const int);
 static voidigmp_v1v2_process_group_timer(struct in_multi *, const int);
-static voidigmp_v1v2_process_querier_timers(struct igmp_ifinfo *);
+static voidigmp_v1v2_process_querier_timers(struct igmp_ifsoftc *);
 static voidigmp_v2_update_group(struct in_multi *, const int);
-static voidigmp_v3_cancel_link_timers(struct igmp_ifinfo *);
-static voidigmp_v3_dispatch_general_query(struct igmp_ifinfo *);
+static voidigmp_v3_cancel_link_timers(struct igmp_ifsoftc *);
+static voidigmp_v3_dispatch_general_query(struct igmp_ifsoftc *);
 static struct mbuf *
igmp_v3_encap_report(struct ifnet *, struct mbuf *);
 static int igmp_v3_enqueue_group_record(struct mbufq *,
struct in_multi *, const int, const int, const int);
 static int igmp_v3_enqueue_filter_change(struct mbufq *,
struct in_multi *);
-static voidigmp_v3_process_group_timers(struct igmp_ifinfo *,
+static voidigmp_v3_process_group_timers(struct igmp_ifsoftc *,
struct mbufq *, struct mbufq *, struct in_multi *,
const int);
 static int igmp_v3_merge_state_changes(struct in_multi *,
@@ -158,13 +158,13 @@ static const struct netisr_handler igmp_
  *  * All output is delegated to the netisr.
  *Now that Giant has been eliminated, the netisr may be inlined.
  *  * IN_MULTI_LOCK covers in_multi.
- *  * IGMP_LOCK covers igmp_ifinfo and any global variables in this file,
+ *  * IGMP_LOCK covers igmp_ifsoftc and any global variables in this file,
  *including the output queue.
  *  * IF_ADDR_LOCK covers if_multiaddrs, which is used for a variety of
  *per-link state iterators.
- *  * igmp_ifinfo is valid as long as PF_INET is attached to the interface,
+ *  * igmp_ifsoftc is valid as long as PF_INET is attached to the interface,
  *therefore it is not refcounted.
- *We allow unlocked reads of igmp_ifinfo when accessed via in_multi.
+ *We allow unlocked reads of igmp_ifsoftc when accessed via in_multi.
  *

svn commit: r279027 - head/sys/netinet6

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:37:01 2015
New Revision: 279027
URL: https://svnweb.freebsd.org/changeset/base/279027

Log:
  - Rename 'struct mld_ifinfo' into 'struct mld_ifsoftc', since it really
represents a context.
  - Preserve name 'struct mld_ifinfo' for a new structure, that will be stable
API between userland and kernel.
  - Make sysctl_mld_ifinfo() return the new 'struct mld_ifinfo', instead of
old one, which had a bunch of internal kernel structures in it.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/mld6.c
  head/sys/netinet6/mld6_var.h

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 22:35:23 2015(r279026)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 22:37:01 2015(r279027)
@@ -97,7 +97,7 @@ struct in6_addrlifetime {
 struct nd_ifinfo;
 struct scope6_id;
 struct lltable;
-struct mld_ifinfo;
+struct mld_ifsoftc;
 
 struct in6_ifextra {
counter_u64_t *in6_ifstat;
@@ -105,7 +105,7 @@ struct in6_ifextra {
struct nd_ifinfo *nd_ifinfo;
struct scope6_id *scope6_id;
struct lltable *lltable;
-   struct mld_ifinfo *mld_ifinfo;
+   struct mld_ifsoftc *mld_ifinfo;
 };
 
 #defineLLTABLE6(ifp)   (((struct in6_ifextra 
*)(ifp)->if_afdata[AF_INET6])->lltable)
@@ -646,7 +646,7 @@ struct in6_multi {
u_int   in6m_timer; /* MLD6 listener report timer */
 
/* New fields for MLDv2 follow. */
-   struct mld_ifinfo   *in6m_mli;  /* MLD info */
+   struct mld_ifsoftc  *in6m_mli;  /* MLD info */
SLIST_ENTRY(in6_multi)   in6m_nrele;/* to-be-released by MLD */
struct ip6_msource_tree  in6m_srcs; /* tree of sources */
u_long   in6m_nsrc; /* # of tree entries */

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cThu Feb 19 22:35:23 2015(r279026)
+++ head/sys/netinet6/mld6.cThu Feb 19 22:37:01 2015(r279027)
@@ -102,33 +102,33 @@ __FBSDID("$FreeBSD$");
 #define KTR_MLD KTR_INET6
 #endif
 
-static struct mld_ifinfo *
+static struct mld_ifsoftc *
mli_alloc_locked(struct ifnet *);
 static voidmli_delete_locked(const struct ifnet *);
 static voidmld_dispatch_packet(struct mbuf *);
 static voidmld_dispatch_queue(struct mbufq *, int);
-static voidmld_final_leave(struct in6_multi *, struct mld_ifinfo *);
+static voidmld_final_leave(struct in6_multi *, struct mld_ifsoftc *);
 static voidmld_fasttimo_vnet(void);
 static int mld_handle_state_change(struct in6_multi *,
-   struct mld_ifinfo *);
-static int mld_initial_join(struct in6_multi *, struct mld_ifinfo *,
+   struct mld_ifsoftc *);
+static int mld_initial_join(struct in6_multi *, struct mld_ifsoftc *,
const int);
 #ifdef KTR
 static char *  mld_rec_type_to_str(const int);
 #endif
-static voidmld_set_version(struct mld_ifinfo *, const int);
+static voidmld_set_version(struct mld_ifsoftc *, const int);
 static voidmld_slowtimo_vnet(void);
 static int mld_v1_input_query(struct ifnet *, const struct ip6_hdr *,
/*const*/ struct mld_hdr *);
 static int mld_v1_input_report(struct ifnet *, const struct ip6_hdr *,
/*const*/ struct mld_hdr *);
-static voidmld_v1_process_group_timer(struct mld_ifinfo *,
+static voidmld_v1_process_group_timer(struct mld_ifsoftc *,
struct in6_multi *);
-static voidmld_v1_process_querier_timers(struct mld_ifinfo *);
+static voidmld_v1_process_querier_timers(struct mld_ifsoftc *);
 static int mld_v1_transmit_report(struct in6_multi *, const int);
 static voidmld_v1_update_group(struct in6_multi *, const int);
-static voidmld_v2_cancel_link_timers(struct mld_ifinfo *);
-static voidmld_v2_dispatch_general_query(struct mld_ifinfo *);
+static voidmld_v2_cancel_link_timers(struct mld_ifsoftc *);
+static voidmld_v2_dispatch_general_query(struct mld_ifsoftc *);
 static struct mbuf *
mld_v2_encap_report(struct ifnet *, struct mbuf *);
 static int mld_v2_enqueue_filter_change(struct mbufq *,
@@ -140,11 +140,11 @@ static intmld_v2_input_query(struct ifn
struct mbuf *, const int, const int);
 static int mld_v2_merge_state_changes(struct in6_multi *,
struct mbufq *);
-static voidmld_v2_process_group_timers(struct mld_ifinfo *,
+static voidmld_v2_process_group_timers(struct mld_ifsoftc *,
struct mbufq *, struct mbufq *,
struct in6_multi *, const int);
 static int mld_v2_process_group_query(struct in6_multi *,
-   struct mld_ifinfo *mli, int, st

svn commit: r279028 - in head/usr.sbin: . ifmcstat

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 22:42:33 2015
New Revision: 279028
URL: https://svnweb.freebsd.org/changeset/base/279028

Log:
  Now that IGMP and MLD sysctls provide a clean API structures that do not
  leak kernel internal stuff, reconnect ifmcstat(1) back to build.  However,
  disable kvm(3) support in it, since it requires uncovering tons of _KERNEL
  defined declarations, which can be achieved either uncovering them globally
  or providing dirty hacks such as _WANT_IFADDR.  If anyone demands an
  ifmcstat-like kvm-based tool, please take the code out of usr.sbin/ifmstat
  and create a tool in src/tools/tools.

Modified:
  head/usr.sbin/Makefile
  head/usr.sbin/ifmcstat/Makefile
  head/usr.sbin/ifmcstat/ifmcstat.c

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Feb 19 22:37:01 2015(r279027)
+++ head/usr.sbin/Makefile  Thu Feb 19 22:42:33 2015(r279028)
@@ -94,8 +94,6 @@ SUBDIR=   adduser \
watchdogd \
zic
 
-SUBDIR:=   ${SUBDIR:Nifmcstat}
-
 # NB: keep these sorted by MK_* knobs
 
 .if ${MK_ACCT} != "no"

Modified: head/usr.sbin/ifmcstat/Makefile
==
--- head/usr.sbin/ifmcstat/Makefile Thu Feb 19 22:37:01 2015
(r279027)
+++ head/usr.sbin/ifmcstat/Makefile Thu Feb 19 22:42:33 2015
(r279028)
@@ -15,9 +15,4 @@ WARNS?=   2
 CFLAGS+=-DINET6
 .endif
 
-.if ${MK_KVM_SUPPORT} != "no"
-CFLAGS+=-DWITH_KVM
-LIBADD=kvm
-.endif
-
 .include 

Modified: head/usr.sbin/ifmcstat/ifmcstat.c
==
--- head/usr.sbin/ifmcstat/ifmcstat.c   Thu Feb 19 22:37:01 2015
(r279027)
+++ head/usr.sbin/ifmcstat/ifmcstat.c   Thu Feb 19 22:42:33 2015
(r279028)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#define_WANT_IFADDR
 #include 
 #include 
 #include 
@@ -52,20 +51,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#define KERNEL
-# include 
-#undef KERNEL
-#define _KERNEL
-#define SYSCTL_DECL(x)
-# include 
-#undef SYSCTL_DECL
-#undef _KERNEL
+#include 
+#include 
 
 #ifdef INET6
 #include 
-#define _KERNEL
-# include 
-#undef _KERNEL
+#include 
 #endif /* INET6 */
 
 #include 
@@ -82,14 +73,23 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-/* XXX: This file currently assumes INET and KVM support in the base system. */
+#ifdef KVM
+/*
+ * Currently the KVM build is broken. To be fixed it requires uncovering
+ * large amount of _KERNEL code in include files, and it is also very
+ * tentative to internal kernel ABI changes. If anyone wishes to restore
+ * it, please move it out of src/usr.sbin to src/tools/tools.
+ */
+#include 
+#include 
+#endif
+
+/* XXX: This file currently assumes INET support in the base system. */
 #ifndef INET
 #define INET
 #endif
___
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: r279029 - head/contrib/ipfilter

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:14:35 2015
New Revision: 279029
URL: https://svnweb.freebsd.org/changeset/base/279029

Log:
  The ipftest(1) is a program that emulates ipf(4) operation and tests packets
  against rules.  It definitely doesn't need to know about kernel internals,
  such as 'struct ifaddr'.  What it does with ifaddr, is that it only takes
  ifa_addr member of it, and treats it as sockaddr, while it is only a pointer
  to sockaddr.  Fortunately, sizeof(struct ifaddr) > sizeof(struct 
sockaddr_in6),
  so no problems arise.
  
  Fix that declaring a private struct ifaddr in ipftest(1) and stop including
  if_var.h.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/contrib/ipfilter/ip_fil.c
  head/contrib/ipfilter/ipf.h

Modified: head/contrib/ipfilter/ip_fil.c
==
--- head/contrib/ipfilter/ip_fil.c  Thu Feb 19 22:42:33 2015
(r279028)
+++ head/contrib/ipfilter/ip_fil.c  Thu Feb 19 23:14:35 2015
(r279029)
@@ -44,6 +44,9 @@ static intwrite_output __P((struct ifne
 # endif
 #endif
 
+struct ifaddr {
+   struct sockaddr_storage ifa_addr;
+};
 
 int
 ipfattach(softc)

Modified: head/contrib/ipfilter/ipf.h
==
--- head/contrib/ipfilter/ipf.h Thu Feb 19 22:42:33 2015(r279028)
+++ head/contrib/ipfilter/ipf.h Thu Feb 19 23:14:35 2015(r279029)
@@ -43,9 +43,6 @@ struct file;
 #include 
 #include 
 
-#define_WANT_IFADDR
-#include 
-
 #include 
 #include 
 #include 
___
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: r279030 - in head/sys: net netinet netinet6

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:16:10 2015
New Revision: 279030
URL: https://svnweb.freebsd.org/changeset/base/279030

Log:
  Now that all users of _WANT_IFADDR are fixed, remove this crutch and
  hide ifaddr, in_ifaddr and in6_ifaddr under _KERNEL.
  
  Sponsored by: Netflix
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/net/if_var.h
  head/sys/netinet/in_var.h
  head/sys/netinet6/in6_var.h

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/net/if_var.h   Thu Feb 19 23:16:10 2015(r279030)
@@ -365,8 +365,6 @@ EVENTHANDLER_DECLARE(group_change_event,
 
 #defineTOEDEV(ifp) ((ifp)->if_llsoftc)
 
-#endif /* _KERNEL */
-
 /*
  * The ifaddr structure contains information about one address
  * of an interface.  They are maintained by the different address families,
@@ -377,7 +375,6 @@ EVENTHANDLER_DECLARE(group_change_event,
  * chunk of malloc'ed memory, where we store the three addresses
  * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here.
  */
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
 struct ifaddr {
struct  sockaddr *ifa_addr; /* address of interface */
struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */
@@ -389,6 +386,8 @@ struct ifaddr {
void(*ifa_rtrequest)/* check or clean routes (+ or -)'d */
(int, struct rtentry *, struct rt_addrinfo *);
u_short ifa_flags;  /* mostly rt_flags for cloning */
+#defineIFA_ROUTE   RTF_UP  /* route installed */
+#defineIFA_RTSELF  RTF_HOST/* loopback route to self 
installed */
u_int   ifa_refcnt; /* references to this structure */
 
counter_u64_t   ifa_ipackets;
@@ -396,11 +395,6 @@ struct ifaddr {
counter_u64_t   ifa_ibytes;
counter_u64_t   ifa_obytes;
 };
-#endif
-
-#ifdef _KERNEL
-#defineIFA_ROUTE   RTF_UP  /* route installed */
-#defineIFA_RTSELF  RTF_HOST/* loopback route to self 
installed */
 
 /* For compatibility with other BSDs. SCTP uses it. */
 #defineifa_listifa_link

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/netinet/in_var.h   Thu Feb 19 23:16:10 2015(r279030)
@@ -50,7 +50,7 @@ struct in_ifinfo {
struct in_multi *ii_allhosts;   /* 224.0.0.1 membership */
 };
 
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
+#ifdef _KERNEL
 /*
  * Interface address, Internet version.  One of these structures
  * is allocated for each Internet address on an interface.
@@ -71,7 +71,7 @@ struct in_ifaddr {
 #defineia_broadaddria_dstaddr
struct  sockaddr_in ia_sockmask; /* reserve space for general netmask */
 };
-#endif
+#endif /* _KERNEL */
 
 struct in_aliasreq {
charifra_name[IFNAMSIZ];/* if name, e.g. "en0" */

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Thu Feb 19 23:14:35 2015(r279029)
+++ head/sys/netinet6/in6_var.h Thu Feb 19 23:16:10 2015(r279030)
@@ -110,7 +110,7 @@ struct in6_ifextra {
 
 #defineLLTABLE6(ifp)   (((struct in6_ifextra 
*)(ifp)->if_afdata[AF_INET6])->lltable)
 
-#if defined(_KERNEL) || defined(_WANT_IFADDR)
+#ifdef _KERNEL
 struct in6_ifaddr {
struct  ifaddr ia_ifa;  /* protocol-independent info */
 #defineia_ifp  ia_ifa.ifa_ifp
@@ -141,7 +141,7 @@ struct  in6_ifaddr {
 /* List of in6_ifaddr's. */
 TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr);
 LIST_HEAD(in6_ifaddrlisthead, in6_ifaddr);
-#endif
+#endif /* _KERNEL */
 
 /* control structure to manage address selection policy */
 struct in6_addrpolicy {
___
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: r279031 - head/sys/netinet

2015-02-19 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb 19 23:59:27 2015
New Revision: 279031
URL: https://svnweb.freebsd.org/changeset/base/279031

Log:
  The last userland piece of in_var.h is now 'struct in_aliasreq'.  Move
  it to the top of the file, and ifdef _KERNEL the rest.

Modified:
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Feb 19 23:16:10 2015(r279030)
+++ head/sys/netinet/in_var.h   Thu Feb 19 23:59:27 2015(r279031)
@@ -33,6 +33,19 @@
 #ifndef _NETINET_IN_VAR_H_
 #define _NETINET_IN_VAR_H_
 
+/*
+ * Argument structure for SIOCAIFADDR.
+ */
+struct in_aliasreq {
+   charifra_name[IFNAMSIZ];/* if name, e.g. "en0" */
+   struct  sockaddr_in ifra_addr;
+   struct  sockaddr_in ifra_broadaddr;
+#define ifra_dstaddr ifra_broadaddr
+   struct  sockaddr_in ifra_mask;
+   int ifra_vhid;
+};
+
+#ifdef _KERNEL
 #include 
 #include 
 #include 
@@ -50,7 +63,6 @@ struct in_ifinfo {
struct in_multi *ii_allhosts;   /* 224.0.0.1 membership */
 };
 
-#ifdef _KERNEL
 /*
  * Interface address, Internet version.  One of these structures
  * is allocated for each Internet address on an interface.
@@ -71,16 +83,7 @@ struct in_ifaddr {
 #defineia_broadaddria_dstaddr
struct  sockaddr_in ia_sockmask; /* reserve space for general netmask */
 };
-#endif /* _KERNEL */
 
-struct in_aliasreq {
-   charifra_name[IFNAMSIZ];/* if name, e.g. "en0" */
-   struct  sockaddr_in ifra_addr;
-   struct  sockaddr_in ifra_broadaddr;
-#define ifra_dstaddr ifra_broadaddr
-   struct  sockaddr_in ifra_mask;
-   int ifra_vhid;
-};
 /*
  * Given a pointer to an in_ifaddr (ifaddr),
  * return a pointer to the addr as a sockaddr_in.
@@ -92,8 +95,6 @@ structin_aliasreq {
 #define IN_LNAOF(in, ifa) \
((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
 
-
-#ifdef _KERNEL
 extern u_char  inetctlerrmap[];
 
 #define LLTABLE(ifp)   \
___
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: r279033 - head/sys/dev/ixl

2015-02-19 Thread Jack F Vogel
Author: jfv
Date: Fri Feb 20 00:40:26 2015
New Revision: 279033
URL: https://svnweb.freebsd.org/changeset/base/279033

Log:
  Bring the XL710 drivers up to the SW3 release level.
  
  MFC after: 1 week

Modified:
  head/sys/dev/ixl/i40e_adminq.c
  head/sys/dev/ixl/i40e_adminq_cmd.h
  head/sys/dev/ixl/i40e_common.c
  head/sys/dev/ixl/i40e_lan_hmc.c
  head/sys/dev/ixl/i40e_prototype.h
  head/sys/dev/ixl/i40e_type.h
  head/sys/dev/ixl/if_ixl.c
  head/sys/dev/ixl/if_ixlv.c
  head/sys/dev/ixl/ixl.h
  head/sys/dev/ixl/ixl_pf.h
  head/sys/dev/ixl/ixl_txrx.c
  head/sys/dev/ixl/ixlvc.c

Modified: head/sys/dev/ixl/i40e_adminq.c
==
--- head/sys/dev/ixl/i40e_adminq.c  Fri Feb 20 00:12:59 2015
(r279032)
+++ head/sys/dev/ixl/i40e_adminq.c  Fri Feb 20 00:40:26 2015
(r279033)
@@ -1,6 +1,6 @@
 /**
 
-  Copyright (c) 2013-2014, Intel Corporation 
+  Copyright (c) 2013-2015, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -614,7 +614,8 @@ enum i40e_status_code i40e_init_adminq(s
goto init_adminq_free_arq;
 
/* get the NVM version info */
-   i40e_read_nvm_word(hw, I40E_SR_NVM_IMAGE_VERSION, &hw->nvm.version);
+   i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION,
+  &hw->nvm.version);
i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_LO, &eetrack_lo);
i40e_read_nvm_word(hw, I40E_SR_NVM_EETRACK_HI, &eetrack_hi);
hw->nvm.eetrack = (eetrack_hi << 16) | eetrack_lo;

Modified: head/sys/dev/ixl/i40e_adminq_cmd.h
==
--- head/sys/dev/ixl/i40e_adminq_cmd.h  Fri Feb 20 00:12:59 2015
(r279032)
+++ head/sys/dev/ixl/i40e_adminq_cmd.h  Fri Feb 20 00:40:26 2015
(r279033)
@@ -1,6 +1,6 @@
 /**
 
-  Copyright (c) 2013-2014, Intel Corporation 
+  Copyright (c) 2013-2015, Intel Corporation 
   All rights reserved.
   
   Redistribution and use in source and binary forms, with or without 
@@ -42,7 +42,7 @@
  */
 
 #define I40E_FW_API_VERSION_MAJOR  0x0001
-#define I40E_FW_API_VERSION_MINOR  0x0002
+#define I40E_FW_API_VERSION_MINOR  0x0004
 
 struct i40e_aq_desc {
__le16 flags;
@@ -140,12 +140,7 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_list_func_capabilities = 0x000A,
i40e_aqc_opc_list_dev_capabilities  = 0x000B,
 
-   i40e_aqc_opc_set_cppm_configuration = 0x0103,
-   i40e_aqc_opc_set_arp_proxy_entry= 0x0104,
-   i40e_aqc_opc_set_ns_proxy_entry = 0x0105,
-
/* LAA */
-   i40e_aqc_opc_mng_laa= 0x0106,   /* AQ obsolete */
i40e_aqc_opc_mac_address_read   = 0x0107,
i40e_aqc_opc_mac_address_write  = 0x0108,
 
@@ -270,7 +265,6 @@ enum i40e_admin_queue_opc {
/* Tunnel commands */
i40e_aqc_opc_add_udp_tunnel = 0x0B00,
i40e_aqc_opc_del_udp_tunnel = 0x0B01,
-   i40e_aqc_opc_tunnel_key_structure   = 0x0B10,
 
/* Async Events */
i40e_aqc_opc_event_lan_overflow = 0x1001,
@@ -282,8 +276,6 @@ enum i40e_admin_queue_opc {
i40e_aqc_opc_oem_ocbb_initialize= 0xFE03,
 
/* debug commands */
-   i40e_aqc_opc_debug_get_deviceid = 0xFF00,
-   i40e_aqc_opc_debug_set_mode = 0xFF01,
i40e_aqc_opc_debug_read_reg = 0xFF03,
i40e_aqc_opc_debug_write_reg= 0xFF04,
i40e_aqc_opc_debug_modify_reg   = 0xFF07,
@@ -517,7 +509,8 @@ struct i40e_aqc_mac_address_read {
 #define I40E_AQC_SAN_ADDR_VALID0x20
 #define I40E_AQC_PORT_ADDR_VALID   0x40
 #define I40E_AQC_WOL_ADDR_VALID0x80
-#define I40E_AQC_ADDR_VALID_MASK   0xf0
+#define I40E_AQC_MC_MAG_EN_VALID   0x100
+#define I40E_AQC_ADDR_VALID_MASK   0x1F0
u8  reserved[6];
__le32  addr_high;
__le32  addr_low;
@@ -540,7 +533,9 @@ struct i40e_aqc_mac_address_write {
 #define I40E_AQC_WRITE_TYPE_LAA_ONLY   0x
 #define I40E_AQC_WRITE_TYPE_LAA_WOL0x4000
 #define I40E_AQC_WRITE_TYPE_PORT   0x8000
-#define I40E_AQC_WRITE_TYPE_MASK   0xc000
+#define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG  0xC000
+#define I40E_AQC_WRITE_TYPE_MASK   0xC000
+
__le16  mac_sah;
__le32  mac_sal;
u8  reserved[8];
@@ -1076,6 +1071,7 @@ struct i40e_aqc_set_vsi_promiscuous_mode
__le16  seid;
 #define I40E_AQC_VSI_PROM_CMD_SEID_MASK0x3FF
__le16  vlan_tag;
+#define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF
 #define I40E_AQC_SET_VSI_VLAN_VALID0x8000
u8  reserved[8];
 };
@@ -2070,6 +2066,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_s

svn commit: r279035 - head/lib/libc/gen

2015-02-19 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 20 01:02:32 2015
New Revision: 279035
URL: https://svnweb.freebsd.org/changeset/base/279035

Log:
  Fix small memleaks in nis_passwd() and nis_group().
  
  These only occur upon error.
  
  Code Review:  https://reviews.freebsd.org/D1849
  Reviewed by:  delphij
  
  CID:  1016715
  CID:  1016717

Modified:
  head/lib/libc/gen/getgrent.c
  head/lib/libc/gen/getpwent.c

Modified: head/lib/libc/gen/getgrent.c
==
--- head/lib/libc/gen/getgrent.cFri Feb 20 00:55:38 2015
(r279034)
+++ head/lib/libc/gen/getgrent.cFri Feb 20 01:02:32 2015
(r279035)
@@ -1173,8 +1173,10 @@ nis_group(void *retval, void *mdata, va_
 * terminator, alignment padding, and one (char *)
 * pointer for the member list terminator.
 */
-   if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *))
+   if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *)) {
+   free(result);
goto erange;
+   }
memcpy(buffer, result, resultlen);
buffer[resultlen] = '\0';
free(result);

Modified: head/lib/libc/gen/getpwent.c
==
--- head/lib/libc/gen/getpwent.cFri Feb 20 00:55:38 2015
(r279034)
+++ head/lib/libc/gen/getpwent.cFri Feb 20 01:02:32 2015
(r279035)
@@ -1392,8 +1392,10 @@ nis_passwd(void *retval, void *mdata, va
continue;
}
}
-   if (resultlen >= bufsize)
+   if (resultlen >= bufsize) {
+   free(result);
goto erange;
+   }
memcpy(buffer, result, resultlen);
buffer[resultlen] = '\0';
free(result);
___
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: r279037 - head/lib/libc/db/man

2015-02-19 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 20 01:31:10 2015
New Revision: 279037
URL: https://svnweb.freebsd.org/changeset/base/279037

Log:
  dbm_delete(3) correct man page to match current behaviour.
  
  "The dbm_store() and dbm_delete() functions shall return 0 when they
  succeed and a negative value when they fail."
  
  Reference:
  http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html
  
  PR:   42422
  Suggested by: delphij
  MFC after:3 days

Modified:
  head/lib/libc/db/man/dbm.3

Modified: head/lib/libc/db/man/dbm.3
==
--- head/lib/libc/db/man/dbm.3  Fri Feb 20 01:03:44 2015(r279036)
+++ head/lib/libc/db/man/dbm.3  Fri Feb 20 01:31:10 2015(r279037)
@@ -15,7 +15,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 16, 2006
+.Dd February 19, 2015
 .Dt DBM 3
 .Os
 .Sh NAME
@@ -174,9 +174,7 @@ deletes the entry for
 The
 .Fn dbm_delete
 function
-normally returns zero but returns 1 if there was no entry with
-.Fa key
-in the database or returns -1 and sets
+normally returns zero or returns -1 and sets
 .Va errno
 if there were any errors.
 .Pp
___
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: r279038 - in head/sys/boot/efi/include: . amd64 i386

2015-02-19 Thread Warner Losh
Author: imp
Date: Fri Feb 20 01:40:55 2015
New Revision: 279038
URL: https://svnweb.freebsd.org/changeset/base/279038

Log:
  Allow EFI and ACPI to be included together. When ACPI is included
  first, EFI will use its definitions for {,U}INT{8,16,32,64} and
  BOOLEAN. When EFI is included first, define ACPI_USE_SYSTEM_INTTYPES
  to tell ACPI that these are already defined.
  
  Differential Revision: https://reviews.freebsd.org/D1905

Modified:
  head/sys/boot/efi/include/amd64/efibind.h
  head/sys/boot/efi/include/efidef.h
  head/sys/boot/efi/include/i386/efibind.h

Modified: head/sys/boot/efi/include/amd64/efibind.h
==
--- head/sys/boot/efi/include/amd64/efibind.h   Fri Feb 20 01:31:10 2015
(r279037)
+++ head/sys/boot/efi/include/amd64/efibind.h   Fri Feb 20 01:40:55 2015
(r279038)
@@ -85,6 +85,9 @@ Revision History
 // Basic EFI types of various widths
 //
 
+#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
+#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
+
 typedef uint64_t   UINT64;
 typedef int64_tINT64;
 
@@ -98,6 +101,7 @@ typedef int16_tINT16;
 typedef uint8_tUINT8;
 typedef int8_t INT8;
 
+#endif
 
 #undef VOID
 #define VOIDvoid

Modified: head/sys/boot/efi/include/efidef.h
==
--- head/sys/boot/efi/include/efidef.h  Fri Feb 20 01:31:10 2015
(r279037)
+++ head/sys/boot/efi/include/efidef.h  Fri Feb 20 01:40:55 2015
(r279038)
@@ -30,7 +30,9 @@ Revision History
 
 typedef UINT16  CHAR16;
 typedef UINT8   CHAR8;
+#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
 typedef UINT8   BOOLEAN;
+#endif
 
 #ifndef TRUE
 #define TRUE((BOOLEAN) 1)

Modified: head/sys/boot/efi/include/i386/efibind.h
==
--- head/sys/boot/efi/include/i386/efibind.hFri Feb 20 01:31:10 2015
(r279037)
+++ head/sys/boot/efi/include/i386/efibind.hFri Feb 20 01:40:55 2015
(r279038)
@@ -85,6 +85,9 @@ Revision History
 // Basic EFI types of various widths
 //
 
+#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine, use those */
+#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */
+
 typedef uint64_t   UINT64;
 typedef int64_tINT64;
 
@@ -98,6 +101,7 @@ typedef int16_tINT16;
 typedef uint8_tUINT8;
 typedef int8_t INT8;
 
+#endif
 
 #undef VOID
 #define VOIDvoid
___
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"


Re: svn commit: r279028 - in head/usr.sbin: . ifmcstat

2015-02-19 Thread Bruce Simpson

Gleb,

Correct me if I'm wrong -- but doesn't this set of changes remove the 
ability for the user to see the stack-wide membership filters on each 
link? The implementation required KVM as it must inspect the SSM filters 
themselves to obtain this information.


On 19/02/2015 22:42, Gleb Smirnoff wrote:

   Now that IGMP and MLD sysctls provide a clean API structures that do not
   leak kernel internal stuff, reconnect ifmcstat(1) back to build.


The change is well motivated, but the job is only half done.

The backend code you have added simply reflects the per-link information 
to userland as a flat data structure; it does not appear to report what 
the membership filters are.


This would require taking a lock, walking the RB-tree for the in-mode 
filters, and serializing the data to userland as a variable length 
structure.


regards
Bruce
___
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: r279043 - head/share/man/man4/man4.powerpc

2015-02-19 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Fri Feb 20 05:40:39 2015
New Revision: 279043
URL: https://svnweb.freebsd.org/changeset/base/279043

Log:
  Add rudimentary man page for llan(4) virtualized ethernet controllers.
  
  MFC after:1 week

Added:
  head/share/man/man4/man4.powerpc/llan.4   (contents, props changed)
Modified:
  head/share/man/man4/man4.powerpc/Makefile

Modified: head/share/man/man4/man4.powerpc/Makefile
==
--- head/share/man/man4/man4.powerpc/Makefile   Fri Feb 20 05:29:22 2015
(r279042)
+++ head/share/man/man4/man4.powerpc/Makefile   Fri Feb 20 05:40:39 2015
(r279043)
@@ -6,6 +6,7 @@ MAN=adb.4 \
ams.4 \
bm.4 \
cuda.4 \
+   llan.4 \
pmu.4 \
powermac_nvram.4 \
smu.4 \

Added: head/share/man/man4/man4.powerpc/llan.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/man4.powerpc/llan.4 Fri Feb 20 05:40:39 2015
(r279043)
@@ -0,0 +1,61 @@
+.\"-
+.\" Copyright (c) 2015 Nathan Whitehorn 
+.\" 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 ``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 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 February 19, 2015
+.Dt LLAN 4
+.Os
+.Sh NAME
+.Nm llan
+.Nd POWER Logical Lan
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device llan"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the inter-partition logical LAN controller
+provided by PAPR-compliant POWER hypervisors (such as PowerVM and PowerKVM).
+On some firmwares, advanced offload features are supported by the hypervisor,
+but these are not currently supported by the driver.
+.Sh SEE ALSO
+.Xr vtnet 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+device driver appeared in
+.Fx 10.0.
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Nathan Whitehorn Aq Mt nwhiteh...@freebsd.org .
___
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: r279045 - head/sys/powerpc/powermac

2015-02-19 Thread Justin Hibbits
Author: jhibbits
Date: Fri Feb 20 06:19:23 2015
New Revision: 279045
URL: https://svnweb.freebsd.org/changeset/base/279045

Log:
  Make the PowerMac fan control nonlinear
  
  Summary:
  Currently, fan control is linear between the target temperature and max
  temperature, which is far from ideal.  This changes it to be proportional to 
the
  distance between the current temperature and the two endpoints (target and max
  temp).  This also adds a hysteresis, so that fans keep going when the
  temperature drops, for about 10 seconds, before slowing down.
  
  Reviewers: nwhitehorn
  
  Reviewed By: nwhitehorn
  
  Differential Revision: https://reviews.freebsd.org/D1549
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/powermac/powermac_thermal.c

Modified: head/sys/powerpc/powermac/powermac_thermal.c
==
--- head/sys/powerpc/powermac/powermac_thermal.cFri Feb 20 06:13:52 
2015(r279044)
+++ head/sys/powerpc/powermac/powermac_thermal.cFri Feb 20 06:19:23 
2015(r279045)
@@ -42,6 +42,9 @@ __FBSDID("$FreeBSD$");
 
 #include "powermac_thermal.h"
 
+/* A 10 second timer for spinning down fans. */
+#define FAN_HYSTERESIS_TIMER   10
+
 static void fan_management_proc(void);
 static void pmac_therm_manage_fans(void);
 
@@ -63,6 +66,7 @@ static MALLOC_DEFINE(M_PMACTHERM, "pmact
 struct pmac_fan_le {
struct pmac_fan *fan;
int last_val;
+   int timer;
SLIST_ENTRY(pmac_fan_le)entries;
 };
 struct pmac_sens_le {
@@ -95,6 +99,7 @@ pmac_therm_manage_fans(void)
struct pmac_sens_le *sensor;
struct pmac_fan_le *fan;
int average_excess, max_excess_zone, frac_excess;
+   int fan_speed;
int nsens, nsens_zone;
int temp;
 
@@ -137,10 +142,11 @@ pmac_therm_manage_fans(void)
nsens = nsens_zone = 0;
average_excess = max_excess_zone = 0;
SLIST_FOREACH(sensor, &sensors, entries) {
-   frac_excess = (sensor->last_val -
+   temp = imin(sensor->last_val,
+   sensor->sensor->max_temp);
+   frac_excess = (temp -
sensor->sensor->target_temp)*100 /
-   (sensor->sensor->max_temp -
-   sensor->sensor->target_temp);
+   (sensor->sensor->max_temp - temp + 1);
if (frac_excess < 0)
frac_excess = 0;
if (sensor->sensor->zone == fan->fan->zone) {
@@ -166,9 +172,21 @@ pmac_therm_manage_fans(void)
 * Scale the fan linearly in the max temperature in its
 * thermal zone.
 */
-   fan->fan->set(fan->fan, max_excess_zone *
+   max_excess_zone = imin(max_excess_zone, 100);
+   fan_speed = max_excess_zone * 
(fan->fan->max_rpm - fan->fan->min_rpm)/100 +
-   fan->fan->min_rpm);
+   fan->fan->min_rpm;
+   if (fan_speed >= fan->last_val) {
+   fan->timer = FAN_HYSTERESIS_TIMER;
+   fan->last_val = fan_speed;
+   } else {
+   fan->timer--;
+   if (fan->timer == 0) {
+   fan->last_val = fan_speed;
+   fan->timer = FAN_HYSTERESIS_TIMER;
+   }
+   }
+   fan->fan->set(fan->fan, fan->last_val);
}
 }
 
___
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: r279046 - head/sys/dev/sfxge

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:53:46 2015
New Revision: 279046
URL: https://svnweb.freebsd.org/changeset/base/279046

Log:
  sfxge: handle fragmented TCP header in mbuf
  
  TCP header is fragmented in the case of VLAN tagged IPv6 traffic without
  HW VLAN tagging.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

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

Modified: head/sys/dev/sfxge/sfxge_tx.c
==
--- head/sys/dev/sfxge/sfxge_tx.c   Fri Feb 20 06:19:23 2015
(r279045)
+++ head/sys/dev/sfxge/sfxge_tx.c   Fri Feb 20 07:53:46 2015
(r279046)
@@ -865,6 +865,8 @@ static void tso_fini(struct sfxge_txq *t
 static void tso_start(struct sfxge_tso_state *tso, struct mbuf *mbuf)
 {
struct ether_header *eh = mtod(mbuf, struct ether_header *);
+   const struct tcphdr *th;
+   struct tcphdr th_copy;
 
tso->mbuf = mbuf;
 
@@ -892,13 +894,24 @@ static void tso_start(struct sfxge_tso_s
tso->tcph_off = tso->nh_off + sizeof(struct ip6_hdr);
}
 
-   tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off;
+   KASSERT(mbuf->m_len >= tso->tcph_off,
+   ("network header is fragmented in mbuf"));
+   /* We need TCP header including flags (window is the next) */
+   if (mbuf->m_len < tso->tcph_off + offsetof(struct tcphdr, th_win)) {
+   m_copydata(tso->mbuf, tso->tcph_off, sizeof(th_copy),
+  (caddr_t)&th_copy);
+   th = &th_copy;
+   } else {
+   th = tso_tcph(tso);
+   }
+
+   tso->header_len = tso->tcph_off + 4 * th->th_off;
tso->seg_size = mbuf->m_pkthdr.tso_segsz;
 
-   tso->seqnum = ntohl(tso_tcph(tso)->th_seq);
+   tso->seqnum = ntohl(th->th_seq);
 
/* These flags must not be duplicated */
-   KASSERT(!(tso_tcph(tso)->th_flags & (TH_URG | TH_SYN | TH_RST)),
+   KASSERT(!(th->th_flags & (TH_URG | TH_SYN | TH_RST)),
("incompatible TCP flag on TSO packet"));
 
tso->out_len = mbuf->m_pkthdr.len - tso->header_len;
___
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: r279047 - head/sys/dev/sfxge/common

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:54:35 2015
New Revision: 279047
URL: https://svnweb.freebsd.org/changeset/base/279047

Log:
  sfxge: regenerate MCDI protocol headers
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx_regs_mcdi.h

Modified: head/sys/dev/sfxge/common/efx_regs_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_regs_mcdi.h   Fri Feb 20 07:53:46 2015
(r279046)
+++ head/sys/dev/sfxge/common/efx_regs_mcdi.h   Fri Feb 20 07:54:35 2015
(r279047)
@@ -40,6 +40,18 @@
 /* The Scheduler has started. */
 #define MC_FW_STATE_SCHED (8)
 
+/* Siena MC shared memmory offsets */
+/* The 'doorbell' addresses are hard-wired to alert the MC when written */
+#defineMC_SMEM_P0_DOORBELL_OFST0x000
+#defineMC_SMEM_P1_DOORBELL_OFST0x004
+/* The rest of these are firmware-defined */
+#defineMC_SMEM_P0_PDU_OFST 0x008
+#defineMC_SMEM_P1_PDU_OFST 0x108
+#defineMC_SMEM_PDU_LEN 0x100
+#defineMC_SMEM_P0_PTP_TIME_OFST0x7f0
+#defineMC_SMEM_P0_STATUS_OFST  0x7f8
+#defineMC_SMEM_P1_STATUS_OFST  0x7fc
+
 /* Values to be written to the per-port status dword in shared
  * memory on reboot and assert */
 #define MC_STATUS_DWORD_REBOOT (0xb007b007)
@@ -58,10 +70,7 @@
 
 /* Unused commands: 0x23, 0x27, 0x30, 0x31 */
 
-/* Unused commands: 0x23, 0x27, 0x30, 0x31 */
-
-/**
- * MCDI version 1
+/* MCDI version 1
  *
  * Each MCDI request starts with an MCDI_HEADER, which is a 32byte
  * structure, filled in by the client.
@@ -113,10 +122,10 @@
 #define MCDI_HEADER_XFLAGS_EVREQ 0x01
 
 /* Maximum number of payload bytes */
-#if MCDI_PCOL_VERSION == 1
-#define MCDI_CTL_SDU_LEN_MAX 0xfc
-#elif  MCDI_PCOL_VERSION == 2
+#ifdef WITH_MCDI_V2
 #define MCDI_CTL_SDU_LEN_MAX 0x400
+#else
+#define MCDI_CTL_SDU_LEN_MAX 0xfc
 #endif
 
 /* The MC can generate events for two reasons:
@@ -133,7 +142,7 @@
  *
  * If Code==CMDDONE, then the fields are further interpreted as:
  *
- *   - LEVEL==INFOCommand succeded
+ *   - LEVEL==INFOCommand succeeded
  *   - LEVEL==ERR Command failed
  *
  *0 8 16  24 32
@@ -293,6 +302,27 @@
 #defineMCDI_EVENT_TX_ERR_INFO_WIDTH 16
 #defineMCDI_EVENT_TX_FLUSH_TXQ_LBN 0
 #defineMCDI_EVENT_TX_FLUSH_TXQ_WIDTH 12
+#defineMCDI_EVENT_PTP_ERR_TYPE_LBN 0
+#defineMCDI_EVENT_PTP_ERR_TYPE_WIDTH 8
+#defineMCDI_EVENT_PTP_ERR_PLL_LOST 0x1 /* enum */
+#defineMCDI_EVENT_PTP_ERR_FILTER 0x2 /* enum */
+#defineMCDI_EVENT_PTP_ERR_FIFO 0x3 /* enum */
+#defineMCDI_EVENT_PTP_ERR_QUEUE 0x4 /* enum */
+#defineMCDI_EVENT_AOE_ERR_TYPE_LBN 0
+#defineMCDI_EVENT_AOE_ERR_TYPE_WIDTH 8
+#defineMCDI_EVENT_AOE_NO_LOAD 0x1 /* enum */
+#defineMCDI_EVENT_AOE_FC_ASSERT 0x2 /* enum */
+#defineMCDI_EVENT_AOE_FC_WATCHDOG 0x3 /* enum */
+#defineMCDI_EVENT_AOE_FC_NO_START 0x4 /* enum */
+#defineMCDI_EVENT_AOE_FAULT 0x5 /* enum */
+#defineMCDI_EVENT_AOE_CPLD_REPROGRAMMED 0x6 /* enum */
+#defineMCDI_EVENT_AOE_LOAD 0x7 /* enum */
+#defineMCDI_EVENT_AOE_DMA 0x8 /* enum */
+#defineMCDI_EVENT_AOE_BYTEBLASTER 0x9 /* enum */
+#defineMCDI_EVENT_AOE_DDR_ECC_STATUS 0xa /* enum */
+#defineMCDI_EVENT_AOE_PTP_STATUS 0xb /* enum */
+#defineMCDI_EVENT_AOE_ERR_DATA_LBN 8
+#defineMCDI_EVENT_AOE_ERR_DATA_WIDTH 8
 #defineMCDI_EVENT_DATA_LBN 0
 #defineMCDI_EVENT_DATA_WIDTH 32
 #defineMCDI_EVENT_SRC_LBN 36
@@ -313,6 +343,12 @@
 #defineMCDI_EVENT_CODE_FLR 0xa /* enum */
 #defineMCDI_EVENT_CODE_TX_ERR 0xb /* enum */
 #defineMCDI_EVENT_CODE_TX_FLUSH  0xc /* enum */
+#defineMCDI_EVENT_CODE_PTP_RX  0xd /* enum */
+#defineMCDI_EVENT_CODE_PTP_FAULT  0xe /* enum */
+#defineMCDI_EVENT_CODE_PTP_PPS  0xf /* enum */
+#defineMCDI_EVENT_CODE_AOE  0x12 /* enum */
+#defineMCDI_EVENT_CODE_VCAL_FAIL  0x13 /* enum */
+#defineMCDI_EVENT_CODE_HW_PPS  0x14 /* enum */
 #defineMCDI_EVENT_CMDDONE_DATA_OFST 0
 #defineMCDI_EVENT_CMDDONE_DATA_LBN 0
 #defineMCDI_EVENT_CMDDONE_DATA_WIDTH 32
@@ -328,6 +364,94 @@
 #defineMCDI_EVENT_TX_ERR_DATA_OFST 0
 #defineMCDI_EVENT_TX_ERR_DATA_LBN 0
 #defineMCDI_EVENT_TX_ERR_DATA_WIDTH 32
+#defineMCDI_EVENT_PTP_SECONDS_OFST 0
+#defineMCDI_EVENT_PTP_SECONDS_LBN 0
+#defineMCDI_EVENT_PTP_SECONDS_WIDTH 32
+#defineMCDI_EVENT_PTP_NANOSECONDS_OFST 0
+#defineMCDI_EVENT_PTP_NANOSECONDS_LBN 0
+#defineMCDI_EVENT_PTP_NANOSECONDS_WIDTH 32
+#defineMCDI_EVENT_PTP_UUID_OFST 0
+#defineMCDI_EVENT_PTP_UUID_LBN 0
+#defineMCDI_EVENT_PTP_UUID_WIDTH 32
+
+/* FCDI_EVE

svn commit: r279048 - head/sys/dev/sfxge/common

2015-02-19 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 20 07:57:59 2015
New Revision: 279048
URL: https://svnweb.freebsd.org/changeset/base/279048

Log:
  sfxge: add Florence R7 turbo mode support to common code
  
  Submitted by:   Andrew Lee 
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_ev.c
  head/sys/dev/sfxge/common/efx_mcdi.h
  head/sys/dev/sfxge/common/siena_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx.h Fri Feb 20 07:57:59 2015
(r279048)
@@ -861,6 +861,7 @@ efx_phy_bist_stop(
 #defineEFX_FEATURE_MCDI0x0020
 #defineEFX_FEATURE_LOOKAHEAD_SPLIT 0x0040
 #defineEFX_FEATURE_MAC_HEADER_FILTERS  0x0080
+#defineEFX_FEATURE_TURBO   0x0100
 
 typedef struct efx_nic_cfg_s {
uint32_tenc_board_type;
@@ -881,6 +882,7 @@ typedef struct efx_nic_cfg_s {
uint32_tenc_rxq_limit;
uint32_tenc_buftbl_limit;
uint32_tenc_evq_moderation_max;
+   uint32_tenc_clk_mult;
 #if EFSYS_OPT_LOOPBACK
uint32_tenc_loopback_types[EFX_LINK_NMODES];
 #endif /* EFSYS_OPT_LOOPBACK */

Modified: head/sys/dev/sfxge/common/efx_ev.c
==
--- head/sys/dev/sfxge/common/efx_ev.c  Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx_ev.c  Fri Feb 20 07:57:59 2015
(r279048)
@@ -844,13 +844,14 @@ efx_ev_qmoderate(
__inunsigned int us)
 {
efx_nic_t *enp = eep->ee_enp;
+   efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
unsigned int locked;
efx_dword_t dword;
int rc;
 
EFSYS_ASSERT3U(eep->ee_magic, ==, EFX_EVQ_MAGIC);
 
-   if (us > enp->en_nic_cfg.enc_evq_moderation_max) {
+   if (us > encp->enc_evq_moderation_max) {
rc = EINVAL;
goto fail1;
}
@@ -869,21 +870,20 @@ efx_ev_qmoderate(
uint32_t timer_val;
 
/* Calculate the timer value in quanta */
-   us -= (us % EFX_EV_TIMER_QUANTUM);
-   if (us < EFX_EV_TIMER_QUANTUM)
-   us = EFX_EV_TIMER_QUANTUM;
-
-   timer_val = us / EFX_EV_TIMER_QUANTUM;
+   timer_val = us * encp->enc_clk_mult / EFX_EV_TIMER_QUANTUM;
 
/* Moderation value is base 0 so we need to deduct 1 */
+   if (timer_val > 0)
+   timer_val--;
+
if (enp->en_family == EFX_FAMILY_FALCON)
EFX_POPULATE_DWORD_2(dword,
FRF_AB_TC_TIMER_MODE, FFE_AB_TIMER_MODE_INT_HLDOFF,
-   FRF_AB_TIMER_VAL, timer_val - 1);
+   FRF_AB_TIMER_VAL, timer_val);
else
EFX_POPULATE_DWORD_2(dword,
FRF_CZ_TC_TIMER_MODE, FFE_CZ_TIMER_MODE_INT_HLDOFF,
-   FRF_CZ_TC_TIMER_VAL, timer_val - 1);
+   FRF_CZ_TC_TIMER_VAL, timer_val);
}
 
locked = (eep->ee_index == 0) ? 1 : 0;

Modified: head/sys/dev/sfxge/common/efx_mcdi.h
==
--- head/sys/dev/sfxge/common/efx_mcdi.hFri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/efx_mcdi.hFri Feb 20 07:57:59 2015
(r279048)
@@ -233,6 +233,9 @@ efx_mcdi_version(
 #defineMCDI_EV_FIELD(_eqp, _field) 
\
EFX_QWORD_FIELD(*_eqp, MCDI_EVENT_ ## _field)
 
+#define MCDI_CMD_DWORD_FIELD(_edp, _field) \
+   EFX_DWORD_FIELD(*_edp, MC_CMD_ ## _field)
+
 #ifdef __cplusplus
 }
 #endif

Modified: head/sys/dev/sfxge/common/siena_nic.c
==
--- head/sys/dev/sfxge/common/siena_nic.c   Fri Feb 20 07:54:35 2015
(r279047)
+++ head/sys/dev/sfxge/common/siena_nic.c   Fri Feb 20 07:57:59 2015
(r279048)
@@ -279,7 +279,8 @@ siena_board_cfg(
uint8_t outbuf[MAX(MC_CMD_GET_BOARD_CFG_OUT_LENMIN,
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)];
efx_mcdi_req_t req;
-   uint8_t *src;
+   uint8_t *mac_addr;
+   efx_dword_t *capabilities;
int rc;
 
/* Board configuration */
@@ -302,17 +303,35 @@ siena_board_cfg(
goto fail2;
}
 
-   if (emip->emi_port == 1)
-   src = MCDI_OUT2(req, uint8_t,
+   if (emip->emi_port == 1) {
+   mac_addr = MCDI_OUT2(req, uint8_t,