From owner-svn-src-head@freebsd.org Sun Sep 27 03:46:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DFB3A0A191; Sun, 27 Sep 2015 03:46:57 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E291A61F; Sun, 27 Sep 2015 03:46:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R3kuYM054236; Sun, 27 Sep 2015 03:46:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R3ku6k054234; Sun, 27 Sep 2015 03:46:56 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509270346.t8R3ku6k054234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 27 Sep 2015 03:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288290 - head/sys/dev/otus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 03:46:57 -0000 Author: adrian Date: Sun Sep 27 03:46:55 2015 New Revision: 288290 URL: https://svnweb.freebsd.org/changeset/base/288290 Log: Track the command response code buffer size and verify it in the receive path. Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Sun Sep 27 01:37:30 2015 (r288289) +++ head/sys/dev/otus/if_otus.c Sun Sep 27 03:46:55 2015 (r288290) @@ -156,7 +156,7 @@ void otus_do_async(struct otus_softc *, int otus_newstate(struct ieee80211vap *, enum ieee80211_state, int); int otus_cmd(struct otus_softc *, uint8_t, const void *, int, - void *); + void *, int); void otus_write(struct otus_softc *, uint32_t, uint32_t); int otus_write_barrier(struct otus_softc *); struct ieee80211_node *otus_node_alloc(struct ieee80211com *); @@ -702,7 +702,7 @@ otus_attachhook(struct otus_softc *sc) /* Send an ECHO command to check that everything is settled. */ in = 0xbadc0ffe; - if (otus_cmd(sc, AR_CMD_ECHO, &in, sizeof in, &out) != 0) { + if (otus_cmd(sc, AR_CMD_ECHO, &in, sizeof in, &out, sizeof(out)) != 0) { OTUS_UNLOCK(sc); device_printf(sc->sc_dev, "%s: echo command failed\n", __func__); @@ -1282,7 +1282,7 @@ otus_newstate(struct ieee80211vap *vap, int otus_cmd(struct otus_softc *sc, uint8_t code, const void *idata, int ilen, - void *odata) + void *odata, int odatalen) { struct otus_tx_cmd *cmd; struct ar_cmd_hdr *hdr; @@ -1321,6 +1321,7 @@ otus_cmd(struct otus_softc *sc, uint8_t __func__, code, ilen, hdr->token); cmd->odata = odata; + cmd->odatalen = odatalen; cmd->buflen = xferlen; /* Queue the command to the endpoint */ @@ -1373,7 +1374,7 @@ otus_write_barrier(struct otus_softc *sc sc->write_idx); error = otus_cmd(sc, AR_CMD_WREG, sc->write_buf, - sizeof (sc->write_buf[0]) * sc->write_idx, NULL); + sizeof (sc->write_buf[0]) * sc->write_idx, NULL, 0); sc->write_idx = 0; return error; } @@ -1428,7 +1429,7 @@ otus_read_eeprom(struct otus_softc *sc) for (i = 0; i < sizeof (sc->eeprom) / 32; i++) { for (j = 0; j < 8; j++, reg += 4) regs[j] = htole32(reg); - error = otus_cmd(sc, AR_CMD_RREG, regs, sizeof regs, eep); + error = otus_cmd(sc, AR_CMD_RREG, regs, sizeof regs, eep, 32); if (error != 0) break; eep += 32; @@ -1477,8 +1478,18 @@ otus_cmd_handle_response(struct otus_sof (int) cmd->token); if (hdr->token == cmd->token) { /* Copy answer into caller's supplied buffer. */ - if (cmd->odata != NULL) - memcpy(cmd->odata, &hdr[1], hdr->len); + if (cmd->odata != NULL) { + if (hdr->len != cmd->odatalen) { + device_printf(sc->sc_dev, + "%s: code 0x%02x, len=%d, olen=%d\n", + __func__, + (int) hdr->code, + (int) hdr->len, + (int) cmd->odatalen); + } + memcpy(cmd->odata, &hdr[1], + MIN(cmd->odatalen, hdr->len)); + } wakeup(cmd); } @@ -1513,8 +1524,9 @@ otus_cmd_rxeof(struct otus_softc *sc, ui hdr->code); /* - * XXX TODO: has to reach into the cmd queue "waiting for + * This has to reach into the cmd queue "waiting for * an RX response" list, grab the head entry and check + * if we need to wake anyone up. */ if ((hdr->code & 0xc0) != 0xc0) { otus_cmd_handle_response(sc, hdr); @@ -2686,7 +2698,7 @@ otus_set_chan(struct otus_softc *sc, str goto finish; /* XXX Is that FREQ_START ? */ - error = otus_cmd(sc, AR_CMD_FREQ_STRAT, NULL, 0, NULL); + error = otus_cmd(sc, AR_CMD_FREQ_STRAT, NULL, 0, NULL, 0); if (error != 0) goto finish; @@ -2758,7 +2770,7 @@ otus_set_chan(struct otus_softc *sc, str cmd.check_loop_count = assoc ? htole32(2000) : htole32(1000); OTUS_DPRINTF(sc, OTUS_DEBUG_RESET, "%s\n", (code == AR_CMD_RF_INIT) ? "RF_INIT" : "FREQUENCY"); - error = otus_cmd(sc, code, &cmd, sizeof cmd, &rsp); + error = otus_cmd(sc, code, &cmd, sizeof cmd, &rsp, sizeof(rsp)); if (error != 0) goto finish; if ((rsp.status & htole32(AR_CAL_ERR_AGC | AR_CAL_ERR_NF_VAL)) != 0) { @@ -2848,14 +2860,14 @@ otus_set_key_cb(struct otus_softc *sc, v } key.cipher = htole16(cipher); memcpy(key.key, k->k_key, MIN(k->k_len, 16)); - error = otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL); + error = otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL, 0); if (error != 0 || k->k_cipher != IEEE80211_CIPHER_TKIP) return; /* TKIP: set Tx/Rx MIC Key. */ key.kix = htole16(1); memcpy(key.key, k->k_key + 16, 16); - (void)otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL); + (void)otus_cmd(sc, AR_CMD_EKEY, &key, sizeof key, NULL, 0); } void @@ -2886,7 +2898,7 @@ otus_delete_key_cb(struct otus_softc *sc uid = htole32(k->k_id); else uid = htole32(OTUS_UID(cmd->associd)); - (void)otus_cmd(sc, AR_CMD_DKEY, &uid, sizeof uid, NULL); + (void)otus_cmd(sc, AR_CMD_DKEY, &uid, sizeof uid, NULL, 0); } #endif Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Sun Sep 27 01:37:30 2015 (r288289) +++ head/sys/dev/otus/if_otusreg.h Sun Sep 27 03:46:55 2015 (r288290) @@ -875,6 +875,7 @@ struct otus_tx_cmd { uint8_t *buf; uint16_t buflen; void * *odata; + uint16_t odatalen; uint16_t token; STAILQ_ENTRY(otus_tx_cmd) next_cmd; }; From owner-svn-src-head@freebsd.org Sun Sep 27 04:03:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DAD6FA0AA2B; Sun, 27 Sep 2015 04:03:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBFCBE16; Sun, 27 Sep 2015 04:03:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R43Bb5062242; Sun, 27 Sep 2015 04:03:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R43B5Z062241; Sun, 27 Sep 2015 04:03:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509270403.t8R43B5Z062241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 27 Sep 2015 04:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288291 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 04:03:12 -0000 Author: adrian Date: Sun Sep 27 04:03:11 2015 New Revision: 288291 URL: https://svnweb.freebsd.org/changeset/base/288291 Log: Enforce consistent limits of daemons run from rc.subr: * Allow the user to configure the login class to use in rc.conf by using {daemon}_login_class, which; * Use the daemon class by default; * .. and then use 'limits' to set the login class so it works both via init at startup (which runs this in 'daemon' class) and via whichever root environment (eg command line, other daemons, etc.) Reviewed by: dteske Differential Revision: https://reviews.freebsd.org/D3630 Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sun Sep 27 03:46:55 2015 (r288290) +++ head/etc/rc.subr Sun Sep 27 04:03:11 2015 (r288291) @@ -768,6 +768,8 @@ check_startmsgs() # # ${name}_prepend n Command added before ${command}. # +# ${name}_login_class n Login class to use, else "daemon". +# # ${rc_arg}_cmd n If set, use this as the method when invoked; # Otherwise, use default command (see below) # @@ -942,7 +944,7 @@ run_rc_command() _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ - _prepend=\$${name}_prepend + _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} if [ -n "$_user" ]; then # unset $_user if running as that user if [ "$_user" = "$(eval $IDCMD)" ]; then @@ -1050,6 +1052,9 @@ $command $rc_flags $command_args" fi fi + # Prepend default limits + _doit="limits -C $_login_class $_doit" + # run the full command # if ! _run_rc_doit "$_doit"; then From owner-svn-src-head@freebsd.org Sun Sep 27 04:40:55 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 986A3A0A7C7; Sun, 27 Sep 2015 04:40:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 867837A9; Sun, 27 Sep 2015 04:40:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4etQm075234; Sun, 27 Sep 2015 04:40:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4esUp075231; Sun, 27 Sep 2015 04:40:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270440.t8R4esUp075231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 04:40:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288295 - in head: . share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 04:40:55 -0000 Author: ngie Date: Sun Sep 27 04:40:54 2015 New Revision: 288295 URL: https://svnweb.freebsd.org/changeset/base/288295 Log: Posthumously remove all references to MFREE(9) The macro was removed in r90227 MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/mbuf.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Sep 27 04:36:09 2015 (r288294) +++ head/ObsoleteFiles.inc Sun Sep 27 04:40:54 2015 (r288295) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150926: posthumously (r90227) remove MFREE(9) from mbuf(9) +OLD_FILES+=usr/share/man/man9/MFREE.9.gz # 20150818: *allocm() are gone in jemalloc 4.0.0 OLD_FILES+=usr/share/man/man3/allocm.3.gz OLD_FILES+=usr/share/man/man3/dallocm.3.gz Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Sep 27 04:36:09 2015 (r288294) +++ head/share/man/man9/Makefile Sun Sep 27 04:40:54 2015 (r288295) @@ -1013,7 +1013,6 @@ MLINKS+=\ mbuf.9 MEXT_IS_REF.9 \ mbuf.9 MEXT_REM_REF.9 \ mbuf.9 m_fixhdr.9 \ - mbuf.9 MFREE.9 \ mbuf.9 m_free.9 \ mbuf.9 m_freem.9 \ mbuf.9 MGET.9 \ Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Sun Sep 27 04:36:09 2015 (r288294) +++ head/share/man/man9/mbuf.9 Sun Sep 27 04:40:54 2015 (r288295) @@ -53,7 +53,6 @@ .Fa "int type" .Fc .Fn MEXTFREE "struct mbuf *mbuf" -.Fn MFREE "struct mbuf *mbuf" "struct mbuf *successor" .\" .Ss Mbuf utility macros .Fn mtod "struct mbuf *mbuf" "type" From owner-svn-src-head@freebsd.org Sun Sep 27 04:54:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 861189CF0E3; Sun, 27 Sep 2015 04:54:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68310E87; Sun, 27 Sep 2015 04:54:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4sV7C083063; Sun, 27 Sep 2015 04:54:31 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4sUYo083058; Sun, 27 Sep 2015 04:54:30 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201509270454.t8R4sUYo083058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 27 Sep 2015 04:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288297 - in head: sys/netinet sys/netinet6 usr.sbin/arp usr.sbin/ndp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 04:54:31 -0000 Author: melifaro Date: Sun Sep 27 04:54:29 2015 New Revision: 288297 URL: https://svnweb.freebsd.org/changeset/base/288297 Log: rtsock requests for deleting interface address lles started to return EPERM instead of old "ignore-and-return 0" in r287789. This broke arp -da / ndp -cn behavior (they exit on rtsock command failure). Fix this by translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and making arp/ndp ignore these entries in batched delete. MFC after: 2 weeks Modified: head/sys/netinet/in.c head/sys/netinet6/in6.c head/usr.sbin/arp/arp.c head/usr.sbin/ndp/ndp.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/sys/netinet/in.c Sun Sep 27 04:54:29 2015 (r288297) @@ -1333,6 +1333,8 @@ in_lltable_dump_entry(struct lltable *ll arpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA); if (lle->la_flags & LLE_STATIC) arpc.rtm.rtm_flags |= RTF_STATIC; + if (lle->la_flags & LLE_IFADDR) + arpc.rtm.rtm_flags |= RTF_PINNED; arpc.rtm.rtm_index = ifp->if_index; error = SYSCTL_OUT(wr, &arpc, sizeof(arpc)); Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/sys/netinet6/in6.c Sun Sep 27 04:54:29 2015 (r288297) @@ -2354,6 +2354,8 @@ in6_lltable_dump_entry(struct lltable *l ndpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA); if (lle->la_flags & LLE_STATIC) ndpc.rtm.rtm_flags |= RTF_STATIC; + if (lle->la_flags & LLE_IFADDR) + ndpc.rtm.rtm_flags |= RTF_PINNED; ndpc.rtm.rtm_index = ifp->if_index; error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc)); Modified: head/usr.sbin/arp/arp.c ============================================================================== --- head/usr.sbin/arp/arp.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/usr.sbin/arp/arp.c Sun Sep 27 04:54:29 2015 (r288297) @@ -673,10 +673,13 @@ print_entry(struct sockaddr_dl *sdl, */ static void nuke_entry(struct sockaddr_dl *sdl __unused, - struct sockaddr_in *addr, struct rt_msghdr *rtm __unused) + struct sockaddr_in *addr, struct rt_msghdr *rtm) { char ip[20]; + if (rtm->rtm_flags & RTF_PINNED) + return; + snprintf(ip, sizeof(ip), "%s", inet_ntoa(addr->sin_addr)); delete(ip); } Modified: head/usr.sbin/ndp/ndp.c ============================================================================== --- head/usr.sbin/ndp/ndp.c Sun Sep 27 04:47:08 2015 (r288296) +++ head/usr.sbin/ndp/ndp.c Sun Sep 27 04:54:29 2015 (r288297) @@ -649,6 +649,8 @@ again:; if (rtm->rtm_flags & RTF_CLONED) delete(host_buf); #else + if (rtm->rtm_flags & RTF_PINNED) + continue; delete(host_buf); #endif continue; From owner-svn-src-head@freebsd.org Sun Sep 27 04:55:45 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DB0C9CF1F5; Sun, 27 Sep 2015 04:55:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65ADB8D; Sun, 27 Sep 2015 04:55:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R4tjKm083187; Sun, 27 Sep 2015 04:55:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R4ti42083184; Sun, 27 Sep 2015 04:55:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270455.t8R4ti42083184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 04:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288298 - in head: . share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 04:55:45 -0000 Author: ngie Date: Sun Sep 27 04:55:43 2015 New Revision: 288298 URL: https://svnweb.freebsd.org/changeset/base/288298 Log: Remove MLINKS to more non-existent mbuf(9) macros X-MFC with: r288295 MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile head/share/man/man9/mbuf.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Sep 27 04:54:29 2015 (r288297) +++ head/ObsoleteFiles.inc Sun Sep 27 04:55:43 2015 (r288298) @@ -38,7 +38,11 @@ # xargs -n1 | sort | uniq -d; # done -# 20150926: posthumously (r90227) remove MFREE(9) from mbuf(9) +# 20150926: remove links to removed/unimplemented mbuf(9) macros +OLD_FILES+=usr/share/man/man9/MEXT_ADD_REF.9.gz +OLD_FILES+=usr/share/man/man9/MEXTFREE.9.gz +OLD_FILES+=usr/share/man/man9/MEXT_IS_REF.9.gz +OLD_FILES+=usr/share/man/man9/MEXT_REM_REF.9.gz OLD_FILES+=usr/share/man/man9/MFREE.9.gz # 20150818: *allocm() are gone in jemalloc 4.0.0 OLD_FILES+=usr/share/man/man3/allocm.3.gz Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Sep 27 04:54:29 2015 (r288297) +++ head/share/man/man9/Makefile Sun Sep 27 04:55:43 2015 (r288298) @@ -1008,10 +1008,6 @@ MLINKS+=\ mbuf.9 m_dup.9 \ mbuf.9 m_dup_pkthdr.9 \ mbuf.9 MEXTADD.9 \ - mbuf.9 MEXT_ADD_REF.9 \ - mbuf.9 MEXTFREE.9 \ - mbuf.9 MEXT_IS_REF.9 \ - mbuf.9 MEXT_REM_REF.9 \ mbuf.9 m_fixhdr.9 \ mbuf.9 m_free.9 \ mbuf.9 m_freem.9 \ Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Sun Sep 27 04:54:29 2015 (r288297) +++ head/share/man/man9/mbuf.9 Sun Sep 27 04:55:43 2015 (r288298) @@ -52,7 +52,6 @@ .Fa "short flags" .Fa "int type" .Fc -.Fn MEXTFREE "struct mbuf *mbuf" .\" .Ss Mbuf utility macros .Fn mtod "struct mbuf *mbuf" "type" From owner-svn-src-head@freebsd.org Sun Sep 27 05:16:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6CDCA0A06B; Sun, 27 Sep 2015 05:16:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AE03AA2; Sun, 27 Sep 2015 05:16:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5G7Ym091317; Sun, 27 Sep 2015 05:16:07 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5G7s2091316; Sun, 27 Sep 2015 05:16:07 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201509270516.t8R5G7s2091316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 27 Sep 2015 05:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288299 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 05:16:07 -0000 Author: jeff Date: Sun Sep 27 05:16:06 2015 New Revision: 288299 URL: https://svnweb.freebsd.org/changeset/base/288299 Log: - Collapse vfs_vmio_truncate & vfs_vmio_release into a single function. - Allow vfs_vmio_invalidate() to free the pages, leaving us with a single loop and bufobj lock when B_NOCACHE/B_INVAL is used. - Eliminate the special B_ASYNC handling on free that has not been relevant for some time. - Remove the extraneous page busy from vfs_vmio_truncate(). Reviewed by: kib Tested by: pho Sponsored by: EMC / Isilon storage division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Sep 27 04:55:43 2015 (r288298) +++ head/sys/kern/vfs_bio.c Sun Sep 27 05:16:06 2015 (r288299) @@ -111,7 +111,6 @@ static void vfs_page_set_validclean(stru static void vfs_clean_pages_dirty_buf(struct buf *bp); static void vfs_setdirty_locked_object(struct buf *bp); static void vfs_vmio_invalidate(struct buf *bp); -static void vfs_vmio_release(struct buf *bp); static void vfs_vmio_truncate(struct buf *bp, int npages); static void vfs_vmio_extend(struct buf *bp, int npages, int size); static int vfs_bio_clcheck(struct vnode *vp, int size, @@ -1830,20 +1829,19 @@ brelse(struct buf *bp) bdirtysub(); bp->b_flags &= ~(B_DELWRI | B_CACHE); if ((bp->b_flags & B_VMIO) == 0) { - if (bp->b_bufsize) - allocbuf(bp, 0); + allocbuf(bp, 0); if (bp->b_vp) brelvp(bp); } } /* - * We must clear B_RELBUF if B_DELWRI is set. If vfs_vmio_release() + * We must clear B_RELBUF if B_DELWRI is set. If vfs_vmio_truncate() * is called with B_DELWRI set, the underlying pages may wind up * getting freed causing a previous write (bdwrite()) to get 'lost' * because pages associated with a B_DELWRI bp are marked clean. * - * We still allow the B_INVAL case to call vfs_vmio_release(), even + * We still allow the B_INVAL case to call vfs_vmio_truncate(), even * if B_DELWRI is set. */ if (bp->b_flags & B_DELWRI) @@ -1870,14 +1868,13 @@ brelse(struct buf *bp) (bp->b_ioflags & BIO_ERROR && bp->b_iocmd == BIO_READ)) && !(bp->b_vp->v_mount != NULL && (bp->b_vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 && - !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI))) + !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI))) { vfs_vmio_invalidate(bp); + allocbuf(bp, 0); + } if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0) { - if (bp->b_flags & B_VMIO) - vfs_vmio_release(bp); - if (bp->b_bufsize != 0) - allocbuf(bp, 0); + allocbuf(bp, 0); if (bp->b_vp != NULL) brelvp(bp); } @@ -2059,8 +2056,41 @@ vfs_vmio_iodone(struct buf *bp) } /* + * Unwire a page held by a buf and place it on the appropriate vm queue. + */ +static void +vfs_vmio_unwire(struct buf *bp, vm_page_t m) +{ + bool freed; + + vm_page_lock(m); + if (vm_page_unwire(m, PQ_NONE)) { + /* + * Determine if the page should be freed before adding + * it to the inactive queue. + */ + if (m->valid == 0) { + freed = !vm_page_busied(m); + if (freed) + vm_page_free(m); + } else if ((bp->b_flags & B_DIRECT) != 0) + freed = vm_page_try_to_free(m); + else + freed = false; + if (!freed) { + /* + * In order to maintain LRU page ordering, put + * the page at the tail of the inactive queue. + */ + vm_page_deactivate(m); + } + } + vm_page_unlock(m); +} + +/* * Perform page invalidation when a buffer is released. The fully invalid - * pages will be reclaimed later in vfs_vmio_release(). + * pages will be reclaimed later in vfs_vmio_truncate(). */ static void vfs_vmio_invalidate(struct buf *bp) @@ -2069,6 +2099,11 @@ vfs_vmio_invalidate(struct buf *bp) vm_page_t m; int i, resid, poffset, presid; + if (buf_mapped(bp)) { + BUF_CHECK_MAPPED(bp); + pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); + } else + BUF_CHECK_UNMAPPED(bp); /* * Get the base offset and length of the buffer. Note that * in the VMIO case if the buffer block size is not @@ -2089,6 +2124,7 @@ vfs_vmio_invalidate(struct buf *bp) m = bp->b_pages[i]; if (m == bogus_page) panic("vfs_vmio_invalidate: Unexpected bogus page."); + bp->b_pages[i] = NULL; presid = resid > (PAGE_SIZE - poffset) ? (PAGE_SIZE - poffset) : resid; @@ -2101,63 +2137,12 @@ vfs_vmio_invalidate(struct buf *bp) } if (pmap_page_wired_mappings(m) == 0) vm_page_set_invalid(m, poffset, presid); + vfs_vmio_unwire(bp, m); resid -= presid; poffset = 0; } VM_OBJECT_WUNLOCK(obj); -} - -/* Give pages used by the bp back to the VM system (where possible) */ -static void -vfs_vmio_release(struct buf *bp) -{ - vm_object_t obj; - vm_page_t m; - int i; - bool freed; - - if (buf_mapped(bp)) { - BUF_CHECK_MAPPED(bp); - pmap_qremove(trunc_page((vm_offset_t)bp->b_data), bp->b_npages); - } else - BUF_CHECK_UNMAPPED(bp); - obj = bp->b_bufobj->bo_object; - if (obj != NULL) - VM_OBJECT_WLOCK(obj); - for (i = 0; i < bp->b_npages; i++) { - m = bp->b_pages[i]; - bp->b_pages[i] = NULL; - vm_page_lock(m); - if (vm_page_unwire(m, PQ_NONE)) { - /* - * Determine if the page should be freed before adding - * it to the inactive queue. - */ - if ((bp->b_flags & B_ASYNC) == 0 && m->valid == 0) { - freed = !vm_page_busied(m); - if (freed) - vm_page_free(m); - } else if ((bp->b_flags & B_DIRECT) != 0) - freed = vm_page_try_to_free(m); - else - freed = false; - if (!freed) { - /* - * In order to maintain LRU page ordering, put - * the page at the tail of the inactive queue. - */ - vm_page_deactivate(m); - } - } - vm_page_unlock(m); - } - if (obj != NULL) - VM_OBJECT_WUNLOCK(obj); - - if (bp->b_bufsize) - bufspaceadjust(bp, 0); bp->b_npages = 0; - bp->b_flags &= ~B_VMIO; } /* @@ -2166,6 +2151,7 @@ vfs_vmio_release(struct buf *bp) static void vfs_vmio_truncate(struct buf *bp, int desiredpages) { + vm_object_t obj; vm_page_t m; int i; @@ -2178,22 +2164,17 @@ vfs_vmio_truncate(struct buf *bp, int de (desiredpages << PAGE_SHIFT), bp->b_npages - desiredpages); } else BUF_CHECK_UNMAPPED(bp); - VM_OBJECT_WLOCK(bp->b_bufobj->bo_object); + obj = bp->b_bufobj->bo_object; + if (obj != NULL) + VM_OBJECT_WLOCK(obj); for (i = desiredpages; i < bp->b_npages; i++) { - /* - * The page is not freed here -- it is the responsibility of - * vnode_pager_setsize. - */ m = bp->b_pages[i]; KASSERT(m != bogus_page, ("allocbuf: bogus page found")); - while (vm_page_sleep_if_busy(m, "biodep")) - continue; bp->b_pages[i] = NULL; - vm_page_lock(m); - vm_page_unwire(m, PQ_INACTIVE); - vm_page_unlock(m); + vfs_vmio_unwire(bp, m); } - VM_OBJECT_WUNLOCK(bp->b_bufobj->bo_object); + if (obj != NULL) + VM_OBJECT_WUNLOCK(obj); bp->b_npages = desiredpages; } @@ -2478,11 +2459,12 @@ getnewbuf_reuse_bp(struct buf *bp, int q KASSERT((bp->b_flags & B_DELWRI) == 0, ("delwri buffer %p found in queue %d", bp, qindex)); + /* + * When recycling a clean buffer we have to truncate it and + * release the vnode. + */ if (qindex == QUEUE_CLEAN) { - if (bp->b_flags & B_VMIO) { - bp->b_flags &= ~B_ASYNC; - vfs_vmio_release(bp); - } + allocbuf(bp, 0); if (bp->b_vp != NULL) brelvp(bp); } @@ -2491,7 +2473,6 @@ getnewbuf_reuse_bp(struct buf *bp, int q * Get the rest of the buffer freed up. b_kva* is still valid * after this operation. */ - if (bp->b_rcred != NOCRED) { crfree(bp->b_rcred); bp->b_rcred = NOCRED; @@ -2508,9 +2489,8 @@ getnewbuf_reuse_bp(struct buf *bp, int q bp, bp->b_vp, qindex)); KASSERT((bp->b_xflags & (BX_VNCLEAN|BX_VNDIRTY)) == 0, ("bp: %p still on a buffer list. xflags %X", bp, bp->b_xflags)); - - if (bp->b_bufsize) - allocbuf(bp, 0); + KASSERT(bp->b_npages == 0, + ("bp: %p still has %d vm pages\n", bp, bp->b_npages)); bp->b_flags = 0; bp->b_ioflags = 0; @@ -3426,8 +3406,7 @@ loop: * cleared. If the size has not changed, B_CACHE remains * unchanged from its previous state. */ - if (bp->b_bcount != size) - allocbuf(bp, size); + allocbuf(bp, size); KASSERT(bp->b_offset != NOOFFSET, ("getblk: no buffer offset")); @@ -3678,6 +3657,9 @@ allocbuf(struct buf *bp, int size) BUF_ASSERT_HELD(bp); + if (bp->b_bcount == size) + return (1); + if (bp->b_kvasize != 0 && bp->b_kvasize < size) panic("allocbuf: buffer too small"); @@ -3716,7 +3698,7 @@ allocbuf(struct buf *bp, int size) bufspaceadjust(bp, newbsize); } bp->b_bcount = size; /* requested buffer size. */ - return 1; + return (1); } extern int inflight_transient_maps; From owner-svn-src-head@freebsd.org Sun Sep 27 05:29:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5570FA0AA9F; Sun, 27 Sep 2015 05:29:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 398391F8; Sun, 27 Sep 2015 05:29:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R5TbSf095551; Sun, 27 Sep 2015 05:29:37 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R5TYRf095540; Sun, 27 Sep 2015 05:29:34 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201509270529.t8R5TYRf095540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 27 Sep 2015 05:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288301 - in head/sys: net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 05:29:37 -0000 Author: melifaro Date: Sun Sep 27 05:29:34 2015 New Revision: 288301 URL: https://svnweb.freebsd.org/changeset/base/288301 Log: Eliminate nd6_nud_hint() and its TCP bindings. Initially function was introduced in r53541 (KAME initial commit) to "provide hints from upper layer protocols that indicate a connection is making "forward progress"" (quote from RFC 2461 7.3.1 Reachability Confirmation). However, it was converted to do nothing (e.g. just return) in r122922 (tcp_hostcache implementation) back in 2003. Some defines were moved to tcp_var.h in r169541. Then, it was broken (for non-corner cases) by r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, right now this code is broken and has no "real" base users. Differential Revision: https://reviews.freebsd.org/D3699 Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6.h head/sys/netinet6/nd6_nbr.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/net/if_llatbl.c Sun Sep 27 05:29:34 2015 (r288301) @@ -721,7 +721,6 @@ llatbl_lle_show(struct llentry_sa *la) db_printf(" la_flags=0x%04x\n", lle->la_flags); db_printf(" la_asked=%u\n", lle->la_asked); db_printf(" la_preempt=%u\n", lle->la_preempt); - db_printf(" ln_byhint=%u\n", lle->ln_byhint); db_printf(" ln_state=%d\n", lle->ln_state); db_printf(" ln_router=%u\n", lle->ln_router); db_printf(" ln_ntick=%ju\n", (uintmax_t)lle->ln_ntick); Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/net/if_llatbl.h Sun Sep 27 05:29:34 2015 (r288301) @@ -75,7 +75,6 @@ struct llentry { uint16_t la_flags; uint16_t la_asked; uint16_t la_preempt; - uint16_t ln_byhint; int16_t ln_state; /* IPv6 has ND6_LLINFO_NOSTATE == -2 */ uint16_t ln_router; time_t ln_ntick; Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_input.c Sun Sep 27 05:29:34 2015 (r288301) @@ -469,18 +469,6 @@ tcp_signature_verify_input(struct mbuf * } #endif -/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ -#ifdef INET6 -#define ND6_HINT(tp) \ -do { \ - if ((tp) && (tp)->t_inpcb && \ - ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \ - nd6_nud_hint(NULL, NULL, 0); \ -} while (0) -#else -#define ND6_HINT(tp) -#endif - /* * Indicate whether this ack should be delayed. We can delay the ack if * following conditions are met: @@ -1763,7 +1751,6 @@ tcp_do_segment(struct mbuf *m, struct tc tp->snd_wl2 = th->th_ack; tp->t_dupacks = 0; m_freem(m); - ND6_HINT(tp); /* Some progress has been made. */ /* * If all outstanding data are acked, stop @@ -1822,7 +1809,6 @@ tcp_do_segment(struct mbuf *m, struct tc tp->rcv_up = tp->rcv_nxt; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); - ND6_HINT(tp); /* Some progress has been made */ #ifdef TCPDEBUG if (so->so_options & SO_DEBUG) tcp_trace(TA_INPUT, ostate, tp, @@ -2924,7 +2910,6 @@ dodata: /* XXX */ thflags = th->th_flags & TH_FIN; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); - ND6_HINT(tp); SOCKBUF_LOCK(&so->so_rcv); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) m_freem(m); Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_reass.c Sun Sep 27 05:29:34 2015 (r288301) @@ -327,7 +327,6 @@ present: tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); - ND6_HINT(tp); sorwakeup_locked(so); return (flags); } Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet/tcp_var.h Sun Sep 27 05:29:34 2015 (r288301) @@ -83,18 +83,6 @@ struct tcptemp { #define tcp6cb tcpcb /* for KAME src sync over BSD*'s */ -/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */ -#ifdef INET6 -#define ND6_HINT(tp) \ -do { \ - if ((tp) && (tp)->t_inpcb && \ - ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0) \ - nd6_nud_hint(NULL, NULL, 0); \ -} while (0) -#else -#define ND6_HINT(tp) -#endif - /* * Tcp control block, one per tcp; fields: * Organized for 16 byte cacheline efficiency. Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6.c Sun Sep 27 05:29:34 2015 (r288301) @@ -1314,47 +1314,6 @@ nd6_free_redirect(const struct llentry * } /* - * Upper-layer reachability hint for Neighbor Unreachability Detection. - * - * XXX cost-effective methods? - */ -void -nd6_nud_hint(struct rtentry *rt, struct in6_addr *dst6, int force) -{ - struct llentry *ln; - struct ifnet *ifp; - - if ((dst6 == NULL) || (rt == NULL)) - return; - - ifp = rt->rt_ifp; - IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(dst6, LLE_EXCLUSIVE, NULL); - IF_AFDATA_RUNLOCK(ifp); - if (ln == NULL) - return; - - if (ln->ln_state < ND6_LLINFO_REACHABLE) - goto done; - - /* - * if we get upper-layer reachability confirmation many times, - * it is possible we have false information. - */ - if (!force) { - ln->ln_byhint++; - if (ln->ln_byhint > V_nd6_maxnudhint) { - goto done; - } - } - - nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); -done: - LLE_WUNLOCK(ln); -} - - -/* * Rejuvenate this function for routing operations related * processing. */ Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6.h Sun Sep 27 05:29:34 2015 (r288301) @@ -412,7 +412,6 @@ void nd6_llinfo_settimer(struct llentry void nd6_llinfo_settimer_locked(struct llentry *, long); void nd6_timer(void *); void nd6_purge(struct ifnet *); -void nd6_nud_hint(struct rtentry *, struct in6_addr *, int); int nd6_resolve(struct ifnet *, int, struct mbuf *, const struct sockaddr *, u_char *, uint32_t *); int nd6_ioctl(u_long, caddr_t, struct ifnet *); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sun Sep 27 05:26:22 2015 (r288300) +++ head/sys/netinet6/nd6_nbr.c Sun Sep 27 05:29:34 2015 (r288301) @@ -768,10 +768,9 @@ nd6_na_input(struct mbuf *m, int off, in bcopy(lladdr, &ln->ll_addr, ifp->if_addrlen); ln->la_flags |= LLE_VALID; EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); - if (is_solicited) { + if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); - ln->ln_byhint = 0; - } else + else nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); if ((ln->ln_router = is_router) != 0) { /* @@ -844,10 +843,9 @@ nd6_na_input(struct mbuf *m, int off, in * If not solicited and the link-layer address was * changed, make it STALE. */ - if (is_solicited) { - ln->ln_byhint = 0; + if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); - } else { + else { if (lladdr != NULL && llchange) nd6_llinfo_setstate(ln, ND6_LLINFO_STALE); } From owner-svn-src-head@freebsd.org Sun Sep 27 07:04:18 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57EC0A0AA8D; Sun, 27 Sep 2015 07:04:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47FDDFF0; Sun, 27 Sep 2015 07:04:18 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R74I3b036335; Sun, 27 Sep 2015 07:04:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R74Hcg036332; Sun, 27 Sep 2015 07:04:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509270704.t8R74Hcg036332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 27 Sep 2015 07:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288303 - head/contrib/netcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 07:04:18 -0000 Author: delphij Date: Sun Sep 27 07:04:16 2015 New Revision: 288303 URL: https://svnweb.freebsd.org/changeset/base/288303 Log: MFV r288243: nc from OpenBSD 5.8. Modified: head/contrib/netcat/nc.1 head/contrib/netcat/netcat.c head/contrib/netcat/socks.c Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/nc.1 ============================================================================== --- head/contrib/netcat/nc.1 Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/nc.1 Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.67 2014/02/26 20:56:11 claudio Exp $ +.\" $OpenBSD: nc.1,v 1.68 2015/03/26 10:35:04 tobias Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 11, 2014 +.Dd September 26, 2015 .Dt NC 1 .Os .Sh NAME @@ -133,7 +133,7 @@ connection to another program (e.g.\& .Xr ssh 1 using the .Xr ssh_config 5 -.Cm ProxyUseFdPass +.Cm ProxyUseFdpass option). .It Fl h Prints out Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/netcat.c Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.127 2015/02/14 22:40:22 jca Exp $ */ +/* $OpenBSD: netcat.c,v 1.130 2015/07/26 19:12:28 chl Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -52,15 +52,16 @@ #include #include #include +#include +#include #include #include +#include #include #include #include #include #include -#include -#include #include "atomicio.h" #ifndef SUN_LEN @@ -163,6 +164,8 @@ main(int argc, char *argv[]) uport = NULL; sv = NULL; + signal(SIGPIPE, SIG_IGN); + while ((ch = getopt_long(argc, argv, "46DdEe:FhI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z", longopts, NULL)) != -1) { @@ -1042,7 +1045,6 @@ fdpass(int nfd) bzero(&mh, sizeof(mh)); bzero(&cmsgbuf, sizeof(cmsgbuf)); bzero(&iov, sizeof(iov)); - bzero(&pfd, sizeof(pfd)); mh.msg_control = (caddr_t)&cmsgbuf.buf; mh.msg_controllen = sizeof(cmsgbuf.buf); @@ -1059,17 +1061,17 @@ fdpass(int nfd) bzero(&pfd, sizeof(pfd)); pfd.fd = STDOUT_FILENO; + pfd.events = POLLOUT; for (;;) { r = sendmsg(STDOUT_FILENO, &mh, 0); if (r == -1) { if (errno == EAGAIN || errno == EINTR) { - pfd.events = POLLOUT; if (poll(&pfd, 1, -1) == -1) err(1, "poll"); continue; } err(1, "sendmsg"); - } else if (r == -1) + } else if (r != 1) errx(1, "sendmsg: unexpected return value %zd", r); else break; Modified: head/contrib/netcat/socks.c ============================================================================== --- head/contrib/netcat/socks.c Sun Sep 27 05:45:16 2015 (r288302) +++ head/contrib/netcat/socks.c Sun Sep 27 07:04:16 2015 (r288303) @@ -1,4 +1,4 @@ -/* $OpenBSD: socks.c,v 1.20 2012/03/08 09:56:28 espie Exp $ */ +/* $OpenBSD: socks.c,v 1.21 2015/03/26 21:19:51 tobias Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. @@ -308,8 +308,8 @@ socks_connect(const char *host, const ch } /* Terminate headers */ - if ((r = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2) - err(1, "write failed (2/%d)", r); + if ((cnt = atomicio(vwrite, proxyfd, "\r\n", 2)) != 2) + err(1, "write failed (%zu/2)", cnt); /* Read status reply */ proxy_read_line(proxyfd, buf, sizeof(buf)); From owner-svn-src-head@freebsd.org Sun Sep 27 07:40:20 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453749D0EEA; Sun, 27 Sep 2015 07:40:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36115F13; Sun, 27 Sep 2015 07:40:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R7eKuc049122; Sun, 27 Sep 2015 07:40:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R7eKqR049121; Sun, 27 Sep 2015 07:40:20 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270740.t8R7eKqR049121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 07:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288304 - head/sys/modules/netgraph X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 07:40:20 -0000 Author: ngie Date: Sun Sep 27 07:40:19 2015 New Revision: 288304 URL: https://svnweb.freebsd.org/changeset/base/288304 Log: Enable parallel subdirectory building with sys/modules/netgraph MFC after: 2 weeks Modified: head/sys/modules/netgraph/Makefile Modified: head/sys/modules/netgraph/Makefile ============================================================================== --- head/sys/modules/netgraph/Makefile Sun Sep 27 07:04:16 2015 (r288303) +++ head/sys/modules/netgraph/Makefile Sun Sep 27 07:40:19 2015 (r288304) @@ -62,4 +62,6 @@ _bluetooth= bluetooth _mppc= mppc .endif +SUBDIR_PARALLEL= + .include From owner-svn-src-head@freebsd.org Sun Sep 27 07:51:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AA99A0A7F8; Sun, 27 Sep 2015 07:51:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEB8583B; Sun, 27 Sep 2015 07:51:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R7pNWI055675; Sun, 27 Sep 2015 07:51:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R7pJ0B055658; Sun, 27 Sep 2015 07:51:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509270751.t8R7pJ0B055658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 27 Sep 2015 07:51:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288305 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 07:51:24 -0000 Author: ngie Date: Sun Sep 27 07:51:18 2015 New Revision: 288305 URL: https://svnweb.freebsd.org/changeset/base/288305 Log: Replace N #defines with nitems to simplify ifconfig code slightly MFC after: 1 week Modified: head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/carp.c head/sbin/ifconfig/ifbridge.c head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/iffib.c head/sbin/ifconfig/ifgre.c head/sbin/ifconfig/ifgroup.c head/sbin/ifconfig/ifieee80211.c head/sbin/ifconfig/iflagg.c head/sbin/ifconfig/ifmac.c head/sbin/ifconfig/ifmedia.c head/sbin/ifconfig/ifpfsync.c head/sbin/ifconfig/ifvlan.c head/sbin/ifconfig/ifvxlan.c Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/af_inet6.c Sun Sep 27 07:51:18 2015 (r288305) @@ -521,7 +521,6 @@ static struct option in6_Lopt = { static __constructor void inet6_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; #ifndef RESCUE @@ -529,9 +528,8 @@ inet6_ctor(void) return; #endif - for (i = 0; i < N(inet6_cmds); i++) + for (i = 0; i < nitems(inet6_cmds); i++) cmd_register(&inet6_cmds[i]); af_register(&af_inet6); opt_register(&in6_Lopt); -#undef N } Modified: head/sbin/ifconfig/carp.c ============================================================================== --- head/sbin/ifconfig/carp.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/carp.c Sun Sep 27 07:51:18 2015 (r288305) @@ -217,11 +217,9 @@ static struct afswtch af_carp = { static __constructor void carp_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(carp_cmds); i++) + for (i = 0; i < nitems(carp_cmds); i++) cmd_register(&carp_cmds[i]); af_register(&af_carp); -#undef N } Modified: head/sbin/ifconfig/ifbridge.c ============================================================================== --- head/sbin/ifconfig/ifbridge.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifbridge.c Sun Sep 27 07:51:18 2015 (r288305) @@ -749,11 +749,9 @@ static struct afswtch af_bridge = { static __constructor void bridge_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(bridge_cmds); i++) + for (i = 0; i < nitems(bridge_cmds); i++) cmd_register(&bridge_cmds[i]); af_register(&af_bridge); -#undef N } Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifclone.c Sun Sep 27 07:51:18 2015 (r288305) @@ -32,9 +32,9 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include +#include #include +#include #include #include @@ -184,11 +184,9 @@ static struct option clone_Copt = { .opt static __constructor void clone_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(clone_cmds); i++) + for (i = 0; i < nitems(clone_cmds); i++) cmd_register(&clone_cmds[i]); opt_register(&clone_Copt); -#undef N } Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifconfig.c Sun Sep 27 07:51:18 2015 (r288305) @@ -43,11 +43,11 @@ static const char rcsid[] = #include #include -#include -#include #include #include #include +#include +#include #include #include @@ -604,7 +604,6 @@ cmd_register(struct cmd *p) static const struct cmd * cmd_lookup(const char *name, int iscreate) { -#define N(a) (sizeof(a)/sizeof(a[0])) const struct cmd *p; for (p = cmds; p != NULL; p = p->c_next) @@ -618,7 +617,6 @@ cmd_lookup(const char *name, int iscreat } } return NULL; -#undef N } struct callback { @@ -1387,10 +1385,8 @@ static struct cmd basic_cmds[] = { static __constructor void ifconfig_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(basic_cmds); i++) + for (i = 0; i < nitems(basic_cmds); i++) cmd_register(&basic_cmds[i]); -#undef N } Modified: head/sbin/ifconfig/iffib.c ============================================================================== --- head/sbin/ifconfig/iffib.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/iffib.c Sun Sep 27 07:51:18 2015 (r288305) @@ -113,11 +113,9 @@ static struct afswtch af_fib = { static __constructor void fib_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(fib_cmds); i++) + for (i = 0; i < nitems(fib_cmds); i++) cmd_register(&fib_cmds[i]); af_register(&af_fib); -#undef N } Modified: head/sbin/ifconfig/ifgre.c ============================================================================== --- head/sbin/ifconfig/ifgre.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifgre.c Sun Sep 27 07:51:18 2015 (r288305) @@ -113,11 +113,9 @@ static struct afswtch af_gre = { static __constructor void gre_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(gre_cmds); i++) + for (i = 0; i < nitems(gre_cmds); i++) cmd_register(&gre_cmds[i]); af_register(&af_gre); -#undef N } Modified: head/sbin/ifconfig/ifgroup.c ============================================================================== --- head/sbin/ifconfig/ifgroup.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifgroup.c Sun Sep 27 07:51:18 2015 (r288305) @@ -28,7 +28,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include +#include #include #include #include @@ -174,12 +174,10 @@ static struct option group_gopt = { "g:" static __constructor void group_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(group_cmds); i++) + for (i = 0; i < nitems(group_cmds); i++) cmd_register(&group_cmds[i]); af_register(&af_group); opt_register(&group_gopt); -#undef N } Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifieee80211.c Sun Sep 27 07:51:18 2015 (r288305) @@ -2856,7 +2856,6 @@ printrsnie(const char *tag, const u_int8 static void printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen) { -#define N(a) (sizeof(a) / sizeof(a[0])) u_int8_t len = ie[1]; printf("%s", tag); @@ -2897,7 +2896,7 @@ printwpsie(const char *tag, const u_int8 break; case IEEE80211_WPS_DEV_PASS_ID: n = LE_READ_2(ie); - if (n < N(dev_pass_id)) + if (n < nitems(dev_pass_id)) printf(" dpi:%s", dev_pass_id[n]); break; case IEEE80211_WPS_UUID_E: @@ -2911,7 +2910,6 @@ printwpsie(const char *tag, const u_int8 } printf(">"); } -#undef N } static void @@ -3418,7 +3416,6 @@ list_stations(int s) static const char * mesh_linkstate_string(uint8_t state) { -#define N(a) (sizeof(a) / sizeof(a[0])) static const char *state_names[] = { [0] = "IDLE", [1] = "OPEN-TX", @@ -3428,13 +3425,12 @@ mesh_linkstate_string(uint8_t state) [5] = "HOLDING", }; - if (state >= N(state_names)) { + if (state >= nitems(state_names)) { static char buf[10]; snprintf(buf, sizeof(buf), "#%u", state); return buf; } else return state_names[state]; -#undef N } static const char * @@ -5320,12 +5316,10 @@ static struct afswtch af_ieee80211 = { static __constructor void ieee80211_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(ieee80211_cmds); i++) + for (i = 0; i < nitems(ieee80211_cmds); i++) cmd_register(&ieee80211_cmds[i]); af_register(&af_ieee80211); clone_setdefcallback("wlan", wlan_create); -#undef N } Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/iflagg.c Sun Sep 27 07:51:18 2015 (r288305) @@ -308,11 +308,9 @@ static struct afswtch af_lagg = { static __constructor void lagg_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(lagg_cmds); i++) + for (i = 0; i < nitems(lagg_cmds); i++) cmd_register(&lagg_cmds[i]); af_register(&af_lagg); -#undef N } Modified: head/sbin/ifconfig/ifmac.c ============================================================================== --- head/sbin/ifconfig/ifmac.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifmac.c Sun Sep 27 07:51:18 2015 (r288305) @@ -111,11 +111,9 @@ static struct afswtch af_mac = { static __constructor void mac_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(mac_cmds); i++) + for (i = 0; i < nitems(mac_cmds); i++) cmd_register(&mac_cmds[i]); af_register(&af_mac); -#undef N } Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifmedia.c Sun Sep 27 07:51:18 2015 (r288305) @@ -845,11 +845,9 @@ static struct afswtch af_media = { static __constructor void ifmedia_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(media_cmds); i++) + for (i = 0; i < nitems(media_cmds); i++) cmd_register(&media_cmds[i]); af_register(&af_media); -#undef N } Modified: head/sbin/ifconfig/ifpfsync.c ============================================================================== --- head/sbin/ifconfig/ifpfsync.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifpfsync.c Sun Sep 27 07:51:18 2015 (r288305) @@ -26,7 +26,7 @@ * $FreeBSD$ */ -#include +#include #include #include @@ -227,11 +227,9 @@ static struct afswtch af_pfsync = { static __constructor void pfsync_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) int i; - for (i = 0; i < N(pfsync_cmds); i++) + for (i = 0; i < nitems(pfsync_cmds); i++) cmd_register(&pfsync_cmds[i]); af_register(&af_pfsync); -#undef N } Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifvlan.c Sun Sep 27 07:51:18 2015 (r288305) @@ -194,13 +194,11 @@ static struct afswtch af_vlan = { static __constructor void vlan_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(vlan_cmds); i++) + for (i = 0; i < nitems(vlan_cmds); i++) cmd_register(&vlan_cmds[i]); af_register(&af_vlan); callback_register(vlan_cb, NULL); clone_setdefcallback("vlan", vlan_create); -#undef N } Modified: head/sbin/ifconfig/ifvxlan.c ============================================================================== --- head/sbin/ifconfig/ifvxlan.c Sun Sep 27 07:40:19 2015 (r288304) +++ head/sbin/ifconfig/ifvxlan.c Sun Sep 27 07:51:18 2015 (r288305) @@ -635,13 +635,11 @@ static struct afswtch af_vxlan = { static __constructor void vxlan_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(vxlan_cmds); i++) + for (i = 0; i < nitems(vxlan_cmds); i++) cmd_register(&vxlan_cmds[i]); af_register(&af_vxlan); callback_register(vxlan_cb, NULL); clone_setdefcallback("vxlan", vxlan_create); -#undef N } From owner-svn-src-head@freebsd.org Sun Sep 27 09:15:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFEA8A0A659; Sun, 27 Sep 2015 09:15:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFEF033D; Sun, 27 Sep 2015 09:15:56 +0000 (UTC) (envelope-from mr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8R9FuxO089165; Sun, 27 Sep 2015 09:15:56 GMT (envelope-from mr@FreeBSD.org) Received: (from mr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8R9FsEi089158; Sun, 27 Sep 2015 09:15:54 GMT (envelope-from mr@FreeBSD.org) Message-Id: <201509270915.t8R9FsEi089158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mr set sender to mr@FreeBSD.org using -f From: Michael Reifenberger Date: Sun, 27 Sep 2015 09:15:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288306 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 09:15:57 -0000 Author: mr Date: Sun Sep 27 09:15:54 2015 New Revision: 288306 URL: https://svnweb.freebsd.org/changeset/base/288306 Log: Add support to systat to display zfs arc cache status/info PR: 195460 Submitted by: ota Added: head/usr.bin/systat/zarc.c (contents, props changed) Modified: head/usr.bin/systat/Makefile head/usr.bin/systat/cmdtab.c head/usr.bin/systat/extern.h head/usr.bin/systat/main.c head/usr.bin/systat/systat.1 head/usr.bin/systat/systat.h Modified: head/usr.bin/systat/Makefile ============================================================================== --- head/usr.bin/systat/Makefile Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/Makefile Sun Sep 27 09:15:54 2015 (r288306) @@ -6,7 +6,7 @@ PROG= systat SRCS= cmds.c cmdtab.c devs.c fetch.c iostat.c keyboard.c main.c \ netcmds.c netstat.c pigs.c swap.c icmp.c \ - mode.c ip.c tcp.c \ + mode.c ip.c tcp.c zarc.c \ vmstat.c convtbl.c ifcmds.c ifstat.c .if ${MK_INET6_SUPPORT} != "no" Modified: head/usr.bin/systat/cmdtab.c ============================================================================== --- head/usr.bin/systat/cmdtab.c Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/cmdtab.c Sun Sep 27 09:15:54 2015 (r288306) @@ -75,6 +75,9 @@ struct cmdtab cmdtab[] = { { "ifstat", showifstat, fetchifstat, labelifstat, initifstat, openifstat, closeifstat, cmdifstat, 0, CF_LOADAV }, + { "zarc", showzarc, fetchzarc, labelzarc, + initzarc, openzarc, closezarc, 0, + resetzarc, CF_ZFSARC }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0 } }; struct cmdtab *curcmd = &cmdtab[0]; Modified: head/usr.bin/systat/extern.h ============================================================================== --- head/usr.bin/systat/extern.h Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/extern.h Sun Sep 27 09:15:54 2015 (r288306) @@ -163,3 +163,14 @@ void showtcp(void); void status(void); void suspend(int); char *sysctl_dynread(const char *, size_t *); + +#define SYSTAT_CMD(name) \ + void close ## name(WINDOW *); \ + void fetch ## name(void); \ + int init ## name(void); \ + void label ## name(void); \ + WINDOW *open ## name(void); \ + void reset ## name(void); \ + void show ## name(void) + +SYSTAT_CMD( zarc ); Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/main.c Sun Sep 27 09:15:54 2015 (r288306) @@ -243,6 +243,11 @@ labels(void) "/0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10"); mvaddstr(1, 5, "Load Average"); } + if (curcmd->c_flags & CF_ZFSARC) { + mvaddstr(0, 20, + " Total MFU MRU Anon Hdr L2Hdr Other"); + mvaddstr(1, 5, "ZFS ARC "); + } (*curcmd->c_label)(); #ifdef notdef mvprintw(21, 25, "CPU usage on %s", hostname); @@ -276,8 +281,33 @@ display(void) if (j > 50) wprintw(wload, " %4.1f", avenrun[0]); } + if (curcmd->c_flags & CF_ZFSARC) { + uint64_t arc[7] = {}; + size_t size = sizeof(arc[0]); + if (sysctlbyname("kstat.zfs.misc.arcstats.size", + &arc[0], &size, NULL, 0) == 0 ) { + GETSYSCTL("vfs.zfs.mfu_size", arc[1]); + GETSYSCTL("vfs.zfs.mru_size", arc[2]); + GETSYSCTL("vfs.zfs.anon_size", arc[3]); + GETSYSCTL("kstat.zfs.misc.arcstats.hdr_size", arc[4]); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]); + GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]); + wmove(wload, 0, 0); wclrtoeol(wload); + for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) { + if (arc[i] > 10llu * 1024 * 1024 * 1024 ) { + wprintw(wload, "%7lluG", arc[i] >> 30); + } + else if (arc[i] > 10 * 1024 * 1024 ) { + wprintw(wload, "%7lluM", arc[i] >> 20); + } + else { + wprintw(wload, "%7lluK", arc[i] >> 10); + } + } + } + } (*curcmd->c_refresh)(); - if (curcmd->c_flags & CF_LOADAV) + if (curcmd->c_flags & (CF_LOADAV |CF_ZFSARC)) wrefresh(wload); wrefresh(wnd); move(CMDLINE, col); Modified: head/usr.bin/systat/systat.1 ============================================================================== --- head/usr.bin/systat/systat.1 Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/systat.1 Sun Sep 27 09:15:54 2015 (r288306) @@ -98,8 +98,9 @@ to be one of: .Ic pigs , .Ic swap , .Ic tcp , +.Ic vmstat , or -.Ic vmstat . +.Ic zarc , These displays can also be requested interactively (without the .Dq Fl ) and are described in @@ -441,6 +442,8 @@ Display statistics averaged over the ref .It Cm zero Reset running statistics to zero. .El +.It Ic zarc +display arc cache usage and hit/miss statistics. .It Ic netstat Display, in the lower window, network connections. By default, Modified: head/usr.bin/systat/systat.h ============================================================================== --- head/usr.bin/systat/systat.h Sun Sep 27 07:51:18 2015 (r288305) +++ head/usr.bin/systat/systat.h Sun Sep 27 09:15:54 2015 (r288306) @@ -54,6 +54,7 @@ extern int use_kvm; #define CF_INIT 0x1 /* been initialized */ #define CF_LOADAV 0x2 /* display w/ load average */ +#define CF_ZFSARC 0x4 /* display w/ ZFS cache usage */ #define TCP 0x1 #define UDP 0x2 Added: head/usr.bin/systat/zarc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/systat/zarc.c Sun Sep 27 09:15:54 2015 (r288306) @@ -0,0 +1,221 @@ +/*- + * Copyright (c) 2014 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include "systat.h" +#include "extern.h" + +struct zfield{ + uint64_t arcstats; + uint64_t arcstats_demand_data; + uint64_t arcstats_demand_metadata; + uint64_t arcstats_prefetch_data; + uint64_t arcstats_prefetch_metadata; + uint64_t zfetchstats; + uint64_t arcstats_l2; + uint64_t vdev_cache_stats; +}; + +static struct zarcstats { + struct zfield hits; + struct zfield misses; +} curstat, initstat, oldstat; + +static void +getinfo(struct zarcstats *ls); + +WINDOW * +openzarc(void) +{ + return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); +} + +void +closezarc(WINDOW *w) +{ + if (w == NULL) + return; + wclear(w); + wrefresh(w); + delwin(w); +} + +void +labelzarc(void) +{ + wmove(wnd, 0, 0); wclrtoeol(wnd); + mvwprintw(wnd, 0, 31+1, "%4.4s %7.7s %7.7s %12.12s %12.12s", + "rate", "hits", "misses", "total hits", "total misses"); +#define L(row, str) mvwprintw(wnd, row, 5, str); \ + mvwprintw(wnd, row, 31, ":"); \ + mvwprintw(wnd, row, 31+4, "%%") + L(1, "arcstats"); + L(2, "arcstats.demand_data"); + L(3, "arcstats.demand_metadata"); + L(4, "arcstats.prefetch_data"); + L(5, "arcstats.prefetch_metadata"); + L(6, "zfetchstats"); + L(7, "arcstats.l2"); + L(8, "vdev_cache_stats"); +#undef L +} + +static int calc(uint64_t hits, uint64_t misses) +{ + if( hits ) + return 100 * hits / ( hits + misses ); + else + return 0; +} + +static void +domode(struct zarcstats *delta, struct zarcstats *rate) +{ +#define DO(stat) \ + delta->hits.stat = (curstat.hits.stat - oldstat.hits.stat); \ + delta->misses.stat = (curstat.misses.stat - oldstat.misses.stat); \ + rate->hits.stat = calc(delta->hits.stat, delta->misses.stat) + DO(arcstats); + DO(arcstats_demand_data); + DO(arcstats_demand_metadata); + DO(arcstats_prefetch_data); + DO(arcstats_prefetch_metadata); + DO(zfetchstats); + DO(arcstats_l2); + DO(vdev_cache_stats); + DO(arcstats); + DO(arcstats_demand_data); + DO(arcstats_demand_metadata); + DO(arcstats_prefetch_data); + DO(arcstats_prefetch_metadata); + DO(zfetchstats); + DO(arcstats_l2); + DO(vdev_cache_stats); +#undef DO +} + +void +showzarc(void) +{ + struct zarcstats delta, rate; + + memset(&delta, 0, sizeof delta); + memset(&rate, 0, sizeof rate); + + domode(&delta, &rate); + +#define DO(stat, row, col, fmt) \ + mvwprintw(wnd, row, col, fmt, stat) +#define R(row, stat) DO(rate.hits.stat, row, 31+1, "%3lu") +#define H(row, stat) DO(delta.hits.stat, row, 31+1+5, "%7lu"); \ + DO(curstat.hits.stat, row, 31+1+5+8+8, "%12lu") +#define M(row, stat) DO(delta.misses.stat, row, 31+1+5+8, "%7lu"); \ + DO(curstat.misses.stat, row, 31+1+5+8+8+13, "%12lu") +#define E(row, stat) R(row, stat); H(row, stat); M(row, stat); + E(1, arcstats); + E(2, arcstats_demand_data); + E(3, arcstats_demand_metadata); + E(4, arcstats_prefetch_data); + E(5, arcstats_prefetch_metadata); + E(6, zfetchstats); + E(7, arcstats_l2); + E(8, vdev_cache_stats); +#undef DO +#undef E +#undef M +#undef H +#undef R +} + +int +initzarc(void) +{ + getinfo(&initstat); + curstat = oldstat = initstat; + return 1; +} + +void +resetzarc(void) +{ + initzarc(); +} + +static void +getinfo(struct zarcstats *ls) +{ + size_t size = sizeof( ls->hits.arcstats ); + if ( sysctlbyname("kstat.zfs.misc.arcstats.hits", + &ls->hits.arcstats, &size, NULL, 0 ) != 0 ) + return; + GETSYSCTL("kstat.zfs.misc.arcstats.misses", + ls->misses.arcstats); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_hits", + ls->hits.arcstats_demand_data); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_data_misses", + ls->misses.arcstats_demand_data); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_hits", + ls->hits.arcstats_demand_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.demand_metadata_misses", + ls->misses.arcstats_demand_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_hits", + ls->hits.arcstats_prefetch_data); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_data_misses", + ls->misses.arcstats_prefetch_data); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_hits", + ls->hits.arcstats_prefetch_metadata); + GETSYSCTL("kstat.zfs.misc.arcstats.prefetch_metadata_misses", + ls->misses.arcstats_prefetch_metadata); + GETSYSCTL("kstat.zfs.misc.zfetchstats.hits", + ls->hits.zfetchstats); + GETSYSCTL("kstat.zfs.misc.zfetchstats.misses", + ls->misses.zfetchstats); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_hits", + ls->hits.arcstats_l2); + GETSYSCTL("kstat.zfs.misc.arcstats.l2_misses", + ls->misses.arcstats_l2); + GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.hits", + ls->hits.vdev_cache_stats); + GETSYSCTL("kstat.zfs.misc.vdev_cache_stats.misses", + ls->misses.vdev_cache_stats); +} + +void +fetchzarc(void) +{ + oldstat = curstat; + getinfo(&curstat); +} From owner-svn-src-head@freebsd.org Sun Sep 27 12:17:04 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 912DEA0ACA4; Sun, 27 Sep 2015 12:17:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8206B259; Sun, 27 Sep 2015 12:17:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCH4jO063260; Sun, 27 Sep 2015 12:17:04 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCH4Zi063259; Sun, 27 Sep 2015 12:17:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201509271217.t8RCH4Zi063259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 27 Sep 2015 12:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288307 - head/sys/dev/nxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 12:17:04 -0000 Author: bz Date: Sun Sep 27 12:17:03 2015 New Revision: 288307 URL: https://svnweb.freebsd.org/changeset/base/288307 Log: Compare the correct variable to see if memory allocation succeeded. I don't even want to know where the symbol "version" comes from. Spotted by: reading kernel compile time log MFC after: 2 weeks Modified: head/sys/dev/nxge/if_nxge.c Modified: head/sys/dev/nxge/if_nxge.c ============================================================================== --- head/sys/dev/nxge/if_nxge.c Sun Sep 27 09:15:54 2015 (r288306) +++ head/sys/dev/nxge/if_nxge.c Sun Sep 27 12:17:03 2015 (r288307) @@ -1457,7 +1457,7 @@ xge_ioctl_stats(xge_lldev_t *lldev, stru case XGE_READ_VERSION: info = xge_os_malloc(NULL, XGE_BUFFER_SIZE); - if(version != NULL) { + if(info != NULL) { strcpy(info, XGE_DRIVER_VERSION); if(copyout(info, ifreqp->ifr_data, XGE_BUFFER_SIZE) == 0) retValue = 0; From owner-svn-src-head@freebsd.org Sun Sep 27 12:19:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA69FA0AE17; Sun, 27 Sep 2015 12:19:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B28F62F; Sun, 27 Sep 2015 12:19:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCJbIJ063405; Sun, 27 Sep 2015 12:19:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCJb1m063403; Sun, 27 Sep 2015 12:19:37 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201509271219.t8RCJb1m063403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 27 Sep 2015 12:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288308 - head/sys/dev/nxge/xgehal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 12:19:37 -0000 Author: bz Date: Sun Sep 27 12:19:36 2015 New Revision: 288308 URL: https://svnweb.freebsd.org/changeset/base/288308 Log: Fix what looks like a consistent copy&paste error. Don't make an integer to a boolean and then compare to a value which needs an integer comparison. Spotted by: reading kernel compile time log MFC after: 2 weeks Modified: head/sys/dev/nxge/xgehal/xgehal-fifo.c head/sys/dev/nxge/xgehal/xgehal-ring.c Modified: head/sys/dev/nxge/xgehal/xgehal-fifo.c ============================================================================== --- head/sys/dev/nxge/xgehal/xgehal-fifo.c Sun Sep 27 12:17:03 2015 (r288307) +++ head/sys/dev/nxge/xgehal/xgehal-fifo.c Sun Sep 27 12:19:36 2015 (r288308) @@ -464,7 +464,7 @@ __hal_fifo_hw_initialize(xge_hal_device_ if (!hldev->config.fifo.queue[i].configured || !hldev->config.fifo.queue[i].intr_vector || - !hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) + hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) continue; /* find channel */ Modified: head/sys/dev/nxge/xgehal/xgehal-ring.c ============================================================================== --- head/sys/dev/nxge/xgehal/xgehal-ring.c Sun Sep 27 12:17:03 2015 (r288307) +++ head/sys/dev/nxge/xgehal/xgehal-ring.c Sun Sep 27 12:19:36 2015 (r288308) @@ -609,7 +609,7 @@ __hal_ring_hw_initialize(xge_hal_device_ if (!hldev->config.ring.queue[i].configured || !hldev->config.ring.queue[i].intr_vector || - !hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) + hldev->config.intr_mode != XGE_HAL_INTR_MODE_MSIX) continue; /* find channel */ From owner-svn-src-head@freebsd.org Sun Sep 27 12:26:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32F96A0A92C; Sun, 27 Sep 2015 12:26:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E266EC65; Sun, 27 Sep 2015 12:26:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 5197F25D387C; Sun, 27 Sep 2015 12:26:53 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 60783C770BD; Sun, 27 Sep 2015 12:26:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id MjVqNRmBDXo3; Sun, 27 Sep 2015 12:26:50 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1CFE1C770B3; Sun, 27 Sep 2015 12:26:49 +0000 (UTC) Date: Sun, 27 Sep 2015 12:26:48 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Alexander V. Chernikov" , George Neville-Neil cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288301 - in head/sys: net netinet netinet6 In-Reply-To: <201509270529.t8R5TYRf095540@repo.freebsd.org> Message-ID: References: <201509270529.t8R5TYRf095540@repo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 12:26:56 -0000 On Sun, 27 Sep 2015, Alexander V. Chernikov wrote: > Author: melifaro > Date: Sun Sep 27 05:29:34 2015 > New Revision: 288301 > URL: https://svnweb.freebsd.org/changeset/base/288301 > > Log: > Eliminate nd6_nud_hint() and its TCP bindings. > > Initially function was introduced in r53541 (KAME initial commit) to > "provide hints from upper layer protocols that indicate a connection > is making "forward progress"" (quote from RFC 2461 7.3.1 Reachability > Confirmation). > However, it was converted to do nothing (e.g. just return) in r122922 > (tcp_hostcache implementation) back in 2003. Some defines were moved > to tcp_var.h in r169541. Then, it was broken (for non-corner cases) > by r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, > right now this code is broken and has no "real" base users. > > Differential Revision: https://reviews.freebsd.org/D3699 PR: 165692 It would be nice to have the feature back though it would be very expensive locking wise if it'd remain a per-packet operation. -- Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@freebsd.org Sun Sep 27 12:52:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 817D99CFAFF; Sun, 27 Sep 2015 12:52:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 659339B5; Sun, 27 Sep 2015 12:52:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RCqJkk079338; Sun, 27 Sep 2015 12:52:19 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RCqJqO079337; Sun, 27 Sep 2015 12:52:19 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509271252.t8RCqJqO079337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 27 Sep 2015 12:52:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288309 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 12:52:19 -0000 Author: jilles Date: Sun Sep 27 12:52:18 2015 New Revision: 288309 URL: https://svnweb.freebsd.org/changeset/base/288309 Log: fnmatch(): Remove exponential behaviour as in sh r229201. The old code was exponential in the number of asterisks in the pattern. However, once a match has been found upto the next asterisk, the previous asterisks are no longer relevant. Modified: head/lib/libc/gen/fnmatch.c Modified: head/lib/libc/gen/fnmatch.c ============================================================================== --- head/lib/libc/gen/fnmatch.c Sun Sep 27 12:19:36 2015 (r288308) +++ head/lib/libc/gen/fnmatch.c Sun Sep 27 12:52:18 2015 (r288309) @@ -87,11 +87,14 @@ static int fnmatch1(const char *pattern, const char *string, const char *stringstart, int flags, mbstate_t patmbs, mbstate_t strmbs) { + const char *bt_pattern, *bt_string; + mbstate_t bt_patmbs, bt_strmbs; char *newp; char c; wchar_t pc, sc; size_t pclen, sclen; + bt_pattern = bt_string = NULL; for (;;) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); if (pclen == (size_t)-1 || pclen == (size_t)-2) @@ -107,16 +110,18 @@ fnmatch1(const char *pattern, const char case EOS: if ((flags & FNM_LEADING_DIR) && sc == '/') return (0); - return (sc == EOS ? 0 : FNM_NOMATCH); + if (sc == EOS) + return (0); + goto backtrack; case '?': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; string += sclen; break; case '*': @@ -128,7 +133,7 @@ fnmatch1(const char *pattern, const char if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; /* Optimize for pattern with * at end or before /. */ if (c == EOS) @@ -144,33 +149,24 @@ fnmatch1(const char *pattern, const char break; } - /* General case, use recursion. */ - while (sc != EOS) { - if (!fnmatch1(pattern, string, stringstart, - flags, patmbs, strmbs)) - return (0); - sclen = mbrtowc(&sc, string, MB_LEN_MAX, - &strmbs); - if (sclen == (size_t)-1 || - sclen == (size_t)-2) { - sc = (unsigned char)*string; - sclen = 1; - memset(&strmbs, 0, sizeof(strmbs)); - } - if (sc == '/' && flags & FNM_PATHNAME) - break; - string += sclen; - } - return (FNM_NOMATCH); + /* + * First try the shortest match for the '*' that + * could work. We can forget any earlier '*' since + * there is no way having it match more characters + * can help us, given that we are already here. + */ + bt_pattern = pattern, bt_patmbs = patmbs; + bt_string = string, bt_strmbs = strmbs; + break; case '[': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; switch (rangematch(pattern, sc, flags, &newp, &patmbs)) { @@ -180,7 +176,7 @@ fnmatch1(const char *pattern, const char pattern = newp; break; case RANGE_NOMATCH: - return (FNM_NOMATCH); + goto backtrack; } string += sclen; break; @@ -195,14 +191,39 @@ fnmatch1(const char *pattern, const char /* FALLTHROUGH */ default: norm: + string += sclen; if (pc == sc) ; else if ((flags & FNM_CASEFOLD) && (towlower(pc) == towlower(sc))) ; - else - return (FNM_NOMATCH); - string += sclen; + else { + backtrack: + /* + * If we have a mismatch (other than hitting + * the end of the string), go back to the last + * '*' seen and have it match one additional + * character. + */ + if (bt_pattern == NULL) + return (FNM_NOMATCH); + sclen = mbrtowc(&sc, bt_string, MB_LEN_MAX, + &bt_strmbs); + if (sclen == (size_t)-1 || + sclen == (size_t)-2) { + sc = (unsigned char)*bt_string; + sclen = 1; + memset(&bt_strmbs, 0, + sizeof(bt_strmbs)); + } + if (sc == EOS) + return (FNM_NOMATCH); + if (sc == '/' && flags & FNM_PATHNAME) + return (FNM_NOMATCH); + bt_string += sclen; + pattern = bt_pattern, patmbs = bt_patmbs; + string = bt_string, strmbs = bt_strmbs; + } break; } } From owner-svn-src-head@freebsd.org Sun Sep 27 13:47:30 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E927EA0AE99; Sun, 27 Sep 2015 13:47:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D84FFFD; Sun, 27 Sep 2015 13:47:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RDlULD099835; Sun, 27 Sep 2015 13:47:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RDlT2S099825; Sun, 27 Sep 2015 13:47:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509271347.t8RDlT2S099825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Sep 2015 13:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288310 - in head: share/man/man4 sys/cam/ctl sys/cam/scsi usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 13:47:31 -0000 Author: mav Date: Sun Sep 27 13:47:28 2015 New Revision: 288310 URL: https://svnweb.freebsd.org/changeset/base/288310 Log: Add to CTL initial support for CDROMs and removable devices. Relnotes: yes Modified: head/share/man/man4/ctl.4 head/sys/cam/ctl/README.ctl.txt head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_cd.h head/usr.sbin/ctladm/ctladm.8 head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/share/man/man4/ctl.4 ============================================================================== --- head/share/man/man4/ctl.4 Sun Sep 27 12:52:18 2015 (r288309) +++ head/share/man/man4/ctl.4 Sun Sep 27 13:47:28 2015 (r288310) @@ -24,7 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 12, 2015 +.Dd September 27, 2015 .Dt CTL 4 .Os .Sh NAME @@ -53,7 +53,7 @@ It supports features such as: .Pp .Bl -bullet -compact .It -Disk and processor device emulation +Disk, processor and cdrom device emulation .It Tagged queueing .It Modified: head/sys/cam/ctl/README.ctl.txt ============================================================================== --- head/sys/cam/ctl/README.ctl.txt Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/README.ctl.txt Sun Sep 27 13:47:28 2015 (r288310) @@ -19,9 +19,9 @@ Userland Commands Introduction: ============ -CTL is a disk and processor device emulation subsystem originally written -for Copan Systems under Linux starting in 2003. It has been shipping in -Copan (now SGI) products since 2005. +CTL is a disk, processor and cdrom device emulation subsystem originally +written for Copan Systems under Linux starting in 2003. It has been +shipping in Copan (now SGI) products since 2005. It was ported to FreeBSD in 2008, and thanks to an agreement between SGI (who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is @@ -31,7 +31,7 @@ that Spectra would work to get CTL into Features: ======== - - Disk and processor device emulation. + - Disk, processor and cdrom device emulation. - Tagged queueing - SCSI task attribute support (ordered, head of queue, simple tags) - SCSI implicit command ordering support. (e.g. if a read follows a mode Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl.c Sun Sep 27 13:47:28 2015 (r288310) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -3819,8 +3820,14 @@ ctl_init_page_index(struct ctl_lun *lun) for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { page_index = &lun->mode_pages.index[i]; - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; switch (page_index->page_code & SMPH_PC_MASK) { @@ -4205,8 +4212,14 @@ ctl_init_log_page_index(struct ctl_lun * for (i = 0, j = 0, k = 0; i < CTL_NUM_LOG_PAGES; i++) { page_index = &lun->log_pages.index[i]; - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; if (page_index->page_code == SLS_LOGICAL_BLOCK_PROVISIONING && @@ -4282,7 +4295,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_lun *nlun, *lun; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor; + const char *eui, *naa, *scsiname, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4294,8 +4307,8 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft */ switch (be_lun->lun_type) { case T_DIRECT: - break; case T_PROCESSOR: + case T_CDROM: break; case T_SEQUENTIAL: case T_CHANGER: @@ -4448,6 +4461,13 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; + value = ctl_get_opt(&be_lun->options, "removable"); + if (value != NULL) { + if (strcmp(value, "on") == 0) + lun->flags |= CTL_LUN_REMOVABLE; + } else if (be_lun->lun_type == T_CDROM) + lun->flags |= CTL_LUN_REMOVABLE; + lun->ctl_softc = ctl_softc; #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); @@ -5124,14 +5144,14 @@ ctl_start_stop(struct ctl_scsiio *ctsio) } } - /* - * If there is no backend on this device, we can't start or stop - * it. In theory we shouldn't get any start/stop commands in the - * first place at this level if the LUN doesn't have a backend. - * That should get stopped by the command decode code. - */ - if (lun->backend == NULL) { - ctl_set_invalid_opcode(ctsio); + if ((cdb->how & SSS_LOEJ) && + (lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 4, + /*bit_valid*/ 1, + /*bit*/ 1); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -5161,6 +5181,26 @@ ctl_start_stop(struct ctl_scsiio *ctsio) return (retval); } +int +ctl_prevent_allow(struct ctl_scsiio *ctsio) +{ + struct ctl_lun *lun; + int retval; + + CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + + if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + retval = lun->backend->config_write((union ctl_io *)ctsio); + return (retval); +} + /* * We support the SYNCHRONIZE CACHE command (10 and 16 byte versions), but * we don't really do anything with the LBA and length fields if the user @@ -5222,15 +5262,6 @@ ctl_sync_cache(struct ctl_scsiio *ctsio) goto bailout; } - /* - * If this LUN has no backend, we can't flush the cache anyway. - */ - if (lun->backend == NULL) { - ctl_set_invalid_opcode(ctsio); - ctl_done((union ctl_io *)ctsio); - goto bailout; - } - lbalen = (struct ctl_lba_len_flags *)&ctsio->io_hdr.ctl_private[CTL_PRIV_LBA_LEN]; lbalen->lba = starting_lba; lbalen->len = block_count; @@ -5933,13 +5964,18 @@ do_next_page: * XXX KDM should we do something with the block descriptor? */ for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { - - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) + page_index = &lun->mode_pages.index[i]; + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; - if ((lun->mode_pages.index[i].page_code & SMPH_PC_MASK) != + if ((page_index->page_code & SMPH_PC_MASK) != (page_header->page_code & SMPH_PC_MASK)) continue; @@ -5947,9 +5983,8 @@ do_next_page: * If neither page has a subpage code, then we've got a * match. */ - if (((lun->mode_pages.index[i].page_code & SMPH_SPF) == 0) + if (((page_index->page_code & SMPH_SPF) == 0) && ((page_header->page_code & SMPH_SPF) == 0)) { - page_index = &lun->mode_pages.index[i]; page_len = page_header->page_length; break; } @@ -5958,15 +5993,12 @@ do_next_page: * If both pages have subpages, then the subpage numbers * have to match. */ - if ((lun->mode_pages.index[i].page_code & SMPH_SPF) + if ((page_index->page_code & SMPH_SPF) && (page_header->page_code & SMPH_SPF)) { struct scsi_mode_page_header_sp *sph; sph = (struct scsi_mode_page_header_sp *)page_header; - - if (lun->mode_pages.index[i].subpage == - sph->subpage) { - page_index = &lun->mode_pages.index[i]; + if (page_index->subpage == sph->subpage) { page_len = scsi_2btoul(sph->page_length); break; } @@ -5977,7 +6009,7 @@ do_next_page: * If we couldn't find the page, or if we don't have a mode select * handler for it, send back an error to the user. */ - if ((page_index == NULL) + if ((i >= CTL_NUM_MODE_PAGES) || (page_index->select_handler == NULL)) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, @@ -6236,7 +6268,6 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) dbd = 0; llba = 0; block_desc = NULL; - page_index = NULL; CTL_DEBUG_PRINT(("ctl_mode_sense\n")); @@ -6313,26 +6344,33 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) } for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) + page_index = &lun->mode_pages.index[i]; + + /* Make sure the page is supported for this dev type */ + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* * We don't use this subpage if the user didn't * request all subpages. */ - if ((lun->mode_pages.index[i].subpage != 0) + if ((page_index->subpage != 0) && (subpage == SMS_SUBPAGE_PAGE_0)) continue; #if 0 printf("found page %#x len %d\n", - lun->mode_pages.index[i].page_code & - SMPH_PC_MASK, - lun->mode_pages.index[i].page_len); + page_index->page_code & SMPH_PC_MASK, + page_index->page_len); #endif - page_len += lun->mode_pages.index[i].page_len; + page_len += page_index->page_len; } break; } @@ -6342,30 +6380,35 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) page_len = 0; for (i = 0; i < CTL_NUM_MODE_PAGES; i++) { + page_index = &lun->mode_pages.index[i]; + + /* Make sure the page is supported for this dev type */ + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) + continue; + /* Look for the right page code */ - if ((lun->mode_pages.index[i].page_code & - SMPH_PC_MASK) != page_code) + if ((page_index->page_code & SMPH_PC_MASK) != page_code) continue; /* Look for the right subpage or the subpage wildcard*/ - if ((lun->mode_pages.index[i].subpage != subpage) + if ((page_index->subpage != subpage) && (subpage != SMS_SUBPAGE_ALL)) continue; - /* Make sure the page is supported for this dev type */ - if (lun->be_lun->lun_type != T_DIRECT && - (lun->mode_pages.index[i].page_flags & - CTL_PAGE_FLAG_DISK_ONLY)) - continue; - #if 0 printf("found page %#x len %d\n", - lun->mode_pages.index[i].page_code & - SMPH_PC_MASK, - lun->mode_pages.index[i].page_len); + page_index->page_code & SMPH_PC_MASK, + page_index->page_len); #endif - page_len += lun->mode_pages.index[i].page_len; + page_len += page_index->page_len; } if (page_len == 0) { @@ -6473,9 +6516,14 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) struct ctl_page_index *page_index; page_index = &lun->mode_pages.index[i]; - - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* @@ -6523,8 +6571,14 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) continue; /* Make sure the page is supported for this dev type */ - if (lun->be_lun->lun_type != T_DIRECT && - (page_index->page_flags & CTL_PAGE_FLAG_DISK_ONLY)) + if (lun->be_lun->lun_type == T_DIRECT && + (page_index->page_flags & CTL_PAGE_FLAG_DIRECT) == 0) + continue; + if (lun->be_lun->lun_type == T_PROCESSOR && + (page_index->page_flags & CTL_PAGE_FLAG_PROC) == 0) + continue; + if (lun->be_lun->lun_type == T_CDROM && + (page_index->page_flags & CTL_PAGE_FLAG_CDROM) == 0) continue; /* @@ -10050,6 +10104,8 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio inq_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | lun->be_lun->lun_type; } + if (lun->flags & CTL_LUN_REMOVABLE) + inq_ptr->dev_qual2 |= SID_RMB; } else inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE; @@ -10114,6 +10170,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio strncpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT, sizeof(inq_ptr->product)); break; + case T_CDROM: + strncpy(inq_ptr->product, CTL_CDROM_PRODUCT, + sizeof(inq_ptr->product)); + break; default: strncpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT, sizeof(inq_ptr->product)); @@ -10176,6 +10236,11 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio scsi_ulto2b(0x0600, inq_ptr->version4); break; case T_PROCESSOR: + break; + case T_CDROM: + /* MMC-6 (no version claimed) */ + scsi_ulto2b(0x04E0, inq_ptr->version4); + break; default: break; } @@ -10215,6 +10280,344 @@ ctl_inquiry(struct ctl_scsiio *ctsio) return (retval); } +int +ctl_get_config(struct ctl_scsiio *ctsio) +{ + struct scsi_get_config_header *hdr; + struct scsi_get_config_feature *feature; + struct scsi_get_config *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int rt, starting; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_get_config *)ctsio->cdb; + rt = (cdb->rt & SGC_RT_MASK); + starting = scsi_2btoul(cdb->starting_feature); + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_get_config_header) + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 8 + + sizeof(struct scsi_get_config_feature) + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4; + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + hdr = (struct scsi_get_config_header *)ctsio->kern_data_ptr; + if (lun->flags & CTL_LUN_OFFLINE) + scsi_ulto2b(0x0000, hdr->current_profile); + else + scsi_ulto2b(0x0010, hdr->current_profile); + feature = (struct scsi_get_config_feature *)(hdr + 1); + + if (starting > 0x001f) + goto done; + if (starting > 0x001e) + goto f1f; + if (starting > 0x001d) + goto f1e; + if (starting > 0x0010) + goto f1d; + if (starting > 0x0003) + goto f10; + if (starting > 0x0002) + goto f3; + if (starting > 0x0001) + goto f2; + if (starting > 0x0000) + goto f1; + + /* Profile List */ + scsi_ulto2b(0x0000, feature->feature_code); + feature->flags = SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto2b(0x0008, &feature->feature_data[0]); /* CD-ROM */ + feature->feature_data[2] = 0x00; + scsi_ulto2b(0x0010, &feature->feature_data[4]); /* DVD-ROM */ + feature->feature_data[6] = 0x01; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1: /* Core */ + scsi_ulto2b(0x0001, feature->feature_code); + feature->flags = 0x08 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto4b(0x00000000, &feature->feature_data[0]); + feature->feature_data[4] = 0x03; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f2: /* Morphing */ + scsi_ulto2b(0x0002, feature->feature_code); + feature->flags = 0x04 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x02; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3: /* Removable Medium */ + scsi_ulto2b(0x0003, feature->feature_code); + feature->flags = 0x04 | SGC_F_PERSISTENT | SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x39; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + + if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_OFFLINE)) + goto done; + +f10: /* Random Read */ + scsi_ulto2b(0x0010, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 8; + scsi_ulto4b(lun->be_lun->blocksize, &feature->feature_data[0]); + scsi_ulto2b(1, &feature->feature_data[4]); + feature->feature_data[6] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1d: /* Multi-Read */ + scsi_ulto2b(0x001D, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 0; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1e: /* CD Read */ + scsi_ulto2b(0x001E, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f1f: /* DVD Read */ + scsi_ulto2b(0x001F, feature->feature_code); + feature->flags = 0x08; + if ((lun->flags & CTL_LUN_OFFLINE) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x01; + feature->feature_data[2] = 0x03; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +done: + data_len = (uint8_t *)feature - (uint8_t *)hdr; + if (rt == SGC_RT_SPECIFIC && data_len > 4) { + feature = (struct scsi_get_config_feature *)(hdr + 1); + if (scsi_2btoul(feature->feature_code) == starting) + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + data_len = (uint8_t *)feature - (uint8_t *)hdr; + } + scsi_ulto4b(data_len - 4, hdr->data_length); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_get_event_status(struct ctl_scsiio *ctsio) +{ + struct scsi_get_event_status_header *hdr; + struct scsi_get_event_status *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int notif_class; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_get_event_status *)ctsio->cdb; + if ((cdb->byte2 & SGESN_POLLED) == 0) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, + /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + notif_class = cdb->notif_class; + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_get_event_status_header); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_get_event_status_header *)ctsio->kern_data_ptr; + scsi_ulto2b(0, hdr->descr_length); + hdr->nea_class = SGESN_NEA; + hdr->supported_class = 0; + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int +ctl_mechanism_status(struct ctl_scsiio *ctsio) +{ + struct scsi_mechanism_status_header *hdr; + struct scsi_mechanism_status *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_mechanism_status *)ctsio->cdb; + alloc_len = scsi_2btoul(cdb->length); + + data_len = sizeof(struct scsi_mechanism_status_header); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_mechanism_status_header *)ctsio->kern_data_ptr; + hdr->state1 = 0x00; + hdr->state2 = 0xe0; + scsi_ulto3b(0, hdr->lba); + hdr->slots_num = 0; + scsi_ulto2b(0, hdr->slots_length); + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +static void +ctl_ultomsf(uint32_t lba, uint8_t *buf) +{ + + lba += 150; + buf[0] = 0; + buf[1] = bin2bcd((lba / 75) / 60); + buf[2] = bin2bcd((lba / 75) % 60); + buf[3] = bin2bcd(lba % 75); +} + +int +ctl_read_toc(struct ctl_scsiio *ctsio) +{ + struct scsi_read_toc_hdr *hdr; + struct scsi_read_toc_type01_descr *descr; + struct scsi_read_toc *cdb; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + int format, msf; + + lun = ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_read_toc *)ctsio->cdb; + msf = (cdb->byte2 & CD_MSF) != 0; + format = cdb->format; + alloc_len = scsi_2btoul(cdb->data_len); + + data_len = sizeof(struct scsi_read_toc_hdr); + if (format == 0) + data_len += 2 * sizeof(struct scsi_read_toc_type01_descr); + else + data_len += sizeof(struct scsi_read_toc_type01_descr); + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + ctsio->kern_sg_entries = 0; + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + + hdr = (struct scsi_read_toc_hdr *)ctsio->kern_data_ptr; + if (format == 0) { + scsi_ulto2b(0x12, hdr->data_length); + hdr->first = 1; + hdr->last = 1; + descr = (struct scsi_read_toc_type01_descr *)(hdr + 1); + descr->addr_ctl = 0x14; + descr->track_number = 1; + if (msf) + ctl_ultomsf(0, descr->track_start); + else + scsi_ulto4b(0, descr->track_start); + descr++; + descr->addr_ctl = 0x14; + descr->track_number = 0xaa; + if (msf) + ctl_ultomsf(lun->be_lun->maxlba+1, descr->track_start); + else + scsi_ulto4b(lun->be_lun->maxlba+1, descr->track_start); + } else { + scsi_ulto2b(0x0a, hdr->data_length); + hdr->first = 1; + hdr->last = 1; + descr = (struct scsi_read_toc_type01_descr *)(hdr + 1); + descr->addr_ctl = 0x14; + descr->track_number = 1; + if (msf) + ctl_ultomsf(0, descr->track_start); + else + scsi_ulto4b(0, descr->track_start); + } + + ctl_set_success(ctsio); + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + /* * For known CDB types, parse the LBA and length. */ @@ -11264,12 +11667,16 @@ ctl_cmd_applicable(uint8_t lun_type, con { switch (lun_type) { + case T_DIRECT: + if ((entry->flags & CTL_CMD_FLAG_OK_ON_DIRECT) == 0) + return (0); + break; case T_PROCESSOR: if ((entry->flags & CTL_CMD_FLAG_OK_ON_PROC) == 0) return (0); break; - case T_DIRECT: - if ((entry->flags & CTL_CMD_FLAG_OK_ON_SLUN) == 0) + case T_CDROM: + if ((entry->flags & CTL_CMD_FLAG_OK_ON_CDROM) == 0) return (0); break; default: Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_backend_block.c Sun Sep 27 13:47:28 2015 (r288310) @@ -1869,6 +1869,8 @@ ctl_be_block_open_file(struct ctl_be_blo */ if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; @@ -1997,7 +1999,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc "requested blocksize %u < backing device " "blocksize %u", params->blocksize_bytes, tmp); return (EINVAL); - } else + } else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = MAX(tmp, 2048); + else cbe_lun->blocksize = tmp; error = csw->d_ioctl(dev, DIOCGMEDIASIZE, (caddr_t)&otmp, FREAD, @@ -2157,7 +2161,10 @@ ctl_be_block_open(struct ctl_be_block_so flags = FREAD; value = ctl_get_opt(&cbe_lun->options, "readonly"); - if (value == NULL || strcmp(value, "on") != 0) + if (value != NULL) { + if (strcmp(value, "on") != 0) + flags |= FWRITE; + } else if (cbe_lun->lun_type == T_DIRECT) flags |= FWRITE; again: @@ -2273,10 +2280,13 @@ ctl_be_block_create(struct ctl_be_block_ } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; - if (cbe_lun->lun_type == T_DIRECT) { + if (cbe_lun->lun_type == T_DIRECT || + cbe_lun->lun_type == T_CDROM) { be_lun->size_bytes = params->lun_size_bytes; if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; be_lun->size_blocks = be_lun->size_bytes / cbe_lun->blocksize; @@ -2761,6 +2771,10 @@ ctl_be_block_config_write(union ctl_io * ctl_config_write_done(io); break; } + case PREVENT_ALLOW: + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; default: ctl_set_invalid_opcode(&io->scsiio); ctl_config_write_done(io); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Sun Sep 27 13:47:28 2015 (r288310) @@ -530,9 +530,12 @@ ctl_backend_ramdisk_create(struct ctl_be } else if (control_softc->flags & CTL_FLAG_ACTIVE_SHELF) cbe_lun->flags |= CTL_LUN_FLAG_PRIMARY; - if (cbe_lun->lun_type == T_DIRECT) { + if (cbe_lun->lun_type == T_DIRECT || + cbe_lun->lun_type == T_CDROM) { if (params->blocksize_bytes != 0) cbe_lun->blocksize = params->blocksize_bytes; + else if (cbe_lun->lun_type == T_CDROM) + cbe_lun->blocksize = 2048; else cbe_lun->blocksize = 512; if (params->lun_size_bytes < cbe_lun->blocksize) { @@ -556,7 +559,10 @@ ctl_backend_ramdisk_create(struct ctl_be if (value != NULL && strcmp(value, "on") == 0) cbe_lun->flags |= CTL_LUN_FLAG_UNMAP; value = ctl_get_opt(&cbe_lun->options, "readonly"); - if (value != NULL && strcmp(value, "on") == 0) + if (value != NULL) { + if (strcmp(value, "on") == 0) + cbe_lun->flags |= CTL_LUN_FLAG_READONLY; + } else if (cbe_lun->lun_type != T_DIRECT) cbe_lun->flags |= CTL_LUN_FLAG_READONLY; cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; value = ctl_get_opt(&cbe_lun->options, "serseq"); @@ -896,6 +902,7 @@ ctl_backend_ramdisk_config_write(union c ctl_config_write_done(io); break; } + case PREVENT_ALLOW: case WRITE_SAME_10: case WRITE_SAME_16: case UNMAP: Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Sun Sep 27 12:52:18 2015 (r288309) +++ head/sys/cam/ctl/ctl_cmd_table.c Sun Sep 27 13:47:28 2015 (r288310) @@ -255,7 +255,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 10 POPULATE TOKEN */ -{ctl_populate_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_populate_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_NONE, @@ -263,7 +263,7 @@ const struct ctl_cmd_entry ctl_cmd_table 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 11 WRITE USING TOKEN */ -{ctl_write_using_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_write_using_token, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x11, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, @@ -422,7 +422,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 10 READ CAPACITY(16) */ -{ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | @@ -434,7 +434,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 12 GET LBA STATUS */ -{ctl_get_lba_status, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_get_lba_status, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, @@ -559,7 +559,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0xff, 0x07}}, /* 04 FORMAT UNIT */ -{ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0xff, 0, 0, 0, 0x07}}, @@ -574,7 +574,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 08 READ(6) */ -{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, @@ -583,7 +583,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 0A WRITE(6) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, 6, {0x1f, 0xff, 0xff, 0xff, 0x07}}, @@ -669,7 +669,8 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_LUN_PAT_NONE, 6, {0x08, 0xff, 0xff, 0xff, 0x07}}, /* 1B START STOP UNIT */ -{ctl_start_stop, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_start_stop, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_NONE | @@ -683,7 +684,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 1E PREVENT ALLOW MEDIUM REMOVAL */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_prevent_allow, CTL_SERIDX_START, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | + CTL_CMD_FLAG_OK_ON_STOPPED | + CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_FLAG_DATA_NONE, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0x03, 0x07}}, /* 1F */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -704,7 +710,8 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 25 READ CAPACITY(10) */ -{ctl_read_capacity, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_SLUN| +{ctl_read_capacity, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | @@ -718,7 +725,8 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 28 READ(10) */ -{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_SLUN | +{ctl_read_write, CTL_SERIDX_READ, CTL_CMD_FLAG_OK_ON_DIRECT | + CTL_CMD_FLAG_OK_ON_CDROM | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_WRESV, CTL_LUN_PAT_READ | CTL_LUN_PAT_RANGE, @@ -728,7 +736,7 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 2A WRITE(10) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT| CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, 10, {0x1a, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, @@ -742,12 +750,12 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 2E WRITE AND VERIFY(10) */ -{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_DIRECT| CTL_FLAG_DATA_OUT, CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Sep 27 14:58:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 253F7A0AA0D; Sun, 27 Sep 2015 14:58:52 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward19p.cmail.yandex.net (forward19p.cmail.yandex.net [IPv6:2a02:6b8:0:1465::aa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D023D5FA; Sun, 27 Sep 2015 14:58:51 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from web20g.yandex.ru (web20g.yandex.ru [IPv6:2a02:6b8:0:1402::30]) by forward19p.cmail.yandex.net (Yandex) with ESMTP id F1A2220B42; Sun, 27 Sep 2015 17:58:36 +0300 (MSK) Received: from 127.0.0.1 (localhost [127.0.0.1]) by web20g.yandex.ru (Yandex) with ESMTP id 133456AC132B; Sun, 27 Sep 2015 17:58:35 +0300 (MSK) Received: by web20g.yandex.ru with HTTP; Sun, 27 Sep 2015 17:58:35 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Bjoern A. Zeeb , George Neville-Neil Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: References: <201509270529.t8R5TYRf095540@repo.freebsd.org> Subject: Re: svn commit: r288301 - in head/sys: net netinet netinet6 MIME-Version: 1.0 Message-Id: <2804821443365915@web20g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sun, 27 Sep 2015 17:58:35 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 14:58:52 -0000 27.09.2015, 15:26, "Bjoern A. Zeeb" : > On Sun, 27 Sep 2015, Alexander V. Chernikov wrote: > >> šAuthor: melifaro >> šDate: Sun Sep 27 05:29:34 2015 >> šNew Revision: 288301 >> šURL: https://svnweb.freebsd.org/changeset/base/288301 >> >> šLog: >> ššEliminate nd6_nud_hint() and its TCP bindings. >> >> ššInitially function was introduced in r53541 (KAME initial commit) to >> šššš"provide hints from upper layer protocols that indicate a connection >> ššššis making "forward progress"" (quote from RFC 2461 7.3.1 Reachability >> ššššConfirmation). >> ššHowever, it was converted to do nothing (e.g. just return) in r122922 >> šššš(tcp_hostcache implementation) back in 2003. Some defines were moved >> ššššto tcp_var.h in r169541. Then, it was broken (for non-corner cases) >> ššššby r186119 (L2<>L3 split) in 2008 (NULL ifp in nd6_lookup). So, >> ššššright now this code is broken and has no "real" base users. >> >> ššDifferential Revision: https://reviews.freebsd.org/D3699 > > PR: 165692 > > It would be nice to have the feature back though it would be very > expensive locking wise if it'd remain a per-packet operation. It looks like there are options to implement this without significant overhead (like, on proper TCP session teardown, or on delayed-ack timer, or/and with some sort of sampling + special "no-gw" flag). I'd prefer not to shift my focus from projects/routing now, but I can cooperate with someone from TCP side and resurrect/test nd6_nud_hint() > > -- > Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@freebsd.org Sun Sep 27 18:21:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 526F1A0AD31; Sun, 27 Sep 2015 18:21:23 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D081E12; Sun, 27 Sep 2015 18:21:23 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RILNaY012463; Sun, 27 Sep 2015 18:21:23 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RILNtA012462; Sun, 27 Sep 2015 18:21:23 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201509271821.t8RILNtA012462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 27 Sep 2015 18:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288311 - head/sys/boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 18:21:23 -0000 Author: loos Date: Sun Sep 27 18:21:22 2015 New Revision: 288311 URL: https://svnweb.freebsd.org/changeset/base/288311 Log: Set the #address-cells and #size-cells for the I2C controllers in RPi2. This allows the use of I2C addresses in 'reg' property. Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi Modified: head/sys/boot/fdt/dts/arm/bcm2836.dtsi ============================================================================== --- head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sun Sep 27 13:47:28 2015 (r288310) +++ head/sys/boot/fdt/dts/arm/bcm2836.dtsi Sun Sep 27 18:21:22 2015 (r288311) @@ -379,6 +379,8 @@ }; bsc0 { + #address-cells = <1>; + #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x205000 0x20>; @@ -387,6 +389,8 @@ }; bsc1 { + #address-cells = <1>; + #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x804000 0x20>; From owner-svn-src-head@freebsd.org Sun Sep 27 22:02:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24F559D07B7; Sun, 27 Sep 2015 22:02:47 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 162E9936; Sun, 27 Sep 2015 22:02:47 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RM2kCN006432; Sun, 27 Sep 2015 22:02:46 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RM2k2P006431; Sun, 27 Sep 2015 22:02:46 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509272202.t8RM2k2P006431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Sep 2015 22:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288312 - head/bin/ls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 22:02:47 -0000 Author: allanjude Date: Sun Sep 27 22:02:46 2015 New Revision: 288312 URL: https://svnweb.freebsd.org/changeset/base/288312 Log: Use one fewer made up words in the ls(1) man page PR: 203337 Submitted by: Mike Dame Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Modified: head/bin/ls/ls.1 Modified: head/bin/ls/ls.1 ============================================================================== --- head/bin/ls/ls.1 Sun Sep 27 18:21:22 2015 (r288311) +++ head/bin/ls/ls.1 Sun Sep 27 22:02:46 2015 (r288312) @@ -32,7 +32,7 @@ .\" @(#)ls.1 8.7 (Berkeley) 7/29/94 .\" $FreeBSD$ .\" -.Dd June 8, 2015 +.Dd September 27, 2015 .Dt LS 1 .Os .Sh NAME @@ -320,7 +320,7 @@ or use the option. This causes .Nm -to reverse the lexicographal sort order when sorting files with the +to reverse the lexicographical sort order when sorting files with the same modification timestamp. .It Fl u Use time of last access, From owner-svn-src-head@freebsd.org Sun Sep 27 22:05:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84B6A9D090F; Sun, 27 Sep 2015 22:05:21 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75AF9AFF; Sun, 27 Sep 2015 22:05:21 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8RM5LI1006602; Sun, 27 Sep 2015 22:05:21 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8RM5LTl006601; Sun, 27 Sep 2015 22:05:21 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201509272205.t8RM5LTl006601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Sun, 27 Sep 2015 22:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288313 - head/bin/ls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Sep 2015 22:05:21 -0000 Author: allanjude Date: Sun Sep 27 22:05:20 2015 New Revision: 288313 URL: https://svnweb.freebsd.org/changeset/base/288313 Log: Fix whitespace error in ls(1) detected by igor Approved by: bcr (mentor) Sponsored by: EuroBSDCon DevSummit Modified: head/bin/ls/ls.1 Modified: head/bin/ls/ls.1 ============================================================================== --- head/bin/ls/ls.1 Sun Sep 27 22:02:46 2015 (r288312) +++ head/bin/ls/ls.1 Sun Sep 27 22:05:20 2015 (r288313) @@ -296,9 +296,9 @@ subsection below, except (if the long fo the directory totals are not output when the output is in a single column, even if multi-column output is requested. .It Fl t -Sort by descending time modified (most recently modified first). If two files -have the same modification timestamp, sort their names in ascending -lexicographical order. +Sort by descending time modified (most recently modified first). +If two files have the same modification timestamp, sort their names +in ascending lexicographical order. The .Fl r option reverses both of these sort orders. From owner-svn-src-head@freebsd.org Mon Sep 28 00:17:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32594A0AD0B; Mon, 28 Sep 2015 00:17:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 176B2BC4; Mon, 28 Sep 2015 00:17:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0Hq7R060643; Mon, 28 Sep 2015 00:17:52 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0HqUN060641; Mon, 28 Sep 2015 00:17:52 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280017.t8S0HqUN060641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288315 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 00:17:53 -0000 Author: adrian Date: Mon Sep 28 00:17:51 2015 New Revision: 288315 URL: https://svnweb.freebsd.org/changeset/base/288315 Log: Abstract out the ampdu TX pps initialisation code so it can be reused in the superg fast-frames code. This harks back to an earlier commit (r280349) where I found that initialising the pps code with ticks=0 would cause hilariously bad hz ticks wraparound failures, leading to never actually aggregating traffic. This is still true for the superg path and so I have to do the same thing there. This is a big no-op; a subsequent commit will flip this on so it works with the fast-frames transmit path. Tested: * AR9170, otus(4) - STA mode, 11bg operation * AR9331, AP mode Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Sep 27 23:33:54 2015 (r288314) +++ head/sys/net80211/ieee80211_ht.c Mon Sep 28 00:17:51 2015 (r288315) @@ -1081,7 +1081,7 @@ ieee80211_ht_node_init(struct ieee80211_ tap = &ni->ni_tx_ampdu[tid]; tap->txa_tid = tid; tap->txa_ni = ni; - tap->txa_lastsample = ticks; + ieee80211_txampdu_init_pps(tap); /* NB: further initialization deferred */ } ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU; @@ -1251,7 +1251,7 @@ ieee80211_ht_wds_init(struct ieee80211_n for (tid = 0; tid < WME_NUM_TID; tid++) { tap = &ni->ni_tx_ampdu[tid]; tap->txa_tid = tid; - tap->txa_lastsample = ticks; + ieee80211_txampdu_init_pps(tap); } /* NB: AMPDU tx/rx governed by IEEE80211_FHT_AMPDU_{TX,RX} */ ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU; @@ -1752,8 +1752,7 @@ ampdu_tx_stop(struct ieee80211_tx_ampdu /* * Reset packet estimate. */ - tap->txa_lastsample = ticks; - tap->txa_avgpps = 0; + ieee80211_txampdu_init_pps(tap); /* NB: clearing NAK means we may re-send ADDBA */ tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK); Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Sun Sep 27 23:33:54 2015 (r288314) +++ head/sys/net80211/ieee80211_ht.h Mon Sep 28 00:17:51 2015 (r288315) @@ -84,8 +84,19 @@ struct ieee80211_tx_ampdu { */ static __inline void +ieee80211_txampdu_init_pps(struct ieee80211_tx_ampdu *tap) +{ + /* + * Reset packet estimate. + */ + tap->txa_lastsample = ticks; + tap->txa_avgpps = 0; +} + +static __inline void ieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap) { + /* NB: scale factor of 2 was picked heuristically */ tap->txa_avgpps = ((tap->txa_avgpps << 2) - tap->txa_avgpps + tap->txa_pkts) >> 2; @@ -97,6 +108,7 @@ ieee80211_txampdu_update_pps(struct ieee static __inline void ieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap) { + /* XXX bound loop/do more crude estimate? */ while (ticks - tap->txa_lastsample >= hz) { ieee80211_txampdu_update_pps(tap); From owner-svn-src-head@freebsd.org Mon Sep 28 00:51:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 209D2A0A1D5; Mon, 28 Sep 2015 00:51:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11BBCCDF; Mon, 28 Sep 2015 00:51:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0pOeR078107; Mon, 28 Sep 2015 00:51:24 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0pOKx078106; Mon, 28 Sep 2015 00:51:24 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280051.t8S0pOKx078106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288317 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 00:51:25 -0000 Author: adrian Date: Mon Sep 28 00:51:24 2015 New Revision: 288317 URL: https://svnweb.freebsd.org/changeset/base/288317 Log: Comments, mostly to remind myself of what's going on and why. Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Mon Sep 28 00:20:14 2015 (r288316) +++ head/sys/net80211/ieee80211_output.c Mon Sep 28 00:51:24 2015 (r288317) @@ -213,6 +213,22 @@ ieee80211_vap_pkt_send_dest(struct ieee8 } } + /* + * XXX If we aren't doing AMPDU TX then we /could/ do + * fast-frames encapsulation, however right now this + * output logic doesn't handle that case. + * + * So we'll be limited to "fast-frames" xmit for non-11n STA + * and "no fast frames" xmit for 11n STAs. + * It'd be nice to eventually test fast-frames out by + * gracefully falling from failing A-MPDU transmission + * (driver says no, fail to negotiate it with peer) to + * using fast-frames. + * + * Note: we can actually put A-MSDU's inside an A-MPDU, + * so hopefully we can figure out how to make that particular + * combination work right. + */ #ifdef IEEE80211_SUPPORT_SUPERG else if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF)) { m = ieee80211_ff_check(ni, m); @@ -230,6 +246,11 @@ ieee80211_vap_pkt_send_dest(struct ieee8 */ IEEE80211_TX_LOCK(ic); + /* + * XXX make the encap and transmit code a separate function + * so things like the FF (and later A-MSDU) path can just call + * it for flushed frames. + */ if (__predict_true((vap->iv_caps & IEEE80211_C_8023ENCAP) == 0)) { /* * Encapsulate the packet in prep for transmission. From owner-svn-src-head@freebsd.org Mon Sep 28 00:59:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F1DFA0A595; Mon, 28 Sep 2015 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FAD194; Mon, 28 Sep 2015 00:59:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S0x83O079125; Mon, 28 Sep 2015 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S0x8UM079123; Mon, 28 Sep 2015 00:59:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280059.t8S0x8UM079123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 00:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288318 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 00:59:09 -0000 Author: adrian Date: Mon Sep 28 00:59:07 2015 New Revision: 288318 URL: https://svnweb.freebsd.org/changeset/base/288318 Log: Migrate the fast-frames transmit support away from using the txa_private field and into a separate fast-frames staging pointer in ieee80211_node. The A-MPDU TX path allows txa_private to be used by drivers. So it will clash with any attempt to use fast-frames. Now, fast-frames is not really anything special - it's just a custom ethernet frame type that contains two MSDUs into one MPDU. So all the NIC has to support doing is transmitting up to a 4KiB frame with an arbitrary ethertype and bam! Fast-frames. However, using txa_private means we can /either/ do fast-frames or A-MPDU TX, so fast frames has been turned off in the Atheros HAL for 11n chipsets. This is a bit silly - it actually means that 802.11 performance to/from 11abg Atheros chips is actually better than between an 11abg atheros device and an 11n Atheros device. So: * create a new mbuf staging queue for fast frames. It only queues a single frame in the staging queue (and there's a top-level ic staging queue used for expiry/tracking) so it's just an mbuf pointer per TID. * Still use the ampdu TX packet counter to determine whether to do aggregation or not. It'll double count if we start doing both A-MPDU TX and fast frames, but that's not all that important right now. * Initialise the pps tracker so ticks isn't zero. This ensures that fast-frames actually gets used - without it, the ticks math overflows and the pps math always sets txa_pps=0. This is the same bug that plagued A-MPDU TX starting logic. This actually allows fast-frames transmit to occur between the AR9331 (in 11n HT/20 mode) and AR9170 (if_otus) in 11bg mode. Now, this is a great big no-op on atheros 11n hardware, so don't worry. It may mean you start seeing more reliable fast-frames transmission on 11abg hardware which may expose some more amusing bugs. TODO: * further testing and debugging of all of this before flipping on fast-frames in if_ath (for 11n) and if_otus. Modified: head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Mon Sep 28 00:51:24 2015 (r288317) +++ head/sys/net80211/ieee80211_node.h Mon Sep 28 00:59:07 2015 (r288318) @@ -219,6 +219,9 @@ struct ieee80211_node { struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID]; struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID]; + /* fast-frames state */ + struct mbuf * ni_tx_superg[WME_NUM_TID]; + /* others */ short ni_inact; /* inactivity mark count */ short ni_inact_reload;/* inactivity reload value */ Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Mon Sep 28 00:51:24 2015 (r288317) +++ head/sys/net80211/ieee80211_superg.c Mon Sep 28 00:59:07 2015 (r288318) @@ -530,7 +530,6 @@ ieee80211_ff_age(struct ieee80211com *ic { struct mbuf *m, *head; struct ieee80211_node *ni; - struct ieee80211_tx_ampdu *tap; #if 0 KASSERT(sq->head != NULL, ("stageq empty")); @@ -541,11 +540,10 @@ ieee80211_ff_age(struct ieee80211com *ic while ((m = sq->head) != NULL && M_AGE_GET(m) < quanta) { int tid = WME_AC_TO_TID(M_WME_GETAC(m)); - /* clear tap ref to frame */ + /* clear staging ref to frame */ ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; - tap = &ni->ni_tx_ampdu[tid]; - KASSERT(tap->txa_private == m, ("staging queue empty")); - tap->txa_private = NULL; + KASSERT(ni->ni_tx_superg[tid] == m, ("staging queue empty")); + ni->ni_tx_superg[tid] = NULL; sq->head = m->m_nextpkt; sq->depth--; @@ -658,7 +656,12 @@ ieee80211_ff_check(struct ieee80211_node */ IEEE80211_LOCK(ic); tap = &ni->ni_tx_ampdu[WME_AC_TO_TID(pri)]; - mstaged = tap->txa_private; /* NB: we reuse AMPDU state */ + mstaged = ni->ni_tx_superg[WME_AC_TO_TID(pri)]; + /* XXX NOTE: reusing packet counter state from A-MPDU */ + /* + * XXX NOTE: this means we're double-counting; it should just + * be done in ieee80211_output.c once for both superg and A-MPDU. + */ ieee80211_txampdu_count_packet(tap); /* @@ -676,6 +679,8 @@ ieee80211_ff_check(struct ieee80211_node * If there is no frame to combine with and the pps is * too low; then do not attempt to aggregate this frame. */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, + "%s: staged: %p; pps: %d\n", __func__, mstaged, ieee80211_txampdu_getpps(tap)); if (mstaged == NULL && ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) { IEEE80211_UNLOCK(ic); @@ -698,7 +703,7 @@ ieee80211_ff_check(struct ieee80211_node "%s: txtime %u exceeds txop limit %u\n", __func__, txtime, limit); - tap->txa_private = NULL; + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL; if (mstaged != NULL) stageq_remove(ic, sq, mstaged); IEEE80211_UNLOCK(ic); @@ -721,7 +726,7 @@ ieee80211_ff_check(struct ieee80211_node * hold their node reference. */ if (mstaged != NULL) { - tap->txa_private = NULL; + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = NULL; stageq_remove(ic, sq, mstaged); IEEE80211_UNLOCK(ic); @@ -739,9 +744,10 @@ ieee80211_ff_check(struct ieee80211_node mstaged->m_nextpkt = m; mstaged->m_flags |= M_FF; /* NB: mark for encap work */ } else { - KASSERT(tap->txa_private == NULL, - ("txa_private %p", tap->txa_private)); - tap->txa_private = m; + KASSERT(ni->ni_tx_superg[WME_AC_TO_TID(pri)]== NULL, + ("ni_tx_superg[]: %p", + ni->ni_tx_superg[WME_AC_TO_TID(pri)])); + ni->ni_tx_superg[WME_AC_TO_TID(pri)] = m; stageq_add(ic, sq, m); IEEE80211_UNLOCK(ic); @@ -769,7 +775,6 @@ ieee80211_ff_node_cleanup(struct ieee802 { struct ieee80211com *ic = ni->ni_ic; struct ieee80211_superg *sg = ic->ic_superg; - struct ieee80211_tx_ampdu *tap; struct mbuf *m, *next_m, *head; int tid; @@ -777,11 +782,16 @@ ieee80211_ff_node_cleanup(struct ieee802 head = NULL; for (tid = 0; tid < WME_NUM_TID; tid++) { int ac = TID_TO_WME_AC(tid); - - tap = &ni->ni_tx_ampdu[tid]; - m = tap->txa_private; + /* + * XXX Initialise the packet counter. + * + * This may be double-work for 11n stations; + * but without it we never setup things. + */ + ieee80211_txampdu_init_pps(&ni->ni_tx_ampdu[tid]); + m = ni->ni_tx_superg[tid]; if (m != NULL) { - tap->txa_private = NULL; + ni->ni_tx_superg[tid] = NULL; stageq_remove(ic, &sg->ff_stageq[ac], m); m->m_nextpkt = head; head = m; From owner-svn-src-head@freebsd.org Mon Sep 28 01:09:49 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 26751A0ACD7; Mon, 28 Sep 2015 01:09:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1765AAA4; Mon, 28 Sep 2015 01:09:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S19mMM083337; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S19mH8083335; Mon, 28 Sep 2015 01:09:48 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280109.t8S19mH8083335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 01:09:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288319 - head/sys/dev/otus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 01:09:49 -0000 Author: adrian Date: Mon Sep 28 01:09:48 2015 New Revision: 288319 URL: https://svnweb.freebsd.org/changeset/base/288319 Log: if_otus fixes; add fast-frames support. Fast-frames: * include opt_wlan.h ; tsk to not doing it earlier; * add a tx pending tracking counter for seeing how deep the hardware TX queue is; * add the frame aging code from if_ath; * add fast-frames capability to the driver setup. Bugs: * free the buffers (and node references) before detaching net80211 state. This prevents a use-after-free in the node free path where we've destroyed net80211 underneath it. Modified: head/sys/dev/otus/if_otus.c head/sys/dev/otus/if_otusreg.h Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otus.c Mon Sep 28 01:09:48 2015 (r288319) @@ -24,6 +24,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_wlan.h" + #include #include #include @@ -60,6 +62,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef IEEE80211_SUPPORT_SUPERG +#include +#endif #include #include @@ -340,6 +345,7 @@ otus_detach(device_t self) taskqueue_drain(taskqueue_thread, &sc->tx_task); taskqueue_drain(taskqueue_thread, &sc->wme_update_task); + otus_close_pipes(sc); #if 0 /* Wait for all queued asynchronous commands to complete. */ usb_rem_wait_task(sc->sc_udev, &sc->sc_task); @@ -348,7 +354,6 @@ otus_detach(device_t self) #endif ieee80211_ifdetach(ic); - otus_close_pipes(sc); mtx_destroy(&sc->sc_mtx); return 0; } @@ -949,9 +954,12 @@ fail: otus_close_pipes(sc); void otus_close_pipes(struct otus_softc *sc) { + + OTUS_LOCK(sc); otus_free_tx_cmd_list(sc); otus_free_tx_list(sc); otus_free_rx_list(sc); + OTUS_UNLOCK(sc); usbd_transfer_unsetup(sc->sc_xfer, OTUS_N_XFER); } @@ -1838,6 +1846,9 @@ tr_setup: } else (void)ieee80211_input_mimo_all(ic, m, NULL); } +#ifdef IEEE80211_SUPPORT_SUPERG + ieee80211_ff_age_all(ic, 100); +#endif OTUS_LOCK(sc); break; default: @@ -1866,6 +1877,14 @@ otus_txeof(struct usb_xfer *xfer, struct OTUS_LOCK_ASSERT(sc); + if (sc->sc_tx_n_active == 0) { + device_printf(sc->sc_dev, + "%s: completed but tx_active=0\n", + __func__); + } else { + sc->sc_tx_n_active--; + } + if (data->m) { /* XXX status? */ /* XXX we get TX status via the RX path.. */ @@ -1926,6 +1945,7 @@ tr_setup: if (data == NULL) { OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: empty pending queue sc %p\n", __func__, sc); + sc->sc_tx_n_active = 0; goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending[which], next); @@ -1934,6 +1954,7 @@ tr_setup: OTUS_DPRINTF(sc, OTUS_DEBUG_XMIT, "%s: submitting transfer %p\n", __func__, data); usbd_transfer_submit(xfer); + sc->sc_tx_n_active++; break; default: data = STAILQ_FIRST(&sc->sc_tx_active[which]); @@ -1952,6 +1973,22 @@ tr_setup: } finish: +#ifdef IEEE80211_SUPPORT_SUPERG + /* + * If the TX active queue drops below a certain + * threshold, ensure we age fast-frames out so they're + * transmitted. + */ + if (sc->sc_tx_n_active < 2) { + /* XXX ew - net80211 should defer this for us! */ + OTUS_UNLOCK(sc); + ieee80211_ff_flush(ic, WME_AC_VO); + ieee80211_ff_flush(ic, WME_AC_VI); + ieee80211_ff_flush(ic, WME_AC_BE); + ieee80211_ff_flush(ic, WME_AC_BK); + OTUS_LOCK(sc); + } +#endif /* Kick TX */ otus_tx_start(sc); } Modified: head/sys/dev/otus/if_otusreg.h ============================================================================== --- head/sys/dev/otus/if_otusreg.h Mon Sep 28 00:59:07 2015 (r288318) +++ head/sys/dev/otus/if_otusreg.h Mon Sep 28 01:09:48 2015 (r288319) @@ -984,6 +984,10 @@ struct otus_softc { /* current noisefloor, from SET_FREQUENCY */ int sc_nf[OTUS_NUM_CHAINS]; + /* How many pending, active transmit frames */ + int sc_tx_n_pending; + int sc_tx_n_active; + const uint32_t *phy_vals; struct { From owner-svn-src-head@freebsd.org Mon Sep 28 01:16:45 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18D64A0B45B; Mon, 28 Sep 2015 01:16:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09CDF13A; Mon, 28 Sep 2015 01:16:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S1Gil7087464; Mon, 28 Sep 2015 01:16:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S1GiYS087463; Mon, 28 Sep 2015 01:16:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280116.t8S1GiYS087463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 01:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288320 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 01:16:45 -0000 Author: adrian Date: Mon Sep 28 01:16:44 2015 New Revision: 288320 URL: https://svnweb.freebsd.org/changeset/base/288320 Log: include opt_wlan.h . Tsk adrian. Modified: head/sys/dev/usb/wlan/if_rsu.c Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 01:09:48 2015 (r288319) +++ head/sys/dev/usb/wlan/if_rsu.c Mon Sep 28 01:16:44 2015 (r288320) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); * o power-save operation */ +#include "opt_wlan.h" + #include #include #include From owner-svn-src-head@freebsd.org Mon Sep 28 03:28:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB59BA0A57B; Mon, 28 Sep 2015 03:28:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3D1181; Mon, 28 Sep 2015 03:28:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S3SNiL041531; Mon, 28 Sep 2015 03:28:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S3SNaC041530; Mon, 28 Sep 2015 03:28:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509280328.t8S3SNaC041530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Sep 2015 03:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288328 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 03:28:23 -0000 Author: ngie Date: Mon Sep 28 03:28:22 2015 New Revision: 288328 URL: https://svnweb.freebsd.org/changeset/base/288328 Log: Delete stray svn:mergeinfo Modified: Directory Properties: head/etc/ (props changed) From owner-svn-src-head@freebsd.org Mon Sep 28 03:36:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D986A0AB18; Mon, 28 Sep 2015 03:36:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E0B1A00; Mon, 28 Sep 2015 03:36:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S3aG2S045877; Mon, 28 Sep 2015 03:36:16 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S3aGE1045873; Mon, 28 Sep 2015 03:36:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509280336.t8S3aGE1045873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 28 Sep 2015 03:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288330 - in head: bin/ls bin/ls/tests etc/mtree X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 03:36:17 -0000 Author: ngie Date: Mon Sep 28 03:36:15 2015 New Revision: 288330 URL: https://svnweb.freebsd.org/changeset/base/288330 Log: Add initial testcases for bin/ls MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Added: head/bin/ls/tests/ - copied from r284388, user/ngie/more-tests/bin/ls/tests/ Modified: head/bin/ls/Makefile head/bin/ls/tests/Makefile head/bin/ls/tests/ls_tests.sh head/etc/mtree/BSD.tests.dist Directory Properties: head/ (props changed) Modified: head/bin/ls/Makefile ============================================================================== --- head/bin/ls/Makefile Mon Sep 28 03:31:01 2015 (r288329) +++ head/bin/ls/Makefile Mon Sep 28 03:36:15 2015 (r288330) @@ -13,4 +13,8 @@ CFLAGS+= -DCOLORLS LIBADD+= termcapw .endif +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: head/bin/ls/tests/Makefile ============================================================================== --- user/ngie/more-tests/bin/ls/tests/Makefile Sun Jun 14 20:52:52 2015 (r284388) +++ head/bin/ls/tests/Makefile Mon Sep 28 03:36:15 2015 (r288330) @@ -1,8 +1,11 @@ +# $FreeBSD$ + TESTSDIR= ${TESTSBASE}/bin/ls ATF_TESTS_SH+= ls_tests # This seems like overkill, but the idea in mind is that all of the testcases # should be runnable as !root TEST_METADATA.ls_tests+= required_user="unprivileged" +TEST_METADATA.ls_tests+= required_files="/usr/bin/nc" .include Modified: head/bin/ls/tests/ls_tests.sh ============================================================================== --- user/ngie/more-tests/bin/ls/tests/ls_tests.sh Sun Jun 14 20:52:52 2015 (r284388) +++ head/bin/ls/tests/ls_tests.sh Mon Sep 28 03:36:15 2015 (r288330) @@ -27,9 +27,11 @@ # $FreeBSD$ # -create_test_inputs() +create_test_dir() { - ATF_TMPDIR=$(pwd) + [ -z "$ATF_TMPDIR" ] || return 0 + + export ATF_TMPDIR=$(pwd) # XXX: need to nest this because of how kyua creates $TMPDIR; otherwise # it will run into EPERM issues later @@ -37,6 +39,12 @@ create_test_inputs() atf_check -e empty -s exit:0 mkdir -m 0777 -p $TEST_INPUTS_DIR cd $TEST_INPUTS_DIR +} + +create_test_inputs() +{ + create_test_dir + atf_check -e empty -s exit:0 mkdir -m 0755 -p a/b atf_check -e empty -s exit:0 ln -s a/b c atf_check -e empty -s exit:0 touch d @@ -44,16 +52,76 @@ create_test_inputs() atf_check -e empty -s exit:0 touch .f atf_check -e empty -s exit:0 mkdir .g atf_check -e empty -s exit:0 mkfifo h + atf_check -e ignore -s exit:0 dd if=/dev/zero of=i count=1000 bs=1 + atf_check -e empty -s exit:0 \ + sh -c "pid=${ATF_TMPDIR}/nc.pid; daemon -p \$pid nc -lU j; sleep 2; pkill -F \$pid" + atf_check -e empty -s exit:0 touch klmn + atf_check -e empty -s exit:0 touch opqr + atf_check -e empty -s exit:0 touch stuv + atf_check -e empty -s exit:0 touch wxyz + atf_check -e empty -s exit:0 touch 0b00000001 + atf_check -e empty -s exit:0 touch 0b00000010 + atf_check -e empty -s exit:0 touch 0b00000011 + atf_check -e empty -s exit:0 touch 0b00000100 + atf_check -e empty -s exit:0 touch 0b00000101 + atf_check -e empty -s exit:0 touch 0b00000110 + atf_check -e empty -s exit:0 touch 0b00000111 + atf_check -e empty -s exit:0 touch 0b00001000 + atf_check -e empty -s exit:0 touch 0b00001001 + atf_check -e empty -s exit:0 touch 0b00001010 + atf_check -e empty -s exit:0 touch 0b00001011 + atf_check -e empty -s exit:0 touch 0b00001100 + atf_check -e empty -s exit:0 touch 0b00001101 + atf_check -e empty -s exit:0 touch 0b00001110 + atf_check -e empty -s exit:0 touch 0b00001111 +} + +atf_test_case a_flag +a_flag_head() +{ + atf_set "descr" "Verify -a support" +} + +a_flag_body() +{ + create_test_dir + + # Make sure "." and ".." show up with -a + atf_check -e empty -o match:'\.[[:space:]]+\.\.' -s exit:0 ls -ax + + create_test_inputs + + WITH_a=$PWD/../with_a.out + WITHOUT_a=$PWD/../without_a.out + + atf_check -e empty -o save:$WITH_a -s exit:0 ls -A + atf_check -e empty -o save:$WITHOUT_a -s exit:0 ls + + echo "-A usage" + cat $WITH_a + echo "No -A usage" + cat $WITHOUT_a + + for dot_path in '\.f' '\.g'; do + atf_check -e empty -o not-empty -s exit:0 grep "${dot_path}" \ + $WITH_a + atf_check -e empty -o empty -s not-exit:0 grep "${dot_path}" \ + $WITHOUT_a + done } atf_test_case A_flag A_flag_head() { - atf_set "require.user" "unprivileged" + atf_set "descr" "Verify -A support with unprivileged users" } A_flag_body() { + create_test_dir + + atf_check -e empty -o empty -s exit:0 ls -A + create_test_inputs WITH_A=$PWD/../with_A.out @@ -84,6 +152,10 @@ A_flag_implied_when_root_head() A_flag_implied_when_root_body() { + create_test_dir + + atf_check -e empty -o empty -s exit:0 ls -A + create_test_inputs WITH_EXPLICIT=$PWD/../with_explicit_A.out @@ -100,9 +172,187 @@ A_flag_implied_when_root_body() atf_check_equal "$(cat $WITH_EXPLICIT)" "$(cat $WITH_IMPLIED)" } +atf_test_case B_flag +B_flag_head() +{ + atf_set "descr" "Verify that the output from ls -B prints out non-printable characters" +} + +B_flag_body() +{ + + atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" + atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B +} + +atf_test_case C_flag +C_flag_head() +{ + atf_set "descr" "Verify that the output from ls -C is multi-column, sorted down" +} + +C_flag_body() +{ + create_test_inputs + + WITH_C=$PWD/../with_C.out + + atf_check -e empty -o save:$WITH_C -s exit:0 ls -C + + echo "With -C usage" + cat $WITH_C + + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "0b00000001[[:space:]]+0b00000111[[:space:]]+0b00001101[[:space:]]+e[[:space:]]+stuv" $WITH_C + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "0b00000010[[:space:]]+0b00001000[[:space:]]+0b00001110[[:space:]]+h[[:space:]]+wxyz" $WITH_C +} + +atf_test_case I_flag +I_flag_head() +{ + atf_set "descr" "Verify that the output from ls -I is the same as ls for an unprivileged user" +} + +I_flag_body() +{ + create_test_inputs + + WITH_I=$PWD/../with_I.out + WITHOUT_I=$PWD/../without_I.out + + atf_check -e empty -o save:$WITH_I -s exit:0 ls -I + atf_check -e empty -o save:$WITHOUT_I -s exit:0 ls + + echo "Explicit -I usage" + cat $WITH_I + echo "No -I usage" + cat $WITHOUT_I + + atf_check_equal "$(cat $WITH_I)" "$(cat $WITHOUT_I)" +} + +atf_test_case I_flag_voids_implied_A_flag_when_root +I_flag_voids_implied_A_flag_when_root_head() +{ + atf_set "descr" "Verify that -I voids out implied -A for root" + atf_set "require.user" "root" +} + +I_flag_voids_implied_A_flag_when_root_body() +{ + create_test_inputs + + atf_check -o not-match:'\.f' -s exit:0 ls -I + atf_check -o not-match:'\.g' -s exit:0 ls -I + + atf_check -o match:'\.f' -s exit:0 ls -A -I + atf_check -o match:'\.g' -s exit:0 ls -A -I +} + +lcomma_flag_head() +{ + atf_set "descr" "Verify that -l, prints out the size with , delimiters" +} + +lcomma_flag_body() +{ + create_test_inputs + + atf_check \ + -o match:'\-rw\-r\-\-r\-\-[[:space:]]+.+[[:space:]]+1,000[[:space:]]+.+i' \ + env LC_ALL=en_US.ISO8859-1 ls -l, i +} + +x_flag_head() +{ + atf_set "descr" "Verify that -x prints out one item per line" +} + +x_flag_body() +{ + create_test_inputs + + WITH_x=$PWD/../with_x.out + + atf_check -e empty -o save:$WITH_x -s exit:0 ls -x + + echo "With -x usage" + cat $WITH_x + + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "a[[:space:]]+c[[:space:]]+d[[:space:]]+e[[:space:]]+h" $WITH_x + atf_check -e ignore -o not-empty -s exit:0 \ + egrep "i[[:space:]]+j[[:space:]]+klmn[[:space:]]+opqr[[:space:]]+stuv" $WITH_x +} + +1_flag_head() +{ + atf_set "descr" "Verify that -1 prints out one item per line" +} + +1_flag_body() +{ + create_test_inputs + + WITH_1=$PWD/../with_1.out + WITHOUT_1=$PWD/../without_1.out + + atf_check -e empty -o save:$WITH_1 -s exit:0 ls -1 + atf_check -e empty -o save:$WITHOUT_1 -s exit:0 \ + sh -c 'for i in $(ls); do echo $i; done' + + echo "Explicit -1 usage" + cat $WITH_1 + echo "No -1 usage" + cat $WITHOUT_1 + + atf_check_equal "$(cat $WITH_1)" "$(cat $WITHOUT_1)" +} + atf_init_test_cases() { atf_add_test_case A_flag atf_add_test_case A_flag_implied_when_root + atf_add_test_case B_flag + atf_add_test_case C_flag + #atf_add_test_case D_flag + #atf_add_test_case F_flag + #atf_add_test_case G_flag + #atf_add_test_case H_flag + atf_add_test_case I_flag + atf_add_test_case I_flag_voids_implied_A_flag_when_root + #atf_add_test_case L_flag + #atf_add_test_case P_flag + #atf_add_test_case R_flag + #atf_add_test_case S_flag + #atf_add_test_case T_flag + #atf_add_test_case U_flag + #atf_add_test_case W_flag + #atf_add_test_case Z_flag + atf_add_test_case a_flag + #atf_add_test_case b_flag + #atf_add_test_case c_flag + #atf_add_test_case d_flag + #atf_add_test_case f_flag + #atf_add_test_case g_flag + #atf_add_test_case h_flag + #atf_add_test_case i_flag + #atf_add_test_case k_flag + #atf_add_test_case l_flag + atf_add_test_case lcomma_flag + #atf_add_test_case m_flag + #atf_add_test_case n_flag + #atf_add_test_case o_flag + #atf_add_test_case p_flag + #atf_add_test_case q_flag + #atf_add_test_case r_flag + #atf_add_test_case s_flag + #atf_add_test_case t_flag + #atf_add_test_case u_flag + #atf_add_test_case w_flag + atf_add_test_case x_flag + #atf_add_test_case y_flag + atf_add_test_case 1_flag } Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Sep 28 03:31:01 2015 (r288329) +++ head/etc/mtree/BSD.tests.dist Mon Sep 28 03:36:15 2015 (r288330) @@ -14,6 +14,8 @@ .. expr .. + ls + .. mv .. pax From owner-svn-src-head@freebsd.org Mon Sep 28 06:26:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C2269CFC3D; Mon, 28 Sep 2015 06:26:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D2381F89; Mon, 28 Sep 2015 06:26:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S6QlN7017862; Mon, 28 Sep 2015 06:26:47 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S6Qllp017861; Mon, 28 Sep 2015 06:26:47 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509280626.t8S6Qllp017861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 28 Sep 2015 06:26:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288334 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 06:26:47 -0000 Author: adrian Date: Mon Sep 28 06:26:46 2015 New Revision: 288334 URL: https://svnweb.freebsd.org/changeset/base/288334 Log: Remove some debugging that wasn't supposed to be there. Modified: head/sys/net80211/ieee80211_superg.c Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Mon Sep 28 03:43:05 2015 (r288333) +++ head/sys/net80211/ieee80211_superg.c Mon Sep 28 06:26:46 2015 (r288334) @@ -679,8 +679,6 @@ ieee80211_ff_check(struct ieee80211_node * If there is no frame to combine with and the pps is * too low; then do not attempt to aggregate this frame. */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SUPERG, - "%s: staged: %p; pps: %d\n", __func__, mstaged, ieee80211_txampdu_getpps(tap)); if (mstaged == NULL && ieee80211_txampdu_getpps(tap) < ieee80211_ffppsmin) { IEEE80211_UNLOCK(ic); From owner-svn-src-head@freebsd.org Mon Sep 28 07:23:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7E5BA0A402; Mon, 28 Sep 2015 07:23:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D81621C7F; Mon, 28 Sep 2015 07:23:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8S7N5BU042277; Mon, 28 Sep 2015 07:23:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8S7N5XW042276; Mon, 28 Sep 2015 07:23:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201509280723.t8S7N5XW042276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Sep 2015 07:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288335 - head/usr.bin/usbhidaction X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 07:23:06 -0000 Author: hselasky Date: Mon Sep 28 07:23:05 2015 New Revision: 288335 URL: https://svnweb.freebsd.org/changeset/base/288335 Log: Store PID after becoming a daemon() and not before to ensure the correct PID gets written to the PID file. Submitted by: Maxime Soule PR: 203252 MFC after: 2 weeks Modified: head/usr.bin/usbhidaction/usbhidaction.c Modified: head/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- head/usr.bin/usbhidaction/usbhidaction.c Mon Sep 28 06:26:46 2015 (r288334) +++ head/usr.bin/usbhidaction/usbhidaction.c Mon Sep 28 07:23:05 2015 (r288335) @@ -166,17 +166,15 @@ main(int argc, char **argv) if (demon) { fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH); - if (fp >= 0) { - sz1 = snprintf(buf, sizeof buf, "%ld\n", - (long)getpid()); - if (sz1 > sizeof buf) - sz1 = sizeof buf; - write(fp, buf, sz1); - close(fp); - } else + if (fp < 0) err(1, "%s", pidfile); if (daemon(0, 0) < 0) err(1, "daemon()"); + snprintf(buf, sizeof(buf), "%ld\n", (long)getpid()); + sz1 = strlen(buf); + if (write(fp, buf, sz1) < 0) + err(1, "%s", pidfile); + close(fp); isdemon = 1; } From owner-svn-src-head@freebsd.org Mon Sep 28 12:14:20 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DBEBA0B489; Mon, 28 Sep 2015 12:14:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D3771D59; Mon, 28 Sep 2015 12:14:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCEK2d062631; Mon, 28 Sep 2015 12:14:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCEGBU062616; Mon, 28 Sep 2015 12:14:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281214.t8SCEGBU062616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288336 - in head/sys: compat/linux kern tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 12:14:20 -0000 Author: avg Date: Mon Sep 28 12:14:16 2015 New Revision: 288336 URL: https://svnweb.freebsd.org/changeset/base/288336 Log: save some bytes by using more concise SDT_PROBE instead of SDT_PROBE SDT_PROBE requires 5 parameters whereas SDT_PROBE requires n parameters where n is typically smaller than 5. Perhaps SDT_PROBE should be made a private implementation detail. MFC after: 20 days Modified: head/sys/compat/linux/linux_dtrace.h head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_proc.c head/sys/kern/kern_racct.c head/sys/kern/kern_sig.c head/sys/kern/kern_timeout.c head/sys/kern/vfs_cache.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_syscalls.c head/sys/tools/vnode_if.awk Modified: head/sys/compat/linux/linux_dtrace.h ============================================================================== --- head/sys/compat/linux/linux_dtrace.h Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/compat/linux/linux_dtrace.h Mon Sep 28 12:14:16 2015 (r288336) @@ -82,7 +82,7 @@ c, d, e, f) #define LIN_SDT_PROBE4(a, b, c, d, e, f, g) SDT_PROBE4(LINUX_DTRACE, a, b, \ c, d, e, f, g) -#define _LIN_SDT_PROBE5(a, b, c, d, e, f, g, h, i) SDT_PROBE(a, b, c, d, \ +#define _LIN_SDT_PROBE5(a, b, c, d, e, f, g, h, i) SDT_PROBE5(a, b, c, d, \ e, f, g, h, i) #define LIN_SDT_PROBE5(a, b, c, d, e, f, g, h) _LIN_SDT_PROBE5(LINUX_DTRACE, \ a, b, c, d, e, f, g, h) Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_exec.c Mon Sep 28 12:14:16 2015 (r288336) @@ -418,7 +418,7 @@ do_execve(td, args, mac_p) | AUDITVNODE1, UIO_SYSSPACE, args->fname, td); } - SDT_PROBE(proc, kernel, , exec, args->fname, 0, 0, 0, 0 ); + SDT_PROBE1(proc, kernel, , exec, args->fname); interpret: if (args->fname != NULL) { @@ -846,7 +846,7 @@ interpret: vfs_mark_atime(imgp->vp, td->td_ucred); - SDT_PROBE(proc, kernel, , exec__success, args->fname, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exec__success, args->fname); VOP_UNLOCK(imgp->vp, 0); done1: @@ -918,7 +918,7 @@ exec_fail: p->p_flag &= ~P_INEXEC; PROC_UNLOCK(p); - SDT_PROBE(proc, kernel, , exec__failure, error, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exec__failure, error); done2: #ifdef MAC Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_exit.c Mon Sep 28 12:14:16 2015 (r288336) @@ -569,7 +569,7 @@ exit1(struct thread *td, int rval, int s reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; - SDT_PROBE(proc, kernel, , exit, reason, 0, 0, 0, 0); + SDT_PROBE1(proc, kernel, , exit, reason); #endif /* Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_fork.c Mon Sep 28 12:14:16 2015 (r288336) @@ -753,7 +753,7 @@ do_fork(struct thread *td, int flags, st * Tell any interested parties about the new process. */ knote_fork(&p1->p_klist, p2->p_pid); - SDT_PROBE(proc, kernel, , create, p2, p1, flags, 0, 0); + SDT_PROBE3(proc, kernel, , create, p2, p1, flags); /* * Wait until debugger is attached to child. Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_proc.c Mon Sep 28 12:14:16 2015 (r288336) @@ -181,9 +181,9 @@ proc_ctor(void *mem, int size, void *arg struct proc *p; p = (struct proc *)mem; - SDT_PROBE(proc, kernel, ctor , entry, p, size, arg, flags, 0); + SDT_PROBE4(proc, kernel, ctor , entry, p, size, arg, flags); EVENTHANDLER_INVOKE(process_ctor, p); - SDT_PROBE(proc, kernel, ctor , return, p, size, arg, flags, 0); + SDT_PROBE4(proc, kernel, ctor , return, p, size, arg, flags); return (0); } @@ -199,7 +199,7 @@ proc_dtor(void *mem, int size, void *arg /* INVARIANTS checks go here */ p = (struct proc *)mem; td = FIRST_THREAD_IN_PROC(p); - SDT_PROBE(proc, kernel, dtor, entry, p, size, arg, td, 0); + SDT_PROBE4(proc, kernel, dtor, entry, p, size, arg, td); if (td != NULL) { #ifdef INVARIANTS KASSERT((p->p_numthreads == 1), @@ -212,7 +212,7 @@ proc_dtor(void *mem, int size, void *arg EVENTHANDLER_INVOKE(process_dtor, p); if (p->p_ksi != NULL) KASSERT(! KSI_ONQ(p->p_ksi), ("SIGCHLD queue")); - SDT_PROBE(proc, kernel, dtor, return, p, size, arg, 0, 0); + SDT_PROBE3(proc, kernel, dtor, return, p, size, arg); } /* @@ -224,7 +224,7 @@ proc_init(void *mem, int size, int flags struct proc *p; p = (struct proc *)mem; - SDT_PROBE(proc, kernel, init, entry, p, size, flags, 0, 0); + SDT_PROBE3(proc, kernel, init, entry, p, size, flags); p->p_sched = (struct p_sched *)&p[1]; mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW); mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_NEW); @@ -236,7 +236,7 @@ proc_init(void *mem, int size, int flags TAILQ_INIT(&p->p_threads); /* all threads in proc */ EVENTHANDLER_INVOKE(process_init, p); p->p_stats = pstats_alloc(); - SDT_PROBE(proc, kernel, init, return, p, size, flags, 0, 0); + SDT_PROBE3(proc, kernel, init, return, p, size, flags); return (0); } Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_racct.c Mon Sep 28 12:14:16 2015 (r288336) @@ -445,7 +445,7 @@ racct_create(struct racct **racctp) if (!racct_enable) return; - SDT_PROBE(racct, kernel, racct, create, racctp, 0, 0, 0, 0); + SDT_PROBE1(racct, kernel, racct, create, racctp); KASSERT(*racctp == NULL, ("racct already allocated")); @@ -460,7 +460,7 @@ racct_destroy_locked(struct racct **racc ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, racct, destroy, racctp, 0, 0, 0, 0); + SDT_PROBE1(racct, kernel, racct, destroy, racctp); mtx_assert(&racct_lock, MA_OWNED); KASSERT(racctp != NULL, ("NULL racctp")); @@ -538,7 +538,7 @@ racct_add_locked(struct proc *p, int res ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -548,8 +548,8 @@ racct_add_locked(struct proc *p, int res #ifdef RCTL error = rctl_enforce(p, resource, amount); if (error && RACCT_IS_DENIABLE(resource)) { - SDT_PROBE(racct, kernel, rusage, add__failure, p, resource, - amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__failure, p, resource, + amount); return (error); } #endif @@ -584,8 +584,7 @@ racct_add_cred_locked(struct ucred *cred ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, add__cred, cred, resource, amount, - 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__cred, cred, resource, amount); racct_adjust_resource(cred->cr_ruidinfo->ui_racct, resource, amount); for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) @@ -623,7 +622,7 @@ racct_add_force(struct proc *p, int reso if (!racct_enable) return; - SDT_PROBE(racct, kernel, rusage, add__force, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, add__force, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -647,7 +646,7 @@ racct_set_locked(struct proc *p, int res ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -679,8 +678,8 @@ racct_set_locked(struct proc *p, int res if (diff_proc > 0) { error = rctl_enforce(p, resource, diff_proc); if (error && RACCT_IS_DENIABLE(resource)) { - SDT_PROBE(racct, kernel, rusage, set__failure, p, - resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set__failure, p, + resource, amount); return (error); } } @@ -723,7 +722,7 @@ racct_set_force_locked(struct proc *p, i ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, set, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -834,7 +833,7 @@ racct_sub(struct proc *p, int resource, if (!racct_enable) return; - SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0); + SDT_PROBE3(racct, kernel, rusage, sub, p, resource, amount); /* * We need proc lock to dereference p->p_ucred. @@ -861,8 +860,7 @@ racct_sub_cred_locked(struct ucred *cred ASSERT_RACCT_ENABLED(); - SDT_PROBE(racct, kernel, rusage, sub__cred, cred, resource, amount, - 0, 0); + SDT_PROBE3(racct, kernel, rusage, sub__cred, cred, resource, amount); #ifdef notyet KASSERT(RACCT_CAN_DROP(resource), Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_sig.c Mon Sep 28 12:14:16 2015 (r288336) @@ -1308,7 +1308,7 @@ kern_sigtimedwait(struct thread *td, sig reschedule_signals(p, new_block, 0); if (error == 0) { - SDT_PROBE(proc, kernel, , signal__clear, sig, ksi, 0, 0, 0); + SDT_PROBE2(proc, kernel, , signal__clear, sig, ksi); if (ksi->ksi_code == SI_TIMER) itimer_accept(p, ksi->ksi_timerid, ksi); @@ -2121,7 +2121,7 @@ tdsendsignal(struct proc *p, struct thre } else sigqueue = &td->td_sigqueue; - SDT_PROBE(proc, kernel, , signal__send, td, p, sig, 0, 0 ); + SDT_PROBE3(proc, kernel, , signal__send, td, p, sig); /* * If the signal is being ignored, @@ -2132,7 +2132,7 @@ tdsendsignal(struct proc *p, struct thre */ mtx_lock(&ps->ps_mtx); if (SIGISMEMBER(ps->ps_sigignore, sig)) { - SDT_PROBE(proc, kernel, , signal__discard, td, p, sig, 0, 0 ); + SDT_PROBE3(proc, kernel, , signal__discard, td, p, sig); mtx_unlock(&ps->ps_mtx); if (ksi && (ksi->ksi_flags & KSI_INS)) Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/kern_timeout.c Mon Sep 28 12:14:16 2015 (r288336) @@ -718,9 +718,9 @@ softclock_call_cc(struct callout *c, str sbt1 = sbinuptime(); #endif THREAD_NO_SLEEPING(); - SDT_PROBE(callout_execute, kernel, , callout__start, c, 0, 0, 0, 0); + SDT_PROBE1(callout_execute, kernel, , callout__start, c); c_func(c_arg); - SDT_PROBE(callout_execute, kernel, , callout__end, c, 0, 0, 0, 0); + SDT_PROBE1(callout_execute, kernel, , callout__end, c); THREAD_SLEEPING_OK(); #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) sbt2 = sbinuptime(); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_cache.c Mon Sep 28 12:14:16 2015 (r288336) @@ -419,11 +419,11 @@ cache_zap(ncp) CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, ncp->nc_vp); #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { - SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - nc_get_name(ncp), ncp->nc_vp, 0, 0); + SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, + nc_get_name(ncp), ncp->nc_vp); } else { - SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - nc_get_name(ncp), 0, 0, 0); + SDT_PROBE2(vfs, namecache, zap_negative, done, ncp->nc_dvp, + nc_get_name(ncp)); } #endif vp = NULL; @@ -498,8 +498,7 @@ retry_wlocked: CTR2(KTR_VFS, "cache_lookup(%p, %s) found via .", dvp, cnp->cn_nameptr); dothits++; - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ".", - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ".", *vpp); if (tsp != NULL) timespecclear(tsp); if (ticksp != NULL) @@ -509,8 +508,8 @@ retry_wlocked: if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { dotdothits++; if (dvp->v_cache_dd == NULL) { - SDT_PROBE(vfs, namecache, lookup, miss, dvp, - "..", NULL, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, miss, dvp, + "..", NULL); goto unlock; } if ((cnp->cn_flags & MAKEENTRY) == 0) { @@ -532,8 +531,8 @@ retry_wlocked: goto negative_success; CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", dvp, cnp->cn_nameptr, *vpp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, "..", + *vpp); cache_out_ts(ncp, tsp, ticksp); if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == NCF_DTS && tsp != NULL) @@ -554,8 +553,8 @@ retry_wlocked: /* We failed to find an entry */ if (ncp == NULL) { - SDT_PROBE(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, + NULL); if ((cnp->cn_flags & MAKEENTRY) == 0) { nummisszap++; } else { @@ -583,8 +582,8 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), - *vpp, 0, 0); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), + *vpp); cache_out_ts(ncp, tsp, ticksp); goto success; } @@ -615,8 +614,8 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit__negative, dvp, nc_get_name(ncp), - 0, 0, 0); + SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, + nc_get_name(ncp)); cache_out_ts(ncp, tsp, ticksp); CACHE_WUNLOCK(); return (ENOENT); @@ -769,8 +768,7 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp return; } dvp->v_cache_dd = NULL; - SDT_PROBE(vfs, namecache, enter, done, dvp, "..", vp, - 0, 0); + SDT_PROBE3(vfs, namecache, enter, done, dvp, "..", vp); CACHE_WUNLOCK(); flag = NCF_ISDOTDOT; } @@ -890,12 +888,12 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), - vp, 0, 0); + SDT_PROBE3(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - nc_get_name(ncp), 0, 0, 0); + SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, + nc_get_name(ncp)); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -984,7 +982,7 @@ cache_purge(vp) { CTR1(KTR_VFS, "cache_purge(%p)", vp); - SDT_PROBE(vfs, namecache, purge, done, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purge, done, vp); CACHE_WLOCK(); while (!LIST_EMPTY(&vp->v_cache_src)) cache_zap(LIST_FIRST(&vp->v_cache_src)); @@ -1009,7 +1007,7 @@ cache_purge_negative(vp) struct namecache *cp, *ncp; CTR1(KTR_VFS, "cache_purge_negative(%p)", vp); - SDT_PROBE(vfs, namecache, purge_negative, done, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purge_negative, done, vp); CACHE_WLOCK(); LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) { if (cp->nc_vp == NULL) @@ -1029,7 +1027,7 @@ cache_purgevfs(mp) struct namecache *ncp, *nnp; /* Scan hash tables for applicable entries */ - SDT_PROBE(vfs, namecache, purgevfs, done, mp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, purgevfs, done, mp); CACHE_WLOCK(); for (ncpp = &nchashtbl[nchash]; ncpp >= nchashtbl; ncpp--) { LIST_FOREACH_SAFE(ncp, ncpp, nc_hash, nnp) { @@ -1253,14 +1251,14 @@ vn_vptocnp_locked(struct vnode **vp, str vrele(*vp); numfullpathfail4++; error = ENOMEM; - SDT_PROBE(vfs, namecache, fullpath, return, error, - vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, + vp, NULL); return (error); } *buflen -= ncp->nc_nlen; memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); - SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - nc_get_name(ncp), vp, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, hit, ncp->nc_dvp, + nc_get_name(ncp), vp); dvp = *vp; *vp = ncp->nc_dvp; vref(*vp); @@ -1269,7 +1267,7 @@ vn_vptocnp_locked(struct vnode **vp, str CACHE_RLOCK(); return (0); } - SDT_PROBE(vfs, namecache, fullpath, miss, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, fullpath, miss, vp); CACHE_RUNLOCK(); vn_lock(*vp, LK_SHARED | LK_RETRY); @@ -1277,8 +1275,7 @@ vn_vptocnp_locked(struct vnode **vp, str vput(*vp); if (error) { numfullpathfail2++; - SDT_PROBE(vfs, namecache, fullpath, return, error, vp, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, vp, NULL); return (error); } @@ -1289,8 +1286,7 @@ vn_vptocnp_locked(struct vnode **vp, str CACHE_RUNLOCK(); vrele(dvp); error = ENOENT; - SDT_PROBE(vfs, namecache, fullpath, return, error, vp, - NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, vp, NULL); return (error); } /* @@ -1318,7 +1314,7 @@ vn_fullpath1(struct thread *td, struct v error = 0; slash_prefixed = 0; - SDT_PROBE(vfs, namecache, fullpath, entry, vp, 0, 0, 0, 0); + SDT_PROBE1(vfs, namecache, fullpath, entry, vp); numfullpathcalls++; vref(vp); CACHE_RLOCK(); @@ -1340,8 +1336,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); error = ENOENT; - SDT_PROBE(vfs, namecache, fullpath, return, - error, vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, + error, vp, NULL); break; } vp1 = vp->v_mount->mnt_vnodecovered; @@ -1357,8 +1353,8 @@ vn_fullpath1(struct thread *td, struct v vrele(vp); numfullpathfail1++; error = ENOTDIR; - SDT_PROBE(vfs, namecache, fullpath, return, - error, vp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, + error, vp, NULL); break; } error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen); @@ -1368,8 +1364,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); error = ENOMEM; - SDT_PROBE(vfs, namecache, fullpath, return, error, - startvp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, error, + startvp, NULL); break; } buf[--buflen] = '/'; @@ -1382,8 +1378,8 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); numfullpathfail4++; - SDT_PROBE(vfs, namecache, fullpath, return, ENOMEM, - startvp, NULL, 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, ENOMEM, + startvp, NULL); return (ENOMEM); } buf[--buflen] = '/'; @@ -1392,8 +1388,7 @@ vn_fullpath1(struct thread *td, struct v CACHE_RUNLOCK(); vrele(vp); - SDT_PROBE(vfs, namecache, fullpath, return, 0, startvp, buf + buflen, - 0, 0); + SDT_PROBE3(vfs, namecache, fullpath, return, 0, startvp, buf + buflen); *retbuf = buf + buflen; return (0); } Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_lookup.c Mon Sep 28 12:14:16 2015 (r288336) @@ -299,16 +299,15 @@ namei(struct nameidata *ndp) namei_cleanup_cnp(cnp); return (error); } - SDT_PROBE(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, - cnp->cn_flags, 0, 0); + SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, + cnp->cn_flags); for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); if (error != 0) { vrele(ndp->ni_rootdir); namei_cleanup_cnp(cnp); - SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, - 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, error, NULL); return (error); } /* @@ -321,8 +320,7 @@ namei(struct nameidata *ndp) } else cnp->cn_flags |= HASBUF; - SDT_PROBE(vfs, namei, lookup, return, 0, ndp->ni_vp, - 0, 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, 0, ndp->ni_vp); return (0); } if (ndp->ni_loopcnt++ >= MAXSYMLINKS) { @@ -397,7 +395,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); - SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); + SDT_PROBE2(vfs, namei, lookup, return, error, NULL); return (error); } Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/kern/vfs_syscalls.c Mon Sep 28 12:14:16 2015 (r288336) @@ -2160,9 +2160,9 @@ kern_statat(struct thread *td, int flag, return (error); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); if (error == 0) { - SDT_PROBE(vfs, , stat, mode, path, sb.st_mode, 0, 0, 0); + SDT_PROBE2(vfs, , stat, mode, path, sb.st_mode); if (S_ISREG(sb.st_mode)) - SDT_PROBE(vfs, , stat, reg, path, pathseg, 0, 0, 0); + SDT_PROBE2(vfs, , stat, reg, path, pathseg); if (__predict_false(hook != NULL)) hook(nd.ni_vp, &sb); } Modified: head/sys/tools/vnode_if.awk ============================================================================== --- head/sys/tools/vnode_if.awk Mon Sep 28 07:23:05 2015 (r288335) +++ head/sys/tools/vnode_if.awk Mon Sep 28 12:14:16 2015 (r288336) @@ -359,7 +359,7 @@ while ((getline < srcfile) > 0) { printc("\t vop->"name" == NULL && vop->vop_bypass == NULL)") printc("\t\tvop = vop->vop_default;") printc("\tVNASSERT(vop != NULL, a->a_" args[0]", (\"No "name"(%p, %p)\", a->a_" args[0]", a));") - printc("\tSDT_PROBE(vfs, vop, " name ", entry, a->a_" args[0] ", a, 0, 0, 0);\n"); + printc("\tSDT_PROBE2(vfs, vop, " name ", entry, a->a_" args[0] ", a);\n"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "Entry", "\t"); printc("\tKTR_START" ctrstr); @@ -370,7 +370,7 @@ while ((getline < srcfile) > 0) { printc("\telse") printc("\t\trc = vop->vop_bypass(&a->a_gen);") printc("\tVFS_EPILOGUE(a->a_" args[0]"->v_mount);") - printc("\tSDT_PROBE(vfs, vop, " name ", return, a->a_" args[0] ", a, rc, 0, 0);\n"); + printc("\tSDT_PROBE3(vfs, vop, " name ", return, a->a_" args[0] ", a, rc);\n"); printc("\tif (rc == 0) {"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "OK", "\t\t"); From owner-svn-src-head@freebsd.org Mon Sep 28 12:23:11 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B95E3A0B919; Mon, 28 Sep 2015 12:23:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92168126B; Mon, 28 Sep 2015 12:23:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCNBTi066906; Mon, 28 Sep 2015 12:23:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCNBs7066905; Mon, 28 Sep 2015 12:23:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281223.t8SCNBs7066905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288337 - head/cddl/contrib/opensolaris/common/avl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 12:23:11 -0000 Author: avg Date: Mon Sep 28 12:23:10 2015 New Revision: 288337 URL: https://svnweb.freebsd.org/changeset/base/288337 Log: remove an extra copy of avl.c from illumos contrib code MFC after: 20 days Deleted: head/cddl/contrib/opensolaris/common/avl/avl.c From owner-svn-src-head@freebsd.org Mon Sep 28 12:38:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FB1CA0A023; Mon, 28 Sep 2015 12:38:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C0D61B5D; Mon, 28 Sep 2015 12:38:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SCcxLl072137; Mon, 28 Sep 2015 12:38:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SCcwCJ072132; Mon, 28 Sep 2015 12:38:58 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281238.t8SCcwCJ072132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 12:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288339 - in head: . cddl/contrib/opensolaris/cmd/sgs cddl/usr.bin cddl/usr.bin/sgsmsg targets/pseudo/userland/cddl tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 12:38:59 -0000 Author: avg Date: Mon Sep 28 12:38:57 2015 New Revision: 288339 URL: https://svnweb.freebsd.org/changeset/base/288339 Log: remove unused sgsmsg utility (originally imported from opensolaris) MFC after: 25 days Deleted: head/cddl/contrib/opensolaris/cmd/sgs/ head/cddl/usr.bin/sgsmsg/ Modified: head/Makefile.inc1 head/ObsoleteFiles.inc head/cddl/usr.bin/Makefile head/targets/pseudo/userland/cddl/Makefile.depend head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Sep 28 12:30:22 2015 (r288338) +++ head/Makefile.inc1 Mon Sep 28 12:38:57 2015 (r288339) @@ -1497,7 +1497,7 @@ _btxld= usr.sbin/btxld # Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures # resulting from missing bug fixes or ELF Toolchain updates. .if ${MK_CDDL} != "no" -_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \ +_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ cddl/usr.bin/ctfmerge .endif Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Sep 28 12:30:22 2015 (r288338) +++ head/ObsoleteFiles.inc Mon Sep 28 12:38:57 2015 (r288339) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150928: unused sgsmsg utility is removed +OLD_FILES+=usr/bin/sgsmsg # 20150926: remove links to removed/unimplemented mbuf(9) macros OLD_FILES+=usr/share/man/man9/MEXT_ADD_REF.9.gz OLD_FILES+=usr/share/man/man9/MEXTFREE.9.gz Modified: head/cddl/usr.bin/Makefile ============================================================================== --- head/cddl/usr.bin/Makefile Mon Sep 28 12:30:22 2015 (r288338) +++ head/cddl/usr.bin/Makefile Mon Sep 28 12:38:57 2015 (r288339) @@ -6,7 +6,6 @@ SUBDIR= \ ctfconvert \ ctfdump \ ctfmerge \ - sgsmsg \ ${_tests} \ ${_zinject} \ ${_zlook} \ Modified: head/targets/pseudo/userland/cddl/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/cddl/Makefile.depend Mon Sep 28 12:30:22 2015 (r288338) +++ head/targets/pseudo/userland/cddl/Makefile.depend Mon Sep 28 12:38:57 2015 (r288339) @@ -12,7 +12,6 @@ DIRDEPS = \ cddl/lib/libnvpair \ cddl/lib/libumem \ cddl/lib/libuutil \ - cddl/usr.bin/sgsmsg \ DIRDEPS.CTF = \ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 28 12:30:22 2015 (r288338) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 28 12:38:57 2015 (r288339) @@ -910,7 +910,6 @@ OLD_LIBS+=lib/libuutil.so.2 OLD_FILES+=usr/bin/ctfconvert OLD_FILES+=usr/bin/ctfdump OLD_FILES+=usr/bin/ctfmerge -OLD_FILES+=usr/bin/sgsmsg OLD_FILES+=usr/lib/dtrace/drti.o OLD_FILES+=usr/lib/dtrace/errno.d OLD_FILES+=usr/lib/dtrace/io.d From owner-svn-src-head@freebsd.org Mon Sep 28 15:25:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1984EA0AA61; Mon, 28 Sep 2015 15:25:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E37A01ADF; Mon, 28 Sep 2015 15:25:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SFPbt7041708; Mon, 28 Sep 2015 15:25:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SFPbIk041704; Mon, 28 Sep 2015 15:25:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509281525.t8SFPbIk041704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Sep 2015 15:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288340 - in head: cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/contrib/opensolaris/common/nvpair X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 15:25:38 -0000 Author: avg Date: Mon Sep 28 15:25:36 2015 New Revision: 288340 URL: https://svnweb.freebsd.org/changeset/base/288340 Log: define aok in libnvpair which is linked to all zfs libraries that need aok This removes the circular dependency of libnvpair on libzfs / libzpool. PR: 199811 Obtained from: bapt MFC after: 23 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Mon Sep 28 15:25:36 2015 (r288340) @@ -55,7 +55,6 @@ #include "zfs_prop.h" #include "zfeature_common.h" -int aok; int libzfs_errno(libzfs_handle_t *hdl) Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Mon Sep 28 15:25:36 2015 (r288340) @@ -45,7 +45,9 @@ * Emulation of kernel services in userland. */ +#ifndef __FreeBSD__ int aok; +#endif uint64_t physmem; vnode_t *rootdir = (vnode_t *)0xabcd1234; char hw_serial[HW_HOSTID_LEN]; Modified: head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Mon Sep 28 12:38:57 2015 (r288339) +++ head/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c Mon Sep 28 15:25:36 2015 (r288340) @@ -44,6 +44,14 @@ #endif #define skip_whitespace(p) while ((*(p) == ' ') || (*(p) == '\t')) p++ +#if defined(__FreeBSD__) && !defined(_KERNEL) +/* + * libnvpair is the lowest commen denominator for ZFS related libraries, + * defining aok here makes it usable by all ZFS related libraries + */ +int aok; +#endif + /* * nvpair.c - Provides kernel & userland interfaces for manipulating * name-value pairs. From owner-svn-src-head@freebsd.org Mon Sep 28 16:33:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E429A0B3CB; Mon, 28 Sep 2015 16:33:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F9C913AA; Mon, 28 Sep 2015 16:33:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SGXdZq071069; Mon, 28 Sep 2015 16:33:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SGXdEN071068; Mon, 28 Sep 2015 16:33:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281633.t8SGXdEN071068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 16:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288341 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 16:33:39 -0000 Author: gjb Date: Mon Sep 28 16:33:38 2015 New Revision: 288341 URL: https://svnweb.freebsd.org/changeset/base/288341 Log: Honor VMFORMATS and VMSIZE if set in release.conf. PR: 203420 Submitted by: luca pizzamiglio gmail com MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 15:25:36 2015 (r288340) +++ head/release/release.sh Mon Sep 28 16:33:38 2015 (r288341) @@ -208,6 +208,7 @@ env_check() { RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${DOCPORTS} \ WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ + VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE} \ WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" return 0 From owner-svn-src-head@freebsd.org Mon Sep 28 18:19:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC7E1A0B44D; Mon, 28 Sep 2015 18:19:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D6CE104B; Mon, 28 Sep 2015 18:19:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SIJN4u012601; Mon, 28 Sep 2015 18:19:23 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SIJNDr012600; Mon, 28 Sep 2015 18:19:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509281819.t8SIJNDr012600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 28 Sep 2015 18:19:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288344 - head/usr.bin/systat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 18:19:23 -0000 Author: delphij Date: Mon Sep 28 18:19:22 2015 New Revision: 288344 URL: https://svnweb.freebsd.org/changeset/base/288344 Log: Use _PATH_DEVNULL instead of direct hardcoding. MFC after: 2 weeks Modified: head/usr.bin/systat/main.c Modified: head/usr.bin/systat/main.c ============================================================================== --- head/usr.bin/systat/main.c Mon Sep 28 17:30:07 2015 (r288343) +++ head/usr.bin/systat/main.c Mon Sep 28 18:19:22 2015 (r288344) @@ -178,7 +178,7 @@ main(int argc, char **argv) * devices. We can now use sysctl only. */ use_kvm = 0; - kd = kvm_openfiles("/dev/null", "/dev/null", "/dev/null", + kd = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, _PATH_DEVNULL, O_RDONLY, errbuf); if (kd == NULL) { error("%s", errbuf); From owner-svn-src-head@freebsd.org Mon Sep 28 18:39:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C9EFA0A376; Mon, 28 Sep 2015 18:39:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B14713BA; Mon, 28 Sep 2015 18:39:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SIdMWY021923; Mon, 28 Sep 2015 18:39:22 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SIdMOw021922; Mon, 28 Sep 2015 18:39:22 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281839.t8SIdMOw021922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 18:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288345 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 18:39:22 -0000 Author: gjb Date: Mon Sep 28 18:39:21 2015 New Revision: 288345 URL: https://svnweb.freebsd.org/changeset/base/288345 Log: In followup to r288341, ensure VMFORMATS and VMSIZE are not set to empty values, which would result in nonintuitive build errors. MFC after: 3 days X-MFC-With: r288341 PR: 203420 (related to) Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 18:19:22 2015 (r288344) +++ head/release/release.sh Mon Sep 28 18:39:21 2015 (r288345) @@ -208,7 +208,6 @@ env_check() { RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${DOCPORTS} \ WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ - VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE} \ WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" return 0 @@ -312,6 +311,18 @@ chroot_build_target() { # chroot_build_release(): Invoke the 'make release' target. chroot_build_release() { load_target_env + if [ ! -z "${WITH_VMIMAGES}" ]; then + if [ -z "${VMFORMATS}" ]; then + VMFORMATS="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMFORMATS)" + fi + if [ -z "${VMSIZE}" ]; then + VMSIZE="$(eval chroot ${CHROOTDIR} \ + make -C /usr/src/release -V VMSIZE)" + fi + fi + RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} VMFORMATS=\"${VMFORMATS}\" \ + VMSIZE=${VMSIZE}" eval chroot ${CHROOTDIR} make -C /usr/src/release \ ${RELEASE_RMAKEFLAGS} release eval chroot ${CHROOTDIR} make -C /usr/src/release \ From owner-svn-src-head@freebsd.org Mon Sep 28 19:19:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0317A0A39E; Mon, 28 Sep 2015 19:19:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1688134A; Mon, 28 Sep 2015 19:19:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SJJrOP038606; Mon, 28 Sep 2015 19:19:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SJJrQM038605; Mon, 28 Sep 2015 19:19:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509281919.t8SJJrQM038605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 28 Sep 2015 19:19:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288347 - head/release X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 19:19:53 -0000 Author: gjb Date: Mon Sep 28 19:19:53 2015 New Revision: 288347 URL: https://svnweb.freebsd.org/changeset/base/288347 Log: Append VMFORMATS and VMSIZE to RELEASE_RMAKEFLAGS only if WITH_VMIMAGES is set. MFC after: 3 days X-MFC-With: r288341, r288345 Sponsored by: The FreeBSD Foundation Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Mon Sep 28 18:58:27 2015 (r288346) +++ head/release/release.sh Mon Sep 28 19:19:53 2015 (r288347) @@ -320,9 +320,9 @@ chroot_build_release() { VMSIZE="$(eval chroot ${CHROOTDIR} \ make -C /usr/src/release -V VMSIZE)" fi + RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} \ + VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE}" fi - RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} VMFORMATS=\"${VMFORMATS}\" \ - VMSIZE=${VMSIZE}" eval chroot ${CHROOTDIR} make -C /usr/src/release \ ${RELEASE_RMAKEFLAGS} release eval chroot ${CHROOTDIR} make -C /usr/src/release \ From owner-svn-src-head@freebsd.org Mon Sep 28 20:54:20 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B9D0A0A267; Mon, 28 Sep 2015 20:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BCFE1577; Mon, 28 Sep 2015 20:54:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8SKsK2W080356; Mon, 28 Sep 2015 20:54:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8SKsIrA080346; Mon, 28 Sep 2015 20:54:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509282054.t8SKsIrA080346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 28 Sep 2015 20:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288348 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 20:54:20 -0000 Author: mav Date: Mon Sep 28 20:54:18 2015 New Revision: 288348 URL: https://svnweb.freebsd.org/changeset/base/288348 Log: Umplement media load/eject support for removable devices. In case of block backend eject really closes the backing store, while load tries to open it back. Failed store open is reported as no media. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl.h 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_cmd_table.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_io.h head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl.c Mon Sep 28 20:54:18 2015 (r288348) @@ -3716,46 +3716,6 @@ ctl_zero_io(union ctl_io *io) io->io_hdr.pool = pool_ref; } -/* - * This routine is currently used for internal copies of ctl_ios that need - * to persist for some reason after we've already returned status to the - * FETD. (Thus the flag set.) - * - * XXX XXX - * Note that this makes a blind copy of all fields in the ctl_io, except - * for the pool reference. This includes any memory that has been - * allocated! That memory will no longer be valid after done has been - * called, so this would be VERY DANGEROUS for command that actually does - * any reads or writes. Right now (11/7/2005), this is only used for immediate - * start and stop commands, which don't transfer any data, so this is not a - * problem. If it is used for anything else, the caller would also need to - * allocate data buffer space and this routine would need to be modified to - * copy the data buffer(s) as well. - */ -void -ctl_copy_io(union ctl_io *src, union ctl_io *dest) -{ - void *pool_ref; - - if ((src == NULL) - || (dest == NULL)) - return; - - /* - * May need to preserve linked list pointers at some point too. - */ - pool_ref = dest->io_hdr.pool; - - memcpy(dest, src, MIN(sizeof(*src), sizeof(*dest))); - - dest->io_hdr.pool = pool_ref; - /* - * We need to know that this is an internal copy, and doesn't need - * to get passed back to the FETD that allocated it. - */ - dest->io_hdr.flags |= CTL_FLAG_INT_COPY; -} - int ctl_expand_number(const char *buf, uint64_t *num) { @@ -4449,15 +4409,13 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; atomic_add_int(&be_lun->be->num_luns, 1); - if (be_lun->flags & CTL_LUN_FLAG_OFFLINE) - lun->flags |= CTL_LUN_OFFLINE; - - if (be_lun->flags & CTL_LUN_FLAG_POWERED_OFF) + if (be_lun->flags & CTL_LUN_FLAG_EJECTED) + lun->flags |= CTL_LUN_EJECTED; + if (be_lun->flags & CTL_LUN_FLAG_NO_MEDIA) + lun->flags |= CTL_LUN_NO_MEDIA; + if (be_lun->flags & CTL_LUN_FLAG_STOPPED) lun->flags |= CTL_LUN_STOPPED; - if (be_lun->flags & CTL_LUN_FLAG_INOPERABLE) - lun->flags |= CTL_LUN_INOPERABLE; - if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; @@ -4717,23 +4675,51 @@ ctl_stop_lun(struct ctl_be_lun *be_lun) } int -ctl_lun_offline(struct ctl_be_lun *be_lun) +ctl_lun_no_media(struct ctl_be_lun *be_lun) +{ + struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; + + mtx_lock(&lun->lun_lock); + lun->flags |= CTL_LUN_NO_MEDIA; + mtx_unlock(&lun->lun_lock); + return (0); +} + +int +ctl_lun_has_media(struct ctl_be_lun *be_lun) { struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; + union ctl_ha_msg msg; mtx_lock(&lun->lun_lock); - lun->flags |= CTL_LUN_OFFLINE; + lun->flags &= ~(CTL_LUN_NO_MEDIA | CTL_LUN_EJECTED); + if (lun->flags & CTL_LUN_REMOVABLE) + ctl_est_ua_all(lun, -1, CTL_UA_MEDIUM_CHANGE); mtx_unlock(&lun->lun_lock); + if ((lun->flags & CTL_LUN_REMOVABLE) && + lun->ctl_softc->ha_mode == CTL_HA_MODE_XFER) { + bzero(&msg.ua, sizeof(msg.ua)); + msg.hdr.msg_type = CTL_MSG_UA; + msg.hdr.nexus.initid = -1; + msg.hdr.nexus.targ_port = -1; + msg.hdr.nexus.targ_lun = lun->lun; + msg.hdr.nexus.targ_mapped_lun = lun->lun; + msg.ua.ua_all = 1; + msg.ua.ua_set = 1; + msg.ua.ua_type = CTL_UA_MEDIUM_CHANGE; + ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg.ua), + M_WAITOK); + } return (0); } int -ctl_lun_online(struct ctl_be_lun *be_lun) +ctl_lun_ejected(struct ctl_be_lun *be_lun) { struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_OFFLINE; + lun->flags |= CTL_LUN_EJECTED; mtx_unlock(&lun->lun_lock); return (0); } @@ -4803,28 +4789,6 @@ ctl_invalidate_lun(struct ctl_be_lun *be return (0); } -int -ctl_lun_inoperable(struct ctl_be_lun *be_lun) -{ - struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; - - mtx_lock(&lun->lun_lock); - lun->flags |= CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - return (0); -} - -int -ctl_lun_operable(struct ctl_be_lun *be_lun) -{ - struct ctl_lun *lun = (struct ctl_lun *)be_lun->ctl_lun; - - mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - return (0); -} - void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) { @@ -4832,7 +4796,7 @@ ctl_lun_capacity_changed(struct ctl_be_l union ctl_ha_msg msg; mtx_lock(&lun->lun_lock); - ctl_est_ua_all(lun, -1, CTL_UA_CAPACITY_CHANGED); + ctl_est_ua_all(lun, -1, CTL_UA_CAPACITY_CHANGE); mtx_unlock(&lun->lun_lock); if (lun->ctl_softc->ha_mode == CTL_HA_MODE_XFER) { /* Send msg to other side. */ @@ -4844,7 +4808,7 @@ ctl_lun_capacity_changed(struct ctl_be_l msg.hdr.nexus.targ_mapped_lun = lun->lun; msg.ua.ua_all = 1; msg.ua.ua_set = 1; - msg.ua.ua_type = CTL_UA_CAPACITY_CHANGED; + msg.ua.ua_type = CTL_UA_CAPACITY_CHANGE; ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg, sizeof(msg.ua), M_WAITOK); } @@ -5102,34 +5066,6 @@ ctl_start_stop(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; - /* - * XXX KDM - * We don't support the immediate bit on a stop unit. In order to - * do that, we would need to code up a way to know that a stop is - * pending, and hold off any new commands until it completes, one - * way or another. Then we could accept or reject those commands - * depending on its status. We would almost need to do the reverse - * of what we do below for an immediate start -- return the copy of - * the ctl_io to the FETD with status to send to the host (and to - * free the copy!) and then free the original I/O once the stop - * actually completes. That way, the OOA queue mechanism can work - * to block commands that shouldn't proceed. Another alternative - * would be to put the copy in the queue in place of the original, - * and return the original back to the caller. That could be - * slightly safer.. - */ - if ((cdb->byte2 & SSS_IMMED) - && ((cdb->how & SSS_START) == 0)) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 1, - /*bit_valid*/ 1, - /*bit*/ 0); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } - if ((lun->flags & CTL_LUN_PR_RESERVED) && ((cdb->how & SSS_START)==0)) { uint32_t residx; @@ -5156,28 +5092,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) return (CTL_RETVAL_COMPLETE); } - /* - * In the non-immediate case, we send the request to - * the backend and return status to the user when - * it is done. - * - * In the immediate case, we allocate a new ctl_io - * to hold a copy of the request, and send that to - * the backend. We then set good status on the - * user's request and return it immediately. - */ - if (cdb->byte2 & SSS_IMMED) { - union ctl_io *new_io; - - new_io = ctl_alloc_io(ctsio->io_hdr.pool); - ctl_copy_io((union ctl_io *)ctsio, new_io); - retval = lun->backend->config_write(new_io); - ctl_set_success(ctsio); - ctl_done((union ctl_io *)ctsio); - } else { - retval = lun->backend->config_write( - (union ctl_io *)ctsio); - } + retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); } @@ -5346,17 +5261,6 @@ ctl_format(struct ctl_scsiio *ctsio) } } - /* - * The format command will clear out the "Medium format corrupted" - * status if set by the configuration code. That status is really - * just a way to notify the host that we have lost the media, and - * get them to issue a command that will basically make them think - * they're blowing away the media. - */ - mtx_lock(&lun->lun_lock); - lun->flags &= ~CTL_LUN_INOPERABLE; - mtx_unlock(&lun->lun_lock); - ctl_set_success(ctsio); bailout: @@ -10311,7 +10215,7 @@ ctl_get_config(struct ctl_scsiio *ctsio) ctsio->kern_rel_offset = 0; hdr = (struct scsi_get_config_header *)ctsio->kern_data_ptr; - if (lun->flags & CTL_LUN_OFFLINE) + if (lun->flags & CTL_LUN_NO_MEDIA) scsi_ulto2b(0x0000, hdr->current_profile); else scsi_ulto2b(0x0010, hdr->current_profile); @@ -10370,13 +10274,13 @@ f3: /* Removable Medium */ feature = (struct scsi_get_config_feature *) &feature->feature_data[feature->add_length]; - if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_OFFLINE)) + if (rt == SGC_RT_CURRENT && (lun->flags & CTL_LUN_NO_MEDIA)) goto done; f10: /* Random Read */ scsi_ulto2b(0x0010, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 8; scsi_ulto4b(lun->be_lun->blocksize, &feature->feature_data[0]); @@ -10388,7 +10292,7 @@ f10: /* Random Read */ f1d: /* Multi-Read */ scsi_ulto2b(0x001D, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 0; feature = (struct scsi_get_config_feature *) @@ -10397,7 +10301,7 @@ f1d: /* Multi-Read */ f1e: /* CD Read */ scsi_ulto2b(0x001E, feature->feature_code); feature->flags = 0x00; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 4; feature->feature_data[0] = 0x00; @@ -10407,7 +10311,7 @@ f1e: /* CD Read */ f1f: /* DVD Read */ scsi_ulto2b(0x001F, feature->feature_code); feature->flags = 0x08; - if ((lun->flags & CTL_LUN_OFFLINE) == 0) + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) feature->flags |= SGC_F_CURRENT; feature->add_length = 4; feature->feature_data[0] = 0x01; @@ -11261,25 +11165,18 @@ ctl_scsiio_lun_check(struct ctl_lun *lun } } - if ((lun->flags & CTL_LUN_OFFLINE) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_STANDBY) == 0)) { - ctl_set_lun_not_ready(ctsio); - retval = 1; - goto bailout; - } - - if ((lun->flags & CTL_LUN_STOPPED) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_STOPPED) == 0)) { - /* "Logical unit not ready, initializing cmd. required" */ - ctl_set_lun_stopped(ctsio); - retval = 1; - goto bailout; - } - - if ((lun->flags & CTL_LUN_INOPERABLE) - && ((entry->flags & CTL_CMD_FLAG_OK_ON_INOPERABLE) == 0)) { - /* "Medium format corrupted" */ - ctl_set_medium_format_corrupted(ctsio); + if ((entry->flags & CTL_CMD_FLAG_OK_ON_NO_MEDIA) == 0) { + if (lun->flags & CTL_LUN_EJECTED) + ctl_set_lun_ejected(ctsio); + else if (lun->flags & CTL_LUN_NO_MEDIA) { + if (lun->flags & CTL_LUN_REMOVABLE) + ctl_set_lun_no_media(ctsio); + else + ctl_set_lun_int_reqd(ctsio); + } else if (lun->flags & CTL_LUN_STOPPED) + ctl_set_lun_stopped(ctsio); + else + goto bailout; retval = 1; goto bailout; } @@ -13484,7 +13381,7 @@ ctl_thresh_thread(void *arg) mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(lun, &softc->lun_list, links) { if ((lun->flags & CTL_LUN_DISABLED) || - (lun->flags & CTL_LUN_OFFLINE) || + (lun->flags & CTL_LUN_NO_MEDIA) || lun->backend->lun_attr == NULL) continue; if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && Modified: head/sys/cam/ctl/ctl.h ============================================================================== --- head/sys/cam/ctl/ctl.h Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl.h Mon Sep 28 20:54:18 2015 (r288348) @@ -123,10 +123,11 @@ typedef enum { CTL_UA_INQ_CHANGE = 0x0100, CTL_UA_RES_PREEMPT = 0x0400, CTL_UA_RES_RELEASE = 0x0800, - CTL_UA_REG_PREEMPT = 0x1000, - CTL_UA_ASYM_ACC_CHANGE = 0x2000, - CTL_UA_CAPACITY_CHANGED = 0x4000, - CTL_UA_THIN_PROV_THRES = 0x8000 + CTL_UA_REG_PREEMPT = 0x1000, + CTL_UA_ASYM_ACC_CHANGE = 0x2000, + CTL_UA_CAPACITY_CHANGE = 0x4000, + CTL_UA_THIN_PROV_THRES = 0x8000, + CTL_UA_MEDIUM_CHANGE = 0x10000 } ctl_ua_type; #ifdef _KERNEL Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend.h Mon Sep 28 20:54:18 2015 (r288348) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003 Silicon Graphics International Corp. + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,14 +50,11 @@ * particular LUN ID in the req_lun_id field. If we cannot allocate that * LUN ID, the ctl_add_lun() call will fail. * - * The POWERED_OFF flag tells us that the LUN should default to the powered + * The STOPPED flag tells us that the LUN should default to the powered * off state. It will return 0x04,0x02 until it is powered up. ("Logical * unit not ready, initializing command required.") * - * The INOPERABLE flag tells us that this LUN is not operable for whatever - * reason. This means that user data may have been (or has been?) lost. - * We will return 0x31,0x00 ("Medium format corrupted") until the host - * issues a FORMAT UNIT command to clear the error. + * The NO_MEDIA flag tells us that the LUN has no media inserted. * * The PRIMARY flag tells us that this LUN is registered as a Primary LUN * which is accessible via the Master shelf controller in an HA. This flag @@ -72,20 +70,22 @@ * * The DEV_TYPE flag tells us that the device_type field is filled in. * + * The EJECTED flag tells us that the removable LUN has tray open. + * * The UNMAP flag tells us that this LUN supports UNMAP. * * The OFFLINE flag tells us that this LUN can not access backing store. */ typedef enum { CTL_LUN_FLAG_ID_REQ = 0x01, - CTL_LUN_FLAG_POWERED_OFF = 0x02, - CTL_LUN_FLAG_INOPERABLE = 0x04, + CTL_LUN_FLAG_STOPPED = 0x02, + CTL_LUN_FLAG_NO_MEDIA = 0x04, CTL_LUN_FLAG_PRIMARY = 0x08, CTL_LUN_FLAG_SERIAL_NUM = 0x10, CTL_LUN_FLAG_DEVID = 0x20, CTL_LUN_FLAG_DEV_TYPE = 0x40, CTL_LUN_FLAG_UNMAP = 0x80, - CTL_LUN_FLAG_OFFLINE = 0x100, + CTL_LUN_FLAG_EJECTED = 0x100, CTL_LUN_FLAG_READONLY = 0x200 } ctl_backend_lun_flags; @@ -289,23 +289,11 @@ int ctl_start_lun(struct ctl_be_lun *be_ int ctl_stop_lun(struct ctl_be_lun *be_lun); /* - * If a LUN is inoperable, call ctl_lun_inoperable(). Generally the LUN - * will become operable once again when the user issues the SCSI FORMAT UNIT - * command. (CTL will automatically clear the inoperable flag.) If we - * need to re-enable the LUN, we can call ctl_lun_operable() to enable it - * without a SCSI command. - */ -int ctl_lun_inoperable(struct ctl_be_lun *be_lun); -int ctl_lun_operable(struct ctl_be_lun *be_lun); - -/* - * To take a LUN offline, call ctl_lun_offline(). Generally the LUN will - * be online again once the user sends a SCSI START STOP UNIT command with - * the start and on/offline bits set. The backend can bring the LUN back - * online via the ctl_lun_online() function, if necessary. + * Methods to notify about media and tray status changes. */ -int ctl_lun_offline(struct ctl_be_lun *be_lun); -int ctl_lun_online(struct ctl_be_lun *be_lun); +int ctl_lun_no_media(struct ctl_be_lun *be_lun); +int ctl_lun_has_media(struct ctl_be_lun *be_lun); +int ctl_lun_ejected(struct ctl_be_lun *be_lun); /* * Called on LUN HA role change. @@ -314,7 +302,7 @@ int ctl_lun_primary(struct ctl_be_lun *b int ctl_lun_secondary(struct ctl_be_lun *be_lun); /* - * Let the backend notify the initiator about changed capacity. + * Let the backend notify the initiators about changes. */ void ctl_lun_capacity_changed(struct ctl_be_lun *be_lun); Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Sep 28 20:54:18 2015 (r288348) @@ -2,6 +2,7 @@ * Copyright (c) 2003 Silicon Graphics International Corp. * Copyright (c) 2009-2011 Spectra Logic Corporation * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -256,8 +257,7 @@ static int ctl_be_block_open_file(struct static int ctl_be_block_open_dev(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req); static int ctl_be_block_close(struct ctl_be_block_lun *be_lun); -static int ctl_be_block_open(struct ctl_be_block_softc *softc, - struct ctl_be_block_lun *be_lun, +static int ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req); static int ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req); @@ -1660,7 +1660,7 @@ ctl_be_block_worker(void *context, int p DPRINTF("entered\n"); /* * Fetch and process I/Os from all queues. If we detect LUN - * CTL_LUN_FLAG_OFFLINE status here -- it is result of a race, + * CTL_LUN_FLAG_NO_MEDIA status here -- it is result of a race, * so make response maximally opaque to not confuse initiator. */ for (;;) { @@ -1672,7 +1672,7 @@ ctl_be_block_worker(void *context, int p ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_complete_beio(beio); return; @@ -1686,7 +1686,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_write_done(io); return; @@ -1700,7 +1700,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_read_done(io); return; @@ -1714,7 +1714,7 @@ ctl_be_block_worker(void *context, int p STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, ctl_io_hdr, links); mtx_unlock(&be_lun->queue_lock); - if (cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) { + if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_data_submit_done(io); return; @@ -2134,8 +2134,7 @@ ctl_be_block_close(struct ctl_be_block_l } static int -ctl_be_block_open(struct ctl_be_block_softc *softc, - struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) +ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) { struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct nameidata nd; @@ -2295,7 +2294,7 @@ ctl_be_block_create(struct ctl_be_block_ if ((cbe_lun->flags & CTL_LUN_FLAG_PRIMARY) || control_softc->ha_mode == CTL_HA_MODE_SER_ONLY) { - retval = ctl_be_block_open(softc, be_lun, req); + retval = ctl_be_block_open(be_lun, req); if (retval != 0) { retval = 0; req->status = CTL_LUN_WARNING; @@ -2325,7 +2324,7 @@ ctl_be_block_create(struct ctl_be_block_ } if (be_lun->vn == NULL) - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; /* Tell the user the blocksize we ended up using */ params->lun_size_bytes = be_lun->size_bytes; params->blocksize_bytes = cbe_lun->blocksize; @@ -2512,8 +2511,8 @@ ctl_be_block_rm(struct ctl_be_block_soft } if (be_lun->vn != NULL) { - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; - ctl_lun_offline(cbe_lun); + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); taskqueue_drain_all(be_lun->io_taskqueue); ctl_be_block_close(be_lun); } @@ -2621,22 +2620,27 @@ ctl_be_block_modify(struct ctl_be_block_ if ((cbe_lun->flags & CTL_LUN_FLAG_PRIMARY) || control_softc->ha_mode == CTL_HA_MODE_SER_ONLY) { if (be_lun->vn == NULL) - error = ctl_be_block_open(softc, be_lun, req); + error = ctl_be_block_open(be_lun, req); else if (vn_isdisk(be_lun->vn, &error)) error = ctl_be_block_open_dev(be_lun, req); else if (be_lun->vn->v_type == VREG) error = ctl_be_block_open_file(be_lun, req); else error = EINVAL; - if ((cbe_lun->flags & CTL_LUN_FLAG_OFFLINE) && + if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) && be_lun->vn != NULL) { - cbe_lun->flags &= ~CTL_LUN_FLAG_OFFLINE; - ctl_lun_online(cbe_lun); + cbe_lun->flags &= ~CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_has_media(cbe_lun); + } else if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) == 0 && + be_lun->vn == NULL) { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); } + cbe_lun->flags &= ~CTL_LUN_FLAG_EJECTED; } else { if (be_lun->vn != NULL) { - cbe_lun->flags |= CTL_LUN_FLAG_OFFLINE; - ctl_lun_offline(cbe_lun); + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); taskqueue_drain_all(be_lun->io_taskqueue); error = ctl_be_block_close(be_lun); } else @@ -2747,27 +2751,34 @@ ctl_be_block_config_write(union ctl_io * break; case START_STOP_UNIT: { struct scsi_start_stop_unit *cdb; + struct ctl_lun_req req; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; - - if (cdb->how & SSS_START) - retval = ctl_start_lun(cbe_lun); - else - retval = ctl_stop_lun(cbe_lun); - - /* - * In general, the above routines should not fail. They - * just set state for the LUN. So we've got something - * pretty wrong here if we can't start or stop the LUN. - */ - if (retval != 0) { - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ 0xf051); - retval = CTL_RETVAL_COMPLETE; + if (cdb->how & SSS_START) { + if ((cdb->how & SSS_LOEJ) && be_lun->vn == NULL) { + retval = ctl_be_block_open(be_lun, &req); + cbe_lun->flags &= ~CTL_LUN_FLAG_EJECTED; + if (retval == 0) { + cbe_lun->flags &= ~CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_has_media(cbe_lun); + } else { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + ctl_lun_no_media(cbe_lun); + } + } + ctl_start_lun(cbe_lun); } else { - ctl_set_success(&io->scsiio); + ctl_stop_lun(cbe_lun); + if (cdb->how & SSS_LOEJ) { + cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; + cbe_lun->flags |= CTL_LUN_FLAG_EJECTED; + ctl_lun_ejected(cbe_lun); + if (be_lun->vn != NULL) + ctl_be_block_close(be_lun); + } } + + ctl_set_success(&io->scsiio); ctl_config_write_done(io); break; } Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Sep 28 20:54:18 2015 (r288348) @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003, 2008 Silicon Graphics International Corp. * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Portions of this software were developed by Edward Tomasz Napierala @@ -848,8 +849,11 @@ ctl_backend_ramdisk_lun_config_status(vo static int ctl_backend_ramdisk_config_write(union ctl_io *io) { + struct ctl_be_lun *cbe_lun; int retval; + cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ + CTL_PRIV_BACKEND_LUN].ptr; retval = 0; switch (io->scsiio.cdb[0]) { case SYNCHRONIZE_CACHE: @@ -874,31 +878,18 @@ ctl_backend_ramdisk_config_write(union c break; case START_STOP_UNIT: { struct scsi_start_stop_unit *cdb; - struct ctl_be_lun *cbe_lun; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; - - cbe_lun = (struct ctl_be_lun *)io->io_hdr.ctl_private[ - CTL_PRIV_BACKEND_LUN].ptr; - - if (cdb->how & SSS_START) - retval = ctl_start_lun(cbe_lun); - else - retval = ctl_stop_lun(cbe_lun); - - /* - * In general, the above routines should not fail. They - * just set state for the LUN. So we've got something - * pretty wrong here if we can't start or stop the LUN. - */ - if (retval != 0) { - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 1, - /*retry_count*/ 0xf051); - retval = CTL_RETVAL_COMPLETE; + if (cdb->how & SSS_START) { + if (cdb->how & SSS_LOEJ) + ctl_lun_has_media(cbe_lun); + ctl_start_lun(cbe_lun); } else { - ctl_set_success(&io->scsiio); + ctl_stop_lun(cbe_lun); + if (cdb->how & SSS_LOEJ) + ctl_lun_ejected(cbe_lun); } + ctl_set_success(&io->scsiio); ctl_config_write_done(io); break; } Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Mon Sep 28 19:19:53 2015 (r288347) +++ head/sys/cam/ctl/ctl_cmd_table.c Mon Sep 28 20:54:18 2015 (r288348) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2003, 2004, 2005, 2009 Silicon Graphics International Corp. + * Copyright (c) 2014-2015 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,8 +68,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 READ KEYS */ {ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -78,8 +78,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 01 READ RESERVATION */ {ctl_persistent_reserve_in, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -89,8 +88,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 02 REPORT CAPABILITIES */ {ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -100,8 +98,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 READ FULL STATUS */ {ctl_persistent_reserve_in, CTL_SERIDX_INQ, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -117,8 +114,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 REGISTER */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -128,8 +124,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 01 RESERVE */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -139,8 +134,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 02 RELEASE */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -150,8 +144,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 CLEAR */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -161,8 +154,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 PREEMPT */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -172,8 +164,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 05 PREEMPT AND ABORT */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -183,8 +174,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 06 REGISTER AND IGNORE EXISTING KEY */ {ctl_persistent_reserve_out, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -202,12 +192,14 @@ const struct ctl_cmd_entry ctl_cmd_table { /* 00 EXTENDED COPY (LID1) */ {ctl_extended_copy_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 01 EXTENDED COPY (LID4) */ {ctl_extended_copy_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 16, { 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, @@ -301,6 +293,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 1C COPY OPERATION ABORT */ {ctl_copy_operation_abort, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 16, { 0x1c, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07}}, @@ -312,6 +305,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 00 RECEIVE COPY STATUS (LID1) */ {ctl_receive_copy_status_lid1, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -326,8 +320,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 03 RECEIVE COPY OPERATING PARAMETERS */ {ctl_receive_copy_operating_parameters, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -337,6 +330,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 RECEIVE COPY FAILURE DETAILS (LID1) */ {ctl_receive_copy_failure_details, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -345,6 +339,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 05 RECEIVE COPY STATUS (LID4) */ {ctl_receive_copy_status_lid4, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -356,6 +351,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 07 RECEIVE ROD TOKEN INFORMATION */ {ctl_receive_rod_token_information, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -364,6 +360,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 08 REPORT ALL ROD TOKENS */ {ctl_report_all_rod_tokens, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_BOTH | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_NONE, @@ -423,8 +420,6 @@ const struct ctl_cmd_entry ctl_cmd_table /* 10 READ CAPACITY(16) */ {ctl_read_capacity_16, CTL_SERIDX_RD_CAP, CTL_CMD_FLAG_OK_ON_DIRECT | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, CTL_LUN_PAT_READCAP, @@ -479,8 +474,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0A REPORT TARGET PORT GROUPS */ {ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -493,8 +487,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0C REPORT SUPPORTED_OPCODES */ {ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -504,8 +497,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0D REPORT SUPPORTED_TASK MANAGEMENT FUNCTIONS */ {ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -518,8 +510,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 0F REPORT TIMESTAMP */ {ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -550,8 +541,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_NO_SENSE | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_CMD_FLAG_ALLOW_ON_PR_RESV | @@ -560,7 +550,6 @@ const struct ctl_cmd_entry ctl_cmd_table /* 04 FORMAT UNIT */ {ctl_format, CTL_SERIDX_FORMAT, CTL_CMD_FLAG_OK_ON_DIRECT | - CTL_CMD_FLAG_OK_ON_INOPERABLE | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0xff, 0, 0, 0, 0x07}}, @@ -613,8 +602,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_NO_SENSE | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_CMD_FLAG_OK_ON_STANDBY | CTL_CMD_FLAG_OK_ON_UNAVAIL | CTL_FLAG_DATA_IN | @@ -629,8 +617,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 15 MODE SELECT(6) */ {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + 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}}, @@ -638,8 +625,7 @@ const struct ctl_cmd_entry ctl_cmd_table /* 16 RESERVE(6) */ {ctl_scsi_reserve, CTL_SERIDX_RES, CTL_CMD_FLAG_ALLOW_ON_RESV | CTL_CMD_FLAG_OK_ON_BOTH | - CTL_CMD_FLAG_OK_ON_STOPPED | - CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_NO_MEDIA | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Sep 29 03:37:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A07FA0B363; Tue, 29 Sep 2015 03:37:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AC061A1A; Tue, 29 Sep 2015 03:37:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T3bJt6045255; Tue, 29 Sep 2015 03:37:19 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T3bIKh045252; Tue, 29 Sep 2015 03:37:18 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290337.t8T3bIKh045252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 03:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288349 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 03:37:19 -0000 Author: adrian Date: Tue Sep 29 03:37:17 2015 New Revision: 288349 URL: https://svnweb.freebsd.org/changeset/base/288349 Log: Remove the references to the TX IC lock - i ended up solving this using net80211 to seralise encap+xmit, so now it's a non-issue. Modified: head/sys/dev/ath/if_ath_ahb.c head/sys/dev/ath/if_ath_pci.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_ahb.c ============================================================================== --- head/sys/dev/ath/if_ath_ahb.c Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_ath_ahb.c Tue Sep 29 03:37:17 2015 (r288349) @@ -261,7 +261,6 @@ ath_ahb_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); - ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); error = ath_attach(device_id, sc); @@ -271,7 +270,6 @@ ath_ahb_attach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); bus_dma_tag_destroy(sc->sc_dmat); @@ -315,7 +313,6 @@ ath_ahb_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_ath_pci.c Tue Sep 29 03:37:17 2015 (r288349) @@ -283,7 +283,6 @@ ath_pci_attach(device_t dev) ATH_PCU_LOCK_INIT(sc); ATH_RX_LOCK_INIT(sc); ATH_TX_LOCK_INIT(sc); - ATH_TX_IC_LOCK_INIT(sc); ATH_TXSTATUS_LOCK_INIT(sc); /* @@ -371,7 +370,6 @@ bad1: ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); @@ -408,7 +406,6 @@ ath_pci_detach(device_t dev) ATH_TXSTATUS_LOCK_DESTROY(sc); ATH_PCU_LOCK_DESTROY(sc); ATH_RX_LOCK_DESTROY(sc); - ATH_TX_IC_LOCK_DESTROY(sc); ATH_TX_LOCK_DESTROY(sc); ATH_LOCK_DESTROY(sc); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Sep 28 20:54:18 2015 (r288348) +++ head/sys/dev/ath/if_athvar.h Tue Sep 29 03:37:17 2015 (r288349) @@ -941,26 +941,6 @@ struct ath_softc { mtx_trylock(&(_sc)->sc_tx_mtx)) /* - * The IC TX lock is non-reentrant and serialises packet queuing from - * the upper layers. - */ -#define ATH_TX_IC_LOCK_INIT(_sc) do {\ - snprintf((_sc)->sc_tx_ic_mtx_name, \ - sizeof((_sc)->sc_tx_ic_mtx_name), \ - "%s IC TX lock", \ - device_get_nameunit((_sc)->sc_dev)); \ - mtx_init(&(_sc)->sc_tx_ic_mtx, (_sc)->sc_tx_ic_mtx_name, \ - NULL, MTX_DEF); \ - } while (0) -#define ATH_TX_IC_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_LOCK(_sc) mtx_lock(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_tx_ic_mtx) -#define ATH_TX_IC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ - MA_OWNED) -#define ATH_TX_IC_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_tx_ic_mtx, \ - MA_NOTOWNED) - -/* * The PCU lock is non-recursive and should be treated as a spinlock. * Although currently the interrupt code is run in netisr context and * doesn't require this, this may change in the future. From owner-svn-src-head@freebsd.org Tue Sep 29 03:40:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19DB2A0B633; Tue, 29 Sep 2015 03:40:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F22D91E99; Tue, 29 Sep 2015 03:40:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T3eMpu045853; Tue, 29 Sep 2015 03:40:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T3eMIi045851; Tue, 29 Sep 2015 03:40:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290340.t8T3eMIi045851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 03:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288350 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 03:40:23 -0000 Author: adrian Date: Tue Sep 29 03:40:21 2015 New Revision: 288350 URL: https://svnweb.freebsd.org/changeset/base/288350 Log: Defer calling into the driver to update the QOS (WME) configuration. This gets called from the driver RX path which leads to driver re-entry. Modified: head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Tue Sep 29 03:37:17 2015 (r288349) +++ head/sys/net80211/ieee80211_proto.c Tue Sep 29 03:40:21 2015 (r288350) @@ -107,6 +107,7 @@ static void update_mcast(void *, int); static void update_promisc(void *, int); static void update_channel(void *, int); static void update_chw(void *, int); +static void update_wme(void *, int); static void ieee80211_newstate_cb(void *, int); static int @@ -144,6 +145,7 @@ ieee80211_proto_attach(struct ieee80211c TASK_INIT(&ic->ic_chan_task, 0, update_channel, ic); TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); + TASK_INIT(&ic->ic_wme_task, 0, update_wme, ic); ic->ic_wme.wme_hipri_switch_hysteresis = AGGRESSIVE_MODE_SWITCH_HYSTERESIS; @@ -1133,7 +1135,8 @@ ieee80211_wme_updateparams_locked(struct ieee80211_beacon_notify(vap, IEEE80211_BEACON_WME); } - wme->wme_update(ic); + /* schedule the deferred WME update */ + ieee80211_runtask(ic, &ic->ic_wme_task); IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME, "%s: WME params updated, cap_info 0x%x\n", __func__, @@ -1198,6 +1201,17 @@ update_chw(void *arg, int npending) ic->ic_update_chw(ic); } +static void +update_wme(void *arg, int npending) +{ + struct ieee80211com *ic = arg; + + /* + * XXX should we defer the WME configuration update until now? + */ + ic->ic_wme.wme_update(ic); +} + /* * Block until the parent is in a known state. This is * used after any operations that dispatch a task (e.g. @@ -1213,6 +1227,7 @@ ieee80211_waitfor_parent(struct ieee8021 ieee80211_draintask(ic, &ic->ic_chan_task); ieee80211_draintask(ic, &ic->ic_bmiss_task); ieee80211_draintask(ic, &ic->ic_chw_task); + ieee80211_draintask(ic, &ic->ic_wme_task); taskqueue_unblock(ic->ic_tq); } Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Tue Sep 29 03:37:17 2015 (r288349) +++ head/sys/net80211/ieee80211_var.h Tue Sep 29 03:40:21 2015 (r288350) @@ -133,6 +133,7 @@ struct ieee80211com { struct task ic_chan_task; /* deferred channel change */ struct task ic_bmiss_task; /* deferred beacon miss hndlr */ struct task ic_chw_task; /* deferred HT CHW update */ + struct task ic_wme_task; /* deferred WME update */ counter_u64_t ic_ierrors; /* input errors */ counter_u64_t ic_oerrors; /* output errors */ From owner-svn-src-head@freebsd.org Tue Sep 29 04:47:32 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA555A0A23C; Tue, 29 Sep 2015 04:47:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB3981CDD; Tue, 29 Sep 2015 04:47:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T4lWfK074245; Tue, 29 Sep 2015 04:47:32 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T4lWjl074244; Tue, 29 Sep 2015 04:47:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509290447.t8T4lWjl074244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 04:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288351 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 04:47:32 -0000 Author: delphij Date: Tue Sep 29 04:47:31 2015 New Revision: 288351 URL: https://svnweb.freebsd.org/changeset/base/288351 Log: Use calloc() instead of malloc + memset. MFC after: 2 weeks Modified: head/lib/libc/gen/fts-compat.c Modified: head/lib/libc/gen/fts-compat.c ============================================================================== --- head/lib/libc/gen/fts-compat.c Tue Sep 29 03:40:21 2015 (r288350) +++ head/lib/libc/gen/fts-compat.c Tue Sep 29 04:47:31 2015 (r288351) @@ -137,9 +137,8 @@ __fts_open_44bsd(char * const *argv, int } /* Allocate/initialize the stream. */ - if ((priv = malloc(sizeof(*priv))) == NULL) + if ((priv = calloc(1, sizeof(*priv))) == NULL) return (NULL); - memset(priv, 0, sizeof(*priv)); sp = &priv->ftsp_fts; sp->fts_compar = compar; sp->fts_options = options; From owner-svn-src-head@freebsd.org Tue Sep 29 04:56:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F95AA0A815; Tue, 29 Sep 2015 04:56:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 805DE1136; Tue, 29 Sep 2015 04:56:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T4uSLk078264; Tue, 29 Sep 2015 04:56:28 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T4uShO078262; Tue, 29 Sep 2015 04:56:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290456.t8T4uShO078262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 04:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288352 - in head/sys/modules/usb: rsu urtwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 04:56:28 -0000 Author: adrian Date: Tue Sep 29 04:56:27 2015 New Revision: 288352 URL: https://svnweb.freebsd.org/changeset/base/288352 Log: Add opt_wlan.h as requirements for the two drivers I'm currently working on. Modified: head/sys/modules/usb/rsu/Makefile head/sys/modules/usb/urtwn/Makefile Modified: head/sys/modules/usb/rsu/Makefile ============================================================================== --- head/sys/modules/usb/rsu/Makefile Tue Sep 29 04:47:31 2015 (r288351) +++ head/sys/modules/usb/rsu/Makefile Tue Sep 29 04:56:27 2015 (r288352) @@ -5,6 +5,6 @@ KMOD = if_rsu SRCS = if_rsu.c if_rsureg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include Modified: head/sys/modules/usb/urtwn/Makefile ============================================================================== --- head/sys/modules/usb/urtwn/Makefile Tue Sep 29 04:47:31 2015 (r288351) +++ head/sys/modules/usb/urtwn/Makefile Tue Sep 29 04:56:27 2015 (r288352) @@ -5,6 +5,6 @@ KMOD = if_urtwn SRCS = if_urtwn.c if_urtwnreg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include From owner-svn-src-head@freebsd.org Tue Sep 29 05:03:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70AE3A0AE0B; Tue, 29 Sep 2015 05:03:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E9871637; Tue, 29 Sep 2015 05:03:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T53PJr082231; Tue, 29 Sep 2015 05:03:25 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T53P6w082230; Tue, 29 Sep 2015 05:03:25 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290503.t8T53P6w082230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 05:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288353 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 05:03:25 -0000 Author: adrian Date: Tue Sep 29 05:03:24 2015 New Revision: 288353 URL: https://svnweb.freebsd.org/changeset/base/288353 Log: urtwn driver fixes - missing include, free node references, shut down xfers first * include opt_wlan.h like a good little wlan driver; * add a function to free the mbufq /and/ the node references on it, or we will leak said node references; * free the mbufq upon NIC shutdown otherwise we may end up with a full list that we never begin transmit work on, and thus never drain it; * .. which frees it upon NIC detach too; * ensure urtwn_start() gets called after the completion of frame TX even if the pending queue is empty, otherwise transmit will stall. It's highly unlikely that the usb tx queue would be empty whilst the incoming send queue is full, but hey, who knows. This passes some iperf testing with and without the NIC being actively removed during said active iperf test. Tested: * urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R ; STA mode Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Tue Sep 29 04:56:27 2015 (r288352) +++ head/sys/dev/usb/wlan/if_urtwn.c Tue Sep 29 05:03:24 2015 (r288353) @@ -24,6 +24,8 @@ __FBSDID("$FreeBSD$"); * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. */ +#include "opt_wlan.h" + #include #include #include @@ -169,6 +171,7 @@ static device_detach_t urtwn_detach; static usb_callback_t urtwn_bulk_tx_callback; static usb_callback_t urtwn_bulk_rx_callback; +static void urtwn_drain_mbufq(struct urtwn_softc *sc); static usb_error_t urtwn_do_request(struct urtwn_softc *, struct usb_device_request *, void *); static struct ieee80211vap *urtwn_vap_create(struct ieee80211com *, @@ -467,6 +470,20 @@ detach: return (ENXIO); /* failure */ } +static void +urtwn_drain_mbufq(struct urtwn_softc *sc) +{ + struct mbuf *m; + struct ieee80211_node *ni; + URTWN_ASSERT_LOCKED(sc); + while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) { + ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; + m->m_pkthdr.rcvif = NULL; + ieee80211_free_node(ni); + m_freem(m); + } +} + static int urtwn_detach(device_t self) { @@ -482,6 +499,9 @@ urtwn_detach(device_t self) callout_drain(&sc->sc_watchdog_ch); + /* stop all USB transfers */ + usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); + /* Prevent further allocations from RX/TX data lists. */ URTWN_LOCK(sc); STAILQ_INIT(&sc->sc_tx_active); @@ -502,10 +522,7 @@ urtwn_detach(device_t self) urtwn_free_rx_list(sc); URTWN_UNLOCK(sc); - /* stop all USB transfers */ - usbd_transfer_unsetup(sc->sc_xfer, URTWN_N_TRANSFER); ieee80211_ifdetach(ic); - mbufq_drain(&sc->sc_snd); mtx_destroy(&sc->sc_mtx); return (0); @@ -879,13 +896,12 @@ tr_setup: data = STAILQ_FIRST(&sc->sc_tx_pending); if (data == NULL) { DPRINTF("%s: empty pending queue\n", __func__); - return; + goto finish; } STAILQ_REMOVE_HEAD(&sc->sc_tx_pending, next); STAILQ_INSERT_TAIL(&sc->sc_tx_active, data, next); usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen); usbd_transfer_submit(xfer); - urtwn_start(sc); break; default: data = STAILQ_FIRST(&sc->sc_tx_active); @@ -903,6 +919,9 @@ tr_setup: } break; } +finish: + /* Kick-start more transmit */ + urtwn_start(sc); } static struct urtwn_data * @@ -1778,7 +1797,6 @@ urtwn_tx_start(struct urtwn_softc *sc, s device_printf(sc->sc_dev, "ieee80211_crypto_encap returns NULL.\n"); /* XXX we don't expect the fragmented frames */ - m_freem(m0); return (ENOBUFS); } @@ -1931,6 +1949,7 @@ urtwn_start(struct urtwn_softc *sc) if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, 1); STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next); + m_freem(m); ieee80211_free_node(ni); break; } @@ -3417,6 +3436,8 @@ urtwn_stop(struct urtwn_softc *sc) sc->sc_flags &= ~URTWN_RUNNING; callout_stop(&sc->sc_watchdog_ch); urtwn_abort_xfers(sc); + + urtwn_drain_mbufq(sc); } static void @@ -3455,14 +3476,15 @@ urtwn_raw_xmit(struct ieee80211_node *ni } if (urtwn_tx_start(sc, ni, m, bf) != 0) { + m_freem(m); ieee80211_free_node(ni); STAILQ_INSERT_HEAD(&sc->sc_tx_inactive, bf, next); URTWN_UNLOCK(sc); return (EIO); } + sc->sc_txtimer = 5; URTWN_UNLOCK(sc); - sc->sc_txtimer = 5; return (0); } From owner-svn-src-head@freebsd.org Tue Sep 29 06:56:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8440EA0AA26; Tue, 29 Sep 2015 06:56:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7229E10B8; Tue, 29 Sep 2015 06:56:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T6u1hh027531; Tue, 29 Sep 2015 06:56:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T6u1de027529; Tue, 29 Sep 2015 06:56:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509290656.t8T6u1de027529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 06:56:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288357 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 06:56:01 -0000 Author: adrian Date: Tue Sep 29 06:56:00 2015 New Revision: 288357 URL: https://svnweb.freebsd.org/changeset/base/288357 Log: rsu(4): Add support for 1T2R and 2T2R NICs. This logic is mostly crimed from the reference driver and the linux r92su driver. I verified that it (a) worked on the rsu hardware I have, and (b) did traffic testing whilst watching what ath(4) sent as a hostap. It successfully sent MCS8..15 rates (which requires 2-stream reception) as well as MCS0..7 (which is 1-stream.) Tested: * RTL8712, 1T1R NIC, MCS rates 0..7. * RTL8712, 1T2R NIC, MCS rates 0..15 TODO: * Find a 2T2R NIC! Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Tue Sep 29 05:25:34 2015 (r288356) +++ head/sys/dev/usb/wlan/if_rsu.c Tue Sep 29 06:56:00 2015 (r288357) @@ -403,6 +403,7 @@ rsu_attach(device_t self) int error; uint8_t iface_index, bands; struct usb_interface *iface; + const char *rft; device_set_usb_desc(self); sc->sc_udev = uaa->device; @@ -462,8 +463,37 @@ rsu_attach(device_t self) device_printf(self, "could not read ROM\n"); goto fail_rom; } + + /* Figure out TX/RX streams */ + switch (sc->rom[84]) { + case 0x0: + sc->sc_rftype = RTL8712_RFCONFIG_1T1R; + sc->sc_nrxstream = 1; + sc->sc_ntxstream = 1; + rft = "1T1R"; + break; + case 0x1: + sc->sc_rftype = RTL8712_RFCONFIG_1T2R; + sc->sc_nrxstream = 2; + sc->sc_ntxstream = 1; + rft = "1T2R"; + break; + case 0x2: + sc->sc_rftype = RTL8712_RFCONFIG_2T2R; + sc->sc_nrxstream = 2; + sc->sc_ntxstream = 2; + rft = "2T2R"; + break; + default: + device_printf(sc->sc_dev, + "%s: unknown board type (rfconfig=0x%02x)\n", + __func__, + sc->rom[84]); + goto fail_rom; + } + IEEE80211_ADDR_COPY(ic->ic_macaddr, &sc->rom[0x12]); - device_printf(self, "MAC/BB RTL8712 cut %d\n", sc->cut); + device_printf(self, "MAC/BB RTL8712 cut %d %s\n", sc->cut, rft); ic->ic_softc = sc; ic->ic_name = device_get_nameunit(self); @@ -494,8 +524,8 @@ rsu_attach(device_t self) ic->ic_htcaps |= IEEE80211_HTCAP_CHWIDTH40; /* set number of spatial streams */ - ic->ic_txstream = 1; - ic->ic_rxstream = 1; + ic->ic_txstream = sc->sc_ntxstream; + ic->ic_rxstream = sc->sc_nrxstream; } /* Set supported .11b and .11g rates. */ @@ -2664,8 +2694,7 @@ rsu_load_firmware(struct rsu_softc *sc) dmem->hci_sel = R92S_HCI_SEL_USB | R92S_HCI_SEL_8172; dmem->nendpoints = sc->sc_nendpoints; dmem->chip_version = sc->cut; - /* XXX TODO: rf_config should come from ROM */ - dmem->rf_config = 0x11; /* 1T1R */ + dmem->rf_config = sc->sc_rftype; dmem->vcs_type = R92S_VCS_TYPE_AUTO; dmem->vcs_mode = R92S_VCS_MODE_RTS_CTS; dmem->turbo_mode = 0; Modified: head/sys/dev/usb/wlan/if_rsureg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rsureg.h Tue Sep 29 05:25:34 2015 (r288356) +++ head/sys/dev/usb/wlan/if_rsureg.h Tue Sep 29 06:56:00 2015 (r288357) @@ -158,6 +158,20 @@ (((var) & ~field##_M) | SM(field, val)) /* + * ROM field with RF config. + */ +enum { + RTL8712_RFCONFIG_1T = 0x10, + RTL8712_RFCONFIG_2T = 0x20, + RTL8712_RFCONFIG_1R = 0x01, + RTL8712_RFCONFIG_2R = 0x02, + RTL8712_RFCONFIG_1T1R = 0x11, + RTL8712_RFCONFIG_1T2R = 0x12, + RTL8712_RFCONFIG_TURBO = 0x92, + RTL8712_RFCONFIG_2T2R = 0x22 +}; + +/* * Firmware image header. */ struct r92s_fw_priv { @@ -173,6 +187,7 @@ struct r92s_fw_priv { uint8_t chip_version; uint16_t custid; uint8_t rf_config; +//0x11: 1T1R, 0x12: 1T2R, 0x92: 1T2R turbo, 0x22: 2T2R uint8_t nendpoints; /* QWORD1 */ uint32_t regulatory; @@ -755,6 +770,9 @@ struct rsu_softc { sc_scanning:1, sc_scan_pass:1; u_int cut; + uint8_t sc_rftype; + int8_t sc_nrxstream; + int8_t sc_ntxstream; struct rsu_host_cmd_ring cmdq; struct rsu_data sc_rx[RSU_RX_LIST_COUNT]; struct rsu_data sc_tx[RSU_TX_LIST_COUNT]; From owner-svn-src-head@freebsd.org Tue Sep 29 09:09:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5A59A0B7BB; Tue, 29 Sep 2015 09:09:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99FED117D; Tue, 29 Sep 2015 09:09:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8T99cRJ081729; Tue, 29 Sep 2015 09:09:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8T99bjq081726; Tue, 29 Sep 2015 09:09:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509290909.t8T99bjq081726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 09:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288358 - in head/sys/cam: ctl scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 09:09:38 -0000 Author: mav Date: Tue Sep 29 09:09:37 2015 New Revision: 288358 URL: https://svnweb.freebsd.org/changeset/base/288358 Log: Add CD/DVD Capabilities and Mechanical Status Page. This page is obsolete since MMC-4, but still used by some software. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_cd.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 09:09:37 2015 (r288358) @@ -354,6 +354,52 @@ const static struct ctl_logical_block_pr } }; +const static struct scsi_cddvd_capabilities_page cddvd_page_default = { + /*page_code*/SMS_CDDVD_CAPS_PAGE, + /*page_length*/sizeof(struct scsi_cddvd_capabilities_page) - 2, + /*caps1*/0x3f, + /*caps2*/0x00, + /*caps3*/0xf0, + /*caps4*/0x00, + /*caps5*/0x29, + /*caps6*/0x00, + /*obsolete*/{0, 0}, + /*nvol_levels*/{0, 0}, + /*buffer_size*/{8, 0}, + /*obsolete2*/{0, 0}, + /*reserved*/0, + /*digital*/0, + /*obsolete3*/0, + /*copy_management*/0, + /*reserved2*/0, + /*rotation_control*/0, + /*cur_write_speed*/0, + /*num_speed_descr*/0, +}; + +const static struct scsi_cddvd_capabilities_page cddvd_page_changeable = { + /*page_code*/SMS_CDDVD_CAPS_PAGE, + /*page_length*/sizeof(struct scsi_cddvd_capabilities_page) - 2, + /*caps1*/0, + /*caps2*/0, + /*caps3*/0, + /*caps4*/0, + /*caps5*/0, + /*caps6*/0, + /*obsolete*/{0, 0}, + /*nvol_levels*/{0, 0}, + /*buffer_size*/{0, 0}, + /*obsolete2*/{0, 0}, + /*reserved*/0, + /*digital*/0, + /*obsolete3*/0, + /*copy_management*/0, + /*reserved2*/0, + /*rotation_control*/0, + /*cur_write_speed*/0, + /*num_speed_descr*/0, +}; + SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CTLFLAG_RD, 0, "CAM Target Layer"); static int worker_threads = -1; SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, @@ -4119,6 +4165,23 @@ ctl_init_page_index(struct ctl_lun *lun) }} break; } + case SMS_CDDVD_CAPS_PAGE:{ + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_DEFAULT], + &cddvd_page_default, + sizeof(cddvd_page_default)); + memcpy(&lun->mode_pages.cddvd_page[ + CTL_PAGE_CHANGEABLE], &cddvd_page_changeable, + sizeof(cddvd_page_changeable)); + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_SAVED], + &cddvd_page_default, + sizeof(cddvd_page_default)); + memcpy(&lun->mode_pages.cddvd_page[CTL_PAGE_CURRENT], + &lun->mode_pages.cddvd_page[CTL_PAGE_SAVED], + sizeof(cddvd_page_default)); + page_index->page_data = + (uint8_t *)lun->mode_pages.cddvd_page; + break; + } case SMS_VENDOR_SPECIFIC_PAGE:{ switch (page_index->subpage) { case DBGCNF_SUBPAGE_CODE: { Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/ctl/ctl_private.h Tue Sep 29 09:09:37 2015 (r288358) @@ -40,6 +40,10 @@ #ifndef _CTL_PRIVATE_H_ #define _CTL_PRIVATE_H_ +#include +#include +#include + /* * SCSI vendor and product names. */ @@ -286,6 +290,9 @@ static const struct ctl_page_index page_ {SMS_INFO_EXCEPTIONS_PAGE | SMPH_SPF, 0x02, sizeof(struct ctl_logical_block_provisioning_page), NULL, CTL_PAGE_FLAG_DIRECT, NULL, NULL}, + {SMS_CDDVD_CAPS_PAGE, 0, + sizeof(struct scsi_cddvd_capabilities_page), NULL, + CTL_PAGE_FLAG_CDROM, NULL, NULL}, {SMS_VENDOR_SPECIFIC_PAGE | SMPH_SPF, DBGCNF_SUBPAGE_CODE, sizeof(struct copan_debugconf_subpage), NULL, CTL_PAGE_FLAG_ALL, ctl_debugconf_sp_sense_handler, ctl_debugconf_sp_select_handler}, @@ -303,6 +310,7 @@ struct ctl_mode_pages { struct scsi_control_ext_page control_ext_page[4]; struct scsi_info_exceptions_page ie_page[4]; struct ctl_logical_block_provisioning_page lbp_page[4]; + struct scsi_cddvd_capabilities_page cddvd_page[4]; struct copan_debugconf_subpage debugconf_subpage[4]; struct ctl_page_index index[CTL_NUM_MODE_PAGES]; }; Modified: head/sys/cam/scsi/scsi_cd.h ============================================================================== --- head/sys/cam/scsi/scsi_cd.h Tue Sep 29 06:56:00 2015 (r288357) +++ head/sys/cam/scsi/scsi_cd.h Tue Sep 29 09:09:37 2015 (r288358) @@ -783,6 +783,37 @@ struct cd_audio_page #define RIGHT_PORT 1 }; +struct scsi_cddvd_capabilities_page_sd { + uint8_t reserved; + uint8_t rotation_control; + uint8_t write_speed_supported[2]; +}; + +struct scsi_cddvd_capabilities_page { + uint8_t page_code; +#define SMS_CDDVD_CAPS_PAGE 0x2a + uint8_t page_length; + uint8_t caps1; + uint8_t caps2; + uint8_t caps3; + uint8_t caps4; + uint8_t caps5; + uint8_t caps6; + uint8_t obsolete[2]; + uint8_t nvol_levels[2]; + uint8_t buffer_size[2]; + uint8_t obsolete2[2]; + uint8_t reserved; + uint8_t digital; + uint8_t obsolete3; + uint8_t copy_management; + uint8_t reserved2; + uint8_t rotation_control; + uint8_t cur_write_speed; + uint8_t num_speed_descr; + struct scsi_cddvd_capabilities_page_sd speed_descr[]; +}; + union cd_pages { struct cd_audio_page audio; From owner-svn-src-head@freebsd.org Tue Sep 29 10:44:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DEAF6A0B964; Tue, 29 Sep 2015 10:44:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C32CA1DF2; Tue, 29 Sep 2015 10:44:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TAiclE022885; Tue, 29 Sep 2015 10:44:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TAicAB022884; Tue, 29 Sep 2015 10:44:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291044.t8TAicAB022884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 10:44:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288359 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 10:44:39 -0000 Author: mav Date: Tue Sep 29 10:44:37 2015 New Revision: 288359 URL: https://svnweb.freebsd.org/changeset/base/288359 Log: Report that we can read all flavours of DVD. Why not? Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 09:09:37 2015 (r288358) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 10:44:37 2015 (r288359) @@ -10271,6 +10271,10 @@ ctl_get_config(struct ctl_scsiio *ctsio) sizeof(struct scsi_get_config_feature) + 8 + sizeof(struct scsi_get_config_feature) + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + + sizeof(struct scsi_get_config_feature) + 4 + sizeof(struct scsi_get_config_feature) + 4; ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); ctsio->kern_sg_entries = 0; @@ -10284,8 +10288,16 @@ ctl_get_config(struct ctl_scsiio *ctsio) scsi_ulto2b(0x0010, hdr->current_profile); feature = (struct scsi_get_config_feature *)(hdr + 1); - if (starting > 0x001f) + if (starting > 0x003b) goto done; + if (starting > 0x003a) + goto f3b; + if (starting > 0x002b) + goto f3a; + if (starting > 0x002a) + goto f2b; + if (starting > 0x001f) + goto f2a; if (starting > 0x001e) goto f1f; if (starting > 0x001d) @@ -10382,6 +10394,48 @@ f1f: /* DVD Read */ feature = (struct scsi_get_config_feature *) &feature->feature_data[feature->add_length]; +f2a: /* DVD+RW */ + scsi_ulto2b(0x002A, feature->feature_code); + feature->flags = 0x04; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature->feature_data[1] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f2b: /* DVD+R */ + scsi_ulto2b(0x002B, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3a: /* DVD+RW Dual Layer */ + scsi_ulto2b(0x003A, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature->feature_data[1] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + +f3b: /* DVD+R Dual Layer */ + scsi_ulto2b(0x003B, feature->feature_code); + feature->flags = 0x00; + if ((lun->flags & CTL_LUN_NO_MEDIA) == 0) + feature->flags |= SGC_F_CURRENT; + feature->add_length = 4; + feature->feature_data[0] = 0x00; + feature = (struct scsi_get_config_feature *) + &feature->feature_data[feature->add_length]; + done: data_len = (uint8_t *)feature - (uint8_t *)hdr; if (rt == SGC_RT_SPECIFIC && data_len > 4) { From owner-svn-src-head@freebsd.org Tue Sep 29 11:48:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2DC6A0B9AC; Tue, 29 Sep 2015 11:48:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3A891504; Tue, 29 Sep 2015 11:48:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBmmlU048254; Tue, 29 Sep 2015 11:48:48 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBmmYN048253; Tue, 29 Sep 2015 11:48:48 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509291148.t8TBmmYN048253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 29 Sep 2015 11:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288360 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 11:48:48 -0000 Author: brueffer Date: Tue Sep 29 11:48:47 2015 New Revision: 288360 URL: https://svnweb.freebsd.org/changeset/base/288360 Log: The Dt argument should be in capital letters. Modified: head/share/man/man4/otusfw.4 Modified: head/share/man/man4/otusfw.4 ============================================================================== --- head/share/man/man4/otusfw.4 Tue Sep 29 10:44:37 2015 (r288359) +++ head/share/man/man4/otusfw.4 Tue Sep 29 11:48:47 2015 (r288360) @@ -14,7 +14,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd September 25, 2015 -.Dt otusfw 4 +.Dt OTUSFW 4 .Os .Sh NAME .Nm otusfw From owner-svn-src-head@freebsd.org Tue Sep 29 11:55:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2990EA0BE6B; Tue, 29 Sep 2015 11:55:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A43E1BED; Tue, 29 Sep 2015 11:55:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBtRMM052333; Tue, 29 Sep 2015 11:55:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBtRfh052331; Tue, 29 Sep 2015 11:55:27 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291155.t8TBtRfh052331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 11:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288361 - in head/sys/cddl/dev/dtrace: amd64 powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 11:55:28 -0000 Author: avg Date: Tue Sep 29 11:55:26 2015 New Revision: 288361 URL: https://svnweb.freebsd.org/changeset/base/288361 Log: dtrace_getarg: remove stray return statement on amd64, powerpc MFC after: 10 days Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Sep 29 11:48:47 2015 (r288360) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Sep 29 11:55:26 2015 (r288361) @@ -448,7 +448,6 @@ load: DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); return (val); - return (0); } int Modified: head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Tue Sep 29 11:48:47 2015 (r288360) +++ head/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c Tue Sep 29 11:55:26 2015 (r288361) @@ -520,7 +520,6 @@ load: DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); return (val); - return (0); } int From owner-svn-src-head@freebsd.org Tue Sep 29 11:58:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C04AA0B011; Tue, 29 Sep 2015 11:58:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D1541DB2; Tue, 29 Sep 2015 11:58:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TBwLgZ052485; Tue, 29 Sep 2015 11:58:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TBwLd1052484; Tue, 29 Sep 2015 11:58:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291158.t8TBwLd1052484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 11:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288362 - head/sys/cddl/dev/sdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 11:58:22 -0000 Author: avg Date: Tue Sep 29 11:58:21 2015 New Revision: 288362 URL: https://svnweb.freebsd.org/changeset/base/288362 Log: sdt: start checking version field when parsing probe definitions This is an extra safety measure. MFC after: 21 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 (r288361) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 (r288362) @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe char *to; size_t len; + if (probe->version != (int)sizeof(*probe)) { + printf("ignoring probe %p, version %u expected %u\n", + probe, probe->version, (int)sizeof(*probe)); + return; + } + TAILQ_FOREACH(prov, &sdt_prov_list, prov_entry) if (strcmp(prov->name, probe->prov->name) == 0) break; From owner-svn-src-head@freebsd.org Tue Sep 29 12:02:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1CDCA0B7F5; Tue, 29 Sep 2015 12:02:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E020B131F; Tue, 29 Sep 2015 12:02:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TC2Nk2056327; Tue, 29 Sep 2015 12:02:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TC2NpG056326; Tue, 29 Sep 2015 12:02:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291202.t8TC2NpG056326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288363 - head/sys/cddl/dev/sdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:02:24 -0000 Author: avg Date: Tue Sep 29 12:02:23 2015 New Revision: 288363 URL: https://svnweb.freebsd.org/changeset/base/288363 Log: std: it is important that func name is never an empty string otherwise DTRACE_ANCHORED() returns false and that makes stack() insert a bogus frame at the top. For example: dtrace -n 'test:dtrace_test::sdttest { stack(); } This change is not really a solution, but just a work-around. The real solution is to record the probe's call site and to use that for resolving a function name. PR: 195222 MFC after: 22 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 (r288362) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:02:23 2015 (r288363) @@ -168,6 +168,8 @@ sdt_create_probe(struct sdt_probe *probe * in the C compiler, so we have to respect const vs non-const. */ strlcpy(func, probe->func, sizeof(func)); + if (func[0] == '\0') + strcpy(func, "none"); from = probe->name; to = name; From owner-svn-src-head@freebsd.org Tue Sep 29 12:13:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2DABA0A01D; Tue, 29 Sep 2015 12:13:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E35261AFA; Tue, 29 Sep 2015 12:13:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCDVkf060604; Tue, 29 Sep 2015 12:13:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCDV5f060603; Tue, 29 Sep 2015 12:13:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291213.t8TCDV5f060603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288364 - head/sys/cddl/dev/sdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:13:32 -0000 Author: avg Date: Tue Sep 29 12:13:31 2015 New Revision: 288364 URL: https://svnweb.freebsd.org/changeset/base/288364 Log: sdt module does not seem to actually use any symbol from opensolaris module MFC after: 11 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:02:23 2015 (r288363) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:13:31 2015 (r288364) @@ -409,4 +409,3 @@ sdt_modevent(module_t mod __unused, int DEV_MODULE(sdt, sdt_modevent, NULL); MODULE_VERSION(sdt, 1); MODULE_DEPEND(sdt, dtrace, 1, 1, 1); -MODULE_DEPEND(sdt, opensolaris, 1, 1, 1); From owner-svn-src-head@freebsd.org Tue Sep 29 12:14:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1ED5A0A0B1; Tue, 29 Sep 2015 12:14:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2F771C67; Tue, 29 Sep 2015 12:14:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCENo0060683; Tue, 29 Sep 2015 12:14:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCENt0060681; Tue, 29 Sep 2015 12:14:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291214.t8TCENt0060681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288365 - head/sys/cddl/dev/sdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:14:23 -0000 Author: avg Date: Tue Sep 29 12:14:22 2015 New Revision: 288365 URL: https://svnweb.freebsd.org/changeset/base/288365 Log: sdt: static-ize couple of variables MFC after: 11 days Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:13:31 2015 (r288364) +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 12:14:22 2015 (r288365) @@ -99,8 +99,8 @@ static dtrace_pops_t sdt_pops = { static TAILQ_HEAD(, sdt_provider) sdt_prov_list; -eventhandler_tag sdt_kld_load_tag; -eventhandler_tag sdt_kld_unload_try_tag; +static eventhandler_tag sdt_kld_load_tag; +static eventhandler_tag sdt_kld_unload_try_tag; static void sdt_create_provider(struct sdt_provider *prov) From owner-svn-src-head@freebsd.org Tue Sep 29 12:15:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF778A0A156; Tue, 29 Sep 2015 12:15:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0BE91DCC; Tue, 29 Sep 2015 12:15:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCF0jL060762; Tue, 29 Sep 2015 12:15:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCF0ss060761; Tue, 29 Sep 2015 12:15:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201509291215.t8TCF0ss060761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 29 Sep 2015 12:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288366 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:15:00 -0000 Author: avg Date: Tue Sep 29 12:14:59 2015 New Revision: 288366 URL: https://svnweb.freebsd.org/changeset/base/288366 Log: sdt.h: no need for argtype_list_head MFC after: 12 days Modified: head/sys/sys/sdt.h Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Tue Sep 29 12:14:22 2015 (r288365) +++ head/sys/sys/sdt.h Tue Sep 29 12:14:59 2015 (r288366) @@ -398,7 +398,7 @@ struct sdt_probe { struct sdt_provider *prov; /* Ptr to the provider structure. */ TAILQ_ENTRY(sdt_probe) probe_entry; /* SDT probe list entry. */ - TAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list; + TAILQ_HEAD(, sdt_argtype) argtype_list; const char *mod; const char *func; const char *name; From owner-svn-src-head@freebsd.org Tue Sep 29 12:53:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A807EA0C1E2; Tue, 29 Sep 2015 12:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8BC5F1284; Tue, 29 Sep 2015 12:53:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TCrgC3077073; Tue, 29 Sep 2015 12:53:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TCrgwk077072; Tue, 29 Sep 2015 12:53:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291253.t8TCrgwk077072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 12:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288367 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 12:53:42 -0000 Author: mav Date: Tue Sep 29 12:53:41 2015 New Revision: 288367 URL: https://svnweb.freebsd.org/changeset/base/288367 Log: Fix arguments order. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Tue Sep 29 12:14:59 2015 (r288366) +++ head/sys/cam/ctl/ctl_tpc.c Tue Sep 29 12:53:41 2015 (r288367) @@ -837,7 +837,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -854,7 +854,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -885,7 +885,7 @@ tpc_process_b2b(struct tpc_list *list) ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x26, /*ascq*/ 0x0A, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -986,7 +986,7 @@ tpc_process_verify(struct tpc_list *list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } else @@ -1000,7 +1000,7 @@ tpc_process_verify(struct tpc_list *list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -1050,7 +1050,7 @@ tpc_process_register_key(struct tpc_list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x0d, /*ascq*/ 0x01, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } else @@ -1064,7 +1064,7 @@ tpc_process_register_key(struct tpc_list ctl_set_sense(list->ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x08, /*ascq*/ 0x04, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); return (CTL_RETVAL_ERROR); } @@ -1398,7 +1398,7 @@ tpc_process(struct tpc_list *list) ctl_set_sense(ctsio, /*current_error*/ 1, /*sense_key*/ SSD_KEY_COPY_ABORTED, /*asc*/ 0x26, /*ascq*/ 0x09, - SSD_ELEM_COMMAND, csi, sizeof(csi), + SSD_ELEM_COMMAND, sizeof(csi), csi, SSD_ELEM_NONE); goto done; } From owner-svn-src-head@freebsd.org Tue Sep 29 13:58:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 222EEA0C16A; Tue, 29 Sep 2015 13:58:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EFEC1A74; Tue, 29 Sep 2015 13:58:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TDwRMd002221; Tue, 29 Sep 2015 13:58:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TDwRnk002220; Tue, 29 Sep 2015 13:58:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291358.t8TDwRnk002220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 13:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288368 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 13:58:28 -0000 Author: mav Date: Tue Sep 29 13:58:27 2015 New Revision: 288368 URL: https://svnweb.freebsd.org/changeset/base/288368 Log: Don't report SYNC_NV bit set in SYNCHRONIZE CACHE as error. While this bit is obsolete in SBC-3, behavior controlled by it is allowed on device discretion. Modified: head/sys/cam/ctl/ctl_cmd_table.c Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 12:53:41 2015 (r288367) +++ head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 13:58:27 2015 (r288368) @@ -760,7 +760,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_sync_cache, CTL_SERIDX_SYNC, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_WRITE, - 10, {0x02, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, + 10, {0x06, 0xff, 0xff, 0xff, 0xff, 0, 0xff, 0xff, 0x07}}, /* 36 LOCK UNLOCK CACHE(10) */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -1119,7 +1119,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_sync_cache, CTL_SERIDX_SYNC, CTL_CMD_FLAG_OK_ON_DIRECT | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_WRITE, - 16, {0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 16, {0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* 92 LOCK UNLOCK CACHE(16) */ From owner-svn-src-head@freebsd.org Tue Sep 29 15:12:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2E51A0CD20; Tue, 29 Sep 2015 15:12:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3CC61FFA; Tue, 29 Sep 2015 15:12:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFCgTZ035897; Tue, 29 Sep 2015 15:12:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFCfb1035892; Tue, 29 Sep 2015 15:12:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509291512.t8TFCfb1035892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 29 Sep 2015 15:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288369 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 15:12:43 -0000 Author: mav Date: Tue Sep 29 15:12:40 2015 New Revision: 288369 URL: https://svnweb.freebsd.org/changeset/base/288369 Log: Really implement PREVENT ALLOW MEDIUM REMOVAL command. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl.c Tue Sep 29 15:12:40 2015 (r288369) @@ -5129,30 +5129,43 @@ ctl_start_stop(struct ctl_scsiio *ctsio) lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_start_stop_unit *)ctsio->cdb; - if ((lun->flags & CTL_LUN_PR_RESERVED) - && ((cdb->how & SSS_START)==0)) { - uint32_t residx; + if ((cdb->how & SSS_PC_MASK) == 0) { + if ((lun->flags & CTL_LUN_PR_RESERVED) && + (cdb->how & SSS_START) == 0) { + uint32_t residx; + + residx = ctl_get_initindex(&ctsio->io_hdr.nexus); + if (ctl_get_prkey(lun, residx) == 0 || + (lun->pr_res_idx != residx && lun->res_type < 4)) { - residx = ctl_get_initindex(&ctsio->io_hdr.nexus); - if (ctl_get_prkey(lun, residx) == 0 - || (lun->pr_res_idx!=residx && lun->res_type < 4)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } - ctl_set_reservation_conflict(ctsio); + if ((cdb->how & SSS_LOEJ) && + (lun->flags & CTL_LUN_REMOVABLE) == 0) { + ctl_set_invalid_field(ctsio, + /*sks_valid*/ 1, + /*command*/ 1, + /*field*/ 4, + /*bit_valid*/ 1, + /*bit*/ 1); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - } - if ((cdb->how & SSS_LOEJ) && - (lun->flags & CTL_LUN_REMOVABLE) == 0) { - ctl_set_invalid_field(ctsio, - /*sks_valid*/ 1, - /*command*/ 1, - /*field*/ 4, - /*bit_valid*/ 1, - /*bit*/ 1); - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + if ((cdb->how & SSS_START) == 0 && (cdb->how & SSS_LOEJ) && + lun->prevent_count > 0) { + /* "Medium removal prevented" */ + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/(lun->flags & CTL_LUN_NO_MEDIA) ? + SSD_KEY_NOT_READY : SSD_KEY_ILLEGAL_REQUEST, + /*asc*/ 0x53, /*ascq*/ 0x02, SSD_ELEM_NONE); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } } retval = lun->backend->config_write((union ctl_io *)ctsio); @@ -5163,11 +5176,14 @@ int ctl_prevent_allow(struct ctl_scsiio *ctsio) { struct ctl_lun *lun; + struct scsi_prevent *cdb; int retval; + uint32_t initidx; CTL_DEBUG_PRINT(("ctl_prevent_allow\n")); lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + cdb = (struct scsi_prevent *)ctsio->cdb; if ((lun->flags & CTL_LUN_REMOVABLE) == 0) { ctl_set_invalid_opcode(ctsio); @@ -5175,6 +5191,18 @@ ctl_prevent_allow(struct ctl_scsiio *cts return (CTL_RETVAL_COMPLETE); } + initidx = ctl_get_initindex(&ctsio->io_hdr.nexus); + mtx_lock(&lun->lun_lock); + if ((cdb->how & PR_PREVENT) && + ctl_is_set(lun->prevent, initidx) == 0) { + ctl_set_mask(lun->prevent, initidx); + lun->prevent_count++; + } else if ((cdb->how & PR_PREVENT) == 0 && + ctl_is_set(lun->prevent, initidx)) { + ctl_clear_mask(lun->prevent, initidx); + lun->prevent_count--; + } + mtx_unlock(&lun->lun_lock); retval = lun->backend->config_write((union ctl_io *)ctsio); return (retval); } @@ -11805,9 +11833,7 @@ ctl_do_lun_reset(struct ctl_lun *lun, un #if 0 uint32_t initidx; #endif -#ifdef CTL_WITH_CA int i; -#endif mtx_lock(&lun->lun_lock); /* @@ -11842,6 +11868,9 @@ ctl_do_lun_reset(struct ctl_lun *lun, un for (i = 0; i < CTL_MAX_INITIATORS; i++) ctl_clear_mask(lun->have_ca, i); #endif + lun->prevent_count = 0; + for (i = 0; i < CTL_MAX_INITIATORS; i++) + ctl_clear_mask(lun->prevent, i); mtx_unlock(&lun->lun_lock); return (0); @@ -11987,6 +12016,10 @@ ctl_i_t_nexus_reset(union ctl_io *io) #endif if ((lun->flags & CTL_LUN_RESERVED) && (lun->res_idx == initidx)) lun->flags &= ~CTL_LUN_RESERVED; + if (ctl_is_set(lun->prevent, initidx)) { + ctl_clear_mask(lun->prevent, initidx); + lun->prevent_count--; + } ctl_est_ua(lun, initidx, CTL_UA_I_T_NEXUS_LOSS); mtx_unlock(&lun->lun_lock); } Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_backend_block.c Tue Sep 29 15:12:40 2015 (r288369) @@ -2754,6 +2754,11 @@ ctl_be_block_config_write(union ctl_io * struct ctl_lun_req req; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; + if ((cdb->how & SSS_PC_MASK) != 0) { + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } if (cdb->how & SSS_START) { if ((cdb->how & SSS_LOEJ) && be_lun->vn == NULL) { retval = ctl_be_block_open(be_lun, &req); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Tue Sep 29 15:12:40 2015 (r288369) @@ -880,6 +880,11 @@ ctl_backend_ramdisk_config_write(union c struct scsi_start_stop_unit *cdb; cdb = (struct scsi_start_stop_unit *)io->scsiio.cdb; + if ((cdb->how & SSS_PC_MASK) != 0) { + ctl_set_success(&io->scsiio); + ctl_config_write_done(io); + break; + } if (cdb->how & SSS_START) { if (cdb->how & SSS_LOEJ) ctl_lun_has_media(cbe_lun); Modified: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_cmd_table.c Tue Sep 29 15:12:40 2015 (r288369) @@ -658,7 +658,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_NO_MEDIA | CTL_FLAG_DATA_NONE | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, - CTL_LUN_PAT_NONE, 6, {0x01, 0, 0, 0x03, 0x07}}, + CTL_LUN_PAT_NONE, 6, {0x01, 0, 0x0f, 0xf7, 0x07}}, /* 1C RECEIVE DIAGNOSTIC RESULTS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Tue Sep 29 13:58:27 2015 (r288368) +++ head/sys/cam/ctl/ctl_private.h Tue Sep 29 15:12:40 2015 (r288369) @@ -397,6 +397,8 @@ struct ctl_lun { int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; + int prevent_count; + uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; uint8_t *write_buffer; struct ctl_devid *lun_devid; TAILQ_HEAD(tpc_lists, tpc_list) tpc_lists; From owner-svn-src-head@freebsd.org Tue Sep 29 15:30:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4EE7EA0AB11; Tue, 29 Sep 2015 15:30:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 408A51C4D; Tue, 29 Sep 2015 15:30:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFUSOu040980; Tue, 29 Sep 2015 15:30:28 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFUSHa040979; Tue, 29 Sep 2015 15:30:28 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291530.t8TFUSHa040979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 15:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288370 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 15:30:28 -0000 Author: gjb Date: Tue Sep 29 15:30:27 2015 New Revision: 288370 URL: https://svnweb.freebsd.org/changeset/base/288370 Log: In vm_copy_base(), turn off SU+J on the resultant filesystem, leaving only SU enabled. Discussed with: kib (a few weeks ago) MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/vmimage.subr Modified: head/release/tools/vmimage.subr ============================================================================== --- head/release/tools/vmimage.subr Tue Sep 29 15:12:40 2015 (r288369) +++ head/release/tools/vmimage.subr Tue Sep 29 15:30:27 2015 (r288370) @@ -108,7 +108,7 @@ vm_copy_base() { umount_loop /dev/${mdnew} rmdir ${DESTDIR}/new - tunefs -j enable /dev/${mdnew} + tunefs -n enable /dev/${mdnew} mdconfig -d -u ${mdnew} mv ${VMBASE}.tmp ${VMBASE} } From owner-svn-src-head@freebsd.org Tue Sep 29 15:47:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB08EA0B819; Tue, 29 Sep 2015 15:47:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC0BD1814; Tue, 29 Sep 2015 15:47:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFlgMp048469; Tue, 29 Sep 2015 15:47:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFlgfr048468; Tue, 29 Sep 2015 15:47:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509291547.t8TFlgfr048468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 15:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288371 - head/gnu/usr.bin/gdb/kgdb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 15:47:43 -0000 Author: jhb Date: Tue Sep 29 15:47:42 2015 New Revision: 288371 URL: https://svnweb.freebsd.org/changeset/base/288371 Log: When XSAVE support was added on amd64, the FPU save area was moved out of 'struct pcb' and into a variable-sized region after the structure. The kgdb code currently only reads the pcb. It does not read in the FPU save area but instead passes stack garbage as the FPU's saved context. Fixing this would mean determining the proper size of the area and fetching it. However, this state is not saved for running CPUs in stoppcbs[], so the callback would also have to know to ignore those pcbs. Instead, just remove the call since it is of limited usefulness. It results in kgdb reporting the state of the FPU/SIMD registers in userland, not their current values in the kernel. In particular, it does not report the correct state for any code in the kernel which does use the FPU and would report incorrect values in that case. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3743 Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Tue Sep 29 15:30:27 2015 (r288370) +++ head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c Tue Sep 29 15:47:42 2015 (r288371) @@ -72,7 +72,6 @@ kgdb_trgt_fetch_registers(int regno __un supply_register(AMD64_R8_REGNUM + 6, (char *)&pcb.pcb_r14); supply_register(AMD64_R15_REGNUM, (char *)&pcb.pcb_r15); supply_register(AMD64_RIP_REGNUM, (char *)&pcb.pcb_rip); - amd64_supply_fxsave(current_regcache, -1, (struct fpusave *)(&pcb + 1)); } void From owner-svn-src-head@freebsd.org Tue Sep 29 15:49:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ABDBEA0B923; Tue, 29 Sep 2015 15:49:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D24A1A0B; Tue, 29 Sep 2015 15:49:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TFnsZr048596; Tue, 29 Sep 2015 15:49:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TFns1o048595; Tue, 29 Sep 2015 15:49:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509291549.t8TFns1o048595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 15:49:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288372 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 15:49:54 -0000 Author: jhb Date: Tue Sep 29 15:49:53 2015 New Revision: 288372 URL: https://svnweb.freebsd.org/changeset/base/288372 Log: Use EFI page size constants instead of hardcoding 4096. Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3692 Modified: head/sys/boot/efi/loader/copy.c Modified: head/sys/boot/efi/loader/copy.c ============================================================================== --- head/sys/boot/efi/loader/copy.c Tue Sep 29 15:47:42 2015 (r288371) +++ head/sys/boot/efi/loader/copy.c Tue Sep 29 15:49:53 2015 (r288372) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #define EFI_STAGING_SIZE 48 #endif -#define STAGE_PAGES ((EFI_STAGING_SIZE) * 1024 * 1024 / 4096) +#define STAGE_PAGES EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024) EFI_PHYSICAL_ADDRESS staging, staging_end; int stage_offset_set = 0; @@ -59,7 +59,7 @@ efi_copy_init(void) (unsigned long)(status & EFI_ERROR_MASK)); return (status); } - staging_end = staging + STAGE_PAGES * 4096; + staging_end = staging + STAGE_PAGES * EFI_PAGE_SIZE; #if defined(__aarch64__) || defined(__arm__) /* @@ -132,7 +132,7 @@ efi_copy_finish(void) src = (uint64_t *)staging; dst = (uint64_t *)(staging - stage_offset); - last = (uint64_t *)(staging + STAGE_PAGES * EFI_PAGE_SIZE); + last = (uint64_t *)staging_end; while (src < last) *dst++ = *src++; From owner-svn-src-head@freebsd.org Tue Sep 29 16:10:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA9C4A0C4D2; Tue, 29 Sep 2015 16:10:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B067C1391; Tue, 29 Sep 2015 16:10:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGA3lE056823; Tue, 29 Sep 2015 16:10:03 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TGA00r056809; Tue, 29 Sep 2015 16:10:00 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509291610.t8TGA00r056809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 29 Sep 2015 16:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288374 - head/release/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 16:10:03 -0000 Author: gjb Date: Tue Sep 29 16:09:59 2015 New Revision: 288374 URL: https://svnweb.freebsd.org/changeset/base/288374 Log: In addition to the ubldr file, also copy ubldr.bin to the MS-DOS partition. This will help with transitioning to a single arm/armv6 userland build which could be used for all FreeBSD/armv6 images without UBLDR_LOADADDR being set for each board (ultimately requiring a separate buildworld for each currently). Requested by: ian MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BEAGLEBONE.conf head/release/arm/CUBOX-HUMMINGBOARD.conf head/release/arm/GUMSTIX.conf head/release/arm/PANDABOARD.conf head/release/arm/RPI-B.conf head/release/arm/RPI2.conf head/release/arm/WANDBOARD.conf Modified: head/release/arm/BEAGLEBONE.conf ============================================================================== --- head/release/arm/BEAGLEBONE.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/BEAGLEBONE.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/CUBOX-HUMMINGBOARD.conf ============================================================================== --- head/release/arm/CUBOX-HUMMINGBOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/CUBOX-HUMMINGBOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -28,6 +28,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/GUMSTIX.conf ============================================================================== --- head/release/arm/GUMSTIX.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/GUMSTIX.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/PANDABOARD.conf ============================================================================== --- head/release/arm/PANDABOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/PANDABOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -26,6 +26,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/MLO ${FATMOUNT}/MLO chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/u-boot.img ${FATMOUNT}/u-boot.img chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} Modified: head/release/arm/RPI-B.conf ============================================================================== --- head/release/arm/RPI-B.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/RPI-B.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -30,6 +30,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi.dtb \ ${FATMOUNT}/rpi.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: head/release/arm/RPI2.conf ============================================================================== --- head/release/arm/RPI2.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/RPI2.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -30,6 +30,8 @@ arm_install_uboot() { ${FATMOUNT}/${_UF} done chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/dtb/rpi2.dtb \ ${FATMOUNT}/rpi2.dtb chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot Modified: head/release/arm/WANDBOARD.conf ============================================================================== --- head/release/arm/WANDBOARD.conf Tue Sep 29 16:09:58 2015 (r288373) +++ head/release/arm/WANDBOARD.conf Tue Sep 29 16:09:59 2015 (r288374) @@ -28,6 +28,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot sync umount_loop ${CHROOTDIR}/${FATMOUNT} From owner-svn-src-head@freebsd.org Tue Sep 29 16:10:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8008A0C503; Tue, 29 Sep 2015 16:10:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5D831553; Tue, 29 Sep 2015 16:10:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TGACu4056870; Tue, 29 Sep 2015 16:10:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TG9w7K056737; Tue, 29 Sep 2015 16:09:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509291609.t8TG9w7K056737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Sep 2015 16:09:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288373 - in head: contrib/compiler-rt/lib/builtins/arm contrib/gcc/config/arm lib/csu/arm lib/libc/arm/aeabi lib/libc/arm/gen lib/libc/arm/string lib/libc/arm/sys lib/libc/sys lib/libc... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 16:10:12 -0000 Author: kib Date: Tue Sep 29 16:09:58 2015 New Revision: 288373 URL: https://svnweb.freebsd.org/changeset/base/288373 Log: Annotate arm userspace assembler sources stating their tolerance to the non-executable stack. Reviewed by: andrew Sponsored by: The FreeBSD Foundation Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S head/contrib/gcc/config/arm/crti.asm head/contrib/gcc/config/arm/crtn.asm head/contrib/gcc/config/arm/lib1funcs.asm head/lib/csu/arm/crti.S head/lib/csu/arm/crtn.S head/lib/libc/arm/aeabi/aeabi_asm_double.S head/lib/libc/arm/aeabi/aeabi_asm_float.S head/lib/libc/arm/aeabi/aeabi_vfp_double.S head/lib/libc/arm/aeabi/aeabi_vfp_float.S head/lib/libc/arm/gen/__aeabi_read_tp.S head/lib/libc/arm/gen/_ctx_start.S head/lib/libc/arm/gen/_setjmp.S head/lib/libc/arm/gen/alloca.S head/lib/libc/arm/gen/divsi3.S head/lib/libc/arm/gen/setjmp.S head/lib/libc/arm/gen/sigsetjmp.S head/lib/libc/arm/string/ffs.S head/lib/libc/arm/string/memcmp.S head/lib/libc/arm/string/memcpy_arm.S head/lib/libc/arm/string/memcpy_xscale.S head/lib/libc/arm/string/memmove.S head/lib/libc/arm/string/memset.S head/lib/libc/arm/string/strcmp.S head/lib/libc/arm/string/strlen.S head/lib/libc/arm/string/strncmp.S head/lib/libc/arm/sys/Ovfork.S head/lib/libc/arm/sys/brk.S head/lib/libc/arm/sys/cerror.S head/lib/libc/arm/sys/pipe.S head/lib/libc/arm/sys/ptrace.S head/lib/libc/arm/sys/sbrk.S head/lib/libc/arm/sys/shmat.S head/lib/libc/arm/sys/sigreturn.S head/lib/libc/arm/sys/syscall.S head/lib/libc/sys/Makefile.inc head/lib/libcompiler_rt/Makefile head/libexec/rtld-elf/arm/rtld_start.S Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memcmp) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp4, __aeabi_memcmp) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp8, __aeabi_memcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memcpy) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy4, __aeabi_memcpy) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcpy8, __aeabi_memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S Tue Sep 29 16:09:58 2015 (r288373) @@ -18,3 +18,5 @@ END_COMPILERRT_FUNCTION(__aeabi_memmove) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove4, __aeabi_memmove) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memmove8, __aeabi_memmove) + + .section .note.GNU-stack,"",%progbits Modified: head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S ============================================================================== --- head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S Tue Sep 29 16:09:58 2015 (r288373) @@ -32,3 +32,4 @@ END_COMPILERRT_FUNCTION(__aeabi_memclr) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr) + .section .note.GNU-stack,"",%progbits Modified: head/contrib/gcc/config/arm/crti.asm ============================================================================== --- head/contrib/gcc/config/arm/crti.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/crti.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -60,6 +60,8 @@ .file "crti.asm" + .section .note.GNU-stack,"",%progbits + .section ".init" .align 2 .global _init Modified: head/contrib/gcc/config/arm/crtn.asm ============================================================================== --- head/contrib/gcc/config/arm/crtn.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/crtn.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -68,6 +68,8 @@ .file "crtn.asm" + .section .note.GNU-stack,"",%progbits + .section ".init" ;; FUNC_END Modified: head/contrib/gcc/config/arm/lib1funcs.asm ============================================================================== --- head/contrib/gcc/config/arm/lib1funcs.asm Tue Sep 29 15:49:53 2015 (r288372) +++ head/contrib/gcc/config/arm/lib1funcs.asm Tue Sep 29 16:09:58 2015 (r288373) @@ -1305,3 +1305,5 @@ LSYM(Lchange_\register): #include "ieee754-sf.S" #include "bpabi.S" #endif /* __symbian__ */ + + .section .note.GNU-stack,"",%progbits Modified: head/lib/csu/arm/crti.S ============================================================================== --- head/lib/csu/arm/crti.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/csu/arm/crti.S Tue Sep 29 16:09:58 2015 (r288373) @@ -19,3 +19,4 @@ _fini: stmdb sp!, {fp, ip, lr, pc} sub fp, ip, #4 + .section .note.GNU-stack,"",%progbits Modified: head/lib/csu/arm/crtn.S ============================================================================== --- head/lib/csu/arm/crtn.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/csu/arm/crtn.S Tue Sep 29 16:09:58 2015 (r288373) @@ -8,3 +8,5 @@ __FBSDID("$FreeBSD$"); .section .fini,"ax",%progbits ldmea fp, {fp, sp, pc} mov pc, lr + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_asm_double.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_asm_double.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_asm_double.S Tue Sep 29 16:09:58 2015 (r288373) @@ -117,3 +117,5 @@ ENTRY(__aeabi_cdcmpeq) msr cpsr_c, ip RET END(__aeabi_cdcmpeq) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_asm_float.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_asm_float.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_asm_float.S Tue Sep 29 16:09:58 2015 (r288373) @@ -108,3 +108,5 @@ ENTRY(__aeabi_cfcmpeq) msr cpsr_c, ip RET END(__aeabi_cfcmpeq) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_vfp_double.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp_double.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_vfp_double.S Tue Sep 29 16:09:58 2015 (r288373) @@ -201,3 +201,4 @@ AEABI_ENTRY(dsub) RET AEABI_END(dsub) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/aeabi/aeabi_vfp_float.S ============================================================================== --- head/lib/libc/arm/aeabi/aeabi_vfp_float.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/aeabi/aeabi_vfp_float.S Tue Sep 29 16:09:58 2015 (r288373) @@ -188,3 +188,4 @@ AEABI_ENTRY(fsub) RET AEABI_END(fsub) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/__aeabi_read_tp.S ============================================================================== --- head/lib/libc/arm/gen/__aeabi_read_tp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/__aeabi_read_tp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -45,3 +45,4 @@ END(__aeabi_read_tp) .word ARM_TP_ADDRESS #endif + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/_ctx_start.S ============================================================================== --- head/lib/libc/arm/gen/_ctx_start.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/_ctx_start.S Tue Sep 29 16:09:58 2015 (r288373) @@ -8,3 +8,5 @@ ENTRY(_ctx_start) bl _C_LABEL(ctx_done) bl _C_LABEL(abort) END(_ctx_start) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/_setjmp.S ============================================================================== --- head/lib/libc/arm/gen/_setjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/_setjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -157,3 +157,5 @@ botch: b . #endif END(_longjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/alloca.S ============================================================================== --- head/lib/libc/arm/gen/alloca.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/alloca.S Tue Sep 29 16:09:58 2015 (r288373) @@ -44,3 +44,5 @@ ENTRY(alloca) mov r0, sp /* r0 = base of new space */ RET END(alloca) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/divsi3.S ============================================================================== --- head/lib/libc/arm/gen/divsi3.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/divsi3.S Tue Sep 29 16:09:58 2015 (r288373) @@ -389,3 +389,5 @@ ENTRY(__divsi3) mov r0, r3 RET END(__divsi3) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/setjmp.S ============================================================================== --- head/lib/libc/arm/gen/setjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/setjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -158,3 +158,5 @@ ENTRY(__longjmp) bl PIC_SYM(_C_LABEL(abort), PLT) 1: b 1b /* Cannot get here */ END(__longjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/arm/gen/sigsetjmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/gen/sigsetjmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -66,3 +66,5 @@ ENTRY(siglongjmp) beq PIC_SYM(_C_LABEL(_longjmp), PLT) b PIC_SYM(_C_LABEL(longjmp), PLT) END(siglongjmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/ffs.S ============================================================================== --- head/lib/libc/arm/string/ffs.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/ffs.S Tue Sep 29 16:09:58 2015 (r288373) @@ -84,3 +84,5 @@ ENTRY(ffs) RET #endif END(ffs) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcmp.S ============================================================================== --- head/lib/libc/arm/string/memcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -181,3 +181,5 @@ ENTRY(memcmp) RET #endif END(memcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcpy_arm.S ============================================================================== --- head/lib/libc/arm/string/memcpy_arm.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcpy_arm.S Tue Sep 29 16:09:58 2015 (r288373) @@ -334,3 +334,5 @@ ENTRY(memcpy) sub r1, r1, #1 b .Lmemcpy_l4 END(memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memcpy_xscale.S ============================================================================== --- head/lib/libc/arm/string/memcpy_xscale.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memcpy_xscale.S Tue Sep 29 16:09:58 2015 (r288373) @@ -1784,3 +1784,5 @@ ENTRY(memcpy) bx lr #endif /* !_STANDALONE */ END(memcpy) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memmove.S ============================================================================== --- head/lib/libc/arm/string/memmove.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memmove.S Tue Sep 29 16:09:58 2015 (r288373) @@ -609,3 +609,5 @@ END(memmove) #else END(bcopy) #endif + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/memset.S ============================================================================== --- head/lib/libc/arm/string/memset.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/memset.S Tue Sep 29 16:09:58 2015 (r288373) @@ -263,3 +263,5 @@ END(bzero) #else END(memset) #endif + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strcmp.S ============================================================================== --- head/lib/libc/arm/string/strcmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strcmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -43,3 +43,5 @@ ENTRY(strcmp) sub r0, r2, r3 RET END(strcmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strlen.S ============================================================================== --- head/lib/libc/arm/string/strlen.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strlen.S Tue Sep 29 16:09:58 2015 (r288373) @@ -83,3 +83,5 @@ ENTRY(strlen) mov r0, r1 RET END(strlen) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/string/strncmp.S ============================================================================== --- head/lib/libc/arm/string/strncmp.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/string/strncmp.S Tue Sep 29 16:09:58 2015 (r288373) @@ -56,3 +56,5 @@ ENTRY(strncmp) sub r0, r2, r3 RET END(strncmp) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/Ovfork.S ============================================================================== --- head/lib/libc/arm/sys/Ovfork.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/Ovfork.S Tue Sep 29 16:09:58 2015 (r288373) @@ -53,3 +53,5 @@ ENTRY(vfork) and r0, r0, r1 /* r0 == 0 if child, else unchanged */ mov r15, r2 END(vfork) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/brk.S ============================================================================== --- head/lib/libc/arm/sys/brk.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/brk.S Tue Sep 29 16:09:58 2015 (r288373) @@ -91,3 +91,5 @@ ENTRY(_brk) .Lcurbrk: .word PIC_SYM(CURBRK, GOT) END(_brk) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/cerror.S ============================================================================== --- head/lib/libc/arm/sys/cerror.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/cerror.S Tue Sep 29 16:09:58 2015 (r288373) @@ -47,3 +47,5 @@ ASENTRY(CERROR) mvn r1, #0x00000000 ldmfd sp!, {r4, pc} END(CERROR) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/pipe.S ============================================================================== --- head/lib/libc/arm/sys/pipe.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/pipe.S Tue Sep 29 16:09:58 2015 (r288373) @@ -49,3 +49,5 @@ ENTRY(_pipe) mov r0, #0x00000000 RET END(_pipe) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/ptrace.S ============================================================================== --- head/lib/libc/arm/sys/ptrace.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/ptrace.S Tue Sep 29 16:09:58 2015 (r288373) @@ -47,3 +47,5 @@ ENTRY(ptrace) bcs PIC_SYM(CERROR, PLT) RET END(ptrace) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/sbrk.S ============================================================================== --- head/lib/libc/arm/sys/sbrk.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/sbrk.S Tue Sep 29 16:09:58 2015 (r288373) @@ -78,3 +78,5 @@ ENTRY(_sbrk) .Lcurbrk: .word PIC_SYM(CURBRK, GOT) END(_sbrk) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/shmat.S ============================================================================== --- head/lib/libc/arm/sys/shmat.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/shmat.S Tue Sep 29 16:09:58 2015 (r288373) @@ -5,3 +5,5 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" RSYSCALL(shmat) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/sigreturn.S ============================================================================== --- head/lib/libc/arm/sys/sigreturn.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/sigreturn.S Tue Sep 29 16:09:58 2015 (r288373) @@ -40,3 +40,5 @@ __FBSDID("$FreeBSD$"); */ RSYSCALL(sigreturn) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/arm/sys/syscall.S ============================================================================== --- head/lib/libc/arm/sys/syscall.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/arm/sys/syscall.S Tue Sep 29 16:09:58 2015 (r288373) @@ -36,3 +36,5 @@ __FBSDID("$FreeBSD$"); #include "SYS.h" RSYSCALL(syscall) + + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libc/sys/Makefile.inc Tue Sep 29 16:09:58 2015 (r288373) @@ -102,7 +102,7 @@ SYM_MAPS+= ${LIBC_SRCTOP}/sys/Symbol.map CLEANFILES+= ${SASM} ${SPSEUDO} .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "powerpc" + ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*} NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n' .else NOTE_GNU_STACK='' Modified: head/lib/libcompiler_rt/Makefile ============================================================================== --- head/lib/libcompiler_rt/Makefile Tue Sep 29 15:49:53 2015 (r288372) +++ head/lib/libcompiler_rt/Makefile Tue Sep 29 16:09:58 2015 (r288373) @@ -230,7 +230,7 @@ SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/l .endif .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \ - ${MACHINE_CPUARCH} == "powerpc" + ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*} AFLAGS+=--noexecstack ACFLAGS+=-Wa,--noexecstack .endif Modified: head/libexec/rtld-elf/arm/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/arm/rtld_start.S Tue Sep 29 15:49:53 2015 (r288372) +++ head/libexec/rtld-elf/arm/rtld_start.S Tue Sep 29 16:09:58 2015 (r288373) @@ -97,3 +97,4 @@ _rtld_bind_start: ldmia sp!,{r0-r5,sl,fp,lr} /* restore the stack */ mov pc, ip /* jump to the new address */ + .section .note.GNU-stack,"",%progbits From owner-svn-src-head@freebsd.org Tue Sep 29 17:04:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 653CDA0B91D; Tue, 29 Sep 2015 17:04:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55BE719BB; Tue, 29 Sep 2015 17:04:21 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TH4LUn081072; Tue, 29 Sep 2015 17:04:21 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TH4Kik081069; Tue, 29 Sep 2015 17:04:20 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509291704.t8TH4Kik081069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 29 Sep 2015 17:04:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288378 - in head/release/doc: en_US.ISO8859-1/hardware share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 17:04:21 -0000 Author: brueffer Date: Tue Sep 29 17:04:20 2015 New Revision: 288378 URL: https://svnweb.freebsd.org/changeset/base/288378 Log: Add otus(4) to the hardware notes. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.xml Tue Sep 29 17:02:27 2015 (r288377) +++ head/release/doc/en_US.ISO8859-1/hardware/article.xml Tue Sep 29 17:04:20 2015 (r288378) @@ -1011,6 +1011,8 @@ Marvell 88W8363 IEEE 802.11n wireless network adapters (&man.mwl.4; driver) + &hwlist.otus; + &hwlist.ral; &hwlist.rsu; Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Tue Sep 29 17:02:27 2015 (r288377) +++ head/release/doc/share/misc/dev.archlist.txt Tue Sep 29 17:04:20 2015 (r288378) @@ -101,6 +101,7 @@ nxge i386,amd64 oce i386,amd64 ohci i386,pc98,amd64,powerpc oltr i386 +otus i386,amd64 pcn i386,pc98,amd64 pst i386 qlxgb amd64 From owner-svn-src-head@freebsd.org Tue Sep 29 17:50:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1034A0A6B2; Tue, 29 Sep 2015 17:50:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D777010AD; Tue, 29 Sep 2015 17:50:00 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THo0bB097630; Tue, 29 Sep 2015 17:50:00 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THo0AQ097629; Tue, 29 Sep 2015 17:50:00 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291750.t8THo0AQ097629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:50:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288380 - head/usr.sbin/etcupdate X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 17:50:01 -0000 Author: bdrewery Date: Tue Sep 29 17:49:59 2015 New Revision: 288380 URL: https://svnweb.freebsd.org/changeset/base/288380 Log: Document the post-merge actions of calling tzsetup(8) and services_mkdb(8) added in r259134. MFC after: 3 days Modified: head/usr.sbin/etcupdate/etcupdate.8 Modified: head/usr.sbin/etcupdate/etcupdate.8 ============================================================================== --- head/usr.sbin/etcupdate/etcupdate.8 Tue Sep 29 17:05:12 2015 (r288379) +++ head/usr.sbin/etcupdate/etcupdate.8 Tue Sep 29 17:49:59 2015 (r288380) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd September 29, 2015 .Dt ETCUPDATE 8 .Os .Sh NAME @@ -233,6 +233,16 @@ is changed, is invoked if .Pa /etc/mail/aliases is changed, +.Xr services_mkdb 8 +is invoked if +.Pa /etc/services +is changed, +.Xr tzsetup 8 +is invoked if +.Pa /etc/localtime +is changed and if +.Fa /var/db/zoneinfo +exists, and .Pa /etc/rc.d/motd is invoked if @@ -843,7 +853,9 @@ but it has been removed in the destinati .Xr make 1 , .Xr newaliases 1 , .Xr sh 1 , -.Xr pwd_mkdb 8 +.Xr pwd_mkdb 8 , +.Xr services_mkdb 8 , +.Xr tzsetup 8 .Sh HISTORY The .Nm From owner-svn-src-head@freebsd.org Tue Sep 29 17:54:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D445A0A965; Tue, 29 Sep 2015 17:54:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DF3E1519; Tue, 29 Sep 2015 17:54:02 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THs2gM001544; Tue, 29 Sep 2015 17:54:02 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THs2Vl001543; Tue, 29 Sep 2015 17:54:02 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291754.t8THs2Vl001543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 17:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288381 - head/usr.sbin/mergemaster X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 17:54:02 -0000 Author: bdrewery Date: Tue Sep 29 17:54:01 2015 New Revision: 288381 URL: https://svnweb.freebsd.org/changeset/base/288381 Log: All supported releases have the -m support from r186678, so remove the mention of it and reword this a bit to remove 'you'. MFC after: 3 days Modified: head/usr.sbin/mergemaster/mergemaster.8 Modified: head/usr.sbin/mergemaster/mergemaster.8 ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.8 Tue Sep 29 17:49:59 2015 (r288380) +++ head/usr.sbin/mergemaster/mergemaster.8 Tue Sep 29 17:54:01 2015 (r288381) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2011 +.Dd September 29, 2015 .Dt MERGEMASTER 8 .Os .Sh NAME @@ -257,14 +257,13 @@ Specify the path to the directory where .Xr make 1 . (In other words, where your sources are, but -s was already taken.) -In previous versions of +In older versions of .Nm -you needed to specify the path all the way to -.Pa src/etc . -Starting with r186678 you only need to specify the path to -.Pa src . +the path to +.Pa src/etc +was required. .Nm -will convert the path for you if you use the old method. +will convert the path if this older method is used. .It Fl t Ar /path/to/temp/root Create the temporary root environment in .Pa /path/to/temp/root From owner-svn-src-head@freebsd.org Tue Sep 29 17:54:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45BCEA0AA00; Tue, 29 Sep 2015 17:54:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36DAF179C; Tue, 29 Sep 2015 17:54:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8THsTqc001607; Tue, 29 Sep 2015 17:54:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8THsT3X001606; Tue, 29 Sep 2015 17:54:29 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291754.t8THsT3X001606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 17:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288382 - head/lib/libc/tests/stdio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 17:54:29 -0000 Author: delphij Date: Tue Sep 29 17:54:28 2015 New Revision: 288382 URL: https://svnweb.freebsd.org/changeset/base/288382 Log: In this context fclose() can never fail, so assert it in the test case. Modified: head/lib/libc/tests/stdio/fmemopen2_test.c Modified: head/lib/libc/tests/stdio/fmemopen2_test.c ============================================================================== --- head/lib/libc/tests/stdio/fmemopen2_test.c Tue Sep 29 17:54:01 2015 (r288381) +++ head/lib/libc/tests/stdio/fmemopen2_test.c Tue Sep 29 17:54:28 2015 (r288382) @@ -97,6 +97,7 @@ ATF_TC_BODY(test_preexisting, tc) /* Close the FILE *. */ rc = fclose(fp); + ATF_REQUIRE(rc == 0); /* Check that the string was not modified after the first 4 bytes. */ ATF_REQUIRE(strcmp(str, str3) == 0); From owner-svn-src-head@freebsd.org Tue Sep 29 18:05:55 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12E80A0B1F4; Tue, 29 Sep 2015 18:05:55 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC20A1DA3; Tue, 29 Sep 2015 18:05:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TI5srB005962; Tue, 29 Sep 2015 18:05:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TI5sBE005961; Tue, 29 Sep 2015 18:05:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509291805.t8TI5sBE005961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Sep 2015 18:05:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288383 - head/usr.sbin/rpcbind X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 18:05:55 -0000 Author: delphij Date: Tue Sep 29 18:05:54 2015 New Revision: 288383 URL: https://svnweb.freebsd.org/changeset/base/288383 Log: The Sun RPC framework uses a netbuf structure to represent the transport specific form of a universal transport address. The structure is expected to be opaque to consumers. In the current implementation, the structure contains a pointer to a buffer that holds the actual address. In rpcbind(8), netbuf structures are copied directly, which would result in two netbuf structures that reference to one shared address buffer. When one of the two netbuf structures is freed, access to the other netbuf structure would result in an undefined result that may crash the rpcbind(8) daemon. Fix this by making a copy of the buffer that is going to be freed instead of doing a shallow copy. Security: FreeBSD-SA-15:24.rpcbind Security: CVE-2015-7236 Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 17:54:28 2015 (r288382) +++ head/usr.sbin/rpcbind/rpcb_svc_com.c Tue Sep 29 18:05:54 2015 (r288383) @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1047,19 +1048,31 @@ netbufcmp(struct netbuf *n1, struct netb return ((n1->len != n2->len) || memcmp(n1->buf, n2->buf, n1->len)); } +static bool_t +netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) +{ + + assert(dst->buf == NULL); + + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); + + dst->maxlen = dst->len = src->len; + memcpy(dst->buf, src->buf, src->len); + return (TRUE); +} + static struct netbuf * netbufdup(struct netbuf *ap) { struct netbuf *np; - if ((np = malloc(sizeof(struct netbuf))) == NULL) + if ((np = calloc(1, sizeof(struct netbuf))) == NULL) return (NULL); - if ((np->buf = malloc(ap->len)) == NULL) { + if (netbuf_copybuf(np, ap) == FALSE) { free(np); return (NULL); } - np->maxlen = np->len = ap->len; - memcpy(np->buf, ap->buf, ap->len); return (np); } @@ -1067,6 +1080,7 @@ static void netbuffree(struct netbuf *ap) { free(ap->buf); + ap->buf = NULL; free(ap); } @@ -1184,7 +1198,7 @@ xprt_set_caller(SVCXPRT *xprt, struct fi { u_int32_t *xidp; - *(svc_getrpccaller(xprt)) = *(fi->caller_addr); + netbuf_copybuf(svc_getrpccaller(xprt), fi->caller_addr); xidp = __rpcb_get_dg_xidp(xprt); *xidp = fi->caller_xid; } From owner-svn-src-head@freebsd.org Tue Sep 29 18:48:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42EB8A0A3DE; Tue, 29 Sep 2015 18:48:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30E881574; Tue, 29 Sep 2015 18:48:13 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TImDuS023484; Tue, 29 Sep 2015 18:48:13 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TImDMS023483; Tue, 29 Sep 2015 18:48:13 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291848.t8TImDMS023483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:48:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288389 - head/lib/libugidfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 18:48:13 -0000 Author: bdrewery Date: Tue Sep 29 18:48:12 2015 New Revision: 288389 URL: https://svnweb.freebsd.org/changeset/base/288389 Log: Fix 'ugidfw remove' after r284251 incorrectly changed it. The sysctl_rule() node removes entries when given a newptr and newlen == 0. Modified: head/lib/libugidfw/ugidfw.c Modified: head/lib/libugidfw/ugidfw.c ============================================================================== --- head/lib/libugidfw/ugidfw.c Tue Sep 29 18:46:39 2015 (r288388) +++ head/lib/libugidfw/ugidfw.c Tue Sep 29 18:48:12 2015 (r288389) @@ -1233,7 +1233,7 @@ bsde_delete_rule(int rulenum, size_t buf name[len] = rulenum; len++; - error = sysctl(name, len, NULL, NULL, &rule, sizeof(rule)); + error = sysctl(name, len, NULL, NULL, &rule, 0); if (error) { len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); From owner-svn-src-head@freebsd.org Tue Sep 29 18:51:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3800CA0A7AA; Tue, 29 Sep 2015 18:51:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2900D1AAE; Tue, 29 Sep 2015 18:51:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIpvlA027290; Tue, 29 Sep 2015 18:51:57 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIpvYc027289; Tue, 29 Sep 2015 18:51:57 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291851.t8TIpvYc027289@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288390 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 18:51:57 -0000 Author: bdrewery Date: Tue Sep 29 18:51:56 2015 New Revision: 288390 URL: https://svnweb.freebsd.org/changeset/base/288390 Log: When stopping ugidfw, it is not enough to just try unloading the module. If the module is built-in to the kernel then the kldunload will fail. Rather than do this just check if there are rules and then remove them all. Add requirement on FILESYSTEMS to ensure /usr is present for /usr/sbin/ugidfw and /usr/bin/xargs. This was already effectively the ordering from rcorder(8). MFC after: 2 weeks Relnotes: yes Modified: head/etc/rc.d/ugidfw Modified: head/etc/rc.d/ugidfw ============================================================================== --- head/etc/rc.d/ugidfw Tue Sep 29 18:48:12 2015 (r288389) +++ head/etc/rc.d/ugidfw Tue Sep 29 18:51:56 2015 (r288390) @@ -3,6 +3,7 @@ # $FreeBSD$ # PROVIDE: ugidfw +# REQUIRE: FILESYSTEMS # BEFORE: LOGIN # KEYWORD: nojail shutdown @@ -33,9 +34,17 @@ ugidfw_start() ugidfw_stop() { + local rulecount + # Disable the policy # - kldunload mac_bsdextended + # Check for the existence of rules and flush them if needed. + rulecount=$(sysctl -in security.mac.bsdextended.rule_count) + if [ ${rulecount:-0} -gt 0 ]; then + ugidfw list | sed -n '2,$p' | cut -d ' ' -f 1 | sort -r -n | + xargs -n 1 ugidfw remove + echo "MAC bsdextended rules flushed." + fi } load_rc_config $name From owner-svn-src-head@freebsd.org Tue Sep 29 18:57:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B78C3A0ABE1; Tue, 29 Sep 2015 18:57:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A87AB1CE2; Tue, 29 Sep 2015 18:57:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TIvVuO027580; Tue, 29 Sep 2015 18:57:31 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TIvVJH027579; Tue, 29 Sep 2015 18:57:31 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509291857.t8TIvVJH027579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 29 Sep 2015 18:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288391 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 18:57:31 -0000 Author: bdrewery Date: Tue Sep 29 18:57:30 2015 New Revision: 288391 URL: https://svnweb.freebsd.org/changeset/base/288391 Log: Fix the .MAKE added in r251750 to properly support the historical -n -n. The condition used matches the condition in sys.mk for setting _+_ to blank or +. With this -n will continue to not descend into Makefile.inc1, while -n -n will and cause Makefile.inc1's target to run with -n. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Tue Sep 29 18:51:56 2015 (r288390) +++ head/Makefile Tue Sep 29 18:57:30 2015 (r288391) @@ -243,9 +243,9 @@ cleanworld: # Handle the user-driven targets, using the source relative mk files. # -.if empty(.MAKEFLAGS:M-n) +.if !(!empty(.MAKEFLAGS:M-n) && ${.MAKEFLAGS:M-n} == "-n") # skip this for -n to avoid changing previous behavior of -# 'make -n buildworld' etc. +# 'make -n buildworld' etc. Using -n -n will run it. ${TGTS}: .MAKE tinderbox toolchains kernel-toolchains: .MAKE .endif From owner-svn-src-head@freebsd.org Tue Sep 29 19:15:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2916A0BBF2; Tue, 29 Sep 2015 19:15:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D8D21D60; Tue, 29 Sep 2015 19:15:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TJF9kp035884; Tue, 29 Sep 2015 19:15:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TJF9SE035883; Tue, 29 Sep 2015 19:15:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509291915.t8TJF9SE035883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 29 Sep 2015 19:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288393 - head/sys/dev/iwn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 19:15:09 -0000 Author: adrian Date: Tue Sep 29 19:15:08 2015 New Revision: 288393 URL: https://svnweb.freebsd.org/changeset/base/288393 Log: Fix locking after my EDCA update change. The net80211 lock is no longer held during this call, so we don't have to unlock/relock. Noticed by: David Wolfskill Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue Sep 29 19:14:52 2015 (r288392) +++ head/sys/dev/iwn/if_iwn.c Tue Sep 29 19:15:08 2015 (r288393) @@ -5344,6 +5344,8 @@ iwn_updateedca(struct ieee80211com *ic) memset(&cmd, 0, sizeof cmd); cmd.flags = htole32(IWN_EDCA_UPDATE); + + IEEE80211_LOCK(ic); for (aci = 0; aci < WME_NUM_AC; aci++) { const struct wmeParams *ac = &ic->ic_wme.wme_chanParams.cap_wmeParams[aci]; @@ -5354,10 +5356,10 @@ iwn_updateedca(struct ieee80211com *ic) htole16(IEEE80211_TXOP_TO_US(ac->wmep_txopLimit)); } IEEE80211_UNLOCK(ic); + IWN_LOCK(sc); (void)iwn_cmd(sc, IWN_CMD_EDCA_PARAMS, &cmd, sizeof cmd, 1); IWN_UNLOCK(sc); - IEEE80211_LOCK(ic); DPRINTF(sc, IWN_DEBUG_TRACE, "->%s: end\n",__func__); From owner-svn-src-head@freebsd.org Tue Sep 29 23:54:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A41E8A0B3B1; Tue, 29 Sep 2015 23:54:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 957531B4B; Tue, 29 Sep 2015 23:54:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TNsR7u051200; Tue, 29 Sep 2015 23:54:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TNsRhg051199; Tue, 29 Sep 2015 23:54:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509292354.t8TNsRhg051199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 29 Sep 2015 23:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288405 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Sep 2015 23:54:27 -0000 Author: jhb Date: Tue Sep 29 23:54:26 2015 New Revision: 288405 URL: https://svnweb.freebsd.org/changeset/base/288405 Log: Decode recently added procctl(2) operations. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Sep 29 22:33:26 2015 (r288404) +++ head/usr.bin/truss/syscalls.c Tue Sep 29 23:54:26 2015 (r288405) @@ -534,7 +534,9 @@ static struct xlat idtype_arg[] = { }; static struct xlat procctl_arg[] = { - X(PROC_SPROTECT) XEND + X(PROC_SPROTECT) X(PROC_REAP_ACQUIRE) X(PROC_REAP_RELEASE) + X(PROC_REAP_STATUS) X(PROC_REAP_GETPIDS) X(PROC_REAP_KILL) + X(PROC_TRACE_CTL) X(PROC_TRACE_STATUS) XEND }; static struct xlat umtx_ops[] = { From owner-svn-src-head@freebsd.org Wed Sep 30 00:08:25 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCF5EA0C2A2; Wed, 30 Sep 2015 00:08:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A593912F6; Wed, 30 Sep 2015 00:08:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U08P6M055491; Wed, 30 Sep 2015 00:08:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U08Owa055488; Wed, 30 Sep 2015 00:08:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509300008.t8U08Owa055488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Sep 2015 00:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288406 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 00:08:25 -0000 Author: jhb Date: Wed Sep 30 00:08:24 2015 New Revision: 288406 URL: https://svnweb.freebsd.org/changeset/base/288406 Log: Trim trailing whitespace. Modified: head/usr.bin/truss/arm-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/arm-fbsd.c ============================================================================== --- head/usr.bin/truss/arm-fbsd.c Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/arm-fbsd.c Wed Sep 30 00:08:24 2015 (r288406) @@ -140,7 +140,7 @@ arm_syscall_entry(struct trussinfo *trus #ifdef __ARM_EABI__ syscall_num = regs.r[7]; #else - if ((syscall_num = ptrace(PT_READ_I, tid, + if ((syscall_num = ptrace(PT_READ_I, tid, (caddr_t)(regs.r[_REG_PC] - INSN_SIZE), 0)) == -1) { fprintf(trussinfo->outfile, "-- CANNOT READ PC --\n"); return; Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/syscall.h Wed Sep 30 00:08:24 2015 (r288406) @@ -86,11 +86,11 @@ char *print_arg(struct syscall_args *, u #define LINUX_SETSOCKOPT 14 #define LINUX_GETSOCKOPT 15 #define LINUX_SENDMSG 16 -#define LINUX_RECVMSG 17 +#define LINUX_RECVMSG 17 #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) - + #if BYTE_ORDER == LITTLE_ENDIAN #define PADL_(t) 0 #define PADR_(t) PAD_(t) Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Tue Sep 29 23:54:26 2015 (r288405) +++ head/usr.bin/truss/syscalls.c Wed Sep 30 00:08:24 2015 (r288406) @@ -811,7 +811,7 @@ print_kevent(FILE *fp, struct kevent *ke int ctrl, data; ctrl = ke->fflags & NOTE_FFCTRLMASK; - data = ke->fflags & NOTE_FFLAGSMASK; + data = ke->fflags & NOTE_FFLAGSMASK; if (input) { fputs(xlookup(kevent_user_ffctrl, ctrl), fp); if (ke->fflags & NOTE_TRIGGER) @@ -937,7 +937,7 @@ print_arg(struct syscall_args *sc, unsig fprintf(fp, "0x%lx", args[sc->offset]); break; } - + /* * Read a page of pointers at a time. Punt if the top-level * pointer is not aligned. Note that the first read is of From owner-svn-src-head@freebsd.org Wed Sep 30 03:37:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56E78A0CAB3; Wed, 30 Sep 2015 03:37:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E09A1335; Wed, 30 Sep 2015 03:37:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U3bclQ046893; Wed, 30 Sep 2015 03:37:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U3bcoD046892; Wed, 30 Sep 2015 03:37:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201509300337.t8U3bcoD046892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 30 Sep 2015 03:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288412 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 03:37:38 -0000 Author: glebius Date: Wed Sep 30 03:37:37 2015 New Revision: 288412 URL: https://svnweb.freebsd.org/changeset/base/288412 Log: When processing ICMP need frag message, ignore the suggested MTU unless it is smaller than the current one for this connection. This is behavior specified by RFC 1191, and this is how original BSD stack behaved, but this was unintentionally regressed in r182851. Reported & tested by: Richard Russo Differential Revision: D3567 Sponsored by: Nginx, Inc. Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Sep 30 03:36:41 2015 (r288411) +++ head/sys/netinet/tcp_subr.c Wed Sep 30 03:37:37 2015 (r288412) @@ -1541,11 +1541,6 @@ tcp_ctlinput(int cmd, struct sockaddr *s * in the route to the suggested new * value (if given) and then notify. */ - bzero(&inc, sizeof(inc)); - inc.inc_faddr = faddr; - inc.inc_fibnum = - inp->inp_inc.inc_fibnum; - mtu = ntohs(icp->icmp_nextmtu); /* * If no alternative MTU was @@ -1560,14 +1555,18 @@ tcp_ctlinput(int cmd, struct sockaddr *s mtu = V_tcp_minmss + sizeof(struct tcpiphdr); /* - * Only cache the MTU if it - * is smaller than the interface - * or route MTU. tcp_mtudisc() - * will do right thing by itself. + * Only process the offered MTU if it + * is smaller than the current one. */ - if (mtu <= tcp_maxmtu(&inc, NULL)) + if (mtu < tp->t_maxopd + + sizeof(struct tcpiphdr)) { + bzero(&inc, sizeof(inc)); + inc.inc_faddr = faddr; + inc.inc_fibnum = + inp->inp_inc.inc_fibnum; tcp_hc_updatemtu(&inc, mtu); - tcp_mtudisc(inp, mtu); + tcp_mtudisc(inp, mtu); + } } else inp = (*notify)(inp, inetctlerrmap[cmd]); From owner-svn-src-head@freebsd.org Wed Sep 30 04:49:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7016A0C237; Wed, 30 Sep 2015 04:49:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92DB0101D; Wed, 30 Sep 2015 04:49:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U4n2ak079221; Wed, 30 Sep 2015 04:49:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U4mur9079187; Wed, 30 Sep 2015 04:48:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300448.t8U4mur9079187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 04:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288413 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 04:49:02 -0000 Author: markj Date: Wed Sep 30 04:48:56 2015 New Revision: 288413 URL: https://svnweb.freebsd.org/changeset/base/288413 Log: Stop hard-coding a 32-bit data model for USDT tests, and just use the native model. This was causing many of the tests to fail on amd64 since USDT support for 32-bit programs is currently non-functional. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.header.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.user.ksh Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Wed Sep 30 03:37:37 2015 (r288412) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh Wed Sep 30 04:48:56 2015 (r288413) @@ -69,7 +69,7 @@ prov.h: prov.d $dtrace -h -s prov.d prov.o: prov.d main.o - $dtrace -G -32 -s prov.d main.o + $dtrace -G -s prov.d main.o EOF cat > prov.d < Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49855A0B3F4; Wed, 30 Sep 2015 05:19:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3996D1D09; Wed, 30 Sep 2015 05:19:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5JH8m093089; Wed, 30 Sep 2015 05:19:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5JG4Y093086; Wed, 30 Sep 2015 05:19:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201509300519.t8U5JG4Y093086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 30 Sep 2015 05:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288414 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 05:19:17 -0000 Author: adrian Date: Wed Sep 30 05:19:16 2015 New Revision: 288414 URL: https://svnweb.freebsd.org/changeset/base/288414 Log: modify the rssi logic a bit to actually return a useful rssi. The fullmac firmware doesn't seem to populate a useful rssi indicator in the RX descriptor, so if one plotted said values, they'd basically look like garbage. The reference driver implements a "get current rssi" firmware command which I guess is really meant for station operation only (as hostap operation would need rssi per station, not a single firmware read.) So: * populate sc_currssi during each calibration run; * use this in the RX path instead of trying to reconstruct the RSSI value and passing it around as a pointer; * do up a quick hack to map the rssi hardware value to some useful signal level; * the survey results provide an RSSI value between 0..100, so just do another quick hack to map it into some usefulish signal level; * supply a faked noise floor - I haven't yet found how to pull it out of the firmware. The scan results and the station RSSI information is now more useful for indicating signal strength / distance. Modified: head/sys/dev/usb/wlan/if_rsu.c head/sys/dev/usb/wlan/if_rsureg.h Modified: head/sys/dev/usb/wlan/if_rsu.c ============================================================================== --- head/sys/dev/usb/wlan/if_rsu.c Wed Sep 30 04:48:56 2015 (r288413) +++ head/sys/dev/usb/wlan/if_rsu.c Wed Sep 30 05:19:16 2015 (r288414) @@ -203,17 +203,18 @@ static void rsu_delete_key(struct rsu_so static int rsu_site_survey(struct rsu_softc *, struct ieee80211vap *); static int rsu_join_bss(struct rsu_softc *, struct ieee80211_node *); static int rsu_disconnect(struct rsu_softc *); +static int rsu_hwrssi_to_rssi(struct rsu_softc *, int hw_rssi); static void rsu_event_survey(struct rsu_softc *, uint8_t *, int); static void rsu_event_join_bss(struct rsu_softc *, uint8_t *, int); static void rsu_rx_event(struct rsu_softc *, uint8_t, uint8_t *, int); static void rsu_rx_multi_event(struct rsu_softc *, uint8_t *, int); +#if 0 static int8_t rsu_get_rssi(struct rsu_softc *, int, void *); +#endif +static struct mbuf * rsu_rx_frame(struct rsu_softc *, uint8_t *, int); +static struct mbuf * rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int); static struct mbuf * - rsu_rx_frame(struct rsu_softc *, uint8_t *, int, int *); -static struct mbuf * - rsu_rx_multi_frame(struct rsu_softc *, uint8_t *, int, int *); -static struct mbuf * - rsu_rxeof(struct usb_xfer *, struct rsu_data *, int *); + rsu_rxeof(struct usb_xfer *, struct rsu_data *); static void rsu_txeof(struct usb_xfer *, struct rsu_data *); static int rsu_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -1082,7 +1083,9 @@ static void rsu_calib_task(void *arg, int pending __unused) { struct rsu_softc *sc = arg; +#ifdef notyet uint32_t reg; +#endif RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: running calibration task\n", __func__); @@ -1100,9 +1103,10 @@ rsu_calib_task(void *arg, int pending __ #endif /* Read current signal level. */ if (rsu_fw_iocmd(sc, 0xf4000001) == 0) { - reg = rsu_read_4(sc, R92S_IOCMD_DATA); - RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: RSSI=%d%%\n", - __func__, reg >> 4); + sc->sc_currssi = rsu_read_4(sc, R92S_IOCMD_DATA); + RSU_DPRINTF(sc, RSU_DEBUG_CALIB, "%s: RSSI=%d (%d)\n", + __func__, sc->sc_currssi, + rsu_hwrssi_to_rssi(sc, sc->sc_currssi)); } if (sc->sc_calibrating) taskqueue_enqueue_timeout(taskqueue_thread, &sc->calib_task, hz); @@ -1433,6 +1437,24 @@ rsu_disconnect(struct rsu_softc *sc) return (rsu_fw_cmd(sc, R92S_CMD_DISCONNECT, &zero, sizeof(zero))); } +/* + * Map the hardware provided RSSI value to a signal level. + * For the most part it's just something we divide by and cap + * so it doesn't overflow the representation by net80211. + */ +static int +rsu_hwrssi_to_rssi(struct rsu_softc *sc, int hw_rssi) +{ + int v; + + if (hw_rssi == 0) + return (0); + v = hw_rssi >> 4; + if (v > 80) + v = 80; + return (v); +} + static void rsu_event_survey(struct rsu_softc *sc, uint8_t *buf, int len) { @@ -1486,8 +1508,9 @@ rsu_event_survey(struct rsu_softc *sc, u rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI; rxs.c_ieee = le32toh(bss->config.dsconfig); rxs.c_freq = ieee80211_ieee2mhz(rxs.c_ieee, IEEE80211_CHAN_2GHZ); - rxs.rssi = le32toh(bss->rssi); - rxs.nf = 0; /* XXX */ + /* This is a number from 0..100; so let's just divide it down a bit */ + rxs.rssi = le32toh(bss->rssi) / 2; + rxs.nf = -96; /* XXX avoid a LOR */ RSU_UNLOCK(sc); @@ -1557,7 +1580,7 @@ rsu_event_addba_req_report(struct rsu_so if (vap == NULL) return; - device_printf(sc->sc_dev, "%s: mac=%s, tid=%d, ssn=%d\n", + RSU_DPRINTF(sc, RSU_DEBUG_AMPDU, "%s: mac=%s, tid=%d, ssn=%d\n", __func__, ether_sprintf(ba->mac_addr), (int) ba->tid, @@ -1670,6 +1693,7 @@ rsu_rx_multi_event(struct rsu_softc *sc, } } +#if 0 static int8_t rsu_get_rssi(struct rsu_softc *sc, int rate, void *physt) { @@ -1690,9 +1714,10 @@ rsu_get_rssi(struct rsu_softc *sc, int r } return (rssi); } +#endif static struct mbuf * -rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen, int *rssi) +rsu_rx_frame(struct rsu_softc *sc, uint8_t *buf, int pktlen) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_frame *wh; @@ -1718,16 +1743,17 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 rate = MS(rxdw3, R92S_RXDW3_RATE); infosz = MS(rxdw0, R92S_RXDW0_INFOSZ) * 8; +#if 0 /* Get RSSI from PHY status descriptor if present. */ if (infosz != 0) *rssi = rsu_get_rssi(sc, rate, &stat[1]); else *rssi = 0; +#endif RSU_DPRINTF(sc, RSU_DEBUG_RX, - "%s: Rx frame len=%d rate=%d infosz=%d rssi=%d\n", - __func__, - pktlen, rate, infosz, *rssi); + "%s: Rx frame len=%d rate=%d infosz=%d\n", + __func__, pktlen, rate, infosz); m = m_get2(pktlen, M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { @@ -1769,7 +1795,11 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 /* Bit 7 set means HT MCS instead of rate. */ tap->wr_rate = 0x80 | (rate - 12); } +#if 0 tap->wr_dbm_antsignal = *rssi; +#endif + /* XXX not nice */ + tap->wr_dbm_antsignal = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); } @@ -1778,7 +1808,7 @@ rsu_rx_frame(struct rsu_softc *sc, uint8 } static struct mbuf * -rsu_rx_multi_frame(struct rsu_softc *sc, uint8_t *buf, int len, int *rssi) +rsu_rx_multi_frame(struct rsu_softc *sc, uint8_t *buf, int len) { struct r92s_rx_stat *stat; uint32_t rxdw0; @@ -1810,7 +1840,7 @@ rsu_rx_multi_frame(struct rsu_softc *sc, break; /* Process 802.11 frame. */ - m = rsu_rx_frame(sc, buf, pktlen, rssi); + m = rsu_rx_frame(sc, buf, pktlen); if (m0 == NULL) m0 = m; if (prevm == NULL) @@ -1829,7 +1859,7 @@ rsu_rx_multi_frame(struct rsu_softc *sc, } static struct mbuf * -rsu_rxeof(struct usb_xfer *xfer, struct rsu_data *data, int *rssi) +rsu_rxeof(struct usb_xfer *xfer, struct rsu_data *data) { struct rsu_softc *sc = data->sc; struct ieee80211com *ic = &sc->sc_ic; @@ -1850,7 +1880,7 @@ rsu_rxeof(struct usb_xfer *xfer, struct /* No packets to process. */ return (NULL); } else - return (rsu_rx_multi_frame(sc, data->buf, len, rssi)); + return (rsu_rx_multi_frame(sc, data->buf, len)); } static void @@ -1862,7 +1892,6 @@ rsu_bulk_rx_callback(struct usb_xfer *xf struct ieee80211_node *ni; struct mbuf *m = NULL, *next; struct rsu_data *data; - int rssi = 1; RSU_ASSERT_LOCKED(sc); @@ -1872,7 +1901,7 @@ rsu_bulk_rx_callback(struct usb_xfer *xf if (data == NULL) goto tr_setup; STAILQ_REMOVE_HEAD(&sc->sc_rx_active, next); - m = rsu_rxeof(xfer, data, &rssi); + m = rsu_rxeof(xfer, data); STAILQ_INSERT_TAIL(&sc->sc_rx_inactive, data, next); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -1898,6 +1927,11 @@ tr_setup: */ RSU_UNLOCK(sc); while (m != NULL) { + int rssi; + + /* Cheat and get the last calibrated RSSI */ + rssi = rsu_hwrssi_to_rssi(sc, sc->sc_currssi); + next = m->m_next; m->m_next = NULL; wh = mtod(m, struct ieee80211_frame *); @@ -1906,10 +1940,10 @@ tr_setup: if (ni != NULL) { if (ni->ni_flags & IEEE80211_NODE_HT) m->m_flags |= M_AMPDU; - (void)ieee80211_input(ni, m, rssi, 0); + (void)ieee80211_input(ni, m, rssi, -96); ieee80211_free_node(ni); } else - (void)ieee80211_input_all(ic, m, rssi, 0); + (void)ieee80211_input_all(ic, m, rssi, -96); m = next; } RSU_LOCK(sc); @@ -2003,6 +2037,12 @@ tr_setup: } break; } + + /* + * XXX TODO: if the queue is low, flush out FF TX frames. + * Remember to unlock the driver for now; net80211 doesn't + * defer it for us. + */ } static void Modified: head/sys/dev/usb/wlan/if_rsureg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rsureg.h Wed Sep 30 04:48:56 2015 (r288413) +++ head/sys/dev/usb/wlan/if_rsureg.h Wed Sep 30 05:19:16 2015 (r288414) @@ -764,6 +764,7 @@ struct rsu_softc { int sc_ht; int sc_nendpoints; int sc_curpwrstate; + int sc_currssi; u_int sc_running:1, sc_calibrating:1, From owner-svn-src-head@freebsd.org Wed Sep 30 05:24:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85615A0C075; Wed, 30 Sep 2015 05:24:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 732DF12F0; Wed, 30 Sep 2015 05:24:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5OOXd097264; Wed, 30 Sep 2015 05:24:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5ONsG097254; Wed, 30 Sep 2015 05:24:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300524.t8U5ONsG097254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288415 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars sys/cddl/contrib/opensolaris/uts/common/dtrace s... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 05:24:24 -0000 Author: markj Date: Wed Sep 30 05:24:22 2015 New Revision: 288415 URL: https://svnweb.freebsd.org/changeset/base/288415 Log: MFV r288408: 6266 harden dtrace_difo_chunksize() with respect to malicious DIF illumos/illumos-gate@395c7a3dcfc66b8b671dc4b3c4a2f0ca26449922 Reviewed by: Alex Wilson Reviewed by: Dan McDonald Approved by: Garrett D'Amore Author: Bryan Cantrill MFC after: 1 week Added: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d - copied unchanged from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/err.biglocal.d Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh (from r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh Wed Sep 30 05:24:22 2015 (r288415, copy of r288408, vendor/illumos/dist/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh) @@ -0,0 +1,112 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2015, Joyent, Inc. All rights reserved. +# + +err=/tmp/err.$$ + +ppriv -s A=basic,dtrace_user $$ + +# +# When we lack dtrace_kernel, we expect to not be able to get at kernel memory +# via any subroutine or other vector. +# +# trace(func((void *)&\`utsname)); } +/usr/sbin/dtrace -wq -Cs /dev/stdin 2> $err <mrbig.toomany[0] = '!'; + exit(0); +} Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 30 05:19:16 2015 (r288414) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Wed Sep 30 05:24:22 2015 (r288415) @@ -155,7 +155,7 @@ int dtrace_destructive_disallow = 0; dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); dtrace_optval_t dtrace_dof_maxsize = (8 * 1024 * 1024); -size_t dtrace_global_maxsize = (16 * 1024); +size_t dtrace_statvar_maxsize = (16 * 1024); size_t dtrace_actions_max = (16 * 1024); size_t dtrace_retain_max = 1024; dtrace_optval_t dtrace_helper_actions_max = 128; @@ -699,13 +699,33 @@ dtrace_canstore_statvar(uint64_t addr, s dtrace_statvar_t **svars, int nsvars) { int i; + size_t maxglobalsize, maxlocalsize; + + if (nsvars == 0) + return (0); + + maxglobalsize = dtrace_statvar_maxsize; + maxlocalsize = (maxglobalsize + sizeof (uint64_t)) * NCPU; for (i = 0; i < nsvars; i++) { dtrace_statvar_t *svar = svars[i]; + uint8_t scope; + size_t size; - if (svar == NULL || svar->dtsv_size == 0) + if (svar == NULL || (size = svar->dtsv_size) == 0) continue; + scope = svar->dtsv_var.dtdv_scope; + + /* + * We verify that our size is valid in the spirit of providing + * defense in depth: we want to prevent attackers from using + * DTrace to escalate an orthogonal kernel heap corruption bug + * into the ability to store to arbitrary locations in memory. + */ + VERIFY((scope == DIFV_SCOPE_GLOBAL && size < maxglobalsize) || + (scope == DIFV_SCOPE_LOCAL && size < maxlocalsize)); + if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size)) return (1); } @@ -4455,7 +4475,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_canload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyout(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -4470,7 +4491,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, if (!dtrace_destructive_disallow && dtrace_priv_proc_control(state) && - !dtrace_istoxic(kaddr, size)) { + !dtrace_istoxic(kaddr, size) && + dtrace_strcanload(kaddr, size, mstate, vstate)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); dtrace_copyoutstr(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); @@ -6458,6 +6480,11 @@ dtrace_dif_emulate(dtrace_difo_t *difo, regs[r2] ? regs[r2] : dtrace_strsize_default) + 1; } else { + if (regs[r2] > LONG_MAX) { + *flags |= CPU_DTRACE_ILLOP; + break; + } + tupregs[ttop].dttk_size = regs[r2]; } @@ -9915,9 +9942,10 @@ dtrace_difo_validate(dtrace_difo_t *dp, break; } - if (v->dtdv_scope == DIFV_SCOPE_GLOBAL && - vt->dtdt_size > dtrace_global_maxsize) { - err += efunc(i, "oversized by-ref global\n"); + if ((v->dtdv_scope == DIFV_SCOPE_GLOBAL || + v->dtdv_scope == DIFV_SCOPE_LOCAL) && + vt->dtdt_size > dtrace_statvar_maxsize) { + err += efunc(i, "oversized by-ref static\n"); break; } } @@ -10261,6 +10289,9 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, if (srd == 0) return; + if (sval > LONG_MAX) + return; + tupregs[ttop++].dttk_size = sval; } @@ -10322,6 +10353,19 @@ dtrace_difo_chunksize(dtrace_difo_t *dp, */ size = P2ROUNDUP(size, sizeof (uint64_t)); + /* + * Before setting the chunk size, check that we're not going + * to set it to a negative value... + */ + if (size > LONG_MAX) + return; + + /* + * ...and make certain that we didn't badly overflow. + */ + if (size < ksize || size < sizeof (dtrace_dynvar_t)) + return; + if (size > vstate->dtvs_dynvars.dtds_chunksize) vstate->dtvs_dynvars.dtds_chunksize = size; } @@ -13942,6 +13986,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((dstate->dtds_chunksize = chunksize) == 0) dstate->dtds_chunksize = DTRACE_DYNVAR_CHUNKSIZE; + VERIFY(dstate->dtds_chunksize < LONG_MAX); + if (size < (min = dstate->dtds_chunksize + sizeof (dtrace_dynhash_t))) size = min; @@ -13982,6 +14028,9 @@ dtrace_dstate_init(dtrace_dstate_t *dsta ((uintptr_t)base + hashsize * sizeof (dtrace_dynhash_t)); limit = (uintptr_t)base + size; + VERIFY((uintptr_t)start < limit); + VERIFY((uintptr_t)start >= (uintptr_t)base); + maxper = (limit - (uintptr_t)start) / NCPU; maxper = (maxper / dstate->dtds_chunksize) * dstate->dtds_chunksize; @@ -14007,7 +14056,7 @@ dtrace_dstate_init(dtrace_dstate_t *dsta start = (dtrace_dynvar_t *)limit; } - ASSERT(limit <= (uintptr_t)base + size); + VERIFY(limit <= (uintptr_t)base + size); for (;;) { next = (dtrace_dynvar_t *)((uintptr_t)dvar + @@ -14016,6 +14065,8 @@ dtrace_dstate_init(dtrace_dstate_t *dsta if ((uintptr_t)next + dstate->dtds_chunksize >= limit) break; + VERIFY((uintptr_t)dvar >= (uintptr_t)base && + (uintptr_t)dvar <= (uintptr_t)base + size); dvar->dtdv_next = next; dvar = next; } Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Wed Sep 30 05:19:16 2015 (r288414) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h Wed Sep 30 05:24:22 2015 (r288415) @@ -1317,16 +1317,19 @@ extern void dtrace_copystr(uintptr_t, ui /* * DTrace Assertions * - * DTrace calls ASSERT from probe context. To assure that a failed ASSERT - * does not induce a markedly more catastrophic failure (e.g., one from which - * a dump cannot be gleaned), DTrace must define its own ASSERT to be one that - * may safely be called from probe context. This header file must thus be - * included by any DTrace component that calls ASSERT from probe context, and - * _only_ by those components. (The only exception to this is kernel - * debugging infrastructure at user-level that doesn't depend on calling - * ASSERT.) + * DTrace calls ASSERT and VERIFY from probe context. To assure that a failed + * ASSERT or VERIFY does not induce a markedly more catastrophic failure (e.g., + * one from which a dump cannot be gleaned), DTrace must define its own ASSERT + * and VERIFY macros to be ones that may safely be called from probe context. + * This header file must thus be included by any DTrace component that calls + * ASSERT and/or VERIFY from probe context, and _only_ by those components. + * (The only exception to this is kernel debugging infrastructure at user-level + * that doesn't depend on calling ASSERT.) */ #undef ASSERT +#undef VERIFY +#define VERIFY(EX) ((void)((EX) || \ + dtrace_assfail(#EX, __FILE__, __LINE__))) #ifdef DEBUG #define ASSERT(EX) ((void)((EX) || \ dtrace_assfail(#EX, __FILE__, __LINE__))) From owner-svn-src-head@freebsd.org Wed Sep 30 05:25:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A6F1A0C21E; Wed, 30 Sep 2015 05:25:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B1E314D0; Wed, 30 Sep 2015 05:25:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5Pdbw097431; Wed, 30 Sep 2015 05:25:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5Pd7w097429; Wed, 30 Sep 2015 05:25:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300525.t8U5Pd7w097429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:25:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288416 - in head/cddl/usr.sbin/dtrace/tests/common: privs scalars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 05:25:40 -0000 Author: markj Date: Wed Sep 30 05:25:39 2015 New Revision: 288416 URL: https://svnweb.freebsd.org/changeset/base/288416 Log: Update DTrace test makefiles after r288415. Modified: head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Modified: head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Wed Sep 30 05:24:22 2015 (r288415) +++ head/cddl/usr.sbin/dtrace/tests/common/privs/Makefile Wed Sep 30 05:25:39 2015 (r288416) @@ -8,6 +8,7 @@ TESTFILES= \ tst.fds.ksh \ tst.func_access.ksh \ tst.getf.ksh \ + tst.kpriv.ksh \ tst.op_access.ksh \ tst.procpriv.ksh \ tst.providers.ksh \ Modified: head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Wed Sep 30 05:24:22 2015 (r288415) +++ head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Wed Sep 30 05:25:39 2015 (r288416) @@ -14,6 +14,8 @@ TESTFILES= \ err.D_OP_INCOMPAT.dupltype.d \ err.D_OP_INCOMPAT.dupttype.d \ err.D_SYNTAX.declare.d \ + err.bigglobal.d \ + err.biglocal.d \ tst.basicvar.d \ tst.basicvar.d.out \ tst.localvar.d \ From owner-svn-src-head@freebsd.org Wed Sep 30 05:46:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AC27A0B01A; Wed, 30 Sep 2015 05:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F32F1F21; Wed, 30 Sep 2015 05:46:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U5kvPo006856; Wed, 30 Sep 2015 05:46:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U5kv01006854; Wed, 30 Sep 2015 05:46:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509300546.t8U5kv01006854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 05:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288417 - head/cddl/contrib/opensolaris/cmd/lockstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 05:46:58 -0000 Author: markj Date: Wed Sep 30 05:46:56 2015 New Revision: 288417 URL: https://svnweb.freebsd.org/changeset/base/288417 Log: Have lockstat(1) trace locks by name rather than by address. Previously, lockstat(1) would use a lock's address as its identifier when consuming data describing lock contention and hold events. After collecting the requested data, it would use ksyms(4) to resolve lock addresses to names. Of course, this doesn't work too well for locks contained in dynamically-allocated memory. This change modifies lockstat(1) to trace the lock names obtained from the base struct lock_object instead, leading to output that is generally much more useful. This change also removes the -c option, which is used to coalesce data for locks in an array. It's not possible to support this option without also tracing lock addresses, and since lock arrays in which the lock names are distinct are not very common in FreeBSD, it's simpler to just remove the option. Reviewed by: avg (earlier revision) Differential Revision: https://reviews.freebsd.org/D3661 Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Wed Sep 30 05:25:39 2015 (r288416) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.1 Wed Sep 30 05:46:56 2015 (r288417) @@ -21,7 +21,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2015 +.Dd September 29, 2015 .Dt LOCKSTAT 1 .Os .Sh NAME @@ -38,7 +38,7 @@ .Op Fl d Ar duration .Op Fl f Ar function Oo Ns , Ns Ar size Oc .Op Fl T -.Op Fl ckgwWRpP +.Op Fl kgwWRpP .Op Fl D Ar count .Op Fl o filename .Op Fl x Ar opt Oo Ns = Ns Ar val Oc @@ -172,8 +172,6 @@ This is off by default. .El .Ss Data Reporting .Bl -tag -width indent -.It Fl c -Coalesce lock data for lock arrays. .It Fl D Ar count Only display the top .Ar count Modified: head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Sep 30 05:25:39 2015 (r288416) +++ head/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Wed Sep 30 05:46:56 2015 (r288417) @@ -65,7 +65,11 @@ typedef uintptr_t pc_t; typedef struct lsrec { struct lsrec *ls_next; /* next in hash chain */ +#ifdef illumos uintptr_t ls_lock; /* lock address */ +#else + char *ls_lock; /* lock name */ +#endif uintptr_t ls_caller; /* caller address */ uint32_t ls_count; /* cumulative event count */ uint32_t ls_event; /* type of event */ @@ -338,7 +342,9 @@ usage(void) " -d duration only watch events longer than \n" " -T trace (rather than sample) events\n" "\nData reporting options:\n\n" +#ifdef illumos " -c coalesce lock data for arrays like pse_mutex[]\n" +#endif " -k coalesce PCs within functions\n" " -g show total events generated by function\n" " -w wherever: don't distinguish events by caller\n" @@ -381,12 +387,16 @@ lockcmp(lsrec_t *a, lsrec_t *b) if (a->ls_caller > b->ls_caller) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); return (0); +#else + return (strcmp(a->ls_lock, b->ls_lock)); +#endif } static int @@ -424,26 +434,40 @@ lockcmp_anywhere(lsrec_t *a, lsrec_t *b) if (a->ls_event > b->ls_event) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); return (0); +#else + return (strcmp(a->ls_lock, b->ls_lock)); +#endif } static int lock_and_count_cmp_anywhere(lsrec_t *a, lsrec_t *b) { +#ifndef illumos + int cmp; +#endif + if (a->ls_event < b->ls_event) return (-1); if (a->ls_event > b->ls_event) return (1); +#ifdef illumos if (a->ls_lock < b->ls_lock) return (-1); if (a->ls_lock > b->ls_lock) return (1); +#else + cmp = strcmp(a->ls_lock, b->ls_lock); + if (cmp != 0) + return (cmp); +#endif return (b->ls_count - a->ls_count); } @@ -698,7 +722,11 @@ dprog_addevent(int event) caller = "(uintptr_t)arg0"; arg1 = "arg2"; } else { +#ifdef illumos arg0 = "(uintptr_t)arg0"; +#else + arg0 = "stringof(args[0]->lock_object.lo_name)"; +#endif caller = "caller"; } @@ -912,12 +940,17 @@ lsrec_fill(lsrec_t *lsrec, const dtrace_ lsrec->ls_event = (uint32_t)*((uint64_t *)(data + rec->dtrd_offset)); rec++; +#ifdef illumos if (rec->dtrd_size != sizeof (uintptr_t)) fail(0, "bad lock address size in second record"); /* LINTED - alignment */ lsrec->ls_lock = *((uintptr_t *)(data + rec->dtrd_offset)); rec++; +#else + lsrec->ls_lock = strdup((const char *)(data + rec->dtrd_offset)); + rec++; +#endif if (rec->dtrd_size != sizeof (uintptr_t)) fail(0, "bad caller size in third record"); @@ -1224,9 +1257,11 @@ main(int argc, char **argv) events_specified = 1; break; +#ifdef illumos case 'c': g_cflag = 1; break; +#endif case 'k': g_kflag = 1; @@ -1539,6 +1574,9 @@ main(int argc, char **argv) caller_in_stack = 1; bcopy(oldlsp, lsp, LS_TIME); lsp->ls_caller = oldlsp->ls_stack[fr]; +#ifndef illumos + lsp->ls_lock = strdup(oldlsp->ls_lock); +#endif /* LINTED - alignment */ lsp = (lsrec_t *)((char *)lsp + LS_TIME); } @@ -1547,6 +1585,9 @@ main(int argc, char **argv) /* LINTED - alignment */ lsp = (lsrec_t *)((char *)lsp + LS_TIME); } +#ifndef illumos + free(oldlsp->ls_lock); +#endif } g_nrecs = g_nrecs_used = ((uintptr_t)lsp - (uintptr_t)newlsp) / LS_TIME; @@ -1604,8 +1645,10 @@ main(int argc, char **argv) for (i = 0; i < g_nrecs_used; i++) { int fr; lsp = sort_buf[i]; +#ifdef illumos if (g_cflag) coalesce_symbol(&lsp->ls_lock); +#endif if (g_kflag) { for (fr = 0; fr < g_stkdepth; fr++) coalesce_symbol(&lsp->ls_stack[fr]); @@ -1659,6 +1702,15 @@ main(int argc, char **argv) first = current; } +#ifndef illumos + /* + * Free lock name buffers + */ + for (i = 0, lsp = (lsrec_t *)data_buf; i < g_nrecs_used; i++, + lsp = (lsrec_t *)((char *)lsp + g_recsize)) + free(lsp->ls_lock); +#endif + return (0); } @@ -1748,8 +1800,12 @@ report_stats(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%u %u", lsp->ls_event, lsp->ls_count); +#ifdef illumos (void) fprintf(out, " %s", format_symbol(buf, lsp->ls_lock, g_cflag)); +#else + (void) fprintf(out, " %s", lsp->ls_lock); +#endif (void) fprintf(out, " %s", format_symbol(buf, lsp->ls_caller, 0)); (void) fprintf(out, " %f", @@ -1811,8 +1867,12 @@ report_stats(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%4.2f %8s ", (double)lsp->ls_refcnt / lsp->ls_count, buf); +#ifdef illumos (void) fprintf(out, "%-22s ", format_symbol(buf, lsp->ls_lock, g_cflag)); +#else + (void) fprintf(out, "%-22s ", lsp->ls_lock); +#endif (void) fprintf(out, "%-24s\n", format_symbol(buf, lsp->ls_caller, 0)); @@ -1908,7 +1968,11 @@ report_trace(FILE *out, lsrec_t **sort_b (void) fprintf(out, "%2d %10llu %11p %-24s %-24s\n", lsp->ls_event, (unsigned long long)lsp->ls_time, (void *)lsp->ls_next, +#ifdef illumos format_symbol(buf, lsp->ls_lock, 0), +#else + lsp->ls_lock, +#endif format_symbol(buf2, lsp->ls_caller, 0)); if (rectype <= LS_STACK(0)) From owner-svn-src-head@freebsd.org Wed Sep 30 08:16:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D157A0A12F; Wed, 30 Sep 2015 08:16:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 52A7F1B07; Wed, 30 Sep 2015 08:16:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8U8GarL075933; Wed, 30 Sep 2015 08:16:36 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8U8GYP1075923; Wed, 30 Sep 2015 08:16:34 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201509300816.t8U8GYP1075923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 30 Sep 2015 08:16:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288418 - in head/sys: netinet netinet6 netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 08:16:36 -0000 Author: ae Date: Wed Sep 30 08:16:33 2015 New Revision: 288418 URL: https://svnweb.freebsd.org/changeset/base/288418 Log: Take extra reference to security policy before calling crypto_dispatch(). Currently we perform crypto requests for IPSEC synchronous for most of crypto providers (software, aesni) and only VIA padlock calls crypto callback asynchronous. In synchronous mode it is possible, that security policy will be removed during the processing crypto request. And crypto callback will release the last reference to SP. Then upon return into ipsec[46]_process_packet() IPSECREQUEST_UNLOCK() will be called to already freed request. To prevent this we will take extra reference to SP. PR: 201876 Sponsored by: Yandex LLC Modified: head/sys/netinet/ip_ipsec.c head/sys/netinet6/ip6_ipsec.c head/sys/netipsec/ipsec_output.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netinet/ip_ipsec.c ============================================================================== --- head/sys/netinet/ip_ipsec.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netinet/ip_ipsec.c Wed Sep 30 08:16:33 2015 (r288418) @@ -199,9 +199,7 @@ ip_ipsec_output(struct mbuf **m, struct /* NB: callee frees mbuf */ *error = ipsec4_process_packet(*m, sp->req); - /* Release SP if an error occured */ - if (*error != 0) - KEY_FREESP(&sp); + KEY_FREESP(&sp); if (*error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We Modified: head/sys/netinet6/ip6_ipsec.c ============================================================================== --- head/sys/netinet6/ip6_ipsec.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netinet6/ip6_ipsec.c Wed Sep 30 08:16:33 2015 (r288418) @@ -200,9 +200,7 @@ ip6_ipsec_output(struct mbuf **m, struct /* NB: callee frees mbuf */ *error = ipsec6_process_packet(*m, sp->req); - /* Release SP if an error occured */ - if (*error != 0) - KEY_FREESP(&sp); + KEY_FREESP(&sp); if (*error == EJUSTRETURN) { /* * We had a SP with a level of 'use' and no SA. We Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/ipsec_output.c Wed Sep 30 08:16:33 2015 (r288418) @@ -166,10 +166,6 @@ ipsec_process_done(struct mbuf *m, struc * If this is a problem we'll need to introduce a queue * to set the packet on so we can unwind the stack before * doing further processing. - * - * If ipsec[46]_process_packet() will successfully queue - * the request, we need to take additional reference to SP, - * because xform callback will release reference. */ if (isr->next) { /* XXX-BZ currently only support same AF bundles. */ @@ -177,11 +173,7 @@ ipsec_process_done(struct mbuf *m, struc #ifdef INET case AF_INET: IPSECSTAT_INC(ips_out_bundlesa); - key_addref(isr->sp); - error = ipsec4_process_packet(m, isr->next); - if (error != 0) - KEY_FREESP(&isr->sp); - return (error); + return (ipsec4_process_packet(m, isr->next)); /* NOTREACHED */ #endif #ifdef notyet @@ -189,11 +181,7 @@ ipsec_process_done(struct mbuf *m, struc case AF_INET6: /* XXX */ IPSEC6STAT_INC(ips_out_bundlesa); - key_addref(isr->sp); - error = ipsec6_process_packet(m, isr->next); - if (error != 0) - KEY_FREESP(&isr->sp); - return (error); + return (ipsec6_process_packet(m, isr->next)); /* NOTREACHED */ #endif /* INET6 */ #endif Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_ah.c Wed Sep 30 08:16:33 2015 (r288418) @@ -1068,6 +1068,7 @@ ah_output(struct mbuf *m, struct ipsecre crp->crp_opaque = (caddr_t) tc; /* These are passed as-is to the callback. */ + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_esp.c Wed Sep 30 08:16:33 2015 (r288418) @@ -874,6 +874,7 @@ esp_output(struct mbuf *m, struct ipsecr } /* Callback parameters */ + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; Modified: head/sys/netipsec/xform_ipcomp.c ============================================================================== --- head/sys/netipsec/xform_ipcomp.c Wed Sep 30 05:46:56 2015 (r288417) +++ head/sys/netipsec/xform_ipcomp.c Wed Sep 30 08:16:33 2015 (r288418) @@ -449,6 +449,7 @@ ipcomp_output(struct mbuf *m, struct ips goto bad; } + key_addref(isr->sp); tc->tc_isr = isr; KEY_ADDREFSA(sav); tc->tc_sav = sav; From owner-svn-src-head@freebsd.org Wed Sep 30 12:40:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8747DA0B46D; Wed, 30 Sep 2015 12:40:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77D6A1EF0; Wed, 30 Sep 2015 12:40:52 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UCeqA6087032; Wed, 30 Sep 2015 12:40:52 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UCeqbO087031; Wed, 30 Sep 2015 12:40:52 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201509301240.t8UCeqbO087031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 30 Sep 2015 12:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288419 - head/share/examples/mdoc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 12:40:52 -0000 Author: brueffer Date: Wed Sep 30 12:40:51 2015 New Revision: 288419 URL: https://svnweb.freebsd.org/changeset/base/288419 Log: Join excessive split lines. MFC after: 1 week Modified: head/share/examples/mdoc/example.4 Modified: head/share/examples/mdoc/example.4 ============================================================================== --- head/share/examples/mdoc/example.4 Wed Sep 30 08:16:33 2015 (r288418) +++ head/share/examples/mdoc/example.4 Wed Sep 30 12:40:51 2015 (r288419) @@ -26,15 +26,14 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd April 1, 2006 +.Dd July 31, 2015 .Dt EXAMPLE 4 i386 .Os .Sh NAME .Nm example .Nd "example device driver manual page" .Sh SYNOPSIS -To compile the -driver into the kernel, +To compile the driver into the kernel, place the following lines in the kernel configuration file: .Bd -ragged -offset indent @@ -42,8 +41,7 @@ kernel configuration file: .Cd "options EXAMPLE_DEBUG" .Ed .Pp -Alternatively, to load the -driver as a +Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent From owner-svn-src-head@freebsd.org Wed Sep 30 13:31:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF38EA0BA40; Wed, 30 Sep 2015 13:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF5591BDA; Wed, 30 Sep 2015 13:31:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UDVd0T010248; Wed, 30 Sep 2015 13:31:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UDVbYB010241; Wed, 30 Sep 2015 13:31:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509301331.t8UDVbYB010241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Sep 2015 13:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288420 - in head/sys/cam: . scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 13:31:40 -0000 Author: mav Date: Wed Sep 30 13:31:37 2015 New Revision: 288420 URL: https://svnweb.freebsd.org/changeset/base/288420 Log: Make pass, sg and targ drivers respect HBA's maxio. Previous limitation of 64K (DFLTPHYS) is quite annoying. Modified: head/sys/cam/cam_compat.c head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_pass.c head/sys/cam/scsi/scsi_sg.c head/sys/cam/scsi/scsi_target.c Modified: head/sys/cam/cam_compat.c ============================================================================== --- head/sys/cam/cam_compat.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_compat.c Wed Sep 30 13:31:37 2015 (r288420) @@ -300,7 +300,7 @@ cam_compat_translate_dev_match_0x18(unio /* Remap the CCB into kernel address space */ bzero(&mapinfo, sizeof(mapinfo)); - cam_periph_mapmem(ccb, &mapinfo); + cam_periph_mapmem(ccb, &mapinfo, MAXPHYS); dm = ccb->cdm.matches; /* Translate in-place: old fields are smaller */ Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_periph.c Wed Sep 30 13:31:37 2015 (r288420) @@ -716,16 +716,19 @@ camperiphfree(struct cam_periph *periph) * buffers to map stuff in and out, we're limited to the buffer size. */ int -cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo) +cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo, + u_int maxmap) { int numbufs, i, j; int flags[CAM_PERIPH_MAXMAPS]; u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS]; u_int32_t lengths[CAM_PERIPH_MAXMAPS]; u_int32_t dirs[CAM_PERIPH_MAXMAPS]; - /* Some controllers may not be able to handle more data. */ - size_t maxmap = DFLTPHYS; + if (maxmap == 0) + maxmap = DFLTPHYS; /* traditional default */ + else if (maxmap > MAXPHYS) + maxmap = MAXPHYS; /* for safety */ switch(ccb->ccb_h.func_code) { case XPT_DEV_MATCH: if (ccb->cdm.match_buf_len == 0) { Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_periph.h Wed Sep 30 13:31:37 2015 (r288420) @@ -160,7 +160,8 @@ int cam_periph_hold(struct cam_periph * void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); int cam_periph_mapmem(union ccb *ccb, - struct cam_periph_map_info *mapinfo); + struct cam_periph_map_info *mapinfo, + u_int maxmap); void cam_periph_unmapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo); union ccb *cam_periph_getccb(struct cam_periph *periph, Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/cam_xpt.c Wed Sep 30 13:31:37 2015 (r288420) @@ -536,7 +536,7 @@ xptdoioctl(struct cdev *dev, u_long cmd, * Map the pattern and match buffers into kernel * virtual address space. */ - error = cam_periph_mapmem(inccb, &mapinfo); + error = cam_periph_mapmem(inccb, &mapinfo, MAXPHYS); if (error) { inccb->ccb_h.path = old_path; Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_pass.c Wed Sep 30 13:31:37 2015 (r288420) @@ -77,6 +77,7 @@ struct pass_softc { u_int8_t pd_type; union ccb saved_ccb; int open_count; + u_int maxio; struct devstat *device_stats; struct cdev *dev; struct cdev *alias_dev; @@ -366,6 +367,13 @@ passregister(struct cam_periph *periph, cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ + /* * We pass in 0 for a blocksize, since we don't * know what the blocksize of this device is, if @@ -657,7 +665,7 @@ passsendccb(struct cam_periph *periph, u * Dropping it here is reasonably safe. */ cam_periph_unlock(periph); - error = cam_periph_mapmem(ccb, &mapinfo); + error = cam_periph_mapmem(ccb, &mapinfo, softc->maxio); cam_periph_lock(periph); /* Modified: head/sys/cam/scsi/scsi_sg.c ============================================================================== --- head/sys/cam/scsi/scsi_sg.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_sg.c Wed Sep 30 13:31:37 2015 (r288420) @@ -99,6 +99,7 @@ struct sg_softc { sg_state state; sg_flags flags; int open_count; + u_int maxio; struct devstat *device_stats; TAILQ_HEAD(, sg_rdwr) rdwr_done; struct cdev *dev; @@ -325,6 +326,13 @@ sgregister(struct cam_periph *periph, vo cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ + /* * We pass in 0 for all blocksize, since we don't know what the * blocksize of the device is, if it even has a blocksize. @@ -894,7 +902,7 @@ sgsendccb(struct cam_periph *periph, uni * need for additional checks. */ cam_periph_unlock(periph); - error = cam_periph_mapmem(ccb, &mapinfo); + error = cam_periph_mapmem(ccb, &mapinfo, softc->maxio); cam_periph_lock(periph); if (error) return (error); Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Wed Sep 30 12:40:51 2015 (r288419) +++ head/sys/cam/scsi/scsi_target.c Wed Sep 30 13:31:37 2015 (r288420) @@ -94,6 +94,7 @@ struct targ_softc { struct cam_periph *periph; struct cam_path *path; targ_state state; + u_int maxio; struct selinfo read_select; struct devstat device_stats; }; @@ -403,6 +404,12 @@ targenable(struct targ_softc *softc, str status = CAM_FUNC_NOTAVAIL; goto enable_fail; } + if (cpi.maxio == 0) + softc->maxio = DFLTPHYS; /* traditional default */ + else if (cpi.maxio > MAXPHYS) + softc->maxio = MAXPHYS; /* for safety */ + else + softc->maxio = cpi.maxio; /* real value */ /* Destroy any periph on our path if it is disabled */ periph = cam_periph_find(path, "targ"); @@ -725,7 +732,7 @@ targsendccb(struct targ_softc *softc, un if ((ccb_h->func_code == XPT_CONT_TARGET_IO) || (ccb_h->func_code == XPT_DEV_MATCH)) { - error = cam_periph_mapmem(ccb, mapinfo); + error = cam_periph_mapmem(ccb, mapinfo, softc->maxio); /* * cam_periph_mapmem returned an error, we can't continue. From owner-svn-src-head@freebsd.org Wed Sep 30 16:31:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09BF2A0CE5A; Wed, 30 Sep 2015 16:31:23 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E323E1E02; Wed, 30 Sep 2015 16:31:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UGVM2x081847; Wed, 30 Sep 2015 16:31:22 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UGVM82081843; Wed, 30 Sep 2015 16:31:22 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509301631.t8UGVM82081843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 30 Sep 2015 16:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288421 - head/release/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 16:31:23 -0000 Author: gjb Date: Wed Sep 30 16:31:21 2015 New Revision: 288421 URL: https://svnweb.freebsd.org/changeset/base/288421 Log: Initial attempt to add support for building images for BANANAPI, CUBIEBOARD, and CUBIEBOARD2 SoCs. Obtained from: Crochet, FreeBSD/arm/Allwinner Wiki page Sponsored by: The FreeBSD Foundation Added: head/release/arm/BANANAPI.conf (contents, props changed) head/release/arm/CUBIEBOARD.conf (contents, props changed) head/release/arm/CUBIEBOARD2.conf (contents, props changed) Added: head/release/arm/BANANAPI.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/BANANAPI.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-bananapi" +KERNEL="A20" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 +export BOARDNAME="BANANAPI" + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-bananapi" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Added: head/release/arm/CUBIEBOARD.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/CUBIEBOARD.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-cubieboard" +KERNEL="CUBIEBOARD" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} Added: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/arm/CUBIEBOARD2.conf Wed Sep 30 16:31:21 2015 (r288421) @@ -0,0 +1,43 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +EMBEDDEDBUILD=1 +EMBEDDED_TARGET="arm" +EMBEDDED_TARGET_ARCH="armv6" +EMBEDDEDPORTS="sysutils/u-boot-cubieboard2" +KERNEL="A20" +WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" +IMAGE_SIZE="1G" +PART_SCHEME="MBR" +FAT_SIZE="32m -b 1m" +FAT_TYPE="16" +MD_ARGS="-x 63 -y 255" +NODOC=1 +export BOARDNAME="CUBIEBOARD2" + +arm_install_uboot() { + UBOOT_DIR="/usr/local/share/u-boot/u-boot-cubieboard2" + UBOOT_FILES="u-boot.img" + FATMOUNT="${DESTDIR%${KERNEL}}/fat" + UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ + of=/dev/${mddev} bs=1m seek=8 + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ + of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" + chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} + chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr ${FATMOUNT}/ubldr + chroot ${CHROOTDIR} cp -p ${UFSMOUNT}/boot/ubldr.bin \ + ${FATMOUNT}/ubldr.bin + chroot ${CHROOTDIR} touch ${UFSMOUNT}/firstboot + sync + umount_loop ${CHROOTDIR}/${FATMOUNT} + umount_loop ${CHROOTDIR}/${UFSMOUNT} + chroot ${CHROOTDIR} rmdir ${FATMOUNT} + chroot ${CHROOTDIR} rmdir ${UFSMOUNT} + + return 0 +} From owner-svn-src-head@freebsd.org Wed Sep 30 17:43:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66DA7A0BD98; Wed, 30 Sep 2015 17:43:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 581C71887; Wed, 30 Sep 2015 17:43:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UHh3Yi012704; Wed, 30 Sep 2015 17:43:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UHh3hD012703; Wed, 30 Sep 2015 17:43:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201509301743.t8UHh3hD012703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 30 Sep 2015 17:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288423 - head/bin/ls/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 17:43:03 -0000 Author: ngie Date: Wed Sep 30 17:43:02 2015 New Revision: 288423 URL: https://svnweb.freebsd.org/changeset/base/288423 Log: Skip the B_flag testcase to stop blowing up freebsd-current@ with "test failure emails" because kyua report-jenkins doesn't properly escape non-printable chars Modified: head/bin/ls/tests/ls_tests.sh Modified: head/bin/ls/tests/ls_tests.sh ============================================================================== --- head/bin/ls/tests/ls_tests.sh Wed Sep 30 17:40:09 2015 (r288422) +++ head/bin/ls/tests/ls_tests.sh Wed Sep 30 17:43:02 2015 (r288423) @@ -180,6 +180,7 @@ B_flag_head() B_flag_body() { + atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136" atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")" atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B From owner-svn-src-head@freebsd.org Wed Sep 30 19:13:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB95CA0C088; Wed, 30 Sep 2015 19:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB2851E7B; Wed, 30 Sep 2015 19:13:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UJDX5t050057; Wed, 30 Sep 2015 19:13:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UJDWL8050052; Wed, 30 Sep 2015 19:13:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201509301913.t8UJDWL8050052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 30 Sep 2015 19:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288424 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 19:13:34 -0000 Author: jhb Date: Wed Sep 30 19:13:32 2015 New Revision: 288424 URL: https://svnweb.freebsd.org/changeset/base/288424 Log: Several changes to truss. - Refactor the interface between the ABI-independent code and the ABI-specific backends. The backends now provide smaller hooks to fetch system call arguments and return values. The rest of the system call entry and exit handling that was previously duplicated among all the backends has been moved to one place. - Merge the loop when waiting for an event with the loop for handling stops. This also means not emulating a procfs-like interface on top of ptrace(). Instead, use a single event loop that fetches process events via waitid(). Among other things this allows us to report the full 32-bit exit value. - Use PT_FOLLOW_FORK to follow new child processes instead of forking a new truss process for each new child. This allows one truss process to monitor a tree of processes and truss -c should now display one total for the entire tree instead of separate summaries per process. - Use the recently added fields to ptrace_lwpinfo to determine the current system call number and argument count. The latter is especially useful and fixes a regression since the conversion from procfs. truss now generally prints the correct number of arguments for most system calls rather than printing extra arguments for any call not listed in the table in syscalls.c. - Actually check the new ABI when processes call exec. The comments claimed that this happened but it was not being done (perhaps this was another regression in the conversion to ptrace()). If the new ABI after exec is not supported, truss detaches from the process. If truss does not support the ABI for a newly executed process the process is killed before it returns from exec. - Along with the refactor, teach the various ABI-specific backends to fetch both return values, not just the first. Use this to properly report the full 64-bit return value from lseek(). In addition, the handler for "pipe" now pulls the pair of descriptors out of the return values (which is the true kernel system call interface) but displays them as an argument (which matches the interface exported by libc). - Each ABI handler adds entries to a linker set rather than requiring a statically defined table of handlers in main.c. - The arm and mips system call fetching code was changed to follow the same pattern as amd64 (and the in-kernel handler) of fetching register arguments first and then reading any remaining arguments from the stack. This should fix indirect system call arguments on at least arm. - The mipsn32 and n64 ABIs will now look for arguments in A4 through A7. - Use register %ebp for the 6th system call argument for Linux/i386 ABIs to match the in-kernel argument fetch code. - For powerpc binaries on a powerpc64 system, fetch the extra arguments on the stack as 32-bit values that are then copied into the 64-bit argument array instead of reading the 32-bit values directly into the 64-bit array. Reviewed by: kib (earlier version) Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version) Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D3575 Modified: head/usr.bin/truss/amd64-fbsd.c head/usr.bin/truss/amd64-fbsd32.c head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/arm-fbsd.c head/usr.bin/truss/extern.h head/usr.bin/truss/i386-fbsd.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/mips-fbsd.c head/usr.bin/truss/powerpc-fbsd.c head/usr.bin/truss/powerpc64-fbsd.c head/usr.bin/truss/setup.c head/usr.bin/truss/sparc64-fbsd.c head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c head/usr.bin/truss/truss.h Modified: head/usr.bin/truss/amd64-fbsd.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-fbsd.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,290 +29,103 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * FreeBSD/amd64-specific system call handling. This is probably the most - * complex part of the entire truss program, although I've got lots of - * it handled relatively cleanly now. The system call names are generated - * automatically, thanks to /usr/src/sys/kern/syscalls.master. The - * names used for the various structures are confusing, I sadly admit. - */ +#include +__FBSDID("$FreeBSD$"); + +/* FreeBSD/amd64-specific system call handling. */ -#include #include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "syscalls.h" -static int nsyscalls = nitems(syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct freebsd_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long *args; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct freebsd_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct freebsd_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct freebsd_syscall *fsc) -{ - int i; - - free(fsc->args); - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in amd64/amd64/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct ptrace_io_desc iorequest; struct reg regs; - struct freebsd_syscall *fsc; - struct syscall *sc; + struct current_syscall *cs; lwpid_t tid; - int i, reg, syscall_num; + u_int i, reg; tid = trussinfo->curthread->tid; - + cs = &trussinfo->curthread->cs; if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); - return; + return (-1); } /* - * FreeBSD has two special kinds of system call redirctions -- + * FreeBSD has two special kinds of system call redirections -- * SYS_syscall, and SYS___syscall. The former is the old syscall() * routine, basically; the latter is for quad-aligned arguments. + * + * The system call argument count and code from ptrace() already + * account for these, but we need to skip over %rax if it contains + * either of these values. */ reg = 0; - syscall_num = regs.r_rax; - switch (syscall_num) { + switch (regs.r_rax) { case SYS_syscall: case SYS___syscall: - syscall_num = regs.r_rdi; reg++; break; } - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); - } - - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "fork") == 0 || - strcmp(fsc->name, "pdfork") == 0 || - strcmp(fsc->name, "rfork") == 0 || - strcmp(fsc->name, "vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - - fsc->args = malloc((1 + nargs) * sizeof(unsigned long)); - for (i = 0; i < nargs && reg < 6; i++, reg++) { + for (i = 0; i < narg && reg < 6; i++, reg++) { switch (reg) { - case 0: fsc->args[i] = regs.r_rdi; break; - case 1: fsc->args[i] = regs.r_rsi; break; - case 2: fsc->args[i] = regs.r_rdx; break; - case 3: fsc->args[i] = regs.r_rcx; break; - case 4: fsc->args[i] = regs.r_r8; break; - case 5: fsc->args[i] = regs.r_r9; break; + case 0: cs->args[i] = regs.r_rdi; break; + case 1: cs->args[i] = regs.r_rsi; break; + case 2: cs->args[i] = regs.r_rdx; break; + case 3: cs->args[i] = regs.r_rcx; break; + case 4: cs->args[i] = regs.r_r8; break; + case 5: cs->args[i] = regs.r_r9; break; } } - if (nargs > i) { + if (narg > i) { iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = (void *)(regs.r_rsp + sizeof(register_t)); - iorequest.piod_addr = &fsc->args[i]; - iorequest.piod_len = (nargs - i) * sizeof(register_t); + iorequest.piod_addr = &cs->args[i]; + iorequest.piod_len = (narg - i) * sizeof(register_t); ptrace(PT_IO, tid, (caddr_t)&iorequest, 0); if (iorequest.piod_len == 0) - return; + return (-1); } - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; - } - - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%lx%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif - } - -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + return (0); } -/* - * And when the system call is done, we handle it here. - * Currently, no attempt is made to ensure that the system calls - * match -- this needs to be fixed (and is, in fact, why S_SCX includes - * the system call number instead of, say, an error status). - */ - -long -amd64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +static int +amd64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) { struct reg regs; - struct freebsd_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; - } - } - } - - if (fsc->name != NULL && (strcmp(fsc->name, "execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; - - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ + retval[0] = regs.r_rax; + retval[1] = regs.r_rdx; + *errorp = !!(regs.r_rflags & PSL_C); + return (0); +} - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_fbsd = { + "FreeBSD ELF64", + syscallnames, + nitems(syscallnames), + amd64_fetch_args, + amd64_fetch_retval +}; - return (retval); -} +PROCABI(amd64_fbsd); Modified: head/usr.bin/truss/amd64-fbsd32.c ============================================================================== --- head/usr.bin/truss/amd64-fbsd32.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-fbsd32.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,290 +29,109 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * FreeBSD/i386-specific system call handling. This is probably the most - * complex part of the entire truss program, although I've got lots of - * it handled relatively cleanly now. The system call names are generated - * automatically, thanks to /usr/src/sys/kern/syscalls.master. The - * names used for the various structures are confusing, I sadly admit. - */ +#include +__FBSDID("$FreeBSD$"); + +/* FreeBSD/i386-specific system call handling. */ -#include #include #include #include #include -#include -#include -#include #include #include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "freebsd32_syscalls.h" -static int nsyscalls = nitems(freebsd32_syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct freebsd32_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long *args; - unsigned int *args32; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct freebsd32_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct freebsd32_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct freebsd32_syscall *fsc) -{ - int i; - - free(fsc->args); - free(fsc->args32); - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_fbsd32_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_fbsd32_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct ptrace_io_desc iorequest; struct reg regs; - struct freebsd32_syscall *fsc; - struct syscall *sc; - lwpid_t tid; + struct current_syscall *cs; + unsigned int args32[narg]; unsigned long parm_offset; - int i, syscall_num; + lwpid_t tid; + u_int i; tid = trussinfo->curthread->tid; - + cs = &trussinfo->curthread->cs; if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); - return; + return (-1); } parm_offset = regs.r_rsp + sizeof(int); /* - * FreeBSD has two special kinds of system call redirctions -- + * FreeBSD has two special kinds of system call redirections -- * SYS_syscall, and SYS___syscall. The former is the old syscall() * routine, basically; the latter is for quad-aligned arguments. + * + * The system call argument count and code from ptrace() already + * account for these, but we need to skip over the first argument. */ - syscall_num = regs.r_rax; - switch (syscall_num) { + switch (regs.r_rax) { case SYS_syscall: - syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0); parm_offset += sizeof(int); break; case SYS___syscall: - syscall_num = ptrace(PT_READ_D, tid, (caddr_t)parm_offset, 0); parm_offset += sizeof(quad_t); break; } - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : freebsd32_syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); - } - - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "fork") == 0 || - strcmp(fsc->name, "pdfork") == 0 || - strcmp(fsc->name, "rfork") == 0 || - strcmp(fsc->name, "vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - - fsc->args32 = malloc((1 + nargs) * sizeof(unsigned int)); iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = (void *)parm_offset; - iorequest.piod_addr = fsc->args32; - iorequest.piod_len = (1 + nargs) * sizeof(unsigned int); + iorequest.piod_addr = args32; + iorequest.piod_len = sizeof(args32); ptrace(PT_IO, tid, (caddr_t)&iorequest, 0); - if (iorequest.piod_len == 0) - return; - - fsc->args = malloc((1 + nargs) * sizeof(unsigned long)); - for (i = 0; i < nargs + 1; i++) - fsc->args[i] = fsc->args32[i]; - - sc = NULL; - if (fsc->name) - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; - } - - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%x%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif + if (iorequest.piod_len == 0) { + return (-1); } -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + for (i = 0; i < narg; i++) + cs->args[i] = args32[i]; + return (0); } -/* - * And when the system call is done, we handle it here. - * Currently, no attempt is made to ensure that the system calls - * match -- this needs to be fixed (and is, in fact, why S_SCX includes - * the system call number instead of, say, an error status). - */ - -long -amd64_fbsd32_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +static int +amd64_fbsd32_fetch_retval(struct trussinfo *trussinfo, long *retval, + int *errorp) { struct reg regs; - struct freebsd32_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; - } - } - } + retval[0] = regs.r_rax & 0xffffffff; + retval[1] = regs.r_rdx & 0xffffffff; + *errorp = !!(regs.r_rflags & PSL_C); + return (0); +} - if (fsc->name != NULL && (strcmp(fsc->name, "freebsd32_execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; +static struct procabi amd64_fbsd32 = { + "FreeBSD ELF32", + freebsd32_syscallnames, + nitems(freebsd32_syscallnames), + amd64_fbsd32_fetch_args, + amd64_fbsd32_fetch_retval +}; - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ +PROCABI(amd64_fbsd32); - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_fbsd32_aout = { + "FreeBSD a.out", + freebsd32_syscallnames, + nitems(freebsd32_syscallnames), + amd64_fbsd32_fetch_args, + amd64_fbsd32_fetch_retval +}; - return (retval); -} +PROCABI(amd64_fbsd32_aout); Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/amd64-linux32.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,123 +29,36 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); -/* - * Linux/i386-specific system call handling. Given how much of this code - * is taken from the freebsd equivalent, I can probably put even more of - * it in support routines that can be used by any personality support. - */ +/* Linux/i386-specific system call handling. */ -#include #include #include #include -#include -#include -#include #include -#include -#include -#include -#include #include "truss.h" -#include "syscall.h" -#include "extern.h" #include "linux32_syscalls.h" -static int nsyscalls = nitems(linux32_syscallnames); - -/* - * This is what this particular file uses to keep track of a system call. - * It is probably not quite sufficient -- I can probably use the same - * structure for the various syscall personalities, and I also probably - * need to nest system calls (for signal handlers). - * - * 'struct syscall' describes the system call; it may be NULL, however, - * if we don't know about this particular system call yet. - */ -struct linux_syscall { - struct syscall *sc; - const char *name; - int number; - unsigned long args[5]; - int nargs; /* number of arguments -- *not* number of words! */ - char **s_args; /* the printable arguments */ -}; - -static struct linux_syscall * -alloc_fsc(void) -{ - - return (malloc(sizeof(struct linux_syscall))); -} - -/* Clear up and free parts of the fsc structure. */ -static void -free_fsc(struct linux_syscall *fsc) -{ - int i; - - if (fsc->s_args) { - for (i = 0; i < fsc->nargs; i++) - free(fsc->s_args[i]); - free(fsc->s_args); - } - free(fsc); -} - -/* - * Called when a process has entered a system call. nargs is the - * number of words, not number of arguments (a necessary distinction - * in some cases). Note that if the STOPEVENT() code in i386/i386/trap.c - * is ever changed these functions need to keep up. - */ - -void -amd64_linux32_syscall_entry(struct trussinfo *trussinfo, int nargs) +static int +amd64_linux32_fetch_args(struct trussinfo *trussinfo, u_int narg) { struct reg regs; - struct linux_syscall *fsc; - struct syscall *sc; + struct current_syscall *cs; lwpid_t tid; - int i, syscall_num; tid = trussinfo->curthread->tid; - + cs = &trussinfo->curthread->cs; if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); - return; - } - - syscall_num = regs.r_rax; - - fsc = alloc_fsc(); - if (fsc == NULL) - return; - fsc->number = syscall_num; - fsc->name = (syscall_num < 0 || syscall_num >= nsyscalls) ? - NULL : linux32_syscallnames[syscall_num]; - if (!fsc->name) { - fprintf(trussinfo->outfile, "-- UNKNOWN SYSCALL %d --\n", - syscall_num); + return (-1); } - if (fsc->name && (trussinfo->flags & FOLLOWFORKS) && - (strcmp(fsc->name, "linux_fork") == 0 || - strcmp(fsc->name, "linux_vfork") == 0)) - trussinfo->curthread->in_fork = 1; - - if (nargs == 0) - return; - /* * Linux passes syscall arguments in registers, not * on the stack. Fortunately, we've got access to the @@ -153,60 +66,22 @@ amd64_linux32_syscall_entry(struct truss * number of arguments. And what does linux do for syscalls * that have more than five arguments? */ - - fsc->args[0] = regs.r_rbx; - fsc->args[1] = regs.r_rcx; - fsc->args[2] = regs.r_rdx; - fsc->args[3] = regs.r_rsi; - fsc->args[4] = regs.r_rdi; - - sc = get_syscall(fsc->name); - if (sc) - fsc->nargs = sc->nargs; - else { -#if DEBUG - fprintf(trussinfo->outfile, "unknown syscall %s -- setting " - "args to %d\n", fsc->name, nargs); -#endif - fsc->nargs = nargs; + switch (narg) { + default: + cs->args[5] = regs.r_rbp; /* Unconfirmed */ + case 5: + cs->args[4] = regs.r_rdi; + case 4: + cs->args[3] = regs.r_rsi; + case 3: + cs->args[2] = regs.r_rdx; + case 2: + cs->args[1] = regs.r_rcx; + case 1: + cs->args[0] = regs.r_rbx; } - fsc->s_args = calloc(1, (1 + fsc->nargs) * sizeof(char *)); - fsc->sc = sc; - - /* - * At this point, we set up the system call arguments. - * We ignore any OUT ones, however -- those are arguments that - * are set by the system call, and so are probably meaningless - * now. This doesn't currently support arguments that are - * passed in *and* out, however. - */ - - if (fsc->name) { -#if DEBUG - fprintf(stderr, "syscall %s(", fsc->name); -#endif - for (i = 0; i < fsc->nargs; i++) { -#if DEBUG - fprintf(stderr, "0x%x%s", sc ? - fsc->args[sc->args[i].offset] : fsc->args[i], - i < (fsc->nargs - 1) ? "," : ""); -#endif - if (sc && !(sc->args[i].type & OUT)) { - fsc->s_args[i] = print_arg(&sc->args[i], - fsc->args, 0, trussinfo); - } - } -#if DEBUG - fprintf(stderr, ")\n"); -#endif - } - -#if DEBUG - fprintf(trussinfo->outfile, "\n"); -#endif - - trussinfo->curthread->fsc = fsc; + return (0); } /* @@ -224,83 +99,43 @@ static const int bsd_to_linux_errno[] = -6, }; -long -amd64_linux32_syscall_exit(struct trussinfo *trussinfo, - int syscall_num __unused) +static int +amd64_linux32_fetch_retval(struct trussinfo *trussinfo, long *retval, + int *errorp) { struct reg regs; - struct linux_syscall *fsc; - struct syscall *sc; lwpid_t tid; - long retval; - int errorp, i; - - if (trussinfo->curthread->fsc == NULL) - return (-1); + size_t i; tid = trussinfo->curthread->tid; - if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); return (-1); } - retval = regs.r_rax; - errorp = !!(regs.r_rflags & PSL_C); - - /* - * This code, while simpler than the initial versions I used, could - * stand some significant cleaning. - */ - - fsc = trussinfo->curthread->fsc; - sc = fsc->sc; - if (!sc) { - for (i = 0; i < fsc->nargs; i++) - asprintf(&fsc->s_args[i], "0x%lx", fsc->args[i]); - } else { - /* - * Here, we only look for arguments that have OUT masked in -- - * otherwise, they were handled in the syscall_entry function. - */ - for (i = 0; i < sc->nargs; i++) { - char *temp; - - if (sc->args[i].type & OUT) { - /* - * If an error occurred, then don't bother - * getting the data; it may not be valid. - */ - if (errorp) { - asprintf(&temp, "0x%lx", - fsc->args[sc->args[i].offset]); - } else { - temp = print_arg(&sc->args[i], - fsc->args, retval, trussinfo); - } - fsc->s_args[i] = temp; + retval[0] = regs.r_rax & 0xffffffff; + retval[1] = regs.r_rdx & 0xffffffff; + *errorp = !!(regs.r_rflags & PSL_C); + + if (*errorp) { + for (i = 0; i < nitems(bsd_to_linux_errno); i++) { + if (retval[0] == bsd_to_linux_errno[i]) { + retval[0] = i; + return (0); } } - } - /* - * It would probably be a good idea to merge the error handling, - * but that complicates things considerably. - */ - if (errorp) { - for (i = 0; (size_t)i < nitems(bsd_to_linux_errno); i++) { - if (retval == bsd_to_linux_errno[i]) - break; - } + /* XXX: How to handle unknown errors? */ } + return (0); +} - if (fsc->name != NULL && (strcmp(fsc->name, "linux_execve") == 0 || - strcmp(fsc->name, "exit") == 0)) - trussinfo->curthread->in_syscall = 1; - - print_syscall_ret(trussinfo, fsc->name, fsc->nargs, fsc->s_args, errorp, - errorp ? i : retval, fsc->sc); - free_fsc(fsc); +static struct procabi amd64_linux32 = { + "Linux ELF32", + linux32_syscallnames, + nitems(linux32_syscallnames), + amd64_linux32_fetch_args, + amd64_linux32_fetch_retval +}; - return (retval); -} +PROCABI(amd64_linux32); Modified: head/usr.bin/truss/arm-fbsd.c ============================================================================== --- head/usr.bin/truss/arm-fbsd.c Wed Sep 30 17:43:02 2015 (r288423) +++ head/usr.bin/truss/arm-fbsd.c Wed Sep 30 19:13:32 2015 (r288424) @@ -29,17 +29,11 @@ * SUCH DAMAGE. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Sep 30 20:38:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D427A0C3BA; Wed, 30 Sep 2015 20:38:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01B8E1479; Wed, 30 Sep 2015 20:38:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKcaf3082893; Wed, 30 Sep 2015 20:38:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKcaIN082891; Wed, 30 Sep 2015 20:38:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201509302038.t8UKcaIN082891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 30 Sep 2015 20:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288427 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 20:38:37 -0000 Author: mav Date: Wed Sep 30 20:38:35 2015 New Revision: 288427 URL: https://svnweb.freebsd.org/changeset/base/288427 Log: Use proper STAILQ_* macros where possible. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Sep 30 20:14:34 2015 (r288426) +++ head/sys/cam/ctl/ctl.c Wed Sep 30 20:38:35 2015 (r288427) @@ -1922,13 +1922,8 @@ ctl_shutdown(void) mtx_lock(&softc->ctl_lock); - /* - * Free up each LUN. - */ - for (lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; lun = next_lun){ - next_lun = STAILQ_NEXT(lun, links); + STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) ctl_free_lun(lun); - } mtx_unlock(&softc->ctl_lock); @@ -2780,9 +2775,9 @@ ctl_ioctl(struct cdev *dev, u_long cmd, * XXX KDM no locking here. If the LUN list changes, * things can blow up. */ - for (i = 0, lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; - i++, lun = STAILQ_NEXT(lun, links)) { - retval = copyout(&lun->stats, &stats->lun_stats[i], + i = 0; + STAILQ_FOREACH(lun, &softc->lun_list, links) { + retval = copyout(&lun->stats, &stats->lun_stats[i++], sizeof(lun->stats)); if (retval != 0) break; @@ -4637,8 +4632,7 @@ ctl_enable_lun(struct ctl_be_lun *be_lun lun->flags &= ~CTL_LUN_DISABLED; mtx_unlock(&lun->lun_lock); - for (port = STAILQ_FIRST(&softc->port_list); port != NULL; port = nport) { - nport = STAILQ_NEXT(port, links); + STAILQ_FOREACH_SAFE(port, &softc->port_list, links, nport) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0 || port->lun_map != NULL || port->lun_enable == NULL) continue; @@ -13130,7 +13124,7 @@ ctl_process_done(union ctl_io *io) * Check to see if we have any errors to inject here. We only * inject errors for commands that don't already have errors set. */ - if ((STAILQ_FIRST(&lun->error_list) != NULL) && + if (!STAILQ_EMPTY(&lun->error_list) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) && ((io->io_hdr.flags & CTL_FLAG_STATUS_SENT) == 0)) ctl_inject_error(lun, io); Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Sep 30 20:14:34 2015 (r288426) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Wed Sep 30 20:38:35 2015 (r288427) @@ -180,14 +180,7 @@ ctl_backend_ramdisk_shutdown(void) #endif mtx_lock(&softc->lock); - for (lun = STAILQ_FIRST(&softc->lun_list); lun != NULL; lun = next_lun){ - /* - * Grab the next LUN. The current LUN may get removed by - * ctl_invalidate_lun(), which will call our LUN shutdown - * routine, if there is no outstanding I/O for this LUN. - */ - next_lun = STAILQ_NEXT(lun, links); - + STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { /* * Drop our lock here. Since ctl_invalidate_lun() can call * back into us, this could potentially lead to a recursive From owner-svn-src-head@freebsd.org Wed Sep 30 20:40:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3CDA0C512; Wed, 30 Sep 2015 20:40:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B24D17ED; Wed, 30 Sep 2015 20:40:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKeqqd085466; Wed, 30 Sep 2015 20:40:52 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKeq54085465; Wed, 30 Sep 2015 20:40:52 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302040.t8UKeq54085465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 20:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288428 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 20:40:52 -0000 Author: bdrewery Date: Wed Sep 30 20:40:51 2015 New Revision: 288428 URL: https://svnweb.freebsd.org/changeset/base/288428 Log: META_MODE: Remove unneeded groff/tmac special GENDIRDEPS_FILTER. This is converting the path usr/share/tmac.*stage to something else, but nothing ever installs or reads from such a path. They might look in stage.*usr/share/tmac, but that's not what this is matching. Additionally the .dirdeps match all of the tmac files back to gnu/usr.bin/groff/tmac fine. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.gendirdeps.mk Modified: head/share/mk/local.gendirdeps.mk ============================================================================== --- head/share/mk/local.gendirdeps.mk Wed Sep 30 20:38:35 2015 (r288427) +++ head/share/mk/local.gendirdeps.mk Wed Sep 30 20:40:51 2015 (r288428) @@ -44,7 +44,3 @@ GENDIRDEPS_FILTER_VARS+= \ GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_DIR_VARS:@v@S,${$v},_{${v}},@} GENDIRDEPS_FILTER+= ${GENDIRDEPS_FILTER_VARS:@v@S,/${$v}/,/_{${v}}/,@:NS,//,*:u} - -# handle the non-standard way that gnu/usr.bin/groff/tmac is staged -GENDIRDEPS_FILTER+= C,.*usr/share/tmac.*stage,gnu/usr.bin/groff/tmac, - From owner-svn-src-head@freebsd.org Wed Sep 30 20:47:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE0B5A0C98E; Wed, 30 Sep 2015 20:47:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCA811C6C; Wed, 30 Sep 2015 20:47:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UKlSUd087028; Wed, 30 Sep 2015 20:47:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UKlR5R087024; Wed, 30 Sep 2015 20:47:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302047.t8UKlR5R087024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 20:47:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288429 - head/gnu/usr.bin/groff/tmac X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 20:47:29 -0000 Author: bdrewery Date: Wed Sep 30 20:47:27 2015 New Revision: 288429 URL: https://svnweb.freebsd.org/changeset/base/288429 Log: Replace most of the beforeinstall: hack with FILES mechanism. This now generates the files into the OBJDIR as needed. Some of the files are installed directly from the src directory. Files which are generated from the src directory are renamed to .in to generate them and avoid colliding with the checked-in file when CURDIR=OBJDIR. The remaining beforeinstall: handling still needs to be reworked as it does not work well with staging for packaging. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Added: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1 head/gnu/usr.bin/groff/tmac/mdoc.local.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/mdoc.local head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in - copied unchanged from r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R Deleted: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1 head/gnu/usr.bin/groff/tmac/mdoc.local head/gnu/usr.bin/groff/tmac/ru.KOI8-R Modified: head/gnu/usr.bin/groff/tmac/Makefile Modified: head/gnu/usr.bin/groff/tmac/Makefile ============================================================================== --- head/gnu/usr.bin/groff/tmac/Makefile Wed Sep 30 20:40:51 2015 (r288428) +++ head/gnu/usr.bin/groff/tmac/Makefile Wed Sep 30 20:47:27 2015 (r288429) @@ -14,7 +14,7 @@ MLINKS= groff_ms.7 ms.7 MLINKS+= groff_me.7 me.7 MLINKS+= groff_mdoc.7 mdoc.samples.7 -CLEANFILES= ${MAN} ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +CLEANFILES= ${MAN} NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \ me.tmac \ @@ -39,45 +39,59 @@ NORMALFILES= mandoc.tmac andoc.tmac an-o composite.tmac \ eqnrc \ troffrc troffrc-end \ + koi8-r.tmac hyphen.ru \ hyphen.us hyphenex.us +# These are all generated into the OBJDIR. SPECIALFILES= an.tmac man.tmac s.tmac ms.tmac www.tmac STRIPFILES= e.tmac doc.tmac mdoc.local MDOCFILES= doc-common doc-ditroff doc-nroff doc-syms \ fr.ISO8859-1 ru.KOI8-R +# These are in srcdir and must be built special to avoid colliding with +# CURDIR=OBJDIR. +SRCFILES= fr.ISO8859-1 mdoc.local ru.KOI8-R +CLEANFILES+= ${SRCFILES} + +FILESGROUPS= FILES +FILES= ${NORMALFILES} +FILESOWN= ${TMACOWN} +FILESGRP= ${TMACGRP} +FILESMODE= ${TMACMODE} +FILESDIR= ${TMACDIR} +MDOCFILESDIR= ${MDOCDIR} + +# Setup handling for the generated and special file groups +.for var in SPECIAL STRIP MDOC +FILESGROUPS+= ${var}FILES +CLEANFILES+= ${${var}FILES} +${var}FILESOWN?=${TMACOWN} +${var}FILESGRP?=${TMACGRP} +${var}FILESMODE?=${TMACMODE} +${var}FILESDIR?=${TMACDIR} +.endfor -all: ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +beforeinstall: +.if !exists(${DESTDIR}${TMACDIR}/man.local) + ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ + ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR} +.endif +.include + +# Do this after ../Makefile.inc gets included so DIST_DIR is defined. .for f in ${MDOCFILES} ${STRIPFILES} -$f-s: $f +# Generate the file from the contrib dir or src dir as needed. +.if ${SRCFILES:M${f}} != "" +${f}: ${.CURDIR}/${f}.in +.else +${f}: ${DIST_DIR}/${f} +.endif sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET} .endfor .for f in ${SPECIALFILES} -$f-s: $f +${f}: ${DIST_DIR}/${f} sed -e "s;@TMAC_AN_PREFIX@;${tmac_an_prefix};g" \ -e "s;@TMAC_S_PREFIX@;${tmac_s_prefix};g" \ -e "s;@PNMTOPS_NOSETPAGE@;pnmtops;g" \ ${.ALLSRC} > ${.TARGET} .endfor - -beforeinstall: - (cd ${DIST_DIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - ${NORMALFILES} ${DESTDIR}${TMACDIR}) - (cd ${.CURDIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}) -.for f in ${STRIPFILES} ${SPECIALFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${TMACDIR}/$f -.endfor -.for f in ${MDOCFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${MDOCDIR}/$f -.endfor -.if !exists(${DESTDIR}${TMACDIR}/man.local) - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR} -.endif - -.include Copied: head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in (from r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/fr.ISO8859-1) @@ -0,0 +1,139 @@ +.\" Copyright (c) 2002 Sebastien Gioria . +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" %beginstrip% +. +.\" .Dt localization +.nr doc-volume-operating-system-ateol 1 +.ds doc-volume-ds-1 Manuel des commandes utilisateur +.ds doc-volume-ds-2 Manuel des appels systèmes +.ds doc-volume-ds-3 Manuel des fonctions de la librairie +.ds doc-volume-ds-4 Manuel des interfaces du noyau +.ds doc-volume-ds-5 Manuel des formats de fichier +.ds doc-volume-ds-6 Manuel des jeux +.ds doc-volume-ds-7 Manuel d'informations diverses +.ds doc-volume-ds-8 Manuel de l'administrateur +.ds doc-volume-ds-9 Manuel du développeur du noyau +. +.ds doc-volume-ds-USD Documentation supplémentaire utilisateur +.ds doc-volume-ds-PS1 Documentation supplémentaire du programmeur +.ds doc-volume-ds-AMD Documentation ancestrale +.ds doc-volume-ds-SMM Manuel de l'administrateur +.ds doc-volume-ds-URM Manuel de référence utilisateur +.ds doc-volume-ds-PRM Manuel du programmeur +.ds doc-volume-ds-KM Manuel du noyau +.ds doc-volume-ds-IND Index principal des manuels +.ds doc-volume-ds-LOCAL Manuel local +.ds doc-volume-ds-CON Manuel des logiciels contribués +. +.\" .Os localization +.ds doc-operating-system-ATT-7 7th\~Edition +.ds doc-operating-system-BSD-3 3rd\~Distribution de Berkeley +.ds doc-operating-system-BSD-4 4th\~Distribution de Berkeley +.ds doc-operating-system-BSD-4.1 Distribution\~4.1 de Berkeley +.ds doc-operating-system-BSD-4.2 Distribution\~4.2 de Berkeley +.ds doc-operating-system-BSD-4.3 Distribution\~4.3 de Berkeley +.ds doc-operating-system-BSD-4.3T Distribution 4.3-Tahoe de Berkeley +.ds doc-operating-system-BSD-4.3R Distribution 4.3-Reno de Berkeley +. +.\" .Sh localization +.ds doc-section-name NOM +.ds doc-section-synopsis SYNOPSIS +.ds doc-section-library BIBLIOTHÈQUE +.ds doc-section-description DESCRIPTION +.ds doc-section-see-also VOIR +.ds doc-section-files FICHIERS +.ds doc-section-authors AUTEURS +. +.\" .Lb localization +.ds doc-str-Lb-libarm32 Bibliothèque de l'architecture ARM32 (libarm32, \-larm32) +.ds doc-str-Lb-libc Bibliothèque\~C Standard (libc, \-lc) +.ds doc-str-Lb-libc_r Bibliothèque\~C réentrante (libc_r, \-lc_r) +.\" XXX ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) +.\" XXX ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) +.ds doc-str-Lb-libcipher Bibliothèque de cryptage FreeSec (libcipher, \-lcipher) +.ds doc-str-Lb-libcompat Bibliothèque de compatibilité (libcompat, \-lcompat) +.ds doc-str-Lb-libcrypt Bibliothèque de cryptage (libcrypt, \-lcrypt) +.ds doc-str-Lb-libcurses Bibliothèque de Curses (libcurses, \-lcurses) +.\" XXX ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-devinfo) +.ds doc-str-Lb-libdevstat Bibliothèque de statistiques des périphériques (libdevstat, \-ldevstat) +.ds doc-str-Lb-libdisk Bibliothèque d'accès à l'interface des labels de partitions (libdisk, \-ldisk) +.ds doc-str-Lb-libedit Bibliothèque de l'éditeur de ligne de commande (libedit, \-ledit) +.ds doc-str-Lb-libfetch Bibliothèque de transfert de fichier (libfetch, \-lfetch) +.\" XXX ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) +.ds doc-str-Lb-libi386 Bibliothèque de l'architecture i386 (libi386, \-li386) +.ds doc-str-Lb-libipsec Bibliothèque de contrôle de politique IPsec (libipsec, \-lipsec) +.ds doc-str-Lb-libkvm Bibliothèque d'accès aux données du noyau (libkvm, \-lkvm) +.ds doc-str-Lb-libm Bibliothèque mathématique (libm, \-lm) +.ds doc-str-Lb-libmd Bibliothèque de support des signatures (MD4, MD5, etc.) (libmd, \-lmd) +.ds doc-str-Lb-libmenu Bibliothèque Curses des Menus (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph Bibliothèque utilisateur Netgraph (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libossaudio Bibliothèque d'émulation audio OSS (libossaudio, \-lossaudio) +.ds doc-str-Lb-libpam Bibliothèque PAM (libpam, \-lpam) +.ds doc-str-Lb-libposix Bibliothèque de compatibilité \*[Px] (libposix, \-lposix) +.ds doc-str-Lb-libresolv Bibliothèque du résolveur DNS (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsvc Bibliothèque des services RPC (librpcsvc, \-lrpcsvc) +.ds doc-str-Lb-libtermcap Bibliothèque d'accès aux terminaux (libtermcap, \-ltermcap) +.\" XXX ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) +.\" XXX ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libusbhid Bibliothèque d'accès aux routines USB HID (libusbhid, \-lusbhid) +.ds doc-str-Lb-libutil Bibliothèque des utilitaires système (libutil, \-lutil) +.ds doc-str-Lb-libvgl Bibliothèque graphique vidéo (libvgl, \-lvgl) +.ds doc-str-Lb-libz Bibliothèque de compression (libz, \-lz) +. +.\" .Rv localization +.ds doc-str-Rv-std-prefix "La +.ds doc-str-Rv-std-suffix "fonction retourne la valeur\~0 si tout c'est bien passé; +.as doc-str-Rv-std-suffix " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-std-suffix " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-std-suffix " est positionnée pour indiquer l'erreur. +. +.ds doc-str-Rv-stds-prefix "Les +.ds doc-str-Rv-stds-and "et +.ds doc-str-Rv-stds-suffix "fonctions retournent la valeur\~0 si tout c'est bien passé; +.as doc-str-Rv-stds-suffix " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-stds-suffix " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-stds-suffix " est positionnée pour indiquer l'erreur. +. +.ds doc-str-Rv-std0 "Si tout c'est bien passé, la valeur\~0 est retournée; +.as doc-str-Rv-std0 " sinon la valeur \~-1 est retournée et +.as doc-str-Rv-std0 " la variable globale \*[doc-Va-font]errno\f[P] +.as doc-str-Rv-std0 " est positionnée pour indiquer l'erreur. +. +.\" .Ex localization +.ds doc-str-Ex-std-prefix "La commande +.ds doc-str-Ex-std-suffix " retourne\~0 si tout c'est bien passé, +.as doc-str-Ex-std-suffix " et\~>0 si une erreur survient. +. +.ds doc-str-Ex-stds-prefix "Les commandes +.ds doc-str-Ex-stds-suffix "retournent\~0 si tout c'est bien passé, +.as doc-str-Ex-stds-suffix " et\~>0 si une erreur survient. +. +.\" .Ar localization +.ds doc-str-Ar-default "fichier\ .\|.\|. +. +.\" .%A localization +.ds doc-str-dpra "et Copied: head/gnu/usr.bin/groff/tmac/mdoc.local.in (from r288405, head/gnu/usr.bin/groff/tmac/mdoc.local) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/mdoc.local.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/mdoc.local) @@ -0,0 +1,80 @@ +.\" Copyright (c) 2001-2004 Ruslan Ermilov . +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" %beginstrip% +. +.eo +. +. +.ds doc-volume-operating-system FreeBSD +. +.\" FreeBSD .Lb values +.ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) +.ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) +.ds doc-str-Lb-libcapsicum Capsicum Library (libcapsicum, \-lcapsicum) +.ds doc-str-Lb-libcuse Userland Character Device Library (libcuse, \-lcuse) +.ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit) +.ds doc-str-Lb-libefi EFI Runtime Services Library (libefi, \-lefi) +.ds doc-str-Lb-libelf ELF Parsing Library (libelf, \-lelf) +.ds doc-str-Lb-libexecinfo Backtrace Access Library (libexecinfo, \-lexecinfo) +.ds doc-str-Lb-libfetch File Transfer Library (libfetch, \-lfetch) +.ds doc-str-Lb-libnv Name/value pairs library (libnv, \-lnv) +.ds doc-str-Lb-libpmc Performance Monitoring Counters Interface Library (libpmc, \-lpmc) +.ds doc-str-Lb-libproc Processor Monitoring and Analysis Library (libproc, \-lproc) +.ds doc-str-Lb-libprocstat Process and Files Information Retrieval (libprocstat, \-lprocstat) +.ds doc-str-Lb-librtld_db Run-time Linker Debugging Library (librtld_db, \-lrtld_db) +.ds doc-str-Lb-libsbuf Safe String Composition Library (libsbuf, \-lsbuf) +.ds doc-str-Lb-libstdthreads C11 Threads Library (libstdthreads, \-lstdthreads) +. +.\" Default .Os value +.ds doc-default-operating-system FreeBSD\~11.0 +. +.\" FreeBSD releases not found in doc-common +.ds doc-operating-system-FreeBSD-2.2.9 2.2.9 +.ds doc-operating-system-FreeBSD-7.4 7.4 +.ds doc-operating-system-FreeBSD-8.3 8.3 +.ds doc-operating-system-FreeBSD-8.4 8.4 +.ds doc-operating-system-FreeBSD-9.1 9.1 +.ds doc-operating-system-FreeBSD-9.2 9.2 +.ds doc-operating-system-FreeBSD-9.3 9.3 +.ds doc-operating-system-FreeBSD-10.0 10.0 +.ds doc-operating-system-FreeBSD-10.1 10.1 +.ds doc-operating-system-FreeBSD-11.0 11.0 +. +.\" Definitions for other *BSDs not (yet) in doc-common +.ds doc-operating-system-NetBSD-7.0 7.0 +. +.\" Definitions not (yet) in doc-syms +. +.ec +. +.\" Locale support +.if d doc-locale \{\ +. ie "\*[doc-locale]"ru.KOI8-R" \ +. mso mdoc/ru.KOI8-R +. el \{ .if "\*[doc-locale]"fr.ISO8859-1" \ +. mso mdoc/fr.ISO8859-1 +.\}\} Copied: head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in (from r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/groff/tmac/ru.KOI8-R.in Wed Sep 30 20:47:27 2015 (r288429, copy of r288405, head/gnu/usr.bin/groff/tmac/ru.KOI8-R) @@ -0,0 +1,139 @@ +.\" Copyright (c) 2001-2003 Ruslan Ermilov . +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.\" %beginstrip% +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Dt +.nr doc-volume-operating-system-ateol 1 +.ds doc-volume-ds-1 óÐÒÁ×ÏÞÎÉË ÏÓÎÏ×ÎÙÈ ËÏÍÁÎÄ +.ds doc-volume-ds-2 óÐÒÁ×ÏÞÎÉË ÓÉÓÔÅÍÎÙÈ ×ÙÚÏ×Ï× +.ds doc-volume-ds-3 óÐÒÁ×ÏÞÎÉË ÂÉÂÌÉÏÔÅÞÎÙÈ ÆÕÎËÃÉÊ +.ds doc-volume-ds-4 óÐÒÁ×ÏÞÎÉË ÉÎÔÅÒÆÅÊÓÏ× ÑÄÒÁ +.ds doc-volume-ds-5 óÐÒÁ×ÏÞÎÉË ÆÏÒÍÁÔÏ× ÆÁÊÌÏ× +.ds doc-volume-ds-6 óÐÒÁ×ÏÞÎÉË ÉÇÒ +.ds doc-volume-ds-7 óÐÒÁ×ÏÞÎÉË ÒÁÚÎÏÊ ÉÎÆÏÒÍÁÃÉÉ +.ds doc-volume-ds-8 óÐÒÁ×ÏÞÎÉË ÓÉÓÔÅÍÎÏÇÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒÁ +.ds doc-volume-ds-9 óÐÒÁ×ÏÞÎÉË ÒÁÚÒÁÂÏÔÞÉËÁ ÑÄÒÁ +. +.ds doc-volume-ds-USD äÏÐÏÌÎÉÔÅÌØÎÙÅ ÄÏËÕÍÅÎÔÙ ÄÌÑ ÐÏÌØÚÏ×ÁÔÅÌÑ +.ds doc-volume-ds-PS1 äÏÐÏÌÎÉÔÅÌØÎÙÅ ÄÏËÕÍÅÎÔÙ ÄÌÑ ÐÒÏÇÒÁÍÍÉÓÔÁ +.ds doc-volume-ds-AMD äÏËÕÍÅÎÔÙ ÕÎÁÓÌÅÄÏ×ÁÎÎÏÇÏ ÓÐÒÁ×ÏÞÎÉËÁ +.ds doc-volume-ds-SMM òÕËÏ×ÏÄÓÔ×Ï ÓÉÓÔÅÍÎÏÇÏ ÁÄÍÉÎÉÓÔÒÁÔÏÒÁ +.ds doc-volume-ds-URM óÐÒÁ×ÏÞÎÏÅ ÒÕËÏ×ÏÄÓÔ×Ï +.ds doc-volume-ds-PRM òÕËÏ×ÏÄÓÔ×Ï ÐÒÏÇÒÁÍÍÉÓÔÁ +.ds doc-volume-ds-KM òÕËÏ×ÏÄÓÔ×Ï ÐÏ ÑÄÒÕ +.ds doc-volume-ds-IND ïÓÎÏ×ÎÏÊ ÐÒÅÄÍÅÔÎÙÊ ÕËÁÚÁÔÅÌØ ÓÐÒÁ×ÏÞÎÉËÁ +.ds doc-volume-ds-LOCAL ìÏËÁÌØÎÙÊ ÓÐÒÁ×ÏÞÎÉË +.ds doc-volume-ds-CON óÐÒÁ×ÏÞÎÉË ÐÏ ÄÏÐÏÌÎÉÔÅÌØÎÏÍÕ ðï +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Os +.ds doc-operating-system-ATT-7 7Ñ\~ÒÅÄÁËÃÉÑ +.ds doc-operating-system-BSD-3 3Ê\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4 4Ê\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.1 4.1\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.2 4.2\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3 4.3\~ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3T 4.3-Tahoe ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +.ds doc-operating-system-BSD-4.3R 4.3-Reno ÄÉÓÔÒÉÂÕÔÉ× âÅÒËÌÉ +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Sh +.ds doc-section-name îáú÷áîéå +.ds doc-section-synopsis óéîôáëóéó +.ds doc-section-library âéâìéïôåëá +.ds doc-section-description ïðéóáîéå +.ds doc-section-see-also óíïôòé +.ds doc-section-files æáêìù +.ds doc-section-authors á÷ôïòù +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Lb (XXX) +.ds doc-str-Lb-libarm32 âÉÂÌÉÏÔÅËÁ ÁÒÈÉÔÅËÔÕÒÙ ARM32 (libarm32, \-larm32) +.ds doc-str-Lb-libc óÔÁÎÄÁÒÔÎÁÑ ÂÉÂÌÉÏÔÅËÁ\~C (libc, \-lc) +.ds doc-str-Lb-libc_r òÅÅÎÔÅÒÁÂÅÌØÎÁÑ ÂÉÂÌÉÏÔÅËÁ\~C (libc_r, \-lc_r) +.ds doc-str-Lb-libcalendar âÉÂÌÉÏÔÅËÁ ËÁÌÅÎÄÁÒÎÏÊ ÁÒÉÆÍÅÔÉËÉ (libcalendar, \-lcalendar) +.ds doc-str-Lb-libcam ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ ÂÉÂÌÉÏÔÅËÁ CAM (libcam, \-lcam) +.ds doc-str-Lb-libcipher âÉÂÌÉÏÔÅËÁ ËÒÉÐÔÏÇÒÁÆÉÉ FreeSec (libcipher, \-lcipher) +.ds doc-str-Lb-libcompat âÉÂÌÉÏÔÅËÁ ÓÏ×ÍÅÓÔÉÍÏÓÔÉ (libcompat, \-lcompat) +.ds doc-str-Lb-libcrypt âÉÂÌÉÏÔÅËÁ ËÒÉÐÔÏÇÒÁÆÉÉ (libcrypt, \-lcrypt) +.\" XXX ds doc-str-Lb-libcurses Curses Library (libcurses, \-lcurses) +.\" XXX ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) +.ds doc-str-Lb-libdevstat âÉÂÌÉÏÔÅËÁ ÓÔÁÔÉÓÔÉËÉ ÕÓÔÒÏÊÓÔ× (libdevstat, \-ldevstat) +.\" XXX ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) +.ds doc-str-Lb-libedit âÉÂÌÉÏÔÅËÁ ÒÅÄÁËÔÏÒÁ ËÏÍÁÎÄÎÏÊ ÓÔÒÏËÉ (libedit, \-ledit) +.ds doc-str-Lb-libfetch âÉÂÌÉÏÔÅËÁ ÆÁÊÌÏ×ÏÊ ÐÅÒÅÄÁÞÉ (libfetch, \-lfetch) +.ds doc-str-Lb-libgeom ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ API ÂÉÂÌÉÏÔÅËÁ ÐÏÄÓÉÓÔÅÍÙ ÑÄÒÁ GEOM (libgeom, \-lgeom) +.ds doc-str-Lb-libi386 âÉÂÌÉÏÔÅËÁ ÁÒÈÉÔÅËÔÕÒÙ i386 (libi386, \-li386) +.ds doc-str-Lb-libipsec âÉÂÌÉÏÔÅËÁ ÕÐÒÁ×ÌÅÎÉÑ IPsec Policy (libipsec, \-lipsec) +.ds doc-str-Lb-libkvm âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë ÄÁÎÎÙÍ ÑÄÒÁ (libkvm, \-lkvm) +.ds doc-str-Lb-libm âÉÂÌÉÏÔÅËÁ ÍÁÔÅÍÁÔÉÞÅÓËÉÈ ÆÕÎËÃÉÊ (libm, \-lm) +.\" XXX ds doc-str-Lb-libmd Message Digest (MD4, MD5, É Ô.Ä.) Support Library (libmd, \-lmd) +.\" XXX ds doc-str-Lb-libmenu Curses Menu Library (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph ðÏÌØÚÏ×ÁÔÅÌØÓËÁÑ ÂÉÂÌÉÏÔÅËÁ Netgraph (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libossaudio âÉÂÌÉÏÔÅËÁ ÜÍÕÌÑÃÉÉ OSS Audio (libossaudio, \-lossaudio) +.ds doc-str-Lb-libpam âÉÂÌÉÏÔÅËÁ PAM (libpam, \-lpam) +.ds doc-str-Lb-libposix âÉÂÌÉÏÔÅËÁ \*[Px]\-ÓÏ×ÍÅÓÔÉÍÏÓÔÉ (libposix, \-lposix) +.\" XXX ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsvc âÉÂÌÉÏÔÅËÁ ÓÌÕÖ RPC (librpcsvc, \-lrpcsvc) +.ds doc-str-Lb-libtermcap âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë termcap (libtermcap, \-ltermcap) +.ds doc-str-Lb-libufs âÉÂÌÉÏÔÅËÁ ÄÏÓÔÕÐÁ Ë ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÅ UFS (libufs, \-lufs) +.\" XXX ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libusbhid âÉÂÌÉÏÔÅËÁ ÆÕÎËÃÉÊ ÄÏÓÔÕÐÁ Ë USB HID (libusbhid, \-lusbhid) +.ds doc-str-Lb-libutil âÉÂÌÉÏÔÅËÁ ÓÉÓÔÅÍÎÙÈ ÕÔÉÌÉÔ (libutil, \-lutil) +.ds doc-str-Lb-libvgl âÉÂÌÉÏÔÅËÁ ×ÉÄÅÏ-ÇÒÁÆÉËÉ (libvgl, \-lvgl) +.ds doc-str-Lb-libz âÉÂÌÉÏÔÅËÁ ËÏÍÐÒÅÓÓÉÉ (libz, \-lz) +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Rv +.ds doc-str-Rv-std-prefix "æÕÎËÃÉÑ +.ds doc-str-Rv-std-suffix "×ÏÚ×ÒÁÝÁÅÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ; +.as doc-str-Rv-std-suffix " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ÏÎÁ ×ÏÚ×ÒÁÝÁÅÔ\~-1, +.as doc-str-Rv-std-suffix " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-std-suffix " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.ds doc-str-Rv-stds-prefix "æÕÎËÃÉÉ +.ds doc-str-Rv-stds-and "É +.ds doc-str-Rv-stds-suffix "×ÏÚ×ÒÁÝÁÀÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ; +.as doc-str-Rv-stds-suffix " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ÏÎÉ ×ÏÚ×ÒÁÝÁÀÔ\~-1, +.as doc-str-Rv-stds-suffix " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-stds-suffix " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.ds doc-str-Rv-std0 "÷ ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ ×ÏÚ×ÒÁÝÁÅÔÓÑ\~0; +.as doc-str-Rv-std0 " × ÐÒÏÔÉ×ÎÏÍ ÓÌÕÞÁÅ ×ÏÚ×ÒÁÝÁÅÔÓÑ\~-1, +.as doc-str-Rv-std0 " Á ËÏÄ ÏÛÉÂËÉ ÓÏÈÒÁÎÑÅÔÓÑ × ÇÌÏÂÁÌØÎÏÊ +.as doc-str-Rv-std0 " ÐÅÒÅÍÅÎÎÏÊ \*[doc-Va-font]errno\f[P]. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Ex +.ds doc-str-Ex-std-prefix "õÔÉÌÉÔÁ +.ds doc-str-Ex-std-suffix "×ÏÚ×ÒÁÝÁÅÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ +.as doc-str-Ex-std-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ. +. +.ds doc-str-Ex-stds-prefix "õÔÉÌÉÔÙ +.ds doc-str-Ex-stds-suffix "×ÏÚ×ÒÁÝÁÀÔ\~0 × ÓÌÕÞÁÅ ÕÓÐÅÛÎÏÇÏ ÚÁ×ÅÒÛÅÎÉÑ +.as doc-str-Ex-stds-suffix " É\~>0 × ÓÌÕÞÁÅ ×ÏÚÎÉËÎÏ×ÅÎÉÑ ÏÛÉÂËÉ. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .Ar +.ds doc-str-Ar-default "ÆÁÊÌ\ .\|.\|. +. +.\" ÌÏËÁÌÉÚÁÃÉÑ .%A +.ds doc-str-dpra "É From owner-svn-src-head@freebsd.org Wed Sep 30 21:32:31 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6279A0C8DB; Wed, 30 Sep 2015 21:32:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95C001232; Wed, 30 Sep 2015 21:32:31 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8ULWVgL007084; Wed, 30 Sep 2015 21:32:31 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8ULWUnZ007076; Wed, 30 Sep 2015 21:32:30 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509302132.t8ULWUnZ007076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Wed, 30 Sep 2015 21:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288430 - in head: bin/sh lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 21:32:31 -0000 Author: jilles Date: Wed Sep 30 21:32:29 2015 New Revision: 288430 URL: https://svnweb.freebsd.org/changeset/base/288430 Log: wordexp: Rewrite to make WRDE_NOCMD reliable. Shell syntax is too complicated to detect command substitution and unquoted operators reliably without implementing much of sh's parser. Therefore, have sh do this detection. While changing sh's support anyway, also read input from a pipe instead of arguments to avoid {ARG_MAX} limits and improve privacy, and output count and length using 16 instead of 8 digits. The basic concept is: execl("/bin/sh", "sh", "-c", "freebsd_wordexp ${1:+\"$1\"} -f "$2", "", flags & WRDE_NOCMD ? "-p" : "", ); The WRDE_BADCHAR error is still implemented in libc. POSIX requires us to fail strings containing unquoted braces with code WRDE_BADCHAR. Since this is normally not a syntax error in sh, there is still a need for checking code in libc, we_check(). The new we_check() is an optimistic check that all the characters | & ; < > ( ) { } are quoted. To avoid duplicating too much sh logic, such characters are permitted when quoting characters are seen, even if the quoting characters may themselves be quoted. This code reports all WRDE_BADCHAR errors; bad characters that get past it and are a syntax error in sh return WRDE_SYNTAX. Although many implementations of WRDE_NOCMD erroneously allow some command substitutions (and ours even documented this), there appears to be code that relies on its security (codesearch.debian.net shows quite a few uses). Passing untrusted data to wordexp() still exposes a denial of service possibility and a fairly large attack surface. Reviewed by: wblock (man page only) MFC after: 2 weeks Relnotes: yes Security: fixes command execution with wordexp(untrusted, WRDE_NOCMD) Modified: head/bin/sh/builtins.def head/bin/sh/expand.c head/bin/sh/parser.c head/bin/sh/parser.h head/lib/libc/gen/wordexp.3 head/lib/libc/gen/wordexp.c Modified: head/bin/sh/builtins.def ============================================================================== --- head/bin/sh/builtins.def Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/builtins.def Wed Sep 30 21:32:29 2015 (r288430) @@ -65,6 +65,7 @@ exportcmd -s export -s readonly #exprcmd expr falsecmd false fgcmd -j fg +freebsd_wordexpcmd freebsd_wordexp getoptscmd getopts hashcmd hash histcmd -h fc Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/expand.c Wed Sep 30 21:32:29 2015 (r288430) @@ -1656,3 +1656,57 @@ wordexpcmd(int argc, char **argv) outbin(argv[i], strlen(argv[i]) + 1, out1); return (0); } + +/* + * Do most of the work for wordexp(3), new version. + */ + +int +freebsd_wordexpcmd(int argc __unused, char **argv __unused) +{ + struct arglist arglist; + union node *args, *n; + struct strlist *sp; + size_t count, len; + int ch; + int protected = 0; + int fd = -1; + + while ((ch = nextopt("f:p")) != '\0') { + switch (ch) { + case 'f': + fd = number(shoptarg); + break; + case 'p': + protected = 1; + break; + } + } + if (*argptr != NULL) + error("wrong number of arguments"); + if (fd < 0) + error("missing fd"); + INTOFF; + setinputfd(fd, 1); + INTON; + args = parsewordexp(); + popfile(); /* will also close fd */ + if (protected) + for (n = args; n != NULL; n = n->narg.next) { + if (n->narg.backquote != NULL) { + outcslow('C', out1); + error("command substitution disabled"); + } + } + outcslow(' ', out1); + arglist.lastp = &arglist.list; + for (n = args; n != NULL; n = n->narg.next) + expandarg(n, &arglist, EXP_FULL | EXP_TILDE); + *arglist.lastp = NULL; + for (sp = arglist.list, count = len = 0; sp; sp = sp->next) + count++, len += strlen(sp->text); + out1fmt("%016zx %016zx", count, len); + for (sp = arglist.list; sp; sp = sp->next) + outbin(sp->text, strlen(sp->text) + 1, out1); + return (0); +} Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/parser.c Wed Sep 30 21:32:29 2015 (r288430) @@ -231,6 +231,39 @@ parsecmd(int interact) } +/* + * Read and parse words for wordexp. + * Returns a list of NARG nodes; NULL if there are no words. + */ +union node * +parsewordexp(void) +{ + union node *n, *first = NULL, **pnext; + int t; + + /* This assumes the parser is not re-entered, + * which could happen if we add command substitution on PS1/PS2. + */ + parser_temp_free_all(); + heredoclist = NULL; + + tokpushback = 0; + checkkwd = 0; + doprompt = 0; + setprompt(0); + needprompt = 0; + pnext = &first; + while ((t = readtoken()) != TEOF) { + if (t != TWORD) + synexpect(TWORD); + n = makename(); + *pnext = n; + pnext = &n->narg.next; + } + return first; +} + + static union node * list(int nlflag) { Modified: head/bin/sh/parser.h ============================================================================== --- head/bin/sh/parser.h Wed Sep 30 20:47:27 2015 (r288429) +++ head/bin/sh/parser.h Wed Sep 30 21:32:29 2015 (r288430) @@ -76,6 +76,7 @@ extern const char *const parsekwd[]; union node *parsecmd(int); +union node *parsewordexp(void); void forcealias(void); void fixredir(union node *, const char *, int); int goodname(const char *); Modified: head/lib/libc/gen/wordexp.3 ============================================================================== --- head/lib/libc/gen/wordexp.3 Wed Sep 30 20:47:27 2015 (r288429) +++ head/lib/libc/gen/wordexp.3 Wed Sep 30 21:32:29 2015 (r288430) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2015 +.Dd September 30, 2015 .Dt WORDEXP 3 .Os .Sh NAME @@ -108,8 +108,9 @@ function frees the memory allocated by .Sh IMPLEMENTATION NOTES The .Fn wordexp -function is implemented by executing -.Xr sh 1 . +function is implemented using the undocumented +.Ic freebsd_wordexp +shell built-in command. .Sh RETURN VALUES The .Fn wordexp @@ -191,18 +192,19 @@ and functions conform to .St -p1003.1-2001 . .Sh BUGS -Do not pass untrusted user data to -.Fn wordexp , -regardless of whether the -.Dv WRDE_NOCMD -flag is set. -The -.Fn wordexp -function attempts to detect input that would cause commands to be -executed before passing it to the shell -but it does not use the same parser so it may be fooled. -.Pp The current .Fn wordexp implementation does not recognize multibyte characters other than UTF-8, since the shell (which it invokes to perform expansions) does not. +.Sh SECURITY CONSIDERATIONS +Pathname generation may create output that is exponentially larger than the +input size. +.Pp +Although this implementation detects command substitution reliably for +.Dv WRDE_NOCMD , +the attack surface remains fairly large. +Also, some other implementations +(such as older versions of this one) +may execute command substitutions even if +.Dv WRDE_NOCMD +is set. Modified: head/lib/libc/gen/wordexp.c ============================================================================== --- head/lib/libc/gen/wordexp.c Wed Sep 30 20:47:27 2015 (r288429) +++ head/lib/libc/gen/wordexp.c Wed Sep 30 21:32:29 2015 (r288430) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,7 @@ __FBSDID("$FreeBSD$"); static int we_askshell(const char *, wordexp_t *, int); -static int we_check(const char *, int); +static int we_check(const char *); /* * wordexp -- @@ -65,7 +66,7 @@ wordexp(const char * __restrict words, w we->we_strings = NULL; we->we_nbytes = 0; } - if ((error = we_check(words, flags)) != 0) { + if ((error = we_check(words)) != 0) { wordfree(we); return (error); } @@ -94,17 +95,37 @@ we_read_fully(int fd, char *buffer, size return done; } +static bool +we_write_fully(int fd, const char *buffer, size_t len) +{ + size_t done; + ssize_t nwritten; + + done = 0; + do { + nwritten = _write(fd, buffer + done, len - done); + if (nwritten == -1 && errno == EINTR) + continue; + if (nwritten <= 0) + return (false); + done += nwritten; + } while (done != len); + return (true); +} + /* * we_askshell -- - * Use the `wordexp' /bin/sh builtin function to do most of the work - * in expanding the word string. This function is complicated by + * Use the `freebsd_wordexp' /bin/sh builtin function to do most of the + * work in expanding the word string. This function is complicated by * memory management. */ static int we_askshell(const char *words, wordexp_t *we, int flags) { - int pdes[2]; /* Pipe to child */ - char buf[18]; /* Buffer for byte and word count */ + int pdesw[2]; /* Pipe for writing words */ + int pdes[2]; /* Pipe for reading output */ + char wfdstr[sizeof(int) * 3 + 1]; + char buf[35]; /* Buffer for byte and word count */ long nwords, nbytes; /* Number of words, bytes from child */ long i; /* Handy integer */ size_t sofs; /* Offset into we->we_strings */ @@ -119,18 +140,25 @@ we_askshell(const char *words, wordexp_t char **nwv; /* Temporary for realloc() */ sigset_t newsigblock, oldsigblock; const char *ifs; - char save; serrno = errno; ifs = getenv("IFS"); - if (pipe2(pdes, O_CLOEXEC) < 0) + if (pipe2(pdesw, O_CLOEXEC) < 0) + return (WRDE_NOSPACE); /* XXX */ + snprintf(wfdstr, sizeof(wfdstr), "%d", pdesw[0]); + if (pipe2(pdes, O_CLOEXEC) < 0) { + _close(pdesw[0]); + _close(pdesw[1]); return (WRDE_NOSPACE); /* XXX */ + } (void)sigemptyset(&newsigblock); (void)sigaddset(&newsigblock, SIGCHLD); (void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); if ((pid = fork()) < 0) { serrno = errno; + _close(pdesw[0]); + _close(pdesw[1]); _close(pdes[0]); _close(pdes[1]); (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); @@ -146,43 +174,54 @@ we_askshell(const char *words, wordexp_t _dup2(pdes[1], STDOUT_FILENO) : _fcntl(pdes[1], F_SETFD, 0)) < 0) _exit(1); + if (_fcntl(pdesw[0], F_SETFD, 0) < 0) + _exit(1); execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u", - "-c", "IFS=$1;eval \"$2\";eval \"echo;set -- $3\";" - "IFS=;a=\"$*\";printf '%08x' \"$#\" \"${#a}\";" - "printf '%s\\0' \"$@\"", + "-c", "IFS=$1;eval \"$2\";" + "freebsd_wordexp -f \"$3\" ${4:+\"$4\"}", "", ifs != NULL ? ifs : " \t\n", - flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words, + flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", + wfdstr, + flags & WRDE_NOCMD ? "-p" : "", (char *)NULL); _exit(1); } /* - * We are the parent; read the output of the shell wordexp function, - * which is a byte indicating that the words were parsed successfully, - * a 32-bit hexadecimal word count, a 32-bit hexadecimal byte count - * (not including terminating null bytes), followed by the expanded - * words separated by nulls. + * We are the parent; write the words. */ _close(pdes[1]); - switch (we_read_fully(pdes[0], buf, 17)) { + _close(pdesw[0]); + if (!we_write_fully(pdesw[1], words, strlen(words))) { + _close(pdesw[1]); + error = WRDE_SYNTAX; + goto cleanup; + } + _close(pdesw[1]); + /* + * Read the output of the shell wordexp function, + * which is a byte indicating that the words were parsed successfully, + * a 64-bit hexadecimal word count, a dummy byte, a 64-bit hexadecimal + * byte count (not including terminating null bytes), followed by the + * expanded words separated by nulls. + */ + switch (we_read_fully(pdes[0], buf, 34)) { case 1: - error = WRDE_BADVAL; + error = buf[0] == 'C' ? WRDE_CMDSUB : WRDE_BADVAL; serrno = errno; goto cleanup; - case 17: + case 34: break; default: error = WRDE_SYNTAX; serrno = errno; goto cleanup; } - save = buf[9]; - buf[9] = '\0'; - nwords = strtol(buf + 1, NULL, 16); - buf[9] = save; buf[17] = '\0'; - nbytes = strtol(buf + 9, NULL, 16) + nwords; + nwords = strtol(buf + 1, NULL, 16); + buf[34] = '\0'; + nbytes = strtol(buf + 18, NULL, 16) + nwords; /* * Allocate or reallocate (when flags & WRDE_APPEND) the word vector @@ -255,83 +294,96 @@ cleanup: * we_check -- * Check that the string contains none of the following unquoted * special characters: |&;<>(){} - * or command substitutions when WRDE_NOCMD is set in flags. + * This mainly serves for {} which are normally legal in sh. + * It deliberately does not attempt to model full sh syntax. */ static int -we_check(const char *words, int flags) +we_check(const char *words) { char c; - int dquote, level, quote, squote; + /* Saw \ or $, possibly not special: */ + bool quote = false, dollar = false; + /* Saw ', ", ${, ` or $(, possibly not special: */ + bool have_sq = false, have_dq = false, have_par_begin = false; + bool have_cmd = false; + /* Definitely saw a ', ", ${, ` or $(, need a closing character: */ + bool need_sq = false, need_dq = false, need_par_end = false; + bool need_cmd_old = false, need_cmd_new = false; - quote = squote = dquote = 0; while ((c = *words++) != '\0') { switch (c) { case '\\': - if (squote == 0) - quote ^= 1; + quote = !quote; + continue; + case '$': + if (quote) + quote = false; + else + dollar = !dollar; continue; case '\'': - if (quote + dquote == 0) - squote ^= 1; + if (!quote && !have_sq && !have_dq) + need_sq = true; + else + need_sq = false; + have_sq = true; break; case '"': - if (quote + squote == 0) - dquote ^= 1; + if (!quote && !have_sq && !have_dq) + need_dq = true; + else + need_dq = false; + have_dq = true; break; case '`': - if (quote + squote == 0 && flags & WRDE_NOCMD) - return (WRDE_CMDSUB); - while ((c = *words++) != '\0' && c != '`') - if (c == '\\' && (c = *words++) == '\0') - break; - if (c == '\0') - return (WRDE_SYNTAX); + if (!quote && !have_sq && !have_cmd) + need_cmd_old = true; + else + need_cmd_old = false; + have_cmd = true; break; - case '|': case '&': case ';': case '<': case '>': - case '{': case '}': case '(': case ')': case '\n': - if (quote + squote + dquote == 0) + case '{': + if (!quote && !dollar && !have_sq && !have_dq && + !have_cmd) return (WRDE_BADCHAR); + if (dollar) { + if (!quote && !have_sq) + need_par_end = true; + have_par_begin = true; + } break; - case '$': - if ((c = *words++) == '\0') - break; - else if (quote + squote == 0 && c == '(') { - if (flags & WRDE_NOCMD && *words != '(') - return (WRDE_CMDSUB); - level = 1; - while ((c = *words++) != '\0') { - if (c == '\\') { - if ((c = *words++) == '\0') - break; - } else if (c == '(') - level++; - else if (c == ')' && --level == 0) - break; - } - if (c == '\0' || level != 0) - return (WRDE_SYNTAX); - } else if (quote + squote == 0 && c == '{') { - level = 1; - while ((c = *words++) != '\0') { - if (c == '\\') { - if ((c = *words++) == '\0') - break; - } else if (c == '{') - level++; - else if (c == '}' && --level == 0) - break; - } - if (c == '\0' || level != 0) - return (WRDE_SYNTAX); - } else - --words; + case '}': + if (!quote && !have_sq && !have_dq && !have_par_begin && + !have_cmd) + return (WRDE_BADCHAR); + need_par_end = false; + break; + case '(': + if (!quote && !dollar && !have_sq && !have_dq && + !have_cmd) + return (WRDE_BADCHAR); + if (dollar) { + if (!quote && !have_sq) + need_cmd_new = true; + have_cmd = true; + } + break; + case ')': + if (!quote && !have_sq && !have_dq && !have_cmd) + return (WRDE_BADCHAR); + need_cmd_new = false; + break; + case '|': case '&': case ';': case '<': case '>': case '\n': + if (!quote && !have_sq && !have_dq && !have_cmd) + return (WRDE_BADCHAR); break; default: break; } - quote = 0; + quote = dollar = false; } - if (quote + squote + dquote != 0) + if (quote || dollar || need_sq || need_dq || need_par_end || + need_cmd_old || need_cmd_new) return (WRDE_SYNTAX); return (0); From owner-svn-src-head@freebsd.org Wed Sep 30 22:21:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FB5CA0AAA3; Wed, 30 Sep 2015 22:21:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E6CD1F48; Wed, 30 Sep 2015 22:21:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3E345B922; Wed, 30 Sep 2015 18:21:35 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288424 - head/usr.bin/truss Date: Wed, 30 Sep 2015 12:46:02 -0700 Message-ID: <2136278.DT0mBerccO@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201509301913.t8UJDWL8050052@repo.freebsd.org> References: <201509301913.t8UJDWL8050052@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 30 Sep 2015 18:21:35 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 22:21:37 -0000 On Wednesday, September 30, 2015 07:13:32 PM John Baldwin wrote: > Author: jhb > Date: Wed Sep 30 19:13:32 2015 > New Revision: 288424 > URL: https://svnweb.freebsd.org/changeset/base/288424 > > Log: > Several changes to truss. > .... > > Reviewed by: kib (earlier version) > Tested on: amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version) > Tested on: powerpc64 (FreeBSD/powerpc64 & powerpc) This was posted to arch@ a while back for testing. mips and sparc64 could certainly use some testing. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Sep 30 23:06:33 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0939BA0C9E6; Wed, 30 Sep 2015 23:06:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED562105F; Wed, 30 Sep 2015 23:06:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UN6WL5043750; Wed, 30 Sep 2015 23:06:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UN6UwX043736; Wed, 30 Sep 2015 23:06:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201509302306.t8UN6UwX043736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 30 Sep 2015 23:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288431 - in head/sys: kern sys vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 23:06:33 -0000 Author: markj Date: Wed Sep 30 23:06:29 2015 New Revision: 288431 URL: https://svnweb.freebsd.org/changeset/base/288431 Log: As a step towards the elimination of PG_CACHED pages, rework the handling of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to the head of the inactive queue instead of being cached. This affects the implementation of POSIX_FADV_NOREUSE as well, since it works by applying POSIX_FADV_DONTNEED to file ranges after they have been read or written. At that point the corresponding buffers may still be dirty, so the previous implementation would coalesce successive ranges and apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the dirty buffers would eventually be cached. To preserve this behaviour in an efficient manner, this change adds a new buf flag, B_NOREUSE, which causes the pages backing a VMIO buf to be placed at the head of the inactive queue when the buf is released. POSIX_FADV_NOREUSE then works by setting this flag in bufs that underlie the specified range. Reviewed by: alc, kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3726 Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_default.c head/sys/kern/vfs_syscalls.c head/sys/kern/vfs_vnops.c head/sys/sys/buf.h head/sys/sys/file.h head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_bio.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1785,6 +1785,8 @@ brelse(struct buf *bp) bp, bp->b_vp, bp->b_flags); KASSERT(!(bp->b_flags & (B_CLUSTER|B_PAGING)), ("brelse: inappropriate B_PAGING or B_CLUSTER bp %p", bp)); + KASSERT((bp->b_flags & B_VMIO) != 0 || (bp->b_flags & B_NOREUSE) == 0, + ("brelse: non-VMIO buffer marked NOREUSE")); if (BUF_LOCKRECURSED(bp)) { /* @@ -1873,8 +1875,10 @@ brelse(struct buf *bp) allocbuf(bp, 0); } - if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0) { + if ((bp->b_flags & (B_INVAL | B_RELBUF)) != 0 || + (bp->b_flags & (B_DELWRI | B_NOREUSE)) == B_NOREUSE) { allocbuf(bp, 0); + bp->b_flags &= ~B_NOREUSE; if (bp->b_vp != NULL) brelvp(bp); } @@ -1969,6 +1973,10 @@ bqrelse(struct buf *bp) if ((bp->b_flags & B_DELWRI) == 0 && (bp->b_xflags & BX_VNDIRTY)) panic("bqrelse: not dirty"); + if ((bp->b_flags & B_NOREUSE) != 0) { + brelse(bp); + return; + } qindex = QUEUE_CLEAN; } binsfree(bp, qindex); @@ -2079,10 +2087,15 @@ vfs_vmio_unwire(struct buf *bp, vm_page_ freed = false; if (!freed) { /* - * In order to maintain LRU page ordering, put - * the page at the tail of the inactive queue. + * If the page is unlikely to be reused, let the + * VM know. Otherwise, maintain LRU page + * ordering and put the page at the tail of the + * inactive queue. */ - vm_page_deactivate(m); + if ((bp->b_flags & B_NOREUSE) != 0) + vm_page_deactivate_noreuse(m); + else + vm_page_deactivate(m); } } vm_page_unlock(m); @@ -2456,8 +2469,9 @@ getnewbuf_reuse_bp(struct buf *bp, int q * Note: we no longer distinguish between VMIO and non-VMIO * buffers. */ - KASSERT((bp->b_flags & B_DELWRI) == 0, - ("delwri buffer %p found in queue %d", bp, qindex)); + KASSERT((bp->b_flags & (B_DELWRI | B_NOREUSE)) == 0, + ("invalid buffer %p flags %#x found in queue %d", bp, bp->b_flags, + qindex)); /* * When recycling a clean buffer we have to truncate it and Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_default.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1034,9 +1034,12 @@ vop_stdallocate(struct vop_allocate_args int vop_stdadvise(struct vop_advise_args *ap) { + struct buf *bp; + struct buflists *bl; struct vnode *vp; + daddr_t bn, startn, endn; off_t start, end; - int error; + int bsize, error; vp = ap->a_vp; switch (ap->a_advice) { @@ -1049,28 +1052,59 @@ vop_stdadvise(struct vop_advise_args *ap error = 0; break; case POSIX_FADV_DONTNEED: - /* - * Flush any open FS buffers and then remove pages - * from the backing VM object. Using vinvalbuf() here - * is a bit heavy-handed as it flushes all buffers for - * the given vnode, not just the buffers covering the - * requested range. - */ error = 0; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_iflag & VI_DOOMED) { VOP_UNLOCK(vp, 0); break; } - vinvalbuf(vp, V_CLEANONLY, 0, 0); + + /* + * Deactivate pages in the specified range from the backing VM + * object. Pages that are resident in the buffer cache will + * remain wired until their corresponding buffers are released + * below. + */ if (vp->v_object != NULL) { start = trunc_page(ap->a_start); end = round_page(ap->a_end); VM_OBJECT_WLOCK(vp->v_object); - vm_object_page_cache(vp->v_object, OFF_TO_IDX(start), + vm_object_page_noreuse(vp->v_object, OFF_TO_IDX(start), OFF_TO_IDX(end)); VM_OBJECT_WUNLOCK(vp->v_object); } + + BO_RLOCK(&vp->v_bufobj); + bsize = vp->v_bufobj.bo_bsize; + startn = ap->a_start / bsize; + if (ap->a_end == OFF_MAX) { + endn = -1; + bl = &vp->v_bufobj.bo_clean.bv_hd; + if (!TAILQ_EMPTY(bl)) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + bl = &vp->v_bufobj.bo_dirty.bv_hd; + if (!TAILQ_EMPTY(bl) && + endn < TAILQ_LAST(bl, buflists)->b_lblkno) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + } else + endn = ap->a_end / bsize; + BO_RUNLOCK(&vp->v_bufobj); + /* + * In the VMIO case, use the B_NOREUSE flag to hint that the + * pages backing each buffer in the range are unlikely to be + * reused. Dirty buffers will have the hint applied once + * they've been written. + */ + for (bn = startn; bn <= endn; bn++) { + bp = getblk(vp, bn, bsize, 0, 0, GB_NOCREAT | + GB_UNMAPPED); + if (bp == NULL) + continue; + bp->b_flags |= B_RELBUF; + if (vp->v_object != NULL) + bp->b_flags |= B_NOREUSE; + brelse(bp); + } VOP_UNLOCK(vp, 0); break; default: Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_syscalls.c Wed Sep 30 23:06:29 2015 (r288431) @@ -4610,8 +4610,6 @@ kern_posix_fadvise(struct thread *td, in new->fa_advice = advice; new->fa_start = offset; new->fa_end = end; - new->fa_prevstart = 0; - new->fa_prevend = 0; fp->f_advice = new; new = fa; } Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/kern/vfs_vnops.c Wed Sep 30 23:06:29 2015 (r288431) @@ -770,10 +770,9 @@ vn_read(fp, uio, active_cred, flags, td) struct thread *td; { struct vnode *vp; - struct mtx *mtxp; + off_t orig_offset; int error, ioflag; int advice; - off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -797,7 +796,7 @@ vn_read(fp, uio, active_cred, flags, td) /* Disable read-ahead for random I/O. */ break; } - offset = uio->uio_offset; + orig_offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -807,39 +806,14 @@ vn_read(fp, uio, active_cred, flags, td) fp->f_nextoff = uio->uio_offset; VOP_UNLOCK(vp, 0); if (error == 0 && advice == POSIX_FADV_NOREUSE && - offset != uio->uio_offset) { + orig_offset != uio->uio_offset) /* - * Use POSIX_FADV_DONTNEED to flush clean pages and - * buffers for the backing file after a - * POSIX_FADV_NOREUSE read(2). To optimize the common - * case of using POSIX_FADV_NOREUSE with sequential - * access, track the previous implicit DONTNEED - * request and grow this request to include the - * current read(2) in addition to the previous - * DONTNEED. With purely sequential access this will - * cause the DONTNEED requests to continously grow to - * cover all of the previously read regions of the - * file. This allows filesystem blocks that are - * accessed by multiple calls to read(2) to be flushed - * once the last read(2) finishes. + * Use POSIX_FADV_DONTNEED to flush pages and buffers + * for the backing file after a POSIX_FADV_NOREUSE + * read(2). */ - start = offset; - end = uio->uio_offset - 1; - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { - if (start != 0 && fp->f_advice->fa_prevend + 1 == start) - start = fp->f_advice->fa_prevstart; - else if (fp->f_advice->fa_prevstart != 0 && - fp->f_advice->fa_prevstart == end + 1) - end = fp->f_advice->fa_prevend; - fp->f_advice->fa_prevstart = start; - fp->f_advice->fa_prevend = end; - } - mtx_unlock(mtxp); - error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); - } + error = VOP_ADVISE(vp, orig_offset, uio->uio_offset - 1, + POSIX_FADV_DONTNEED); return (error); } @@ -856,10 +830,9 @@ vn_write(fp, uio, active_cred, flags, td { struct vnode *vp; struct mount *mp; - struct mtx *mtxp; + off_t orig_offset; int error, ioflag, lock_flags; int advice; - off_t offset, start, end; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -902,7 +875,7 @@ vn_write(fp, uio, active_cred, flags, td /* XXX: Is this correct? */ break; } - offset = uio->uio_offset; + orig_offset = uio->uio_offset; #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); @@ -914,55 +887,14 @@ vn_write(fp, uio, active_cred, flags, td if (vp->v_type != VCHR) vn_finished_write(mp); if (error == 0 && advice == POSIX_FADV_NOREUSE && - offset != uio->uio_offset) { + orig_offset != uio->uio_offset) /* - * Use POSIX_FADV_DONTNEED to flush clean pages and - * buffers for the backing file after a - * POSIX_FADV_NOREUSE write(2). To optimize the - * common case of using POSIX_FADV_NOREUSE with - * sequential access, track the previous implicit - * DONTNEED request and grow this request to include - * the current write(2) in addition to the previous - * DONTNEED. With purely sequential access this will - * cause the DONTNEED requests to continously grow to - * cover all of the previously written regions of the - * file. - * - * Note that the blocks just written are almost - * certainly still dirty, so this only works when - * VOP_ADVISE() calls from subsequent writes push out - * the data written by this write(2) once the backing - * buffers are clean. However, as compared to forcing - * IO_DIRECT, this gives much saner behavior. Write - * clustering is still allowed, and clean pages are - * merely moved to the cache page queue rather than - * outright thrown away. This means a subsequent - * read(2) can still avoid hitting the disk if the - * pages have not been reclaimed. - * - * This does make POSIX_FADV_NOREUSE largely useless - * with non-sequential access. However, sequential - * access is the more common use case and the flag is - * merely advisory. + * Use POSIX_FADV_DONTNEED to flush pages and buffers + * for the backing file after a POSIX_FADV_NOREUSE + * write(2). */ - start = offset; - end = uio->uio_offset - 1; - mtxp = mtx_pool_find(mtxpool_sleep, fp); - mtx_lock(mtxp); - if (fp->f_advice != NULL && - fp->f_advice->fa_advice == POSIX_FADV_NOREUSE) { - if (start != 0 && fp->f_advice->fa_prevend + 1 == start) - start = fp->f_advice->fa_prevstart; - else if (fp->f_advice->fa_prevstart != 0 && - fp->f_advice->fa_prevstart == end + 1) - end = fp->f_advice->fa_prevend; - fp->f_advice->fa_prevstart = start; - fp->f_advice->fa_prevend = end; - } - mtx_unlock(mtxp); - error = VOP_ADVISE(vp, start, end, POSIX_FADV_DONTNEED); - } - + error = VOP_ADVISE(vp, orig_offset, uio->uio_offset - 1, + POSIX_FADV_DONTNEED); unlock: return (error); } Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/sys/buf.h Wed Sep 30 23:06:29 2015 (r288431) @@ -204,7 +204,7 @@ struct buf { #define B_PERSISTENT 0x00000100 /* Perm. ref'ed while EXT2FS mounted. */ #define B_DONE 0x00000200 /* I/O completed. */ #define B_EINTR 0x00000400 /* I/O was interrupted */ -#define B_00000800 0x00000800 /* Available flag. */ +#define B_NOREUSE 0x00000800 /* Contents not reused once released. */ #define B_00001000 0x00001000 /* Available flag. */ #define B_INVAL 0x00002000 /* Does not contain valid info. */ #define B_BARRIER 0x00004000 /* Write this and all preceeding first. */ @@ -229,7 +229,7 @@ struct buf { #define PRINT_BUF_FLAGS "\20\40remfree\37cluster\36vmio\35ram\34managed" \ "\33paging\32infreecnt\31nocopy\30b23\27relbuf\26dirty\25b20" \ "\24b19\23b18\22clusterok\21malloc\20nocache\17b14\16inval" \ - "\15b12\14b11\13eintr\12done\11persist\10delwri" \ + "\15b12\14noreuse\13eintr\12done\11persist\10delwri" \ "\7validsuspwrt\6cache\5deferred\4direct\3async\2needcommit\1age" /* Modified: head/sys/sys/file.h ============================================================================== --- head/sys/sys/file.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/sys/file.h Wed Sep 30 23:06:29 2015 (r288431) @@ -160,8 +160,6 @@ struct fadvise_info { int fa_advice; /* (f) FADV_* type. */ off_t fa_start; /* (f) Region start. */ off_t fa_end; /* (f) Region end. */ - off_t fa_prevstart; /* (f) Previous NOREUSE start. */ - off_t fa_prevend; /* (f) Previous NOREUSE end. */ }; struct file { Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_object.c Wed Sep 30 23:06:29 2015 (r288431) @@ -1963,15 +1963,15 @@ skipmemq: } /* - * vm_object_page_cache: + * vm_object_page_noreuse: * - * For the given object, attempt to move the specified clean - * pages to the cache queue. If a page is wired for any reason, - * then it will not be changed. Pages are specified by the given - * range ["start", "end"). As a special case, if "end" is zero, - * then the range extends from "start" to the end of the object. - * Any mappings to the specified pages are removed before the - * pages are moved to the cache queue. + * For the given object, attempt to move the specified pages to + * the head of the inactive queue. This bypasses regular LRU + * operation and allows the pages to be reused quickly under memory + * pressure. If a page is wired for any reason, then it will not + * be queued. Pages are specified by the range ["start", "end"). + * As a special case, if "end" is zero, then the range extends from + * "start" to the end of the object. * * This operation should only be performed on objects that * contain non-fictitious, managed pages. @@ -1979,14 +1979,14 @@ skipmemq: * The object must be locked. */ void -vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end) +vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) { struct mtx *mtx, *new_mtx; vm_page_t p, next; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & (OBJ_FICTITIOUS | OBJ_UNMANAGED)) == 0, - ("vm_object_page_cache: illegal object %p", object)); + ("vm_object_page_noreuse: illegal object %p", object)); if (object->resident_page_count == 0) return; p = vm_page_find_least(object, start); @@ -2009,7 +2009,7 @@ vm_object_page_cache(vm_object_t object, mtx = new_mtx; mtx_lock(mtx); } - vm_page_try_to_cache(p); + vm_page_deactivate_noreuse(p); } if (mtx != NULL) mtx_unlock(mtx); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_object.h Wed Sep 30 23:06:29 2015 (r288431) @@ -304,10 +304,10 @@ void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); void vm_object_madvise(vm_object_t, vm_pindex_t, vm_pindex_t, int); -void vm_object_page_cache(vm_object_t object, vm_pindex_t start, - vm_pindex_t end); boolean_t vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, int flags); +void vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, + vm_pindex_t end); void vm_object_page_remove(vm_object_t object, vm_pindex_t start, vm_pindex_t end, int options); boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_page.c Wed Sep 30 23:06:29 2015 (r288431) @@ -2589,6 +2589,19 @@ vm_page_deactivate(vm_page_t m) } /* + * Move the specified page to the inactive queue with the expectation + * that it is unlikely to be reused. + * + * The page must be locked. + */ +void +vm_page_deactivate_noreuse(vm_page_t m) +{ + + _vm_page_deactivate(m, 1); +} + +/* * vm_page_try_to_cache: * * Returns 0 on failure, 1 on success @@ -2740,8 +2753,7 @@ vm_page_cache(vm_page_t m) /* * vm_page_advise * - * Deactivate or do nothing, as appropriate. This routine is used - * by madvise() and vop_stdadvise(). + * Deactivate or do nothing, as appropriate. * * The object and page must be locked. */ Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Wed Sep 30 21:32:29 2015 (r288430) +++ head/sys/vm/vm_page.h Wed Sep 30 23:06:29 2015 (r288431) @@ -451,6 +451,7 @@ void vm_page_cache_transfer(vm_object_t, int vm_page_try_to_cache (vm_page_t); int vm_page_try_to_free (vm_page_t); void vm_page_deactivate (vm_page_t); +void vm_page_deactivate_noreuse(vm_page_t); void vm_page_dequeue(vm_page_t m); void vm_page_dequeue_locked(vm_page_t m); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); From owner-svn-src-head@freebsd.org Wed Sep 30 23:14:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AFD0A0B1EA; Wed, 30 Sep 2015 23:14:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C0D71BD4; Wed, 30 Sep 2015 23:14:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8UNEOQi048151; Wed, 30 Sep 2015 23:14:24 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8UNEObc048149; Wed, 30 Sep 2015 23:14:24 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509302314.t8UNEObc048149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 30 Sep 2015 23:14:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288432 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Sep 2015 23:14:24 -0000 Author: bdrewery Date: Wed Sep 30 23:14:23 2015 New Revision: 288432 URL: https://svnweb.freebsd.org/changeset/base/288432 Log: META_MODE: Set HOST_CXX and HOST_CPP and chain them down into CXX/CPP for host builds. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/local.init.mk head/share/mk/local.meta.sys.mk Modified: head/share/mk/local.init.mk ============================================================================== --- head/share/mk/local.init.mk Wed Sep 30 23:06:29 2015 (r288431) +++ head/share/mk/local.init.mk Wed Sep 30 23:14:23 2015 (r288432) @@ -28,8 +28,12 @@ CXXFLAGS_LAST+= -I/usr/include .if ${.MAKE.DEPENDFILE:E} != "host" UPDATE_DEPENDFILE?= no .endif -HOST_CC?= /usr/bin/cc +HOST_CC?= /usr/bin/cc +CC= ${HOST_CC} +HOST_CXX?= /usr/bin/c++ +CXX= ${HOST_CXX} +HOST_CPP?= /usr/bin/cpp +CPP= ${HOST_CPP} HOST_CFLAGS+= -DHOSTPROG -CC= ${HOST_CC} CFLAGS+= ${HOST_CFLAGS} .endif Modified: head/share/mk/local.meta.sys.mk ============================================================================== --- head/share/mk/local.meta.sys.mk Wed Sep 30 23:06:29 2015 (r288431) +++ head/share/mk/local.meta.sys.mk Wed Sep 30 23:14:23 2015 (r288432) @@ -213,10 +213,13 @@ TOOLSDIR?= ${STAGE_HOST_OBJTOP} PATH:= ${PATH:S,:, ,g:@d@${exists(${TOOLSDIR}$d):?${TOOLSDIR}$d:}@:ts:}:${PATH} .export PATH .if exists(${TOOLSDIR}/usr/bin/cc) -HOST_CC?= ${TOOLSDIR}/usr/bin/cc -CC?= ${TOOLSDIR}/usr/bin/cc -CXX?= ${TOOLSDIR}/usr/bin/c++ -.export HOST_CC CC CXX +HOST_CC?= ${TOOLSDIR}/usr/bin/cc +CC?= ${HOST_CC} +HOST_CXX?= ${TOOLSDIR}/usr/bin/c++ +CXX?= ${HOST_CXX} +HOST_CPP?= ${TOOLSDIR}/usr/bin/cpp +CPP?= ${HOST_CPP} +.export HOST_CC CC HOST_CXX CXX HOST_CPP CPP .endif .endif .endif From owner-svn-src-head@freebsd.org Thu Oct 1 00:34:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15030A0C1DC; Thu, 1 Oct 2015 00:34:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 067081E92; Thu, 1 Oct 2015 00:34:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t910Yd3m080624; Thu, 1 Oct 2015 00:34:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t910Ydp1080621; Thu, 1 Oct 2015 00:34:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510010034.t910Ydp1080621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 00:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288433 - head/release/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 00:34:40 -0000 Author: gjb Date: Thu Oct 1 00:34:38 2015 New Revision: 288433 URL: https://svnweb.freebsd.org/changeset/base/288433 Log: Fix FAT_SIZE by removing '-b' argument passing, which was a result of my misunderstanding on what Crochet was doing in this case for these boards. Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/BANANAPI.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="CUBIEBOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Wed Sep 30 23:14:23 2015 (r288432) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 00:34:38 2015 (r288433) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m -b 1m" +FAT_SIZE="32m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 From owner-svn-src-head@freebsd.org Thu Oct 1 01:50:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30FA5A0C67E; Thu, 1 Oct 2015 01:50:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F2D214AE; Thu, 1 Oct 2015 01:50:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t911oLQc010282; Thu, 1 Oct 2015 01:50:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t911oLJ7010279; Thu, 1 Oct 2015 01:50:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510010150.t911oLJ7010279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 01:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288436 - head/release/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 01:50:22 -0000 Author: gjb Date: Thu Oct 1 01:50:20 2015 New Revision: 288436 URL: https://svnweb.freebsd.org/changeset/base/288436 Log: Partially revert r288433, with a minor change: Spell 'k' correctly. Spotted by: loos (thank you!) Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/BANANAPI.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -23,9 +23,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="CUBIEBOARD" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -22,9 +22,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Thu Oct 1 00:47:30 2015 (r288435) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 01:50:20 2015 (r288436) @@ -11,7 +11,7 @@ KERNEL="A20" WORLD_FLAGS="${WORLD_FLAGS} UBLDR_LOADADDR=0x42000000" IMAGE_SIZE="1G" PART_SCHEME="MBR" -FAT_SIZE="32m" +FAT_SIZE="32m -b 1m" FAT_TYPE="16" MD_ARGS="-x 63 -y 255" NODOC=1 @@ -23,9 +23,9 @@ arm_install_uboot() { FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1m seek=8 + of=/dev/${mddev} bs=1k seek=8 chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1m seek=40 conv=notrunc,sync + of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} From owner-svn-src-head@freebsd.org Thu Oct 1 05:56:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBC40A0E61B; Thu, 1 Oct 2015 05:56:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8CD51D3A; Thu, 1 Oct 2015 05:56:39 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t915udCp012223; Thu, 1 Oct 2015 05:56:39 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t915udJs012222; Thu, 1 Oct 2015 05:56:39 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201510010556.t915udJs012222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 1 Oct 2015 05:56:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288437 - head/sys/modules/otus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 05:56:39 -0000 Author: lwhsu (ports committer) Date: Thu Oct 1 05:56:38 2015 New Revision: 288437 URL: https://svnweb.freebsd.org/changeset/base/288437 Log: Fix `make depend` in sys/modules/otus Reviewed by: delphij Approved by: delphij Differential Revision: https://reviews.freebsd.org/D3751 Modified: head/sys/modules/otus/Makefile Modified: head/sys/modules/otus/Makefile ============================================================================== --- head/sys/modules/otus/Makefile Thu Oct 1 01:50:20 2015 (r288436) +++ head/sys/modules/otus/Makefile Thu Oct 1 05:56:38 2015 (r288437) @@ -5,6 +5,6 @@ KMOD = if_otus SRCS = if_otus.c if_otusreg.h \ bus_if.h device_if.h \ - opt_bus.h opt_usb.h usb_if.h usbdevs.h + opt_bus.h opt_usb.h opt_wlan.h usb_if.h usbdevs.h .include From owner-svn-src-head@freebsd.org Thu Oct 1 09:36:19 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F5A9A0C1D3; Thu, 1 Oct 2015 09:36:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 405DE1282; Thu, 1 Oct 2015 09:36:19 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919aJkg003509; Thu, 1 Oct 2015 09:36:19 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919aJ2W003508; Thu, 1 Oct 2015 09:36:19 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010936.t919aJ2W003508@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288440 - head/etc/etc.aarch64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 09:36:19 -0000 Author: andrew Date: Thu Oct 1 09:36:18 2015 New Revision: 288440 URL: https://svnweb.freebsd.org/changeset/base/288440 Log: Update the arm64 ttys file to enable the correct uart based on which device the console is attached to. This makes this file identical to the 32-bit arm version of this file. Obtained from: EuroBSDCon devsummit Sponsored by: ABT Systems Ltd Modified: head/etc/etc.aarch64/ttys Modified: head/etc/etc.aarch64/ttys ============================================================================== --- head/etc/etc.aarch64/ttys Thu Oct 1 07:48:26 2015 (r288439) +++ head/etc/etc.aarch64/ttys Thu Oct 1 09:36:18 2015 (r288440) @@ -29,7 +29,7 @@ # when going to single-user mode. console none unknown off secure # -ttyv0 "/usr/libexec/getty Pc" xterm off secure +ttyv0 "/usr/libexec/getty Pc" xterm onifconsole secure # Virtual terminals ttyv1 "/usr/libexec/getty Pc" xterm off secure ttyv2 "/usr/libexec/getty Pc" xterm off secure @@ -41,9 +41,9 @@ ttyv7 "/usr/libexec/getty Pc" xterm off #ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.9600" vt100 on secure -ttyu1 "/usr/libexec/getty std.9600" dialup off secure -ttyu2 "/usr/libexec/getty std.9600" dialup off secure -ttyu3 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure +ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure # Dumb console dcons "/usr/libexec/getty std.9600" vt100 off secure From owner-svn-src-head@freebsd.org Thu Oct 1 09:40:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C310A0C69B; Thu, 1 Oct 2015 09:40:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2DA9E17DD; Thu, 1 Oct 2015 09:40:34 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919eYsR004984; Thu, 1 Oct 2015 09:40:34 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919eYeA004983; Thu, 1 Oct 2015 09:40:34 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010940.t919eYeA004983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288442 - head/usr.sbin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 09:40:34 -0000 Author: andrew Date: Thu Oct 1 09:40:33 2015 New Revision: 288442 URL: https://svnweb.freebsd.org/changeset/base/288442 Log: Also build ofwdump on arm64. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Added: head/usr.sbin/Makefile.arm64 (contents, props changed) Added: head/usr.sbin/Makefile.arm64 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/Makefile.arm64 Thu Oct 1 09:40:33 2015 (r288442) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SUBDIR+= ofwdump From owner-svn-src-head@freebsd.org Thu Oct 1 09:44:16 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 420B6A0C9F6; Thu, 1 Oct 2015 09:44:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 332C71D26; Thu, 1 Oct 2015 09:44:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919iGCg007764; Thu, 1 Oct 2015 09:44:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919iGv3007763; Thu, 1 Oct 2015 09:44:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010944.t919iGv3007763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288443 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 09:44:16 -0000 Author: andrew Date: Thu Oct 1 09:44:15 2015 New Revision: 288443 URL: https://svnweb.freebsd.org/changeset/base/288443 Log: Add the ENTRY/END entries around the exception handlers. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/exception.S Modified: head/sys/arm64/arm64/exception.S ============================================================================== --- head/sys/arm64/arm64/exception.S Thu Oct 1 09:40:33 2015 (r288442) +++ head/sys/arm64/arm64/exception.S Thu Oct 1 09:44:15 2015 (r288443) @@ -131,45 +131,51 @@ __FBSDID("$FreeBSD$"); 2: .endm -handle_el1h_sync: +ENTRY(handle_el1h_sync) save_registers 1 mov x0, sp bl do_el1h_sync restore_registers 1 eret +END(handle_el1h_sync) -handle_el1h_irq: +ENTRY(handle_el1h_irq) save_registers 1 mov x0, sp bl arm_cpu_intr restore_registers 1 eret +END(handle_el1h_irq) -handle_el1h_error: +ENTRY(handle_el1h_error) brk 0xf13 +END(handle_el1h_error) -handle_el0_sync: +ENTRY(handle_el0_sync) save_registers 0 mov x0, sp bl do_el0_sync do_ast restore_registers 0 eret +END(handle_el0_sync) -handle_el0_irq: +ENTRY(handle_el0_irq) save_registers 0 mov x0, sp bl arm_cpu_intr do_ast restore_registers 0 eret +END(handle_el0_irq) -handle_el0_error: +ENTRY(handle_el0_error) save_registers 0 mov x0, sp bl do_el0_error brk 0xf23 1: b 1b +END(handle_el0_error) .macro vempty .align 7 From owner-svn-src-head@freebsd.org Thu Oct 1 09:53:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B82ABA0D59D; Thu, 1 Oct 2015 09:53:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8E7812FF; Thu, 1 Oct 2015 09:53:13 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t919rD2O011762; Thu, 1 Oct 2015 09:53:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t919rDXc011761; Thu, 1 Oct 2015 09:53:13 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510010953.t919rDXc011761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 09:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288444 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 09:53:13 -0000 Author: andrew Date: Thu Oct 1 09:53:12 2015 New Revision: 288444 URL: https://svnweb.freebsd.org/changeset/base/288444 Log: Pass 8 arguments to makecontext on arm64 as this is all we support. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Thu Oct 1 09:44:15 2015 (r288443) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getcontext.c Thu Oct 1 09:53:12 2015 (r288444) @@ -53,6 +53,8 @@ run(int n, ...) va_start(va, n); #if defined(__FreeBSD__) && defined(__amd64__) for (i = 0; i < 5; i++) { +#elif defined(__FreeBSD__) && defined(__aarch64__) + for (i = 0; i < 7; i++) { #else for (i = 0; i < 9; i++) { #endif @@ -116,6 +118,10 @@ ATF_TC_BODY(setcontext_link, tc) /* FreeBSD/amd64 only permits up to 6 arguments. */ makecontext(&uc[i], (void *)run, 6, i, 0, 1, 2, 3, 4); +#elif defined(__FreeBSD__) && defined(__aarch64__) + /* FreeBSD/arm64 only permits up to 8 arguments. */ + makecontext(&uc[i], (void *)run, 8, i, + 0, 1, 2, 3, 4, 5, 6); #else makecontext(&uc[i], (void *)run, 10, i, 0, 1, 2, 3, 4, 5, 6, 7, 8); From owner-svn-src-head@freebsd.org Thu Oct 1 10:43:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BA34A0D7B3; Thu, 1 Oct 2015 10:43:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8FB1B73; Thu, 1 Oct 2015 10:43:41 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Ahfn3032249; Thu, 1 Oct 2015 10:43:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91AhfvE032248; Thu, 1 Oct 2015 10:43:41 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510011043.t91AhfvE032248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 10:43:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288445 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 10:43:41 -0000 Author: andrew Date: Thu Oct 1 10:43:40 2015 New Revision: 288445 URL: https://svnweb.freebsd.org/changeset/base/288445 Log: Use pmap_load more consistently. While here try to only load the data once when we reuse the same data. Obtained from: EuroBSDCon Devsummit Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Oct 1 09:53:12 2015 (r288444) +++ head/sys/arm64/arm64/pmap.c Thu Oct 1 10:43:40 2015 (r288445) @@ -243,6 +243,16 @@ static void _pmap_unwire_l3(pmap_t pmap, struct spglist *free); static int pmap_unuse_l3(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); +/* + * These load the old table data and store the new value. + * They need to be atomic as the System MMU may write to the table at + * the same time as the CPU. + */ +#define pmap_load_store(table, entry) atomic_swap_64(table, entry) +#define pmap_set(table, mask) atomic_set_64(table, mask) +#define pmap_load_clear(table) atomic_swap_64(table, 0) +#define pmap_load(table) (*table) + /********************/ /* Inline functions */ /********************/ @@ -277,7 +287,7 @@ pmap_l1_to_l2(pd_entry_t *l1, vm_offset_ { pd_entry_t *l2; - l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK); + l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); return (&l2[pmap_l2_index(va)]); } @@ -287,7 +297,7 @@ pmap_l2(pmap_t pmap, vm_offset_t va) pd_entry_t *l1; l1 = pmap_l1(pmap, va); - if ((*l1 & ATTR_DESCR_MASK) != L1_TABLE) + if ((pmap_load(l1) & ATTR_DESCR_MASK) != L1_TABLE) return (NULL); return (pmap_l1_to_l2(l1, va)); @@ -298,7 +308,7 @@ pmap_l2_to_l3(pd_entry_t *l2, vm_offset_ { pt_entry_t *l3; - l3 = (pd_entry_t *)PHYS_TO_DMAP(*l2 & ~ATTR_MASK); + l3 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l2) & ~ATTR_MASK); return (&l3[pmap_l3_index(va)]); } @@ -308,7 +318,7 @@ pmap_l3(pmap_t pmap, vm_offset_t va) pd_entry_t *l2; l2 = pmap_l2(pmap, va); - if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE) + if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE) return (NULL); return (pmap_l2_to_l3(l2, va)); @@ -326,19 +336,19 @@ pmap_get_tables(pmap_t pmap, vm_offset_t l1p = pmap_l1(pmap, va); *l1 = l1p; - if ((*l1p & ATTR_DESCR_MASK) == L1_BLOCK) { + if ((pmap_load(l1p) & ATTR_DESCR_MASK) == L1_BLOCK) { *l2 = NULL; *l3 = NULL; return (true); } - if ((*l1p & ATTR_DESCR_MASK) != L1_TABLE) + if ((pmap_load(l1p) & ATTR_DESCR_MASK) != L1_TABLE) return (false); l2p = pmap_l1_to_l2(l1p, va); *l2 = l2p; - if ((*l2p & ATTR_DESCR_MASK) == L2_BLOCK) { + if ((pmap_load(l2p) & ATTR_DESCR_MASK) == L2_BLOCK) { *l3 = NULL; return (true); } @@ -348,16 +358,6 @@ pmap_get_tables(pmap_t pmap, vm_offset_t return (true); } -/* - * These load the old table data and store the new value. - * They need to be atomic as the System MMU may write to the table at - * the same time as the CPU. - */ -#define pmap_load_store(table, entry) atomic_swap_64(table, entry) -#define pmap_set(table, mask) atomic_set_64(table, mask) -#define pmap_load_clear(table) atomic_swap_64(table, 0) -#define pmap_load(table) (*table) - static __inline int pmap_is_current(pmap_t pmap) { @@ -799,11 +799,11 @@ pmap_extract(pmap_t pmap, vm_offset_t va */ l2p = pmap_l2(pmap, va); if (l2p != NULL) { - l2 = *l2p; + l2 = pmap_load(l2p); if ((l2 & ATTR_DESCR_MASK) == L2_TABLE) { l3p = pmap_l2_to_l3(l2p, va); if (l3p != NULL) { - l3 = *l3p; + l3 = pmap_load(l3p); if ((l3 & ATTR_DESCR_MASK) == L3_PAGE) pa = (l3 & ~ATTR_MASK) | @@ -852,23 +852,25 @@ retry: vm_paddr_t pmap_kextract(vm_offset_t va) { - pd_entry_t *l2; + pd_entry_t *l2p, l2; pt_entry_t *l3; vm_paddr_t pa; if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) { pa = DMAP_TO_PHYS(va); } else { - l2 = pmap_l2(kernel_pmap, va); - if (l2 == NULL) + l2p = pmap_l2(kernel_pmap, va); + if (l2p == NULL) panic("pmap_kextract: No l2"); - if ((*l2 & ATTR_DESCR_MASK) == L2_BLOCK) - return ((*l2 & ~ATTR_MASK) | (va & L2_OFFSET)); + l2 = pmap_load(l2p); + if ((l2 & ATTR_DESCR_MASK) == L2_BLOCK) + return ((l2 & ~ATTR_MASK) | + (va & L2_OFFSET)); - l3 = pmap_l2_to_l3(l2, va); + l3 = pmap_l2_to_l3(l2p, va); if (l3 == NULL) panic("pmap_kextract: No l3..."); - pa = (*l3 & ~ATTR_MASK) | (va & PAGE_MASK); + pa = (pmap_load(l3) & ~ATTR_MASK) | (va & PAGE_MASK); } return (pa); } @@ -1242,11 +1244,11 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t return (NULL); } } else { - pdpg = PHYS_TO_VM_PAGE(*l1 & ~ATTR_MASK); + pdpg = PHYS_TO_VM_PAGE(pmap_load(l1) & ~ATTR_MASK); pdpg->wire_count++; } - l2 = (pd_entry_t *)PHYS_TO_DMAP(*l1 & ~ATTR_MASK); + l2 = (pd_entry_t *)PHYS_TO_DMAP(pmap_load(l1) & ~ATTR_MASK); l2 = &l2[ptepindex & Ln_ADDR_MASK]; pmap_load_store(l2, VM_PAGE_TO_PHYS(m) | L2_TABLE); PTE_SYNC(l2); @@ -1738,7 +1740,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva if (l2 == NULL) continue; - l3_paddr = *l2; + l3_paddr = pmap_load(l2); /* * Weed out invalid mappings. @@ -1805,7 +1807,7 @@ pmap_remove_all(vm_page_t m) pv_entry_t pv; pmap_t pmap; pt_entry_t *l3, tl3; - pd_entry_t *l2; + pd_entry_t *l2, tl2; struct spglist free; KASSERT((m->oflags & VPO_UNMANAGED) == 0, @@ -1817,7 +1819,9 @@ pmap_remove_all(vm_page_t m) PMAP_LOCK(pmap); pmap_resident_count_dec(pmap, 1); l2 = pmap_l2(pmap, pv->pv_va); - KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE, + KASSERT(l2 != NULL, ("pmap_remove_all: no l2 table found")); + tl2 = pmap_load(l2); + KASSERT((tl2 & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_remove_all: found a table when expecting " "a block in %p's pv list", m)); l3 = pmap_l2_to_l3(l2, pv->pv_va); @@ -1837,7 +1841,7 @@ pmap_remove_all(vm_page_t m) */ if (pmap_page_dirty(tl3)) vm_page_dirty(m); - pmap_unuse_l3(pmap, pv->pv_va, *l2, &free); + pmap_unuse_l3(pmap, pv->pv_va, tl2, &free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; free_pv_entry(pmap, pv); @@ -1883,7 +1887,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL || (*l2 & ATTR_DESCR_MASK) != L2_TABLE) + if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE) continue; if (va_next > eva) @@ -2345,7 +2349,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva continue; if ((pmap_load(l3) & ATTR_SW_WIRED) == 0) panic("pmap_unwire: l3 %#jx is missing " - "ATTR_SW_WIRED", (uintmax_t)*l3); + "ATTR_SW_WIRED", (uintmax_t)pmap_load(l3)); /* * PG_W must be cleared atomically. Although the pmap @@ -2836,7 +2840,7 @@ retry_pv_loop: } l3 = pmap_l3(pmap, pv->pv_va); retry: - oldl3 = *l3; + oldl3 = pmap_load(l3); if ((oldl3 & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) { if (!atomic_cmpset_long(l3, oldl3, oldl3 | ATTR_AP(ATTR_AP_RO))) @@ -2879,7 +2883,7 @@ pmap_ts_referenced(vm_page_t m) pv_entry_t pv, pvf; pmap_t pmap; struct rwlock *lock; - pd_entry_t *l2; + pd_entry_t *l2p, l2; pt_entry_t *l3; vm_paddr_t pa; int cleared, md_gen, not_cleared; @@ -2912,12 +2916,14 @@ retry: goto retry; } } - l2 = pmap_l2(pmap, pv->pv_va); - KASSERT((*l2 & ATTR_DESCR_MASK) == L2_TABLE, + l2p = pmap_l2(pmap, pv->pv_va); + KASSERT(l2p != NULL, ("pmap_ts_referenced: no l2 table found")); + l2 = pmap_load(l2p); + KASSERT((l2 & ATTR_DESCR_MASK) == L2_TABLE, ("pmap_ts_referenced: found an invalid l2 table")); - l3 = pmap_l2_to_l3(l2, pv->pv_va); + l3 = pmap_l2_to_l3(l2p, pv->pv_va); if ((pmap_load(l3) & ATTR_AF) != 0) { - if (safe_to_clear_referenced(pmap, *l3)) { + if (safe_to_clear_referenced(pmap, pmap_load(l3))) { /* * TODO: We don't handle the access flag * at all. We need to be able to set it in @@ -2931,8 +2937,8 @@ retry: * them is wasted effort. We do the * hard work for unwired pages only. */ - pmap_remove_l3(pmap, l3, pv->pv_va, - *l2, &free, &lock); + pmap_remove_l3(pmap, l3, pv->pv_va, l2, + &free, &lock); pmap_invalidate_page(pmap, pv->pv_va); cleared++; if (pvf == pv) From owner-svn-src-head@freebsd.org Thu Oct 1 10:52:28 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A02F7A0DDFB; Thu, 1 Oct 2015 10:52:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9012E1041; Thu, 1 Oct 2015 10:52:28 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91AqSnS036248; Thu, 1 Oct 2015 10:52:28 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91AqR38036244; Thu, 1 Oct 2015 10:52:27 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201510011052.t91AqR38036244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 1 Oct 2015 10:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288446 - in head: sbin/init sys/dev/acpica sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 10:52:28 -0000 Author: cperciva Date: Thu Oct 1 10:52:26 2015 New Revision: 288446 URL: https://svnweb.freebsd.org/changeset/base/288446 Log: Disable suspend when we're shutting down. This solves the "tell FreeBSD to shut down; close laptop lid" scenario which otherwise tended to end with a laptop overheating or the battery dying. The implementation uses a new sysctl, kern.suspend_blocked; init(8) sets this while rc.suspend runs, and the ACPI sleep code ignores requests while the sysctl is set. Discussed on: freebsd-acpi (35 emails) MFC after: 1 week Modified: head/sbin/init/init.c head/sys/dev/acpica/acpi.c head/sys/kern/kern_shutdown.c head/sys/sys/systm.h Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sbin/init/init.c Thu Oct 1 10:52:26 2015 (r288446) @@ -1487,6 +1487,15 @@ static state_func_t death(void) { session_t *sp; + int block, blocked; + size_t len; + + /* Temporarily block suspend. */ + len = sizeof(blocked); + block = 1; + if (sysctlbyname("kern.suspend_blocked", &blocked, &len, + &block, sizeof(block)) == -1) + blocked = 0; /* * Also revoke the TTY here. Because runshutdown() may reopen @@ -1503,6 +1512,11 @@ death(void) /* Try to run the rc.shutdown script within a period of time */ runshutdown(); + /* Unblock suspend if we blocked it. */ + if (!blocked) + sysctlbyname("kern.suspend_blocked", NULL, NULL, + &blocked, sizeof(blocked)); + return (state_func_t) death_single; } Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/dev/acpica/acpi.c Thu Oct 1 10:52:26 2015 (r288446) @@ -2574,8 +2574,11 @@ acpi_ReqSleepState(struct acpi_softc *sc if (!acpi_sleep_states[state]) return (EOPNOTSUPP); - /* If a suspend request is already in progress, just return. */ - if (sc->acpi_next_sstate != 0) { + /* + * If a reboot/shutdown/suspend request is already in progress or + * suspend is blocked due to an upcoming shutdown, just return. + */ + if (rebooting || sc->acpi_next_sstate != 0 || suspend_blocked) { return (0); } Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/kern/kern_shutdown.c Thu Oct 1 10:52:26 2015 (r288446) @@ -137,6 +137,10 @@ static int show_busybufs = 1; SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, &show_busybufs, 0, ""); +int suspend_blocked = 0; +SYSCTL_INT(_kern, OID_AUTO, suspend_blocked, CTLFLAG_RW, + &suspend_blocked, 0, "Block suspend due to a pending shutdown"); + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Thu Oct 1 10:43:40 2015 (r288445) +++ head/sys/sys/systm.h Thu Oct 1 10:52:26 2015 (r288446) @@ -46,6 +46,7 @@ #include /* for people using printf mainly */ extern int cold; /* nonzero if we are doing a cold boot */ +extern int suspend_blocked; /* block suspend due to pending shutdown */ extern int rebooting; /* kern_reboot() has been called. */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ From owner-svn-src-head@freebsd.org Thu Oct 1 12:09:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B76CA0B493; Thu, 1 Oct 2015 12:09:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61C4F1BE8; Thu, 1 Oct 2015 12:09:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91C96Cs065091; Thu, 1 Oct 2015 12:09:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91C95YJ065089; Thu, 1 Oct 2015 12:09:05 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201510011209.t91C95YJ065089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 1 Oct 2015 12:09:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288447 - in head/sys/arm: broadcom/bcm2835 mv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 12:09:06 -0000 Author: andrew Date: Thu Oct 1 12:09:05 2015 New Revision: 288447 URL: https://svnweb.freebsd.org/changeset/base/288447 Log: An IPI must be cleared before it is handled otherwise next IPI could be missed. In other words, if a new request for an IPI is sent while the previous request is being handled but the IPI is not cleared yet, the clearing of the previous IPI request also clears the new one and the handling is missed. There are only three MP interrupt controllers in ARM now. Two of them are fixed by this change, the third one is correct, probably only just by accident. The fix is minimalistic as new interrupt framework is awaited. It was debugged on RPi2 where missing IPI handling together with SCHED_ULE led to situation in which tdq_ipipending was not cleared and so IPI_PREEMPT was stopped to be sent. Various odditys were found related to slow system response time like various events timed out, and slow console response. Submitted by: Svatopluk Kraus Reviewed by: loos, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3722 Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c head/sys/arm/mv/mpic.c Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Thu Oct 1 10:52:26 2015 (r288446) +++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.c Thu Oct 1 12:09:05 2015 (r288447) @@ -182,6 +182,8 @@ pic_ipi_read(int i) if (val == 0) return (0); ipi = ffs(val) - 1; + BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi); + dsb(); return (ipi); } return (0x3ff); @@ -190,12 +192,6 @@ pic_ipi_read(int i) void pic_ipi_clear(int ipi) { - int cpu; - - cpu = PCPU_GET(cpuid); - dsb(); - BSWR4(MBOX0CLR_CORE(cpu), 1 << ipi); - wmb(); } void Modified: head/sys/arm/mv/mpic.c ============================================================================== --- head/sys/arm/mv/mpic.c Thu Oct 1 10:52:26 2015 (r288446) +++ head/sys/arm/mv/mpic.c Thu Oct 1 12:09:05 2015 (r288447) @@ -378,10 +378,14 @@ int pic_ipi_read(int i __unused) { uint32_t val; + int ipi; val = MPIC_CPU_READ(mv_mpic_sc, MPIC_IN_DRBL); - if (val) - return (ffs(val) - 1); + if (val) { + ipi = ffs(val) - 1; + MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, ~(1 << ipi)); + return (ipi); + } return (0x3ff); } @@ -389,10 +393,6 @@ pic_ipi_read(int i __unused) void pic_ipi_clear(int ipi) { - uint32_t val; - - val = ~(1 << ipi); - MPIC_CPU_WRITE(mv_mpic_sc, MPIC_IN_DRBL, val); } #endif From owner-svn-src-head@freebsd.org Thu Oct 1 12:15:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9311AA0BAA2; Thu, 1 Oct 2015 12:15:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82F7D112B; Thu, 1 Oct 2015 12:15:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91CFbER069009; Thu, 1 Oct 2015 12:15:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91CFbAN069007; Thu, 1 Oct 2015 12:15:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011215.t91CFbAN069007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 12:15:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288448 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 12:15:37 -0000 Author: mav Date: Thu Oct 1 12:15:36 2015 New Revision: 288448 URL: https://svnweb.freebsd.org/changeset/base/288448 Log: Unify PR variable names to reduce confusion. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Oct 1 12:09:05 2015 (r288447) +++ head/sys/cam/ctl/ctl.c Thu Oct 1 12:15:36 2015 (r288448) @@ -781,9 +781,9 @@ alloc: msg->hdr.nexus.targ_lun = lun->lun; msg->hdr.nexus.targ_mapped_lun = lun->lun; msg->lun.flags = lun->flags; - msg->lun.pr_generation = lun->PRGeneration; + msg->lun.pr_generation = lun->pr_generation; msg->lun.pr_res_idx = lun->pr_res_idx; - msg->lun.pr_res_type = lun->res_type; + msg->lun.pr_res_type = lun->pr_res_type; msg->lun.pr_key_count = lun->pr_key_count; i = 0; if (lun->lun_devid) { @@ -1085,9 +1085,9 @@ ctl_isc_lun_sync(struct ctl_softc *softc /* If peer is primary and we are not -- use data */ if ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && (lun->flags & CTL_LUN_PEER_SC_PRIMARY)) { - lun->PRGeneration = msg->lun.pr_generation; + lun->pr_generation = msg->lun.pr_generation; lun->pr_res_idx = msg->lun.pr_res_idx; - lun->res_type = msg->lun.pr_res_type; + lun->pr_res_type = msg->lun.pr_res_type; lun->pr_key_count = msg->lun.pr_key_count; for (k = 0; k < CTL_MAX_INITIATORS; k++) ctl_clr_prkey(lun, k); @@ -5130,7 +5130,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) residx = ctl_get_initindex(&ctsio->io_hdr.nexus); if (ctl_get_prkey(lun, residx) == 0 || - (lun->pr_res_idx != residx && lun->res_type < 4)) { + (lun->pr_res_idx != residx && lun->pr_res_type < 4)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); @@ -7540,7 +7540,7 @@ retry: goto retry; } - scsi_ulto4b(lun->PRGeneration, res_keys->header.generation); + scsi_ulto4b(lun->pr_generation, res_keys->header.generation); scsi_ulto4b(sizeof(struct scsi_per_res_key) * lun->pr_key_count, res_keys->header.length); @@ -7571,7 +7571,7 @@ retry: res = (struct scsi_per_res_in_rsrv *)ctsio->kern_data_ptr; - scsi_ulto4b(lun->PRGeneration, res->header.generation); + scsi_ulto4b(lun->pr_generation, res->header.generation); if (lun->flags & CTL_LUN_PR_RESERVED) { @@ -7614,7 +7614,7 @@ retry: scsi_u64to8b(ctl_get_prkey(lun, lun->pr_res_idx), res->data.reservation); } - res->data.scopetype = lun->res_type; + res->data.scopetype = lun->pr_res_type; break; } case SPRI_RC: //report capabilities @@ -7659,7 +7659,7 @@ retry: goto retry; } - scsi_ulto4b(lun->PRGeneration, res_status->header.generation); + scsi_ulto4b(lun->pr_generation, res_status->header.generation); res_desc = &res_status->desc[0]; for (i = 0; i < CTL_MAX_INITIATORS; i++) { @@ -7671,7 +7671,7 @@ retry: (lun->pr_res_idx == i || lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { res_desc->flags = SPRI_FULL_R_HOLDER; - res_desc->scopetype = lun->res_type; + res_desc->scopetype = lun->pr_res_type; } scsi_ulto2b(i / CTL_MAX_INIT_PER_PORT, res_desc->rel_trgt_port_id); @@ -7760,11 +7760,11 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } lun->pr_key_count = 1; - lun->res_type = type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); /* send msg to other side */ @@ -7834,7 +7834,7 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); /* send msg to other side */ @@ -7900,19 +7900,19 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_clr_prkey(lun, i); lun->pr_key_count--; ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); - } else if (type != lun->res_type - && (lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type ==SPR_TYPE_EX_AC_RO)){ + } else if (type != lun->pr_res_type && + (lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO)) { ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = residx; else lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -7949,7 +7949,7 @@ ctl_pro_preempt(struct ctl_softc *softc, ctl_done((union ctl_io *)ctsio); return (1); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -7993,9 +7993,9 @@ ctl_pro_preempt_other(struct ctl_lun *lu } lun->pr_key_count = 1; - lun->res_type = msg->pr.pr_info.res_type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = msg->pr.pr_info.res_type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = msg->pr.pr_info.residx; } else { for (i = 0; i < CTL_MAX_INITIATORS; i++) { @@ -8017,20 +8017,20 @@ ctl_pro_preempt_other(struct ctl_lun *lu ctl_clr_prkey(lun, i); lun->pr_key_count--; ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); - } else if (msg->pr.pr_info.res_type != lun->res_type - && (lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO)) { + } else if (msg->pr.pr_info.res_type != lun->pr_res_type + && (lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO)) { ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = msg->pr.pr_info.res_type; - if (lun->res_type != SPR_TYPE_WR_EX_AR - && lun->res_type != SPR_TYPE_EX_AC_AR) + lun->pr_res_type = msg->pr.pr_info.res_type; + if (lun->pr_res_type != SPR_TYPE_WR_EX_AR && + lun->pr_res_type != SPR_TYPE_EX_AC_AR) lun->pr_res_idx = msg->pr.pr_info.residx; else lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; } - lun->PRGeneration++; + lun->pr_generation++; } @@ -8212,9 +8212,9 @@ ctl_persistent_reserve_out(struct ctl_sc lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - if ((lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO) - && lun->pr_key_count) { + if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO) && + lun->pr_key_count) { /* * If the reservation is a registrants * only type we need to generate a UA @@ -8230,15 +8230,15 @@ ctl_persistent_reserve_out(struct ctl_sc CTL_UA_RES_RELEASE); } } - lun->res_type = 0; + lun->pr_res_type = 0; } else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) { if (lun->pr_key_count==0) { lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; } } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8257,7 +8257,7 @@ ctl_persistent_reserve_out(struct ctl_sc if (ctl_get_prkey(lun, residx) == 0) lun->pr_key_count++; ctl_set_prkey(lun, residx, sa_res_key); - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8286,7 +8286,7 @@ ctl_persistent_reserve_out(struct ctl_sc */ if ((lun->pr_res_idx != residx && lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) - || lun->res_type != type) { + || lun->pr_res_type != type) { mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_reservation_conflict(ctsio); @@ -8306,7 +8306,7 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_res_idx = CTL_PR_ALL_REGISTRANTS; lun->flags |= CTL_LUN_PR_RESERVED; - lun->res_type = type; + lun->pr_res_type = type; mtx_unlock(&lun->lun_lock); @@ -8341,7 +8341,7 @@ ctl_persistent_reserve_out(struct ctl_sc goto done; } - if (lun->res_type != type) { + if (lun->pr_res_type != type) { mtx_unlock(&lun->lun_lock); free(ctsio->kern_data_ptr, M_CTL); ctl_set_illegal_pr_release(ctsio); @@ -8352,7 +8352,7 @@ ctl_persistent_reserve_out(struct ctl_sc /* okay to release */ lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - lun->res_type = 0; + lun->pr_res_type = 0; /* * if this isn't an exclusive access @@ -8382,7 +8382,7 @@ ctl_persistent_reserve_out(struct ctl_sc mtx_lock(&lun->lun_lock); lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; @@ -8392,7 +8392,7 @@ ctl_persistent_reserve_out(struct ctl_sc ctl_clr_prkey(lun, i); ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } - lun->PRGeneration++; + lun->pr_generation++; mtx_unlock(&lun->lun_lock); persis_io.hdr.nexus = ctsio->io_hdr.nexus; @@ -8459,7 +8459,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->pr_key_count++; ctl_set_prkey(lun, msg->pr.pr_info.residx, scsi_8btou64(msg->pr.pr_info.sa_res_key)); - lun->PRGeneration++; + lun->pr_generation++; break; case CTL_PR_UNREG_KEY: @@ -8472,9 +8472,9 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - if ((lun->res_type == SPR_TYPE_WR_EX_RO - || lun->res_type == SPR_TYPE_EX_AC_RO) - && lun->pr_key_count) { + if ((lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_EX_AC_RO) && + lun->pr_key_count) { /* * If the reservation is a registrants * only type we need to generate a UA @@ -8490,20 +8490,20 @@ ctl_hndl_per_res_out_on_other_sc(union c ctl_est_ua(lun, i, CTL_UA_RES_RELEASE); } } - lun->res_type = 0; + lun->pr_res_type = 0; } else if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS) { if (lun->pr_key_count==0) { lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; } } - lun->PRGeneration++; + lun->pr_generation++; break; case CTL_PR_RESERVE: lun->flags |= CTL_LUN_PR_RESERVED; - lun->res_type = msg->pr.pr_info.res_type; + lun->pr_res_type = msg->pr.pr_info.res_type; lun->pr_res_idx = msg->pr.pr_info.residx; break; @@ -8513,8 +8513,8 @@ ctl_hndl_per_res_out_on_other_sc(union c * if this isn't an exclusive access res generate UA for all * other registrants. */ - if (lun->res_type != SPR_TYPE_EX_AC - && lun->res_type != SPR_TYPE_WR_EX) { + if (lun->pr_res_type != SPR_TYPE_EX_AC && + lun->pr_res_type != SPR_TYPE_WR_EX) { for (i = softc->init_min; i < softc->init_max; i++) if (i == residx || ctl_get_prkey(lun, i) == 0) continue; @@ -8523,7 +8523,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->flags &= ~CTL_LUN_PR_RESERVED; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - lun->res_type = 0; + lun->pr_res_type = 0; break; case CTL_PR_PREEMPT: @@ -8531,7 +8531,7 @@ ctl_hndl_per_res_out_on_other_sc(union c break; case CTL_PR_CLEAR: lun->flags &= ~CTL_LUN_PR_RESERVED; - lun->res_type = 0; + lun->pr_res_type = 0; lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; @@ -8541,7 +8541,7 @@ ctl_hndl_per_res_out_on_other_sc(union c ctl_clr_prkey(lun, i); ctl_est_ua(lun, i, CTL_UA_REG_PREEMPT); } - lun->PRGeneration++; + lun->pr_generation++; break; } @@ -11286,9 +11286,9 @@ ctl_scsiio_lun_check(struct ctl_lun *lun (entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_RESV)) { /* No reservation or command is allowed. */; } else if ((entry->flags & CTL_CMD_FLAG_ALLOW_ON_PR_WRESV) && - (lun->res_type == SPR_TYPE_WR_EX || - lun->res_type == SPR_TYPE_WR_EX_RO || - lun->res_type == SPR_TYPE_WR_EX_AR)) { + (lun->pr_res_type == SPR_TYPE_WR_EX || + lun->pr_res_type == SPR_TYPE_WR_EX_RO || + lun->pr_res_type == SPR_TYPE_WR_EX_AR)) { /* The command is allowed for Write Exclusive resv. */; } else { /* @@ -11296,8 +11296,8 @@ ctl_scsiio_lun_check(struct ctl_lun *lun * reservation and this isn't the res holder then set a * conflict. */ - if (ctl_get_prkey(lun, residx) == 0 - || (residx != lun->pr_res_idx && lun->res_type < 4)) { + if (ctl_get_prkey(lun, residx) == 0 || + (residx != lun->pr_res_idx && lun->pr_res_type < 4)) { ctl_set_reservation_conflict(ctsio); retval = 1; goto bailout; Modified: head/sys/cam/ctl/ctl_private.h ============================================================================== --- head/sys/cam/ctl/ctl_private.h Thu Oct 1 12:09:05 2015 (r288447) +++ head/sys/cam/ctl/ctl_private.h Thu Oct 1 12:15:36 2015 (r288448) @@ -392,11 +392,11 @@ struct ctl_lun { struct ctl_log_pages log_pages; struct ctl_lun_io_stats stats; uint32_t res_idx; - unsigned int PRGeneration; + uint32_t pr_generation; uint64_t *pr_keys[CTL_MAX_PORTS]; int pr_key_count; uint32_t pr_res_idx; - uint8_t res_type; + uint8_t pr_res_type; int prevent_count; uint32_t prevent[(CTL_MAX_INITIATORS+31)/32]; uint8_t *write_buffer; From owner-svn-src-head@freebsd.org Thu Oct 1 12:57:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1BC8CA0D999; Thu, 1 Oct 2015 12:57:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C5D918BE; Thu, 1 Oct 2015 12:57:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Cvbsx085381; Thu, 1 Oct 2015 12:57:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Cvbvl085380; Thu, 1 Oct 2015 12:57:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011257.t91Cvbvl085380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 12:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288449 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 12:57:38 -0000 Author: mav Date: Thu Oct 1 12:57:37 2015 New Revision: 288449 URL: https://svnweb.freebsd.org/changeset/base/288449 Log: Implement SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Oct 1 12:15:36 2015 (r288448) +++ head/sys/cam/ctl/ctl.c Thu Oct 1 12:57:37 2015 (r288449) @@ -5101,6 +5101,13 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsi ctl_set_reservation_conflict(ctsio); goto bailout; } + + /* SPC-3 exceptions to SPC-2 RESERVE and RELEASE behavior. */ + if (lun->flags & CTL_LUN_PR_RESERVED) { + ctl_set_success(ctsio); + goto bailout; + } + lun->flags |= CTL_LUN_RESERVED; lun->res_idx = residx; ctl_set_success(ctsio); @@ -7624,7 +7631,8 @@ retry: res_cap = (struct scsi_per_res_cap *)ctsio->kern_data_ptr; scsi_ulto2b(sizeof(*res_cap), res_cap->length); - res_cap->flags2 |= SPRI_TMV | SPRI_ALLOW_5; + res_cap->flags1 = SPRI_CRH; + res_cap->flags2 = SPRI_TMV | SPRI_ALLOW_5; type_mask = SPRI_TM_WR_EX_AR | SPRI_TM_EX_AC_RO | SPRI_TM_WR_EX_RO | From owner-svn-src-head@freebsd.org Thu Oct 1 16:30:21 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39B38A0D5C7; Thu, 1 Oct 2015 16:30:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B1C21EBE; Thu, 1 Oct 2015 16:30:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91GULS4080845; Thu, 1 Oct 2015 16:30:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91GULZw080844; Thu, 1 Oct 2015 16:30:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011630.t91GULZw080844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 16:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288450 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 16:30:21 -0000 Author: mav Date: Thu Oct 1 16:30:20 2015 New Revision: 288450 URL: https://svnweb.freebsd.org/changeset/base/288450 Log: Make zero WUT use WRITE SAME with recently allowed NDOB flag. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 12:57:37 2015 (r288449) +++ head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 16:30:20 2015 (r288450) @@ -1295,7 +1295,6 @@ complete: ctl_free_io(tio->io); free(tio, M_CTL); } - free(list->buf, M_CTL); if (list->abort) { ctl_set_task_aborted(list->ctsio); return (CTL_RETVAL_ERROR); @@ -1311,7 +1310,6 @@ complete: } dstblock = list->lun->be_lun->blocksize; - list->buf = malloc(dstblock, M_CTL, M_WAITOK | M_ZERO); TAILQ_INIT(&run); prun = &run; list->tbdio = 1; @@ -1328,9 +1326,9 @@ complete: TAILQ_INSERT_TAIL(&list->allio, tiow, links); tiow->io = tpcl_alloc_io(); ctl_scsi_write_same(tiow->io, - /*data_ptr*/ list->buf, - /*data_len*/ dstblock, - /*byte2*/ 0, + /*data_ptr*/ NULL, + /*data_len*/ 0, + /*byte2*/ SWS_NDOB, /*lba*/ scsi_8btou64(list->range[r].lba), /*num_blocks*/ len, /*tag_type*/ CTL_TAG_SIMPLE, From owner-svn-src-head@freebsd.org Thu Oct 1 16:34:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 854E1A0D904; Thu, 1 Oct 2015 16:34:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57EE81793; Thu, 1 Oct 2015 16:34:54 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91GYsAJ085137; Thu, 1 Oct 2015 16:34:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91GYsml085136; Thu, 1 Oct 2015 16:34:54 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510011634.t91GYsml085136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 1 Oct 2015 16:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288451 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 16:34:54 -0000 Author: markj Date: Thu Oct 1 16:34:53 2015 New Revision: 288451 URL: https://svnweb.freebsd.org/changeset/base/288451 Log: Ensure that vop_stdadvise() does not call getblk() on vnodes that have an empty bufobj. Otherwise, vnodes belonging to filesystems that do not use the buffer cache may trigger assertion failures. Reported by: Fabien Keil Modified: head/sys/kern/vfs_default.c Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Thu Oct 1 16:30:20 2015 (r288450) +++ head/sys/kern/vfs_default.c Thu Oct 1 16:34:53 2015 (r288451) @@ -1077,16 +1077,15 @@ vop_stdadvise(struct vop_advise_args *ap BO_RLOCK(&vp->v_bufobj); bsize = vp->v_bufobj.bo_bsize; startn = ap->a_start / bsize; - if (ap->a_end == OFF_MAX) { - endn = -1; - bl = &vp->v_bufobj.bo_clean.bv_hd; - if (!TAILQ_EMPTY(bl)) - endn = TAILQ_LAST(bl, buflists)->b_lblkno; - bl = &vp->v_bufobj.bo_dirty.bv_hd; - if (!TAILQ_EMPTY(bl) && - endn < TAILQ_LAST(bl, buflists)->b_lblkno) - endn = TAILQ_LAST(bl, buflists)->b_lblkno; - } else + endn = -1; + bl = &vp->v_bufobj.bo_clean.bv_hd; + if (!TAILQ_EMPTY(bl)) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + bl = &vp->v_bufobj.bo_dirty.bv_hd; + if (!TAILQ_EMPTY(bl) && + endn < TAILQ_LAST(bl, buflists)->b_lblkno) + endn = TAILQ_LAST(bl, buflists)->b_lblkno; + if (ap->a_end != OFF_MAX && endn != -1) endn = ap->a_end / bsize; BO_RUNLOCK(&vp->v_bufobj); /* From owner-svn-src-head@freebsd.org Thu Oct 1 16:40:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFEDEA0DC24; Thu, 1 Oct 2015 16:39:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB7AD1CFB; Thu, 1 Oct 2015 16:39:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EB42FB913; Thu, 1 Oct 2015 12:39:57 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Date: Thu, 01 Oct 2015 09:32:45 -0700 Message-ID: <1837187.vUDrWYExQX@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201509302306.t8UN6UwX043736@repo.freebsd.org> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 12:39:58 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 16:40:00 -0000 On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > Author: markj > Date: Wed Sep 30 23:06:29 2015 > New Revision: 288431 > URL: https://svnweb.freebsd.org/changeset/base/288431 > > Log: > As a step towards the elimination of PG_CACHED pages, rework the handling > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > the head of the inactive queue instead of being cached. > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > read or written. At that point the corresponding buffers may still be > dirty, so the previous implementation would coalesce successive ranges and > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > dirty buffers would eventually be cached. To preserve this behaviour in an > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > the pages backing a VMIO buf to be placed at the head of the inactive queue > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > flag in bufs that underlie the specified range. Putting these pages back on the inactive queue completely defeats the primary purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out of the VM object's tree of pages and into the free pool so that the application can instruct the VM to free memory more efficiently than relying on page daemon. The implementation used cache pages instead of free as a cheap optimization so that if an application did something dumb where it used DONTNEED and then turned around and read the file it would not have to go to disk if the pages had not yet been reused. In practice this didn't work out so well because PG_CACHE pages don't really work well. However, using PG_CACHE was secondary to the primary purpose of explicitly freeing memory that an application knew wasn't going to be reused and avoiding the need for pagedaemon to run at all. I think this should be freeing the pages instead of keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns around and rereads the file, it generally deserves to have to go to disk for it. I'm pretty sure I had mentioned this to Alan before. I believe that the idea is that pagedaemon should be cheap enough that having it run anyway shouldn't be an issue, but I'm a bit skeptical of that. :) Lock contention is always possible and having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with pagedaemon during application page faults (since pagedaemon potentially never has to run). I believe that B_NOREUSE is definitely cleaner, btw. I had wanted to change NOREUSE to work that way but wasn't sure how to do it. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Oct 1 16:59:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C0D4A0DA58; Thu, 1 Oct 2015 16:59:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D3D6106C; Thu, 1 Oct 2015 16:59:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91Gx816094040; Thu, 1 Oct 2015 16:59:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Gx8SX094039; Thu, 1 Oct 2015 16:59:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011659.t91Gx8SX094039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 16:59:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288452 - head/sys/dev/drm2/i915 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 16:59:08 -0000 Author: jhb Date: Thu Oct 1 16:59:07 2015 New Revision: 288452 URL: https://svnweb.freebsd.org/changeset/base/288452 Log: Most error cases in i915_gem_do_execbuffer() jump to one of two labels to release resources (such as unholding pages) when errors occur. Some recently added error checks return immediately instead of jumping to a label resulting in leaks. Fix these to jump to a label to do cleanup instead. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3745 Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem_execbuffer.c Thu Oct 1 16:34:53 2015 (r288451) +++ head/sys/dev/drm2/i915/i915_gem_execbuffer.c Thu Oct 1 16:59:07 2015 (r288452) @@ -1151,7 +1151,8 @@ i915_gem_do_execbuffer(struct drm_device if (ctx_id != 0) { DRM_DEBUG("Ring %s doesn't support contexts\n", ring->name); - return -EPERM; + ret = -EPERM; + goto pre_struct_lock_err; } break; case I915_EXEC_BLT: @@ -1159,7 +1160,8 @@ i915_gem_do_execbuffer(struct drm_device if (ctx_id != 0) { DRM_DEBUG("Ring %s doesn't support contexts\n", ring->name); - return -EPERM; + ret = -EPERM; + goto pre_struct_lock_err; } break; default: @@ -1171,7 +1173,8 @@ i915_gem_do_execbuffer(struct drm_device if (!intel_ring_initialized(ring)) { DRM_DEBUG("execbuf with invalid ring: %d\n", (int)(args->flags & I915_EXEC_RING_MASK)); - return -EINVAL; + ret = -EINVAL; + goto pre_struct_lock_err; } mode = args->flags & I915_EXEC_CONSTANTS_MASK; From owner-svn-src-head@freebsd.org Thu Oct 1 17:03:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 247BBA0DCF1; Thu, 1 Oct 2015 17:03:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 034C0146E; Thu, 1 Oct 2015 17:03:13 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 10CC7B913; Thu, 1 Oct 2015 13:03:12 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288452 - head/sys/dev/drm2/i915 Date: Thu, 01 Oct 2015 10:01:20 -0700 Message-ID: <90323889.l5UMs3tJRz@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201510011659.t91Gx8SX094039@repo.freebsd.org> References: <201510011659.t91Gx8SX094039@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 13:03:12 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 17:03:13 -0000 On Thursday, October 01, 2015 04:59:08 PM John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 16:59:07 2015 > New Revision: 288452 > URL: https://svnweb.freebsd.org/changeset/base/288452 > > Log: > Most error cases in i915_gem_do_execbuffer() jump to one of two labels to > release resources (such as unholding pages) when errors occur. Some > recently added error checks return immediately instead of jumping to a > label resulting in leaks. Fix these to jump to a label to do cleanup > instead. I was getting panics due to the hold count on pages being negative in this function. The hold counts were quiet high and so I believe that the hold count overflowed to zero due to these leaks and triggered the panic. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Oct 1 17:28:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04D53A0CE38; Thu, 1 Oct 2015 17:28:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7EAB17B8; Thu, 1 Oct 2015 17:28:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91HS7Zr006634; Thu, 1 Oct 2015 17:28:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91HS7fo006633; Thu, 1 Oct 2015 17:28:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011728.t91HS7fo006633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 17:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288454 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 17:28:08 -0000 Author: jhb Date: Thu Oct 1 17:28:07 2015 New Revision: 288454 URL: https://svnweb.freebsd.org/changeset/base/288454 Log: - Remove extra integer argument from truncate() and ftruncate(). This is probably fallout from the removal of the extra padding argument before off_t in 7. However, that padding still exists for 32-bit powerpc, so use QUAD_ALIGN. - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 for 32-bit platforms that add padding to align 64-bit arguments. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:09:20 2015 (r288453) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 17:28:07 2015 (r288454) @@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$"); #include "syscall.h" /* 64-bit alignment on 32-bit platforms. */ -#ifdef __powerpc__ +#if !defined(__LP64__) && defined(__powerpc__) #define QUAD_ALIGN 1 #else #define QUAD_ALIGN 0 @@ -320,10 +320,10 @@ static struct syscall syscalls[] = { .args = { { PipeFds | OUT, 0 } } }, { .name = "pipe2", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Open, 1 } } }, - { .name = "truncate", .ret_type = 1, .nargs = 3, - .args = { { Name | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, - { .name = "ftruncate", .ret_type = 1, .nargs = 3, - .args = { { Int | IN, 0 }, { Int | IN, 1 }, { Quad | IN, 2 } } }, + { .name = "truncate", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + { .name = "ftruncate", .ret_type = 1, .nargs = 2, + .args = { { Int | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, { .name = "kill", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, { .name = "munmap", .ret_type = 1, .nargs = 2, From owner-svn-src-head@freebsd.org Thu Oct 1 17:50:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FE55A0DD6A; Thu, 1 Oct 2015 17:50:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 326B015D9; Thu, 1 Oct 2015 17:50:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91HogFD017540; Thu, 1 Oct 2015 17:50:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91Hofi5017528; Thu, 1 Oct 2015 17:50:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011750.t91Hofi5017528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 17:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288455 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 17:50:42 -0000 Author: jhb Date: Thu Oct 1 17:50:41 2015 New Revision: 288455 URL: https://svnweb.freebsd.org/changeset/base/288455 Log: The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bit integer. Fix the argument decoding to treat this as a quad instead of an int. This includes using QUAD_ALIGN and QUAD_SLOTS as necessary. To continue printing IDs in decimal, add a new QuadHex argument type that prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments, repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t arguments. This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms. Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Thu Oct 1 17:28:07 2015 (r288454) +++ head/usr.bin/truss/syscall.h Thu Oct 1 17:50:41 2015 (r288455) @@ -42,7 +42,7 @@ enum Argtype { None = 1, Hex, Octal, Int Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, - Sysarch, ExecArgs, ExecEnv, PipeFds }; + Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex }; #define ARG_MASK 0xff #define OUT 0x100 Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:28:07 2015 (r288454) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 17:50:41 2015 (r288455) @@ -106,13 +106,13 @@ static struct syscall syscalls[] = { .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 }, { Int, 3 } } }, { .name = "lseek", .ret_type = 2, .nargs = 3, - .args = { { Int, 0 }, { Quad, 1 + QUAD_ALIGN }, + .args = { { Int, 0 }, { QuadHex, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } }, { .name = "linux_lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, { .name = "mmap", .ret_type = 1, .nargs = 6, .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, - { Int, 4 }, { Quad, 5 + QUAD_ALIGN } } }, + { Int, 4 }, { QuadHex, 5 + QUAD_ALIGN } } }, { .name = "linux_mkdir", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Int, 1 } } }, { .name = "mprotect", .ret_type = 1, .nargs = 3, @@ -321,9 +321,9 @@ static struct syscall syscalls[] = { { .name = "pipe2", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Open, 1 } } }, { .name = "truncate", .ret_type = 1, .nargs = 2, - .args = { { Name | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + .args = { { Name | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, { .name = "ftruncate", .ret_type = 1, .nargs = 2, - .args = { { Int | IN, 0 }, { Quad | IN, 1 + QUAD_ALIGN } } }, + .args = { { Int | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, { .name = "kill", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, { .name = "munmap", .ret_type = 1, .nargs = 2, @@ -344,10 +344,15 @@ static struct syscall syscalls[] = { .args = { { Int, 0 }, { ExitStatus | OUT, 1 }, { Waitoptions, 2 }, { Rusage | OUT, 3 } } }, { .name = "wait6", .ret_type = 1, .nargs = 6, - .args = { { Idtype, 0 }, { Int, 1 }, { ExitStatus | OUT, 2 }, - { Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } }, + .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, + { ExitStatus | OUT, 1 + QUAD_ALIGN + QUAD_SLOTS }, + { Waitoptions, 2 + QUAD_ALIGN + QUAD_SLOTS }, + { Rusage | OUT, 3 + QUAD_ALIGN + QUAD_SLOTS }, + { Ptr, 4 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, - .args = { { Idtype, 0 }, { Int, 1 }, { Procctl, 2 }, { Ptr, 3 } } }, + .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, + { Procctl, 1 + QUAD_ALIGN + QUAD_SLOTS }, + { Ptr, 2 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "sysarch", .ret_type = 1, .nargs = 2, .args = { { Sysarch, 0 }, { Ptr, 1 } } }, { .name = "_umtx_op", .ret_type = 1, .nargs = 5, @@ -966,10 +971,14 @@ print_arg(struct syscall_args *sc, unsig } #ifdef __LP64__ case Quad: + fprintf(fp, "%ld", args[sc->offset]); + break; + case QuadHex: fprintf(fp, "0x%lx", args[sc->offset]); break; #else - case Quad: { + case Quad: + case QuadHex: { unsigned long long ll; #if _BYTE_ORDER == _LITTLE_ENDIAN @@ -979,7 +988,10 @@ print_arg(struct syscall_args *sc, unsig ll = (unsigned long long)args[sc->offset] << 32 | args[sc->offset + 1]; #endif - fprintf(fp, "0x%llx", ll); + if ((sc->type & ARG_MASK) == Quad) + fprintf(fp, "%lld", ll); + else + fprintf(fp, "0x%llx", ll); break; } #endif From owner-svn-src-head@freebsd.org Thu Oct 1 18:18:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47F98A0C3B3; Thu, 1 Oct 2015 18:18:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3334C1583; Thu, 1 Oct 2015 18:18:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91IIx75027339; Thu, 1 Oct 2015 18:18:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91IIxZO027338; Thu, 1 Oct 2015 18:18:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201510011818.t91IIxZO027338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Oct 2015 18:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288456 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 18:18:59 -0000 Author: jhb Date: Thu Oct 1 18:18:58 2015 New Revision: 288456 URL: https://svnweb.freebsd.org/changeset/base/288456 Log: Rather than groveling around in a socket address structure for a socket address's length (and then overriding it if it "looks wrong"), use the next argument to the system call to determine the length. This is more reliable since this is what the kernel depends on anyway and is also simpler. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Thu Oct 1 17:50:41 2015 (r288455) +++ head/usr.bin/truss/syscalls.c Thu Oct 1 18:18:58 2015 (r288456) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1288,12 +1289,12 @@ print_arg(struct syscall_args *sc, unsig fputs(xlookup_bits(rfork_flags, args[sc->offset]), fp); break; case Sockaddr: { - struct sockaddr_storage ss; char addr[64]; struct sockaddr_in *lsin; struct sockaddr_in6 *lsin6; struct sockaddr_un *sun; struct sockaddr *sa; + socklen_t len; u_char *q; if (args[sc->offset] == 0) { @@ -1301,70 +1302,71 @@ print_arg(struct syscall_args *sc, unsig break; } - /* yuck: get ss_len */ - if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, - sizeof(ss.ss_len) + sizeof(ss.ss_family)) == -1) { - fprintf(fp, "0x%lx", args[sc->offset]); - break; - } - /* - * If ss_len is 0, then try to guess from the sockaddr type. - * AF_UNIX may be initialized incorrectly, so always frob - * it by using the "right" size. + * Extract the address length from the next argument. If + * this is an output sockaddr (OUT is set), then the + * next argument is a pointer to a socklen_t. Otherwise + * the next argument contains a socklen_t by value. */ - if (ss.ss_len == 0 || ss.ss_family == AF_UNIX) { - switch (ss.ss_family) { - case AF_INET: - ss.ss_len = sizeof(*lsin); - break; - case AF_INET6: - ss.ss_len = sizeof(*lsin6); - break; - case AF_UNIX: - ss.ss_len = sizeof(*sun); - break; - default: + if (sc->type & OUT) { + if (get_struct(pid, (void *)args[sc->offset + 1], + &len, sizeof(len)) == -1) { + fprintf(fp, "0x%lx", args[sc->offset]); break; } + } else + len = args[sc->offset + 1]; + + /* If the length is too small, just bail. */ + if (len < sizeof(*sa)) { + fprintf(fp, "0x%lx", args[sc->offset]); + break; } - if (ss.ss_len != 0 && - get_struct(pid, (void *)args[sc->offset], (void *)&ss, - ss.ss_len) == -1) { + + sa = calloc(1, len); + if (get_struct(pid, (void *)args[sc->offset], sa, len) == -1) { + free(sa); fprintf(fp, "0x%lx", args[sc->offset]); break; } - switch (ss.ss_family) { + switch (sa->sa_family) { case AF_INET: - lsin = (struct sockaddr_in *)&ss; + if (len < sizeof(*lsin)) + goto sockaddr_short; + lsin = (struct sockaddr_in *)(void *)sa; inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET %s:%d }", addr, htons(lsin->sin_port)); break; case AF_INET6: - lsin6 = (struct sockaddr_in6 *)&ss; + if (len < sizeof(*lsin6)) + goto sockaddr_short; + lsin6 = (struct sockaddr_in6 *)(void *)sa; inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET6 [%s]:%d }", addr, htons(lsin6->sin6_port)); break; case AF_UNIX: - sun = (struct sockaddr_un *)&ss; - fprintf(fp, "{ AF_UNIX \"%s\" }", sun->sun_path); + sun = (struct sockaddr_un *)sa; + fprintf(fp, "{ AF_UNIX \"%.*s\" }", + (int)(len - offsetof(struct sockaddr_un, sun_path)), + sun->sun_path); break; default: - sa = (struct sockaddr *)&ss; + sockaddr_short: fprintf(fp, "{ sa_len = %d, sa_family = %d, sa_data = {", (int)sa->sa_len, (int)sa->sa_family); for (q = (u_char *)sa->sa_data; - q < (u_char *)sa + sa->sa_len; q++) + q < (u_char *)sa + len; q++) fprintf(fp, "%s 0x%02x", q == (u_char *)sa->sa_data ? "" : ",", *q); fputs(" } }", fp); } + free(sa); break; } case Sigaction: { From owner-svn-src-head@freebsd.org Thu Oct 1 19:07:16 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05063A0DC14; Thu, 1 Oct 2015 19:07:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EACCF1596; Thu, 1 Oct 2015 19:07:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91J7FAE047803; Thu, 1 Oct 2015 19:07:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91J7Fjt047802; Thu, 1 Oct 2015 19:07:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510011907.t91J7Fjt047802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Oct 2015 19:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288458 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 19:07:16 -0000 Author: mav Date: Thu Oct 1 19:07:15 2015 New Revision: 288458 URL: https://svnweb.freebsd.org/changeset/base/288458 Log: More aggressively fill WUT read pipeline. On some tests I've measured 5% copy speedup from this. Modified: head/sys/cam/ctl/ctl_tpc.c Modified: head/sys/cam/ctl/ctl_tpc.c ============================================================================== --- head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 19:02:45 2015 (r288457) +++ head/sys/cam/ctl/ctl_tpc.c Thu Oct 1 19:07:15 2015 (r288458) @@ -1128,7 +1128,7 @@ static int tpc_process_wut(struct tpc_list *list) { struct tpc_io *tio, *tior, *tiow; - struct runl run, *prun; + struct runl run; int drange, srange; off_t doffset, soffset; off_t srclba, dstlba, numbytes, donebytes, roundbytes; @@ -1208,8 +1208,7 @@ tpc_process_wut(struct tpc_list *list) // srclba, dstlba); donebytes = 0; TAILQ_INIT(&run); - prun = &run; - list->tbdio = 1; + list->tbdio = 0; TAILQ_INIT(&list->allio); while (donebytes < numbytes) { roundbytes = numbytes - donebytes; @@ -1262,8 +1261,8 @@ tpc_process_wut(struct tpc_list *list) tiow->io->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr = tiow; TAILQ_INSERT_TAIL(&tior->run, tiow, rlinks); - TAILQ_INSERT_TAIL(prun, tior, rlinks); - prun = &tior->run; + TAILQ_INSERT_TAIL(&run, tior, rlinks); + list->tbdio++; donebytes += roundbytes; srclba += roundbytes / srcblock; dstlba += roundbytes / dstblock; From owner-svn-src-head@freebsd.org Thu Oct 1 19:48:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0B43A0D030; Thu, 1 Oct 2015 19:48:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5AD41300; Thu, 1 Oct 2015 19:48:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91JmBZR064804; Thu, 1 Oct 2015 19:48:11 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91JmBmq064801; Thu, 1 Oct 2015 19:48:11 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201510011948.t91JmBmq064801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 1 Oct 2015 19:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288459 - head/release/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 19:48:12 -0000 Author: gjb Date: Thu Oct 1 19:48:10 2015 New Revision: 288459 URL: https://svnweb.freebsd.org/changeset/base/288459 Log: Fix the path to the correct u-boot.bin file to write to the disk image, which fixes boot issues. Tested on: BananaPi Sponsored by: The FreeBSD Foundation Modified: head/release/arm/BANANAPI.conf head/release/arm/CUBIEBOARD.conf head/release/arm/CUBIEBOARD2.conf Modified: head/release/arm/BANANAPI.conf ============================================================================== --- head/release/arm/BANANAPI.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/BANANAPI.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -22,10 +22,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD.conf ============================================================================== --- head/release/arm/CUBIEBOARD.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/CUBIEBOARD.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -21,10 +21,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} Modified: head/release/arm/CUBIEBOARD2.conf ============================================================================== --- head/release/arm/CUBIEBOARD2.conf Thu Oct 1 19:07:15 2015 (r288458) +++ head/release/arm/CUBIEBOARD2.conf Thu Oct 1 19:48:10 2015 (r288459) @@ -22,10 +22,8 @@ arm_install_uboot() { UBOOT_FILES="u-boot.img" FATMOUNT="${DESTDIR%${KERNEL}}/fat" UFSMOUNT="${DESTDIR%${KERNEL}}/ufs" - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/sunxi-spl.bin \ - of=/dev/${mddev} bs=1k seek=8 - chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/${UBOOT_FILES} \ - of=/dev/${mddev} bs=1k seek=40 conv=notrunc,sync + chroot ${CHROOTDIR} dd if=${UBOOT_DIR}/u-boot-sunxi-with-spl.bin \ + of=/dev/${mddev} bs=1k seek=8 conv=sync chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} chroot ${CHROOTDIR} mount /dev/${mddev}s2a ${UFSMOUNT} From owner-svn-src-head@freebsd.org Thu Oct 1 19:51:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C279A0D23F; Thu, 1 Oct 2015 19:51:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AC601768; Thu, 1 Oct 2015 19:51:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DC3E7B918; Thu, 1 Oct 2015 15:51:21 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288454 - head/usr.bin/truss Date: Thu, 01 Oct 2015 11:22:48 -0700 Message-ID: <5360523.S6ag5ugNqo@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201510011728.t91HS7fo006633@repo.freebsd.org> References: <201510011728.t91HS7fo006633@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 01 Oct 2015 15:51:22 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 19:51:23 -0000 On Thursday, October 01, 2015 05:28:07 PM John Baldwin wrote: > Author: jhb > Date: Thu Oct 1 17:28:07 2015 > New Revision: 288454 > URL: https://svnweb.freebsd.org/changeset/base/288454 > > Log: > - Remove extra integer argument from truncate() and ftruncate(). This is > probably fallout from the removal of the extra padding argument before > off_t in 7. However, that padding still exists for 32-bit powerpc, so > use QUAD_ALIGN. > - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 > for 32-bit platforms that add padding to align 64-bit arguments. I'm not sure how the situation is on arm and MIPS, but on powerpc, both the 32-bit and 64-bit platforms define __powerpc__ (unlike amd64 which doesn't define __i386__ for example) making proper #ifdef's for just 32-bit __powerpc__ a bit of a PITA. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Oct 1 20:06:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4315AA0DF4B; Thu, 1 Oct 2015 20:06:07 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F1181121; Thu, 1 Oct 2015 20:06:07 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by igxx6 with SMTP id x6so2888304igx.1; Thu, 01 Oct 2015 13:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7UZMvBd0zj3yPoIwvsLfN5i4MGWkYH+ufJOJTfCqW0I=; b=tP+GfeBgk51P3t4vWq0yq/yj0fxkznTa1jy2Dyr2JDxubr2kdgGzEC0pZKAlah5Iip I3nfAFEtCoT7y0rtPfd0kLYsBekOFbhGkA+njKowMXqvvsQ9AwKuX5selsEglX9e3AKM eq2AQ7PBuaWB6uWu7X6xCWfuFfcns4OWK67c0yfg0mXIY7K+RqCOeCW8MjWuH7JnjLwy SZTYXN8KP/9/joIWVZQLymCVin8pDI6aGy0KaF8plTcMBb5yCH70zcdKcDE/Hvjrb/rJ WaRIhbdehlz/QfqSFg1div09BQ6BVsiX2VRVoNRupw0wiQxJ1Zg2EWoiUfKQQJX6J5NA MNyw== MIME-Version: 1.0 X-Received: by 10.50.78.40 with SMTP id y8mr852559igw.8.1443729966478; Thu, 01 Oct 2015 13:06:06 -0700 (PDT) Received: by 10.36.41.138 with HTTP; Thu, 1 Oct 2015 13:06:06 -0700 (PDT) Received: by 10.36.41.138 with HTTP; Thu, 1 Oct 2015 13:06:06 -0700 (PDT) In-Reply-To: <5360523.S6ag5ugNqo@ralph.baldwin.cx> References: <201510011728.t91HS7fo006633@repo.freebsd.org> <5360523.S6ag5ugNqo@ralph.baldwin.cx> Date: Thu, 1 Oct 2015 15:06:06 -0500 Message-ID: Subject: Re: svn commit: r288454 - head/usr.bin/truss From: Justin Hibbits To: John Baldwin Cc: src-committers , svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 20:06:07 -0000 powerpc64 also defines __powerpc64__ in addition to __powerpc__. This is likely because unlike amd64, the only major difference between 32-bit and 64-bit is the register size, so mips will likely be the same way. -Justin On Oct 1, 2015 2:51 PM, "John Baldwin" wrote: > On Thursday, October 01, 2015 05:28:07 PM John Baldwin wrote: > > Author: jhb > > Date: Thu Oct 1 17:28:07 2015 > > New Revision: 288454 > > URL: https://svnweb.freebsd.org/changeset/base/288454 > > > > Log: > > - Remove extra integer argument from truncate() and ftruncate(). This > is > > probably fallout from the removal of the extra padding argument > before > > off_t in 7. However, that padding still exists for 32-bit powerpc, > so > > use QUAD_ALIGN. > > - Fix QUAD_ALIGN to be zero for powerpc64. It should only be set to 1 > > for 32-bit platforms that add padding to align 64-bit arguments. > > I'm not sure how the situation is on arm and MIPS, but on powerpc, both the > 32-bit and 64-bit platforms define __powerpc__ (unlike amd64 which doesn't > define __i386__ for example) making proper #ifdef's for just 32-bit > __powerpc__ a bit of a PITA. > > -- > John Baldwin > > From owner-svn-src-head@freebsd.org Thu Oct 1 21:52:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18452A0DBA4; Thu, 1 Oct 2015 21:52:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03ECE11FA; Thu, 1 Oct 2015 21:52:27 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t91LqQB1018711; Thu, 1 Oct 2015 21:52:26 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t91LqQbY018709; Thu, 1 Oct 2015 21:52:26 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510012152.t91LqQbY018709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 1 Oct 2015 21:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288462 - in head/targets/pseudo: bootstrap-tools stage X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2015 21:52:27 -0000 Author: bdrewery Date: Thu Oct 1 21:52:25 2015 New Revision: 288462 URL: https://svnweb.freebsd.org/changeset/base/288462 Log: Don't create cookie until the command is all finished, it or the commands after may fail. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/bootstrap-tools/Makefile head/targets/pseudo/stage/Makefile Modified: head/targets/pseudo/bootstrap-tools/Makefile ============================================================================== --- head/targets/pseudo/bootstrap-tools/Makefile Thu Oct 1 20:54:19 2015 (r288461) +++ head/targets/pseudo/bootstrap-tools/Makefile Thu Oct 1 21:52:25 2015 (r288462) @@ -43,8 +43,10 @@ BSARGS= DESTDIR= \ legacy: .MAKE .META mkdir -p ${LEGACY_TOOLS} - ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} > $@2 - ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} > $@ + ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${BTOOLSDIR} \ + > $@.distrib-dirs_btoolsdir + ${MAKE} -C ${SRCTOP}/etc distrib-dirs DESTDIR=${LEGACY_TOOLS} \ + > $@.distrib-dirs_legacy_tools ${BSENV} ${MAKE} -C ${SRCTOP} -f Makefile.inc1 ${BSARGS} $@ touch $@ Modified: head/targets/pseudo/stage/Makefile ============================================================================== --- head/targets/pseudo/stage/Makefile Thu Oct 1 20:54:19 2015 (r288461) +++ head/targets/pseudo/stage/Makefile Thu Oct 1 21:52:25 2015 (r288462) @@ -8,7 +8,9 @@ all: # we don't need to see it. stage-distrib-dirs: .META mkdir -p ${STAGE_OBJTOP} - ${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS DESTDIR=${STAGE_OBJTOP} > $@ + ${.MAKE} -C ${SRCTOP}/etc distrib-dirs -DWITH_TESTS \ + DESTDIR=${STAGE_OBJTOP} > $@.distrib_dirs + touch $@ .include From owner-svn-src-head@freebsd.org Fri Oct 2 02:09:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2891BA0ECC0; Fri, 2 Oct 2015 02:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19BE419A0; Fri, 2 Oct 2015 02:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9229omC021605; Fri, 2 Oct 2015 02:09:50 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9229oW8021604; Fri, 2 Oct 2015 02:09:50 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510020209.t9229oW8021604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 02:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288470 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 02:09:51 -0000 Author: grehan Date: Fri Oct 2 02:09:50 2015 New Revision: 288470 URL: https://svnweb.freebsd.org/changeset/base/288470 Log: - Increase the max number of indirect descriptors to match the largest that the Windows virtio driver can send down - Always advertize indirect descriptors. The Illumos virtio driver won't attach unless this capability is seen. Reviewed by: neel Modified: head/usr.sbin/bhyve/pci_virtio_net.c Modified: head/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 2 02:08:40 2015 (r288469) +++ head/usr.sbin/bhyve/pci_virtio_net.c Fri Oct 2 02:09:50 2015 (r288470) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #define VTNET_RINGSZ 1024 -#define VTNET_MAXSEGS 32 +#define VTNET_MAXSEGS 256 /* * Host capabilities. Note that we only offer a few of these. @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); #define VTNET_S_HOSTCAPS \ ( VIRTIO_NET_F_MAC | VIRTIO_NET_F_MRG_RXBUF | VIRTIO_NET_F_STATUS | \ - VIRTIO_F_NOTIFY_ON_EMPTY) + VIRTIO_F_NOTIFY_ON_EMPTY | VIRTIO_RING_F_INDIRECT_DESC) /* * PCI config-space "registers" From owner-svn-src-head@freebsd.org Fri Oct 2 02:21:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7866EA0D628; Fri, 2 Oct 2015 02:21:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C9A710CD; Fri, 2 Oct 2015 02:21:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t922LctT028843; Fri, 2 Oct 2015 02:21:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t922LbZe028840; Fri, 2 Oct 2015 02:21:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510020221.t922LbZe028840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 02:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288471 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 02:21:38 -0000 Author: adrian Date: Fri Oct 2 02:21:36 2015 New Revision: 288471 URL: https://svnweb.freebsd.org/changeset/base/288471 Log: Fix neeed -> neeeded. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3595 Modified: head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 02:21:36 2015 (r288471) @@ -168,7 +168,7 @@ ccmp_encap(struct ieee80211_key *k, stru ivp[7] = k->wk_keytsc >> 40; /* PN5 */ /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && !ccmp_encrypt(k, m, hdrlen)) Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 02:21:36 2015 (r288471) @@ -195,7 +195,7 @@ tkip_encap(struct ieee80211_key *k, stru ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) { if (!tkip_encrypt(ctx, k, m, hdrlen)) Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 02:09:50 2015 (r288470) +++ head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 02:21:36 2015 (r288471) @@ -184,7 +184,7 @@ wep_encap(struct ieee80211_key *k, struc ivp[3] = keyid; /* - * Finally, do software encrypt if neeed. + * Finally, do software encrypt if needed. */ if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && !wep_encrypt(k, m, hdrlen)) From owner-svn-src-head@freebsd.org Fri Oct 2 04:58:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 299FAA0D3B9; Fri, 2 Oct 2015 04:58:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F00B71EE0; Fri, 2 Oct 2015 04:58:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by padhy16 with SMTP id hy16so96204880pad.1; Thu, 01 Oct 2015 21:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=YTu/N4+VKVRj8rcbIp1zVbauLSdAjYLZsZ//cihdu5k=; b=grBCA5Z92oiGU36iSKLKze4WPj8nzWiIL7Ib7c31AdGF34TaUMnAwNyXLtOSsQV541 iZLR4zA+ZfeUd9ln4fKYF8c1mJXg9D6an+Ex8v8w37P4Qb1qG185tDlCqaIobx4Mbq17 2iMCvZadAe/Qa/lMzGZKrAPWHbuppeIt+YU0EkswMMP5S8kbOdy7gDIpHrp8jCCDwe3i d+Own/j3PTZsb5QBe+2sW4SX5Q1z7JxR0LkIwys3j4eG4ok4PaL2u7ntPg7Ez8ddA4B7 Fkz0e7PbigSfGNsC69EjBJhXhiJI2Lf+XEa0OLkrajkRF/WlohEdT7n+arN/AFYU2S+R Tg+g== X-Received: by 10.68.238.130 with SMTP id vk2mr17416552pbc.114.1443761927572; Thu, 01 Oct 2015 21:58:47 -0700 (PDT) Received: from raichu ([104.232.114.184]) by smtp.gmail.com with ESMTPSA id ey3sm9804472pbd.28.2015.10.01.21.58.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 21:58:46 -0700 (PDT) Sender: Mark Johnston Date: Thu, 1 Oct 2015 21:58:43 -0700 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Message-ID: <20151002045842.GA18421@raichu> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1837187.vUDrWYExQX@ralph.baldwin.cx> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 04:58:48 -0000 On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > Author: markj > > Date: Wed Sep 30 23:06:29 2015 > > New Revision: 288431 > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > Log: > > As a step towards the elimination of PG_CACHED pages, rework the handling > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > the head of the inactive queue instead of being cached. > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > read or written. At that point the corresponding buffers may still be > > dirty, so the previous implementation would coalesce successive ranges and > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > dirty buffers would eventually be cached. To preserve this behaviour in an > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > flag in bufs that underlie the specified range. > > Putting these pages back on the inactive queue completely defeats the primary > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > of the VM object's tree of pages and into the free pool so that the application > can instruct the VM to free memory more efficiently than relying on page daemon. > > The implementation used cache pages instead of free as a cheap optimization so > that if an application did something dumb where it used DONTNEED and then turned > around and read the file it would not have to go to disk if the pages had not > yet been reused. In practice this didn't work out so well because PG_CACHE pages > don't really work well. > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > memory that an application knew wasn't going to be reused and avoiding the need > for pagedaemon to run at all. I think this should be freeing the pages instead of > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > around and rereads the file, it generally deserves to have to go to disk for it. A problem with this is that one application's DONTNEED or NOREUSE hint would cause every application reading or writing that file to go to disk, but posix_fadvise(2) is explicitly intended for applications that wish to provide hints about their own access patterns. I realize that it's typically used with application-private files, but that's not a requirement of the interface. Deactivating (or caching) the backing pages generally avoids this problem. > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > pagedaemon during application page faults (since pagedaemon potentially never has > to run). That's true, but the page queue locking (and the pagedaemon's manipulation of the page queue locks) has also become more fine-grained since posix_fadvise(2) was added. In particular, from some reading of sys/vm in stable/8, inactive queue scans used to be performed with the global page queue lock held; it was only dropped to launder dirty pages. Now, the page queue lock is split into separate locks for the active and inactive page queues, and the pagedaemon drops the inactive queue lock for each page in all but a few exceptional cases. Does the optimization of freeing or caching DONTNEED pages buy us all that much now? Some synthetic testing in which an application writes out many large (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows no significant difference in runtime if the buffer pages are deactivated vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE identically to B_DIRECT.) Unsurprisingly, I see very little lock contention in the latter case, but in the former, most of the lock contention is short (i.e. the mutex is acquired while spinning), and a large majority of the contention is on the free page queue mutex. If lock contention there is a concern, wouldn't it be better to try and address that directly rather than by bypassing the pagedaemon? > > I believe that B_NOREUSE is definitely cleaner, btw. I had wanted to change > NOREUSE to work that way but wasn't sure how to do it. > > -- > John Baldwin From owner-svn-src-head@freebsd.org Fri Oct 2 06:24:10 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76469A0D620; Fri, 2 Oct 2015 06:24:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7D11AA4; Fri, 2 Oct 2015 06:24:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t926OAJM027679; Fri, 2 Oct 2015 06:24:10 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t926OAKl027678; Fri, 2 Oct 2015 06:24:10 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510020624.t926OAKl027678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 06:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288475 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 06:24:10 -0000 Author: bdrewery Date: Fri Oct 2 06:24:09 2015 New Revision: 288475 URL: https://svnweb.freebsd.org/changeset/base/288475 Log: META_MODE: Fix stage_links not running in the right order without -j. This fixes staging errors for non-parallel builds that have LINKS. Creating hardlinks must always happen after the actual files are installed. The staging code was protected by an .ORDER statement that only affected parallel -j builds but not non-parallel builds. Fix this by making the real stage_links.SET (stage_links.links, stage_links.mlinks, etc) targets depend on the main targets for all of the other possible staging needs. For example, stage_links.links will depend on stage_as and stage_files, which have their own dependencies to stage_as.prog or stage_files.prog or stage_files.SET, which is enough to satistfy the ordering. Also remove the requirement that symlinks be created last, as they can safely be made without the source being present unlike hardlinks. This also fixes symlinks to come before hardlinks as it is possible, in theory, to hardlink a symlink. This is not actually supported here though. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/meta.stage.mk Modified: head/share/mk/meta.stage.mk ============================================================================== --- head/share/mk/meta.stage.mk Fri Oct 2 05:30:46 2015 (r288474) +++ head/share/mk/meta.stage.mk Fri Oct 2 06:24:09 2015 (r288475) @@ -237,10 +237,11 @@ stage_as.$s: .dirdep CLEANFILES += ${STAGE_TARGETS} stage_incs stage_includes # stage_*links usually needs to follow any others. -.for t in ${STAGE_TARGETS:N*links:O:u} -.ORDER: $t stage_links -.ORDER: $t stage_symlinks +.if !empty(STAGE_SETS) && !empty(STAGE_TARGETS:Nstage_links) +.for s in ${STAGE_SETS:O:u} +stage_links.$s: ${STAGE_TARGETS:Nstage_links:O:u} .endfor +.endif # make sure this exists staging: From owner-svn-src-head@freebsd.org Fri Oct 2 07:00:44 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44656A0CF51; Fri, 2 Oct 2015 07:00:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 179331254; Fri, 2 Oct 2015 07:00:44 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9270htd044476; Fri, 2 Oct 2015 07:00:43 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9270hW3044475; Fri, 2 Oct 2015 07:00:43 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510020700.t9270hW3044475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 07:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288477 - head/sbin/ipf/ipftest X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 07:00:44 -0000 Author: bdrewery Date: Fri Oct 2 07:00:43 2015 New Revision: 288477 URL: https://svnweb.freebsd.org/changeset/base/288477 Log: META_MODE: For some reason meta mode cannot generate the intermediate tab.c files. Split up all of the targets to be more clear on how they are generated to fix the problem. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sbin/ipf/ipftest/Makefile Modified: head/sbin/ipf/ipftest/Makefile ============================================================================== --- head/sbin/ipf/ipftest/Makefile Fri Oct 2 06:34:34 2015 (r288476) +++ head/sbin/ipf/ipftest/Makefile Fri Oct 2 07:00:43 2015 (r288477) @@ -32,15 +32,19 @@ CLEANFILES+= ipnat.tab.c ipnat.tab.h CLEANFILES+= ippool_y.c ippool_l.c CLEANFILES+= ippool.tab.c ippool.tab.h -ipnat_y.c: ipnat_y.y +ipnat.tab.c ipnat.tab.h: ipnat_y.y ${YACC} -b ipnat -d ${.ALLSRC} + +ipnat_y.c: ipnat.tab.c sed -e 's/yy/ipnat_yy/g' \ -e 's/y.tab.c/ipnat_y.c/' \ -e s/\"ipnat_y.y\"/\"..\\/tools\\/ipnat_y.y\"/ \ ipnat.tab.c > ${.TARGET} + +ipnat_y.h: ipnat.tab.h sed -e 's/yy/ipnat_yy/g' \ -e 's/y.tab.h/ipnat_y.h/' \ - ipnat.tab.h > ${.TARGET:.c=.h} + ipnat.tab.h > ${.TARGET} ipnat_y.h: ipnat_y.c @@ -54,13 +58,17 @@ ipnat_l.h: lexer.h sed -e 's/yy/ipnat_yy/g' \ ${.ALLSRC} > ${.TARGET} -ippool_y.c: ippool_y.y +ippool.tab.c ippool.tab.h: ippool_y.y ${YACC} -b ippool -d ${.ALLSRC} + +ippool_y.c: ippool.tab.c sed -e 's/yy/ippool_yy/g' \ -e 's/"ippool_y.y"/"..\/tools\/ippool_y.y"/' \ ippool.tab.c > ${.TARGET} + +ippool_y.h: ippool.tab.h sed -e 's/yy/ippool_yy/g' \ - ippool.tab.h > ${.TARGET:.c=.h} + ippool.tab.h > ${.TARGET} ippool_y.h: ippool_y.c @@ -74,13 +82,17 @@ ippool_l.h: lexer.h sed -e 's/yy/ippool_yy/g' \ ${.ALLSRC} > ${.TARGET} -ipf_y.c: ipf_y.y +ipf.tab.c ipf.tab.h: ipf_y.y ${YACC} -b ipf -d ${.ALLSRC} + +ipf_y.c: ipf.tab.c sed -e 's/yy/ipf_yy/g' \ -e 's/"ipf_y.y"/"..\/tools\/ipf_y.y"/' \ ipf.tab.c > ${.TARGET} + +ipf_y.h: ipf.tab.h sed -e 's/yy/ipf_yy/g' \ - ipf.tab.h > ${.TARGET:.c=.h} + ipf.tab.h > ${.TARGET} ipf_y.h: ipf_y.c From owner-svn-src-head@freebsd.org Fri Oct 2 08:58:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88EBFA0E97C; Fri, 2 Oct 2015 08:58:51 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 774E01168; Fri, 2 Oct 2015 08:58:51 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t928wpBB091772; Fri, 2 Oct 2015 08:58:51 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t928wpt6091771; Fri, 2 Oct 2015 08:58:51 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201510020858.t928wpt6091771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 2 Oct 2015 08:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288482 - head/usr.sbin/rpc.yppasswdd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 08:58:51 -0000 Author: araujo Date: Fri Oct 2 08:58:50 2015 New Revision: 288482 URL: https://svnweb.freebsd.org/changeset/base/288482 Log: The rpc.yppasswdd has an option to not allow shell changes (-s), but is always passed a shell by the remote yppasswd. If an NIS client overrides the shell provided by the ypserv, then yppasswd (pam_unix, actually, afaict) will pass this new shell to the yppasswdd. If this shell has been set on the client to a shell which is invalid on the server, a user will never be able to change their password on the client. PR: 67142 Submitted by: russell@rucus.ru.ac.za Approved by: bapt (mentor) Sponsored by: EuroBSDCon Sweden. Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c ============================================================================== --- head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Fri Oct 2 08:33:06 2015 (r288481) +++ head/usr.sbin/rpc.yppasswdd/yppasswdd_server.c Fri Oct 2 08:58:50 2015 (r288482) @@ -212,12 +212,12 @@ validate(struct passwd *opw, struct x_pa * Don't allow the user to shoot himself in the foot, * even on purpose. */ - if (!ok_shell(npw->pw_shell)) { + if (!no_chsh && !ok_shell(npw->pw_shell)) { yp_error("%s is not a valid shell", npw->pw_shell); return(1); } - if (validchars(npw->pw_shell)) { + if (!no_chsh && validchars(npw->pw_shell)) { yp_error("specified shell contains invalid characters"); return(1); } From owner-svn-src-head@freebsd.org Fri Oct 2 09:23:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA70DA0DEC3; Fri, 2 Oct 2015 09:23:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8CD91152; Fri, 2 Oct 2015 09:23:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t929NFAY004064; Fri, 2 Oct 2015 09:23:15 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t929NFKK004063; Fri, 2 Oct 2015 09:23:15 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201510020923.t929NFKK004063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Fri, 2 Oct 2015 09:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288484 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 09:23:15 -0000 Author: phk Date: Fri Oct 2 09:23:14 2015 New Revision: 288484 URL: https://svnweb.freebsd.org/changeset/base/288484 Log: Fail the sbuf if vsnprintf(3) fails. Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Oct 2 09:03:28 2015 (r288483) +++ head/sys/kern/subr_sbuf.c Fri Oct 2 09:23:14 2015 (r288484) @@ -623,6 +623,10 @@ sbuf_vprintf(struct sbuf *s, const char va_copy(ap_copy, ap); len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1, fmt, ap_copy); + if (len < 0) { + s->s_error = errno; + return (-1); + } va_end(ap_copy); if (SBUF_FREESPACE(s) >= len) From owner-svn-src-head@freebsd.org Fri Oct 2 10:08:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B52FA0E21A; Fri, 2 Oct 2015 10:08:13 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6615187D; Fri, 2 Oct 2015 10:08:12 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92A8CX6020647; Fri, 2 Oct 2015 10:08:12 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92A8CnP020645; Fri, 2 Oct 2015 10:08:12 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201510021008.t92A8CnP020645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 2 Oct 2015 10:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288485 - in head: . games usr.bin usr.bin/caesar usr.bin/factor usr.bin/fortune usr.bin/grdc usr.bin/morse usr.bin/number usr.bin/pom usr.bin/primes usr.bin/random X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 10:08:13 -0000 Author: cperciva Date: Fri Oct 2 10:08:11 2015 New Revision: 288485 URL: https://svnweb.freebsd.org/changeset/base/288485 Log: Final step of eliminating the "games" distribution: Merge src/games (or what's left of it, at least) into src/usr.bin. This change will not be MFCed. Discussed at: EuroBSDCon 2014 Committed from: EuroBSDCon 2015 Added: head/usr.bin/caesar/ - copied from r288479, head/games/caesar/ head/usr.bin/factor/ - copied from r288479, head/games/factor/ head/usr.bin/fortune/ - copied from r288479, head/games/fortune/ head/usr.bin/grdc/ - copied from r288479, head/games/grdc/ head/usr.bin/morse/ - copied from r288479, head/games/morse/ head/usr.bin/number/ - copied from r288479, head/games/number/ head/usr.bin/pom/ - copied from r288479, head/games/pom/ head/usr.bin/primes/ - copied from r288479, head/games/primes/ head/usr.bin/random/ - copied from r288479, head/games/random/ Deleted: head/games/ Modified: head/Makefile.inc1 head/usr.bin/Makefile Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Oct 2 09:23:14 2015 (r288484) +++ head/Makefile.inc1 Fri Oct 2 10:08:11 2015 (r288485) @@ -61,9 +61,6 @@ SUBDIR= ${SUBDIR_OVERRIDE} .else SUBDIR= lib libexec SUBDIR+=bin -.if ${MK_GAMES} != "no" -SUBDIR+=games -.endif .if ${MK_CDDL} != "no" SUBDIR+=cddl .endif @@ -1285,7 +1282,7 @@ legacy: _bt= _bootstrap-tools .if ${MK_GAMES} != "no" -_strfile= games/fortune/strfile +_strfile= usr.bin/fortune/strfile .endif .if ${MK_GCC} != "no" && ${MK_CXX} != "no" Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Fri Oct 2 09:23:14 2015 (r288484) +++ head/usr.bin/Makefile Fri Oct 2 10:08:11 2015 (r288485) @@ -230,6 +230,18 @@ SUBDIR+= finger SUBDIR+= ftp .endif +.if ${MK_GAMES} != "no" +SUBDIR+= caesar +SUBDIR+= factor +SUBDIR+= fortune +SUBDIR+= grdc +SUBDIR+= morse +SUBDIR+= number +SUBDIR+= pom +SUBDIR+= primes +SUBDIR+= random +.endif + .if ${MK_GPL_DTC} != "yes" SUBDIR+= dtc .endif From owner-svn-src-head@freebsd.org Fri Oct 2 11:16:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07134A0E5C7; Fri, 2 Oct 2015 11:16:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED70F1352; Fri, 2 Oct 2015 11:16:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BGlMT049187; Fri, 2 Oct 2015 11:16:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BGlbE049185; Fri, 2 Oct 2015 11:16:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021116.t92BGlbE049185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 11:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288486 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 11:16:48 -0000 Author: mav Date: Fri Oct 2 11:16:46 2015 New Revision: 288486 URL: https://svnweb.freebsd.org/changeset/base/288486 Log: Set default block size for CD to expected 2048 bytes. Modified: head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Fri Oct 2 10:08:11 2015 (r288485) +++ head/usr.sbin/ctld/ctld.c Fri Oct 2 11:16:46 2015 (r288486) @@ -1661,7 +1661,10 @@ conf_verify_lun(struct lun *lun) } } if (lun->l_blocksize == 0) { - lun_set_blocksize(lun, DEFAULT_BLOCKSIZE); + if (lun->l_device_type == 5) + lun_set_blocksize(lun, DEFAULT_CD_BLOCKSIZE); + else + lun_set_blocksize(lun, DEFAULT_BLOCKSIZE); } else if (lun->l_blocksize < 0) { log_warnx("invalid blocksize for lun \"%s\"; " "must be larger than 0", lun->l_name); Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Fri Oct 2 10:08:11 2015 (r288485) +++ head/usr.sbin/ctld/ctld.h Fri Oct 2 11:16:46 2015 (r288486) @@ -43,6 +43,7 @@ #define DEFAULT_CONFIG_PATH "/etc/ctl.conf" #define DEFAULT_PIDFILE "/var/run/ctld.pid" #define DEFAULT_BLOCKSIZE 512 +#define DEFAULT_CD_BLOCKSIZE 2048 #define MAX_LUNS 1024 #define MAX_NAME_LEN 223 From owner-svn-src-head@freebsd.org Fri Oct 2 11:17:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61C19A0E63E; Fri, 2 Oct 2015 11:17:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5322C1599; Fri, 2 Oct 2015 11:17:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BHHVH049255; Fri, 2 Oct 2015 11:17:17 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BHGAT049252; Fri, 2 Oct 2015 11:17:16 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201510021117.t92BHGAT049252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 2 Oct 2015 11:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288487 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 11:17:17 -0000 Author: ed Date: Fri Oct 2 11:17:15 2015 New Revision: 288487 URL: https://svnweb.freebsd.org/changeset/base/288487 Log: Make truss print CloudABI system call names. This change adds the bits that are necessary to fetch system call arguments and return values from trapframes for CloudABI. This allows us to properly print system calls with the right name. We need to make sure that we properly convert error numbers when system calls fail. We still need to improve truss to pretty-print some of the system calls that have flags. Added: head/usr.bin/truss/amd64-cloudabi64.c (contents, props changed) head/usr.bin/truss/amd64cloudabi64.conf (contents, props changed) Modified: head/usr.bin/truss/Makefile Modified: head/usr.bin/truss/Makefile ============================================================================== --- head/usr.bin/truss/Makefile Fri Oct 2 11:16:46 2015 (r288486) +++ head/usr.bin/truss/Makefile Fri Oct 2 11:17:15 2015 (r288487) @@ -58,6 +58,16 @@ fbsd32-syscalls.master: ${.CURDIR}/../.. freebsd32_syscalls.h: fbsd32-syscalls.master /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \ ${.CURDIR}/fbsd32.conf + +SRCS+= amd64-cloudabi64.c cloudabi64_syscalls.h +CLEANFILES+=amd64cloudabi64-syscalls.master cloudabi64_syscalls.h + +amd64cloudabi64-syscalls.master: ${.CURDIR}/../../sys/compat/cloudabi64/syscalls.master + cat ${.ALLSRC} > ${.TARGET} + +cloudabi64_syscalls.h: amd64cloudabi64-syscalls.master + /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \ + ${.CURDIR}/amd64cloudabi64.conf .endif .if ${MACHINE_ARCH} == "powerpc64" Added: head/usr.bin/truss/amd64-cloudabi64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/amd64-cloudabi64.c Fri Oct 2 11:17:15 2015 (r288487) @@ -0,0 +1,113 @@ +/*- + * Copyright (c) 2015 Nuxi, https://nuxi.nl/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include +#include + +#include "cloudabi64_syscalls.h" +#include "truss.h" + +static int +amd64_cloudabi64_fetch_args(struct trussinfo *trussinfo, unsigned int narg) +{ + struct current_syscall *cs; + struct reg regs; + lwpid_t tid; + + tid = trussinfo->curthread->tid; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) == -1) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + cs = &trussinfo->curthread->cs; + if (narg >= 1) + cs->args[0] = regs.r_rdi; + if (narg >= 2) + cs->args[1] = regs.r_rsi; + if (narg >= 3) + cs->args[2] = regs.r_rdx; + if (narg >= 4) + cs->args[3] = regs.r_rcx; + if (narg >= 5) + cs->args[4] = regs.r_r8; + if (narg >= 6) + cs->args[5] = regs.r_r9; + return (0); +} + +static const int cloudabi_errno_table[] = { + 0, E2BIG, EACCES, EADDRINUSE, EADDRNOTAVAIL, EAFNOSUPPORT, + EAGAIN, EALREADY, EBADF, EBADMSG, EBUSY, ECANCELED, ECHILD, + ECONNABORTED, ECONNREFUSED, ECONNRESET, EDEADLK, EDESTADDRREQ, + EDOM, EDQUOT, EEXIST, EFAULT, EFBIG, EHOSTUNREACH, EIDRM, + EILSEQ, EINPROGRESS, EINTR, EINVAL, EIO, EISCONN, EISDIR, ELOOP, + EMFILE, EMLINK, EMSGSIZE, EMULTIHOP, ENAMETOOLONG, ENETDOWN, + ENETRESET, ENETUNREACH, ENFILE, ENOBUFS, ENODEV, ENOENT, + ENOEXEC, ENOLCK, ENOLINK, ENOMEM, ENOMSG, ENOPROTOOPT, ENOSPC, + ENOSYS, ENOTCONN, ENOTDIR, ENOTEMPTY, ENOTRECOVERABLE, ENOTSOCK, + ENOTSUP, ENOTTY, ENXIO, EOVERFLOW, EOWNERDEAD, EPERM, EPIPE, + EPROTO, EPROTONOSUPPORT, EPROTOTYPE, ERANGE, EROFS, ESPIPE, + ESRCH, ESTALE, ETIMEDOUT, ETXTBSY, EXDEV, ENOTCAPABLE, +}; + +static int +amd64_cloudabi64_fetch_retval(struct trussinfo *trussinfo, long *retval, + int *errorp) +{ + struct reg regs; + lwpid_t tid; + + tid = trussinfo->curthread->tid; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) == -1) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + retval[0] = regs.r_rax; + retval[1] = regs.r_rdx; + *errorp = (regs.r_rflags & PSL_C) != 0; + if (*errorp && *retval >= 0 && *retval < nitems(cloudabi_errno_table)) + *retval = cloudabi_errno_table[*retval]; + return (0); +} + +static struct procabi amd64_cloudabi64 = { + "CloudABI ELF64", + cloudabi64_syscallnames, + nitems(cloudabi64_syscallnames), + amd64_cloudabi64_fetch_args, + amd64_cloudabi64_fetch_retval +}; + +PROCABI(amd64_cloudabi64); Added: head/usr.bin/truss/amd64cloudabi64.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/amd64cloudabi64.conf Fri Oct 2 11:17:15 2015 (r288487) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +sysnames="cloudabi64_syscalls.h" +sysproto="/dev/null" +sysproto_h="/dev/null" +syshdr="/dev/null" +sysmk="/dev/null" +syssw="/dev/null" +syshide="/dev/null" +syscallprefix="SYS_" +switchname="sysent" +namesname="cloudabi64_syscallnames" +systrace="/dev/null" From owner-svn-src-head@freebsd.org Fri Oct 2 11:27:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20674A0EFBF; Fri, 2 Oct 2015 11:27:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 124B71055; Fri, 2 Oct 2015 11:27:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92BRYgS053404; Fri, 2 Oct 2015 11:27:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92BRYEB053403; Fri, 2 Oct 2015 11:27:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510021127.t92BRYEB053403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 2 Oct 2015 11:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288488 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 11:27:35 -0000 Author: mav Date: Fri Oct 2 11:27:34 2015 New Revision: 288488 URL: https://svnweb.freebsd.org/changeset/base/288488 Log: Document CD block size of 2048. Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Fri Oct 2 11:17:15 2015 (r288487) +++ head/usr.sbin/ctld/ctl.conf.5 Fri Oct 2 11:27:34 2015 (r288488) @@ -387,7 +387,7 @@ testing. The default backend is block. .It Ic blocksize Ar size The blocksize visible to the initiator. -The default blocksize is 512. +The default blocksize is 512 for disks, and 2048 for CD/DVDs. .It Ic ctl-lun Ar lun_id Global numeric identifier to use for a given LUN inside CTL. By default CTL allocates those IDs dynamically, but explicit specification From owner-svn-src-head@freebsd.org Fri Oct 2 13:16:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13DB9A0DBE7; Fri, 2 Oct 2015 13:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 054D71AFB; Fri, 2 Oct 2015 13:16:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DG6BB098750; Fri, 2 Oct 2015 13:16:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DG6gF098749; Fri, 2 Oct 2015 13:16:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201510021316.t92DG6gF098749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 2 Oct 2015 13:16:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288490 - head/usr.sbin/kldxref X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 13:16:07 -0000 Author: emaste Date: Fri Oct 2 13:16:06 2015 New Revision: 288490 URL: https://svnweb.freebsd.org/changeset/base/288490 Log: Add debug file extension to kldxref(8) after r288176 After r288176 kernel debug files have the extension .debug. They also moved to /usr/lib/debug/boot/kernel by default so in the normal case kldxref does not encounter them. A src.conf(5) setting may be used to continue installing them in /boot/kernel though, so have kldxref skip .debug files in addition to .symbols files. Reported by: fabient Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/kldxref/kldxref.c Modified: head/usr.sbin/kldxref/kldxref.c ============================================================================== --- head/usr.sbin/kldxref/kldxref.c Fri Oct 2 12:50:12 2015 (r288489) +++ head/usr.sbin/kldxref/kldxref.c Fri Oct 2 13:16:06 2015 (r288490) @@ -360,9 +360,12 @@ main(int argc, char *argv[]) fwrite(&ival, sizeof(ival), 1, fxref); reccnt = 0; } - /* skip non-files or .symbols entries */ + /* skip non-files and separate debug files */ if (p->fts_info != FTS_F) continue; + if (p->fts_namelen >= 6 && + strcmp(p->fts_name + p->fts_namelen - 6, ".debug") == 0) + continue; if (p->fts_namelen >= 8 && strcmp(p->fts_name + p->fts_namelen - 8, ".symbols") == 0) continue; From owner-svn-src-head@freebsd.org Fri Oct 2 13:21:10 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6371CA0E006; Fri, 2 Oct 2015 13:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54EFE1ECC; Fri, 2 Oct 2015 13:21:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DLA1u002728; Fri, 2 Oct 2015 13:21:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DL9nr002723; Fri, 2 Oct 2015 13:21:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021321.t92DL9nr002723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288491 - head/sys/arm/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 13:21:10 -0000 Author: kib Date: Fri Oct 2 13:21:08 2015 New Revision: 288491 URL: https://svnweb.freebsd.org/changeset/base/288491 Log: FreeBSD does not support SMP on ARMv5. Since processor is always self-consistent, there is no need in anything but compiler barrier in the implementation of atomic_thread_fence_*() on ARMv5. Split implementation of fences for ARMv4/5 and ARMv6; the former use compiler barriers, the later also perform hardware barriers. An issue which is fixed by the change is the faults from the CP15 coprocessor accesses in the user mode. This was uncovered by the pthread_once() changes in r287556. Reported by: Mattia Rossi Discussed with: alc, cognet, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/arm/include/atomic-v4.h head/sys/arm/include/atomic-v6.h head/sys/arm/include/atomic.h Modified: head/sys/arm/include/atomic-v4.h ============================================================================== --- head/sys/arm/include/atomic-v4.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic-v4.h Fri Oct 2 13:21:08 2015 (r288491) @@ -439,4 +439,37 @@ atomic_subtract_long(volatile u_long *p, atomic_subtract_32((volatile uint32_t *)p, v); } +/* + * ARMv5 does not support SMP. For both kernel and user modes, only a + * compiler barrier is needed for fences, since CPU is always + * self-consistent. + */ +static __inline void +atomic_thread_fence_acq(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_rel(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_acq_rel(void) +{ + + __compiler_membar(); +} + +static __inline void +atomic_thread_fence_seq_cst(void) +{ + + __compiler_membar(); +} + #endif /* _MACHINE_ATOMIC_H_ */ Modified: head/sys/arm/include/atomic-v6.h ============================================================================== --- head/sys/arm/include/atomic-v6.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic-v6.h Fri Oct 2 13:21:08 2015 (r288491) @@ -596,4 +596,32 @@ atomic_store_rel_long(volatile u_long *p #undef ATOMIC_ACQ_REL #undef ATOMIC_ACQ_REL_LONG +static __inline void +atomic_thread_fence_acq(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_rel(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_acq_rel(void) +{ + + dmb(); +} + +static __inline void +atomic_thread_fence_seq_cst(void) +{ + + dmb(); +} + #endif /* _MACHINE_ATOMIC_V6_H_ */ Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Fri Oct 2 13:16:06 2015 (r288490) +++ head/sys/arm/include/atomic.h Fri Oct 2 13:21:08 2015 (r288491) @@ -82,34 +82,6 @@ atomic_store_long(volatile u_long *dst, *dst = src; } -static __inline void -atomic_thread_fence_acq(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_rel(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_acq_rel(void) -{ - - dmb(); -} - -static __inline void -atomic_thread_fence_seq_cst(void) -{ - - dmb(); -} - #define atomic_clear_ptr atomic_clear_32 #define atomic_set_ptr atomic_set_32 #define atomic_cmpset_ptr atomic_cmpset_32 From owner-svn-src-head@freebsd.org Fri Oct 2 13:26:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CCB1A0E30D; Fri, 2 Oct 2015 13:26:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E7EB11B0; Fri, 2 Oct 2015 13:26:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DQ0CX002989; Fri, 2 Oct 2015 13:26:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DQ0Ds002986; Fri, 2 Oct 2015 13:26:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021326.t92DQ0Ds002986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288492 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 13:26:00 -0000 Author: kib Date: Fri Oct 2 13:25:59 2015 New Revision: 288492 URL: https://svnweb.freebsd.org/changeset/base/288492 Log: Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct implementation of IEEE 754 arithmetic depends on denormals operating correctly. Both perl test suite and paranoia tripped over the setting. Reported by: Stefan Parvu Discussed with: andrew Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/arm/arm/machdep.c head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_vfpcpu = -1; - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; } Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); pcb2->pcb_vfpcpu = -1; - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; tf = td2->td_frame; tf->tf_spsr &= ~PSR_C; From owner-svn-src-head@freebsd.org Fri Oct 2 13:30:57 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66750A0E676; Fri, 2 Oct 2015 13:30:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57C0C15DD; Fri, 2 Oct 2015 13:30:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92DUvIQ005685; Fri, 2 Oct 2015 13:30:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92DUuOi005683; Fri, 2 Oct 2015 13:30:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201510021330.t92DUuOi005683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 2 Oct 2015 13:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288493 - in head/usr.bin: . truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 13:30:57 -0000 Author: kib Date: Fri Oct 2 13:30:56 2015 New Revision: 288493 URL: https://svnweb.freebsd.org/changeset/base/288493 Log: Add aarch64 support to truss(1). Reviewed by: jhb Discussed with: emaste (license) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3750 Added: head/usr.bin/truss/aarch64-fbsd.c (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Fri Oct 2 13:25:59 2015 (r288492) +++ head/usr.bin/Makefile Fri Oct 2 13:30:56 2015 (r288493) @@ -266,10 +266,8 @@ SUBDIR+= iscsictl .if ${MK_KDUMP} != "no" SUBDIR+= kdump -.if ${MACHINE_ARCH} != "aarch64" # ARM64TODO truss does not build SUBDIR+= truss .endif -.endif .if ${MK_KERBEROS_SUPPORT} != "no" SUBDIR+= compile_et Added: head/usr.bin/truss/aarch64-fbsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/truss/aarch64-fbsd.c Fri Oct 2 13:30:56 2015 (r288493) @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2015 The FreeBSD Foundation + * + * 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: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* FreeBSD/arm64-specific system call handling. */ + +#include +#include + +#include +#include +#include + +#include + +#include "truss.h" + +extern const char *syscallnames[]; /* silence compiler */ +#include "syscalls.h" + +static int +aarch64_fetch_args(struct trussinfo *trussinfo, u_int narg) +{ + struct reg regs; + struct current_syscall *cs; + lwpid_t tid; + u_int i, reg, syscall_num; + + tid = trussinfo->curthread->tid; + cs = &trussinfo->curthread->cs; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + /* + * FreeBSD has two special kinds of system call redirections -- + * SYS_syscall, and SYS___syscall. The former is the old syscall() + * routine, basically; the latter is for quad-aligned arguments. + * + * The system call argument count and code from ptrace() already + * account for these, but we need to skip over the first argument. + */ + syscall_num = regs.x[8]; + if (syscall_num == SYS_syscall || syscall_num == SYS___syscall) { + reg = 1; + syscall_num = regs.x[0]; + } else { + reg = 0; + } + + for (i = 0; i < narg && reg < 8; i++, reg++) + cs->args[i] = regs.x[reg]; + return (0); +} + +static int +aarch64_fetch_retval(struct trussinfo *trussinfo, long *retval, int *errorp) +{ + struct reg regs; + lwpid_t tid; + + tid = trussinfo->curthread->tid; + if (ptrace(PT_GETREGS, tid, (caddr_t)®s, 0) < 0) { + fprintf(trussinfo->outfile, "-- CANNOT READ REGISTERS --\n"); + return (-1); + } + + retval[0] = regs.x[0]; + retval[1] = regs.x[1]; + *errorp = !!(regs.spsr & PSR_C); + return (0); +} + +static struct procabi aarch64_fbsd = { + "FreeBSD ELF64", + syscallnames, + nitems(syscallnames), + aarch64_fetch_args, + aarch64_fetch_retval +}; + +PROCABI(aarch64_fbsd); From owner-svn-src-head@freebsd.org Fri Oct 2 14:26:14 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06F81A0D22E for ; Fri, 2 Oct 2015 14:26:14 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE03C1F0C for ; Fri, 2 Oct 2015 14:26:13 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Fri, 2 Oct 2015 14:26:53 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t92EQAJg020591; Fri, 2 Oct 2015 08:26:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1443795970.66572.68.camel@freebsd.org> Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Ian Lepore To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 08:26:10 -0600 In-Reply-To: <201510021326.t92DQ0Ds002986@repo.freebsd.org> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 14:26:14 -0000 On Fri, 2015-10-02 at 13:26 +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Oct 2 13:25:59 2015 > New Revision: 288492 > URL: https://svnweb.freebsd.org/changeset/base/288492 > > Log: > Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct > implementation of IEEE 754 arithmetic depends on denormals operating > correctly. Both perl test suite and paranoia tripped over the > setting. > > Reported by: Stefan Parvu > Discussed with: andrew > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/arm/arm/machdep.c > head/sys/arm/arm/vm_machdep.c > > Modified: head/sys/arm/arm/machdep.c > ============================================================================== > --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) > (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; > thread0.td_pcb->pcb_flags = 0; > thread0.td_pcb->pcb_vfpcpu = -1; > - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; > thread0.td_frame = &proc0_tf; > pcpup->pc_curpcb = thread0.td_pcb; > } > > Modified: head/sys/arm/arm/vm_machdep.c > ============================================================================== > --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re > pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); > > pcb2->pcb_vfpcpu = -1; > - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; > > tf = td2->td_frame; > tf->tf_spsr &= ~PSR_C; > Some arm documentation refers to the need for "support code" when the flush-to-zero option is disabled on VFPv2 hardware (which for us would be just the RPi I think). Do we have that support code? What happens if it's missing? I can't actually find any info on exactly what that support code is supposed to do. For all I know, we have the required code in libm. Or maybe what's needed is exception-handling code in the kernel. I can't find any info on what they mean by "support code" in this context. I don't think this is an issue for VFPv3 and later hardware. I've looked in a few of the TRMs for different cortex-a series processors and they say the hardware handles all combinations of rounding and flush to zero without support software. But we should probably be on the lookout for reports of misbehaving apps on RPi after this change, just in case this setting has been protecting us from our ignorance there. -- Ian From owner-svn-src-head@freebsd.org Fri Oct 2 15:21:05 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42917A0D9B8; Fri, 2 Oct 2015 15:21:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B1007119F; Fri, 2 Oct 2015 15:21:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t92FKxr9062418 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Fri, 2 Oct 2015 18:20:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t92FKxr9062418 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t92FKx2o062417; Fri, 2 Oct 2015 18:20:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 2 Oct 2015 18:20:59 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151002152059.GY11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443795970.66572.68.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 15:21:05 -0000 On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > Some arm documentation refers to the need for "support code" when the > flush-to-zero option is disabled on VFPv2 hardware (which for us would > be just the RPi I think). Do we have that support code? What happens > if it's missing? I can't actually find any info on exactly what that > support code is supposed to do. For all I know, we have the required > code in libm. Or maybe what's needed is exception-handling code in the > kernel. I can't find any info on what they mean by "support code" in > this context. The fpscr register is user-modifiable, so whatever happens after the change, could as well happen before it. I saw the references to the support code in e.g. ARM v7-A A2.7.5 Flush-to-zero. But I was sure that the text refers to the modes when e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, fault handler must do something to allow the computation to proceed. > > I don't think this is an issue for VFPv3 and later hardware. I've > looked in a few of the TRMs for different cortex-a series processors and > they say the hardware handles all combinations of rounding and flush to > zero without support software. But we should probably be on the lookout > for reports of misbehaving apps on RPi after this change, just in case > this setting has been protecting us from our ignorance there. I did found the reference to the support code in the VFP11 TRM, which in turns point to http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html Does FreeBSD enable and handle this variant of coprocessor ? If yes, then indeed I would need to not enable FZ on the affected hardware. From owner-svn-src-head@freebsd.org Fri Oct 2 15:22:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86129A0DA85; Fri, 2 Oct 2015 15:22:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CDE314C2; Fri, 2 Oct 2015 15:22:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FM1SO053436; Fri, 2 Oct 2015 15:22:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FM1rt053435; Fri, 2 Oct 2015 15:22:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021522.t92FM1rt053435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288501 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 15:22:01 -0000 Author: adrian Date: Fri Oct 2 15:22:00 2015 New Revision: 288501 URL: https://svnweb.freebsd.org/changeset/base/288501 Log: rum(4): reduce code duplication. Tested: rum0: on usbus0 rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3606 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:07:02 2015 (r288500) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:22:00 2015 (r288501) @@ -199,6 +199,7 @@ static void rum_set_chan(struct rum_sof struct ieee80211_channel *); static void rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); +static void rum_abort_tsf_sync(struct rum_softc *); static void rum_update_slot(struct rum_softc *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -687,7 +688,6 @@ rum_newstate(struct ieee80211vap *vap, e const struct ieee80211_txparam *tp; enum ieee80211_state ostate; struct ieee80211_node *ni; - uint32_t tmp; ostate = vap->iv_state; DPRINTF("%s -> %s\n", @@ -700,11 +700,9 @@ rum_newstate(struct ieee80211vap *vap, e switch (nstate) { case IEEE80211_S_INIT: - if (ostate == IEEE80211_S_RUN) { - /* abort TSF synchronization */ - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); - } + if (ostate == IEEE80211_S_RUN) + rum_abort_tsf_sync(sc); + break; case IEEE80211_S_RUN: @@ -1731,6 +1729,15 @@ rum_enable_tsf(struct rum_softc *sc) } static void +rum_abort_tsf_sync(struct rum_softc *sc) +{ + uint32_t tmp; + + tmp = rum_read(sc, RT2573_TXRX_CSR9); + rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); +} + +static void rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -2217,12 +2224,9 @@ static void rum_scan_start(struct ieee80211com *ic) { struct rum_softc *sc = ic->ic_softc; - uint32_t tmp; RUM_LOCK(sc); - /* abort TSF synchronization */ - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); + rum_abort_tsf_sync(sc); rum_set_bssid(sc, ieee80211broadcastaddr); RUM_UNLOCK(sc); From owner-svn-src-head@freebsd.org Fri Oct 2 15:26:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7078A0DD51; Fri, 2 Oct 2015 15:26:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AC44184C; Fri, 2 Oct 2015 15:26:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FQYlP053675; Fri, 2 Oct 2015 15:26:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FQYgm053674; Fri, 2 Oct 2015 15:26:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021526.t92FQYgm053674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:26:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288502 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 15:26:34 -0000 Author: adrian Date: Fri Oct 2 15:26:33 2015 New Revision: 288502 URL: https://svnweb.freebsd.org/changeset/base/288502 Log: rum(4): move common part of rum_bbp_write() and rum_bbp_read() into rum_bbp_busy(). Submitted by: Differential Revision: https://reviews.freebsd.org/D3608 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:22:00 2015 (r288501) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:26:33 2015 (r288502) @@ -186,6 +186,7 @@ static void rum_read_multi(struct rum_s static usb_error_t rum_write(struct rum_softc *, uint16_t, uint32_t); static usb_error_t rum_write_multi(struct rum_softc *, uint16_t, void *, size_t); +static int rum_bbp_busy(struct rum_softc *); static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t); static uint8_t rum_bbp_read(struct rum_softc *, uint8_t); static void rum_rf_write(struct rum_softc *, uint8_t, uint32_t); @@ -1410,21 +1411,31 @@ rum_write_multi(struct rum_softc *sc, ui return (USB_ERR_NORMAL_COMPLETION); } -static void -rum_bbp_write(struct rum_softc *sc, uint8_t reg, uint8_t val) +static int +rum_bbp_busy(struct rum_softc *sc) { - uint32_t tmp; int ntries; - DPRINTFN(2, "reg=0x%08x\n", reg); - for (ntries = 0; ntries < 100; ntries++) { if (!(rum_read(sc, RT2573_PHY_CSR3) & RT2573_BBP_BUSY)) break; if (rum_pause(sc, hz / 100)) break; } - if (ntries == 100) { + if (ntries == 100) + return (ETIMEDOUT); + + return (0); +} + +static void +rum_bbp_write(struct rum_softc *sc, uint8_t reg, uint8_t val) +{ + uint32_t tmp; + + DPRINTFN(2, "reg=0x%08x\n", reg); + + if (rum_bbp_busy(sc) != 0) { device_printf(sc->sc_dev, "could not write to BBP\n"); return; } @@ -1441,13 +1452,7 @@ rum_bbp_read(struct rum_softc *sc, uint8 DPRINTFN(2, "reg=0x%08x\n", reg); - for (ntries = 0; ntries < 100; ntries++) { - if (!(rum_read(sc, RT2573_PHY_CSR3) & RT2573_BBP_BUSY)) - break; - if (rum_pause(sc, hz / 100)) - break; - } - if (ntries == 100) { + if (rum_bbp_busy(sc) != 0) { device_printf(sc->sc_dev, "could not read BBP\n"); return 0; } From owner-svn-src-head@freebsd.org Fri Oct 2 15:28:45 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52D0AA0DEE6; Fri, 2 Oct 2015 15:28:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42CB21A21; Fri, 2 Oct 2015 15:28:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FSjj4053805; Fri, 2 Oct 2015 15:28:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FSjFc053804; Fri, 2 Oct 2015 15:28:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021528.t92FSjFc053804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:28:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288503 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 15:28:45 -0000 Author: adrian Date: Fri Oct 2 15:28:44 2015 New Revision: 288503 URL: https://svnweb.freebsd.org/changeset/base/288503 Log: rum(4): create few wrappers. Tested: rum0: on usbus0 rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3609 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:26:33 2015 (r288502) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:28:44 2015 (r288503) @@ -186,6 +186,10 @@ static void rum_read_multi(struct rum_s static usb_error_t rum_write(struct rum_softc *, uint16_t, uint32_t); static usb_error_t rum_write_multi(struct rum_softc *, uint16_t, void *, size_t); +static usb_error_t rum_setbits(struct rum_softc *, uint16_t, uint32_t); +static usb_error_t rum_clrbits(struct rum_softc *, uint16_t, uint32_t); +static usb_error_t rum_modbits(struct rum_softc *, uint16_t, uint32_t, + uint32_t); static int rum_bbp_busy(struct rum_softc *); static void rum_bbp_write(struct rum_softc *, uint8_t, uint8_t); static uint8_t rum_bbp_read(struct rum_softc *, uint8_t); @@ -1411,6 +1415,24 @@ rum_write_multi(struct rum_softc *sc, ui return (USB_ERR_NORMAL_COMPLETION); } +static usb_error_t +rum_setbits(struct rum_softc *sc, uint16_t reg, uint32_t mask) +{ + return (rum_write(sc, reg, rum_read(sc, reg) | mask)); +} + +static usb_error_t +rum_clrbits(struct rum_softc *sc, uint16_t reg, uint32_t mask) +{ + return (rum_write(sc, reg, rum_read(sc, reg) & ~mask)); +} + +static usb_error_t +rum_modbits(struct rum_softc *sc, uint16_t reg, uint32_t set, uint32_t unset) +{ + return (rum_write(sc, reg, (rum_read(sc, reg) & ~unset) | set)); +} + static int rum_bbp_busy(struct rum_softc *sc) { @@ -1528,31 +1550,25 @@ static void rum_enable_mrr(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR4); - - tmp &= ~RT2573_MRR_CCK_FALLBACK; - if (!IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) - tmp |= RT2573_MRR_CCK_FALLBACK; - tmp |= RT2573_MRR_ENABLED; - rum_write(sc, RT2573_TXRX_CSR4, tmp); + if (!IEEE80211_IS_CHAN_5GHZ(ic->ic_bsschan)) { + rum_setbits(sc, RT2573_TXRX_CSR4, + RT2573_MRR_ENABLED | RT2573_MRR_CCK_FALLBACK); + } else { + rum_modbits(sc, RT2573_TXRX_CSR4, + RT2573_MRR_ENABLED, RT2573_MRR_CCK_FALLBACK); + } } static void rum_set_txpreamble(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR4); - tmp &= ~RT2573_SHORT_PREAMBLE; if (ic->ic_flags & IEEE80211_F_SHPREAMBLE) - tmp |= RT2573_SHORT_PREAMBLE; - - rum_write(sc, RT2573_TXRX_CSR4, tmp); + rum_setbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_PREAMBLE); + else + rum_clrbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_PREAMBLE); } static void @@ -1581,7 +1597,6 @@ static void rum_select_band(struct rum_softc *sc, struct ieee80211_channel *c) { uint8_t bbp17, bbp35, bbp96, bbp97, bbp98, bbp104; - uint32_t tmp; /* update all BBP registers that depend on the band */ bbp17 = 0x20; bbp96 = 0x48; bbp104 = 0x2c; @@ -1611,13 +1626,13 @@ rum_select_band(struct rum_softc *sc, st rum_bbp_write(sc, 97, bbp97); rum_bbp_write(sc, 98, bbp98); - tmp = rum_read(sc, RT2573_PHY_CSR0); - tmp &= ~(RT2573_PA_PE_2GHZ | RT2573_PA_PE_5GHZ); - if (IEEE80211_IS_CHAN_2GHZ(c)) - tmp |= RT2573_PA_PE_2GHZ; - else - tmp |= RT2573_PA_PE_5GHZ; - rum_write(sc, RT2573_PHY_CSR0, tmp); + if (IEEE80211_IS_CHAN_2GHZ(c)) { + rum_modbits(sc, RT2573_PHY_CSR0, RT2573_PA_PE_2GHZ, + RT2573_PA_PE_5GHZ); + } else { + rum_modbits(sc, RT2573_PHY_CSR0, RT2573_PA_PE_5GHZ, + RT2573_PA_PE_2GHZ); + } } static void @@ -1728,18 +1743,14 @@ rum_enable_tsf_sync(struct rum_softc *sc static void rum_enable_tsf(struct rum_softc *sc) { - rum_write(sc, RT2573_TXRX_CSR9, - (rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000) | - RT2573_TSF_TICKING | RT2573_TSF_MODE(2)); + rum_modbits(sc, RT2573_TXRX_CSR9, + RT2573_TSF_TICKING | RT2573_TSF_MODE(2), 0x00ffffff); } static void rum_abort_tsf_sync(struct rum_softc *sc) { - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR9); - rum_write(sc, RT2573_TXRX_CSR9, tmp & ~0x00ffffff); + rum_clrbits(sc, RT2573_TXRX_CSR9, 0x00ffffff); } static void @@ -1747,13 +1758,10 @@ rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; - uint32_t tmp; slottime = (ic->ic_flags & IEEE80211_F_SHSLOT) ? 9 : 20; - tmp = rum_read(sc, RT2573_MAC_CSR9); - tmp = (tmp & ~0xff) | slottime; - rum_write(sc, RT2573_MAC_CSR9, tmp); + rum_modbits(sc, RT2573_MAC_CSR9, slottime, 0xff); DPRINTF("setting slot time to %uus\n", slottime); } @@ -1785,17 +1793,14 @@ rum_set_macaddr(struct rum_softc *sc, co static void rum_setpromisc(struct rum_softc *sc) { - uint32_t tmp; - - tmp = rum_read(sc, RT2573_TXRX_CSR0); - - tmp &= ~RT2573_DROP_NOT_TO_ME; - if (sc->sc_ic.ic_promisc == 0) - tmp |= RT2573_DROP_NOT_TO_ME; + struct ieee80211com *ic = &sc->sc_ic; - rum_write(sc, RT2573_TXRX_CSR0, tmp); + if (ic->ic_promisc == 0) + rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DROP_NOT_TO_ME); + else + rum_clrbits(sc, RT2573_TXRX_CSR0, RT2573_DROP_NOT_TO_ME); - DPRINTF("%s promiscuous mode\n", sc->sc_ic.ic_promisc > 0 ? + DPRINTF("%s promiscuous mode\n", ic->ic_promisc > 0 ? "entering" : "leaving"); } @@ -2033,7 +2038,6 @@ fail: rum_stop(sc); static void rum_stop(struct rum_softc *sc) { - uint32_t tmp; RUM_LOCK_ASSERT(sc, MA_OWNED); @@ -2052,8 +2056,7 @@ rum_stop(struct rum_softc *sc) rum_unsetup_tx_list(sc); /* disable Rx */ - tmp = rum_read(sc, RT2573_TXRX_CSR0); - rum_write(sc, RT2573_TXRX_CSR0, tmp | RT2573_DISABLE_RX); + rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DISABLE_RX); /* reset ASIC */ rum_write(sc, RT2573_MAC_CSR1, 3); From owner-svn-src-head@freebsd.org Fri Oct 2 15:30:38 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE062A0E15B; Fri, 2 Oct 2015 15:30:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 767E91D6A; Fri, 2 Oct 2015 15:30:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92FUcsL053952; Fri, 2 Oct 2015 15:30:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92FUbEh053950; Fri, 2 Oct 2015 15:30:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510021530.t92FUbEh053950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 15:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288504 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 15:30:38 -0000 Author: adrian Date: Fri Oct 2 15:30:37 2015 New Revision: 288504 URL: https://svnweb.freebsd.org/changeset/base/288504 Log: rum(4): sync rum_enable_tsf(_sync) with run(4). Submitted by: Differential Revision: https://reviews.freebsd.org/D3611 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:28:44 2015 (r288503) +++ head/sys/dev/usb/wlan/if_rum.c Fri Oct 2 15:30:37 2015 (r288504) @@ -1730,12 +1730,35 @@ rum_enable_tsf_sync(struct rum_softc *sc /* set beacon interval (in 1/16ms unit) */ tmp |= vap->iv_bss->ni_intval * 16; + tmp |= RT2573_TSF_TIMER_EN | RT2573_TBTT_TIMER_EN; - tmp |= RT2573_TSF_TICKING | RT2573_ENABLE_TBTT; - if (vap->iv_opmode == IEEE80211_M_STA) - tmp |= RT2573_TSF_MODE(1); - else - tmp |= RT2573_TSF_MODE(2) | RT2573_GENERATE_BEACON; + switch (vap->iv_opmode) { + case IEEE80211_M_STA: + /* + * Local TSF is always updated with remote TSF on beacon + * reception. + */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_STA); + break; + case IEEE80211_M_IBSS: + /* + * Local TSF is updated with remote TSF on beacon reception + * only if the remote TSF is greater than local TSF. + */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_IBSS); + tmp |= RT2573_BCN_TX_EN; + break; + case IEEE80211_M_HOSTAP: + /* SYNC with nobody */ + tmp |= RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_HOSTAP); + tmp |= RT2573_BCN_TX_EN; + break; + default: + device_printf(sc->sc_dev, + "Enabling TSF failed. undefined opmode %d\n", + vap->iv_opmode); + return; + } rum_write(sc, RT2573_TXRX_CSR9, tmp); } @@ -1743,8 +1766,8 @@ rum_enable_tsf_sync(struct rum_softc *sc static void rum_enable_tsf(struct rum_softc *sc) { - rum_modbits(sc, RT2573_TXRX_CSR9, - RT2573_TSF_TICKING | RT2573_TSF_MODE(2), 0x00ffffff); + rum_modbits(sc, RT2573_TXRX_CSR9, RT2573_TSF_TIMER_EN | + RT2573_TSF_SYNC_MODE(RT2573_TSF_SYNC_MODE_DIS), 0x00ffffff); } static void Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Fri Oct 2 15:28:44 2015 (r288503) +++ head/sys/dev/usb/wlan/if_rumreg.h Fri Oct 2 15:30:37 2015 (r288504) @@ -124,11 +124,14 @@ #define RT2573_MRR_CCK_FALLBACK (1 << 22) /* possible flags for register TXRX_CSR9 */ -#define RT2573_TSF_TICKING (1 << 16) -#define RT2573_TSF_MODE(x) (((x) & 0x3) << 17) -/* TBTT stands for Target Beacon Transmission Time */ -#define RT2573_ENABLE_TBTT (1 << 19) -#define RT2573_GENERATE_BEACON (1 << 20) +#define RT2573_TSF_TIMER_EN (1 << 16) +#define RT2573_TSF_SYNC_MODE(x) (((x) & 0x3) << 17) +#define RT2573_TSF_SYNC_MODE_DIS 0 +#define RT2573_TSF_SYNC_MODE_STA 1 +#define RT2573_TSF_SYNC_MODE_IBSS 2 +#define RT2573_TSF_SYNC_MODE_HOSTAP 3 +#define RT2573_TBTT_TIMER_EN (1 << 19) +#define RT2573_BCN_TX_EN (1 << 20) /* possible flags for register PHY_CSR0 */ #define RT2573_PA_PE_2GHZ (1 << 16) From owner-svn-src-head@freebsd.org Fri Oct 2 16:17:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BBFFA0DED1; Fri, 2 Oct 2015 16:17:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 236C51616; Fri, 2 Oct 2015 16:17:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 329A1B96C; Fri, 2 Oct 2015 12:17:16 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Date: Fri, 02 Oct 2015 08:59:33 -0700 Message-ID: <4276391.z2UvhhORjP@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20151002045842.GA18421@raichu> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 02 Oct 2015 12:17:16 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 16:17:17 -0000 On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: > On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > > Author: markj > > > Date: Wed Sep 30 23:06:29 2015 > > > New Revision: 288431 > > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > > > Log: > > > As a step towards the elimination of PG_CACHED pages, rework the handling > > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > > the head of the inactive queue instead of being cached. > > > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > > read or written. At that point the corresponding buffers may still be > > > dirty, so the previous implementation would coalesce successive ranges and > > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > > dirty buffers would eventually be cached. To preserve this behaviour in an > > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > > flag in bufs that underlie the specified range. > > > > Putting these pages back on the inactive queue completely defeats the primary > > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > > of the VM object's tree of pages and into the free pool so that the application > > can instruct the VM to free memory more efficiently than relying on page daemon. > > > > The implementation used cache pages instead of free as a cheap optimization so > > that if an application did something dumb where it used DONTNEED and then turned > > around and read the file it would not have to go to disk if the pages had not > > yet been reused. In practice this didn't work out so well because PG_CACHE pages > > don't really work well. > > > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > > memory that an application knew wasn't going to be reused and avoiding the need > > for pagedaemon to run at all. I think this should be freeing the pages instead of > > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > > around and rereads the file, it generally deserves to have to go to disk for it. > > A problem with this is that one application's DONTNEED or NOREUSE hint > would cause every application reading or writing that file to go to > disk, but posix_fadvise(2) is explicitly intended for applications that > wish to provide hints about their own access patterns. I realize that > it's typically used with application-private files, but that's not a > requirement of the interface. Deactivating (or caching) the backing > pages generally avoids this problem. I think it is not unreasonble to expect that fadvise() incurs system-wide affects. A properly implemented WILLNEED that does read-ahead cannot work without incurring system-wide effects. I had always assumed that fadvise() operated on a file, not a given process' view of a file (unlike, say, madvise which only operates on mappings and only indirectly affects file-backed data). > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > > pagedaemon during application page faults (since pagedaemon potentially never has > > to run). > > That's true, but the page queue locking (and the pagedaemon's > manipulation of the page queue locks) has also become more fine-grained > since posix_fadvise(2) was added. In particular, from some reading of > sys/vm in stable/8, inactive queue scans used to be performed with the > global page queue lock held; it was only dropped to launder dirty pages. > Now, the page queue lock is split into separate locks for the active and > inactive page queues, and the pagedaemon drops the inactive queue lock > for each page in all but a few exceptional cases. Does the optimization > of freeing or caching DONTNEED pages buy us all that much now? > > Some synthetic testing in which an application writes out many large > (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows > no significant difference in runtime if the buffer pages are deactivated > vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE > identically to B_DIRECT.) Unsurprisingly, I see very little lock > contention in the latter case, but in the former, most of the lock > contention is short (i.e. the mutex is acquired while spinning), and > a large majority of the contention is on the free page queue mutex. If > lock contention there is a concern, wouldn't it be better to try and > address that directly rather than by bypassing the pagedaemon? The lock contention was related to one process faulting in a new page due to a malloc() while pagedaemon ran. Also, it wasn't a steady type of contention that would show up in an average. Instead, it was the outliers (which in the case on 8.x were on the order of 2 seconds) that were problematic. I used a hack to log "long" wait times for specific processes to both debug this and evaluate the solution. I have a test program laying around from when I last tested this. I'll see what I can reproduce (before it required a machine with at least 24GB of RAM to reproduce). The only foolproof way to reduce contention to zero is to eliminate one of the contending threads. :) I do think there are situations where an application may be more informed about the optimal memory pattern for its workload than what the VM system can infer from heuristics. Currently there is no other way to flush a file's contents from RAM. If we had things like DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a sliding scale, but at the moment the policy isn't that fine-grained. -- John Baldwin From owner-svn-src-head@freebsd.org Fri Oct 2 16:27:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07C39A0E7AB for ; Fri, 2 Oct 2015 16:27:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C17ED15D6 for ; Fri, 2 Oct 2015 16:27:58 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from ilsoft.org (unknown [73.34.117.227]) by outbound1.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Fri, 2 Oct 2015 16:28:39 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id t92GRuLr020777; Fri, 2 Oct 2015 10:27:56 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1443803276.66572.72.camel@freebsd.org> Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Ian Lepore To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 10:27:56 -0600 In-Reply-To: <20151002152059.GY11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.10 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 16:27:59 -0000 On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > Some arm documentation refers to the need for "support code" when the > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > be just the RPi I think). Do we have that support code? What happens > > if it's missing? I can't actually find any info on exactly what that > > support code is supposed to do. For all I know, we have the required > > code in libm. Or maybe what's needed is exception-handling code in the > > kernel. I can't find any info on what they mean by "support code" in > > this context. > The fpscr register is user-modifiable, so whatever happens after the > change, could as well happen before it. > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > Flush-to-zero. But I was sure that the text refers to the modes when > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > fault handler must do something to allow the computation to proceed. > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > looked in a few of the TRMs for different cortex-a series processors and > > they say the hardware handles all combinations of rounding and flush to > > zero without support software. But we should probably be on the lookout > > for reports of misbehaving apps on RPi after this change, just in case > > this setting has been protecting us from our ignorance there. > > I did found the reference to the support code in the VFP11 TRM, which in > turns point to > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > indeed I would need to not enable FZ on the affected hardware. > That link opened a reference to a cortex-a57 chip for me. I've had problems trying to share links to arm's documentation site, something about the way that navbar stuff works makes pasting links not-work. We support one arm11/VFPv2 chipset, the one used on RPi. It's the only actual armv6 chip we support, all the other stuff supported by the arch we call armv6 is really armv7. The TRM for the arm1176JZF-S core used on RPi is the one that mentions needing support code. -- Ian From owner-svn-src-head@freebsd.org Fri Oct 2 16:33:40 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFE1EA0EBDD; Fri, 2 Oct 2015 16:33:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CC201CFE; Fri, 2 Oct 2015 16:33:40 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igbni9 with SMTP id ni9so20087091igb.0; Fri, 02 Oct 2015 09:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KvW7vBCRCdXgAm1mqloHmqF4Fhx5taqEZoZIJahXO94=; b=0a+pCOH/S4XgEVQi8tK5wqJx6A23vOH5BDy9TKKYxiupqZ762R+eZ7NBMw8zur87NR kFIC8GTI4TtFEdv4XQEGF4oqsTgZjYKF440TMqYnZJuRziFk0ih4RXRiHBbIOZpGK+rC TRSDlv+csm9lV7KlZfrq+LMqzCQlQM0YHSJSeL7s4kqK3IiASqk/j1cmpOjmz+h9EKL2 MCXtKD/KVLjhikigNk6GHsIBFoEsStKFxDo1aen0YYaoJgMAPm8OILSL8RTOiMF5U06q 7vpzlh21gJn5UKnIbI6L1s2dROyo8UXUKmThzkTcez32KtSuDkLJB9Qee9sIPhT1aWjo TikQ== MIME-Version: 1.0 X-Received: by 10.50.64.243 with SMTP id r19mr5028113igs.22.1443803620079; Fri, 02 Oct 2015 09:33:40 -0700 (PDT) Received: by 10.36.46.15 with HTTP; Fri, 2 Oct 2015 09:33:40 -0700 (PDT) In-Reply-To: <201510021326.t92DQ0Ds002986@repo.freebsd.org> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> Date: Fri, 2 Oct 2015 09:33:40 -0700 Message-ID: Subject: Re: svn commit: r288492 - head/sys/arm/arm From: Adrian Chadd To: Konstantin Belousov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 16:33:40 -0000 Hi, When you run this stuff on ARM (and MIPS, too) - would you please report in the commit message(s) which platforms you ran it on? I'd hate to see this break an existing platform that it mostly works on just to fix it on a platform it doesn't. -a On 2 October 2015 at 06:26, Konstantin Belousov wrote: > Author: kib > Date: Fri Oct 2 13:25:59 2015 > New Revision: 288492 > URL: https://svnweb.freebsd.org/changeset/base/288492 > > Log: > Do not set 'flush to zero' VFPSCR_FZ bit by default. The correct > implementation of IEEE 754 arithmetic depends on denormals operating > correctly. Both perl test suite and paranoia tripped over the > setting. > > Reported by: Stefan Parvu > Discussed with: andrew > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/arm/arm/machdep.c > head/sys/arm/arm/vm_machdep.c > > Modified: head/sys/arm/arm/machdep.c > ============================================================================== > --- head/sys/arm/arm/machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -1069,7 +1069,7 @@ init_proc0(vm_offset_t kstack) > (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; > thread0.td_pcb->pcb_flags = 0; > thread0.td_pcb->pcb_vfpcpu = -1; > - thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; > thread0.td_frame = &proc0_tf; > pcpup->pc_curpcb = thread0.td_pcb; > } > > Modified: head/sys/arm/arm/vm_machdep.c > ============================================================================== > --- head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:21:08 2015 (r288491) > +++ head/sys/arm/arm/vm_machdep.c Fri Oct 2 13:25:59 2015 (r288492) > @@ -134,7 +134,7 @@ cpu_fork(register struct thread *td1, re > pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame); > > pcb2->pcb_vfpcpu = -1; > - pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ; > + pcb2->pcb_vfpstate.fpscr = VFPSCR_DN; > > tf = td2->td_frame; > tf->tf_spsr &= ~PSR_C; > From owner-svn-src-head@freebsd.org Fri Oct 2 16:35:41 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6C32A0ED0F; Fri, 2 Oct 2015 16:35:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D73581EB1; Fri, 2 Oct 2015 16:35:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92GZfn6082398; Fri, 2 Oct 2015 16:35:41 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92GZf6j082397; Fri, 2 Oct 2015 16:35:41 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201510021635.t92GZf6j082397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 2 Oct 2015 16:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288510 - head/usr.sbin/rpcbind X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 16:35:42 -0000 Author: delphij Date: Fri Oct 2 16:35:41 2015 New Revision: 288510 URL: https://svnweb.freebsd.org/changeset/base/288510 Log: Fix a regression with SA-15:24 patch that prevented NIS from working. Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c ============================================================================== --- head/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:30:54 2015 (r288509) +++ head/usr.sbin/rpcbind/rpcb_svc_com.c Fri Oct 2 16:35:41 2015 (r288510) @@ -1052,12 +1052,15 @@ static bool_t netbuf_copybuf(struct netbuf *dst, const struct netbuf *src) { - assert(dst->buf == NULL); + if (dst->len != src->len || dst->buf == NULL) { + if (dst->buf != NULL) + free(dst->buf); + if ((dst->buf = malloc(src->len)) == NULL) + return (FALSE); - if ((dst->buf = malloc(src->len)) == NULL) - return (FALSE); + dst->maxlen = dst->len = src->len; + } - dst->maxlen = dst->len = src->len; memcpy(dst->buf, src->buf, src->len); return (TRUE); } From owner-svn-src-head@freebsd.org Fri Oct 2 17:51:48 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DA2EA0E0CB; Fri, 2 Oct 2015 17:51:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AF0B1D37; Fri, 2 Oct 2015 17:51:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92HpmZH020719; Fri, 2 Oct 2015 17:51:48 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92Hpm9I020718; Fri, 2 Oct 2015 17:51:48 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021751.t92Hpm9I020718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288513 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 17:51:48 -0000 Author: bdrewery Date: Fri Oct 2 17:51:47 2015 New Revision: 288513 URL: https://svnweb.freebsd.org/changeset/base/288513 Log: /usr/src/games was removed in r288485. Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Fri Oct 2 16:37:06 2015 (r288512) +++ head/share/man/man7/hier.7 Fri Oct 2 17:51:47 2015 (r288513) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 14, 2015 +.Dd October 2, 2015 .Dt HIER 7 .Os .Sh NAME @@ -685,9 +685,6 @@ source code for contributed cryptography .It Pa etc/ source code for files in .Pa /etc -.It Pa games/ -source code for files in -.Pa /usr/games .It Pa gnu/ Utilities covered by the GNU General Public License .It Pa include/ From owner-svn-src-head@freebsd.org Fri Oct 2 17:54:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D55AA0E2D4; Fri, 2 Oct 2015 17:54:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D58C1F55; Fri, 2 Oct 2015 17:54:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92Hs6At020960; Fri, 2 Oct 2015 17:54:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92Hs6GH020959; Fri, 2 Oct 2015 17:54:06 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021754.t92Hs6GH020959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288514 - head/targets/pseudo/userland/games X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 17:54:06 -0000 Author: bdrewery Date: Fri Oct 2 17:54:05 2015 New Revision: 288514 URL: https://svnweb.freebsd.org/changeset/base/288514 Log: Remove defunct games removed in r279150. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/userland/games/Makefile.depend Modified: head/targets/pseudo/userland/games/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:51:47 2015 (r288513) +++ head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:54:05 2015 (r288514) @@ -3,7 +3,6 @@ # This file is not autogenerated - take care! DIRDEPS = \ - games/bcd \ games/caesar \ games/factor \ games/fortune/fortune \ @@ -14,7 +13,6 @@ DIRDEPS = \ games/morse \ games/number \ games/pom \ - games/ppt \ games/primes \ games/random \ From owner-svn-src-head@freebsd.org Fri Oct 2 17:58:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E827A0E6D8; Fri, 2 Oct 2015 17:58:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E75D11E8; Fri, 2 Oct 2015 17:58:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92HwHXd021186; Fri, 2 Oct 2015 17:58:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92HwHhA021185; Fri, 2 Oct 2015 17:58:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510021758.t92HwHhA021185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 2 Oct 2015 17:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288515 - head/targets/pseudo/userland/games X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 17:58:17 -0000 Author: bdrewery Date: Fri Oct 2 17:58:16 2015 New Revision: 288515 URL: https://svnweb.freebsd.org/changeset/base/288515 Log: All the games moved to usr.bin/ in r288485. Sponsored by: EMC / Isilon Storage Division Modified: head/targets/pseudo/userland/games/Makefile.depend Modified: head/targets/pseudo/userland/games/Makefile.depend ============================================================================== --- head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:54:05 2015 (r288514) +++ head/targets/pseudo/userland/games/Makefile.depend Fri Oct 2 17:58:16 2015 (r288515) @@ -3,18 +3,18 @@ # This file is not autogenerated - take care! DIRDEPS = \ - games/caesar \ - games/factor \ - games/fortune/fortune \ - games/fortune/strfile \ - games/fortune/datfiles \ - games/fortune/unstr \ - games/grdc \ - games/morse \ - games/number \ - games/pom \ - games/primes \ - games/random \ + usr.bin/caesar \ + usr.bin/factor \ + usr.bin/fortune/fortune \ + usr.bin/fortune/strfile \ + usr.bin/fortune/datfiles \ + usr.bin/fortune/unstr \ + usr.bin/grdc \ + usr.bin/morse \ + usr.bin/number \ + usr.bin/pom \ + usr.bin/primes \ + usr.bin/random \ .include From owner-svn-src-head@freebsd.org Fri Oct 2 18:04:43 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE1F5A0EC51; Fri, 2 Oct 2015 18:04:43 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89DD6184D; Fri, 2 Oct 2015 18:04:43 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVL00ARJU7SRI00@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 18:04:43 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020227 Message-id: <1443809080.13078.13.camel@me.com> Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Rui Paulo To: Adrian Chadd , Warner Losh Cc: John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 02 Oct 2015 11:04:40 -0700 In-reply-to: References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 18:04:43 -0000 On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: > ... I'm confused about the "load it by hand" stuff in net80211. Why > don't we just do the kldload at that point? > I was talking about ieee80211_load_module. net80211 module auto loading doesn't work probably because kern_kldload() can't be called from certain contexts. -- Rui Paulo From owner-svn-src-head@freebsd.org Fri Oct 2 18:55:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFE94A0D1AA; Fri, 2 Oct 2015 18:55:01 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8ED44104D; Fri, 2 Oct 2015 18:55:01 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVL00GF3TRHHX30@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 17:54:55 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=2.57571741713036e-14 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020225 Message-id: <1443808493.13078.11.camel@me.com> Subject: Re: svn commit: r288362 - head/sys/cddl/dev/sdt From: Rui Paulo To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 02 Oct 2015 10:54:53 -0700 In-reply-to: <201509291158.t8TBwLd1052484@repo.freebsd.org> References: <201509291158.t8TBwLd1052484@repo.freebsd.org> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 18:55:01 -0000 On Tue, 2015-09-29 at 11:58 +0000, Andriy Gapon wrote: > Author: avg > Date: Tue Sep 29 11:58:21 2015 > New Revision: 288362 > URL: https://svnweb.freebsd.org/changeset/base/288362 > > Log: > sdt: start checking version field when parsing probe definitions > > This is an extra safety measure. > > MFC after: 21 days > > Modified: > head/sys/cddl/dev/sdt/sdt.c > > Modified: head/sys/cddl/dev/sdt/sdt.c > ===================================================================== > ========= > --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 > (r288361) > +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 > (r288362) > @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe > char *to; > size_t len; > > + if (probe->version != (int)sizeof(*probe)) { > + printf("ignoring probe %p, version %u expected > %u\n", > + probe, probe->version, (int)sizeof(*probe)); > + return; > + } > + > Not picking on your change, but this version management sounds like a bad idea to me... -- Rui Paulo From owner-svn-src-head@freebsd.org Fri Oct 2 19:10:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC7B8A0DF45; Fri, 2 Oct 2015 19:10:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-ig0-x22f.google.com (mail-ig0-x22f.google.com [IPv6:2607:f8b0:4001:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6BBB1A2A; Fri, 2 Oct 2015 19:10:52 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by igcpb10 with SMTP id pb10so25598787igc.1; Fri, 02 Oct 2015 12:10:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5sQI3ICgIkxbxfiKHKRFfjvGA0yuj2QtMm9dFVFrmEc=; b=ASm7D8UugUEQfe7IQtKmpT2rbzmeP4wH6eeGMwS/QR5f/goLz4MDyBUueCz+VfQxRO y/JaFWh2vpKDbHEGq98811QsvmOqe9nJUrV0Y4XuheByL8Yz+/zFT9gbnlGmoAL6L05/ XX0bnj5hfyXeo4slectXmwPcvGK4TTVodGnf1pg47lNKOqTjNVGwAkjKtHOGcwieYyHi IRXI79bhJ+Pmx+hb67Sfw42RENcQ/QEDB7gdcr3xT0nFTRbXGuUvPm2F3M+wMFebLSBA e4Xk1BogVu9Isv2R7jnrmcWLmgrkmndy40ODliJ6D9PQXwUZhTvYTEFiEJPyJJCrirtW Ji1g== MIME-Version: 1.0 X-Received: by 10.50.61.243 with SMTP id t19mr627699igr.22.1443813052055; Fri, 02 Oct 2015 12:10:52 -0700 (PDT) Received: by 10.36.46.15 with HTTP; Fri, 2 Oct 2015 12:10:51 -0700 (PDT) In-Reply-To: <1443809080.13078.13.camel@me.com> References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> <1443809080.13078.13.camel@me.com> Date: Fri, 2 Oct 2015 12:10:51 -0700 Message-ID: Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Adrian Chadd To: Rui Paulo Cc: Warner Losh , John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 19:10:53 -0000 On 2 October 2015 at 11:04, Rui Paulo wrote: > On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: >> ... I'm confused about the "load it by hand" stuff in net80211. Why >> don't we just do the kldload at that point? >> > > I was talking about ieee80211_load_module. net80211 module auto > loading doesn't work probably because kern_kldload() can't be called > from certain contexts. hm, can we do it from a taskqueue? -a From owner-svn-src-head@freebsd.org Fri Oct 2 19:47:34 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1339AA0DC74; Fri, 2 Oct 2015 19:47:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id EA8F811EA; Fri, 2 Oct 2015 19:47:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA14952; Fri, 02 Oct 2015 22:47:29 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Zi6Ij-0000IG-4p; Fri, 02 Oct 2015 22:47:29 +0300 Subject: Re: svn commit: r288362 - head/sys/cddl/dev/sdt To: Rui Paulo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201509291158.t8TBwLd1052484@repo.freebsd.org> <1443808493.13078.11.camel@me.com> From: Andriy Gapon Message-ID: <560EDEF6.8050009@FreeBSD.org> Date: Fri, 2 Oct 2015 22:45:58 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1443808493.13078.11.camel@me.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 19:47:34 -0000 On 02/10/2015 20:54, Rui Paulo wrote: > On Tue, 2015-09-29 at 11:58 +0000, Andriy Gapon wrote: >> Author: avg >> Date: Tue Sep 29 11:58:21 2015 >> New Revision: 288362 >> URL: https://svnweb.freebsd.org/changeset/base/288362 >> >> Log: >> sdt: start checking version field when parsing probe definitions >> >> This is an extra safety measure. >> >> MFC after: 21 days >> >> Modified: >> head/sys/cddl/dev/sdt/sdt.c >> >> Modified: head/sys/cddl/dev/sdt/sdt.c >> ===================================================================== >> ========= >> --- head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:55:26 2015 >> (r288361) >> +++ head/sys/cddl/dev/sdt/sdt.c Tue Sep 29 11:58:21 2015 >> (r288362) >> @@ -141,6 +141,12 @@ sdt_create_probe(struct sdt_probe *probe >> char *to; >> size_t len; >> >> + if (probe->version != (int)sizeof(*probe)) { >> + printf("ignoring probe %p, version %u expected >> %u\n", >> + probe, probe->version, (int)sizeof(*probe)); >> + return; >> + } >> + >> > > Not picking on your change, but this version management sounds like a > bad idea to me... > It's certainly not very robust, but I think that it's better than nothing. Having proper SDT binary layout versions would be better, of course. -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Oct 2 21:09:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A4A3A0EE8C; Fri, 2 Oct 2015 21:09:51 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE1DB1930; Fri, 2 Oct 2015 21:09:50 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92L9oHq001575; Fri, 2 Oct 2015 21:09:50 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92L9nvM001571; Fri, 2 Oct 2015 21:09:49 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510022109.t92L9nvM001571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 21:09:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288522 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 21:09:51 -0000 Author: grehan Date: Fri Oct 2 21:09:49 2015 New Revision: 288522 URL: https://svnweb.freebsd.org/changeset/base/288522 Log: Simple sysctl-like firmware query interface. Similar in operation to the qemu one, and uses the same i/o ports but with different messaging. Requires the 'bootrom' option to be enabled. This is used by UEFI (and potentially other BIOSs/firmware) to request information from bhyve. Currently, only the number of vCPUs is made available, with more to follow. A very large thankyou to Ben Perrault who helped out testing an earlier version of this, and bhyve/Windows in general. Reviewed by: tychon Discussed with: neel Sponsored by: Nahanni Systems Added: head/usr.sbin/bhyve/fwctl.c (contents, props changed) head/usr.sbin/bhyve/fwctl.h (contents, props changed) Modified: head/usr.sbin/bhyve/Makefile head/usr.sbin/bhyve/bhyverun.c Modified: head/usr.sbin/bhyve/Makefile ============================================================================== --- head/usr.sbin/bhyve/Makefile Fri Oct 2 20:13:56 2015 (r288521) +++ head/usr.sbin/bhyve/Makefile Fri Oct 2 21:09:49 2015 (r288522) @@ -16,6 +16,7 @@ SRCS= \ bootrom.c \ consport.c \ dbgport.c \ + fwctl.c \ inout.c \ ioapic.c \ mem.c \ Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Fri Oct 2 20:13:56 2015 (r288521) +++ head/usr.sbin/bhyve/bhyverun.c Fri Oct 2 21:09:49 2015 (r288522) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "inout.h" #include "dbgport.h" +#include "fwctl.h" #include "ioapic.h" #include "mem.h" #include "mevent.h" @@ -950,6 +951,9 @@ main(int argc, char *argv[]) assert(error == 0); } + if (lpc_bootrom()) + fwctl_init(); + /* * Change the proc title to include the VM name. */ Added: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/fwctl.c Fri Oct 2 21:09:49 2015 (r288522) @@ -0,0 +1,549 @@ +/*- + * Copyright (c) 2015 Peter Grehan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Guest firmware interface. Uses i/o ports x510/x511 as Qemu does, + * but with a request/response messaging protocol. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "bhyverun.h" +#include "inout.h" +#include "fwctl.h" + +/* + * Messaging protocol base operations + */ +#define OP_NULL 1 +#define OP_ECHO 2 +#define OP_GET 3 +#define OP_GET_LEN 4 +#define OP_SET 5 +#define OP_MAX OP_SET + +/* I/O ports */ +#define FWCTL_OUT 0x510 +#define FWCTL_IN 0x511 + +/* + * Back-end state-machine + */ +enum state { + DORMANT, + IDENT_WAIT, + IDENT_SEND, + REQ, + RESP +} be_state = DORMANT; + +static uint8_t sig[] = { 'B', 'H', 'Y', 'V' }; +static u_int ident_idx; + +struct op_info { + int op; + int (*op_start)(int len); + void (*op_data)(uint32_t data, int len); + int (*op_result)(struct iovec **data); + void (*op_done)(struct iovec *data); +}; +static struct op_info *ops[OP_MAX+1]; + +/* Return 0-padded uint32_t */ +static uint32_t +fwctl_send_rest(uint32_t *data, size_t len) +{ + union { + uint8_t c[4]; + uint32_t w; + } u; + uint8_t *cdata; + int i; + + cdata = (uint8_t *) data; + u.w = 0; + + for (i = 0, u.w = 0; i < len; i++) + u.c[i] = *cdata++; + + return (u.w); +} + +/* + * error op dummy proto - drop all data sent and return an error +*/ +static int errop_code; + +static void +errop_set(int err) +{ + + errop_code = err; +} + +static int +errop_start(int len) +{ + errop_code = ENOENT; + + /* accept any length */ + return (errop_code); +} + +static void +errop_data(uint32_t data, int len) +{ + + /* ignore */ +} + +static int +errop_result(struct iovec **data) +{ + + /* no data to send back; always successful */ + *data = NULL; + return (errop_code); +} + +static void +errop_done(struct iovec *data) +{ + + /* assert data is NULL */ +} + +static struct op_info errop_info = { + .op_start = errop_start, + .op_data = errop_data, + .op_result = errop_result, + .op_done = errop_done +}; + +/* OID search */ +SET_DECLARE(ctl_set, struct ctl); + +CTL_NODE("hw.ncpu", &guest_ncpus, sizeof(guest_ncpus)); + +static struct ctl * +ctl_locate(const char *str, int maxlen) +{ + struct ctl *cp, **cpp; + + SET_FOREACH(cpp, ctl_set) { + cp = *cpp; + if (!strncmp(str, cp->c_oid, maxlen)) + return (cp); + } + + return (NULL); +} + +/* uefi-sysctl get-len */ +#define FGET_STRSZ 80 +static struct iovec fget_biov[2]; +static char fget_str[FGET_STRSZ]; +static struct { + size_t f_sz; + uint32_t f_data[1024]; +} fget_buf; +static int fget_cnt; +static size_t fget_size; + +static int +fget_start(int len) +{ + + if (len > FGET_STRSZ) + return(E2BIG); + + fget_cnt = 0; + + return (0); +} + +static void +fget_data(uint32_t data, int len) +{ + + *((uint32_t *) &fget_str[fget_cnt]) = data; + fget_cnt += sizeof(uint32_t); +} + +static int +fget_result(struct iovec **data, int val) +{ + struct ctl *cp; + int err; + + err = 0; + + /* Locate the OID */ + cp = ctl_locate(fget_str, fget_cnt); + if (cp == NULL) { + *data = NULL; + err = ENOENT; + } else { + if (val) { + /* For now, copy the len/data into a buffer */ + memset(&fget_buf, 0, sizeof(fget_buf)); + fget_buf.f_sz = cp->c_len; + memcpy(fget_buf.f_data, cp->c_data, cp->c_len); + fget_biov[0].iov_base = (char *)&fget_buf; + fget_biov[0].iov_len = sizeof(fget_buf.f_sz) + + cp->c_len; + } else { + fget_size = cp->c_len; + fget_biov[0].iov_base = (char *)&fget_size; + fget_biov[0].iov_len = sizeof(fget_size); + } + + fget_biov[1].iov_base = NULL; + fget_biov[1].iov_len = 0; + *data = fget_biov; + } + + return (err); +} + +static void +fget_done(struct iovec *data) +{ + + /* nothing needs to be freed */ +} + +static int +fget_len_result(struct iovec **data) +{ + return (fget_result(data, 0)); +} + +static int +fget_val_result(struct iovec **data) +{ + return (fget_result(data, 1)); +} + +static struct op_info fgetlen_info = { + .op_start = fget_start, + .op_data = fget_data, + .op_result = fget_len_result, + .op_done = fget_done +}; + +static struct op_info fgetval_info = { + .op_start = fget_start, + .op_data = fget_data, + .op_result = fget_val_result, + .op_done = fget_done +}; + +static struct req_info { + int req_error; + u_int req_count; + uint32_t req_size; + uint32_t req_type; + uint32_t req_txid; + struct op_info *req_op; + int resp_error; + int resp_count; + int resp_size; + int resp_off; + struct iovec *resp_biov; +} rinfo; + +static void +fwctl_response_done(void) +{ + + (*rinfo.req_op->op_done)(rinfo.resp_biov); + + /* reinit the req data struct */ + memset(&rinfo, 0, sizeof(rinfo)); +} + +static void +fwctl_request_done(void) +{ + + rinfo.resp_error = (*rinfo.req_op->op_result)(&rinfo.resp_biov); + + /* XXX only a single vector supported at the moment */ + rinfo.resp_off = 0; + if (rinfo.resp_biov == NULL) { + rinfo.resp_size = 0; + } else { + rinfo.resp_size = rinfo.resp_biov[0].iov_len; + } +} + +static int +fwctl_request_start(void) +{ + int err; + + /* Data size doesn't include header */ + rinfo.req_size -= 12; + + rinfo.req_op = &errop_info; + if (rinfo.req_type <= OP_MAX && ops[rinfo.req_type] != NULL) + rinfo.req_op = ops[rinfo.req_type]; + + err = (*rinfo.req_op->op_start)(rinfo.req_size); + + if (err) { + errop_set(err); + rinfo.req_op = &errop_info; + } + + /* Catch case of zero-length message here */ + if (rinfo.req_size == 0) { + fwctl_request_done(); + return (1); + } + + return (0); +} + +static int +fwctl_request_data(uint32_t value) +{ + int remlen; + + /* Make sure remaining size is >= 0 */ + rinfo.req_size -= sizeof(uint32_t); + remlen = (rinfo.req_size > 0) ? rinfo.req_size: 0; + + (*rinfo.req_op->op_data)(value, remlen); + + if (rinfo.req_size < sizeof(uint32_t)) { + fwctl_request_done(); + return (1); + } + + return (0); +} + +static int +fwctl_request(uint32_t value) +{ + + int ret; + + ret = 0; + + switch (rinfo.req_count) { + case 0: + /* Verify size */ + if (value < 12) { + printf("msg size error"); + exit(1); + } + rinfo.req_size = value; + rinfo.req_count = 1; + break; + case 1: + rinfo.req_type = value; + rinfo.req_count++; + break; + case 2: + rinfo.req_txid = value; + rinfo.req_count++; + ret = fwctl_request_start(); + break; + default: + ret = fwctl_request_data(value); + break; + } + + return (ret); +} + +static int +fwctl_response(uint32_t *retval) +{ + uint32_t *dp; + int remlen; + + switch(rinfo.resp_count) { + case 0: + /* 4 x u32 header len + data */ + *retval = 4*sizeof(uint32_t) + + roundup(rinfo.resp_size, sizeof(uint32_t)); + rinfo.resp_count++; + break; + case 1: + *retval = rinfo.req_type; + rinfo.resp_count++; + break; + case 2: + *retval = rinfo.req_txid; + rinfo.resp_count++; + break; + case 3: + *retval = rinfo.resp_error; + rinfo.resp_count++; + break; + default: + remlen = rinfo.resp_size - rinfo.resp_off; + dp = (uint32_t *) + ((uint8_t *)rinfo.resp_biov->iov_base + rinfo.resp_off); + if (remlen >= sizeof(uint32_t)) { + *retval = *dp; + } else if (remlen > 0) { + *retval = fwctl_send_rest(dp, remlen); + } + rinfo.resp_off += sizeof(uint32_t); + break; + } + + if (rinfo.resp_count > 3 && + rinfo.resp_size - rinfo.resp_off <= 0) { + fwctl_response_done(); + return (1); + } + + return (0); +} + + +/* + * i/o port handling. + */ +static uint8_t +fwctl_inb(void) +{ + uint8_t retval; + + retval = 0xff; + + switch (be_state) { + case IDENT_SEND: + retval = sig[ident_idx++]; + if (ident_idx >= sizeof(sig)) + be_state = REQ; + break; + default: + break; + } + + return (retval); +} + +static void +fwctl_outw(uint16_t val) +{ + switch (be_state) { + case IDENT_WAIT: + if (val == 0) { + be_state = IDENT_SEND; + ident_idx = 0; + } + break; + default: + /* ignore */ + break; + } +} + +static uint32_t +fwctl_inl(void) +{ + uint32_t retval; + + switch (be_state) { + case RESP: + if (fwctl_response(&retval)) + be_state = REQ; + break; + default: + retval = 0xffffffff; + break; + } + + return (retval); +} + +static void +fwctl_outl(uint32_t val) +{ + + switch (be_state) { + case REQ: + if (fwctl_request(val)) + be_state = RESP; + default: + break; + } + +} + +static int +fwctl_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, + uint32_t *eax, void *arg) +{ + + if (in) { + if (bytes == 1) + *eax = fwctl_inb(); + else if (bytes == 4) + *eax = fwctl_inl(); + else + *eax = 0xffff; + } else { + if (bytes == 2) + fwctl_outw(*eax); + else if (bytes == 4) + fwctl_outl(*eax); + } + + return (0); +} +INOUT_PORT(fwctl_wreg, FWCTL_OUT, IOPORT_F_INOUT, fwctl_handler); +INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_OUT, fwctl_handler); + +void +fwctl_init(void) +{ + + ops[OP_GET_LEN] = &fgetlen_info; + ops[OP_GET] = &fgetval_info; + + be_state = IDENT_WAIT; +} Added: head/usr.sbin/bhyve/fwctl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bhyve/fwctl.h Fri Oct 2 21:09:49 2015 (r288522) @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2015 Peter Grehan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _FWCTL_H_ +#define _FWCTL_H_ + +#include + +/* + * Linker set api for export of information to guest firmware via + * a sysctl-like OID interface + */ +struct ctl { + const char *c_oid; + const void *c_data; + const int c_len; +}; + +#define CTL_NODE(oid, data, len) \ + static struct ctl __CONCAT(__ctl, __LINE__) = { \ + oid, \ + (data), \ + (len), \ + }; \ + DATA_SET(ctl_set, __CONCAT(__ctl, __LINE__)) + +void fwctl_init(void); + +#endif /* _FWCTL_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 2 21:25:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56302A0EB21; Fri, 2 Oct 2015 21:25:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439E01245; Fri, 2 Oct 2015 21:25:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92LPpDO009625; Fri, 2 Oct 2015 21:25:51 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92LPnbR009619; Fri, 2 Oct 2015 21:25:49 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510022125.t92LPnbR009619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 2 Oct 2015 21:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288523 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 21:25:51 -0000 Author: adrian Date: Fri Oct 2 21:25:48 2015 New Revision: 288523 URL: https://svnweb.freebsd.org/changeset/base/288523 Log: net80211: separate ieee80211_crypto_get_keyid() from ieee80211_crypto_encap() Tested: * rum(4), STA mode * rsu(4), STA mode * urtwn(4), STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3637 Modified: head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_none.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto.c Fri Oct 2 21:25:48 2015 (r288523) @@ -521,6 +521,16 @@ ieee80211_crypto_setkey(struct ieee80211 return dev_key_set(vap, key); } +uint8_t +ieee80211_crypto_get_keyid(struct ieee80211vap *vap, struct ieee80211_key *k) +{ + if (k >= &vap->iv_nw_keys[0] && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]) + return (k - vap->iv_nw_keys); + else + return (0); +} + /* * Add privacy headers appropriate for the specified key. */ @@ -531,7 +541,6 @@ ieee80211_crypto_encap(struct ieee80211_ struct ieee80211_key *k; struct ieee80211_frame *wh; const struct ieee80211_cipher *cip; - uint8_t keyid; /* * Multicast traffic always uses the multicast key. @@ -550,14 +559,12 @@ ieee80211_crypto_encap(struct ieee80211_ vap->iv_stats.is_tx_nodefkey++; return NULL; } - keyid = vap->iv_def_txkey; k = &vap->iv_nw_keys[vap->iv_def_txkey]; - } else { - keyid = 0; + } else k = &ni->ni_ucastkey; - } + cip = k->wk_cipher; - return (cip->ic_encap(k, m, keyid<<6) ? k : NULL); + return (cip->ic_encap(k, m) ? k : NULL); } /* Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto.h Fri Oct 2 21:25:48 2015 (r288523) @@ -178,8 +178,7 @@ struct ieee80211_cipher { void* (*ic_attach)(struct ieee80211vap *, struct ieee80211_key *); void (*ic_detach)(struct ieee80211_key *); int (*ic_setkey)(struct ieee80211_key *); - int (*ic_encap)(struct ieee80211_key *, struct mbuf *, - uint8_t keyid); + int (*ic_encap)(struct ieee80211_key *, struct mbuf *); int (*ic_decap)(struct ieee80211_key *, struct mbuf *, int); int (*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); int (*ic_demic)(struct ieee80211_key *, struct mbuf *, int); @@ -193,6 +192,8 @@ void ieee80211_crypto_register(const str void ieee80211_crypto_unregister(const struct ieee80211_cipher *); int ieee80211_crypto_available(u_int cipher); +uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, + struct ieee80211_key *k); struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *); struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Fri Oct 2 21:25:48 2015 (r288523) @@ -63,7 +63,7 @@ struct ccmp_ctx { static void *ccmp_attach(struct ieee80211vap *, struct ieee80211_key *); static void ccmp_detach(struct ieee80211_key *); static int ccmp_setkey(struct ieee80211_key *); -static int ccmp_encap(struct ieee80211_key *k, struct mbuf *, uint8_t keyid); +static int ccmp_encap(struct ieee80211_key *, struct mbuf *); static int ccmp_decap(struct ieee80211_key *, struct mbuf *, int); static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int); static int ccmp_demic(struct ieee80211_key *, struct mbuf *, int); @@ -138,11 +138,13 @@ ccmp_setkey(struct ieee80211_key *k) * Add privacy headers appropriate for the specified key. */ static int -ccmp_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +ccmp_encap(struct ieee80211_key *k, struct mbuf *m) { struct ccmp_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->cc_ic; + struct ieee80211vap *vap = ctx->cc_vap; uint8_t *ivp; + uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -157,6 +159,8 @@ ccmp_encap(struct ieee80211_key *k, stru ovbcopy(ivp + ccmp.ic_header, ivp, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + k->wk_keytsc++; /* XXX wrap at 48 bits */ ivp[0] = k->wk_keytsc >> 0; /* PN0 */ ivp[1] = k->wk_keytsc >> 8; /* PN1 */ Modified: head/sys/net80211/ieee80211_crypto_none.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_none.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_none.c Fri Oct 2 21:25:48 2015 (r288523) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); static void *none_attach(struct ieee80211vap *, struct ieee80211_key *); static void none_detach(struct ieee80211_key *); static int none_setkey(struct ieee80211_key *); -static int none_encap(struct ieee80211_key *, struct mbuf *, uint8_t); +static int none_encap(struct ieee80211_key *, struct mbuf *); static int none_decap(struct ieee80211_key *, struct mbuf *, int); static int none_enmic(struct ieee80211_key *, struct mbuf *, int); static int none_demic(struct ieee80211_key *, struct mbuf *, int); @@ -88,19 +88,22 @@ none_setkey(struct ieee80211_key *k) } static int -none_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +none_encap(struct ieee80211_key *k, struct mbuf *m) { struct ieee80211vap *vap = k->wk_private; #ifdef IEEE80211_DEBUG struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); #endif + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k); /* * The specified key is not setup; this can * happen, at least, when changing keys. */ IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr1, - "key id %u is not set (encap)", keyid>>6); + "key id %u is not set (encap)", keyid); vap->iv_stats.is_tx_badcipher++; return 0; } Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 21:25:48 2015 (r288523) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); static void *tkip_attach(struct ieee80211vap *, struct ieee80211_key *); static void tkip_detach(struct ieee80211_key *); static int tkip_setkey(struct ieee80211_key *); -static int tkip_encap(struct ieee80211_key *, struct mbuf *m, uint8_t keyid); +static int tkip_encap(struct ieee80211_key *, struct mbuf *); static int tkip_enmic(struct ieee80211_key *, struct mbuf *, int); static int tkip_decap(struct ieee80211_key *, struct mbuf *, int); static int tkip_demic(struct ieee80211_key *, struct mbuf *, int); @@ -152,12 +152,13 @@ tkip_setkey(struct ieee80211_key *k) * Add privacy headers and do any s/w encryption required. */ static int -tkip_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +tkip_encap(struct ieee80211_key *k, struct mbuf *m) { struct tkip_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211com *ic = vap->iv_ic; uint8_t *ivp; + uint8_t keyid; int hdrlen; /* @@ -185,6 +186,8 @@ tkip_encap(struct ieee80211_key *k, stru memmove(ivp, ivp + tkip.ic_header, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 21:09:49 2015 (r288522) +++ head/sys/net80211/ieee80211_crypto_wep.c Fri Oct 2 21:25:48 2015 (r288523) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); static void *wep_attach(struct ieee80211vap *, struct ieee80211_key *); static void wep_detach(struct ieee80211_key *); static int wep_setkey(struct ieee80211_key *); -static int wep_encap(struct ieee80211_key *, struct mbuf *, uint8_t keyid); +static int wep_encap(struct ieee80211_key *, struct mbuf *); static int wep_decap(struct ieee80211_key *, struct mbuf *, int hdrlen); static int wep_enmic(struct ieee80211_key *, struct mbuf *, int); static int wep_demic(struct ieee80211_key *, struct mbuf *, int); @@ -121,12 +121,14 @@ wep_setkey(struct ieee80211_key *k) * Add privacy headers appropriate for the specified key. */ static int -wep_encap(struct ieee80211_key *k, struct mbuf *m, uint8_t keyid) +wep_encap(struct ieee80211_key *k, struct mbuf *m) { struct wep_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->wc_vap; struct ieee80211com *ic = ctx->wc_ic; uint32_t iv; uint8_t *ivp; + uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -141,6 +143,8 @@ wep_encap(struct ieee80211_key *k, struc ovbcopy(ivp + wep.ic_header, ivp, hdrlen); ivp += hdrlen; + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + /* * XXX * IV must not duplicate during the lifetime of the key. From owner-svn-src-head@freebsd.org Fri Oct 2 21:43:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A7FAA0DE23; Fri, 2 Oct 2015 21:43:56 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from mr11p00im-asmtp001.me.com (mr11p00im-asmtp001.me.com [17.110.69.252]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E17D0118C; Fri, 2 Oct 2015 21:43:55 +0000 (UTC) (envelope-from rpaulo@me.com) Received: from akita.hsd1.ca.comcast.net (c-73-162-13-215.hsd1.ca.comcast.net [73.162.13.215]) by mr11p00im-asmtp001.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NVM005OA4D34W10@mr11p00im-asmtp001.me.com>; Fri, 02 Oct 2015 21:43:54 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-10-02_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=5.55111512312578e-17 compositescore=0.981618935876834 phishscore=0 kscore.is_spamscore=0 rbsscore=0.981618935876834 recipient_to_sender_totalscore=0 spamscore=0 urlsuspectscore=0.981618935876834 adultscore=0 kscore.compositescore=0 circleOfTrustscore=0 suspectscore=0 recipient_domain_to_sender_totalscore=0 bulkscore=0 recipient_domain_to_sender_domain_totalscore=0 recipient_to_sender_domain_totalscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1412110000 definitions=main-1510020274 Message-id: <1443822231.6210.1.camel@me.com> Subject: Re: svn commit: r287934 - head/sys/boot/efi/loader From: Rui Paulo To: Adrian Chadd Cc: Warner Losh , John Baldwin , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 02 Oct 2015 14:43:51 -0700 In-reply-to: References: <35a0f1b6-0236-4b0e-b919-00cab07429be@me.com> <5427AC7C-1B0B-4273-B758-DB0C1BDF656F@bsdimp.com> <1443064383.14580.3.camel@me.com> <1443809080.13078.13.camel@me.com> Content-type: text/plain; charset=UTF-8 X-Mailer: Evolution 3.16.5-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 21:43:56 -0000 On Fri, 2015-10-02 at 12:10 -0700, Adrian Chadd wrote: > On 2 October 2015 at 11:04, Rui Paulo wrote: > > On Thu, 2015-09-24 at 08:29 -0700, Adrian Chadd wrote: > > > ... I'm confused about the "load it by hand" stuff in net80211. > > > Why > > > don't we just do the kldload at that point? > > > > > > > I was talking about ieee80211_load_module. net80211 module auto > > loading doesn't work probably because kern_kldload() can't be > > called > > from certain contexts. > > hm, can we do it from a taskqueue? > Sure, but I suspect the caller might not want to sleep waiting for the taskqueue to terminate. I really haven't looked into it, sorry... It might be a better idea to check if the driver does software and/or hardware crypto and load the appropriate modules at that time. Then check which ratesel module should be used and load that as well. The list continues :-) -- Rui Paulo From owner-svn-src-head@freebsd.org Fri Oct 2 22:03:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9747BA0EF1D; Fri, 2 Oct 2015 22:03:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBCF10FE; Fri, 2 Oct 2015 22:03:13 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by qkbi190 with SMTP id i190so28539308qkb.1; Fri, 02 Oct 2015 15:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=gXtCJItkCVtZD4rweN72big2DC5728OWMoPGt+u54KA=; b=Nl6r6rijMFhm98AIItT8F7r6ejp2gTz0HGWoIFtpRFg0WnxDDH7UveoRrRl0wh4q9m aEb3PA16X15oJrAjHucKvh0j0DoYf3UQVDb1uRethFyIdvKZAKB6fUEnIz1/fs4ku2vq yLI3PtTIifZs5npiBczhfuTz7rIO62d5bmItsVDLDPZITkMcPaWN82l6gIII2dCaahNH 0Tjik6KIxcNksLTnh5XjU0Xyo7clXVRpVgDCKfm1/QW8cJq4bcA4HeKQctun8nFX/T0n epNsWrYIK7OHlkZf6lueq5S6570A1dDKdkM6iqOIAKe8sCgRO6PgoHBXLExK0N4pTMcn /y1Q== X-Received: by 10.55.49.75 with SMTP id x72mr23436605qkx.45.1443823392098; Fri, 02 Oct 2015 15:03:12 -0700 (PDT) Received: from muskytusk ([104.236.250.12]) by smtp.gmail.com with ESMTPSA id y12sm5519665qgd.20.2015.10.02.15.03.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 15:03:11 -0700 (PDT) Sender: Mark Johnston Date: Fri, 2 Oct 2015 22:02:34 +0000 From: Mark Johnston To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288431 - in head/sys: kern sys vm Message-ID: <20151002220234.GA58210@muskytusk> References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> <4276391.z2UvhhORjP@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <4276391.z2UvhhORjP@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 22:03:13 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 02, 2015 at 08:59:33AM -0700, John Baldwin wrote: > On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: > > On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: > > > On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: > > > > Author: markj > > > > Date: Wed Sep 30 23:06:29 2015 > > > > New Revision: 288431 > > > > URL: https://svnweb.freebsd.org/changeset/base/288431 > > > > > > > > Log: > > > > As a step towards the elimination of PG_CACHED pages, rework the handling > > > > of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to > > > > the head of the inactive queue instead of being cached. > > > > > > > > This affects the implementation of POSIX_FADV_NOREUSE as well, since it > > > > works by applying POSIX_FADV_DONTNEED to file ranges after they have been > > > > read or written. At that point the corresponding buffers may still be > > > > dirty, so the previous implementation would coalesce successive ranges and > > > > apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the > > > > dirty buffers would eventually be cached. To preserve this behaviour in an > > > > efficient manner, this change adds a new buf flag, B_NOREUSE, which causes > > > > the pages backing a VMIO buf to be placed at the head of the inactive queue > > > > when the buf is released. POSIX_FADV_NOREUSE then works by setting this > > > > flag in bufs that underlie the specified range. > > > > > > Putting these pages back on the inactive queue completely defeats the primary > > > purpose of DONTNEED and NOREUSE. The primary purpose is to move the pages out > > > of the VM object's tree of pages and into the free pool so that the application > > > can instruct the VM to free memory more efficiently than relying on page daemon. > > > > > > The implementation used cache pages instead of free as a cheap optimization so > > > that if an application did something dumb where it used DONTNEED and then turned > > > around and read the file it would not have to go to disk if the pages had not > > > yet been reused. In practice this didn't work out so well because PG_CACHE pages > > > don't really work well. > > > > > > However, using PG_CACHE was secondary to the primary purpose of explicitly freeing > > > memory that an application knew wasn't going to be reused and avoiding the need > > > for pagedaemon to run at all. I think this should be freeing the pages instead of > > > keeping them inactive. If an application uses DONTNEED or NOREUSE and then turns > > > around and rereads the file, it generally deserves to have to go to disk for it. > > > > A problem with this is that one application's DONTNEED or NOREUSE hint > > would cause every application reading or writing that file to go to > > disk, but posix_fadvise(2) is explicitly intended for applications that > > wish to provide hints about their own access patterns. I realize that > > it's typically used with application-private files, but that's not a > > requirement of the interface. Deactivating (or caching) the backing > > pages generally avoids this problem. > > I think it is not unreasonble to expect that fadvise() incurs system-wide > affects. A properly implemented WILLNEED that does read-ahead cannot work > without incurring system-wide effects. I had always assumed that fadvise() > operated on a file, not a given process' view of a file (unlike, say, > madvise which only operates on mappings and only indirectly affects > file-backed data). Well, that's even true of read(): two processes reading the same file may affect each other if one primes the buffer cache with blocks as the second process is reading them. DONTNEED and NOREUSE would specifically pessimize all processes using the file if they were to cause backing pages to be freed, though. > > > > I'm pretty sure I had mentioned this to Alan before. I believe that the idea is > > > that pagedaemon should be cheap enough that having it run anyway shouldn't be an > > > issue, but I'm a bit skeptical of that. :) Lock contention is always possible and > > > having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock contention with > > > pagedaemon during application page faults (since pagedaemon potentially never has > > > to run). > > > > That's true, but the page queue locking (and the pagedaemon's > > manipulation of the page queue locks) has also become more fine-grained > > since posix_fadvise(2) was added. In particular, from some reading of > > sys/vm in stable/8, inactive queue scans used to be performed with the > > global page queue lock held; it was only dropped to launder dirty pages. > > Now, the page queue lock is split into separate locks for the active and > > inactive page queues, and the pagedaemon drops the inactive queue lock > > for each page in all but a few exceptional cases. Does the optimization > > of freeing or caching DONTNEED pages buy us all that much now? > > > > Some synthetic testing in which an application writes out many large > > (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one shows > > no significant difference in runtime if the buffer pages are deactivated > > vs. freed. (My test just modifies vfs_vmio_unwire() to treat B_NOREUSE > > identically to B_DIRECT.) Unsurprisingly, I see very little lock > > contention in the latter case, but in the former, most of the lock > > contention is short (i.e. the mutex is acquired while spinning), and > > a large majority of the contention is on the free page queue mutex. If > > lock contention there is a concern, wouldn't it be better to try and > > address that directly rather than by bypassing the pagedaemon? > > The lock contention was related to one process faulting in a new page due to > a malloc() while pagedaemon ran. Also, it wasn't a steady type of contention > that would show up in an average. Instead, it was the outliers (which in the > case on 8.x were on the order of 2 seconds) that were problematic. I used a > hack to log "long" wait times for specific processes to both debug this and > evaluate the solution. I have a test program laying around from when I last > tested this. I'll see what I can reproduce (before it required a machine > with at least 24GB of RAM to reproduce). Thanks! FWIW, I found the attached patch convenient for testing and benchmarking fadvise; it adds iadvice and oadvice parameters to dd(1). > > The only foolproof way to reduce contention to zero is to eliminate one of > the contending threads. :) I do think there are situations where an > application may be more informed about the optimal memory pattern for its > workload than what the VM system can infer from heuristics. Currently there > is no other way to flush a file's contents from RAM. If we had things like > DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a sliding > scale, but at the moment the policy isn't that fine-grained. Sure. I guess I'm just making the conservative argument that a "seatbelts-off" implementation isn't obviously the right choice for a default. This is something that could be controlled with a sysctl or a richer set of hints. --EVF5PPMfhYS0aIcm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ddadv.diff" diff --git a/bin/dd/args.c b/bin/dd/args.c index 2f197f8..6220115 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -39,10 +39,11 @@ static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #include __FBSDID("$FreeBSD$"); -#include +#include #include #include +#include #include #include #include @@ -54,14 +55,17 @@ __FBSDID("$FreeBSD$"); static int c_arg(const void *, const void *); static int c_conv(const void *, const void *); +static void f_advice(const char *, IO *); static void f_bs(char *); static void f_cbs(char *); static void f_conv(char *); static void f_count(char *); static void f_files(char *); static void f_fillchar(char *); +static void f_iadvice(char *); static void f_ibs(char *); static void f_if(char *); +static void f_oadvice(char *); static void f_obs(char *); static void f_of(char *); static void f_seek(char *); @@ -81,9 +85,11 @@ static const struct arg { { "count", f_count, C_COUNT, C_COUNT }, { "files", f_files, C_FILES, C_FILES }, { "fillchar", f_fillchar, C_FILL, C_FILL }, + { "iadvice", f_iadvice, C_IADV, C_IADV }, { "ibs", f_ibs, C_IBS, C_BS|C_IBS }, { "if", f_if, C_IF, C_IF }, { "iseek", f_skip, C_SKIP, C_SKIP }, + { "oadvice", f_oadvice, C_OADV, C_OADV }, { "obs", f_obs, C_OBS, C_BS|C_OBS }, { "of", f_of, C_OF, C_OF }, { "oseek", f_seek, C_SEEK, C_SEEK }, @@ -104,6 +110,7 @@ jcl(char **argv) char *arg; in.dbsz = out.dbsz = 512; + in.advice = out.advice = POSIX_FADV_NORMAL; while ((oper = *++argv) != NULL) { if ((oper = strdup(oper)) == NULL) @@ -306,6 +313,48 @@ f_status(char *arg) errx(1, "unknown status %s", arg); } +static const struct { + const char *name; + int advice; + int flags; +} pieces[] = { + { "noreuse", POSIX_FADV_NOREUSE, ADVBEFORE }, + { "normal", POSIX_FADV_NORMAL, ADVBEFORE }, + { "random", POSIX_FADV_RANDOM, ADVBEFORE }, + { "sequential", POSIX_FADV_SEQUENTIAL, ADVBEFORE }, + { "willneed", POSIX_FADV_WILLNEED, ADVBEFORE }, + { "dontneed", POSIX_FADV_DONTNEED, ADVAFTER }, +}; + +static void +f_advice(const char *arg, IO *io) +{ + u_long i; + + for (i = 0; i < nitems(pieces); i++) + if (strcmp(arg, pieces[i].name) == 0) + break; + if (i == nitems(pieces)) + errx(1, "'%s' isn't real advice", arg); + + io->advice = pieces[i].advice; + io->flags |= pieces[i].flags; +} + +static void +f_iadvice(char *arg) +{ + + f_advice(arg, &in); +} + +static void +f_oadvice(char *arg) +{ + + f_advice(arg, &out); +} + static const struct conv { const char *name; u_int set, noset; diff --git a/bin/dd/dd.1 b/bin/dd/dd.1 index 0908642..9b6a824 100644 --- a/bin/dd/dd.1 +++ b/bin/dd/dd.1 @@ -94,6 +94,16 @@ modes, fill with the specified .Tn ASCII character, rather than using a space or .Dv NUL . +.It Cm iadvice Ns = Ns Ar value +Use +.Xr posix_fadvise 2 +to provide the specified hint about the input file over its entire range. +This is useful for benchmarking. +Valid values are formed by removing the +.Ql POSIX_FADV_ +prefix of +.Xr posix_fadvise 2 +arguments and converting the result to lower-case. .It Cm ibs Ns = Ns Ar n Set the input block size to .Ar n @@ -108,6 +118,10 @@ Seek on the input file blocks. This is synonymous with .Cm skip Ns = Ns Ar n . +.It Cm oadvice Ns = Ns Ar value +The equivalent of +.Cm iadvice +for the output file. .It Cm obs Ns = Ns Ar n Set the output block size to .Ar n diff --git a/bin/dd/dd.c b/bin/dd/dd.c index 8ae11a7..7c78295 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -243,6 +243,13 @@ setup(void) ctab = casetab; } + if ((in.flags & ADVBEFORE) && + posix_fadvise(in.fd, 0, 0, in.advice) != 0) + err(1, "posix_fadvise"); + if ((out.flags & ADVBEFORE) && + posix_fadvise(out.fd, 0, 0, out.advice) != 0) + err(1, "posix_fadvise"); + if (clock_gettime(CLOCK_MONOTONIC, &st.start)) err(1, "clock_gettime"); } @@ -409,6 +416,12 @@ dd_close(void) } if (out.dbcnt || pending) dd_out(1); + if ((in.flags & ADVAFTER) && + posix_fadvise(in.fd, 0, 0, in.advice) != 0) + err(1, "posix_fadvise"); + if ((out.flags & ADVAFTER) && + posix_fadvise(out.fd, 0, 0, out.advice) != 0) + err(1, "posix_fadvise"); } void diff --git a/bin/dd/dd.h b/bin/dd/dd.h index a8b45e5..9627f52 100644 --- a/bin/dd/dd.h +++ b/bin/dd/dd.h @@ -49,9 +49,12 @@ typedef struct { #define ISSEEK 0x08 /* valid to seek on */ #define NOREAD 0x10 /* not readable */ #define ISTRUNC 0x20 /* valid to ftruncate() */ +#define ADVBEFORE 0x40 /* apply advice before I/O */ +#define ADVAFTER 0x80 /* apply advice after I/O */ u_int flags; const char *name; /* name */ + int advice; /* posix_fadvise(2) advice */ int fd; /* file descriptor */ off_t offset; /* # of blocks to skip */ } IO; @@ -98,5 +101,7 @@ typedef struct { #define C_STATUS 0x08000000 #define C_NOXFER 0x10000000 #define C_NOINFO 0x20000000 +#define C_IADV 0x40000000 +#define C_OADV 0x80000000 #define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET) --EVF5PPMfhYS0aIcm-- From owner-svn-src-head@freebsd.org Fri Oct 2 22:05:52 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ADCE2A0E09E; Fri, 2 Oct 2015 22:05:52 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F1CA12A7; Fri, 2 Oct 2015 22:05:52 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t92M5q5c025876; Fri, 2 Oct 2015 22:05:52 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t92M5qOV025875; Fri, 2 Oct 2015 22:05:52 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201510022205.t92M5qOV025875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Fri, 2 Oct 2015 22:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288524 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 22:05:52 -0000 Author: grehan Date: Fri Oct 2 22:05:51 2015 New Revision: 288524 URL: https://svnweb.freebsd.org/changeset/base/288524 Log: Fix post-test typo that snuck in. Modified: head/usr.sbin/bhyve/fwctl.c Modified: head/usr.sbin/bhyve/fwctl.c ============================================================================== --- head/usr.sbin/bhyve/fwctl.c Fri Oct 2 21:25:48 2015 (r288523) +++ head/usr.sbin/bhyve/fwctl.c Fri Oct 2 22:05:51 2015 (r288524) @@ -536,7 +536,7 @@ fwctl_handler(struct vmctx *ctx, int vcp return (0); } INOUT_PORT(fwctl_wreg, FWCTL_OUT, IOPORT_F_INOUT, fwctl_handler); -INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_OUT, fwctl_handler); +INOUT_PORT(fwctl_rreg, FWCTL_IN, IOPORT_F_IN, fwctl_handler); void fwctl_init(void) From owner-svn-src-head@freebsd.org Fri Oct 2 23:50:45 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9391CA0D6B7; Fri, 2 Oct 2015 23:50:45 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp1.rice.edu (proofpoint1.mail.rice.edu [128.42.201.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D1F21C40; Fri, 2 Oct 2015 23:50:44 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pps.filterd (pp1.rice.edu [127.0.0.1]) by pp1.rice.edu (8.15.0.59/8.15.0.59) with SMTP id t92NnjnB012271; Fri, 2 Oct 2015 18:50:37 -0500 Received: from mh11.mail.rice.edu (mh11.mail.rice.edu [128.42.199.30]) by pp1.rice.edu with ESMTP id 1x9wyjg9rh-1; Fri, 02 Oct 2015 18:50:37 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh11.mail.rice.edu, auth channel Received: from [10.87.76.177] (unknown [10.87.76.177]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh11.mail.rice.edu (Postfix) with ESMTPSA id 458054C01B1; Fri, 2 Oct 2015 18:50:37 -0500 (CDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r288431 - in head/sys: kern sys vm From: Alan Cox In-Reply-To: <4276391.z2UvhhORjP@ralph.baldwin.cx> Date: Fri, 2 Oct 2015 18:50:36 -0500 Cc: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201509302306.t8UN6UwX043736@repo.freebsd.org> <1837187.vUDrWYExQX@ralph.baldwin.cx> <20151002045842.GA18421@raichu> <4276391.z2UvhhORjP@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.9 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1510020307 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Oct 2015 23:50:45 -0000 On Oct 2, 2015, at 10:59 AM, John Baldwin wrote: > On Thursday, October 01, 2015 09:58:43 PM Mark Johnston wrote: >> On Thu, Oct 01, 2015 at 09:32:45AM -0700, John Baldwin wrote: >>> On Wednesday, September 30, 2015 11:06:30 PM Mark Johnston wrote: >>>> Author: markj >>>> Date: Wed Sep 30 23:06:29 2015 >>>> New Revision: 288431 >>>> URL: https://svnweb.freebsd.org/changeset/base/288431 >>>>=20 >>>> Log: >>>> As a step towards the elimination of PG_CACHED pages, rework the = handling >>>> of POSIX_FADV_DONTNEED so that it causes the backing pages to be = moved to >>>> the head of the inactive queue instead of being cached. >>>>=20 >>>> This affects the implementation of POSIX_FADV_NOREUSE as well, = since it >>>> works by applying POSIX_FADV_DONTNEED to file ranges after they = have been >>>> read or written. At that point the corresponding buffers may = still be >>>> dirty, so the previous implementation would coalesce successive = ranges and >>>> apply POSIX_FADV_DONTNEED to the result, ensuring that pages = backing the >>>> dirty buffers would eventually be cached. To preserve this = behaviour in an >>>> efficient manner, this change adds a new buf flag, B_NOREUSE, = which causes >>>> the pages backing a VMIO buf to be placed at the head of the = inactive queue >>>> when the buf is released. POSIX_FADV_NOREUSE then works by = setting this >>>> flag in bufs that underlie the specified range. >>>=20 >>> Putting these pages back on the inactive queue completely defeats = the primary >>> purpose of DONTNEED and NOREUSE. The primary purpose is to move the = pages out >>> of the VM object's tree of pages and into the free pool so that the = application >>> can instruct the VM to free memory more efficiently than relying on = page daemon. >>>=20 >>> The implementation used cache pages instead of free as a cheap = optimization so >>> that if an application did something dumb where it used DONTNEED and = then turned >>> around and read the file it would not have to go to disk if the = pages had not >>> yet been reused. In practice this didn't work out so well because = PG_CACHE pages >>> don't really work well. >>>=20 >>> However, using PG_CACHE was secondary to the primary purpose of = explicitly freeing >>> memory that an application knew wasn't going to be reused and = avoiding the need >>> for pagedaemon to run at all. I think this should be freeing the = pages instead of >>> keeping them inactive. If an application uses DONTNEED or NOREUSE = and then turns >>> around and rereads the file, it generally deserves to have to go to = disk for it. >>=20 >> A problem with this is that one application's DONTNEED or NOREUSE = hint >> would cause every application reading or writing that file to go to >> disk, but posix_fadvise(2) is explicitly intended for applications = that >> wish to provide hints about their own access patterns. I realize that >> it's typically used with application-private files, but that's not a >> requirement of the interface. Deactivating (or caching) the backing >> pages generally avoids this problem. >=20 > I think it is not unreasonble to expect that fadvise() incurs = system-wide > affects. A properly implemented WILLNEED that does read-ahead cannot = work > without incurring system-wide effects. I had always assumed that = fadvise() > operated on a file, not a given process' view of a file (unlike, say, > madvise which only operates on mappings and only indirectly affects > file-backed data). >=20 Can you elaborate on what you mean by =93I had always assumed that = fadvise() operated on a file, =85=94? Under the previous implementation, if you did an fadvise(DONTNEED) on a = file, in order to cache the file=92s pages, those pages first had to be = unmapped from any address space. (You can find this unmapping performed = by vm_page_try_to_cache().) In other words, there was never any code = that said, =93Is this a mapped page, and if it is, don=92t cache it = because we=92re actually performing an fadvise().=94 So, to pick an = extreme example, if you did an fadvise(=93libc.so=94, DONTNEED), unless = some process had libc.so wired, then every single mapping to every = single page of libc.so was going to be destroyed and the pages moved to = the cache. However, because we moved the pages to the cache (rather = than freeing them), and libc.so is frequently accessed, a subsequent = instruction fetch would have faulted and been able to reactivate the = cached page, avoiding an I/O operation. In other words, that we were = caching the pages targeted by fadvise() rather than simply freeing them = mattered in cases where the pages were in use/accessed by multiple = processes. >>> I'm pretty sure I had mentioned this to Alan before. I believe that = the idea is >>> that pagedaemon should be cheap enough that having it run anyway = shouldn't be an >>> issue, but I'm a bit skeptical of that. :) Lock contention is = always possible and >>> having DONTNEED/NOREUSE move pages to PG_CACHE avoided lock = contention with >>> pagedaemon during application page faults (since pagedaemon = potentially never has >>> to run). >>=20 >> That's true, but the page queue locking (and the pagedaemon's >> manipulation of the page queue locks) has also become more = fine-grained >> since posix_fadvise(2) was added. In particular, from some reading of >> sys/vm in stable/8, inactive queue scans used to be performed with = the >> global page queue lock held; it was only dropped to launder dirty = pages. >> Now, the page queue lock is split into separate locks for the active = and >> inactive page queues, and the pagedaemon drops the inactive queue = lock >> for each page in all but a few exceptional cases. Does the = optimization >> of freeing or caching DONTNEED pages buy us all that much now? >>=20 >> Some synthetic testing in which an application writes out many large >> (2G) files and calls posix_fadvise(FADV_DONTNEED) after each one = shows >> no significant difference in runtime if the buffer pages are = deactivated >> vs. freed. (My test just modifies vfs_vmio_unwire() to treat = B_NOREUSE >> identically to B_DIRECT.) Unsurprisingly, I see very little lock >> contention in the latter case, but in the former, most of the lock >> contention is short (i.e. the mutex is acquired while spinning), and >> a large majority of the contention is on the free page queue mutex. = If >> lock contention there is a concern, wouldn't it be better to try and >> address that directly rather than by bypassing the pagedaemon? >=20 > The lock contention was related to one process faulting in a new page = due to > a malloc() while pagedaemon ran. Also, it wasn't a steady type of = contention > that would show up in an average. Instead, it was the outliers (which = in the > case on 8.x were on the order of 2 seconds) that were problematic. I = used a > hack to log "long" wait times for specific processes to both debug = this and > evaluate the solution. I have a test program laying around from when = I last > tested this. I'll see what I can reproduce (before it required a = machine > with at least 24GB of RAM to reproduce). >=20 > The only foolproof way to reduce contention to zero is to eliminate = one of > the contending threads. :) I do think there are situations where an > application may be more informed about the optimal memory pattern for = its > workload than what the VM system can infer from heuristics. Currently = there > is no other way to flush a file's contents from RAM. If we had things = like > DONTNEED_I_MEAN_IT and DONTNEED_IM_NOT_SURE perhaps we could have a = sliding > scale, but at the moment the policy isn't that fine-grained. >=20 > --=20 > John Baldwin >=20 >=20 From owner-svn-src-head@freebsd.org Sat Oct 3 00:03:08 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95DFCA0E4B4; Sat, 3 Oct 2015 00:03:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B2A11608; Sat, 3 Oct 2015 00:03:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93038Y1074838; Sat, 3 Oct 2015 00:03:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93038q9074837; Sat, 3 Oct 2015 00:03:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030003.t93038q9074837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288525 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 00:03:08 -0000 Author: adrian Date: Sat Oct 3 00:03:07 2015 New Revision: 288525 URL: https://svnweb.freebsd.org/changeset/base/288525 Log: net80211: get rid of tx_phase1_done flag (ieee80211_crypto_tkip.c). Submitted by: Differential Revision: https://reviews.freebsd.org/D3596 Modified: head/sys/net80211/ieee80211_crypto_tkip.c Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Fri Oct 2 22:05:51 2015 (r288524) +++ head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:03:07 2015 (r288525) @@ -84,7 +84,6 @@ struct tkip_ctx { struct ieee80211vap *tc_vap; /* for diagnostics+statistics */ u16 tx_ttak[5]; - int tx_phase1_done; u8 tx_rc4key[16]; /* XXX for test module; make locals? */ u16 rx_ttak[5]; @@ -143,7 +142,6 @@ tkip_setkey(struct ieee80211_key *k) __func__, k->wk_keylen, 128/NBBY); return 0; } - k->wk_keytsc = 1; /* TSC starts at 1 */ ctx->rx_phase1_done = 0; return 1; } @@ -188,6 +186,7 @@ tkip_encap(struct ieee80211_key *k, stru keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + k->wk_keytsc++; ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ @@ -200,12 +199,9 @@ tkip_encap(struct ieee80211_key *k, stru /* * Finally, do software encrypt if needed. */ - if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) { - if (!tkip_encrypt(ctx, k, m, hdrlen)) - return 0; - /* NB: tkip_encrypt handles wk_keytsc */ - } else - k->wk_keytsc++; + if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) && + !tkip_encrypt(ctx, k, m, hdrlen)) + return 0; return 1; } @@ -934,10 +930,9 @@ tkip_encrypt(struct tkip_ctx *ctx, struc ctx->tc_vap->iv_stats.is_crypto_tkip++; wh = mtod(m, struct ieee80211_frame *); - if (!ctx->tx_phase1_done) { + if ((u16)(key->wk_keytsc) == 0 || key->wk_keytsc == 1) { tkip_mixing_phase1(ctx->tx_ttak, key->wk_key, wh->i_addr2, (u32)(key->wk_keytsc >> 16)); - ctx->tx_phase1_done = 1; } tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak, (u16) key->wk_keytsc); @@ -948,9 +943,6 @@ tkip_encrypt(struct tkip_ctx *ctx, struc icv); (void) m_append(m, IEEE80211_WEP_CRCLEN, icv); /* XXX check return */ - key->wk_keytsc++; - if ((u16)(key->wk_keytsc) == 0) - ctx->tx_phase1_done = 0; return 1; } From owner-svn-src-head@freebsd.org Sat Oct 3 00:50:16 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10320A0E956; Sat, 3 Oct 2015 00:50:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98441D50; Sat, 3 Oct 2015 00:50:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t930oFol093573; Sat, 3 Oct 2015 00:50:15 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t930oElb093568; Sat, 3 Oct 2015 00:50:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030050.t930oElb093568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288526 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 00:50:16 -0000 Author: adrian Date: Sat Oct 3 00:50:13 2015 New Revision: 288526 URL: https://svnweb.freebsd.org/changeset/base/288526 Log: net80211: add new method for ieee80211_cipher (ic_setiv). This can be used to update IV state for the caller without adding information to the mbuf. Some hardware (eg rum) apparently requires bits of this. Submitted by: Differential Revision: https://reviews.freebsd.org/D3638 Modified: head/sys/net80211/ieee80211_crypto.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_none.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:50:13 2015 (r288526) @@ -178,6 +178,7 @@ struct ieee80211_cipher { void* (*ic_attach)(struct ieee80211vap *, struct ieee80211_key *); void (*ic_detach)(struct ieee80211_key *); int (*ic_setkey)(struct ieee80211_key *); + void (*ic_setiv)(struct ieee80211_key *, uint8_t *); int (*ic_encap)(struct ieee80211_key *, struct mbuf *); int (*ic_decap)(struct ieee80211_key *, struct mbuf *, int); int (*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Sat Oct 3 00:50:13 2015 (r288526) @@ -63,6 +63,7 @@ struct ccmp_ctx { static void *ccmp_attach(struct ieee80211vap *, struct ieee80211_key *); static void ccmp_detach(struct ieee80211_key *); static int ccmp_setkey(struct ieee80211_key *); +static void ccmp_setiv(struct ieee80211_key *, uint8_t *); static int ccmp_encap(struct ieee80211_key *, struct mbuf *); static int ccmp_decap(struct ieee80211_key *, struct mbuf *, int); static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int); @@ -78,6 +79,7 @@ static const struct ieee80211_cipher ccm .ic_attach = ccmp_attach, .ic_detach = ccmp_detach, .ic_setkey = ccmp_setkey, + .ic_setiv = ccmp_setiv, .ic_encap = ccmp_encap, .ic_decap = ccmp_decap, .ic_enmic = ccmp_enmic, @@ -134,6 +136,26 @@ ccmp_setkey(struct ieee80211_key *k) return 1; } +static void +ccmp_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ + struct ccmp_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->cc_vap; + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + + k->wk_keytsc++; + ivp[0] = k->wk_keytsc >> 0; /* PN0 */ + ivp[1] = k->wk_keytsc >> 8; /* PN1 */ + ivp[2] = 0; /* Reserved */ + ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ + ivp[4] = k->wk_keytsc >> 16; /* PN2 */ + ivp[5] = k->wk_keytsc >> 24; /* PN3 */ + ivp[6] = k->wk_keytsc >> 32; /* PN4 */ + ivp[7] = k->wk_keytsc >> 40; /* PN5 */ +} + /* * Add privacy headers appropriate for the specified key. */ @@ -142,9 +164,7 @@ ccmp_encap(struct ieee80211_key *k, stru { struct ccmp_ctx *ctx = k->wk_private; struct ieee80211com *ic = ctx->cc_ic; - struct ieee80211vap *vap = ctx->cc_vap; uint8_t *ivp; - uint8_t keyid; int hdrlen; hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); @@ -159,17 +179,7 @@ ccmp_encap(struct ieee80211_key *k, stru ovbcopy(ivp + ccmp.ic_header, ivp, hdrlen); ivp += hdrlen; - keyid = ieee80211_crypto_get_keyid(vap, k) << 6; - - k->wk_keytsc++; /* XXX wrap at 48 bits */ - ivp[0] = k->wk_keytsc >> 0; /* PN0 */ - ivp[1] = k->wk_keytsc >> 8; /* PN1 */ - ivp[2] = 0; /* Reserved */ - ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ - ivp[4] = k->wk_keytsc >> 16; /* PN2 */ - ivp[5] = k->wk_keytsc >> 24; /* PN3 */ - ivp[6] = k->wk_keytsc >> 32; /* PN4 */ - ivp[7] = k->wk_keytsc >> 40; /* PN5 */ + ccmp_setiv(k, ivp); /* * Finally, do software encrypt if needed. Modified: head/sys/net80211/ieee80211_crypto_none.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_none.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_none.c Sat Oct 3 00:50:13 2015 (r288526) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); static void *none_attach(struct ieee80211vap *, struct ieee80211_key *); static void none_detach(struct ieee80211_key *); static int none_setkey(struct ieee80211_key *); +static void none_setiv(struct ieee80211_key *, uint8_t *); static int none_encap(struct ieee80211_key *, struct mbuf *); static int none_decap(struct ieee80211_key *, struct mbuf *, int); static int none_enmic(struct ieee80211_key *, struct mbuf *, int); @@ -62,6 +63,7 @@ const struct ieee80211_cipher ieee80211_ .ic_attach = none_attach, .ic_detach = none_detach, .ic_setkey = none_setkey, + .ic_setiv = none_setiv, .ic_encap = none_encap, .ic_decap = none_decap, .ic_enmic = none_enmic, @@ -87,6 +89,11 @@ none_setkey(struct ieee80211_key *k) return 1; } +static void +none_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ +} + static int none_encap(struct ieee80211_key *k, struct mbuf *m) { Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_tkip.c Sat Oct 3 00:50:13 2015 (r288526) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); static void *tkip_attach(struct ieee80211vap *, struct ieee80211_key *); static void tkip_detach(struct ieee80211_key *); static int tkip_setkey(struct ieee80211_key *); +static void tkip_setiv(struct ieee80211_key *, uint8_t *); static int tkip_encap(struct ieee80211_key *, struct mbuf *); static int tkip_enmic(struct ieee80211_key *, struct mbuf *, int); static int tkip_decap(struct ieee80211_key *, struct mbuf *, int); @@ -69,6 +70,7 @@ static const struct ieee80211_cipher tki .ic_attach = tkip_attach, .ic_detach = tkip_detach, .ic_setkey = tkip_setkey, + .ic_setiv = tkip_setiv, .ic_encap = tkip_encap, .ic_decap = tkip_decap, .ic_enmic = tkip_enmic, @@ -146,6 +148,26 @@ tkip_setkey(struct ieee80211_key *k) return 1; } +static void +tkip_setiv(struct ieee80211_key *k, uint8_t *ivp) +{ + struct tkip_ctx *ctx = k->wk_private; + struct ieee80211vap *vap = ctx->tc_vap; + uint8_t keyid; + + keyid = ieee80211_crypto_get_keyid(vap, k) << 6; + + k->wk_keytsc++; + ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ + ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ + ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ + ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ + ivp[4] = k->wk_keytsc >> 16; /* TSC2 */ + ivp[5] = k->wk_keytsc >> 24; /* TSC3 */ + ivp[6] = k->wk_keytsc >> 32; /* TSC4 */ + ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ +} + /* * Add privacy headers and do any s/w encryption required. */ @@ -156,7 +178,6 @@ tkip_encap(struct ieee80211_key *k, stru struct ieee80211vap *vap = ctx->tc_vap; struct ieee80211com *ic = vap->iv_ic; uint8_t *ivp; - uint8_t keyid; int hdrlen; /* @@ -184,17 +205,7 @@ tkip_encap(struct ieee80211_key *k, stru memmove(ivp, ivp + tkip.ic_header, hdrlen); ivp += hdrlen; - keyid = ieee80211_crypto_get_keyid(vap, k) << 6; - - k->wk_keytsc++; - ivp[0] = k->wk_keytsc >> 8; /* TSC1 */ - ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */ - ivp[2] = k->wk_keytsc >> 0; /* TSC0 */ - ivp[3] = keyid | IEEE80211_WEP_EXTIV; /* KeyID | ExtID */ - ivp[4] = k->wk_keytsc >> 16; /* TSC2 */ - ivp[5] = k->wk_keytsc >> 24; /* TSC3 */ - ivp[6] = k->wk_keytsc >> 32; /* TSC4 */ - ivp[7] = k->wk_keytsc >> 40; /* TSC5 */ + tkip_setiv(k, ivp); /* * Finally, do software encrypt if needed. Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Sat Oct 3 00:03:07 2015 (r288525) +++ head/sys/net80211/ieee80211_crypto_wep.c Sat Oct 3 00:50:13 2015 (r288526) @@ -50,8 +50,9 @@ __FBSDID("$FreeBSD$"); static void *wep_attach(struct ieee80211vap *, struct ieee80211_key *); static void wep_detach(struct ieee80211_key *); static int wep_setkey(struct ieee80211_key *); +static void wep_setiv(struct ieee80211_key *, uint8_t *); static int wep_encap(struct ieee80211_key *, struct mbuf *); -static int wep_decap(struct ieee80211_key *, struct mbuf *, int hdrlen); +static int wep_decap(struct ieee80211_key *, struct mbuf *, int); static int wep_enmic(struct ieee80211_key *, struct mbuf *, int); static int wep_demic(struct ieee80211_key *, struct mbuf *, int); @@ -64,6 +65,7 @@ static const struct ieee80211_cipher wep .ic_attach = wep_attach, .ic_detach = wep_detach, .ic_setkey = wep_setkey, + .ic_setiv = wep_setiv, .ic_encap = wep_encap, .ic_decap = wep_decap, .ic_enmic = wep_enmic, @@ -117,31 +119,13 @@ wep_setkey(struct ieee80211_key *k) return k->wk_keylen >= 40/NBBY; } -/* - * Add privacy headers appropriate for the specified key. - */ -static int -wep_encap(struct ieee80211_key *k, struct mbuf *m) +static void +wep_setiv(struct ieee80211_key *k, uint8_t *ivp) { struct wep_ctx *ctx = k->wk_private; struct ieee80211vap *vap = ctx->wc_vap; - struct ieee80211com *ic = ctx->wc_ic; uint32_t iv; - uint8_t *ivp; uint8_t keyid; - int hdrlen; - - hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); - - /* - * Copy down 802.11 header and add the IV + KeyID. - */ - M_PREPEND(m, wep.ic_header, M_NOWAIT); - if (m == NULL) - return 0; - ivp = mtod(m, uint8_t *); - ovbcopy(ivp + wep.ic_header, ivp, hdrlen); - ivp += hdrlen; keyid = ieee80211_crypto_get_keyid(vap, k) << 6; @@ -186,6 +170,32 @@ wep_encap(struct ieee80211_key *k, struc ivp[0] = iv >> 16; #endif ivp[3] = keyid; +} + +/* + * Add privacy headers appropriate for the specified key. + */ +static int +wep_encap(struct ieee80211_key *k, struct mbuf *m) +{ + struct wep_ctx *ctx = k->wk_private; + struct ieee80211com *ic = ctx->wc_ic; + uint8_t *ivp; + int hdrlen; + + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); + + /* + * Copy down 802.11 header and add the IV + KeyID. + */ + M_PREPEND(m, wep.ic_header, M_NOWAIT); + if (m == NULL) + return 0; + ivp = mtod(m, uint8_t *); + ovbcopy(ivp + wep.ic_header, ivp, hdrlen); + ivp += hdrlen; + + wep_setiv(k, ivp); /* * Finally, do software encrypt if needed. From owner-svn-src-head@freebsd.org Sat Oct 3 00:57:35 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F41B1A0EF61; Sat, 3 Oct 2015 00:57:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C89F211D7; Sat, 3 Oct 2015 00:57:34 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t930vYok095568; Sat, 3 Oct 2015 00:57:34 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t930vYjn095566; Sat, 3 Oct 2015 00:57:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030057.t930vYjn095566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 00:57:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288527 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 00:57:35 -0000 Author: adrian Date: Sat Oct 3 00:57:33 2015 New Revision: 288527 URL: https://svnweb.freebsd.org/changeset/base/288527 Log: net80211: add a possibility to retrieve current TX key without encapsulation. Submitted by: Differential Revision: https://reviews.freebsd.org/D3639 Modified: head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_crypto.h Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Sat Oct 3 00:50:13 2015 (r288526) +++ head/sys/net80211/ieee80211_crypto.c Sat Oct 3 00:57:33 2015 (r288527) @@ -531,16 +531,11 @@ ieee80211_crypto_get_keyid(struct ieee80 return (0); } -/* - * Add privacy headers appropriate for the specified key. - */ struct ieee80211_key * -ieee80211_crypto_encap(struct ieee80211_node *ni, struct mbuf *m) +ieee80211_crypto_get_txkey(struct ieee80211_node *ni, struct mbuf *m) { struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211_key *k; struct ieee80211_frame *wh; - const struct ieee80211_cipher *cip; /* * Multicast traffic always uses the multicast key. @@ -559,12 +554,27 @@ ieee80211_crypto_encap(struct ieee80211_ vap->iv_stats.is_tx_nodefkey++; return NULL; } - k = &vap->iv_nw_keys[vap->iv_def_txkey]; - } else - k = &ni->ni_ucastkey; + return &vap->iv_nw_keys[vap->iv_def_txkey]; + } - cip = k->wk_cipher; - return (cip->ic_encap(k, m) ? k : NULL); + return &ni->ni_ucastkey; +} + +/* + * Add privacy headers appropriate for the specified key. + */ +struct ieee80211_key * +ieee80211_crypto_encap(struct ieee80211_node *ni, struct mbuf *m) +{ + struct ieee80211_key *k; + const struct ieee80211_cipher *cip; + + if ((k = ieee80211_crypto_get_txkey(ni, m)) != NULL) { + cip = k->wk_cipher; + return (cip->ic_encap(k, m) ? k : NULL); + } + + return NULL; } /* Modified: head/sys/net80211/ieee80211_crypto.h ============================================================================== --- head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:50:13 2015 (r288526) +++ head/sys/net80211/ieee80211_crypto.h Sat Oct 3 00:57:33 2015 (r288527) @@ -195,6 +195,8 @@ int ieee80211_crypto_available(u_int cip uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, struct ieee80211_key *k); +struct ieee80211_key *ieee80211_crypto_get_txkey(struct ieee80211_node *, + struct mbuf *); struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, struct mbuf *); struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, From owner-svn-src-head@freebsd.org Sat Oct 3 03:12:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3CD9A0FBFD; Sat, 3 Oct 2015 03:12:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E46201929; Sat, 3 Oct 2015 03:12:57 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t933Cvm6053978; Sat, 3 Oct 2015 03:12:57 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t933Cvch053977; Sat, 3 Oct 2015 03:12:57 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201510030312.t933Cvch053977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 3 Oct 2015 03:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288528 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 03:12:58 -0000 Author: ae Date: Sat Oct 3 03:12:57 2015 New Revision: 288528 URL: https://svnweb.freebsd.org/changeset/base/288528 Log: Fix possible segmentation fault. PR: 203494 MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Oct 3 00:57:33 2015 (r288527) +++ head/sbin/ipfw/ipfw2.c Sat Oct 3 03:12:57 2015 (r288528) @@ -3625,7 +3625,7 @@ compile_rule(char *av[], uint32_t *rbuf, action->opcode = O_NAT; action->len = F_INSN_SIZE(ipfw_insn_nat); CHECK_ACTLEN; - if (_substrcmp(*av, "global") == 0) { + if (*av != NULL && _substrcmp(*av, "global") == 0) { action->arg1 = 0; av++; break; From owner-svn-src-head@freebsd.org Sat Oct 3 03:57:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B852BA0ECDB; Sat, 3 Oct 2015 03:57:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A86481B91; Sat, 3 Oct 2015 03:57:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t933vxNq070213; Sat, 3 Oct 2015 03:57:59 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t933vxMc070212; Sat, 3 Oct 2015 03:57:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201510030357.t933vxMc070212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 3 Oct 2015 03:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288529 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 03:57:59 -0000 Author: ae Date: Sat Oct 3 03:57:58 2015 New Revision: 288529 URL: https://svnweb.freebsd.org/changeset/base/288529 Log: Always detach encap handler when reconfiguring tunnel. Reported by: hrs MFC after: 1 week Modified: head/sys/net/if_gre.c Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Oct 3 03:12:57 2015 (r288528) +++ head/sys/net/if_gre.c Sat Oct 3 03:57:58 2015 (r288529) @@ -623,7 +623,7 @@ gre_set_tunnel(struct ifnet *ifp, struct default: return (EAFNOSUPPORT); } - if (sc->gre_family != src->sa_family) + if (sc->gre_family != 0) gre_detach(sc); GRE_WLOCK(sc); if (sc->gre_family != 0) From owner-svn-src-head@freebsd.org Sat Oct 3 05:42:26 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A177A0F343; Sat, 3 Oct 2015 05:42:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A34A1E40; Sat, 3 Oct 2015 05:42:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935gQjt019287; Sat, 3 Oct 2015 05:42:26 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935gQhE019286; Sat, 3 Oct 2015 05:42:26 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201510030542.t935gQhE019286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sat, 3 Oct 2015 05:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288530 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 05:42:26 -0000 Author: melifaro Date: Sat Oct 3 05:42:25 2015 New Revision: 288530 URL: https://svnweb.freebsd.org/changeset/base/288530 Log: Bump number of prefixes in O_IP_ from 15 to 31 (max possible). PR: 203459 Submitted by: groos at xiplink.com MFC after: 2 weeks Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Oct 3 03:57:58 2015 (r288529) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Oct 3 05:42:25 2015 (r288530) @@ -1531,7 +1531,7 @@ check_ipfw_rule_body(ipfw_insn *cmd, int case O_IP_SRC_MASK: case O_IP_DST_MASK: /* only odd command lengths */ - if ( !(cmdlen & 1) || cmdlen > 31) + if ((cmdlen & 1) == 0) goto bad_size; break; From owner-svn-src-head@freebsd.org Sat Oct 3 05:44:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 596E4A0F478; Sat, 3 Oct 2015 05:44:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 496511FF5; Sat, 3 Oct 2015 05:44:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935i6Df019428; Sat, 3 Oct 2015 05:44:06 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935i5YN019425; Sat, 3 Oct 2015 05:44:05 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030544.t935i5YN019425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288531 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 05:44:06 -0000 Author: adrian Date: Sat Oct 3 05:44:05 2015 New Revision: 288531 URL: https://svnweb.freebsd.org/changeset/base/288531 Log: rum(4): some non-functional changes / cleanup * Remove unused sc_txtap_len/sc_rxtap_len fields. * Remove unused ackrate variable. * Remove unneded warning in rum_update_mcast(). * Use nitems(). * Replace some hardcoded values for RT2573_MAC_CSR1 register. * Remove second argument for RUM_LOCK_ASSERT() - it is always the same. Submitted by: Differential Revision: https://reviews.freebsd.org/D3605 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:42:25 2015 (r288530) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:44:05 2015 (r288531) @@ -86,8 +86,6 @@ SYSCTL_INT(_hw_usb_rum, OID_AUTO, debug, "Debug level"); #endif -#define N(a) ((int)(sizeof (a) / sizeof ((a)[0]))) - static const STRUCT_USB_HOST_ID rum_devs[] = { #define RUM_DEV(v,p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } RUM_DEV(ABOCOM, HWU54DM), @@ -532,6 +530,7 @@ static int rum_detach(device_t self) { struct rum_softc *sc = device_get_softc(self); + struct ieee80211com *ic = &sc->sc_ic; /* Prevent further ioctls */ RUM_LOCK(sc); @@ -546,8 +545,8 @@ rum_detach(device_t self) rum_unsetup_tx_list(sc); RUM_UNLOCK(sc); - if (sc->sc_ic.ic_softc == sc) - ieee80211_ifdetach(&sc->sc_ic); + if (ic->ic_softc == sc) + ieee80211_ifdetach(ic); mbufq_drain(&sc->sc_snd); mtx_destroy(&sc->sc_mtx); return (0); @@ -1025,10 +1024,10 @@ rum_sendprot(struct rum_softc *sc, const struct ieee80211_frame *wh; struct rum_tx_data *data; struct mbuf *mprot; - int protrate, ackrate, pktlen, flags, isshort; + int protrate, pktlen, flags, isshort; uint16_t dur; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); KASSERT(prot == IEEE80211_PROT_RTSCTS || prot == IEEE80211_PROT_CTSONLY, ("protection %d", prot)); @@ -1036,7 +1035,6 @@ rum_sendprot(struct rum_softc *sc, pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN; protrate = ieee80211_ctl_rate(ic->ic_rt, rate); - ackrate = ieee80211_ack_rate(ic->ic_rt, rate); isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0; dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) @@ -1081,7 +1079,7 @@ rum_tx_mgt(struct rum_softc *sc, struct uint32_t flags = 0; uint16_t dur; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); @@ -1137,7 +1135,7 @@ rum_tx_raw(struct rum_softc *sc, struct uint32_t flags; int rate, error; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); KASSERT(params != NULL, ("no raw xmit params")); rate = params->ibp_rate0; @@ -1193,7 +1191,7 @@ rum_tx_data(struct rum_softc *sc, struct uint16_t dur; int error, rate; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); @@ -1289,7 +1287,7 @@ rum_start(struct rum_softc *sc) struct ieee80211_node *ni; struct mbuf *m; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); if (!sc->sc_running) return; @@ -1844,12 +1842,7 @@ rum_update_promisc(struct ieee80211com * static void rum_update_mcast(struct ieee80211com *ic) { - static int warning_printed; - - if (warning_printed == 0) { - ic_printf(ic, "need to implement %s\n", __func__); - warning_printed = 1; - } + /* Ignore. */ } static const char * @@ -1966,7 +1959,7 @@ rum_bbp_init(struct rum_softc *sc) } /* initialize BBP registers to default values */ - for (i = 0; i < N(rum_def_bbp); i++) + for (i = 0; i < nitems(rum_def_bbp); i++) rum_bbp_write(sc, rum_def_bbp[i].reg, rum_def_bbp[i].val); /* write vendor-specific BBP values (from EEPROM) */ @@ -1988,16 +1981,16 @@ rum_init(struct rum_softc *sc) usb_error_t error; int i, ntries; - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); rum_stop(sc); /* initialize MAC registers to default values */ - for (i = 0; i < N(rum_def_mac); i++) + for (i = 0; i < nitems(rum_def_mac); i++) rum_write(sc, rum_def_mac[i].reg, rum_def_mac[i].val); /* set host ready */ - rum_write(sc, RT2573_MAC_CSR1, 3); + rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); /* wait for BBP/RF to wakeup */ @@ -2028,7 +2021,7 @@ rum_init(struct rum_softc *sc) rum_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr); /* initialize ASIC */ - rum_write(sc, RT2573_MAC_CSR1, 4); + rum_write(sc, RT2573_MAC_CSR1, RT2573_HOST_READY); /* * Allocate Tx and Rx xfer queues. @@ -2062,7 +2055,7 @@ static void rum_stop(struct rum_softc *sc) { - RUM_LOCK_ASSERT(sc, MA_OWNED); + RUM_LOCK_ASSERT(sc); sc->sc_running = 0; @@ -2082,7 +2075,7 @@ rum_stop(struct rum_softc *sc) rum_setbits(sc, RT2573_TXRX_CSR0, RT2573_DISABLE_RX); /* reset ASIC */ - rum_write(sc, RT2573_MAC_CSR1, 3); + rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:42:25 2015 (r288530) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:44:05 2015 (r288531) @@ -90,7 +90,7 @@ struct rum_softc { device_t sc_dev; struct usb_device *sc_udev; - struct usb_xfer *sc_xfer[RUM_N_TRANSFER]; + struct usb_xfer *sc_xfer[RUM_N_TRANSFER]; uint8_t rf_rev; uint8_t rffreq; @@ -125,12 +125,9 @@ struct rum_softc { uint8_t bbp17; struct rum_rx_radiotap_header sc_rxtap; - int sc_rxtap_len; - struct rum_tx_radiotap_header sc_txtap; - int sc_txtap_len; }; #define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) #define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) -#define RUM_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t) +#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) From owner-svn-src-head@freebsd.org Sat Oct 3 05:46:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9ABA5A0F675; Sat, 3 Oct 2015 05:46:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E47E11FD; Sat, 3 Oct 2015 05:46:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935kaqc019640; Sat, 3 Oct 2015 05:46:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935kao5019638; Sat, 3 Oct 2015 05:46:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030546.t935kao5019638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288532 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 05:46:36 -0000 Author: adrian Date: Sat Oct 3 05:46:35 2015 New Revision: 288532 URL: https://svnweb.freebsd.org/changeset/base/288532 Log: rum(4): add command queue for running sleepable tasks in non-sleepable contexts Tested: * Tested on WUSB54GC, STA mode. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3629 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:44:05 2015 (r288531) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 05:46:35 2015 (r288532) @@ -158,6 +158,9 @@ static struct ieee80211vap *rum_vap_crea int, const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void rum_vap_delete(struct ieee80211vap *); +static void rum_cmdq_cb(void *, int); +static int rum_cmd_sleepable(struct rum_softc *, const void *, + size_t, uint8_t, uint8_t, CMD_FUNC_PROTO); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); static void rum_unsetup_tx_list(struct rum_softc *); @@ -438,8 +441,8 @@ rum_attach(device_t self) sc->sc_udev = uaa->device; sc->sc_dev = self; - mtx_init(&sc->sc_mtx, device_get_nameunit(self), - MTX_NETWORK_LOCK, MTX_DEF); + RUM_LOCK_INIT(sc); + RUM_CMDQ_LOCK_INIT(sc); mbufq_init(&sc->sc_snd, ifqmaxlen); iface_index = RT2573_IFACE_INDEX; @@ -516,6 +519,8 @@ rum_attach(device_t self) &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap), RT2573_RX_RADIOTAP_PRESENT); + TASK_INIT(&sc->cmdq_task, 0, rum_cmdq_cb, sc); + if (bootverbose) ieee80211_announce(ic); @@ -545,10 +550,15 @@ rum_detach(device_t self) rum_unsetup_tx_list(sc); RUM_UNLOCK(sc); - if (ic->ic_softc == sc) + if (ic->ic_softc == sc) { + ieee80211_draintask(ic, &sc->cmdq_task); ieee80211_ifdetach(ic); + } + mbufq_drain(&sc->sc_snd); - mtx_destroy(&sc->sc_mtx); + RUM_CMDQ_LOCK_DESTROY(sc); + RUM_LOCK_DESTROY(sc); + return (0); } @@ -625,6 +635,57 @@ rum_vap_delete(struct ieee80211vap *vap) } static void +rum_cmdq_cb(void *arg, int pending) +{ + struct rum_softc *sc = arg; + struct rum_cmdq *rc; + + RUM_CMDQ_LOCK(sc); + while (sc->cmdq[sc->cmdq_first].func != NULL) { + rc = &sc->cmdq[sc->cmdq_first]; + RUM_CMDQ_UNLOCK(sc); + + RUM_LOCK(sc); + rc->func(sc, &rc->data, rc->rn_id, rc->rvp_id); + RUM_UNLOCK(sc); + + RUM_CMDQ_LOCK(sc); + memset(rc, 0, sizeof (*rc)); + sc->cmdq_first = (sc->cmdq_first + 1) % RUM_CMDQ_SIZE; + } + RUM_CMDQ_UNLOCK(sc); +} + +static int +rum_cmd_sleepable(struct rum_softc *sc, const void *ptr, size_t len, + uint8_t rn_id, uint8_t rvp_id, CMD_FUNC_PROTO) +{ + struct ieee80211com *ic = &sc->sc_ic; + + KASSERT(len <= sizeof(union sec_param), ("buffer overflow")); + + RUM_CMDQ_LOCK(sc); + if (sc->cmdq[sc->cmdq_last].func != NULL) { + device_printf(sc->sc_dev, "%s: cmdq overflow\n", __func__); + RUM_CMDQ_UNLOCK(sc); + + return EAGAIN; + } + + if (ptr != NULL) + memcpy(&sc->cmdq[sc->cmdq_last].data, ptr, len); + sc->cmdq[sc->cmdq_last].rn_id = rn_id; + sc->cmdq[sc->cmdq_last].rvp_id = rvp_id; + sc->cmdq[sc->cmdq_last].func = func; + sc->cmdq_last = (sc->cmdq_last + 1) % RUM_CMDQ_SIZE; + RUM_CMDQ_UNLOCK(sc); + + ieee80211_runtask(ic, &sc->cmdq_task); + + return 0; +} + +static void rum_tx_free(struct rum_tx_data *data, int txerr) { struct rum_softc *sc = data->sc; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:44:05 2015 (r288531) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 05:46:35 2015 (r288532) @@ -67,6 +67,25 @@ struct rum_tx_data { }; typedef STAILQ_HEAD(, rum_tx_data) rum_txdhead; +union sec_param { + struct ieee80211_key key; + uint8_t macaddr[IEEE80211_ADDR_LEN]; + struct ieee80211vap *vap; +}; +#define CMD_FUNC_PROTO void (*func)(struct rum_softc *, \ + union sec_param *, uint8_t, \ + uint8_t) + +struct rum_cmdq { + union sec_param data; + + uint8_t rn_id; + uint8_t rvp_id; + + CMD_FUNC_PROTO; +}; +#define RUM_CMDQ_SIZE 16 + struct rum_vap { struct ieee80211vap vap; struct ieee80211_beacon_offsets bo; @@ -103,6 +122,12 @@ struct rum_softc { struct mtx sc_mtx; + struct rum_cmdq cmdq[RUM_CMDQ_SIZE]; + struct mtx cmdq_mtx; + struct task cmdq_task; + uint8_t cmdq_first; + uint8_t cmdq_last; + uint32_t sta[6]; uint32_t rf_regs[4]; uint8_t txpow[44]; @@ -128,6 +153,16 @@ struct rum_softc { struct rum_tx_radiotap_header sc_txtap; }; -#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) -#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) -#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define RUM_LOCK_INIT(sc) \ + mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \ + MTX_NETWORK_LOCK, MTX_DEF); +#define RUM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) +#define RUM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) +#define RUM_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +#define RUM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) + +#define RUM_CMDQ_LOCK_INIT(sc) \ + mtx_init(&(sc)->cmdq_mtx, "cmdq lock", NULL, MTX_DEF) +#define RUM_CMDQ_LOCK(sc) mtx_lock(&(sc)->cmdq_mtx) +#define RUM_CMDQ_UNLOCK(sc) mtx_unlock(&(sc)->cmdq_mtx) +#define RUM_CMDQ_LOCK_DESTROY(sc) mtx_destroy(&(sc)->cmdq_mtx) From owner-svn-src-head@freebsd.org Sat Oct 3 05:55:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91CE0A0FB51; Sat, 3 Oct 2015 05:55:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 820301831; Sat, 3 Oct 2015 05:55:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t935tHNB023706; Sat, 3 Oct 2015 05:55:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t935tH1O023705; Sat, 3 Oct 2015 05:55:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030555.t935tH1O023705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 05:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288533 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 05:55:17 -0000 Author: adrian Date: Sat Oct 3 05:55:16 2015 New Revision: 288533 URL: https://svnweb.freebsd.org/changeset/base/288533 Log: ural(4): reduce copy-paste in ural_newstate(). Submitted by: Differential Revision: https://reviews.freebsd.org/D3656 Modified: head/sys/dev/usb/wlan/if_ural.c Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 05:46:35 2015 (r288532) +++ head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 05:55:16 2015 (r288533) @@ -698,12 +698,9 @@ ural_newstate(struct ieee80211vap *vap, ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { - if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); - } + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + goto fail; + ural_update_slot(sc); ural_set_txpreamble(sc); ural_set_basicrates(sc, ic->ic_bsschan); @@ -717,19 +714,13 @@ ural_newstate(struct ieee80211vap *vap, if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + goto fail; } ieee80211_ref_node(ni); if (ural_tx_bcn(sc, m, ni) != 0) { device_printf(sc->sc_dev, "could not send beacon\n"); - RAL_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + goto fail; } } @@ -755,6 +746,12 @@ ural_newstate(struct ieee80211vap *vap, RAL_UNLOCK(sc); IEEE80211_LOCK(ic); return (uvp->newstate(vap, nstate, arg)); + +fail: + RAL_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return (-1); } From owner-svn-src-head@freebsd.org Sat Oct 3 06:07:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8BF6A0D073; Sat, 3 Oct 2015 06:07:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C93001C9D; Sat, 3 Oct 2015 06:07:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93672QE027851; Sat, 3 Oct 2015 06:07:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93672ft027850; Sat, 3 Oct 2015 06:07:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030607.t93672ft027850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 06:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288534 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 06:07:02 -0000 Author: adrian Date: Sat Oct 3 06:07:01 2015 New Revision: 288534 URL: https://svnweb.freebsd.org/changeset/base/288534 Log: urtwn(4): fix sequence numbering for QoS frames Tested: * urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3684 Modified: head/sys/dev/usb/wlan/if_urtwn.c Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Sat Oct 3 05:55:16 2015 (r288533) +++ head/sys/dev/usb/wlan/if_urtwn.c Sat Oct 3 06:07:01 2015 (r288534) @@ -1775,7 +1775,7 @@ urtwn_tx_start(struct urtwn_softc *sc, s struct r92c_tx_desc *txd; uint8_t raid, type; uint16_t sum; - int i, hasqos, xferlen; + int i, xferlen; struct usb_xfer *urtwn_pipes[4] = { sc->sc_xfer[URTWN_BULK_TX_BE], sc->sc_xfer[URTWN_BULK_TX_BK], @@ -1816,8 +1816,6 @@ urtwn_tx_start(struct urtwn_softc *sc, s break; } - hasqos = 0; - /* Fill Tx descriptor. */ txd = (struct r92c_tx_desc *)data->buf; memset(txd, 0, sizeof(*txd)); @@ -1873,7 +1871,7 @@ urtwn_tx_start(struct urtwn_softc *sc, s /* Set sequence number (already little endian). */ txd->txdseq |= *(uint16_t *)wh->i_seq; - if (!hasqos) { + if (!IEEE80211_QOS_HAS_SEQ(wh)) { /* Use HW sequence numbering for non-QoS frames. */ txd->txdw4 |= htole32(R92C_TXDW4_HWSEQ); txd->txdseq |= htole16(0x8000); From owner-svn-src-head@freebsd.org Sat Oct 3 06:35:18 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5539EA0EBB2; Sat, 3 Oct 2015 06:35:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 456361AAE; Sat, 3 Oct 2015 06:35:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t936ZI6A040142; Sat, 3 Oct 2015 06:35:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t936ZHbs040140; Sat, 3 Oct 2015 06:35:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510030635.t936ZHbs040140@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 06:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288535 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 06:35:18 -0000 Author: adrian Date: Sat Oct 3 06:35:17 2015 New Revision: 288535 URL: https://svnweb.freebsd.org/changeset/base/288535 Log: Remove beacon offsets usage from if_rum. Differential Revision: https://reviews.freebsd.org/D3658 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 06:07:01 2015 (r288534) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 06:35:17 2015 (r288535) @@ -2187,7 +2187,7 @@ rum_prepare_beacon(struct rum_softc *sc, if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) return; - m0 = ieee80211_beacon_alloc(vap->iv_bss, &RUM_VAP(vap)->bo); + m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); if (m0 == NULL) return; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 06:07:01 2015 (r288534) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 06:35:17 2015 (r288535) @@ -88,7 +88,6 @@ struct rum_cmdq { struct rum_vap { struct ieee80211vap vap; - struct ieee80211_beacon_offsets bo; struct usb_callout ratectl_ch; struct task ratectl_task; From owner-svn-src-head@freebsd.org Sat Oct 3 07:03:03 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E342EA0FD69; Sat, 3 Oct 2015 07:03:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A6A118D5; Sat, 3 Oct 2015 07:03:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t9372u6R091217 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 3 Oct 2015 10:02:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t9372u6R091217 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t9372uPg091216; Sat, 3 Oct 2015 10:02:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Oct 2015 10:02:56 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, gjb@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151003070256.GD11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> <1443803276.66572.72.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443803276.66572.72.camel@freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 07:03:03 -0000 On Fri, Oct 02, 2015 at 10:27:56AM -0600, Ian Lepore wrote: > On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > > Some arm documentation refers to the need for "support code" when the > > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > > be just the RPi I think). Do we have that support code? What happens > > > if it's missing? I can't actually find any info on exactly what that > > > support code is supposed to do. For all I know, we have the required > > > code in libm. Or maybe what's needed is exception-handling code in the > > > kernel. I can't find any info on what they mean by "support code" in > > > this context. > > The fpscr register is user-modifiable, so whatever happens after the > > change, could as well happen before it. > > > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > > Flush-to-zero. But I was sure that the text refers to the modes when > > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > > fault handler must do something to allow the computation to proceed. > > > > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > > looked in a few of the TRMs for different cortex-a series processors and > > > they say the hardware handles all combinations of rounding and flush to > > > zero without support software. But we should probably be on the lookout > > > for reports of misbehaving apps on RPi after this change, just in case > > > this setting has been protecting us from our ignorance there. > > > > I did found the reference to the support code in the VFP11 TRM, which in > > turns point to > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > > indeed I would need to not enable FZ on the affected hardware. > > > > That link opened a reference to a cortex-a57 chip for me. I've had > problems trying to share links to arm's documentation site, something > about the way that navbar stuff works makes pasting links not-work. I tried to reference App Notes and tutorials -> All Application Notes -> AN098 - VFP Support Code > > We support one arm11/VFPv2 chipset, the one used on RPi. It's the only > actual armv6 chip we support, all the other stuff supported by the arch > we call armv6 is really armv7. The TRM for the arm1176JZF-S core used > on RPi is the one that mentions needing support code. Yes, testing on original RPi, done by Glen, demostrates it. The test program I used is at https://www.kib.kiev.ua/kib/perl_opbasic_arith_175.c https://www.kib.kiev.ua/kib/perl_opbasic_arith_175 is the compiled binary with -mfloat-abi=softfp Also the following untested on RPi patch should fix this. I verified that it still starts with FZ bit cleared, on VFP v3 (RPi 2): https://www.kib.kiev.ua/kib/rpi-fz.1.patch From owner-svn-src-head@freebsd.org Sat Oct 3 07:30:46 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CADB3A0E610; Sat, 3 Oct 2015 07:30:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59AB7156D; Sat, 3 Oct 2015 07:30:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t937UeHP097642 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 3 Oct 2015 10:30:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t937UeHP097642 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t937UeT0097641; Sat, 3 Oct 2015 10:30:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Oct 2015 10:30:40 +0300 From: Konstantin Belousov To: Ian Lepore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, gjb@freebsd.org Subject: Re: svn commit: r288492 - head/sys/arm/arm Message-ID: <20151003073040.GE11284@kib.kiev.ua> References: <201510021326.t92DQ0Ds002986@repo.freebsd.org> <1443795970.66572.68.camel@freebsd.org> <20151002152059.GY11284@kib.kiev.ua> <1443803276.66572.72.camel@freebsd.org> <20151003070256.GD11284@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151003070256.GD11284@kib.kiev.ua> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 07:30:47 -0000 On Sat, Oct 03, 2015 at 10:02:56AM +0300, Konstantin Belousov wrote: > On Fri, Oct 02, 2015 at 10:27:56AM -0600, Ian Lepore wrote: > > On Fri, 2015-10-02 at 18:20 +0300, Konstantin Belousov wrote: > > > On Fri, Oct 02, 2015 at 08:26:10AM -0600, Ian Lepore wrote: > > > > Some arm documentation refers to the need for "support code" when the > > > > flush-to-zero option is disabled on VFPv2 hardware (which for us would > > > > be just the RPi I think). Do we have that support code? What happens > > > > if it's missing? I can't actually find any info on exactly what that > > > > support code is supposed to do. For all I know, we have the required > > > > code in libm. Or maybe what's needed is exception-handling code in the > > > > kernel. I can't find any info on what they mean by "support code" in > > > > this context. > > > The fpscr register is user-modifiable, so whatever happens after the > > > change, could as well happen before it. > > > > > > I saw the references to the support code in e.g. ARM v7-A A2.7.5 > > > Flush-to-zero. But I was sure that the text refers to the modes when > > > e.g. FZ is cleared and UFE or IXE bits are enabled. In this situation, > > > fault handler must do something to allow the computation to proceed. > > > > > > > > > > > I don't think this is an issue for VFPv3 and later hardware. I've > > > > looked in a few of the TRMs for different cortex-a series processors and > > > > they say the hardware handles all combinations of rounding and flush to > > > > zero without support software. But we should probably be on the lookout > > > > for reports of misbehaving apps on RPi after this change, just in case > > > > this setting has been protecting us from our ignorance there. > > > > > > I did found the reference to the support code in the VFP11 TRM, which in > > > turns point to > > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.epm049219/index.html > > > Does FreeBSD enable and handle this variant of coprocessor ? If yes, then > > > indeed I would need to not enable FZ on the affected hardware. > > > > > > > That link opened a reference to a cortex-a57 chip for me. I've had > > problems trying to share links to arm's documentation site, something > > about the way that navbar stuff works makes pasting links not-work. > I tried to reference > App Notes and tutorials -> All Application Notes -> AN098 - VFP > Support Code > > > > > We support one arm11/VFPv2 chipset, the one used on RPi. It's the only > > actual armv6 chip we support, all the other stuff supported by the arch > > we call armv6 is really armv7. The TRM for the arm1176JZF-S core used > > on RPi is the one that mentions needing support code. > > Yes, testing on original RPi, done by Glen, demostrates it. The test > program I used is at > https://www.kib.kiev.ua/kib/perl_opbasic_arith_175.c > https://www.kib.kiev.ua/kib/perl_opbasic_arith_175 is the compiled binary > with -mfloat-abi=softfp > > Also the following untested on RPi patch should fix this. I verified > that it still starts with FZ bit cleared, on VFP v3 (RPi 2): > https://www.kib.kiev.ua/kib/rpi-fz.1.patch Use https://www.kib.kiev.ua/kib/rpi-fz.2.patch instead, VFP v3 might also declare that denormals are not supported in hw, apparently. From owner-svn-src-head@freebsd.org Sat Oct 3 09:15:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0DECA0EDD2; Sat, 3 Oct 2015 09:15:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8FCE11CCB; Sat, 3 Oct 2015 09:15:24 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t939FOte012127; Sat, 3 Oct 2015 09:15:24 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t939FNAC012124; Sat, 3 Oct 2015 09:15:23 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510030915.t939FNAC012124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 09:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288575 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 09:15:24 -0000 Author: hrs Date: Sat Oct 3 09:15:23 2015 New Revision: 288575 URL: https://svnweb.freebsd.org/changeset/base/288575 Log: Add IFCAP_LINKSTATE support. Modified: head/sys/net/if_gif.c head/sys/net/if_gre.c head/sys/net/if_me.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_gif.c Sat Oct 3 09:15:23 2015 (r288575) @@ -197,6 +197,8 @@ gif_clone_create(struct if_clone *ifc, i GIF2IFP(sc)->if_transmit = gif_transmit; GIF2IFP(sc)->if_qflush = gif_qflush; GIF2IFP(sc)->if_output = gif_output; + GIF2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GIF2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GIF2IFP(sc)); bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t)); if (ng_gif_attach_p != NULL) @@ -1040,10 +1042,13 @@ gif_set_tunnel(struct ifnet *ifp, struct #if defined(INET) || defined(INET6) bad: #endif - if (error == 0 && sc->gif_family != 0) + if (error == 0 && sc->gif_family != 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; - else + if_link_state_change(ifp, LINK_STATE_UP); + } else { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); + } return (error); } @@ -1065,4 +1070,5 @@ gif_delete_tunnel(struct ifnet *ifp) free(sc->gif_hdr, M_GIF); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } Modified: head/sys/net/if_gre.c ============================================================================== --- head/sys/net/if_gre.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_gre.c Sat Oct 3 09:15:23 2015 (r288575) @@ -179,6 +179,8 @@ gre_clone_create(struct if_clone *ifc, i GRE2IFP(sc)->if_ioctl = gre_ioctl; GRE2IFP(sc)->if_transmit = gre_transmit; GRE2IFP(sc)->if_qflush = gre_qflush; + GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(GRE2IFP(sc)); bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t)); GRE_LIST_LOCK(); @@ -648,8 +650,10 @@ gre_set_tunnel(struct ifnet *ifp, struct break; #endif } - if (error == 0) + if (error == 0) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (error); } @@ -668,6 +672,7 @@ gre_delete_tunnel(struct ifnet *ifp) free(sc->gre_hdr, M_GRE); } ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } int Modified: head/sys/net/if_me.c ============================================================================== --- head/sys/net/if_me.c Sat Oct 3 08:07:21 2015 (r288574) +++ head/sys/net/if_me.c Sat Oct 3 09:15:23 2015 (r288575) @@ -192,6 +192,8 @@ me_clone_create(struct if_clone *ifc, in ME2IFP(sc)->if_ioctl = me_ioctl; ME2IFP(sc)->if_transmit = me_transmit; ME2IFP(sc)->if_qflush = me_qflush; + ME2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE; + ME2IFP(sc)->if_capenable |= IFCAP_LINKSTATE; if_attach(ME2IFP(sc)); bpfattach(ME2IFP(sc), DLT_NULL, sizeof(u_int32_t)); ME_LIST_LOCK(); @@ -376,8 +378,10 @@ me_set_tunnel(struct ifnet *ifp, struct if (sc->me_ecookie == NULL) sc->me_ecookie = encap_attach_func(AF_INET, IPPROTO_MOBILE, me_encapcheck, &in_mobile_protosw, sc); - if (sc->me_ecookie != NULL) + if (sc->me_ecookie != NULL) { ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_UP); + } return (0); } @@ -395,6 +399,7 @@ me_delete_tunnel(struct ifnet *ifp) sc->me_dst.s_addr = 0; ME_WUNLOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + if_link_state_change(ifp, LINK_STATE_DOWN); } static uint16_t From owner-svn-src-head@freebsd.org Sat Oct 3 11:05:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FFBA0E424; Sat, 3 Oct 2015 11:05:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31F95151E; Sat, 3 Oct 2015 11:05:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93B5xo4057250; Sat, 3 Oct 2015 11:05:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93B5xB7057249; Sat, 3 Oct 2015 11:05:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510031105.t93B5xB7057249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 3 Oct 2015 11:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288579 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 11:05:59 -0000 Author: mav Date: Sat Oct 3 11:05:58 2015 New Revision: 288579 URL: https://svnweb.freebsd.org/changeset/base/288579 Log: Restore original array_rd_sz semantics. Before r278702 prefetch was blocked for I/Os > 1MB, after -- >= 1MB. 1MB I/Os are used for bulk operations in CTL (XCOPY, VERIFY), and disabling prefetch for them reduced the performance. This is temporary local patch, that should be replaced when upstreamed. Discussed with: mahrens MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 09:47:29 2015 (r288578) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Sat Oct 3 11:05:58 2015 (r288579) @@ -449,7 +449,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, } if ((flags & DMU_READ_NO_PREFETCH) == 0 && read && - length < zfetch_array_rd_sz) { + length <= zfetch_array_rd_sz) { dmu_zfetch(&dn->dn_zfetch, blkid, nblks); } rw_exit(&dn->dn_struct_rwlock); From owner-svn-src-head@freebsd.org Sat Oct 3 12:09:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE4ACA0F800; Sat, 3 Oct 2015 12:09:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2A1A1F2D; Sat, 3 Oct 2015 12:09:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93C9DGU082739; Sat, 3 Oct 2015 12:09:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93C9Dn6082736; Sat, 3 Oct 2015 12:09:13 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031209.t93C9Dn6082736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288600 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 12:09:13 -0000 Author: hrs Date: Sat Oct 3 12:09:12 2015 New Revision: 288600 URL: https://svnweb.freebsd.org/changeset/base/288600 Log: - Schedule DAD for IN6_IFF_TENTATIVE addresses in nd6_timer(). This catches cases that DAD probes cannot be sent because of IFF_UP && !IFF_DRV_RUNNING. - nd6_dad_starttimer() now calls nd6_dad_ns_output(), instead of calling it before nd6_dad_starttimer(). - Do not release an entry in dadq when a duplicate entry is being added. Modified: head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sat Oct 3 11:43:54 2015 (r288599) +++ head/sys/netinet6/nd6.c Sat Oct 3 12:09:12 2015 (r288600) @@ -810,8 +810,31 @@ nd6_timer(void *arg) goto addrloop; } } + } else if ((ia6->ia6_flags & IN6_IFF_TENTATIVE) != 0) { + /* + * Schedule DAD for a tentative address. This happens + * if the interface was down or not running + * when the address was configured. + */ + int delay; + + delay = arc4random() % + (MAX_RTR_SOLICITATION_DELAY * hz); + nd6_dad_start((struct ifaddr *)ia6, delay); } else { /* + * Check status of the interface. If it is down, + * mark the address as tentative for future DAD. + */ + if ((ia6->ia_ifp->if_flags & IFF_UP) == 0 || + (ia6->ia_ifp->if_drv_flags & IFF_DRV_RUNNING) + == 0 || + (ND_IFINFO(ia6->ia_ifp)->flags & + ND6_IFF_IFDISABLED) != 0) { + ia6->ia6_flags &= ~IN6_IFF_DUPLICATED; + ia6->ia6_flags |= IN6_IFF_TENTATIVE; + } + /* * A new RA might have made a deprecated address * preferred. */ @@ -1452,7 +1475,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* Mark all IPv6 address as tentative. */ ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED; - if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { + if (V_ip6_dad_count > 0 && + (ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Oct 3 11:43:54 2015 (r288599) +++ head/sys/netinet6/nd6_nbr.c Sat Oct 3 12:09:12 2015 (r288600) @@ -85,11 +85,11 @@ static struct dadq *nd6_dad_find(struct static void nd6_dad_add(struct dadq *dp); static void nd6_dad_del(struct dadq *dp); static void nd6_dad_rele(struct dadq *); -static void nd6_dad_starttimer(struct dadq *, int); +static void nd6_dad_starttimer(struct dadq *, int, int); static void nd6_dad_stoptimer(struct dadq *); static void nd6_dad_timer(struct dadq *); static void nd6_dad_duplicated(struct ifaddr *, struct dadq *); -static void nd6_dad_ns_output(struct dadq *, struct ifaddr *); +static void nd6_dad_ns_output(struct dadq *); static void nd6_dad_ns_input(struct ifaddr *, struct nd_opt_nonce *); static void nd6_dad_na_input(struct ifaddr *); static void nd6_na_output_fib(struct ifnet *, const struct in6_addr *, @@ -1199,9 +1199,11 @@ nd6_dad_find(struct ifaddr *ifa, struct } static void -nd6_dad_starttimer(struct dadq *dp, int ticks) +nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) { + if (send_ns != 0) + nd6_dad_ns_output(dp); callout_reset(&dp->dad_timer_ch, ticks, (void (*)(void *))nd6_dad_timer, (void *)dp); } @@ -1240,6 +1242,7 @@ nd6_dad_start(struct ifaddr *ifa, int de struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; + int send_ns; /* * If we don't need DAD, don't do it. @@ -1276,8 +1279,10 @@ nd6_dad_start(struct ifaddr *ifa, int de return; } if ((dp = nd6_dad_find(ifa, NULL)) != NULL) { - /* DAD already in progress */ - nd6_dad_rele(dp); + /* + * DAD already in progress. Let the existing entry + * to finish it. + */ return; } @@ -1310,13 +1315,12 @@ nd6_dad_start(struct ifaddr *ifa, int de dp->dad_ns_lcount = dp->dad_loopbackprobe = 0; refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); + send_ns = 0; if (delay == 0) { - nd6_dad_ns_output(dp, ifa); - nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); - } else { - nd6_dad_starttimer(dp, delay); + send_ns = 1; + delay = (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000; } + nd6_dad_starttimer(dp, delay, send_ns); } /* @@ -1386,7 +1390,8 @@ nd6_dad_timer(struct dadq *dp) if ((dp->dad_ns_tcount > V_dad_maxtry) && (((ifp->if_flags & IFF_UP) == 0) || ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0))) { - nd6log((LOG_INFO, "%s: could not run DAD, driver problem?\n", + nd6log((LOG_INFO, "%s: could not run DAD " + "because the interface was down or not running.\n", if_name(ifa->ifa_ifp))); goto err; } @@ -1396,9 +1401,8 @@ nd6_dad_timer(struct dadq *dp) /* * We have more NS to go. Send NS packet for DAD. */ - nd6_dad_ns_output(dp, ifa); nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, 1); goto done; } else { /* @@ -1426,11 +1430,11 @@ nd6_dad_timer(struct dadq *dp) * Send an NS immediately and increase dad_count by * V_nd6_mmaxtries - 1. */ - nd6_dad_ns_output(dp, ifa); dp->dad_count = dp->dad_ns_ocount + V_nd6_mmaxtries - 1; nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, + 1); goto done; } else { /* @@ -1517,10 +1521,10 @@ nd6_dad_duplicated(struct ifaddr *ifa, s } static void -nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) +nd6_dad_ns_output(struct dadq *dp) { - struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; - struct ifnet *ifp = ifa->ifa_ifp; + struct in6_ifaddr *ia = (struct in6_ifaddr *)dp->dad_ifa; + struct ifnet *ifp = dp->dad_ifa->ifa_ifp; int i; dp->dad_ns_tcount++; From owner-svn-src-head@freebsd.org Sat Oct 3 12:40:55 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66E58A0C3A3; Sat, 3 Oct 2015 12:40:55 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 582771D26; Sat, 3 Oct 2015 12:40:55 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93CetIm097640; Sat, 3 Oct 2015 12:40:55 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93CetWn097639; Sat, 3 Oct 2015 12:40:55 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031240.t93CetWn097639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288601 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 12:40:55 -0000 Author: hrs Date: Sat Oct 3 12:40:54 2015 New Revision: 288601 URL: https://svnweb.freebsd.org/changeset/base/288601 Log: - Move PF_LOCAL at the end of the array. PF_INET{,6} is used more often. - Add SOCKTYPE_ANY to PF_LOCAL. - Apply AI_CANONNAME to only AF_INET{,6}. It is not meaningful for the other AFs. Modified: head/lib/libc/net/getaddrinfo.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Sat Oct 3 12:09:12 2015 (r288600) +++ head/lib/libc/net/getaddrinfo.c Sat Oct 3 12:40:54 2015 (r288601) @@ -168,12 +168,6 @@ struct explore { }; static const struct explore explore[] = { - { PF_LOCAL, SOCK_DGRAM, ANY, - AF_ANY | PROTOCOL_ANY }, - { PF_LOCAL, SOCK_STREAM, ANY, - AF_ANY | PROTOCOL_ANY }, - { PF_LOCAL, SOCK_SEQPACKET, ANY, - AF_ANY | PROTOCOL_ANY }, #ifdef INET6 { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, @@ -200,6 +194,12 @@ static const struct explore explore[] = AF_ANY | SOCKTYPE_ANY }, { PF_INET, SOCK_RAW, ANY, AF_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_DGRAM, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_STREAM, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, + { PF_LOCAL, SOCK_SEQPACKET, ANY, + AF_ANY | SOCKTYPE_ANY | PROTOCOL_ANY }, { -1, 0, 0, 0 }, }; @@ -1245,7 +1245,9 @@ explore_numeric(const struct addrinfo *p if (pai->ai_family == afd->a_af) { GET_AI(ai, afd, p); GET_PORT(ai, servname); - if ((pai->ai_flags & AI_CANONNAME)) { + if ((pai->ai_family == AF_INET || + pai->ai_family == AF_INET6) && + (pai->ai_flags & AI_CANONNAME)) { /* * Set the numeric address itself as the canonical * name, based on a clarification in RFC3493. From owner-svn-src-head@freebsd.org Sat Oct 3 12:49:06 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46F17A0C691; Sat, 3 Oct 2015 12:49:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C80A111E; Sat, 3 Oct 2015 12:49:06 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Cn5sh099161; Sat, 3 Oct 2015 12:49:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Cn5rW099160; Sat, 3 Oct 2015 12:49:05 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201510031249.t93Cn5rW099160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sat, 3 Oct 2015 12:49:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288602 - head/bin/cat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 12:49:06 -0000 Author: hrs Date: Sat Oct 3 12:49:05 2015 New Revision: 288602 URL: https://svnweb.freebsd.org/changeset/base/288602 Log: Use getaddrinfo() to fill struct sockaddr_un. It now supports SOCK_DGRAM and SOCK_SEQPACKET in addition to SOCK_STREAM. Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Sat Oct 3 12:40:54 2015 (r288601) +++ head/bin/cat/cat.c Sat Oct 3 12:49:05 2015 (r288602) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif #include @@ -302,31 +303,39 @@ raw_cat(int rfd) static int udom_open(const char *path, int flags) { - struct sockaddr_un sou; - int fd; - unsigned int len; - - bzero(&sou, sizeof(sou)); + struct addrinfo hints, *res, *res0; + char rpath[PATH_MAX]; + int fd, error; /* - * Construct the unix domain socket address and attempt to connect + * Construct the unix domain socket address and attempt to connect. */ - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd >= 0) { - sou.sun_family = AF_UNIX; - if ((len = strlcpy(sou.sun_path, path, - sizeof(sou.sun_path))) >= sizeof(sou.sun_path)) { - close(fd); - errno = ENAMETOOLONG; + bzero(&hints, sizeof(hints)); + hints.ai_family = AF_LOCAL; + if (realpath(path, rpath) == NULL) + return (-1); + error = getaddrinfo(rpath, NULL, &hints, &res0); + if (error) { + warn("%s", gai_strerror(error)); + errno = EINVAL; + return (-1); + } + for (res = res0; res != NULL; res = res->ai_next) { + fd = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (fd < 0) { + freeaddrinfo(res0); return (-1); } - len = offsetof(struct sockaddr_un, sun_path[len+1]); - - if (connect(fd, (void *)&sou, len) < 0) { + error = connect(fd, res->ai_addr, res->ai_addrlen); + if (error == 0) + break; + else { close(fd); fd = -1; } } + freeaddrinfo(res0); /* * handle the open flags by shutting down appropriate directions From owner-svn-src-head@freebsd.org Sat Oct 3 15:48:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33250A0E98B; Sat, 3 Oct 2015 15:48:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1751B187E; Sat, 3 Oct 2015 15:48:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93FmMiZ073052; Sat, 3 Oct 2015 15:48:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93FmMHv073050; Sat, 3 Oct 2015 15:48:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031548.t93FmMHv073050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288603 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 15:48:23 -0000 Author: adrian Date: Sat Oct 3 15:48:21 2015 New Revision: 288603 URL: https://svnweb.freebsd.org/changeset/base/288603 Log: run(4): Add initial support for IBSS merge. Submitted by: Differential Revision: https://reviews.freebsd.org/D3592 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runvar.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 12:49:05 2015 (r288602) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 15:48:21 2015 (r288603) @@ -392,6 +392,8 @@ static void run_drain_fifo(void *); static void run_iter_func(void *, struct ieee80211_node *); static void run_newassoc_cb(void *); static void run_newassoc(struct ieee80211_node *, int); +static void run_recv_mgmt(struct ieee80211_node *, struct mbuf *, int, + const struct ieee80211_rx_stats *, int, int); static void run_rx_frame(struct run_softc *, struct mbuf *, uint32_t); static void run_tx_free(struct run_endpoint_queue *pq, struct run_tx_data *, int); @@ -939,6 +941,10 @@ run_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = run_newstate; + if (opmode == IEEE80211_M_IBSS) { + rvp->recv_mgmt = vap->iv_recv_mgmt; + vap->iv_recv_mgmt = run_recv_mgmt; + } ieee80211_ratectl_init(vap); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); @@ -2725,6 +2731,34 @@ run_maxrssi_chain(struct run_softc *sc, } static void +run_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m, int subtype, + const struct ieee80211_rx_stats *rxs, int rssi, int nf) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct run_softc *sc = vap->iv_ic->ic_softc; + struct run_vap *rvp = RUN_VAP(vap); + uint64_t ni_tstamp, rx_tstamp; + + rvp->recv_mgmt(ni, m, subtype, rxs, rssi, nf); + + if (vap->iv_state == IEEE80211_S_RUN && + (subtype == IEEE80211_FC0_SUBTYPE_BEACON || + subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP)) { + ni_tstamp = le64toh(ni->ni_tstamp.tsf); + RUN_LOCK(sc); + run_get_tsf(sc, &rx_tstamp); + RUN_UNLOCK(sc); + rx_tstamp = le64toh(rx_tstamp); + + if (ni_tstamp >= rx_tstamp) { + DPRINTF("ibss merge, tsf %ju tstamp %ju\n", + (uintmax_t)rx_tstamp, (uintmax_t)ni_tstamp); + (void) ieee80211_ibss_merge(ni); + } + } +} + +static void run_rx_frame(struct run_softc *sc, struct mbuf *m, uint32_t dmalen) { struct ieee80211com *ic = &sc->sc_ic; Modified: head/sys/dev/usb/wlan/if_runvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_runvar.h Sat Oct 3 12:49:05 2015 (r288602) +++ head/sys/dev/usb/wlan/if_runvar.h Sat Oct 3 15:48:21 2015 (r288603) @@ -123,6 +123,10 @@ struct run_vap { int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); + void (*recv_mgmt)(struct ieee80211_node *, + struct mbuf *, int, + const struct ieee80211_rx_stats *, + int, int); uint8_t rvp_id; }; From owner-svn-src-head@freebsd.org Sat Oct 3 15:49:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70D45A0EA90; Sat, 3 Oct 2015 15:49:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 618C219FD; Sat, 3 Oct 2015 15:49:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fnu66073197; Sat, 3 Oct 2015 15:49:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fnt9d073195; Sat, 3 Oct 2015 15:49:55 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031549.t93Fnt9d073195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:49:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288604 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 15:49:56 -0000 Author: adrian Date: Sat Oct 3 15:49:55 2015 New Revision: 288604 URL: https://svnweb.freebsd.org/changeset/base/288604 Log: rum(4): add TSF field into radiotap headers Submitted by: Differential Revision: https://reviews.freebsd.org/D3607 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:48:21 2015 (r288603) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:49:55 2015 (r288604) @@ -206,6 +206,7 @@ static void rum_set_chan(struct rum_sof static void rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); +static void rum_get_tsf(struct rum_softc *, uint64_t *); static void rum_update_slot(struct rum_softc *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -857,6 +858,7 @@ tr_setup: tap->wt_flags = 0; tap->wt_rate = data->rate; + rum_get_tsf(sc, &tap->wt_tsf); tap->wt_antenna = sc->tx_ant; ieee80211_radiotap_tx(vap, m); @@ -963,11 +965,11 @@ rum_bulk_read_callback(struct usb_xfer * if (ieee80211_radiotap_active(ic)) { struct rum_rx_radiotap_header *tap = &sc->sc_rxtap; - /* XXX read tsf */ tap->wr_flags = 0; tap->wr_rate = ieee80211_plcp2rate(sc->sc_rx_desc.rate, (flags & RT2573_RX_OFDM) ? IEEE80211_T_OFDM : IEEE80211_T_CCK); + rum_get_tsf(sc, &tap->wr_tsf); tap->wr_antsignal = RT2573_NOISE_FLOOR + rssi; tap->wr_antnoise = RT2573_NOISE_FLOOR; tap->wr_antenna = sc->rx_ant; @@ -1836,6 +1838,12 @@ rum_abort_tsf_sync(struct rum_softc *sc) } static void +rum_get_tsf(struct rum_softc *sc, uint64_t *buf) +{ + rum_read_multi(sc, RT2573_TXRX_CSR12, buf, sizeof (*buf)); +} + +static void rum_update_slot(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 15:48:21 2015 (r288603) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 15:49:55 2015 (r288604) @@ -22,6 +22,7 @@ struct rum_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; uint8_t wr_flags; uint8_t wr_rate; uint16_t wr_chan_freq; @@ -32,7 +33,8 @@ struct rum_rx_radiotap_header { } __packed __aligned(8); #define RT2573_RX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \ @@ -42,6 +44,7 @@ struct rum_rx_radiotap_header { struct rum_tx_radiotap_header { struct ieee80211_radiotap_header wt_ihdr; + uint64_t wt_tsf; uint8_t wt_flags; uint8_t wt_rate; uint16_t wt_chan_freq; @@ -50,7 +53,8 @@ struct rum_tx_radiotap_header { } __packed __aligned(8); #define RT2573_TX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_ANTENNA)) From owner-svn-src-head@freebsd.org Sat Oct 3 15:52:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD9DA0D09F; Sat, 3 Oct 2015 15:52:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BB301E77; Sat, 3 Oct 2015 15:52:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fqxwr077045; Sat, 3 Oct 2015 15:52:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fqx80077044; Sat, 3 Oct 2015 15:52:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031552.t93Fqx80077044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288605 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 15:52:59 -0000 Author: adrian Date: Sat Oct 3 15:52:58 2015 New Revision: 288605 URL: https://svnweb.freebsd.org/changeset/base/288605 Log: rum(4): check mbuf size before accessing its contents Submitted by: Differential Revision: https://reviews.freebsd.org/D3610 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:49:55 2015 (r288604) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:52:58 2015 (r288605) @@ -912,6 +912,7 @@ rum_bulk_read_callback(struct usb_xfer * { struct rum_softc *sc = usbd_xfer_softc(xfer); struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_frame_min *wh; struct ieee80211_node *ni; struct mbuf *m = NULL; struct usb_page_cache *pc; @@ -959,6 +960,8 @@ rum_bulk_read_callback(struct usb_xfer * usbd_copy_out(pc, RT2573_RX_DESC_SIZE, mtod(m, uint8_t *), len); + wh = mtod(m, struct ieee80211_frame_min *); + /* finalize mbuf */ m->m_pkthdr.len = m->m_len = (flags >> 16) & 0xfff; @@ -987,8 +990,11 @@ tr_setup: */ RUM_UNLOCK(sc); if (m) { - ni = ieee80211_find_rxnode(ic, - mtod(m, struct ieee80211_frame_min *)); + if (m->m_len >= sizeof(struct ieee80211_frame_min)) + ni = ieee80211_find_rxnode(ic, wh); + else + ni = NULL; + if (ni != NULL) { (void) ieee80211_input(ni, m, rssi, RT2573_NOISE_FLOOR); From owner-svn-src-head@freebsd.org Sat Oct 3 15:58:01 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5414FA0D3D0; Sat, 3 Oct 2015 15:58:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 358811088; Sat, 3 Oct 2015 15:58:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Fw1lw077432; Sat, 3 Oct 2015 15:58:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Fw1o2077431; Sat, 3 Oct 2015 15:58:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031558.t93Fw1o2077431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 15:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288606 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 15:58:01 -0000 Author: adrian Date: Sat Oct 3 15:58:00 2015 New Revision: 288606 URL: https://svnweb.freebsd.org/changeset/base/288606 Log: rum(4): simplify error handling rum_raw_xmit() Move the mbuf free responsibility to the caller of the hardware xmit function, not the hardware xmit function itself. Submitted by: Differential Revision: https://reviews.freebsd.org/D3621 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:52:58 2015 (r288605) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 15:58:00 2015 (r288606) @@ -1157,10 +1157,9 @@ rum_tx_mgt(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m0); - if (k == NULL) { - m_freem(m0); - return ENOBUFS; - } + if (k == NULL) + return (ENOBUFS); + wh = mtod(m0, struct ieee80211_frame *); } @@ -1205,13 +1204,11 @@ rum_tx_raw(struct rum_softc *sc, struct int rate, error; RUM_LOCK_ASSERT(sc); - KASSERT(params != NULL, ("no raw xmit params")); rate = params->ibp_rate0; - if (!ieee80211_isratevalid(ic->ic_rt, rate)) { - m_freem(m0); - return EINVAL; - } + if (!ieee80211_isratevalid(ic->ic_rt, rate)) + return (EINVAL); + flags = 0; if ((params->ibp_flags & IEEE80211_BPF_NOACK) == 0) flags |= RT2573_TX_NEED_ACK; @@ -1220,10 +1217,9 @@ rum_tx_raw(struct rum_softc *sc, struct params->ibp_flags & IEEE80211_BPF_RTS ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_CTSONLY, rate); - if (error || sc->tx_nfree == 0) { - m_freem(m0); - return ENOBUFS; - } + if (error || sc->tx_nfree == 0) + return (ENOBUFS); + flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } @@ -2224,20 +2220,17 @@ rum_raw_xmit(struct ieee80211_node *ni, const struct ieee80211_bpf_params *params) { struct rum_softc *sc = ni->ni_ic->ic_softc; + int ret; RUM_LOCK(sc); /* prevent management frames from being sent if we're not ready */ if (!sc->sc_running) { - RUM_UNLOCK(sc); - m_freem(m); - ieee80211_free_node(ni); - return ENETDOWN; + ret = ENETDOWN; + goto bad; } if (sc->tx_nfree < RUM_TX_MINFREE) { - RUM_UNLOCK(sc); - m_freem(m); - ieee80211_free_node(ni); - return EIO; + ret = EIO; + goto bad; } if (params == NULL) { @@ -2245,14 +2238,14 @@ rum_raw_xmit(struct ieee80211_node *ni, * Legacy path; interpret frame contents to decide * precisely how to send the frame. */ - if (rum_tx_mgt(sc, m, ni) != 0) + if ((ret = rum_tx_mgt(sc, m, ni)) != 0) goto bad; } else { /* * Caller supplied explicit parameters to use in * sending the frame. */ - if (rum_tx_raw(sc, m, ni, params) != 0) + if ((ret = rum_tx_raw(sc, m, ni, params)) != 0) goto bad; } RUM_UNLOCK(sc); @@ -2260,8 +2253,9 @@ rum_raw_xmit(struct ieee80211_node *ni, return 0; bad: RUM_UNLOCK(sc); + m_freem(m); ieee80211_free_node(ni); - return EIO; + return ret; } static void From owner-svn-src-head@freebsd.org Sat Oct 3 16:09:56 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B46A0DBAA; Sat, 3 Oct 2015 16:09:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0354317E6; Sat, 3 Oct 2015 16:09:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93G9tKM081962; Sat, 3 Oct 2015 16:09:55 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93G9ttI081961; Sat, 3 Oct 2015 16:09:55 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031609.t93G9ttI081961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288608 - head/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 16:09:56 -0000 Author: bdrewery Date: Sat Oct 3 16:09:55 2015 New Revision: 288608 URL: https://svnweb.freebsd.org/changeset/base/288608 Log: Avoid make compatibility mode issues with creating cookies from r287844 and r287848. Also hide the cookie creation. Suggested by: imp, Daniel O'Connor Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sat Oct 3 16:01:16 2015 (r288607) +++ head/include/Makefile Sat Oct 3 16:09:55 2015 (r288608) @@ -166,7 +166,7 @@ compat: -f ${.CURDIR}/../etc/mtree/BSD.include.dist \ -p ${DESTDIR}${INCLUDEDIR} > /dev/null .if ${MK_META_MODE} == "yes" - touch ${.TARGET} + @touch ${.TARGET} .endif copies: @@ -255,8 +255,7 @@ copies: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ ${DESTDIR}${INCLUDEDIR}/teken .if ${MK_META_MODE} == "yes" - cd ${.OBJDIR} - touch ${.TARGET} + @touch ${.OBJDIR}/${.TARGET} .endif symlinks: @@ -373,8 +372,7 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/rpc; \ done .if ${MK_META_MODE} == "yes" - cd ${.OBJDIR} - touch ${.TARGET} + touch ${.OBJDIR}/${.TARGET} .endif .if ${MACHINE} == "host" From owner-svn-src-head@freebsd.org Sat Oct 3 16:21:07 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7115A0E3CD; Sat, 3 Oct 2015 16:21:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7B481E3B; Sat, 3 Oct 2015 16:21:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GL7xT089334; Sat, 3 Oct 2015 16:21:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GL7TA089333; Sat, 3 Oct 2015 16:21:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031621.t93GL7TA089333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 16:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288609 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 16:21:07 -0000 Author: adrian Date: Sat Oct 3 16:21:06 2015 New Revision: 288609 URL: https://svnweb.freebsd.org/changeset/base/288609 Log: rum(4): add error handling in initialization path Tested: * Tested on WUSB54GC, STA mode. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3622 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:09:55 2015 (r288608) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:21:06 2015 (r288609) @@ -216,7 +216,7 @@ static void rum_setpromisc(struct rum_s static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); -static void rum_init(struct rum_softc *); +static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); @@ -1373,24 +1373,22 @@ static void rum_parent(struct ieee80211com *ic) { struct rum_softc *sc = ic->ic_softc; - int startall = 0; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); RUM_LOCK(sc); if (sc->sc_detached) { RUM_UNLOCK(sc); return; } + RUM_UNLOCK(sc); + if (ic->ic_nrunning > 0) { - if (!sc->sc_running) { - rum_init(sc); - startall = 1; - } else - rum_setpromisc(sc); - } else if (sc->sc_running) + if (rum_init(sc) == 0) + ieee80211_start_all(ic); + else + ieee80211_stop(vap); + } else rum_stop(sc); - RUM_UNLOCK(sc); - if (startall) - ieee80211_start_all(ic); } static void @@ -2043,18 +2041,19 @@ rum_bbp_init(struct rum_softc *sc) return 0; } -static void +static int rum_init(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); uint32_t tmp; - usb_error_t error; - int i, ntries; - - RUM_LOCK_ASSERT(sc); + int i, ntries, ret; - rum_stop(sc); + RUM_LOCK(sc); + if (sc->sc_running) { + ret = 0; + goto end; + } /* initialize MAC registers to default values */ for (i = 0; i < nitems(rum_def_mac); i++) @@ -2075,11 +2074,12 @@ rum_init(struct rum_softc *sc) if (ntries == 100) { device_printf(sc->sc_dev, "timeout waiting for BBP/RF to wakeup\n"); - goto fail; + ret = ETIMEDOUT; + goto end; } - if ((error = rum_bbp_init(sc)) != 0) - goto fail; + if ((ret = rum_bbp_init(sc)) != 0) + goto end; /* select default channel */ rum_select_band(sc, ic->ic_curchan); @@ -2116,20 +2116,25 @@ rum_init(struct rum_softc *sc) sc->sc_running = 1; usbd_xfer_set_stall(sc->sc_xfer[RUM_BULK_WR]); usbd_transfer_start(sc->sc_xfer[RUM_BULK_RD]); - return; -fail: rum_stop(sc); -#undef N +end: RUM_UNLOCK(sc); + + if (ret != 0) + rum_stop(sc); + + return ret; } static void rum_stop(struct rum_softc *sc) { - RUM_LOCK_ASSERT(sc); - + RUM_LOCK(sc); + if (!sc->sc_running) { + RUM_UNLOCK(sc); + return; + } sc->sc_running = 0; - RUM_UNLOCK(sc); /* @@ -2139,7 +2144,6 @@ rum_stop(struct rum_softc *sc) usbd_transfer_drain(sc->sc_xfer[RUM_BULK_RD]); RUM_LOCK(sc); - rum_unsetup_tx_list(sc); /* disable Rx */ @@ -2148,6 +2152,7 @@ rum_stop(struct rum_softc *sc) /* reset ASIC */ rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); + RUM_UNLOCK(sc); } static void From owner-svn-src-head@freebsd.org Sat Oct 3 16:34:23 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21FEAA0EC2F; Sat, 3 Oct 2015 16:34:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1244C1C1B; Sat, 3 Oct 2015 16:34:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GYM1F094999; Sat, 3 Oct 2015 16:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GYMG2094996; Sat, 3 Oct 2015 16:34:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031634.t93GYMG2094996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 16:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288615 - in head/lib: libusb libz X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 16:34:23 -0000 Author: bdrewery Date: Sat Oct 3 16:34:21 2015 New Revision: 288615 URL: https://svnweb.freebsd.org/changeset/base/288615 Log: Remove redundant COMPAT_32BIT guard on pkgconfig files. This is already handled by the LIBRARIES_ONLY mechanism protecting FILES. Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libusb/Makefile head/lib/libz/Makefile Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Sat Oct 3 16:26:46 2015 (r288614) +++ head/lib/libusb/Makefile Sat Oct 3 16:34:21 2015 (r288615) @@ -35,10 +35,10 @@ SRCS+= libusb10_io.c .if defined(COMPAT_32BIT) CFLAGS+= -DCOMPAT_32BIT -.else +.endif + FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc FILESDIR= ${LIBDATADIR}/pkgconfig -.endif # # Cross platform support Modified: head/lib/libz/Makefile ============================================================================== --- head/lib/libz/Makefile Sat Oct 3 16:26:46 2015 (r288614) +++ head/lib/libz/Makefile Sat Oct 3 16:34:21 2015 (r288615) @@ -68,10 +68,8 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) -.ifndef COMPAT_32BIT FILES= zlib.pc FILESDIR= ${LIBDATADIR}/pkgconfig -.endif .include From owner-svn-src-head@freebsd.org Sat Oct 3 16:37:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B29CA0EDD7; Sat, 3 Oct 2015 16:37:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71A9D1DB2; Sat, 3 Oct 2015 16:37:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93GbdYm095271; Sat, 3 Oct 2015 16:37:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93GbdZn095270; Sat, 3 Oct 2015 16:37:39 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031637.t93GbdZn095270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 16:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288616 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 16:37:39 -0000 Author: adrian Date: Sat Oct 3 16:37:38 2015 New Revision: 288616 URL: https://svnweb.freebsd.org/changeset/base/288616 Log: rum(4): move some code from rum_init() into separate function. Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3623 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:34:21 2015 (r288615) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 16:37:38 2015 (r288616) @@ -215,6 +215,7 @@ static void rum_update_promisc(struct i static void rum_setpromisc(struct rum_softc *); static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); +static int rum_bbp_wakeup(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); @@ -2010,6 +2011,27 @@ rum_read_eeprom(struct rum_softc *sc) } static int +rum_bbp_wakeup(struct rum_softc *sc) +{ + unsigned int ntries; + + for (ntries = 0; ntries < 100; ntries++) { + if (rum_read(sc, RT2573_MAC_CSR12) & 8) + break; + rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */ + if (rum_pause(sc, hz / 100)) + break; + } + if (ntries == 100) { + device_printf(sc->sc_dev, + "timeout waiting for BBP/RF to wakeup\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int rum_bbp_init(struct rum_softc *sc) { int i, ntries; @@ -2047,7 +2069,7 @@ rum_init(struct rum_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); uint32_t tmp; - int i, ntries, ret; + int i, ret; RUM_LOCK(sc); if (sc->sc_running) { @@ -2064,19 +2086,8 @@ rum_init(struct rum_softc *sc) rum_write(sc, RT2573_MAC_CSR1, 0); /* wait for BBP/RF to wakeup */ - for (ntries = 0; ntries < 100; ntries++) { - if (rum_read(sc, RT2573_MAC_CSR12) & 8) - break; - rum_write(sc, RT2573_MAC_CSR12, 4); /* force wakeup */ - if (rum_pause(sc, hz / 100)) - break; - } - if (ntries == 100) { - device_printf(sc->sc_dev, - "timeout waiting for BBP/RF to wakeup\n"); - ret = ETIMEDOUT; + if ((ret = rum_bbp_wakeup(sc)) != 0) goto end; - } if ((ret = rum_bbp_init(sc)) != 0) goto end; From owner-svn-src-head@freebsd.org Sat Oct 3 17:04:53 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E1B8A0E057; Sat, 3 Oct 2015 17:04:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C3C41B30; Sat, 3 Oct 2015 17:04:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93H4rar007412; Sat, 3 Oct 2015 17:04:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93H4rho007411; Sat, 3 Oct 2015 17:04:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201510031704.t93H4rho007411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 3 Oct 2015 17:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288617 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:04:53 -0000 Author: alc Date: Sat Oct 3 17:04:52 2015 New Revision: 288617 URL: https://svnweb.freebsd.org/changeset/base/288617 Log: Perform a single batched update to the object's paging-in-progress count rather than updating it for each page. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat Oct 3 16:37:38 2015 (r288616) +++ head/sys/kern/vfs_bio.c Sat Oct 3 17:04:52 2015 (r288617) @@ -2050,11 +2050,10 @@ vfs_vmio_iodone(struct buf *bp) (intmax_t)foff, (uintmax_t)m->pindex)); vm_page_sunbusy(m); - vm_object_pip_subtract(obj, 1); foff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; iosize -= resid; } - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeupn(obj, bp->b_npages); VM_OBJECT_WUNLOCK(obj); if (bogus && buf_mapped(bp)) { BUF_CHECK_MAPPED(bp); @@ -3923,10 +3922,9 @@ vfs_unbusy_pages(struct buf *bp) } else BUF_CHECK_UNMAPPED(bp); } - vm_object_pip_subtract(obj, 1); vm_page_sunbusy(m); } - vm_object_pip_wakeupn(obj, 0); + vm_object_pip_wakeupn(obj, bp->b_npages); VM_OBJECT_WUNLOCK(obj); } From owner-svn-src-head@freebsd.org Sat Oct 3 17:11:22 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 723BFA0F108; Sat, 3 Oct 2015 17:11:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 570B21542; Sat, 3 Oct 2015 17:11:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HBMbS014979; Sat, 3 Oct 2015 17:11:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HBMKN014978; Sat, 3 Oct 2015 17:11:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031711.t93HBMKN014978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288618 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:11:22 -0000 Author: adrian Date: Sat Oct 3 17:11:21 2015 New Revision: 288618 URL: https://svnweb.freebsd.org/changeset/base/288618 Log: rum(4): add error handling for rum_enable_tsf_sync() and rum_prepare_beacon() Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Note: haven't tested AP mode yet; will do once the rest of the AP mode / power save commits are in. Submitted by: Differential Revision: https://reviews.freebsd.org/D3624 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:04:52 2015 (r288617) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:11:21 2015 (r288618) @@ -203,7 +203,7 @@ static void rum_select_band(struct rum_ struct ieee80211_channel *); static void rum_set_chan(struct rum_softc *, struct ieee80211_channel *); -static void rum_enable_tsf_sync(struct rum_softc *); +static int rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); @@ -221,7 +221,7 @@ static int rum_init(struct rum_softc *) static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); -static void rum_prepare_beacon(struct rum_softc *, +static int rum_prepare_beacon(struct rum_softc *, struct ieee80211vap *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -755,6 +755,7 @@ rum_newstate(struct ieee80211vap *vap, e const struct ieee80211_txparam *tp; enum ieee80211_state ostate; struct ieee80211_node *ni; + int ret; ostate = vap->iv_state; DPRINTF("%s -> %s\n", @@ -777,10 +778,8 @@ rum_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode != IEEE80211_M_MONITOR) { if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { - RUM_UNLOCK(sc); - IEEE80211_LOCK(ic); - ieee80211_free_node(ni); - return (-1); + ret = EINVAL; + goto run_fail; } rum_update_slot(sc); rum_enable_mrr(sc); @@ -791,12 +790,15 @@ rum_newstate(struct ieee80211vap *vap, e } if (vap->iv_opmode == IEEE80211_M_HOSTAP || - vap->iv_opmode == IEEE80211_M_IBSS) - rum_prepare_beacon(sc, vap); + vap->iv_opmode == IEEE80211_M_IBSS) { + if ((ret = rum_prepare_beacon(sc, vap)) != 0) + goto run_fail; + } - if (vap->iv_opmode != IEEE80211_M_MONITOR) - rum_enable_tsf_sync(sc); - else + if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if ((ret = rum_enable_tsf_sync(sc)) != 0) + goto run_fail; + } else rum_enable_tsf(sc); /* enable automatic rate adaptation */ @@ -811,6 +813,12 @@ rum_newstate(struct ieee80211vap *vap, e RUM_UNLOCK(sc); IEEE80211_LOCK(ic); return (rvp->newstate(vap, nstate, arg)); + +run_fail: + RUM_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return ret; } static void @@ -1773,7 +1781,7 @@ rum_set_chan(struct rum_softc *sc, struc * Enable TSF synchronization and tell h/w to start sending beacons for IBSS * and HostAP operating modes. */ -static void +static int rum_enable_tsf_sync(struct rum_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -1785,7 +1793,8 @@ rum_enable_tsf_sync(struct rum_softc *sc * Change default 16ms TBTT adjustment to 8ms. * Must be done before enabling beacon generation. */ - rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8); + if (rum_write(sc, RT2573_TXRX_CSR10, 1 << 12 | 8) != 0) + return EIO; } tmp = rum_read(sc, RT2573_TXRX_CSR9) & 0xff000000; @@ -1819,10 +1828,13 @@ rum_enable_tsf_sync(struct rum_softc *sc device_printf(sc->sc_dev, "Enabling TSF failed. undefined opmode %d\n", vap->iv_opmode); - return; + return EINVAL; } - rum_write(sc, RT2573_TXRX_CSR9, tmp); + if (rum_write(sc, RT2573_TXRX_CSR9, tmp) != 0) + return EIO; + + return 0; } static void @@ -2200,35 +2212,43 @@ rum_load_microcode(struct rum_softc *sc, rum_pause(sc, hz / 8); } -static void +static int rum_prepare_beacon(struct rum_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; const struct ieee80211_txparam *tp; struct rum_tx_desc desc; struct mbuf *m0; + int ret = 0; if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) - return; + return EINVAL; if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) - return; + return EINVAL; m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); if (m0 == NULL) - return; + return ENOMEM; tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, m0->m_pkthdr.len, tp->mgmtrate); /* copy the first 24 bytes of Tx descriptor into NIC memory */ - rum_write_multi(sc, RT2573_HW_BEACON_BASE0, (uint8_t *)&desc, 24); + if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0, + (uint8_t *)&desc, 24)) != 0) { + ret = EIO; + goto end; + } /* copy beacon header and payload into NIC memory */ - rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), - m0->m_pkthdr.len); + if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), + m0->m_pkthdr.len)) != 0) + ret = EIO; +end: m_freem(m0); + return ret; } static int From owner-svn-src-head@freebsd.org Sat Oct 3 17:18:36 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA62DA0F855; Sat, 3 Oct 2015 17:18:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9ADBD1BA1; Sat, 3 Oct 2015 17:18:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HIaK0019627; Sat, 3 Oct 2015 17:18:36 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HIa5w019625; Sat, 3 Oct 2015 17:18:36 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031718.t93HIa5w019625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288619 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:18:36 -0000 Author: adrian Date: Sat Oct 3 17:18:35 2015 New Revision: 288619 URL: https://svnweb.freebsd.org/changeset/base/288619 Log: rum(4): do not corrupt MAC address Don't override the NIC MAC address with an overridden MAC address for a VAP. Submitted by: Differential Revision: https://reviews.freebsd.org/D3625 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:11:21 2015 (r288618) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:18:35 2015 (r288619) @@ -785,8 +785,8 @@ rum_newstate(struct ieee80211vap *vap, e rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); - IEEE80211_ADDR_COPY(ic->ic_macaddr, ni->ni_bssid); - rum_set_bssid(sc, ic->ic_macaddr); + IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); + rum_set_bssid(sc, sc->sc_bssid); } if (vap->iv_opmode == IEEE80211_M_HOSTAP || @@ -2368,7 +2368,7 @@ rum_scan_end(struct ieee80211com *ic) RUM_LOCK(sc); rum_enable_tsf_sync(sc); - rum_set_bssid(sc, ic->ic_macaddr); + rum_set_bssid(sc, sc->sc_bssid); RUM_UNLOCK(sc); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:11:21 2015 (r288618) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:18:35 2015 (r288619) @@ -137,6 +137,8 @@ struct rum_softc { u_int sc_detached:1, sc_running:1; + uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + struct { uint8_t val; uint8_t reg; From owner-svn-src-head@freebsd.org Sat Oct 3 17:28:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D9C0A0FE92; Sat, 3 Oct 2015 17:28:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E48D10C6; Sat, 3 Oct 2015 17:28:47 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HSlgY023676; Sat, 3 Oct 2015 17:28:47 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HSlZ8023675; Sat, 3 Oct 2015 17:28:47 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031728.t93HSlZ8023675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 17:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288620 - head/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:28:47 -0000 Author: bdrewery Date: Sat Oct 3 17:28:46 2015 New Revision: 288620 URL: https://svnweb.freebsd.org/changeset/base/288620 Log: Mute this cookie as well Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Sat Oct 3 17:18:35 2015 (r288619) +++ head/include/Makefile Sat Oct 3 17:28:46 2015 (r288620) @@ -372,7 +372,7 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/rpc; \ done .if ${MK_META_MODE} == "yes" - touch ${.OBJDIR}/${.TARGET} + @touch ${.OBJDIR}/${.TARGET} .endif .if ${MACHINE} == "host" From owner-svn-src-head@freebsd.org Sat Oct 3 17:30:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66710A0FFD5; Sat, 3 Oct 2015 17:30:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D33912EC; Sat, 3 Oct 2015 17:30:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HUwwX026916; Sat, 3 Oct 2015 17:30:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HUvo4026914; Sat, 3 Oct 2015 17:30:57 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031730.t93HUvo4026914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288621 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:30:58 -0000 Author: adrian Date: Sat Oct 3 17:30:57 2015 New Revision: 288621 URL: https://svnweb.freebsd.org/changeset/base/288621 Log: rum(4): simplify rum_set_bssid(), rum_set_macaddr() and rum_update_promisc() Tested: * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3626 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:28:46 2015 (r288620) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:30:57 2015 (r288621) @@ -1872,25 +1872,21 @@ rum_update_slot(struct rum_softc *sc) static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { - uint32_t tmp; - - tmp = bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24; - rum_write(sc, RT2573_MAC_CSR4, tmp); - tmp = bssid[4] | bssid[5] << 8 | RT2573_ONE_BSSID << 16; - rum_write(sc, RT2573_MAC_CSR5, tmp); + rum_write(sc, RT2573_MAC_CSR4, + bssid[0] | bssid[1] << 8 | bssid[2] << 16 | bssid[3] << 24); + rum_write(sc, RT2573_MAC_CSR5, + bssid[4] | bssid[5] << 8 | RT2573_NUM_BSSID_MSK(1)); } static void rum_set_macaddr(struct rum_softc *sc, const uint8_t *addr) { - uint32_t tmp; - - tmp = addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24; - rum_write(sc, RT2573_MAC_CSR2, tmp); - tmp = addr[4] | addr[5] << 8 | 0xff << 16; - rum_write(sc, RT2573_MAC_CSR3, tmp); + rum_write(sc, RT2573_MAC_CSR2, + addr[0] | addr[1] << 8 | addr[2] << 16 | addr[3] << 24); + rum_write(sc, RT2573_MAC_CSR3, + addr[4] | addr[5] << 8 | 0xff << 16); } static void @@ -1913,11 +1909,8 @@ rum_update_promisc(struct ieee80211com * struct rum_softc *sc = ic->ic_softc; RUM_LOCK(sc); - if (!sc->sc_running) { - RUM_UNLOCK(sc); - return; - } - rum_setpromisc(sc); + if (sc->sc_running) + rum_setpromisc(sc); RUM_UNLOCK(sc); } Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:28:46 2015 (r288620) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:30:57 2015 (r288621) @@ -101,7 +101,7 @@ #define RT2573_HOST_READY (1 << 2) /* possible flags for register MAC_CSR5 */ -#define RT2573_ONE_BSSID 3 +#define RT2573_NUM_BSSID_MSK(n) (((n * 3) & 3) << 16) /* possible flags for register TXRX_CSR0 */ /* Tx filter flags are in the low 16 bits */ From owner-svn-src-head@freebsd.org Sat Oct 3 17:34:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7D83A0E283; Sat, 3 Oct 2015 17:34:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B85E01796; Sat, 3 Oct 2015 17:34:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HYCB1027613; Sat, 3 Oct 2015 17:34:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HYCQa027612; Sat, 3 Oct 2015 17:34:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031734.t93HYCQa027612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288622 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:34:12 -0000 Author: adrian Date: Sat Oct 3 17:34:11 2015 New Revision: 288622 URL: https://svnweb.freebsd.org/changeset/base/288622 Log: rum(4): add support for AHDEMO mode. Submitted by: Differential Revision: https://reviews.freebsd.org/D3627 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:30:57 2015 (r288621) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:34:11 2015 (r288622) @@ -489,6 +489,7 @@ rum_attach(device_t self) | IEEE80211_C_IBSS /* IBSS mode supported */ | IEEE80211_C_MONITOR /* monitor mode supported */ | IEEE80211_C_HOSTAP /* HostAp mode supported */ + | IEEE80211_C_AHDEMO /* adhoc demo mode */ | IEEE80211_C_TXPMGT /* tx power management */ | IEEE80211_C_SHPREAMBLE /* short preamble supported */ | IEEE80211_C_SHSLOT /* short slot time supported */ @@ -795,7 +796,8 @@ rum_newstate(struct ieee80211vap *vap, e goto run_fail; } - if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (vap->iv_opmode != IEEE80211_M_MONITOR && + vap->iv_opmode != IEEE80211_M_AHDEMO) { if ((ret = rum_enable_tsf_sync(sc)) != 0) goto run_fail; } else @@ -2360,7 +2362,10 @@ rum_scan_end(struct ieee80211com *ic) struct rum_softc *sc = ic->ic_softc; RUM_LOCK(sc); - rum_enable_tsf_sync(sc); + if (ic->ic_opmode != IEEE80211_M_AHDEMO) + rum_enable_tsf_sync(sc); + else + rum_enable_tsf(sc); rum_set_bssid(sc, sc->sc_bssid); RUM_UNLOCK(sc); From owner-svn-src-head@freebsd.org Sat Oct 3 17:49:13 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DC30A0ECA3; Sat, 3 Oct 2015 17:49:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5EC91D12; Sat, 3 Oct 2015 17:49:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93HnCj3031882; Sat, 3 Oct 2015 17:49:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93HnCqH031879; Sat, 3 Oct 2015 17:49:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510031749.t93HnCqH031879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 17:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288623 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 17:49:13 -0000 Author: adrian Date: Sat Oct 3 17:49:11 2015 New Revision: 288623 URL: https://svnweb.freebsd.org/changeset/base/288623 Log: rum(4): split rum_prepare_beacon() into 'alloc' and 'set' stages Note: I manually had to merge this; I merged in the "put beacon_offsets into vap" commit before this. Submitted by: Differential Revision: https://reviews.freebsd.org/D3628 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 17:49:11 2015 (r288623) @@ -221,7 +221,9 @@ static int rum_init(struct rum_softc *) static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, size_t); -static int rum_prepare_beacon(struct rum_softc *, +static int rum_set_beacon(struct rum_softc *, + struct ieee80211vap *); +static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); @@ -630,6 +632,7 @@ rum_vap_delete(struct ieee80211vap *vap) struct rum_vap *rvp = RUM_VAP(vap); struct ieee80211com *ic = vap->iv_ic; + m_freem(rvp->bcn_mbuf); usb_callout_drain(&rvp->ratectl_ch); ieee80211_draintask(ic, &rvp->ratectl_task); ieee80211_ratectl_deinit(vap); @@ -792,7 +795,7 @@ rum_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { - if ((ret = rum_prepare_beacon(sc, vap)) != 0) + if ((ret = rum_alloc_beacon(sc, vap)) != 0) goto run_fail; } @@ -2208,42 +2211,58 @@ rum_load_microcode(struct rum_softc *sc, } static int -rum_prepare_beacon(struct rum_softc *sc, struct ieee80211vap *vap) +rum_set_beacon(struct rum_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; + struct rum_vap *rvp = RUM_VAP(vap); + struct mbuf *m = rvp->bcn_mbuf; const struct ieee80211_txparam *tp; struct rum_tx_desc desc; - struct mbuf *m0; - int ret = 0; - if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) + RUM_LOCK_ASSERT(sc); + + if (m == NULL) return EINVAL; if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) return EINVAL; - m0 = ieee80211_beacon_alloc(vap->iv_bss, &vap->iv_bcn_off); - if (m0 == NULL) - return ENOMEM; - tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, - m0->m_pkthdr.len, tp->mgmtrate); + m->m_pkthdr.len, tp->mgmtrate); - /* copy the first 24 bytes of Tx descriptor into NIC memory */ - if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0, - (uint8_t *)&desc, 24)) != 0) { - ret = EIO; - goto end; - } + /* copy the Tx descriptor into NIC memory */ + if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, + RT2573_TX_DESC_SIZE) != 0) + return EIO; /* copy beacon header and payload into NIC memory */ - if ((ret = rum_write_multi(sc, RT2573_HW_BEACON_BASE0 + 24, mtod(m0, uint8_t *), - m0->m_pkthdr.len)) != 0) - ret = EIO; + if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0) + RT2573_TX_DESC_SIZE, + mtod(m, uint8_t *), m->m_pkthdr.len) != 0) + return EIO; -end: - m_freem(m0); - return ret; + return 0; +} + +static int +rum_alloc_beacon(struct rum_softc *sc, struct ieee80211vap *vap) +{ + struct rum_vap *rvp = RUM_VAP(vap); + struct ieee80211_node *ni = vap->iv_bss; + struct mbuf *m; + + if (ni->ni_chan == IEEE80211_CHAN_ANYC) + return EINVAL; + + m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + if (m == NULL) + return ENOMEM; + + if (rvp->bcn_mbuf != NULL) + m_freem(rvp->bcn_mbuf); + + rvp->bcn_mbuf = m; + + return (rum_set_beacon(sc, vap)); } static int Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 17:49:11 2015 (r288623) @@ -40,7 +40,7 @@ #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 #define RT2573_MCU_CODE_BASE 0x0800 -#define RT2573_HW_BEACON_BASE0 0x2400 +#define RT2573_HW_BCN_BASE(id) (0x2400 + (id) * 0x100) #define RT2573_MAC_CSR0 0x3000 #define RT2573_MAC_CSR1 0x3004 #define RT2573_MAC_CSR2 0x3008 Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:34:11 2015 (r288622) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 17:49:11 2015 (r288623) @@ -92,6 +92,7 @@ struct rum_cmdq { struct rum_vap { struct ieee80211vap vap; + struct mbuf *bcn_mbuf; struct usb_callout ratectl_ch; struct task ratectl_task; From owner-svn-src-head@freebsd.org Sat Oct 3 18:57:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24C62A0F335; Sat, 3 Oct 2015 18:57:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15E2F1E8B; Sat, 3 Oct 2015 18:57:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93IvGrE061262; Sat, 3 Oct 2015 18:57:16 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93IvGQB061260; Sat, 3 Oct 2015 18:57:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031857.t93IvGQB061260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 18:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288625 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 18:57:17 -0000 Author: bdrewery Date: Sat Oct 3 18:57:15 2015 New Revision: 288625 URL: https://svnweb.freebsd.org/changeset/base/288625 Log: Add decoding for struct statfs. Reviewed by: jhb (briefly) Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Sat Oct 3 18:40:27 2015 (r288624) +++ head/usr.bin/truss/syscall.h Sat Oct 3 18:57:15 2015 (r288625) @@ -10,6 +10,7 @@ * BinString -- pointer to an array of chars, printed via strvisx(). * Ptr -- pointer to some unspecified structure. Just print as hex for now. * Stat -- a pointer to a stat buffer. Prints a couple fields. + * StatFs -- a pointer to a statfs buffer. Prints a few fields. * Ioctl -- an ioctl command. Woefully limited. * Quad -- a double-word value. e.g., lseek(int, offset_t, int) * Signal -- a signal number. Prints the signal name (SIGxxx) @@ -38,7 +39,7 @@ enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad, Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd, Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres, - Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open, + Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open, Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Oct 3 18:40:27 2015 (r288624) +++ head/usr.bin/truss/syscalls.c Sat Oct 3 18:57:15 2015 (r288625) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -182,6 +183,10 @@ static struct syscall syscalls[] = { { Atflags, 3 } } }, { .name = "stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, + { .name = "statfs", .ret_type = 1, .nargs = 2, + .args = { { Name | IN, 0 }, { StatFs | OUT, 1 } } }, + { .name = "fstatfs", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { StatFs | OUT, 1 } } }, { .name = "lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "linux_newstat", .ret_type = 1, .nargs = 2, @@ -1444,6 +1449,29 @@ print_arg(struct syscall_args *sc, unsig } break; } + case StatFs: { + unsigned int i; + struct statfs buf; + if (get_struct(pid, (void *)args[sc->offset], &buf, + sizeof(buf)) != -1) { + char fsid[17]; + + bzero(fsid, sizeof(fsid)); + if (buf.f_fsid.val[0] != 0 || buf.f_fsid.val[1] != 0) { + for (i = 0; i < sizeof(buf.f_fsid); i++) + snprintf(&fsid[i*2], + sizeof(fsid) - (i*2), "%02x", + ((u_char *)&buf.f_fsid)[i]); + } + fprintf(fp, + "{ fstypename=%s,mntonname=%s,mntfromname=%s," + "fsid=%s }", buf.f_fstypename, buf.f_mntonname, + buf.f_mntfromname, fsid); + } else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } + case Rusage: { struct rusage ru; From owner-svn-src-head@freebsd.org Sat Oct 3 19:08:37 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AD4CA0FA6B; Sat, 3 Oct 2015 19:08:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CB081367; Sat, 3 Oct 2015 19:08:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93J8bqR065396; Sat, 3 Oct 2015 19:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93J8bbS065395; Sat, 3 Oct 2015 19:08:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510031908.t93J8bbS065395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 19:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288626 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 19:08:37 -0000 Author: bdrewery Date: Sat Oct 3 19:08:36 2015 New Revision: 288626 URL: https://svnweb.freebsd.org/changeset/base/288626 Log: Style fix. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Oct 3 18:57:15 2015 (r288625) +++ head/usr.bin/truss/syscalls.c Sat Oct 3 19:08:36 2015 (r288626) @@ -1452,6 +1452,7 @@ print_arg(struct syscall_args *sc, unsig case StatFs: { unsigned int i; struct statfs buf; + if (get_struct(pid, (void *)args[sc->offset], &buf, sizeof(buf)) != -1) { char fsid[17]; From owner-svn-src-head@freebsd.org Sat Oct 3 19:27:54 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 169FDA0E753; Sat, 3 Oct 2015 19:27:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0496A1EDB; Sat, 3 Oct 2015 19:27:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93JRrUM073445; Sat, 3 Oct 2015 19:27:53 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93JRrvt073442; Sat, 3 Oct 2015 19:27:53 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201510031927.t93JRrvt073442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sat, 3 Oct 2015 19:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288627 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 19:27:54 -0000 Author: alc Date: Sat Oct 3 19:27:52 2015 New Revision: 288627 URL: https://svnweb.freebsd.org/changeset/base/288627 Log: Reduce the scope of a variable to the only file where it is used. Modified: head/sys/vm/vm_page.c head/sys/vm/vm_pageout.c head/sys/vm/vm_pageout.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_page.c Sat Oct 3 19:27:52 2015 (r288627) @@ -149,6 +149,8 @@ static int sysctl_vm_page_blacklist(SYSC SYSCTL_PROC(_vm, OID_AUTO, page_blacklist, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_page_blacklist, "A", "Blacklist pages"); +/* Is the page daemon waiting for free pages? */ +static int vm_pageout_pages_needed; static uma_zone_t fakepg_zone; Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_pageout.c Sat Oct 3 19:27:52 2015 (r288627) @@ -157,7 +157,6 @@ SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ int vm_pages_needed; /* Event on which pageout daemon sleeps */ int vm_pageout_deficit; /* Estimated number of pages deficit */ -int vm_pageout_pages_needed; /* flag saying that the pageout daemon needs pages */ int vm_pageout_wakeup_thresh; #if !defined(NO_SWAPPING) Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Sat Oct 3 19:08:36 2015 (r288626) +++ head/sys/vm/vm_pageout.h Sat Oct 3 19:27:52 2015 (r288627) @@ -73,7 +73,6 @@ extern int vm_page_max_wired; extern int vm_pages_needed; /* should be some "event" structure */ -extern int vm_pageout_pages_needed; extern int vm_pageout_deficit; extern int vm_pageout_page_count; From owner-svn-src-head@freebsd.org Sat Oct 3 19:37:42 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4CC6A0EE18; Sat, 3 Oct 2015 19:37:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96F9913E4; Sat, 3 Oct 2015 19:37:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93JbgkW077519; Sat, 3 Oct 2015 19:37:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Jbgkk077518; Sat, 3 Oct 2015 19:37:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510031937.t93Jbgkk077518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 3 Oct 2015 19:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288628 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 19:37:42 -0000 Author: markj Date: Sat Oct 3 19:37:41 2015 New Revision: 288628 URL: https://svnweb.freebsd.org/changeset/base/288628 Log: The return value of posix_fadvise(2) is just an error status, so sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() rather than setting a return value. MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) @@ -4663,7 +4663,6 @@ int sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) { - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, - uap->len, uap->advice); - return (0); + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice)); } From owner-svn-src-head@freebsd.org Sat Oct 3 20:06:51 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCEFFA0E48F; Sat, 3 Oct 2015 20:06:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF13B12C3; Sat, 3 Oct 2015 20:06:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93K6p4S089718; Sat, 3 Oct 2015 20:06:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93K6pG2089717; Sat, 3 Oct 2015 20:06:51 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510032006.t93K6pG2089717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 20:06:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288629 - head/lib/libohash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:06:51 -0000 Author: bdrewery Date: Sat Oct 3 20:06:50 2015 New Revision: 288629 URL: https://svnweb.freebsd.org/changeset/base/288629 Log: Include stddef.h for ptrdiff_t Modified: head/lib/libohash/ohash.h Modified: head/lib/libohash/ohash.h ============================================================================== --- head/lib/libohash/ohash.h Sat Oct 3 19:37:41 2015 (r288628) +++ head/lib/libohash/ohash.h Sat Oct 3 20:06:50 2015 (r288629) @@ -20,6 +20,8 @@ #ifndef OHASH_H #define OHASH_H +#include + /* Open hashing support. * Open hashing was chosen because it is much lighter than other hash * techniques, and more efficient in most cases. From owner-svn-src-head@freebsd.org Sat Oct 3 20:24:24 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1627AA0F092; Sat, 3 Oct 2015 20:24:24 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2CB51C07; Sat, 3 Oct 2015 20:24:23 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KON1M097770; Sat, 3 Oct 2015 20:24:23 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KONg5097769; Sat, 3 Oct 2015 20:24:23 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510032024.t93KONg5097769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 3 Oct 2015 20:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288630 - head/bin/cat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:24:24 -0000 Author: bdrewery Date: Sat Oct 3 20:24:23 2015 New Revision: 288630 URL: https://svnweb.freebsd.org/changeset/base/288630 Log: Make GCC happy Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c ============================================================================== --- head/bin/cat/cat.c Sat Oct 3 20:06:50 2015 (r288629) +++ head/bin/cat/cat.c Sat Oct 3 20:24:23 2015 (r288630) @@ -168,6 +168,7 @@ scanfiles(char *argv[], int cooked) FILE *fp; i = 0; + fd = -1; while ((path = argv[i]) != NULL || i == 0) { if (path == NULL || strcmp(path, "-") == 0) { filename = "stdin"; From owner-svn-src-head@freebsd.org Sat Oct 3 20:44:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76E9AA0E060; Sat, 3 Oct 2015 20:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DE5A1639; Sat, 3 Oct 2015 20:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KiHgr005975; Sat, 3 Oct 2015 20:44:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KiHHX005974; Sat, 3 Oct 2015 20:44:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032044.t93KiHHX005974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288631 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:44:17 -0000 Author: adrian Date: Sat Oct 3 20:44:16 2015 New Revision: 288631 URL: https://svnweb.freebsd.org/changeset/base/288631 Log: rum(4): attach rum_update_slot to ic_updateslot. Submitted by: Differential Revision: https://reviews.freebsd.org/D3631 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:24:23 2015 (r288630) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:44:16 2015 (r288631) @@ -207,7 +207,9 @@ static int rum_enable_tsf_sync(struct r static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); -static void rum_update_slot(struct rum_softc *); +static void rum_update_slot_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_update_slot(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); static void rum_update_mcast(struct ieee80211com *); @@ -516,6 +518,7 @@ rum_attach(device_t self) ic->ic_parent = rum_parent; ic->ic_vap_create = rum_vap_create; ic->ic_vap_delete = rum_vap_delete; + ic->ic_updateslot = rum_update_slot; ic->ic_update_mcast = rum_update_mcast; ieee80211_radiotap_attach(ic, @@ -785,7 +788,7 @@ rum_newstate(struct ieee80211vap *vap, e ret = EINVAL; goto run_fail; } - rum_update_slot(sc); + rum_update_slot_cb(sc, NULL, 0, 0); rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); @@ -1862,7 +1865,8 @@ rum_get_tsf(struct rum_softc *sc, uint64 } static void -rum_update_slot(struct rum_softc *sc) +rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rv_id, + uint8_t rvp_id) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; @@ -1875,6 +1879,12 @@ rum_update_slot(struct rum_softc *sc) } static void +rum_update_slot(struct ieee80211com *ic) +{ + rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, 0, rum_update_slot_cb); +} + +static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { From owner-svn-src-head@freebsd.org Sat Oct 3 20:45:44 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D029A0E1F3; Sat, 3 Oct 2015 20:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 553E3190E; Sat, 3 Oct 2015 20:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Kji7b006080; Sat, 3 Oct 2015 20:45:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Kji63006079; Sat, 3 Oct 2015 20:45:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032045.t93Kji63006079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288632 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:45:44 -0000 Author: adrian Date: Sat Oct 3 20:45:43 2015 New Revision: 288632 URL: https://svnweb.freebsd.org/changeset/base/288632 Log: rum(4): implement iv_update_beacon call (fixes client power save support). Submitted by: Differential Revision: https://reviews.freebsd.org/D3632 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:44:16 2015 (r288631) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:45:43 2015 (r288632) @@ -227,6 +227,9 @@ static int rum_set_beacon(struct rum_so struct ieee80211vap *); static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); +static void rum_update_beacon_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_update_beacon(struct ieee80211vap *, int); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static void rum_scan_start(struct ieee80211com *); @@ -617,6 +620,7 @@ rum_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = rum_newstate; + vap->iv_update_beacon = rum_update_beacon; usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); @@ -2275,6 +2279,56 @@ rum_alloc_beacon(struct rum_softc *sc, s return (rum_set_beacon(sc, vap)); } +static void +rum_update_beacon_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211vap *vap = data->vap; + + rum_set_beacon(sc, vap); +} + +static void +rum_update_beacon(struct ieee80211vap *vap, int item) +{ + struct ieee80211com *ic = vap->iv_ic; + struct rum_softc *sc = ic->ic_softc; + struct rum_vap *rvp = RUM_VAP(vap); + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; + struct ieee80211_node *ni = vap->iv_bss; + struct mbuf *m = rvp->bcn_mbuf; + int mcast = 0; + + RUM_LOCK(sc); + if (m == NULL) { + m = ieee80211_beacon_alloc(ni, bo); + if (m == NULL) { + device_printf(sc->sc_dev, + "%s: could not allocate beacon frame\n", __func__); + RUM_UNLOCK(sc); + return; + } + rvp->bcn_mbuf = m; + } + + switch (item) { + case IEEE80211_BEACON_ERP: + rum_update_slot(ic); + break; + case IEEE80211_BEACON_TIM: + mcast = 1; /*TODO*/ + break; + default: + break; + } + RUM_UNLOCK(sc); + + setbit(bo->bo_flags, item); + ieee80211_beacon_update(ni, bo, m, mcast); + + rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, 0, rum_update_beacon_cb); +} + static int rum_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) From owner-svn-src-head@freebsd.org Sat Oct 3 20:49:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77887A0E46E; Sat, 3 Oct 2015 20:49:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68B571BD1; Sat, 3 Oct 2015 20:49:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Kn9PT006363; Sat, 3 Oct 2015 20:49:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Kn8cB006360; Sat, 3 Oct 2015 20:49:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032049.t93Kn8cB006360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288633 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:49:09 -0000 Author: adrian Date: Sat Oct 3 20:49:08 2015 New Revision: 288633 URL: https://svnweb.freebsd.org/changeset/base/288633 Log: rum(4): add support for hardware encryption (WEP, TKIP and CCMP). This diff includes: * Transmitter Addresses, Keys and TKIP MIC addition to the Security Key Table. * Proper SEC Control Registers initialization and maintenance. * Additional flags and values in TX descriptor, which are required for encryption support. * Error checking in RX path. Tested: * Tested on WUSB54GC, STA (WEP, TKIP, CCMP), HOSTAP (CCMP) and IBSS (CCMP, WPA-None) modes. * rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528, STA mode (CCMP+TKIP) Submitted by: Differential Revision: https://reviews.freebsd.org/D3640 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:49:08 2015 (r288633) @@ -166,9 +166,13 @@ static void rum_setup_tx_list(struct ru static void rum_unsetup_tx_list(struct rum_softc *); static int rum_newstate(struct ieee80211vap *, enum ieee80211_state, int); +static uint8_t rum_crypto_mode(struct rum_softc *, u_int, int); static void rum_setup_tx_desc(struct rum_softc *, - struct rum_tx_desc *, uint32_t, uint16_t, int, - int); + struct rum_tx_desc *, struct ieee80211_key *, + uint32_t, uint8_t, int, int, int); +static uint32_t rum_tx_crypto_flags(struct rum_softc *, + struct ieee80211_node *, + const struct ieee80211_key *); static int rum_tx_mgt(struct rum_softc *, struct mbuf *, struct ieee80211_node *); static int rum_tx_raw(struct rum_softc *, struct mbuf *, @@ -219,6 +223,7 @@ static const char *rum_get_rf(int); static void rum_read_eeprom(struct rum_softc *); static int rum_bbp_wakeup(struct rum_softc *); static int rum_bbp_init(struct rum_softc *); +static void rum_clr_shkey_regs(struct rum_softc *); static int rum_init(struct rum_softc *); static void rum_stop(struct rum_softc *); static void rum_load_microcode(struct rum_softc *, const uint8_t *, @@ -230,6 +235,24 @@ static int rum_alloc_beacon(struct rum_ static void rum_update_beacon_cb(struct rum_softc *, union sec_param *, uint8_t, uint8_t); static void rum_update_beacon(struct ieee80211vap *, int); +static int rum_common_key_set(struct rum_softc *, + struct ieee80211_key *, uint16_t); +static void rum_group_key_set_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_group_key_del_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_pair_key_set_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static void rum_pair_key_del_cb(struct rum_softc *, + union sec_param *, uint8_t, uint8_t); +static int rum_key_alloc(struct ieee80211vap *, + struct ieee80211_key *, ieee80211_keyix *, + ieee80211_keyix *); +static int rum_key_set(struct ieee80211vap *, + const struct ieee80211_key *, + const uint8_t mac[IEEE80211_ADDR_LEN]); +static int rum_key_delete(struct ieee80211vap *, + const struct ieee80211_key *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); static void rum_scan_start(struct ieee80211com *); @@ -258,9 +281,9 @@ static const struct { { RT2573_MAC_CSR10, 0x00000718 }, { RT2573_MAC_CSR12, 0x00000004 }, { RT2573_MAC_CSR13, 0x00007f00 }, - { RT2573_SEC_CSR0, 0x00000000 }, - { RT2573_SEC_CSR1, 0x00000000 }, - { RT2573_SEC_CSR5, 0x00000000 }, + { RT2573_SEC_CSR2, 0x00000000 }, + { RT2573_SEC_CSR3, 0x00000000 }, + { RT2573_SEC_CSR4, 0x00000000 }, { RT2573_PHY_CSR1, 0x000023b0 }, { RT2573_PHY_CSR5, 0x00040a06 }, { RT2573_PHY_CSR6, 0x00080606 }, @@ -504,6 +527,12 @@ rum_attach(device_t self) | IEEE80211_C_WPA /* 802.11i */ ; + ic->ic_cryptocaps = + IEEE80211_CRYPTO_WEP | + IEEE80211_CRYPTO_AES_CCM | + IEEE80211_CRYPTO_TKIPMIC | + IEEE80211_CRYPTO_TKIP; + bands = 0; setbit(&bands, IEEE80211_MODE_11B); setbit(&bands, IEEE80211_MODE_11G); @@ -620,7 +649,11 @@ rum_vap_create(struct ieee80211com *ic, /* override state transition machine */ rvp->newstate = vap->iv_newstate; vap->iv_newstate = rum_newstate; + vap->iv_key_alloc = rum_key_alloc; + vap->iv_key_set = rum_key_set; + vap->iv_key_delete = rum_key_delete; vap->iv_update_beacon = rum_update_beacon; + vap->iv_max_aid = RT2573_ADDR_MAX; usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); @@ -971,6 +1004,21 @@ rum_bulk_read_callback(struct usb_xfer * counter_u64_add(ic->ic_ierrors, 1); goto tr_setup; } + if ((flags & RT2573_RX_DEC_MASK) != RT2573_RX_DEC_OK) { + switch (flags & RT2573_RX_DEC_MASK) { + case RT2573_RX_IV_ERROR: + DPRINTFN(5, "IV/EIV error\n"); + break; + case RT2573_RX_MIC_ERROR: + DPRINTFN(5, "MIC error\n"); + break; + case RT2573_RX_KEY_ERROR: + DPRINTFN(5, "Key error\n"); + break; + } + counter_u64_add(ic->ic_ierrors, 1); + goto tr_setup; + } m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { @@ -983,6 +1031,13 @@ rum_bulk_read_callback(struct usb_xfer * wh = mtod(m, struct ieee80211_frame_min *); + if ((wh->i_fc[1] & IEEE80211_FC1_PROTECTED) && + (flags & RT2573_RX_CIP_MASK) != + RT2573_RX_CIP_MODE(RT2573_MODE_NOSEC)) { + wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; + m->m_flags |= M_WEP; + } + /* finalize mbuf */ m->m_pkthdr.len = m->m_len = (flags >> 16) & 0xfff; @@ -1061,22 +1116,45 @@ rum_plcp_signal(int rate) return 0xff; /* XXX unsupported/unknown rate */ } +/* + * Map net80211 cipher to RT2573 security mode. + */ +static uint8_t +rum_crypto_mode(struct rum_softc *sc, u_int cipher, int keylen) +{ + switch (cipher) { + case IEEE80211_CIPHER_WEP: + return (keylen < 8 ? RT2573_MODE_WEP40 : RT2573_MODE_WEP104); + case IEEE80211_CIPHER_TKIP: + return RT2573_MODE_TKIP; + case IEEE80211_CIPHER_AES_CCM: + return RT2573_MODE_AES_CCMP; + default: + device_printf(sc->sc_dev, "unknown cipher %d\n", cipher); + return 0; + } +} + static void rum_setup_tx_desc(struct rum_softc *sc, struct rum_tx_desc *desc, - uint32_t flags, uint16_t xflags, int len, int rate) + struct ieee80211_key *k, uint32_t flags, uint8_t xflags, int hdrlen, + int len, int rate) { struct ieee80211com *ic = &sc->sc_ic; uint16_t plcp_length; int remainder; - desc->flags = htole32(flags); - desc->flags |= htole32(RT2573_TX_VALID); - desc->flags |= htole32(len << 16); + flags |= RT2573_TX_VALID; + flags |= len << 16; - desc->xflags = htole16(xflags); + if (k != NULL && !(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + const struct ieee80211_cipher *cip = k->wk_cipher; - desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | - RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); + len += cip->ic_header + cip->ic_trailer + cip->ic_miclen; + + desc->eiv = 0; /* for WEP */ + cip->ic_setiv(k, (uint8_t *)&desc->iv); + } /* setup PLCP fields */ desc->plcp_signal = rum_plcp_signal(rate); @@ -1084,7 +1162,7 @@ rum_setup_tx_desc(struct rum_softc *sc, len += IEEE80211_CRC_LEN; if (ieee80211_rate2phytype(ic->ic_rt, rate) == IEEE80211_T_OFDM) { - desc->flags |= htole32(RT2573_TX_OFDM); + flags |= RT2573_TX_OFDM; plcp_length = len & 0xfff; desc->plcp_length_hi = plcp_length >> 6; @@ -1104,6 +1182,13 @@ rum_setup_tx_desc(struct rum_softc *sc, if (rate != 2 && (ic->ic_flags & IEEE80211_F_SHPREAMBLE)) desc->plcp_signal |= 0x08; } + + desc->flags = htole32(flags); + desc->hdrlen = hdrlen; + desc->xflags = xflags; + + desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | + RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); } static int @@ -1149,7 +1234,8 @@ rum_sendprot(struct rum_softc *sc, data->m = mprot; data->ni = ieee80211_ref_node(ni); data->rate = protrate; - rum_setup_tx_desc(sc, &data->desc, flags, 0, mprot->m_pkthdr.len, protrate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, + mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); usbd_transfer_start(sc->sc_xfer[RUM_BULK_WR]); @@ -1157,6 +1243,40 @@ rum_sendprot(struct rum_softc *sc, return 0; } +static uint32_t +rum_tx_crypto_flags(struct rum_softc *sc, struct ieee80211_node *ni, + const struct ieee80211_key *k) +{ + struct ieee80211vap *vap = ni->ni_vap; + u_int cipher; + uint32_t flags = 0; + uint8_t mode, pos; + + if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + cipher = k->wk_cipher->ic_cipher; + pos = k->wk_keyix; + mode = rum_crypto_mode(sc, cipher, k->wk_keylen); + if (mode == 0) + return 0; + + flags |= RT2573_TX_CIP_MODE(mode); + + /* Do not trust GROUP flag */ + if (!(k >= &vap->iv_nw_keys[0] && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) + flags |= RT2573_TX_KEY_PAIR; + else + pos += 0 * RT2573_SKEY_MAX; /* vap id */ + + flags |= RT2573_TX_KEY_ID(pos); + + if (cipher == IEEE80211_CIPHER_TKIP) + flags |= RT2573_TX_TKIPMIC; + } + + return flags; +} + static int rum_tx_mgt(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) { @@ -1165,9 +1285,10 @@ rum_tx_mgt(struct rum_softc *sc, struct struct rum_tx_data *data; struct ieee80211_frame *wh; const struct ieee80211_txparam *tp; - struct ieee80211_key *k; + struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1176,9 +1297,15 @@ rum_tx_mgt(struct rum_softc *sc, struct sc->tx_nfree--; wh = mtod(m0, struct ieee80211_frame *); + hdrlen = ieee80211_anyhdrsize(wh); + if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { - k = ieee80211_crypto_encap(ni, m0); + k = ieee80211_crypto_get_txkey(ni, m0); if (k == NULL) + return (ENOENT); + + if ((k->wk_flags & IEEE80211_KEY_SWCRYPT) && + !k->wk_cipher->ic_encap(k, m0)) return (ENOBUFS); wh = mtod(m0, struct ieee80211_frame *); @@ -1200,11 +1327,15 @@ rum_tx_mgt(struct rum_softc *sc, struct flags |= RT2573_TX_TIMESTAMP; } + if (k != NULL) + flags |= rum_tx_crypto_flags(sc, ni, k); + data->m = m0; data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, tp->mgmtrate); + rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, tp->mgmtrate); @@ -1253,7 +1384,8 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, rate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, m0->m_pkthdr.len, + rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", m0->m_pkthdr.len, rate); @@ -1272,14 +1404,15 @@ rum_tx_data(struct rum_softc *sc, struct struct rum_tx_data *data; struct ieee80211_frame *wh; const struct ieee80211_txparam *tp; - struct ieee80211_key *k; + struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - int error, rate; + int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); + hdrlen = ieee80211_anyhdrsize(wh); tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) @@ -1290,10 +1423,15 @@ rum_tx_data(struct rum_softc *sc, struct rate = ni->ni_txrate; if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { - k = ieee80211_crypto_encap(ni, m0); + k = ieee80211_crypto_get_txkey(ni, m0); if (k == NULL) { m_freem(m0); - return ENOBUFS; + return (ENOENT); + } + if ((k->wk_flags & IEEE80211_KEY_SWCRYPT) && + !k->wk_cipher->ic_encap(k, m0)) { + m_freem(m0); + return (ENOBUFS); } /* packet header may have moved, reset our local pointer */ @@ -1317,6 +1455,9 @@ rum_tx_data(struct rum_softc *sc, struct } } + if (k != NULL) + flags |= rum_tx_crypto_flags(sc, ni, k); + data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); sc->tx_nfree--; @@ -1334,7 +1475,8 @@ rum_tx_data(struct rum_softc *sc, struct USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, flags, 0, m0->m_pkthdr.len, rate); + rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", m0->m_pkthdr.len + (int)RT2573_TX_DESC_SIZE, rate); @@ -2087,6 +2229,14 @@ rum_bbp_init(struct rum_softc *sc) return 0; } +static void +rum_clr_shkey_regs(struct rum_softc *sc) +{ + rum_write(sc, RT2573_SEC_CSR0, 0); + rum_write(sc, RT2573_SEC_CSR1, 0); + rum_write(sc, RT2573_SEC_CSR5, 0); +} + static int rum_init(struct rum_softc *sc) { @@ -2124,6 +2274,12 @@ rum_init(struct rum_softc *sc) /* clear STA registers */ rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof sc->sta); + /* clear security registers (if required) */ + if (sc->sc_clr_shkeys == 0) { + rum_clr_shkey_regs(sc); + sc->sc_clr_shkeys = 1; + } + rum_set_macaddr(sc, vap ? vap->iv_myaddr : ic->ic_macaddr); /* initialize ASIC */ @@ -2241,8 +2397,8 @@ rum_set_beacon(struct rum_softc *sc, str return EINVAL; tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; - rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, - m->m_pkthdr.len, tp->mgmtrate); + rum_setup_tx_desc(sc, &desc, NULL, RT2573_TX_TIMESTAMP, + RT2573_TX_HWSEQ, 0, m->m_pkthdr.len, tp->mgmtrate); /* copy the Tx descriptor into NIC memory */ if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, @@ -2330,6 +2486,216 @@ rum_update_beacon(struct ieee80211vap *v } static int +rum_common_key_set(struct rum_softc *sc, struct ieee80211_key *k, + uint16_t base) +{ + + if (rum_write_multi(sc, base, k->wk_key, k->wk_keylen)) + return EIO; + + if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) { + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE, + k->wk_txmic, 8)) + return EIO; + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE + 8, + k->wk_rxmic, 8)) + return EIO; + } + + return 0; +} + +static void +rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + uint8_t mode; + + if (sc->sc_clr_shkeys == 0) { + rum_clr_shkey_regs(sc); + sc->sc_clr_shkeys = 1; + } + + mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen); + if (mode == 0) + goto print_err; + + DPRINTFN(1, "setting group key %d for vap %d, mode %d " + "(tx %s, rx %s)\n", k->wk_keyix, rvp_id, mode, + (k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off", + (k->wk_flags & IEEE80211_KEY_RECV) ? "on" : "off"); + + /* Install the key. */ + if (rum_common_key_set(sc, k, RT2573_SKEY(rvp_id, k->wk_keyix)) != 0) + goto print_err; + + /* Set cipher mode. */ + if (rum_modbits(sc, rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, + mode << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX, + RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX) + != 0) + goto print_err; + + /* Mark this key as valid. */ + if (rum_setbits(sc, RT2573_SEC_CSR0, + 1 << (rvp_id * RT2573_SKEY_MAX + k->wk_keyix)) != 0) + goto print_err; + + return; + +print_err: + device_printf(sc->sc_dev, "%s: cannot set group key %d for vap %d\n", + __func__, k->wk_keyix, rvp_id); +} + +static void +rum_group_key_del_cb(struct rum_softc *sc, union sec_param *data, + uint8_t rn_id, uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + + DPRINTF("%s: removing group key %d for vap %d\n", __func__, + k->wk_keyix, rvp_id); + rum_clrbits(sc, + rvp_id < 2 ? RT2573_SEC_CSR1 : RT2573_SEC_CSR5, + RT2573_MODE_MASK << (rvp_id % 2 + k->wk_keyix) * RT2573_SKEY_MAX); + rum_clrbits(sc, RT2573_SEC_CSR0, + rvp_id * RT2573_SKEY_MAX + k->wk_keyix); +} + +static void +rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, + uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + uint8_t buf[IEEE80211_ADDR_LEN + 1]; + uint8_t mode; + + mode = rum_crypto_mode(sc, k->wk_cipher->ic_cipher, k->wk_keylen); + if (mode == 0) + goto print_err; + + DPRINTFN(1, "setting pairwise key %d for vap %d, mode %d " + "(tx %s, rx %s)\n", k->wk_keyix, rvp_id, mode, + (k->wk_flags & IEEE80211_KEY_XMIT) ? "on" : "off", + (k->wk_flags & IEEE80211_KEY_RECV) ? "on" : "off"); + + /* Install the key. */ + if (rum_common_key_set(sc, k, RT2573_PKEY(k->wk_keyix)) != 0) + goto print_err; + + IEEE80211_ADDR_COPY(buf, k->wk_macaddr); + buf[IEEE80211_ADDR_LEN] = mode; + + /* Set transmitter address and cipher mode. */ + if (rum_write_multi(sc, RT2573_ADDR_ENTRY(k->wk_keyix), + buf, sizeof buf) != 0) + goto print_err; + + /* Enable key table lookup for this vap. */ + if (sc->vap_key_count[rvp_id]++ == 0) + if (rum_setbits(sc, RT2573_SEC_CSR4, 1 << rvp_id) != 0) + goto print_err; + + /* Mark this key as valid. */ + if (rum_setbits(sc, + k->wk_keyix < 32 ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, + 1 << (k->wk_keyix % 32)) != 0) + goto print_err; + + return; + +print_err: + device_printf(sc->sc_dev, + "%s: cannot set pairwise key %d, vap %d\n", __func__, k->wk_keyix, + rvp_id); +} + +static void +rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, + uint8_t rvp_id) +{ + struct ieee80211_key *k = &data->key; + + DPRINTF("%s: removing key %d\n", __func__, k->wk_keyix); + rum_clrbits(sc, (k->wk_keyix < 32) ? RT2573_SEC_CSR2 : RT2573_SEC_CSR3, + 1 << (k->wk_keyix % 32)); + sc->keys_bmap &= ~(1 << k->wk_keyix); + if (--sc->vap_key_count[rvp_id] == 0) + rum_clrbits(sc, RT2573_SEC_CSR4, 1 << rvp_id); +} + +static int +rum_key_alloc(struct ieee80211vap *vap, struct ieee80211_key *k, + ieee80211_keyix *keyix, ieee80211_keyix *rxkeyix) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + uint8_t i; + + if (!(&vap->iv_nw_keys[0] <= k && + k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { + if (!(k->wk_flags & IEEE80211_KEY_SWCRYPT)) { + RUM_LOCK(sc); + for (i = 0; i < RT2573_ADDR_MAX; i++) { + if ((sc->keys_bmap & (1 << i)) == 0) { + sc->keys_bmap |= 1 << i; + *keyix = i; + break; + } + } + RUM_UNLOCK(sc); + if (i == RT2573_ADDR_MAX) { + device_printf(sc->sc_dev, + "%s: no free space in the key table\n", + __func__); + return 0; + } + } else + *keyix = 0; + } else { + *keyix = k - vap->iv_nw_keys; + } + *rxkeyix = *keyix; + return 1; +} + +static int +rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, + const uint8_t mac[IEEE80211_ADDR_LEN]) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + int group; + + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + /* Not for us. */ + return 1; + } + + group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; + + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + group ? rum_group_key_set_cb : rum_pair_key_set_cb); +} + +static int +rum_key_delete(struct ieee80211vap *vap, const struct ieee80211_key *k) +{ + struct rum_softc *sc = vap->iv_ic->ic_softc; + int group; + + if (k->wk_flags & IEEE80211_KEY_SWCRYPT) { + /* Not for us. */ + return 1; + } + + group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; + + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + group ? rum_group_key_del_cb : rum_pair_key_del_cb); +} + +static int rum_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) { Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 20:49:08 2015 (r288633) @@ -34,13 +34,34 @@ #define RT2573_WRITE_LED 0x0a /* - * Control and status registers. + * WME registers. */ #define RT2573_AIFSN_CSR 0x0400 #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 #define RT2573_MCU_CODE_BASE 0x0800 + +/* + * H/w encryption/decryption support + */ +#define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) +#define RT2573_ADDR_MAX 64 +#define RT2573_SKEY_MAX 4 + +#define RT2573_SKEY(vap, kidx) (0x1000 + ((vap) * RT2573_SKEY_MAX + \ + (kidx)) * KEY_SIZE) +#define RT2573_PKEY(id) (0x1200 + (id) * KEY_SIZE) + +#define RT2573_ADDR_ENTRY(id) (0x1a00 + (id) * 8) + +/* + * Shared memory area + */ #define RT2573_HW_BCN_BASE(id) (0x2400 + (id) * 0x100) + +/* + * Control and status registers. + */ #define RT2573_MAC_CSR0 0x3000 #define RT2573_MAC_CSR1 0x3004 #define RT2573_MAC_CSR2 0x3008 @@ -95,6 +116,16 @@ #define RT2573_STA_CSR5 0x30d4 +/* possible values for register RT2573_ADDR_MODE */ +#define RT2573_MODE_MASK 0x7 +#define RT2573_MODE_NOSEC 0 +#define RT2573_MODE_WEP40 1 +#define RT2573_MODE_WEP104 2 +#define RT2573_MODE_TKIP 3 +#define RT2573_MODE_AES_CCMP 4 +#define RT2573_MODE_CKIP40 5 +#define RT2573_MODE_CKIP104 6 + /* possible flags for register RT2573_MAC_CSR1 */ #define RT2573_RESET_ASIC (1 << 0) #define RT2573_RESET_BBP (1 << 1) @@ -178,6 +209,10 @@ struct rum_tx_desc { #define RT2573_TX_OFDM (1 << 5) #define RT2573_TX_IFS_SIFS (1 << 6) #define RT2573_TX_LONG_RETRY (1 << 7) +#define RT2573_TX_TKIPMIC (1 << 8) +#define RT2573_TX_KEY_PAIR (1 << 9) +#define RT2573_TX_KEY_ID(id) (((id) & 0x3f) << 10) +#define RT2573_TX_CIP_MODE(m) ((m) << 29) uint16_t wme; #define RT2573_QID(v) (v) @@ -185,8 +220,9 @@ struct rum_tx_desc { #define RT2573_LOGCWMIN(v) ((v) << 8) #define RT2573_LOGCWMAX(v) ((v) << 12) - uint16_t xflags; -#define RT2573_TX_HWSEQ (1 << 12) + uint8_t hdrlen; + uint8_t xflags; +#define RT2573_TX_HWSEQ (1 << 4) uint8_t plcp_signal; uint8_t plcp_service; @@ -210,9 +246,25 @@ struct rum_rx_desc { uint32_t flags; #define RT2573_RX_BUSY (1 << 0) #define RT2573_RX_DROP (1 << 1) +#define RT2573_RX_UC2ME (1 << 2) +#define RT2573_RX_MC (1 << 3) +#define RT2573_RX_BC (1 << 4) +#define RT2573_RX_MYBSS (1 << 5) #define RT2573_RX_CRC_ERROR (1 << 6) #define RT2573_RX_OFDM (1 << 7) +#define RT2573_RX_DEC_MASK (3 << 8) +#define RT2573_RX_DEC_OK (0 << 8) + +#define RT2573_RX_IV_ERROR (1 << 8) +#define RT2573_RX_MIC_ERROR (2 << 8) +#define RT2573_RX_KEY_ERROR (3 << 8) + +#define RT2573_RX_KEY_PAIR (1 << 28) + +#define RT2573_RX_CIP_MASK (7 << 29) +#define RT2573_RX_CIP_MODE(m) ((m) << 29) + uint8_t rate; uint8_t rssi; uint8_t reserved1; Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:45:43 2015 (r288632) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:49:08 2015 (r288633) @@ -136,10 +136,14 @@ struct rum_softc { uint32_t rf_regs[4]; uint8_t txpow[44]; u_int sc_detached:1, - sc_running:1; + sc_running:1, + sc_clr_shkeys:1; uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + uint8_t vap_key_count[1]; + uint64_t keys_bmap; + struct { uint8_t val; uint8_t reg; From owner-svn-src-head@freebsd.org Sat Oct 3 20:53:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B089A0E978; Sat, 3 Oct 2015 20:53:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C94D10C2; Sat, 3 Oct 2015 20:53:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93KrB0N010316; Sat, 3 Oct 2015 20:53:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93KrBOw010314; Sat, 3 Oct 2015 20:53:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032053.t93KrBOw010314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 20:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288634 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 20:53:12 -0000 Author: adrian Date: Sat Oct 3 20:53:10 2015 New Revision: 288634 URL: https://svnweb.freebsd.org/changeset/base/288634 Log: rum(4): drop unused 'node id' parameter. Submitted by: Differential Revision: https://reviews.freebsd.org/D3655 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:49:08 2015 (r288633) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:53:10 2015 (r288634) @@ -160,7 +160,7 @@ static struct ieee80211vap *rum_vap_crea static void rum_vap_delete(struct ieee80211vap *); static void rum_cmdq_cb(void *, int); static int rum_cmd_sleepable(struct rum_softc *, const void *, - size_t, uint8_t, uint8_t, CMD_FUNC_PROTO); + size_t, uint8_t, CMD_FUNC_PROTO); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); static void rum_unsetup_tx_list(struct rum_softc *); @@ -212,7 +212,7 @@ static void rum_enable_tsf(struct rum_s static void rum_abort_tsf_sync(struct rum_softc *); static void rum_get_tsf(struct rum_softc *, uint64_t *); static void rum_update_slot_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_update_slot(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); @@ -233,18 +233,18 @@ static int rum_set_beacon(struct rum_so static int rum_alloc_beacon(struct rum_softc *, struct ieee80211vap *); static void rum_update_beacon_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_update_beacon(struct ieee80211vap *, int); static int rum_common_key_set(struct rum_softc *, struct ieee80211_key *, uint16_t); static void rum_group_key_set_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_group_key_del_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_pair_key_set_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static void rum_pair_key_del_cb(struct rum_softc *, - union sec_param *, uint8_t, uint8_t); + union sec_param *, uint8_t); static int rum_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); @@ -692,7 +692,7 @@ rum_cmdq_cb(void *arg, int pending) RUM_CMDQ_UNLOCK(sc); RUM_LOCK(sc); - rc->func(sc, &rc->data, rc->rn_id, rc->rvp_id); + rc->func(sc, &rc->data, rc->rvp_id); RUM_UNLOCK(sc); RUM_CMDQ_LOCK(sc); @@ -704,7 +704,7 @@ rum_cmdq_cb(void *arg, int pending) static int rum_cmd_sleepable(struct rum_softc *sc, const void *ptr, size_t len, - uint8_t rn_id, uint8_t rvp_id, CMD_FUNC_PROTO) + uint8_t rvp_id, CMD_FUNC_PROTO) { struct ieee80211com *ic = &sc->sc_ic; @@ -720,7 +720,6 @@ rum_cmd_sleepable(struct rum_softc *sc, if (ptr != NULL) memcpy(&sc->cmdq[sc->cmdq_last].data, ptr, len); - sc->cmdq[sc->cmdq_last].rn_id = rn_id; sc->cmdq[sc->cmdq_last].rvp_id = rvp_id; sc->cmdq[sc->cmdq_last].func = func; sc->cmdq_last = (sc->cmdq_last + 1) % RUM_CMDQ_SIZE; @@ -825,7 +824,7 @@ rum_newstate(struct ieee80211vap *vap, e ret = EINVAL; goto run_fail; } - rum_update_slot_cb(sc, NULL, 0, 0); + rum_update_slot_cb(sc, NULL, 0); rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); @@ -2011,8 +2010,7 @@ rum_get_tsf(struct rum_softc *sc, uint64 } static void -rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rv_id, - uint8_t rvp_id) +rum_update_slot_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211com *ic = &sc->sc_ic; uint8_t slottime; @@ -2027,7 +2025,7 @@ rum_update_slot_cb(struct rum_softc *sc, static void rum_update_slot(struct ieee80211com *ic) { - rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, 0, rum_update_slot_cb); + rum_cmd_sleepable(ic->ic_softc, NULL, 0, 0, rum_update_slot_cb); } static void @@ -2437,7 +2435,7 @@ rum_alloc_beacon(struct rum_softc *sc, s static void rum_update_beacon_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211vap *vap = data->vap; @@ -2482,7 +2480,7 @@ rum_update_beacon(struct ieee80211vap *v setbit(bo->bo_flags, item); ieee80211_beacon_update(ni, bo, m, mcast); - rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, 0, rum_update_beacon_cb); + rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, rum_update_beacon_cb); } static int @@ -2507,7 +2505,7 @@ rum_common_key_set(struct rum_softc *sc, static void rum_group_key_set_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211_key *k = &data->key; uint8_t mode; @@ -2551,7 +2549,7 @@ print_err: static void rum_group_key_del_cb(struct rum_softc *sc, union sec_param *data, - uint8_t rn_id, uint8_t rvp_id) + uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2565,7 +2563,7 @@ rum_group_key_del_cb(struct rum_softc *s } static void -rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, +rum_pair_key_set_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2613,7 +2611,7 @@ print_err: } static void -rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rn_id, +rum_pair_key_del_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) { struct ieee80211_key *k = &data->key; @@ -2674,7 +2672,7 @@ rum_key_set(struct ieee80211vap *vap, co group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; - return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, group ? rum_group_key_set_cb : rum_pair_key_set_cb); } @@ -2691,7 +2689,7 @@ rum_key_delete(struct ieee80211vap *vap, group = k >= &vap->iv_nw_keys[0] && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; - return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, 0, + return !rum_cmd_sleepable(sc, k, sizeof(*k), 0, group ? rum_group_key_del_cb : rum_pair_key_del_cb); } Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:49:08 2015 (r288633) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 20:53:10 2015 (r288634) @@ -77,13 +77,10 @@ union sec_param { struct ieee80211vap *vap; }; #define CMD_FUNC_PROTO void (*func)(struct rum_softc *, \ - union sec_param *, uint8_t, \ - uint8_t) + union sec_param *, uint8_t) struct rum_cmdq { union sec_param data; - - uint8_t rn_id; uint8_t rvp_id; CMD_FUNC_PROTO; From owner-svn-src-head@freebsd.org Sat Oct 3 21:33:14 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5AA9A0E63B; Sat, 3 Oct 2015 21:33:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 8E8461781; Sat, 3 Oct 2015 21:33:14 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 3B516359302; Sat, 3 Oct 2015 23:33:12 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 0EE7028494; Sat, 3 Oct 2015 23:33:12 +0200 (CEST) Date: Sat, 3 Oct 2015 23:33:12 +0200 From: Jilles Tjoelker To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r288628 - head/sys/kern Message-ID: <20151003213311.GB57303@stack.nl> References: <201510031937.t93Jbgkk077518@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201510031937.t93Jbgkk077518@repo.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 21:33:14 -0000 On Sat, Oct 03, 2015 at 07:37:42PM +0000, Mark Johnston wrote: > Author: markj > Date: Sat Oct 3 19:37:41 2015 > New Revision: 288628 > URL: https://svnweb.freebsd.org/changeset/base/288628 > Log: > The return value of posix_fadvise(2) is just an error status, so > sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() > rather than setting a return value. > MFC after: 1 week > Modified: > head/sys/kern/vfs_syscalls.c > > Modified: head/sys/kern/vfs_syscalls.c > ============================================================================== > --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) > +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) > @@ -4663,7 +4663,6 @@ int > sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) > { > > - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, > - uap->len, uap->advice); > - return (0); > + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, > + uap->advice)); > } This change makes the code match the man page, but in fact, the code was right and the man page is wrong. Per POSIX, posix_fadvise() shall return 0 on success and an error number on failure, and need not modify errno. Also, this kind of ABI change in general is almost always a bad idea when the function is already part of a stable branch. -- Jilles Tjoelker From owner-svn-src-head@freebsd.org Sat Oct 3 21:48:30 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E1D8A0F3BD; Sat, 3 Oct 2015 21:48:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 726211E49; Sat, 3 Oct 2015 21:48:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93LmUUl030991; Sat, 3 Oct 2015 21:48:30 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93LmRvC030979; Sat, 3 Oct 2015 21:48:27 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032148.t93LmRvC030979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 21:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288635 - in head/sys: dev/ath dev/if_ndis dev/mwl dev/usb/wlan dev/wpi net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 21:48:30 -0000 Author: adrian Date: Sat Oct 3 21:48:27 2015 New Revision: 288635 URL: https://svnweb.freebsd.org/changeset/base/288635 Log: net80211: drop redundant 3rd parameter from iv_key_set(). The MAC can be fetched from the key struct. I added the ndis updates to make it compile. Submitted by: Differential Revision: https://reviews.freebsd.org/D3657 Modified: head/sys/dev/ath/if_ath_keycache.c head/sys/dev/ath/if_ath_keycache.h head/sys/dev/if_ndis/if_ndis.c head/sys/dev/mwl/if_mwl.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/wpi/if_wpi.c head/sys/net80211/ieee80211_crypto.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/ath/if_ath_keycache.c ============================================================================== --- head/sys/dev/ath/if_ath_keycache.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/ath/if_ath_keycache.c Sat Oct 3 21:48:27 2015 (r288635) @@ -527,8 +527,7 @@ ath_key_delete(struct ieee80211vap *vap, * slot(s) must already have been allocated by ath_key_alloc. */ int -ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const u_int8_t mac[IEEE80211_ADDR_LEN]) +ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { struct ath_softc *sc = vap->iv_ic->ic_softc; Modified: head/sys/dev/ath/if_ath_keycache.h ============================================================================== --- head/sys/dev/ath/if_ath_keycache.h Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/ath/if_ath_keycache.h Sat Oct 3 21:48:27 2015 (r288635) @@ -35,8 +35,7 @@ extern int ath_key_alloc(struct ieee80211vap *, struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); extern int ath_key_delete(struct ieee80211vap *, const struct ieee80211_key *); -extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *, - const u_int8_t mac[IEEE80211_ADDR_LEN]); +extern int ath_key_set(struct ieee80211vap *, const struct ieee80211_key *); extern int ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap, const struct ieee80211_key *k, struct ieee80211_node *bss); Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/if_ndis/if_ndis.c Sat Oct 3 21:48:27 2015 (r288635) @@ -194,7 +194,7 @@ static void ndis_media_status (struct if static int ndis_set_cipher (struct ndis_softc *, int); static int ndis_set_wpa (struct ndis_softc *, void *, int); static int ndis_add_key (struct ieee80211vap *, - const struct ieee80211_key *, const u_int8_t []); + const struct ieee80211_key *); static int ndis_del_key (struct ieee80211vap *, const struct ieee80211_key *); static void ndis_setmulti (struct ndis_softc *); @@ -3070,8 +3070,7 @@ ndis_del_key(struct ieee80211vap *vap, c * set after initial authentication with the AP. */ static int -ndis_add_key(struct ieee80211vap *vap, const struct ieee80211_key *key, - const uint8_t mac[IEEE80211_ADDR_LEN]) +ndis_add_key(struct ieee80211vap *vap, const struct ieee80211_key *key) { struct ndis_softc *sc = vap->iv_ic->ic_softc; ndis_80211_key rkey; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/mwl/if_mwl.c Sat Oct 3 21:48:27 2015 (r288635) @@ -111,7 +111,10 @@ static int mwl_key_alloc(struct ieee8021 ieee80211_keyix *, ieee80211_keyix *); static int mwl_key_delete(struct ieee80211vap *, const struct ieee80211_key *); -static int mwl_key_set(struct ieee80211vap *, const struct ieee80211_key *, +static int mwl_key_set(struct ieee80211vap *, + const struct ieee80211_key *); +static int _mwl_key_set(struct ieee80211vap *, + const struct ieee80211_key *, const uint8_t mac[IEEE80211_ADDR_LEN]); static int mwl_mode_init(struct mwl_softc *); static void mwl_update_mcast(struct ieee80211com *); @@ -1604,7 +1607,13 @@ addgroupflags(MWL_HAL_KEYVAL *hk, const * slot(s) must already have been allocated by mwl_key_alloc. */ static int -mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, +mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) +{ + return (_mwl_key_set(vap, k, k->wk_macaddr)); +} + +static int +_mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, const uint8_t mac[IEEE80211_ADDR_LEN]) { #define GRPXMIT (IEEE80211_KEY_XMIT | IEEE80211_KEY_GROUP) @@ -3911,7 +3920,8 @@ mwl_setanywepkey(struct ieee80211vap *va IEEE80211_F_PRIVACY && vap->iv_def_txkey != IEEE80211_KEYIX_NONE && vap->iv_nw_keys[vap->iv_def_txkey].wk_keyix != IEEE80211_KEYIX_NONE) - (void) mwl_key_set(vap, &vap->iv_nw_keys[vap->iv_def_txkey], mac); + (void) _mwl_key_set(vap, &vap->iv_nw_keys[vap->iv_def_txkey], + mac); } static int @@ -3956,7 +3966,7 @@ mwl_setglobalkeys(struct ieee80211vap *v wk = &vap->iv_nw_keys[0]; for (; wk < &vap->iv_nw_keys[IEEE80211_WEP_NKID]; wk++) if (wk->wk_keyix != IEEE80211_KEYIX_NONE) - (void) mwl_key_set(vap, wk, vap->iv_myaddr); + (void) _mwl_key_set(vap, wk, vap->iv_myaddr); } /* Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 21:48:27 2015 (r288635) @@ -249,8 +249,7 @@ static int rum_key_alloc(struct ieee802 struct ieee80211_key *, ieee80211_keyix *, ieee80211_keyix *); static int rum_key_set(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); static int rum_key_delete(struct ieee80211vap *, const struct ieee80211_key *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, @@ -2659,8 +2658,7 @@ rum_key_alloc(struct ieee80211vap *vap, } static int -rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +rum_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { struct rum_softc *sc = vap->iv_ic->ic_softc; int group; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 21:48:27 2015 (r288635) @@ -382,8 +382,7 @@ static int run_newstate(struct ieee80211 static int run_wme_update(struct ieee80211com *); static void run_wme_update_cb(void *); static void run_key_set_cb(void *); -static int run_key_set(struct ieee80211vap *, struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); +static int run_key_set(struct ieee80211vap *, struct ieee80211_key *); static void run_key_delete_cb(void *); static int run_key_delete(struct ieee80211vap *, struct ieee80211_key *); static void run_ratectl_to(void *); @@ -2361,8 +2360,7 @@ run_key_set_cb(void *arg) * return 0 on error */ static int -run_key_set(struct ieee80211vap *vap, struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +run_key_set(struct ieee80211vap *vap, struct ieee80211_key *k) { struct ieee80211com *ic = vap->iv_ic; struct run_softc *sc = ic->ic_softc; @@ -2374,7 +2372,7 @@ run_key_set(struct ieee80211vap *vap, st sc->cmdq[i].arg0 = NULL; sc->cmdq[i].arg1 = vap; sc->cmdq[i].k = k; - IEEE80211_ADDR_COPY(sc->cmdq[i].mac, mac); + IEEE80211_ADDR_COPY(sc->cmdq[i].mac, k->wk_macaddr); ieee80211_runtask(ic, &sc->cmdq_task); /* Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/dev/wpi/if_wpi.c Sat Oct 3 21:48:27 2015 (r288635) @@ -254,8 +254,7 @@ static void wpi_del_key_cb(void *, struc static int wpi_process_key(struct ieee80211vap *, const struct ieee80211_key *, int); static int wpi_key_set(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); static int wpi_key_delete(struct ieee80211vap *, const struct ieee80211_key *); static int wpi_post_alive(struct wpi_softc *); @@ -4799,8 +4798,7 @@ wpi_process_key(struct ieee80211vap *vap } static int -wpi_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +wpi_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { return wpi_process_key(vap, k, 1); } Modified: head/sys/net80211/ieee80211_crypto.c ============================================================================== --- head/sys/net80211/ieee80211_crypto.c Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/net80211/ieee80211_crypto.c Sat Oct 3 21:48:27 2015 (r288635) @@ -89,8 +89,7 @@ null_key_delete(struct ieee80211vap *vap return 1; } static int -null_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, - const uint8_t mac[IEEE80211_ADDR_LEN]) +null_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k) { return 1; } @@ -132,7 +131,7 @@ dev_key_delete(struct ieee80211vap *vap, static __inline int dev_key_set(struct ieee80211vap *vap, const struct ieee80211_key *key) { - return vap->iv_key_set(vap, key, key->wk_macaddr); + return vap->iv_key_set(vap, key); } /* Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Oct 3 20:53:10 2015 (r288634) +++ head/sys/net80211/ieee80211_var.h Sat Oct 3 21:48:27 2015 (r288635) @@ -461,8 +461,7 @@ struct ieee80211vap { int (*iv_key_delete)(struct ieee80211vap *, const struct ieee80211_key *); int (*iv_key_set)(struct ieee80211vap *, - const struct ieee80211_key *, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_key *); void (*iv_key_update_begin)(struct ieee80211vap *); void (*iv_key_update_end)(struct ieee80211vap *); From owner-svn-src-head@freebsd.org Sat Oct 3 22:12:29 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2A1BA0E370; Sat, 3 Oct 2015 22:12:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1AE01AD3; Sat, 3 Oct 2015 22:12:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MCTpY042889; Sat, 3 Oct 2015 22:12:29 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MCQiR042874; Sat, 3 Oct 2015 22:12:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032212.t93MCQiR042874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288636 - in head/sys: dev/ath dev/mwl dev/ral dev/usb/wlan dev/wpi dev/wtap net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:12:30 -0000 Author: adrian Date: Sat Oct 3 22:12:25 2015 New Revision: 288636 URL: https://svnweb.freebsd.org/changeset/base/288636 Log: net80211: drop ieee80211_beacon_offsets parameter from ieee80211_beacon_alloc() and ieee80211_beacon_update() Submitted by: Differential Revision: https://reviews.freebsd.org/D3659 Modified: head/sys/dev/ath/if_ath_beacon.c head/sys/dev/mwl/if_mwl.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/ral/rt2860.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/wpi/if_wpi.c head/sys/dev/wtap/if_wtap.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/dev/ath/if_ath_beacon.c ============================================================================== --- head/sys/dev/ath/if_ath_beacon.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ath/if_ath_beacon.c Sat Oct 3 22:12:25 2015 (r288636) @@ -199,7 +199,7 @@ ath_beacon_alloc(struct ath_softc *sc, s * we assume the mbuf routines will return us something * with this alignment (perhaps should assert). */ - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: cannot get mbuf\n", __func__); sc->sc_stats.ast_be_nombuf++; @@ -713,7 +713,7 @@ ath_beacon_generate(struct ath_softc *sc /* XXX lock mcastq? */ nmcastq = avp->av_mcastq.axq_depth; - if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, nmcastq)) { + if (ieee80211_beacon_update(bf->bf_node, m, nmcastq)) { /* XXX too conservative? */ bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, @@ -829,7 +829,7 @@ ath_beacon_start_adhoc(struct ath_softc */ bf = avp->av_bcbuf; m = bf->bf_m; - if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, 0)) { + if (ieee80211_beacon_update(bf->bf_node, m, 0)) { /* XXX too conservative? */ bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m, Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/mwl/if_mwl.c Sat Oct 3 22:12:25 2015 (r288636) @@ -1843,10 +1843,9 @@ mwl_beacon_setup(struct ieee80211vap *va { struct mwl_hal_vap *hvap = MWL_VAP(vap)->mv_hvap; struct ieee80211_node *ni = vap->iv_bss; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct mbuf *m; - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) return ENOBUFS; mwl_hal_setbeacon(hvap, mtod(m, const void *), m->m_len); Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2560.c Sat Oct 3 22:12:25 2015 (r288636) @@ -768,7 +768,7 @@ rt2560_newstate(struct ieee80211vap *vap if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS || vap->iv_opmode == IEEE80211_M_MBSS) { - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); @@ -1286,7 +1286,6 @@ static void rt2560_beacon_expire(struct rt2560_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct rt2560_tx_data *data; if (ic->ic_opmode != IEEE80211_M_IBSS && @@ -1305,7 +1304,7 @@ rt2560_beacon_expire(struct rt2560_softc bus_dmamap_unload(sc->bcnq.data_dmat, data->map); /* XXX 1 =>'s mcast frames which means all PS sta's will wakeup! */ - ieee80211_beacon_update(data->ni, &vap->iv_bcn_off, data->m, 1); + ieee80211_beacon_update(data->ni, data->m, 1); rt2560_tx_bcn(sc, data->m, data->ni); Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2661.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2626,13 +2626,11 @@ static int rt2661_prepare_beacon(struct rt2661_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct rt2661_tx_desc desc; struct mbuf *m0; int rate; - m0 = ieee80211_beacon_alloc(vap->iv_bss, bo); - if (m0 == NULL) { + if ((m0 = ieee80211_beacon_alloc(vap->iv_bss))== NULL) { device_printf(sc->sc_dev, "could not allocate beacon frame\n"); return ENOBUFS; } Modified: head/sys/dev/ral/rt2860.c ============================================================================== --- head/sys/dev/ral/rt2860.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/ral/rt2860.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4268,12 +4268,11 @@ static int rt2860_setup_beacon(struct rt2860_softc *sc, struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct rt2860_txwi txwi; struct mbuf *m; int ridx; - if ((m = ieee80211_beacon_alloc(vap->iv_bss, bo)) == NULL) + if ((m = ieee80211_beacon_alloc(vap->iv_bss)) == NULL) return ENOBUFS; memset(&txwi, 0, sizeof txwi); Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2420,7 +2420,7 @@ rum_alloc_beacon(struct rum_softc *sc, s if (ni->ni_chan == IEEE80211_CHAN_ANYC) return EINVAL; - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) return ENOMEM; @@ -2454,7 +2454,7 @@ rum_update_beacon(struct ieee80211vap *v RUM_LOCK(sc); if (m == NULL) { - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -2477,7 +2477,7 @@ rum_update_beacon(struct ieee80211vap *v RUM_UNLOCK(sc); setbit(bo->bo_flags, item); - ieee80211_beacon_update(ni, bo, m, mcast); + ieee80211_beacon_update(ni, m, mcast); rum_cmd_sleepable(sc, &vap, sizeof(vap), 0, rum_update_beacon_cb); } Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4866,11 +4866,11 @@ run_update_beacon(struct ieee80211vap *v setbit(bo->bo_flags, item); if (rvp->beacon_mbuf == NULL) { - rvp->beacon_mbuf = ieee80211_beacon_alloc(ni, bo); + rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); if (rvp->beacon_mbuf == NULL) return; } - ieee80211_beacon_update(ni, bo, rvp->beacon_mbuf, mcast); + ieee80211_beacon_update(ni, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); DPRINTF("cmdq_store=%d\n", i); @@ -4904,8 +4904,7 @@ run_update_beacon_cb(void *arg) * is taking care of apropriate calls. */ if (rvp->beacon_mbuf == NULL) { - rvp->beacon_mbuf = ieee80211_beacon_alloc(ni, - &vap->iv_bcn_off); + rvp->beacon_mbuf = ieee80211_beacon_alloc(ni); if (rvp->beacon_mbuf == NULL) return; } Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/usb/wlan/if_ural.c Sat Oct 3 22:12:25 2015 (r288636) @@ -710,7 +710,7 @@ ural_newstate(struct ieee80211vap *vap, if (vap->iv_opmode == IEEE80211_M_HOSTAP || vap->iv_opmode == IEEE80211_M_IBSS) { - m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "could not allocate beacon\n"); Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/wpi/if_wpi.c Sat Oct 3 22:12:25 2015 (r288636) @@ -4354,7 +4354,6 @@ static int wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct wpi_vap *wvp = WPI_VAP(vap); struct wpi_buf *bcn = &wvp->wv_bcbuf; struct mbuf *m; @@ -4365,7 +4364,7 @@ wpi_setup_beacon(struct wpi_softc *sc, s if (ni->ni_chan == IEEE80211_CHAN_ANYC) return EINVAL; - m = ieee80211_beacon_alloc(ni, bo); + m = ieee80211_beacon_alloc(ni); if (m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -4398,7 +4397,7 @@ wpi_update_beacon(struct ieee80211vap *v WPI_VAP_LOCK(wvp); if (bcn->m == NULL) { - bcn->m = ieee80211_beacon_alloc(ni, bo); + bcn->m = ieee80211_beacon_alloc(ni); if (bcn->m == NULL) { device_printf(sc->sc_dev, "%s: could not allocate beacon frame\n", __func__); @@ -4416,7 +4415,7 @@ wpi_update_beacon(struct ieee80211vap *v mcast = 1; /* TODO */ setbit(bo->bo_flags, item); - ieee80211_beacon_update(ni, bo, bcn->m, mcast); + ieee80211_beacon_update(ni, bcn->m, mcast); WPI_VAP_LOCK(wvp); wpi_config_beacon(wvp); Modified: head/sys/dev/wtap/if_wtap.c ============================================================================== --- head/sys/dev/wtap/if_wtap.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/dev/wtap/if_wtap.c Sat Oct 3 22:12:25 2015 (r288636) @@ -205,7 +205,7 @@ wtap_beacon_alloc(struct wtap_softc *sc, * we assume the mbuf routines will return us something * with this alignment (perhaps should assert). */ - avp->beacon = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off); + avp->beacon = ieee80211_beacon_alloc(ni); if (avp->beacon == NULL) { printf("%s: cannot get mbuf\n", __func__); return ENOMEM; @@ -242,7 +242,7 @@ wtap_beacon_intrp(void *arg) * of the TIM bitmap). */ m = m_dup(avp->beacon, M_NOWAIT); - if (ieee80211_beacon_update(avp->bf_node, &vap->iv_bcn_off, m, 0)) { + if (ieee80211_beacon_update(avp->bf_node, m, 0)) { printf("%s, need to remap the memory because the beacon frame" " changed size.\n",__func__); } Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/net80211/ieee80211_output.c Sat Oct 3 22:12:25 2015 (r288636) @@ -2860,9 +2860,10 @@ ieee80211_tx_mgt_cb(struct ieee80211_nod static void ieee80211_beacon_construct(struct mbuf *m, uint8_t *frm, - struct ieee80211_beacon_offsets *bo, struct ieee80211_node *ni) + struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct ieee80211com *ic = ni->ni_ic; struct ieee80211_rateset *rs = &ni->ni_rates; uint16_t capinfo; @@ -3021,8 +3022,7 @@ ieee80211_beacon_construct(struct mbuf * * Allocate a beacon frame and fillin the appropriate bits. */ struct mbuf * -ieee80211_beacon_alloc(struct ieee80211_node *ni, - struct ieee80211_beacon_offsets *bo) +ieee80211_beacon_alloc(struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; @@ -3104,7 +3104,7 @@ ieee80211_beacon_alloc(struct ieee80211_ vap->iv_stats.is_tx_nobuf++; return NULL; } - ieee80211_beacon_construct(m, frm, bo, ni); + ieee80211_beacon_construct(m, frm, ni); M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); KASSERT(m != NULL, ("no space for 802.11 header?")); @@ -3125,10 +3125,10 @@ ieee80211_beacon_alloc(struct ieee80211_ * Update the dynamic parts of a beacon frame based on the current state. */ int -ieee80211_beacon_update(struct ieee80211_node *ni, - struct ieee80211_beacon_offsets *bo, struct mbuf *m, int mcast) +ieee80211_beacon_update(struct ieee80211_node *ni, struct mbuf *m, int mcast) { struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off; struct ieee80211com *ic = ni->ni_ic; int len_changed = 0; uint16_t capinfo; @@ -3158,7 +3158,7 @@ ieee80211_beacon_update(struct ieee80211 * clear IEEE80211_BEACON_CSA. */ ieee80211_beacon_construct(m, - mtod(m, uint8_t*) + sizeof(struct ieee80211_frame), bo, ni); + mtod(m, uint8_t*) + sizeof(struct ieee80211_frame), ni); /* XXX do WME aggressive mode processing? */ IEEE80211_UNLOCK(ic); Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Sat Oct 3 21:48:27 2015 (r288635) +++ head/sys/net80211/ieee80211_proto.h Sat Oct 3 22:12:25 2015 (r288636) @@ -346,8 +346,7 @@ struct ieee80211_beacon_offsets { uint8_t *bo_meshconf; /* start of MESHCONF element */ uint8_t *bo_spare[3]; }; -struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *, - struct ieee80211_beacon_offsets *); +struct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *); /* * Beacon frame updates are signaled through calls to iv_update_beacon @@ -375,7 +374,7 @@ enum { IEEE80211_BEACON_MESHCONF = 11, /* Mesh Configuration */ }; int ieee80211_beacon_update(struct ieee80211_node *, - struct ieee80211_beacon_offsets *, struct mbuf *, int mcast); + struct mbuf *, int mcast); void ieee80211_csa_startswitch(struct ieee80211com *, struct ieee80211_channel *, int mode, int count); From owner-svn-src-head@freebsd.org Sat Oct 3 22:16:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C308A0E697; Sat, 3 Oct 2015 22:16:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 103131CDA; Sat, 3 Oct 2015 22:16:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MFxu0043066; Sat, 3 Oct 2015 22:15:59 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MFxRH043065; Sat, 3 Oct 2015 22:15:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032215.t93MFxRH043065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288637 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:16:00 -0000 Author: adrian Date: Sat Oct 3 22:15:59 2015 New Revision: 288637 URL: https://svnweb.freebsd.org/changeset/base/288637 Log: rum(4): fix sequence number generation. * drop erroneous RT2573_TX_MORE_FRAG flag; * provide RT2573_TX_HWSEQ where needed. Submitted by: Differential Revision: https://reviews.freebsd.org/D3672 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:12:25 2015 (r288636) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:15:59 2015 (r288637) @@ -1212,7 +1212,7 @@ rum_sendprot(struct rum_softc *sc, isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0; dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) + ieee80211_ack_duration(ic->ic_rt, rate, isshort); - flags = RT2573_TX_MORE_FRAG; + flags = 0; if (prot == IEEE80211_PROT_RTSCTS) { /* NB: CTS is the same size as an ACK */ dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort); @@ -1286,6 +1286,7 @@ rum_tx_mgt(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + uint8_t type, xflags = 0; int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1295,6 +1296,7 @@ rum_tx_mgt(struct rum_softc *sc, struct sc->tx_nfree--; wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { @@ -1319,12 +1321,15 @@ rum_tx_mgt(struct rum_softc *sc, struct USETW(wh->i_dur, dur); /* tell hardware to add timestamp for probe responses */ - if ((wh->i_fc[0] & - (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == - (IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_PROBE_RESP)) + if (type == IEEE80211_FC0_TYPE_MGT && + (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == + IEEE80211_FC0_SUBTYPE_PROBE_RESP) flags |= RT2573_TX_TIMESTAMP; } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + if (k != NULL) flags |= rum_tx_crypto_flags(sc, ni, k); @@ -1332,7 +1337,7 @@ rum_tx_mgt(struct rum_softc *sc, struct data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", @@ -1349,12 +1354,17 @@ rum_tx_raw(struct rum_softc *sc, struct const struct ieee80211_bpf_params *params) { struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_frame *wh; struct rum_tx_data *data; uint32_t flags; + uint8_t type, xflags = 0; int rate, error; RUM_LOCK_ASSERT(sc); + wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + rate = params->ibp_rate0; if (!ieee80211_isratevalid(ic->ic_rt, rate)) return (EINVAL); @@ -1373,6 +1383,9 @@ rum_tx_raw(struct rum_softc *sc, struct flags |= RT2573_TX_LONG_RETRY | RT2573_TX_IFS_SIFS; } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); sc->tx_nfree--; @@ -1382,8 +1395,8 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, m0->m_pkthdr.len, - rate); + rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, 0, + m0->m_pkthdr.len, rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", m0->m_pkthdr.len, rate); @@ -1405,11 +1418,13 @@ rum_tx_data(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; + uint8_t type, xflags = 0; int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); wh = mtod(m0, struct ieee80211_frame *); + type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; @@ -1436,6 +1451,9 @@ rum_tx_data(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); } + if (type != IEEE80211_FC0_TYPE_CTL && !IEEE80211_QOS_HAS_SEQ(wh)) + xflags |= RT2573_TX_HWSEQ; + if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { int prot = IEEE80211_PROT_NONE; if (m0->m_pkthdr.len + IEEE80211_CRC_LEN > vap->iv_rtsthreshold) @@ -1466,14 +1484,13 @@ rum_tx_data(struct rum_softc *sc, struct if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { flags |= RT2573_TX_NEED_ACK; - flags |= RT2573_TX_MORE_FRAG; dur = ieee80211_ack_duration(ic->ic_rt, rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, k, flags, 0, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", From owner-svn-src-head@freebsd.org Sat Oct 3 22:22:27 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 826D9A0ED38; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7010911C4; Sat, 3 Oct 2015 22:22:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MMR0T047139; Sat, 3 Oct 2015 22:22:27 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MMQTE047135; Sat, 3 Oct 2015 22:22:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032222.t93MMQTE047135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:22:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288638 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:22:27 -0000 Author: adrian Date: Sat Oct 3 22:22:26 2015 New Revision: 288638 URL: https://svnweb.freebsd.org/changeset/base/288638 Log: rum(4): set short/long retry limits Now device will use retry limit, which is set via 'ifconfig maxretry '. Tested: * Tested on WUSB54GC, STA mode. Submitted by: Differential Revision: https://reviews.freebsd.org/D3689 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:22:26 2015 (r288638) @@ -207,6 +207,8 @@ static void rum_select_band(struct rum_ struct ieee80211_channel *); static void rum_set_chan(struct rum_softc *, struct ieee80211_channel *); +static void rum_set_maxretry(struct rum_softc *, + struct ieee80211vap *); static int rum_enable_tsf_sync(struct rum_softc *); static void rum_enable_tsf(struct rum_softc *); static void rum_abort_tsf_sync(struct rum_softc *); @@ -819,7 +821,8 @@ rum_newstate(struct ieee80211vap *vap, e ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { - if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC || + ni->ni_chan == IEEE80211_CHAN_ANYC) { ret = EINVAL; goto run_fail; } @@ -827,6 +830,7 @@ rum_newstate(struct ieee80211vap *vap, e rum_enable_mrr(sc); rum_set_txpreamble(sc); rum_set_basicrates(sc); + rum_set_maxretry(sc, vap); IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); rum_set_bssid(sc, sc->sc_bssid); } @@ -1946,6 +1950,21 @@ rum_set_chan(struct rum_softc *sc, struc rum_pause(sc, hz / 100); } +static void +rum_set_maxretry(struct rum_softc *sc, struct ieee80211vap *vap) +{ + const struct ieee80211_txparam *tp; + struct ieee80211_node *ni = vap->iv_bss; + struct rum_vap *rvp = RUM_VAP(vap); + + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; + rvp->maxretry = tp->maxretry < 0xf ? tp->maxretry : 0xf; + + rum_modbits(sc, RT2573_TXRX_CSR4, RT2573_SHORT_RETRY(rvp->maxretry) | + RT2573_LONG_RETRY(rvp->maxretry), + RT2573_SHORT_RETRY_MASK | RT2573_LONG_RETRY_MASK); +} + /* * Enable TSF synchronization and tell h/w to start sending beacons for IBSS * and HostAP operating modes. Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:22:26 2015 (r288638) @@ -153,6 +153,10 @@ #define RT2573_SHORT_PREAMBLE (1 << 18) #define RT2573_MRR_ENABLED (1 << 19) #define RT2573_MRR_CCK_FALLBACK (1 << 22) +#define RT2573_LONG_RETRY(max) ((max) << 24) +#define RT2573_LONG_RETRY_MASK (0xf << 24) +#define RT2573_SHORT_RETRY(max) ((max) << 28) +#define RT2573_SHORT_RETRY_MASK (0xf << 28) /* possible flags for register TXRX_CSR9 */ #define RT2573_TSF_TIMER_EN (1 << 16) Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:15:59 2015 (r288637) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:22:26 2015 (r288638) @@ -92,6 +92,7 @@ struct rum_vap { struct mbuf *bcn_mbuf; struct usb_callout ratectl_ch; struct task ratectl_task; + uint8_t maxretry; int (*newstate)(struct ieee80211vap *, enum ieee80211_state, int); From owner-svn-src-head@freebsd.org Sat Oct 3 22:27:00 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EBEFA0F0B4; Sat, 3 Oct 2015 22:27:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 323E713AD; Sat, 3 Oct 2015 22:27:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MR0Ft047364; Sat, 3 Oct 2015 22:27:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MR0dQ047360; Sat, 3 Oct 2015 22:27:00 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032227.t93MR0dQ047360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288639 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:27:00 -0000 Author: adrian Date: Sat Oct 3 22:26:59 2015 New Revision: 288639 URL: https://svnweb.freebsd.org/changeset/base/288639 Log: rum(4): fix stats interpretation in rum_ratectl_task() Testing: * WUSB54GC, STA mode Submitted by: Differential Revision: https://reviews.freebsd.org/D3690 Modified: head/sys/dev/usb/wlan/if_rum.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:22:26 2015 (r288638) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:26:59 2015 (r288639) @@ -2797,29 +2797,34 @@ rum_ratectl_task(void *arg, int pending) { struct rum_vap *rvp = arg; struct ieee80211vap *vap = &rvp->vap; - struct ieee80211com *ic = vap->iv_ic; - struct rum_softc *sc = ic->ic_softc; + struct rum_softc *sc = vap->iv_ic->ic_softc; struct ieee80211_node *ni; - int ok, fail; - int sum, retrycnt; + int ok[3], fail; + int sum, success, retrycnt; RUM_LOCK(sc); - /* read and clear statistic registers (STA_CSR0 to STA_CSR10) */ + /* read and clear statistic registers (STA_CSR0 to STA_CSR5) */ rum_read_multi(sc, RT2573_STA_CSR0, sc->sta, sizeof(sc->sta)); - ok = (le32toh(sc->sta[4]) >> 16) + /* TX ok w/o retry */ - (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ retry */ - fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ - sum = ok+fail; - retrycnt = (le32toh(sc->sta[5]) & 0xffff) + fail; - - ni = ieee80211_ref_node(vap->iv_bss); - ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); - (void) ieee80211_ratectl_rate(ni, NULL, 0); - ieee80211_free_node(ni); + ok[0] = (le32toh(sc->sta[4]) & 0xffff); /* TX ok w/o retry */ + ok[1] = (le32toh(sc->sta[4]) >> 16); /* TX ok w/ one retry */ + ok[2] = (le32toh(sc->sta[5]) & 0xffff); /* TX ok w/ multiple retries */ + fail = (le32toh(sc->sta[5]) >> 16); /* TX retry-fail count */ + + success = ok[0] + ok[1] + ok[2]; + sum = success + fail; + /* XXX at least */ + retrycnt = ok[1] + ok[2] * 2 + fail * (rvp->maxretry + 1); + + if (sum != 0) { + ni = ieee80211_ref_node(vap->iv_bss); + ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); + (void) ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_free_node(ni); + } /* count TX retry-fail as Tx errors */ - if_inc_counter(ni->ni_vap->iv_ifp, IFCOUNTER_OERRORS, fail); + if_inc_counter(vap->iv_ifp, IFCOUNTER_OERRORS, fail); usb_callout_reset(&rvp->ratectl_ch, hz, rum_ratectl_timeout, rvp); RUM_UNLOCK(sc); From owner-svn-src-head@freebsd.org Sat Oct 3 22:27:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E21FA0F0E8; Sat, 3 Oct 2015 22:27:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EBF11588; Sat, 3 Oct 2015 22:27:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MRF3G047421; Sat, 3 Oct 2015 22:27:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MRFGk047419; Sat, 3 Oct 2015 22:27:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201510032227.t93MRFGk047419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 3 Oct 2015 22:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288640 - in head: lib/libc/sys sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:27:15 -0000 Author: markj Date: Sat Oct 3 22:27:14 2015 New Revision: 288640 URL: https://svnweb.freebsd.org/changeset/base/288640 Log: Revert r288628 and instead fix a discrepancy between the posix_fadvise(2) man page and POSIX: posix_fadvise(2) returns an error number on failure. Reported by: jilles MFC after: 1 week Modified: head/lib/libc/sys/posix_fadvise.2 head/sys/kern/vfs_syscalls.c Modified: head/lib/libc/sys/posix_fadvise.2 ============================================================================== --- head/lib/libc/sys/posix_fadvise.2 Sat Oct 3 22:26:59 2015 (r288639) +++ head/lib/libc/sys/posix_fadvise.2 Sat Oct 3 22:27:14 2015 (r288640) @@ -28,7 +28,7 @@ .\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd January 30, 2014 +.Dd October 3, 2015 .Dt POSIX_FADVISE 2 .Os .Sh NAME @@ -89,11 +89,13 @@ read or written. Future access to this data may require a read operation. .El .Sh RETURN VALUES -.Rv -std posix_fadvise -.Sh ERRORS -The +If successful, .Fn posix_fadvise -system call returns zero on success, and an error on failure: +returns zero. +It returns an error on failure, without setting +.Va errno . +.Sh ERRORS +Possible failure conditions: .Bl -tag -width Er .It Bq Er EBADF The Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Oct 3 22:26:59 2015 (r288639) +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 22:27:14 2015 (r288640) @@ -4663,6 +4663,7 @@ int sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) { - return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, - uap->advice)); + td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, + uap->len, uap->advice); + return (0); } From owner-svn-src-head@freebsd.org Sat Oct 3 22:29:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B2D7A0F2BC; Sat, 3 Oct 2015 22:29:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 36471182F; Sat, 3 Oct 2015 22:29:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by wicgb1 with SMTP id gb1so74054853wic.1; Sat, 03 Oct 2015 15:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=u817LOpDzghxfp3kWsA8KPHmqtASVrs9DslxpOzdbF0=; b=Dtx81XOXuzdy0wPAwWvLrp6JNaHmEUIHeh7RiMlhfqg4ikbN+rAbtfcP5/abpS6H6N oyUBaOtgFa3Jwfa3fsZpJOqSHsmeUoh4bcJaNpV5bAgjQUnecX9+xJtedh95KpBdCsud nEC2UwmEKiOdQcxmCqN5QYU8xHv5kgp6f3pvbGjdKHZ6ZEbR3j+99Xga/CY2F+fG2GFP rSGgTVL5cyOQyAbok7XBhR6FAkep7MhQ4CLDRDEfSuoQd9qMl805AaGfjgg8R27FeP7e +a2xKNhnpOdNTYCr2rJaJvNdvjev00/sKJM8f36dllRYszF653vdWod9aIFi6yPIKlW2 9RBg== MIME-Version: 1.0 X-Received: by 10.194.71.39 with SMTP id r7mr25858512wju.120.1443911376587; Sat, 03 Oct 2015 15:29:36 -0700 (PDT) Sender: markjdb@gmail.com Received: by 10.194.151.137 with HTTP; Sat, 3 Oct 2015 15:29:36 -0700 (PDT) In-Reply-To: <20151003213311.GB57303@stack.nl> References: <201510031937.t93Jbgkk077518@repo.freebsd.org> <20151003213311.GB57303@stack.nl> Date: Sat, 3 Oct 2015 15:29:36 -0700 X-Google-Sender-Auth: UTJQQheHZ5TTeVJEp_cW0MklZaE Message-ID: Subject: Re: svn commit: r288628 - head/sys/kern From: Mark Johnston To: Jilles Tjoelker Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:29:39 -0000 On Sat, Oct 3, 2015 at 2:33 PM, Jilles Tjoelker wrote: > On Sat, Oct 03, 2015 at 07:37:42PM +0000, Mark Johnston wrote: >> Author: markj >> Date: Sat Oct 3 19:37:41 2015 >> New Revision: 288628 >> URL: https://svnweb.freebsd.org/changeset/base/288628 > >> Log: >> The return value of posix_fadvise(2) is just an error status, so >> sys_posix_fadvise() should simply return the errno (or 0) to syscallenter() >> rather than setting a return value. > >> MFC after: 1 week > >> Modified: >> head/sys/kern/vfs_syscalls.c >> >> Modified: head/sys/kern/vfs_syscalls.c >> ============================================================================== >> --- head/sys/kern/vfs_syscalls.c Sat Oct 3 19:27:52 2015 (r288627) >> +++ head/sys/kern/vfs_syscalls.c Sat Oct 3 19:37:41 2015 (r288628) >> @@ -4663,7 +4663,6 @@ int >> sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) >> { >> >> - td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, >> - uap->len, uap->advice); >> - return (0); >> + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, >> + uap->advice)); >> } > > This change makes the code match the man page, but in fact, the code was > right and the man page is wrong. Per POSIX, posix_fadvise() shall return > 0 on success and an error number on failure, and need not modify errno. Oops, thank you. This is fixed in r288640; I updated the posix_fadvise man page to use the same wording as for posix_fallocate. > > Also, this kind of ABI change in general is almost always a bad idea > when the function is already part of a stable branch. Noted, thanks. From owner-svn-src-head@freebsd.org Sat Oct 3 22:33:46 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FD46A0F697; Sat, 3 Oct 2015 22:33:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 202001C30; Sat, 3 Oct 2015 22:33:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MXju9051370; Sat, 3 Oct 2015 22:33:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MXjjs051369; Sat, 3 Oct 2015 22:33:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032233.t93MXjjs051369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288641 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:33:46 -0000 Author: adrian Date: Sat Oct 3 22:33:45 2015 New Revision: 288641 URL: https://svnweb.freebsd.org/changeset/base/288641 Log: run(4): fix WME support (untested). Now run(4) fetches parameters from ic->ic_wme.wme_params array, which is never initialized (and can be safely removed). This patch replaces &ic->ic_wme.wme_params with &ic->ic_wme.wme_chanParams.cap_wmeParams (contains parameters for local station; used by other drivers with WME support). Tested: * me: STA: run0: MAC/BBP RT5390 (rev 0x0502), RF RT5370 (MIMO 1T1R), address 38:83:45:11:78:ae Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:27:14 2015 (r288640) +++ head/sys/dev/usb/wlan/if_run.c Sat Oct 3 22:33:45 2015 (r288641) @@ -2162,7 +2162,8 @@ run_wme_update_cb(void *arg) { struct ieee80211com *ic = arg; struct run_softc *sc = ic->ic_softc; - struct ieee80211_wme_state *wmesp = &ic->ic_wme; + const struct wmeParams (*ac)[WME_NUM_AC] = + &ic->ic_wme.wme_chanParams.cap_wmeParams; int aci, error = 0; RUN_LOCK_ASSERT(sc, MA_OWNED); @@ -2170,39 +2171,39 @@ run_wme_update_cb(void *arg) /* update MAC TX configuration registers */ for (aci = 0; aci < WME_NUM_AC; aci++) { error = run_write(sc, RT2860_EDCA_AC_CFG(aci), - wmesp->wme_params[aci].wmep_logcwmax << 16 | - wmesp->wme_params[aci].wmep_logcwmin << 12 | - wmesp->wme_params[aci].wmep_aifsn << 8 | - wmesp->wme_params[aci].wmep_txopLimit); + ac[aci]->wmep_logcwmax << 16 | + ac[aci]->wmep_logcwmin << 12 | + ac[aci]->wmep_aifsn << 8 | + ac[aci]->wmep_txopLimit); if (error) goto err; } /* update SCH/DMA registers too */ error = run_write(sc, RT2860_WMM_AIFSN_CFG, - wmesp->wme_params[WME_AC_VO].wmep_aifsn << 12 | - wmesp->wme_params[WME_AC_VI].wmep_aifsn << 8 | - wmesp->wme_params[WME_AC_BK].wmep_aifsn << 4 | - wmesp->wme_params[WME_AC_BE].wmep_aifsn); + ac[WME_AC_VO]->wmep_aifsn << 12 | + ac[WME_AC_VI]->wmep_aifsn << 8 | + ac[WME_AC_BK]->wmep_aifsn << 4 | + ac[WME_AC_BE]->wmep_aifsn); if (error) goto err; error = run_write(sc, RT2860_WMM_CWMIN_CFG, - wmesp->wme_params[WME_AC_VO].wmep_logcwmin << 12 | - wmesp->wme_params[WME_AC_VI].wmep_logcwmin << 8 | - wmesp->wme_params[WME_AC_BK].wmep_logcwmin << 4 | - wmesp->wme_params[WME_AC_BE].wmep_logcwmin); + ac[WME_AC_VO]->wmep_logcwmin << 12 | + ac[WME_AC_VI]->wmep_logcwmin << 8 | + ac[WME_AC_BK]->wmep_logcwmin << 4 | + ac[WME_AC_BE]->wmep_logcwmin); if (error) goto err; error = run_write(sc, RT2860_WMM_CWMAX_CFG, - wmesp->wme_params[WME_AC_VO].wmep_logcwmax << 12 | - wmesp->wme_params[WME_AC_VI].wmep_logcwmax << 8 | - wmesp->wme_params[WME_AC_BK].wmep_logcwmax << 4 | - wmesp->wme_params[WME_AC_BE].wmep_logcwmax); + ac[WME_AC_VO]->wmep_logcwmax << 12 | + ac[WME_AC_VI]->wmep_logcwmax << 8 | + ac[WME_AC_BK]->wmep_logcwmax << 4 | + ac[WME_AC_BE]->wmep_logcwmax); if (error) goto err; error = run_write(sc, RT2860_WMM_TXOP0_CFG, - wmesp->wme_params[WME_AC_BK].wmep_txopLimit << 16 | - wmesp->wme_params[WME_AC_BE].wmep_txopLimit); + ac[WME_AC_BK]->wmep_txopLimit << 16 | + ac[WME_AC_BE]->wmep_txopLimit); if (error) goto err; error = run_write(sc, RT2860_WMM_TXOP1_CFG, - wmesp->wme_params[WME_AC_VO].wmep_txopLimit << 16 | - wmesp->wme_params[WME_AC_VI].wmep_txopLimit); + ac[WME_AC_VO]->wmep_txopLimit << 16 | + ac[WME_AC_VI]->wmep_txopLimit); err: if (error) From owner-svn-src-head@freebsd.org Sat Oct 3 22:35:39 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70CB9A0F7F4; Sat, 3 Oct 2015 22:35:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 439FF1DD9; Sat, 3 Oct 2015 22:35:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93MZdGO051506; Sat, 3 Oct 2015 22:35:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93MZcB8051503; Sat, 3 Oct 2015 22:35:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032235.t93MZcB8051503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288642 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:35:39 -0000 Author: adrian Date: Sat Oct 3 22:35:37 2015 New Revision: 288642 URL: https://svnweb.freebsd.org/changeset/base/288642 Log: rum(4): add WME support. Tested: * WUSB54GC, HOSTAP and STA modes. * Me: rum0: MAC/BBP RT2573 (rev 0x2573a), RF RT2528 Submitted by: Differential Revision: https://reviews.freebsd.org/D3700 Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_rumreg.h head/sys/dev/usb/wlan/if_rumvar.h Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rum.c Sat Oct 3 22:35:37 2015 (r288642) @@ -169,7 +169,7 @@ static int rum_newstate(struct ieee8021 static uint8_t rum_crypto_mode(struct rum_softc *, u_int, int); static void rum_setup_tx_desc(struct rum_softc *, struct rum_tx_desc *, struct ieee80211_key *, - uint32_t, uint8_t, int, int, int); + uint32_t, uint8_t, uint8_t, int, int, int); static uint32_t rum_tx_crypto_flags(struct rum_softc *, struct ieee80211_node *, const struct ieee80211_key *); @@ -216,6 +216,9 @@ static void rum_get_tsf(struct rum_soft static void rum_update_slot_cb(struct rum_softc *, union sec_param *, uint8_t); static void rum_update_slot(struct ieee80211com *); +static void rum_wme_update_cb(struct rum_softc *, + union sec_param *, uint8_t); +static int rum_wme_update(struct ieee80211com *); static void rum_set_bssid(struct rum_softc *, const uint8_t *); static void rum_set_macaddr(struct rum_softc *, const uint8_t *); static void rum_update_mcast(struct ieee80211com *); @@ -526,6 +529,7 @@ rum_attach(device_t self) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_BGSCAN /* bg scanning supported */ | IEEE80211_C_WPA /* 802.11i */ + | IEEE80211_C_WME /* 802.11e */ ; ic->ic_cryptocaps = @@ -552,6 +556,7 @@ rum_attach(device_t self) ic->ic_vap_create = rum_vap_create; ic->ic_vap_delete = rum_vap_delete; ic->ic_updateslot = rum_update_slot; + ic->ic_wme.wme_update = rum_wme_update; ic->ic_update_mcast = rum_update_mcast; ieee80211_radiotap_attach(ic, @@ -1139,10 +1144,11 @@ rum_crypto_mode(struct rum_softc *sc, u_ static void rum_setup_tx_desc(struct rum_softc *sc, struct rum_tx_desc *desc, - struct ieee80211_key *k, uint32_t flags, uint8_t xflags, int hdrlen, - int len, int rate) + struct ieee80211_key *k, uint32_t flags, uint8_t xflags, uint8_t qid, + int hdrlen, int len, int rate) { struct ieee80211com *ic = &sc->sc_ic; + struct wmeParams *wmep = &sc->wme_params[qid]; uint16_t plcp_length; int remainder; @@ -1189,8 +1195,10 @@ rum_setup_tx_desc(struct rum_softc *sc, desc->hdrlen = hdrlen; desc->xflags = xflags; - desc->wme = htole16(RT2573_QID(0) | RT2573_AIFSN(2) | - RT2573_LOGCWMIN(4) | RT2573_LOGCWMAX(10)); + desc->wme = htole16(RT2573_QID(qid) | + RT2573_AIFSN(wmep->wmep_aifsn) | + RT2573_LOGCWMIN(wmep->wmep_logcwmin) | + RT2573_LOGCWMAX(wmep->wmep_logcwmax)); } static int @@ -1236,7 +1244,7 @@ rum_sendprot(struct rum_softc *sc, data->m = mprot; data->ni = ieee80211_ref_node(ni); data->rate = protrate; - rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, + rum_setup_tx_desc(sc, &data->desc, NULL, flags, 0, 0, 0, mprot->m_pkthdr.len, protrate); STAILQ_INSERT_TAIL(&sc->tx_q, data, next); @@ -1290,7 +1298,7 @@ rum_tx_mgt(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - uint8_t type, xflags = 0; + uint8_t ac, type, xflags = 0; int hdrlen; RUM_LOCK_ASSERT(sc); @@ -1302,6 +1310,7 @@ rum_tx_mgt(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); + ac = M_WME_GETAC(m0); if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_get_txkey(ni, m0); @@ -1341,7 +1350,7 @@ rum_tx_mgt(struct rum_softc *sc, struct data->ni = ni; data->rate = tp->mgmtrate; - rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, ac, hdrlen, m0->m_pkthdr.len, tp->mgmtrate); DPRINTFN(10, "sending mgt frame len=%d rate=%d\n", @@ -1361,7 +1370,7 @@ rum_tx_raw(struct rum_softc *sc, struct struct ieee80211_frame *wh; struct rum_tx_data *data; uint32_t flags; - uint8_t type, xflags = 0; + uint8_t ac, type, xflags = 0; int rate, error; RUM_LOCK_ASSERT(sc); @@ -1369,6 +1378,8 @@ rum_tx_raw(struct rum_softc *sc, struct wh = mtod(m0, struct ieee80211_frame *); type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; + ac = params->ibp_pri & 3; + rate = params->ibp_rate0; if (!ieee80211_isratevalid(ic->ic_rt, rate)) return (EINVAL); @@ -1399,7 +1410,7 @@ rum_tx_raw(struct rum_softc *sc, struct data->rate = rate; /* XXX need to setup descriptor ourself */ - rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, 0, + rum_setup_tx_desc(sc, &data->desc, NULL, flags, xflags, ac, 0, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending raw frame len=%u rate=%u\n", @@ -1422,7 +1433,7 @@ rum_tx_data(struct rum_softc *sc, struct struct ieee80211_key *k = NULL; uint32_t flags = 0; uint16_t dur; - uint8_t type, xflags = 0; + uint8_t ac, type, qos, xflags = 0; int error, hdrlen, rate; RUM_LOCK_ASSERT(sc); @@ -1431,6 +1442,12 @@ rum_tx_data(struct rum_softc *sc, struct type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK; hdrlen = ieee80211_anyhdrsize(wh); + if (IEEE80211_QOS_HAS_SEQ(wh)) + qos = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + else + qos = 0; + ac = M_WME_GETAC(m0); + tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)]; if (IEEE80211_IS_MULTICAST(wh->i_addr1)) rate = tp->mcastrate; @@ -1487,14 +1504,17 @@ rum_tx_data(struct rum_softc *sc, struct data->rate = rate; if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) { - flags |= RT2573_TX_NEED_ACK; + /* Unicast frame, check if an ACK is expected. */ + if (!qos || (qos & IEEE80211_QOS_ACKPOLICY) != + IEEE80211_QOS_ACKPOLICY_NOACK) + flags |= RT2573_TX_NEED_ACK; - dur = ieee80211_ack_duration(ic->ic_rt, rate, + dur = ieee80211_ack_duration(ic->ic_rt, rate, ic->ic_flags & IEEE80211_F_SHPREAMBLE); USETW(wh->i_dur, dur); } - rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, hdrlen, + rum_setup_tx_desc(sc, &data->desc, k, flags, xflags, ac, hdrlen, m0->m_pkthdr.len, rate); DPRINTFN(10, "sending frame len=%d rate=%d\n", @@ -2064,6 +2084,65 @@ rum_update_slot(struct ieee80211com *ic) } static void +rum_wme_update_cb(struct rum_softc *sc, union sec_param *data, uint8_t rvp_id) +{ + const struct wmeParams (*chanp)[WME_NUM_AC] = &data->wme_params; + int error = 0; + + error = rum_write(sc, RT2573_AIFSN_CSR, + chanp[WME_AC_VO]->wmep_aifsn << 12 | + chanp[WME_AC_VI]->wmep_aifsn << 8 | + chanp[WME_AC_BK]->wmep_aifsn << 4 | + chanp[WME_AC_BE]->wmep_aifsn); + if (error) + goto print_err; + error = rum_write(sc, RT2573_CWMIN_CSR, + chanp[WME_AC_VO]->wmep_logcwmin << 12 | + chanp[WME_AC_VI]->wmep_logcwmin << 8 | + chanp[WME_AC_BK]->wmep_logcwmin << 4 | + chanp[WME_AC_BE]->wmep_logcwmin); + if (error) + goto print_err; + error = rum_write(sc, RT2573_CWMAX_CSR, + chanp[WME_AC_VO]->wmep_logcwmax << 12 | + chanp[WME_AC_VI]->wmep_logcwmax << 8 | + chanp[WME_AC_BK]->wmep_logcwmax << 4 | + chanp[WME_AC_BE]->wmep_logcwmax); + if (error) + goto print_err; + error = rum_write(sc, RT2573_TXOP01_CSR, + chanp[WME_AC_BK]->wmep_txopLimit << 16 | + chanp[WME_AC_BE]->wmep_txopLimit); + if (error) + goto print_err; + error = rum_write(sc, RT2573_TXOP23_CSR, + chanp[WME_AC_VO]->wmep_txopLimit << 16 | + chanp[WME_AC_VI]->wmep_txopLimit); + if (error) + goto print_err; + + memcpy(sc->wme_params, chanp, sizeof(*chanp) * WME_NUM_AC); + + return; + +print_err: + device_printf(sc->sc_dev, "%s: WME update failed, error %d\n", + __func__, error); +} + +static int +rum_wme_update(struct ieee80211com *ic) +{ + struct rum_softc *sc = ic->ic_softc; + const struct wmeParams (*chanp)[WME_NUM_AC] = + &ic->ic_wme.wme_chanParams.cap_wmeParams; + + rum_cmd_sleepable(sc, chanp, sizeof (*chanp), 0, rum_wme_update_cb); + + return (0); +} + +static void rum_set_bssid(struct rum_softc *sc, const uint8_t *bssid) { @@ -2288,6 +2367,11 @@ rum_init(struct rum_softc *sc) for (i = 0; i < nitems(rum_def_mac); i++) rum_write(sc, rum_def_mac[i].reg, rum_def_mac[i].val); + /* reset some WME parameters to default values */ + sc->wme_params[0].wmep_aifsn = 2; + sc->wme_params[0].wmep_logcwmin = 4; + sc->wme_params[0].wmep_logcwmax = 10; + /* set host ready */ rum_write(sc, RT2573_MAC_CSR1, RT2573_RESET_ASIC | RT2573_RESET_BBP); rum_write(sc, RT2573_MAC_CSR1, 0); @@ -2431,7 +2515,7 @@ rum_set_beacon(struct rum_softc *sc, str tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, NULL, RT2573_TX_TIMESTAMP, - RT2573_TX_HWSEQ, 0, m->m_pkthdr.len, tp->mgmtrate); + RT2573_TX_HWSEQ, 0, 0, m->m_pkthdr.len, tp->mgmtrate); /* copy the Tx descriptor into NIC memory */ if (rum_write_multi(sc, RT2573_HW_BCN_BASE(0), (uint8_t *)&desc, Modified: head/sys/dev/usb/wlan/if_rumreg.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rumreg.h Sat Oct 3 22:35:37 2015 (r288642) @@ -39,6 +39,8 @@ #define RT2573_AIFSN_CSR 0x0400 #define RT2573_CWMIN_CSR 0x0404 #define RT2573_CWMAX_CSR 0x0408 +#define RT2573_TXOP01_CSR 0x040C +#define RT2573_TXOP23_CSR 0x0410 #define RT2573_MCU_CODE_BASE 0x0800 /* Modified: head/sys/dev/usb/wlan/if_rumvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:33:45 2015 (r288641) +++ head/sys/dev/usb/wlan/if_rumvar.h Sat Oct 3 22:35:37 2015 (r288642) @@ -73,6 +73,7 @@ typedef STAILQ_HEAD(, rum_tx_data) rum_t union sec_param { struct ieee80211_key key; + struct wmeParams wme_params[WME_NUM_AC]; uint8_t macaddr[IEEE80211_ADDR_LEN]; struct ieee80211vap *vap; }; @@ -138,6 +139,7 @@ struct rum_softc { sc_clr_shkeys:1; uint8_t sc_bssid[IEEE80211_ADDR_LEN]; + struct wmeParams wme_params[WME_NUM_AC]; uint8_t vap_key_count[1]; uint64_t keys_bmap; From owner-svn-src-head@freebsd.org Sat Oct 3 22:38:09 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C85CA0F99E; Sat, 3 Oct 2015 22:38:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A7AA1F70; Sat, 3 Oct 2015 22:38:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t93Mc9Ua051655; Sat, 3 Oct 2015 22:38:09 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t93Mc9QB051654; Sat, 3 Oct 2015 22:38:09 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201510032238.t93Mc9QB051654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Oct 2015 22:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r288643 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2015 22:38:09 -0000 Author: adrian Date: Sat Oct 3 22:38:08 2015 New Revision: 288643 URL: https://svnweb.freebsd.org/changeset/base/288643 Log: net80211: reduce code duplication in the ieee80211_ioctl_setwmeparam() + fix comments. Submitted by: Differential Revision: https://reviews.freebsd.org/D3701 Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sat Oct 3 22:35:37 2015 (r288642) +++ head/sys/net80211/ieee80211_ioctl.c Sat Oct 3 22:38:08 2015 (r288643) @@ -957,7 +957,7 @@ ieee80211_ioctl_get80211(struct ieee8021 case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ - case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ + case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only) */ error = ieee80211_ioctl_getwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: @@ -1757,13 +1757,14 @@ ieee80211_ioctl_setwmeparam(struct ieee8 struct ieee80211com *ic = vap->iv_ic; struct ieee80211_wme_state *wme = &ic->ic_wme; struct wmeParams *wmep, *chanp; - int isbss, ac; + int isbss, ac, aggrmode; if ((ic->ic_caps & IEEE80211_C_WME) == 0) return EOPNOTSUPP; isbss = (ireq->i_len & IEEE80211_WMEPARAM_BSS); ac = (ireq->i_len & IEEE80211_WMEPARAM_VAL); + aggrmode = (wme->wme_flags & WME_F_AGGRMODE); if (ac >= WME_NUM_AC) ac = WME_AC_BE; if (isbss) { @@ -1775,47 +1776,28 @@ ieee80211_ioctl_setwmeparam(struct ieee8 } switch (ireq->i_type) { case IEEE80211_IOC_WME_CWMIN: /* WME: CWmin */ - if (isbss) { - wmep->wmep_logcwmin = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_logcwmin = ireq->i_val; - } else { - wmep->wmep_logcwmin = chanp->wmep_logcwmin = - ireq->i_val; - } + wmep->wmep_logcwmin = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_logcwmin = ireq->i_val; break; case IEEE80211_IOC_WME_CWMAX: /* WME: CWmax */ - if (isbss) { - wmep->wmep_logcwmax = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_logcwmax = ireq->i_val; - } else { - wmep->wmep_logcwmax = chanp->wmep_logcwmax = - ireq->i_val; - } + wmep->wmep_logcwmax = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_logcwmax = ireq->i_val; break; case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ - if (isbss) { - wmep->wmep_aifsn = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_aifsn = ireq->i_val; - } else { - wmep->wmep_aifsn = chanp->wmep_aifsn = ireq->i_val; - } + wmep->wmep_aifsn = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_aifsn = ireq->i_val; break; case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ - if (isbss) { - wmep->wmep_txopLimit = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) - chanp->wmep_txopLimit = ireq->i_val; - } else { - wmep->wmep_txopLimit = chanp->wmep_txopLimit = - ireq->i_val; - } + wmep->wmep_txopLimit = ireq->i_val; + if (!isbss || !aggrmode) + chanp->wmep_txopLimit = ireq->i_val; break; case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ wmep->wmep_acm = ireq->i_val; - if ((wme->wme_flags & WME_F_AGGRMODE) == 0) + if (!aggrmode) chanp->wmep_acm = ireq->i_val; break; case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only)*/ @@ -2945,7 +2927,7 @@ ieee80211_ioctl_set80211(struct ieee8021 case IEEE80211_IOC_WME_AIFS: /* WME: AIFS */ case IEEE80211_IOC_WME_TXOPLIMIT: /* WME: txops limit */ case IEEE80211_IOC_WME_ACM: /* WME: ACM (bss only) */ - case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (bss only) */ + case IEEE80211_IOC_WME_ACKPOLICY: /* WME: ACK policy (!bss only) */ error = ieee80211_ioctl_setwmeparam(vap, ireq); break; case IEEE80211_IOC_DTIM_PERIOD: