svn commit: r266536 - head/sys/netgraph

2014-05-21 Thread Alexander Motin
Author: mav
Date: Thu May 22 06:40:07 2014
New Revision: 266536
URL: http://svnweb.freebsd.org/changeset/base/266536

Log:
  Use NG_WAITOK as ng_package_msg() argument instead of M_WAITOK.
  
  Submitted by: Dmitry Luhtionov 

Modified:
  head/sys/netgraph/ng_socket.c

Modified: head/sys/netgraph/ng_socket.c
==
--- head/sys/netgraph/ng_socket.c   Thu May 22 06:28:09 2014
(r266535)
+++ head/sys/netgraph/ng_socket.c   Thu May 22 06:40:07 2014
(r266536)
@@ -301,7 +301,7 @@ ngc_send(struct socket *so, int flags, s
}
}
 
-   item = ng_package_msg(msg, M_WAITOK);
+   item = ng_package_msg(msg, NG_WAITOK);
if ((error = ng_address_path((pcbp->sockdata->node), item, path, 0))
!= 0) {
 #ifdef TRACE_MESSAGES
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Thu May 22 06:28:09 2014
New Revision: 266535
URL: http://svnweb.freebsd.org/changeset/base/266535

Log:
  - Stop transfers when RSU init fails.
  - Make sure TX/RX lists don't leak and are only allocated once.
  - Fix off-by one transfer index computation.
  - Give firmware loading more time.
  
  MFC after:3 days

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Thu May 22 05:33:50 2014
(r266534)
+++ head/sys/dev/usb/wlan/if_rsu.c  Thu May 22 06:28:09 2014
(r266535)
@@ -319,6 +319,20 @@ rsu_attach(device_t self)
TIMEOUT_TASK_INIT(taskqueue_thread, &sc->calib_task, 0, 
rsu_calib_task, sc);
 
+   /* Allocate Tx/Rx buffers. */
+   error = rsu_alloc_rx_list(sc);
+   if (error != 0) {
+   device_printf(sc->sc_dev, "could not allocate Rx buffers\n");
+   goto fail_usb;
+   }
+
+   error = rsu_alloc_tx_list(sc);
+   if (error != 0) {
+   device_printf(sc->sc_dev, "could not allocate Tx buffers\n");
+   rsu_free_rx_list(sc);
+   goto fail_usb;
+   }
+
iface_index = 0;
error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
rsu_config, RSU_N_TRANSFER, sc, &sc->sc_mtx);
@@ -615,12 +629,26 @@ rsu_alloc_tx_list(struct rsu_softc *sc)
 static void
 rsu_free_tx_list(struct rsu_softc *sc)
 {
+   int i;
+
+   /* prevent further allocations from TX list(s) */
+   STAILQ_INIT(&sc->sc_tx_inactive);
+
+   for (i = 0; i != RSU_MAX_TX_EP; i++) {
+   STAILQ_INIT(&sc->sc_tx_active[i]);
+   STAILQ_INIT(&sc->sc_tx_pending[i]);
+   }
+
rsu_free_list(sc, sc->sc_tx, RSU_TX_LIST_COUNT);
 }
 
 static void
 rsu_free_rx_list(struct rsu_softc *sc)
 {
+   /* prevent further allocations from RX list(s) */
+   STAILQ_INIT(&sc->sc_rx_inactive);
+   STAILQ_INIT(&sc->sc_rx_active);
+
rsu_free_list(sc, sc->sc_rx, RSU_RX_LIST_COUNT);
 }
 
