svn commit: r295693 - head/sys/arm/arm

2016-02-17 Thread Svatopluk Kraus
Author: skra
Date: Wed Feb 17 12:30:59 2016
New Revision: 295693
URL: https://svnweb.freebsd.org/changeset/base/295693

Log:
  Evaluate also VM_PROT_EXECUTE protection in pmap_preboot_map_attr().
  Before this change all mappings done by this function were executable
  as pte entries have NOT EXECUTABLE bit.
  
  The function is used only for static device mappings at present. Thus
  this is also a fix as DEVICE memory should not be mapped as executable.

Modified:
  head/sys/arm/arm/pmap-v6.c

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Feb 17 11:40:03 2016(r295692)
+++ head/sys/arm/arm/pmap-v6.c  Wed Feb 17 12:30:59 2016(r295693)
@@ -1022,6 +1022,7 @@ pmap_preboot_map_attr(vm_paddr_t pa, vm_
pt2_entry_t *pte2p;
 
l2_prot = prot & VM_PROT_WRITE ? PTE2_AP_KRW : PTE2_AP_KR;
+   l2_prot |= (prot & VM_PROT_EXECUTE) ? PTE2_X : PTE2_NX;
l2_attr = vm_memattr_to_pte2(attr);
l1_prot = ATTR_TO_L1(l2_prot);
l1_attr = ATTR_TO_L1(l2_attr);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295694 - in head/sys: arm/arm arm/at91 arm/cavium/cns11xx arm/freescale/imx arm/include arm/mv arm/mv/orion arm/versatile arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa arm64/include

2016-02-17 Thread Svatopluk Kraus
Author: skra
Date: Wed Feb 17 12:36:24 2016
New Revision: 295694
URL: https://svnweb.freebsd.org/changeset/base/295694

Log:
  Remove pd_prot and pd_cache members from struct arm_devmap_entry.
  The struct is used for definition of static device mappings which
  should always have same protection and attributes.

Modified:
  head/sys/arm/arm/bus_space_generic.c
  head/sys/arm/arm/devmap.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/cavium/cns11xx/econa_machdep.c
  head/sys/arm/freescale/imx/imx6_machdep.c
  head/sys/arm/include/devmap.h
  head/sys/arm/include/pmap-v6.h
  head/sys/arm/mv/mv_localbus.c
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/mv/mv_pci.c
  head/sys/arm/mv/orion/db88f5xxx.c
  head/sys/arm/versatile/versatile_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c
  head/sys/arm64/include/devmap.h

Modified: head/sys/arm/arm/bus_space_generic.c
==
--- head/sys/arm/arm/bus_space_generic.cWed Feb 17 12:30:59 2016
(r295693)
+++ head/sys/arm/arm/bus_space_generic.cWed Feb 17 12:36:24 2016
(r295694)
@@ -71,8 +71,8 @@ generic_bs_map(bus_space_tag_t t, bus_ad
 
/*
 * We don't even examine the passed-in flags.  For ARM, the CACHEABLE
-* flag doesn't make sense (we create PTE_DEVICE mappings), and the
-* LINEAR flag is just implied because we use kva_alloc(size).
+* flag doesn't make sense (we create VM_MEMATTR_DEVICE mappings), and
+* the LINEAR flag is just implied because we use kva_alloc(size).
 */
if ((va = pmap_mapdev(bpa, size)) == NULL)
return (ENOMEM);

Modified: head/sys/arm/arm/devmap.c
==
--- head/sys/arm/arm/devmap.c   Wed Feb 17 12:30:59 2016(r295693)
+++ head/sys/arm/arm/devmap.c   Wed Feb 17 12:36:24 2016(r295694)
@@ -52,7 +52,6 @@ static boolean_t devmap_bootstrap_done =
 
 #if defined(__aarch64__)
 #defineMAX_VADDR   VM_MAX_KERNEL_ADDRESS
-#definePTE_DEVICE  VM_MEMATTR_DEVICE
 #elif defined(__arm__)
 #defineMAX_VADDR   ARM_VECTORS_HIGH
 #endif
@@ -165,8 +164,6 @@ arm_devmap_add_entry(vm_paddr_t pa, vm_s
m->pd_va= akva_devmap_vaddr;
m->pd_pa= pa;
m->pd_size  = sz;
-   m->pd_prot  = VM_PROT_READ | VM_PROT_WRITE;
-   m->pd_cache = PTE_DEVICE;
 }
 
 /*
@@ -209,10 +206,10 @@ arm_devmap_bootstrap(vm_offset_t l1pt, c
 #if defined(__arm__)
 #if __ARM_ARCH >= 6
pmap_preboot_map_attr(pd->pd_pa, pd->pd_va, pd->pd_size,
-   pd->pd_prot, pd->pd_cache);
+   VM_PROT_READ | VM_PROT_WRITE, VM_MEMATTR_DEVICE);
 #else
pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size,
-   pd->pd_prot, pd->pd_cache);
+   VM_PROT_READ | VM_PROT_WRITE, PTE_DEVICE);
 #endif
 #elif defined(__aarch64__)
pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa);
@@ -270,7 +267,8 @@ arm_devmap_vtop(void * vpva, vm_size_t s
  * range, otherwise it allocates kva space and maps the physical pages into it.
  *
  * This routine is intended to be used for mapping device memory, NOT real
- * memory; the mapping type is inherently PTE_DEVICE in pmap_kenter_device().
+ * memory; the mapping type is inherently VM_MEMATTR_DEVICE in
+ * pmap_kenter_device().
  */
 void *
 pmap_mapdev(vm_offset_t pa, vm_size_t size)

Modified: head/sys/arm/at91/at91_machdep.c
==
--- head/sys/arm/at91/at91_machdep.cWed Feb 17 12:30:59 2016
(r295693)
+++ head/sys/arm/at91/at91_machdep.cWed Feb 17 12:36:24 2016
(r295694)
@@ -128,8 +128,6 @@ const struct arm_devmap_entry at91_devma
0xdff0,
0xfff0,
0x0010,
-   VM_PROT_READ|VM_PROT_WRITE,
-   PTE_DEVICE,
},
/* There's a notion that we should do the rest of these lazily. */
/*
@@ -152,16 +150,12 @@ const struct arm_devmap_entry at91_devma
AT91RM92_OHCI_VA_BASE,
AT91RM92_OHCI_BASE,
0x0010,
-   VM_PROT_READ|VM_PROT_WRITE,
-   PTE_DEVICE,
},
{
/* CompactFlash controller. Portion of EBI CS4 1MB */
AT91RM92_CF_VA_BASE,
AT91RM92_CF_BASE,
0x0010,
-   VM_PROT_READ|VM_PROT_WRITE,
-   PTE_DEVICE,
},
/*
 * The next two should be good for the 9260, 9261 and 9G20 since
@@ -172,16 +166,12 @@ const struct arm_devmap_entry at91_devma
AT91SAM9G20_OHCI_VA_BASE,
AT91SAM9G20_OHCI_BASE,
0x0010,
-   VM_PROT_READ|V

svn commit: r295695 - head/sys/arm/include

2016-02-17 Thread Svatopluk Kraus
Author: skra
Date: Wed Feb 17 12:57:05 2016
New Revision: 295695
URL: https://svnweb.freebsd.org/changeset/base/295695

Log:
  Include pte-v6.h only where needed.

Modified:
  head/sys/arm/include/pmap-v6.h
  head/sys/arm/include/pmap_var.h
  head/sys/arm/include/vm.h

Modified: head/sys/arm/include/pmap-v6.h
==
--- head/sys/arm/include/pmap-v6.h  Wed Feb 17 12:36:24 2016
(r295694)
+++ head/sys/arm/include/pmap-v6.h  Wed Feb 17 12:57:05 2016
(r295695)
@@ -222,8 +222,6 @@ void pmap_preboot_map_attr(vm_paddr_t, v
 #endif /* _KERNEL */
 
 // - TO BE DELETED 
-
-#include 
-
 #ifdef _KERNEL
 
 /*

Modified: head/sys/arm/include/pmap_var.h
==
--- head/sys/arm/include/pmap_var.h Wed Feb 17 12:36:24 2016
(r295694)
+++ head/sys/arm/include/pmap_var.h Wed Feb 17 12:57:05 2016
(r295695)
@@ -31,6 +31,7 @@
 #define _MACHINE_PMAP_VAR_H_
 
 #include 
+#include 
 /*
  *  Various PMAP defines, exports, and inline functions
  *  definitions also usable in other MD code.

Modified: head/sys/arm/include/vm.h
==
--- head/sys/arm/include/vm.h   Wed Feb 17 12:36:24 2016(r295694)
+++ head/sys/arm/include/vm.h   Wed Feb 17 12:57:05 2016(r295695)
@@ -32,8 +32,6 @@
 #include 
 
 #if __ARM_ARCH >= 6
-#include 
-
 #define VM_MEMATTR_WB_WA   ((vm_memattr_t)0)
 #define VM_MEMATTR_NOCACHE ((vm_memattr_t)1)
 #define VM_MEMATTR_DEVICE  ((vm_memattr_t)2)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295696 - in head/sys/arm: arm include

2016-02-17 Thread Svatopluk Kraus
Author: skra
Date: Wed Feb 17 13:29:17 2016
New Revision: 295696
URL: https://svnweb.freebsd.org/changeset/base/295696

Log:
  Remove unneeded vector_page_setprot() for __ARM_ARCH >= 6. A vector
  page is always mapped in KVA space and so it's always writeable.

Modified:
  head/sys/arm/arm/fiq.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap-v6.h

Modified: head/sys/arm/arm/fiq.c
==
--- head/sys/arm/arm/fiq.c  Wed Feb 17 12:57:05 2016(r295695)
+++ head/sys/arm/arm/fiq.c  Wed Feb 17 13:29:17 2016(r295696)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -73,13 +74,13 @@ fiq_installhandler(void *func, size_t si
 {
const uint32_t fiqvector = 7 * sizeof(uint32_t);
 
-#if !defined(__ARM_FIQ_INDIRECT)
+#if __ARM_ARCH < 6 && !defined(__ARM_FIQ_INDIRECT)
vector_page_setprot(VM_PROT_READ|VM_PROT_WRITE);
 #endif
 
memcpy((void *)(vector_page + fiqvector), func, size);
 
-#if !defined(__ARM_FIQ_INDIRECT)
+#if __ARM_ARCH < 6 && !defined(__ARM_FIQ_INDIRECT)
vector_page_setprot(VM_PROT_READ);
 #endif
icache_sync((vm_offset_t) fiqvector, size);

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Wed Feb 17 12:57:05 2016(r295695)
+++ head/sys/arm/arm/pmap-v6.c  Wed Feb 17 13:29:17 2016(r295696)
@@ -6314,11 +6314,6 @@ pte1_setrw:
return (KERN_FAILURE);
 }
 
-/*  REMOVE  */
-void vector_page_setprot(int p)
-{
-}
-
 #if defined(PMAP_DEBUG)
 /*
  *  Reusing of KVA used in pmap_zero_page function !!!

Modified: head/sys/arm/include/pmap-v6.h
==
--- head/sys/arm/include/pmap-v6.h  Wed Feb 17 12:57:05 2016
(r295695)
+++ head/sys/arm/include/pmap-v6.h  Wed Feb 17 13:29:17 2016
(r295696)
@@ -243,11 +243,6 @@ void pmap_preboot_map_attr(vm_paddr_t, v
  */
 #definePMAP_DOMAIN_KERNEL  0   /* The kernel uses domain #0 */
 
-/*
- * sys/arm/arm/cpufunc.c
- */
-void vector_page_setprot(int);
-
 #endif /* _KERNEL */
 // 
-
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295697 - head/sys/riscv/riscv

2016-02-17 Thread Ruslan Bukin
Author: br
Date: Wed Feb 17 13:43:43 2016
New Revision: 295697
URL: https://svnweb.freebsd.org/changeset/base/295697

Log:
  Use callee-saved registers to pass args through fork_trampoline().

Modified:
  head/sys/riscv/riscv/swtch.S
  head/sys/riscv/riscv/vm_machdep.c

Modified: head/sys/riscv/riscv/swtch.S
==
--- head/sys/riscv/riscv/swtch.SWed Feb 17 13:29:17 2016
(r295696)
+++ head/sys/riscv/riscv/swtch.SWed Feb 17 13:43:43 2016
(r295697)
@@ -109,14 +109,10 @@ ENTRY(cpu_switch)
/* Save the old context. */
ld  x13, TD_PCB(a0)
 
-   /* Store the callee-saved registers */
+   /* Store ra, sp and the callee-saved registers */
sd  ra, (PCB_RA)(x13)
sd  sp, (PCB_SP)(x13)
 
-   /* We use these in fork_trampoline */
-   sd  t0, (PCB_T + 0 * 8)(x13)
-   sd  t1, (PCB_T + 1 * 8)(x13)
-
/* s[0-11] */
sd  s0, (PCB_S + 0 * 8)(x13)
sd  s1, (PCB_S + 1 * 8)(x13)
@@ -167,10 +163,6 @@ ENTRY(cpu_switch)
ld  ra, (PCB_RA)(x13)
ld  sp, (PCB_SP)(x13)
 
