svn commit: r312740 - head/sys/dev/cesa
Author: wma Date: Wed Jan 25 06:11:07 2017 New Revision: 312740 URL: https://svnweb.freebsd.org/changeset/base/312740 Log: Add misssing Armada38x ID's in CESA attach Marvell Armada 38x is supported in 3 variants, so take all into consideration in crypto driver attach routine. Submitted by: Marcin WojtasObtained from: Semihalf Sponsored by: Stormshield Reviewed by: zbb Differential revision: https://reviews.freebsd.org/D9248 Modified: head/sys/dev/cesa/cesa.c Modified: head/sys/dev/cesa/cesa.c == --- head/sys/dev/cesa/cesa.cWed Jan 25 06:08:10 2017(r312739) +++ head/sys/dev/cesa/cesa.cWed Jan 25 06:11:07 2017(r312740) @@ -1045,6 +1045,8 @@ cesa_attach(device_t dev) case MV_DEV_88F6281: case MV_DEV_88F6282: case MV_DEV_88F6828: + case MV_DEV_88F6820: + case MV_DEV_88F6810: sc->sc_tperr = 0; break; case MV_DEV_MV78100: ___ 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: r312739 - in head/sys/arm/mv: armada armada38x
Author: wma Date: Wed Jan 25 06:08:10 2017 New Revision: 312739 URL: https://svnweb.freebsd.org/changeset/base/312739 Log: Introduce armada_thermal driver for Armada family platforms * Currently supports only Armada38X family but other Marvell SoC's can be added if needed. * Provides temperature is C deg. * To print the temperature one can use: sysctl dev.armada_thermal.0.temperature Submitted by: Zbigniew BodekObtained from: Semihalf Sponsored by: Stormshield Differential revision: https://reviews.freebsd.org/D9217 Added: head/sys/arm/mv/armada/ head/sys/arm/mv/armada/thermal.c (contents, props changed) Modified: head/sys/arm/mv/armada38x/files.armada38x Added: head/sys/arm/mv/armada/thermal.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/armada/thermal.cWed Jan 25 06:08:10 2017 (r312739) @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2017 Semihalf. + * Copyright (c) 2017 Stormshield. + * 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$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#defineREADOUT_TO_C(temp) ((temp) / 1000) + +#defineSTAT_RID0 +#defineCTRL_RID1 + +#defineTSEN_STAT_READOUT_VALID 0x1 + +#defineA380_TSEN_CTRL_RESET(1 << 8) + +struct armada_thermal_softc; + +typedef struct armada_thermal_data { + /* Initialize the sensor */ + void (*tsen_init)(struct armada_thermal_softc *); + + /* Test for a valid sensor value */ + boolean_t (*is_valid)(struct armada_thermal_softc *); + + /* Formula coefficients: temp = (b + m * reg) / div */ + u_long coef_b; + u_long coef_m; + u_long coef_div; + + boolean_t inverted; + + /* Shift and mask to access the sensor temperature */ + u_int temp_shift; + u_int temp_mask; + u_int is_valid_shift; +} armada_tdata_t; + +static boolean_t armada_tsen_readout_valid(struct armada_thermal_softc *); +static int armada_tsen_get_temp(struct armada_thermal_softc *, u_long *); +static void armada380_tsen_init(struct armada_thermal_softc *); +static void armada_temp_update(void *); + +static const armada_tdata_t armada380_tdata = { + .tsen_init = armada380_tsen_init, + .is_valid = armada_tsen_readout_valid, + .is_valid_shift = 10, + .temp_shift = 0, + .temp_mask = 0x3ff, + .coef_b = 1172499100UL, + .coef_m = 296UL, + .coef_div = 4201, + .inverted = TRUE, +}; + +static int armada_thermal_probe(device_t); +static int armada_thermal_attach(device_t); +static int armada_thermal_detach(device_t); + +static device_method_t armada_thermal_methods[] = { + DEVMETHOD(device_probe, armada_thermal_probe), + DEVMETHOD(device_attach,armada_thermal_attach), + DEVMETHOD(device_detach,armada_thermal_detach), + + DEVMETHOD_END +}; + +struct armada_thermal_softc { + device_tdev; + + struct resource *stat_res; + struct resource *ctrl_res; + + struct callout temp_upd; + struct mtx temp_upd_mtx; + + const armada_tdata_t*tdata; + + u_long chip_temperature; +}; + +static driver_tarmada_thermal_driver = { + "armada_thermal", + armada_thermal_methods, + sizeof(struct armada_thermal_softc) +}; + +static
Re: svn commit: r312724 - in head/sys: sys vm
On Wed, Jan 25, 2017 at 01:29:21PM +1100, Bruce Evans wrote: > On Tue, 24 Jan 2017, Mateusz Guzik wrote: > > >Log: > > hwpmc: partially depessimize munmap handling if the module is not loaded > > > > HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the > > common (module not loaded) case. > >... > >Modified: head/sys/sys/pmckern.h > >== > >--- head/sys/sys/pmckern.h Tue Jan 24 21:48:57 2017(r312723) > >+++ head/sys/sys/pmckern.h Tue Jan 24 22:00:16 2017(r312724) > >@@ -174,6 +174,9 @@ extern const int pmc_kernel_version; > >/* PMC soft per cpu trapframe */ > >extern struct trapframe pmc_tf[MAXCPU]; > > > >+/* Quick check if preparatory work is necessary */ > >+#define PMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL) > > I'm still waiting for other __predict_ugly() macro invocations to be > removed. > Actually pmc was already using the annotation, so this fits the local style. > The 2 new ones here even less effect than most. I couldn't measure the > effect on makeworld of removing the PMC_HOOKS completely. Removing KTRACE > long ago also seemed to have no effect. Unfortunately, it is impossible > to remove procctl and other bloat that has grown in the syscall path, and > is easy to measure slowdowns from this. > The kernel has a lot of systematic single- and multi-threaded slowness and it is unlikely that some branch removals/predictions in isolation will make a measurable difference in a macrobenchmark. Most of the slow down is caused by avoidable atomic ops, which arguably trump spurious branches even if the target cacheline is not ping-ponged around. However, when a spurious branch/mostly false branch shows up, I don't see why not plug it. There is work done on proper hotpatching support which will hopefully make plenty of branches go away. syscall handling is slowed down by a lot of branches which are typically false. However, here the solution is to group them under one condition which if true takes the kernel to the slow (current) path. That is ktrace, ptrace, capsicum and whatever else would set a ->td_specialhandling (or whatever) flag/bitfield along with whatever it sets now. There is an additional slowness of packing/unpacking all arguments, but I don't know if this is worth changing. For non-static syscalls, their handling can be postponed. Instead of putting such syscalls directly into the table, they can be using a proxy method which would handle the reference counting. That is, the knowledge of such syscalls would be removed from the common path completely. There is only a matter of finding a nice way to get back the syscall number. I am *NOT* working on this though. For the vfs layer, slowness includes: - vget grabs both hold and usecount, which gives 2 atomic ops. then they have to be released and that's another 2. I had patch which made it so that a usecount implies holdcnt, but it rotted and is only a part of the real fix - dropping references to vnodes too easily causes them to be reshuffled on the free list, which adds single-threaded slowness due to more work and a lock contention point. I don't have a good solution, but a total hack I came up with so far boils down to grabbing and extra reference in vget and letting the syncer drop it some time later - similarly, vputx relocks the vnode in exclusive mode to call the inactive routine. Said routine very often does nothing and/or gets away with a mere interlock. I have a hack which extends the interface so that the filesystem can be asked whether it wants to do inactive. - VOP_* routines have arguments packed which the target fs has to unpack before use. Wrappers have several avoidable and mostly false branches. I would argue a new interface is needed. - the main lockmgr routine takes 8 arguments, 2 more than what's passable in registers on amd64 with sysv abi. Then it proceeds to perform several branches. I have a patch introducing a fast path which avoids it all and falls back to the original lockmgr if there are issues getting the lock uncontested. this gave me +4% more ops in a single-threaded stat benchmark. there is a LOCK_PROFILING bug somewhere in there I have to fix before committing - lockmgr locks are not adaptive. the facility itself does support the feature, but the code is disabled and no fs annotates its vnodes to use it if present - closing a vnode performs vn_start_write + vnode lock + VOP_CLOSE. the latter almost always has nothing to do so, thus making the above work unnecessary. In a spirit similar to inactive handling, we can ask the fs what it wants to do. Or better yet, revamp the interface so that the fs calls relevant helpers to do the locking it needs. and so on. tl;dr the main point of this patch was to not lock pmc_sx if it can be helped. I presume you don't have objections here. The annotations and shifting the
Re: svn commit: r312724 - in head/sys: sys vm
On Tue, 24 Jan 2017, Mateusz Guzik wrote: Log: hwpmc: partially depessimize munmap handling if the module is not loaded HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the common (module not loaded) case. ... Modified: head/sys/sys/pmckern.h == --- head/sys/sys/pmckern.h Tue Jan 24 21:48:57 2017(r312723) +++ head/sys/sys/pmckern.h Tue Jan 24 22:00:16 2017(r312724) @@ -174,6 +174,9 @@ extern const int pmc_kernel_version; /* PMC soft per cpu trapframe */ extern struct trapframe pmc_tf[MAXCPU]; +/* Quick check if preparatory work is necessary */ +#definePMC_HOOK_INSTALLED(cmd) __predict_false(pmc_hook != NULL) I'm still waiting for other __predict_ugly() macro invocations to be removed. The 2 new ones here even less effect than most. I couldn't measure the effect on makeworld of removing the PMC_HOOKS completely. Removing KTRACE long ago also seemed to have no effect. Unfortunately, it is impossible to remove procctl and other bloat that has grown in the syscall path, and is easy to measure slowdowns from this. The above one is an even better obfuscation than most. It is only invoked once, and it is context-dependent whether to false branch is the unusual case. Modified: head/sys/vm/vm_mmap.c == --- head/sys/vm/vm_mmap.c Tue Jan 24 21:48:57 2017(r312723) +++ head/sys/vm/vm_mmap.c Tue Jan 24 22:00:16 2017(r312724) @@ -526,6 +526,7 @@ sys_munmap(td, uap) #ifdef HWPMC_HOOKS struct pmckern_map_out pkm; vm_map_entry_t entry; + bool pmc_handled; #endif vm_offset_t addr; vm_size_t size, pageoff; @@ -551,20 +552,24 @@ sys_munmap(td, uap) return (EINVAL); vm_map_lock(map); #ifdef HWPMC_HOOKS - /* -* Inform hwpmc if the address range being unmapped contains -* an executable region. -*/ - pkm.pm_address = (uintptr_t) NULL; - if (vm_map_lookup_entry(map, addr, )) { - for (; -entry != >header && entry->start < addr + size; -entry = entry->next) { - if (vm_map_check_protection(map, entry->start, - entry->end, VM_PROT_EXECUTE) == TRUE) { - pkm.pm_address = (uintptr_t) addr; - pkm.pm_size = (size_t) size; - break; + pmc_handled = false; + if (PMC_HOOK_INSTALLED(PMC_FN_MUNMAP)) { + pmc_handled = true; + /* +* Inform hwpmc if the address range being unmapped contains +* an executable region. +*/ + pkm.pm_address = (uintptr_t) NULL; + if (vm_map_lookup_entry(map, addr, )) { + for (; + entry != >header && entry->start < addr + size; + entry = entry->next) { + if (vm_map_check_protection(map, entry->start, + entry->end, VM_PROT_EXECUTE) == TRUE) { + pkm.pm_address = (uintptr_t) addr; + pkm.pm_size = (size_t) size; + break; + } } } } Predictions could also be implemented in a more hard-coded way using 'goto slowcase' and moving the slow case out of the way (assuming that that the hardware predicts forward branches as not taken and the compiler doesn't reorder the code anyway). This would be uglier, but not much more invasive than re-indenting the code after adding a test for the slow case. 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: r312732 - head/sys/cam
Author: imp Date: Wed Jan 25 02:05:08 2017 New Revision: 312732 URL: https://svnweb.freebsd.org/changeset/base/312732 Log: Preening pass to fix up trailing white space and other minor style(9) nits (though I'm sure others remain). MFC After: 3 days Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c == --- head/sys/cam/cam_iosched.c Wed Jan 25 01:16:10 2017(r312731) +++ head/sys/cam/cam_iosched.c Wed Jan 25 02:05:08 2017(r312732) @@ -112,7 +112,7 @@ typedef enum { bandwidth, /* Limit bandwidth to the drive */ limiter_max } io_limiter; - + static const char *cam_iosched_limiter_names[] = { "none", "queue_depth", "iops", "bandwidth" }; @@ -131,7 +131,7 @@ typedef int l_tick_t(struct iop_stats *) * Called to see if the limiter thinks this IOP can be allowed to * proceed. If so, the limiter assumes that the while IOP proceeded * and makes any accounting of it that's needed. - */ + */ typedef int l_iop_t(struct iop_stats *, struct bio *); /* @@ -157,8 +157,7 @@ static l_tick_t cam_iosched_bw_tick; static l_iop_t cam_iosched_bw_caniop; static l_iop_t cam_iosched_bw_iop; -struct limswitch -{ +struct limswitch { l_init_t*l_init; l_tick_t*l_tick; l_iop_t *l_iop; @@ -195,8 +194,7 @@ struct limswitch }, }; -struct iop_stats -{ +struct iop_stats { /* * sysctl state for this subnode. */ @@ -212,7 +210,6 @@ struct iop_stats int current;/* Current rate limiter */ int l_value1; /* per-limiter scratch value 1. */ int l_value2; /* per-limiter scratch value 2. */ - /* * Debug information about counts of I/Os that have gone through the @@ -223,7 +220,7 @@ struct iop_stats int total; /* Total for all time -- wraps */ int in; /* number queued all time -- wraps */ int out;/* number completed all time -- wraps */ - + /* * Statistics on different bits of the process. */ @@ -251,8 +248,7 @@ typedef enum { static const char *cam_iosched_control_type_names[] = { "set_max", "read_latency" }; -struct control_loop -{ +struct control_loop { /* * sysctl state for this subnode. */ @@ -272,8 +268,7 @@ struct control_loop #endif -struct cam_iosched_softc -{ +struct cam_iosched_softc { struct bio_queue_head bio_queue; struct bio_queue_head trim_queue; /* scheduler flags < 16, user flags >= 16 */ @@ -385,7 +380,7 @@ cam_iosched_limiter_iodone(struct iop_st static int cam_iosched_qd_iop(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending < ios->current) return 0; @@ -395,7 +390,7 @@ cam_iosched_qd_iop(struct iop_stats *ios static int cam_iosched_qd_caniop(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending < ios->current) return 0; @@ -405,7 +400,7 @@ cam_iosched_qd_caniop(struct iop_stats * static int cam_iosched_qd_iodone(struct iop_stats *ios, struct bio *bp) { - + if (ios->current <= 0 || ios->pending != ios->current) return 0; @@ -773,7 +768,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLE struct cam_iosched_softc *isc; int value, i, error; const char *p; - + ios = arg1; isc = ios->softc; value = ios->limiter; @@ -781,7 +776,7 @@ cam_iosched_limiter_sysctl(SYSCTL_HANDLE p = "UNKNOWN"; else p = cam_iosched_limiter_names[value]; - + strlcpy(buf, p, sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -819,7 +814,7 @@ cam_iosched_control_type_sysctl(SYSCTL_H struct cam_iosched_softc *isc; int value, i, error; const char *p; - + clp = arg1; isc = clp->softc; value = clp->type; @@ -827,7 +822,7 @@ cam_iosched_control_type_sysctl(SYSCTL_H p = "UNKNOWN"; else p = cam_iosched_control_type_names[value]; - + strlcpy(buf, p, sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) @@ -852,7 +847,7 @@ cam_iosched_sbintime_sysctl(SYSCTL_HANDL sbintime_t value; int error; uint64_t us; - + value = *(sbintime_t *)arg1; us = (uint64_t)value / SBT_1US; snprintf(buf, sizeof(buf), "%ju", (intmax_t)us); @@ -969,7 +964,7 @@ cam_iosched_cl_sysctl_init(struct
svn commit: r312728 - head/sys/dev/qlxgbe
Author: davidcs Date: Wed Jan 25 00:23:38 2017 New Revision: 312728 URL: https://svnweb.freebsd.org/changeset/base/312728 Log: Added support for if_transmit and if_qflush Removed if_start updated version to 3.10.33 MFC after:5 days Modified: head/sys/dev/qlxgbe/ql_def.h head/sys/dev/qlxgbe/ql_glbl.h head/sys/dev/qlxgbe/ql_hw.c head/sys/dev/qlxgbe/ql_hw.h head/sys/dev/qlxgbe/ql_isr.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/qlxgbe/ql_os.h head/sys/dev/qlxgbe/ql_ver.h Modified: head/sys/dev/qlxgbe/ql_def.h == --- head/sys/dev/qlxgbe/ql_def.hTue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_def.hWed Jan 25 00:23:38 2017 (r312728) @@ -112,6 +112,16 @@ typedef struct _qla_tx_ring { uint64_tcount; } qla_tx_ring_t; +typedef struct _qla_tx_fp { + struct mtx tx_mtx; + chartx_mtx_name[32]; + struct buf_ring *tx_br; + struct task fp_task; + struct taskqueue*fp_taskqueue; + void*ha; + uint32_ttxr_idx; +} qla_tx_fp_t; + /* * Adapter structure contains the hardware independent information of the * pci function. @@ -178,10 +188,9 @@ struct qla_host { qla_tx_ring_t tx_ring[NUM_TX_RINGS]; bus_dma_tag_t tx_tag; - struct task tx_task; - struct taskqueue*tx_tq; struct callout tx_callout; - struct mtx tx_lock; + + qla_tx_fp_t tx_fp[MAX_SDS_RINGS]; qla_rx_ring_t rx_ring[MAX_RDS_RINGS]; bus_dma_tag_t rx_tag; Modified: head/sys/dev/qlxgbe/ql_glbl.h == --- head/sys/dev/qlxgbe/ql_glbl.h Tue Jan 24 23:41:20 2017 (r312727) +++ head/sys/dev/qlxgbe/ql_glbl.h Wed Jan 25 00:23:38 2017 (r312728) @@ -39,6 +39,7 @@ */ extern void ql_mbx_isr(void *arg); extern void ql_isr(void *arg); +extern uint32_t ql_rcv_isr(qla_host_t *ha, uint32_t sds_idx, uint32_t count); /* * from ql_os.c @@ -66,7 +67,7 @@ extern void qla_reset_promisc(qla_host_t extern int ql_set_allmulti(qla_host_t *ha); extern void qla_reset_allmulti(qla_host_t *ha); extern void ql_update_link_state(qla_host_t *ha); -extern void ql_hw_tx_done(qla_host_t *ha); +extern void ql_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx); extern int ql_set_max_mtu(qla_host_t *ha, uint32_t mtu, uint16_t cntxt_id); extern void ql_hw_stop_rcv(qla_host_t *ha); extern void ql_get_stats(qla_host_t *ha); @@ -76,7 +77,7 @@ extern void qla_hw_async_event(qla_host_ extern int qla_get_nic_partition(qla_host_t *ha, uint32_t *supports_9kb, uint32_t *num_rcvq); -extern int qla_iscsi_pdu(qla_host_t *ha, struct mbuf *mp); +extern int ql_iscsi_pdu(qla_host_t *ha, struct mbuf *mp); extern void ql_minidump(qla_host_t *ha); extern int ql_minidump_init(qla_host_t *ha); Modified: head/sys/dev/qlxgbe/ql_hw.c == --- head/sys/dev/qlxgbe/ql_hw.c Tue Jan 24 23:41:20 2017(r312727) +++ head/sys/dev/qlxgbe/ql_hw.c Wed Jan 25 00:23:38 2017(r312728) @@ -51,7 +51,6 @@ static void qla_del_rcv_cntxt(qla_host_t static int qla_init_rcv_cntxt(qla_host_t *ha); static void qla_del_xmt_cntxt(qla_host_t *ha); static int qla_init_xmt_cntxt(qla_host_t *ha); -static void qla_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx); static int qla_mbx_cmd(qla_host_t *ha, uint32_t *h_mbox, uint32_t n_hmbox, uint32_t *fw_mbox, uint32_t n_fwmbox, uint32_t no_pause); static int qla_config_intr_cntxt(qla_host_t *ha, uint32_t start_idx, @@ -2047,7 +2046,7 @@ ql_hw_send(qla_host_t *ha, bus_dma_segme ha->hw.iscsi_pkt_count++; if (hw->tx_cntxt[txr_idx].txr_free <= (num_tx_cmds + QLA_TX_MIN_FREE)) { - qla_hw_tx_done_locked(ha, txr_idx); + ql_hw_tx_done_locked(ha, txr_idx); if (hw->tx_cntxt[txr_idx].txr_free <= (num_tx_cmds + QLA_TX_MIN_FREE)) { QL_DPRINT8(ha, (dev, "%s: (hw->txr_free <= " @@ -2552,15 +2551,8 @@ qla_init_rcv_cntxt(qla_host_t *ha) qla_host_to_le64(hw->dma_buf.sds_ring[i].dma_addr); rcntxt->sds[i].size = qla_host_to_le32(NUM_STATUS_DESCRIPTORS); - if (ha->msix_count == 2) { - rcntxt->sds[i].intr_id = - qla_host_to_le16(hw->intr_id[0]); - rcntxt->sds[i].intr_src_bit = qla_host_to_le16((i)); - } else { - rcntxt->sds[i].intr_id = -
Re: svn commit: r312723 - head/sys/kern
On Tue, Jan 24, 2017 at 09:48:58PM +, Mateusz Guzik wrote: > New Revision: 312723 > URL: https://svnweb.freebsd.org/changeset/base/312723 > > Log: > proc: perform a lockless check in sys_issetugid > > Discussed with: kib Shouldn't the summary of this discussion be included in the commmit log? ./danfe ___ 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: r312726 - head/sys/dev/ath/ath_hal
Author: adrian Date: Tue Jan 24 22:52:09 2017 New Revision: 312726 URL: https://svnweb.freebsd.org/changeset/base/312726 Log: [ath_hal] note that the CCA configuration setting may be chip-dependent. I bet it isn't, but who knows - this is making assumptions about the layout of AR_DIAG. Modified: head/sys/dev/ath/ath_hal/ah.c Modified: head/sys/dev/ath/ath_hal/ah.c == --- head/sys/dev/ath/ath_hal/ah.c Tue Jan 24 22:46:43 2017 (r312725) +++ head/sys/dev/ath/ath_hal/ah.c Tue Jan 24 22:52:09 2017 (r312726) @@ -1415,6 +1415,9 @@ ath_hal_setcca(struct ath_hal *ah, int e /* * Get CCA setting. + * + * XXX TODO: turn this and the above function into methods + * in case there are chipset differences in handling CCA. */ int ath_hal_getcca(struct ath_hal *ah) ___ 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: r312725 - head/sys/kern
Author: emaste Date: Tue Jan 24 22:46:43 2017 New Revision: 312725 URL: https://svnweb.freebsd.org/changeset/base/312725 Log: imgact_elf: refactor et_dyn_addr calculation This simplifies the logic somewhat. It is extracted from the change in review in D5603. Differential Revision:https://reviews.freebsd.org/D9321 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c == --- head/sys/kern/imgact_elf.c Tue Jan 24 22:00:16 2017(r312724) +++ head/sys/kern/imgact_elf.c Tue Jan 24 22:46:43 2017(r312725) @@ -859,6 +859,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i error = ENOEXEC; goto ret; } + et_dyn_addr = 0; if (hdr->e_type == ET_DYN) { if ((brand_info->flags & BI_CAN_EXEC_DYN) == 0) { uprintf("Cannot execute shared object\n"); @@ -871,10 +872,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i */ if (baddr == 0) et_dyn_addr = ET_DYN_LOAD_ADDR; - else - et_dyn_addr = 0; - } else - et_dyn_addr = 0; + } sv = brand_info->sysvec; if (interp != NULL && brand_info->interp_newpath != NULL) newinterp = brand_info->interp_newpath; @@ -1058,7 +1056,7 @@ __CONCAT(exec_, __elfN(imgact))(struct i imgp->reloc_base = addr; imgp->proc->p_osrel = osrel; - ret: +ret: free(interp_buf, M_TEMP); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
RE: svn commit: r312687 - in head/sys: net sys
> From: Gleb Smirnoff [mailto:gleb...@freebsd.org] > Dexuan, > > On Tue, Jan 24, 2017 at 09:19:47AM +, Dexuan Cui wrote: > D> --- head/sys/sys/eventhandler.hTue Jan 24 09:15:36 2017 > (r312686) > D> +++ head/sys/sys/eventhandler.hTue Jan 24 09:19:46 2017 > (r312687) > D> @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc > D> EVENTHANDLER_DECLARE(swapon, swapon_fn); > D> EVENTHANDLER_DECLARE(swapoff, swapoff_fn); > D> > D> +/* ifup/ifdown events */ > D> +#define IFNET_EVENT_UP0 > D> +#define IFNET_EVENT_DOWN 1 > D> +struct ifnet; > D> +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); > D> +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); > D> + > D> #endif /* _SYS_EVENTHANDLER_H_ */ > > The network stuff shall not be added to sys/eventhandler.h. > > All these declarations should go to net/if_var.h. There is already > a block of event(9) defines there. Please move it there. > > -- > Totus tuus, Glebius. Hi Gleb, Sorry, I didn't realize this... I'll move it as you suggested. Thank you for the reminder! -- Dexuan ___ 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: r312723 - head/sys/kern
Author: mjg Date: Tue Jan 24 21:48:57 2017 New Revision: 312723 URL: https://svnweb.freebsd.org/changeset/base/312723 Log: proc: perform a lockless check in sys_issetugid Discussed with: kib MFC after:1 week Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Tue Jan 24 21:30:31 2017(r312722) +++ head/sys/kern/kern_prot.c Tue Jan 24 21:48:57 2017(r312723) @@ -1225,9 +1225,7 @@ sys_issetugid(register struct thread *td * a user without an exec - programs cannot know *everything* * that libc *might* have put in their data segment. */ - PROC_LOCK(p); td->td_retval[0] = (p->p_flag & P_SUGID) ? 1 : 0; - PROC_UNLOCK(p); return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312722 - head/sys/netinet
Author: tuexen Date: Tue Jan 24 21:30:31 2017 New Revision: 312722 URL: https://svnweb.freebsd.org/changeset/base/312722 Log: Fix a bug where the overhead of the I-DATA chunk was not considered. MFC after: 1 week Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Tue Jan 24 21:07:13 2017 (r312721) +++ head/sys/netinet/sctp_output.c Tue Jan 24 21:30:31 2017 (r312722) @@ -7080,11 +7080,9 @@ sctp_clean_up_ctl(struct sctp_tcb *stcb, } } - -static int -sctp_can_we_split_this(struct sctp_tcb *stcb, -uint32_t length, -uint32_t goal_mtu, uint32_t frag_point, int eeor_on) +static uint32_t +sctp_can_we_split_this(struct sctp_tcb *stcb, uint32_t length, +uint32_t space_left, uint32_t frag_point, int eeor_on) { /* * Make a decision on if I should split a msg into multiple parts. @@ -7096,7 +7094,7 @@ sctp_can_we_split_this(struct sctp_tcb * * entire thing, since it might be all the guy is putting in * the hopper. */ - if (goal_mtu >= length) { + if (space_left >= length) { /*- * If we have data outstanding, * we get another chance when the sack @@ -7113,7 +7111,7 @@ sctp_can_we_split_this(struct sctp_tcb * } else { /* You can fill the rest */ - return (goal_mtu); + return (space_left); } } /*- @@ -7124,28 +7122,27 @@ sctp_can_we_split_this(struct sctp_tcb * if (SCTP_SB_LIMIT_SND(stcb->sctp_socket) < frag_point) { return (length); } - if ((length <= goal_mtu) || - ((length - goal_mtu) < SCTP_BASE_SYSCTL(sctp_min_residual))) { + if ((length <= space_left) || + ((length - space_left) < SCTP_BASE_SYSCTL(sctp_min_residual))) { /* Sub-optimial residual don't split in non-eeor mode. */ return (0); } /* -* If we reach here length is larger than the goal_mtu. Do we wish +* If we reach here length is larger than the space_left. Do we wish * to split it for the sake of packet putting together? */ - if (goal_mtu >= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) { + if (space_left >= min(SCTP_BASE_SYSCTL(sctp_min_split_point), frag_point)) { /* Its ok to split it */ - return (min(goal_mtu, frag_point)); + return (min(space_left, frag_point)); } /* Nope, can't split */ return (0); - } static uint32_t sctp_move_to_outqueue(struct sctp_tcb *stcb, struct sctp_stream_out *strq, -uint32_t goal_mtu, +uint32_t space_left, uint32_t frag_point, int *giveup, int eeor_mode, @@ -7306,7 +7303,7 @@ re_look: sp->some_taken = 1; } } else { - to_move = sctp_can_we_split_this(stcb, length, goal_mtu, frag_point, eeor_mode); + to_move = sctp_can_we_split_this(stcb, length, space_left, frag_point, eeor_mode); if (to_move) { /*- * We use a snapshot of length in case it @@ -7701,56 +7698,66 @@ sctp_fill_outqueue(struct sctp_tcb *stcb { struct sctp_association *asoc; struct sctp_stream_out *strq; - int goal_mtu, moved_how_much, total_moved = 0, bail = 0; - int giveup; + uint32_t space_left, moved, total_moved; + int bail, giveup; SCTP_TCB_LOCK_ASSERT(stcb); asoc = >asoc; + total_moved = 0; switch (net->ro._l_addr.sa.sa_family) { #ifdef INET case AF_INET: - goal_mtu = net->mtu - SCTP_MIN_V4_OVERHEAD; + space_left = net->mtu - SCTP_MIN_V4_OVERHEAD; break; #endif #ifdef INET6 case AF_INET6: - goal_mtu = net->mtu - SCTP_MIN_OVERHEAD; + space_left = net->mtu - SCTP_MIN_OVERHEAD; break; #endif default: /* TSNH */ - goal_mtu = net->mtu; + space_left = net->mtu; break; } /* Need an allowance for the data chunk header too */ if (stcb->asoc.idata_supported == 0) { - goal_mtu -= sizeof(struct sctp_data_chunk); + space_left -= sizeof(struct sctp_data_chunk); } else { - goal_mtu -= sizeof(struct sctp_idata_chunk); + space_left -= sizeof(struct sctp_idata_chunk); } /* must make even word boundary */ - goal_mtu &= 0xfffc; + space_left &= 0xfffc; strq =
svn commit: r312721 - head/share/skel
Author: jilles Date: Tue Jan 24 21:07:13 2017 New Revision: 312721 URL: https://svnweb.freebsd.org/changeset/base/312721 Log: skel: Remove reference to deleted part in previous commit to this file. Reported by: Rodney W. Grimes MFC after:1 week Modified: head/share/skel/dot.shrc Modified: head/share/skel/dot.shrc == --- head/share/skel/dot.shrcTue Jan 24 19:59:25 2017(r312720) +++ head/share/skel/dot.shrcTue Jan 24 21:07:13 2017(r312721) @@ -13,8 +13,8 @@ # # umask022 -# Uncomment this and comment the above to enable the builtin vi(1) command -# line editor in sh(1), e.g. ESC to go into visual mode. +# Uncomment this to enable the builtin vi(1) command line editor in sh(1), +# e.g. ESC to go into visual mode. # set -o vi ___ 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: r312702 - in head/sys: kern libkern sys
On Tue, 24 Jan 2017, Conrad E. Meyer wrote: Log: Use time_t for intermediate values to avoid overflow in clock_ts_to_ct This is bogus. time_t is for storing times in seconds, not for times in days, hours or minutes. Add additionally safety and overflow checks to clock_ts_to_ct and the BCD routines while we're here. I also disagreed with previous versions of this fix. Perform a safety check in sys_clock_settime() first to avoid easy local root panic, without having to propagate an error value back through dozens of APIs currently lacking error returns. I agree with not over-engineering this to check at all levels. But top-level check needs to be more stringent and magic to work. It is easier to check a couple of levels lower. PR:211960, 214300 Submitted by: Justin McOmie , kib@ Reported by: Tim Newsham Reviewed by: kib@ Sponsored by: Dell EMC Isilon, FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9279 Modified: head/sys/kern/kern_time.c head/sys/kern/subr_clock.c head/sys/libkern/bcd.c head/sys/sys/libkern.h Modified: head/sys/kern/kern_time.c == --- head/sys/kern/kern_time.c Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/kern/kern_time.c Tue Jan 24 18:05:29 2017(r312702) @@ -387,6 +387,11 @@ sys_clock_settime(struct thread *td, str return (kern_clock_settime(td, uap->clock_id, )); } +static int allow_insane_settime = 0; +SYSCTL_INT(_debug, OID_AUTO, allow_insane_settime, CTLFLAG_RWTUN, +_insane_settime, 0, +"do not perform possibly restrictive checks on settime(2) args"); Debugging code; shoouldn't be committed. + int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) { @@ -400,6 +405,8 @@ kern_clock_settime(struct thread *td, cl if (ats->tv_nsec < 0 || ats->tv_nsec >= 10 || ats->tv_sec < 0) return (EINVAL); Times before the Epoch were already disallowed here, but this doesn't prevent negative times being passed to lower levels -- see below. + if (!allow_insane_settime && ats->tv_sec > ULL * 366 * 24 * 60 * 60) + return (EINVAL); This uses the long long abomination. This checking belongs in lower levels. It has a buggy limit. Since the average length of a year is below 366, this can give a year later than , so the year is not guaranteed to be represntable which is not representable in hardware with 4 decimal digits, so even lower levels with such hardware must do their own the check. INT_MAX - is a more reasonable arbitrary limit. Not LONG_MAX, since that is usually the same as TIME_T_MAX, and we want to be able to add the timezone offset without overflow. On arches with 32-bit time_t, the above limit exceeds TIME_T_MAX, so the code should fail to compile due to being tautologically true. The compiler must be smart enough to see the previous check that ats->tv_sec < 0, so that it knows that the comparison cannot fail due to sign extension bugs (negative times promoting to ULLONG_MAX). Using the signed abomination LL would avoid the sign extension. /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(, ats); error = settime(td, ); Modified: head/sys/kern/subr_clock.c == --- head/sys/kern/subr_clock.c Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/kern/subr_clock.c Tue Jan 24 18:05:29 2017(r312702) @@ -178,7 +178,7 @@ clock_ct_to_ts(struct clocktime *ct, str void clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) { - int i, year, days; + time_t i, year, days; time_t rsec;/* remainder seconds */ time_t secs; This works provided the caller never passes a negative time, but obfuscates the range checking. rsec should also be int. @@ -214,6 +214,20 @@ clock_ts_to_ct(struct timespec *ts, stru print_ct(ct); printf("\n"); } + + KASSERT(ct->year >= 0 && ct->year < 1, + ("year %d isn't a 4 digit year", ct->year)); This is too device-dependent, and inconsistent with clock_ct_to_ts(). clock_ct_to_cs() checks that the year is < 2037. So allowing years >= 2037 here is worse than useless -- it allows writing times that will be rejected when read back on the next boot of FreeBSD, although BIOSes and other OSes might accept them. The correct check here is simply an up-front test that tv->tv_sec >= 0 (don't trust callers to pass non-negative years) && tv->tv_sec < INT32_MAX. This allows calculation of everything without overflow using int variables. Further range checks are required: (1) It was correct to not trust callers to pass nonnegative times, so the check here is necessary. Negative times are passed here when the time in clock_settime is small and utc_offset()
Re: svn commit: r312687 - in head/sys: net sys
Dexuan, On Tue, Jan 24, 2017 at 09:19:47AM +, Dexuan Cui wrote: D> Author: dexuan D> Date: Tue Jan 24 09:19:46 2017 D> New Revision: 312687 D> URL: https://svnweb.freebsd.org/changeset/base/312687 D> D> Log: D> ifnet: introduce event handlers for ifup/ifdown events D> D> Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and D> a VF NIC to work together, mainly to support seamless live migration. D> D> When the VF device becomes UP (or DOWN), the synthetic NIC driver needs D> to switch the data path from the synthetic NIC to the VF (or the opposite). D> D> So the synthetic NIC driver needs to know when a VF device is becoming D> UP or DOWN and hence the patch is made. D> D> Reviewed by: sephe D> Approved by: sephe (mentor) D> MFC after: 2 weeks D> Sponsored by: Microsoft D> Differential Revision: https://reviews.freebsd.org/D8963 D> D> Modified: D> head/sys/net/if.c D> head/sys/sys/eventhandler.h ... D> Modified: head/sys/sys/eventhandler.h D> == D> --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017 (r312686) D> +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017 (r312687) D> @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc D> EVENTHANDLER_DECLARE(swapon, swapon_fn); D> EVENTHANDLER_DECLARE(swapoff, swapoff_fn); D> D> +/* ifup/ifdown events */ D> +#define IFNET_EVENT_UP 0 D> +#define IFNET_EVENT_DOWN1 D> +struct ifnet; D> +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); D> +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); D> + D> #endif /* _SYS_EVENTHANDLER_H_ */ The network stuff shall not be added to sys/eventhandler.h. All these declarations should go to net/if_var.h. There is already a block of event(9) defines there. Please move it there. -- Totus tuus, Glebius. ___ 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: r312703 - head/lib/libc/aarch64/sys
Author: andrew Date: Tue Jan 24 18:56:09 2017 New Revision: 312703 URL: https://svnweb.freebsd.org/changeset/base/312703 Log: Fix the error value we write in cerror. __error returns an int *, however we were writing a 64 bit value meaning the 32 bits after this would be trashed. MFC after:3 days Sponsored by: DARPA, AFRL Modified: head/lib/libc/aarch64/sys/cerror.S Modified: head/lib/libc/aarch64/sys/cerror.S == --- head/lib/libc/aarch64/sys/cerror.S Tue Jan 24 18:05:29 2017 (r312702) +++ head/lib/libc/aarch64/sys/cerror.S Tue Jan 24 18:56:09 2017 (r312703) @@ -34,7 +34,7 @@ ENTRY(cerror) stp x0, lr, [sp] bl _C_LABEL(__error) ldp x1, lr, [sp] - str x1, [x0] + str w1, [x0] movnx0, #0 movnx1, #0 add sp, sp, #16 ___ 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: r312702 - in head/sys: kern libkern sys
Author: cem Date: Tue Jan 24 18:05:29 2017 New Revision: 312702 URL: https://svnweb.freebsd.org/changeset/base/312702 Log: Use time_t for intermediate values to avoid overflow in clock_ts_to_ct Add additionally safety and overflow checks to clock_ts_to_ct and the BCD routines while we're here. Perform a safety check in sys_clock_settime() first to avoid easy local root panic, without having to propagate an error value back through dozens of APIs currently lacking error returns. PR: 211960, 214300 Submitted by: Justin McOmie , kib@ Reported by: Tim Newsham Reviewed by: kib@ Sponsored by: Dell EMC Isilon, FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D9279 Modified: head/sys/kern/kern_time.c head/sys/kern/subr_clock.c head/sys/libkern/bcd.c head/sys/sys/libkern.h Modified: head/sys/kern/kern_time.c == --- head/sys/kern/kern_time.c Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/kern/kern_time.c Tue Jan 24 18:05:29 2017(r312702) @@ -387,6 +387,11 @@ sys_clock_settime(struct thread *td, str return (kern_clock_settime(td, uap->clock_id, )); } +static int allow_insane_settime = 0; +SYSCTL_INT(_debug, OID_AUTO, allow_insane_settime, CTLFLAG_RWTUN, +_insane_settime, 0, +"do not perform possibly restrictive checks on settime(2) args"); + int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats) { @@ -400,6 +405,8 @@ kern_clock_settime(struct thread *td, cl if (ats->tv_nsec < 0 || ats->tv_nsec >= 10 || ats->tv_sec < 0) return (EINVAL); + if (!allow_insane_settime && ats->tv_sec > ULL * 366 * 24 * 60 * 60) + return (EINVAL); /* XXX Don't convert nsec->usec and back */ TIMESPEC_TO_TIMEVAL(, ats); error = settime(td, ); Modified: head/sys/kern/subr_clock.c == --- head/sys/kern/subr_clock.c Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/kern/subr_clock.c Tue Jan 24 18:05:29 2017(r312702) @@ -178,7 +178,7 @@ clock_ct_to_ts(struct clocktime *ct, str void clock_ts_to_ct(struct timespec *ts, struct clocktime *ct) { - int i, year, days; + time_t i, year, days; time_t rsec;/* remainder seconds */ time_t secs; @@ -214,6 +214,20 @@ clock_ts_to_ct(struct timespec *ts, stru print_ct(ct); printf("\n"); } + + KASSERT(ct->year >= 0 && ct->year < 1, + ("year %d isn't a 4 digit year", ct->year)); + KASSERT(ct->mon >= 1 && ct->mon <= 12, + ("month %d not in 1-12", ct->mon)); + KASSERT(ct->day >= 1 && ct->day <= 31, + ("day %d not in 1-31", ct->day)); + KASSERT(ct->hour >= 0 && ct->hour <= 23, + ("hour %d not in 0-23", ct->hour)); + KASSERT(ct->min >= 0 && ct->min <= 59, + ("minute %d not in 0-59", ct->min)); + /* Not sure if this interface needs to handle leapseconds or not. */ + KASSERT(ct->sec >= 0 && ct->sec <= 60, + ("seconds %d not in 0-60", ct->sec)); } int Modified: head/sys/libkern/bcd.c == --- head/sys/libkern/bcd.c Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/libkern/bcd.c Tue Jan 24 18:05:29 2017(r312702) @@ -6,6 +6,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include u_char const bcd2bin_data[] = { @@ -20,6 +21,7 @@ u_char const bcd2bin_data[] = { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; +CTASSERT(nitems(bcd2bin_data) == LIBKERN_LEN_BCD2BIN); u_char const bin2bcd_data[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, @@ -33,6 +35,8 @@ u_char const bin2bcd_data[] = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 }; +CTASSERT(nitems(bin2bcd_data) == LIBKERN_LEN_BIN2BCD); /* This is actually used with radix [2..36] */ char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; +CTASSERT(nitems(hex2ascii_data) == LIBKERN_LEN_HEX2ASCII + 1); Modified: head/sys/sys/libkern.h == --- head/sys/sys/libkern.h Tue Jan 24 17:30:13 2017(r312701) +++ head/sys/sys/libkern.h Tue Jan 24 18:05:29 2017(r312702) @@ -49,9 +49,36 @@ extern u_char const bcd2bin_data[]; extern u_char constbin2bcd_data[]; extern char const hex2ascii_data[]; -#definebcd2bin(bcd)(bcd2bin_data[bcd]) -#definebin2bcd(bin)(bin2bcd_data[bin]) -#definehex2ascii(hex) (hex2ascii_data[hex]) +#define
svn commit: r312699 - head/sys/amd64/linux
Author: tijl Date: Tue Jan 24 16:13:59 2017 New Revision: 312699 URL: https://svnweb.freebsd.org/changeset/base/312699 Log: Apply r210555 to 64 bit linux support: The interpreter name should no longer be treated as a buffer that can be overwritten. PR: 216346 MFC after:3 days Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:05:42 2017 (r312698) +++ head/sys/amd64/linux/linux_sysvec.c Tue Jan 24 16:13:59 2017 (r312699) @@ -718,7 +718,7 @@ exec_linux_imgact_try(struct image_param { const char *head = (const char *)imgp->image_header; char *rpath; - int error = -1, len; + int error = -1; /* * The interpreter for shell scripts run from a linux binary needs @@ -736,17 +736,12 @@ exec_linux_imgact_try(struct image_param linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), imgp->interpreter_name, UIO_SYSSPACE, , 0, AT_FDCWD); - if (rpath != NULL) { - len = strlen(rpath) + 1; - - if (len <= MAXSHELLCMDLEN) - memcpy(imgp->interpreter_name, - rpath, len); - free(rpath, M_TEMP); - } + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; } } - return(error); + return (error); } #defineLINUX_VSYSCALL_START(-10UL << 20) ___ 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: r312698 - in head/sys: dev/e1000 kern net sys
Author: sbruno Date: Tue Jan 24 16:05:42 2017 New Revision: 312698 URL: https://svnweb.freebsd.org/changeset/base/312698 Log: iflib: Add internal tracking of smp startup status to reliably figure out what methods are to be used to get gtaskqueue up and running. e1000: Calculating this pointer gives undefined behaviour when (last == -1) (it is before the buffer). The pointer is always followed. Panics occurred when it points to an unmapped page. Otherwise, the pointed-to garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the broken case the loop was usually null and the function just returned, and this was acidentally correct. Submitted by: bde Reported by: Matt MacyModified: head/sys/dev/e1000/em_txrx.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/e1000/em_txrx.c == --- head/sys/dev/e1000/em_txrx.cTue Jan 24 15:55:52 2017 (r312697) +++ head/sys/dev/e1000/em_txrx.cTue Jan 24 16:05:42 2017 (r312698) @@ -408,10 +408,13 @@ em_isc_txd_credits_update(void *arg, uin cidx = cidx_init; buf = >tx_buffers[cidx]; tx_desc = >tx_base[cidx]; -last = buf->eop; + last = buf->eop; + if (last == -1) + return (processed); eop_desc = >tx_base[last]; - DPRINTF(iflib_get_dev(adapter->ctx), "credits_update: cidx_init=%d clear=%d last=%d\n", + DPRINTF(iflib_get_dev(adapter->ctx), + "credits_update: cidx_init=%d clear=%d last=%d\n", cidx_init, clear, last); /* * What this does is get the index of the @@ -420,7 +423,7 @@ em_isc_txd_credits_update(void *arg, uin * simple comparison on the inner while loop. */ if (++last == scctx->isc_ntxd[0]) -last = 0; + last = 0; done = last; @@ -436,7 +439,7 @@ em_isc_txd_credits_update(void *arg, uin tx_desc++; buf++; processed++; - + /* wrap the ring ? */ if (++cidx == scctx->isc_ntxd[0]) { cidx = 0; Modified: head/sys/kern/subr_gtaskqueue.c == --- head/sys/kern/subr_gtaskqueue.c Tue Jan 24 15:55:52 2017 (r312697) +++ head/sys/kern/subr_gtaskqueue.c Tue Jan 24 16:05:42 2017 (r312698) @@ -630,6 +630,29 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } +/* + * smp_started is unusable since it is not set for UP kernels or even for + * SMP kernels when there is 1 CPU. This is usually handled by adding a + * (mp_ncpus == 1) test, but that would be broken here since we need to + * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case + * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. + * + * So maintain our own flag. It must be set after all CPUs are started + * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed + * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before + * SI_ORDER_ANY and unclearly after the CPUs are started. It would be + * simpler for adjustment to pass a flag indicating if it is delayed. + */ +static int tqg_smp_started; + +static void +tqg_record_smp_started(void *arg) +{ + tqg_smp_started = 1; +} + +SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, + tqg_record_smp_started, NULL); void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, @@ -647,7 +670,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(>tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && (smp_started || mp_ncpus == 1)) { + if (irq != -1 && tqg_smp_started ) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, ); @@ -697,7 +720,7 @@ taskqgroup_attach_cpu(struct taskqgroup gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(>tqg_lock); - if (smp_started || mp_ncpus == 1) { + if (tqg_smp_started) { for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -731,7 +754,7 @@ taskqgroup_attach_cpu_deferred(struct ta qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started || mp_ncpus == 1); + MPASS(tqg_smp_started); mtx_lock(>tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if
svn commit: r312696 - in head/sys: dev/e1000 kern net sys
Author: sbruno Date: Tue Jan 24 14:48:32 2017 New Revision: 312696 URL: https://svnweb.freebsd.org/changeset/base/312696 Log: iflib: Add internal tracking of smp startup status to reliably figure out what methods are to be used to get gtaskqueue up and running. e1000: Calculating this pointer gives undefined behaviour when (last == -1) (it is before the buffer). The pointer is always followed. Panics occurred when it points to an unmapped page. Otherwise, the pointed-to garbage tends to not have the E1000_TXD_STAT_DD bit set in it, so in the broken case the loop was usually null and the function just returned, and this was acidentally correct. Submitted by: bde Reviewed by: Matt MacyModified: head/sys/dev/e1000/em_txrx.c head/sys/kern/subr_gtaskqueue.c head/sys/net/iflib.c head/sys/sys/gtaskqueue.h Modified: head/sys/dev/e1000/em_txrx.c == --- head/sys/dev/e1000/em_txrx.cTue Jan 24 12:15:10 2017 (r312695) +++ head/sys/dev/e1000/em_txrx.cTue Jan 24 14:48:32 2017 (r312696) @@ -408,10 +408,13 @@ em_isc_txd_credits_update(void *arg, uin cidx = cidx_init; buf = >tx_buffers[cidx]; tx_desc = >tx_base[cidx]; -last = buf->eop; + last = buf->eop; + if (last == -1) + return (processed); eop_desc = >tx_base[last]; - DPRINTF(iflib_get_dev(adapter->ctx), "credits_update: cidx_init=%d clear=%d last=%d\n", + DPRINTF(iflib_get_dev(adapter->ctx), + "credits_update: cidx_init=%d clear=%d last=%d\n", cidx_init, clear, last); /* * What this does is get the index of the @@ -420,7 +423,7 @@ em_isc_txd_credits_update(void *arg, uin * simple comparison on the inner while loop. */ if (++last == scctx->isc_ntxd[0]) -last = 0; + last = 0; done = last; @@ -436,7 +439,7 @@ em_isc_txd_credits_update(void *arg, uin tx_desc++; buf++; processed++; - + /* wrap the ring ? */ if (++cidx == scctx->isc_ntxd[0]) { cidx = 0; Modified: head/sys/kern/subr_gtaskqueue.c == --- head/sys/kern/subr_gtaskqueue.c Tue Jan 24 12:15:10 2017 (r312695) +++ head/sys/kern/subr_gtaskqueue.c Tue Jan 24 14:48:32 2017 (r312696) @@ -630,6 +630,29 @@ taskqgroup_find(struct taskqgroup *qgrou return (idx); } +/* + * smp_started is unusable since it is not set for UP kernels or even for + * SMP kernels when there is 1 CPU. This is usually handled by adding a + * (mp_ncpus == 1) test, but that would be broken here since we need to + * to synchronize with the SI_SUB_SMP ordering. Even in the pure SMP case + * smp_started only gives a fuzzy ordering relative to SI_SUB_SMP. + * + * So maintain our own flag. It must be set after all CPUs are started + * and before SI_SUB_SMP:SI_ORDER_ANY so that the SYSINIT for delayed + * adjustment is properly delayed. SI_ORDER_FOURTH is clearly before + * SI_ORDER_ANY and unclearly after the CPUs are started. It would be + * simpler for adjustment to pass a flag indicating if it is delayed. + */ +static int tqg_smp_started; + +static void +tqg_record_smp_started(void *arg) +{ + tqg_smp_started = 1; +} + +SYSINIT(tqg_record_smp_started, SI_SUB_SMP, SI_ORDER_FOURTH, + tqg_record_smp_started, NULL); void taskqgroup_attach(struct taskqgroup *qgroup, struct grouptask *gtask, @@ -647,7 +670,7 @@ taskqgroup_attach(struct taskqgroup *qgr qgroup->tqg_queue[qid].tgc_cnt++; LIST_INSERT_HEAD(>tqg_queue[qid].tgc_tasks, gtask, gt_list); gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq; - if (irq != -1 && (smp_started || mp_ncpus == 1)) { + if (irq != -1 && tqg_smp_started ) { gtask->gt_cpu = qgroup->tqg_queue[qid].tgc_cpu; CPU_ZERO(); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, ); @@ -697,7 +720,7 @@ taskqgroup_attach_cpu(struct taskqgroup gtask->gt_irq = irq; gtask->gt_cpu = cpu; mtx_lock(>tqg_lock); - if (smp_started || mp_ncpus == 1) { + if (tqg_smp_started) for (i = 0; i < qgroup->tqg_cnt; i++) if (qgroup->tqg_queue[i].tgc_cpu == cpu) { qid = i; @@ -731,7 +754,7 @@ taskqgroup_attach_cpu_deferred(struct ta qid = -1; irq = gtask->gt_irq; cpu = gtask->gt_cpu; - MPASS(smp_started || mp_ncpus == 1); + MPASS(tqg_smp_started); mtx_lock(>tqg_lock); for (i = 0; i < qgroup->tqg_cnt; i++) if
Re: svn commit: r312694 - in head: sys/cam/ctl usr.sbin/ctladm
On 24.01.2017 15:14, Konstantin Belousov wrote: > On Tue, Jan 24, 2017 at 12:13:41PM +, Alexander Motin wrote: >> Author: mav >> Date: Tue Jan 24 12:13:41 2017 >> New Revision: 312694 >> URL: https://svnweb.freebsd.org/changeset/base/312694 >> >> Log: >> Make CTL ramdisk backend a real RAM disk. >> >> If "capacity" LU option is set, ramdisk backend now implements featured >> thin provisioned disk, storing data in malloc(9) allocated memory blocks >> of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU >> size is used for indirection tree (bigger pblocksize reduce the overhead). >> Backend supports all unmap and anchor operations. If configured capacity >> is overflowed, proper error conditions are reported. >> >> If "capacity" LU option is not set, the backend operates mostly the same >> as before without allocating real storage: writes go to nowhere, reads >> return zeroes, reporting that all LBAs are unmapped. >> >> This backend is still mostly oriented on testing and benchmarking (it is >> still a volatile RAM disk), but now it should allow to run real FS tests, >> not only simple dumb dd. > > This sounds too much like malloc-backed md(4). Yes, it is. Just without memory copies and GEOM calls, and with some additional SCSI features. -- Alexander Motin ___ 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: r312694 - in head: sys/cam/ctl usr.sbin/ctladm
On Tue, Jan 24, 2017 at 12:13:41PM +, Alexander Motin wrote: > Author: mav > Date: Tue Jan 24 12:13:41 2017 > New Revision: 312694 > URL: https://svnweb.freebsd.org/changeset/base/312694 > > Log: > Make CTL ramdisk backend a real RAM disk. > > If "capacity" LU option is set, ramdisk backend now implements featured > thin provisioned disk, storing data in malloc(9) allocated memory blocks > of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU > size is used for indirection tree (bigger pblocksize reduce the overhead). > Backend supports all unmap and anchor operations. If configured capacity > is overflowed, proper error conditions are reported. > > If "capacity" LU option is not set, the backend operates mostly the same > as before without allocating real storage: writes go to nowhere, reads > return zeroes, reporting that all LBAs are unmapped. > > This backend is still mostly oriented on testing and benchmarking (it is > still a volatile RAM disk), but now it should allow to run real FS tests, > not only simple dumb dd. This sounds too much like malloc-backed md(4). ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312694 - in head: sys/cam/ctl usr.sbin/ctladm
Author: mav Date: Tue Jan 24 12:13:41 2017 New Revision: 312694 URL: https://svnweb.freebsd.org/changeset/base/312694 Log: Make CTL ramdisk backend a real RAM disk. If "capacity" LU option is set, ramdisk backend now implements featured thin provisioned disk, storing data in malloc(9) allocated memory blocks of pblocksize bytes (default PAGE_SIZE or 4KB). Additionally ~0.2% of LU size is used for indirection tree (bigger pblocksize reduce the overhead). Backend supports all unmap and anchor operations. If configured capacity is overflowed, proper error conditions are reported. If "capacity" LU option is not set, the backend operates mostly the same as before without allocating real storage: writes go to nowhere, reads return zeroes, reporting that all LBAs are unmapped. This backend is still mostly oriented on testing and benchmarking (it is still a volatile RAM disk), but now it should allow to run real FS tests, not only simple dumb dd. MFC after:2 weeks Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c head/usr.sbin/ctladm/ctladm.8 Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c == --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Jan 24 11:13:41 2017 (r312693) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Jan 24 12:13:41 2017 (r312694) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003, 2008 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation - * Copyright (c) 2014-2015 Alexander Motin+ * Copyright (c) 2014-2017 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -35,7 +35,7 @@ * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_ramdisk.c#3 $ */ /* - * CAM Target Layer backend for a "fake" ramdisk. + * CAM Target Layer black hole and RAM disk backend. * * Author: Ken Merry */ @@ -48,9 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -71,6 +73,29 @@ __FBSDID("$FreeBSD$"); #include #include +#define PRIV(io) \ +((struct ctl_ptr_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_BACKEND]) +#define ARGS(io) \ +((struct ctl_lba_len_flags *)&(io)->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]) + +#definePPP (PAGE_SIZE / sizeof(uint8_t **)) +#ifdef __LP64__ +#definePPPS(PAGE_SHIFT - 3) +#else +#definePPPS(PAGE_SHIFT - 2) +#endif +#defineSGPP(PAGE_SIZE / sizeof(struct ctl_sg_entry)) + +#defineP_UNMAPPED NULL/* Page is unmapped. */ +#defineP_ANCHORED ((void *)(uintptr_t)1) /* Page is anchored. */ + +typedef enum { + GP_READ,/* Return data page or zero page. */ + GP_WRITE, /* Return data page, try allocate if none. */ + GP_ANCHOR, /* Return data page, try anchor if none. */ + GP_OTHER, /* Return what present, do not allocate/anchor. */ +} getpage_op_t; + typedef enum { CTL_BE_RAMDISK_LUN_UNCONFIGURED = 0x01, CTL_BE_RAMDISK_LUN_CONFIG_ERR = 0x02, @@ -79,28 +104,29 @@ typedef enum { struct ctl_be_ramdisk_lun { struct ctl_lun_create_params params; - char lunname[32]; - uint64_t size_bytes; - uint64_t size_blocks; + charlunname[32]; + int indir; + uint8_t **pages; + uint8_t *zero_page; + struct sx page_lock; + u_int pblocksize; + u_int pblockmul; + uint64_tsize_bytes; + uint64_tsize_blocks; + uint64_tcap_bytes; + uint64_tcap_used; struct ctl_be_ramdisk_softc *softc; ctl_be_ramdisk_lun_flags flags; STAILQ_ENTRY(ctl_be_ramdisk_lun) links; - struct ctl_be_lun cbe_lun; - struct taskqueue *io_taskqueue; - struct task io_task; + struct ctl_be_lun cbe_lun; + struct taskqueue*io_taskqueue; + struct task io_task; STAILQ_HEAD(, ctl_io_hdr) cont_queue; - struct mtx_padalign queue_lock; + struct mtx_padalign queue_lock; }; struct ctl_be_ramdisk_softc { struct mtx lock; - int rd_size; -#ifdef CTL_RAMDISK_PAGES - uint8_t **ramdisk_pages; - int num_pages; -#else - uint8_t *ramdisk_buffer; -#endif int num_luns; STAILQ_HEAD(, ctl_be_ramdisk_lun) lun_list; }; @@ -111,8 +137,13 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static void
svn commit: r312692 - head/usr.bin/find
Author: sevan (doc committer) Date: Tue Jan 24 10:42:21 2017 New Revision: 312692 URL: https://svnweb.freebsd.org/changeset/base/312692 Log: Improve wording when describing -mmin. PR: 215922 Submitted by: danielsh AT apache DOT org Approved by: bcr (mentor) MFC after:5 days Differential Revision:https://reviews.freebsd.org/D9313 Modified: head/usr.bin/find/find.1 Modified: head/usr.bin/find/find.1 == --- head/usr.bin/find/find.1Tue Jan 24 09:41:44 2017(r312691) +++ head/usr.bin/find/find.1Tue Jan 24 10:42:21 2017(r312692) @@ -31,7 +31,7 @@ .\"@(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 13, 2014 +.Dd January 24, 2017 .Dt FIND 1 .Os .Sh NAME @@ -572,6 +572,7 @@ processes all but the command line argum True if the difference between the file last modification time and the time .Nm was started, rounded up to the next full minute, is +more than .Ar n .Pq + Ns Ar n , less than ___ 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: r312691 - in head: sys/riscv/include sys/riscv/riscv usr.bin/truss
Author: lwhsu (ports committer) Date: Tue Jan 24 09:41:44 2017 New Revision: 312691 URL: https://svnweb.freebsd.org/changeset/base/312691 Log: Add RISC-V support for truss(1) While here, extract NARGREG as a definition. Reviewed by: br Differential Revision:https://reviews.freebsd.org/D9249 Added: head/usr.bin/truss/riscv64-freebsd.c (contents, props changed) Modified: head/sys/riscv/include/frame.h head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/include/frame.h == --- head/sys/riscv/include/frame.h Tue Jan 24 09:27:13 2017 (r312690) +++ head/sys/riscv/include/frame.h Tue Jan 24 09:41:44 2017 (r312691) @@ -74,4 +74,7 @@ struct sigframe { #endif /* !LOCORE */ +/* Definitions for syscalls */ +#defineNARGREG 8 /* 8 args in regs */ + #endif /* !_MACHINE_FRAME_H_ */ Modified: head/sys/riscv/riscv/trap.c == --- head/sys/riscv/riscv/trap.c Tue Jan 24 09:27:13 2017(r312690) +++ head/sys/riscv/riscv/trap.c Tue Jan 24 09:41:44 2017(r312691) @@ -95,7 +95,7 @@ cpu_fetch_syscall_args(struct thread *td register_t *ap; int nap; - nap = 8; + nap = NARGREG; p = td->td_proc; ap = >td_frame->tf_a[0]; @@ -116,7 +116,7 @@ cpu_fetch_syscall_args(struct thread *td sa->narg = sa->callp->sy_narg; memcpy(sa->args, ap, nap * sizeof(register_t)); if (sa->narg > nap) - panic("TODO: Could we have more then 8 args?"); + panic("TODO: Could we have more then %d args?", NARGREG); td->td_retval[0] = 0; td->td_retval[1] = 0; Added: head/usr.bin/truss/riscv64-freebsd.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/riscv64-freebsd.cTue Jan 24 09:41:44 2017 (r312691) @@ -0,0 +1,106 @@ +/*- + * Copyright 2017 Li-Wen Hsu+ * + * 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$"); + +/* FreeBSD/riscv64-specific system call handling. */ + +#include +#include + +#include +#include + +#include +#include +#include + +#include "truss.h" + +static int +riscv64_fetch_args(struct trussinfo *trussinfo, u_int narg) +{ + struct reg regs; + struct current_syscall *cs; + lwpid_t tid; + u_int i, reg, syscall_num; + + tid = trussinfo->curthread->tid; + cs = >curthread->cs; + if (ptrace(PT_GETREGS, tid, (caddr_t), 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + /* +* FreeBSD has two special kinds of system call redirections -- +* SYS_syscall, and SYS___syscall. The former is the old syscall() +* routine, basically; the latter is for quad-aligned arguments. +* +* The system call argument count and code from ptrace() already +* account for these, but we need to skip over the first argument. +*/ + syscall_num = regs.t[0]; + if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) { + reg = 1; + syscall_num = regs.a[0]; + } else { + reg = 0; + } + + for (i = 0; i < narg && reg < NARGREG; i++, reg++) + cs->args[i] = regs.a[reg]; + return (0); +} + +static int +riscv64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) +{ + struct reg
svn commit: r312690 - head/sys/dev/hyperv/netvsc
Author: dexuan Date: Tue Jan 24 09:27:13 2017 New Revision: 312690 URL: https://svnweb.freebsd.org/changeset/base/312690 Log: hyperv/hn: add devctl_notify for VF_UP/DOWN events Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9102 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:25:42 2017 (r312689) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:27:13 2017 (r312690) @@ -996,6 +996,9 @@ hn_set_vf(struct hn_softc *sc, struct if hn_resume_mgmt(sc); } + devctl_notify("HYPERV_NIC_VF", if_name(hn_ifp), + vf ? "VF_UP" : "VF_DOWN", NULL); + if (bootverbose) if_printf(hn_ifp, "Data path is switched %s %s\n", vf ? "to" : "from", if_name(ifp)); ___ 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: r312689 - head/sys/dev/hyperv/netvsc
Author: dexuan Date: Tue Jan 24 09:25:42 2017 New Revision: 312689 URL: https://svnweb.freebsd.org/changeset/base/312689 Log: hyperv/hn: add a sysctl name for the VF interface This makes it easier for the userland script to find the releated VF interface. Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9101 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:24:14 2017 (r312688) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:25:42 2017 (r312689) @@ -301,6 +301,7 @@ static int hn_txagg_pkts_sysctl(SYSCTL static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); static voidhn_stop(struct hn_softc *, bool); static voidhn_init_locked(struct hn_softc *); @@ -1254,6 +1255,9 @@ hn_attach(device_t dev) CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_polling_sysctl, "I", "Polling frequency: [100,100], 0 disable polling"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "vf", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + hn_vf_sysctl, "A", "Virtual Function's name"); /* * Setup the ifmedia, which has been initialized earlier. @@ -3222,6 +3226,22 @@ hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS) } static int +hn_vf_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + char vf_name[128]; + struct ifnet *vf; + + HN_LOCK(sc); + vf_name[0] = '\0'; + vf = sc->hn_rx_ring[0].hn_vf; + if (vf != NULL) + snprintf(vf_name, sizeof(vf_name), "%s", if_name(vf)); + HN_UNLOCK(sc); + return sysctl_handle_string(oidp, vf_name, sizeof(vf_name), req); +} + +static int hn_check_iplen(const struct mbuf *m, int hoff) { const struct ip *ip; ___ 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: r312688 - head/sys/dev/hyperv/netvsc
Author: dexuan Date: Tue Jan 24 09:24:14 2017 New Revision: 312688 URL: https://svnweb.freebsd.org/changeset/base/312688 Log: hyperv/hn: add the support for VF drivers (SR-IOV) Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together (both NICs have the same MAC address), mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). Note: multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface (if the VF is UP), even if the synthetic NIC is DOWN (so we need to force the rxfilter to be NDIS_PACKET_TYPE_PROMISCUOUS, when the VF is UP). Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8964 Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/hn_nvs.h head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c == --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Jan 24 09:24:14 2017 (r312688) @@ -500,6 +500,8 @@ hn_nvs_conf_ndis(struct hn_softc *sc, in conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; conf.nvs_mtu = mtu; conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) + conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; /* NOTE: No response. */ error = hn_nvs_req_send(sc, , sizeof(conf)); @@ -719,3 +721,15 @@ hn_nvs_send_rndis_ctrl(struct vmbus_chan return hn_nvs_send_rndis_sglist(chan, HN_NVS_RNDIS_MTYPE_CTRL, sndc, gpa, gpa_cnt); } + +void +hn_nvs_set_datapath(struct hn_softc *sc, uint32_t path) +{ + struct hn_nvs_datapath dp; + + memset(, 0, sizeof(dp)); + dp.nvs_type = HN_NVS_TYPE_SET_DATAPATH; + dp.nvs_active_path = path; + + hn_nvs_req_send(sc, , sizeof(dp)); +} Modified: head/sys/dev/hyperv/netvsc/hn_nvs.h == --- head/sys/dev/hyperv/netvsc/hn_nvs.h Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Tue Jan 24 09:24:14 2017 (r312688) @@ -100,6 +100,7 @@ voidhn_nvs_sent_xact(struct hn_nvs_sen inthn_nvs_send_rndis_ctrl(struct vmbus_channel *chan, struct hn_nvs_sendctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); +void hn_nvs_set_datapath(struct hn_softc *sc, uint32_t path); extern struct hn_nvs_sendctx hn_nvs_sendctx_none; Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:19:46 2017 (r312687) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:24:14 2017 (r312688) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -84,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -216,6 +218,11 @@ struct hn_rxinfo { uint32_thash_value; }; +struct hn_update_vf { + struct hn_rx_ring *rxr; + struct ifnet*vf; +}; + #define HN_RXINFO_VLAN 0x0001 #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 @@ -295,7 +302,7 @@ static int hn_txagg_pktmax_sysctl(SYSC static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); -static voidhn_stop(struct hn_softc *); +static voidhn_stop(struct hn_softc *, bool); static voidhn_init_locked(struct hn_softc *); static int hn_chan_attach(struct hn_softc *, struct vmbus_channel *); @@ -707,7 +714,8 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); - if (ifp->if_flags & IFF_PROMISC) { + if ((ifp->if_flags & IFF_PROMISC) || + (sc->hn_flags & HN_FLAG_VF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -896,6 +904,119 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmr->ifm_active |= IFM_10G_T | IFM_FDX; } +static void +hn_update_vf_task(void *arg, int pending __unused) +{ + struct hn_update_vf *uv = arg; + + uv->rxr->hn_vf = uv->vf; +} + +static void
svn commit: r312687 - in head/sys: net sys
Author: dexuan Date: Tue Jan 24 09:19:46 2017 New Revision: 312687 URL: https://svnweb.freebsd.org/changeset/base/312687 Log: ifnet: introduce event handlers for ifup/ifdown events Hyper-V's NIC SR-IOV implementation needs a Hyper-V synthetic NIC and a VF NIC to work together, mainly to support seamless live migration. When the VF device becomes UP (or DOWN), the synthetic NIC driver needs to switch the data path from the synthetic NIC to the VF (or the opposite). So the synthetic NIC driver needs to know when a VF device is becoming UP or DOWN and hence the patch is made. Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8963 Modified: head/sys/net/if.c head/sys/sys/eventhandler.h Modified: head/sys/net/if.c == --- head/sys/net/if.c Tue Jan 24 09:15:36 2017(r312686) +++ head/sys/net/if.c Tue Jan 24 09:19:46 2017(r312687) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -2218,6 +2219,7 @@ void if_down(struct ifnet *ifp) { + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_DOWN); if_unroute(ifp, IFF_UP, AF_UNSPEC); } @@ -2230,6 +2232,7 @@ if_up(struct ifnet *ifp) { if_route(ifp, IFF_UP, AF_UNSPEC); + EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_UP); } /* Modified: head/sys/sys/eventhandler.h == --- head/sys/sys/eventhandler.h Tue Jan 24 09:15:36 2017(r312686) +++ head/sys/sys/eventhandler.h Tue Jan 24 09:19:46 2017(r312687) @@ -284,4 +284,11 @@ typedef void (*swapoff_fn)(void *, struc EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); +/* ifup/ifdown events */ +#define IFNET_EVENT_UP 0 +#define IFNET_EVENT_DOWN 1 +struct ifnet; +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); + #endif /* _SYS_EVENTHANDLER_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312686 - head/sys/dev/hyperv/netvsc
Author: dexuan Date: Tue Jan 24 09:15:36 2017 New Revision: 312686 URL: https://svnweb.freebsd.org/changeset/base/312686 Log: hyperv/hn: remove the MTU and IFF_DRV_RUNNING checking in hn_rxpkt() It's unnecessary because the upper nework stack does the same checking. In the case of Hyper-V SR-IOV, we need to remove the checking because 1) multicast/broadcast packets are still received through the synthetic NIC and we need to inject the packets through the VF interface; 2) we must inject the packets even if the synthetic NIC is down, or has a different MTU from the VF device. Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8962 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:09:53 2017 (r312685) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:15:36 2017 (r312686) @@ -2129,15 +2129,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const v int size, do_lro = 0, do_csum = 1; int hash_type; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - return (0); - - /* -* Bail out if packet contains more data than configured MTU. -*/ - if (dlen > (ifp->if_mtu + ETHER_HDR_LEN)) { - return (0); - } else if (dlen <= MHLEN) { + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312685 - head/sys/dev/hyperv/netvsc
Author: dexuan Date: Tue Jan 24 09:09:53 2017 New Revision: 312685 URL: https://svnweb.freebsd.org/changeset/base/312685 Log: hyperv/hn: remember the channel pointer in struct hn_rx_ring This will be used by the coming NIC SR-IOV patch. Reviewed by: sephe Approved by: sephe (mentor) MFC after:2 weeks Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8909 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 08:56:54 2017 (r312684) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Jan 24 09:09:53 2017 (r312685) @@ -4323,6 +4323,7 @@ hn_chan_attach(struct hn_softc *sc, stru KASSERT((rxr->hn_rx_flags & HN_RX_FLAG_ATTACHED) == 0, ("RX ring %d already attached", idx)); rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED; + rxr->hn_chan = chan; if (bootverbose) { if_printf(sc->hn_ifp, "link RX ring %d to chan%u\n", Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h == --- head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 08:56:54 2017 (r312684) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Jan 24 09:09:53 2017 (r312685) @@ -85,6 +85,8 @@ struct hn_rx_ring { void*hn_br; /* TX/RX bufring */ struct hyperv_dma hn_br_dma; + + struct vmbus_channel *hn_chan; } __aligned(CACHE_LINE_SIZE); #define HN_TRUST_HCSUM_IP 0x0001 ___ 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: r312684 - head/usr.sbin/wpa/wpa_cli
Author: sevan (doc committer) Date: Tue Jan 24 08:56:54 2017 New Revision: 312684 URL: https://svnweb.freebsd.org/changeset/base/312684 Log: Extend manual to cover more commands and options. PR: 203406 Submitted by: Fehmi Noyan Isi (fnoyanisi AT yahoo DOT com) Approved by: wblock (mentor) MFC after:5 days Differential Revision: https://reviews.freebsd.org/D8691 Modified: head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Modified: head/usr.sbin/wpa/wpa_cli/wpa_cli.8 == --- head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Tue Jan 24 07:48:36 2017 (r312683) +++ head/usr.sbin/wpa/wpa_cli/wpa_cli.8 Tue Jan 24 08:56:54 2017 (r312684) @@ -24,15 +24,22 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2005 +.Dd January 24, 2017 .Dt WPA_CLI 8 .Os .Sh NAME .Nm wpa_cli .Nd "text-based frontend program for interacting with wpa_supplicant" .Sh SYNOPSIS -.Nm -.Op Ar commands +.Nm wpa_cli +.Op Fl p Ar path_to_ctrl_sockets +.Op Fl i Ar ifname +.Op Fl hvB +.Op Fl a Ar action_file +.Op Fl P Ar pid_file +.Op Fl g Ar global_ctrl +.Op Fl G Ar ping_interval +.Ar command ... .Sh DESCRIPTION The .Nm @@ -144,26 +151,75 @@ Example request for generic token card c CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar > otp 2 9876 .Ed +.Sh OPTIONS +These options are available: +.Bl -tag -width indent +.It Fl p Ar path +Control sockets path. +This should match the +.Ic ctrl_interface +in +.Xr wpa_supplicant.conf 5 . +The default path is +.Pa /var/run/wpa_supplicant . +.It Fl i Ar ifname +Interface to be configured. +By default, the first interface found in the socket path is used. +.It Fl h +Show help. +.It Fl v +Show version information. +.It Fl B +Run the daemon in the background. +.It Fl a Ar action_file +Run in daemon mode, executing the action file based on events from +.Xr wpa_supplicant 8 . +.It Fl P Ar pid_file +PID file location. +.It Fl g Ar global_ctrl +Use a global control interface to +.Xr wpa_supplicant 8 +rather than the default Unix domain sockets. +.It Fl G Ar ping_interval +Wait +.Dq ping_interval +seconds before sending each ping to +.Xr wpa_supplicant 8 . +See the +.Ic ping +command. +.It command +See available commands in the next section. +.El .Sh COMMANDS -The following commands may be supplied on the command line +These commands can be supplied on the command line or at a prompt when operating interactively. .Bl -tag -width indent .It Ic status Report the current WPA/EAPOL/EAP status for the current interface. +.It Ic ifname +Show the current interface name. +The default interface is the first interface found in the socket path. +.It Ic ping +Ping the +.Xr wpa_supplicant 8 +utility. +This command can be used to test the status of the +.Xr wpa_supplicant 8 +daemon. .It Ic mib Report MIB variables (dot1x, dot11) for the current interface. .It Ic help Show usage help. .It Ic interface Op Ar ifname Show available interfaces and/or set the current interface -when multiple are available. +when multiple interfaces are available. .It Ic level Ar debug_level Change the debugging level in .Xr wpa_supplicant 8 . Larger numbers generate more messages. .It Ic license -Display the full -license for +Display the full license for .Nm . .It Ic logoff Send the IEEE 802.1X EAPOL state machine into the @@ -192,12 +248,68 @@ Force preauthentication of the specified Configure an identity for an SSID. .It Ic password Ar network_id password Configure a password for an SSID. +.It Ic new_password Ar network_id password +Change the password for an SSID. +.It Ic PIN Ar network_id pin +Configure a PIN for an SSID. +.It Ic passphrase Ar network_id passphrase +Configure a private key passphrase for an SSID. +.It Ic bssid Ar network_id bssid +Set a preferred BSSID for an SSID +.It Ic blacklist Op Ar bssid | clear +Add a BSSID to the blacklist. +When invoked without any extra arguments, display the blacklist. +Specifying +.Ar clear +causes +.Nm +to clear the blacklist. +.It Ic list_networks +List configured networks. +.It Ic select_network Ar network_id +Select a network and disable others. +.It Ic enable_network Ar network_id +Enable a network. +.It Ic disable_network Ar network_id +Disable a network. +.It Ic add_network +Add a network. +.It Ic remove_network Ar network_id +Remove a network. +.It Ic set_network Op Ar network_id variable value +Set network variables. +Shows a list of variables when run without arguments. +.It Ic get_network Ar network_id variable +Get network variables. +.It Ic disconnect +Disconnect and wait for reassociate/reconnect command before connecting. +.It Ic reconnect +Similar to +.Ic reassociate , +but only takes effect if already disconnected. +.It Ic scan +Request new BSS scan. +.It Ic scan_results +Get the latest BSS scan results. +This command can be invoked after running a BSS scan with +.Ic scan . +.It Ic bss Op Ar idx | bssid +Get a detailed BSS scan result for the network