@@ -1695,9 +1723,9 @@ rsu_tx_start(struct rsu_softc *sc, struc
which = RSU_BULK_TX_VO - RSU_BULK_TX_BE;
break;
default:
-   KASSERT(M_WME_GETAC(m0) < 4,
-   ("unsupported WME pipe %d", M_WME_GETAC(m0)));
-   which = M_WME_GETAC(m0) + RSU_BULK_TX_BE;
+   which = M_WME_GETAC(m0);
+   KASSERT(which < RSU_MAX_TX_EP,
+   ("unsupported WME pipe %d", which));
break;
}
hasqos = 0;
@@ -2172,15 +2200,14 @@ rsu_load_firmware(struct rsu_softc *sc)
goto fail;
}
/* Wait for load to complete. */
-   for (ntries = 0; ntries < 10; ntries++) {
+   for (ntries = 0; ntries != 50; ntries++) {
usb_pause_mtx(&sc->sc_mtx, hz / 100);
reg = rsu_read_2(sc, R92S_TCR);
if (reg & R92S_TCR_IMEM_CODE_DONE)
break;
}
-   if (ntries == 10 || !(reg & R92S_TCR_IMEM_CHK_RPT)) {
-   device_printf(sc->sc_dev, "timeout waiting for %s transfer\n",
-   "IMEM");
+   if (ntries == 50) {
+   device_printf(sc->sc_dev, "timeout waiting for IMEM 
transfer\n");
error = ETIMEDOUT;
goto fail;
}
@@ -2193,15 +2220,14 @@ rsu_load_firmware(struct rsu_softc *sc)
goto fail;
}
/* Wait for load to complete. */
-   for (ntries = 0; ntries < 10; ntries++) {
+   for (ntries = 0; ntries != 10; ntries++) {
usb_pause_mtx(&sc->sc_mtx, hz / 100);
reg = rsu_read_2(sc, R92S_TCR);
if (reg & R92S_TCR_EMEM_CODE_DONE)
break;
}
-   if (ntries == 10 || !(reg & R92S_TCR_EMEM_CHK_RPT)) {
-   device_printf(sc->sc_dev, "timeout waiting for %s transfer\n",
-   "EMEM");
+   if (ntries == 10) {
+   device_printf(sc->sc_dev, "timeout waiting for EMEM 
transfer\n");
error = ETIMEDOUT;
goto fail;
}
@@ -2336,22 +2362,11 @@ rsu_init_locked(struct rsu_softc *sc)
struct ifnet *ifp = sc->sc_ifp;
struct r92s_set_pwr_mode cmd;
int error;
+   int i;
 
/* Init host async commands ring. */
sc->cmdq.cur = sc->cmdq.next = sc->cmdq.queued = 0;
 
-   /* Allocate Tx/Rx buffers. */
-   error = rsu_alloc_rx_list(sc);
-   if (error != 0) {
-   device_printf(sc->sc_dev, "could not allocate Rx buffers\n");
-   return;
-   }
-   error = rsu_alloc_tx_list(sc);
-   if (error != 0) {
-   device_printf(sc->sc_dev, "could not allocate Tx buffers\n");
-   rsu_free_rx_list(sc);
-   return;
-   }
/* Power on adapter.

Re: svn commit: r266534 - head

2014-05-21 Thread Don Lewis
On 22 May, Xin LI wrote:
> Author: delphij
> Date: Thu May 22 05:33:50 2014
> New Revision: 266534
> URL: http://svnweb.freebsd.org/changeset/base/266534
> 
> Log:
>   Fix build: Build libavl as prebuild-lib.

Thanks!

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


svn commit: r266534 - head

2014-05-21 Thread Xin LI
Author: delphij
Date: Thu May 22 05:33:50 2014
New Revision: 266534
URL: http://svnweb.freebsd.org/changeset/base/266534

Log:
  Fix build: Build libavl as prebuild-lib.
  
  X-MFC-With:   266520

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu May 22 05:30:38 2014(r266533)
+++ head/Makefile.inc1  Thu May 22 05:33:50 2014(r266534)
@@ -1475,6 +1475,7 @@ _prebuild_libs=   ${_kerberos5_lib_libasn1
lib/libopie lib/libpam ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
+   ${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
${_secure_lib_libcrypto} ${_lib_libldns} \
@@ -1520,6 +1521,7 @@ lib/libopie__L lib/libtacplus__L: lib/li
 .if ${MK_CDDL} != "no"
 _cddl_lib_libumem= cddl/lib/libumem
 _cddl_lib_libnvpair= cddl/lib/libnvpair
+_cddl_lib_libavl= cddl/lib/libavl
 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
 _cddl_lib= cddl/lib
 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266533 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-05-21 Thread Allan Jude
Author: allanjude (doc committer)
Date: Thu May 22 05:30:38 2014
New Revision: 266533
URL: http://svnweb.freebsd.org/changeset/base/266533

Log:
  Improve sysctl descriptions for new ZFS sysctls:
  vfs.zfs.dirty_data_max
  vfs.zfs.dirty_data_max_max
  vfs.zfs.dirty_data_sync
  
  Reviewed by:  smh
  Approved by:  wblock (mentor)

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Thu May 
22 05:20:21 2014(r266532)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Thu May 
22 05:30:38 2014(r266533)
@@ -144,13 +144,13 @@ SYSCTL_DECL(_vfs_zfs);
 TUNABLE_QUAD("vfs.zfs.dirty_data_max", &zfs_dirty_data_max);
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max, CTLFLAG_RWTUN,
 &zfs_dirty_data_max, 0,
-"The dirty space limit in bytes after which new writes are halted until "
-"space becomes available");
+"The maximum amount of dirty data in bytes after which new writes are "
+"halted until space becomes available");
 
 TUNABLE_QUAD("vfs.zfs.dirty_data_max_max", &zfs_dirty_data_max_max);
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max_max, CTLFLAG_RDTUN,
 &zfs_dirty_data_max_max, 0,
-"The absolute cap on diry_data_max when auto calculating");
+"The absolute cap on dirty_data_max when auto calculating");
 
 TUNABLE_INT("vfs.zfs.dirty_data_max_percent", &zfs_dirty_data_max_percent);
 SYSCTL_INT(_vfs_zfs, OID_AUTO, dirty_data_max_percent, CTLFLAG_RDTUN,
@@ -160,7 +160,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, dirty_dat
 TUNABLE_QUAD("vfs.zfs.dirty_data_sync", &zfs_dirty_data_sync);
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync, CTLFLAG_RWTUN,
 &zfs_dirty_data_sync, 0,
-"Force at txg if the number of dirty buffer bytes exceed this value");
+"Force a txg if the number of dirty buffer bytes exceed this value");
 
 static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS);
 /* No zfs_delay_min_dirty_percent tunable due to limit requirements */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266531 - in head/sys: amd64/conf conf i386/conf modules

2014-05-21 Thread Justin Hibbits
Author: jhibbits
Date: Thu May 22 05:04:40 2014
New Revision: 266531
URL: http://svnweb.freebsd.org/changeset/base/266531

Log:
  imagact_binmisc builds for all supported architectures, so enable it for all.
  
  Any bugs in execution will be dealt with as they crop up.
  
  MFC after:3 weeks
  Relnotes: Yes

Modified:
  head/sys/amd64/conf/NOTES
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/options
  head/sys/conf/options.amd64
  head/sys/conf/options.i386
  head/sys/i386/conf/NOTES
  head/sys/modules/Makefile

Modified: head/sys/amd64/conf/NOTES
==
--- head/sys/amd64/conf/NOTES   Thu May 22 04:46:51 2014(r266530)
+++ head/sys/amd64/conf/NOTES   Thu May 22 05:04:40 2014(r266531)
@@ -646,6 +646,3 @@ options VM_KMEM_SIZE_SCALE
 # Enable NDIS binary driver support
 optionsNDISAPI
 device ndis
-
-# Module to enable execution of application via emulators like QEMU
-options IMAGACT_BINMISC

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/NOTES Thu May 22 05:04:40 2014(r266531)
@@ -2968,3 +2968,6 @@ options   RANDOM_YARROW   # Yarrow RNG
 ##options  RANDOM_FORTUNA  # Fortuna RNG - not yet implemented
 optionsRANDOM_DEBUG# Debugging messages
 optionsRANDOM_RWFILE   # Read and write entropy cache
+
+# Module to enable execution of application via emulators like QEMU
+options IMAGACT_BINMISC

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/files Thu May 22 05:04:40 2014(r266531)
@@ -2850,6 +2850,7 @@ kern/bus_if.m standard
 kern/clock_if.mstandard
 kern/cpufreq_if.m  standard
 kern/device_if.m   standard
+kern/imgact_binmisc.c  optionalimagact_binmisc
 kern/imgact_elf.c  standard
 kern/imgact_elf32.coptional compat_freebsd32
 kern/imgact_shell.cstandard

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/files.amd64   Thu May 22 05:04:40 2014(r266531)
@@ -438,7 +438,6 @@ dev/virtio/scsi/virtio_scsi.c   optional
 dev/virtio/random/virtio_random.c  optionalvirtio_random
 isa/syscons_isa.c  optionalsc
 isa/vga_isa.c  optionalvga
-kern/imgact_binmisc.c  optionalimagact_binmisc
 kern/kern_clocksource.cstandard
 kern/link_elf_obj.cstandard
 #

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/files.i386Thu May 22 05:04:40 2014(r266531)
@@ -520,7 +520,6 @@ isa/syscons_isa.c   optional sc
 isa/vga_isa.c  optional vga
 kern/kern_clocksource.cstandard
 kern/imgact_aout.c optional compat_aout
-kern/imgact_binmisc.c  optional imagact_binmisc
 kern/imgact_gzip.c optional gzip
 libkern/divdi3.c   standard
 libkern/flsll.cstandard

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/options   Thu May 22 05:04:40 2014(r266531)
@@ -91,6 +91,7 @@ DIRECTIO
 FILEMONopt_dontuse.h
 FFCLOCK
 FULL_PREEMPTIONopt_sched.h
+IMAGACT_BINMISCopt_dontuse.h
 IPI_PREEMPTION opt_sched.h
 GEOM_AES   opt_geom.h
 GEOM_BDE   opt_geom.h

Modified: head/sys/conf/options.amd64
==
--- head/sys/conf/options.amd64 Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/options.amd64 Thu May 22 05:04:40 2014(r266531)
@@ -21,7 +21,6 @@ COMPAT_FREEBSD32  opt_compat.h
 COMPAT_LINUX32 opt_compat.h
 #COMPAT_SVR4   opt_dontuse.h
 #DEBUG_SVR4opt_svr4.h
-IMAGACT_BINMISCopt_dontuse.h
 LINPROCFS  opt_dontuse.h
 LINSYSFS   opt_dontuse.h
 NDISAPIopt_dontuse.h

Modified: head/sys/conf/options.i386
==
--- head/sys/conf/options.i386  Thu May 22 04:46:51 2014(r266530)
+++ head/sys/conf/options.i386  Thu May 22 05:0

svn commit: r266530 - head/release/doc/en_US.ISO8859-1/relnotes

2014-05-21 Thread Gregory Neil Shapiro
Author: gshapiro
Date: Thu May 22 04:46:51 2014
New Revision: 266530
URL: http://svnweb.freebsd.org/changeset/base/266530

Log:
  Note merge to head for sendmail 8.14.9.
  
  MFC after:3 days

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu May 22 
04:43:40 2014(r266529)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu May 22 
04:46:51 2014(r266530)
@@ -347,7 +347,7 @@
   version 3.5.0.
 
 Sendmail
-  has been updated from 8.14.7 to 8.14.8.
+  has been updated from 8.14.7 to 8.14.9.
 
 bmake has been
   updated to version 20140101.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266529 - head/etc/sendmail

2014-05-21 Thread Gregory Neil Shapiro
Author: gshapiro
Date: Thu May 22 04:43:40 2014
New Revision: 266529
URL: http://svnweb.freebsd.org/changeset/base/266529

Log:
  Minor changes to force commit these files so new freebsd*.cf files are
  built to use the new sendmail-8.14.9/cf tree.
  
  MFC after:3 days

Modified:
  head/etc/sendmail/freebsd.mc
  head/etc/sendmail/freebsd.submit.mc

Modified: head/etc/sendmail/freebsd.mc
==
--- head/etc/sendmail/freebsd.mcThu May 22 04:41:11 2014
(r266528)
+++ head/etc/sendmail/freebsd.mcThu May 22 04:43:40 2014
(r266529)
@@ -33,7 +33,6 @@ divert(-1)
 # SUCH DAMAGE.
 #
 
-
 #
 #  This is a generic configuration file for FreeBSD 6.X and later systems.
 #  If you want to customize it, copy it to a name appropriate for your

Modified: head/etc/sendmail/freebsd.submit.mc
==
--- head/etc/sendmail/freebsd.submit.mc Thu May 22 04:41:11 2014
(r266528)
+++ head/etc/sendmail/freebsd.submit.mc Thu May 22 04:43:40 2014
(r266529)
@@ -9,7 +9,6 @@ divert(-1)
 #
 #
 
-
 #
 #  This is the FreeBSD configuration for a set-group-ID sm-msp sendmail
 #  that acts as a initial mail submission program.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266528 - head/contrib/sendmail

2014-05-21 Thread Gregory Neil Shapiro
Author: gshapiro
Date: Thu May 22 04:41:11 2014
New Revision: 266528
URL: http://svnweb.freebsd.org/changeset/base/266528

Log:
  Update for sendmail 8.14.9 import
  
  MFC after:3 days

Modified:
  head/contrib/sendmail/FREEBSD-upgrade

Modified: head/contrib/sendmail/FREEBSD-upgrade
==
--- head/contrib/sendmail/FREEBSD-upgrade   Thu May 22 04:39:17 2014
(r266527)
+++ head/contrib/sendmail/FREEBSD-upgrade   Thu May 22 04:41:11 2014
(r266528)
@@ -1,6 +1,6 @@
 $FreeBSD$
 
-sendmail 8.14.8
+sendmail 8.14.9
originals can be found at: ftp://ftp.sendmail.org/pub/sendmail/
 
 For the import of sendmail, the following directories were renamed:
@@ -97,4 +97,4 @@ infrastructure in FreeBSD:
usr.sbin/mailwrapper/Makefile
 
 gshap...@freebsd.org
-26-January-2014
+21-May-2014
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266524 - in head/sys/amd64: include vmm

2014-05-21 Thread Neel Natu
Author: neel
Date: Thu May 22 03:14:54 2014
New Revision: 266524
URL: http://svnweb.freebsd.org/changeset/base/266524

Log:
  Inject page fault into the guest if the page table walker detects an invalid
  translation for the guest linear address.

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/include/vmm_instruction_emul.h
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_instruction_emul.c

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hThu May 22 00:46:03 2014
(r266523)
+++ head/sys/amd64/include/vmm.hThu May 22 03:14:54 2014
(r266524)
@@ -236,6 +236,7 @@ int vm_exception_pending(struct vm *vm, 
 
 void vm_inject_gp(struct vm *vm, int vcpuid); /* general protection fault */
 void vm_inject_ud(struct vm *vm, int vcpuid); /* undefined instruction fault */
+void vm_inject_pf(struct vm *vm, int vcpuid, int error_code); /* page fault */
 
 #endif /* KERNEL */
 

Modified: head/sys/amd64/include/vmm_instruction_emul.h
==
--- head/sys/amd64/include/vmm_instruction_emul.h   Thu May 22 00:46:03 
2014(r266523)
+++ head/sys/amd64/include/vmm_instruction_emul.h   Thu May 22 03:14:54 
2014(r266524)
@@ -122,6 +122,16 @@ int vmm_fetch_instruction(struct vm *vm,
  enum vie_paging_mode paging_mode, int cpl,
  struct vie *vie);
 
+/*
+ * Translate the guest linear address 'gla' to a guest physical address.
+ *
+ * Returns 0 on success and '*gpa' contains the result of the translation.
+ * Returns 1 if a page fault exception was injected into the guest.
+ * Returns -1 otherwise.
+ */
+int vmm_gla2gpa(struct vm *vm, int vcpuid, uint64_t gla, uint64_t cr3,
+uint64_t *gpa, enum vie_paging_mode paging_mode, int cpl, int prot);
+
 void vie_init(struct vie *vie);
 
 /*

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cThu May 22 00:46:03 2014(r266523)
+++ head/sys/amd64/vmm/vmm.cThu May 22 03:14:54 2014(r266524)
@@ -1155,9 +1155,14 @@ vm_handle_inst_emul(struct vm *vm, int v
vie_init(vie);
 
/* Fetch, decode and emulate the faulting instruction */
-   if (vmm_fetch_instruction(vm, vcpuid, rip, inst_length, cr3,
-   paging_mode, cpl, vie) != 0)
+   error = vmm_fetch_instruction(vm, vcpuid, rip, inst_length, cr3,
+   paging_mode, cpl, vie);
+   if (error == 1)
+   return (0); /* Resume guest to handle page fault */
+   else if (error == -1)
return (EFAULT);
+   else if (error != 0)
+   panic("%s: vmm_fetch_instruction error %d", __func__, error);
 
if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, vie) != 0)
return (EFAULT);
@@ -1431,6 +1436,18 @@ vm_inject_fault(struct vm *vm, int vcpui
 }
 
 void
+vm_inject_pf(struct vm *vm, int vcpuid, int error_code)
+{
+   struct vm_exception pf = {
+   .vector = IDT_PF,
+   .error_code_valid = 1,
+   .error_code = error_code
+   };
+
+   vm_inject_fault(vm, vcpuid, &pf);
+}
+
+void
 vm_inject_gp(struct vm *vm, int vcpuid)
 {
struct vm_exception gpf = {

Modified: head/sys/amd64/vmm/vmm_instruction_emul.c
==
--- head/sys/amd64/vmm/vmm_instruction_emul.c   Thu May 22 00:46:03 2014
(r266523)
+++ head/sys/amd64/vmm/vmm_instruction_emul.c   Thu May 22 03:14:54 2014
(r266524)
@@ -572,6 +572,23 @@ vie_init(struct vie *vie)
vie->index_register = VM_REG_LAST;
 }
 
+static int
+pf_error_code(int usermode, int prot, uint64_t pte)
+{
+   int error_code = 0;
+
+   if (pte & PG_V)
+   error_code |= PGEX_P;
+   if (prot & VM_PROT_WRITE)
+   error_code |= PGEX_W;
+   if (usermode)
+   error_code |= PGEX_U;
+   if (prot & VM_PROT_EXECUTE)
+   error_code |= PGEX_I;
+
+   return (error_code);
+}
+
 static void
 ptp_release(void **cookie)
 {
@@ -591,11 +608,11 @@ ptp_hold(struct vm *vm, vm_paddr_t ptpph
return (ptr);
 }
 
-static int
-gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, uint64_t *gpa,
-enum vie_paging_mode paging_mode, int cpl, int prot)
+int
+vmm_gla2gpa(struct vm *vm, int vcpuid, uint64_t gla, uint64_t ptpphys,
+uint64_t *gpa, enum vie_paging_mode paging_mode, int cpl, int prot)
 {
-   int nlevels, ptpshift, ptpindex, retval, usermode, writable;
+   int nlevels, pfcode, ptpshift, ptpindex, retval, usermode, writable;
u_int retries;
uint64_t *ptpbase, pte, pgsize;
uint32_t *ptpbase32, pte32;
@@ -604,7 +621,7 @@ gla2gpa(struct vm *vm, uint64_t gla, uin
usermode = (cpl == 3 ?

svn commit: r266520 - head/cddl/lib/libzfs

2014-05-21 Thread Xin LI
Author: delphij
Date: Thu May 22 00:01:31 2014
New Revision: 266520
URL: http://svnweb.freebsd.org/changeset/base/266520

Log:
  Explicitly link libzfs against libavl as it is done in OpenSolaris
  (4543:12bb2876a62e).  Without this, some third party applications
  may break because the lack of AVL related symbols.
  
  FreeBSD base system are not affected because the FreeBSD ZFS command
  line tools were all linked against libavl and thus hide the underlying
  issue.
  
  PR:   java/183081
  Tested by:jkim
  MFC after:3 days

Modified:
  head/cddl/lib/libzfs/Makefile

Modified: head/cddl/lib/libzfs/Makefile
==
--- head/cddl/lib/libzfs/Makefile   Wed May 21 23:04:47 2014
(r266519)
+++ head/cddl/lib/libzfs/Makefile   Thu May 22 00:01:31 2014
(r266520)
@@ -7,8 +7,8 @@
 
 LIB=   zfs
 DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \
-   ${LIBZFS_CORE}
-LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lzfs_core
+   ${LIBAVL} ${LIBZFS_CORE}
+LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lavl -lzfs_core
 
 SRCS=  deviceid.c \
fsshare.c \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-05-21 Thread Scott Long via svn-src-head

On May 21, 2014, at 10:03 AM, Konstantin Belousov  wrote:

>> 
> You changed the handling of the alignment, which is probably not correct.
> The problematic parameter, if any, is boundary.

Thanks, this crept in when I re-formatted the code for check-in.  I’ll fix it.

Scott



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r266518 - head/sys/mips/conf

2014-05-21 Thread Sean Bruno
Author: sbruno
Date: Wed May 21 21:30:00 2014
New Revision: 266518
URL: http://svnweb.freebsd.org/changeset/base/266518

Log:
  Remove duplicate:
  optionAH_DEBUG_ALQ

Modified:
  head/sys/mips/conf/AR933X_BASE

Modified: head/sys/mips/conf/AR933X_BASE
==
--- head/sys/mips/conf/AR933X_BASE  Wed May 21 20:30:52 2014
(r266517)
+++ head/sys/mips/conf/AR933X_BASE  Wed May 21 21:30:00 2014
(r266518)
@@ -90,7 +90,6 @@ deviceath_ar9300  # AR9330 HAL; 
no nee
 option AH_DEBUG
 option AH_SUPPORT_AR5416   # 11n HAL support
 option AH_SUPPORT_AR9330   # Chipset support
-option AH_DEBUG_ALQ
 option AH_AR5416_INTERRUPT_MITIGATION
 
 device mii
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r265927 - head/sys/dev/vt

2014-05-21 Thread Hans Petter Selasky

On 05/12/14 21:29, Aleksandr Rybalko wrote:

Author: ray
Date: Mon May 12 19:29:38 2014
New Revision: 265927
URL: http://svnweb.freebsd.org/changeset/base/265927

Log:
   Update terminal sizes in any case when new vt(4) driver arrive.
   (Plus remove one unused newline)

   Sponsored by:The FreeBSD Foundation

Modified:
   head/sys/dev/vt/vt_core.c



This patch causes panic when booting the RPI-B:

VT: initialize with new VT driver "fb".
panic: mtx_lock() of spin mutex (null) @ 
/usr/img/freebsd/sys/dev/vt/vt_core.c:2037

KDB: enter: panic
[ thread pid 0 tid 10 ]
Stopped at  $d: ldrbr15, [r15, r15, ror r15]!

__mtx_lock_flags() at
vt_resize() at vt_upgrade() at
mi_startup() at mi_startup+0x11c


--HPS

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


Re: svn commit: r266083 - in head/sys/arm: arm include

2014-05-21 Thread Hans Petter Selasky

On 05/14/14 21:11, Mark Murray wrote:

Author: markm
Date: Wed May 14 19:11:15 2014
New Revision: 266083
URL: http://svnweb.freebsd.org/changeset/base/266083

Log:
   Give suitably-endowed ARMs a register similar to the x86 TSC register.



Hi,

Regression issue:
This commit prevents RPI-B from booting.

--HPS

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


svn commit: r266515 - head/sys/boot/fdt

2014-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 21 18:02:19 2014
New Revision: 266515
URL: http://svnweb.freebsd.org/changeset/base/266515

Log:
  "%p" formatting already includes "0x" prefix in printout.

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Wed May 21 17:39:49 2014
(r266514)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Wed May 21 18:02:19 2014
(r266515)
@@ -233,7 +233,7 @@ fdt_load_dtb_addr(struct fdt_header *hea
 {
int err;
 
-   debugf("fdt_load_dtb_addr(0x%p)\n", header);
+   debugf("fdt_load_dtb_addr(%p)\n", header);
 
fdtp_size = fdt_totalsize(header);
err = fdt_check_header(header);
@@ -321,7 +321,7 @@ fdt_setup_fdtp()
if (*p == '\0') {
if (fdt_load_dtb_addr(hdr) == 0) {
printf("Using DTB provided by U-Boot at "
-   "address 0x%p.\n", hdr);
+   "address %p.\n", hdr);
return (0);
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266514 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:39:49 2014
New Revision: 266514
URL: http://svnweb.freebsd.org/changeset/base/266514

Log:
  Fix CID 1204379 (vtoc8.c) & CID 1204380 (bsd.c): Cast ncyls to lba_t
  before multiplying the 32-bit integrals to avoid any possibility of
  truncation before widening. Not a likely scenario to begin with...

Modified:
  head/usr.bin/mkimg/bsd.c
  head/usr.bin/mkimg/vtoc8.c

Modified: head/usr.bin/mkimg/bsd.c
==
--- head/usr.bin/mkimg/bsd.cWed May 21 17:38:56 2014(r266513)
+++ head/usr.bin/mkimg/bsd.cWed May 21 17:39:49 2014(r266514)
@@ -80,7 +80,7 @@ bsd_write(lba_t imgsz, void *bootcode)
} else
memset(buf, 0, BBSIZE);
 
-   imgsz = ncyls * nheads * nsecs;
+   imgsz = (lba_t)ncyls * nheads * nsecs;
error = image_set_size(imgsz);
if (error) {
free(buf);

Modified: head/usr.bin/mkimg/vtoc8.c
==
--- head/usr.bin/mkimg/vtoc8.c  Wed May 21 17:38:56 2014(r266513)
+++ head/usr.bin/mkimg/vtoc8.c  Wed May 21 17:39:49 2014(r266514)
@@ -71,7 +71,7 @@ vtoc8_write(lba_t imgsz, void *bootcode 
int error, n;
uint16_t ofs, sum;
 
-   imgsz = ncyls * nheads * nsecs;
+   imgsz = (lba_t)ncyls * nheads * nsecs;
 
memset(&vtoc8, 0, sizeof(vtoc8));
sprintf(vtoc8.ascii, "FreeBSD%lldM",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266513 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:38:56 2014
New Revision: 266513
URL: http://svnweb.freebsd.org/changeset/base/266513

Log:
  Fix CID 1204394: Use strncpy(3) instead of strcpy(3). Note that it's
  ok to not have the name and type strings terminated.

Modified:
  head/usr.bin/mkimg/apm.c

Modified: head/usr.bin/mkimg/apm.c
==
--- head/usr.bin/mkimg/apm.cWed May 21 17:38:14 2014(r266512)
+++ head/usr.bin/mkimg/apm.cWed May 21 17:38:56 2014(r266513)
@@ -86,8 +86,8 @@ apm_write(lba_t imgsz, void *bootcode __
be32enc(&ent->ent_pmblkcnt, nparts + 1);
be32enc(&ent->ent_start, 1);
be32enc(&ent->ent_size, nparts + 1);
-   strcpy(ent->ent_type, APM_ENT_TYPE_SELF);
-   strcpy(ent->ent_name, "Apple");
+   strncpy(ent->ent_type, APM_ENT_TYPE_SELF, sizeof(ent->ent_type));
+   strncpy(ent->ent_name, "Apple", sizeof(ent->ent_name));
 
STAILQ_FOREACH(part, &partlist, link) {
ent = (void *)(buf + (part->index + 2) * secsz);
@@ -95,9 +95,11 @@ apm_write(lba_t imgsz, void *bootcode __
be32enc(&ent->ent_pmblkcnt, nparts + 1);
be32enc(&ent->ent_start, part->block);
be32enc(&ent->ent_size, part->size);
-   strcpy(ent->ent_type, ALIAS_TYPE2PTR(part->type));
+   strncpy(ent->ent_type, ALIAS_TYPE2PTR(part->type),
+   sizeof(ent->ent_type));
if (part->label != NULL)
-   strcpy(ent->ent_name, part->label);
+   strncpy(ent->ent_name, part->label,
+   sizeof(ent->ent_name));
}
 
error = image_write(0, buf, nparts + 2);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266512 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:38:14 2014
New Revision: 266512
URL: http://svnweb.freebsd.org/changeset/base/266512

Log:
  Fix CID 1215124: Handle errors properly.

Modified:
  head/usr.bin/mkimg/image.c

Modified: head/usr.bin/mkimg/image.c
==
--- head/usr.bin/mkimg/image.c  Wed May 21 17:37:22 2014(r266511)
+++ head/usr.bin/mkimg/image.c  Wed May 21 17:38:14 2014(r266512)
@@ -119,8 +119,12 @@ image_copyout(int fd)
}
}
free(buffer);
+   if (error)
+   return (error);
ofs = lseek(fd, 0L, SEEK_CUR);
-   ftruncate(fd, ofs);
+   if (ofs == -1)
+   return (errno);
+   error = (ftruncate(fd, ofs) == -1) ? errno : 0;
return (error);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266511 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:37:22 2014
New Revision: 266511
URL: http://svnweb.freebsd.org/changeset/base/266511

Log:
  Fix CID 1215125: fstat(2) returns -1 on error and sets errno. It does
  not return the error (oops).

Modified:
  head/usr.bin/mkimg/scheme.c

Modified: head/usr.bin/mkimg/scheme.c
==
--- head/usr.bin/mkimg/scheme.c Wed May 21 17:36:12 2014(r266510)
+++ head/usr.bin/mkimg/scheme.c Wed May 21 17:37:22 2014(r266511)
@@ -103,14 +103,12 @@ int
 scheme_bootcode(int fd)
 {
struct stat sb;
-   int error;
 
if (scheme->bootcode == 0)
return (ENXIO);
 
-   error = fstat(fd, &sb);
-   if (error)
-   return (error);
+   if (fstat(fd, &sb) == -1)
+   return (errno);
if (sb.st_size > scheme->bootcode)
return (EFBIG);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266510 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:36:12 2014
New Revision: 266510
URL: http://svnweb.freebsd.org/changeset/base/266510

Log:
  Fix CID 1215128: Free the allocated buf when image_set_size()
  returns and error and we return from bsd_write().

Modified:
  head/usr.bin/mkimg/bsd.c

Modified: head/usr.bin/mkimg/bsd.c
==
--- head/usr.bin/mkimg/bsd.cWed May 21 17:34:50 2014(r266509)
+++ head/usr.bin/mkimg/bsd.cWed May 21 17:36:12 2014(r266510)
@@ -82,8 +82,10 @@ bsd_write(lba_t imgsz, void *bootcode)
 
imgsz = ncyls * nheads * nsecs;
error = image_set_size(imgsz);
-   if (error)
+   if (error) {
+   free(buf);
return (error);
+   }
 
d = (void *)(buf + secsz);
le32enc(&d->d_magic, DISKMAGIC);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266509 - head/usr.bin/mkimg

2014-05-21 Thread Marcel Moolenaar
Author: marcel
Date: Wed May 21 17:34:50 2014
New Revision: 266509
URL: http://svnweb.freebsd.org/changeset/base/266509

Log:
  Fix CID 1215129: move the call to lseek(2) before the call to malloc(3)
  so that the error path (taken due to lseek(2) failing) isn't leaking
  memory.

Modified:
  head/usr.bin/mkimg/image.c

Modified: head/usr.bin/mkimg/image.c
==
--- head/usr.bin/mkimg/image.c  Wed May 21 17:22:41 2014(r266508)
+++ head/usr.bin/mkimg/image.c  Wed May 21 17:34:50 2014(r266509)
@@ -98,11 +98,11 @@ image_copyout(int fd)
 
ofs = lseek(fd, 0L, SEEK_CUR);
 
+   if (lseek(image_fd, 0, SEEK_SET) != 0)
+   return (errno);
buffer = malloc(BUFFER_SIZE);
if (buffer == NULL)
return (errno);
-   if (lseek(image_fd, 0, SEEK_SET) != 0)
-   return (errno);
error = 0;
while (1) {
rdsz = read(image_fd, buffer, BUFFER_SIZE);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266508 - head/sys/dev/usb/controller

2014-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 21 17:22:41 2014
New Revision: 266508
URL: http://svnweb.freebsd.org/changeset/base/266508

Log:
  Implement interrupt endpoint methods for host mode transfers.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/usb/controller/saf1761_otg.c
  head/sys/dev/usb/controller/saf1761_otg.h

Modified: head/sys/dev/usb/controller/saf1761_otg.c
==
--- head/sys/dev/usb/controller/saf1761_otg.c   Wed May 21 17:02:21 2014
(r266507)
+++ head/sys/dev/usb/controller/saf1761_otg.c   Wed May 21 17:22:41 2014
(r266508)
@@ -561,13 +561,195 @@ complete:
 static uint8_t
 saf1761_host_intr_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td 
*td)
 {
+   uint32_t pdt_addr;
+   uint32_t temp;
+
+   if (td->channel < SOTG_HOST_CHANNEL_MAX) {
+   uint32_t status;
+   uint32_t count;
+   uint8_t got_short;
+
+   pdt_addr = SOTG_PDT(td->channel);
+
+   saf1761_read_host_memory_4(sc, pdt_addr + SOTG_PDT_DW3, 
&status, 1);
+
+   if (status & SOTG_PDT_DW3_ACTIVE) {
+   goto busy;
+   } else if (status & SOTG_PDT_DW3_HALTED) {
+   td->error_stall = 1;
+   td->error_any = 1;
+   goto complete;
+   }
+
+   count = (status & SOTG_PDT_DW3_XFER_COUNT);
+   got_short = 0;
+
+   /* verify the packet byte count */
+   if (count != td->max_packet_size) {
+   if (count < td->max_packet_size) {
+   /* we have a short packet */
+   td->short_pkt = 1;
+   got_short = 1;
+   } else {
+   /* invalid USB packet */
+   td->error_any = 1;
+   goto complete;
+   }
+   }
+   td->toggle ^= 1;
+
+   /* verify the packet byte count */
+   if (count > td->remainder) {
+   /* invalid USB packet */
+   td->error_any = 1;
+   goto complete;
+   }
+
+   saf1761_read_host_memory_4(sc, SOTG_DATA_ADDR(td->channel),
+   sc->sc_bounce_buffer, (count + 3) / 4);
+
+   usbd_copy_in(td->pc, td->offset,
+   sc->sc_bounce_buffer, count);
+
+   td->remainder -= count;
+   td->offset += count;
+
+   saf1761_host_channel_free(sc, td);
+
+   /* check if we are complete */
+   if ((td->remainder == 0) || got_short) {
+   if (td->short_pkt)
+   goto complete;
+   /* else need to receive a zero length packet */
+   }
+   }
+   if (saf1761_host_channel_alloc(sc, td))
+   goto busy;
+
+   /* set toggle, if any */
+   if (td->set_toggle) {
+   td->set_toggle = 0;
+   td->toggle = 1;
+   }
+
+   /* receive one more packet */
+
+   pdt_addr = SOTG_PDT(td->channel);
+
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW7, 0);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW6, 0);
+
+   temp = (0xFC << td->uframe) & 0xFF; /* complete split */
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW5, temp);
+
+   temp = (1U << td->uframe);  /* start split */
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW4, temp);
+
+   temp = SOTG_PDT_DW3_ACTIVE | (td->toggle << 25) | SOTG_PDT_DW3_CERR;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW3, temp);
+
+   temp = (SOTG_HC_MEMORY_ADDR(SOTG_DATA_ADDR(td->channel)) << 8) | 
td->interval;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW2, temp);
+
+   temp = td->dw1_value | (1 << 10) /* IN-PID */ | (td->ep_index >> 1);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW1, temp);
+
+   temp = (td->ep_index << 31) | (1 << 29) /* pkt-multiplier */ |
+   (td->max_packet_size << 18) /* wMaxPacketSize */ |
+   (td->max_packet_size << 3) /* transfer count */ |
+   SOTG_PDT_DW0_VALID;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW0, temp);
+busy:
return (1); /* busy */
+complete:
+   return (0); /* complete */
 }
 
 static uint8_t
 saf1761_host_intr_data_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td 
*td)
 {
+   uint32_t pdt_addr;
+   uint32_t temp;
+   uint32_t count;
+
+   if (td->channel < SOTG_HOST_CHANNEL_MAX) {
+   uint32_t status;
+
+   pdt_addr = SOTG_PDT(td->channel);
+
+   saf1761_read_host_memory_4(sc, pdt_addr + SOTG_PDT_DW3, 
&status, 1);
+
+   if (status & SOTG_PDT_DW3_ACTIVE) {
+   goto busy;
+ 

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

2014-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 21 16:52:55 2014
New Revision: 266505
URL: http://svnweb.freebsd.org/changeset/base/266505

Log:
  - Split transmit queue into one for each type. Apparently there will
  be a race when using a single active queue for all transmit types.
  - Last argument of usb_pause_mtx() is ticks and not milliseconds.
  - Remove unused watchdog.
  - Remove some unused fields from the RSU softc structure.
  - Workaround usbd_transfer_start() recursion from inside of completion
  callback.
  
  MFC after:3 days

Modified:
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/dev/usb/wlan/if_rsureg.h

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Wed May 21 16:50:22 2014
(r266504)
+++ head/sys/dev/usb/wlan/if_rsu.c  Wed May 21 16:52:55 2014
(r266505)
@@ -128,7 +128,10 @@ static const STRUCT_USB_HOST_ID rsu_devs
 static device_probe_t   rsu_match;
 static device_attach_t  rsu_attach;
 static device_detach_t  rsu_detach;
-static usb_callback_t   rsu_bulk_tx_callback;
+static usb_callback_t   rsu_bulk_tx_callback_0;
+static usb_callback_t   rsu_bulk_tx_callback_1;
+static usb_callback_t   rsu_bulk_tx_callback_2;
+static usb_callback_t   rsu_bulk_tx_callback_3;
 static usb_callback_t   rsu_bulk_rx_callback;
 static usb_error_t rsu_do_request(struct rsu_softc *,
struct usb_device_request *, void *);
@@ -187,11 +190,10 @@ static intrsu_raw_xmit(struct ieee80211
const struct ieee80211_bpf_params *);
 static voidrsu_init(void *);
 static voidrsu_init_locked(struct rsu_softc *);
-static voidrsu_watchdog(void *);
 static int rsu_tx_start(struct rsu_softc *, struct ieee80211_node *, 
-   struct mbuf *, struct rsu_data *, struct usb_xfer *);
+   struct mbuf *, struct rsu_data *);
 static voidrsu_start(struct ifnet *);
-static voidrsu_start_locked(struct ifnet *, struct usb_xfer *);
+static voidrsu_start_locked(struct ifnet *);
 static int rsu_ioctl(struct ifnet *, u_long, caddr_t);
 static voidrsu_stop(struct ifnet *, int);
 static voidrsu_stop_locked(struct ifnet *, int);
@@ -241,7 +243,7 @@ static const struct usb_config rsu_confi
.pipe_bof = 1,
.force_short_xfer = 1
},
-   .callback = rsu_bulk_tx_callback,
+   .callback = rsu_bulk_tx_callback_0,
.timeout = RSU_TX_TIMEOUT
},
[RSU_BULK_TX_BK] = {
@@ -254,7 +256,7 @@ static const struct usb_config rsu_confi
.pipe_bof = 1,
.force_short_xfer = 1
},
-   .callback = rsu_bulk_tx_callback,
+   .callback = rsu_bulk_tx_callback_1,
.timeout = RSU_TX_TIMEOUT
},
[RSU_BULK_TX_VI] = {
@@ -267,7 +269,7 @@ static const struct usb_config rsu_confi
.pipe_bof = 1,
.force_short_xfer = 1
},
-   .callback = rsu_bulk_tx_callback,
+   .callback = rsu_bulk_tx_callback_2,
.timeout = RSU_TX_TIMEOUT
},
[RSU_BULK_TX_VO] = {
@@ -280,7 +282,7 @@ static const struct usb_config rsu_confi
.pipe_bof = 1,
.force_short_xfer = 1
},
-   .callback = rsu_bulk_tx_callback,
+   .callback = rsu_bulk_tx_callback_3,
.timeout = RSU_TX_TIMEOUT
},
 };
@@ -316,7 +318,6 @@ rsu_attach(device_t self)
MTX_DEF);
TIMEOUT_TASK_INIT(taskqueue_thread, &sc->calib_task, 0, 
rsu_calib_task, sc);
-   callout_init(&sc->sc_watchdog_ch, 0);
 
