svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Baptiste Daroussin
Author: bapt
Date: Tue Nov 10 08:11:27 2015
New Revision: 290637
URL: https://svnweb.freebsd.org/changeset/base/290637

Log:
  return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
  as it used to be in previous version of the locales. Returning
  "POSIX" has too many fallouts.

Modified:
  head/lib/libc/locale/nl_langinfo.c

Modified: head/lib/libc/locale/nl_langinfo.c
==
--- head/lib/libc/locale/nl_langinfo.c  Tue Nov 10 07:32:49 2015
(r290636)
+++ head/lib/libc/locale/nl_langinfo.c  Tue Nov 10 08:11:27 2015
(r290637)
@@ -71,7 +71,7 @@ nl_langinfo_l(nl_item item, locale_t loc
else if (strcmp(s, "MSKanji") == 0)
ret = "SJIS";
else if (strcmp(s, "NONE") == 0)
-   ret = "POSIX";
+   ret = "US-ASCII";
else if (strncmp(s, "NONE:", 5) == 0)
ret = (char *)(s + 5);
else
___
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: r290639 - in head/sys/dev/usb: . input

2015-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 09:27:52 2015
New Revision: 290639
URL: https://svnweb.freebsd.org/changeset/base/290639

Log:
  Update the wsp driver to support newer touch pads, like found in
  MacBookPro11,4 and MacBook12,1. This update adds support for the
  force touch parameter.
  
  PR:   204420
  MFC after:1 week

Modified:
  head/sys/dev/usb/input/wsp.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/input/wsp.c
==
--- head/sys/dev/usb/input/wsp.cTue Nov 10 08:39:07 2015
(r290638)
+++ head/sys/dev/usb/input/wsp.cTue Nov 10 09:27:52 2015
(r290639)
@@ -94,8 +94,8 @@ static struct wsp_tuning {
.z_factor = 5,
.pressure_touch_threshold = 50,
.pressure_untouch_threshold = 10,
-   .pressure_tap_threshold = 100,
-   .scr_hor_threshold = 10,
+   .pressure_tap_threshold = 120,
+   .scr_hor_threshold = 20,
 };
 
 static void
@@ -122,8 +122,6 @@ SYSCTL_INT(_hw_usb_wsp, OID_AUTO, pressu
 SYSCTL_INT(_hw_usb_wsp, OID_AUTO, scr_hor_threshold, CTLFLAG_RWTUN,
 &wsp_tuning.scr_hor_threshold, 0, "horizontal scrolling threshold");
 
-#defineWSP_IFACE_INDEX 1
-
 /*
  * Some tables, structures, definitions and constant values for the
  * touchpad protocol has been copied from Linux's
@@ -155,21 +153,30 @@ struct bt_data {
 enum tp_type {
TYPE1,  /* plain trackpad */
TYPE2,  /* button integrated in trackpad */
-   TYPE3   /* additional header fields since June 2013 */
+   TYPE3,  /* additional header fields since June 2013 */
+   TYPE4   /* additional header field for pressure data */
 };
 
 /* trackpad finger data offsets, le16-aligned */
 #defineFINGER_TYPE1(13 * 2)
 #defineFINGER_TYPE2(15 * 2)
 #defineFINGER_TYPE3(19 * 2)
+#defineFINGER_TYPE4(23 * 2)
 
 /* trackpad button data offsets */
 #defineBUTTON_TYPE215
 #defineBUTTON_TYPE323
+#defineBUTTON_TYPE431
 
 /* list of device capability bits */
 #defineHAS_INTEGRATED_BUTTON   1
 
+/* trackpad finger data block size */
+#define FSIZE_TYPE1 (14 * 2)
+#define FSIZE_TYPE2 (14 * 2)
+#define FSIZE_TYPE3 (14 * 2)
+#define FSIZE_TYPE4 (15 * 2)
+
 /* trackpad finger header - little endian */
 struct tp_header {
uint8_t flag;
@@ -197,9 +204,10 @@ struct tp_finger {
int16_t orientation;/* 16384 when point, else 15 bit angle 
*/
int16_t touch_major;/* touch area, major axis */
int16_t touch_minor;/* touch area, minor axis */
-   int16_t unused[3];  /* zeros */
+   int16_t unused[2];  /* zeros */
+   int16_t pressure;   /* pressure on forcetouch touchpad */
int16_t multi;  /* one finger: varies, more fingers:
-* constant */
+* constant */
 } __packed;
 
 /* trackpad finger data size, empirically at least ten fingers */
@@ -207,7 +215,7 @@ struct tp_finger {
 #defineSIZEOF_FINGER   sizeof(struct tp_finger)
 #defineSIZEOF_ALL_FINGERS  (MAX_FINGERS * SIZEOF_FINGER)
 
-#if (WSP_BUFFER_MAX < ((MAX_FINGERS * 14 * 2) + FINGER_TYPE3))
+#if (WSP_BUFFER_MAX < ((MAX_FINGERS * FSIZE_TYPE4) + FINGER_TYPE4))
 #error "WSP_BUFFER_MAX is too small"
 #endif
 
@@ -224,6 +232,7 @@ enum {
WSP_FLAG_WELLSPRING7,
WSP_FLAG_WELLSPRING7A,
WSP_FLAG_WELLSPRING8,
+   WSP_FLAG_WELLSPRING9,
WSP_FLAG_MAX,
 };
 
@@ -231,69 +240,213 @@ enum {
 struct wsp_dev_params {
uint8_t caps;   /* device capability bitmask */
uint8_t tp_type;/* type of trackpad interface */
+   uint8_t tp_button;  /* offset to button data */
uint8_t tp_offset;  /* offset to trackpad finger data */
+   uint8_t tp_fsize;   /* bytes in single finger block */
+   uint8_t tp_delta;   /* offset from header to finger struct 
*/
+   uint8_t iface_index;
+   uint8_t um_size;/* usb control message length */
+   uint8_t um_req_val; /* usb control message value */
+   uint8_t um_req_idx; /* usb control message index */
+   uint8_t um_switch_idx;  /* usb control message mode switch 
index */
+   uint8_t um_switch_on;   /* usb control message mode switch on */
+   uint8_t um_switch_off;  /* usb control message mode switch off 
*/
 };
 
 static const struct wsp_dev_params wsp_dev_params[WSP_FLAG_MAX] = {
[WSP_FLAG_WELLSPRING1] = {
.caps = 0,
.tp_type = TYPE1,
+

svn commit: r290640 - head

2015-11-10 Thread Dag-Erling Smørgrav
Author: des
Date: Tue Nov 10 10:49:26 2015
New Revision: 290640
URL: https://svnweb.freebsd.org/changeset/base/290640

Log:
  Upgrade my claim on fetch and libfetch since people don't seem to give a
  hoot about "advance notification requested".

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSTue Nov 10 09:27:52 2015(r290639)
+++ head/MAINTAINERSTue Nov 10 10:49:26 2015(r290640)
@@ -45,8 +45,8 @@ isci(4)   jimharris   Pre-commit review req
 nvme(4)jimharris   Pre-commit review requested.
 nvd(4) jimharris   Pre-commit review requested.
 nvmecontrol(8) jimharris   Pre-commit review requested.
-libfetch   des Advance notification requested.
-fetch  des Advance notification requested.
+libfetch   des Pre-commit review requested.
+fetch  des Pre-commit review requested.
 libpam des Pre-commit review requested.
 opensshdes Pre-commit review requested.
 pseudofs   des Pre-commit review requested.
___
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"


Re: svn commit: r288217 - head/lib/libfetch

2015-11-10 Thread Dag-Erling Smørgrav
Michael Gmelin  writes:
> Log:
>   Fix non-POSIX-compliant use of getaddrinfo in libfetch
>   
>   Submitted by:   Boris Kolpackov 
>   Reviewed by:bapt
>   Approved by:bapt
>   MFC after:  1 week
>   Differential Revision:  https://reviews.freebsd.org/D3724

Not reviewed by:des

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r290641 - head/sys/dev/e1000

2015-11-10 Thread Michael Tuexen
Author: tuexen
Date: Tue Nov 10 10:55:57 2015
New Revision: 290641
URL: https://svnweb.freebsd.org/changeset/base/290641

Log:
  Add support for SCTP checksum offloading for the 82580 controller
  similar to the 82576 controller.
  Tested with Intel i340 cards.
  
  Reviewed by:  erj@
  MFC after:1 week

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

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Tue Nov 10 10:49:26 2015(r290640)
+++ head/sys/dev/e1000/if_igb.c Tue Nov 10 10:55:57 2015(r290641)
@@ -1258,7 +1258,8 @@ igb_init_locked(struct adapter *adapter)
if (ifp->if_capenable & IFCAP_TXCSUM) {
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
 #if __FreeBSD_version >= 80
-   if (adapter->hw.mac.type == e1000_82576)
+   if ((adapter->hw.mac.type == e1000_82576) ||
+   (adapter->hw.mac.type == e1000_82580))
ifp->if_hwassist |= CSUM_SCTP;
 #endif
}
@@ -4681,8 +4682,9 @@ igb_initialize_receive_units(struct adap
rxcsum |= E1000_RXCSUM_PCSD;
 #if __FreeBSD_version >= 80
/* For SCTP Offload */
-   if ((hw->mac.type == e1000_82576)
-   && (ifp->if_capenable & IFCAP_RXCSUM))
+   if (((hw->mac.type == e1000_82576) ||
+(hw->mac.type == e1000_82580)) &&
+   (ifp->if_capenable & IFCAP_RXCSUM))
rxcsum |= E1000_RXCSUM_CRCOFL;
 #endif
} else {
@@ -4690,7 +4692,8 @@ igb_initialize_receive_units(struct adap
if (ifp->if_capenable & IFCAP_RXCSUM) {
rxcsum |= E1000_RXCSUM_IPPCSE;
 #if __FreeBSD_version >= 80
-   if (adapter->hw.mac.type == e1000_82576)
+   if ((adapter->hw.mac.type == e1000_82576) ||
+   (adapter->hw.mac.type == e1000_82580))
rxcsum |= E1000_RXCSUM_CRCOFL;
 #endif
} else
___
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: r290642 - head/sys/contrib/vchiq/interface/vchiq_arm

2015-11-10 Thread Svatopluk Kraus
Author: skra
Date: Tue Nov 10 10:56:52 2015
New Revision: 290642
URL: https://svnweb.freebsd.org/changeset/base/290642

Log:
  Fix slots DMA memory handling. It's similar to r290553.
  
  Discussed with:   gonzo
  Approved by:  kib (mentor)

Modified:
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
==
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Tue Nov 10 
10:55:57 2015(r290641)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Tue Nov 10 
10:56:52 2015(r290642)
@@ -213,10 +213,10 @@ vchiq_platform_init(VCHIQ_STATE_T *state
 
 failed_vchiq_init:
 failed_init_slots:
-failed_load:
bus_dmamap_unload(bcm_slots_dma_tag, bcm_slots_dma_map);
+failed_load:
+   bus_dmamem_free(bcm_slots_dma_tag, g_slot_mem, bcm_slots_dma_map);
 failed_alloc:
-   bus_dmamap_destroy(bcm_slots_dma_tag, bcm_slots_dma_map);
bus_dma_tag_destroy(bcm_slots_dma_tag);
 
return err;
@@ -227,7 +227,7 @@ vchiq_platform_exit(VCHIQ_STATE_T *state
 {
 
bus_dmamap_unload(bcm_slots_dma_tag, bcm_slots_dma_map);
-   bus_dmamap_destroy(bcm_slots_dma_tag, bcm_slots_dma_map);
+   bus_dmamem_free(bcm_slots_dma_tag, g_slot_mem, bcm_slots_dma_map);
bus_dma_tag_destroy(bcm_slots_dma_tag);
 }
 
___
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: r290643 - head

2015-11-10 Thread Garrett Cooper
Author: ngie
Date: Tue Nov 10 10:59:40 2015
New Revision: 290643
URL: https://svnweb.freebsd.org/changeset/base/290643

Log:
  - Move the testing entries up for netbsd-tests/pjdfstest
  - Add pjd to contrib/pjdfstest
  - Add atf to the list; add jmmv
  - Add tests
  - Add share/mk/*.test.mk

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSTue Nov 10 10:56:52 2015(r290642)
+++ head/MAINTAINERSTue Nov 10 10:59:40 2015(r290643)
@@ -57,6 +57,11 @@ contrib/libc++   dim Pre-commit review pr
 contrib/libcxxrt   dim Pre-commit review preferred.
 contrib/llvm   dim Pre-commit review preferred.
 contrib/llvm/tools/lldbemaste  Pre-commit review preferred.
+atffreebsd-testing,jmmv,ngie   Pre-commit review 
requested.
+contrib/netbsd-tests   freebsd-testing,ngiePre-commit review requested.
+contrib/pjdfstest  freebsd-testing,ngie,pjdPre-commit review 
requested.
+share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too)
Pre-commit review requested.
+tests  freebsd-testing,ngiePre-commit review requested.
  OLD 
 libc/posix1e   rwatson Pre-commit review requested.
 POSIX.1e ACLs  rwatson Pre-commit review requested.
@@ -103,8 +108,6 @@ contrib/pf  glebius Pre-commit review rec
 file   obrien  Insists to keep file blocked from other's unapproved
commits
 contrib/bzip2  obrien  Pre-commit review required.
-contrib/netbsd-tests   freebsd-testing,ngiePre-commit review requested.
-contrib/pjdfstest  freebsd-testing,ngiePre-commit review requested.
 geom   freebsd-g...@freebsd.org
 geom_concatpjd Pre-commit review preferred.
 geom_eli   pjd Pre-commit review preferred.
___
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: r290644 - head

2015-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 11:04:23 2015
New Revision: 290644
URL: https://svnweb.freebsd.org/changeset/base/290644

Log:
  Renew my MAINTAINERS entries.

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSTue Nov 10 10:59:40 2015(r290643)
+++ head/MAINTAINERSTue Nov 10 11:04:23 2015(r290644)
@@ -62,6 +62,9 @@ contrib/netbsd-tests  freebsd-testing,ngi
 contrib/pjdfstest  freebsd-testing,ngie,pjdPre-commit review 
requested.
 share/mk/*.test.mk freebsd-testing,ngie (same list as share/mk too)
Pre-commit review requested.
 tests  freebsd-testing,ngiePre-commit review requested.
+sys/dev/usbhselaskyIf in doubt, ask.
+sys/dev/sound/usb  hselaskyIf in doubt, ask.
+sys/compat/linuxkpihselaskyIf in doubt, ask.
  OLD 
 libc/posix1e   rwatson Pre-commit review requested.
 POSIX.1e ACLs  rwatson Pre-commit review requested.
@@ -126,9 +129,6 @@ linux emul  emulation   Please discuss chan
 bs{diff,patch} cpercivaPre-commit review requested.
 portsnap   cpercivaPre-commit review requested.
 freebsd-update cpercivaPre-commit review requested.
-sys/dev/usbhselaskyIf in doubt, ask.
-sys/dev/sound/usb  hselaskyIf in doubt, ask.
-sys/compat/linuxkpihselaskyIf in doubt, ask.
 sys/netgraph/bluetooth emaxPre-commit review preferred.
 lib/libbluetooth   emaxPre-commit review preferred.
 lib/libsdp emaxPre-commit review preferred.
___
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: r290645 - head/usr.sbin/bootparamd/bootparamd

2015-11-10 Thread Garrett Cooper
Author: ngie
Date: Tue Nov 10 11:19:36 2015
New Revision: 290645
URL: https://svnweb.freebsd.org/changeset/base/290645

Log:
  Fix some trivial warnings with bootparamd/main.c
  
  - Convert K&R to something a bit less ancient
  - Remove an incorrect, duplicate prototype for bootparamprog_1(..)
  
  MFC after: 1 week
  PR: 71667
  Submitted by: bcran
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/bootparamd/bootparamd/main.c

Modified: head/usr.sbin/bootparamd/bootparamd/main.c
==
--- head/usr.sbin/bootparamd/bootparamd/main.c  Tue Nov 10 11:04:23 2015
(r290644)
+++ head/usr.sbin/bootparamd/bootparamd/main.c  Tue Nov 10 11:19:36 2015
(r290645)
@@ -36,13 +36,10 @@ in_addr_t route_addr = -1;
 struct sockaddr_in my_addr;
 char *bootpfile = "/etc/bootparams";
 
-extern  void bootparamprog_1();
 static void usage(void);
 
 int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
 {
SVCXPRT *transp;
struct hostent *he;
@@ -110,7 +107,7 @@ char **argv;
 }
 
 static void
-usage()
+usage(void)
 {
fprintf(stderr,
"usage: bootparamd [-d] [-s] [-r router] [-f bootparmsfile]\n");
___
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: r290646 - head/lib/libc/tests/gen

2015-11-10 Thread Garrett Cooper
Author: ngie
Date: Tue Nov 10 11:28:02 2015
New Revision: 290646
URL: https://svnweb.freebsd.org/changeset/base/290646

Log:
  Add missing licensing boilerplate to test-fnmatch.c
  
  Carry over licensing author info from fnmatch_test.c (jilles@)
  
  MFC after: 1 week
  X-MFC with: r290572
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libc/tests/gen/test-fnmatch.c

Modified: head/lib/libc/tests/gen/test-fnmatch.c
==
--- head/lib/libc/tests/gen/test-fnmatch.c  Tue Nov 10 11:19:36 2015
(r290645)
+++ head/lib/libc/tests/gen/test-fnmatch.c  Tue Nov 10 11:28:02 2015
(r290646)
@@ -1,3 +1,28 @@
+/*-
+ * Copyright (c) 2010 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
 
 #include 
 __FBSDID("$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: r290647 - head/sys/arm/arm

2015-11-10 Thread Michal Meloun
Author: mmel
Date: Tue Nov 10 11:45:41 2015
New Revision: 290647
URL: https://svnweb.freebsd.org/changeset/base/290647

Log:
  ARM: Improve robustness of locore_v6.S and fix errors.
  - boot page table is not allocated in data section, so must be
cleared before use
  - map only one section (1 MB) for SOCDEV mapping (*)
  - DSB must be used for ensuring of finishing TLB operations
  - Invalidate BTB when appropriate
  
  PR:   198360
  Reported by:  Daisuke Aoyama  (*)
  Approved by:  kib (mentor)

Modified:
  head/sys/arm/arm/locore-v6.S

Modified: head/sys/arm/arm/locore-v6.S
==
--- head/sys/arm/arm/locore-v6.STue Nov 10 11:28:02 2015
(r290646)
+++ head/sys/arm/arm/locore-v6.STue Nov 10 11:45:41 2015
(r290647)
@@ -142,9 +142,11 @@ ASENTRY_NP(_start)
orr r7, #CPU_CONTROL_AFLT_ENABLE
orr r7, #CPU_CONTROL_VECRELOC
mcr CP15_SCTLR(r7)
+   DSB
ISB
bl  dcache_inv_poc_all
mcr CP15_ICIALLU
+   DSB
ISB
 
/*
@@ -155,6 +157,14 @@ ASENTRY_NP(_start)
adr r0, Lpagetable
bl  translate_va_to_pa
 
+   /* Clear boot page table */
+   mov r1, r0
+   mov r2, L1_TABLE_SIZE
+   mov r3,#0
+1: str r3, [r1], #4
+   subsr2, #4
+   bgt 1b
+
/*
 * Map PA == VA
 */
@@ -174,9 +184,10 @@ ASENTRY_NP(_start)
bl  build_pagetables
 
 #if defined(SOCDEV_PA) && defined(SOCDEV_VA)
-   /* Create the custom map used for early_printf(). */
+   /* Create the custom map (1MB) used for early_printf(). */
ldr r1, =SOCDEV_PA
ldr r2, =SOCDEV_VA
+   mov r3, #1
bl  build_pagetables
 #endif
bl  init_mmu
@@ -300,7 +311,9 @@ ASENTRY_NP(init_mmu)
ISB
mcr CP15_TLBIALL/* Flush TLB */
mcr CP15_BPIALL /* Flush Branch predictor */
+   DSB
ISB
+
mov pc, lr
 END(init_mmu)
 
@@ -328,6 +341,7 @@ ASENTRY_NP(reinit_mmu)
bl  dcache_inv_pou_all
 #endif
mcr CP15_ICIALLU
+   DSB
ISB
 
/* Set auxiliary register */
@@ -336,6 +350,7 @@ ASENTRY_NP(reinit_mmu)
eor r8, r8, r6  /* Set bits */
teq r7, r8
mcrne   CP15_ACTLR(r8)
+   DSB
ISB
 
/* Enable caches. */
@@ -350,8 +365,8 @@ ASENTRY_NP(reinit_mmu)
DSB
ISB
 
-   /* Flush all TLBs */
-   mcr CP15_TLBIALL
+   mcr CP15_TLBIALL/* Flush TLB */
+   mcr CP15_BPIALL /* Flush Branch predictor */
DSB
ISB
 
@@ -362,6 +377,7 @@ ASENTRY_NP(reinit_mmu)
bl  dcache_inv_pou_all
 #endif
mcr CP15_ICIALLU
+   DSB
ISB
 
pop {r4-r11, pc}
@@ -453,11 +469,13 @@ ASENTRY_NP(mpentry)
orr r0, #CPU_CONTROL_AFLT_ENABLE
orr r0, #CPU_CONTROL_VECRELOC
mcr CP15_SCTLR(r0)
+   DSB
ISB
 
/* Invalidate L1 cache I+D cache */
bl  dcache_inv_pou_all
mcr CP15_ICIALLU
+   DSB
ISB
 
/* Find the delta between VA and PA */
___
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: r290648 - head/sys/arm/include

2015-11-10 Thread Michal Meloun
Author: mmel
Date: Tue Nov 10 12:02:41 2015
New Revision: 290648
URL: https://svnweb.freebsd.org/changeset/base/290648

Log:
  ARM: Remove trailing whitespace from sys/arm/include
  No functional changes.
  
  Approved by:kib (mentor)

Modified:
  head/sys/arm/include/_stdint.h
  head/sys/arm/include/armreg.h
  head/sys/arm/include/asm.h
  head/sys/arm/include/atags.h
  head/sys/arm/include/atomic-v4.h
  head/sys/arm/include/board.h
  head/sys/arm/include/bus.h
  head/sys/arm/include/cpufunc.h
  head/sys/arm/include/devmap.h
  head/sys/arm/include/disassem.h
  head/sys/arm/include/endian.h
  head/sys/arm/include/pcb.h
  head/sys/arm/include/pcpu.h
  head/sys/arm/include/physmem.h
  head/sys/arm/include/pl310.h

Modified: head/sys/arm/include/_stdint.h
==
--- head/sys/arm/include/_stdint.h  Tue Nov 10 11:45:41 2015
(r290647)
+++ head/sys/arm/include/_stdint.h  Tue Nov 10 12:02:41 2015
(r290648)
@@ -139,7 +139,7 @@
  * 7.18.3  Limits of other integer types
  */
 /* Limits of ptrdiff_t. */
-#definePTRDIFF_MIN INT32_MIN   
+#definePTRDIFF_MIN INT32_MIN
 #definePTRDIFF_MAX INT32_MAX
 
 /* Limits of sig_atomic_t. */

Modified: head/sys/arm/include/armreg.h
==
--- head/sys/arm/include/armreg.h   Tue Nov 10 11:45:41 2015
(r290647)
+++ head/sys/arm/include/armreg.h   Tue Nov 10 12:02:41 2015
(r290648)
@@ -285,7 +285,7 @@
* in r0 steppings. See errata
* 364296.
*/
-/* ARM1176 Auxiliary Control Register (CP15 register 1, opcode2 1) */   
+/* ARM1176 Auxiliary Control Register (CP15 register 1, opcode2 1) */
 #defineARM1176_AUXCTL_PHD  0x1000 /* inst. prefetch halting 
disable */
 #defineARM1176_AUXCTL_BFD  0x2000 /* branch folding disable */
 #defineARM1176_AUXCTL_FSD  0x4000 /* force speculative ops 
disable */

Modified: head/sys/arm/include/asm.h
==
--- head/sys/arm/include/asm.h  Tue Nov 10 11:45:41 2015(r290647)
+++ head/sys/arm/include/asm.h  Tue Nov 10 12:02:41 2015(r290648)
@@ -167,7 +167,7 @@
 #else
 #define __FBSDID(s) /* nothing */
 #endif
-   
+
 
 #defineWEAK_ALIAS(alias,sym)   
\
.weak alias;\

Modified: head/sys/arm/include/atags.h
==
--- head/sys/arm/include/atags.hTue Nov 10 11:45:41 2015
(r290647)
+++ head/sys/arm/include/atags.hTue Nov 10 12:02:41 2015
(r290648)
@@ -64,7 +64,7 @@ struct arm_lbabi_core
uint32_t pagesize;
uint32_t rootdev;
 };
-   
+
 /*
  * ATAG_MEM data -- Can be more than one to describe different
  * banks.
@@ -75,7 +75,7 @@ struct arm_lbabi_mem32
uint32_t start; /* start of physical memory */
 };
 
-/* 
+/*
  * ATAG_INITRD2 - Compressed ramdisk image details
  */
 struct arm_lbabi_initrd
@@ -92,7 +92,7 @@ struct arm_lbabi_serial_number
uint32_t low;
uint32_t high;
 };
-   
+
 /*
  * ATAG_REVISION - board revision
  */
@@ -100,7 +100,7 @@ struct arm_lbabi_revision
 {
uint32_t rev;
 };
-   
+
 /*
  * ATAG_CMDLINE - Command line from uboot
  */
@@ -109,7 +109,7 @@ struct arm_lbabi_command_line
char command[1];/* Minimum command length */
 };
 
-struct arm_lbabi_tag 
+struct arm_lbabi_tag
 {
struct arm_lbabi_header tag_hdr;
union {

Modified: head/sys/arm/include/atomic-v4.h
==
--- head/sys/arm/include/atomic-v4.hTue Nov 10 11:45:41 2015
(r290647)
+++ head/sys/arm/include/atomic-v4.hTue Nov 10 12:02:41 2015
(r290648)
@@ -116,7 +116,7 @@ static __inline u_int32_t
 atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile 
u_int32_t newval)
 {
int ret;
-   
+
__with_interrupts_disabled(
 {
if (*p == cmpval) {
@@ -133,7 +133,7 @@ static __inline u_int64_t
 atomic_cmpset_64(volatile u_int64_t *p, volatile u_int64_t cmpval, volatile 
u_int64_t newval)
 {
int ret;
-   
+
__with_interrupts_disabled(
 {
if (*p == cmpval) {

Modified: head/sys/arm/include/board.h
==
--- head/sys/arm/include/board.hTue Nov 10 11:45:41 2015
(r290647)
+++ head/sys/arm/include/board.hTue Nov 10 12:02:41 2015
(r290648)
@@ -37,7 +37,7 @@ struct arm_board {
  

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

2015-11-10 Thread Konstantin Belousov
Author: kib
Date: Tue Nov 10 12:15:13 2015
New Revision: 290649
URL: https://svnweb.freebsd.org/changeset/base/290649

Log:
  Implement atomic_testandset_{32,int,long,64} for ARMv6.  Only
  little-endian configuration for 64-bit variant is supported.
  
  Reviewed by:  mmel
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D4113

Modified:
  head/sys/arm/include/atomic-v6.h

Modified: head/sys/arm/include/atomic-v6.h
==
--- head/sys/arm/include/atomic-v6.hTue Nov 10 12:02:41 2015
(r290648)
+++ head/sys/arm/include/atomic-v6.hTue Nov 10 12:15:13 2015
(r290649)
@@ -593,6 +593,54 @@ atomic_store_rel_long(volatile u_long *p
*p = v;
 }
 
+static __inline int
+atomic_testandset_32(volatile uint32_t *p, u_int v)
+{
+   uint32_t tmp, tmp2, res, mask;
+
+   mask = 1u << (v & 0x1f);
+   tmp = tmp2 = 0;
+   __asm __volatile(
+   "1: ldrex   %0, [%4]\n"
+   "   orr %1, %0, %3  \n"
+   "   strex   %2, %1, [%4]\n"
+   "   cmp %2, #0  \n"
+   "   it  ne  \n"
+   "   bne 1b  \n"
+   : "=&r" (res), "=&r" (tmp), "=&r" (tmp2)
+   : "r" (mask), "r" (p)
+   : "cc", "memory");
+   return ((res & mask) != 0);
+}
+
+static __inline int
+atomic_testandset_int(volatile u_int *p, u_int v)
+{
+
+   return (atomic_testandset_32((volatile uint32_t *)p, v));
+}
+
+static __inline int
+atomic_testandset_long(volatile u_long *p, u_int v)
+{
+
+   return (atomic_testandset_32((volatile uint32_t *)p, v));
+}
+
+static __inline int
+atomic_testandset_64(volatile uint64_t *p, u_int v)
+{
+   volatile uint32_t *p32;
+
+   p32 = (volatile uint32_t *)p;
+   /* Assume little-endian */
+   if (v >= 32) {
+   v &= 0x1f;
+   p32++;
+   }
+   return (atomic_testandset_32(p32, v));
+}
+
 #undef ATOMIC_ACQ_REL
 #undef ATOMIC_ACQ_REL_LONG
 
___
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: r290650 - in head/sys: dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 modules/mlx5en

2015-11-10 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Nov 10 12:20:22 2015
New Revision: 290650
URL: https://svnweb.freebsd.org/changeset/base/290650

Log:
  Add mlx5 and mlx5en driver(s) for ConnectX-4 and ConnectX-4LX cards
  from Mellanox Technologies. The current driver supports ethernet
  speeds up to and including 100 GBit/s. Infiniband support will be
  done later.
  
  The code added is not compiled by default, which will be done by a
  separate commit.
  
  Sponsored by: Mellanox Technologies
  MFC after:2 weeks

Added:
  head/sys/dev/mlx5/
  head/sys/dev/mlx5/cq.h   (contents, props changed)
  head/sys/dev/mlx5/device.h   (contents, props changed)
  head/sys/dev/mlx5/doorbell.h   (contents, props changed)
  head/sys/dev/mlx5/driver.h   (contents, props changed)
  head/sys/dev/mlx5/flow_table.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/
  head/sys/dev/mlx5/mlx5_core/mlx5_alloc.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_core.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_cq.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_eq.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_flow_table.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_fw.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_health.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_mad.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_mcg.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_mr.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_pd.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_port.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_qp.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_srq.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_transobj.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_uar.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_vport.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/mlx5_wq.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/transobj.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_core/wq.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/
  head/sys/dev/mlx5/mlx5_en/en.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/tcp_tlro.c   (contents, props changed)
  head/sys/dev/mlx5/mlx5_en/tcp_tlro.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_ifc.h   (contents, props changed)
  head/sys/dev/mlx5/mlx5_rdma_if.h   (contents, props changed)
  head/sys/dev/mlx5/qp.h   (contents, props changed)
  head/sys/dev/mlx5/srq.h   (contents, props changed)
  head/sys/dev/mlx5/vport.h   (contents, props changed)
  head/sys/modules/mlx5/
  head/sys/modules/mlx5/Makefile   (contents, props changed)
  head/sys/modules/mlx5en/
  head/sys/modules/mlx5en/Makefile   (contents, props changed)

Added: head/sys/dev/mlx5/cq.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/mlx5/cq.h  Tue Nov 10 12:20:22 2015(r290650)
@@ -0,0 +1,169 @@
+/*-
+ * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON 

Re: svn commit: r290610 - head/sys/x86/x86

2015-11-10 Thread Roger Pau Monné
El 09/11/15 a les 20.19, Ian Lepore ha escrit:
> On Mon, 2015-11-09 at 16:41 +0100, Roger Pau Monné wrote:
>> Hello,
>>
>> El 09/11/15 a les 13.30, Hans Petter Selasky ha escrit:
>>> On 11/09/15 13:19, Roger Pau Monné wrote:
 +if (dmat->common.flags & BUS_DMA_KEEP_PG_OFFSET) {
 +/*
 + * If we have to keep the offset of each page this
 function
 + * is not suitable, switch back to
 bus_dmamap_load_ma_triv
 + * which is going to do the right thing in this case.
 + */
 +error = bus_dmamap_load_ma_triv(dmat, map, ma, buflen,
 ma_offs,
 +flags, segs, segp);
 +return (error);
 +}
>>>
>>> Hi,
>>>
>>> There has been an update made to the USB stack, which is currently
>>> the
>>> only client of "BUS_DMA_KEEP_PG_OFFSET", which means this check can
>>
>> The only in-tree client. We don't know if there are other clients out
>> of
>> the tree.
>>
> 
> The BUS_DMA_KEEP_PG_OFFSET flag is not documented anywhere except in a
> short coment block near its #define which is less than 100% rigorous in
> specifying exactly what the flag even means.  For example it is
> documented as being a "hint" but also includes the word "must".  It
> doesn't say whether the flag is to be used to create a tag, to create a
> map, or to load a buffer.  It says the offset must be kept the same in
> the first segment but doesn't really fully explain what the USB
> requirements are (and the flag was added specifically for USB).
> 
> To me, all of that adds up to freedom to clarify the meaning of the
> flag in both code and documentation without a lot of worrying about out
> of tree code.  And the mips and arm busdma implementations are soon
> going to leverage that freedom into much better implementations based
> on the new understanding of what that flag really requires.

Maybe rename the flag to BUS_DMA_CONTIGUOUS_PG_OFFSET?

>>> probably be skipped or relaxed a bit. The condition which must be
>>> fullfilled is:
>>
>> So you basically want a contiguous bounce buffer. I don't think we
>> can
>> just change BUS_DMA_KEEP_PG_OFFSET to mean "use a contiguous bounce
>> buffer". Maybe a new flag could be introduced to describe this new
>> requirement and the old one deprecated.
>>
> 
> It's not "I want a contiguous buffer".  It is "I want contiguous
> offsets when transitioning between (potentially non-continguous)
> pages."  That grants you the freedom to bounce a couple different ways
> depending on what's most efficient for the platform and the situation.
> 
> For example, you can maintain the offset-within-page in the first
> segment and allow the offset in all subsequent pages (bounced or not)
> to be zero.  That's what all current implementations are doing, but it
> can require two full bounce pages to handle a 2-byte transfer that
> happens to be split across two pages (and yes that happens; it's not
> even rare in USB, as lots of DMA is done specifying buffers and
> variables on kernel stacks or in softc member variables).
> 
> It also allows for the possibility of changing the offset in the first
> segment if doing so avoids any page crossings at all (which handles
> everything from the 2-byte worst case to a 4096-byte buffer).

Yes, that's what I've now tried to do in x86:

https://reviews.freebsd.org/D4119

Change the offset in the first segment and then making sure everything
is contiguous in terms of offsets.

>>> #ifdef USB_DEBUG
>>> if (nseg > 1 &&
>>> ((segs->ds_addr + segs->ds_len) & (USB_PAGE_SIZE - 1))
>>> !=
>>> ((segs + 1)->ds_addr & (USB_PAGE_SIZE - 1))) {
>>> /*
>>>  * This check verifies there is no page offset hole
>>>  * between the first and second segment. See the
>>>  * BUS_DMA_KEEP_PG_OFFSET flag.
>>>  */
>>> DPRINTFN(0, "Page offset was not preserved\n");
>>> error = 1;
>>> goto done;
>>> }
>>> #endif
>>
>> AFAICT with the current bounce implementation on x86 you would have
>> to
>> specify an alignment of PAGE_SIZE in order to have this guarantee
>> without specifying BUS_DMA_KEEP_PG_OFFSET.
>>
>> IMHO, we should change all the current bounce buffer code and switch
>> to
>> use memdescs for everything (ie: bios and mbufs should use a memdesc
>> internally). Then each arch should provide functions to copy from the
>> different kinds of memdescs (either memdescs containing physical or
>> virtual memory), so the bounce code could be unified between all
>> arches.
>> Of course that's easier said than done...
>>
> 
> I completely disagree with this, mostly because I'm halfway through a
> set of changes that will make arm and mips bounce handling look
> completely different than x86 or other platforms.  That reflects the
> differences in underlying hardware that leads to completely different
> reasons for bouncing in the first place.

svn commit: r290651 - head/sys/dev/usb/wlan

2015-11-10 Thread Andriy Voskoboinyk
Author: avos
Date: Tue Nov 10 12:52:26 2015
New Revision: 290651
URL: https://svnweb.freebsd.org/changeset/base/290651

Log:
  urtwn(4): add IBSS mode support
  
  Tested with RTL8188EU, IBSS and STA modes.
  
  Reviewed by:  kevlo
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D4038

Modified:
  head/sys/dev/usb/wlan/if_urtwn.c
  head/sys/dev/usb/wlan/if_urtwnvar.h

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==
--- head/sys/dev/usb/wlan/if_urtwn.cTue Nov 10 12:20:22 2015
(r290650)
+++ head/sys/dev/usb/wlan/if_urtwn.cTue Nov 10 12:52:26 2015
(r290651)
@@ -228,10 +228,14 @@ static inturtwn_setup_beacon(struct ur
 static voidurtwn_update_beacon(struct ieee80211vap *, int);
 static int urtwn_tx_beacon(struct urtwn_softc *sc,
struct urtwn_vap *);
+static voidurtwn_tsf_task_adhoc(void *, int);
 static voidurtwn_tsf_sync_enable(struct urtwn_softc *,
struct ieee80211vap *);
 static voidurtwn_set_led(struct urtwn_softc *, int, int);
 static voidurtwn_set_mode(struct urtwn_softc *, uint8_t);
+static voidurtwn_ibss_recv_mgmt(struct ieee80211_node *,
+   struct mbuf *, int,
+   const struct ieee80211_rx_stats *, int, int);
 static int urtwn_newstate(struct ieee80211vap *,
enum ieee80211_state, int);
 static voidurtwn_watchdog(void *);
@@ -449,6 +453,7 @@ urtwn_attach(device_t self)
ic->ic_caps =
  IEEE80211_C_STA   /* station mode */
| IEEE80211_C_MONITOR   /* monitor mode */
+   | IEEE80211_C_IBSS  /* adhoc mode */
| IEEE80211_C_HOSTAP/* hostap mode */
| IEEE80211_C_SHPREAMBLE/* short preamble supported */
| IEEE80211_C_SHSLOT/* short slot time supported */
@@ -592,13 +597,18 @@ urtwn_vap_create(struct ieee80211com *ic
return (NULL);
}
 
-   if (opmode == IEEE80211_M_HOSTAP)
+   if (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS)
urtwn_init_beacon(sc, uvp);
 
/* override state transition machine */
uvp->newstate = vap->iv_newstate;
vap->iv_newstate = urtwn_newstate;
vap->iv_update_beacon = urtwn_update_beacon;
+   if (opmode == IEEE80211_M_IBSS) {
+   uvp->recv_mgmt = vap->iv_recv_mgmt;
+   vap->iv_recv_mgmt = urtwn_ibss_recv_mgmt;
+   TASK_INIT(&uvp->tsf_task_adhoc, 0, urtwn_tsf_task_adhoc, vap);
+   }
 
/* complete setup */
ieee80211_vap_attach(vap, ieee80211_media_change,
@@ -610,13 +620,13 @@ urtwn_vap_create(struct ieee80211com *ic
 static void
 urtwn_vap_delete(struct ieee80211vap *vap)
 {
+   struct ieee80211com *ic = vap->iv_ic;
struct urtwn_vap *uvp = URTWN_VAP(vap);
-   enum ieee80211_opmode opmode = vap->iv_opmode;
 
-   if (opmode == IEEE80211_M_HOSTAP) {
-   if (uvp->bcn_mbuf != NULL)
-   m_freem(uvp->bcn_mbuf);
-   }
+   if (uvp->bcn_mbuf != NULL)
+   m_freem(uvp->bcn_mbuf);
+   if (vap->iv_opmode == IEEE80211_M_IBSS)
+   ieee80211_draintask(ic, &uvp->tsf_task_adhoc);
ieee80211_vap_detach(vap);
free(uvp, M_80211_VAP);
 }
@@ -1611,8 +1621,50 @@ urtwn_tx_beacon(struct urtwn_softc *sc, 
 }
 
 static void
+urtwn_tsf_task_adhoc(void *arg, int pending)
+{
+   struct ieee80211vap *vap = arg;
+   struct urtwn_softc *sc = vap->iv_ic->ic_softc;
+   struct ieee80211_node *ni;
+   uint32_t reg;
+
+   URTWN_LOCK(sc);
+   ni = ieee80211_ref_node(vap->iv_bss);
+   reg = urtwn_read_1(sc, R92C_BCN_CTRL);
+
+   /* Accept beacons with the same BSSID. */
+   urtwn_set_rx_bssid_all(sc, 0);
+
+   /* Enable synchronization. */
+   reg &= ~R92C_BCN_CTRL_DIS_TSF_UDT0;
+   urtwn_write_1(sc, R92C_BCN_CTRL, reg);
+
+   /* Synchronize. */
+   usb_pause_mtx(&sc->sc_mtx, hz * ni->ni_intval * 5 / 1000);
+
+   /* Disable synchronization. */
+   reg |= R92C_BCN_CTRL_DIS_TSF_UDT0;
+   urtwn_write_1(sc, R92C_BCN_CTRL, reg);
+
+   /* Remove beacon filter. */
+   urtwn_set_rx_bssid_all(sc, 1);
+
+   /* Enable beaconing. */
+   urtwn_write_1(sc, R92C_MBID_NUM,
+   urtwn_read_1(sc, R92C_MBID_NUM) | R92C_MBID_TXBCN_RPT0);
+   reg |= R92C_BCN_CTRL_EN_BCN;
+
+   urtwn_write_1(sc, R92C_BCN_CTRL, reg);
+   ieee80211_free_node(ni);
+   URTWN_UNLOCK(sc);
+}
+
+static void
 urtwn_tsf_sync_enable(struct urtwn_softc *sc, struct ieee80211vap *vap)
 {
+   struct ieee80211com *ic = &sc->sc_ic;
+   struct urtwn_vap *uvp = URTWN_VAP(vap)

Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Andrey Chernov
On 10.11.2015 11:11, Baptiste Daroussin wrote:
> Author: bapt
> Date: Tue Nov 10 08:11:27 2015
> New Revision: 290637
> URL: https://svnweb.freebsd.org/changeset/base/290637
> 
> Log:
>   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
>   as it used to be in previous version of the locales. Returning
>   "POSIX" has too many fallouts.

You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
different with real US-ASCII. It is what glibc returns for C/POSIX
locale and most ports expected, being linux-oriented.

> 
> Modified:
>   head/lib/libc/locale/nl_langinfo.c
> 
> Modified: head/lib/libc/locale/nl_langinfo.c
> ==
> --- head/lib/libc/locale/nl_langinfo.cTue Nov 10 07:32:49 2015
> (r290636)
> +++ head/lib/libc/locale/nl_langinfo.cTue Nov 10 08:11:27 2015
> (r290637)
> @@ -71,7 +71,7 @@ nl_langinfo_l(nl_item item, locale_t loc
>   else if (strcmp(s, "MSKanji") == 0)
>   ret = "SJIS";
>   else if (strcmp(s, "NONE") == 0)
> - ret = "POSIX";
> + ret = "US-ASCII";
>   else if (strncmp(s, "NONE:", 5) == 0)
>   ret = (char *)(s + 5);
>   else
> 


-- 
http://ache.vniz.net/
___
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"


Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Baptiste Daroussin
On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
> On 10.11.2015 11:11, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Tue Nov 10 08:11:27 2015
> > New Revision: 290637
> > URL: https://svnweb.freebsd.org/changeset/base/290637
> > 
> > Log:
> >   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
> >   as it used to be in previous version of the locales. Returning
> >   "POSIX" has too many fallouts.
> 
> You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
> different with real US-ASCII. It is what glibc returns for C/POSIX
> locale and most ports expected, being linux-oriented.
> 
I thought about it, but in the end it is probably safer for now that nl_langinfo
return US-ASCII as it did in the past, to reduce breakage with FreeBSD only code
that maybe be existing ou there.

Best regards,
Bapt


signature.asc
Description: PGP signature


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

2015-11-10 Thread Svatopluk Kraus
Author: skra
Date: Tue Nov 10 13:15:34 2015
New Revision: 290655
URL: https://svnweb.freebsd.org/changeset/base/290655

Log:
  Fix pmap_fault(). It turned out that alignment abort may have higher
  priority than both translation and permission ones.
  
  Approved by:  kib (mentor)

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

Modified: head/sys/arm/arm/pmap-v6-new.c
==
--- head/sys/arm/arm/pmap-v6-new.c  Tue Nov 10 13:11:22 2015
(r290654)
+++ head/sys/arm/arm/pmap-v6-new.c  Tue Nov 10 13:15:34 2015
(r290655)
@@ -6152,8 +6152,9 @@ pmap_fault(pmap_t pmap, vm_offset_t far,
 * All L1 tables should always be mapped and present.
 * However, we check only current one herein. For user mode,
 * only permission abort from malicious user is not fatal.
+* And alignment abort as it may have higher priority.
 */
-   if (!usermode || (idx != FAULT_PERM_L2)) {
+   if (!usermode || (idx != FAULT_ALIGN && idx != FAULT_PERM_L2)) {
CTR4(KTR_PMAP, "%s: pmap %#x pm_pt1 %#x far %#x",
__func__, pmap, pmap->pm_pt1, far);
panic("%s: pm_pt1 abort", __func__);
@@ -6166,9 +6167,10 @@ pmap_fault(pmap_t pmap, vm_offset_t far,
 * L1 table. However, only existing L2 tables are mapped
 * in PT2MAP. For user mode, only L2 translation abort and
 * permission abort from malicious user is not fatal.
+* And alignment abort as it may have higher priority.
 */
-   if (!usermode ||
-   (idx != FAULT_TRAN_L2 && idx != FAULT_PERM_L2)) {
+   if (!usermode || (idx != FAULT_ALIGN &&
+   idx != FAULT_TRAN_L2 && idx != FAULT_PERM_L2)) {
CTR4(KTR_PMAP, "%s: pmap %#x PT2MAP %#x far %#x",
__func__, pmap, PT2MAP, far);
panic("%s: PT2MAP abort", __func__);
___
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: r290656 - head/sys/arm/include

2015-11-10 Thread Svatopluk Kraus
Author: skra
Date: Tue Nov 10 13:20:21 2015
New Revision: 290656
URL: https://svnweb.freebsd.org/changeset/base/290656

Log:
  Fix cp15 PAR definition and function. While here, add cp15 ATS1CPW
  function which checks an address for privileged (PL1) write access.
  The function is inlined so it does not bring any cost, but makes
  function set for checking privileged access complete.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/arm/include/cpu-v6.h
  head/sys/arm/include/sysreg.h

Modified: head/sys/arm/include/cpu-v6.h
==
--- head/sys/arm/include/cpu-v6.h   Tue Nov 10 13:15:34 2015
(r290655)
+++ head/sys/arm/include/cpu-v6.h   Tue Nov 10 13:20:21 2015
(r290656)
@@ -156,8 +156,9 @@ _RF0(cp15_l2ctlr_get, CP15_L2CTLR(%0))
 _RF0(cp15_actlr_get, CP15_ACTLR(%0))
 _WF1(cp15_actlr_set, CP15_ACTLR(%0))
 #if __ARM_ARCH >= 6
-_WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0));
-_RF0(cp15_par_get, CP15_PAR);
+_WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0))
+_WF1(cp15_ats1cpw_set, CP15_ATS1CPW(%0))
+_RF0(cp15_par_get, CP15_PAR(%0))
 _RF0(cp15_sctlr_get, CP15_SCTLR(%0))
 #endif
 

Modified: head/sys/arm/include/sysreg.h
==
--- head/sys/arm/include/sysreg.h   Tue Nov 10 13:15:34 2015
(r290655)
+++ head/sys/arm/include/sysreg.h   Tue Nov 10 13:20:21 2015
(r290656)
@@ -130,7 +130,7 @@
 #defineCP15_BPIALLIS   p15, 0, r0, c7, c1,  6 /* Branch 
predictor invalidate all IS */
 #endif
 
-#defineCP15_PARp15, 0, r0, c7, c4,  0 /* Physical 
Address Register */
+#defineCP15_PAR(rr)p15, 0, rr, c7, c4,  0 /* Physical 
Address Register */
 
 #defineCP15_ICIALLUp15, 0, r0, c7, c5,  0 /* Instruction 
cache invalidate all PoU */
 #defineCP15_ICIMVAU(rr)p15, 0, rr, c7, c5,  1 /* Instruction 
cache invalidate */
___
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"


Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Andrey Chernov
On 10.11.2015 16:04, Baptiste Daroussin wrote:
> On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
>> On 10.11.2015 11:11, Baptiste Daroussin wrote:
>>> Author: bapt
>>> Date: Tue Nov 10 08:11:27 2015
>>> New Revision: 290637
>>> URL: https://svnweb.freebsd.org/changeset/base/290637
>>>
>>> Log:
>>>   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
>>>   as it used to be in previous version of the locales. Returning
>>>   "POSIX" has too many fallouts.
>>
>> You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
>> different with real US-ASCII. It is what glibc returns for C/POSIX
>> locale and most ports expected, being linux-oriented.
>>
> I thought about it, but in the end it is probably safer for now that 
> nl_langinfo
> return US-ASCII as it did in the past, to reduce breakage with FreeBSD only 
> code
> that maybe be existing ou there.

All FreeBSD code I know never check locale this way. IMHO probability of
potential danger to meet some linux-oriented port with this check is
much much higher than to meet similar FreeBSD only code in the wild. In
any case, changing collate order from A-Za-z to aA-zZ we do just now
have much higher probability to break unknown FreeBSD only code, so one
breaking change can go with other one together.

-- 
http://ache.vniz.net/



signature.asc
Description: OpenPGP digital signature


svn commit: r290659 - in head: share/man/man4 share/man/man5 tools/build/mk

2015-11-10 Thread Garrett Cooper
Author: ngie
Date: Tue Nov 10 13:28:41 2015
New Revision: 290659
URL: https://svnweb.freebsd.org/changeset/base/290659

Log:
  - Move ng_bluetooth.4 under MK_BLUETOOTH != no
  - Move all section 5 bluetooth manpages under MK_BLUETOOTH != no
  
  MFC after: 3 days
  PR: 193260
  Reported by: Philippe Michel 
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/man/man4/Makefile
  head/share/man/man5/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Nov 10 13:27:02 2015
(r290658)
+++ head/share/man/man4/MakefileTue Nov 10 13:28:41 2015
(r290659)
@@ -311,7 +311,6 @@ MAN=aac.4 \
ng_atm.4 \
ngatmbase.4 \
ng_atmllc.4 \
-   ng_bluetooth.4 \
ng_bpf.4 \
ng_bridge.4 \
ng_bt3c.4 \
@@ -821,6 +820,10 @@ _bhyve.4=  bhyve.4
 .endif
 .endif
 
+.if ${MK_BLUETOOTH} != "no"
+MAN+=  ng_bluetooth.4
+.endif
+
 .if ${MACHINE_CPUARCH} == "mips"
 _nvram2env.4=  nvram2env.4
 .endif

Modified: head/share/man/man5/Makefile
==
--- head/share/man/man5/MakefileTue Nov 10 13:27:02 2015
(r290658)
+++ head/share/man/man5/MakefileTue Nov 10 13:28:41 2015
(r290659)
@@ -7,9 +7,6 @@
 MAN=   acct.5 \
ar.5 \
a.out.5 \
-   bluetooth.device.conf.5 \
-   bluetooth.hosts.5 \
-   bluetooth.protocols.5 \
${_boot.config.5} \
core.5 \
devfs.5 \
@@ -84,6 +81,12 @@ MLINKS+=src.conf.5 src-env.conf.5
 MAN+=  autofs.5
 .endif
 
+.if ${MK_BLUETOOTH} != "no"
+MAN+=  bluetooth.device.conf.5 \
+   bluetooth.hosts.5 \
+   bluetooth.protocols.5
+.endif
+
 .if ${MK_FREEBSD_UPDATE} != "no"
 MAN+=  freebsd-update.conf.5
 .endif

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Nov 10 13:27:02 
2015(r290658)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Nov 10 13:28:41 
2015(r290659)
@@ -517,6 +517,10 @@ OLD_FILES+=usr/share/man/man3/sdp_regist
 OLD_FILES+=usr/share/man/man3/sdp_search.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_unregister_service.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_uuid2desc.3.gz
+OLD_FILES+=usr/share/man/man4/ng_bluetooth.4.gz
+OLD_FILES+=usr/share/man/man5/bluetooth.device.conf.5.gz
+OLD_FILES+=usr/share/man/man5/bluetooth.hosts.5.gz
+OLD_FILES+=usr/share/man/man5/bluetooth.protocols.5.gz
 OLD_FILES+=usr/share/man/man5/hcsecd.conf.5.gz
 OLD_FILES+=usr/share/man/man8/ath3kfw.8.gz
 OLD_FILES+=usr/share/man/man8/bcmfw.8.gz
___
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: r290660 - head/share/man/man4

2015-11-10 Thread Garrett Cooper
Author: ngie
Date: Tue Nov 10 13:32:05 2015
New Revision: 290660
URL: https://svnweb.freebsd.org/changeset/base/290660

Log:
  Move the MK_BLUETOOTH block down below the architecture specific sections by 
the
  other generic options
  
  MFC after: 3 days
  X-MFC with: r290659
  PR: 193260
  Sponsored by: EMC / Isilon Storage Divisions

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileTue Nov 10 13:28:41 2015
(r290659)
+++ head/share/man/man4/MakefileTue Nov 10 13:32:05 2015
(r290660)
@@ -820,10 +820,6 @@ _bhyve.4=  bhyve.4
 .endif
 .endif
 
-.if ${MK_BLUETOOTH} != "no"
-MAN+=  ng_bluetooth.4
-.endif
-
 .if ${MACHINE_CPUARCH} == "mips"
 _nvram2env.4=  nvram2env.4
 .endif
@@ -832,6 +828,10 @@ _nvram2env.4=  nvram2env.4
 SUBDIR=man4.${MACHINE_CPUARCH}
 .endif
 
+.if ${MK_BLUETOOTH} != "no"
+MAN+=  ng_bluetooth.4
+.endif
+
 .if ${MK_CCD} != "no"
 _ccd.4=ccd.4
 .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"


Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Baptiste Daroussin
On Tue, Nov 10, 2015 at 04:20:38PM +0300, Andrey Chernov wrote:
> On 10.11.2015 16:04, Baptiste Daroussin wrote:
> > On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
> >> On 10.11.2015 11:11, Baptiste Daroussin wrote:
> >>> Author: bapt
> >>> Date: Tue Nov 10 08:11:27 2015
> >>> New Revision: 290637
> >>> URL: https://svnweb.freebsd.org/changeset/base/290637
> >>>
> >>> Log:
> >>>   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
> >>>   as it used to be in previous version of the locales. Returning
> >>>   "POSIX" has too many fallouts.
> >>
> >> You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
> >> different with real US-ASCII. It is what glibc returns for C/POSIX
> >> locale and most ports expected, being linux-oriented.
> >>
> > I thought about it, but in the end it is probably safer for now that 
> > nl_langinfo
> > return US-ASCII as it did in the past, to reduce breakage with FreeBSD only 
> > code
> > that maybe be existing ou there.
> 
> All FreeBSD code I know never check locale this way. IMHO probability of
> potential danger to meet some linux-oriented port with this check is
> much much higher than to meet similar FreeBSD only code in the wild. In
> any case, changing collate order from A-Za-z to aA-zZ we do just now
> have much higher probability to break unknown FreeBSD only code, so one
> breaking change can go with other one together.
> 
That is true, except that the new collation thing is invalidated as soon as you
set LC_COLLATE=C which bring your back to A-Za-z. So you have a workaround while
changing the return value of nl_langinfo() is not workaroundable.

---
Bapt


signature.asc
Description: PGP signature


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

2015-11-10 Thread Michal Meloun
Author: mmel
Date: Tue Nov 10 13:47:28 2015
New Revision: 290661
URL: https://svnweb.freebsd.org/changeset/base/290661

Log:
  ARM: Refactor interrupt_enable/disable/restore.
  Allow manipulation with PSR_A bit on ARMv6+.
  Remove declaration of unused functions.
  
  This effectively enables asynchronous aborts on early bootstrap stage,
  which previously was not enabled due to an error in enable_interrupts().
  
  PR:   201434
  Reported by:  Gregory Soutade 
  Approved by:  kib (mentor)

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

Modified: head/sys/arm/include/cpufunc.h
==
--- head/sys/arm/include/cpufunc.h  Tue Nov 10 13:32:05 2015
(r290660)
+++ head/sys/arm/include/cpufunc.h  Tue Nov 10 13:47:28 2015
(r290661)
@@ -47,6 +47,7 @@
 #ifdef _KERNEL
 
 #include 
+#include 
 #include 
 #include  /* For in[bwl] and out[bwl] */
 
@@ -520,45 +521,54 @@ void  xscalec3_context_switch (void);
 /*
  * Macros for manipulating CPU interrupts
  */
-static __inline u_int32_t __set_cpsr_c(u_int bic, u_int eor) 
__attribute__((__unused__));
+#if __ARM_ARCH < 6
+#define__ARM_INTR_BITS (PSR_I | PSR_F)
+#else
+#define__ARM_INTR_BITS (PSR_I | PSR_F | PSR_A)
+#endif
 
-static __inline u_int32_t
-__set_cpsr_c(u_int bic, u_int eor)
+static __inline uint32_t
+__set_cpsr(uint32_t bic, uint32_t eor)
 {
-   u_int32_t   tmp, ret;
+   uint32_ttmp, ret;
 
__asm __volatile(
-   "mrs %0, cpsr\n"/* Get the CPSR */
-   "bic %1, %0, %2\n"  /* Clear bits */
-   "eor %1, %1, %3\n"  /* XOR bits */
-   "msr cpsr_c, %1\n"  /* Set the control field of CPSR */
+   "mrs %0, cpsr\n"/* Get the CPSR */
+   "bic %1, %0, %2\n"  /* Clear bits */
+   "eor %1, %1, %3\n"  /* XOR bits */
+   "msr cpsr_xc, %1\n" /* Set the CPSR */
: "=&r" (ret), "=&r" (tmp)
: "r" (bic), "r" (eor) : "memory");
 
return ret;
 }
 
-#defineARM_CPSR_F32(1 << 6)/* FIQ disable */
-#defineARM_CPSR_I32(1 << 7)/* IRQ disable */
+static __inline uint32_t
+disable_interrupts(uint32_t mask)
+{
 
-#define disable_interrupts(mask)   \
-   (__set_cpsr_c((mask) & (ARM_CPSR_I32 | ARM_CPSR_F32),   \
- (mask) & (ARM_CPSR_I32 | ARM_CPSR_F32)))
-
-#define enable_interrupts(mask)
\
-   (__set_cpsr_c((mask) & (ARM_CPSR_I32 | ARM_CPSR_F32), 0))
-
-#define restore_interrupts(old_cpsr)   \
-   (__set_cpsr_c((ARM_CPSR_I32 | ARM_CPSR_F32),\
- (old_cpsr) & (ARM_CPSR_I32 | ARM_CPSR_F32)))
+   return (__set_cpsr(mask & __ARM_INTR_BITS, mask & __ARM_INTR_BITS));
+}
+
+static __inline uint32_t
+enable_interrupts(uint32_t mask)
+{
+
+   return (__set_cpsr(mask & __ARM_INTR_BITS, 0));
+}
+
+static __inline uint32_t
+restore_interrupts(uint32_t old_cpsr)
+{
+
+   return (__set_cpsr(__ARM_INTR_BITS, old_cpsr & __ARM_INTR_BITS));
+}
 
 static __inline register_t
 intr_disable(void)
 {
-   register_t s;
 
-   s = disable_interrupts(ARM_CPSR_I32 | ARM_CPSR_F32);
-   return (s);
+   return (disable_interrupts(PSR_I | PSR_F));
 }
 
 static __inline void
@@ -567,10 +577,7 @@ intr_restore(register_t s)
 
restore_interrupts(s);
 }
-
-/* Functions to manipulate the CPSR. */
-u_int  SetCPSR(u_int bic, u_int eor);
-u_int  GetCPSR(void);
+#undef __ARM_INTR_BITS
 
 /*
  * Functions to manipulate cpu r13
___
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: r290663 - in head/sys: modules modules/tests modules/tests/callout_test modules/tests/framework tests tests/callout_test tests/framework

2015-11-10 Thread Randall Stewart
Author: rrs
Date: Tue Nov 10 14:14:41 2015
New Revision: 290663
URL: https://svnweb.freebsd.org/changeset/base/290663

Log:
  Add a kernel test framework. The callout_test is a demonstration and will only
  work with the upcoming async-drain functionality. Tests can be added
  to the tests directory and then the framework can be used to launch
  those tests.
  
  MFC after:1 month
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D1755

Added:
  head/sys/modules/tests/
  head/sys/modules/tests/callout_test/
  head/sys/modules/tests/callout_test/Makefile   (contents, props changed)
  head/sys/modules/tests/framework/
  head/sys/modules/tests/framework/Makefile   (contents, props changed)
  head/sys/tests/
  head/sys/tests/callout_test/
  head/sys/tests/callout_test.h   (contents, props changed)
  head/sys/tests/callout_test/callout_test.c   (contents, props changed)
  head/sys/tests/framework/
  head/sys/tests/framework/kern_testfrwk.c   (contents, props changed)
  head/sys/tests/kern_testfrwk.h   (contents, props changed)
Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Nov 10 14:14:32 2015(r290662)
+++ head/sys/modules/Makefile   Tue Nov 10 14:14:41 2015(r290663)
@@ -343,6 +343,8 @@ SUBDIR= \
${_syscons} \
sysvipc \
${_ti} \
+   tests/framework \
+   tests/callout_test \
tl \
tmpfs \
${_toecore} \

Added: head/sys/modules/tests/callout_test/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/tests/callout_test/MakefileTue Nov 10 14:14:41 
2015(r290663)
@@ -0,0 +1,15 @@
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../../tests/callout_test
+
+KMOD=  callout_test
+SRCS=  callout_test.c
+
+#
+# Enable full debugging
+#
+#CFLAGS += -g
+
+.include 

Added: head/sys/modules/tests/framework/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/tests/framework/Makefile   Tue Nov 10 14:14:41 2015
(r290663)
@@ -0,0 +1,15 @@
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../../tests/framework
+
+KMOD=  kern_testfrwk
+SRCS=  kern_testfrwk.c
+
+#
+# Enable full debugging
+#
+#CFLAGS += -g
+
+.include 

Added: head/sys/tests/callout_test.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/tests/callout_test.h   Tue Nov 10 14:14:41 2015
(r290663)
@@ -0,0 +1,34 @@
+#ifndef __callout_test_h__
+#define __callout_test_h__
+/*-
+ * Copyright (c) 2015
+ * Netflix Incorporated, All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *__FBSDID("$FreeBSD$");
+ *
+ */
+struct callout_test {
+   int number_of_callouts;
+   int test_number;
+};
+#endif

Added: head/sys/tests/callout_test/callout_test.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/tests/callout_test/callout_test.c  Tue Nov 10 14:14:41 2015
(r290663)
@@ -0,0 +1,284 @@
+/*-
+ * Copyright (c) 2015 Netflix Inc. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above cop

svn commit: r290662 - head/sys/kern

2015-11-10 Thread Josh Paetzel
Author: jpaetzel
Date: Tue Nov 10 14:14:32 2015
New Revision: 290662
URL: https://svnweb.freebsd.org/changeset/base/290662

Log:
  Fix a bug in the CPU % limiting code
  
  If you attempt to set a pcpu limit that is higher than
  110% using rctl (for instance, you want a jail to be
  able to use 2 cores on your system so you set pcpu to
  200%) the thing you are trying to limit becomes unthrottled.
  
  PR:   189870
  Submitted by: dustinw...@ebureau.com
  Reviewed by:  trasz
  MFC after:1 week

Modified:
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_racct.c
==
--- head/sys/kern/kern_racct.c  Tue Nov 10 13:47:28 2015(r290661)
+++ head/sys/kern/kern_racct.c  Tue Nov 10 14:14:32 2015(r290662)
@@ -517,16 +517,16 @@ racct_adjust_resource(struct racct *racc

/*
 * There are some cases where the racct %cpu resource would grow
-* beyond 100%.
-* For example in racct_proc_exit() we add the process %cpu usage
-* to the ucred racct containers.  If too many processes terminated
-* in a short time span, the ucred %cpu resource could grow too much.
-* Also, the 4BSD scheduler sometimes returns for a thread more than
-* 100% cpu usage.  So we set a boundary here to 100%.
+* beyond 100% per core.  For example in racct_proc_exit() we add
+* the process %cpu usage to the ucred racct containers.  If too
+* many processes terminated in a short time span, the ucred %cpu
+* resource could grow too much.  Also, the 4BSD scheduler sometimes
+* returns for a thread more than 100% cpu usage. So we set a sane
+* boundary here to 100% * the maxumum number of CPUs.
 */
if ((resource == RACCT_PCTCPU) &&
-   (racct->r_resources[RACCT_PCTCPU] > 100 * 100))
-   racct->r_resources[RACCT_PCTCPU] = 100 * 100;
+   (racct->r_resources[RACCT_PCTCPU] > 100 * 100 * 
(int64_t)MAXCPU))
+   racct->r_resources[RACCT_PCTCPU] = 100 * 100 * 
(int64_t)MAXCPU;
 }
 
 static 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: r290664 - in head: share/man/man9 sys/kern sys/sys

2015-11-10 Thread Randall Stewart
Author: rrs
Date: Tue Nov 10 14:49:32 2015
New Revision: 290664
URL: https://svnweb.freebsd.org/changeset/base/290664

Log:
  Add new async_drain to the callout system. This is so-far not used but
  should be used by TCP for sure in its cleanup of the IN-PCB (will be coming 
shortly).
  
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D4076

Modified:
  head/share/man/man9/timeout.9
  head/sys/kern/kern_timeout.c
  head/sys/sys/callout.h

Modified: head/share/man/man9/timeout.9
==
--- head/share/man/man9/timeout.9   Tue Nov 10 14:14:41 2015
(r290663)
+++ head/share/man/man9/timeout.9   Tue Nov 10 14:49:32 2015
(r290664)
@@ -35,6 +35,7 @@
 .Sh NAME
 .Nm callout_active ,
 .Nm callout_deactivate ,
+.Nm callout_async_drain ,
 .Nm callout_drain ,
 .Nm callout_handle_init ,
 .Nm callout_init ,
@@ -69,6 +70,8 @@ typedef void timeout_t (void *);
 .Ft void
 .Fn callout_deactivate "struct callout *c"
 .Ft int
+.Fn callout_async_drain "struct callout *c" "timeout_t *drain"
+.Ft int
 .Fn callout_drain "struct callout *c"
 .Ft void
 .Fn callout_handle_init "struct callout_handle *handle"
@@ -236,17 +239,42 @@ The function
 cancels a callout
 .Fa c
 if it is currently pending.
-If the callout is pending, then
+If the callout is pending and successfuly stopped, then
 .Fn callout_stop
-returns a non-zero value.
-If the callout is not set,
-has already been serviced,
-or is currently being serviced,
+returns a value of one.
+If the callout is not set, or
+has already been serviced, then
+negative one is returned.
+If the callout is currently being serviced and cannot be stopped,
 then zero will be returned.
 If the callout has an associated lock,
 then that lock must be held when this function is called.
 .Pp
 The function
+.Fn callout_async_drain
+is identical to
+.Fn callout_stop
+with one difference.
+When
+.Fn callout_async_drain
+returns zero it will arrange for the function
+.Fa drain
+to be called using the same argument given to the
+.Fn callout_reset
+function. 
+.Fn callout_async_drain
+If the callout has an associated lock,
+then that lock must be held when this function is called.
+Note that when stopping multiple callouts that use the same lock it is possible
+to get multiple return's of zero and multiple calls to the
+.Fa drain
+function, depending upon which CPU's the callouts are running. The
+.Fa drain
+function itself is called from the context of the completing callout
+i.e. softclock or hardclock, just like a callout itself.
+p
+.Pp
+The function
 .Fn callout_drain
 is identical to
 .Fn callout_stop

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cTue Nov 10 14:14:41 2015
(r290663)
+++ head/sys/kern/kern_timeout.cTue Nov 10 14:49:32 2015
(r290664)
@@ -136,6 +136,7 @@ u_int callwheelsize, callwheelmask;
  */
 struct cc_exec {
struct callout  *cc_curr;
+   void(*cc_drain)(void *);
 #ifdef SMP
void(*ce_migration_func)(void *);
void*ce_migration_arg;
@@ -170,6 +171,7 @@ struct callout_cpu {
 #definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION)
 
 #definecc_exec_curr(cc, dir)   cc->cc_exec_entity[dir].cc_curr
+#definecc_exec_drain(cc, dir)  cc->cc_exec_entity[dir].cc_drain
 #definecc_exec_next(cc)cc->cc_next
 #definecc_exec_cancel(cc, dir) 
cc->cc_exec_entity[dir].cc_cancel
 #definecc_exec_waiting(cc, dir)
cc->cc_exec_entity[dir].cc_waiting
@@ -679,6 +681,7 @@ softclock_call_cc(struct callout *c, str

cc_exec_curr(cc, direct) = c;
cc_exec_cancel(cc, direct) = false;
+   cc_exec_drain(cc, direct) = NULL;
CC_UNLOCK(cc);
if (c_lock != NULL) {
class->lc_lock(c_lock, lock_status);
@@ -744,6 +747,15 @@ skip:
CC_LOCK(cc);
KASSERT(cc_exec_curr(cc, direct) == c, ("mishandled cc_curr"));
cc_exec_curr(cc, direct) = NULL;
+   if (cc_exec_drain(cc, direct)) {
+   void (*drain)(void *);
+   
+   drain = cc_exec_drain(cc, direct);
+   cc_exec_drain(cc, direct) = NULL;
+   CC_UNLOCK(cc);
+   drain(c_arg);
+   CC_LOCK(cc);
+   }
if (cc_exec_waiting(cc, direct)) {
/*
 * There is someone waiting for the
@@ -1145,7 +1157,7 @@ callout_schedule(struct callout *c, int 
 }
 
 int
-_callout_stop_safe(struct callout *c, int safe)
+_callout_stop_safe(struct callout *c, int safe, void (*drain)(void *))
 {
struct callout_cpu *cc, *old_cc;
struct lock_class *class;
@@ -1225,19 +1237,22 @@ again:
 * stop it by other means howeve

Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys

2015-11-10 Thread Hans Petter Selasky

On 11/10/15 15:49, Randall Stewart wrote:

+#define callout_async_drain(c, d)  \
+_callout_stop_safe(c, 0, d)


Hi,

Like commented in D4076, I think the callout_async_drain() function 
should take a second void pointer argument, which is passed to the 
drain function, instead of re-using the pointer argument passed to 
callout_reset(), because that will make many to one, N:1, asynchronous 
drain possible.


--HPS
___
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"


Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys

2015-11-10 Thread Randall Stewart via svn-src-head
And I disagree here Hans

You don’t need that and it just adds more into the
callout system that is not needed.

R
On Nov 10, 2015, at 9:59 AM, Hans Petter Selasky  wrote:

> On 11/10/15 15:49, Randall Stewart wrote:
>> +#define callout_async_drain(c, d)   \
>> +_callout_stop_safe(c, 0, d)
> 
> Hi,
> 
> Like commented in D4076, I think the callout_async_drain() function should 
> take a second void pointer argument, which is passed to the drain function, 
> instead of re-using the pointer argument passed to callout_reset(), because 
> that will make many to one, N:1, asynchronous drain possible.
> 
> --HPS


Randall Stewart
r...@netflix.com
803-317-4952





___
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"


Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Ian Lepore
On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote:
> On 11/09/15 22:17, Bruce Evans wrote:
> > On Mon, 9 Nov 2015, Conrad E. Meyer wrote:
> > 
> > > Log:
> > >  linuxkpi/sysfs.h: Cast arg2 through intptr_t to avoid GCC
> > > warning
> > > 
> > >  The code compiles fine under Clang, but GCC on PPC is less
> > > permissive
> > > about
> > >  integer and pointer sizes.  (An intmax_t is clearly *large
> > > enough* to
> > > hold a
> > >  pointer value.)
> > > 
> > >  Another follow-up to r290475.
> > 
> > This shouldn't compile either.
> > 
> 
> Hi Conrad,
> 
> 
> >  static int
> > -sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
> > intptr_t arg2,
> > +sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
> > intmax_t arg2,
> >  struct sysctl_req *req, struct rm_priotracker *tracker)
> 
> Given that the second argument is sometimes used for pointers, maybe
> we 
> should keep it intptr_t. Or add a compile time assert that 
> sizeof(intmax) >= sizeof(intptr_t) which I think doesn't hold?
> 
> --HPS
> 

If intmax_t is the "maximum width integer type" and intptr_t is
"integer type capable of holding a pointer", I think by definition
sizeof(intmax_t) must be >= sizeof(intptr_t).  On the other hand, given
the perverse way standards-writers think, I'm not sure "big enough" is
all it takes to qualify as "capable of holding a pointer".  But I think
in reality it'll work out right anyway.

-- Ian

___
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"


Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys

2015-11-10 Thread Hans Petter Selasky

On 11/10/15 16:03, Randall Stewart wrote:

And I disagree here Hans

You don’t need that and it just adds more into the
callout system that is not needed.


Hi,

It also makes debugging more easy, that you can see the last function 
call and argument. I.E. You should not have to clear the drain function 
pointer before calling the drain function.


Something else. Maybe you should bump the FreeBSD version, because 
callout_stop() is a macro, and you've changed its API by adding another 
argument to _callout_stop_safe(), to force a recompilation of KLD's. 
Else garbage will be passed into "drain" ...


--HPS
___
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"


Re: svn commit: r290650 - in head/sys: dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 modules/mlx5en

2015-11-10 Thread Andrew Gallatin

On 11/10/2015 07:20, Hans Petter Selasky wrote:

Author: hselasky
Date: Tue Nov 10 12:20:22 2015
New Revision: 290650
URL: https://svnweb.freebsd.org/changeset/base/290650

Log:
   Add mlx5 and mlx5en driver(s) for ConnectX-4 and ConnectX-4LX cards
   from Mellanox Technologies. The current driver supports ethernet
   speeds up to and including 100 GBit/s. Infiniband support will be
   done later.

   The code added is not compiled by default, which will be done by a
   separate commit.

   Sponsored by:Mellanox Technologies
   MFC after:   2 weeks




This has been extensively tested at high load here at Netflix,
and we have had several internet facing machines serving well over
70Gb/s each across these NICs for the last few months.


Drew
___
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"


Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Conrad Meyer
On Tue, Nov 10, 2015 at 7:08 AM, Ian Lepore  wrote:
> On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote:
>> > -sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
>> > intptr_t arg2,
>> > +sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
>> > intmax_t arg2,
>> >  struct sysctl_req *req, struct rm_priotracker *tracker)
>>
>> Given that the second argument is sometimes used for pointers, maybe
>> we
>> should keep it intptr_t. Or add a compile time assert that
>> sizeof(intmax) >= sizeof(intptr_t) which I think doesn't hold?
>
> If intmax_t is the "maximum width integer type" and intptr_t is
> "integer type capable of holding a pointer", I think by definition
> sizeof(intmax_t) must be >= sizeof(intptr_t).  On the other hand, given
> the perverse way standards-writers think, I'm not sure "big enough" is
> all it takes to qualify as "capable of holding a pointer".  But I think
> in reality it'll work out right anyway.

+1 to what Ian said.

In any C99 implementation where intptr_t is defined, I believe
intmax_t must be at least as big.  See § 7.18.1.5, "Greatest-width
integer types," and § 7.18.1.4, "Integer types capable of holding
object pointers."

> The following type designates a signed integer type with the property that 
> any valid pointer to void can be converted to this type, then converted back 
> to pointer to void, and the result will compare equal to the original 
> pointer: intptr_t
>
> The following type designates a signed integer type capable of representing 
> any value of any signed integer type: intmax_t

Given that intptr_t exists in our implementation and is a signed
integer type, I see no reason why intmax_t could possibly not
represent any such value.  Same argument for the unsigned variants.

Best,
Conrad
___
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"

Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Andrey Chernov
On 10.11.2015 16:36, Baptiste Daroussin wrote:
> On Tue, Nov 10, 2015 at 04:20:38PM +0300, Andrey Chernov wrote:
>> On 10.11.2015 16:04, Baptiste Daroussin wrote:
>>> On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
 On 10.11.2015 11:11, Baptiste Daroussin wrote:
> Author: bapt
> Date: Tue Nov 10 08:11:27 2015
> New Revision: 290637
> URL: https://svnweb.freebsd.org/changeset/base/290637
>
> Log:
>   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
>   as it used to be in previous version of the locales. Returning
>   "POSIX" has too many fallouts.

 You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
 different with real US-ASCII. It is what glibc returns for C/POSIX
 locale and most ports expected, being linux-oriented.

>>> I thought about it, but in the end it is probably safer for now that 
>>> nl_langinfo
>>> return US-ASCII as it did in the past, to reduce breakage with FreeBSD only 
>>> code
>>> that maybe be existing ou there.
>>
>> All FreeBSD code I know never check locale this way. IMHO probability of
>> potential danger to meet some linux-oriented port with this check is
>> much much higher than to meet similar FreeBSD only code in the wild. In
>> any case, changing collate order from A-Za-z to aA-zZ we do just now
>> have much higher probability to break unknown FreeBSD only code, so one
>> breaking change can go with other one together.
>>
> That is true, except that the new collation thing is invalidated as soon as 
> you
> set LC_COLLATE=C which bring your back to A-Za-z. So you have a workaround 
> while
> changing the return value of nl_langinfo() is not workaroundable.

Well, forget my improper comparison with collate and see this bug in
action right now, in our port tcl8.6.4/unix/tclUnixInit.c:

See localeTable and comment above it, there is internal "ansi_x3.4-1968"
(i.e. POSIX locale), internal "ascii" and even no alias for our
"us-ascii" at all.

It gets info through nl_langinfo(CODESET), lowercased. I.e. not using
"ANSI_X3.4-1968" breaks all tcl ports right now, this is more essential
than hypothetical private FreeBSD only code no one see.

-- 
http://ache.vniz.net/



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Baptiste Daroussin
On Tue, Nov 10, 2015 at 07:07:26PM +0300, Andrey Chernov wrote:
> On 10.11.2015 16:36, Baptiste Daroussin wrote:
> > On Tue, Nov 10, 2015 at 04:20:38PM +0300, Andrey Chernov wrote:
> >> On 10.11.2015 16:04, Baptiste Daroussin wrote:
> >>> On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
>  On 10.11.2015 11:11, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Tue Nov 10 08:11:27 2015
> > New Revision: 290637
> > URL: https://svnweb.freebsd.org/changeset/base/290637
> >
> > Log:
> >   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
> >   as it used to be in previous version of the locales. Returning
> >   "POSIX" has too many fallouts.
> 
>  You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
>  different with real US-ASCII. It is what glibc returns for C/POSIX
>  locale and most ports expected, being linux-oriented.
> 
> >>> I thought about it, but in the end it is probably safer for now that 
> >>> nl_langinfo
> >>> return US-ASCII as it did in the past, to reduce breakage with FreeBSD 
> >>> only code
> >>> that maybe be existing ou there.
> >>
> >> All FreeBSD code I know never check locale this way. IMHO probability of
> >> potential danger to meet some linux-oriented port with this check is
> >> much much higher than to meet similar FreeBSD only code in the wild. In
> >> any case, changing collate order from A-Za-z to aA-zZ we do just now
> >> have much higher probability to break unknown FreeBSD only code, so one
> >> breaking change can go with other one together.
> >>
> > That is true, except that the new collation thing is invalidated as soon as 
> > you
> > set LC_COLLATE=C which bring your back to A-Za-z. So you have a workaround 
> > while
> > changing the return value of nl_langinfo() is not workaroundable.
> 
> Well, forget my improper comparison with collate and see this bug in
> action right now, in our port tcl8.6.4/unix/tclUnixInit.c:
> 
> See localeTable and comment above it, there is internal "ansi_x3.4-1968"
> (i.e. POSIX locale), internal "ascii" and even no alias for our
> "us-ascii" at all.
> 
> It gets info through nl_langinfo(CODESET), lowercased. I.e. not using
> "ANSI_X3.4-1968" breaks all tcl ports right now, this is more essential
> than hypothetical private FreeBSD only code no one see.

That one is a valid point, that also means that is is broken right now on
FreeBSD 10 and below?

Best regards,
Bapt


signature.asc
Description: PGP signature


Re: svn commit: r290663 - in head/sys: modules modules/tests modules/tests/callout_test modules/tests/framework tests tests/callout_test tests/framework

2015-11-10 Thread Bjoern A. Zeeb

> On 10 Nov 2015, at 14:14 , Randall Stewart  wrote:
> 
> Author: rrs
> Date: Tue Nov 10 14:14:41 2015
> New Revision: 290663
> URL: https://svnweb.freebsd.org/changeset/base/290663
> 
> Log:
>  Add a kernel test framework. The callout_test is a demonstration and will 
> only
>  work with the upcoming async-drain functionality. Tests can be added
>  to the tests directory and then the framework can be used to launch
>  those tests.
> 
>  MFC after:   1 month
>  Sponsored by:Netflix Inc.
>  Differential Revision:   https://reviews.freebsd.org/D1755
> 


/scratch/tmp/bz/head.svn/sys/modules/tests/callout_test/../../../tests/callout_test/callout_test.c:75:
 warning: function declaration isn't a prototype [-Wstrict-prototypes]
/scratch/tmp/bz/head.svn/sys/modules/tests/callout_test/../../../tests/callout_test/callout_test.c:133:
 warning: no previous prototype for ‘execute_the_co_test' [-Wmissing-prototypes]


/scratch/tmp/bz/head.svn/sys/modules/tests/framework/../../../tests/framework/kern_testfrwk.c:171:
 warning: redundant redeclaration of 'sysctl___kern' [-Wredundant-decls]
/scratch/tmp/bz/head.svn/sys/sys/sysctl.h:918: warning: previous declaration of 
‘sysctl___kern' was here

This is on sparc64 but I guess that’s just one of my early kernel compiles.


> Added:
>  head/sys/modules/tests/
>  head/sys/modules/tests/callout_test/
>  head/sys/modules/tests/callout_test/Makefile   (contents, props changed)
>  head/sys/modules/tests/framework/
>  head/sys/modules/tests/framework/Makefile   (contents, props changed)
>  head/sys/tests/
>  head/sys/tests/callout_test/
>  head/sys/tests/callout_test.h   (contents, props changed)
>  head/sys/tests/callout_test/callout_test.c   (contents, props changed)
>  head/sys/tests/framework/
>  head/sys/tests/framework/kern_testfrwk.c   (contents, props changed)
>  head/sys/tests/kern_testfrwk.h   (contents, props changed)
> Modified:
>  head/sys/modules/Makefile

___
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"

Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Andrey Chernov
On 10.11.2015 19:12, Baptiste Daroussin wrote:
> On Tue, Nov 10, 2015 at 07:07:26PM +0300, Andrey Chernov wrote:
>> On 10.11.2015 16:36, Baptiste Daroussin wrote:
>>> On Tue, Nov 10, 2015 at 04:20:38PM +0300, Andrey Chernov wrote:
 On 10.11.2015 16:04, Baptiste Daroussin wrote:
> On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
>> On 10.11.2015 11:11, Baptiste Daroussin wrote:
>>> Author: bapt
>>> Date: Tue Nov 10 08:11:27 2015
>>> New Revision: 290637
>>> URL: https://svnweb.freebsd.org/changeset/base/290637
>>>
>>> Log:
>>>   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
>>>   as it used to be in previous version of the locales. Returning
>>>   "POSIX" has too many fallouts.
>>
>> You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
>> different with real US-ASCII. It is what glibc returns for C/POSIX
>> locale and most ports expected, being linux-oriented.
>>
> I thought about it, but in the end it is probably safer for now that 
> nl_langinfo
> return US-ASCII as it did in the past, to reduce breakage with FreeBSD 
> only code
> that maybe be existing ou there.

 All FreeBSD code I know never check locale this way. IMHO probability of
 potential danger to meet some linux-oriented port with this check is
 much much higher than to meet similar FreeBSD only code in the wild. In
 any case, changing collate order from A-Za-z to aA-zZ we do just now
 have much higher probability to break unknown FreeBSD only code, so one
 breaking change can go with other one together.

>>> That is true, except that the new collation thing is invalidated as soon as 
>>> you
>>> set LC_COLLATE=C which bring your back to A-Za-z. So you have a workaround 
>>> while
>>> changing the return value of nl_langinfo() is not workaroundable.
>>
>> Well, forget my improper comparison with collate and see this bug in
>> action right now, in our port tcl8.6.4/unix/tclUnixInit.c:
>>
>> See localeTable and comment above it, there is internal "ansi_x3.4-1968"
>> (i.e. POSIX locale), internal "ascii" and even no alias for our
>> "us-ascii" at all.
>>
>> It gets info through nl_langinfo(CODESET), lowercased. I.e. not using
>> "ANSI_X3.4-1968" breaks all tcl ports right now, this is more essential
>> than hypothetical private FreeBSD only code no one see.
> 
> That one is a valid point, that also means that is is broken right now on
> FreeBSD 10 and below?

Yes. It can't map our C locale to the some of internal ones and falls
back to TCL_DEFAULT_ENCODING "iso8859-1"

-- 
http://ache.vniz.net/



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r290637 - head/lib/libc/locale

2015-11-10 Thread Andrey Chernov
On 10.11.2015 19:19, Andrey Chernov wrote:
> On 10.11.2015 19:12, Baptiste Daroussin wrote:
>> On Tue, Nov 10, 2015 at 07:07:26PM +0300, Andrey Chernov wrote:
>>> On 10.11.2015 16:36, Baptiste Daroussin wrote:
 On Tue, Nov 10, 2015 at 04:20:38PM +0300, Andrey Chernov wrote:
> On 10.11.2015 16:04, Baptiste Daroussin wrote:
>> On Tue, Nov 10, 2015 at 03:48:52PM +0300, Andrey Chernov wrote:
>>> On 10.11.2015 11:11, Baptiste Daroussin wrote:
 Author: bapt
 Date: Tue Nov 10 08:11:27 2015
 New Revision: 290637
 URL: https://svnweb.freebsd.org/changeset/base/290637

 Log:
   return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
   as it used to be in previous version of the locales. Returning
   "POSIX" has too many fallouts.
>>>
>>> You can return "ANSI_X3.4-1968" (another name of "US-ASCII") to be
>>> different with real US-ASCII. It is what glibc returns for C/POSIX
>>> locale and most ports expected, being linux-oriented.
>>>
>> I thought about it, but in the end it is probably safer for now that 
>> nl_langinfo
>> return US-ASCII as it did in the past, to reduce breakage with FreeBSD 
>> only code
>> that maybe be existing ou there.
>
> All FreeBSD code I know never check locale this way. IMHO probability of
> potential danger to meet some linux-oriented port with this check is
> much much higher than to meet similar FreeBSD only code in the wild. In
> any case, changing collate order from A-Za-z to aA-zZ we do just now
> have much higher probability to break unknown FreeBSD only code, so one
> breaking change can go with other one together.
>
 That is true, except that the new collation thing is invalidated as soon 
 as you
 set LC_COLLATE=C which bring your back to A-Za-z. So you have a workaround 
 while
 changing the return value of nl_langinfo() is not workaroundable.
>>>
>>> Well, forget my improper comparison with collate and see this bug in
>>> action right now, in our port tcl8.6.4/unix/tclUnixInit.c:
>>>
>>> See localeTable and comment above it, there is internal "ansi_x3.4-1968"
>>> (i.e. POSIX locale), internal "ascii" and even no alias for our
>>> "us-ascii" at all.
>>>
>>> It gets info through nl_langinfo(CODESET), lowercased. I.e. not using
>>> "ANSI_X3.4-1968" breaks all tcl ports right now, this is more essential
>>> than hypothetical private FreeBSD only code no one see.
>>
>> That one is a valid point, that also means that is is broken right now on
>> FreeBSD 10 and below?
> 
> Yes. It can't map our C locale to the some of internal ones and falls
> back to TCL_DEFAULT_ENCODING "iso8859-1"
> 

BTW, for pure ASCII locale readded we should return "ASCII" instead of
"US-ASCII". I search lots of Linux code and see many checks for "ASCII"
and no checks for "US-ASCII" (like in tcl too).

-- 
http://ache.vniz.net/



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Bruce Evans

On Tue, 10 Nov 2015, Hans Petter Selasky wrote:


On 11/09/15 22:17, Bruce Evans wrote:

...
This shouldn't compile either.



 static int
-sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intptr_t 
arg2,
+sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intmax_t 
arg2,

 struct sysctl_req *req, struct rm_priotracker *tracker)


Given that the second argument is sometimes used for pointers, maybe we 
should keep it intptr_t. Or add a compile time assert that sizeof(intmax) >= 
sizeof(intptr_t) which I think doesn't hold?


Then it wouldn't be large enough to hold int64_t on i386 or intmax_t on
all arches.  intmax_t is already not large enough to hold uintmax_t.

intmax_t can hold more than intptr_t, but its size and rank may be smaller.
See another reply.

Bruce
___
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: r290665 - in head/sys/modules: . drm2 drm2/radeonkmsfw netgraph usb

2015-11-10 Thread Bryan Drewery
Author: bdrewery
Date: Tue Nov 10 17:15:36 2015
New Revision: 290665
URL: https://svnweb.freebsd.org/changeset/base/290665

Log:
  Build all of sys/modules with SUBDIR_PARALLEL.
  
  Sponsored by: EMC / Isilon Storage Division
  MFC after:3 weeks

Modified:
  head/sys/modules/Makefile.inc
  head/sys/modules/drm2/Makefile
  head/sys/modules/drm2/radeonkmsfw/Makefile
  head/sys/modules/netgraph/Makefile
  head/sys/modules/usb/Makefile

Modified: head/sys/modules/Makefile.inc
==
--- head/sys/modules/Makefile.inc   Tue Nov 10 14:49:32 2015
(r290664)
+++ head/sys/modules/Makefile.inc   Tue Nov 10 17:15:36 2015
(r290665)
@@ -4,3 +4,4 @@
 CFLAGS+= -DPC98
 .endif
 
+SUBDIR_PARALLEL=   yes

Modified: head/sys/modules/drm2/Makefile
==
--- head/sys/modules/drm2/Makefile  Tue Nov 10 14:49:32 2015
(r290664)
+++ head/sys/modules/drm2/Makefile  Tue Nov 10 17:15:36 2015
(r290665)
@@ -3,8 +3,6 @@
 SYSDIR?=${.CURDIR}/../..
 .include "${SYSDIR}/conf/kern.opts.mk"
 
-SUBDIR_PARALLEL=
-
 .if ${MACHINE_CPUARCH} == "amd64"
 _i915kms=  i915kms
 _radeonkms=radeonkms

Modified: head/sys/modules/drm2/radeonkmsfw/Makefile
==
--- head/sys/modules/drm2/radeonkmsfw/Makefile  Tue Nov 10 14:49:32 2015
(r290664)
+++ head/sys/modules/drm2/radeonkmsfw/Makefile  Tue Nov 10 17:15:36 2015
(r290665)
@@ -1,7 +1,5 @@
 # $FreeBSD$
 
-SUBDIR_PARALLEL=
-
 SUBDIR=
\
ARUBA_me\
ARUBA_pfp   \

Modified: head/sys/modules/netgraph/Makefile
==
--- head/sys/modules/netgraph/Makefile  Tue Nov 10 14:49:32 2015
(r290664)
+++ head/sys/modules/netgraph/Makefile  Tue Nov 10 17:15:36 2015
(r290665)
@@ -62,6 +62,4 @@ _bluetooth=   bluetooth
 _mppc= mppc
 .endif
 
-SUBDIR_PARALLEL=
-
 .include 

Modified: head/sys/modules/usb/Makefile
==
--- head/sys/modules/usb/Makefile   Tue Nov 10 14:49:32 2015
(r290664)
+++ head/sys/modules/usb/Makefile   Tue Nov 10 17:15:36 2015
(r290665)
@@ -29,11 +29,6 @@ SYSDIR?=${.CURDIR}/../..
 .include "${SYSDIR}/conf/kern.opts.mk"
 
 #
-# Allow USB modules to be built in parallel
-#
-SUBDIR_PARALLEL=
-
-#
 # Check for common USB debug flags to pass when building the USB
 # modules in this directory:
 #
___
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"


Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Andriy Gapon
On 10/11/2015 18:35, Bruce Evans wrote:
> intmax_t can hold more than intptr_t, but its size and rank may be smaller.
> See another reply.

I think that that's the case on middle-endian architectures.

-- 
Andriy Gapon
___
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"


Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Justin Hibbits
On Tue, Nov 10, 2015 at 9:42 AM, Conrad Meyer  wrote:
> On Tue, Nov 10, 2015 at 7:08 AM, Ian Lepore  wrote:
>> On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote:
>>> > -sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
>>> > intptr_t arg2,
>>> > +sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
>>> > intmax_t arg2,
>>> >  struct sysctl_req *req, struct rm_priotracker *tracker)
>>>
>>> Given that the second argument is sometimes used for pointers, maybe
>>> we
>>> should keep it intptr_t. Or add a compile time assert that
>>> sizeof(intmax) >= sizeof(intptr_t) which I think doesn't hold?
>>
>> If intmax_t is the "maximum width integer type" and intptr_t is
>> "integer type capable of holding a pointer", I think by definition
>> sizeof(intmax_t) must be >= sizeof(intptr_t).  On the other hand, given
>> the perverse way standards-writers think, I'm not sure "big enough" is
>> all it takes to qualify as "capable of holding a pointer".  But I think
>> in reality it'll work out right anyway.
>
> +1 to what Ian said.
>
> In any C99 implementation where intptr_t is defined, I believe
> intmax_t must be at least as big.  See § 7.18.1.5, "Greatest-width
> integer types," and § 7.18.1.4, "Integer types capable of holding
> object pointers."
>
>> The following type designates a signed integer type with the property that 
>> any valid pointer to void can be converted to this type, then converted back 
>> to pointer to void, and the result will compare equal to the original 
>> pointer: intptr_t
>>
>> The following type designates a signed integer type capable of representing 
>> any value of any signed integer type: intmax_t
>
> Given that intptr_t exists in our implementation and is a signed
> integer type, I see no reason why intmax_t could possibly not
> represent any such value.  Same argument for the unsigned variants.
>
> Best,
> Conrad
>

I may be wrong on this, but I *think* uintptr_t/intptr_t are required
to be *precisely* the same size as a pointer, which explains why you
can't cast directly from uintmax_t on 32-bit architectures.

- Justin
___
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"

Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Bruce Evans

On Tue, 10 Nov 2015, Conrad Meyer wrote:


On Tue, Nov 10, 2015 at 7:08 AM, Ian Lepore  wrote:

On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote:

-sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
intptr_t arg2,
+sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
intmax_t arg2,
 struct sysctl_req *req, struct rm_priotracker *tracker)


Given that the second argument is sometimes used for pointers, maybe
we
should keep it intptr_t. Or add a compile time assert that
sizeof(intmax) >= sizeof(intptr_t) which I think doesn't hold?


If intmax_t is the "maximum width integer type" and intptr_t is
"integer type capable of holding a pointer", I think by definition
sizeof(intmax_t) must be >= sizeof(intptr_t).


intmax_t isn't the "maximum width integer type".  It is a "signed integer
type capable of representing any value of any signed integer type (including
extended ones).  This imples that INTMAX_MAX >= INTPTR_MAX but not that
sizeof(intmax_t) >= sizeof(intptr_t) or that
rankof(intmax_t) >= rankof(intptr_t).  intptr_t may have more padding bits
than intmax_t.  In FreeBSD, rankof(intmax_t) >= rankof(intptr_t), but
rankof(intmax_t) doesn't have maximum rank.  It is smaller than the long
long abomination in rank on all 64-bit arches  All arches declare intmax_t
as int64_t, and this has to be long_long_abomination_t on 32-bit arches
(except I made it a magic gcc type in old versions of FreeBSD and C where
long long was a syntax error), but intmax_t is always plain long on 64
bit arches.  In terms of rank, intptr_t == int64_t == intmax_t <
long_long_abomination_t on 64-bit arches, and
intptr_t < int64_t == intmax_t == long_long_abomination_t on 32-bit arches.


On the other hand, given
the perverse way standards-writers think, I'm not sure "big enough" is
all it takes to qualify as "capable of holding a pointer".  But I think
in reality it'll work out right anyway.


Only on vaxes, unless you write correct code.  E.g., consider the following
reasonable implementation:
- pointers have 64 bits, consisting of 32 high address bits and 32 low
  low type bits
- the type bits for void have value 1 
- intmax_t is also 64 bits

- intptr_t is 32 bits (the type bits need not be represented because they
  are always 1)
- conversion from void * to intmax_t then can and should be to copy all
  the bits.  The void * pointer kernbase with bits 0xc001
  gives the same bit when converted to intmax_t.  The reversion conversion
  also copies the bits.
- conversion from void * to intmax_t must reduce to 32 bits.  It can and
  should do this in the obvious way by discarding the low type bits and
  shifting the top bits to the low bits.  The kernbase becomes
  0xc when converted to intptr_t.  The reverse conversion shifts
  the addres bits back and sets the type bits to their known value for
  void *.
Then wrong code breaks nicely.  (intptr_t)(intmax_t)kernbase gives 1
and there is obviously no way to convert this back to kernbase.  To
use intmax_t for kernbase, you have write (intmax_t)(intptr_t)kernbase.
This has value 0xc000.  Then to get back to void *, first cast
back to intptr_t.

Qualified pointers to void are required to work too.  In the above
implementation, they should have different type bits and some only
difference is that casting back must restore different type bits.
Conversions of other pointers are not required to work, but would
work accidentally.  All the type info needed to recover the original
type bits is in the cast back (provided it is really back to the same
type).


+1 to what Ian said.

In any C99 implementation where intptr_t is defined, I believe
intmax_t must be at least as big.  See ?? 7.18.1.5, "Greatest-width
integer types," and ?? 7.18.1.4, "Integer types capable of holding
object pointers."


The following type designates a signed integer type with the property that any 
valid pointer to void can be converted to this type, then converted back to 
pointer to void, and the result will compare equal to the original pointer: 
intptr_t


Note that it only requires working when the conversion is to this type.
Any conversion from a pointer to int may involve some reduction or
reordering of the bits.  The conversion might depend on the type of
both the integer and the pointer in more complicated ways than the
above.  The requirement that the conversions are not required to work
for all "large enough" types makes things simpler for everyone.


The following type designates a signed integer type capable of representing any 
value of any signed integer type: intmax_t


Given that intptr_t exists in our implementation and is a signed
integer type, I see no reason why intmax_t could possibly not
represent any such value.  Same argument for the unsigned variants.


It can only represent integers directly.  intptr_t is only required to
represent pointers with some unique encoding.  Other integer types are
only required to represent (via conversion) poi

Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux

2015-11-10 Thread Bruce Evans

On Tue, 10 Nov 2015, Justin Hibbits wrote:


On Tue, Nov 10, 2015 at 9:42 AM, Conrad Meyer  wrote:

...
Given that intptr_t exists in our implementation and is a signed
integer type, I see no reason why intmax_t could possibly not
represent any such value.  Same argument for the unsigned variants.


I may be wrong on this, but I *think* uintptr_t/intptr_t are required
to be *precisely* the same size as a pointer, which explains why you
can't cast directly from uintmax_t on 32-bit architectures.


Good compilers use the size for a simple portability check.  They
should also complain if the types are different but have the same size,
as is done for int vs long format mismatches on i386.

Bruce
___
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"


Re: svn commit: r290651 - head/sys/dev/usb/wlan

2015-11-10 Thread Renato Botelho
> On Nov 10, 2015, at 10:52, Andriy Voskoboinyk  wrote:
> 
> Author: avos
> Date: Tue Nov 10 12:52:26 2015
> New Revision: 290651
> URL: https://svnweb.freebsd.org/changeset/base/290651
> 
> Log:
>  urtwn(4): add IBSS mode support
> 
>  Tested with RTL8188EU, IBSS and STA modes.
> 
>  Reviewed by: kevlo
>  Approved by: adrian (mentor)
>  Differential Revision:   https://reviews.freebsd.org/D4038
> 
> Modified:
>  head/sys/dev/usb/wlan/if_urtwn.c
>  head/sys/dev/usb/wlan/if_urtwnvar.h
> 
> Modified: head/sys/dev/usb/wlan/if_urtwn.c
> ==
> --- head/sys/dev/usb/wlan/if_urtwn.c  Tue Nov 10 12:20:22 2015
> (r290650)
> +++ head/sys/dev/usb/wlan/if_urtwn.c  Tue Nov 10 12:52:26 2015
> (r290651)
> @@ -228,10 +228,14 @@ static int  urtwn_setup_beacon(struct ur
> static void   urtwn_update_beacon(struct ieee80211vap *, int);
> static inturtwn_tx_beacon(struct urtwn_softc *sc,
>   struct urtwn_vap *);
> +static void  urtwn_tsf_task_adhoc(void *, int);
> static void   urtwn_tsf_sync_enable(struct urtwn_softc *,
>   struct ieee80211vap *);
> static void   urtwn_set_led(struct urtwn_softc *, int, int);
> static void   urtwn_set_mode(struct urtwn_softc *, uint8_t);
> +static void  urtwn_ibss_recv_mgmt(struct ieee80211_node *,
> + struct mbuf *, int,
> + const struct ieee80211_rx_stats *, int, int);
> static inturtwn_newstate(struct ieee80211vap *,
>   enum ieee80211_state, int);
> static void   urtwn_watchdog(void *);
> @@ -449,6 +453,7 @@ urtwn_attach(device_t self)
>   ic->ic_caps =
> IEEE80211_C_STA   /* station mode */
>   | IEEE80211_C_MONITOR   /* monitor mode */
> + | IEEE80211_C_IBSS  /* adhoc mode */
>   | IEEE80211_C_HOSTAP/* hostap mode */
>   | IEEE80211_C_SHPREAMBLE/* short preamble supported */
>   | IEEE80211_C_SHSLOT/* short slot time supported */
> @@ -592,13 +597,18 @@ urtwn_vap_create(struct ieee80211com *ic
>   return (NULL);
>   }
> 
> - if (opmode == IEEE80211_M_HOSTAP)
> + if (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS)
>   urtwn_init_beacon(sc, uvp);
> 
>   /* override state transition machine */
>   uvp->newstate = vap->iv_newstate;
>   vap->iv_newstate = urtwn_newstate;
>   vap->iv_update_beacon = urtwn_update_beacon;
> + if (opmode == IEEE80211_M_IBSS) {
> + uvp->recv_mgmt = vap->iv_recv_mgmt;
> + vap->iv_recv_mgmt = urtwn_ibss_recv_mgmt;
> + TASK_INIT(&uvp->tsf_task_adhoc, 0, urtwn_tsf_task_adhoc, vap);
> + }
> 
>   /* complete setup */
>   ieee80211_vap_attach(vap, ieee80211_media_change,
> @@ -610,13 +620,13 @@ urtwn_vap_create(struct ieee80211com *ic
> static void
> urtwn_vap_delete(struct ieee80211vap *vap)
> {
> + struct ieee80211com *ic = vap->iv_ic;
>   struct urtwn_vap *uvp = URTWN_VAP(vap);
> - enum ieee80211_opmode opmode = vap->iv_opmode;
> 
> - if (opmode == IEEE80211_M_HOSTAP) {
> - if (uvp->bcn_mbuf != NULL)
> - m_freem(uvp->bcn_mbuf);
> - }
> + if (uvp->bcn_mbuf != NULL)
> + m_freem(uvp->bcn_mbuf);
> + if (vap->iv_opmode == IEEE80211_M_IBSS)
> + ieee80211_draintask(ic, &uvp->tsf_task_adhoc);
>   ieee80211_vap_detach(vap);
>   free(uvp, M_80211_VAP);
> }
> @@ -1611,8 +1621,50 @@ urtwn_tx_beacon(struct urtwn_softc *sc, 
> }
> 
> static void
> +urtwn_tsf_task_adhoc(void *arg, int pending)
> +{
> + struct ieee80211vap *vap = arg;
> + struct urtwn_softc *sc = vap->iv_ic->ic_softc;
> + struct ieee80211_node *ni;
> + uint32_t reg;
> +
> + URTWN_LOCK(sc);
> + ni = ieee80211_ref_node(vap->iv_bss);
> + reg = urtwn_read_1(sc, R92C_BCN_CTRL);
> +
> + /* Accept beacons with the same BSSID. */
> + urtwn_set_rx_bssid_all(sc, 0);
> +
> + /* Enable synchronization. */
> + reg &= ~R92C_BCN_CTRL_DIS_TSF_UDT0;
> + urtwn_write_1(sc, R92C_BCN_CTRL, reg);
> +
> + /* Synchronize. */
> + usb_pause_mtx(&sc->sc_mtx, hz * ni->ni_intval * 5 / 1000);
> +
> + /* Disable synchronization. */
> + reg |= R92C_BCN_CTRL_DIS_TSF_UDT0;
> + urtwn_write_1(sc, R92C_BCN_CTRL, reg);
> +
> + /* Remove beacon filter. */
> + urtwn_set_rx_bssid_all(sc, 1);
> +
> + /* Enable beaconing. */
> + urtwn_write_1(sc, R92C_MBID_NUM,
> + urtwn_read_1(sc, R92C_MBID_NUM) | R92C_MBID_TXBCN_RPT0);
> + reg |= R92C_BCN_CTRL_EN_BCN;
> +
> + urtwn_write_1(sc, R92C_BCN_CTRL, reg);
> + ieee80211_free_node(ni);
> + URTWN_UNLOCK(sc);
> +}
> +
> +static void
> urtwn_tsf_sync_enable(struct urt

Re: svn commit: r290626 - head

2015-11-10 Thread Bryan Drewery
On 11/9/15 3:36 PM, Bryan Drewery wrote:
> Author: bdrewery
> Date: Mon Nov  9 23:36:46 2015
> New Revision: 290626
> URL: https://svnweb.freebsd.org/changeset/base/290626
> 
> Log:
>   Move 'make cleandir' from Makefile to Makefile.inc1.
>   

Obviously I meant 'cleanworld' here. The commit was effectively a NOP
too to make the next commit more clear.

-- 
Regards,
Bryan Drewery
___
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: r290666 - head/sys/arm/broadcom/bcm2835

2015-11-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Nov 11 00:41:02 2015
New Revision: 290666
URL: https://svnweb.freebsd.org/changeset/base/290666

Log:
  - Set have_message in interrupt to handle "response before READ" case
  - Serialize access to property channel when using bcm2835_mbox_property

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cTue Nov 10 17:15:36 
2015(r290665)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cWed Nov 11 00:41:02 
2015(r290666)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -83,6 +84,7 @@ struct bcm_mbox_softc {
bus_space_handle_t  bsh;
int msg[BCM2835_MBOX_CHANS];
int have_message[BCM2835_MBOX_CHANS];
+   struct sx   property_chan_lock;
 };
 
 #definembox_read_4(sc, reg)\
@@ -122,8 +124,10 @@ bcm_mbox_intr(void *arg)
 
MBOX_LOCK(sc);
while (!(mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY))
-   if (bcm_mbox_read_msg(sc, &chan) == 0)
+   if (bcm_mbox_read_msg(sc, &chan) == 0) {
+   sc->have_message[chan] = 1;
wakeup(&sc->have_message[chan]);
+   }
MBOX_UNLOCK(sc);
 }
 
@@ -179,6 +183,8 @@ bcm_mbox_attach(device_t dev)
sc->have_message[i] = 0;
}
 
+   sx_init(&sc->property_chan_lock, "mboxprop");
+
/* Read all pending messages */
while ((mbox_read_4(sc, REG_STATUS) & STATUS_EMPTY) == 0)
(void)mbox_read_4(sc, REG_READ);
@@ -366,6 +372,7 @@ bcm2835_mbox_err(device_t dev, bus_addr_
 int
 bcm2835_mbox_property(void *msg, size_t msg_size)
 {
+   struct bcm_mbox_softc *sc;
struct msg_set_power_state *buf;
bus_dma_tag_t msg_tag;
bus_dmamap_t msg_map;
@@ -379,11 +386,16 @@ bcm2835_mbox_property(void *msg, size_t 
if (mbox == NULL)
return (ENXIO);
 
+   sc = device_get_softc(mbox);
+   sx_xlock(&sc->property_chan_lock);
+
/* Allocate memory for the message */
buf = bcm2835_mbox_init_dma(mbox, msg_size, &msg_tag, &msg_map,
&msg_phys);
-   if (buf == NULL)
-   return (ENOMEM);
+   if (buf == NULL) {
+   err = ENOMEM;
+   goto out;
+   }
 
memcpy(buf, msg, msg_size);
 
@@ -404,7 +416,8 @@ bcm2835_mbox_property(void *msg, size_t 
bus_dmamap_unload(msg_tag, msg_map);
bus_dmamem_free(msg_tag, buf, msg_map);
bus_dma_tag_destroy(msg_tag);
-
+out:
+   sx_xunlock(&sc->property_chan_lock);
return (err);
 }
 
___
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: r290667 - head/sys/arm/broadcom/bcm2835

2015-11-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Nov 11 00:45:41 2015
New Revision: 290667
URL: https://svnweb.freebsd.org/changeset/base/290667

Log:
  Refactor bcm2835_cpufreq to use bcm2835_mbox_property API

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Wed Nov 11 00:41:02 
2015(r290666)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_cpufreq.c Wed Nov 11 00:45:41 
2015(r290667)
@@ -115,13 +115,6 @@ struct bcm2835_cpufreq_softc {
int voltage_sdram_p;
int turbo_mode;
 
-   /* mbox buffer (physical address) */
-   bus_dma_tag_t   dma_tag;
-   bus_dmamap_tdma_map;
-   bus_size_t  dma_size;
-   void*dma_buf;
-   bus_addr_t  dma_phys;
-
/* initial hook for waiting mbox intr */
struct intr_config_hook init_hook;
 };
@@ -151,84 +144,10 @@ bcm2835_dump(const void *data, int len)
 #endif
 
 static int
-bcm2835_mbox_call_prop(struct bcm2835_cpufreq_softc *sc)
-{
-   struct bcm2835_mbox_hdr *msg = (struct bcm2835_mbox_hdr *)sc->dma_buf;
-   struct bcm2835_mbox_tag_hdr *tag, *last;
-   uint8_t *up;
-   device_t mbox;
-   size_t hdr_size;
-   int idx;
-   int err;
-
-   /*
-* For multiple calls, locking is not here. The caller must have
-* VC semaphore.
-*/
-
-   /* get mbox device */
-   mbox = devclass_get_device(devclass_find("mbox"), 0);
-   if (mbox == NULL) {
-   device_printf(sc->dev, "can't find mbox\n");
-   return (-1);
-   }
-
-   /* go mailbox property */
-#ifdef PROP_DEBUG
-   bcm2835_dump(msg, 64);
-#endif
-   bus_dmamap_sync(sc->dma_tag, sc->dma_map,
-   BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
-   MBOX_WRITE(mbox, BCM2835_MBOX_CHAN_PROP, (uint32_t)sc->dma_phys);
-   MBOX_READ(mbox, BCM2835_MBOX_CHAN_PROP, &err);
-   bus_dmamap_sync(sc->dma_tag, sc->dma_map, BUS_DMASYNC_POSTREAD);
-#ifdef PROP_DEBUG
-   bcm2835_dump(msg, 64);
-#endif
-
-   /* check response code */
-   if (msg->code != BCM2835_MBOX_CODE_RESP_SUCCESS) {
-   device_printf(sc->dev, "mbox response error\n");
-   return (-1);
-   }
-
-   /* tag = first tag */
-   up = (uint8_t *)msg;
-   hdr_size = sizeof(struct bcm2835_mbox_hdr);
-   tag = (struct bcm2835_mbox_tag_hdr *)(up + hdr_size);
-   /* last = end of buffer specified by header */
-   last = (struct bcm2835_mbox_tag_hdr *)(up + msg->buf_size);
-
-   /* loop unitl end tag (=0x0) */
-   hdr_size = sizeof(struct bcm2835_mbox_tag_hdr);
-   for (idx = 0; tag->tag != 0; idx++) {
-   if ((tag->val_len & BCM2835_MBOX_TAG_VAL_LEN_RESPONSE) == 0) {
-   device_printf(sc->dev, "tag%d response error\n", idx);
-   return (-1);
-   }
-   /* clear response bit */
-   tag->val_len &= ~BCM2835_MBOX_TAG_VAL_LEN_RESPONSE;
-
-   /* get next tag */
-   up = (uint8_t *)tag;
-   tag = (struct bcm2835_mbox_tag_hdr *)(up + hdr_size +
-   tag->val_buf_size);
-
-   /* check buffer size of header */
-   if (tag > last) {
-   device_printf(sc->dev, "mbox buffer size error\n");
-   return (-1);
-   }
-   }
-
-   return (0);
-}
-
-static int
 bcm2835_cpufreq_get_clock_rate(struct bcm2835_cpufreq_softc *sc,
 uint32_t clock_id)
 {
-   struct msg_get_clock_rate *msg;
+   struct msg_get_clock_rate msg;
int rate;
int err;
 
@@ -246,26 +165,18 @@ bcm2835_cpufreq_get_clock_rate(struct bc
 *   u32: rate (in Hz)
 */
 
-   /* using DMA buffer for VC */
-   msg = (struct msg_get_clock_rate *)sc->dma_buf;
-   if (sizeof(*msg) > sc->dma_size) {
-   device_printf(sc->dev, "DMA size overflow (%zu>%lu)\n",
-   sizeof(*msg), sc->dma_size);
-   return (MSG_ERROR);
-   }
-
/* setup single tag buffer */
-   memset(msg, 0, sizeof(*msg));
-   msg->hdr.buf_size = sizeof(*msg);
-   msg->hdr.code = BCM2835_MBOX_CODE_REQ;
-   msg->tag_hdr.tag = BCM2835_MBOX_TAG_GET_CLOCK_RATE;
-   msg->tag_hdr.val_buf_size = sizeof(msg->body);
-   msg->tag_hdr.val_len = sizeof(msg->body.req);
-   msg->body.req.clock_id = clock_id;
-   msg->end_tag = 0;
+   memset(&msg, 0, sizeof(msg));
+   msg.hdr.buf_size = sizeof(msg);
+   msg.hdr.code = BCM2835_MBOX_CODE_REQ;
+   msg.tag_hdr.tag = BCM2835_MBOX_TAG_GET_CLOCK_RATE;
+   msg.tag_hdr.val_buf_size = sizeof(msg.body);
+   msg.tag_hdr.val_len = sizeof(msg.body.req);
+   msg.body.req.clock_id = clock_id;
+   msg.end_tag