-   /* We use these in fork_trampoline */
-   ld  t0, (PCB_T + 0 * 8)(x13)
-   ld  t1, (PCB_T + 1 * 8)(x13)
-
/* s[0-11] */
ld  s0, (PCB_S + 0 * 8)(x13)
ld  s1, (PCB_S + 1 * 8)(x13)
@@ -195,8 +187,8 @@ END(cpu_switch)
  */
 
 ENTRY(fork_trampoline)
-   mv  a0, x5
-   mv  a1, x6
+   mv  a0, s0
+   mv  a1, s1
mv  a2, sp
call_C_LABEL(fork_exit)
 

Modified: head/sys/riscv/riscv/vm_machdep.c
==
--- head/sys/riscv/riscv/vm_machdep.c   Wed Feb 17 13:29:17 2016
(r295696)
+++ head/sys/riscv/riscv/vm_machdep.c   Wed Feb 17 13:43:43 2016
(r295697)
@@ -97,8 +97,8 @@ cpu_fork(struct thread *td1, struct proc
td2->td_frame = tf;
 
/* Set the return value registers for fork() */
-   td2->td_pcb->pcb_t[0] = (uintptr_t)fork_return;
-   td2->td_pcb->pcb_t[1] = (uintptr_t)td2;
+   td2->td_pcb->pcb_s[0] = (uintptr_t)fork_return;
+   td2->td_pcb->pcb_s[1] = (uintptr_t)td2;
td2->td_pcb->pcb_ra = (uintptr_t)fork_trampoline;
td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
 
@@ -165,8 +165,8 @@ cpu_set_upcall(struct thread *td, struct
bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
 
-   td->td_pcb->pcb_t[0] = (uintptr_t)fork_return;
-   td->td_pcb->pcb_t[1] = (uintptr_t)td;
+   td->td_pcb->pcb_s[0] = (uintptr_t)fork_return;
+   td->td_pcb->pcb_s[1] = (uintptr_t)td;
td->td_pcb->pcb_ra = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
 
@@ -240,8 +240,8 @@ void
 cpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg)
 {
 
-   td->td_pcb->pcb_t[0] = (uintptr_t)func;
-   td->td_pcb->pcb_t[1] = (uintptr_t)arg;
+   td->td_pcb->pcb_s[0] = (uintptr_t)func;
+   td->td_pcb->pcb_s[1] = (uintptr_t)arg;
td->td_pcb->pcb_ra = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295698 - head/sys/riscv/riscv

2016-02-17 Thread Ruslan Bukin
Author: br
Date: Wed Feb 17 13:49:38 2016
New Revision: 295698
URL: https://svnweb.freebsd.org/changeset/base/295698

Log:
  Add the implementation of savectx().

Modified:
  head/sys/riscv/riscv/swtch.S

Modified: head/sys/riscv/riscv/swtch.S
==
--- head/sys/riscv/riscv/swtch.SWed Feb 17 13:43:43 2016
(r295697)
+++ head/sys/riscv/riscv/swtch.SWed Feb 17 13:49:38 2016
(r295698)
@@ -256,8 +256,27 @@ ENTRY(fork_trampoline)
 END(fork_trampoline)
 
 ENTRY(savectx)
-   la  a0, .Lsavectx_panic_str
-   callpanic
-.Lsavectx_panic_str:
-   .asciz "savectx_panic: %p\0"
+   /* Store ra, sp and the callee-saved registers */
+   sd  ra, (PCB_RA)(a0)
+   sd  sp, (PCB_SP)(a0)
+
+   /* s[0-11] */
+   sd  s0, (PCB_S + 0 * 8)(a0)
+   sd  s1, (PCB_S + 1 * 8)(a0)
+   sd  s2, (PCB_S + 2 * 8)(a0)
+   sd  s3, (PCB_S + 3 * 8)(a0)
+   sd  s4, (PCB_S + 4 * 8)(a0)
+   sd  s5, (PCB_S + 5 * 8)(a0)
+   sd  s6, (PCB_S + 6 * 8)(a0)
+   sd  s7, (PCB_S + 7 * 8)(a0)
+   sd  s8, (PCB_S + 8 * 8)(a0)
+   sd  s9, (PCB_S + 9 * 8)(a0)
+   sd  s10, (PCB_S + 10 * 8)(a0)
+   sd  s11, (PCB_S + 11 * 8)(a0)
+
+   /* Store the VFP registers */
+#ifdef VFP
+   /* TODO */
+#endif
+   ret
 END(savectx)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295699 - head/sys/riscv/riscv

2016-02-17 Thread Ruslan Bukin
Author: br
Date: Wed Feb 17 14:13:25 2016
New Revision: 295699
URL: https://svnweb.freebsd.org/changeset/base/295699

Log:
  There is no need to pre save tp in cpu_fork().
  
  Discussed with: jhb

Modified:
  head/sys/riscv/riscv/vm_machdep.c

Modified: head/sys/riscv/riscv/vm_machdep.c
==
--- head/sys/riscv/riscv/vm_machdep.c   Wed Feb 17 13:49:38 2016
(r295698)
+++ head/sys/riscv/riscv/vm_machdep.c   Wed Feb 17 14:13:25 2016
(r295699)
@@ -64,16 +64,10 @@ cpu_fork(struct thread *td1, struct proc
 {
struct pcb *pcb2;
struct trapframe *tf;
-   uint64_t val;
 
if ((flags & RFPROC) == 0)
return;
 
-   if (td1 == curthread) {
-   __asm __volatile("mv%0, tp" : "=&r"(val));
-   td1->td_pcb->pcb_tp = val;
-   }
-
pcb2 = (struct pcb *)(td2->td_kstack +
td2->td_kstack_pages * PAGE_SIZE) - 1;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295700 - head/sys/riscv/include

2016-02-17 Thread Ruslan Bukin
Author: br
Date: Wed Feb 17 14:24:25 2016
New Revision: 295700
URL: https://svnweb.freebsd.org/changeset/base/295700

Log:
  Use better form representing 32 x 128-bit floating-point registers.
  
  Suggested by: kib

Modified:
  head/sys/riscv/include/ucontext.h

Modified: head/sys/riscv/include/ucontext.h
==
--- head/sys/riscv/include/ucontext.h   Wed Feb 17 14:13:25 2016
(r295699)
+++ head/sys/riscv/include/ucontext.h   Wed Feb 17 14:24:25 2016
(r295700)
@@ -50,7 +50,7 @@ struct gpregs {
 };
 
 struct fpregs {
-   __uint64_t  fp_x[64] __aligned(16);
+   __uint64_t  fp_x[32][2];
__uint64_t  fp_fcsr;
int fp_flags;
int pad;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295701 - head/sys/riscv/include

2016-02-17 Thread Ruslan Bukin
Author: br
Date: Wed Feb 17 14:32:03 2016
New Revision: 295701
URL: https://svnweb.freebsd.org/changeset/base/295701

Log:
  Add the implementation of atomic_swap_32().

Modified:
  head/sys/riscv/include/atomic.h

Modified: head/sys/riscv/include/atomic.h
==
--- head/sys/riscv/include/atomic.h Wed Feb 17 14:24:25 2016
(r295700)
+++ head/sys/riscv/include/atomic.h Wed Feb 17 14:32:03 2016
(r295701)
@@ -310,6 +310,19 @@ atomic_readandclear_64(volatile uint64_t
return (ret);
 }
 
+static __inline uint32_t
+atomic_swap_32(volatile uint32_t *p, uint32_t val)
+{
+   uint32_t old;
+
+   __asm __volatile("amoswap.w %0, %2, %1"
+   : "=&r"(old), "+A" (*p)
+   : "r" (val)
+   : "memory");
+
+   return (old);
+}
+
 static __inline uint64_t
 atomic_swap_64(volatile uint64_t *p, uint64_t val)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295702 - head/gnu/usr.bin/rcs/doc

2016-02-17 Thread Ed Maste
Author: emaste
Date: Wed Feb 17 14:34:01 2016
New Revision: 295702
URL: https://svnweb.freebsd.org/changeset/base/295702

Log:
  Hardcode date in RCS paper for reproducibility
  
  The 1995/06/01 date is taken from the $Id$ entry in rcs.ms from RCS 5.7,
  the last version we imported, and is more meaningful than the OS build
  date.
  
  Reviewed by:  eadler
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5299

Modified:
  head/gnu/usr.bin/rcs/doc/rcs.ms

Modified: head/gnu/usr.bin/rcs/doc/rcs.ms
==
--- head/gnu/usr.bin/rcs/doc/rcs.ms Wed Feb 17 14:32:03 2016
(r295701)
+++ head/gnu/usr.bin/rcs/doc/rcs.ms Wed Feb 17 14:34:01 2016
(r295702)
@@ -16,7 +16,7 @@
 .R
 ..
 .de Id
-.ND \\$4
+.ND 1 June 1995
 ..
 .Id $FreeBSD$
 .RP
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295703 - in head/sys/arm: arm include

2016-02-17 Thread Svatopluk Kraus
Author: skra
Date: Wed Feb 17 14:39:29 2016
New Revision: 295703
URL: https://svnweb.freebsd.org/changeset/base/295703

Log:
  Do not use PMAP_DOMAIN_KERNEL definition for __ARM_ARCH >= 6 as domains
  are not utilized there. Only domain #0 is used and there is no reference
  to it in the whole pmap-v6.c. Thus initialize domain access register in
  locore-v6.c without reference too.

Modified:
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/locore-v6.S
  head/sys/arm/include/pmap-v6.h

Modified: head/sys/arm/arm/genassym.c
==
--- head/sys/arm/arm/genassym.c Wed Feb 17 14:34:01 2016(r295702)
+++ head/sys/arm/arm/genassym.c Wed Feb 17 14:39:29 2016(r295703)
@@ -129,7 +129,9 @@ ASSYM(PC_CURPMAP, offsetof(struct pcpu, 
 #endif
 
 ASSYM(PAGE_SIZE, PAGE_SIZE);
+#if __ARM_ARCH < 6
 ASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL);
+#endif
 #ifdef PMAP_INCLUDE_PTE_SYNC
 ASSYM(PMAP_INCLUDE_PTE_SYNC, 1);
 #endif

Modified: head/sys/arm/arm/locore-v6.S
==
--- head/sys/arm/arm/locore-v6.SWed Feb 17 14:34:01 2016
(r295702)
+++ head/sys/arm/arm/locore-v6.SWed Feb 17 14:39:29 2016
(r295703)
@@ -280,7 +280,7 @@ ASENTRY_NP(init_mmu)
mcr CP15_CONTEXTIDR(r0) /* Set ASID to 0 */
 
/* Set the Domain Access register */
-   mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
+   mov r0, #DOMAIN_CLIENT  /* Only domain #0 is used */
mcr CP15_DACR(r0)
 
/*

Modified: head/sys/arm/include/pmap-v6.h
==
--- head/sys/arm/include/pmap-v6.h  Wed Feb 17 14:34:01 2016
(r295702)
+++ head/sys/arm/include/pmap-v6.h  Wed Feb 17 14:39:29 2016
(r295703)
@@ -220,30 +220,4 @@ void pmap_preboot_map_attr(vm_paddr_t, v
 vm_memattr_t);
 
 #endif /* _KERNEL */
-
-// - TO BE DELETED 
-
-#ifdef _KERNEL
-
-/*
- * sys/arm/arm/elf_trampoline.c
- * sys/arm/arm/genassym.c
- * sys/arm/arm/machdep.c
- * sys/arm/arm/mp_machdep.c
- * sys/arm/arm/locore.S
- * sys/arm/arm/pmap.c
- * sys/arm/arm/swtch.S
- * sys/arm/at91/at91_machdep.c
- * sys/arm/cavium/cns11xx/econa_machdep.c
- * sys/arm/s3c2xx0/s3c24x0_machdep.c
- * sys/arm/xscale/ixp425/avila_machdep.c
- * sys/arm/xscale/i8134x/crb_machdep.c
- * sys/arm/xscale/i80321/ep80219_machdep.c
- * sys/arm/xscale/i80321/iq31244_machdep.c
- * sys/arm/xscale/pxa/pxa_machdep.c
- */
-#definePMAP_DOMAIN_KERNEL  0   /* The kernel uses domain #0 */
-
-#endif /* _KERNEL */
-// 
-
-
 #endif /* !_MACHINE_PMAP_H_ */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295707 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/mmc dev/virtio/block geom geom/journal geom/mirror geom/raid geom/raid3 kern

2016-02-17 Thread Warner Losh
Author: imp
Date: Wed Feb 17 17:16:02 2016
New Revision: 295707
URL: https://svnweb.freebsd.org/changeset/base/295707

Log:
  Create an API to reset a struct bio (g_reset_bio). This is mandatory
  for all struct bio you get back from g_{new,alloc}_bio. Temporary
  bios that you create on the stack or elsewhere should use this before
  first use of the bio, and between uses of the bio. At the moment, it
  is nothing more than a wrapper around bzero, but that may change in
  the future. The wrapper also removes one place where we encode the
  size of struct bio in the KBI.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  head/sys/dev/mmc/mmcsd.c
  head/sys/dev/virtio/block/virtio_blk.c
  head/sys/geom/geom.h
  head/sys/geom/geom_io.c
  head/sys/geom/journal/g_journal.c
  head/sys/geom/mirror/g_mirror.c
  head/sys/geom/raid/g_raid.c
  head/sys/geom/raid3/g_raid3.c
  head/sys/kern/kern_physio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Feb 
17 16:13:22 2016(r295706)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Feb 
17 17:16:02 2016(r295707)
@@ -314,7 +314,7 @@ vdev_geom_io(struct g_consumer *cp, int 
error = 0;
 
for (; off < offset; off += maxio, p += maxio, size -= maxio) {
-   bzero(bp, sizeof(*bp));
+   g_reset_bio(bp);
bp->bio_cmd = cmd;
bp->bio_done = NULL;
bp->bio_offset = off;

Modified: head/sys/dev/mmc/mmcsd.c
==
--- head/sys/dev/mmc/mmcsd.cWed Feb 17 16:13:22 2016(r295706)
+++ head/sys/dev/mmc/mmcsd.cWed Feb 17 17:16:02 2016(r295707)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -487,7 +488,7 @@ mmcsd_dump(void *arg, void *virtual, vm_
if (!length)
return (0);
 
-   bzero(&bp, sizeof(struct bio));
+   g_reset_bio(&bp);
bp.bio_disk = disk;
bp.bio_pblkno = offset / disk->d_sectorsize;
bp.bio_bcount = length;

Modified: head/sys/dev/virtio/block/virtio_blk.c
==
--- head/sys/dev/virtio/block/virtio_blk.c  Wed Feb 17 16:13:22 2016
(r295706)
+++ head/sys/dev/virtio/block/virtio_blk.c  Wed Feb 17 17:16:02 2016
(r295707)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -1146,7 +1147,7 @@ vtblk_ident(struct vtblk_softc *sc)
req->vbr_hdr.sector = 0;
 
req->vbr_bp = &buf;
-   bzero(&buf, sizeof(struct bio));
+   g_reset_bio(&buf);
 
buf.bio_cmd = BIO_READ;
buf.bio_data = dp->d_ident;
@@ -1278,7 +1279,7 @@ vtblk_dump_write(struct vtblk_softc *sc,
req->vbr_hdr.sector = offset / 512;
 
req->vbr_bp = &buf;
-   bzero(&buf, sizeof(struct bio));
+   g_reset_bio(&buf);
 
buf.bio_cmd = BIO_WRITE;
buf.bio_data = virtual;
@@ -1300,7 +1301,7 @@ vtblk_dump_flush(struct vtblk_softc *sc)
req->vbr_hdr.sector = 0;
 
req->vbr_bp = &buf;
-   bzero(&buf, sizeof(struct bio));
+   g_reset_bio(&buf);
 
buf.bio_cmd = BIO_FLUSH;
 

Modified: head/sys/geom/geom.h
==
--- head/sys/geom/geom.hWed Feb 17 16:13:22 2016(r295706)
+++ head/sys/geom/geom.hWed Feb 17 17:16:02 2016(r295707)
@@ -324,6 +324,7 @@ void g_unregister_classifier(struct g_cl
 void g_io_request(struct bio *bp, struct g_consumer *cp);
 struct bio *g_new_bio(void);
 struct bio *g_alloc_bio(void);
+void g_reset_bio(struct bio *);
 void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int 
*error);
 int g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length);
 int g_delete_data(struct g_consumer *cp, off_t offset, off_t length);

Modified: head/sys/geom/geom_io.c
==
--- head/sys/geom/geom_io.c Wed Feb 17 16:13:22 2016(r295706)
+++ head/sys/geom/geom_io.c Wed Feb 17 17:16:02 2016(r295707)
@@ -265,6 +265,13 @@ g_duplicate_bio(struct bio *bp)
 }
 
 void
+g_reset_bio(struct bio *bp)
+{
+
+   bzero(bp, sizeof(bp));
+}
+
+void
 g_io_init()
 {
 

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Wed Feb 17 16:13:22 2016
(r295706)
+++ head/sys/geom/journal/g_journal.c   Wed Feb 17 17:16:02 2016
(r295707)
@@ -1296,7 +1296,7 @@ g_journal_flush(struct g_journal_softc *
data = b

svn commit: r295708 - head/sys/netinet

2016-02-17 Thread Michael Tuexen
Author: tuexen
Date: Wed Feb 17 17:52:46 2016
New Revision: 295708
URL: https://svnweb.freebsd.org/changeset/base/295708

Log:
  Address a warning reported by D5245 / PVS.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Feb 17 17:16:02 2016
(r295707)
+++ head/sys/netinet/sctp_output.c  Wed Feb 17 17:52:46 2016
(r295708)
@@ -10613,7 +10613,7 @@ sctp_send_sack(struct sctp_tcb *stcb, in
 * Clear all bits corresponding to TSNs
 * smaller or equal to the cumulative TSN.
 */
-   tsn_map &= (~0 << (1 - offset));
+   tsn_map &= (~0U << (1 - offset));
}
selector = &sack_array[tsn_map];
if (mergeable && selector->right_edge) {
@@ -10688,7 +10688,7 @@ sctp_send_sack(struct sctp_tcb *stcb, in
 * TSNs smaller or equal to the
 * cumulative TSN.
 */
-   tsn_map &= (~0 << (1 - offset));
+   tsn_map &= (~0U << (1 - offset));
}
selector = &sack_array[tsn_map];
if (mergeable && selector->right_edge) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295709 - head/sys/netinet

2016-02-17 Thread Michael Tuexen
Author: tuexen
Date: Wed Feb 17 18:04:22 2016
New Revision: 295709
URL: https://svnweb.freebsd.org/changeset/base/295709

Log:
  Code cleanup which will silence a warning in PVS / D5245.

Modified:
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_timer.h

Modified: head/sys/netinet/sctp_timer.c
==
--- head/sys/netinet/sctp_timer.c   Wed Feb 17 17:52:46 2016
(r295708)
+++ head/sys/netinet/sctp_timer.c   Wed Feb 17 18:04:22 2016
(r295709)
@@ -85,7 +85,7 @@ sctp_audit_retranmission_queue(struct sc
asoc->sent_queue_cnt);
 }
 
-int
+static int
 sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
 struct sctp_nets *net, uint16_t threshold)
 {
@@ -111,9 +111,9 @@ sctp_threshold_management(struct sctp_in
net->last_active = sctp_get_tick_count();
sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED);
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT,
-   stcb->sctp_ep, stcb, net,
+   inp, stcb, net,
SCTP_FROM_SCTP_TIMER + SCTP_LOC_1);
-   sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, 
stcb->sctp_ep, stcb, net);
+   sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, 
inp, stcb, net);
}
}
}

Modified: head/sys/netinet/sctp_timer.h
==
--- head/sys/netinet/sctp_timer.h   Wed Feb 17 17:52:46 2016
(r295708)
+++ head/sys/netinet/sctp_timer.h   Wed Feb 17 18:04:22 2016
(r295709)
@@ -46,10 +46,6 @@ sctp_find_alternate_net(struct sctp_tcb 
 struct sctp_nets *, int mode);
 
 int
-sctp_threshold_management(struct sctp_inpcb *, struct sctp_tcb *,
-struct sctp_nets *, uint16_t);
-
-int
 sctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *,
 struct sctp_nets *);
 int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295710 - head/sys/netinet

2016-02-17 Thread Michael Tuexen
Author: tuexen
Date: Wed Feb 17 18:12:38 2016
New Revision: 295710
URL: https://svnweb.freebsd.org/changeset/base/295710

Log:
  Add protection code for issues reported by PVS / D5245.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Wed Feb 17 18:04:22 2016
(r295709)
+++ head/sys/netinet/sctp_input.c   Wed Feb 17 18:12:38 2016
(r295710)
@@ -909,7 +909,9 @@ sctp_handle_shutdown(struct sctp_shutdow
return;
}
 #endif
-   sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
+   if (stcb->sctp_socket) {
+   sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
+   }
 #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_SOCKET_UNLOCK(so, 1);
 #endif
@@ -4858,7 +4860,7 @@ process_control_chunks:
if ((stcb) && 
(stcb->asoc.total_output_queue_size)) {
;
} else {
-   if (locked_tcb != stcb) {
+   if ((locked_tcb != NULL) && (locked_tcb 
!= stcb)) {
/* Very unlikely */
SCTP_TCB_UNLOCK(locked_tcb);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295711 - in head/sys: arm/allwinner arm/allwinner/a20 arm/conf boot/fdt/dts/arm conf

2016-02-17 Thread Andrew Turner
Author: andrew
Date: Wed Feb 17 18:28:03 2016
New Revision: 295711
URL: https://svnweb.freebsd.org/changeset/base/295711

Log:
  Move the Allwinner kernels to use fdt_pinctrl. This will read the pin
  configuration from the FDT data, then set the pins into the requested
  state. As part of this the gpio controller now reports the correct number
  of pins instead of returning the number of bank * 32.
  
  To allow for a future consolidated kernel we add the SOC_ALLWINNER_A10 and
  SOC_ALLWINNER_A20 kernel options. These need to be set as appropriate for
  the SoC the kernel will boot on.
  
  Submitted by: Emmanuel Vadot 
  Differential Revision:https://reviews.freebsd.org/D5177

Added:
  head/sys/arm/allwinner/a10_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/a20/a20_padconf.c   (contents, props changed)
  head/sys/arm/allwinner/allwinner_pinctrl.h   (contents, props changed)
Modified:
  head/sys/arm/allwinner/a10_ahci.c
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/allwinner/a20/a20_if_dwc.c
  head/sys/arm/allwinner/a20/files.a20
  head/sys/arm/allwinner/files.a10
  head/sys/arm/allwinner/if_emac.c
  head/sys/arm/conf/A10
  head/sys/arm/conf/A20
  head/sys/arm/conf/CUBIEBOARD
  head/sys/boot/fdt/dts/arm/bananapi.dts
  head/sys/boot/fdt/dts/arm/cubieboard.dts
  head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi
  head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
  head/sys/conf/options.arm

Modified: head/sys/arm/allwinner/a10_ahci.c
==
--- head/sys/arm/allwinner/a10_ahci.c   Wed Feb 17 18:12:38 2016
(r295710)
+++ head/sys/arm/allwinner/a10_ahci.c   Wed Feb 17 18:28:03 2016
(r295711)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include  
@@ -49,7 +48,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include "gpio_if.h"
 
 /*
  * Allwinner a1x/a2x/a8x SATA attachment.  This is just the AHCI register
@@ -119,9 +117,6 @@ __FBSDID("$FreeBSD$");
 #defineAHCI_P0PHYCR0x0078
 #defineAHCI_P0PHYSR0x007C
 
-/* Kludge for CUBIEBOARD (and Banana PI too) */
-#defineGPIO_AHCI_PWR   40
-
 static void inline
 ahci_set(struct resource *m, bus_size_t off, uint32_t set)
 {
@@ -298,7 +293,6 @@ ahci_a10_probe(device_t dev)
 static int
 ahci_a10_attach(device_t dev)
 {
-   device_t gpio;
int error;
struct ahci_controller *ctlr;
 
@@ -316,19 +310,6 @@ ahci_a10_attach(device_t dev)
/* Turn on the PLL for SATA */
a10_clk_ahci_activate();
 
-   /* Apply power to the drive, if any */
-   gpio = devclass_get_device(devclass_find("gpio"), 0);
-   if (gpio == NULL) {
-   device_printf(dev,
-   "GPIO device not yet present (SATA won't work).\n");
-   bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid,
-   ctlr->r_mem);
-   return (ENXIO);
-   }
-   GPIO_PIN_SETFLAGS(gpio, GPIO_AHCI_PWR, GPIO_PIN_OUTPUT);
-   GPIO_PIN_SET(gpio, GPIO_AHCI_PWR, GPIO_PIN_HIGH);
-   DELAY(1);
-
/* Reset controller */
if ((error = ahci_a10_ctlr_reset(dev)) != 0) {
bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid,

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Wed Feb 17 18:12:38 2016
(r295710)
+++ head/sys/arm/allwinner/a10_gpio.c   Wed Feb 17 18:28:03 2016
(r295711)
@@ -47,12 +47,15 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
+#include 
+#include 
+
 #include "gpio_if.h"
-#include "a10_gpio.h"
 
 /*
  * A10 have 9 banks of gpio.
@@ -62,7 +65,6 @@ __FBSDID("$FreeBSD$");
  * PG0 - PG9 | PH0 - PH27 | PI0 - PI12
  */
 
-#defineA10_GPIO_PINS   288
 #defineA10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | 
\
 GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
 
@@ -73,6 +75,9 @@ __FBSDID("$FreeBSD$");
 #define A10_GPIO_INPUT 0
 #define A10_GPIO_OUTPUT1
 
+#define AW_GPIO_DRV_MASK   0x3
+#define AW_GPIO_PUD_MASK   0x3
+
 static struct ofw_compat_data compat_data[] = {
{"allwinner,sun4i-a10-pinctrl", 1},
{"allwinner,sun7i-a20-pinctrl", 1},
@@ -88,8 +93,19 @@ struct a10_gpio_softc {
bus_space_tag_t sc_bst;
bus_space_handle_t  sc_bsh;
void *  sc_intrhand;
+   const struct allwinner_padconf *padconf;
 };
 
+/* Defined in a10_padconf.c */
+#ifdef SOC_ALLWINNER_A10
+extern const struct allwinner_padconf a10_padconf;
+#endif
+
+/* Defined in a20_padconf.c */
+#ifdef SOC_ALLWINNER_A20
+extern const struct allwinner_padconf a20_padconf;
+#endif
+
 #defineA10_GPIO_LOCK(_sc)  mtx_lock_spin(&(_sc)->sc_mtx)
 #defineA10_GPIO_UNLOCK(_sc)mtx_unlock_spin

svn commit: r295712 - head/sys/geom

2016-02-17 Thread Warner Losh
Author: imp
Date: Wed Feb 17 18:28:38 2016
New Revision: 295712
URL: https://svnweb.freebsd.org/changeset/base/295712

Log:
  Use the right size for zeroing.
  
  Submitted by: rpokala@

Modified:
  head/sys/geom/geom_io.c

Modified: head/sys/geom/geom_io.c
==
--- head/sys/geom/geom_io.c Wed Feb 17 18:28:03 2016(r295711)
+++ head/sys/geom/geom_io.c Wed Feb 17 18:28:38 2016(r295712)
@@ -268,7 +268,7 @@ void
 g_reset_bio(struct bio *bp)
 {
 
-   bzero(bp, sizeof(bp));
+   bzero(bp, sizeof(*bp));
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295713 - head/lib/libc/tests

2016-02-17 Thread Bryan Drewery
Author: bdrewery
Date: Wed Feb 17 18:41:55 2016
New Revision: 295713
URL: https://svnweb.freebsd.org/changeset/base/295713

Log:
  Fix build race after r295643.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libc/tests/Makefile

Modified: head/lib/libc/tests/Makefile
==
--- head/lib/libc/tests/MakefileWed Feb 17 18:28:38 2016
(r295712)
+++ head/lib/libc/tests/MakefileWed Feb 17 18:41:55 2016
(r295713)
@@ -22,6 +22,8 @@ TESTS_SUBDIRS+=   termios
 TESTS_SUBDIRS+=tls
 TESTS_SUBDIRS+=ttyio
 
+SUBDIR_DEPEND_tls= tls_dso
+
 .if ${MK_LOCALES} != "no"
 TESTS_SUBDIRS+=locale
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295716 - head/sys/kern

2016-02-17 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 17 19:39:57 2016
New Revision: 295716
URL: https://svnweb.freebsd.org/changeset/base/295716

Log:
  In bnoreuselist(), check both ends of the specified logical block
  numbers range.
  
  This effectively skips indirect and extdata blocks on the buffer
  queue.  Since their logical block numbers are negative, bnoreuselist()
  could loop infinitely.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Feb 17 19:11:09 2016(r295715)
+++ head/sys/kern/vfs_subr.cWed Feb 17 19:39:57 2016(r295716)
@@ -1673,7 +1673,8 @@ bnoreuselist(struct bufv *bufv, struct b
for (lblkno = startn;;) {
 again:
bp = BUF_PCTRIE_LOOKUP_GE(&bufv->bv_root, lblkno);
-   if (bp == NULL || bp->b_lblkno >= endn)
+   if (bp == NULL || bp->b_lblkno >= endn ||
+   bp->b_lblkno < startn)
break;
error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL |
LK_INTERLOCK, BO_LOCKPTR(bo), "brlsfl", 0, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295717 - head/sys/fs/nullfs

2016-02-17 Thread Konstantin Belousov
Author: kib
Date: Wed Feb 17 19:43:03 2016
New Revision: 295717
URL: https://svnweb.freebsd.org/changeset/base/295717

Log:
  After nullfs rmdir operation, reclaim the directory vnode which was
  unlinked.  Otherwise the vnode stays cached, causing leak.  This is
  similar to r292961 for regular files.
  
  Reported and tested by:   pho (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Wed Feb 17 19:39:57 2016
(r295716)
+++ head/sys/fs/nullfs/null_vnops.c Wed Feb 17 19:43:03 2016
(r295717)
@@ -619,6 +619,14 @@ null_rename(struct vop_rename_args *ap)
return (null_bypass((struct vop_generic_args *)ap));
 }
 
+static int
+null_rmdir(struct vop_rmdir_args *ap)
+{
+
+   VTONULL(ap->a_vp)->null_flags |= NULLV_DROP;
+   return (null_bypass(&ap->a_gen));
+}
+
 /*
  * We need to process our own vnode lock and then clear the
  * interlock flag as it applies only to our vnode, not the
@@ -920,6 +928,7 @@ struct vop_vector null_vnodeops = {
.vop_reclaim =  null_reclaim,
.vop_remove =   null_remove,
.vop_rename =   null_rename,
+   .vop_rmdir =null_rmdir,
.vop_setattr =  null_setattr,
.vop_strategy = VOP_EOPNOTSUPP,
.vop_unlock =   null_unlock,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295718 - head/sys/dev/random

2016-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Wed Feb 17 21:09:19 2016
New Revision: 295718
URL: https://svnweb.freebsd.org/changeset/base/295718

Log:
  Add missing braces.
  
  Found by: PVS-Studio
  Approved by:  so (implicit)

Modified:
  head/sys/dev/random/nehemiah.c

Modified: head/sys/dev/random/nehemiah.c
==
--- head/sys/dev/random/nehemiah.c  Wed Feb 17 19:43:03 2016
(r295717)
+++ head/sys/dev/random/nehemiah.c  Wed Feb 17 21:09:19 2016
(r295718)
@@ -131,9 +131,10 @@ nehemiah_modevent(module_t mod, int type
break;
 
case MOD_UNLOAD:
-   if (via_feature_rng & VIA_HAS_RNG)
+   if (via_feature_rng & VIA_HAS_RNG) {
random_nehemiah_deinit();
random_source_deregister(&random_nehemiah);
+   }
break;
 
case MOD_SHUTDOWN:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295719 - head/sys/dev/ata/chipsets

2016-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Wed Feb 17 21:13:33 2016
New Revision: 295719
URL: https://svnweb.freebsd.org/changeset/base/295719

Log:
  Ternary operator has lower priority than OR.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/ata/chipsets/ata-serverworks.c

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==
--- head/sys/dev/ata/chipsets/ata-serverworks.c Wed Feb 17 21:09:19 2016
(r295718)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c Wed Feb 17 21:13:33 2016
(r295719)
@@ -162,9 +162,8 @@ ata_serverworks_chipinit(device_t dev)
}
 }
 else {
-   pci_write_config(dev, 0x5a,
-(pci_read_config(dev, 0x5a, 1) & ~0x40) |
-(ctlr->chip->cfg1 == SWKS_100) ? 0x03 : 0x02, 1);
+   pci_write_config(dev, 0x5a, (pci_read_config(dev, 0x5a, 1) & ~0x40) |
+   ((ctlr->chip->cfg1 == SWKS_100) ? 0x03 : 0x02), 1);
 }
 ctlr->setmode = ata_serverworks_setmode;
 return 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295720 - head/sys/netinet6

2016-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Wed Feb 17 21:17:14 2016
New Revision: 295720
URL: https://svnweb.freebsd.org/changeset/base/295720

Log:
  Ternary operator has lower priority than OR.
  
  Found by: PVS-Studio

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Wed Feb 17 21:13:33 2016(r295719)
+++ head/sys/netinet6/in6.c Wed Feb 17 21:17:14 2016(r295720)
@@ -1316,7 +1316,7 @@ in6_purgeaddr(struct ifaddr *ifa)
plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */
if ((ia->ia_flags & IFA_ROUTE) && plen == 128) {
error = rtinit(&(ia->ia_ifa), RTM_DELETE, ia->ia_flags |
-   (ia->ia_dstaddr.sin6_family == AF_INET6) ? RTF_HOST : 0);
+   (ia->ia_dstaddr.sin6_family == AF_INET6 ? RTF_HOST : 0));
if (error != 0)
log(LOG_INFO, "%s: err=%d, destination address delete "
"failed\n", __func__, error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295721 - head/sys/dev/ae

2016-02-17 Thread Gleb Smirnoff
Author: glebius
Date: Wed Feb 17 21:24:26 2016
New Revision: 295721
URL: https://svnweb.freebsd.org/changeset/base/295721

Log:
  Fix a potentially "forever" loop.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==
--- head/sys/dev/ae/if_ae.c Wed Feb 17 21:17:14 2016(r295720)
+++ head/sys/dev/ae/if_ae.c Wed Feb 17 21:24:26 2016(r295721)
@@ -1660,7 +1660,7 @@ ae_stop_rxmac(ae_softc_t *sc)
/*
 * Wait for IDLE state.
 */
-   for (i = 0; i < AE_IDLE_TIMEOUT; i--) {
+   for (i = 0; i < AE_IDLE_TIMEOUT; i++) {
val = AE_READ_4(sc, AE_IDLE_REG);
if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0)
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295729 - head/sys/netinet6

2016-02-17 Thread Mark Johnston
Author: markj
Date: Wed Feb 17 23:53:24 2016
New Revision: 295729
URL: https://svnweb.freebsd.org/changeset/base/295729

Log:
  Remove a prototype for the non-existent prelist_del().
  
  MFC after:1 week

Modified:
  head/sys/netinet6/nd6.h

Modified: head/sys/netinet6/nd6.h
==
--- head/sys/netinet6/nd6.h Wed Feb 17 23:36:58 2016(r295728)
+++ head/sys/netinet6/nd6.h Wed Feb 17 23:53:24 2016(r295729)
@@ -441,7 +441,6 @@ void nd6_dad_stop(struct ifaddr *);
 /* nd6_rtr.c */
 void nd6_rs_input(struct mbuf *, int, int);
 void nd6_ra_input(struct mbuf *, int, int);
-void prelist_del(struct nd_prefix *);
 void defrouter_reset(void);
 void defrouter_select(void);
 void defrtrlist_del(struct nd_defrouter *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295730 - head/sys/netinet6

2016-02-17 Thread Mark Johnston
Author: markj
Date: Wed Feb 17 23:55:24 2016
New Revision: 295730
URL: https://svnweb.freebsd.org/changeset/base/295730

Log:
  Use pfxrtr_del() instead of freeing advertising routers directly.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Wed Feb 17 23:53:24 2016(r295729)
+++ head/sys/netinet6/nd6_rtr.c Wed Feb 17 23:55:24 2016(r295730)
@@ -936,9 +936,9 @@ prelist_remove(struct nd_prefix *pr)
/* unlink ndpr_entry from nd_prefix list */
LIST_REMOVE(pr, ndpr_entry);
 
-   /* free list of routers that adversed the prefix */
+   /* free list of routers that advertised the prefix */
LIST_FOREACH_SAFE(pfr, &pr->ndpr_advrtrs, pfr_entry, next) {
-   free(pfr, M_IP6NDP);
+   pfxrtr_del(pfr);
}
free(pr, M_IP6NDP);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295732 - head/sys/netinet6

2016-02-17 Thread Mark Johnston
Author: markj
Date: Thu Feb 18 00:00:51 2016
New Revision: 295732
URL: https://svnweb.freebsd.org/changeset/base/295732

Log:
  Release the ref acquired in nd6_dad_find() if DAD is already in progress.
  
  MFC after:1 week

Modified:
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/netinet6/nd6_nbr.c
==
--- head/sys/netinet6/nd6_nbr.c Thu Feb 18 00:00:36 2016(r295731)
+++ head/sys/netinet6/nd6_nbr.c Thu Feb 18 00:00:51 2016(r295732)
@@ -1262,9 +1262,10 @@ nd6_dad_start(struct ifaddr *ifa, int de
}
if ((dp = nd6_dad_find(ifa, NULL)) != NULL) {
/*
-* DAD already in progress.  Let the existing entry
-* to finish it.
+* DAD is already in progress.  Let the existing entry
+* finish it.
 */
+   nd6_dad_rele(dp);
return;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295733 - in head: libexec libexec/makewhatis.local usr.bin/makewhatis

2016-02-17 Thread Bryan Drewery
Author: bdrewery
Date: Thu Feb 18 00:26:21 2016
New Revision: 295733
URL: https://svnweb.freebsd.org/changeset/base/295733

Log:
  Fix installation of makewhatis.local(1) since r283777.
  
  The wrapper script has moved to libexec/makewhatis.local since it is not
  directlry related to the older makewhatis(1) utility that has been replaced
  by the usr.bin/mandoc version.
  
  Reported by:  vangyzen

Added:
  head/libexec/makewhatis.local/
 - copied from r295732, head/usr.bin/makewhatis/
Deleted:
  head/libexec/makewhatis.local/makewhatis.1
  head/libexec/makewhatis.local/makewhatis.c
Modified:
  head/libexec/Makefile
  head/libexec/makewhatis.local/Makefile
  head/libexec/makewhatis.local/Makefile.depend
  head/usr.bin/makewhatis/Makefile

Modified: head/libexec/Makefile
==
--- head/libexec/Makefile   Thu Feb 18 00:00:51 2016(r295732)
+++ head/libexec/Makefile   Thu Feb 18 00:26:21 2016(r295733)
@@ -10,6 +10,7 @@ SUBDIR=   ${_atf} \
${_dma} \
getty \
${_mail.local} \
+   ${_makewhatis.local} \
${_mknetid} \
${_pppoed} \
revnetgroup \
@@ -88,6 +89,10 @@ _mail.local= mail.local
 _smrsh=smrsh
 .endif
 
+.if ${MK_MAN_UTILS} != "no"
+_makewhatis.local= makewhatis.local
+.endif
+
 .if ${MK_TALK} != "no"
 SUBDIR+=   talkd
 .endif

Modified: head/libexec/makewhatis.local/Makefile
==
--- head/usr.bin/makewhatis/MakefileThu Feb 18 00:00:51 2016
(r295732)
+++ head/libexec/makewhatis.local/Makefile  Thu Feb 18 00:26:21 2016
(r295733)
@@ -1,9 +1,7 @@
 # $FreeBSD$
 
-PROG=  makewhatis
-LIBADD=z
 SCRIPTS=   makewhatis.local.sh
-MAN=   makewhatis.1 makewhatis.local.8
+MAN=   makewhatis.local.8
 SCRIPTSDIR=${LIBEXECDIR}
 LINKS= ${SCRIPTSDIR}/makewhatis.local ${SCRIPTSDIR}/catman.local
 MLINKS=makewhatis.local.8 catman.local.8

Modified: head/libexec/makewhatis.local/Makefile.depend
==
--- head/usr.bin/makewhatis/Makefile.depend Thu Feb 18 00:00:51 2016
(r295732)
+++ head/libexec/makewhatis.local/Makefile.depend   Thu Feb 18 00:26:21 
2016(r295733)
@@ -2,14 +2,6 @@
 # Autogenerated - do NOT edit!
 
 DIRDEPS = \
-   gnu/lib/csu \
-   gnu/lib/libgcc \
-   include \
-   include/xlocale \
-   lib/${CSU_DIR} \
-   lib/libc \
-   lib/libcompiler_rt \
-   lib/libz \
 
 
 .include 

Modified: head/usr.bin/makewhatis/Makefile
==
--- head/usr.bin/makewhatis/MakefileThu Feb 18 00:00:51 2016
(r295732)
+++ head/usr.bin/makewhatis/MakefileThu Feb 18 00:26:21 2016
(r295733)
@@ -2,10 +2,5 @@
 
 PROG=  makewhatis
 LIBADD=z
-SCRIPTS=   makewhatis.local.sh
-MAN=   makewhatis.1 makewhatis.local.8
-SCRIPTSDIR=${LIBEXECDIR}
-LINKS= ${SCRIPTSDIR}/makewhatis.local ${SCRIPTSDIR}/catman.local
-MLINKS=makewhatis.local.8 catman.local.8
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295735 - in head/sys/dev: age alc ale jme msk stge vte

2016-02-17 Thread Pyun YongHyeon
Author: yongari
Date: Thu Feb 18 01:24:10 2016
New Revision: 295735
URL: https://svnweb.freebsd.org/changeset/base/295735

Log:
  Fix variable assignment.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/age/if_age.c
  head/sys/dev/alc/if_alc.c
  head/sys/dev/ale/if_ale.c
  head/sys/dev/jme/if_jme.c
  head/sys/dev/msk/if_msk.c
  head/sys/dev/stge/if_stge.c
  head/sys/dev/vte/if_vte.c

Modified: head/sys/dev/age/if_age.c
==
--- head/sys/dev/age/if_age.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/age/if_age.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -588,7 +588,7 @@ age_attach(device_t dev)
/* Create device sysctl node. */
age_sysctl_node(sc);
 
-   if ((error = age_dma_alloc(sc) != 0))
+   if ((error = age_dma_alloc(sc)) != 0)
goto fail;
 
/* Load station address. */

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/alc/if_alc.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -1532,7 +1532,7 @@ alc_attach(device_t dev)
/* Create device sysctl node. */
alc_sysctl_node(sc);
 
-   if ((error = alc_dma_alloc(sc) != 0))
+   if ((error = alc_dma_alloc(sc)) != 0)
goto fail;
 
/* Load station address. */

Modified: head/sys/dev/ale/if_ale.c
==
--- head/sys/dev/ale/if_ale.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/ale/if_ale.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -603,7 +603,7 @@ ale_attach(device_t dev)
/* Create device sysctl node. */
ale_sysctl_node(sc);
 
-   if ((error = ale_dma_alloc(sc) != 0))
+   if ((error = ale_dma_alloc(sc)) != 0)
goto fail;
 
/* Load station address. */

Modified: head/sys/dev/jme/if_jme.c
==
--- head/sys/dev/jme/if_jme.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/jme/if_jme.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -804,7 +804,7 @@ jme_attach(device_t dev)
}
/* Create coalescing sysctl node. */
jme_sysctl_node(sc);
-   if ((error = jme_dma_alloc(sc) != 0))
+   if ((error = jme_dma_alloc(sc)) != 0)
goto fail;
 
ifp = sc->jme_ifp = if_alloc(IFT_ETHER);

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/msk/if_msk.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -1623,7 +1623,7 @@ msk_attach(device_t dev)
callout_init_mtx(&sc_if->msk_tick_ch, &sc_if->msk_softc->msk_mtx, 0);
msk_sysctl_node(sc_if);
 
-   if ((error = msk_txrx_dma_alloc(sc_if) != 0))
+   if ((error = msk_txrx_dma_alloc(sc_if)) != 0)
goto fail;
msk_rx_dma_jalloc(sc_if);
 

Modified: head/sys/dev/stge/if_stge.c
==
--- head/sys/dev/stge/if_stge.c Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/stge/if_stge.c Thu Feb 18 01:24:10 2016(r295735)
@@ -508,7 +508,7 @@ stge_attach(device_t dev)
}
}
 
-   if ((error = stge_dma_alloc(sc) != 0))
+   if ((error = stge_dma_alloc(sc)) != 0)
goto fail;
 
/*

Modified: head/sys/dev/vte/if_vte.c
==
--- head/sys/dev/vte/if_vte.c   Thu Feb 18 00:37:58 2016(r295734)
+++ head/sys/dev/vte/if_vte.c   Thu Feb 18 01:24:10 2016(r295735)
@@ -428,7 +428,7 @@ vte_attach(device_t dev)
/* Reset the ethernet controller. */
vte_reset(sc);
 
-   if ((error = vte_dma_alloc(sc) != 0))
+   if ((error = vte_dma_alloc(sc)) != 0)
goto fail;
 
/* Create device sysctl node. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295736 - head/sys/dev/rl

2016-02-17 Thread Pyun YongHyeon
Author: yongari
Date: Thu Feb 18 01:30:49 2016
New Revision: 295736
URL: https://svnweb.freebsd.org/changeset/base/295736

Log:
  Remove duplicated check.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/rl/if_rl.c

Modified: head/sys/dev/rl/if_rl.c
==
--- head/sys/dev/rl/if_rl.c Thu Feb 18 01:24:10 2016(r295735)
+++ head/sys/dev/rl/if_rl.c Thu Feb 18 01:30:49 2016(r295736)
@@ -1938,18 +1938,15 @@ rl_stop(struct rl_softc *sc)
 */
for (i = 0; i < RL_TX_LIST_CNT; i++) {
if (sc->rl_cdata.rl_tx_chain[i] != NULL) {
-   if (sc->rl_cdata.rl_tx_chain[i] != NULL) {
-   bus_dmamap_sync(sc->rl_cdata.rl_tx_tag,
-   sc->rl_cdata.rl_tx_dmamap[i],
-   BUS_DMASYNC_POSTWRITE);
-   bus_dmamap_unload(sc->rl_cdata.rl_tx_tag,
-   sc->rl_cdata.rl_tx_dmamap[i]);
-   m_freem(sc->rl_cdata.rl_tx_chain[i]);
-   sc->rl_cdata.rl_tx_chain[i] = NULL;
-   }
-   CSR_WRITE_4(sc, RL_TXADDR0 + (i * sizeof(uint32_t)),
-   0x000);
+   bus_dmamap_sync(sc->rl_cdata.rl_tx_tag,
+   sc->rl_cdata.rl_tx_dmamap[i],
+   BUS_DMASYNC_POSTWRITE);
+   bus_dmamap_unload(sc->rl_cdata.rl_tx_tag,
+   sc->rl_cdata.rl_tx_dmamap[i]);
+   m_freem(sc->rl_cdata.rl_tx_chain[i]);
+   sc->rl_cdata.rl_tx_chain[i] = NULL;
}
+   CSR_WRITE_4(sc, RL_TXADDR0 + (i * sizeof(uint32_t)), 0x000);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295737 - head/usr.sbin/rtsold

2016-02-17 Thread Mark Johnston
Author: markj
Date: Thu Feb 18 01:58:26 2016
New Revision: 295737
URL: https://svnweb.freebsd.org/changeset/base/295737

Log:
  Use the _SAFE loop variant, since the loop body may remove queue entries.
  
  PR:   207146
  MFC after:3 days

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

Modified: head/usr.sbin/rtsold/rtsold.c
==
--- head/usr.sbin/rtsold/rtsold.c   Thu Feb 18 01:30:49 2016
(r295736)
+++ head/usr.sbin/rtsold/rtsold.c   Thu Feb 18 01:58:26 2016
(r295737)
@@ -554,7 +554,7 @@ rtsol_check_timer(void)
struct timespec now, rtsol_timer;
struct ifinfo *ifi;
struct rainfo *rai;
-   struct ra_opt *rao;
+   struct ra_opt *rao, *raotmp;
int flags;
 
clock_gettime(CLOCK_MONOTONIC_FAST, &now);
@@ -649,7 +649,8 @@ rtsol_check_timer(void)
int expire = 0;
 
TAILQ_FOREACH(rai, &ifi->ifi_rainfo, rai_next) {
-   TAILQ_FOREACH(rao, &rai->rai_ra_opt, rao_next) {
+   TAILQ_FOREACH_SAFE(rao, &rai->rai_ra_opt,
+   rao_next, raotmp) {
warnmsg(LOG_DEBUG, __func__,
"RA expiration timer: "
"type=%d, msg=%s, expire=%s",
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295738 - head/sys/dev/rl

2016-02-17 Thread Pyun YongHyeon
Author: yongari
Date: Thu Feb 18 03:05:08 2016
New Revision: 295738
URL: https://svnweb.freebsd.org/changeset/base/295738

Log:
  Fix a bug introduced in r295736
  TX descriptor address should be updated for valid chain.
  
  Pointed out by:   jmallett

Modified:
  head/sys/dev/rl/if_rl.c

Modified: head/sys/dev/rl/if_rl.c
==
--- head/sys/dev/rl/if_rl.c Thu Feb 18 01:58:26 2016(r295737)
+++ head/sys/dev/rl/if_rl.c Thu Feb 18 03:05:08 2016(r295738)
@@ -1945,8 +1945,9 @@ rl_stop(struct rl_softc *sc)
sc->rl_cdata.rl_tx_dmamap[i]);
m_freem(sc->rl_cdata.rl_tx_chain[i]);
sc->rl_cdata.rl_tx_chain[i] = NULL;
+   CSR_WRITE_4(sc, RL_TXADDR0 + (i * sizeof(uint32_t)),
+   0x000);
}
-   CSR_WRITE_4(sc, RL_TXADDR0 + (i * sizeof(uint32_t)), 0x000);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295739 - in head/sys: netinet sys

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 04:58:34 2016
New Revision: 295739
URL: https://svnweb.freebsd.org/changeset/base/295739

Log:
  tcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit
  
  ACK aggregation limit is append count based, while the TCP data segment
  aggregation limit is length based.  Unless the network driver sets these
  two limits, it's an NO-OP.
  
  Reviewed by:  adrian, gallatin (previous version), hselasky (previous version)
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5185

Modified:
  head/sys/netinet/tcp_lro.c
  head/sys/netinet/tcp_lro.h
  head/sys/sys/param.h

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Thu Feb 18 03:05:08 2016(r295738)
+++ head/sys/netinet/tcp_lro.c  Thu Feb 18 04:58:34 2016(r295739)
@@ -88,6 +88,8 @@ tcp_lro_init_args(struct lro_ctrl *lc, s
lc->lro_mbuf_count = 0;
lc->lro_mbuf_max = lro_mbufs;
lc->lro_cnt = lro_entries;
+   lc->lro_ackcnt_lim = TCP_LRO_ACKCNT_MAX;
+   lc->lro_length_lim = TCP_LRO_LENGTH_MAX;
lc->ifp = ifp;
SLIST_INIT(&lc->lro_free);
SLIST_INIT(&lc->lro_active);
@@ -610,7 +612,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
}
 
/* Flush now if appending will result in overflow. */
-   if (le->p_len > (65535 - tcp_data_len)) {
+   if (le->p_len > (lc->lro_length_lim - tcp_data_len)) {
SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
tcp_lro_flush(lc, le);
break;
@@ -648,6 +650,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 
if (tcp_data_len == 0) {
m_freem(m);
+   /*
+* Flush this LRO entry, if this ACK should not
+* be further delayed.
+*/
+   if (le->append_cnt >= lc->lro_ackcnt_lim) {
+   SLIST_REMOVE(&lc->lro_active, le, lro_entry,
+   next);
+   tcp_lro_flush(lc, le);
+   }
return (0);
}
 
@@ -668,7 +679,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
 * If a possible next full length packet would cause an
 * overflow, pro-actively flush now.
 */
-   if (le->p_len > (65535 - lc->ifp->if_mtu)) {
+   if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) {
SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
tcp_lro_flush(lc, le);
} else

Modified: head/sys/netinet/tcp_lro.h
==
--- head/sys/netinet/tcp_lro.h  Thu Feb 18 03:05:08 2016(r295738)
+++ head/sys/netinet/tcp_lro.h  Thu Feb 18 04:58:34 2016(r295739)
@@ -91,11 +91,16 @@ struct lro_ctrl {
unsignedlro_cnt;
unsignedlro_mbuf_count;
unsignedlro_mbuf_max;
+   unsigned short  lro_ackcnt_lim; /* max # of aggregated ACKs */
+   unsignedlro_length_lim; /* max len of aggregated data */
 
struct lro_head lro_active;
struct lro_head lro_free;
 };
 
+#defineTCP_LRO_LENGTH_MAX  65535
+#defineTCP_LRO_ACKCNT_MAX  65535   /* unlimited */
+
 int tcp_lro_init(struct lro_ctrl *);
 int tcp_lro_init_args(struct lro_ctrl *, struct ifnet *, unsigned, unsigned);
 void tcp_lro_free(struct lro_ctrl *);

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Feb 18 03:05:08 2016(r295738)
+++ head/sys/sys/param.hThu Feb 18 04:58:34 2016(r295739)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100098  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100099  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295740 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 04:59:37 2016
New Revision: 295740
URL: https://svnweb.freebsd.org/changeset/base/295740

Log:
  hyperv/hn: Set the TCP ACK/data segment aggregation limit
  
  Set TCP ACK append limit to 1, i.e. aggregate 2 ACKs at most.  Aggregating
  anything more than 2 hurts TCP sending performance in hyperv.  This
  significantly improves the TCP sending performance when the number of
  concurrent connetion is low (2~8).  And it greatly stabilizes the TCP
  sending performance in other cases.
  
  Set TCP data segments aggregation length limit to 37500.  Without this
  limitation, hn(4) could aggregate ~45 TCP data segments for each
  connection (even at 64 or more connections) before dispatching them to
  socket code; large aggregation slows down ACK sending and eventually
  hurts/destabilizes TCP reception performance.  This setting stabilizes
  and improves TCP reception performance for >4 concurrent connections
  significantly.
  
  Make them sysctls so they could be adjusted.
  
  Reviewed by:  adrian, gallatin (previous version), hselasky (previous version)
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5185

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 04:58:34 2016
(r295739)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 04:59:37 2016
(r295740)
@@ -1030,7 +1030,6 @@ typedef struct hn_softc {
struct task hn_txeof_task;
 
struct lro_ctrl hn_lro;
-   int hn_lro_hiwat;
 
/* Trust csum verification on host side */
int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 04:58:34 
2016(r295739)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 04:59:37 
2016(r295740)
@@ -176,14 +176,11 @@ struct hn_txdesc {
 #define HN_CSUM_ASSIST_WIN8(CSUM_TCP)
 #define HN_CSUM_ASSIST (CSUM_IP | CSUM_UDP | CSUM_TCP)
 
-/* XXX move to netinet/tcp_lro.h */
-#define HN_LRO_HIWAT_MAX   65535
-#define HN_LRO_HIWAT_DEF   HN_LRO_HIWAT_MAX
+#define HN_LRO_LENLIM_DEF  (25 * ETHERMTU)
 /* YYY 2*MTU is a bit rough, but should be good enough. */
-#define HN_LRO_HIWAT_MTULIM(ifp)   (2 * (ifp)->if_mtu)
-#define HN_LRO_HIWAT_ISVALID(sc, hiwat)\
-((hiwat) >= HN_LRO_HIWAT_MTULIM((sc)->hn_ifp) ||   \
- (hiwat) <= HN_LRO_HIWAT_MAX)
+#define HN_LRO_LENLIM_MIN(ifp) (2 * (ifp)->if_mtu)
+
+#define HN_LRO_ACKCNT_DEF  1
 
 /*
  * Be aware that this sleepable mutex will exhibit WITNESS errors when
@@ -253,9 +250,8 @@ static void hn_start(struct ifnet *ifp);
 static void hn_start_txeof(struct ifnet *ifp);
 static int hn_ifmedia_upd(struct ifnet *ifp);
 static void hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
-#ifdef HN_LRO_HIWAT
-static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS);
-#endif
+static int hn_lro_lenlim_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_tx_chimney_size_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_check_iplen(const struct mbuf *, int);
@@ -265,15 +261,6 @@ static void hn_start_taskfunc(void *xsc,
 static void hn_txeof_taskfunc(void *xsc, int pending);
 static int hn_encap(struct hn_softc *, struct hn_txdesc *, struct mbuf **);
 
-static __inline void
-hn_set_lro_hiwat(struct hn_softc *sc, int hiwat)
-{
-   sc->hn_lro_hiwat = hiwat;
-#ifdef HN_LRO_HIWAT
-   sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
-#endif
-}
-
 static int
 hn_ifmedia_upd(struct ifnet *ifp __unused)
 {
@@ -358,7 +345,6 @@ netvsc_attach(device_t dev)
bzero(sc, sizeof(hn_softc_t));
sc->hn_unit = unit;
sc->hn_dev = dev;
-   sc->hn_lro_hiwat = HN_LRO_HIWAT_DEF;
sc->hn_direct_tx_size = hn_direct_tx_size;
if (hn_trust_hosttcp)
sc->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP;
@@ -442,9 +428,8 @@ netvsc_attach(device_t dev)
/* Driver private LRO settings */
sc->hn_lro.ifp = ifp;
 #endif
-#ifdef HN_LRO_HIWAT
-   sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
-#endif
+   sc->hn_lro.lro_length_lim = HN_LRO_LENLIM_DEF;
+   sc->hn_lro.lro_ackcnt_lim = HN_LRO_ACKCNT_DEF;
 #endif /* INET || INET6 */
 
 #if __FreeBSD_version >= 1100045
@@ -480,11 +465,12 @@ netvsc_attach(device_t dev)
CTLFLAG_RW, &sc->hn_lro.lro_flushed, 0, "LRO flushed")

svn commit: r295741 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 06:55:05 2016
New Revision: 295741
URL: https://svnweb.freebsd.org/changeset/base/295741

Log:
  hyperv/hn: Add option to allow sharing TX taskq between hn instances
  
  It is off by default.  This eases further experimenting on this driver.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5272

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 04:59:37 
2016(r295740)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 06:55:05 
2016(r295741)
@@ -238,6 +238,11 @@ TUNABLE_INT("dev.hn.lro_entry_count", &h
 #endif
 #endif
 
+static int hn_share_tx_taskq = 0;
+TUNABLE_INT("hw.hn.share_tx_taskq", &hn_share_tx_taskq);
+
+static struct taskqueue*hn_tx_taskq;
+
 /*
  * Forward declarations
  */
@@ -353,10 +358,14 @@ netvsc_attach(device_t dev)
if (hn_trust_hostip)
sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP;
 
-   sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
-   taskqueue_thread_enqueue, &sc->hn_tx_taskq);
-   taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx",
-   device_get_nameunit(dev));
+   if (hn_tx_taskq == NULL) {
+   sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
+   taskqueue_thread_enqueue, &sc->hn_tx_taskq);
+   taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx",
+   device_get_nameunit(dev));
+   } else {
+   sc->hn_tx_taskq = hn_tx_taskq;
+   }
TASK_INIT(&sc->hn_start_task, 0, hn_start_taskfunc, sc);
TASK_INIT(&sc->hn_txeof_task, 0, hn_txeof_taskfunc, sc);
 
@@ -602,7 +611,8 @@ netvsc_detach(device_t dev)
 
taskqueue_drain(sc->hn_tx_taskq, &sc->hn_start_task);
taskqueue_drain(sc->hn_tx_taskq, &sc->hn_txeof_task);
-   taskqueue_free(sc->hn_tx_taskq);
+   if (sc->hn_tx_taskq != hn_tx_taskq)
+   taskqueue_free(sc->hn_tx_taskq);
 
ifmedia_removeall(&sc->hn_media);
 #if defined(INET) || defined(INET6)
@@ -2039,6 +2049,28 @@ hn_txeof_taskfunc(void *xsc, int pending
NV_UNLOCK(sc);
 }
 
+static void
+hn_tx_taskq_create(void *arg __unused)
+{
+   if (!hn_share_tx_taskq)
+   return;
+
+   hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
+   taskqueue_thread_enqueue, &hn_tx_taskq);
+   taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx");
+}
+SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_FIRST,
+hn_tx_taskq_create, NULL);
+
+static void
+hn_tx_taskq_destroy(void *arg __unused)
+{
+   if (hn_tx_taskq != NULL)
+   taskqueue_free(hn_tx_taskq);
+}
+SYSUNINIT(hn_txtq_destroy, SI_SUB_DRIVERS, SI_ORDER_FIRST,
+hn_tx_taskq_destroy, NULL);
+
 static device_method_t netvsc_methods[] = {
 /* Device interface */
 DEVMETHOD(device_probe, netvsc_probe),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295742 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:00:47 2016
New Revision: 295742
URL: https://svnweb.freebsd.org/changeset/base/295742

Log:
  hyperv/hn: Always do transmission scheduling.
  
  This one gives the best performance so far.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5273

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 06:55:05 
2016(r295741)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:00:47 
2016(r295742)
@@ -465,6 +465,13 @@ netvsc_attach(device_t dev)
hn_tx_chimney_size < sc->hn_tx_chimney_max)
sc->hn_tx_chimney_size = hn_tx_chimney_size;
 
+   /*
+* Always schedule transmission instead of trying
+* to do direct transmission.  This one gives the
+* best performance so far.
+*/
+   sc->hn_sched_tx = 1;
+
ctx = device_get_sysctl_ctx(dev);
child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev));
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295743 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:06:44 2016
New Revision: 295743
URL: https://svnweb.freebsd.org/changeset/base/295743

Log:
  hyperv/hn: Change global tunable prefix to hw.hn
  
  And use SYSCTL+CTLFLAG_RDTUN for them.
  
  Suggested by: adrian
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5274

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:00:47 
2016(r295742)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:06:44 
2016(r295743)
@@ -205,41 +205,57 @@ struct hn_txdesc {
 
 int hv_promisc_mode = 0;/* normal mode by default */
 
+SYSCTL_NODE(_hw, OID_AUTO, hn, CTLFLAG_RD, NULL, "Hyper-V network interface");
+
 /* Trust tcp segements verification on host side. */
 static int hn_trust_hosttcp = 1;
-TUNABLE_INT("dev.hn.trust_hosttcp", &hn_trust_hosttcp);
+SYSCTL_INT(_hw_hn, OID_AUTO, trust_hosttcp, CTLFLAG_RDTUN,
+&hn_trust_hosttcp, 0,
+"Trust tcp segement verification on host side, "
+"when csum info is missing (global setting)");
 
 /* Trust udp datagrams verification on host side. */
 static int hn_trust_hostudp = 1;
-TUNABLE_INT("dev.hn.trust_hostudp", &hn_trust_hostudp);
+SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostudp, CTLFLAG_RDTUN,
+&hn_trust_hostudp, 0,
+"Trust udp datagram verification on host side, "
+"when csum info is missing (global setting)");
 
 /* Trust ip packets verification on host side. */
 static int hn_trust_hostip = 1;
-TUNABLE_INT("dev.hn.trust_hostip", &hn_trust_hostip);
+SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostip, CTLFLAG_RDTUN,
+&hn_trust_hostip, 0,
+"Trust ip packet verification on host side, "
+"when csum info is missing (global setting)");
 
 #if __FreeBSD_version >= 1100045
 /* Limit TSO burst size */
 static int hn_tso_maxlen = 0;
-TUNABLE_INT("dev.hn.tso_maxlen", &hn_tso_maxlen);
+SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN,
+&hn_tso_maxlen, 0, "TSO burst limit");
 #endif
 
 /* Limit chimney send size */
 static int hn_tx_chimney_size = 0;
-TUNABLE_INT("dev.hn.tx_chimney_size", &hn_tx_chimney_size);
+SYSCTL_INT(_hw_hn, OID_AUTO, tx_chimney_size, CTLFLAG_RDTUN,
+&hn_tx_chimney_size, 0, "Chimney send packet size limit");
 
 /* Limit the size of packet for direct transmission */
 static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF;
-TUNABLE_INT("dev.hn.direct_tx_size", &hn_direct_tx_size);
+SYSCTL_INT(_hw_hn, OID_AUTO, direct_tx_size, CTLFLAG_RDTUN,
+&hn_direct_tx_size, 0, "Size of the packet for direct transmission");
 
 #if defined(INET) || defined(INET6)
 #if __FreeBSD_version >= 1100095
 static int hn_lro_entry_count = HN_LROENT_CNT_DEF;
-TUNABLE_INT("dev.hn.lro_entry_count", &hn_lro_entry_count);
+SYSCTL_INT(_hw_hn, OID_AUTO, lro_entry_count, CTLFLAG_RDTUN,
+&hn_lro_entry_count, 0, "LRO entry count");
 #endif
 #endif
 
 static int hn_share_tx_taskq = 0;
-TUNABLE_INT("hw.hn.share_tx_taskq", &hn_share_tx_taskq);
+SYSCTL_INT(_hw_hn, OID_AUTO, share_tx_taskq, CTLFLAG_RDTUN,
+&hn_share_tx_taskq, 0, "Enable shared TX taskqueue");
 
 static struct taskqueue*hn_tx_taskq;
 
@@ -541,48 +557,6 @@ netvsc_attach(device_t dev)
"Always schedule transmission "
"instead of doing direct transmission");
 
-   if (unit == 0) {
-   struct sysctl_ctx_list *dc_ctx;
-   struct sysctl_oid_list *dc_child;
-   devclass_t dc;
-
-   /*
-* Add sysctl nodes for devclass
-*/
-   dc = device_get_devclass(dev);
-   dc_ctx = devclass_get_sysctl_ctx(dc);
-   dc_child = SYSCTL_CHILDREN(devclass_get_sysctl_tree(dc));
-
-   SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "trust_hosttcp",
-   CTLFLAG_RD, &hn_trust_hosttcp, 0,
-   "Trust tcp segement verification on host side, "
-   "when csum info is missing (global setting)");
-   SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "trust_hostudp",
-   CTLFLAG_RD, &hn_trust_hostudp, 0,
-   "Trust udp datagram verification on host side, "
-   "when csum info is missing (global setting)");
-   SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "trust_hostip",
-   CTLFLAG_RD, &hn_trust_hostip, 0,
-   "Trust ip packet verification on host side, "
-   "when csum info is missing (global setting)");
-   SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "tx_chimney_size",
-   CTLFLAG_RD, &hn_tx_chimney_size, 0,
-   "Chimney send packet size limit");
-#if __FreeBSD_v

svn commit: r295744 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:16:31 2016
New Revision: 295744
URL: https://svnweb.freebsd.org/changeset/base/295744

Log:
  hyperv/hn: Split RX ring data structure out of softc
  
  This paves the way for upcoming vRSS stuffs and eases more code cleanup.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5275

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:06:44 2016
(r295743)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:16:31 2016
(r295744)
@@ -993,6 +993,24 @@ typedef struct {
 struct hn_txdesc;
 SLIST_HEAD(hn_txdesc_list, hn_txdesc);
 
+struct hn_rx_ring {
+   struct lro_ctrl hn_lro;
+
+   /* Trust csum verification on host side */
+   int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
+
+   u_long  hn_csum_ip;
+   u_long  hn_csum_tcp;
+   u_long  hn_csum_udp;
+   u_long  hn_csum_trusted;
+   u_long  hn_lro_tried;
+   u_long  hn_small_pkts;
+} __aligned(CACHE_LINE_SIZE);
+
+#define HN_TRUST_HCSUM_IP  0x0001
+#define HN_TRUST_HCSUM_TCP 0x0002
+#define HN_TRUST_HCSUM_UDP 0x0004
+
 /*
  * Device-specific softc structure
  */
@@ -1029,17 +1047,9 @@ typedef struct hn_softc {
struct task hn_start_task;
struct task hn_txeof_task;
 
-   struct lro_ctrl hn_lro;
-
-   /* Trust csum verification on host side */
-   int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
+   int hn_rx_ring_cnt;
+   struct hn_rx_ring *hn_rx_ring;
 
-   u_long  hn_csum_ip;
-   u_long  hn_csum_tcp;
-   u_long  hn_csum_udp;
-   u_long  hn_csum_trusted;
-   u_long  hn_lro_tried;
-   u_long  hn_small_pkts;
u_long  hn_no_txdescs;
u_long  hn_send_failed;
u_long  hn_txdma_failed;
@@ -1047,10 +1057,6 @@ typedef struct hn_softc {
u_long  hn_tx_chimney;
 } hn_softc_t;
 
-#define HN_TRUST_HCSUM_IP  0x0001
-#define HN_TRUST_HCSUM_TCP 0x0002
-#define HN_TRUST_HCSUM_UDP 0x0004
-
 /*
  * Externs
  */

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:06:44 
2016(r295743)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:16:31 
2016(r295744)
@@ -275,12 +275,16 @@ static int hn_lro_lenlim_sysctl(SYSCTL_H
 static int hn_lro_ackcnt_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_tx_chimney_size_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_rx_stat_ulong_sysctl(SYSCTL_HANDLER_ARGS);
+static int hn_rx_stat_u64_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_check_iplen(const struct mbuf *, int);
 static int hn_create_tx_ring(struct hn_softc *sc);
 static void hn_destroy_tx_ring(struct hn_softc *sc);
 static void hn_start_taskfunc(void *xsc, int pending);
 static void hn_txeof_taskfunc(void *xsc, int pending);
 static int hn_encap(struct hn_softc *, struct hn_txdesc *, struct mbuf **);
+static void hn_create_rx_data(struct hn_softc *sc);
+static void hn_destroy_rx_data(struct hn_softc *sc);
 
 static int
 hn_ifmedia_upd(struct ifnet *ifp __unused)
@@ -352,11 +356,6 @@ netvsc_attach(device_t dev)
 #if __FreeBSD_version >= 1100045
int tso_maxlen;
 #endif
-#if defined(INET) || defined(INET6)
-#if __FreeBSD_version >= 1100095
-   int lroent_cnt;
-#endif
-#endif
 
sc = device_get_softc(dev);
if (sc == NULL) {
@@ -367,12 +366,6 @@ netvsc_attach(device_t dev)
sc->hn_unit = unit;
sc->hn_dev = dev;
sc->hn_direct_tx_size = hn_direct_tx_size;
-   if (hn_trust_hosttcp)
-   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP;
-   if (hn_trust_hostudp)
-   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_UDP;
-   if (hn_trust_hostip)
-   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP;
 
if (hn_tx_taskq == NULL) {
sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
@@ -396,6 +389,8 @@ netvsc_attach(device_t dev)
ifp = sc->hn_ifp = if_alloc(IFT_ETHER);
ifp->if_softc = sc;
 
+   hn_create_rx_data(sc);
+
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_dunit = unit;
ifp->if_dname = NETVSC_DEVNAME;
@@ -441,22 +436,6 @@ netvsc_attach(device_t dev)
sc->hn_carrier = 1;
}
 
-#if defined(INET) || defined(INET6)
-#if __FreeBSD_version >= 1100095
-   lroent

svn commit: r295745 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:23:05 2016
New Revision: 295745
URL: https://svnweb.freebsd.org/changeset/base/295745

Log:
  hyperv/hn: Use taskqueue_enqueue()
  
  This also eases experiment on the non-fast taskqueue.
  
  Reviewed by:  adrian, Jun Su 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5276

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:16:31 
2016(r295744)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:23:05 
2016(r295745)
@@ -1549,7 +1549,7 @@ hn_start(struct ifnet *ifp)
return;
}
 do_sched:
-   taskqueue_enqueue_fast(sc->hn_tx_taskq, &sc->hn_start_task);
+   taskqueue_enqueue(sc->hn_tx_taskq, &sc->hn_start_task);
 }
 
 static void
@@ -1566,10 +1566,8 @@ hn_start_txeof(struct ifnet *ifp)
atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE);
sched = hn_start_locked(ifp, sc->hn_direct_tx_size);
NV_UNLOCK(sc);
-   if (sched) {
-   taskqueue_enqueue_fast(sc->hn_tx_taskq,
-   &sc->hn_start_task);
-   }
+   if (sched)
+   taskqueue_enqueue(sc->hn_tx_taskq, &sc->hn_start_task);
} else {
 do_sched:
/*
@@ -1579,7 +1577,7 @@ do_sched:
 * races.
 */
atomic_clear_int(&ifp->if_drv_flags, IFF_DRV_OACTIVE);
-   taskqueue_enqueue_fast(sc->hn_tx_taskq, &sc->hn_txeof_task);
+   taskqueue_enqueue(sc->hn_tx_taskq, &sc->hn_txeof_task);
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295746 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:28:45 2016
New Revision: 295746
URL: https://svnweb.freebsd.org/changeset/base/295746

Log:
  hyperv/hn: Use non-fast taskqueue for transmission
  
  Performance stays same; so no need to use fast taskqueue here.
  
  Suggested by: royger
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5282

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:23:05 
2016(r295745)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:28:45 
2016(r295746)
@@ -368,7 +368,7 @@ netvsc_attach(device_t dev)
sc->hn_direct_tx_size = hn_direct_tx_size;
 
if (hn_tx_taskq == NULL) {
-   sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
+   sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK,
taskqueue_thread_enqueue, &sc->hn_tx_taskq);
taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx",
device_get_nameunit(dev));
@@ -2178,7 +2178,7 @@ hn_tx_taskq_create(void *arg __unused)
if (!hn_share_tx_taskq)
return;
 
-   hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
+   hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK,
taskqueue_thread_enqueue, &hn_tx_taskq);
taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx");
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295747 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:37:59 2016
New Revision: 295747
URL: https://svnweb.freebsd.org/changeset/base/295747

Log:
  hyperv/hn: Split TX ring data structure out of softc
  
  This paves the way for upcoming vRSS stuffs and eases more code cleanup.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5283

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:28:45 2016
(r295746)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:37:59 2016
(r295747)
@@ -1011,6 +1011,38 @@ struct hn_rx_ring {
 #define HN_TRUST_HCSUM_TCP 0x0002
 #define HN_TRUST_HCSUM_UDP 0x0004
 
+struct hn_tx_ring {
+   struct mtx  hn_txlist_spin;
+   struct hn_txdesc_list hn_txlist;
+   int hn_txdesc_cnt;
+   int hn_txdesc_avail;
+   int hn_txeof;
+
+   int hn_sched_tx;
+   struct taskqueue *hn_tx_taskq;
+   struct task hn_start_task;
+   struct task hn_txeof_task;
+
+   struct mtx  hn_tx_lock;
+   struct hn_softc *hn_sc;
+
+   int hn_direct_tx_size;
+   int hn_tx_chimney_size;
+   bus_dma_tag_t   hn_tx_data_dtag;
+   uint64_thn_csum_assist;
+
+   u_long  hn_no_txdescs;
+   u_long  hn_send_failed;
+   u_long  hn_txdma_failed;
+   u_long  hn_tx_collapsed;
+   u_long  hn_tx_chimney;
+
+   /* Rarely used stuffs */
+   struct hn_txdesc *hn_txdesc;
+   bus_dma_tag_t   hn_tx_rndis_dtag;
+   struct sysctl_oid *hn_tx_sysctl_tree;
+} __aligned(CACHE_LINE_SIZE);
+
 /*
  * Device-specific softc structure
  */
@@ -1028,33 +1060,14 @@ typedef struct hn_softc {
struct hv_device  *hn_dev_obj;
netvsc_dev  *net_dev;
 
-   struct hn_txdesc *hn_txdesc;
-   bus_dma_tag_t   hn_tx_data_dtag;
-   bus_dma_tag_t   hn_tx_rndis_dtag;
-   int hn_tx_chimney_size;
-   int hn_tx_chimney_max;
-   uint64_thn_csum_assist;
-
-   struct mtx  hn_txlist_spin;
-   struct hn_txdesc_list hn_txlist;
-   int hn_txdesc_cnt;
-   int hn_txdesc_avail;
-   int hn_txeof;
-
-   int hn_sched_tx;
-   int hn_direct_tx_size;
-   struct taskqueue *hn_tx_taskq;
-   struct task hn_start_task;
-   struct task hn_txeof_task;
-
int hn_rx_ring_cnt;
struct hn_rx_ring *hn_rx_ring;
 
-   u_long  hn_no_txdescs;
-   u_long  hn_send_failed;
-   u_long  hn_txdma_failed;
-   u_long  hn_tx_collapsed;
-   u_long  hn_tx_chimney;
+   int hn_tx_ring_cnt;
+   struct hn_tx_ring *hn_tx_ring;
+   int hn_tx_chimney_max;
+   struct taskqueue *hn_tx_taskq;
+   struct sysctl_oid *hn_tx_sysctl_tree;
 } hn_softc_t;
 
 /*

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:28:45 
2016(r295746)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:37:59 
2016(r295747)
@@ -153,7 +153,7 @@ __FBSDID("$FreeBSD$");
 struct hn_txdesc {
SLIST_ENTRY(hn_txdesc) link;
struct mbuf *m;
-   struct hn_softc *sc;
+   struct hn_tx_ring *txr;
int refs;
uint32_tflags;  /* HN_TXD_FLAG_ */
netvsc_packet   netvsc_pkt; /* XXX to be removed */
@@ -193,7 +193,6 @@ struct hn_txdesc {
 #define NV_LOCK_INIT(_sc, _name) \
mtx_init(&(_sc)->hn_lock, _name, MTX_NETWORK_LOCK, MTX_DEF)
 #define NV_LOCK(_sc)   mtx_lock(&(_sc)->hn_lock)
-#define NV_TRYLOCK(_sc)mtx_trylock(&(_sc)->hn_lock)
 #define NV_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->hn_lock, MA_OWNED)
 #define NV_UNLOCK(_sc) mtx_unlock(&(_sc)->hn_lock)
 #define NV_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->hn_lock)
@@ -266,9 +265,9 @@ static void hn_stop(hn_softc_t *sc);
 static void hn_ifinit_locked(hn_softc_t *sc);
 static void hn_ifinit(void *xsc);
 static int  hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
-static int hn_start_locked(struct ifnet *ifp, int len);
+static int hn_start_locked(struct hn_tx_ring *txr, int len);
 static void hn_start(struct ifnet *ifp);
-static void hn_start_txeof(struct ifnet *ifp);
+static void hn_start_txeof(struct hn_tx_ring *);
 static int hn_ifmedia_upd(struct ifnet *ifp);
 static void hn_ifmedia_sts(str

svn commit: r295748 - head/sys/dev/hyperv/netvsc

2016-02-17 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Feb 18 07:44:14 2016
New Revision: 295748
URL: https://svnweb.freebsd.org/changeset/base/295748

Log:
  hyperv/hn: Use buf_ring for txdesc list
  
  So one spinlock is avoided, which would be potentially dangerous for
  virtual machine, if the spinlock holder was scheduled out by the host,
  as noted by royger.
  
  Old spinlock based txdesc list is still kept around, so we could have
  a safe fallback.
  
  No performance regression nor improvement is observed.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5290

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:37:59 2016
(r295747)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Thu Feb 18 07:44:14 2016
(r295748)
@@ -58,6 +58,8 @@
 
 #include 
 
+#define HN_USE_TXDESC_BUFRING
+
 MALLOC_DECLARE(M_NETVSC);
 
 #define NVSP_INVALID_PROTOCOL_VERSION   (0x)
@@ -990,8 +992,12 @@ typedef struct {
hv_bool_uint8_t link_state;
 } netvsc_device_info;
 
+#ifndef HN_USE_TXDESC_BUFRING
 struct hn_txdesc;
 SLIST_HEAD(hn_txdesc_list, hn_txdesc);
+#else
+struct buf_ring;
+#endif
 
 struct hn_rx_ring {
struct lro_ctrl hn_lro;
@@ -1012,8 +1018,12 @@ struct hn_rx_ring {
 #define HN_TRUST_HCSUM_UDP 0x0004
 
 struct hn_tx_ring {
+#ifndef HN_USE_TXDESC_BUFRING
struct mtx  hn_txlist_spin;
struct hn_txdesc_list hn_txlist;
+#else
+   struct buf_ring *hn_txdesc_br;
+#endif
int hn_txdesc_cnt;
int hn_txdesc_avail;
int hn_txeof;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:37:59 
2016(r295747)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Feb 18 07:44:14 
2016(r295748)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -151,7 +152,9 @@ __FBSDID("$FreeBSD$");
 #define HN_DIRECT_TX_SIZE_DEF  128
 
 struct hn_txdesc {
+#ifndef HN_USE_TXDESC_BUFRING
SLIST_ENTRY(hn_txdesc) link;
+#endif
struct mbuf *m;
struct hn_tx_ring *txr;
int refs;
@@ -258,6 +261,14 @@ SYSCTL_INT(_hw_hn, OID_AUTO, share_tx_ta
 
 static struct taskqueue*hn_tx_taskq;
 
+#ifndef HN_USE_TXDESC_BUFRING
+static int hn_use_txdesc_bufring = 0;
+#else
+static int hn_use_txdesc_bufring = 1;
+#endif
+SYSCTL_INT(_hw_hn, OID_AUTO, use_txdesc_bufring, CTLFLAG_RD,
+&hn_use_txdesc_bufring, 0, "Use buf_ring for TX descriptors");
+
 /*
  * Forward declarations
  */
@@ -570,6 +581,7 @@ hn_txdesc_put(struct hn_tx_ring *txr, st
 
txd->flags |= HN_TXD_FLAG_ONLIST;
 
+#ifndef HN_USE_TXDESC_BUFRING
mtx_lock_spin(&txr->hn_txlist_spin);
KASSERT(txr->hn_txdesc_avail >= 0 &&
txr->hn_txdesc_avail < txr->hn_txdesc_cnt,
@@ -577,6 +589,10 @@ hn_txdesc_put(struct hn_tx_ring *txr, st
txr->hn_txdesc_avail++;
SLIST_INSERT_HEAD(&txr->hn_txlist, txd, link);
mtx_unlock_spin(&txr->hn_txlist_spin);
+#else
+   atomic_add_int(&txr->hn_txdesc_avail, 1);
+   buf_ring_enqueue(txr->hn_txdesc_br, txd);
+#endif
 
return 1;
 }
@@ -586,6 +602,7 @@ hn_txdesc_get(struct hn_tx_ring *txr)
 {
struct hn_txdesc *txd;
 
+#ifndef HN_USE_TXDESC_BUFRING
mtx_lock_spin(&txr->hn_txlist_spin);
txd = SLIST_FIRST(&txr->hn_txlist);
if (txd != NULL) {
@@ -595,8 +612,14 @@ hn_txdesc_get(struct hn_tx_ring *txr)
SLIST_REMOVE_HEAD(&txr->hn_txlist, link);
}
mtx_unlock_spin(&txr->hn_txlist_spin);
+#else
+   txd = buf_ring_dequeue_sc(txr->hn_txdesc_br);
+#endif
 
if (txd != NULL) {
+#ifdef HN_USE_TXDESC_BUFRING
+   atomic_subtract_int(&txr->hn_txdesc_avail, 1);
+#endif
KASSERT(txd->m == NULL && txd->refs == 0 &&
(txd->flags & HN_TXD_FLAG_ONLIST), ("invalid txd"));
txd->flags &= ~HN_TXD_FLAG_ONLIST;
@@ -2048,13 +2071,20 @@ hn_create_tx_ring(struct hn_softc *sc, i
 
txr->hn_sc = sc;
 
+#ifndef HN_USE_TXDESC_BUFRING
mtx_init(&txr->hn_txlist_spin, "hn txlist", NULL, MTX_SPIN);
+#endif
mtx_init(&txr->hn_tx_lock, "hn tx", NULL, MTX_DEF);
 
txr->hn_txdesc_cnt = HN_TX_DESC_CNT;
txr->hn_txdesc = malloc(sizeof(struct hn_txdesc) * txr->hn_txdesc_cnt,
M_NETVSC, M_WAITOK | M_ZERO);
+#ifndef HN_USE_TXDESC_BUFRING
SLIST_INIT(&txr->hn_txlist);
+#else
+   txr->hn_txdesc_br = buf_ring_alloc(txr->

Re: svn commit: r295739 - in head/sys: netinet sys

2016-02-17 Thread Sepherosa Ziehau
Sorry about the MFC note in the commit message.  This commit will
_not_ be MFCed.

Thanks,
sephe

On Thu, Feb 18, 2016 at 12:58 PM, Sepherosa Ziehau  wrote:
> Author: sephe
> Date: Thu Feb 18 04:58:34 2016
> New Revision: 295739
> URL: https://svnweb.freebsd.org/changeset/base/295739
>
> Log:
>   tcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit
>
>   ACK aggregation limit is append count based, while the TCP data segment
>   aggregation limit is length based.  Unless the network driver sets these
>   two limits, it's an NO-OP.
>
>   Reviewed by:  adrian, gallatin (previous version), hselasky (previous 
> version)
>   Approved by:  adrian (mentor)
>   MFC after:1 week
>   Sponsored by: Microsoft OSTC
>   Differential Revision:https://reviews.freebsd.org/D5185
>
> Modified:
>   head/sys/netinet/tcp_lro.c
>   head/sys/netinet/tcp_lro.h
>   head/sys/sys/param.h
>
> Modified: head/sys/netinet/tcp_lro.c
> ==
> --- head/sys/netinet/tcp_lro.c  Thu Feb 18 03:05:08 2016(r295738)
> +++ head/sys/netinet/tcp_lro.c  Thu Feb 18 04:58:34 2016(r295739)
> @@ -88,6 +88,8 @@ tcp_lro_init_args(struct lro_ctrl *lc, s
> lc->lro_mbuf_count = 0;
> lc->lro_mbuf_max = lro_mbufs;
> lc->lro_cnt = lro_entries;
> +   lc->lro_ackcnt_lim = TCP_LRO_ACKCNT_MAX;
> +   lc->lro_length_lim = TCP_LRO_LENGTH_MAX;
> lc->ifp = ifp;
> SLIST_INIT(&lc->lro_free);
> SLIST_INIT(&lc->lro_active);
> @@ -610,7 +612,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
> }
>
> /* Flush now if appending will result in overflow. */
> -   if (le->p_len > (65535 - tcp_data_len)) {
> +   if (le->p_len > (lc->lro_length_lim - tcp_data_len)) {
> SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
> tcp_lro_flush(lc, le);
> break;
> @@ -648,6 +650,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
>
> if (tcp_data_len == 0) {
> m_freem(m);
> +   /*
> +* Flush this LRO entry, if this ACK should not
> +* be further delayed.
> +*/
> +   if (le->append_cnt >= lc->lro_ackcnt_lim) {
> +   SLIST_REMOVE(&lc->lro_active, le, lro_entry,
> +   next);
> +   tcp_lro_flush(lc, le);
> +   }
> return (0);
> }
>
> @@ -668,7 +679,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
>  * If a possible next full length packet would cause an
>  * overflow, pro-actively flush now.
>  */
> -   if (le->p_len > (65535 - lc->ifp->if_mtu)) {
> +   if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) {
> SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
> tcp_lro_flush(lc, le);
> } else
>
> Modified: head/sys/netinet/tcp_lro.h
> ==
> --- head/sys/netinet/tcp_lro.h  Thu Feb 18 03:05:08 2016(r295738)
> +++ head/sys/netinet/tcp_lro.h  Thu Feb 18 04:58:34 2016(r295739)
> @@ -91,11 +91,16 @@ struct lro_ctrl {
> unsignedlro_cnt;
> unsignedlro_mbuf_count;
> unsignedlro_mbuf_max;
> +   unsigned short  lro_ackcnt_lim; /* max # of aggregated ACKs */
> +   unsignedlro_length_lim; /* max len of aggregated data 
> */
>
> struct lro_head lro_active;
> struct lro_head lro_free;
>  };
>
> +#defineTCP_LRO_LENGTH_MAX  65535
> +#defineTCP_LRO_ACKCNT_MAX  65535   /* unlimited */
> +
>  int tcp_lro_init(struct lro_ctrl *);
>  int tcp_lro_init_args(struct lro_ctrl *, struct ifnet *, unsigned, unsigned);
>  void tcp_lro_free(struct lro_ctrl *);
>
> Modified: head/sys/sys/param.h
> ==
> --- head/sys/sys/param.hThu Feb 18 03:05:08 2016(r295738)
> +++ head/sys/sys/param.hThu Feb 18 04:58:34 2016(r295739)
> @@ -58,7 +58,7 @@
>   * in the range 5 to 9.
>   */
>  #undef __FreeBSD_version
> -#define __FreeBSD_version 1100098  /* Master, propagated to newvers */
> +#define __FreeBSD_version 1100099  /* Master, propagated to newvers */
>
>  /*
>   * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
> ___
> svn-src-...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"



-- 
Tomorrow Will Never