iface_index = 0;
error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
@@ -428,7 +429,6 @@ rsu_detach(device_t self)
usbd_transfer_unsetup(sc->sc_xfer, RSU_N_TRANSFER);
ieee80211_ifdetach(ic);
 
-   callout_drain(&sc->sc_watchdog_ch);
taskqueue_drain_timeout(taskqueue_thread, &sc->calib_task);
 
/* Free Tx/Rx buffers. */
@@ -598,9 +598,12 @@ rsu_alloc_tx_list(struct rsu_softc *sc)
if (error != 0)
return (error);
 
-   STAILQ_INIT(&sc->sc_tx_active);
STAILQ_INIT(&sc->sc_tx_inactive);
-   STAILQ_INIT(&sc->sc_tx_pending);
+
+   for (i = 0; i != RSU_MAX_TX_EP; i++) {
+   STAILQ_INIT(&sc->sc_tx_active[i]);
+   STAILQ_INIT(&sc->sc_tx_pending[i]);
+   }
 
for (i = 0; i < RSU_TX_LIST_COUNT; i++) {
STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, &sc->sc_tx[i], next);
@@ -843,10 +846,12 @@ rsu_read_rom(struct rsu_softc *sc)
 static int
 rsu_fw_cmd(struct rsu_softc *sc, uint8_t code, void *buf, int len)
 {
+   const uint8_t which = RSU_BULK_TX_VO - RSU_BULK_TX_BE;
struct rsu_

Re: svn commit: r266423 - in head/sys: conf dev/i40e modules/i40e

2014-05-21 Thread Bruce Evans

On Tue, 20 May 2014, Gleb Smirnoff wrote:


On Tue, May 20, 2014 at 11:40:01PM +1000, Bruce Evans wrote:
B> Also, verbose names break formatting.  E.g., netstat -r has 5 columns
B> available under Netif for the driver name and device number.  netstat
B> -i has about the same under Name (possibly 1 or 2 not directly under
B> Name, but reserved for the Name column).  systat has 3 columns
B> available, but with a more flexible format that truncates other info.
B> All driver name+numbers are broken now on freefall:

We must admit that nowadays 80x25 terminal is not enough :(


Yes, much smaller formats are needed now for small portable screens.
My phone is low-end so it is 29 or 30 wide.

80 is also too wide.  Most books use more like 60.  Most (?) newspapers
use more like 30, with many columns.


Would be cool if most of tools (netstat, systat, etc...) could
determine size of terminal and dynamically widen all their fields.


You mean, determine the size and dynamically narrow all their fields
:-).  This is hard to do.  Curses-based applications like top and
systat should do a combination of horizontal and vertical scrolling
and variant displays, but this is also hard to do.  top and systat
already have some variant displays but are too simple to do much.  You
can send raw output to a terminal or window that does the scrolling,
but this doesn't work for repeated output.


Thus, tool can run w/o any abbreviations when run in a script mode,
run abbreviated on a small terminal, and run verbose on a wide
terminal.

This sounds like a generic library providing a special version
of printf(3), which specifies minimal and maximum sizes for fields
and when extra terminal width is available it distributes this
width evenly between all fields. Name it 'elastic printf'.
Sounds like a nice Google SoC project. Or might be that such
library already exists.


Try doing that with systat -v output.  Even programming tools for
generating fixed forms like the ones used in systat are deficient
in FreeBSD.  All screen locations are almost hard-coded (just as
offsets) and hard to change.  Some of this is from primitive use
of curses, with no subwindows.

Before doing that, just handle arbitrary columnar output (with headers)
in a filter.  This can almost be done in an awk script.  Field
separators might be a problem.  Consider "vmstat 1 output".  It is
messed up by the header being 2 lines with the first line not being
in normal columnar format (some of its keywords are for multiple
columns).  A dumb filter can handle headers without knowing that they
are special provided they are in columnar format, but even this minor
complication seems to be difficult to handle without knowing what the
headers mean.

Here is a not so dumb filter using awk.  vmstat output is so broken in
-current that even this simple filter improves the formatting significantly.

@BEGIN {
@   columns = 79# XXX
@}
@
@{
@   # Determine fields and field widths for current line.
@   # awk's field splitting feature turned out to be inadequate,
@   # and this would be even easier in C.
@   n = split($0, a, "")
@   f = 1
@   j = 1
@   while (j <= n) {
@   cpw[f] = 0;
@   cfw[f] = 0;
@   while (j <= n && a[j] == " ") {
@   cpw[f]++# current (left) padding width
@   j++
@   }
@   while (j <= n && a[j] != " ") {
@   cfw[f]++# current field width without padding
@   j++
@   }
@   fld[f] = substr($0, j - cfw[f], cfw[f])
@   f++
@   }
@   nf = f  # no need to use or trust NF
@
@   if (NR == 1 || NR < 10 && nf != anf) {
@   # Make current field widths active.  When NR > 1, this
@   # discards the previous active field widths.  Good enough
@   # for vmstat, where the widths from NR == 1 are garbage.
@   anf = nf
@   for (f = 1; f <= anf; f++)
@   afw[f] = cpw[f] + cfw[f]
@
@   # Convert current (unpadded) field widths to minumum (padded)
@   # field widths.
@   mfw[1] = cfw[1]
@   for (f = 2; f <= anf; f++)
@   mfw[f] = 1 + cfw[f]
@   } else if (nf != anf) {
@   # Some non-tabular line after warming up.  Probably an ornate
@   # line in the next header.  Too hard to handle properly.
@   printf("%.*s\n", columns, $0)
@   fflush(stdout)
@   next
@   } else {
@   # Update  and minimum field widths if this line needs
@   # wider fields.
@   if (afw[1] < cfw[1])
@   afw[1] = cfw[1]
@   len = afw[1]
@   if (mfw[1] < cfw[1])
@   mfw[1] = cfw[1]
@   for (f = 2; f <= nf; f++) {
@ 

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

2014-05-21 Thread Konstantin Belousov
On Tue, May 20, 2014 at 10:43:18PM +, Scott Long wrote:
> Author: scottl
> Date: Tue May 20 22:43:17 2014
> New Revision: 266481
> URL: http://svnweb.freebsd.org/changeset/base/266481
> 
> Log:
>   Old PCIe implementations cannot allow a DMA transfer to cross a 4GB
>   boundary.  This was addressed several years ago by creating a parent
>   tag hierarchy for the root buses that set the boundary restriction
>   for appropriate buses and allowed child deviced to inherit it.
>   Somewhere along the way, this restriction was turned into a case for
>   marking the tag as a candidate for needing bounce buffers, instead
>   of just splitting the segment along the boundary line.  This flag
>   also causes all maps associated with this tag to be non-NULL, which
>   in turn causes bus_dmamap_sync() to take the slow path of function
>   pointer indirection to discover that there's no bouncing work to
>   do.  The end result is a lot of pages set aside in bounce pools
>   that will never be used, and a slow path for data buffers in nearly
>   every DMA-capable PCIe device.  For example, our workload at Netflix
>   was spending nearly 1% of all CPU time going through this slow path.
>   
>   Fix this problem by being more selective about when to set the
>   COULD_BOUNCE flag.  Only set it when the boundary restriction
>   exists and the consumer cannot do more than a single DMA segment
>   at once.  This fixes the case of dynamic buffers (mbufs, bio's)
>   but doesn't address static buffers allocated from bus_dmamem_alloc().
>   That case will be addressed in the future.
>   
>   For those interested, this was discovered thanks to Dtrace Flame
>   Graphs.
>   
>   Discussed with: jhb, kib
>   Obtained from:  Netflix, Inc.
>   MFC after:  3 days
> 
> Modified:
>   head/sys/x86/x86/busdma_bounce.c
> 
> Modified: head/sys/x86/x86/busdma_bounce.c
> ==
> --- head/sys/x86/x86/busdma_bounce.c  Tue May 20 22:11:52 2014
> (r266480)
> +++ head/sys/x86/x86/busdma_bounce.c  Tue May 20 22:43:17 2014
> (r266481)
> @@ -172,12 +172,35 @@ bounce_bus_dma_tag_create(bus_dma_tag_t 
>   newtag->map_count = 0;
>   newtag->segments = NULL;
>  
> + /*
> +  * Bouncing might be needed if there's a filter.
> +  * XXX Filters are likely broken as there's no way to
> +  * guarantee that bounce pages will also satisfy the
> +  * filter requirement.
> +  */
>   if (parent != NULL && ((newtag->common.filter != NULL) ||
>   ((parent->common.flags & BUS_DMA_COULD_BOUNCE) != 0)))
>   newtag->common.flags |= BUS_DMA_COULD_BOUNCE;
>  
> - if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem) ||
> - newtag->common.alignment > 1)
> + /*
> +  * Bouncing might be needed if there's an upper memory
> +  * restriction.
> +  */
> + if (newtag->common.lowaddr < ptoa((vm_paddr_t)Maxmem))
> + newtag->common.flags |= BUS_DMA_COULD_BOUNCE;
> +
> + /*
> +  * Bouncing might be needed if there's an alignment
> +  * restriction that can't be satisfied by breaking up
> +  * the segment.
> +  * XXX Need to consider non-natural alignment.
> +  * XXX Static allocations that tie to bus_dmamem_alloc()
> +  * will likely pass this test and be penalized with
> +  * the COULD_BOUNCE flag.  Should probably have
> +  * bus_dmamem_alloc() clear this flag.
> +  */
> + if ((newtag->common.nsegments <= 1) &&
> + (newtag->common.alignment > 1))
>   newtag->common.flags |= BUS_DMA_COULD_BOUNCE;
>  
>   if (((newtag->common.flags & BUS_DMA_COULD_BOUNCE) != 0) &&
You changed the handling of the alignment, which is probably not correct.
The problematic parameter, if any, is boundary.


pgpMOO_E4_Tix.pgp
Description: PGP signature


Re: svn commit: r266423 - in head/sys: conf dev/i40e modules/i40e

2014-05-21 Thread Bruce Evans

Mostly off-topic:

On Tue, 20 May 2014, Peter Wemm wrote:


On 5/20/14, 9:08 AM, Jack Vogel wrote:

...
Log:
   This is the beta release of the driver for the new
   Intel 40G Ethernet Controller XL710 Family.
...


He didn't write it quite like that, and in another mail mangling program
it was displayed as:

Log:

 This
is
the
beta
release
of
the
driver
for
the
new

 Intel
40G
Ethernet
Controller
XL710
Family.

Hopefully this doesn't get demangled (the original had about 1 line after
"Log:".  This was mangled to 2 lines when it got to my editor, with
quotes broken but some still present, but in my bad mail program it
was displayed in 18 lines with 1 word per line, and with quotes completely
broken.

Good for small screens, but even I don't want formatting for 10-column
terminals.

This is the worst I've seen in mail.  Normally the bugs go the other
way, with lines joined and different bad mail programs displaying them
differently.

In usenet lately, Gurgle goops has been mangling the line feeds much
more, usually by doubling them on every followup, so their number is
exponential in the number of followups.

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


svn commit: r266497 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-05-21 Thread Steven Hartland
Author: smh
Date: Wed May 21 13:36:04 2014
New Revision: 266497
URL: http://svnweb.freebsd.org/changeset/base/266497

Log:
  Added sysctls / tunables for ZFS dirty data tuning
  
  Added the following new sysctls / tunables:
  * vfs.zfs.dirty_data_max
  * vfs.zfs.dirty_data_max_max
  * vfs.zfs.dirty_data_max_percent
  * vfs.zfs.dirty_data_sync
  * vfs.zfs.delay_min_dirty_percent
  * vfs.zfs.delay_scale
  
  PR:   kern/189865
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Wed May 
21 11:53:15 2014(r266496)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Wed May 
21 13:36:04 2014(r266497)
@@ -46,6 +46,11 @@
 #include 
 #include 
 
+#ifdef __FreeBSD__
+#include 
+#include 
+#endif
+
 /*
  * ZFS Write Throttle
  * --
@@ -130,33 +135,83 @@ uint64_t zfs_delay_scale = 1000 * 1000 *
  * per-pool basis using zfs.conf.
  */
 
+#ifdef __FreeBSD__
+
+extern int zfs_vdev_async_write_active_max_dirty_percent;
 
 SYSCTL_DECL(_vfs_zfs);
-#if 0
-TUNABLE_INT("vfs.zfs.no_write_throttle", &zfs_no_write_throttle);
-SYSCTL_INT(_vfs_zfs, OID_AUTO, no_write_throttle, CTLFLAG_RDTUN,
-&zfs_no_write_throttle, 0, "");
-TUNABLE_INT("vfs.zfs.write_limit_shift", &zfs_write_limit_shift);
-SYSCTL_INT(_vfs_zfs, OID_AUTO, write_limit_shift, CTLFLAG_RDTUN,
-&zfs_write_limit_shift, 0, "2^N of physical memory");
-SYSCTL_DECL(_vfs_zfs_txg);
-TUNABLE_INT("vfs.zfs.txg.synctime_ms", &zfs_txg_synctime_ms);
-SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, synctime_ms, CTLFLAG_RDTUN,
-&zfs_txg_synctime_ms, 0, "Target milliseconds to sync a txg");
-
-TUNABLE_QUAD("vfs.zfs.write_limit_min", &zfs_write_limit_min);
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_min, CTLFLAG_RDTUN,
-&zfs_write_limit_min, 0, "Minimum write limit");
-TUNABLE_QUAD("vfs.zfs.write_limit_max", &zfs_write_limit_max);
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_max, CTLFLAG_RDTUN,
-&zfs_write_limit_max, 0, "Maximum data payload per txg");
-TUNABLE_QUAD("vfs.zfs.write_limit_inflated", &zfs_write_limit_inflated);
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_inflated, CTLFLAG_RDTUN,
-&zfs_write_limit_inflated, 0, "Maximum size of the dynamic write limit");
-TUNABLE_QUAD("vfs.zfs.write_limit_override", &zfs_write_limit_override);
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, write_limit_override, CTLFLAG_RDTUN,
-&zfs_write_limit_override, 0,
-"Force a txg if dirty buffers exceed this value (bytes)");
+
+TUNABLE_QUAD("vfs.zfs.dirty_data_max", &zfs_dirty_data_max);
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max, CTLFLAG_RWTUN,
+&zfs_dirty_data_max, 0,
+"The dirty space limit in bytes after which new writes are halted until "
+"space becomes available");
+
+TUNABLE_QUAD("vfs.zfs.dirty_data_max_max", &zfs_dirty_data_max_max);
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_max_max, CTLFLAG_RDTUN,
+&zfs_dirty_data_max_max, 0,
+"The absolute cap on diry_data_max when auto calculating");
+
+TUNABLE_INT("vfs.zfs.dirty_data_max_percent", &zfs_dirty_data_max_percent);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, dirty_data_max_percent, CTLFLAG_RDTUN,
+&zfs_dirty_data_max_percent, 0,
+"The percent of physical memory used to auto calculate dirty_data_max");
+
+TUNABLE_QUAD("vfs.zfs.dirty_data_sync", &zfs_dirty_data_sync);
+SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, dirty_data_sync, CTLFLAG_RWTUN,
+&zfs_dirty_data_sync, 0,
+"Force at txg if the number of dirty buffer bytes exceed this value");
+
+static int sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS);
+/* No zfs_delay_min_dirty_percent tunable due to limit requirements */
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_min_dirty_percent,
+CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int),
+sysctl_zfs_delay_min_dirty_percent, "I",
+"The limit of outstanding dirty data before transations are delayed");
+
+static int sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS);
+/* No zfs_delay_scale tunable due to limit requirements */
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, delay_scale,
+CTLTYPE_U64 | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(uint64_t),
+sysctl_zfs_delay_scale, "QU",
+"Controls how quickly the delay approaches infinity");
+
+static int
+sysctl_zfs_delay_min_dirty_percent(SYSCTL_HANDLER_ARGS)
+{
+   int val, err;
+
+   val = zfs_delay_min_dirty_percent;
+   err = sysctl_handle_int(oidp, &val, 0, req);
+   if (err != 0 || req->newptr == NULL)
+   return (err);
+
+   if (val < zfs_vdev_async_write_active_max_dirty_percent)
+   return (EINVAL);
+
+   zfs_delay_min_dirty_percent = val;
+
+   return (0);
+}
+
+static int
+sysctl_zfs_delay_scale(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t val;
+   int err;
+
+   val =

svn commit: r266496 - head/usr.bin/lock

2014-05-21 Thread Aleksandr Rybalko
Author: ray
Date: Wed May 21 11:53:15 2014
New Revision: 266496
URL: http://svnweb.freebsd.org/changeset/base/266496

Log:
  Sync lock(1) on VT_LOCKSWITCH usage with syscons(4), vt(4) and vidcontrol(1).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/lock/lock.c

Modified: head/usr.bin/lock/lock.c
==
--- head/usr.bin/lock/lock.cWed May 21 11:15:38 2014(r266495)
+++ head/usr.bin/lock/lock.cWed May 21 11:53:15 2014(r266496)
@@ -121,7 +121,7 @@ main(int argc, char **argv)
no_timeout = 1;
break;
case 'v':
-   vtylock = 1;
+   vtylock = 0x2;
break;
case '?':
default:
@@ -193,7 +193,7 @@ main(int argc, char **argv)
(void)tcsetattr(0, TCSADRAIN|TCSASOFT, &tty);
err(1, "locking vty");
}
-   vtyunlock = 0x2;
+   vtyunlock = 0x1;
}
 
