svn commit: r312618 - head/tools/tools/ath/athalq
Author: adrian Date: Sun Jan 22 07:05:41 2017 New Revision: 312618 URL: https://svnweb.freebsd.org/changeset/base/312618 Log: [athalq] fix rxtimestamp wrapping; print out per-packet timestamp deltas. The delta here is just between the current TX/RX copmletion and the previous TX/RX completion. The metadata needed to link TX descriptor timestamps to their /completion/ timestamp isn't there yet. Modified: head/tools/tools/ath/athalq/ar9300_ds.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c == --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:30:55 2017 (r312617) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 07:05:41 2017 (r312618) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #defineMS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) #defineMF(_v, _f) ( !! ((_v) & (_f))) +static uint32_t last_ts = 0; + void ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a) { @@ -62,15 +64,18 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(, >payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u, DescId=0x%04x, QCU=%d\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u (%u), DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), (unsigned long long) be64toh(a->hdr.threadid), txs.status4, + txs.status4 - last_ts, (unsigned int) MS(txs.status1, AR_tx_desc_id), (unsigned int) MS(txs.ds_info, AR_tx_qcu_num)); printf("DescId=0x%08x\n", txs.status1); + last_ts = txs.status4; + printf("DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", txs.ds_info & 0xff, MS(txs.ds_info, AR_tx_qcu_num), @@ -333,10 +338,12 @@ ar9300_decode_rxstatus(struct if_ath_alq /* XXX assumes rxs is smaller than PAYLOAD_LEN! */ memcpy(, >payload, sizeof(struct ar9300_rxs)); - printf("[%u.%06u] [%llu] RXSTATUS\n", + printf("[%u.%06u] [%llu] RXSTATUS RxTimestamp: %u (%d)\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + rxs.status3, + rxs.status3 - last_ts); /* status1 */ /* .. and status5 */ @@ -358,7 +365,8 @@ ar9300_decode_rxstatus(struct if_ath_alq MS(rxs.status2, AR_hw_upload_data)); /* status3 */ - printf("RX timestamp: %d\n", rxs.status3); + printf("RX timestamp: %u\n", rxs.status3); + last_ts = rxs.status3; /* status4 */ printf("GI: %d, 2040: %d, parallel40: %d, stbc=%d\n", ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312617 - in head/sys/powerpc: include powerpc
Author: jhibbits Date: Sun Jan 22 06:30:55 2017 New Revision: 312617 URL: https://svnweb.freebsd.org/changeset/base/312617 Log: Hide the 'MOREARGS' macro, it conflicts with contrib code, and is only used in one file. PR: 211818 Reported by: Mark Millard MFC after:2 weeks Modified: head/sys/powerpc/include/frame.h head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/include/frame.h == --- head/sys/powerpc/include/frame.hSun Jan 22 06:25:41 2017 (r312616) +++ head/sys/powerpc/include/frame.hSun Jan 22 06:30:55 2017 (r312617) @@ -109,7 +109,5 @@ struct callframe { /* Definitions for syscalls */ #defineFIRSTARG3 /* first arg in reg 3 */ #defineNARGREG 8 /* 8 args in regs */ -#defineMOREARGS(sp)((caddr_t)((uintptr_t)(sp) + \ -sizeof(struct callframe) - 3*sizeof(register_t))) /* more args go here */ #endif /* _MACHINE_FRAME_H_ */ Modified: head/sys/powerpc/powerpc/trap.c == --- head/sys/powerpc/powerpc/trap.c Sun Jan 22 06:25:41 2017 (r312616) +++ head/sys/powerpc/powerpc/trap.c Sun Jan 22 06:30:55 2017 (r312617) @@ -80,6 +80,9 @@ __FBSDID("$FreeBSD$"); #defineFAULTBUF_CR 22 #defineFAULTBUF_R143 +#defineMOREARGS(sp)((caddr_t)((uintptr_t)(sp) + \ +sizeof(struct callframe) - 3*sizeof(register_t))) /* more args go here */ + static voidtrap_fatal(struct trapframe *frame); static voidprinttrap(u_int vector, struct trapframe *frame, int isfatal, int user); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312616 - head/tools/tools/ath/athalq
Author: adrian Date: Sun Jan 22 06:25:41 2017 New Revision: 312616 URL: https://svnweb.freebsd.org/changeset/base/312616 Log: [athalq] print out unsigned tx timestamps. Modified: head/tools/tools/ath/athalq/ar9300_ds.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c == --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:17:31 2017 (r312615) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 06:25:41 2017 (r312616) @@ -62,7 +62,7 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(, >payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%d, DescId=0x%04x, QCU=%d\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%u, DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), (unsigned long long) be64toh(a->hdr.threadid), @@ -77,7 +77,7 @@ ar9300_decode_txstatus(struct if_ath_alq MS(txs.ds_info, AR_ctrl_stat), MS(txs.ds_info, AR_desc_id)); - printf("TxTimestamp: %d\n", txs.status4); + printf("TxTimestamp: %u\n", txs.status4); printf("TxDone=%d, SeqNo=%d, TxOpExceed=%d, TXBFStatus=%d\n", MF(txs.status8, AR_tx_done), ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312615 - head/sys/powerpc/mpc85xx
Author: jhibbits Date: Sun Jan 22 06:17:31 2017 New Revision: 312615 URL: https://svnweb.freebsd.org/changeset/base/312615 Log: Fix r312613. Somehow this slipped through my build testing. Modified: head/sys/powerpc/mpc85xx/fsl_diu.c Modified: head/sys/powerpc/mpc85xx/fsl_diu.c == --- head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 06:00:05 2017 (r312614) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 06:17:31 2017 (r312615) @@ -389,7 +389,7 @@ diu_attach(device_t dev) OF_prop_free(edid_cells); return (ENXIO); } - videomode = edid->edid_preferred_mode; + videomode = edid.edid_preferred_mode; } else { /* Parse video-mode kenv variable. */ if ((err = sscanf(vm_name, "fslfb:%dx%d@%d", , , )) != 3) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312614 - head/sys/conf
Author: jhibbits Date: Sun Jan 22 06:00:05 2017 New Revision: 312614 URL: https://svnweb.freebsd.org/changeset/base/312614 Log: Don't pass -Wa,-many through clang, the integrated as doesn't support it. Our base binutils sets -many by default anyway, but external gcc may not do this. PR: kern/215948 Submitted by: Mark Millard Reported by: Mark Millard MFC after:2 weeks Modified: head/sys/conf/Makefile.powerpc Modified: head/sys/conf/Makefile.powerpc == --- head/sys/conf/Makefile.powerpc Sun Jan 22 05:49:43 2017 (r312613) +++ head/sys/conf/Makefile.powerpc Sun Jan 22 06:00:05 2017 (r312614) @@ -39,7 +39,8 @@ INCLUDES+= -I$S/contrib/libfdt # Force __SPE__, since the builtin will be removed later with -mno-spe CFLAGS+= -mabi=spe -D__SPE__ .endif -CFLAGS+= -msoft-float -Wa,-many +CFLAGS+= -msoft-float +CFLAGS.gcc+= -Wa,-many # Build position-independent kernel CFLAGS+= -fPIC ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312613 - head/sys/powerpc/mpc85xx
Author: jhibbits Date: Sun Jan 22 05:49:43 2017 New Revision: 312613 URL: https://svnweb.freebsd.org/changeset/base/312613 Log: Fix use of uninitialized variable. I don't know how gcc didn't catch this. This was caught during test building with clang. Modified: head/sys/powerpc/mpc85xx/fsl_diu.c Modified: head/sys/powerpc/mpc85xx/fsl_diu.c == --- head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 05:45:42 2017 (r312612) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sun Jan 22 05:49:43 2017 (r312613) @@ -344,7 +344,7 @@ diu_init(struct diu_softc *sc) static int diu_attach(device_t dev) { - struct edid_info *edid; + struct edid_info edid; struct diu_softc *sc; const struct videomode *videomode; void *edid_cells; @@ -384,7 +384,7 @@ diu_attach(device_t dev) } } if (edid_cells != NULL) { - if (edid_parse(edid_cells, edid) != 0) { + if (edid_parse(edid_cells, ) != 0) { device_printf(dev, "Error parsing EDID\n"); OF_prop_free(edid_cells); return (ENXIO); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312612 - head/sys/dev/ath
Author: adrian Date: Sun Jan 22 05:45:42 2017 New Revision: 312612 URL: https://svnweb.freebsd.org/changeset/base/312612 Log: [ath] only apply the AR9300 delimiter workaround for the first sub-frame. This is supposed to only be applied to the first subframe and only if RTS/CTS is being done. I'm still not yet checking RTS/CTS exchange status so it's just happening for all subframes on AR9380 and later. This gets MCS23 throughput up from around 250mbit to 303mbit with RTS/CTS protection enabled, and around 330mbit with no HT protection enabled. Now, MCS23 has a PHY rate of 450mbit and we should be seeing closer to 400mbit for a straight one-way UDP test, but this beats the previous maximum throughput. Tested: * AR9380 (STA) -> AR9580 (AP) - STA with the modifications, doing UDP TX test using iperf. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Sun Jan 22 05:28:26 2017 (r312611) +++ head/sys/dev/ath/if_ath_tx_ht.c Sun Jan 22 05:45:42 2017 (r312612) @@ -402,7 +402,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft */ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf, -uint16_t pktlen) +uint16_t pktlen, int is_first) { #defineMS(_v, _f) (((_v) & _f) >> _f##_S) const HAL_RATE_TABLE *rt = sc->sc_currates; @@ -458,11 +458,12 @@ ath_compute_num_delims(struct ath_softc * For AR9380, there's a minimum number of delimeters * required when doing RTS. * -* XXX TODO: this is only needed if (a) RTS/CTS is enabled, and -* XXX (b) this is the first sub-frame in the aggregate. +* XXX TODO: this is only needed if (a) RTS/CTS is enabled for +* this exchange, and (b) (done) this is the first sub-frame +* in the aggregate. */ if (sc->sc_use_ent && (sc->sc_ent_cfg & AH_ENT_RTSCTS_DELIM_WAR) - && ndelim < AH_FIRST_DESC_NDELIMS) + && ndelim < AH_FIRST_DESC_NDELIMS && is_first) ndelim = AH_FIRST_DESC_NDELIMS; /* @@ -975,7 +976,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s */ bf->bf_state.bfs_ndelim = ath_compute_num_delims(sc, bf_first, - bf->bf_state.bfs_pktlen); + bf->bf_state.bfs_pktlen, (bf_first == bf)); /* * Calculate the padding needed from this set of delimiters, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312611 - head/tools/tools/ath/athalq
Author: adrian Date: Sun Jan 22 05:28:26 2017 New Revision: 312611 URL: https://svnweb.freebsd.org/changeset/base/312611 Log: [athalq] add debug parsing for the TX FIFO push status. Modified: head/tools/tools/ath/athalq/ar9300_ds.c head/tools/tools/ath/athalq/ar9300_ds.h head/tools/tools/ath/athalq/main.c Modified: head/tools/tools/ath/athalq/ar9300_ds.c == --- head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/ar9300_ds.c Sun Jan 22 05:28:26 2017 (r312611) @@ -38,6 +38,22 @@ __FBSDID("$FreeBSD$"); #defineMS(_v, _f) ( ((_v) & (_f)) >> _f##_S ) #defineMF(_v, _f) ( !! ((_v) & (_f))) +void +ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a) +{ + struct if_ath_alq_tx_fifo_push p; + + memcpy(, >payload, sizeof(p)); + printf("[%u.%06u] [%llu] TXPUSH txq=%d, nframes=%d, fifodepth=%d, frmcount=%d\n", + (unsigned int) be32toh(a->hdr.tstamp_sec), + (unsigned int) be32toh(a->hdr.tstamp_usec), + (unsigned long long) be64toh(a->hdr.threadid), + be32toh(p.txq), + be32toh(p.nframes), + be32toh(p.fifo_depth), + be32toh(p.frame_cnt)); +} + static void ar9300_decode_txstatus(struct if_ath_alq_payload *a) { @@ -46,10 +62,13 @@ ar9300_decode_txstatus(struct if_ath_alq /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(, >payload, sizeof(struct ar9300_txs)); - printf("[%u.%06u] [%llu] TXSTATUS\n", + printf("[%u.%06u] [%llu] TXSTATUS TxTimestamp=%d, DescId=0x%04x, QCU=%d\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + txs.status4, + (unsigned int) MS(txs.status1, AR_tx_desc_id), + (unsigned int) MS(txs.ds_info, AR_tx_qcu_num)); printf("DescId=0x%08x\n", txs.status1); printf("DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", @@ -58,7 +77,7 @@ ar9300_decode_txstatus(struct if_ath_alq MS(txs.ds_info, AR_ctrl_stat), MS(txs.ds_info, AR_desc_id)); - printf("TxTimestamp=0x%08x\n", txs.status4); + printf("TxTimestamp: %d\n", txs.status4); printf("TxDone=%d, SeqNo=%d, TxOpExceed=%d, TXBFStatus=%d\n", MF(txs.status8, AR_tx_done), @@ -130,10 +149,11 @@ ar9300_decode_txdesc(struct if_ath_alq_p /* XXX assumes txs is smaller than PAYLOAD_LEN! */ memcpy(, >payload, 96); - printf("[%u.%06u] [%llu] TXD\n", + printf("[%u.%06u] [%llu] TXD DescId=0x%04x\n", (unsigned int) be32toh(a->hdr.tstamp_sec), (unsigned int) be32toh(a->hdr.tstamp_usec), - (unsigned long long) be64toh(a->hdr.threadid)); + (unsigned long long) be64toh(a->hdr.threadid), + (unsigned int) MS(txc.ds_ctl10, AR_tx_desc_id)); printf(" DescLen=%d, TxQcuNum=%d, CtrlStat=%d, DescId=0x%04x\n", txc.ds_info & 0xff, Modified: head/tools/tools/ath/athalq/ar9300_ds.h == --- head/tools/tools/ath/athalq/ar9300_ds.h Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/ar9300_ds.h Sun Jan 22 05:28:26 2017 (r312611) @@ -19,5 +19,6 @@ #define__AR9300_DS_H__ extern void ar9300_alq_payload(struct if_ath_alq_payload *a); +extern void ath_alq_print_edma_tx_fifo_push(struct if_ath_alq_payload *a); #endif /* __AR9300_DS_H__ */ Modified: head/tools/tools/ath/athalq/main.c == --- head/tools/tools/ath/athalq/main.c Sun Jan 22 00:46:04 2017 (r312610) +++ head/tools/tools/ath/athalq/main.c Sun Jan 22 05:28:26 2017 (r312611) @@ -186,6 +186,9 @@ main(int argc, const char *argv[]) case ATH_ALQ_RESUME_BEACON: ath_alq_print_beacon_resume(a); break; + case ATH_ALQ_TX_FIFO_PUSH: + ath_alq_print_edma_tx_fifo_push(a); + break; default: if (be32toh(hdr.sc_hal_magic) == AR5210_MAGIC) ar5210_alq_payload(a); @@ -195,10 +198,8 @@ main(int argc, const char *argv[]) ar5212_alq_payload(a); else if (be32toh(hdr.sc_hal_magic) == AR5416_MAGIC) ar5416_alq_payload(a); -#if 1 else if (be32toh(hdr.sc_hal_magic) == AR9300_MAGIC)
Re: svn commit: r312600 - head/sys/kern
On Sat, 21 Jan 2017, Konstantin Belousov wrote: On Sat, Jan 21, 2017 at 06:38:17PM +, Mateusz Guzik wrote: ... Log: vfs: refactor _vn_lock Stop testing for LK_RETRY and error multiple times. Also postpone the VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. No functional changes. Many style bugs. Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sat Jan 21 17:39:10 2017(r312599) +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017(r312600) @@ -1539,27 +1539,24 @@ _vn_lock(struct vnode *vp, int flags, ch VNASSERT((flags & LK_TYPE_MASK) != 0, vp, ("vn_lock called with no locktype.")); - do { #ifdef DEBUG_VFS_LOCKS - KASSERT(vp->v_holdcnt != 0, - ("vn_lock %p: zero hold count", vp)); + KASSERT(vp->v_holdcnt != 0, + ("vn_lock %p: zero hold count", vp)); This line also has wrong inde seems to not be fixed by later commit. #endif - error = VOP_LOCK1(vp, flags, file, line); - flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ - KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", - flags, error)); This was correctly formatted except for the long line. - /* -* Callers specify LK_RETRY if they wish to get dead vnodes. -* If RETRY is not set, we return ENOENT instead. -*/ - if (error == 0 && vp->v_iflag & VI_DOOMED && - (flags & LK_RETRY) == 0) { +retry: + error = VOP_LOCK1(vp, flags, file, line); + flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ + KASSERT((flags & LK_RETRY) == 0 || error == 0, + ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", +flags, error)); This is even more grossly misreformatted than the other KASSERT(). The new style bugs are: - random first contuation indent (it happens to be 2 tabs) - long line longer than before (further messed up by the indentation) - random second contuation indent (it actually lines up with the first, except it uses gnu-style lining up parentheses instead of KNF) + if (flags & LK_RETRY) { Stylish test is if ((flags & LK_RETRY) != 0) { + if ((error != 0)) Too many (). + goto retry; + if ((vp->v_iflag & VI_DOOMED)) { Too many braces again, or missed != 0. VOP_UNLOCK(vp, 0); error = ENOENT; - break; Also, this does the functional change, it seems to completely break LK_RERY logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. Later commits further unimproved style by adding __predict_ugly() and long lines from blind substitution of that. __predict_ugly() is almost as useful as 'register', but more invasive. } - } while (flags & LK_RETRY && error != 0); + } return (error); } Bruce ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312610 - in head/sys/arm: arm include
Author: jah Date: Sun Jan 22 00:46:04 2017 New Revision: 312610 URL: https://svnweb.freebsd.org/changeset/base/312610 Log: Like r310481 for i386, move the objects used to create temporary mappings for armv6 pmap zero and copy operations to the MD PCPU region. Change sysmap initialization to only allocate KVA pages for CPUs that are actually present. While here, collapse CMAP3 into CMAP2 (their use was mutually exclusive anyway) and "recover" some space in PCPU padding that has always been available due to 64-byte cacheline padding. Reviewed by: skra MFC after:1 week Differential Revision:https://reviews.freebsd.org/D9172 Modified: head/sys/arm/arm/pmap-v6.c head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/pmap-v6.c == --- head/sys/arm/arm/pmap-v6.c Sat Jan 21 23:35:54 2017(r312609) +++ head/sys/arm/arm/pmap-v6.c Sun Jan 22 00:46:04 2017(r312610) @@ -110,11 +110,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef SMP -#include -#else -#include -#endif #ifdef DDB #include @@ -296,16 +291,6 @@ vm_paddr_t first_managed_pa; /* * All those kernel PT submaps that BSD is so fond of */ -struct sysmaps { - struct mtx lock; - pt2_entry_t *CMAP1; - pt2_entry_t *CMAP2; - pt2_entry_t *CMAP3; - caddr_t CADDR1; - caddr_t CADDR2; - caddr_t CADDR3; -}; -static struct sysmaps sysmaps_pcpu[MAXCPU]; caddr_t _tmppt = 0; struct msgbuf *msgbufp = NULL; /* XXX move it to machdep.c */ @@ -1134,8 +1119,7 @@ void pmap_bootstrap(vm_offset_t firstaddr) { pt2_entry_t *unused __unused; - struct sysmaps *sysmaps; - u_int i; + struct pcpu *pc; /* * Initialize the kernel pmap (which is statically allocated). @@ -1174,15 +1158,13 @@ pmap_bootstrap(vm_offset_t firstaddr) /* * Local CMAP1/CMAP2 are used for zeroing and copying pages. -* Local CMAP3 is used for data cache cleaning. +* Local CMAP2 is also used for data cache cleaning. */ - for (i = 0; i < MAXCPU; i++) { - sysmaps = _pcpu[i]; - mtx_init(>lock, "SYSMAPS", NULL, MTX_DEF); - SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1); - SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1); - SYSMAP(caddr_t, sysmaps->CMAP3, sysmaps->CADDR3, 1); - } + pc = pcpu_find(curcpu); + mtx_init(>pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + SYSMAP(caddr_t, pc->pc_cmap1_pte2p, pc->pc_cmap1_addr, 1); + SYSMAP(caddr_t, pc->pc_cmap2_pte2p, pc->pc_cmap2_addr, 1); + SYSMAP(vm_offset_t, unused, pc->pc_qmap_addr, 1); /* * Crashdump maps. @@ -1215,19 +1197,32 @@ pmap_bootstrap(vm_offset_t firstaddr) } static void -pmap_init_qpages(void) +pmap_init_reserved_pages(void) { struct pcpu *pc; + vm_offset_t pages; int i; CPU_FOREACH(i) { pc = pcpu_find(i); - pc->pc_qmap_addr = kva_alloc(PAGE_SIZE); - if (pc->pc_qmap_addr == 0) + /* +* Skip if the mapping has already been initialized, +* i.e. this is the BSP. +*/ + if (pc->pc_cmap1_addr != 0) + continue; + mtx_init(>pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + pages = kva_alloc(PAGE_SIZE * 3); + if (pages == 0) panic("%s: unable to allocate KVA", __func__); + pc->pc_cmap1_pte2p = pt2map_entry(pages); + pc->pc_cmap2_pte2p = pt2map_entry(pages + PAGE_SIZE); + pc->pc_cmap1_addr = (caddr_t)pages; + pc->pc_cmap2_addr = (caddr_t)(pages + PAGE_SIZE); + pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); } } -SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_qpages, NULL); +SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); /* * The function can already be use in second initialization stage. @@ -1578,8 +1573,9 @@ pagezero(void *page) static __inline vm_paddr_t pmap_pt2pg_zero(vm_page_t m) { + pt2_entry_t *cmap2_pte2p; vm_paddr_t pa; - struct sysmaps *sysmaps; + struct pcpu *pc; pa = VM_PAGE_TO_PHYS(m); @@ -1588,20 +1584,27 @@ pmap_pt2pg_zero(vm_page_t m) * to sync it even if the sync is only DSB. */ sched_pin(); - sysmaps = _pcpu[PCPU_GET(cpuid)]; - mtx_lock(>lock); - if (pte2_load(sysmaps->CMAP2) != 0) + pc = pcpu_find(curcpu); + cmap2_pte2p = pc->pc_cmap2_pte2p; + mtx_lock(>pc_cmap_lock); + if (pte2_load(cmap2_pte2p) != 0) panic("%s: CMAP2 busy", __func__); - pte2_store(sysmaps->CMAP2, PTE2_KERN_NG(pa, PTE2_AP_KRW, + pte2_store(cmap2_pte2p,
svn commit: r312609 - head/sys/dev/ath
Author: adrian Date: Sat Jan 21 23:35:54 2017 New Revision: 312609 URL: https://svnweb.freebsd.org/changeset/base/312609 Log: [ath] improve the debugging when looking into the maximum A-MPDU size being chosen. This is how I caught the "why are we only sending 8K aggregates?" problem. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Sat Jan 21 23:07:15 2017 (r312608) +++ head/sys/dev/ath/if_ath_tx_ht.c Sat Jan 21 23:35:54 2017 (r312609) @@ -589,8 +589,14 @@ ath_get_aggr_limit(struct ath_softc *sc, amin = MIN(amin, bf->bf_state.bfs_rc[i].max4msframelen); } - DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: max frame len= %d\n", - __func__, amin); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, + "%s: aggr_limit=%d, iv_ampdu_limit=%d, " + "peer maxrxampdu=%d, max frame len=%d\n", + __func__, + sc->sc_aggr_limit, + vap->iv_ampdu_limit, + MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU), + amin); return amin; #undef MS ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312608 - head/sys/arm/ti/cpsw
Author: loos Date: Sat Jan 21 23:07:15 2017 New Revision: 312608 URL: https://svnweb.freebsd.org/changeset/base/312608 Log: Handle the rx queue stall while reading the packets from NIC (when the descriptor state will not change anymore). This seems to eliminate the race where we can miss a stalled queue under high load. While here remove the unnecessary curly brackets. Reported by: Konstantin KormashevMFC after:3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c == --- head/sys/arm/ti/cpsw/if_cpsw.c Sat Jan 21 21:03:26 2017 (r312607) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sat Jan 21 23:07:15 2017 (r312608) @@ -1652,6 +1652,14 @@ cpsw_rx_dequeue(struct cpsw_softc *sc) } } + if (STAILQ_FIRST(>rx.active) != NULL && + (bd.flags & (CPDMA_BD_EOP | CPDMA_BD_EOQ)) == + (CPDMA_BD_EOP | CPDMA_BD_EOQ)) { + cpsw_write_hdp_slot(sc, >rx, + STAILQ_FIRST(>rx.active)); + sc->rx.queue_restart++; + } + /* Add mbuf to packet list to be returned. */ if (mb_tail) { mb_tail->m_nextpkt = slot->mbuf; @@ -1684,7 +1692,6 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) struct cpsw_cpdma_bd bd; struct cpsw_slot *first_new_slot, *last_old_slot, *next, *slot; int error, nsegs, added = 0; - uint32_t flags; /* Register new mbufs with hardware. */ first_new_slot = NULL; @@ -1750,22 +1757,13 @@ cpsw_rx_enqueue(struct cpsw_softc *sc) } else { /* Add buffers to end of current queue. */ cpsw_cpdma_write_bd_next(sc, last_old_slot, first_new_slot); - /* If underrun, restart queue. */ - if ((flags = cpsw_cpdma_read_bd_flags(sc, last_old_slot)) & - CPDMA_BD_EOQ) { - flags &= ~CPDMA_BD_EOQ; - cpsw_cpdma_write_bd_flags(sc, last_old_slot, flags); - cpsw_write_hdp_slot(sc, >rx, first_new_slot); - sc->rx.queue_restart++; - } } sc->rx.queue_adds += added; sc->rx.avail_queue_len -= added; sc->rx.active_queue_len += added; cpsw_write_4(sc, CPSW_CPDMA_RX_FREEBUFFER(0), added); - if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) { + if (sc->rx.active_queue_len > sc->rx.max_active_queue_len) sc->rx.max_active_queue_len = sc->rx.active_queue_len; - } } static void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r312600 - head/sys/kern
On Sat, Jan 21, 2017 at 09:51:14PM +0200, Konstantin Belousov wrote: > On Sat, Jan 21, 2017 at 06:38:17PM +, Mateusz Guzik wrote: > > + if (flags & LK_RETRY) { > Stylish test is > if ((flags & LK_RETRY) != 0) { > > + if ((error != 0)) > Too many (). > > > + goto retry; > > + if ((vp->v_iflag & VI_DOOMED)) { > Too many braces again, or missed != 0. This was a side effect of putting these into __predict_false and then removing it, albeit not fully. > > VOP_UNLOCK(vp, 0); > > error = ENOENT; > > - break; > Also, this does the functional change, it seems to completely break LK_RERY > logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. > Yea, this was a weird-ass brainfart on my part. Fixed in r312606 The gist of the actual change I wanted to make is postponing the read from the vnode. > > } > > - } while (flags & LK_RETRY && error != 0); > > + } > > return (error); > > } > > -- Mateusz Guzik ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312607 - head/sys/dev/ath
Author: avos Date: Sat Jan 21 21:03:26 2017 New Revision: 312607 URL: https://svnweb.freebsd.org/changeset/base/312607 Log: ath: adapt LDPC support checks Set both IEEE80211_HTCAP_LDPC and IEEE80211_HTC_TXLDPC capability flags if LDPC is supported + set 'do_ldpc = 1' only when it is not disabled, not just supported. Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D9277 Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Sat Jan 21 20:34:20 2017(r312606) +++ head/sys/dev/ath/if_ath.c Sat Jan 21 21:03:26 2017(r312607) @@ -1178,7 +1178,8 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_has_ldpc = 1; device_printf(sc->sc_dev, "[HT] LDPC transmit/receive enabled\n"); - ic->ic_htcaps |= IEEE80211_HTCAP_LDPC; + ic->ic_htcaps |= IEEE80211_HTCAP_LDPC | +IEEE80211_HTC_TXLDPC; } Modified: head/sys/dev/ath/if_ath_tx_ht.c == --- head/sys/dev/ath/if_ath_tx_ht.c Sat Jan 21 20:34:20 2017 (r312606) +++ head/sys/dev/ath/if_ath_tx_ht.c Sat Jan 21 21:03:26 2017 (r312607) @@ -239,7 +239,7 @@ ath_tx_rate_fill_rcflags(struct ath_soft * it if any of the rate entries aren't 11n. */ do_ldpc = 0; - if ((ni->ni_vap->iv_htcaps & IEEE80211_HTCAP_LDPC) && + if ((ni->ni_vap->iv_flags_ht & IEEE80211_FHT_LDPC_TX) && (ni->ni_htcap & IEEE80211_HTCAP_LDPC)) do_ldpc = 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312606 - head/sys/kern
Author: mjg Date: Sat Jan 21 20:34:20 2017 New Revision: 312606 URL: https://svnweb.freebsd.org/changeset/base/312606 Log: vfs: fix LK_RETRY logic braino in r312600 Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sat Jan 21 19:56:28 2017(r312605) +++ head/sys/kern/vfs_vnops.c Sat Jan 21 20:34:20 2017(r312606) @@ -1549,13 +1549,15 @@ retry: KASSERT((flags & LK_RETRY) == 0 || error == 0, ("LK_RETRY set with incompatible flags (0x%x) or " " an error occurred (%d)", flags, error)); - if (flags & LK_RETRY) { - if ((error != 0)) - goto retry; - if ((vp->v_iflag & VI_DOOMED)) { + + if ((flags & LK_RETRY) == 0) { + if (error == 0 && vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); error = ENOENT; } + } else { + if (error != 0) + goto retry; } return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r312598 - head/sys/kern
> On Jan 21, 2017, at 08:59, Mateusz Guzikwrote: > > Author: mjg > Date: Sat Jan 21 16:59:50 2017 > New Revision: 312598 > URL: https://svnweb.freebsd.org/changeset/base/312598 > > Log: > vfs: hide the getvnode NULL mp message behind DIAGNOSTIC > > Since crossmp vnode changes the message was being printed on each boot. > > Reported by: trasz > Discussed with: kib Thank you, -Ngie signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r312605 - head/sys/arm/ti/cpsw
Author: loos Date: Sat Jan 21 19:56:28 2017 New Revision: 312605 URL: https://svnweb.freebsd.org/changeset/base/312605 Log: Commit the struture changes for the padding of small packets on if_cpsw. Should have been committed together with r312604. MFC with: r312604 Modified: head/sys/arm/ti/cpsw/if_cpswvar.h Modified: head/sys/arm/ti/cpsw/if_cpswvar.h == --- head/sys/arm/ti/cpsw/if_cpswvar.h Sat Jan 21 19:49:39 2017 (r312604) +++ head/sys/arm/ti/cpsw/if_cpswvar.h Sat Jan 21 19:56:28 2017 (r312605) @@ -104,10 +104,8 @@ struct cpsw_softc { struct resource *irq_res[CPSW_INTR_COUNT]; void*ih_cookie[CPSW_INTR_COUNT]; - /* An mbuf full of nulls for TX padding. */ - bus_dmamap_t null_mbuf_dmamap; - struct mbuf *null_mbuf; - bus_addr_t null_mbuf_paddr; + /* A buffer full of nulls for TX padding. */ + void*nullpad; bus_dma_tag_t mbuf_dtag; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r312600 - head/sys/kern
On Sat, Jan 21, 2017 at 06:38:17PM +, Mateusz Guzik wrote: > Author: mjg > Date: Sat Jan 21 18:38:16 2017 > New Revision: 312600 > URL: https://svnweb.freebsd.org/changeset/base/312600 > > Log: > vfs: refactor _vn_lock > > Stop testing for LK_RETRY and error multiple times. Also postpone the > VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. > > No functional changes. > > Modified: > head/sys/kern/vfs_vnops.c > > Modified: head/sys/kern/vfs_vnops.c > == > --- head/sys/kern/vfs_vnops.c Sat Jan 21 17:39:10 2017(r312599) > +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017(r312600) > @@ -1539,27 +1539,24 @@ _vn_lock(struct vnode *vp, int flags, ch > > VNASSERT((flags & LK_TYPE_MASK) != 0, vp, > ("vn_lock called with no locktype.")); > - do { > #ifdef DEBUG_VFS_LOCKS > - KASSERT(vp->v_holdcnt != 0, > - ("vn_lock %p: zero hold count", vp)); > + KASSERT(vp->v_holdcnt != 0, > + ("vn_lock %p: zero hold count", vp)); This line also has wrong inde seems to not be fixed by later commit. > #endif > - error = VOP_LOCK1(vp, flags, file, line); > - flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > - KASSERT((flags & LK_RETRY) == 0 || error == 0, > - ("LK_RETRY set with incompatible flags (0x%x) or an error > occurred (%d)", > - flags, error)); > - /* > - * Callers specify LK_RETRY if they wish to get dead vnodes. > - * If RETRY is not set, we return ENOENT instead. > - */ > - if (error == 0 && vp->v_iflag & VI_DOOMED && > - (flags & LK_RETRY) == 0) { > +retry: > + error = VOP_LOCK1(vp, flags, file, line); > + flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ > + KASSERT((flags & LK_RETRY) == 0 || error == 0, > + ("LK_RETRY set with incompatible flags (0x%x) or an > error occurred (%d)", > + flags, error)); > + if (flags & LK_RETRY) { Stylish test is if ((flags & LK_RETRY) != 0) { > + if ((error != 0)) Too many (). > + goto retry; > + if ((vp->v_iflag & VI_DOOMED)) { Too many braces again, or missed != 0. > VOP_UNLOCK(vp, 0); > error = ENOENT; > - break; Also, this does the functional change, it seems to completely break LK_RERY logic. If LK_RETRY is specified, VI_DOOMED must not result in ENOENT. > } > - } while (flags & LK_RETRY && error != 0); > + } > return (error); > } > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312604 - head/sys/arm/ti/cpsw
Author: loos Date: Sat Jan 21 19:49:39 2017 New Revision: 312604 URL: https://svnweb.freebsd.org/changeset/base/312604 Log: Simplify the handling of small packets padding in cpsw: - Pad small packets to 60 bytes and not 64 (exclude the CRC bytes); - Pad the packet using m_append(9), if the packet has enough space for padding, which is usually true, it will not be necessary append a newly allocated mbuf to the chain. Suggested by: yongari MFC after:3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c == --- head/sys/arm/ti/cpsw/if_cpsw.c Sat Jan 21 19:38:26 2017 (r312603) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sat Jan 21 19:49:39 2017 (r312604) @@ -783,8 +783,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, static int cpsw_attach(device_t dev) { - bus_dma_segment_t segs[1]; - int error, i, nsegs; + int error, i; struct cpsw_softc *sc; uint32_t reg; @@ -859,15 +858,8 @@ cpsw_attach(device_t dev) return (error); } - /* Allocate the null mbuf and pre-sync it. */ - sc->null_mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - memset(sc->null_mbuf->m_data, 0, sc->null_mbuf->m_ext.ext_size); - bus_dmamap_create(sc->mbuf_dtag, 0, >null_mbuf_dmamap); - bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->null_mbuf_dmamap, - sc->null_mbuf, segs, , BUS_DMA_NOWAIT); - bus_dmamap_sync(sc->mbuf_dtag, sc->null_mbuf_dmamap, - BUS_DMASYNC_PREWRITE); - sc->null_mbuf_paddr = segs[0].ds_addr; + /* Allocate a NULL buffer for padding. */ + sc->nullpad = malloc(ETHER_MIN_LEN, M_DEVBUF, M_WAITOK | M_ZERO); cpsw_init_slots(sc); @@ -946,13 +938,9 @@ cpsw_detach(device_t dev) for (i = 0; i < nitems(sc->_slots); ++i) cpsw_free_slot(sc, >_slots[i]); - /* Free null mbuf. */ - if (sc->null_mbuf_dmamap) { - bus_dmamap_unload(sc->mbuf_dtag, sc->null_mbuf_dmamap); - error = bus_dmamap_destroy(sc->mbuf_dtag, sc->null_mbuf_dmamap); - KASSERT(error == 0, ("Mapping still active")); - m_freem(sc->null_mbuf); - } + /* Free null padding buffer. */ + if (sc->nullpad) + free(sc->nullpad, M_DEVBUF); /* Free DMA tag */ if (sc->mbuf_dtag) { @@ -1829,21 +1817,19 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) break; slot->mbuf = m0; - padlen = ETHER_MIN_LEN - slot->mbuf->m_pkthdr.len; + padlen = ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; if (padlen < 0) padlen = 0; + else if (padlen > 0) + m_append(slot->mbuf, padlen, sc->swsc->nullpad); /* Create mapping in DMA memory */ error = bus_dmamap_load_mbuf_sg(sc->swsc->mbuf_dtag, slot->dmamap, slot->mbuf, segs, , BUS_DMA_NOWAIT); /* If the packet is too fragmented, try to simplify. */ if (error == EFBIG || - (error == 0 && - nsegs + (padlen > 0 ? 1 : 0) > sc->swsc->tx.avail_queue_len)) { + (error == 0 && nsegs > sc->swsc->tx.avail_queue_len)) { bus_dmamap_unload(sc->swsc->mbuf_dtag, slot->dmamap); - if (padlen > 0) /* May as well add padding. */ - m_append(slot->mbuf, padlen, - sc->swsc->null_mbuf->m_data); m0 = m_defrag(slot->mbuf, M_NOWAIT); if (m0 == NULL) { device_printf(sc->dev, @@ -1895,7 +1881,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.bufptr = segs[0].ds_addr; bd.bufoff = 0; bd.buflen = segs[0].ds_len; - bd.pktlen = m_length(slot->mbuf, NULL) + padlen; + bd.pktlen = m_length(slot->mbuf, NULL); bd.flags = CPDMA_BD_SOP | CPDMA_BD_OWNER; if (sc->swsc->dualemac) { bd.flags |= CPDMA_BD_TO_PORT; @@ -1920,42 +1906,18 @@ cpswp_tx_enqueue(struct cpswp_softc *sc) bd.pktlen = 0; bd.flags = CPDMA_BD_OWNER; } + /* Save the final buffer. */ - if (padlen <= 0) - bd.flags |= CPDMA_BD_EOP; - else { - next = STAILQ_NEXT(slot, next); - bd.next = cpsw_cpdma_bd_paddr(sc->swsc, next); - } + bd.flags |= CPDMA_BD_EOP; cpsw_cpdma_write_bd(sc->swsc, slot, ); STAILQ_REMOVE_HEAD(>swsc->tx.avail,
svn commit: r312603 - head/sys/cam/ctl
Author: mav Date: Sat Jan 21 19:38:26 2017 New Revision: 312603 URL: https://svnweb.freebsd.org/changeset/base/312603 Log: Add initial support for CTL module unloading. It is only a first step and not perfect, but better then nothing. The main blocker is CAM target frontend, that can not be unloaded, since CAM does not have mechanism to unregister periph driver now. MFC after:2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_frontend.c head/sys/cam/ctl/ctl_frontend.h head/sys/cam/ctl/ctl_frontend_cam_sim.c head/sys/cam/ctl/ctl_frontend_ioctl.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_private.h head/sys/cam/ctl/ctl_tpc_local.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Sat Jan 21 19:01:42 2017(r312602) +++ head/sys/cam/ctl/ctl.c Sat Jan 21 19:38:26 2017(r312603) @@ -424,7 +424,7 @@ static void ctl_isc_event_handler(ctl_ha static void ctl_copy_sense_data(union ctl_ha_msg *src, union ctl_io *dest); static void ctl_copy_sense_data_back(union ctl_io *src, union ctl_ha_msg *dest); static int ctl_init(void); -void ctl_shutdown(void); +static int ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); @@ -520,6 +520,8 @@ static const struct ctl_cmd_entry * ctl_validate_command(struct ctl_scsiio *ctsio); static int ctl_cmd_applicable(uint8_t lun_type, const struct ctl_cmd_entry *entry); +static int ctl_ha_init(void); +static int ctl_ha_shutdown(void); static uint64_t ctl_get_prkey(struct ctl_lun *lun, uint32_t residx); static void ctl_clr_prkey(struct ctl_lun *lun, uint32_t residx); @@ -561,6 +563,49 @@ MODULE_VERSION(ctl, 1); static struct ctl_frontend ha_frontend = { .name = "ha", + .init = ctl_ha_init, + .shutdown = ctl_ha_shutdown, +}; + +static int +ctl_ha_init(void) +{ + struct ctl_softc *softc = control_softc; + + if (ctl_pool_create(softc, "othersc", CTL_POOL_ENTRIES_OTHER_SC, + >othersc_pool) != 0) + return (ENOMEM); + if (ctl_ha_msg_init(softc) != CTL_HA_STATUS_SUCCESS) { + ctl_pool_free(softc->othersc_pool); + return (EIO); + } + if (ctl_ha_msg_register(CTL_HA_CHAN_CTL, ctl_isc_event_handler) + != CTL_HA_STATUS_SUCCESS) { + ctl_ha_msg_destroy(softc); + ctl_pool_free(softc->othersc_pool); + return (EIO); + } + return (0); +}; + +static int +ctl_ha_shutdown(void) +{ + struct ctl_softc *softc = control_softc; + struct ctl_port *port; + + ctl_ha_msg_shutdown(softc); + if (ctl_ha_msg_deregister(CTL_HA_CHAN_CTL) != CTL_HA_STATUS_SUCCESS) + return (EIO); + if (ctl_ha_msg_destroy(softc) != CTL_HA_STATUS_SUCCESS) + return (EIO); + ctl_pool_free(softc->othersc_pool); + while ((port = STAILQ_FIRST(_frontend.port_list)) != NULL) { + ctl_port_deregister(port); + free(port->port_name, M_CTL); + free(port, M_CTL); + } + return (0); }; static void @@ -1782,7 +1827,6 @@ ctl_init(void) { struct make_dev_args args; struct ctl_softc *softc; - void *other_pool; int i, error; softc = control_softc = malloc(sizeof(*control_softc), M_DEVBUF, @@ -1855,15 +1899,6 @@ ctl_init(void) STAILQ_INIT(>be_list); ctl_tpc_init(softc); - if (ctl_pool_create(softc, "othersc", CTL_POOL_ENTRIES_OTHER_SC, - _pool) != 0) - { - printf("ctl: can't allocate %d entry other SC pool, " - "exiting\n", CTL_POOL_ENTRIES_OTHER_SC); - return (ENOMEM); - } - softc->othersc_pool = other_pool; - if (worker_threads <= 0) worker_threads = max(1, mp_ncpus / 4); if (worker_threads > CTL_MAX_THREADS) @@ -1883,22 +1918,19 @@ ctl_init(void) >ctl_proc, >thread, 0, 0, "ctl", "work%d", i); if (error != 0) { printf("error creating CTL work thread!\n"); - ctl_pool_free(other_pool); return (error); } } error = kproc_kthread_add(ctl_lun_thread, softc, - >ctl_proc, NULL, 0, 0, "ctl", "lun"); + >ctl_proc, >lun_thread, 0, 0, "ctl", "lun"); if (error != 0) { printf("error creating CTL lun thread!\n"); -
svn commit: r312602 - head/sys/kern
Author: mjg Date: Sat Jan 21 19:01:42 2017 New Revision: 312602 URL: https://svnweb.freebsd.org/changeset/base/312602 Log: vfs: __predict_false the need to handle F_HASLOCK Also reorder the check with DTYPE_VNODE. Passed files are vnodes vast majority of the time, so it is typically true. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sat Jan 21 18:56:58 2017(r312601) +++ head/sys/kern/vfs_vnops.c Sat Jan 21 19:01:42 2017(r312602) @@ -1575,12 +1575,12 @@ vn_closefile(fp, td) vp = fp->f_vnode; fp->f_ops = - if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) - vref(vp); + if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) + vrefact(vp); error = vn_close(vp, fp->f_flag, fp->f_cred, td); - if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) { + if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312601 - head/sys/kern
Author: mjg Date: Sat Jan 21 18:56:58 2017 New Revision: 312601 URL: https://svnweb.freebsd.org/changeset/base/312601 Log: vfs: fix whitespace damage in r312600 While here wrap the previously overly long line so that it fits 80 chars. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017(r312600) +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:56:58 2017(r312601) @@ -1547,8 +1547,8 @@ retry: error = VOP_LOCK1(vp, flags, file, line); flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", -flags, error)); + ("LK_RETRY set with incompatible flags (0x%x) or " + " an error occurred (%d)", flags, error)); if (flags & LK_RETRY) { if ((error != 0)) goto retry; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312600 - head/sys/kern
Author: mjg Date: Sat Jan 21 18:38:16 2017 New Revision: 312600 URL: https://svnweb.freebsd.org/changeset/base/312600 Log: vfs: refactor _vn_lock Stop testing for LK_RETRY and error multiple times. Also postpone the VI_DOOMED until after LK_RETRY was seen as it reads from the vnode. No functional changes. Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c == --- head/sys/kern/vfs_vnops.c Sat Jan 21 17:39:10 2017(r312599) +++ head/sys/kern/vfs_vnops.c Sat Jan 21 18:38:16 2017(r312600) @@ -1539,27 +1539,24 @@ _vn_lock(struct vnode *vp, int flags, ch VNASSERT((flags & LK_TYPE_MASK) != 0, vp, ("vn_lock called with no locktype.")); - do { #ifdef DEBUG_VFS_LOCKS - KASSERT(vp->v_holdcnt != 0, - ("vn_lock %p: zero hold count", vp)); + KASSERT(vp->v_holdcnt != 0, + ("vn_lock %p: zero hold count", vp)); #endif - error = VOP_LOCK1(vp, flags, file, line); - flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ - KASSERT((flags & LK_RETRY) == 0 || error == 0, - ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", - flags, error)); - /* -* Callers specify LK_RETRY if they wish to get dead vnodes. -* If RETRY is not set, we return ENOENT instead. -*/ - if (error == 0 && vp->v_iflag & VI_DOOMED && - (flags & LK_RETRY) == 0) { +retry: + error = VOP_LOCK1(vp, flags, file, line); + flags &= ~LK_INTERLOCK; /* Interlock is always dropped. */ + KASSERT((flags & LK_RETRY) == 0 || error == 0, + ("LK_RETRY set with incompatible flags (0x%x) or an error occurred (%d)", +flags, error)); + if (flags & LK_RETRY) { + if ((error != 0)) + goto retry; + if ((vp->v_iflag & VI_DOOMED)) { VOP_UNLOCK(vp, 0); error = ENOENT; - break; } - } while (flags & LK_RETRY && error != 0); + } return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r312588 - head/sys/mips/conf
On Sat, Jan 21, 2017 at 10:50:54AM -0700, Ian Lepore wrote: > On Sat, 2017-01-21 at 13:41 +0200, Konstantin Belousov wrote: > > On Sat, Jan 21, 2017 at 09:08:28AM +, Brooks Davis wrote: > > > > > > +optionsĀ TMPFS #Efficient memory > > > filesystem > > Is the word 'efficient' copied from somewhere ? Yes, I see it in > > sys/conf/NOTES. I do not see what useful meaning the word has there, > > applied to the tmpfs. In my opinion, it should be removed from > > comments. > > > > Is it not more efficient than the alternatives based on md(4)? If UFS on a swap-backed md(4) is configured without SU and with trim enabled, then it should be very similar to tmpfs. Even more similar if the UFS mount is sync. Except in the case when the files from such mount are mmaped, in which case UFS inherently performs double-copy. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r312588 - head/sys/mips/conf
On Sat, 2017-01-21 at 13:41 +0200, Konstantin Belousov wrote: > On Sat, Jan 21, 2017 at 09:08:28AM +, Brooks Davis wrote: > > > > +optionsĀ TMPFS #Efficient memory > > filesystem > Is the word 'efficient' copied from somewhere ? Yes, I see it in > sys/conf/NOTES. I do not see what useful meaning the word has there, > applied to the tmpfs. In my opinion, it should be removed from > comments. > Is it not more efficient than the alternatives based on md(4)? -- Ian ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312599 - head/sys/sys
Author: cem Date: Sat Jan 21 17:39:10 2017 New Revision: 312599 URL: https://svnweb.freebsd.org/changeset/base/312599 Log: Add remaining ELF compression definitions and structs A follow-up to r300231. Sponsored by: Dell EMC Isilon Modified: head/sys/sys/elf32.h head/sys/sys/elf64.h head/sys/sys/elf_common.h Modified: head/sys/sys/elf32.h == --- head/sys/sys/elf32.hSat Jan 21 16:59:50 2017(r312598) +++ head/sys/sys/elf32.hSat Jan 21 17:39:10 2017(r312599) @@ -254,4 +254,10 @@ typedef struct { Elf32_Half si_flags; /* per symbol flags */ } Elf32_Syminfo; +typedef struct { + Elf32_Word ch_type; + Elf32_Word ch_size; + Elf32_Word ch_addralign; +} Elf32_Chdr; + #endif /* !_SYS_ELF32_H_ */ Modified: head/sys/sys/elf64.h == --- head/sys/sys/elf64.hSat Jan 21 16:59:50 2017(r312598) +++ head/sys/sys/elf64.hSat Jan 21 17:39:10 2017(r312599) @@ -257,4 +257,11 @@ typedef struct { Elf64_Half si_flags; /* per symbol flags */ } Elf64_Syminfo; +typedef struct { + Elf64_Word ch_type; + Elf64_Word ch_reserved; + Elf64_Xword ch_size; + Elf64_Xword ch_addralign; +} Elf64_Chdr; + #endif /* !_SYS_ELF64_H_ */ Modified: head/sys/sys/elf_common.h == --- head/sys/sys/elf_common.h Sat Jan 21 16:59:50 2017(r312598) +++ head/sys/sys/elf_common.h Sat Jan 21 17:39:10 2017(r312599) @@ -849,6 +849,13 @@ typedef struct { #defineSYMINFO_CURRENT 1 #defineSYMINFO_NUM 2 +/* Values for ch_type (compressed section headers). */ +#defineELFCOMPRESS_ZLIB1 /* ZLIB/DEFLATE */ +#defineELFCOMPRESS_LOOS0x6000 /* OS-specific */ +#defineELFCOMPRESS_HIOS0x6fff +#defineELFCOMPRESS_LOPROC 0x7000 /* Processor-specific */ +#defineELFCOMPRESS_HIPROC 0x7fff + /* * Relocation types. * ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312598 - head/sys/kern
Author: mjg Date: Sat Jan 21 16:59:50 2017 New Revision: 312598 URL: https://svnweb.freebsd.org/changeset/base/312598 Log: vfs: hide the getvnode NULL mp message behind DIAGNOSTIC Since crossmp vnode changes the message was being printed on each boot. Reported by: trasz Discussed with: kib Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cSat Jan 21 15:03:58 2017(r312597) +++ head/sys/kern/vfs_subr.cSat Jan 21 16:59:50 2017(r312598) @@ -1489,12 +1489,14 @@ alloc: vp->v_op = vops; v_init_counters(vp); vp->v_bufobj.bo_ops = _ops_bio; +#ifdef DIAGNOSTIC + if (mp == NULL && vops != _vnodeops) + printf("NULL mp in getnewvnode()\n"); +#endif #ifdef MAC mac_vnode_init(vp); if (mp != NULL && (mp->mnt_flag & MNT_MULTILABEL) == 0) mac_vnode_associate_singlelabel(mp, vp); - else if (mp == NULL && vops != _vnodeops) - printf("NULL mp in getnewvnode()\n"); #endif if (mp != NULL) { vp->v_bufobj.bo_bsize = mp->mnt_stat.f_iosize; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312597 - in head/sys/dev/rtwn: . rtl8812a rtl8812a/usb rtl8821a/usb
Author: avos Date: Sat Jan 21 15:03:58 2017 New Revision: 312597 URL: https://svnweb.freebsd.org/changeset/base/312597 Log: rtwn: enable LDPC support where possible Tested with RTL8821AU, STA mode. Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/rtl8812a/r12a_rx.c head/sys/dev/rtwn/rtl8812a/r12a_tx.c head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Modified: head/sys/dev/rtwn/if_rtwn.c == --- head/sys/dev/rtwn/if_rtwn.c Sat Jan 21 14:19:06 2017(r312596) +++ head/sys/dev/rtwn/if_rtwn.c Sat Jan 21 15:03:58 2017(r312597) @@ -695,6 +695,7 @@ rtwn_ioctl_reset(struct ieee80211vap *va case IEEE80211_IOC_RTSTHRESHOLD: case IEEE80211_IOC_PROTMODE: case IEEE80211_IOC_HTPROTMODE: + case IEEE80211_IOC_LDPC: error = 0; break; default: Modified: head/sys/dev/rtwn/rtl8812a/r12a_rx.c == --- head/sys/dev/rtwn/rtl8812a/r12a_rx.cSat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8812a/r12a_rx.cSat Jan 21 15:03:58 2017 (r312597) @@ -252,7 +252,9 @@ r12a_get_rx_stats(struct rtwn_softc *sc, rxdw4 = le32toh(stat->rxdw4); rate = MS(rxdw3, R12A_RXDW3_RATE); - /* TODO: STBC, LDPC */ + /* TODO: STBC */ + if (rxdw4 & R12A_RXDW4_LDPC) + rxs->c_pktflags |= IEEE80211_RX_F_LDPC; if (rxdw1 & R12A_RXDW1_AMPDU) { if (rxdw0 & R92C_RXDW0_PHYST) rxs->c_pktflags |= IEEE80211_RX_F_AMPDU; Modified: head/sys/dev/rtwn/rtl8812a/r12a_tx.c == --- head/sys/dev/rtwn/rtl8812a/r12a_tx.cSat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8812a/r12a_tx.cSat Jan 21 15:03:58 2017 (r312597) @@ -214,6 +214,17 @@ r12a_tx_set_sgi(struct rtwn_softc *sc, v txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT); } +static void +r12a_tx_set_ldpc(struct rtwn_softc *sc, struct r12a_tx_desc *txd, +struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + + if ((vap->iv_flags_ht & IEEE80211_FHT_LDPC_TX) && + (ni->ni_htcap & IEEE80211_HTCAP_LDPC)) + txd->txdw5 |= htole32(R12A_TXDW5_DATA_LDPC); +} + void r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, int maxretry) @@ -284,6 +295,7 @@ r12a_fill_tx_desc(struct rtwn_softc *sc, if (ridx >= RTWN_RIDX_MCS(0)) { r12a_tx_set_ht40(sc, txd, ni); r12a_tx_set_sgi(sc, txd, ni); + r12a_tx_set_ldpc(sc, txd, ni); prot = ic->ic_htprotmode; } else if (ic->ic_flags & IEEE80211_F_USEPROT) prot = ic->ic_protmode; Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c == --- head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Sat Jan 21 14:19:06 2017(r312596) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Sat Jan 21 15:03:58 2017(r312597) @@ -168,7 +168,15 @@ r12a_read_chipid_vendor(struct rtwn_soft static void r12au_adj_devcaps(struct rtwn_softc *sc) { - /* TODO: LDPC, STBC etc */ + struct r12a_softc *rs = sc->sc_priv; + struct ieee80211com *ic = >sc_ic; + + if (rs->chip & R12A_CHIP_C_CUT) { + ic->ic_htcaps |= IEEE80211_HTCAP_LDPC | +IEEE80211_HTC_TXLDPC; + } + + /* TODO: STBC, VHT etc */ } void Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c == --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Sat Jan 21 14:19:06 2017(r312596) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Sat Jan 21 15:03:58 2017(r312597) @@ -157,10 +157,11 @@ r21au_adj_devcaps(struct rtwn_softc *sc) struct ieee80211com *ic = >sc_ic; struct r12a_softc *rs = sc->sc_priv; + ic->ic_htcaps |= IEEE80211_HTC_TXLDPC; if (rs->rs_radar != 0) ic->ic_caps |= IEEE80211_C_DFS; - /* TODO: LDPC etc */ + /* TODO: VHT */ } void ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312596 - in head: sbin/ifconfig sys/net80211
Author: avos Date: Sat Jan 21 14:19:06 2017 New Revision: 312596 URL: https://svnweb.freebsd.org/changeset/base/312596 Log: net80211: allow to configure LDPC support Tested with RTL8821AU, STA mode (Tx support only) Reviewed by: adrian Differential Revision:https://reviews.freebsd.org/D9268 Modified: head/sbin/ifconfig/ifieee80211.c head/sys/net80211/_ieee80211.h head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_var.h Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cSat Jan 21 13:25:57 2017 (r312595) +++ head/sbin/ifconfig/ifieee80211.cSat Jan 21 14:19:06 2017 (r312596) @@ -1787,6 +1787,21 @@ set80211stbc(const char *val, int d, int set80211(s, IEEE80211_IOC_STBC, stbc, 0, NULL); } +static void +set80211ldpc(const char *val, int d, int s, const struct afswtch *rafp) +{ +int ldpc; + +if (get80211val(s, IEEE80211_IOC_LDPC, ) < 0) +errx(-1, "cannot set LDPC setting"); +if (d < 0) { +d = -d; +ldpc &= ~d; +} else +ldpc |= d; +set80211(s, IEEE80211_IOC_LDPC, ldpc, 0, NULL); +} + static DECL_CMD_FUNC(set80211ampdulimit, val, d) { @@ -5030,6 +5045,23 @@ end: break; } } + if (get80211val(s, IEEE80211_IOC_LDPC, ) != -1) { + switch (val) { + case 0: + LINE_CHECK("-ldpc"); + break; + case 1: + LINE_CHECK("ldpctx -ldpcrx"); + break; + case 2: + LINE_CHECK("-ldpctx ldpcrx"); + break; + case 3: + if (verbose) + LINE_CHECK("ldpc"); + break; + } + } } if (IEEE80211_IS_CHAN_VHT(c) || verbose) { @@ -5603,6 +5635,12 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("-stbctx", -1, set80211stbc), DEF_CMD("stbc", 3, set80211stbc), /* NB: tx+rx */ DEF_CMD("-stbc",-3, set80211stbc), + DEF_CMD("ldpcrx", 2, set80211ldpc), + DEF_CMD("-ldpcrx", -2, set80211ldpc), + DEF_CMD("ldpctx", 1, set80211ldpc), + DEF_CMD("-ldpctx", -1, set80211ldpc), + DEF_CMD("ldpc", 3, set80211ldpc), /* NB: tx+rx */ + DEF_CMD("-ldpc",-3, set80211ldpc), DEF_CMD("puren",1, set80211puren), DEF_CMD("-puren", 0, set80211puren), DEF_CMD("doth", 1, set80211doth), Modified: head/sys/net80211/_ieee80211.h == --- head/sys/net80211/_ieee80211.h Sat Jan 21 13:25:57 2017 (r312595) +++ head/sys/net80211/_ieee80211.h Sat Jan 21 14:19:06 2017 (r312596) @@ -517,9 +517,10 @@ struct ieee80211_mimo_info { #defineIEEE80211_HTC_RXMCS32 0x0040 /* CAPABILITY: MCS32 support */ #defineIEEE80211_HTC_TXUNEQUAL 0x0080 /* CAPABILITY: TX unequal MCS */ #defineIEEE80211_HTC_TXMCS32 0x0100 /* CAPABILITY: MCS32 support */ +#defineIEEE80211_HTC_TXLDPC0x0200 /* CAPABILITY: TX using LDPC */ #defineIEEE80211_C_HTCAP_BITS \ "\20\1LDPC\2CHWIDTH40\5GREENFIELD\6SHORTGI20\7SHORTGI40\10TXSTBC" \ - "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS" + "\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS\32TXLDPC" #endif /* _NET80211__IEEE80211_H_ */ Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Sat Jan 21 13:25:57 2017 (r312595) +++ head/sys/net80211/ieee80211.h Sat Jan 21 14:19:06 2017 (r312596) @@ -617,7 +617,7 @@ struct ieee80211_ie_htcap { } __packed; /* HT capability flags (ht_cap) */ -#defineIEEE80211_HTCAP_LDPC0x0001 /* LDPC supported */ +#defineIEEE80211_HTCAP_LDPC0x0001 /* LDPC rx supported */ #defineIEEE80211_HTCAP_CHWIDTH40 0x0002 /* 20/40 supported */ #defineIEEE80211_HTCAP_SMPS0x000c /* SM Power Save mode */ #defineIEEE80211_HTCAP_SMPS_OFF0x000c /* disabled */ Modified: head/sys/net80211/ieee80211_ht.c == --- head/sys/net80211/ieee80211_ht.cSat
svn commit: r312595 - svnadmin/conf
Author: matthew (ports committer) Date: Sat Jan 21 13:25:57 2017 New Revision: 312595 URL: https://svnweb.freebsd.org/changeset/base/312595 Log: versus has given up his commit bit, so it makes no sense to have him under mentorship. Approved by: core (implicit) Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors == --- svnadmin/conf/mentors Sat Jan 21 13:17:53 2017(r312594) +++ svnadmin/conf/mentors Sat Jan 21 13:25:57 2017(r312595) @@ -40,4 +40,3 @@ steveksjg torek rpaulo tsoome allanjude Co-mentor: imp venkat delphij Co-mentor: luigi, jhb -versus gavin Co-mentor: fjoe ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312594 - svnadmin/conf
Author: matthew (ports committer) Date: Sat Jan 21 13:17:53 2017 New Revision: 312594 URL: https://svnweb.freebsd.org/changeset/base/312594 Log: Take in commit bits for the following nine people who have been inactive for more than 18 months and have agreed they are unlikely to begin contributing again in the near future. bschmidt Bernhard Schmidt dmarion Damjan Marion ghelmer Guy Helmer jfv Jack Vogel jh Jaakko Heinonen kensmith Ken Smith rmh Robert Millan trociny Mikolaj Golub versus Konrad Jankowski We wish them well in their future endeavors and hope to see them return to FreeBSD development in the future. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access == --- svnadmin/conf/accessSat Jan 21 13:17:25 2017(r312593) +++ svnadmin/conf/accessSat Jan 21 13:17:53 2017(r312594) @@ -49,7 +49,6 @@ br brooks brueffer bryanv -bschmidt bz cem charnier @@ -71,7 +70,6 @@ des dexuan dfr dim -dmarion dteske dumbbell dwmalone dwmalone=freebsd-committ...@maths.tcd.ie @@ -90,7 +88,6 @@ gad gallatin ganbold gavin -ghelmer gibbs gjb glebius @@ -114,8 +111,6 @@ jceel jch jchandra jeff -jfv -jh jhay jhb jhibbits @@ -139,7 +134,6 @@ kaiw kan karels ken -kensmith kevlo kib kp @@ -194,7 +188,6 @@ raj ray remko rmacklem -rmh rnoland roberto rodrigc @@ -232,7 +225,6 @@ thompsa tijl torek trasz -trociny truckman tsoome tuexen @@ -242,7 +234,6 @@ ups ups_...@stups.com uqs vangyzen venkat -versus whu will wkoszek ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312593 - in head: . contrib/mdocml usr.bin/mandoc
Author: bapt Date: Sat Jan 21 13:17:25 2017 New Revision: 312593 URL: https://svnweb.freebsd.org/changeset/base/312593 Log: Import mandoc cvs snapshot 20170121 (pre 1.14) Note that mandoc does not use anymore sqlite3 but a home made database format An important improvement has been made as well in makewhatis performance: Tests on my laptop shows makewhatis on the entire system goes from 26s to 12s Added: head/contrib/mdocml/dba.c - copied unchanged from r312592, vendor/mdocml/dist/dba.c head/contrib/mdocml/dba.h - copied unchanged from r312592, vendor/mdocml/dist/dba.h head/contrib/mdocml/dba_array.c - copied unchanged from r312592, vendor/mdocml/dist/dba_array.c head/contrib/mdocml/dba_array.h - copied unchanged from r312592, vendor/mdocml/dist/dba_array.h head/contrib/mdocml/dba_read.c - copied unchanged from r312592, vendor/mdocml/dist/dba_read.c head/contrib/mdocml/dba_write.c - copied unchanged from r312592, vendor/mdocml/dist/dba_write.c head/contrib/mdocml/dba_write.h - copied unchanged from r312592, vendor/mdocml/dist/dba_write.h head/contrib/mdocml/dbm.c - copied unchanged from r312592, vendor/mdocml/dist/dbm.c head/contrib/mdocml/dbm.h - copied unchanged from r312592, vendor/mdocml/dist/dbm.h head/contrib/mdocml/dbm_map.c - copied unchanged from r312592, vendor/mdocml/dist/dbm_map.c head/contrib/mdocml/dbm_map.h - copied unchanged from r312592, vendor/mdocml/dist/dbm_map.h head/contrib/mdocml/test-EFTYPE.c - copied unchanged from r312592, vendor/mdocml/dist/test-EFTYPE.c head/contrib/mdocml/test-PATH_MAX.c - copied unchanged from r312592, vendor/mdocml/dist/test-PATH_MAX.c head/contrib/mdocml/test-be32toh.c - copied unchanged from r312592, vendor/mdocml/dist/test-be32toh.c head/contrib/mdocml/test-nanosleep.c - copied unchanged from r312592, vendor/mdocml/dist/test-nanosleep.c head/contrib/mdocml/test-ntohl.c - copied unchanged from r312592, vendor/mdocml/dist/test-ntohl.c head/contrib/mdocml/test-sandbox_init.c - copied unchanged from r312592, vendor/mdocml/dist/test-sandbox_init.c Deleted: head/contrib/mdocml/compat_sqlite3_errstr.c head/contrib/mdocml/config.log head/contrib/mdocml/mansearch_const.c head/contrib/mdocml/test-mmap.c head/contrib/mdocml/test-sqlite3.c head/contrib/mdocml/test-sqlite3_errstr.c Modified: head/Makefile.inc1 head/contrib/mdocml/INSTALL head/contrib/mdocml/LICENSE head/contrib/mdocml/Makefile head/contrib/mdocml/Makefile.depend head/contrib/mdocml/TODO head/contrib/mdocml/cgi.c head/contrib/mdocml/compat_fts.c head/contrib/mdocml/compat_fts.h head/contrib/mdocml/config.h head/contrib/mdocml/configure head/contrib/mdocml/configure.local.example head/contrib/mdocml/demandoc.c head/contrib/mdocml/eqn_html.c head/contrib/mdocml/html.c head/contrib/mdocml/html.h head/contrib/mdocml/lib.in head/contrib/mdocml/libmandoc.h head/contrib/mdocml/main.c head/contrib/mdocml/main.h head/contrib/mdocml/makewhatis.8 head/contrib/mdocml/man.1 head/contrib/mdocml/man.c head/contrib/mdocml/man.conf.5 head/contrib/mdocml/man_hash.c head/contrib/mdocml/man_html.c head/contrib/mdocml/man_macro.c head/contrib/mdocml/man_term.c head/contrib/mdocml/mandoc.1 head/contrib/mdocml/mandoc.3 head/contrib/mdocml/mandoc.css head/contrib/mdocml/mandoc.db.5 head/contrib/mdocml/mandoc.h head/contrib/mdocml/mandoc_aux.h head/contrib/mdocml/mandoc_html.3 head/contrib/mdocml/mandocdb.c head/contrib/mdocml/manpath.c head/contrib/mdocml/mansearch.c head/contrib/mdocml/mansearch.h head/contrib/mdocml/mdoc.7 head/contrib/mdocml/mdoc.c head/contrib/mdocml/mdoc_argv.c head/contrib/mdocml/mdoc_hash.c head/contrib/mdocml/mdoc_html.c head/contrib/mdocml/mdoc_macro.c head/contrib/mdocml/mdoc_man.c head/contrib/mdocml/mdoc_state.c head/contrib/mdocml/mdoc_term.c head/contrib/mdocml/mdoc_validate.c head/contrib/mdocml/read.c head/contrib/mdocml/roff.c head/contrib/mdocml/roff.h head/contrib/mdocml/tag.c head/contrib/mdocml/tbl_html.c head/contrib/mdocml/term.c head/contrib/mdocml/term_ascii.c head/contrib/mdocml/term_ps.c head/contrib/mdocml/test-fts.c head/contrib/mdocml/test-ohash.c head/contrib/mdocml/test-vasprintf.c head/contrib/mdocml/test-wchar.c head/contrib/mdocml/tree.c head/usr.bin/mandoc/Makefile head/usr.bin/mandoc/Makefile.depend Directory Properties: head/contrib/mdocml/ (props changed) Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Sat Jan 21 13:02:53 2017(r312592) +++ head/Makefile.inc1 Sat Jan 21 13:17:25 2017(r312593) @@ -1694,11 +1694,10 @@ _kerberos5_bootstrap_tools= \ .endif # r283777 makewhatis(1) replaced with mandoc version which builds a database. -.if ${MK_MANDOCDB} != "no" && ${BOOTST
svn commit: r312592 - vendor/mdocml/20170121
Author: bapt Date: Sat Jan 21 13:02:53 2017 New Revision: 312592 URL: https://svnweb.freebsd.org/changeset/base/312592 Log: Tag import of mandoc cvs snapshot 20170121 Added: vendor/mdocml/20170121/ - copied from r312590, vendor/mdocml/dist/ vendor/mdocml/20170121/dba.c - copied unchanged from r312591, vendor/mdocml/dist/dba.c vendor/mdocml/20170121/dba.h - copied unchanged from r312591, vendor/mdocml/dist/dba.h vendor/mdocml/20170121/dba_array.c - copied unchanged from r312591, vendor/mdocml/dist/dba_array.c vendor/mdocml/20170121/dba_array.h - copied unchanged from r312591, vendor/mdocml/dist/dba_array.h vendor/mdocml/20170121/dba_read.c - copied unchanged from r312591, vendor/mdocml/dist/dba_read.c vendor/mdocml/20170121/dba_write.c - copied unchanged from r312591, vendor/mdocml/dist/dba_write.c vendor/mdocml/20170121/dba_write.h - copied unchanged from r312591, vendor/mdocml/dist/dba_write.h vendor/mdocml/20170121/dbm.c - copied unchanged from r312591, vendor/mdocml/dist/dbm.c vendor/mdocml/20170121/dbm.h - copied unchanged from r312591, vendor/mdocml/dist/dbm.h vendor/mdocml/20170121/dbm_map.c - copied unchanged from r312591, vendor/mdocml/dist/dbm_map.c vendor/mdocml/20170121/dbm_map.h - copied unchanged from r312591, vendor/mdocml/dist/dbm_map.h vendor/mdocml/20170121/test-EFTYPE.c - copied unchanged from r312591, vendor/mdocml/dist/test-EFTYPE.c vendor/mdocml/20170121/test-PATH_MAX.c - copied unchanged from r312591, vendor/mdocml/dist/test-PATH_MAX.c vendor/mdocml/20170121/test-be32toh.c - copied unchanged from r312591, vendor/mdocml/dist/test-be32toh.c vendor/mdocml/20170121/test-nanosleep.c - copied unchanged from r312591, vendor/mdocml/dist/test-nanosleep.c vendor/mdocml/20170121/test-ntohl.c - copied unchanged from r312591, vendor/mdocml/dist/test-ntohl.c vendor/mdocml/20170121/test-sandbox_init.c - copied unchanged from r312591, vendor/mdocml/dist/test-sandbox_init.c Replaced: vendor/mdocml/20170121/INSTALL - copied unchanged from r312591, vendor/mdocml/dist/INSTALL vendor/mdocml/20170121/LICENSE - copied unchanged from r312591, vendor/mdocml/dist/LICENSE vendor/mdocml/20170121/Makefile - copied unchanged from r312591, vendor/mdocml/dist/Makefile vendor/mdocml/20170121/Makefile.depend - copied unchanged from r312591, vendor/mdocml/dist/Makefile.depend vendor/mdocml/20170121/TODO - copied unchanged from r312591, vendor/mdocml/dist/TODO vendor/mdocml/20170121/cgi.c - copied unchanged from r312591, vendor/mdocml/dist/cgi.c vendor/mdocml/20170121/compat_fts.c - copied unchanged from r312591, vendor/mdocml/dist/compat_fts.c vendor/mdocml/20170121/compat_fts.h - copied unchanged from r312591, vendor/mdocml/dist/compat_fts.h vendor/mdocml/20170121/configure - copied unchanged from r312591, vendor/mdocml/dist/configure vendor/mdocml/20170121/configure.local.example - copied unchanged from r312591, vendor/mdocml/dist/configure.local.example vendor/mdocml/20170121/demandoc.c - copied unchanged from r312591, vendor/mdocml/dist/demandoc.c vendor/mdocml/20170121/eqn_html.c - copied unchanged from r312591, vendor/mdocml/dist/eqn_html.c vendor/mdocml/20170121/html.c - copied unchanged from r312591, vendor/mdocml/dist/html.c vendor/mdocml/20170121/html.h - copied unchanged from r312591, vendor/mdocml/dist/html.h vendor/mdocml/20170121/lib.in - copied unchanged from r312591, vendor/mdocml/dist/lib.in vendor/mdocml/20170121/libmandoc.h - copied unchanged from r312591, vendor/mdocml/dist/libmandoc.h vendor/mdocml/20170121/main.c - copied unchanged from r312591, vendor/mdocml/dist/main.c vendor/mdocml/20170121/main.h - copied unchanged from r312591, vendor/mdocml/dist/main.h vendor/mdocml/20170121/makewhatis.8 - copied unchanged from r312591, vendor/mdocml/dist/makewhatis.8 vendor/mdocml/20170121/man.1 - copied unchanged from r312591, vendor/mdocml/dist/man.1 vendor/mdocml/20170121/man.c - copied unchanged from r312591, vendor/mdocml/dist/man.c vendor/mdocml/20170121/man.conf.5 - copied unchanged from r312591, vendor/mdocml/dist/man.conf.5 vendor/mdocml/20170121/man_hash.c - copied unchanged from r312591, vendor/mdocml/dist/man_hash.c vendor/mdocml/20170121/man_html.c - copied unchanged from r312591, vendor/mdocml/dist/man_html.c vendor/mdocml/20170121/man_macro.c - copied unchanged from r312591, vendor/mdocml/dist/man_macro.c vendor/mdocml/20170121/man_term.c - copied unchanged from r312591, vendor/mdocml/dist/man_term.c vendor/mdocml/20170121/mandoc.1 - copied unchanged from r312591, vendor/mdocml/dist/mandoc.1 vendor/mdocml/20170121/mandoc.3 - copied unchanged from r312591, vendor/mdocml/dist/mandoc.3 vendor/mdocml/20170121/mandoc.css - copied unchanged from r312591, vendor/mdocml
svn commit: r312591 - vendor/mdocml/dist
Author: bapt Date: Sat Jan 21 13:01:39 2017 New Revision: 312591 URL: https://svnweb.freebsd.org/changeset/base/312591 Log: Import mandoc cvs snapshot 20170121 (pre 1.14) Added: vendor/mdocml/dist/dba.c (contents, props changed) vendor/mdocml/dist/dba.h (contents, props changed) vendor/mdocml/dist/dba_array.c (contents, props changed) vendor/mdocml/dist/dba_array.h (contents, props changed) vendor/mdocml/dist/dba_read.c (contents, props changed) vendor/mdocml/dist/dba_write.c (contents, props changed) vendor/mdocml/dist/dba_write.h (contents, props changed) vendor/mdocml/dist/dbm.c (contents, props changed) vendor/mdocml/dist/dbm.h (contents, props changed) vendor/mdocml/dist/dbm_map.c (contents, props changed) vendor/mdocml/dist/dbm_map.h (contents, props changed) vendor/mdocml/dist/test-EFTYPE.c (contents, props changed) vendor/mdocml/dist/test-PATH_MAX.c (contents, props changed) vendor/mdocml/dist/test-be32toh.c (contents, props changed) vendor/mdocml/dist/test-nanosleep.c (contents, props changed) vendor/mdocml/dist/test-ntohl.c (contents, props changed) vendor/mdocml/dist/test-sandbox_init.c (contents, props changed) Deleted: vendor/mdocml/dist/compat_sqlite3_errstr.c vendor/mdocml/dist/config.log vendor/mdocml/dist/mansearch_const.c vendor/mdocml/dist/test-mmap.c vendor/mdocml/dist/test-sqlite3.c vendor/mdocml/dist/test-sqlite3_errstr.c Modified: vendor/mdocml/dist/INSTALL vendor/mdocml/dist/LICENSE vendor/mdocml/dist/Makefile vendor/mdocml/dist/Makefile.depend vendor/mdocml/dist/TODO vendor/mdocml/dist/cgi.c vendor/mdocml/dist/compat_fts.c vendor/mdocml/dist/compat_fts.h vendor/mdocml/dist/configure vendor/mdocml/dist/configure.local.example vendor/mdocml/dist/demandoc.c vendor/mdocml/dist/eqn_html.c vendor/mdocml/dist/html.c vendor/mdocml/dist/html.h vendor/mdocml/dist/lib.in vendor/mdocml/dist/libmandoc.h vendor/mdocml/dist/main.c vendor/mdocml/dist/main.h vendor/mdocml/dist/makewhatis.8 vendor/mdocml/dist/man.1 vendor/mdocml/dist/man.c vendor/mdocml/dist/man.conf.5 vendor/mdocml/dist/man_hash.c vendor/mdocml/dist/man_html.c vendor/mdocml/dist/man_macro.c vendor/mdocml/dist/man_term.c vendor/mdocml/dist/mandoc.1 vendor/mdocml/dist/mandoc.3 vendor/mdocml/dist/mandoc.css vendor/mdocml/dist/mandoc.db.5 vendor/mdocml/dist/mandoc.h vendor/mdocml/dist/mandoc_aux.h vendor/mdocml/dist/mandoc_html.3 vendor/mdocml/dist/mandocdb.c vendor/mdocml/dist/manpath.c vendor/mdocml/dist/mansearch.c vendor/mdocml/dist/mansearch.h vendor/mdocml/dist/mdoc.7 vendor/mdocml/dist/mdoc.c vendor/mdocml/dist/mdoc_argv.c vendor/mdocml/dist/mdoc_hash.c vendor/mdocml/dist/mdoc_html.c vendor/mdocml/dist/mdoc_macro.c vendor/mdocml/dist/mdoc_man.c vendor/mdocml/dist/mdoc_state.c vendor/mdocml/dist/mdoc_term.c vendor/mdocml/dist/mdoc_validate.c vendor/mdocml/dist/read.c vendor/mdocml/dist/roff.c vendor/mdocml/dist/roff.h vendor/mdocml/dist/tag.c vendor/mdocml/dist/tbl_html.c vendor/mdocml/dist/term.c vendor/mdocml/dist/term_ascii.c vendor/mdocml/dist/term_ps.c vendor/mdocml/dist/test-fts.c vendor/mdocml/dist/test-ohash.c vendor/mdocml/dist/test-vasprintf.c vendor/mdocml/dist/test-wchar.c vendor/mdocml/dist/tree.c Modified: vendor/mdocml/dist/INSTALL == --- vendor/mdocml/dist/INSTALL Sat Jan 21 12:30:07 2017(r312590) +++ vendor/mdocml/dist/INSTALL Sat Jan 21 13:01:39 2017(r312591) @@ -1,4 +1,4 @@ -$Id: INSTALL,v 1.15 2016/07/14 11:09:06 schwarze Exp $ +$Id: INSTALL,v 1.17 2016/07/19 22:40:33 schwarze Exp $ About mdocml, the portable mandoc distribution -- @@ -35,7 +35,11 @@ To install mandoc manually, the followin command "echo BUILD_CGI=1 > configure.local". Then run "cp cgi.h.examples cgi.h" and edit cgi.h as desired. -2. Run "./configure". +2. Define MANPATH_DEFAULT in configure.local +if /usr/share/man:/usr/X11R6/man:/usr/local/man is not appropriate +for your operating system. + +3. Run "./configure". This script attempts autoconfiguration of mandoc for your system. Read both its standard output and the file "Makefile.local" it generates. If anything looks wrong or different from what you @@ -45,28 +49,21 @@ result seems right to you. On Solaris 10 and earlier, you may have to run "ksh ./configure" because the native /bin/sh lacks some POSIX features. -3. Run "make". +4. Run "make". Any POSIX-compatible make, in particular both BSD make and GNU make, should work. If the build fails, look at "configure.local.example" and go back to step 2. -4. Run "make -n install" and check whether everything will be +5. Run "make -n install" and check whether everyth
svn commit: r312590 - in stable/10/lib/libc: include stdlib
Author: kib Date: Sat Jan 21 12:30:07 2017 New Revision: 312590 URL: https://svnweb.freebsd.org/changeset/base/312590 Log: MFC r311651: Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. Added: stable/10/lib/libc/stdlib/cxa_thread_atexit_impl.c - copied unchanged from r311651, head/lib/libc/stdlib/cxa_thread_atexit_impl.c Modified: stable/10/lib/libc/include/libc_private.h stable/10/lib/libc/stdlib/Makefile.inc stable/10/lib/libc/stdlib/Symbol.map stable/10/lib/libc/stdlib/cxa_thread_atexit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/include/libc_private.h == --- stable/10/lib/libc/include/libc_private.h Sat Jan 21 11:47:30 2017 (r312589) +++ stable/10/lib/libc/include/libc_private.h Sat Jan 21 12:30:07 2017 (r312590) @@ -268,6 +268,8 @@ void _malloc_thread_cleanup(void); * thread is exiting, so its thread-local dtors should be called. */ void __cxa_thread_call_dtors(void); +int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj, +void *dso_symbol) __hidden; /* * These functions are used by the threading libraries in order to protect Modified: stable/10/lib/libc/stdlib/Makefile.inc == --- stable/10/lib/libc/stdlib/Makefile.inc Sat Jan 21 11:47:30 2017 (r312589) +++ stable/10/lib/libc/stdlib/Makefile.inc Sat Jan 21 12:30:07 2017 (r312590) @@ -5,7 +5,9 @@ .PATH: ${.CURDIR}/${LIBC_ARCH}/stdlib ${.CURDIR}/stdlib MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ - bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ + bsearch.c \ + cxa_thread_atexit.c cxa_thread_atexit_impl.c \ + div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c ptsname.c qsort.c qsort_r.c quick_exit.c radixsort.c rand.c \ Modified: stable/10/lib/libc/stdlib/Symbol.map == --- stable/10/lib/libc/stdlib/Symbol.mapSat Jan 21 11:47:30 2017 (r312589) +++ stable/10/lib/libc/stdlib/Symbol.mapSat Jan 21 12:30:07 2017 (r312590) @@ -106,6 +106,7 @@ FBSD_1.3 { FBSD_1.5 { __cxa_thread_atexit; + __cxa_thread_atexit_impl; }; FBSDprivate_1.0 { Modified: stable/10/lib/libc/stdlib/cxa_thread_atexit.c == --- stable/10/lib/libc/stdlib/cxa_thread_atexit.c Sat Jan 21 11:47:30 2017(r312589) +++ stable/10/lib/libc/stdlib/cxa_thread_atexit.c Sat Jan 21 12:30:07 2017(r312590) @@ -1,7 +1,10 @@ /*- - * Copyright (c) 2016 Mahdi Mokhtari+ * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,114 +30,11 @@ #include __FBSDID("$FreeBSD$"); -#include -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" #include "libc_private.h" -/* - * C++11 introduces the thread_local scope (like __thread with some - * additions). As a key-feature it should support non-trivial - * destructors, registered with __cxa_thread_atexit() to be executed - * at the thread termination. - * - * The implemention keeps a _Thread_local list of destructors per each - * thread, and calls __cxa_thread_call_dtors() on each thread's exit - * to do cleanup. For a thread calling exit(3), in particular, for - * the initial thread returning from main(), we call - * __cxa_thread_call_dtors() inside exit(). - * - * It could be possible that a dynamically loaded library, use - * thread_local variable but is dlclose()'d before thread exit. The - * destructor of this variable will then try to access the address, - * for calling it but it's unloaded, so it'll crash. We're using - * __elf_phdr_match_addr() to detect and prevent such cases and so - * prevent the crash. - */ - -#define CXA_DTORS_ITERATIONS 4 - -struct cxa_thread_dtor { - void *obj; - void (*func)(void *); - void *dso; - LIST_ENTRY(cxa_thread_dtor) entry; -}; -static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors = -LIST_HEAD_INITIALIZER(dtors); - int __cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol) { - struct cxa_thread_dtor *new_dtor; - - new_dtor = malloc(sizeof(*new_dtor)); - if (new_dtor == NULL) { - errno
svn commit: r312589 - in stable/11/lib/libc: include stdlib
Author: kib Date: Sat Jan 21 11:47:30 2017 New Revision: 312589 URL: https://svnweb.freebsd.org/changeset/base/312589 Log: MFC r311651: Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. Added: stable/11/lib/libc/stdlib/cxa_thread_atexit_impl.c - copied unchanged from r311651, head/lib/libc/stdlib/cxa_thread_atexit_impl.c Modified: stable/11/lib/libc/include/libc_private.h stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libc/stdlib/Symbol.map stable/11/lib/libc/stdlib/cxa_thread_atexit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/include/libc_private.h == --- stable/11/lib/libc/include/libc_private.h Sat Jan 21 09:08:27 2017 (r312588) +++ stable/11/lib/libc/include/libc_private.h Sat Jan 21 11:47:30 2017 (r312589) @@ -272,6 +272,8 @@ void _malloc_thread_cleanup(void); * thread is exiting, so its thread-local dtors should be called. */ void __cxa_thread_call_dtors(void); +int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj, +void *dso_symbol) __hidden; /* * These functions are used by the threading libraries in order to protect Modified: stable/11/lib/libc/stdlib/Makefile.inc == --- stable/11/lib/libc/stdlib/Makefile.inc Sat Jan 21 09:08:27 2017 (r312588) +++ stable/11/lib/libc/stdlib/Makefile.inc Sat Jan 21 11:47:30 2017 (r312589) @@ -5,7 +5,9 @@ .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ - bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ + bsearch.c \ + cxa_thread_atexit.c cxa_thread_atexit_impl.c \ + div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ hsearch_r.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ Modified: stable/11/lib/libc/stdlib/Symbol.map == --- stable/11/lib/libc/stdlib/Symbol.mapSat Jan 21 09:08:27 2017 (r312588) +++ stable/11/lib/libc/stdlib/Symbol.mapSat Jan 21 11:47:30 2017 (r312589) @@ -118,6 +118,7 @@ FBSD_1.4 { FBSD_1.5 { __cxa_thread_atexit; + __cxa_thread_atexit_impl; }; FBSDprivate_1.0 { Modified: stable/11/lib/libc/stdlib/cxa_thread_atexit.c == --- stable/11/lib/libc/stdlib/cxa_thread_atexit.c Sat Jan 21 09:08:27 2017(r312588) +++ stable/11/lib/libc/stdlib/cxa_thread_atexit.c Sat Jan 21 11:47:30 2017(r312589) @@ -1,7 +1,10 @@ /*- - * Copyright (c) 2016 Mahdi Mokhtari+ * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,114 +30,11 @@ #include __FBSDID("$FreeBSD$"); -#include -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" #include "libc_private.h" -/* - * C++11 introduces the thread_local scope (like __thread with some - * additions). As a key-feature it should support non-trivial - * destructors, registered with __cxa_thread_atexit() to be executed - * at the thread termination. - * - * The implemention keeps a _Thread_local list of destructors per each - * thread, and calls __cxa_thread_call_dtors() on each thread's exit - * to do cleanup. For a thread calling exit(3), in particular, for - * the initial thread returning from main(), we call - * __cxa_thread_call_dtors() inside exit(). - * - * It could be possible that a dynamically loaded library, use - * thread_local variable but is dlclose()'d before thread exit. The - * destructor of this variable will then try to access the address, - * for calling it but it's unloaded, so it'll crash. We're using - * __elf_phdr_match_addr() to detect and prevent such cases and so - * prevent the crash. - */ - -#define CXA_DTORS_ITERATIONS 4 - -struct cxa_thread_dtor { - void *obj; - void (*func)(void *); - void *dso; - LIST_ENTRY(cxa_thread_dtor) entry; -}; -static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors = -LIST_HEAD_INITIALIZER(dtors); - int __cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol) { - struct cxa_thread_dtor *new_dtor; - - new_dtor = malloc(sizeof(*new_dtor)); - if (new_dtor == NULL) { - errno =
Re: svn commit: r312588 - head/sys/mips/conf
On Sat, Jan 21, 2017 at 09:08:28AM +, Brooks Davis wrote: > +options TMPFS #Efficient memory filesystem Is the word 'efficient' copied from somewhere ? Yes, I see it in sys/conf/NOTES. I do not see what useful meaning the word has there, applied to the tmpfs. In my opinion, it should be removed from comments. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312588 - head/sys/mips/conf
Author: brooks Date: Sat Jan 21 09:08:27 2017 New Revision: 312588 URL: https://svnweb.freebsd.org/changeset/base/312588 Log: Enable TMPFS on MALTA so we can use it on minimalist disk images without modules. Sponsored by: DARPA, AFRL Modified: head/sys/mips/conf/std.MALTA Modified: head/sys/mips/conf/std.MALTA == --- head/sys/mips/conf/std.MALTASat Jan 21 08:43:41 2017 (r312587) +++ head/sys/mips/conf/std.MALTASat Jan 21 09:08:27 2017 (r312588) @@ -27,6 +27,8 @@ options NFS_ROOT#NFS usable as /, req optionsPSEUDOFS#Pseudo-filesystem framework options_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +optionsTMPFS #Efficient memory filesystem + optionsFFS #Berkeley Fast Filesystem optionsSOFTUPDATES #Enable FFS soft updates support optionsUFS_ACL #Support for access control lists ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312587 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:43:41 2017 New Revision: 312587 URL: https://svnweb.freebsd.org/changeset/base/312587 Log: MFC r311892: Do not wait for HA thread shutdown if scheduler is stopped. This wait loop made system hang on panic instead of reboot. Modified: stable/10/sys/cam/ctl/ctl_ha.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_ha.c == --- stable/10/sys/cam/ctl/ctl_ha.c Sat Jan 21 08:43:11 2017 (r312586) +++ stable/10/sys/cam/ctl/ctl_ha.c Sat Jan 21 08:43:41 2017 (r312587) @@ -1001,7 +1001,7 @@ ctl_ha_msg_shutdown(struct ctl_softc *ct softc->ha_shutdown = 1; softc->ha_wakeup = 1; wakeup(>ha_wakeup); - while (softc->ha_shutdown < 2) { + while (softc->ha_shutdown < 2 && !SCHEDULER_STOPPED()) { msleep(>ha_wakeup, >ha_lock, 0, "shutdown", hz); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312586 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:43:11 2017 New Revision: 312586 URL: https://svnweb.freebsd.org/changeset/base/312586 Log: MFC r311892: Do not wait for HA thread shutdown if scheduler is stopped. This wait loop made system hang on panic instead of reboot. Modified: stable/11/sys/cam/ctl/ctl_ha.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_ha.c == --- stable/11/sys/cam/ctl/ctl_ha.c Sat Jan 21 08:41:00 2017 (r312585) +++ stable/11/sys/cam/ctl/ctl_ha.c Sat Jan 21 08:43:11 2017 (r312586) @@ -1001,7 +1001,7 @@ ctl_ha_msg_shutdown(struct ctl_softc *ct softc->ha_shutdown = 1; softc->ha_wakeup = 1; wakeup(>ha_wakeup); - while (softc->ha_shutdown < 2) { + while (softc->ha_shutdown < 2 && !SCHEDULER_STOPPED()) { msleep(>ha_wakeup, >ha_lock, 0, "shutdown", hz); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312585 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:41:00 2017 New Revision: 312585 URL: https://svnweb.freebsd.org/changeset/base/312585 Log: MFC r310649: Allow more efficient use of private area. There are 16 bytes of space, so we may store two pointers in one. Modified: stable/10/sys/cam/ctl/ctl_io.h stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_io.h == --- stable/10/sys/cam/ctl/ctl_io.h Sat Jan 21 08:40:30 2017 (r312584) +++ stable/10/sys/cam/ctl/ctl_io.h Sat Jan 21 08:41:00 2017 (r312585) @@ -145,7 +145,9 @@ struct ctl_ptr_len_flags { union ctl_priv { uint8_t bytes[sizeof(uint64_t) * 2]; uint64_tinteger; + uint64_tintegers[2]; void*ptr; + void*ptrs[2]; }; /* Modified: stable/10/sys/cam/ctl/scsi_ctl.c == --- stable/10/sys/cam/ctl/scsi_ctl.cSat Jan 21 08:40:30 2017 (r312584) +++ stable/10/sys/cam/ctl/scsi_ctl.cSat Jan 21 08:41:00 2017 (r312585) @@ -185,6 +185,9 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CA /* This is only used in the CTIO */ #defineccb_atioppriv_ptr1 +#define PRIV_CCB(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0]) +#define PRIV_INFO(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1]) + intctlfeinitialize(void); void ctlfeshutdown(void); static periph_init_t ctlfeperiphinit; @@ -554,7 +557,7 @@ ctlferegister(struct cam_periph *periph, status = CAM_RESRC_UNAVAIL; break; } - new_io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_INFO(new_io) = cmd_info; softc->atios_alloced++; new_ccb->ccb_h.io_ptr = new_io; @@ -702,7 +705,7 @@ ctlfedata(struct ctlfe_lun_softc *softc, size_t off; int i, idx; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); bus_softc = softc->parent_softc; /* @@ -806,7 +809,7 @@ ctlfestart(struct cam_periph *periph, un flags = atio->ccb_h.flags & (CAM_DIS_DISCONNECT|CAM_TAG_ACTION_VALID|CAM_DIR_MASK); - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); cmd_info->cur_transfer_index = 0; cmd_info->cur_transfer_off = 0; cmd_info->flags = 0; @@ -987,7 +990,7 @@ ctlfe_free_ccb(struct cam_periph *periph switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: softc->atios_freed++; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); free(cmd_info, M_CTLFE); break; case XPT_IMMEDIATE_NOTIFY: @@ -1154,12 +1157,12 @@ ctlfedone(struct cam_periph *periph, uni */ mtx_unlock(mtx); io = done_ccb->ccb_h.io_ptr; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); ctl_zero_io(io); /* Save pointers on both sides */ - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = done_ccb; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_CCB(io) = done_ccb; + PRIV_INFO(io) = cmd_info; done_ccb->ccb_h.io_ptr = io; /* @@ -1315,7 +1318,7 @@ ctlfedone(struct cam_periph *periph, uni struct ccb_scsiio *csio; csio = _ccb->csio; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; @@ -1444,7 +1447,7 @@ ctlfedone(struct cam_periph *periph, uni send_ctl_io = 1; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb; + PRIV_CCB(io) = done_ccb; inot->ccb_h.io_ptr = io; io->io_hdr.nexus.initid = inot->initiator_id; io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; @@ -2001,7 +2004,7 @@ ctlfe_datamove(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + ccb = PRIV_CCB(io); periph = xpt_path_periph(ccb->ccb_h.path); cam_periph_lock(periph); softc = (struct ctlfe_lun_softc *)periph->softc; @@ -2021,7 +2024,7 @@ ctlfe_done(union ctl_io *io)
svn commit: r312584 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:40:30 2017 New Revision: 312584 URL: https://svnweb.freebsd.org/changeset/base/312584 Log: MFC r310649: Allow more efficient use of private area. There are 16 bytes of space, so we may store two pointers in one. Modified: stable/11/sys/cam/ctl/ctl_io.h stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl_io.h == --- stable/11/sys/cam/ctl/ctl_io.h Sat Jan 21 08:39:39 2017 (r312583) +++ stable/11/sys/cam/ctl/ctl_io.h Sat Jan 21 08:40:30 2017 (r312584) @@ -145,7 +145,9 @@ struct ctl_ptr_len_flags { union ctl_priv { uint8_t bytes[sizeof(uint64_t) * 2]; uint64_tinteger; + uint64_tintegers[2]; void*ptr; + void*ptrs[2]; }; /* Modified: stable/11/sys/cam/ctl/scsi_ctl.c == --- stable/11/sys/cam/ctl/scsi_ctl.cSat Jan 21 08:39:39 2017 (r312583) +++ stable/11/sys/cam/ctl/scsi_ctl.cSat Jan 21 08:40:30 2017 (r312584) @@ -185,6 +185,9 @@ MALLOC_DEFINE(M_CTLFE, "CAM CTL FE", "CA /* This is only used in the CTIO */ #defineccb_atioppriv_ptr1 +#define PRIV_CCB(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[0]) +#define PRIV_INFO(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptrs[1]) + intctlfeinitialize(void); void ctlfeshutdown(void); static periph_init_t ctlfeperiphinit; @@ -554,7 +557,7 @@ ctlferegister(struct cam_periph *periph, status = CAM_RESRC_UNAVAIL; break; } - new_io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_INFO(new_io) = cmd_info; softc->atios_alloced++; new_ccb->ccb_h.io_ptr = new_io; @@ -702,7 +705,7 @@ ctlfedata(struct ctlfe_lun_softc *softc, size_t off; int i, idx; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); bus_softc = softc->parent_softc; /* @@ -806,7 +809,7 @@ ctlfestart(struct cam_periph *periph, un flags = atio->ccb_h.flags & (CAM_DIS_DISCONNECT|CAM_TAG_ACTION_VALID|CAM_DIR_MASK); - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); cmd_info->cur_transfer_index = 0; cmd_info->cur_transfer_off = 0; cmd_info->flags = 0; @@ -987,7 +990,7 @@ ctlfe_free_ccb(struct cam_periph *periph switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: softc->atios_freed++; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); free(cmd_info, M_CTLFE); break; case XPT_IMMEDIATE_NOTIFY: @@ -1154,12 +1157,12 @@ ctlfedone(struct cam_periph *periph, uni */ mtx_unlock(mtx); io = done_ccb->ccb_h.io_ptr; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); ctl_zero_io(io); /* Save pointers on both sides */ - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = done_ccb; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr = cmd_info; + PRIV_CCB(io) = done_ccb; + PRIV_INFO(io) = cmd_info; done_ccb->ccb_h.io_ptr = io; /* @@ -1315,7 +1318,7 @@ ctlfedone(struct cam_periph *periph, uni struct ccb_scsiio *csio; csio = _ccb->csio; - cmd_info = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr; + cmd_info = PRIV_INFO(io); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; @@ -1444,7 +1447,7 @@ ctlfedone(struct cam_periph *periph, uni send_ctl_io = 1; io->io_hdr.io_type = CTL_IO_TASK; - io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr =done_ccb; + PRIV_CCB(io) = done_ccb; inot->ccb_h.io_ptr = io; io->io_hdr.nexus.initid = inot->initiator_id; io->io_hdr.nexus.targ_port = bus_softc->port.targ_port; @@ -2002,7 +2005,7 @@ ctlfe_datamove(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); - ccb = io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr; + ccb = PRIV_CCB(io); periph = xpt_path_periph(ccb->ccb_h.path); cam_periph_lock(periph); softc = (struct ctlfe_lun_softc *)periph->softc; @@ -2022,7 +2025,7 @@ ctlfe_done(union ctl_io *io)
svn commit: r312583 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:39:39 2017 New Revision: 312583 URL: https://svnweb.freebsd.org/changeset/base/312583 Log: MFC r310646: Do not update "saved" mode page on every MODE SELECT. We do not have non-volatile memory to really save those values, so we neither report nor support this capability. Also saved mode pages are not replicated between HA peers now. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:39:01 2017(r312582) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:39:39 2017(r312583) @@ -5824,7 +5824,7 @@ ctl_default_page_handler(struct ctl_scsi struct ctl_page_index *page_index, uint8_t *page_ptr) { struct ctl_lun *lun; - uint8_t *current_cp, *saved_cp; + uint8_t *current_cp; int set_ua; uint32_t initidx; @@ -5834,13 +5834,10 @@ ctl_default_page_handler(struct ctl_scsi current_cp = (page_index->page_data + (page_index->page_len * CTL_PAGE_CURRENT)); - saved_cp = (page_index->page_data + (page_index->page_len * - CTL_PAGE_SAVED)); mtx_lock(>lun_lock); if (memcmp(current_cp, page_ptr, page_index->page_len)) { memcpy(current_cp, page_ptr, page_index->page_len); - memcpy(saved_cp, page_ptr, page_index->page_len); set_ua = 1; } if (set_ua != 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312582 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:39:01 2017 New Revision: 312582 URL: https://svnweb.freebsd.org/changeset/base/312582 Log: MFC r310646: Do not update "saved" mode page on every MODE SELECT. We do not have non-volatile memory to really save those values, so we neither report nor support this capability. Also saved mode pages are not replicated between HA peers now. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:37:53 2017(r312581) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:39:01 2017(r312582) @@ -5833,7 +5833,7 @@ ctl_default_page_handler(struct ctl_scsi struct ctl_page_index *page_index, uint8_t *page_ptr) { struct ctl_lun *lun; - uint8_t *current_cp, *saved_cp; + uint8_t *current_cp; int set_ua; uint32_t initidx; @@ -5843,13 +5843,10 @@ ctl_default_page_handler(struct ctl_scsi current_cp = (page_index->page_data + (page_index->page_len * CTL_PAGE_CURRENT)); - saved_cp = (page_index->page_data + (page_index->page_len * - CTL_PAGE_SAVED)); mtx_lock(>lun_lock); if (memcmp(current_cp, page_ptr, page_index->page_len)) { memcpy(current_cp, page_ptr, page_index->page_len); - memcpy(saved_cp, page_ptr, page_index->page_len); set_ua = 1; } if (set_ua != 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312581 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:37:53 2017 New Revision: 312581 URL: https://svnweb.freebsd.org/changeset/base/312581 Log: MFC r310644: Fix/synchronize field types in struct ctl_modepage_header. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:36:59 2017(r312580) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:37:53 2017(r312581) @@ -5930,7 +5930,7 @@ ctl_do_mode_select(union ctl_io *io) int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; struct ctl_lun *lun; - int *len_left, *len_used; + uint16_t *len_left, *len_used; int retval, i; ctsio = >scsiio; Modified: stable/10/sys/cam/ctl/ctl.h == --- stable/10/sys/cam/ctl/ctl.h Sat Jan 21 08:36:59 2017(r312580) +++ stable/10/sys/cam/ctl/ctl.h Sat Jan 21 08:37:53 2017(r312581) @@ -74,8 +74,8 @@ struct ctl_port_entry { struct ctl_modepage_header { uint8_t page_code; uint8_t subpage; - int32_t len_used; - int32_t len_left; + uint16_t len_used; + uint16_t len_left; }; union ctl_modepage_info { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312580 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:36:59 2017 New Revision: 312580 URL: https://svnweb.freebsd.org/changeset/base/312580 Log: MFC r310644: Fix/synchronize field types in struct ctl_modepage_header. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:36:05 2017(r312579) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:36:59 2017(r312580) @@ -5939,7 +5939,7 @@ ctl_do_mode_select(union ctl_io *io) int page_len, page_len_offset, page_len_size; union ctl_modepage_info *modepage_info; struct ctl_lun *lun; - int *len_left, *len_used; + uint16_t *len_left, *len_used; int retval, i; ctsio = >scsiio; Modified: stable/11/sys/cam/ctl/ctl.h == --- stable/11/sys/cam/ctl/ctl.h Sat Jan 21 08:36:05 2017(r312579) +++ stable/11/sys/cam/ctl/ctl.h Sat Jan 21 08:36:59 2017(r312580) @@ -74,8 +74,8 @@ struct ctl_port_entry { struct ctl_modepage_header { uint8_t page_code; uint8_t subpage; - int32_t len_used; - int32_t len_left; + uint16_t len_used; + uint16_t len_left; }; union ctl_modepage_info { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312579 - in stable/10/sys/cam: ctl scsi
Author: mav Date: Sat Jan 21 08:36:05 2017 New Revision: 312579 URL: https://svnweb.freebsd.org/changeset/base/312579 Log: MFC r310640, r310643: Add support for revert to defaults (RTD) bit in MODE SELECT. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl.h stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/scsi/scsi_all.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:35:28 2017(r312578) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:36:05 2017(r312579) @@ -6149,10 +6149,13 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - int param_len, pf, sp; - int header_size, bd_len; + struct ctl_lun *lun; union ctl_modepage_info *modepage_info; + int bd_len, i, header_size, param_len, pf, rtd, sp; + uint32_t initidx; + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + initidx = ctl_get_initindex(>io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { struct scsi_mode_select_6 *cdb; @@ -6160,6 +6163,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_6 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = cdb->length; header_size = sizeof(struct scsi_mode_header_6); @@ -6171,6 +6175,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_10 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = scsi_2btoul(cdb->length); header_size = sizeof(struct scsi_mode_header_10); @@ -6182,6 +6187,30 @@ ctl_mode_select(struct ctl_scsiio *ctsio return (CTL_RETVAL_COMPLETE); } + if (rtd) { + if (param_len != 0) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, + /*command*/ 1, /*field*/ 0, + /*bit_valid*/ 0, /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* Revert to defaults. */ + ctl_init_page_index(lun); + mtx_lock(>lun_lock); + ctl_est_ua_all(lun, initidx, CTL_UA_MODE_CHANGE); + mtx_unlock(>lun_lock); + for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { + ctl_isc_announce_mode(lun, -1, + lun->mode_pages.index[i].page_code & SMPH_PC_MASK, + lun->mode_pages.index[i].subpage); + } + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + /* * From SPC-3: * "A parameter list length of zero indicates that the Data-Out Buffer @@ -9554,6 +9583,11 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * eid_ptr->flags4 = SVPD_EID_LUICLR; /* +* We support revert to defaults (RTD) bit in MODE SELECT. +*/ + eid_ptr->flags5 = SVPD_EID_RTD_SUP; + + /* * XXX KDM in order to correctly answer this, we would need * information from the SIM to determine how much sense data it * can send. So this would really be a path inquiry field, most Modified: stable/10/sys/cam/ctl/ctl.h == --- stable/10/sys/cam/ctl/ctl.h Sat Jan 21 08:35:28 2017(r312578) +++ stable/10/sys/cam/ctl/ctl.h Sat Jan 21 08:36:05 2017(r312579) @@ -78,14 +78,8 @@ struct ctl_modepage_header { int32_t len_left; }; -struct ctl_modepage_aps { - struct ctl_modepage_header header; - uint8_t lock_active; -}; - union ctl_modepage_info { struct ctl_modepage_header header; - struct ctl_modepage_aps aps; }; /* Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c == --- stable/10/sys/cam/ctl/ctl_cmd_table.c Sat Jan 21 08:35:28 2017 (r312578) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Sat Jan 21 08:36:05 2017 (r312579) @@ -990,7 +990,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, + CTL_LUN_PAT_NONE, 6, {0x13, 0, 0, 0xff, 0x07}}, /* 16 RESERVE(6) */
svn commit: r312578 - in stable/11/sys/cam: ctl scsi
Author: mav Date: Sat Jan 21 08:35:28 2017 New Revision: 312578 URL: https://svnweb.freebsd.org/changeset/base/312578 Log: MFC r310640, r310643: Add support for revert to defaults (RTD) bit in MODE SELECT. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl.h stable/11/sys/cam/ctl/ctl_cmd_table.c stable/11/sys/cam/scsi/scsi_all.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:34:27 2017(r312577) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:35:28 2017(r312578) @@ -6158,10 +6158,13 @@ bailout_no_done: int ctl_mode_select(struct ctl_scsiio *ctsio) { - int param_len, pf, sp; - int header_size, bd_len; + struct ctl_lun *lun; union ctl_modepage_info *modepage_info; + int bd_len, i, header_size, param_len, pf, rtd, sp; + uint32_t initidx; + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + initidx = ctl_get_initindex(>io_hdr.nexus); switch (ctsio->cdb[0]) { case MODE_SELECT_6: { struct scsi_mode_select_6 *cdb; @@ -6169,6 +6172,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_6 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = cdb->length; header_size = sizeof(struct scsi_mode_header_6); @@ -6180,6 +6184,7 @@ ctl_mode_select(struct ctl_scsiio *ctsio cdb = (struct scsi_mode_select_10 *)ctsio->cdb; pf = (cdb->byte2 & SMS_PF) ? 1 : 0; + rtd = (cdb->byte2 & SMS_RTD) ? 1 : 0; sp = (cdb->byte2 & SMS_SP) ? 1 : 0; param_len = scsi_2btoul(cdb->length); header_size = sizeof(struct scsi_mode_header_10); @@ -6191,6 +6196,30 @@ ctl_mode_select(struct ctl_scsiio *ctsio return (CTL_RETVAL_COMPLETE); } + if (rtd) { + if (param_len != 0) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 0, + /*command*/ 1, /*field*/ 0, + /*bit_valid*/ 0, /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + /* Revert to defaults. */ + ctl_init_page_index(lun); + mtx_lock(>lun_lock); + ctl_est_ua_all(lun, initidx, CTL_UA_MODE_CHANGE); + mtx_unlock(>lun_lock); + for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { + ctl_isc_announce_mode(lun, -1, + lun->mode_pages.index[i].page_code & SMPH_PC_MASK, + lun->mode_pages.index[i].subpage); + } + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + /* * From SPC-3: * "A parameter list length of zero indicates that the Data-Out Buffer @@ -9563,6 +9592,11 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * eid_ptr->flags4 = SVPD_EID_LUICLR; /* +* We support revert to defaults (RTD) bit in MODE SELECT. +*/ + eid_ptr->flags5 = SVPD_EID_RTD_SUP; + + /* * XXX KDM in order to correctly answer this, we would need * information from the SIM to determine how much sense data it * can send. So this would really be a path inquiry field, most Modified: stable/11/sys/cam/ctl/ctl.h == --- stable/11/sys/cam/ctl/ctl.h Sat Jan 21 08:34:27 2017(r312577) +++ stable/11/sys/cam/ctl/ctl.h Sat Jan 21 08:35:28 2017(r312578) @@ -78,14 +78,8 @@ struct ctl_modepage_header { int32_t len_left; }; -struct ctl_modepage_aps { - struct ctl_modepage_header header; - uint8_t lock_active; -}; - union ctl_modepage_info { struct ctl_modepage_header header; - struct ctl_modepage_aps aps; }; /* Modified: stable/11/sys/cam/ctl/ctl_cmd_table.c == --- stable/11/sys/cam/ctl/ctl_cmd_table.c Sat Jan 21 08:34:27 2017 (r312577) +++ stable/11/sys/cam/ctl/ctl_cmd_table.c Sat Jan 21 08:35:28 2017 (r312578) @@ -990,7 +990,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT, - CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, + CTL_LUN_PAT_NONE, 6, {0x13, 0, 0, 0xff, 0x07}}, /* 16 RESERVE(6) */
svn commit: r312577 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:34:27 2017 New Revision: 312577 URL: https://svnweb.freebsd.org/changeset/base/312577 Log: MFC r310635: Decouple limits on number of LUNs per port and LUs per CTL. Those two values are not directly related, so make them independent. This does not change any limits immediately, but makes number of LUNs per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size. After this change increasing CTL_MAX_LUNS should be pretty cheap, and even making it tunable should be easy. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend.h stable/10/sys/cam/ctl/ctl_io.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:33:44 2017(r312576) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:34:27 2017(r312577) @@ -409,6 +409,9 @@ static int ctl_debug = CTL_DEBUG_NONE; TUNABLE_INT("kern.cam.ctl.debug", _debug); SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, _debug, 0, "Enabled debug flags"); +static int ctl_lun_map_size = 1024; +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, +_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)"); /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), @@ -828,7 +831,7 @@ ctl_isc_announce_port(struct ctl_port *p return; i = sizeof(msg->port) + strlen(port->port_name) + 1; if (port->lun_map) - i += sizeof(uint32_t) * CTL_MAX_LUNS; + i += port->lun_map_size * sizeof(uint32_t); if (port->port_devid) i += port->port_devid->len; if (port->target_devid) @@ -848,7 +851,7 @@ ctl_isc_announce_port(struct ctl_port *p "%d:%s", softc->ha_id, port->port_name) + 1; i += msg->port.name_len; if (port->lun_map) { - msg->port.lun_map_len = sizeof(uint32_t) * CTL_MAX_LUNS; + msg->port.lun_map_len = port->lun_map_size * sizeof(uint32_t); memcpy(>port.data[i], port->lun_map, msg->port.lun_map_len); i += msg->port.lun_map_len; @@ -1157,19 +1160,25 @@ ctl_isc_port_sync(struct ctl_softc *soft M_CTL); i += msg->port.name_len; if (msg->port.lun_map_len != 0) { - if (port->lun_map == NULL) - port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS, + if (port->lun_map == NULL || + port->lun_map_size * sizeof(uint32_t) < + msg->port.lun_map_len) { + port->lun_map_size = 0; + free(port->lun_map, M_CTL); + port->lun_map = malloc(msg->port.lun_map_len, M_CTL, M_WAITOK); - memcpy(port->lun_map, >port.data[i], - sizeof(uint32_t) * CTL_MAX_LUNS); + } + memcpy(port->lun_map, >port.data[i], msg->port.lun_map_len); + port->lun_map_size = msg->port.lun_map_len / sizeof(uint32_t); i += msg->port.lun_map_len; } else { + port->lun_map_size = 0; free(port->lun_map, M_CTL); port->lun_map = NULL; } if (msg->port.port_devid_len != 0) { if (port->port_devid == NULL || - port->port_devid->len != msg->port.port_devid_len) { + port->port_devid->len < msg->port.port_devid_len) { free(port->port_devid, M_CTL); port->port_devid = malloc(sizeof(struct ctl_devid) + msg->port.port_devid_len, M_CTL, M_WAITOK); @@ -1184,7 +1193,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.target_devid_len != 0) { if (port->target_devid == NULL || - port->target_devid->len != msg->port.target_devid_len) { + port->target_devid->len < msg->port.target_devid_len) { free(port->target_devid, M_CTL); port->target_devid = malloc(sizeof(struct ctl_devid) + msg->port.target_devid_len, M_CTL, M_WAITOK); @@ -1199,7 +1208,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.init_devid_len != 0) { if (port->init_devid == NULL || - port->init_devid->len != msg->port.init_devid_len) { + port->init_devid->len < msg->port.init_devid_len) { free(port->init_devid, M_CTL); port->init_devid = malloc(sizeof(struct ctl_devid) + msg->port.init_devid_len, M_CTL, M_WAITOK); @@ -3286,7 +3295,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd,
svn commit: r312576 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:33:44 2017 New Revision: 312576 URL: https://svnweb.freebsd.org/changeset/base/312576 Log: MFC r310635: Decouple limits on number of LUNs per port and LUs per CTL. Those two values are not directly related, so make them independent. This does not change any limits immediately, but makes number of LUNs per port controllable via tunable/sysctl kern.cam.ctl.lun_map_size. After this change increasing CTL_MAX_LUNS should be pretty cheap, and even making it tunable should be easy. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_frontend.c stable/11/sys/cam/ctl/ctl_frontend.h stable/11/sys/cam/ctl/ctl_io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:32:56 2017(r312575) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:33:44 2017(r312576) @@ -407,6 +407,9 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, work static int ctl_debug = CTL_DEBUG_NONE; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, _debug, 0, "Enabled debug flags"); +static int ctl_lun_map_size = 1024; +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, +_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)"); /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), @@ -826,7 +829,7 @@ ctl_isc_announce_port(struct ctl_port *p return; i = sizeof(msg->port) + strlen(port->port_name) + 1; if (port->lun_map) - i += sizeof(uint32_t) * CTL_MAX_LUNS; + i += port->lun_map_size * sizeof(uint32_t); if (port->port_devid) i += port->port_devid->len; if (port->target_devid) @@ -846,7 +849,7 @@ ctl_isc_announce_port(struct ctl_port *p "%d:%s", softc->ha_id, port->port_name) + 1; i += msg->port.name_len; if (port->lun_map) { - msg->port.lun_map_len = sizeof(uint32_t) * CTL_MAX_LUNS; + msg->port.lun_map_len = port->lun_map_size * sizeof(uint32_t); memcpy(>port.data[i], port->lun_map, msg->port.lun_map_len); i += msg->port.lun_map_len; @@ -1155,19 +1158,25 @@ ctl_isc_port_sync(struct ctl_softc *soft M_CTL); i += msg->port.name_len; if (msg->port.lun_map_len != 0) { - if (port->lun_map == NULL) - port->lun_map = malloc(sizeof(uint32_t) * CTL_MAX_LUNS, + if (port->lun_map == NULL || + port->lun_map_size * sizeof(uint32_t) < + msg->port.lun_map_len) { + port->lun_map_size = 0; + free(port->lun_map, M_CTL); + port->lun_map = malloc(msg->port.lun_map_len, M_CTL, M_WAITOK); - memcpy(port->lun_map, >port.data[i], - sizeof(uint32_t) * CTL_MAX_LUNS); + } + memcpy(port->lun_map, >port.data[i], msg->port.lun_map_len); + port->lun_map_size = msg->port.lun_map_len / sizeof(uint32_t); i += msg->port.lun_map_len; } else { + port->lun_map_size = 0; free(port->lun_map, M_CTL); port->lun_map = NULL; } if (msg->port.port_devid_len != 0) { if (port->port_devid == NULL || - port->port_devid->len != msg->port.port_devid_len) { + port->port_devid->len < msg->port.port_devid_len) { free(port->port_devid, M_CTL); port->port_devid = malloc(sizeof(struct ctl_devid) + msg->port.port_devid_len, M_CTL, M_WAITOK); @@ -1182,7 +1191,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.target_devid_len != 0) { if (port->target_devid == NULL || - port->target_devid->len != msg->port.target_devid_len) { + port->target_devid->len < msg->port.target_devid_len) { free(port->target_devid, M_CTL); port->target_devid = malloc(sizeof(struct ctl_devid) + msg->port.target_devid_len, M_CTL, M_WAITOK); @@ -1197,7 +1206,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } if (msg->port.init_devid_len != 0) { if (port->init_devid == NULL || - port->init_devid->len != msg->port.init_devid_len) { + port->init_devid->len < msg->port.init_devid_len) { free(port->init_devid, M_CTL); port->init_devid = malloc(sizeof(struct ctl_devid) + msg->port.init_devid_len, M_CTL, M_WAITOK); @@ -3295,7 +3304,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd,
svn commit: r312575 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:32:56 2017 New Revision: 312575 URL: https://svnweb.freebsd.org/changeset/base/312575 Log: MFC r310575: Fix improperly used nexus.targ_lun. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:32:27 2017(r312574) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:32:56 2017(r312575) @@ -1026,7 +1026,7 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(>hdr.nexus); mtx_lock(>ctl_lock); - if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + if (msg->hdr.nexus.targ_mapped_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(>ctl_lock); return; @@ -1076,7 +1076,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc memcmp(>lun.data[0], lun->lun_devid->data, i) != 0)) { mtx_unlock(>lun_lock); printf("%s: Received conflicting HA LUN %d\n", - __func__, msg->hdr.nexus.targ_lun); + __func__, targ_lun); return; } else { /* Record whether peer is primary. */ @@ -1110,7 +1110,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc mtx_unlock(>lun_lock); CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", - __func__, msg->hdr.nexus.targ_lun, + __func__, targ_lun, (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? "primary" : "secondary")); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312574 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:32:27 2017 New Revision: 312574 URL: https://svnweb.freebsd.org/changeset/base/312574 Log: MFC r310575: Fix improperly used nexus.targ_lun. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:31:49 2017(r312573) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:32:27 2017(r312574) @@ -1024,7 +1024,7 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(>hdr.nexus); mtx_lock(>ctl_lock); - if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + if (msg->hdr.nexus.targ_mapped_lun >= CTL_MAX_LUNS || (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(>ctl_lock); return; @@ -1074,7 +1074,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc memcmp(>lun.data[0], lun->lun_devid->data, i) != 0)) { mtx_unlock(>lun_lock); printf("%s: Received conflicting HA LUN %d\n", - __func__, msg->hdr.nexus.targ_lun); + __func__, targ_lun); return; } else { /* Record whether peer is primary. */ @@ -1108,7 +1108,7 @@ ctl_isc_lun_sync(struct ctl_softc *softc mtx_unlock(>lun_lock); CTL_DEBUG_PRINT(("%s: Known LUN %d, peer is %s\n", - __func__, msg->hdr.nexus.targ_lun, + __func__, targ_lun, (msg->lun.flags & CTL_LUN_PRIMARY_SC) ? "primary" : "secondary")); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312572 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:31:20 2017 New Revision: 312572 URL: https://svnweb.freebsd.org/changeset/base/312572 Log: MFC r310555: Some random code cleaning. - Reduce indentation. - Remove extra braces. - Add few missing savety checks. Modified: stable/11/sys/cam/ctl/ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:30:10 2017(r312571) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:31:20 2017(r312572) @@ -424,7 +424,7 @@ static int ctl_init(void); void ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); -static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries); @@ -1024,27 +1024,27 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(>hdr.nexus); mtx_lock(>ctl_lock); - if (msg->hdr.nexus.targ_lun < CTL_MAX_LUNS && - (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) != NULL) { - mtx_lock(>lun_lock); - mtx_unlock(>ctl_lock); - if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && - msg->ua.ua_set) - memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); - if (msg->ua.ua_all) { - if (msg->ua.ua_set) - ctl_est_ua_all(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua_all(lun, iid, msg->ua.ua_type); - } else { - if (msg->ua.ua_set) - ctl_est_ua(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua(lun, iid, msg->ua.ua_type); - } - mtx_unlock(>lun_lock); - } else + if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(>ctl_lock); + return; + } + mtx_lock(>lun_lock); + mtx_unlock(>ctl_lock); + if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && msg->ua.ua_set) + memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); + if (msg->ua.ua_all) { + if (msg->ua.ua_set) + ctl_est_ua_all(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua_all(lun, iid, msg->ua.ua_type); + } else { + if (msg->ua.ua_set) + ctl_est_ua(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua(lun, iid, msg->ua.ua_type); + } + mtx_unlock(>lun_lock); } static void @@ -1058,8 +1058,8 @@ ctl_isc_lun_sync(struct ctl_softc *softc targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(>ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(>ctl_lock); return; } @@ -1289,8 +1289,8 @@ ctl_isc_mode_sync(struct ctl_softc *soft targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(>ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(>ctl_lock); return; } @@ -2193,7 +2193,7 @@ ctl_create_iid(struct ctl_port *port, in * command on this side (XFER mode) or tell the other side to execute it * (SER_ONLY mode). */ -static int +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { struct ctl_softc *softc = control_softc; @@ -2201,7 +2201,6 @@ ctl_serialize_other_sc_cmd(struct ctl_sc struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; - int retval = 0; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -2216,24 +2215,10 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ - if ((targ_lun < CTL_MAX_LUNS) && - ((lun = softc->ctl_luns[targ_lun]) != NULL)) { - mtx_lock(>lun_lock); - mtx_unlock(>ctl_lock); - /* -* If the LUN is invalid, pretend that it doesn't exist. -* It will go away
svn commit: r312573 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:31:49 2017 New Revision: 312573 URL: https://svnweb.freebsd.org/changeset/base/312573 Log: MFC r310555: Some random code cleaning. - Reduce indentation. - Remove extra braces. - Add few missing savety checks. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:31:20 2017(r312572) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:31:49 2017(r312573) @@ -426,7 +426,7 @@ static int ctl_init(void); void ctl_shutdown(void); static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td); static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td); -static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio); static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries); @@ -1026,27 +1026,27 @@ ctl_isc_ua(struct ctl_softc *softc, unio uint32_t iid = ctl_get_initindex(>hdr.nexus); mtx_lock(>ctl_lock); - if (msg->hdr.nexus.targ_lun < CTL_MAX_LUNS && - (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) != NULL) { - mtx_lock(>lun_lock); - mtx_unlock(>ctl_lock); - if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && - msg->ua.ua_set) - memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); - if (msg->ua.ua_all) { - if (msg->ua.ua_set) - ctl_est_ua_all(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua_all(lun, iid, msg->ua.ua_type); - } else { - if (msg->ua.ua_set) - ctl_est_ua(lun, iid, msg->ua.ua_type); - else - ctl_clr_ua(lun, iid, msg->ua.ua_type); - } - mtx_unlock(>lun_lock); - } else + if (msg->hdr.nexus.targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[msg->hdr.nexus.targ_mapped_lun]) == NULL) { mtx_unlock(>ctl_lock); + return; + } + mtx_lock(>lun_lock); + mtx_unlock(>ctl_lock); + if (msg->ua.ua_type == CTL_UA_THIN_PROV_THRES && msg->ua.ua_set) + memcpy(lun->ua_tpt_info, msg->ua.ua_info, 8); + if (msg->ua.ua_all) { + if (msg->ua.ua_set) + ctl_est_ua_all(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua_all(lun, iid, msg->ua.ua_type); + } else { + if (msg->ua.ua_set) + ctl_est_ua(lun, iid, msg->ua.ua_type); + else + ctl_clr_ua(lun, iid, msg->ua.ua_type); + } + mtx_unlock(>lun_lock); } static void @@ -1060,8 +1060,8 @@ ctl_isc_lun_sync(struct ctl_softc *softc targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(>ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(>ctl_lock); return; } @@ -1291,8 +1291,8 @@ ctl_isc_mode_sync(struct ctl_softc *soft targ_lun = msg->hdr.nexus.targ_mapped_lun; mtx_lock(>ctl_lock); - if ((targ_lun >= CTL_MAX_LUNS) || - ((lun = softc->ctl_luns[targ_lun]) == NULL)) { + if (targ_lun >= CTL_MAX_LUNS || + (lun = softc->ctl_luns[targ_lun]) == NULL) { mtx_unlock(>ctl_lock); return; } @@ -2197,7 +2197,7 @@ ctl_create_iid(struct ctl_port *port, in * command on this side (XFER mode) or tell the other side to execute it * (SER_ONLY mode). */ -static int +static void ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) { struct ctl_softc *softc = control_softc; @@ -2205,7 +2205,6 @@ ctl_serialize_other_sc_cmd(struct ctl_sc struct ctl_port *port; struct ctl_lun *lun; const struct ctl_cmd_entry *entry; - int retval = 0; uint32_t targ_lun; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -2220,24 +2219,10 @@ ctl_serialize_other_sc_cmd(struct ctl_sc } /* Make sure that we know about this LUN. */ - if ((targ_lun < CTL_MAX_LUNS) && - ((lun = softc->ctl_luns[targ_lun]) != NULL)) { - mtx_lock(>lun_lock); - mtx_unlock(>ctl_lock); - /* -* If the LUN is invalid, pretend that it doesn't exist. -* It will go away
svn commit: r312571 - stable/10/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:30:10 2017 New Revision: 312571 URL: https://svnweb.freebsd.org/changeset/base/312571 Log: MFC r310539: Remove CTL_MAX_LUNS from places where it is not required. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_tpc.c stable/10/sys/cam/ctl/ctl_tpc_local.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c == --- stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:29:40 2017(r312570) +++ stable/10/sys/cam/ctl/ctl.c Sat Jan 21 08:30:10 2017(r312571) @@ -1220,7 +1220,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } mtx_lock(>ctl_lock); STAILQ_FOREACH(lun, >lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; mtx_lock(>lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_INQ_CHANGE); @@ -2897,18 +2897,18 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_DUMP_STRUCTS: { - int i, j, k; + int j, k; struct ctl_port *port; struct ctl_frontend *fe; mtx_lock(>ctl_lock); printf("CTL Persistent Reservation information start:\n"); - for (i = 0; i < CTL_MAX_LUNS; i++) { - lun = softc->ctl_luns[i]; - - if ((lun == NULL) -|| ((lun->flags & CTL_LUN_DISABLED) != 0)) + STAILQ_FOREACH(lun, >lun_list, links) { + mtx_lock(>lun_lock); + if ((lun->flags & CTL_LUN_DISABLED) != 0) { + mtx_unlock(>lun_lock); continue; + } for (j = 0; j < CTL_MAX_PORTS; j++) { if (lun->pr_keys[j] == NULL) @@ -2916,11 +2916,12 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ if (lun->pr_keys[j][k] == 0) continue; - printf(" LUN %d port %d iid %d key " - "%#jx\n", i, j, k, + printf(" LUN %ju port %d iid %d key " + "%#jx\n", lun->lun, j, k, (uintmax_t)lun->pr_keys[j][k]); } } + mtx_unlock(>lun_lock); } printf("CTL Persistent Reservation information end\n"); printf("CTL Ports:\n"); @@ -3303,7 +3304,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, sbuf_printf(sb, "\ton\n"); for (j = 0; j < CTL_MAX_LUNS; j++) { plun = ctl_lun_map_from_port(port, j); - if (plun >= CTL_MAX_LUNS) + if (plun == UINT32_MAX) continue; sbuf_printf(sb, "\t%u\n", @@ -3371,8 +3372,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, } if (port->status & CTL_PORT_STATUS_ONLINE) { STAILQ_FOREACH(lun, >lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= - CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == + UINT32_MAX) continue; mtx_lock(>lun_lock); ctl_est_ua_port(lun, lm->port, -1, @@ -3500,7 +3501,7 @@ ctl_lun_map_set(struct ctl_port *port, u } old = port->lun_map[plun]; port->lun_map[plun] = glun; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old >= CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old == UINT32_MAX) { if (port->lun_enable != NULL) port->lun_enable(port->targ_lun_arg, plun); ctl_isc_announce_port(port); @@ -3517,7 +3518,7 @@ ctl_lun_map_unset(struct ctl_port *port, return (0); old = port->lun_map[plun]; port->lun_map[plun] = UINT32_MAX; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old < CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old != UINT32_MAX) { if (port->lun_disable !=
svn commit: r312570 - stable/11/sys/cam/ctl
Author: mav Date: Sat Jan 21 08:29:40 2017 New Revision: 312570 URL: https://svnweb.freebsd.org/changeset/base/312570 Log: MFC r310539: Remove CTL_MAX_LUNS from places where it is not required. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_frontend.c stable/11/sys/cam/ctl/ctl_tpc.c stable/11/sys/cam/ctl/ctl_tpc_local.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c == --- stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:19:42 2017(r312569) +++ stable/11/sys/cam/ctl/ctl.c Sat Jan 21 08:29:40 2017(r312570) @@ -1218,7 +1218,7 @@ ctl_isc_port_sync(struct ctl_softc *soft } mtx_lock(>ctl_lock); STAILQ_FOREACH(lun, >lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == UINT32_MAX) continue; mtx_lock(>lun_lock); ctl_est_ua_all(lun, -1, CTL_UA_INQ_CHANGE); @@ -2906,18 +2906,18 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } case CTL_DUMP_STRUCTS: { - int i, j, k; + int j, k; struct ctl_port *port; struct ctl_frontend *fe; mtx_lock(>ctl_lock); printf("CTL Persistent Reservation information start:\n"); - for (i = 0; i < CTL_MAX_LUNS; i++) { - lun = softc->ctl_luns[i]; - - if ((lun == NULL) -|| ((lun->flags & CTL_LUN_DISABLED) != 0)) + STAILQ_FOREACH(lun, >lun_list, links) { + mtx_lock(>lun_lock); + if ((lun->flags & CTL_LUN_DISABLED) != 0) { + mtx_unlock(>lun_lock); continue; + } for (j = 0; j < CTL_MAX_PORTS; j++) { if (lun->pr_keys[j] == NULL) @@ -2925,11 +2925,12 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ if (lun->pr_keys[j][k] == 0) continue; - printf(" LUN %d port %d iid %d key " - "%#jx\n", i, j, k, + printf(" LUN %ju port %d iid %d key " + "%#jx\n", lun->lun, j, k, (uintmax_t)lun->pr_keys[j][k]); } } + mtx_unlock(>lun_lock); } printf("CTL Persistent Reservation information end\n"); printf("CTL Ports:\n"); @@ -3312,7 +3313,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, sbuf_printf(sb, "\ton\n"); for (j = 0; j < CTL_MAX_LUNS; j++) { plun = ctl_lun_map_from_port(port, j); - if (plun >= CTL_MAX_LUNS) + if (plun == UINT32_MAX) continue; sbuf_printf(sb, "\t%u\n", @@ -3380,8 +3381,8 @@ ctl_ioctl(struct cdev *dev, u_long cmd, } if (port->status & CTL_PORT_STATUS_ONLINE) { STAILQ_FOREACH(lun, >lun_list, links) { - if (ctl_lun_map_to_port(port, lun->lun) >= - CTL_MAX_LUNS) + if (ctl_lun_map_to_port(port, lun->lun) == + UINT32_MAX) continue; mtx_lock(>lun_lock); ctl_est_ua_port(lun, lm->port, -1, @@ -3509,7 +3510,7 @@ ctl_lun_map_set(struct ctl_port *port, u } old = port->lun_map[plun]; port->lun_map[plun] = glun; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old >= CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old == UINT32_MAX) { if (port->lun_enable != NULL) port->lun_enable(port->targ_lun_arg, plun); ctl_isc_announce_port(port); @@ -3526,7 +3527,7 @@ ctl_lun_map_unset(struct ctl_port *port, return (0); old = port->lun_map[plun]; port->lun_map[plun] = UINT32_MAX; - if ((port->status & CTL_PORT_STATUS_ONLINE) && old < CTL_MAX_LUNS) { + if ((port->status & CTL_PORT_STATUS_ONLINE) && old != UINT32_MAX) { if (port->lun_disable !=
svn commit: r312569 - stable/10/sbin/camcontrol
Author: mav Date: Sat Jan 21 08:19:42 2017 New Revision: 312569 URL: https://svnweb.freebsd.org/changeset/base/312569 Log: MFC r311897: Add checks for received mode page length. If our buffer is too small, we may receive part of the page, and should not try read/write past the end of the buffer. Reported by:Coverity CID:1368374, 1368375 Modified: stable/10/sbin/camcontrol/modeedit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/camcontrol/modeedit.c == --- stable/10/sbin/camcontrol/modeedit.cSat Jan 21 08:19:13 2017 (r312568) +++ stable/10/sbin/camcontrol/modeedit.cSat Jan 21 08:19:42 2017 (r312569) @@ -557,7 +557,7 @@ editlist_populate(struct cam_device *dev struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int len; + size_t len; STAILQ_INIT(); @@ -575,6 +575,7 @@ editlist_populate(struct cam_device *dev mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Decode the value data, creating edit_entries for each value. */ buff_decode_visit(mode_pars, len, format, editentry_create, 0); @@ -594,7 +595,7 @@ editlist_save(struct cam_device *device, struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int len, hlen; + size_t len, hlen; /* Make sure that something changed before continuing. */ if (! editlist_changed) @@ -617,6 +618,7 @@ editlist_save(struct cam_device *device, mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Encode the value data to be passed back to the device. */ buff_encode_visit(mode_pars, len, format, editentry_save, 0); @@ -814,7 +816,7 @@ modepage_dump(struct cam_device *device, struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int indx, len; + size_t indx, len; mode_sense(device, dbd, pc, page, subpage, retries, timeout, data, sizeof(data)); @@ -829,6 +831,7 @@ modepage_dump(struct cam_device *device, mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Print the raw mode page data with newlines each 8 bytes. */ for (indx = 0; indx < len; indx++) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312568 - stable/11/sbin/camcontrol
Author: mav Date: Sat Jan 21 08:19:13 2017 New Revision: 312568 URL: https://svnweb.freebsd.org/changeset/base/312568 Log: MFC r311897: Add checks for received mode page length. If our buffer is too small, we may receive part of the page, and should not try read/write past the end of the buffer. Reported by:Coverity CID:1368374, 1368375 Modified: stable/11/sbin/camcontrol/modeedit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/modeedit.c == --- stable/11/sbin/camcontrol/modeedit.cSat Jan 21 08:17:30 2017 (r312567) +++ stable/11/sbin/camcontrol/modeedit.cSat Jan 21 08:19:13 2017 (r312568) @@ -557,7 +557,7 @@ editlist_populate(struct cam_device *dev struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int len; + size_t len; STAILQ_INIT(); @@ -575,6 +575,7 @@ editlist_populate(struct cam_device *dev mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Decode the value data, creating edit_entries for each value. */ buff_decode_visit(mode_pars, len, format, editentry_create, 0); @@ -594,7 +595,7 @@ editlist_save(struct cam_device *device, struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int len, hlen; + size_t len, hlen; /* Make sure that something changed before continuing. */ if (! editlist_changed) @@ -617,6 +618,7 @@ editlist_save(struct cam_device *device, mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Encode the value data to be passed back to the device. */ buff_encode_visit(mode_pars, len, format, editentry_save, 0); @@ -814,7 +816,7 @@ modepage_dump(struct cam_device *device, struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct scsi_mode_page_header_sp *mphsp; - int indx, len; + size_t indx, len; mode_sense(device, dbd, pc, page, subpage, retries, timeout, data, sizeof(data)); @@ -829,6 +831,7 @@ modepage_dump(struct cam_device *device, mode_pars = (uint8_t *)(mphsp + 1); len = scsi_2btoul(mphsp->page_length); } + len = MIN(len, sizeof(data) - (mode_pars - data)); /* Print the raw mode page data with newlines each 8 bytes. */ for (indx = 0; indx < len; indx++) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312567 - in stable/10: sbin/camcontrol share/misc sys/cam/scsi
Author: mav Date: Sat Jan 21 08:17:30 2017 New Revision: 312567 URL: https://svnweb.freebsd.org/changeset/base/312567 Log: MFC r311636: Make 'camcontrol modepage' support subpages. Modified: stable/10/sbin/camcontrol/camcontrol.8 stable/10/sbin/camcontrol/camcontrol.c stable/10/sbin/camcontrol/camcontrol.h stable/10/sbin/camcontrol/modeedit.c stable/10/share/misc/scsi_modes stable/10/sys/cam/scsi/scsi_all.c stable/10/sys/cam/scsi/scsi_all.h stable/10/sys/cam/scsi/scsi_ch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/camcontrol/camcontrol.8 == --- stable/10/sbin/camcontrol/camcontrol.8 Sat Jan 21 08:16:41 2017 (r312566) +++ stable/10/sbin/camcontrol/camcontrol.8 Sat Jan 21 08:17:30 2017 (r312567) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2016 +.Dd January 6, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -121,7 +121,7 @@ .Ic modepage .Op device id .Op generic args -.Aq Fl m Ar page | Fl l +.Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl .Op Fl b | Fl e .Op Fl d @@ -678,9 +678,10 @@ The editor will be invoked if detects that standard input is terminal. .It Fl l Lists all available mode pages. -.It Fl m Ar mode_page -This specifies the number of the mode page the user would like to view -and/or edit. +If specified more then once, also lists subpages. +.It Fl m Ar page[,subpage] +This specifies the number of the mode page and optionally subpage the user +would like to view and/or edit. This argument is mandatory unless .Fl l is specified. Modified: stable/10/sbin/camcontrol/camcontrol.c == --- stable/10/sbin/camcontrol/camcontrol.c Sat Jan 21 08:16:41 2017 (r312566) +++ stable/10/sbin/camcontrol/camcontrol.c Sat Jan 21 08:17:30 2017 (r312567) @@ -122,12 +122,9 @@ typedef enum { CAM_ARG_GET_STDINQ = 0x2000, CAM_ARG_GET_XFERRATE= 0x4000, CAM_ARG_INQ_MASK= 0x7000, - CAM_ARG_MODE_EDIT = 0x8000, - CAM_ARG_PAGE_CNTL = 0x0001, CAM_ARG_TIMEOUT = 0x0002, CAM_ARG_CMD_IN = 0x0004, CAM_ARG_CMD_OUT = 0x0008, - CAM_ARG_DBD = 0x0010, CAM_ARG_ERR_RECOVER = 0x0020, CAM_ARG_RETRIES = 0x0040, CAM_ARG_START_UNIT = 0x0080, @@ -3982,8 +3979,8 @@ reassignblocks(struct cam_device *device #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int mode_page, int page_control, - int dbd, int retry_count, int timeout, u_int8_t *data, int datalen) +mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, + int retry_count, int timeout, u_int8_t *data, int datalen) { union ccb *ccb; int retval; @@ -3995,15 +3992,17 @@ mode_sense(struct cam_device *device, in CCB_CLEAR_ALL_EXCEPT_HDR(>csio); - scsi_mode_sense(>csio, + scsi_mode_sense_subpage(>csio, /* retries */ retry_count, /* cbfcnp */ NULL, /* tag_action */ MSG_SIMPLE_Q_TAG, /* dbd */ dbd, - /* page_code */ page_control << 6, - /* page */ mode_page, + /* pc */ pc << 6, + /* page */ page, + /* subpage */ subpage, /* param_buf */ data, /* param_len */ datalen, + /* minimum_cmd_size */ 0, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); @@ -4084,8 +4083,9 @@ void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { - int c, mode_page = -1, page_control = 0; - int binary = 0, list = 0; + char *str_subpage; + int c, page = -1, subpage = -1, pc = 0; + int binary = 0, dbd = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4093,40 +4093,44 @@ modepage(struct cam_device *device, int binary = 1; break; case 'd': - arglist |= CAM_ARG_DBD; + dbd = 1; break; case 'e': - arglist |= CAM_ARG_MODE_EDIT; + edit = 1; break; case 'l': - list = 1; + list++; break; case 'm': - mode_page = strtol(optarg, NULL, 0); - if (mode_page < 0) -
svn commit: r312566 - in stable/11: sbin/camcontrol share/misc sys/cam/scsi
Author: mav Date: Sat Jan 21 08:16:41 2017 New Revision: 312566 URL: https://svnweb.freebsd.org/changeset/base/312566 Log: MFC r311636: Make 'camcontrol modepage' support subpages. Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/camcontrol.c stable/11/sbin/camcontrol/camcontrol.h stable/11/sbin/camcontrol/modeedit.c stable/11/share/misc/scsi_modes stable/11/sys/cam/scsi/scsi_all.c stable/11/sys/cam/scsi/scsi_all.h stable/11/sys/cam/scsi/scsi_ch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.8 == --- stable/11/sbin/camcontrol/camcontrol.8 Sat Jan 21 08:15:51 2017 (r312565) +++ stable/11/sbin/camcontrol/camcontrol.8 Sat Jan 21 08:16:41 2017 (r312566) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2016 +.Dd January 6, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -121,7 +121,7 @@ .Ic modepage .Op device id .Op generic args -.Aq Fl m Ar page | Fl l +.Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl .Op Fl b | Fl e .Op Fl d @@ -702,9 +702,10 @@ The editor will be invoked if detects that standard input is terminal. .It Fl l Lists all available mode pages. -.It Fl m Ar mode_page -This specifies the number of the mode page the user would like to view -and/or edit. +If specified more then once, also lists subpages. +.It Fl m Ar page[,subpage] +This specifies the number of the mode page and optionally subpage the user +would like to view and/or edit. This argument is mandatory unless .Fl l is specified. Modified: stable/11/sbin/camcontrol/camcontrol.c == --- stable/11/sbin/camcontrol/camcontrol.c Sat Jan 21 08:15:51 2017 (r312565) +++ stable/11/sbin/camcontrol/camcontrol.c Sat Jan 21 08:16:41 2017 (r312566) @@ -125,12 +125,9 @@ typedef enum { CAM_ARG_GET_STDINQ = 0x2000, CAM_ARG_GET_XFERRATE= 0x4000, CAM_ARG_INQ_MASK= 0x7000, - CAM_ARG_MODE_EDIT = 0x8000, - CAM_ARG_PAGE_CNTL = 0x0001, CAM_ARG_TIMEOUT = 0x0002, CAM_ARG_CMD_IN = 0x0004, CAM_ARG_CMD_OUT = 0x0008, - CAM_ARG_DBD = 0x0010, CAM_ARG_ERR_RECOVER = 0x0020, CAM_ARG_RETRIES = 0x0040, CAM_ARG_START_UNIT = 0x0080, @@ -3987,8 +3984,8 @@ reassignblocks(struct cam_device *device #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int mode_page, int page_control, - int dbd, int retry_count, int timeout, u_int8_t *data, int datalen) +mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, + int retry_count, int timeout, u_int8_t *data, int datalen) { union ccb *ccb; int retval; @@ -4000,15 +3997,17 @@ mode_sense(struct cam_device *device, in CCB_CLEAR_ALL_EXCEPT_HDR(>csio); - scsi_mode_sense(>csio, + scsi_mode_sense_subpage(>csio, /* retries */ retry_count, /* cbfcnp */ NULL, /* tag_action */ MSG_SIMPLE_Q_TAG, /* dbd */ dbd, - /* page_code */ page_control << 6, - /* page */ mode_page, + /* pc */ pc << 6, + /* page */ page, + /* subpage */ subpage, /* param_buf */ data, /* param_len */ datalen, + /* minimum_cmd_size */ 0, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); @@ -4089,8 +4088,9 @@ void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { - int c, mode_page = -1, page_control = 0; - int binary = 0, list = 0; + char *str_subpage; + int c, page = -1, subpage = -1, pc = 0; + int binary = 0, dbd = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4098,40 +4098,44 @@ modepage(struct cam_device *device, int binary = 1; break; case 'd': - arglist |= CAM_ARG_DBD; + dbd = 1; break; case 'e': - arglist |= CAM_ARG_MODE_EDIT; + edit = 1; break; case 'l': - list = 1; + list++; break; case 'm': - mode_page = strtol(optarg, NULL, 0); - if (mode_page < 0) -
svn commit: r312565 - in stable/10: lib/libcam sbin/camcontrol
Author: mav Date: Sat Jan 21 08:15:51 2017 New Revision: 312565 URL: https://svnweb.freebsd.org/changeset/base/312565 Log: MFC r311623: Make do_buff_decode() not read past the end of the buffer. Abort format processing as soon as we have no enough data. Modified: stable/10/lib/libcam/scsi_cmdparse.c stable/10/sbin/camcontrol/modeedit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcam/scsi_cmdparse.c == --- stable/10/lib/libcam/scsi_cmdparse.cSat Jan 21 08:15:19 2017 (r312564) +++ stable/10/lib/libcam/scsi_cmdparse.cSat Jan 21 08:15:51 2017 (r312565) @@ -100,10 +100,11 @@ __FBSDID("$FreeBSD$"); */ static int -do_buff_decode(u_int8_t *databuf, size_t len, +do_buff_decode(u_int8_t *buff, size_t len, void (*arg_put)(void *, int , void *, int, char *), void *puthook, const char *fmt, va_list *ap) { + int ind = 0; int assigned = 0; int width; int suppress; @@ -112,21 +113,17 @@ do_buff_decode(u_int8_t *databuf, size_t static u_char mask[] = {0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; int value; - u_char *base = databuf; char *intendp; char letter; char field_name[80]; -# define ARG_PUT(ARG) \ - do \ - { \ - if (!suppress) \ - { \ +#define ARG_PUT(ARG) \ + do { \ + if (!suppress) { \ if (arg_put) \ - (*arg_put)(puthook, (letter == 't' ? \ - 'b' : letter), \ - (void *)((long)(ARG)), width, \ - field_name); \ + (*arg_put)(puthook, (letter == 't' ? 'b' : \ + letter), (void *)((long)(ARG)), width, \ + field_name); \ else \ *(va_arg(*ap, int *)) = (ARG); \ assigned++; \ @@ -187,7 +184,11 @@ do_buff_decode(u_int8_t *databuf, size_t done = 1; else { if (shift <= 0) { - bits = *databuf++; + if (ind >= len) { + done = 1; + break; + } + bits = buff[ind++]; shift = 8; } value = (bits >> (shift - width)) & @@ -209,29 +210,31 @@ do_buff_decode(u_int8_t *databuf, size_t fmt++; width = strtol(fmt, , 10); fmt = intendp; + if (ind + width > len) { + done = 1; + break; + } switch(width) { case 1: - ARG_PUT(*databuf); - databuf++; + ARG_PUT(buff[ind]); + ind++; break; case 2: - ARG_PUT((*databuf) << 8 | *(databuf + 1)); - databuf += 2; + ARG_PUT(buff[ind] << 8 | buff[ind + 1]); + ind += 2; break; case 3: - ARG_PUT((*databuf) << 16 | - (*(databuf + 1)) << 8 | *(databuf + 2)); - databuf += 3; + ARG_PUT(buff[ind] << 16 | + buff[ind + 1] << 8 | buff[ind + 2]); + ind += 3; break; case 4: - ARG_PUT((*databuf) << 24 | - (*(databuf + 1)) << 16 | - (*(databuf + 2)) << 8 | - *(databuf + 3)); - databuf += 4; + ARG_PUT(buff[ind] << 24 | buff[ind + 1] << 16 | + buff[ind + 2] << 8 | buff[ind + 3]); + ind += 4; break; default: @@ -242,32 +245,35 @@ do_buff_decode(u_int8_t *databuf, size_t break; case 'c': /*
svn commit: r312564 - in stable/11: lib/libcam sbin/camcontrol
Author: mav Date: Sat Jan 21 08:15:19 2017 New Revision: 312564 URL: https://svnweb.freebsd.org/changeset/base/312564 Log: MFC r311623: Make do_buff_decode() not read past the end of the buffer. Abort format processing as soon as we have no enough data. Modified: stable/11/lib/libcam/scsi_cmdparse.c stable/11/sbin/camcontrol/modeedit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libcam/scsi_cmdparse.c == --- stable/11/lib/libcam/scsi_cmdparse.cSat Jan 21 07:07:50 2017 (r312563) +++ stable/11/lib/libcam/scsi_cmdparse.cSat Jan 21 08:15:19 2017 (r312564) @@ -100,10 +100,11 @@ __FBSDID("$FreeBSD$"); */ static int -do_buff_decode(u_int8_t *databuf, size_t len, +do_buff_decode(u_int8_t *buff, size_t len, void (*arg_put)(void *, int , void *, int, char *), void *puthook, const char *fmt, va_list *ap) { + int ind = 0; int assigned = 0; int width; int suppress; @@ -112,21 +113,17 @@ do_buff_decode(u_int8_t *databuf, size_t static u_char mask[] = {0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; int value; - u_char *base = databuf; char *intendp; char letter; char field_name[80]; -# define ARG_PUT(ARG) \ - do \ - { \ - if (!suppress) \ - { \ +#define ARG_PUT(ARG) \ + do { \ + if (!suppress) { \ if (arg_put) \ - (*arg_put)(puthook, (letter == 't' ? \ - 'b' : letter), \ - (void *)((long)(ARG)), width, \ - field_name); \ + (*arg_put)(puthook, (letter == 't' ? 'b' : \ + letter), (void *)((long)(ARG)), width, \ + field_name); \ else \ *(va_arg(*ap, int *)) = (ARG); \ assigned++; \ @@ -187,7 +184,11 @@ do_buff_decode(u_int8_t *databuf, size_t done = 1; else { if (shift <= 0) { - bits = *databuf++; + if (ind >= len) { + done = 1; + break; + } + bits = buff[ind++]; shift = 8; } value = (bits >> (shift - width)) & @@ -209,29 +210,31 @@ do_buff_decode(u_int8_t *databuf, size_t fmt++; width = strtol(fmt, , 10); fmt = intendp; + if (ind + width > len) { + done = 1; + break; + } switch(width) { case 1: - ARG_PUT(*databuf); - databuf++; + ARG_PUT(buff[ind]); + ind++; break; case 2: - ARG_PUT((*databuf) << 8 | *(databuf + 1)); - databuf += 2; + ARG_PUT(buff[ind] << 8 | buff[ind + 1]); + ind += 2; break; case 3: - ARG_PUT((*databuf) << 16 | - (*(databuf + 1)) << 8 | *(databuf + 2)); - databuf += 3; + ARG_PUT(buff[ind] << 16 | + buff[ind + 1] << 8 | buff[ind + 2]); + ind += 3; break; case 4: - ARG_PUT((*databuf) << 24 | - (*(databuf + 1)) << 16 | - (*(databuf + 2)) << 8 | - *(databuf + 3)); - databuf += 4; + ARG_PUT(buff[ind] << 24 | buff[ind + 1] << 16 | + buff[ind + 2] << 8 | buff[ind + 3]); + ind += 4; break; default: @@ -242,32 +245,35 @@ do_buff_decode(u_int8_t *databuf, size_t break; case 'c': /*