/* header info */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266495 - head/sys/dev/vt

2014-05-21 Thread Aleksandr Rybalko
Author: ray
Date: Wed May 21 11:15:38 2014
New Revision: 266495
URL: http://svnweb.freebsd.org/changeset/base/266495

Log:
  Fix tty locking.
  o Correct expected values for VT_LOCKSWITCH ioctl.
  o Check current window for locked state.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed May 21 10:04:51 2014(r266494)
+++ head/sys/dev/vt/vt_core.c   Wed May 21 11:15:38 2014(r266495)
@@ -280,12 +280,12 @@ vt_proc_window_switch(struct vt_window *
struct vt_device *vd;
int ret;
 
-   if (vw->vw_flags & VWF_VTYLOCK)
-   return (EBUSY);
-
vd = vw->vw_device;
curvw = vd->vd_curwindow;
 
+   if (curvw->vw_flags & VWF_VTYLOCK)
+   return (EBUSY);
+
/* Ask current process permitions to switch away. */
if (curvw->vw_smode.mode == VT_PROCESS) {
DPRINTF(30, "%s: VT_PROCESS ", __func__);
@@ -1814,10 +1814,12 @@ skip_thunk:
return (0);
case VT_LOCKSWITCH:
/* TODO: Check current state, switching can be in progress. */
-   if ((*(int *)data) & 0x01)
+   if ((*(int *)data) == 0x01)
+   vw->vw_flags &= ~VWF_VTYLOCK;
+   else if ((*(int *)data) == 0x02)
vw->vw_flags |= VWF_VTYLOCK;
else
-   vw->vw_flags &= ~VWF_VTYLOCK;
+   return (EINVAL);
return (0);
case VT_OPENQRY:
VT_LOCK(vd);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-05-21 Thread Hiroki Sato
Author: hrs
Date: Wed May 21 10:04:51 2014
New Revision: 266494
URL: http://svnweb.freebsd.org/changeset/base/266494

Log:
  - Fix a bug which can make sysctl() fail when -F is specified.
  - Increase WID_IF_DEFAULT() from 6 to 8 (the default for AF_INET6) because
we have interfaces with longer names than 6 chars like epairN{a,b}.
  - Style fixes.

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

Modified: head/usr.bin/netstat/route.c
==
--- head/usr.bin/netstat/route.cWed May 21 09:26:02 2014
(r266493)
+++ head/usr.bin/netstat/route.cWed May 21 10:04:51 2014
(r266494)
@@ -230,13 +230,13 @@ pr_family(int af1)
 #ifndef INET6
 #defineWID_DST_DEFAULT(af) 18  /* width of destination column 
*/
 #defineWID_GW_DEFAULT(af)  18  /* width of gateway column */
-#defineWID_IF_DEFAULT(af)  (Wflag ? 8 : 6) /* width of netif 
column */
+#defineWID_IF_DEFAULT(af)  (Wflag ? 10 : 8) /* width of netif 
column */
 #else
 #defineWID_DST_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18)
 #defineWID_GW_DEFAULT(af) \
((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18)
-#defineWID_IF_DEFAULT(af)  ((af) == AF_INET6 ? 8 : (Wflag ? 8 : 6))
+#defineWID_IF_DEFAULT(af)  ((af) == AF_INET6 ? 8 : (Wflag ? 10 : 
8))
 #endif /*INET6*/
 
 static int wid_dst;
@@ -586,17 +586,13 @@ p_rtable_sysctl(int fibnum, int af)
mib[4] = NET_RT_DUMP;
mib[5] = 0;
mib[6] = fibnum;
-   if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0) {
+   if (sysctl(mib, nitems(mib), NULL, &needed, NULL, 0) < 0)
err(EX_OSERR, "sysctl: net.route.0.%d.dump.%d estimate", af,
fibnum);
-   }
-
-   if ((buf = malloc(needed)) == 0) {
+   if ((buf = malloc(needed)) == NULL)
errx(2, "malloc(%lu)", (unsigned long)needed);
-   }
-   if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+   if (sysctl(mib, nitems(mib), buf, &needed, NULL, 0) < 0)
err(1, "sysctl: net.route.0.%d.dump.%d", af, fibnum);
-   }
lim  = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r266423 - in head/sys: conf dev/i40e modules/i40e

2014-05-21 Thread Bruce Evans

On Tue, 20 May 2014, Jack Vogel wrote:


If you don't like the name there's this wonderful feature of ifconfig

ifconfig i40e0 name eth0 (or whatever pleases you...)


Ah, another bug :-).  If you use this to make a non-null change to the
name, then the name becomes inconsistent with the interrupt name, since
the latter is set at driver initialization time and is not updated if
the if name is changed.


Oh and Bruce, I did run into the string length issue, so with this driver
the queues
are all named 'q%d', I might go back and change the earlier drivers.


Also, there is no way for the user to changes this.  setproctitle() only
works on non-kernel processes

Also, setproctitle() is deficient for renaming even the process name.  It
renames something from p_comm/ki_comm and doesn't go near ki_tdname.
ps and top -a merge ki_comm with the proctitle in a bad way to end up
with a bad combination "foo: bar (foo)".

More lossage from combining ki_comm with ki_tdname: on freefall now, there
are 206 non-kernel threads with more than 1 per process.  After removing
duplicates, there are just 4 combined names in COLUMNS=1000 top -H output:

auditdistd{auditdistd}
irssi{irssi}
nfsd{nfsd: master}
nfsd{nfsd: service}

In all cases, the ki_comm name is uselessly repeated in ki_tdname, and
in almost all cases ki_td_name is useless for distinguishing the
threads.  It distinguish the 1 nfsd "master" from the 191 nfsd
"services".  The "master" is in the same process as the "services".
There is also a separate nfsd process with no threads.  The names are
confusing.  According to logic and nfsd(8), all these threads are
servers, not services.  nfsd(8) says to kill the "master" to kill
all the children, but I think the "master" is the independent process
and not the thread named "nfsd: master", since killing applies to
processes so it makes no sense to have a special thread for killing
the others.  Indeed, the documentation matches old versions of FreeBSD
when the nfsd's were separate processes:

FreeBSD-5.2 (now ps laxwH output):
% 0   556 1 392   4  0   704  456 accept Is??0:00.01 nfsd: 
master (nfsd)
% 0   558   556 319   4  0   576  324 -  I ??0:00.00 nfsd: 
server (nfsd)
%  0   559   556 319   4  0   576  324 -  I ??0:00.00 nfsd: 
server (nfsd)
% ...

This also shows the bad combination of ki_comm proctitle, and the name
"server" not regressed to "service".

-current (ps laxwH):
% 0   707 1   0   52  0  20408   1064 select   Is-  0:00.03 
nfsd: master (nfsd)
% 0   709   707   0   52  0  12216   4104 rpcsvc   S -  0:01.59 
nfsd: server (nfsd)
% 0   709   707   0   52  0  12216   4104 rpcsvc   I -  0:00.00 
nfsd: server (nfsd)

Oops, everything is correct for ps output (the only change is to use threads.
proctitle(3) is used correctly to add master/server to the name, except it
is missing numbering of the servers in both.  Numbering is much more needed
with the disfustingly bloated number of servers on freefall.

It is top that has the bad names.  These are only in ki_tdname.  ps is broken
in another way -- it doesn't show the broken ki_tdname since it doesn't even
display ki_tdname for nfsd.
  (It does display ki_tdname for kernel threads.  The bug there is
  primarily that it uses a different format to top.  It also has a
  keyword "tdnam" for displaying ki_tdname.  Bugs in this start with
  its name not being spelled with an "e" and being undocumented.  It
  is unclear if it is used in standard formats.  It is used in some
  cases in -wH.  The editing problems for combining names are especially
  large for using this keyword.  Adding -o any to a standard format
  makes a mess generally, and adding -o tdnam may or may not duplicate
  details in the standard format.  In practice, ps laxwH -o tdnam gives:

...
% 0 0 0   0  -92  0  0   5856 -DLs   -  0:00.08 
[kernel/igb0 que igb0 que
% 012 0   0  -92  0  0   1120 -WL-  9:37.90 
[intr/irq256: ig irq256: igb0:que
% 0   707 1   0   52  0  20408   1064 select   Is-  0:00.03 nfsd: master (nf 
% 0   709   707   0   52  0  12216   4104 rpcsvc   S -  0:01.59 nfsd: server (nf nfsd: master

% 0   709   707   0   52  0  12216   4104 rpcsvc   I -  0:00.00 
nfsd: server (nf nfsd: service

  Various bugs are now more evident:
  - laxwH contains ki_tdname precisely for kernel threads.  So adding -o
tdnam gives duplication for igb0 bug not for nfsd*
  - truncation causes various messes:
- the igb0 proctitle and tdnam (sic) get truncated after "que".  Even
  the "]" delimiter is truncated away for igb0
- the nfsd proctitle gets truncated after "nf".  The nfsd tdnam doesn't
  get truncated.

FreeBSD-5.2 (top -Ha output):
%   556 root   40   704K   456K accept   0:00  0.00% nfsd: master (nfsd)
%   558 root   40   576K   324K -0:00  0.00% nfsd: server 

svn commit: r266493 - head/sys/dev/usb/controller

2014-05-21 Thread Hans Petter Selasky
Author: hselasky
Date: Wed May 21 09:26:02 2014
New Revision: 266493
URL: http://svnweb.freebsd.org/changeset/base/266493

Log:
  - Replace some constants with macros.
  - Need to set the pre-fetch memory address when reading the host memory.
  - We currently assume that no endianness conversion is needed.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/usb/controller/saf1761_otg.c
  head/sys/dev/usb/controller/saf1761_otg_reg.h

Modified: head/sys/dev/usb/controller/saf1761_otg.c
==
--- head/sys/dev/usb/controller/saf1761_otg.c   Wed May 21 09:19:05 2014
(r266492)
+++ head/sys/dev/usb/controller/saf1761_otg.c   Wed May 21 09:26:02 2014
(r266493)
@@ -253,8 +253,8 @@ saf1761_host_channel_free(struct saf1761
return;
 
/* disable channel */
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 3), 0);
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 0), 0);
+   SAF1761_WRITE_4(sc, SOTG_PDT(td->channel) + SOTG_PDT_DW3, 0);
+   SAF1761_WRITE_4(sc, SOTG_PDT(td->channel) + SOTG_PDT_DW0, 0);
 
switch (td->ep_type) {
case UE_INTERRUPT:
@@ -299,20 +299,25 @@ static uint8_t
 saf1761_host_setup_tx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td)
 {
struct usb_device_request req __aligned(4);
+   uint32_t pdt_addr;
uint32_t status;
uint32_t count;
+   uint32_t temp;
 
if (td->channel < SOTG_HOST_CHANNEL_MAX) {
-   status = SAF1761_READ_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 
3));
-   if (status & (1 << 31)) {
+   pdt_addr = SOTG_PDT(td->channel);
+
+   saf1761_read_host_memory_4(sc, pdt_addr + SOTG_PDT_DW3, 
&status, 1);
+
+   if (status & SOTG_PDT_DW3_ACTIVE) {
goto busy;
-   } else if (status & (1 << 30)) {
+   } else if (status & SOTG_PDT_DW3_HALTED) {
td->error_stall = 1;
td->error_any = 1;
-   } else if (status & (3 << 28)) {
+   } else if (status & SOTG_PDT_DW3_ERRORS) {
td->error_any = 1;
}
-   count = (status & 0x7FFF);
+   count = (status & SOTG_PDT_DW3_XFER_COUNT);
 
saf1761_host_channel_free(sc, td);
goto complete;
@@ -332,26 +337,27 @@ saf1761_host_setup_tx(struct saf1761_otg
saf1761_write_host_memory_4(sc, SOTG_DATA_ADDR(td->channel),
&req, (count + 3) / 4);
 
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 7), 0);
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 6), 0);
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 5), 0);
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 4), 0);
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 3),
-   (1 << 31) | (td->toggle << 25) | (3 << 23));
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 2),
-   SOTG_HC_MEMORY_ADDR(SOTG_DATA_ADDR(td->channel)) << 8);
-
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 1),
-   td->dw1_value |
-   (2 << 10) /* SETUP PID */ |
-   (td->ep_index >> 1));
-
-   SAF1761_WRITE_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 0),
-   (td->ep_index << 31) |
-   (1 << 29) /* pkt-multiplier */ |
+   pdt_addr = SOTG_PDT(td->channel);
+
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW7, 0);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW6, 0);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW5, 0);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW4, 0);
+
+   temp = SOTG_PDT_DW3_ACTIVE | (td->toggle << 25) | SOTG_PDT_DW3_CERR;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW3, temp);
+   
+   temp = SOTG_HC_MEMORY_ADDR(SOTG_DATA_ADDR(td->channel)) << 8;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW2, temp);
+
+   temp = td->dw1_value | (2 << 10) /* SETUP PID */ | (td->ep_index >> 1);
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW1, temp);
+
+   temp = (td->ep_index << 31) | (1 << 29) /* pkt-multiplier */ |
(td->max_packet_size << 18) /* wMaxPacketSize */ |
(count << 3) /* transfer count */ |
-   1 /* valid */);
+   SOTG_PDT_DW0_VALID;
+   SAF1761_WRITE_4(sc, pdt_addr + SOTG_PDT_DW0, temp);
 
td->offset += count;
td->remainder -= count;
@@ -365,24 +371,29 @@ complete:
 static uint8_t
 saf1761_host_bulk_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td 
*td)
 {
+   uint32_t pdt_addr;
+   uint32_t temp;
+
if (td->channel < SOTG_HOST_CHANNEL_MAX) {
uint32_t status;
uint32_t count;
uint8_t got_short;
 
-   status = SAF1761_READ_4(sc, SOTG_ISOC_PDT(td->channel) + (4 * 
3));
+   pdt_addr = SOTG_PDT(td->chan

Re: svn commit: r266423 - in head/sys: conf dev/i40e modules/i40e

2014-05-21 Thread David Chisnall
On 20 May 2014, at 18:16, Gleb Smirnoff  wrote:

> Would be cool if most of tools (netstat, systat, etc...) could
> determine size of terminal and dynamically widen all their fields.
> Thus, tool can run w/o any abbreviations when run in a script mode,
> run abbreviated on a small terminal, and run verbose on a wide
> terminal.
> 
> This sounds like a generic library providing a special version
> of printf(3), which specifies minimal and maximum sizes for fields
> and when extra terminal width is available it distributes this
> width evenly between all fields. Name it 'elastic printf'.
> Sounds like a nice Google SoC project. Or might be that such
> library already exists.

We have a summer of code project to teach (some of) these tools to produce a 
structured, machine-readable, output and write a few generic tools for 
processing them.  This should make it a lot easier to produce simple tools that 
can fit the information that you actually want into a terminal (or send HTML to 
netcat, or whatever).

David

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


Re: svn commit: r266423 - in head/sys: conf dev/i40e modules/i40e

2014-05-21 Thread Slawa Olhovchenkov
On Tue, May 20, 2014 at 09:16:13PM +0400, Gleb Smirnoff wrote:

> On Tue, May 20, 2014 at 11:40:01PM +1000, Bruce Evans wrote:
> B> Also, verbose names break formatting.  E.g., netstat -r has 5 columns
> B> available under Netif for the driver name and device number.  netstat
> B> -i has about the same under Name (possibly 1 or 2 not directly under
> B> Name, but reserved for the Name column).  systat has 3 columns
> B> available, but with a more flexible format that truncates other info.
> B> All driver name+numbers are broken now on freefall:
> 
> We must admit that nowadays 80x25 terminal is not enough :(
> 
> Would be cool if most of tools (netstat, systat, etc...) could
> determine size of terminal and dynamically widen all their fields.
> Thus, tool can run w/o any abbreviations when run in a script mode,
> run abbreviated on a small terminal, and run verbose on a wide
> terminal.
> 
> This sounds like a generic library providing a special version
> of printf(3), which specifies minimal and maximum sizes for fields
> and when extra terminal width is available it distributes this
> width evenly between all fields. Name it 'elastic printf'.
> Sounds like a nice Google SoC project. Or might be that such
> library already exists.

Sound like 'universal common distributed enterprise serial bus' from
Rambler.
Just simple check size of screen and select items and precession for
display.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266491 - head/sys/vm

2014-05-21 Thread Konstantin Belousov
Author: kib
Date: Wed May 21 08:19:04 2014
New Revision: 266491
URL: http://svnweb.freebsd.org/changeset/base/266491

Log:
  Remove redundand loop.  The inner goto restarts the whole page
  handling in the situation identical to the loop condition.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Wed May 21 08:09:44 2014(r266490)
+++ head/sys/vm/vm_fault.c  Wed May 21 08:19:04 2014(r266491)
@@ -1351,18 +1351,16 @@ again:
/*
 * Allocate a page in the destination object.
 */
-   do {
-   dst_m = vm_page_alloc(dst_object,
-   (src_object == dst_object ? src_pindex :
-   0) + dst_pindex, VM_ALLOC_NORMAL);
-   if (dst_m == NULL) {
-   VM_OBJECT_WUNLOCK(dst_object);
-   VM_OBJECT_RUNLOCK(object);
-   VM_WAIT;
-   VM_OBJECT_WLOCK(dst_object);
-   goto again;
-   }
-   } while (dst_m == NULL);
+   dst_m = vm_page_alloc(dst_object, (src_object ==
+   dst_object ? src_pindex : 0) + dst_pindex,
+   VM_ALLOC_NORMAL);
+   if (dst_m == NULL) {
+   VM_OBJECT_WUNLOCK(dst_object);
+   VM_OBJECT_RUNLOCK(object);
+   VM_WAIT;
+   VM_OBJECT_WLOCK(dst_object);
+   goto again;
+   }
pmap_copy_page(src_m, dst_m);
VM_OBJECT_RUNLOCK(object);
dst_m->valid = VM_PAGE_BITS_ALL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r266490 - head/sys/dev/usb/net

2014-05-21 Thread Kevin Lo
Author: kevlo
Date: Wed May 21 08:09:44 2014
New Revision: 266490
URL: http://svnweb.freebsd.org/changeset/base/266490

Log:
  - Configure Rx bulk
  - Announce flow control capability to PHY drivers

Modified:
  head/sys/dev/usb/net/if_axge.c

Modified: head/sys/dev/usb/net/if_axge.c
==
--- head/sys/dev/usb/net/if_axge.c  Wed May 21 07:42:42 2014
(r266489)
+++ head/sys/dev/usb/net/if_axge.c  Wed May 21 08:09:44 2014
(r266490)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013 Kevin Lo
+ * Copyright (c) 2013-2014 Kevin Lo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -71,12 +71,16 @@ static const STRUCT_USB_HOST_ID axge_dev
 };
 
 static const struct {
-   unsigned char ctrl, timer_l, timer_h, size, ifg;
-} AX88179_BULKIN_SIZE[] = {
-   {7, 0x4f, 0,0x12, 0xff},
-   {7, 0x20, 3,0x16, 0xff},
-   {7, 0xae, 7,0x18, 0xff},
-   {7, 0xcc, 0x4c, 0x18, 8},
+   uint8_t ctrl;
+   uint8_t timer_l;
+   uint8_t timer_h;
+   uint8_t size;
+   uint8_t ifg;
+} axge_bulk_size[] = {
+   { 7, 0x4f, 0x00, 0x12, 0xff },
+   { 7, 0x20, 0x03, 0x16, 0xff },
+   { 7, 0xae, 0x07, 0x18, 0xff },
+   { 7, 0xcc, 0x4c, 0x18, 0x08 }
 };
 
 /* prototypes */
@@ -104,6 +108,8 @@ static int  axge_read_mem(struct axge_sof
uint16_t, void *, int);
 static voidaxge_write_mem(struct axge_softc *, uint8_t, uint16_t,
uint16_t, void *, int);
+static uint8_t axge_read_cmd_1(struct axge_softc *, uint8_t, uint16_t,
+   uint16_t);
 static uint16_taxge_read_cmd_2(struct axge_softc *, uint8_t, uint16_t,
uint16_t);
 static voidaxge_write_cmd_1(struct axge_softc *, uint8_t, uint16_t,
@@ -233,6 +239,16 @@ axge_write_mem(struct axge_softc *sc, ui
}
 }
 
+static uint8_t
+axge_read_cmd_1(struct axge_softc *sc, uint8_t cmd, uint16_t index,
+uint16_t reg)
+{
+   uint8_t val;
+
+   axge_read_mem(sc, cmd, index, reg, &val, 1);
+   return (val);
+}
+
 static uint16_t
 axge_read_cmd_2(struct axge_softc *sc, uint8_t cmd, uint16_t index,
 uint16_t reg)
@@ -307,6 +323,7 @@ axge_miibus_statchg(device_t dev)
struct axge_softc *sc;
struct mii_data *mii;
struct ifnet *ifp;
+   uint8_t link_status, tmp[5];
uint16_t val;
int locked;
 
@@ -339,6 +356,8 @@ axge_miibus_statchg(device_t dev)
if ((sc->sc_flags & AXGE_FLAG_LINK) == 0)
goto done;
 
+   link_status = axge_read_cmd_1(sc, AXGE_ACCESS_MAC, 1, AXGE_LINK_STATUS);
+
val = 0;
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
val |= AXGE_MEDIUM_FULL_DUPLEX;
@@ -347,18 +366,32 @@ axge_miibus_statchg(device_t dev)
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0)
val |= AXGE_MEDIUM_RXFLOW_CTRLEN;
}
-   val |=  AXGE_MEDIUM_RECEIVE_EN | AXGE_MEDIUM_ALWAYS_ONE;
+   val |=  AXGE_MEDIUM_RECEIVE_EN;
switch (IFM_SUBTYPE(mii->mii_media_active)) {
case IFM_1000_T:
-   val |= AXGE_MEDIUM_GIGAMODE;
+   val |= AXGE_MEDIUM_GIGAMODE | AXGE_MEDIUM_EN_125MHZ;
+   if (link_status & AXGE_LINK_STATUS_USB_SS)
+   memcpy(tmp, &axge_bulk_size[0], 5);
+   else if (link_status & AXGE_LINK_STATUS_USB_HS)
+   memcpy(tmp, &axge_bulk_size[1], 5);
+   else
+   memcpy(tmp, &axge_bulk_size[3], 5);
+   break;
case IFM_100_TX:
val |= AXGE_MEDIUM_PS;
+   if (link_status &
+   (AXGE_LINK_STATUS_USB_SS | AXGE_LINK_STATUS_USB_HS))
+   memcpy(tmp, &axge_bulk_size[2], 5);
+   else
+   memcpy(tmp, &axge_bulk_size[3], 5);
+   break;
case IFM_10_T:
-   /* Doesn't need to be handled. */
+   memcpy(tmp, &axge_bulk_size[3], 5);
break;
}
+   /* Rx bulk configuration. */
+   axge_write_mem(sc, AXGE_ACCESS_MAC, 5, AXGE_RX_BULKIN_QCTRL, tmp, 5);
axge_write_cmd_2(sc, AXGE_ACCESS_MAC, 2, AXGE_MEDIUM_STATUS_MODE, val);
-
 done:
if (!locked)
AXGE_UNLOCK(sc);
@@ -401,16 +434,12 @@ static void
 axge_attach_post(struct usb_ether *ue)
 {
struct axge_softc *sc;
-   uint8_t tmp[5];
 
sc = uether_getsc(ue);
sc->sc_phyno = 3;
 
/* Initialize controller and get station address. */
axge_chip_init(sc);
-
-   memcpy(tmp, &AX88179_BULKIN_SIZE[0], 5);
-   axge_read_mem(sc, AXGE_ACCESS_MAC, 5, AXGE_RX_BULKIN_QCTRL, tmp, 5);
axge_read_mem(sc, AXGE_ACCESS_MAC, ETHER_ADDR_LEN, AXGE_NODE_ID,
ue->ue_eaddr, ETHER_ADDR_LEN);
 }
@@ -439,7 +468,7 @@ axge_attach_post_su