From owner-svn-src-stable@freebsd.org Sun Apr 17 01:35:58 2016 Return-Path: Delivered-To: svn-src-stable@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 BCB14B0A449; Sun, 17 Apr 2016 01:35:58 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9751519F5; Sun, 17 Apr 2016 01:35:58 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3H1ZvLD012442; Sun, 17 Apr 2016 01:35:57 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3H1Zv1H012441; Sun, 17 Apr 2016 01:35:57 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201604170135.u3H1Zv1H012441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 17 Apr 2016 01:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298134 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2016 01:35:58 -0000 Author: scottl Date: Sun Apr 17 01:35:57 2016 New Revision: 298134 URL: https://svnweb.freebsd.org/changeset/base/298134 Log: MFC r298004: Add a devctl/devd notification conduit for CAM errors that happen at the periph level. Due to not merging the changes to ata_res_sbuf(), this version is a little messy. Sponsored by: Netflix Modified: stable/10/sys/cam/cam_periph.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_periph.c ============================================================================== --- stable/10/sys/cam/cam_periph.c Sat Apr 16 22:02:32 2016 (r298133) +++ stable/10/sys/cam/cam_periph.c Sun Apr 17 01:35:57 2016 (r298134) @@ -86,6 +86,7 @@ static int camperiphscsisenseerror(unio u_int32_t *timeout, u_int32_t *action, const char **action_string); +static void cam_periph_devctl_notify(union ccb *ccb); static int nperiph_drivers; static int initialized = 0; @@ -1615,7 +1616,7 @@ cam_periph_error(union ccb *ccb, cam_fla struct cam_periph *periph; const char *action_string; cam_status status; - int frozen, error, openings; + int frozen, error, openings, devctl_err; u_int32_t action, relsim_flags, timeout; action = SSQ_PRINT_SENSE; @@ -1624,9 +1625,26 @@ cam_periph_error(union ccb *ccb, cam_fla status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; status &= CAM_STATUS_MASK; - openings = relsim_flags = timeout = 0; + devctl_err = openings = relsim_flags = timeout = 0; orig_ccb = ccb; + /* Filter the errors that should be reported via devctl */ + switch (ccb->ccb_h.status & CAM_STATUS_MASK) { + case CAM_CMD_TIMEOUT: + case CAM_REQ_ABORTED: + case CAM_REQ_CMP_ERR: + case CAM_REQ_TERMIO: + case CAM_UNREC_HBA_ERROR: + case CAM_DATA_RUN_ERR: + case CAM_SCSI_STATUS_ERROR: + case CAM_ATA_STATUS_ERROR: + case CAM_SMP_STATUS_ERROR: + devctl_err++; + break; + default: + break; + } + switch (status) { case CAM_REQ_CMP: error = 0; @@ -1754,6 +1772,9 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Retrying command\n"); } + if (devctl_err) + cam_periph_devctl_notify(orig_ccb); + if ((action & SSQ_LOST) != 0) { lun_id_t lun_id; @@ -1824,3 +1845,83 @@ cam_periph_error(union ccb *ccb, cam_fla return (error); } + +#define CAM_PERIPH_DEVD_MSG_SIZE 256 + +static void +cam_periph_devctl_notify(union ccb *ccb) +{ + struct cam_periph *periph; + struct ccb_getdev *cgd; + struct sbuf sb; + int serr, sk, asc, ascq; + char *sbmsg, *type; + + sbmsg = malloc(CAM_PERIPH_DEVD_MSG_SIZE, M_CAMPERIPH, M_NOWAIT); + if (sbmsg == NULL) + return; + + sbuf_new(&sb, sbmsg, CAM_PERIPH_DEVD_MSG_SIZE, SBUF_FIXEDLEN); + + periph = xpt_path_periph(ccb->ccb_h.path); + sbuf_printf(&sb, "device=%s%d ", periph->periph_name, + periph->unit_number); + + sbuf_printf(&sb, "serial=\""); + if ((cgd = (struct ccb_getdev *)xpt_alloc_ccb_nowait()) != NULL) { + xpt_setup_ccb(&cgd->ccb_h, ccb->ccb_h.path, + CAM_PRIORITY_NORMAL); + cgd->ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)cgd); + + if (cgd->ccb_h.status == CAM_REQ_CMP) + sbuf_bcat(&sb, cgd->serial_num, cgd->serial_num_len); + } + sbuf_printf(&sb, "\" "); + sbuf_printf(&sb, "cam_status=\"0x%x\" ", ccb->ccb_h.status); + + switch (ccb->ccb_h.status & CAM_STATUS_MASK) { + case CAM_CMD_TIMEOUT: + sbuf_printf(&sb, "timeout=%d ", ccb->ccb_h.timeout); + type = "timeout"; + break; + case CAM_SCSI_STATUS_ERROR: + sbuf_printf(&sb, "scsi_status=%d ", ccb->csio.scsi_status); + if (scsi_extract_sense_ccb(ccb, &serr, &sk, &asc, &ascq)) + sbuf_printf(&sb, "scsi_sense=\"%02x %02x %02x %02x\" ", + serr, sk, asc, ascq); + type = "error"; + break; + case CAM_ATA_STATUS_ERROR: + { + char res_str[(11 * 3) + 1]; + + sbuf_printf(&sb, "RES=\"%s\" ", ata_res_string(&ccb->ataio.res, + res_str, sizeof(res_str))); + type = "error"; + break; + } + default: + type = "error"; + break; + } + + if (ccb->ccb_h.func_code == XPT_SCSI_IO) { + sbuf_printf(&sb, "CDB=\""); + if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) + scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_ptr, &sb); + else + scsi_cdb_sbuf(ccb->csio.cdb_io.cdb_bytes, &sb); + sbuf_printf(&sb, "\" "); + } else if (ccb->ccb_h.func_code == XPT_ATA_IO) { + sbuf_printf(&sb, "ACB=\""); + ata_cmd_sbuf(&ccb->ataio.cmd, &sb); + sbuf_printf(&sb, "\" "); + } + + if (sbuf_finish(&sb) == 0) + devctl_notify("CAM", "periph", type, sbuf_data(&sb)); + sbuf_delete(&sb); + free(sbmsg, M_CAMPERIPH); +} + From owner-svn-src-stable@freebsd.org Sun Apr 17 01:38:38 2016 Return-Path: Delivered-To: svn-src-stable@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 B90C3B0A50A; Sun, 17 Apr 2016 01:38:38 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7BF3D1B67; Sun, 17 Apr 2016 01:38:38 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3H1cbLs012578; Sun, 17 Apr 2016 01:38:37 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3H1cbVZ012577; Sun, 17 Apr 2016 01:38:37 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201604170138.u3H1cbVZ012577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 17 Apr 2016 01:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298135 - stable/10/sbin/devd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2016 01:38:38 -0000 Author: scottl Date: Sun Apr 17 01:38:37 2016 New Revision: 298135 URL: https://svnweb.freebsd.org/changeset/base/298135 Log: Merge r298008 Update the devd.conf man page to describe the new CAM/periph system/subsystem. Sponsored by: Netflix Modified: stable/10/sbin/devd/devd.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/devd/devd.conf.5 ============================================================================== --- stable/10/sbin/devd/devd.conf.5 Sun Apr 17 01:35:57 2016 (r298134) +++ stable/10/sbin/devd/devd.conf.5 Sun Apr 17 01:38:37 2016 (r298135) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd July 11, 2015 +.Dd April 14, 2016 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -492,6 +492,23 @@ Information about the state of the syste Notification that the system has woken from the suspended state. .El .El +.Pp +.It Li CAM +Events related to the +.Xr cam 4 +system. +.Bl -tag -width ".Sy Subsystem" -compact +.It Sy Subsystem +.It Li periph +Events related to peripheral devices. +.Bl -tag -width ".li timeout" -compact +.It Sy Type +.It Li error +Generic errors. +.It Li timeout +Command timeouts. +.El +.El .El .Pp A link state change to UP on the interface @@ -621,4 +638,5 @@ has many additional examples. .Xr coretemp 4 , .Xr devfs 5 , .Xr re_format 7 , -.Xr devd 8 +.Xr devd 8 , +.Xr cam 4 From owner-svn-src-stable@freebsd.org Mon Apr 18 08:30:57 2016 Return-Path: Delivered-To: svn-src-stable@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 32DC2B1223C; Mon, 18 Apr 2016 08:30:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 D76DE14C6; Mon, 18 Apr 2016 08:30:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3I8Uu5v079048; Mon, 18 Apr 2016 08:30:56 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3I8Urnu079016; Mon, 18 Apr 2016 08:30:53 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201604180830.u3I8Urnu079016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 18 Apr 2016 08:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298198 - in stable/9: contrib/file contrib/file/doc contrib/file/magic/Magdir contrib/file/src lib/libmagic X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2016 08:30:57 -0000 Author: delphij Date: Mon Apr 18 08:30:52 2016 New Revision: 298198 URL: https://svnweb.freebsd.org/changeset/base/298198 Log: MFC r287453,287454,288143: file 5.25. Modified: stable/9/contrib/file/ChangeLog stable/9/contrib/file/configure stable/9/contrib/file/configure.ac stable/9/contrib/file/doc/file.man stable/9/contrib/file/doc/libmagic.man stable/9/contrib/file/doc/magic.man stable/9/contrib/file/magic/Magdir/adventure stable/9/contrib/file/magic/Magdir/apple stable/9/contrib/file/magic/Magdir/archive stable/9/contrib/file/magic/Magdir/c-lang stable/9/contrib/file/magic/Magdir/c64 stable/9/contrib/file/magic/Magdir/compress stable/9/contrib/file/magic/Magdir/database stable/9/contrib/file/magic/Magdir/elf stable/9/contrib/file/magic/Magdir/filesystems stable/9/contrib/file/magic/Magdir/fortran stable/9/contrib/file/magic/Magdir/frame stable/9/contrib/file/magic/Magdir/iff stable/9/contrib/file/magic/Magdir/images stable/9/contrib/file/magic/Magdir/karma stable/9/contrib/file/magic/Magdir/linux stable/9/contrib/file/magic/Magdir/mail.news stable/9/contrib/file/magic/Magdir/make stable/9/contrib/file/magic/Magdir/map stable/9/contrib/file/magic/Magdir/msdos stable/9/contrib/file/magic/Magdir/netscape stable/9/contrib/file/magic/Magdir/python stable/9/contrib/file/magic/Magdir/scientific stable/9/contrib/file/magic/Magdir/sgi stable/9/contrib/file/magic/Magdir/sgml stable/9/contrib/file/magic/Magdir/windows stable/9/contrib/file/src/apprentice.c stable/9/contrib/file/src/file.c stable/9/contrib/file/src/file.h stable/9/contrib/file/src/file_opts.h stable/9/contrib/file/src/funcs.c stable/9/contrib/file/src/gmtime_r.c stable/9/contrib/file/src/localtime_r.c stable/9/contrib/file/src/magic.c stable/9/contrib/file/src/magic.h stable/9/contrib/file/src/magic.h.in stable/9/contrib/file/src/print.c stable/9/contrib/file/src/readelf.c stable/9/contrib/file/src/softmagic.c stable/9/lib/libmagic/config.h Directory Properties: stable/9/contrib/file/ (props changed) stable/9/lib/libmagic/ (props changed) Modified: stable/9/contrib/file/ChangeLog ============================================================================== --- stable/9/contrib/file/ChangeLog Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/ChangeLog Mon Apr 18 08:30:52 2016 (r298198) @@ -1,3 +1,23 @@ +2015-09-16 9:50 Christos Zoulas + + * release 5.25 + +2015-09-11 13:25 Christos Zoulas + + * add a limit to the length of regex searches + +2015-09-08 9:50 Christos Zoulas + + * fix problems with --parameter (Christoph Biedl) + +2015-07-11 10:35 Christos Zoulas + + * Windows fixes PR/466 (Jason Hood) + +2015-07-09 10:35 Christos Zoulas + + * release 5.24 + 2015-06-11 8:52 Christos Zoulas * redo long option encoding to fix off-by-one in 5.23 Modified: stable/9/contrib/file/configure ============================================================================== --- stable/9/contrib/file/configure Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/configure Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.23. +# Generated by GNU Autoconf 2.69 for file 5.25. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.23' -PACKAGE_STRING='file 5.23' +PACKAGE_VERSION='5.25' +PACKAGE_STRING='file 5.25' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.23 to adapt to many kinds of systems. +\`configure' configures file 5.25 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.23:";; + short | recursive ) echo "Configuration of file 5.25:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.23 +file configure 5.25 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2163,7 +2163,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.23, which was +It was created by file $as_me 5.25, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3029,7 +3029,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.23' + VERSION='5.25' cat >>confdefs.h <<_ACEOF @@ -15036,7 +15036,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.23, which was +This file was extended by file $as_me 5.25, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15102,7 +15102,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.23 +file config.status 5.25 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/9/contrib/file/configure.ac ============================================================================== --- stable/9/contrib/file/configure.ac Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/configure.ac Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.23],[christos@astron.com]) +AC_INIT([file],[5.25],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) Modified: stable/9/contrib/file/doc/file.man ============================================================================== --- stable/9/contrib/file/doc/file.man Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/doc/file.man Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.117 2015/06/03 19:51:27 christos Exp $ -.Dd June 3, 2015 +.\" $File: file.man,v 1.118 2015/09/11 17:24:09 christos Exp $ +.Dd September 11, 2015 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -316,6 +316,7 @@ Set various parameter limits. .It Li elf_notes Ta 256 Ta max ELF notes processed .It Li elf_phnum Ta 128 Ta max ELF program sections processed .It Li elf_shnum Ta 32768 Ta max ELF sections processed +.It Li regex Ta 8192 Ta length limit for regex searches .El .It Fl r , Fl Fl raw Don't translate unprintable characters to \eooo. Modified: stable/9/contrib/file/doc/libmagic.man ============================================================================== --- stable/9/contrib/file/doc/libmagic.man Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/doc/libmagic.man Mon Apr 18 08:30:52 2016 (r298198) @@ -1,4 +1,4 @@ -.\" $File: libmagic.man,v 1.37 2015/06/03 18:21:24 christos Exp $ +.\" $File: libmagic.man,v 1.38 2015/09/11 17:24:09 christos Exp $ .\" .\" Copyright (c) Christos Zoulas 2003. .\" All Rights Reserved. @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd June 3, 2015 +.Dd September 11, 2015 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -291,6 +291,7 @@ library. .It Li MAGIC_PARAM_ELF_NOTES_MAX Ta size_t Ta 256 .It Li MAGIC_PARAM_ELF_PHNUM_MAX Ta size_t Ta 128 .It Li MAGIC_PARAM_ELF_SHNUM_MAX Ta size_t Ta 32768 +.It Li MAGIC_PARAM_REGEX_MAX Ta size_t Ta 8192 .El .Pp The Modified: stable/9/contrib/file/doc/magic.man ============================================================================== --- stable/9/contrib/file/doc/magic.man Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/doc/magic.man Mon Apr 18 08:30:52 2016 (r298198) @@ -1,4 +1,4 @@ -.\" $File: magic.man,v 1.85 2015/01/01 17:07:34 christos Exp $ +.\" $File: magic.man,v 1.86 2015/09/08 13:48:44 christos Exp $ .Dd January 1, 2015 .Dt MAGIC __FSECTION__ .Os @@ -200,7 +200,7 @@ interpreted as a UNIX-style date, but in than UTC. .It Dv indirect Starting at the given offset, consult the magic database again. -The offset of th +The offset of the .Dv indirect magic is by default absolute in the file, but one can specify .Dv /r Modified: stable/9/contrib/file/magic/Magdir/adventure ============================================================================== --- stable/9/contrib/file/magic/Magdir/adventure Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/adventure Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: adventure,v 1.14 2012/06/21 01:32:26 christos Exp $ +# $File: adventure,v 1.15 2015/09/07 10:03:21 christos Exp $ # adventure: file(1) magic for Adventure game files # # from Allen Garvin @@ -17,6 +17,7 @@ # Infocom (see z-machine) #------------------------------------------------------------------------------ # Z-machine: file(1) magic for Z-machine binaries. +# Sanity checks by David Griffith # Updated by Adam Buchbinder # #http://www.gnelson.demon.co.uk/zspec/sect11.html @@ -41,10 +42,12 @@ >>>>>>>2 ubeshort < 10 Release %d / >>>>>>>>18 string >\0 Serial %.6s) !:strength + 40 +!:mime application/x-zmachine #------------------------------------------------------------------------------ # Glulx: file(1) magic for Glulx binaries. # +# David Griffith # I haven't checked for false matches yet. # 0 string Glul Glulx game data @@ -52,7 +55,7 @@ >>6 byte x \b.%d >>8 byte x \b.%d) >36 string Info Compiled by Inform - +!:mime application/x-glulx # For Quetzal and blorb magic see iff @@ -66,11 +69,13 @@ >9 belong !0x0A0D1A00 game data, CORRUPTED >9 belong 0x0A0D1A00 >>13 string >\0 %s game data +!:mime application/x-tads # Resource files start with "TADS2 rsc\n\r\032\0" then the compiler version. 0 string TADS2\ rsc TADS >9 belong !0x0A0D1A00 resource data, CORRUPTED >9 belong 0x0A0D1A00 >>13 string >\0 %s resource data +!:mime application/x-tads # Some saved game files start with "TADS2 save/g\n\r\032\0", a little-endian # 2-byte length N, the N-char name of the game file *without* a NUL (darn!), # "TADS2 save\n\r\032\0" and the interpreter version. @@ -78,12 +83,14 @@ >12 belong !0x0A0D1A00 saved game data, CORRUPTED >12 belong 0x0A0D1A00 >>(16.s+32) string >\0 %s saved game data +!:mime application/x-tads # Other saved game files start with "TADS2 save\n\r\032\0" and the interpreter # version. 0 string TADS2\ save TADS >10 belong !0x0A0D1A00 saved game data, CORRUPTED >10 belong 0x0A0D1A00 >>14 string >\0 %s saved game data +!:mime application/x-tads # TADS (Text Adventure Development System) version 3 # Game files start with "T3-image\015\012\032" @@ -97,14 +104,18 @@ >>11 byte x \b%c >>12 byte x \b%c >>13 byte x \b%c) +!:mime application/x-t3vm-image +# edited by David Griffith # Danny Milosavljevic -# this are adrift (adventure game standard) game files, extension .taf -# depending on version magic continues with 0x93453E6139FA (V 4.0) -# 0x9445376139FA (V 3.90) -# 0x9445366139FA (V 3.80) -# this is from source (http://www.adrift.org.uk/) and I have some taf -# files, and checked them. -#0 belong 0x3C423FC9 -#>4 belong 0x6A87C2CF Adrift game file -#!:mime application/x-adrift +# These are ADRIFT (adventure game standard) game files, extension .taf +# Checked from source at (http://www.adrift.co/) and various taf files +# found at the Interactive Fiction Archive (http://ifarchive.org/) +0 belong 0x3C423FC9 +>4 belong 0x6A87C2CF Adrift game file version +>>8 belong 0x94453661 3.80 +>>8 belong 0x94453761 3.90 +>>8 belong 0x93453E61 4.0 +>>8 belong 0x92453E61 5.0 +>>8 default x unknown +!:mime application/x-adrift Modified: stable/9/contrib/file/magic/Magdir/apple ============================================================================== --- stable/9/contrib/file/magic/Magdir/apple Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/apple Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: apple,v 1.30 2015/04/13 13:09:06 christos Exp $ +# $File: apple,v 1.31 2015/08/29 07:10:35 christos Exp $ # apple: file(1) magic for Apple file formats # 0 search/1/t FiLeStArTfIlEsTaRt binscii (apple ][) text @@ -265,14 +265,14 @@ >>20 beshort x \b, descriptors %d # Assume 8 partitions each at a multiple of the sector size. # We could glean this from the partition descriptors, but they are empty!?!? ->>(2.S*1) indirect \b, contains[@0x%x]: ->>(2.S*2) indirect \b, contains[@0x%x]: ->>(2.S*3) indirect \b, contains[@0x%x]: ->>(2.S*4) indirect \b, contains[@0x%x]: ->>(2.S*5) indirect \b, contains[@0x%x]: ->>(2.S*6) indirect \b, contains[@0x%x]: ->>(2.S*7) indirect \b, contains[@0x%x]: ->>(2.S*8) indirect \b, contains[@0x%x]: +>>(2.S*1) indirect x \b, contains[@0x%x]: +>>(2.S*2) indirect x \b, contains[@0x%x]: +>>(2.S*3) indirect x \b, contains[@0x%x]: +>>(2.S*4) indirect x \b, contains[@0x%x]: +>>(2.S*5) indirect x \b, contains[@0x%x]: +>>(2.S*6) indirect x \b, contains[@0x%x]: +>>(2.S*7) indirect x \b, contains[@0x%x]: +>>(2.S*8) indirect x \b, contains[@0x%x]: # Yes, the 3rd and 4th bytes are reserved, but we use them to make the # magic stronger. Modified: stable/9/contrib/file/magic/Magdir/archive ============================================================================== --- stable/9/contrib/file/magic/Magdir/archive Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/archive Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: archive,v 1.90 2015/04/24 15:44:12 christos Exp $ +# $File: archive,v 1.91 2015/09/16 13:49:33 christos Exp $ # archive: file(1) magic for archive formats (see also "msdos" for self- # extracting compressed archives) # @@ -434,16 +434,34 @@ # AIN 0 string \x33\x18 AIN archive data 0 string \x33\x17 AIN archive data -# XPA32 -0 string xpa\0\1 XPA32 archive data +# XPA32 test moved and merged with XPA by Joerg Jenderek at Sep 2015 # SZip (TODO: doesn't catch all versions) 0 string SZ\x0a\4 SZip archive data # XPack DiskImage -0 string jm XPack DiskImage archive data +# *.XDI updated by Joerg Jenderek Sep 2015 +# ftp://ftp.sac.sk/pub/sac/pack/0index.txt +# GRR: this test is still too general as it catches also text files starting with jm +0 string jm +# only found examples with this additional characteristic 2 bytes +>2 string \x2\x4 Xpack DiskImage archive data +#!:ext xdi # XPack Data -0 string xpa XPack archive data +# *.xpa updated by Joerg Jenderek Sep 2015 +# ftp://ftp.elf.stuba.sk/pub/pc/pack/ +0 string xpa XPA +!:ext xpa +# XPA32 +# ftp://ftp.elf.stuba.sk/pub/pc/pack/xpa32.zip +# created by XPA32.EXE version 1.0.2 for Windows +>0 string xpa\0\1 \b32 archive data +# created by XPACK.COM version 1.67m or 1.67r with short 0x1800 +>3 ubeshort !0x0001 \bck archive data # XPack Single Data -0 string \xc3\x8d\ jm XPack single archive data +# changed by Joerg Jenderek Sep 2015 back to like in version 5.12 +# letter 'I'+ acute accent is equivalent to \xcd +0 string \xcd\ jm Xpack single archive data +#!:mime application/x-xpa-compressed +!:ext xpa # TODO: missing due to unknown magic/magic at end of file: #DWC Modified: stable/9/contrib/file/magic/Magdir/c-lang ============================================================================== --- stable/9/contrib/file/magic/Magdir/c-lang Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/c-lang Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: c-lang,v 1.19 2014/06/03 19:17:27 christos Exp $ +# $File: c-lang,v 1.20 2015/07/27 14:33:10 christos Exp $ # c-lang: file(1) magic for C and related languages programs # @@ -29,7 +29,7 @@ # C++ # The strength of these rules is increased so they beat the C rules above -0 regex \^template[\ \t\n]+ C++ source text +0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text !:strength + 5 !:mime text/x-c++ 0 regex \^virtual[\ \t\n]+ C++ source text Modified: stable/9/contrib/file/magic/Magdir/c64 ============================================================================== --- stable/9/contrib/file/magic/Magdir/c64 Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/c64 Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: c64,v 1.5 2009/09/19 16:28:08 christos Exp $ +# $File: c64,v 1.6 2015/08/24 05:17:42 christos Exp $ # c64: file(1) magic for various commodore 64 related files # # From: Dirk Jagdmann @@ -41,3 +41,9 @@ >32 leshort x Version:0x%x >36 leshort !0 Entries:%i >40 string x Name:%.24s + +# Raw tape file format (.tap files) +# Esa Hyyti +0 string C64-TAPE-RAW C64 Raw Tape File (.tap), +>0x0c byte x Version:%u, +>0x10 lelong x Length:%u cycles Modified: stable/9/contrib/file/magic/Magdir/compress ============================================================================== --- stable/9/contrib/file/magic/Magdir/compress Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/compress Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: compress,v 1.63 2015/03/11 19:27:35 christos Exp $ +# $File: compress,v 1.64 2015/07/27 15:41:09 christos Exp $ # compress: file(1) magic for pure-compression formats (no archives) # # compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. @@ -258,7 +258,8 @@ !:mime application/x-qpress # Zlib https://www.ietf.org/rfc/rfc6713.txt -0 beshort%31 =0 ->0 byte&0xf =8 ->>0 byte&0x80 =0 zlib compressed data +0 string/b x +>0 beshort%31 =0 +>>0 byte&0xf =8 +>>>0 byte&0x80 =0 zlib compressed data !:mime application/zlib Modified: stable/9/contrib/file/magic/Magdir/database ============================================================================== --- stable/9/contrib/file/magic/Magdir/database Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/database Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: database,v 1.43 2014/10/28 15:47:39 christos Exp $ +# $File: database,v 1.45 2015/09/09 16:25:29 christos Exp $ # database: file(1) magic for various databases # # extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) @@ -533,9 +533,15 @@ # From: Stephane Blondon http://www.yaal.fr # Database file for Zope (done by FileStorage) -0 string FS21 Zope Object Database File Storage (data) +0 string FS21 Zope Object Database File Storage v3 (data) +0 string FS30 Zope Object Database File Storage v4 (data) + # Cache file for the database of Zope (done by ClientStorage) 0 string ZEC3 Zope Object Database Client Cache File (data) # IDA (Interactive Disassembler) database 0 string IDA1 IDA (Interactive Disassembler) database + +# Hopper (reverse engineering tool) http://www.hopperapp.com/ +0 string hopperdb Hopper database + Modified: stable/9/contrib/file/magic/Magdir/elf ============================================================================== --- stable/9/contrib/file/magic/Magdir/elf Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/elf Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: elf,v 1.68 2014/09/19 19:05:57 christos Exp $ +# $File: elf,v 1.69 2015/06/16 17:23:08 christos Exp $ # elf: file(1) magic for ELF executables # # We have to check the byte order flag to see what byte order all the @@ -15,6 +15,32 @@ # Modified by (4): (VMS Itanium) # Modified by (5): Matthias Urlichs (Listing of many architectures) +0 name elf-mips +>0 lelong&0xf0000000 0x00000000 MIPS-I +>0 lelong&0xf0000000 0x10000000 MIPS-II +>0 lelong&0xf0000000 0x20000000 MIPS-III +>0 lelong&0xf0000000 0x30000000 MIPS-IV +>0 lelong&0xf0000000 0x40000000 MIPS-V +>0 lelong&0xf0000000 0x50000000 MIPS32 +>0 lelong&0xf0000000 0x60000000 MIPS64 +>0 lelong&0xf0000000 0x70000000 MIPS32 rel2 +>0 lelong&0xf0000000 0x80000000 MIPS64 rel2 +>0 lelong&0xf0000000 0x90000000 MIPS32 rel6 +>0 lelong&0xf0000000 0xa0000000 MIPS64 rel6 + +0 name elf-sparc +>0 lelong&0x00ffff00 0x00000100 V8+ Required, +>0 lelong&0x00ffff00 0x00000200 Sun UltraSPARC1 Extensions Required, +>0 lelong&0x00ffff00 0x00000400 HaL R1 Extensions Required, +>0 lelong&0x00ffff00 0x00000800 Sun UltraSPARC3 Extensions Required, +>0 lelong&0x3 0 total store ordering, +>0 lelong&0x3 1 partial store ordering, +>0 lelong&0x3 2 relaxed memory ordering, + +0 name elf-pa-risc +>2 leshort 0x0214 2.0 +>0 leshort &0x0008 (LP64) + 0 name elf-le >16 leshort 0 no file type, !:mime application/octet-stream @@ -55,47 +81,26 @@ >18 leshort 8 # only for 32-bit >>4 byte 1 ->>>36 lelong&0xf0000000 0x00000000 MIPS-I ->>>36 lelong&0xf0000000 0x10000000 MIPS-II ->>>36 lelong&0xf0000000 0x20000000 MIPS-III ->>>36 lelong&0xf0000000 0x30000000 MIPS-IV ->>>36 lelong&0xf0000000 0x40000000 MIPS-V ->>>36 lelong&0xf0000000 0x50000000 MIPS32 ->>>36 lelong&0xf0000000 0x60000000 MIPS64 ->>>36 lelong&0xf0000000 0x70000000 MIPS32 rel2 ->>>36 lelong&0xf0000000 0x80000000 MIPS64 rel2 +>>>36 use elf-mips # only for 64-bit >>4 byte 2 ->>>48 lelong&0xf0000000 0x00000000 MIPS-I ->>>48 lelong&0xf0000000 0x10000000 MIPS-II ->>>48 lelong&0xf0000000 0x20000000 MIPS-III ->>>48 lelong&0xf0000000 0x30000000 MIPS-IV ->>>48 lelong&0xf0000000 0x40000000 MIPS-V ->>>48 lelong&0xf0000000 0x50000000 MIPS32 ->>>48 lelong&0xf0000000 0x60000000 MIPS64 ->>>48 lelong&0xf0000000 0x70000000 MIPS32 rel2 ->>>48 lelong&0xf0000000 0x80000000 MIPS64 rel2 +>>>48 use elf-mips >18 leshort 9 Amdahl, >18 leshort 10 MIPS (deprecated), >18 leshort 11 RS6000, >18 leshort 15 PA-RISC, # only for 32-bit >>4 byte 1 ->>>38 leshort 0x0214 2.0 ->>>36 leshort &0x0008 (LP64) +>>>36 use elf-pa-risc # only for 64-bit >>4 byte 2 ->>>50 leshort 0x0214 2.0 ->>>48 leshort &0x0008 (LP64) +>>>48 use elf-pa-risc >18 leshort 16 nCUBE, >18 leshort 17 Fujitsu VPP500, >18 leshort 18 SPARC32PLUS, # only for 32-bit >>4 byte 1 ->>>36 lelong&0xffff00 0x000100 V8+ Required, ->>>36 lelong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required, ->>>36 lelong&0xffff00 0x000400 HaL R1 Extensions Required, ->>>36 lelong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required, +>>>36 use elf-sparc >18 leshort 19 Intel 80960, >18 leshort 20 PowerPC or cisco 4500, >18 leshort 21 64-bit PowerPC or cisco 7500, @@ -117,12 +122,7 @@ >18 leshort 42 Renesas SH, >18 leshort 43 SPARC V9, >>4 byte 2 ->>>48 lelong&0xffff00 0x000200 Sun UltraSPARC1 Extensions Required, ->>>48 lelong&0xffff00 0x000400 HaL R1 Extensions Required, ->>>48 lelong&0xffff00 0x000800 Sun UltraSPARC3 Extensions Required, ->>>48 lelong&0x3 0 total store ordering, ->>>48 lelong&0x3 1 partial store ordering, ->>>48 lelong&0x3 2 relaxed memory ordering, +>>>48 use elf-sparc >18 leshort 44 Siemens Tricore Embedded Processor, >18 leshort 45 Argonaut RISC Core, Argonaut Technologies Inc., >18 leshort 46 Renesas H8/300, Modified: stable/9/contrib/file/magic/Magdir/filesystems ============================================================================== --- stable/9/contrib/file/magic/Magdir/filesystems Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/filesystems Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: filesystems,v 1.109 2015/02/22 01:22:54 christos Exp $ +# $File: filesystems,v 1.111 2015/09/09 16:26:54 christos Exp $ # filesystems: file(1) magic for different filesystems # 0 name partid @@ -1721,7 +1721,7 @@ 0x410 leshort 0x137f !:strength / 2 >0x402 beshort < 100 ->0x402 beshort > -1 Minix filesystem, V1, %d zones +>0x402 beshort > -1 Minix filesystem, V1, 14 char names, %d zones >0x1e string minix \b, bootable 0x410 beshort 0x137f !:strength / 2 @@ -1740,27 +1740,26 @@ >0x1e string minix \b, bootable 0x410 leshort 0x2468 >0x402 beshort < 100 ->>0x402 beshort > -1 Minix filesystem, V2, %d zones +>>0x402 beshort > -1 Minix filesystem, V2, 14 char names >0x1e string minix \b, bootable 0x410 beshort 0x2468 >0x402 beshort < 100 ->0x402 beshort > -1 Minix filesystem, V2 (big endian), %d zones +>0x402 beshort > -1 Minix filesystem, V2 (big endian) >0x1e string minix \b, bootable - 0x410 leshort 0x2478 >0x402 beshort < 100 ->0x402 beshort > -1 Minix filesystem, V2, 30 char names, %d zones +>0x402 beshort > -1 Minix filesystem, V2, 30 char names >0x1e string minix \b, bootable 0x410 leshort 0x2478 >0x402 beshort < 100 ->0x402 beshort > -1 Minix filesystem, V2, 30 char names, %d zones +>0x402 beshort > -1 Minix filesystem, V2, 30 char names >0x1e string minix \b, bootable 0x410 beshort 0x2478 ->0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian), %d zones ->0x1e string minix \b, bootable -0x410 leshort 0x4d5a ->0x402 beshort !0 Minix filesystem, V3, %d zones +>0x402 beshort !0 Minix filesystem, V2, 30 char names (big endian) >0x1e string minix \b, bootable +0x418 leshort 0x4d5a +>0x402 beshort <100 +>>0x402 beshort > -1 Minix filesystem, V3, 60 char names # SGI disk labels - Nathan Scott 0 belong 0x0BE5A941 SGI disk label (volume header) @@ -2209,13 +2208,21 @@ >>0x10024 belong x (blocksize %d, >>0x10060 string >\0 lockproto %s) -# BTRFS -0x10040 string _BHRfS_M BTRFS Filesystem ->0x1012b string >\0 (label "%s", ->0x10090 lelong x sectorsize %d, ->0x10094 lelong x nodesize %d, ->0x10098 lelong x leafsize %d) - +# Russell Coker +0x10040 string _BHRfS_M BTRFS Filesystem +>0x1012b string >\0 label "%s", +>0x10090 lelong x sectorsize %d, +>0x10094 lelong x nodesize %d, +>0x10098 lelong x leafsize %d, +>0x10020 belong x UUID=%8x- +>0x10024 beshort x \b%4x- +>0x10026 beshort x \b%4x- +>0x10028 beshort x \b%4x- +>0x1002a beshort x \b%4x +>0x1002c belong x \b%8x, +>0x10078 lequad x %lld/ +>0x10070 lequad x \b%lld bytes used, +>0x10088 lequad x %lld devices # dvdisaster's .ecc # From: "Nelson A. de Oliveira" Modified: stable/9/contrib/file/magic/Magdir/fortran ============================================================================== --- stable/9/contrib/file/magic/Magdir/fortran Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/fortran Mon Apr 18 08:30:52 2016 (r298198) @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------ -# $File: fortran,v 1.8 2014/06/03 19:01:34 christos Exp $ +# $File: fortran,v 1.9 2015/06/17 19:55:27 christos Exp $ # FORTRAN source -0 regex/100l \^[Cc][\ \t] FORTRAN program +0 regex/100l \^[Cc][\ \t] FORTRAN program text !:mime text/x-fortran !:strength - 5 Modified: stable/9/contrib/file/magic/Magdir/frame ============================================================================== --- stable/9/contrib/file/magic/Magdir/frame Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/frame Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: frame,v 1.12 2009/09/19 16:28:09 christos Exp $ +# $File: frame,v 1.13 2015/08/29 07:10:35 christos Exp $ # frame: file(1) magic for FrameMaker files # # This stuff came on a FrameMaker demo tape, most of which is @@ -41,10 +41,10 @@ >10 string 1.0 (1.0 >13 byte x %c) # XXX - this book entry should be verified, if you find one, uncomment this -#0 string \6 string 3.0 (3.0) #>6 string 2.0 (2.0) #>6 string 1.0 (1.0) -0 string \ # I don't see why these might collide with anything else. # # Interactive Fiction related formats @@ -69,3 +70,4 @@ >8 string IFRS \b, Blorb Interactive Fiction >>24 string Exec with executable chunk >8 string IFZS \b, Z-machine or Glulx saved game file (Quetzal) +!:mime application/x-blorb Modified: stable/9/contrib/file/magic/Magdir/images ============================================================================== --- stable/9/contrib/file/magic/Magdir/images Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/images Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: images,v 1.106 2015/02/22 01:26:05 christos Exp $ +# $File: images,v 1.107 2015/07/11 14:40:10 christos Exp $ # images: file(1) magic for image formats (see also "iff", and "c-lang" for # XPM bitmaps) # @@ -37,7 +37,7 @@ # The next byte following the magic is always whitespace. # strength is changed to try these patterns before "x86 boot sector" 0 name netpbm ->3 regex/s =[0-9]{1,50}\ [0-9]{1,50} Netpbm PPM image data +>3 regex/s =[0-9]{1,50}\ [0-9]{1,50} Netpbm image data >>&0 regex =[0-9]{1,50} \b, size = %s x >>>&0 regex =[0-9]{1,50} \b %s @@ -59,7 +59,6 @@ !:strength + 45 !:mime image/x-portable-pixmap - 0 string P4 >0 use netpbm >>0 string x \b, rawbits, bitmap Modified: stable/9/contrib/file/magic/Magdir/karma ============================================================================== --- stable/9/contrib/file/magic/Magdir/karma Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/karma Mon Apr 18 08:30:52 2016 (r298198) @@ -1,9 +1,9 @@ #------------------------------------------------------------------------------ -# $File: karma,v 1.7 2014/04/30 21:41:02 christos Exp $ +# $File: karma,v 1.8 2015/08/29 07:10:35 christos Exp $ # karma: file(1) magic for Karma data files # # From -0 string KarmaRHD Version Karma Data Structure Version +0 string KarmaRHD\040Version Karma Data Structure Version >16 belong x %u Modified: stable/9/contrib/file/magic/Magdir/linux ============================================================================== --- stable/9/contrib/file/magic/Magdir/linux Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/linux Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: linux,v 1.62 2015/05/03 13:06:36 christos Exp $ +# $File: linux,v 1.63 2015/08/24 05:16:11 christos Exp $ # linux: file(1) magic for Linux files # # Values for Linux/i386 binaries, from Daniel Quinlan @@ -417,6 +417,25 @@ 0 lelong 0xde020109 locale archive >24 lelong x %d strings +# Linux Software RAID (mdadm) +# Russell Coker +0 name linuxraid +>16 belong x UUID=%8x: +>20 belong x \b%8x: +>24 belong x \b%8x: +>28 belong x \b%8x +>32 string x name=%s +>72 lelong x level=%d +>92 lelong x disks=%d + +4096 lelong 0xa92b4efc Linux Software RAID +>4100 lelong x version 1.2 (%d) +>4096 use linuxraid + +0 lelong 0xa92b4efc Linux Software RAID +>4 lelong x version 1.1 (%d) +>0 use linuxraid + # Summary: Database file for mlocate # Description: A database file as used by mlocate, a fast implementation # of locate/updatedb. It uses merging to reuse the existing Modified: stable/9/contrib/file/magic/Magdir/mail.news ============================================================================== --- stable/9/contrib/file/magic/Magdir/mail.news Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/mail.news Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------ -# $File: mail.news,v 1.22 2013/01/04 14:22:07 christos Exp $ +# $File: mail.news,v 1.23 2015/06/29 14:44:26 christos Exp $ # mail.news: file(1) magic for mail and news # # Unfortunately, saved netnews also has From line added in some news software. @@ -41,6 +41,7 @@ # From: Simon Matter 0 string \241\002\213\015skiplist\ file\0\0\0 Cyrus skiplist DB +0 string \241\002\213\015twoskip\ file\0\0\0\0 Cyrus twoskip DB # JAM(mbp) Fidonet message area databases # JHR file Modified: stable/9/contrib/file/magic/Magdir/make ============================================================================== --- stable/9/contrib/file/magic/Magdir/make Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/make Mon Apr 18 08:30:52 2016 (r298198) @@ -1,15 +1,21 @@ #------------------------------------------------------------------------------ -# $File: make,v 1.1 2011/12/08 12:12:46 rrt Exp $ +# $File: make,v 1.2 2015/08/25 07:34:06 christos Exp $ # make: file(1) magic for makefiles # -0 regex \^CFLAGS makefile script text +0 regex/100l \^CFLAGS makefile script text !:mime text/x-makefile -0 regex \^LDFLAGS makefile script text +0 regex/100l \^VPATH makefile script text !:mime text/x-makefile -0 regex \^all: makefile script text +0 regex/100l \^LDFLAGS makefile script text !:mime text/x-makefile -0 regex \^.PRECIOUS makefile script text +0 regex/100l \^all: makefile script text +!:mime text/x-makefile +0 regex/100l \^\.PRECIOUS makefile script text +!:mime text/x-makefile +0 regex/100l \^\.BEGIN BSD makefile script text +!:mime text/x-makefile +0 regex/100l \^\.include BSD makefile script text !:mime text/x-makefile -0 regex \^SUBDIRS automake makefile script text +0 regex/100l \^SUBDIRS automake makefile script text !:mime text/x-makefile Modified: stable/9/contrib/file/magic/Magdir/map ============================================================================== --- stable/9/contrib/file/magic/Magdir/map Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/map Mon Apr 18 08:30:52 2016 (r298198) @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------ -# $File: map,v 1.1 2014/06/03 18:22:25 christos Exp $ +# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $ # map: file(1) magic for Map data # @@ -9,9 +9,11 @@ 8 string .FIT FIT Map data >15 byte 0 >>35 belong x \b, unit id %d -# 20 years after unix epoch >>39 lelong x \b, serial %u ->>43 ledate/631152000 x \b, %s +# http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml +# 20 years after unix epoch +# TZ=GMT date -d '1989-12-31 0:00' +%s +>>43 leldate+631065600 x \b, %s >>47 leshort x \b, manufacturer %d >>47 leshort 1 \b (garmin) @@ -23,3 +25,17 @@ >>53 byte 4 \b (Activity) >>53 byte 8 \b (Elevations) >>53 byte 10 \b (Totals) + +# TOM TOM GPS watches ttbin files: +# http://github.com/ryanbinns/ttwatch/tree/master/ttbin +# From: Daniel Lenski +0 byte 0x20 +>1 leshort 0x0007 +>>0x76 byte 0x20 +>>>0x77 leshort 0x0075 TomTom activity file, v7 +>>>>8 leldate x (%s, +>>>>3 byte x device firmware %d. +>>>>4 byte x \b%d. +>>>>5 byte x \b%d, +>>>>6 leshort x product ID %04d) + Modified: stable/9/contrib/file/magic/Magdir/msdos ============================================================================== --- stable/9/contrib/file/magic/Magdir/msdos Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/msdos Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: msdos,v 1.100 2014/06/03 19:17:27 christos Exp $ +# $File: msdos,v 1.101 2015/08/24 05:08:48 christos Exp $ # msdos: file(1) magic for MS-DOS files # @@ -772,7 +772,7 @@ 0 ulequad 0x3a000000024e4c MS Advisor help file # HtmlHelp files (.chm) -0 string/b ITSF\003\000\000\000\x60\000\000\000\001\000\000\000 MS Windows HtmlHelp Data +0 string/b ITSF\003\000\000\000\x60\000\000\000 MS Windows HtmlHelp Data # GFA-BASIC (Wolfram Kleff) 2 string/b GFA-BASIC3 GFA-BASIC 3 data Modified: stable/9/contrib/file/magic/Magdir/netscape ============================================================================== --- stable/9/contrib/file/magic/Magdir/netscape Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/netscape Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: netscape,v 1.6 2009/09/19 16:28:11 christos Exp $ +# $File: netscape,v 1.7 2015/08/24 05:20:52 christos Exp $ # netscape: file(1) magic for Netscape files # "H. Nanosecond" # version 3 and 4 I think @@ -22,4 +22,5 @@ # #This is files ending in .art, FIXME add more rules -0 string JG\004\016\0\0\0\0 ART +0 string JG\004\016\0\0\0\0 AOL ART image +0 string JG\003\016\0\0\0\0 AOL ART image Modified: stable/9/contrib/file/magic/Magdir/python ============================================================================== --- stable/9/contrib/file/magic/Magdir/python Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/python Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: python,v 1.26 2014/08/04 05:58:40 christos Exp $ +# $File: python,v 1.27 2015/09/08 13:59:44 christos Exp $ # python: file(1) magic for python # # Outlook puts """ too for urgent messages @@ -26,12 +26,16 @@ 0 belong 0xee0c0d0a python 3.4 byte-compiled 0 search/1/w #!\ /usr/bin/python Python script text executable +!:strength + 10 !:mime text/x-python 0 search/1/w #!\ /usr/local/bin/python Python script text executable +!:strength + 10 !:mime text/x-python 0 search/1 #!/usr/bin/env\ python Python script text executable +!:strength + 10 !:mime text/x-python -0 search/1 #!\ /usr/bin/env\ python Python script text executable +0 search/10 #!\ /usr/bin/env\ python Python script text executable +!:strength + 10 !:mime text/x-python Modified: stable/9/contrib/file/magic/Magdir/scientific ============================================================================== --- stable/9/contrib/file/magic/Magdir/scientific Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/scientific Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: scientific,v 1.9 2014/06/03 19:01:34 christos Exp $ +# $File: scientific,v 1.10 2015/08/24 05:18:55 christos Exp $ # scientific: file(1) magic for scientific formats # # From: Joe Krahn @@ -104,3 +104,8 @@ >>5 byte x version %d.0 >4 byte >0x00 version %d >>5 byte x \b.%d + +# Type: LXT (interLaced eXtensible Trace) +# chrysn +0 beshort 0x0138 interLaced eXtensible Trace (LXT) file +>2 beshort >0 (Version %u) Modified: stable/9/contrib/file/magic/Magdir/sgi ============================================================================== --- stable/9/contrib/file/magic/Magdir/sgi Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/sgi Mon Apr 18 08:30:52 2016 (r298198) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: sgi,v 1.21 2014/04/30 21:41:02 christos Exp $ +# $File: sgi,v 1.22 2015/08/29 07:10:35 christos Exp $ # sgi: file(1) magic for Silicon Graphics operating systems and applications # # Executable images are handled either in aout (for old-style a.out @@ -55,8 +55,8 @@ 0 string WNGZWZSS Wingz spreadsheet 0 string WNGZWZHP Wingz help file # -0 string #Inventor V IRIS Inventor 1.0 file -0 string #Inventor V2 Open Inventor 2.0 file +0 string #Inventor\040V IRIS Inventor 1.0 file +0 string #Inventor\040V2 Open Inventor 2.0 file # GLF is OpenGL stream encoding 0 string glfHeadMagic(); GLF_TEXT 4 belong 0x7d000000 GLF_BINARY_LSB_FIRST Modified: stable/9/contrib/file/magic/Magdir/sgml ============================================================================== --- stable/9/contrib/file/magic/Magdir/sgml Mon Apr 18 08:24:13 2016 (r298197) +++ stable/9/contrib/file/magic/Magdir/sgml Mon Apr 18 08:30:52 2016 (r298198) @@ -1,5 +1,4 @@ -#------------------------------------------------------------------------------ -# $File: sgml,v 1.31 2015/03/11 19:38:04 christos Exp $ +#------------------------------------------------------------------------------ # $File: sgml,v 1.32 2015/07/11 15:08:53 christos Exp $ # Type: SVG Vectorial Graphics # From: Noel Torres 0 string \15 string >\0 ->>19 search/4096/cWbt \19 search/4096/cWbt \>15 string >\0 (version %.3s) !:mime text/html 0 string/t \15 string >\0 ->>19 search/4096/cWbt \19 search/4096/cWbt \>15 string >\0 (version %.3s) !:mime text/html 0 string/t \15 string >\0 ->>19 search/4096/cWbt \19 search/4096/cWbt \>15 string >\0 (version %.3s) !:mime text/html #------------------------------------------------------------------------------ @@ -106,9 +105,6 @@ >15 string/t >\0 %.3s document text *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Mon Apr 18 18:17:21 2016 Return-Path: Delivered-To: svn-src-stable@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 BDBE3B13F19; Mon, 18 Apr 2016 18:17:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yw0-x242.google.com (mail-yw0-x242.google.com [IPv6:2607:f8b0:4002:c05::242]) (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 696591C1B; Mon, 18 Apr 2016 18:17:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by mail-yw0-x242.google.com with SMTP id v81so5708739ywa.2; Mon, 18 Apr 2016 11:17:21 -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; bh=50ahMJ0DP1+C6iPRyJf/WNTOMjRbr6O9grVMFjG80NM=; b=K0ulb5XhFlxun6a3coEgnVeYufcLERydtZVPhSTNK236RhWZAJf2jg+NbO+kHjhVjc VAphcdbuU0ObwXppLb/VpeZJqg6e67PLnqTg3wga5X6w6bA4BAAjKPYnhk1paHUny8yS LlW8GyaLqB58iJ4AlJj3NwcxyHjJbERgkX8eA5qknqBlmMJVVmdZ+ZYcaEBtyaIR7gGI RhMeqZRJbPfafmWWKzRjUgfW1sitkPMlmuFz4EGJKqBO85KiOmZcScyHQWGR3WykhVvL 54Kv1bnfVCBlZu4Ycjz3RT0meUbwJaVhY+Hl9T3b/+TovMmTMEqjHEnPT6VunM+tsjT4 lyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=50ahMJ0DP1+C6iPRyJf/WNTOMjRbr6O9grVMFjG80NM=; b=DkNiy7zWg3baI5mOXh5ZjqdNW2nArskVWd0p8uLaK3REGtUj1qjRAd4+AXZ525THhL +ZYriEAz/ShyWhQoFVVQ0pkjF0JllF1TdezRtH94OFJTT6ETwhR6X0aIFyx1e57FuMeu hA7zxisWMEc/7tlH5dQTEucZoyuK1p0W1yYXmbKWPJm5dFEE/KXIl1NCgFcOTbkhDEXU crz4mfhgDhUgfd1Allrlgmob7QxNjHfFv4n7Yj2D92yww/Usq5OhIybomDxcTC4BDtmg H2AW8JNf/eeLU6EiPr2P904YTRzrXb2CmcTkOrXMiaCA6ZWEyNjIwxfmoP4ZOSJnmigj uYKg== X-Gm-Message-State: AOPr4FWL1+lmVpZzEXuCP27fATZOZS1quxsBNBoo5BazUWGN3lWOGm2jXtpYwao0MBov11INvkDMx//BzxjY/g== MIME-Version: 1.0 X-Received: by 10.129.136.67 with SMTP id y64mr7480884ywf.39.1461003440463; Mon, 18 Apr 2016 11:17:20 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.129.51.67 with HTTP; Mon, 18 Apr 2016 11:17:20 -0700 (PDT) In-Reply-To: <201604160211.u3G2B4Mv078856@repo.freebsd.org> References: <201604160211.u3G2B4Mv078856@repo.freebsd.org> Date: Mon, 18 Apr 2016 20:17:20 +0200 X-Google-Sender-Auth: 29DEuEyLYvr8BzC9_cbCZHB6RJE Message-ID: Subject: Re: svn commit: r298091 - in stable/10: sbin/pfctl share/man/man4 sys/conf sys/contrib/altq/altq sys/netpfil/pf From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: Luiz Otavio O Souza Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2016 18:17:21 -0000 Careful with things you should credit to me :) Your boss likes to play games do not get in the middle as well. On Sat, Apr 16, 2016 at 4:11 AM, Luiz Otavio O Souza wrote: > Author: loos > Date: Sat Apr 16 02:11:04 2016 > New Revision: 298091 > URL: https://svnweb.freebsd.org/changeset/base/298091 > > Log: > MFC r284777, r284814, r284863 and r298088: > > ALTQ FAIRQ discipline import from DragonFLY. > > Differential Revision: https://reviews.freebsd.org/D2847 > Obtained from: pfSense > Sponsored by: Rubicon Communications (Netgate) > > Added: > stable/10/sys/contrib/altq/altq/altq_fairq.c (contents, props changed) > stable/10/sys/contrib/altq/altq/altq_fairq.h (contents, props changed) > Modified: > stable/10/sbin/pfctl/parse.y > stable/10/sbin/pfctl/pfctl_altq.c > stable/10/sbin/pfctl/pfctl_parser.h > stable/10/sbin/pfctl/pfctl_qstats.c > stable/10/share/man/man4/altq.4 > stable/10/sys/conf/NOTES > stable/10/sys/conf/files > stable/10/sys/conf/options > stable/10/sys/contrib/altq/altq/altq.h > stable/10/sys/contrib/altq/altq/altq_subr.c > stable/10/sys/contrib/altq/altq/altq_var.h > stable/10/sys/netpfil/pf/pf.c > stable/10/sys/netpfil/pf/pf_altq.h > stable/10/sys/netpfil/pf/pf_mtag.h > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/sbin/pfctl/parse.y > > ============================================================================== > --- stable/10/sbin/pfctl/parse.y Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/sbin/pfctl/parse.y Sat Apr 16 02:11:04 2016 > (r298091) > @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include > #include > @@ -300,6 +301,7 @@ struct pool_opts { > > > struct node_hfsc_opts hfsc_opts; > +struct node_fairq_opts fairq_opts; > struct node_state_opt *keep_state_defaults = NULL; > > int disallow_table(struct node_host *, const char *); > @@ -422,6 +424,7 @@ typedef struct { > struct table_opts table_opts; > struct pool_opts pool_opts; > struct node_hfsc_opts hfsc_opts; > + struct node_fairq_opts fairq_opts; > } v; > int lineno; > } YYSTYPE; > @@ -446,8 +449,8 @@ int parseport(char *, struct range *r, i > %token REQUIREORDER SYNPROXY FINGERPRINTS NOSYNC DEBUG SKIP HOSTID > %token ANTISPOOF FOR INCLUDE > %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY > -%token ALTQ CBQ PRIQ HFSC BANDWIDTH TBRSIZE LINKSHARE REALTIME UPPERLIMIT > -%token QUEUE PRIORITY QLIMIT RTABLE > +%token ALTQ CBQ PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME > UPPERLIMIT > +%token QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE > %token LOAD RULESET_OPTIMIZATION > %token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE > %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY > @@ -495,6 +498,7 @@ int parseport(char *, struct range *r, i > %type cbqflags_list cbqflags_item > %type priqflags_list priqflags_item > %type hfscopts_list hfscopts_item hfsc_opts > +%type fairqopts_list fairqopts_item fairq_opts > %type bandwidth > %type filter_opts filter_opt filter_opts_l > %type antispoof_opts antispoof_opt > antispoof_opts_l > @@ -1659,6 +1663,15 @@ scheduler : CBQ { > $$.qtype = ALTQT_HFSC; > $$.data.hfsc_opts = $3; > } > + | FAIRQ { > + $$.qtype = ALTQT_FAIRQ; > + bzero(&$$.data.fairq_opts, > + sizeof(struct node_fairq_opts)); > + } > + | FAIRQ '(' fairq_opts ')' { > + $$.qtype = ALTQT_FAIRQ; > + $$.data.fairq_opts = $3; > + } > ; > > cbqflags_list : cbqflags_item { $$ |= $1; } > @@ -1807,6 +1820,61 @@ hfscopts_item : LINKSHARE bandwidth > { > } > ; > > +fairq_opts : { > + bzero(&fairq_opts, > + sizeof(struct node_fairq_opts)); > + } > + fairqopts_list { > + $$ = fairq_opts; > + } > + ; > + > +fairqopts_list : fairqopts_item > + | fairqopts_list comma fairqopts_item > + ; > + > +fairqopts_item : LINKSHARE bandwidth { > + if (fairq_opts.linkshare.used) { > + yyerror("linkshare already specified"); > + YYERROR; > + } > + fairq_opts.linkshare.m2 = $2; > + fairq_opts.linkshare.used = 1; > + } > + | LINKSHARE '(' bandwidth number bandwidth ')' { > + if (fairq_opts.linkshare.used) { > + yyerror("linkshare already specified"); > + YYERROR; > + } > + fairq_opts.linkshare.m1 = $3; > + fairq_opts.linkshare.d = $4; > + fairq_opts.linkshare.m2 = $5; > + fairq_opts.linkshare.used = 1; > + } > + | HOGS bandwidth { > + fairq_opts.hogs_bw = $2; > + } > + | BUCKETS number { > + fairq_opts.nbuckets = $2; > + } > + | STRING { > + if (!strcmp($1, "default")) > + fairq_opts.flags |= FARF_DEFAULTCLASS; > + else if (!strcmp($1, "red")) > + fairq_opts.flags |= FARF_RED; > + else if (!strcmp($1, "ecn")) > + fairq_opts.flags |= FARF_RED|FARF_ECN; > + else if (!strcmp($1, "rio")) > + fairq_opts.flags |= FARF_RIO; > + else { > + yyerror("unknown fairq flag \"%s\"", $1); > + free($1); > + YYERROR; > + } > + free($1); > + } > + ; > + > qassign : /* empty */ { $$ = NULL; } > | qassign_item { $$ = $1; } > | '{' optnl qassign_list '}' { $$ = $3; } > @@ -5226,6 +5294,7 @@ lookup(char *s) > { "bitmask", BITMASK}, > { "block", BLOCK}, > { "block-policy", BLOCKPOLICY}, > + { "buckets", BUCKETS}, > { "cbq", CBQ}, > { "code", CODE}, > { "crop", FRAGCROP}, > @@ -5235,6 +5304,7 @@ lookup(char *s) > { "drop", DROP}, > { "drop-ovl", FRAGDROP}, > { "dup-to", DUPTO}, > + { "fairq", FAIRQ}, > { "fastroute", FASTROUTE}, > { "file", FILENAME}, > { "fingerprints", FINGERPRINTS}, > @@ -5247,6 +5317,7 @@ lookup(char *s) > { "global", GLOBAL}, > { "group", GROUP}, > { "hfsc", HFSC}, > + { "hogs", HOGS}, > { "hostid", HOSTID}, > { "icmp-type", ICMPTYPE}, > { "icmp6-type", ICMP6TYPE}, > > Modified: stable/10/sbin/pfctl/pfctl_altq.c > > ============================================================================== > --- stable/10/sbin/pfctl/pfctl_altq.c Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/sbin/pfctl/pfctl_altq.c Sat Apr 16 02:11:04 2016 > (r298091) > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include "pfctl_parser.h" > #include "pfctl.h" > @@ -68,6 +69,11 @@ static int check_commit_hfsc(int, int, s > static int print_hfsc_opts(const struct pf_altq *, > const struct node_queue_opt *); > > +static int eval_pfqueue_fairq(struct pfctl *, struct pf_altq *); > +static int print_fairq_opts(const struct pf_altq *, > + const struct node_queue_opt *); > +static int check_commit_fairq(int, int, struct pf_altq *); > + > static void gsc_add_sc(struct gen_sc *, struct service_curve > *); > static int is_gsc_under_sc(struct gen_sc *, > struct service_curve *); > @@ -88,6 +94,8 @@ int eval_queue_opts(struct pf_altq *, > u_int32_t eval_bwspec(struct node_queue_bw *, u_int32_t); > void print_hfsc_sc(const char *, u_int, u_int, u_int, > const struct node_hfsc_sc *); > +void print_fairq_sc(const char *, u_int, u_int, u_int, > + const struct node_fairq_sc *); > > void > pfaltq_store(struct pf_altq *a) > @@ -173,6 +181,10 @@ print_altq(const struct pf_altq *a, unsi > if (!print_hfsc_opts(a, qopts)) > printf("hfsc "); > break; > + case ALTQT_FAIRQ: > + if (!print_fairq_opts(a, qopts)) > + printf("fairq "); > + break; > } > > if (bw != NULL && bw->bw_percent > 0) { > @@ -203,7 +215,8 @@ print_queue(const struct pf_altq *a, uns > printf("%s ", a->qname); > if (print_interface) > printf("on %s ", a->ifname); > - if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC) { > + if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC || > + a->scheduler == ALTQT_FAIRQ) { > if (bw != NULL && bw->bw_percent > 0) { > if (bw->bw_percent < 100) > printf("bandwidth %u%% ", bw->bw_percent); > @@ -224,6 +237,9 @@ print_queue(const struct pf_altq *a, uns > case ALTQT_HFSC: > print_hfsc_opts(a, qopts); > break; > + case ALTQT_FAIRQ: > + print_fairq_opts(a, qopts); > + break; > } > } > > @@ -294,6 +310,9 @@ check_commit_altq(int dev, int opts) > case ALTQT_HFSC: > error = check_commit_hfsc(dev, opts, altq); > break; > + case ALTQT_FAIRQ: > + error = check_commit_fairq(dev, opts, > altq); > + break; > default: > break; > } > @@ -342,7 +361,8 @@ eval_pfqueue(struct pfctl *pf, struct pf > if (pa->qlimit == 0) > pa->qlimit = DEFAULT_QLIMIT; > > - if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC) { > + if (pa->scheduler == ALTQT_CBQ || pa->scheduler == ALTQT_HFSC || > + pa->scheduler == ALTQT_FAIRQ) { > pa->bandwidth = eval_bwspec(bw, > parent == NULL ? 0 : parent->bandwidth); > > @@ -388,6 +408,9 @@ eval_pfqueue(struct pfctl *pf, struct pf > case ALTQT_HFSC: > error = eval_pfqueue_hfsc(pf, pa); > break; > + case ALTQT_FAIRQ: > + error = eval_pfqueue_fairq(pf, pa); > + break; > default: > break; > } > @@ -807,6 +830,85 @@ err_ret: > return (-1); > } > > +/* > + * FAIRQ support functions > + */ > +static int > +eval_pfqueue_fairq(struct pfctl *pf __unused, struct pf_altq *pa) > +{ > + struct pf_altq *altq, *parent; > + struct fairq_opts *opts; > + struct service_curve sc; > + > + opts = &pa->pq_u.fairq_opts; > + > + if (pa->parent[0] == 0) { > + /* root queue */ > + opts->lssc_m1 = pa->ifbandwidth; > + opts->lssc_m2 = pa->ifbandwidth; > + opts->lssc_d = 0; > + return (0); > + } > + > + LIST_INIT(&lssc); > + > + /* if link_share is not specified, use bandwidth */ > + if (opts->lssc_m2 == 0) > + opts->lssc_m2 = pa->bandwidth; > + > + /* > + * admission control: > + * for the real-time service curve, the sum of the service curves > + * should not exceed 80% of the interface bandwidth. 20% is > reserved > + * not to over-commit the actual interface bandwidth. > + * for the link-sharing service curve, the sum of the child service > + * curve should not exceed the parent service curve. > + * for the upper-limit service curve, the assigned bandwidth should > + * be smaller than the interface bandwidth, and the upper-limit > should > + * be larger than the real-time service curve when both are > defined. > + */ > + parent = qname_to_pfaltq(pa->parent, pa->ifname); > + if (parent == NULL) > + errx(1, "parent %s not found for %s", pa->parent, > pa->qname); > + > + TAILQ_FOREACH(altq, &altqs, entries) { > + if (strncmp(altq->ifname, pa->ifname, IFNAMSIZ) != 0) > + continue; > + if (altq->qname[0] == 0) /* this is for interface */ > + continue; > + > + if (strncmp(altq->parent, pa->parent, PF_QNAME_SIZE) != 0) > + continue; > + > + /* if the class has a link-sharing service curve, add it. > */ > + if (opts->lssc_m2 != 0 && altq->pq_u.fairq_opts.lssc_m2 != > 0) { > + sc.m1 = altq->pq_u.fairq_opts.lssc_m1; > + sc.d = altq->pq_u.fairq_opts.lssc_d; > + sc.m2 = altq->pq_u.fairq_opts.lssc_m2; > + gsc_add_sc(&lssc, &sc); > + } > + } > + > + /* check the link-sharing service curve. */ > + if (opts->lssc_m2 != 0) { > + sc.m1 = parent->pq_u.fairq_opts.lssc_m1; > + sc.d = parent->pq_u.fairq_opts.lssc_d; > + sc.m2 = parent->pq_u.fairq_opts.lssc_m2; > + if (!is_gsc_under_sc(&lssc, &sc)) { > + warnx("link-sharing sc exceeds parent's sc"); > + goto err_ret; > + } > + } > + > + gsc_destroy(&lssc); > + > + return (0); > + > +err_ret: > + gsc_destroy(&lssc); > + return (-1); > +} > + > static int > check_commit_hfsc(int dev, int opts, struct pf_altq *pa) > { > @@ -847,6 +949,43 @@ check_commit_hfsc(int dev, int opts, str > } > > static int > +check_commit_fairq(int dev __unused, int opts __unused, struct pf_altq > *pa) > +{ > + struct pf_altq *altq, *def = NULL; > + int default_class; > + int error = 0; > + > + /* check if fairq has one default queue for this interface */ > + default_class = 0; > + TAILQ_FOREACH(altq, &altqs, entries) { > + if (strncmp(altq->ifname, pa->ifname, IFNAMSIZ) != 0) > + continue; > + if (altq->qname[0] == 0) /* this is for interface */ > + continue; > + if (altq->pq_u.fairq_opts.flags & FARF_DEFAULTCLASS) { > + default_class++; > + def = altq; > + } > + } > + if (default_class != 1) { > + warnx("should have one default queue on %s", pa->ifname); > + return (1); > + } > + /* make sure the default queue is a leaf */ > + TAILQ_FOREACH(altq, &altqs, entries) { > + if (strncmp(altq->ifname, pa->ifname, IFNAMSIZ) != 0) > + continue; > + if (altq->qname[0] == 0) /* this is for interface */ > + continue; > + if (strncmp(altq->parent, def->qname, PF_QNAME_SIZE) == 0) > { > + warnx("default queue is not a leaf"); > + error++; > + } > + } > + return (error); > +} > + > +static int > print_hfsc_opts(const struct pf_altq *a, const struct node_queue_opt > *qopts) > { > const struct hfsc_opts *opts; > @@ -892,6 +1031,43 @@ print_hfsc_opts(const struct pf_altq *a, > return (0); > } > > +static int > +print_fairq_opts(const struct pf_altq *a, const struct node_queue_opt > *qopts) > +{ > + const struct fairq_opts *opts; > + const struct node_fairq_sc *loc_lssc; > + > + opts = &a->pq_u.fairq_opts; > + if (qopts == NULL) > + loc_lssc = NULL; > + else > + loc_lssc = &qopts->data.fairq_opts.linkshare; > + > + if (opts->flags || > + (opts->lssc_m2 != 0 && (opts->lssc_m2 != a->bandwidth || > + opts->lssc_d != 0))) { > + printf("fairq("); > + if (opts->flags & FARF_RED) > + printf(" red"); > + if (opts->flags & FARF_ECN) > + printf(" ecn"); > + if (opts->flags & FARF_RIO) > + printf(" rio"); > + if (opts->flags & FARF_CLEARDSCP) > + printf(" cleardscp"); > + if (opts->flags & FARF_DEFAULTCLASS) > + printf(" default"); > + if (opts->lssc_m2 != 0 && (opts->lssc_m2 != a->bandwidth || > + opts->lssc_d != 0)) > + print_fairq_sc("linkshare", opts->lssc_m1, > opts->lssc_d, > + opts->lssc_m2, loc_lssc); > + printf(" ) "); > + > + return (1); > + } else > + return (0); > +} > + > /* > * admission control using generalized service curve > */ > @@ -1211,6 +1387,23 @@ eval_queue_opts(struct pf_altq *pa, stru > opts->data.hfsc_opts.upperlimit.d; > } > break; > + case ALTQT_FAIRQ: > + pa->pq_u.fairq_opts.flags = opts->data.fairq_opts.flags; > + pa->pq_u.fairq_opts.nbuckets = > opts->data.fairq_opts.nbuckets; > + pa->pq_u.fairq_opts.hogs_m1 = > + eval_bwspec(&opts->data.fairq_opts.hogs_bw, > ref_bw); > + > + if (opts->data.fairq_opts.linkshare.used) { > + pa->pq_u.fairq_opts.lssc_m1 = > + > eval_bwspec(&opts->data.fairq_opts.linkshare.m1, > + ref_bw); > + pa->pq_u.fairq_opts.lssc_m2 = > + > eval_bwspec(&opts->data.fairq_opts.linkshare.m2, > + ref_bw); > + pa->pq_u.fairq_opts.lssc_d = > + opts->data.fairq_opts.linkshare.d; > + } > + break; > default: > warnx("eval_queue_opts: unknown scheduler type %u", > opts->qtype); > @@ -1256,3 +1449,27 @@ print_hfsc_sc(const char *scname, u_int > if (d != 0) > printf(")"); > } > + > +void > +print_fairq_sc(const char *scname, u_int m1, u_int d, u_int m2, > + const struct node_fairq_sc *sc) > +{ > + printf(" %s", scname); > + > + if (d != 0) { > + printf("("); > + if (sc != NULL && sc->m1.bw_percent > 0) > + printf("%u%%", sc->m1.bw_percent); > + else > + printf("%s", rate2str((double)m1)); > + printf(" %u", d); > + } > + > + if (sc != NULL && sc->m2.bw_percent > 0) > + printf(" %u%%", sc->m2.bw_percent); > + else > + printf(" %s", rate2str((double)m2)); > + > + if (d != 0) > + printf(")"); > +} > > Modified: stable/10/sbin/pfctl/pfctl_parser.h > > ============================================================================== > --- stable/10/sbin/pfctl/pfctl_parser.h Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/sbin/pfctl/pfctl_parser.h Sat Apr 16 02:11:04 2016 > (r298091) > @@ -150,12 +150,27 @@ struct node_hfsc_opts { > int flags; > }; > > +struct node_fairq_sc { > + struct node_queue_bw m1; /* slope of 1st segment; bps */ > + u_int d; /* x-projection of m1; msec */ > + struct node_queue_bw m2; /* slope of 2nd segment; bps */ > + u_int8_t used; > +}; > + > +struct node_fairq_opts { > + struct node_fairq_sc linkshare; > + struct node_queue_bw hogs_bw; > + u_int nbuckets; > + int flags; > +}; > + > struct node_queue_opt { > int qtype; > union { > struct cbq_opts cbq_opts; > struct priq_opts priq_opts; > struct node_hfsc_opts hfsc_opts; > + struct node_fairq_opts fairq_opts; > } data; > }; > > > Modified: stable/10/sbin/pfctl/pfctl_qstats.c > > ============================================================================== > --- stable/10/sbin/pfctl/pfctl_qstats.c Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/sbin/pfctl/pfctl_qstats.c Sat Apr 16 02:11:04 2016 > (r298091) > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > > #include "pfctl.h" > #include "pfctl_parser.h" > @@ -46,6 +47,7 @@ union class_stats { > class_stats_t cbq_stats; > struct priq_classstats priq_stats; > struct hfsc_classstats hfsc_stats; > + struct fairq_classstats fairq_stats; > }; > > #define AVGN_MAX 8 > @@ -77,6 +79,7 @@ void pfctl_print_altq_node(int, const > void print_cbqstats(struct queue_stats); > void print_priqstats(struct queue_stats); > void print_hfscstats(struct queue_stats); > +void print_fairqstats(struct queue_stats); > void pfctl_free_altq_node(struct pf_altq_node *); > void pfctl_print_altq_nodestat(int, > const struct pf_altq_node *); > @@ -317,6 +320,9 @@ pfctl_print_altq_nodestat(int dev, const > case ALTQT_HFSC: > print_hfscstats(a->qstats); > break; > + case ALTQT_FAIRQ: > + print_fairqstats(a->qstats); > + break; > } > } > > @@ -382,6 +388,26 @@ print_hfscstats(struct queue_stats cur) > } > > void > +print_fairqstats(struct queue_stats cur) > +{ > + printf(" [ pkts: %10llu bytes: %10llu " > + "dropped pkts: %6llu bytes: %6llu ]\n", > + (unsigned long long)cur.data.fairq_stats.xmit_cnt.packets, > + (unsigned long long)cur.data.fairq_stats.xmit_cnt.bytes, > + (unsigned long long)cur.data.fairq_stats.drop_cnt.packets, > + (unsigned long long)cur.data.fairq_stats.drop_cnt.bytes); > + printf(" [ qlength: %3d/%3d ]\n", > + cur.data.fairq_stats.qlength, cur.data.fairq_stats.qlimit); > + > + if (cur.avgn < 2) > + return; > + > + printf(" [ measured: %7.1f packets/s, %s/s ]\n", > + cur.avg_packets / STAT_INTERVAL, > + rate2str((8 * cur.avg_bytes) / STAT_INTERVAL)); > +} > + > +void > pfctl_free_altq_node(struct pf_altq_node *node) > { > while (node != NULL) { > @@ -421,6 +447,10 @@ update_avg(struct pf_altq_node *a) > b = qs->data.hfsc_stats.xmit_cnt.bytes; > p = qs->data.hfsc_stats.xmit_cnt.packets; > break; > + case ALTQT_FAIRQ: > + b = qs->data.fairq_stats.xmit_cnt.bytes; > + p = qs->data.fairq_stats.xmit_cnt.packets; > + break; > default: > b = 0; > p = 0; > > Modified: stable/10/share/man/man4/altq.4 > > ============================================================================== > --- stable/10/share/man/man4/altq.4 Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/share/man/man4/altq.4 Sat Apr 16 02:11:04 2016 > (r298091) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd December 9, 2011 > +.Dd June 24, 2015 > .Dt ALTQ 4 > .Os > .Sh NAME > @@ -40,6 +40,7 @@ > .Cd options ALTQ_HFSC > .Cd options ALTQ_CDNR > .Cd options ALTQ_PRIQ > +.Cd options ALTQ_FAIRQ > .Sh DESCRIPTION > The > .Nm > @@ -93,6 +94,10 @@ any of the available disciplines or cons > Build the > .Dq "Priority Queuing" > discipline. > +.It Dv ALTQ_FAIRQ > +Build the > +.Dq "Fair Queuing" > +discipline. > .It Dv ALTQ_NOPCC > Required if the TSC is unusable. > .It Dv ALTQ_DEBUG > > Modified: stable/10/sys/conf/NOTES > > ============================================================================== > --- stable/10/sys/conf/NOTES Sat Apr 16 00:01:16 2016 (r298090) > +++ stable/10/sys/conf/NOTES Sat Apr 16 02:11:04 2016 (r298091) > @@ -700,6 +700,7 @@ options ALTQ_CBQ # Class Based Queueing > options ALTQ_RED # Random Early Detection > options ALTQ_RIO # RED In/Out > options ALTQ_HFSC # Hierarchical Packet Scheduler > +options ALTQ_FAIRQ # Fair Packet Scheduler > options ALTQ_CDNR # Traffic conditioner > options ALTQ_PRIQ # Priority Queueing > options ALTQ_NOPCC # Required if the TSC is unusable > > Modified: stable/10/sys/conf/files > > ============================================================================== > --- stable/10/sys/conf/files Sat Apr 16 00:01:16 2016 (r298090) > +++ stable/10/sys/conf/files Sat Apr 16 02:11:04 2016 (r298091) > @@ -252,6 +252,7 @@ compat/freebsd32/freebsd32_syscalls.c op > compat/freebsd32/freebsd32_sysent.c optional compat_freebsd32 > contrib/altq/altq/altq_cbq.c optional altq > contrib/altq/altq/altq_cdnr.c optional altq > +contrib/altq/altq/altq_fairq.c optional altq > contrib/altq/altq/altq_hfsc.c optional altq > contrib/altq/altq/altq_priq.c optional altq > contrib/altq/altq/altq_red.c optional altq > > Modified: stable/10/sys/conf/options > > ============================================================================== > --- stable/10/sys/conf/options Sat Apr 16 00:01:16 2016 (r298090) > +++ stable/10/sys/conf/options Sat Apr 16 02:11:04 2016 (r298091) > @@ -385,6 +385,7 @@ ALTQ opt_global.h > ALTQ_CBQ opt_altq.h > ALTQ_CDNR opt_altq.h > ALTQ_DEBUG opt_altq.h > +ALTQ_FAIRQ opt_altq.h > ALTQ_HFSC opt_altq.h > ALTQ_NOPCC opt_altq.h > ALTQ_PRIQ opt_altq.h > > Modified: stable/10/sys/contrib/altq/altq/altq.h > > ============================================================================== > --- stable/10/sys/contrib/altq/altq/altq.h Sat Apr 16 00:01:16 2016 > (r298090) > +++ stable/10/sys/contrib/altq/altq/altq.h Sat Apr 16 02:11:04 2016 > (r298091) > @@ -63,7 +63,8 @@ > #define ALTQT_BLUE 10 /* blue */ > #define ALTQT_PRIQ 11 /* priority queue */ > #define ALTQT_JOBS 12 /* JoBS */ > -#define ALTQT_MAX 13 /* should be max > discipline type + 1 */ > +#define ALTQT_FAIRQ 13 /* fairq */ > +#define ALTQT_MAX 14 /* should be max > discipline type + 1 */ > > #ifdef ALTQ3_COMPAT > struct altqreq { > > Added: stable/10/sys/contrib/altq/altq/altq_fairq.c > > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/10/sys/contrib/altq/altq/altq_fairq.c Sat Apr 16 > 02:11:04 2016 (r298091) > @@ -0,0 +1,874 @@ > +/* > + * Copyright (c) 2008 The DragonFly Project. All rights reserved. > + * > + * This code is derived from software contributed to The DragonFly Project > + * by Matthew Dillon > + * > + * 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. > + * 3. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS 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 > + * COPYRIGHT HOLDERS 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. > + * > + * $DragonFly: src/sys/net/altq/altq_fairq.c,v 1.1 2008/04/06 18:58:15 > dillon Exp $ > + * $FreeBSD$ > + */ > +/* > + * Matt: I gutted altq_priq.c and used it as a skeleton on which to build > + * fairq. The fairq algorithm is completely different then priq, of > course, > + * but because I used priq's skeleton I believe I should include priq's > + * copyright. > + * > + * Copyright (C) 2000-2003 > + * Sony Computer Science Laboratories Inc. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above 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 SONY CSL 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 SONY CSL 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. > + */ > + > +/* > + * FAIRQ - take traffic classified by keep state (hashed into > + * mbuf->m_pkthdr.altq_state_hash) and bucketize it. Fairly extract > + * the first packet from each bucket in a round-robin fashion. > + * > + * TODO - better overall qlimit support (right now it is per-bucket). > + * - NOTE: red etc is per bucket, not overall. > + * - better service curve support. > + * > + * EXAMPLE: > + * > + * altq on em0 fairq bandwidth 650Kb queue { std, bulk } > + * queue std priority 3 bandwidth 400Kb \ > + * fairq (buckets 64, default, hogs 1Kb) qlimit 50 > + * queue bulk priority 2 bandwidth 100Kb \ > + * fairq (buckets 64, hogs 1Kb) qlimit 50 > + * > + * pass out on em0 from any to any keep state queue std > + * pass out on em0 inet proto tcp ..... port ... keep state queue bulk > + */ > +#include "opt_altq.h" > +#include "opt_inet.h" > +#include "opt_inet6.h" > + > +#ifdef ALTQ_FAIRQ /* fairq is enabled in the kernel conf */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > + > +/* > + * function prototypes > + */ > +static int fairq_clear_interface(struct fairq_if *); > +static int fairq_request(struct ifaltq *, int, void *); > +static void fairq_purge(struct fairq_if *); > +static struct fairq_class *fairq_class_create(struct fairq_if *, int, > int, u_int, struct fairq_opts *, int); > +static int fairq_class_destroy(struct fairq_class *); > +static int fairq_enqueue(struct ifaltq *, struct mbuf *, struct > altq_pktattr *); > +static struct mbuf *fairq_dequeue(struct ifaltq *, int); > + > +static int fairq_addq(struct fairq_class *, struct mbuf *, u_int32_t); > +static struct mbuf *fairq_getq(struct fairq_class *, uint64_t); > +static struct mbuf *fairq_pollq(struct fairq_class *, uint64_t, int *); > +static fairq_bucket_t *fairq_selectq(struct fairq_class *, int); > +static void fairq_purgeq(struct fairq_class *); > + > +static void get_class_stats(struct fairq_classstats *, struct > fairq_class *); > +static struct fairq_class *clh_to_clp(struct fairq_if *, uint32_t); > + > +int > +fairq_pfattach(struct pf_altq *a) > +{ > + struct ifnet *ifp; > + int error; > + > + if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL) > + return (EINVAL); > + > + error = altq_attach(&ifp->if_snd, ALTQT_FAIRQ, a->altq_disc, > + fairq_enqueue, fairq_dequeue, fairq_request, NULL, NULL); > + > + return (error); > +} > + > +int > +fairq_add_altq(struct pf_altq *a) > +{ > + struct fairq_if *pif; > + struct ifnet *ifp; > + > + if ((ifp = ifunit(a->ifname)) == NULL) > + return (EINVAL); > + if (!ALTQ_IS_READY(&ifp->if_snd)) > + return (ENODEV); > + > + > + pif = malloc(sizeof(struct fairq_if), > + M_DEVBUF, M_WAITOK | M_ZERO); > + pif->pif_bandwidth = a->ifbandwidth; > + pif->pif_maxpri = -1; > + pif->pif_ifq = &ifp->if_snd; > + > + /* keep the state in pf_altq */ > + a->altq_disc = pif; > + > + return (0); > +} > + > +int > +fairq_remove_altq(struct pf_altq *a) > +{ > + struct fairq_if *pif; > + > + if ((pif = a->altq_disc) == NULL) > + return (EINVAL); > + a->altq_disc = NULL; > + > + fairq_clear_interface(pif); > + > + free(pif, M_DEVBUF); > + return (0); > +} > + > +int > +fairq_add_queue(struct pf_altq *a) > +{ > + struct fairq_if *pif; > + struct fairq_class *cl; > + > + if ((pif = a->altq_disc) == NULL) > + return (EINVAL); > + > + /* check parameters */ > + if (a->priority >= FAIRQ_MAXPRI) > + return (EINVAL); > + if (a->qid == 0) > + return (EINVAL); > + if (pif->pif_classes[a->priority] != NULL) > + return (EBUSY); > + if (clh_to_clp(pif, a->qid) != NULL) > + return (EBUSY); > + > + cl = fairq_class_create(pif, a->priority, a->qlimit, a->bandwidth, > + &a->pq_u.fairq_opts, a->qid); > + if (cl == NULL) > + return (ENOMEM); > + > + return (0); > +} > + > +int > +fairq_remove_queue(struct pf_altq *a) > +{ > + struct fairq_if *pif; > + struct fairq_class *cl; > + > + if ((pif = a->altq_disc) == NULL) > + return (EINVAL); > + > + if ((cl = clh_to_clp(pif, a->qid)) == NULL) > + return (EINVAL); > + > + return (fairq_class_destroy(cl)); > +} > + > +int > +fairq_getqstats(struct pf_altq *a, void *ubuf, int *nbytes) > +{ > + struct fairq_if *pif; > + struct fairq_class *cl; > + struct fairq_classstats stats; > + int error = 0; > + > + if ((pif = altq_lookup(a->ifname, ALTQT_FAIRQ)) == NULL) > + return (EBADF); > + > + if ((cl = clh_to_clp(pif, a->qid)) == NULL) > + return (EINVAL); > + > + if (*nbytes < sizeof(stats)) > + return (EINVAL); > + > + get_class_stats(&stats, cl); > + > + if ((error = copyout((caddr_t)&stats, ubuf, sizeof(stats))) != 0) > + return (error); > + *nbytes = sizeof(stats); > + return (0); > +} > + > +/* > + * bring the interface back to the initial state by discarding > + * all the filters and classes. > + */ > +static int > +fairq_clear_interface(struct fairq_if *pif) > +{ > + struct fairq_class *cl; > + int pri; > + > + /* clear out the classes */ > + for (pri = 0; pri <= pif->pif_maxpri; pri++) { > + if ((cl = pif->pif_classes[pri]) != NULL) > + fairq_class_destroy(cl); > + } > + > + return (0); > +} > + > +static int > +fairq_request(struct ifaltq *ifq, int req, void *arg) > +{ > + struct fairq_if *pif = (struct fairq_if *)ifq->altq_disc; > + > + IFQ_LOCK_ASSERT(ifq); > + > + switch (req) { > + case ALTRQ_PURGE: > + fairq_purge(pif); > + break; > + } > + return (0); > +} > + > +/* discard all the queued packets on the interface */ > +static void > +fairq_purge(struct fairq_if *pif) > +{ > + struct fairq_class *cl; > + int pri; > + > + for (pri = 0; pri <= pif->pif_maxpri; pri++) { > + if ((cl = pif->pif_classes[pri]) != NULL && cl->cl_head) > + fairq_purgeq(cl); > + } > + if (ALTQ_IS_ENABLED(pif->pif_ifq)) > + pif->pif_ifq->ifq_len = 0; > +} > + > +static struct fairq_class * > +fairq_class_create(struct fairq_if *pif, int pri, int qlimit, > + u_int bandwidth, struct fairq_opts *opts, int qid) > +{ > + struct fairq_class *cl; > + int flags = opts->flags; > + u_int nbuckets = opts->nbuckets; > + int i; > + > +#ifndef ALTQ_RED > + if (flags & FARF_RED) { > +#ifdef ALTQ_DEBUG > + printf("fairq_class_create: RED not configured for > FAIRQ!\n"); > +#endif > + return (NULL); > + } > +#endif > + if (nbuckets == 0) > + nbuckets = 256; > + if (nbuckets > FAIRQ_MAX_BUCKETS) > + nbuckets = FAIRQ_MAX_BUCKETS; > + /* enforce power-of-2 size */ > + while ((nbuckets ^ (nbuckets - 1)) != ((nbuckets << 1) - 1)) > + ++nbuckets; > + > + if ((cl = pif->pif_classes[pri]) != NULL) { > + /* modify the class instead of creating a new one */ > + IFQ_LOCK(cl->cl_pif->pif_ifq); > + if (cl->cl_head) > + fairq_purgeq(cl); > + IFQ_UNLOCK(cl->cl_pif->pif_ifq); > +#ifdef ALTQ_RIO > + if (cl->cl_qtype == Q_RIO) > + rio_destroy((rio_t *)cl->cl_red); > +#endif > +#ifdef ALTQ_RED > + if (cl->cl_qtype == Q_RED) > + red_destroy(cl->cl_red); > +#endif > + } else { > + cl = malloc(sizeof(struct fairq_class), > + M_DEVBUF, M_WAITOK | M_ZERO); > + cl->cl_nbuckets = nbuckets; > + cl->cl_nbucket_mask = nbuckets - 1; > + > + cl->cl_buckets = malloc( > + sizeof(struct fairq_bucket) * cl->cl_nbuckets, > + M_DEVBUF, M_WAITOK | M_ZERO); > + cl->cl_head = NULL; > + } > + > + pif->pif_classes[pri] = cl; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > -- > Ermal > From owner-svn-src-stable@freebsd.org Tue Apr 19 07:34:33 2016 Return-Path: Delivered-To: svn-src-stable@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 1440FB135E2; Tue, 19 Apr 2016 07:34:33 +0000 (UTC) (envelope-from thomas@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C7F1F1AB5; Tue, 19 Apr 2016 07:34:32 +0000 (UTC) (envelope-from thomas@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3J7YVMA001986; Tue, 19 Apr 2016 07:34:31 GMT (envelope-from thomas@FreeBSD.org) Received: (from thomas@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3J7YVJg001981; Tue, 19 Apr 2016 07:34:31 GMT (envelope-from thomas@FreeBSD.org) Message-Id: <201604190734.u3J7YVJg001981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: thomas set sender to thomas@FreeBSD.org using -f From: Thomas Quinot Date: Tue, 19 Apr 2016 07:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298258 - stable/10/bin/dd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 07:34:33 -0000 Author: thomas Date: Tue Apr 19 07:34:31 2016 New Revision: 298258 URL: https://svnweb.freebsd.org/changeset/base/298258 Log: MFC r295749: Reorganize the handling all-zeroes terminal block in sparse mode PR: 189284 (original PR whose fix introduced this bug) PR: 207092 Added: stable/10/bin/dd/ref.obs_zeroes - copied unchanged from r295749, head/bin/dd/ref.obs_zeroes Modified: stable/10/bin/dd/Makefile stable/10/bin/dd/dd.c stable/10/bin/dd/dd.h stable/10/bin/dd/gen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/dd/Makefile ============================================================================== --- stable/10/bin/dd/Makefile Tue Apr 19 07:28:39 2016 (r298257) +++ stable/10/bin/dd/Makefile Tue Apr 19 07:34:31 2016 (r298258) @@ -24,7 +24,18 @@ test: ${PROG} gen LC_ALL=en_US.US-ASCII hexdump -C | \ diff -I FreeBSD - ${.CURDIR}/ref.${conv} .endfor - @rm -f gen + @${ECHO} "testing sparse file (obs zeroes)" + @./gen 189284 | ./dd ibs=16 obs=8 conv=sparse of=obs_zeroes 2> /dev/null + @hexdump -C obs_zeroes | diff -I FreeBSD - ${.CURDIR}/ref.obs_zeroes + + @${ECHO} "testing spase file (all zeroes)" + @./dd if=/dev/zero of=1M_zeroes bs=1048576 count=1 2> /dev/null + @./dd if=1M_zeroes of=1M_zeroes.1 bs=1048576 conv=sparse 2> /dev/null + @./dd if=1M_zeroes of=1M_zeroes.2 bs=1048576 2> /dev/null + @diff 1M_zeroes 1M_zeroes.1 + @diff 1M_zeroes 1M_zeroes.2 + + @rm -f gen 1M_zeroes* obs_zeroes .if ${MK_TESTS} != "no" SUBDIR+= tests Modified: stable/10/bin/dd/dd.c ============================================================================== --- stable/10/bin/dd/dd.c Tue Apr 19 07:28:39 2016 (r298257) +++ stable/10/bin/dd/dd.c Tue Apr 19 07:34:31 2016 (r298258) @@ -77,7 +77,6 @@ STAT st; /* statistics */ void (*cfunc)(void); /* conversion function */ uintmax_t cpy_cnt; /* # of blocks to copy */ static off_t pending = 0; /* pending seek if sparse */ -static off_t last_sp = 0; /* size of last added sparse block */ u_int ddflags = 0; /* conversion options */ size_t cbsz; /* conversion block size */ uintmax_t files_cnt = 1; /* # of files to copy */ @@ -410,6 +409,15 @@ dd_close(void) } if (out.dbcnt || pending) dd_out(1); + + /* + * If the file ends with a hole, ftruncate it to extend its size + * up to the end of the hole (without having to write any data). + */ + if (out.seek_offset > 0 && (out.flags & ISTRUNC)) { + if (ftruncate(out.fd, out.seek_offset) == -1) + err(1, "truncating %s", out.name); + } } void @@ -458,29 +466,27 @@ dd_out(int force) } if (sparse && !force) { pending += cnt; - last_sp = cnt; nw = cnt; } else { if (pending != 0) { - /* If forced to write, and we have no - * data left, we need to write the last - * sparse block explicitly. + /* + * Seek past hole. Note that we need to record the + * reached offset, because we might have no more data + * to write, in which case we'll need to call + * ftruncate to extend the file size. */ - if (force && cnt == 0) { - pending -= last_sp; - assert(outp == out.db); - memset(outp, 0, cnt); - } - if (lseek(out.fd, pending, SEEK_CUR) == - -1) + out.seek_offset = lseek(out.fd, pending, SEEK_CUR); + if (out.seek_offset == -1) err(2, "%s: seek error creating sparse file", out.name); - pending = last_sp = 0; + pending = 0; } - if (cnt) + if (cnt) { nw = write(out.fd, outp, cnt); - else + out.seek_offset = 0; + } else { return; + } } if (nw <= 0) { Modified: stable/10/bin/dd/dd.h ============================================================================== --- stable/10/bin/dd/dd.h Tue Apr 19 07:28:39 2016 (r298257) +++ stable/10/bin/dd/dd.h Tue Apr 19 07:34:31 2016 (r298258) @@ -54,6 +54,7 @@ typedef struct { const char *name; /* name */ int fd; /* file descriptor */ off_t offset; /* # of blocks to skip */ + off_t seek_offset; /* offset of last seek past output hole */ } IO; typedef struct { Modified: stable/10/bin/dd/gen.c ============================================================================== --- stable/10/bin/dd/gen.c Tue Apr 19 07:28:39 2016 (r298257) +++ stable/10/bin/dd/gen.c Tue Apr 19 07:34:31 2016 (r298258) @@ -5,13 +5,20 @@ */ #include +#include int -main(int argc __unused, char **argv __unused) +main(int argc, char **argv) { int i; - for (i = 0; i < 256; i++) - putchar(i); + if (argc > 1 && !strcmp(argv[1], "189284")) { + fputs("ABCDEFGH", stdout); + for (i = 0; i < 8; i++) + putchar(0); + } else { + for (i = 0; i < 256; i++) + putchar(i); + } return (0); } Copied: stable/10/bin/dd/ref.obs_zeroes (from r295749, head/bin/dd/ref.obs_zeroes) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/dd/ref.obs_zeroes Tue Apr 19 07:34:31 2016 (r298258, copy of r295749, head/bin/dd/ref.obs_zeroes) @@ -0,0 +1,3 @@ +$FreeBSD$ +00000000 41 42 43 44 45 46 47 48 00 00 00 00 00 00 00 00 |ABCDEFGH........| +00000010 From owner-svn-src-stable@freebsd.org Tue Apr 19 12:14:16 2016 Return-Path: Delivered-To: svn-src-stable@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 83A8AB14126; Tue, 19 Apr 2016 12:14:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 4D2321065; Tue, 19 Apr 2016 12:14:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JCEFOu085811; Tue, 19 Apr 2016 12:14:15 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JCEF9k085810; Tue, 19 Apr 2016 12:14:15 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604191214.u3JCEF9k085810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Apr 2016 12:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298264 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 12:14:16 -0000 Author: avg Date: Tue Apr 19 12:14:15 2016 New Revision: 298264 URL: https://svnweb.freebsd.org/changeset/base/298264 Log: MFC r297520: zfs receive: -u can be ignored sometimes PR: 204705 Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 19 11:37:43 2016 (r298263) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 19 12:14:15 2016 (r298264) @@ -3479,7 +3479,8 @@ zfs_receive_one(libzfs_handle_t *hdl, in } if (clp) { - err |= changelist_postfix(clp); + if (!flags->nomount) + err |= changelist_postfix(clp); changelist_free(clp); } From owner-svn-src-stable@freebsd.org Tue Apr 19 12:14:54 2016 Return-Path: Delivered-To: svn-src-stable@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 27002B141C2; Tue, 19 Apr 2016 12:14:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E7C3511D0; Tue, 19 Apr 2016 12:14:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JCErER085886; Tue, 19 Apr 2016 12:14:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JCErnE085885; Tue, 19 Apr 2016 12:14:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604191214.u3JCErnE085885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Apr 2016 12:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298265 - stable/9/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 12:14:54 -0000 Author: avg Date: Tue Apr 19 12:14:52 2016 New Revision: 298265 URL: https://svnweb.freebsd.org/changeset/base/298265 Log: MFC r297520: zfs receive: -u can be ignored sometimes PR: 204705 Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/9/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 19 12:14:15 2016 (r298264) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 19 12:14:52 2016 (r298265) @@ -3105,7 +3105,8 @@ zfs_receive_one(libzfs_handle_t *hdl, in } if (clp) { - err |= changelist_postfix(clp); + if (!flags->nomount) + err |= changelist_postfix(clp); changelist_free(clp); } From owner-svn-src-stable@freebsd.org Tue Apr 19 12:20:30 2016 Return-Path: Delivered-To: svn-src-stable@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 1DBB7B14636; Tue, 19 Apr 2016 12:20:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DEF9917A0; Tue, 19 Apr 2016 12:20:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JCKT5F086218; Tue, 19 Apr 2016 12:20:29 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JCKTjZ086217; Tue, 19 Apr 2016 12:20:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604191220.u3JCKTjZ086217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Apr 2016 12:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298266 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 12:20:30 -0000 Author: avg Date: Tue Apr 19 12:20:28 2016 New Revision: 298266 URL: https://svnweb.freebsd.org/changeset/base/298266 Log: MFC r297521: fix zfs set canmount=off on an unmounted filesystem No MFC to stable/9 because of a non-trivial merge conflict and no way to test the edited code. Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Apr 19 12:14:52 2016 (r298265) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Tue Apr 19 12:20:28 2016 (r298266) @@ -1627,8 +1627,9 @@ zfs_prop_set_list(zfs_handle_t *zhp, nvl * its canmount property to 'on' or 'noauto'. We only use * the changelist logic to unmount when setting canmount=off. */ - if (!(prop == ZFS_PROP_CANMOUNT && - fnvpair_value_uint64(elem) != ZFS_CANMOUNT_OFF)) { + if (prop != ZFS_PROP_CANMOUNT || + (fnvpair_value_uint64(elem) == ZFS_CANMOUNT_OFF && + zfs_is_mounted(zhp, NULL))) { cls[cl_idx] = changelist_gather(zhp, prop, 0, 0); if (cls[cl_idx] == NULL) goto error; From owner-svn-src-stable@freebsd.org Tue Apr 19 18:33:37 2016 Return-Path: Delivered-To: svn-src-stable@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 D1CE6B13349; Tue, 19 Apr 2016 18:33:37 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 908EA1379; Tue, 19 Apr 2016 18:33:37 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JIXa4n002888; Tue, 19 Apr 2016 18:33:36 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JIXa1p002886; Tue, 19 Apr 2016 18:33:36 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191833.u3JIXa1p002886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 18:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298281 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 18:33:37 -0000 Author: davidcs Date: Tue Apr 19 18:33:36 2016 New Revision: 298281 URL: https://svnweb.freebsd.org/changeset/base/298281 Log: MFC r297873 1. Process tx completions in bxe_periodic_callout_func() and restart transmissions if possible. 2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED 3. remove code not needed in bxe_init_internal_common() Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/bxe_stats.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Tue Apr 19 18:27:28 2016 (r298280) +++ stable/10/sys/dev/bxe/bxe.c Tue Apr 19 18:33:36 2016 (r298281) @@ -498,7 +498,9 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_sge), 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"}, { STATS_OFFSET32(mbuf_alloc_tpa), - 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"} + 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, + { STATS_OFFSET32(tx_queue_full_return), + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} }; static const struct { @@ -609,7 +611,9 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_sge), 4, "mbuf_alloc_sge"}, { Q_STATS_OFFSET32(mbuf_alloc_tpa), - 4, "mbuf_alloc_tpa"} + 4, "mbuf_alloc_tpa"}, + { Q_STATS_OFFSET32(tx_queue_full_return), + 4, "tx_queue_full_return"} }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp, if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* set the receive mode flags */ bxe_set_rx_mode(sc); - } else { + } else if(sc->state != BXE_STATE_DISABLED) { bxe_init_locked(sc); } } else { @@ -5729,11 +5733,6 @@ bxe_tx_start(struct ifnet *ifp) return; } - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return; - } - if (!sc->link_vars.link_up) { BLOGW(sc, "Interface link is down, ignoring transmit request\n"); return; @@ -5741,6 +5740,11 @@ bxe_tx_start(struct ifnet *ifp) fp = &sc->fp[0]; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + fp->eth_q_stats.tx_queue_full_return++; + return; + } + BXE_FP_TX_LOCK(fp); bxe_tx_start_locked(sc, ifp, fp); BXE_FP_TX_UNLOCK(fp); @@ -9942,21 +9946,6 @@ bxe_init_internal_common(struct bxe_soft { int i; - if (IS_MF_SI(sc)) { - /* - * In switch independent mode, the TSTORM needs to accept - * packets that failed classification, since approximate match - * mac addresses aren't written to NIG LLH. - */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 2); - } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 0); - } - /* * Zero this manually as its initialization is currently missing * in the initTool. @@ -12299,6 +12288,8 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; + struct bxe_fastpath *fp; + uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12321,6 +12312,48 @@ bxe_periodic_callout_func(void *xsc) return; } +#if __FreeBSD_version >= 800000 + + FOR_EACH_QUEUE(sc, i) { + fp = &sc->fp[i]; + + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + } + BXE_FP_TX_UNLOCK(fp); + } + } + +#else + + fp = &sc->fp[0]; + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_start_locked(sc, ifp, fp); + } + + BXE_FP_TX_UNLOCK(fp); + } + +#endif /* #if __FreeBSD_version >= 800000 */ + /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { if (bxe_watchdog(sc, &sc->fp[i]) != 0) { @@ -16169,6 +16202,7 @@ bxe_detach(device_t dev) if (sc->state != BXE_STATE_CLOSED) { BXE_CORE_LOCK(sc); bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE); + sc->state = BXE_STATE_DISABLED; BXE_CORE_UNLOCK(sc); } Modified: stable/10/sys/dev/bxe/bxe_stats.h ============================================================================== --- stable/10/sys/dev/bxe/bxe_stats.h Tue Apr 19 18:27:28 2016 (r298280) +++ stable/10/sys/dev/bxe/bxe_stats.h Tue Apr 19 18:33:36 2016 (r298281) @@ -263,6 +263,9 @@ struct bxe_eth_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; @@ -366,6 +369,9 @@ struct bxe_eth_q_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; struct bxe_eth_stats_old { From owner-svn-src-stable@freebsd.org Tue Apr 19 18:47:35 2016 Return-Path: Delivered-To: svn-src-stable@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 AD40BB1395C; Tue, 19 Apr 2016 18:47:35 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7C8E01D23; Tue, 19 Apr 2016 18:47:35 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JIlYEe005975; Tue, 19 Apr 2016 18:47:34 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JIlYvR005972; Tue, 19 Apr 2016 18:47:34 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191847.u3JIlYvR005972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 18:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298282 - stable/10/sys/dev/bxe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 18:47:35 -0000 Author: davidcs Date: Tue Apr 19 18:47:34 2016 New Revision: 298282 URL: https://svnweb.freebsd.org/changeset/base/298282 Log: MFC r297884 Add support for Flash Update Submitted by:nrapendra.singh@qlogic.com;vaishali.kulkarni@qlogic.com;davidcs@freebsd.org Modified: stable/10/sys/dev/bxe/bxe.c stable/10/sys/dev/bxe/bxe.h stable/10/sys/dev/bxe/bxe_ioctl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bxe/bxe.c ============================================================================== --- stable/10/sys/dev/bxe/bxe.c Tue Apr 19 18:33:36 2016 (r298281) +++ stable/10/sys/dev/bxe/bxe.c Tue Apr 19 18:47:34 2016 (r298282) @@ -13685,49 +13685,60 @@ bxe_get_tunable_params(struct bxe_softc sc->udp_rss); } -static void +static int bxe_media_detect(struct bxe_softc *sc) { + int port_type; uint32_t phy_idx = bxe_get_cur_phy_idx(sc); + switch (sc->link_params.phy[phy_idx].media_type) { case ELINK_ETH_PHY_SFPP_10G_FIBER: case ELINK_ETH_PHY_XFP_FIBER: BLOGI(sc, "Found 10Gb Fiber media.\n"); sc->media = IFM_10G_SR; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_SFP_1G_FIBER: BLOGI(sc, "Found 1Gb Fiber media.\n"); sc->media = IFM_1000_SX; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_KR: case ELINK_ETH_PHY_CX4: BLOGI(sc, "Found 10GBase-CX4 media.\n"); sc->media = IFM_10G_CX4; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_DA_TWINAX: BLOGI(sc, "Found 10Gb Twinax media.\n"); sc->media = IFM_10G_TWINAX; + port_type = PORT_DA; break; case ELINK_ETH_PHY_BASE_T: if (sc->link_params.speed_cap_mask[0] & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { BLOGI(sc, "Found 10GBase-T media.\n"); sc->media = IFM_10G_T; + port_type = PORT_TP; } else { BLOGI(sc, "Found 1000Base-T media.\n"); sc->media = IFM_1000_T; + port_type = PORT_TP; } break; case ELINK_ETH_PHY_NOT_PRESENT: BLOGI(sc, "Media not present.\n"); sc->media = 0; + port_type = PORT_OTHER; break; case ELINK_ETH_PHY_UNSPECIFIED: default: BLOGI(sc, "Unknown media!\n"); sc->media = 0; + port_type = PORT_OTHER; break; } + return port_type; } #define GET_FIELD(value, fname) \ @@ -18746,6 +18757,14 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->grc_dump == NULL) return (-1); + sc->eeprom = malloc(BXE_EEPROM_MAX_DATA_LEN, M_DEVBUF, M_NOWAIT); + + if (sc->eeprom == NULL) { + BLOGW(sc, "Unable to alloc for eeprom size buffer\n"); + free(sc->grc_dump, M_DEVBUF); sc->grc_dump = NULL; + return (-1); + } + sc->ioctl_dev = make_dev(&bxe_cdevsw, sc->ifnet->if_dunit, UID_ROOT, @@ -18757,6 +18776,8 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->ioctl_dev == NULL) { free(sc->grc_dump, M_DEVBUF); + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; return (-1); } @@ -18772,12 +18793,152 @@ bxe_del_cdev(struct bxe_softc *sc) if (sc->ioctl_dev != NULL) destroy_dev(sc->ioctl_dev); - if (sc->grc_dump == NULL) + if (sc->grc_dump != NULL) free(sc->grc_dump, M_DEVBUF); + if (sc->eeprom != NULL) { + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; + } + return; } +static bool bxe_is_nvram_accessible(struct bxe_softc *sc) +{ + + if ((sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) == 0) + return FALSE; + + return TRUE; +} + + +static int +bxe_wr_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_write(sc, offset, (uint8_t *)data, len); + + + return (rval); +} + +static int +bxe_rd_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_read(sc, offset, (uint8_t *)data, len); + + return (rval); +} + +static int +bxe_eeprom_rd_wr(struct bxe_softc *sc, bxe_eeprom_t *eeprom) +{ + int rval = 0; + + switch (eeprom->eeprom_cmd) { + + case BXE_EEPROM_CMD_SET_EEPROM: + + rval = copyin(eeprom->eeprom_data, sc->eeprom, + eeprom->eeprom_data_len); + + if (rval) + break; + + rval = bxe_wr_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + break; + + case BXE_EEPROM_CMD_GET_EEPROM: + + rval = bxe_rd_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + + if (rval) { + break; + } + + rval = copyout(sc->eeprom, eeprom->eeprom_data, + eeprom->eeprom_data_len); + break; + + default: + rval = EINVAL; + break; + } + + if (rval) { + BLOGW(sc, "ioctl cmd %d failed rval %d\n", eeprom->eeprom_cmd, rval); + } + + return (rval); +} + +static int +bxe_get_settings(struct bxe_softc *sc, bxe_dev_setting_t *dev_p) +{ + uint32_t ext_phy_config; + int port = SC_PORT(sc); + int cfg_idx = bxe_get_link_cfg_idx(sc); + + dev_p->supported = sc->port.supported[cfg_idx] | + (sc->port.supported[cfg_idx ^ 1] & + (ELINK_SUPPORTED_TP | ELINK_SUPPORTED_FIBRE)); + dev_p->advertising = sc->port.advertising[cfg_idx]; + if(sc->link_params.phy[bxe_get_cur_phy_idx(sc)].media_type == + ELINK_ETH_PHY_SFP_1G_FIBER) { + dev_p->supported = ~(ELINK_SUPPORTED_10000baseT_Full); + dev_p->advertising &= ~(ADVERTISED_10000baseT_Full); + } + if ((sc->state == BXE_STATE_OPEN) && sc->link_vars.link_up && + !(sc->flags & BXE_MF_FUNC_DIS)) { + dev_p->duplex = sc->link_vars.duplex; + if (IS_MF(sc) && !BXE_NOMCP(sc)) + dev_p->speed = bxe_get_mf_speed(sc); + else + dev_p->speed = sc->link_vars.line_speed; + } else { + dev_p->duplex = DUPLEX_UNKNOWN; + dev_p->speed = SPEED_UNKNOWN; + } + + dev_p->port = bxe_media_detect(sc); + + ext_phy_config = SHMEM_RD(sc, + dev_info.port_hw_config[port].external_phy_config); + if((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) == + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) + dev_p->phy_address = sc->port.phy_addr; + else if(((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && + ((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) + dev_p->phy_address = ELINK_XGXS_EXT_PHY_ADDR(ext_phy_config); + else + dev_p->phy_address = 0; + + if(sc->link_params.req_line_speed[cfg_idx] == ELINK_SPEED_AUTO_NEG) + dev_p->autoneg = AUTONEG_ENABLE; + else + dev_p->autoneg = AUTONEG_DISABLE; + + + return 0; +} + static int bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) @@ -18787,6 +18948,14 @@ bxe_eioctl(struct cdev *dev, u_long cmd, device_t pci_dev; bxe_grcdump_t *dump = NULL; int grc_dump_size; + bxe_drvinfo_t *drv_infop = NULL; + bxe_dev_setting_t *dev_p; + bxe_dev_setting_t dev_set; + bxe_get_regs_t *reg_p; + bxe_reg_rdw_t *reg_rdw_p; + bxe_pcicfg_rdw_t *cfg_rdw_p; + bxe_perm_mac_addr_t *mac_addr_p; + if ((sc = (struct bxe_softc *)dev->si_drv1) == NULL) return ENXIO; @@ -18799,14 +18968,15 @@ bxe_eioctl(struct cdev *dev, u_long cmd, case BXE_GRC_DUMP_SIZE: dump->pci_func = sc->pcie_func; - dump->grcdump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + dump->grcdump_size = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); break; case BXE_GRC_DUMP: grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + sizeof(struct dump_header); if ((sc->grc_dump == NULL) || (dump->grcdump == NULL) || (dump->grcdump_size < grc_dump_size) || (!sc->grcdump_done)) { @@ -18819,6 +18989,92 @@ bxe_eioctl(struct cdev *dev, u_long cmd, break; + case BXE_DRV_INFO: + drv_infop = (bxe_drvinfo_t *)data; + snprintf(drv_infop->drv_name, BXE_DRV_NAME_LENGTH, "%s", "bxe"); + snprintf(drv_infop->drv_version, BXE_DRV_VERSION_LENGTH, "v:%s", + BXE_DRIVER_VERSION); + snprintf(drv_infop->mfw_version, BXE_MFW_VERSION_LENGTH, "%s", + sc->devinfo.bc_ver_str); + snprintf(drv_infop->stormfw_version, BXE_STORMFW_VERSION_LENGTH, + "%s", sc->fw_ver_str); + drv_infop->eeprom_dump_len = sc->devinfo.flash_size; + drv_infop->reg_dump_len = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); + snprintf(drv_infop->bus_info, BXE_BUS_INFO_LENGTH, "%d:%d:%d", + sc->pcie_bus, sc->pcie_device, sc->pcie_func); + break; + case BXE_DEV_SETTING: + dev_p = (bxe_dev_setting_t *)data; + bxe_get_settings(sc, &dev_set); + dev_p->supported = dev_set.supported; + dev_p->advertising = dev_set.advertising; + dev_p->speed = dev_set.speed; + dev_p->duplex = dev_set.duplex; + dev_p->port = dev_set.port; + dev_p->phy_address = dev_set.phy_address; + dev_p->autoneg = dev_set.autoneg; + + break; + + case BXE_GET_REGS: + + reg_p = (bxe_get_regs_t *)data; + grc_dump_size = reg_p->reg_buf_len; + + if (sc->grc_dump == NULL) { + rval = EINVAL; + break; + } + + if(!sc->grcdump_done) { + bxe_grc_dump(sc); + } + if(sc->grcdump_done) { + rval = copyout(sc->grc_dump, reg_p->reg_buf, grc_dump_size); + sc->grcdump_done = 0; + } + + break; + case BXE_RDW_REG: + reg_rdw_p = (bxe_reg_rdw_t *)data; + if((reg_rdw_p->reg_cmd == BXE_READ_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + reg_rdw_p->reg_val = REG_RD(sc, reg_rdw_p->reg_id); + + if((reg_rdw_p->reg_cmd == BXE_WRITE_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + REG_WR(sc, reg_rdw_p->reg_id, reg_rdw_p->reg_val); + + break; + + case BXE_RDW_PCICFG: + cfg_rdw_p = (bxe_pcicfg_rdw_t *)data; + if(cfg_rdw_p->cfg_cmd == BXE_READ_PCICFG) { + + cfg_rdw_p->cfg_val = pci_read_config(sc->dev, cfg_rdw_p->cfg_id, + cfg_rdw_p->cfg_width); + + } else if(cfg_rdw_p->cfg_cmd == BXE_WRITE_PCICFG) { + pci_write_config(sc->dev, cfg_rdw_p->cfg_id, cfg_rdw_p->cfg_val, + cfg_rdw_p->cfg_width); + } else { + BLOGW(sc, "BXE_RDW_PCICFG ioctl wrong cmd passed\n"); + } + break; + + case BXE_MAC_ADDR: + mac_addr_p = (bxe_perm_mac_addr_t *)data; + snprintf(mac_addr_p->mac_addr_str, sizeof(sc->mac_addr_str), "%s", + sc->mac_addr_str); + break; + + case BXE_EEPROM: + rval = bxe_eeprom_rd_wr(sc, (bxe_eeprom_t *)data); + break; + + default: break; } Modified: stable/10/sys/dev/bxe/bxe.h ============================================================================== --- stable/10/sys/dev/bxe/bxe.h Tue Apr 19 18:33:36 2016 (r298281) +++ stable/10/sys/dev/bxe/bxe.h Tue Apr 19 18:47:34 2016 (r298282) @@ -1788,6 +1788,7 @@ struct bxe_softc { struct cdev *ioctl_dev; void *grc_dump; int grcdump_done; + void *eeprom; }; /* struct bxe_softc */ /* IOCTL sub-commands for edebug and firmware upgrade */ @@ -2109,6 +2110,28 @@ static const uint32_t dmae_reg_go_c[] = #define PCI_PM_D0 1 #define PCI_PM_D3hot 2 +#ifndef DUPLEX_UNKNOWN +#define DUPLEX_UNKNOWN (0xff) +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN (-1) +#endif + +/* Enable or disable autonegotiation. */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 +#define PORT_DA 0x05 +#define PORT_NONE 0xef +#define PORT_OTHER 0xff + int bxe_test_bit(int nr, volatile unsigned long * addr); void bxe_set_bit(unsigned int nr, volatile unsigned long * addr); void bxe_clear_bit(int nr, volatile unsigned long * addr); Modified: stable/10/sys/dev/bxe/bxe_ioctl.h ============================================================================== --- stable/10/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 18:33:36 2016 (r298281) +++ stable/10/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 18:47:34 2016 (r298282) @@ -42,6 +42,86 @@ struct bxe_grcdump { }; typedef struct bxe_grcdump bxe_grcdump_t; +#define BXE_DRV_NAME_LENGTH 32 +#define BXE_DRV_VERSION_LENGTH 32 +#define BXE_MFW_VERSION_LENGTH 32 +#define BXE_STORMFW_VERSION_LENGTH 32 +#define BXE_BUS_INFO_LENGTH 32 + +struct bxe_drvinfo { + char drv_name[BXE_DRV_NAME_LENGTH]; + char drv_version[BXE_DRV_VERSION_LENGTH]; + char mfw_version[BXE_MFW_VERSION_LENGTH]; + char stormfw_version[BXE_STORMFW_VERSION_LENGTH]; + uint32_t eeprom_dump_len; /* in bytes */ + uint32_t reg_dump_len; /* in bytes */ + char bus_info[BXE_BUS_INFO_LENGTH]; +}; +typedef struct bxe_drvinfo bxe_drvinfo_t; + +struct bxe_dev_setting { + + uint32_t supported; /* Features this interface supports */ + uint32_t advertising;/* Features this interface advertises */ + uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + uint32_t duplex; /* Duplex, half or full */ + uint32_t port; /* Which connector port */ + uint32_t phy_address;/* port number*/ + uint32_t autoneg; /* Enable or disable autonegotiation */ +}; +typedef struct bxe_dev_setting bxe_dev_setting_t; + +struct bxe_get_regs { + void *reg_buf; + uint32_t reg_buf_len; +}; +typedef struct bxe_get_regs bxe_get_regs_t; + +#define BXE_EEPROM_MAX_DATA_LEN 524288 + +struct bxe_eeprom { + uint32_t eeprom_cmd; +#define BXE_EEPROM_CMD_SET_EEPROM 0x01 +#define BXE_EEPROM_CMD_GET_EEPROM 0x02 + + void *eeprom_data; + uint32_t eeprom_offset; + uint32_t eeprom_data_len; + uint32_t eeprom_magic; +}; +typedef struct bxe_eeprom bxe_eeprom_t; + +struct bxe_reg_rdw { + uint32_t reg_cmd; +#define BXE_READ_REG_CMD 0x01 +#define BXE_WRITE_REG_CMD 0x02 + + uint32_t reg_id; + uint32_t reg_val; + uint32_t reg_access_type; +#define BXE_REG_ACCESS_DIRECT 0x01 +#define BXE_REG_ACCESS_INDIRECT 0x02 +}; + +typedef struct bxe_reg_rdw bxe_reg_rdw_t; + +struct bxe_pcicfg_rdw { + uint32_t cfg_cmd; +#define BXE_READ_PCICFG 0x01 +#define BXE_WRITE_PCICFG 0x01 + uint32_t cfg_id; + uint32_t cfg_val; + uint32_t cfg_width; +}; + +typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t; + +struct bxe_perm_mac_addr { + char mac_addr_str[32]; +}; + +typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t; + /* * Read grcdump size @@ -53,5 +133,41 @@ typedef struct bxe_grcdump bxe_grcdump_t */ #define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t) +/* + * Read driver info + */ +#define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t) + +/* + * Read Device Setting + */ +#define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t) + +/* + * Get Registers + */ +#define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t) + +/* + * Get/Set EEPROM + */ +#define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t) + +/* + * read/write a register + */ +#define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t) + +/* + * read/write PCIcfg + */ +#define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t) + +/* + * get permanent mac address + */ + +#define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t) + #endif /* #ifndef _QLNX_IOCTL_H_ */ From owner-svn-src-stable@freebsd.org Tue Apr 19 18:57:32 2016 Return-Path: Delivered-To: svn-src-stable@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 D5EB7B13E39; Tue, 19 Apr 2016 18:57:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AD6031392; Tue, 19 Apr 2016 18:57:32 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JIvVc3008974; Tue, 19 Apr 2016 18:57:31 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JIvV5q008971; Tue, 19 Apr 2016 18:57:31 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191857.u3JIvV5q008971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 18:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298283 - stable/9/sys/dev/bxe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 18:57:32 -0000 Author: davidcs Date: Tue Apr 19 18:57:31 2016 New Revision: 298283 URL: https://svnweb.freebsd.org/changeset/base/298283 Log: MFC r297873 1. Process tx completions in bxe_periodic_callout_func() and restart transmissions if possible. 2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED 3. remove code not needed in bxe_init_internal_common() Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com Modified: stable/9/sys/dev/bxe/bxe.c stable/9/sys/dev/bxe/bxe_stats.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c ============================================================================== --- stable/9/sys/dev/bxe/bxe.c Tue Apr 19 18:47:34 2016 (r298282) +++ stable/9/sys/dev/bxe/bxe.c Tue Apr 19 18:57:31 2016 (r298283) @@ -498,7 +498,9 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_sge), 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"}, { STATS_OFFSET32(mbuf_alloc_tpa), - 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"} + 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, + { STATS_OFFSET32(tx_queue_full_return), + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} }; static const struct { @@ -609,7 +611,9 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_sge), 4, "mbuf_alloc_sge"}, { Q_STATS_OFFSET32(mbuf_alloc_tpa), - 4, "mbuf_alloc_tpa"} + 4, "mbuf_alloc_tpa"}, + { Q_STATS_OFFSET32(tx_queue_full_return), + 4, "tx_queue_full_return"} }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp, if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* set the receive mode flags */ bxe_set_rx_mode(sc); - } else { + } else if(sc->state != BXE_STATE_DISABLED) { bxe_init_locked(sc); } } else { @@ -5737,11 +5741,6 @@ bxe_tx_start(struct ifnet *ifp) return; } - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return; - } - if (!sc->link_vars.link_up) { BLOGW(sc, "Interface link is down, ignoring transmit request\n"); return; @@ -5749,6 +5748,11 @@ bxe_tx_start(struct ifnet *ifp) fp = &sc->fp[0]; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + fp->eth_q_stats.tx_queue_full_return++; + return; + } + BXE_FP_TX_LOCK(fp); bxe_tx_start_locked(sc, ifp, fp); BXE_FP_TX_UNLOCK(fp); @@ -9950,21 +9954,6 @@ bxe_init_internal_common(struct bxe_soft { int i; - if (IS_MF_SI(sc)) { - /* - * In switch independent mode, the TSTORM needs to accept - * packets that failed classification, since approximate match - * mac addresses aren't written to NIG LLH. - */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 2); - } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 0); - } - /* * Zero this manually as its initialization is currently missing * in the initTool. @@ -12307,6 +12296,8 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; + struct bxe_fastpath *fp; + uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12329,6 +12320,48 @@ bxe_periodic_callout_func(void *xsc) return; } +#if __FreeBSD_version >= 800000 + + FOR_EACH_QUEUE(sc, i) { + fp = &sc->fp[i]; + + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + } + BXE_FP_TX_UNLOCK(fp); + } + } + +#else + + fp = &sc->fp[0]; + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_start_locked(sc, ifp, fp); + } + + BXE_FP_TX_UNLOCK(fp); + } + +#endif /* #if __FreeBSD_version >= 800000 */ + /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { if (bxe_watchdog(sc, &sc->fp[i]) != 0) { @@ -16177,6 +16210,7 @@ bxe_detach(device_t dev) if (sc->state != BXE_STATE_CLOSED) { BXE_CORE_LOCK(sc); bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE); + sc->state = BXE_STATE_DISABLED; BXE_CORE_UNLOCK(sc); } Modified: stable/9/sys/dev/bxe/bxe_stats.h ============================================================================== --- stable/9/sys/dev/bxe/bxe_stats.h Tue Apr 19 18:47:34 2016 (r298282) +++ stable/9/sys/dev/bxe/bxe_stats.h Tue Apr 19 18:57:31 2016 (r298283) @@ -263,6 +263,9 @@ struct bxe_eth_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; @@ -366,6 +369,9 @@ struct bxe_eth_q_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; struct bxe_eth_stats_old { From owner-svn-src-stable@freebsd.org Tue Apr 19 19:03:07 2016 Return-Path: Delivered-To: svn-src-stable@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 9A63DB14193; Tue, 19 Apr 2016 19:03:07 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6A7021A17; Tue, 19 Apr 2016 19:03:07 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JJ36L8012002; Tue, 19 Apr 2016 19:03:06 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JJ36bE011999; Tue, 19 Apr 2016 19:03:06 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191903.u3JJ36bE011999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 19:03:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298284 - stable/9/sys/dev/bxe X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 19:03:07 -0000 Author: davidcs Date: Tue Apr 19 19:03:06 2016 New Revision: 298284 URL: https://svnweb.freebsd.org/changeset/base/298284 Log: MFC r297884 Add support for Flash Update Submitted by:nrapendra.singh@qlogic.com;vaishali.kulkarni@qlogic.com;davidcs@freebsd.org Modified: stable/9/sys/dev/bxe/bxe.c stable/9/sys/dev/bxe/bxe.h stable/9/sys/dev/bxe/bxe_ioctl.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/bxe/bxe.c ============================================================================== --- stable/9/sys/dev/bxe/bxe.c Tue Apr 19 18:57:31 2016 (r298283) +++ stable/9/sys/dev/bxe/bxe.c Tue Apr 19 19:03:06 2016 (r298284) @@ -13693,49 +13693,60 @@ bxe_get_tunable_params(struct bxe_softc sc->udp_rss); } -static void +static int bxe_media_detect(struct bxe_softc *sc) { + int port_type; uint32_t phy_idx = bxe_get_cur_phy_idx(sc); + switch (sc->link_params.phy[phy_idx].media_type) { case ELINK_ETH_PHY_SFPP_10G_FIBER: case ELINK_ETH_PHY_XFP_FIBER: BLOGI(sc, "Found 10Gb Fiber media.\n"); sc->media = IFM_10G_SR; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_SFP_1G_FIBER: BLOGI(sc, "Found 1Gb Fiber media.\n"); sc->media = IFM_1000_SX; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_KR: case ELINK_ETH_PHY_CX4: BLOGI(sc, "Found 10GBase-CX4 media.\n"); sc->media = IFM_10G_CX4; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_DA_TWINAX: BLOGI(sc, "Found 10Gb Twinax media.\n"); sc->media = IFM_10G_TWINAX; + port_type = PORT_DA; break; case ELINK_ETH_PHY_BASE_T: if (sc->link_params.speed_cap_mask[0] & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { BLOGI(sc, "Found 10GBase-T media.\n"); sc->media = IFM_10G_T; + port_type = PORT_TP; } else { BLOGI(sc, "Found 1000Base-T media.\n"); sc->media = IFM_1000_T; + port_type = PORT_TP; } break; case ELINK_ETH_PHY_NOT_PRESENT: BLOGI(sc, "Media not present.\n"); sc->media = 0; + port_type = PORT_OTHER; break; case ELINK_ETH_PHY_UNSPECIFIED: default: BLOGI(sc, "Unknown media!\n"); sc->media = 0; + port_type = PORT_OTHER; break; } + return port_type; } #define GET_FIELD(value, fname) \ @@ -18754,6 +18765,14 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->grc_dump == NULL) return (-1); + sc->eeprom = malloc(BXE_EEPROM_MAX_DATA_LEN, M_DEVBUF, M_NOWAIT); + + if (sc->eeprom == NULL) { + BLOGW(sc, "Unable to alloc for eeprom size buffer\n"); + free(sc->grc_dump, M_DEVBUF); sc->grc_dump = NULL; + return (-1); + } + sc->ioctl_dev = make_dev(&bxe_cdevsw, sc->ifnet->if_dunit, UID_ROOT, @@ -18765,6 +18784,8 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->ioctl_dev == NULL) { free(sc->grc_dump, M_DEVBUF); + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; return (-1); } @@ -18780,12 +18801,152 @@ bxe_del_cdev(struct bxe_softc *sc) if (sc->ioctl_dev != NULL) destroy_dev(sc->ioctl_dev); - if (sc->grc_dump == NULL) + if (sc->grc_dump != NULL) free(sc->grc_dump, M_DEVBUF); + if (sc->eeprom != NULL) { + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; + } + return; } +static bool bxe_is_nvram_accessible(struct bxe_softc *sc) +{ + + if ((sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) == 0) + return FALSE; + + return TRUE; +} + + +static int +bxe_wr_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_write(sc, offset, (uint8_t *)data, len); + + + return (rval); +} + +static int +bxe_rd_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_read(sc, offset, (uint8_t *)data, len); + + return (rval); +} + +static int +bxe_eeprom_rd_wr(struct bxe_softc *sc, bxe_eeprom_t *eeprom) +{ + int rval = 0; + + switch (eeprom->eeprom_cmd) { + + case BXE_EEPROM_CMD_SET_EEPROM: + + rval = copyin(eeprom->eeprom_data, sc->eeprom, + eeprom->eeprom_data_len); + + if (rval) + break; + + rval = bxe_wr_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + break; + + case BXE_EEPROM_CMD_GET_EEPROM: + + rval = bxe_rd_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + + if (rval) { + break; + } + + rval = copyout(sc->eeprom, eeprom->eeprom_data, + eeprom->eeprom_data_len); + break; + + default: + rval = EINVAL; + break; + } + + if (rval) { + BLOGW(sc, "ioctl cmd %d failed rval %d\n", eeprom->eeprom_cmd, rval); + } + + return (rval); +} + +static int +bxe_get_settings(struct bxe_softc *sc, bxe_dev_setting_t *dev_p) +{ + uint32_t ext_phy_config; + int port = SC_PORT(sc); + int cfg_idx = bxe_get_link_cfg_idx(sc); + + dev_p->supported = sc->port.supported[cfg_idx] | + (sc->port.supported[cfg_idx ^ 1] & + (ELINK_SUPPORTED_TP | ELINK_SUPPORTED_FIBRE)); + dev_p->advertising = sc->port.advertising[cfg_idx]; + if(sc->link_params.phy[bxe_get_cur_phy_idx(sc)].media_type == + ELINK_ETH_PHY_SFP_1G_FIBER) { + dev_p->supported = ~(ELINK_SUPPORTED_10000baseT_Full); + dev_p->advertising &= ~(ADVERTISED_10000baseT_Full); + } + if ((sc->state == BXE_STATE_OPEN) && sc->link_vars.link_up && + !(sc->flags & BXE_MF_FUNC_DIS)) { + dev_p->duplex = sc->link_vars.duplex; + if (IS_MF(sc) && !BXE_NOMCP(sc)) + dev_p->speed = bxe_get_mf_speed(sc); + else + dev_p->speed = sc->link_vars.line_speed; + } else { + dev_p->duplex = DUPLEX_UNKNOWN; + dev_p->speed = SPEED_UNKNOWN; + } + + dev_p->port = bxe_media_detect(sc); + + ext_phy_config = SHMEM_RD(sc, + dev_info.port_hw_config[port].external_phy_config); + if((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) == + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) + dev_p->phy_address = sc->port.phy_addr; + else if(((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && + ((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) + dev_p->phy_address = ELINK_XGXS_EXT_PHY_ADDR(ext_phy_config); + else + dev_p->phy_address = 0; + + if(sc->link_params.req_line_speed[cfg_idx] == ELINK_SPEED_AUTO_NEG) + dev_p->autoneg = AUTONEG_ENABLE; + else + dev_p->autoneg = AUTONEG_DISABLE; + + + return 0; +} + static int bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) @@ -18795,6 +18956,14 @@ bxe_eioctl(struct cdev *dev, u_long cmd, device_t pci_dev; bxe_grcdump_t *dump = NULL; int grc_dump_size; + bxe_drvinfo_t *drv_infop = NULL; + bxe_dev_setting_t *dev_p; + bxe_dev_setting_t dev_set; + bxe_get_regs_t *reg_p; + bxe_reg_rdw_t *reg_rdw_p; + bxe_pcicfg_rdw_t *cfg_rdw_p; + bxe_perm_mac_addr_t *mac_addr_p; + if ((sc = (struct bxe_softc *)dev->si_drv1) == NULL) return ENXIO; @@ -18807,14 +18976,15 @@ bxe_eioctl(struct cdev *dev, u_long cmd, case BXE_GRC_DUMP_SIZE: dump->pci_func = sc->pcie_func; - dump->grcdump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + dump->grcdump_size = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); break; case BXE_GRC_DUMP: grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + sizeof(struct dump_header); if ((sc->grc_dump == NULL) || (dump->grcdump == NULL) || (dump->grcdump_size < grc_dump_size) || (!sc->grcdump_done)) { @@ -18827,6 +18997,92 @@ bxe_eioctl(struct cdev *dev, u_long cmd, break; + case BXE_DRV_INFO: + drv_infop = (bxe_drvinfo_t *)data; + snprintf(drv_infop->drv_name, BXE_DRV_NAME_LENGTH, "%s", "bxe"); + snprintf(drv_infop->drv_version, BXE_DRV_VERSION_LENGTH, "v:%s", + BXE_DRIVER_VERSION); + snprintf(drv_infop->mfw_version, BXE_MFW_VERSION_LENGTH, "%s", + sc->devinfo.bc_ver_str); + snprintf(drv_infop->stormfw_version, BXE_STORMFW_VERSION_LENGTH, + "%s", sc->fw_ver_str); + drv_infop->eeprom_dump_len = sc->devinfo.flash_size; + drv_infop->reg_dump_len = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); + snprintf(drv_infop->bus_info, BXE_BUS_INFO_LENGTH, "%d:%d:%d", + sc->pcie_bus, sc->pcie_device, sc->pcie_func); + break; + case BXE_DEV_SETTING: + dev_p = (bxe_dev_setting_t *)data; + bxe_get_settings(sc, &dev_set); + dev_p->supported = dev_set.supported; + dev_p->advertising = dev_set.advertising; + dev_p->speed = dev_set.speed; + dev_p->duplex = dev_set.duplex; + dev_p->port = dev_set.port; + dev_p->phy_address = dev_set.phy_address; + dev_p->autoneg = dev_set.autoneg; + + break; + + case BXE_GET_REGS: + + reg_p = (bxe_get_regs_t *)data; + grc_dump_size = reg_p->reg_buf_len; + + if (sc->grc_dump == NULL) { + rval = EINVAL; + break; + } + + if(!sc->grcdump_done) { + bxe_grc_dump(sc); + } + if(sc->grcdump_done) { + rval = copyout(sc->grc_dump, reg_p->reg_buf, grc_dump_size); + sc->grcdump_done = 0; + } + + break; + case BXE_RDW_REG: + reg_rdw_p = (bxe_reg_rdw_t *)data; + if((reg_rdw_p->reg_cmd == BXE_READ_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + reg_rdw_p->reg_val = REG_RD(sc, reg_rdw_p->reg_id); + + if((reg_rdw_p->reg_cmd == BXE_WRITE_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + REG_WR(sc, reg_rdw_p->reg_id, reg_rdw_p->reg_val); + + break; + + case BXE_RDW_PCICFG: + cfg_rdw_p = (bxe_pcicfg_rdw_t *)data; + if(cfg_rdw_p->cfg_cmd == BXE_READ_PCICFG) { + + cfg_rdw_p->cfg_val = pci_read_config(sc->dev, cfg_rdw_p->cfg_id, + cfg_rdw_p->cfg_width); + + } else if(cfg_rdw_p->cfg_cmd == BXE_WRITE_PCICFG) { + pci_write_config(sc->dev, cfg_rdw_p->cfg_id, cfg_rdw_p->cfg_val, + cfg_rdw_p->cfg_width); + } else { + BLOGW(sc, "BXE_RDW_PCICFG ioctl wrong cmd passed\n"); + } + break; + + case BXE_MAC_ADDR: + mac_addr_p = (bxe_perm_mac_addr_t *)data; + snprintf(mac_addr_p->mac_addr_str, sizeof(sc->mac_addr_str), "%s", + sc->mac_addr_str); + break; + + case BXE_EEPROM: + rval = bxe_eeprom_rd_wr(sc, (bxe_eeprom_t *)data); + break; + + default: break; } Modified: stable/9/sys/dev/bxe/bxe.h ============================================================================== --- stable/9/sys/dev/bxe/bxe.h Tue Apr 19 18:57:31 2016 (r298283) +++ stable/9/sys/dev/bxe/bxe.h Tue Apr 19 19:03:06 2016 (r298284) @@ -1788,6 +1788,7 @@ struct bxe_softc { struct cdev *ioctl_dev; void *grc_dump; int grcdump_done; + void *eeprom; }; /* struct bxe_softc */ /* IOCTL sub-commands for edebug and firmware upgrade */ @@ -2109,6 +2110,28 @@ static const uint32_t dmae_reg_go_c[] = #define PCI_PM_D0 1 #define PCI_PM_D3hot 2 +#ifndef DUPLEX_UNKNOWN +#define DUPLEX_UNKNOWN (0xff) +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN (-1) +#endif + +/* Enable or disable autonegotiation. */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 +#define PORT_DA 0x05 +#define PORT_NONE 0xef +#define PORT_OTHER 0xff + int bxe_test_bit(int nr, volatile unsigned long * addr); void bxe_set_bit(unsigned int nr, volatile unsigned long * addr); void bxe_clear_bit(int nr, volatile unsigned long * addr); Modified: stable/9/sys/dev/bxe/bxe_ioctl.h ============================================================================== --- stable/9/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 18:57:31 2016 (r298283) +++ stable/9/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 19:03:06 2016 (r298284) @@ -42,6 +42,86 @@ struct bxe_grcdump { }; typedef struct bxe_grcdump bxe_grcdump_t; +#define BXE_DRV_NAME_LENGTH 32 +#define BXE_DRV_VERSION_LENGTH 32 +#define BXE_MFW_VERSION_LENGTH 32 +#define BXE_STORMFW_VERSION_LENGTH 32 +#define BXE_BUS_INFO_LENGTH 32 + +struct bxe_drvinfo { + char drv_name[BXE_DRV_NAME_LENGTH]; + char drv_version[BXE_DRV_VERSION_LENGTH]; + char mfw_version[BXE_MFW_VERSION_LENGTH]; + char stormfw_version[BXE_STORMFW_VERSION_LENGTH]; + uint32_t eeprom_dump_len; /* in bytes */ + uint32_t reg_dump_len; /* in bytes */ + char bus_info[BXE_BUS_INFO_LENGTH]; +}; +typedef struct bxe_drvinfo bxe_drvinfo_t; + +struct bxe_dev_setting { + + uint32_t supported; /* Features this interface supports */ + uint32_t advertising;/* Features this interface advertises */ + uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + uint32_t duplex; /* Duplex, half or full */ + uint32_t port; /* Which connector port */ + uint32_t phy_address;/* port number*/ + uint32_t autoneg; /* Enable or disable autonegotiation */ +}; +typedef struct bxe_dev_setting bxe_dev_setting_t; + +struct bxe_get_regs { + void *reg_buf; + uint32_t reg_buf_len; +}; +typedef struct bxe_get_regs bxe_get_regs_t; + +#define BXE_EEPROM_MAX_DATA_LEN 524288 + +struct bxe_eeprom { + uint32_t eeprom_cmd; +#define BXE_EEPROM_CMD_SET_EEPROM 0x01 +#define BXE_EEPROM_CMD_GET_EEPROM 0x02 + + void *eeprom_data; + uint32_t eeprom_offset; + uint32_t eeprom_data_len; + uint32_t eeprom_magic; +}; +typedef struct bxe_eeprom bxe_eeprom_t; + +struct bxe_reg_rdw { + uint32_t reg_cmd; +#define BXE_READ_REG_CMD 0x01 +#define BXE_WRITE_REG_CMD 0x02 + + uint32_t reg_id; + uint32_t reg_val; + uint32_t reg_access_type; +#define BXE_REG_ACCESS_DIRECT 0x01 +#define BXE_REG_ACCESS_INDIRECT 0x02 +}; + +typedef struct bxe_reg_rdw bxe_reg_rdw_t; + +struct bxe_pcicfg_rdw { + uint32_t cfg_cmd; +#define BXE_READ_PCICFG 0x01 +#define BXE_WRITE_PCICFG 0x01 + uint32_t cfg_id; + uint32_t cfg_val; + uint32_t cfg_width; +}; + +typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t; + +struct bxe_perm_mac_addr { + char mac_addr_str[32]; +}; + +typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t; + /* * Read grcdump size @@ -53,5 +133,41 @@ typedef struct bxe_grcdump bxe_grcdump_t */ #define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t) +/* + * Read driver info + */ +#define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t) + +/* + * Read Device Setting + */ +#define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t) + +/* + * Get Registers + */ +#define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t) + +/* + * Get/Set EEPROM + */ +#define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t) + +/* + * read/write a register + */ +#define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t) + +/* + * read/write PCIcfg + */ +#define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t) + +/* + * get permanent mac address + */ + +#define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t) + #endif /* #ifndef _QLNX_IOCTL_H_ */ From owner-svn-src-stable@freebsd.org Tue Apr 19 19:08:45 2016 Return-Path: Delivered-To: svn-src-stable@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 D7241B1441F; Tue, 19 Apr 2016 19:08:45 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A86E31F77; Tue, 19 Apr 2016 19:08:45 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JJ8is6012325; Tue, 19 Apr 2016 19:08:44 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JJ8iWq012323; Tue, 19 Apr 2016 19:08:44 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191908.u3JJ8iWq012323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 19:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r298287 - stable/8/sys/dev/bxe X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 19:08:46 -0000 Author: davidcs Date: Tue Apr 19 19:08:44 2016 New Revision: 298287 URL: https://svnweb.freebsd.org/changeset/base/298287 Log: MFC r297873 1. Process tx completions in bxe_periodic_callout_func() and restart transmissions if possible. 2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED 3. remove code not needed in bxe_init_internal_common() Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com Modified: stable/8/sys/dev/bxe/bxe.c stable/8/sys/dev/bxe/bxe_stats.h Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/bxe/bxe.c ============================================================================== --- stable/8/sys/dev/bxe/bxe.c Tue Apr 19 19:08:37 2016 (r298286) +++ stable/8/sys/dev/bxe/bxe.c Tue Apr 19 19:08:44 2016 (r298287) @@ -498,7 +498,9 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_sge), 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"}, { STATS_OFFSET32(mbuf_alloc_tpa), - 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"} + 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, + { STATS_OFFSET32(tx_queue_full_return), + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} }; static const struct { @@ -609,7 +611,9 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_sge), 4, "mbuf_alloc_sge"}, { Q_STATS_OFFSET32(mbuf_alloc_tpa), - 4, "mbuf_alloc_tpa"} + 4, "mbuf_alloc_tpa"}, + { Q_STATS_OFFSET32(tx_queue_full_return), + 4, "tx_queue_full_return"} }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp, if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* set the receive mode flags */ bxe_set_rx_mode(sc); - } else { + } else if(sc->state != BXE_STATE_DISABLED) { bxe_init_locked(sc); } } else { @@ -5729,11 +5733,6 @@ bxe_tx_start(struct ifnet *ifp) return; } - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return; - } - if (!sc->link_vars.link_up) { BLOGW(sc, "Interface link is down, ignoring transmit request\n"); return; @@ -5741,6 +5740,11 @@ bxe_tx_start(struct ifnet *ifp) fp = &sc->fp[0]; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + fp->eth_q_stats.tx_queue_full_return++; + return; + } + BXE_FP_TX_LOCK(fp); bxe_tx_start_locked(sc, ifp, fp); BXE_FP_TX_UNLOCK(fp); @@ -9942,21 +9946,6 @@ bxe_init_internal_common(struct bxe_soft { int i; - if (IS_MF_SI(sc)) { - /* - * In switch independent mode, the TSTORM needs to accept - * packets that failed classification, since approximate match - * mac addresses aren't written to NIG LLH. - */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 2); - } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 0); - } - /* * Zero this manually as its initialization is currently missing * in the initTool. @@ -12299,6 +12288,8 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; + struct bxe_fastpath *fp; + uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12321,6 +12312,48 @@ bxe_periodic_callout_func(void *xsc) return; } +#if __FreeBSD_version >= 800000 + + FOR_EACH_QUEUE(sc, i) { + fp = &sc->fp[i]; + + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + } + BXE_FP_TX_UNLOCK(fp); + } + } + +#else + + fp = &sc->fp[0]; + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_start_locked(sc, ifp, fp); + } + + BXE_FP_TX_UNLOCK(fp); + } + +#endif /* #if __FreeBSD_version >= 800000 */ + /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { if (bxe_watchdog(sc, &sc->fp[i]) != 0) { @@ -16169,6 +16202,7 @@ bxe_detach(device_t dev) if (sc->state != BXE_STATE_CLOSED) { BXE_CORE_LOCK(sc); bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE); + sc->state = BXE_STATE_DISABLED; BXE_CORE_UNLOCK(sc); } Modified: stable/8/sys/dev/bxe/bxe_stats.h ============================================================================== --- stable/8/sys/dev/bxe/bxe_stats.h Tue Apr 19 19:08:37 2016 (r298286) +++ stable/8/sys/dev/bxe/bxe_stats.h Tue Apr 19 19:08:44 2016 (r298287) @@ -263,6 +263,9 @@ struct bxe_eth_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; @@ -366,6 +369,9 @@ struct bxe_eth_q_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; struct bxe_eth_stats_old { From owner-svn-src-stable@freebsd.org Tue Apr 19 19:14:05 2016 Return-Path: Delivered-To: svn-src-stable@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 5F10DB14696; Tue, 19 Apr 2016 19:14:05 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2E1F91675; Tue, 19 Apr 2016 19:14:05 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JJE48J015245; Tue, 19 Apr 2016 19:14:04 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JJE45s015242; Tue, 19 Apr 2016 19:14:04 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191914.u3JJE45s015242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 19:14:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r298289 - stable/8/sys/dev/bxe X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 19:14:05 -0000 Author: davidcs Date: Tue Apr 19 19:14:04 2016 New Revision: 298289 URL: https://svnweb.freebsd.org/changeset/base/298289 Log: MFC r297884 Add support for Flash Update Submitted by:nrapendra.singh@qlogic.com;vaishali.kulkarni@qlogic.com;davidcs@freebsd.org Modified: stable/8/sys/dev/bxe/bxe.c stable/8/sys/dev/bxe/bxe.h stable/8/sys/dev/bxe/bxe_ioctl.h Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/bxe/bxe.c ============================================================================== --- stable/8/sys/dev/bxe/bxe.c Tue Apr 19 19:13:33 2016 (r298288) +++ stable/8/sys/dev/bxe/bxe.c Tue Apr 19 19:14:04 2016 (r298289) @@ -13685,49 +13685,60 @@ bxe_get_tunable_params(struct bxe_softc sc->udp_rss); } -static void +static int bxe_media_detect(struct bxe_softc *sc) { + int port_type; uint32_t phy_idx = bxe_get_cur_phy_idx(sc); + switch (sc->link_params.phy[phy_idx].media_type) { case ELINK_ETH_PHY_SFPP_10G_FIBER: case ELINK_ETH_PHY_XFP_FIBER: BLOGI(sc, "Found 10Gb Fiber media.\n"); sc->media = IFM_10G_SR; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_SFP_1G_FIBER: BLOGI(sc, "Found 1Gb Fiber media.\n"); sc->media = IFM_1000_SX; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_KR: case ELINK_ETH_PHY_CX4: BLOGI(sc, "Found 10GBase-CX4 media.\n"); sc->media = IFM_10G_CX4; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_DA_TWINAX: BLOGI(sc, "Found 10Gb Twinax media.\n"); sc->media = IFM_10G_TWINAX; + port_type = PORT_DA; break; case ELINK_ETH_PHY_BASE_T: if (sc->link_params.speed_cap_mask[0] & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { BLOGI(sc, "Found 10GBase-T media.\n"); sc->media = IFM_10G_T; + port_type = PORT_TP; } else { BLOGI(sc, "Found 1000Base-T media.\n"); sc->media = IFM_1000_T; + port_type = PORT_TP; } break; case ELINK_ETH_PHY_NOT_PRESENT: BLOGI(sc, "Media not present.\n"); sc->media = 0; + port_type = PORT_OTHER; break; case ELINK_ETH_PHY_UNSPECIFIED: default: BLOGI(sc, "Unknown media!\n"); sc->media = 0; + port_type = PORT_OTHER; break; } + return port_type; } #define GET_FIELD(value, fname) \ @@ -18746,6 +18757,14 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->grc_dump == NULL) return (-1); + sc->eeprom = malloc(BXE_EEPROM_MAX_DATA_LEN, M_DEVBUF, M_NOWAIT); + + if (sc->eeprom == NULL) { + BLOGW(sc, "Unable to alloc for eeprom size buffer\n"); + free(sc->grc_dump, M_DEVBUF); sc->grc_dump = NULL; + return (-1); + } + sc->ioctl_dev = make_dev(&bxe_cdevsw, sc->ifnet->if_dunit, UID_ROOT, @@ -18757,6 +18776,8 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->ioctl_dev == NULL) { free(sc->grc_dump, M_DEVBUF); + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; return (-1); } @@ -18772,12 +18793,152 @@ bxe_del_cdev(struct bxe_softc *sc) if (sc->ioctl_dev != NULL) destroy_dev(sc->ioctl_dev); - if (sc->grc_dump == NULL) + if (sc->grc_dump != NULL) free(sc->grc_dump, M_DEVBUF); + if (sc->eeprom != NULL) { + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; + } + return; } +static bool bxe_is_nvram_accessible(struct bxe_softc *sc) +{ + + if ((sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) == 0) + return FALSE; + + return TRUE; +} + + +static int +bxe_wr_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_write(sc, offset, (uint8_t *)data, len); + + + return (rval); +} + +static int +bxe_rd_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_read(sc, offset, (uint8_t *)data, len); + + return (rval); +} + +static int +bxe_eeprom_rd_wr(struct bxe_softc *sc, bxe_eeprom_t *eeprom) +{ + int rval = 0; + + switch (eeprom->eeprom_cmd) { + + case BXE_EEPROM_CMD_SET_EEPROM: + + rval = copyin(eeprom->eeprom_data, sc->eeprom, + eeprom->eeprom_data_len); + + if (rval) + break; + + rval = bxe_wr_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + break; + + case BXE_EEPROM_CMD_GET_EEPROM: + + rval = bxe_rd_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + + if (rval) { + break; + } + + rval = copyout(sc->eeprom, eeprom->eeprom_data, + eeprom->eeprom_data_len); + break; + + default: + rval = EINVAL; + break; + } + + if (rval) { + BLOGW(sc, "ioctl cmd %d failed rval %d\n", eeprom->eeprom_cmd, rval); + } + + return (rval); +} + +static int +bxe_get_settings(struct bxe_softc *sc, bxe_dev_setting_t *dev_p) +{ + uint32_t ext_phy_config; + int port = SC_PORT(sc); + int cfg_idx = bxe_get_link_cfg_idx(sc); + + dev_p->supported = sc->port.supported[cfg_idx] | + (sc->port.supported[cfg_idx ^ 1] & + (ELINK_SUPPORTED_TP | ELINK_SUPPORTED_FIBRE)); + dev_p->advertising = sc->port.advertising[cfg_idx]; + if(sc->link_params.phy[bxe_get_cur_phy_idx(sc)].media_type == + ELINK_ETH_PHY_SFP_1G_FIBER) { + dev_p->supported = ~(ELINK_SUPPORTED_10000baseT_Full); + dev_p->advertising &= ~(ADVERTISED_10000baseT_Full); + } + if ((sc->state == BXE_STATE_OPEN) && sc->link_vars.link_up && + !(sc->flags & BXE_MF_FUNC_DIS)) { + dev_p->duplex = sc->link_vars.duplex; + if (IS_MF(sc) && !BXE_NOMCP(sc)) + dev_p->speed = bxe_get_mf_speed(sc); + else + dev_p->speed = sc->link_vars.line_speed; + } else { + dev_p->duplex = DUPLEX_UNKNOWN; + dev_p->speed = SPEED_UNKNOWN; + } + + dev_p->port = bxe_media_detect(sc); + + ext_phy_config = SHMEM_RD(sc, + dev_info.port_hw_config[port].external_phy_config); + if((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) == + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) + dev_p->phy_address = sc->port.phy_addr; + else if(((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && + ((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) + dev_p->phy_address = ELINK_XGXS_EXT_PHY_ADDR(ext_phy_config); + else + dev_p->phy_address = 0; + + if(sc->link_params.req_line_speed[cfg_idx] == ELINK_SPEED_AUTO_NEG) + dev_p->autoneg = AUTONEG_ENABLE; + else + dev_p->autoneg = AUTONEG_DISABLE; + + + return 0; +} + static int bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) @@ -18787,6 +18948,14 @@ bxe_eioctl(struct cdev *dev, u_long cmd, device_t pci_dev; bxe_grcdump_t *dump = NULL; int grc_dump_size; + bxe_drvinfo_t *drv_infop = NULL; + bxe_dev_setting_t *dev_p; + bxe_dev_setting_t dev_set; + bxe_get_regs_t *reg_p; + bxe_reg_rdw_t *reg_rdw_p; + bxe_pcicfg_rdw_t *cfg_rdw_p; + bxe_perm_mac_addr_t *mac_addr_p; + if ((sc = (struct bxe_softc *)dev->si_drv1) == NULL) return ENXIO; @@ -18799,14 +18968,15 @@ bxe_eioctl(struct cdev *dev, u_long cmd, case BXE_GRC_DUMP_SIZE: dump->pci_func = sc->pcie_func; - dump->grcdump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + dump->grcdump_size = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); break; case BXE_GRC_DUMP: grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + sizeof(struct dump_header); if ((sc->grc_dump == NULL) || (dump->grcdump == NULL) || (dump->grcdump_size < grc_dump_size) || (!sc->grcdump_done)) { @@ -18819,6 +18989,92 @@ bxe_eioctl(struct cdev *dev, u_long cmd, break; + case BXE_DRV_INFO: + drv_infop = (bxe_drvinfo_t *)data; + snprintf(drv_infop->drv_name, BXE_DRV_NAME_LENGTH, "%s", "bxe"); + snprintf(drv_infop->drv_version, BXE_DRV_VERSION_LENGTH, "v:%s", + BXE_DRIVER_VERSION); + snprintf(drv_infop->mfw_version, BXE_MFW_VERSION_LENGTH, "%s", + sc->devinfo.bc_ver_str); + snprintf(drv_infop->stormfw_version, BXE_STORMFW_VERSION_LENGTH, + "%s", sc->fw_ver_str); + drv_infop->eeprom_dump_len = sc->devinfo.flash_size; + drv_infop->reg_dump_len = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); + snprintf(drv_infop->bus_info, BXE_BUS_INFO_LENGTH, "%d:%d:%d", + sc->pcie_bus, sc->pcie_device, sc->pcie_func); + break; + case BXE_DEV_SETTING: + dev_p = (bxe_dev_setting_t *)data; + bxe_get_settings(sc, &dev_set); + dev_p->supported = dev_set.supported; + dev_p->advertising = dev_set.advertising; + dev_p->speed = dev_set.speed; + dev_p->duplex = dev_set.duplex; + dev_p->port = dev_set.port; + dev_p->phy_address = dev_set.phy_address; + dev_p->autoneg = dev_set.autoneg; + + break; + + case BXE_GET_REGS: + + reg_p = (bxe_get_regs_t *)data; + grc_dump_size = reg_p->reg_buf_len; + + if (sc->grc_dump == NULL) { + rval = EINVAL; + break; + } + + if(!sc->grcdump_done) { + bxe_grc_dump(sc); + } + if(sc->grcdump_done) { + rval = copyout(sc->grc_dump, reg_p->reg_buf, grc_dump_size); + sc->grcdump_done = 0; + } + + break; + case BXE_RDW_REG: + reg_rdw_p = (bxe_reg_rdw_t *)data; + if((reg_rdw_p->reg_cmd == BXE_READ_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + reg_rdw_p->reg_val = REG_RD(sc, reg_rdw_p->reg_id); + + if((reg_rdw_p->reg_cmd == BXE_WRITE_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + REG_WR(sc, reg_rdw_p->reg_id, reg_rdw_p->reg_val); + + break; + + case BXE_RDW_PCICFG: + cfg_rdw_p = (bxe_pcicfg_rdw_t *)data; + if(cfg_rdw_p->cfg_cmd == BXE_READ_PCICFG) { + + cfg_rdw_p->cfg_val = pci_read_config(sc->dev, cfg_rdw_p->cfg_id, + cfg_rdw_p->cfg_width); + + } else if(cfg_rdw_p->cfg_cmd == BXE_WRITE_PCICFG) { + pci_write_config(sc->dev, cfg_rdw_p->cfg_id, cfg_rdw_p->cfg_val, + cfg_rdw_p->cfg_width); + } else { + BLOGW(sc, "BXE_RDW_PCICFG ioctl wrong cmd passed\n"); + } + break; + + case BXE_MAC_ADDR: + mac_addr_p = (bxe_perm_mac_addr_t *)data; + snprintf(mac_addr_p->mac_addr_str, sizeof(sc->mac_addr_str), "%s", + sc->mac_addr_str); + break; + + case BXE_EEPROM: + rval = bxe_eeprom_rd_wr(sc, (bxe_eeprom_t *)data); + break; + + default: break; } Modified: stable/8/sys/dev/bxe/bxe.h ============================================================================== --- stable/8/sys/dev/bxe/bxe.h Tue Apr 19 19:13:33 2016 (r298288) +++ stable/8/sys/dev/bxe/bxe.h Tue Apr 19 19:14:04 2016 (r298289) @@ -1788,6 +1788,7 @@ struct bxe_softc { struct cdev *ioctl_dev; void *grc_dump; int grcdump_done; + void *eeprom; }; /* struct bxe_softc */ /* IOCTL sub-commands for edebug and firmware upgrade */ @@ -2109,6 +2110,28 @@ static const uint32_t dmae_reg_go_c[] = #define PCI_PM_D0 1 #define PCI_PM_D3hot 2 +#ifndef DUPLEX_UNKNOWN +#define DUPLEX_UNKNOWN (0xff) +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN (-1) +#endif + +/* Enable or disable autonegotiation. */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 +#define PORT_DA 0x05 +#define PORT_NONE 0xef +#define PORT_OTHER 0xff + int bxe_test_bit(int nr, volatile unsigned long * addr); void bxe_set_bit(unsigned int nr, volatile unsigned long * addr); void bxe_clear_bit(int nr, volatile unsigned long * addr); Modified: stable/8/sys/dev/bxe/bxe_ioctl.h ============================================================================== --- stable/8/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 19:13:33 2016 (r298288) +++ stable/8/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 19:14:04 2016 (r298289) @@ -42,6 +42,86 @@ struct bxe_grcdump { }; typedef struct bxe_grcdump bxe_grcdump_t; +#define BXE_DRV_NAME_LENGTH 32 +#define BXE_DRV_VERSION_LENGTH 32 +#define BXE_MFW_VERSION_LENGTH 32 +#define BXE_STORMFW_VERSION_LENGTH 32 +#define BXE_BUS_INFO_LENGTH 32 + +struct bxe_drvinfo { + char drv_name[BXE_DRV_NAME_LENGTH]; + char drv_version[BXE_DRV_VERSION_LENGTH]; + char mfw_version[BXE_MFW_VERSION_LENGTH]; + char stormfw_version[BXE_STORMFW_VERSION_LENGTH]; + uint32_t eeprom_dump_len; /* in bytes */ + uint32_t reg_dump_len; /* in bytes */ + char bus_info[BXE_BUS_INFO_LENGTH]; +}; +typedef struct bxe_drvinfo bxe_drvinfo_t; + +struct bxe_dev_setting { + + uint32_t supported; /* Features this interface supports */ + uint32_t advertising;/* Features this interface advertises */ + uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + uint32_t duplex; /* Duplex, half or full */ + uint32_t port; /* Which connector port */ + uint32_t phy_address;/* port number*/ + uint32_t autoneg; /* Enable or disable autonegotiation */ +}; +typedef struct bxe_dev_setting bxe_dev_setting_t; + +struct bxe_get_regs { + void *reg_buf; + uint32_t reg_buf_len; +}; +typedef struct bxe_get_regs bxe_get_regs_t; + +#define BXE_EEPROM_MAX_DATA_LEN 524288 + +struct bxe_eeprom { + uint32_t eeprom_cmd; +#define BXE_EEPROM_CMD_SET_EEPROM 0x01 +#define BXE_EEPROM_CMD_GET_EEPROM 0x02 + + void *eeprom_data; + uint32_t eeprom_offset; + uint32_t eeprom_data_len; + uint32_t eeprom_magic; +}; +typedef struct bxe_eeprom bxe_eeprom_t; + +struct bxe_reg_rdw { + uint32_t reg_cmd; +#define BXE_READ_REG_CMD 0x01 +#define BXE_WRITE_REG_CMD 0x02 + + uint32_t reg_id; + uint32_t reg_val; + uint32_t reg_access_type; +#define BXE_REG_ACCESS_DIRECT 0x01 +#define BXE_REG_ACCESS_INDIRECT 0x02 +}; + +typedef struct bxe_reg_rdw bxe_reg_rdw_t; + +struct bxe_pcicfg_rdw { + uint32_t cfg_cmd; +#define BXE_READ_PCICFG 0x01 +#define BXE_WRITE_PCICFG 0x01 + uint32_t cfg_id; + uint32_t cfg_val; + uint32_t cfg_width; +}; + +typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t; + +struct bxe_perm_mac_addr { + char mac_addr_str[32]; +}; + +typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t; + /* * Read grcdump size @@ -53,5 +133,41 @@ typedef struct bxe_grcdump bxe_grcdump_t */ #define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t) +/* + * Read driver info + */ +#define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t) + +/* + * Read Device Setting + */ +#define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t) + +/* + * Get Registers + */ +#define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t) + +/* + * Get/Set EEPROM + */ +#define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t) + +/* + * read/write a register + */ +#define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t) + +/* + * read/write PCIcfg + */ +#define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t) + +/* + * get permanent mac address + */ + +#define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t) + #endif /* #ifndef _QLNX_IOCTL_H_ */ From owner-svn-src-stable@freebsd.org Tue Apr 19 19:19:00 2016 Return-Path: Delivered-To: svn-src-stable@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 81EC2B14819; Tue, 19 Apr 2016 19:19:00 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 44BB418C9; Tue, 19 Apr 2016 19:19:00 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JJIxJw015455; Tue, 19 Apr 2016 19:18:59 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JJIxi8015453; Tue, 19 Apr 2016 19:18:59 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191918.u3JJIxi8015453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 19:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r298290 - stable/7/sys/dev/bxe X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 19:19:00 -0000 Author: davidcs Date: Tue Apr 19 19:18:59 2016 New Revision: 298290 URL: https://svnweb.freebsd.org/changeset/base/298290 Log: MFC r297873 1. Process tx completions in bxe_periodic_callout_func() and restart transmissions if possible. 2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED 3. remove code not needed in bxe_init_internal_common() Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com Modified: stable/7/sys/dev/bxe/bxe.c stable/7/sys/dev/bxe/bxe_stats.h Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/sys/dev/bxe/bxe.c ============================================================================== --- stable/7/sys/dev/bxe/bxe.c Tue Apr 19 19:14:04 2016 (r298289) +++ stable/7/sys/dev/bxe/bxe.c Tue Apr 19 19:18:59 2016 (r298290) @@ -498,7 +498,9 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_sge), 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"}, { STATS_OFFSET32(mbuf_alloc_tpa), - 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"} + 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, + { STATS_OFFSET32(tx_queue_full_return), + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} }; static const struct { @@ -609,7 +611,9 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_sge), 4, "mbuf_alloc_sge"}, { Q_STATS_OFFSET32(mbuf_alloc_tpa), - 4, "mbuf_alloc_tpa"} + 4, "mbuf_alloc_tpa"}, + { Q_STATS_OFFSET32(tx_queue_full_return), + 4, "tx_queue_full_return"} }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp, if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* set the receive mode flags */ bxe_set_rx_mode(sc); - } else { + } else if(sc->state != BXE_STATE_DISABLED) { bxe_init_locked(sc); } } else { @@ -5729,11 +5733,6 @@ bxe_tx_start(struct ifnet *ifp) return; } - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return; - } - if (!sc->link_vars.link_up) { BLOGW(sc, "Interface link is down, ignoring transmit request\n"); return; @@ -5741,6 +5740,11 @@ bxe_tx_start(struct ifnet *ifp) fp = &sc->fp[0]; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + fp->eth_q_stats.tx_queue_full_return++; + return; + } + BXE_FP_TX_LOCK(fp); bxe_tx_start_locked(sc, ifp, fp); BXE_FP_TX_UNLOCK(fp); @@ -9942,21 +9946,6 @@ bxe_init_internal_common(struct bxe_soft { int i; - if (IS_MF_SI(sc)) { - /* - * In switch independent mode, the TSTORM needs to accept - * packets that failed classification, since approximate match - * mac addresses aren't written to NIG LLH. - */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 2); - } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 0); - } - /* * Zero this manually as its initialization is currently missing * in the initTool. @@ -12299,6 +12288,8 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; + struct bxe_fastpath *fp; + uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12321,6 +12312,48 @@ bxe_periodic_callout_func(void *xsc) return; } +#if __FreeBSD_version >= 800000 + + FOR_EACH_QUEUE(sc, i) { + fp = &sc->fp[i]; + + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + } + BXE_FP_TX_UNLOCK(fp); + } + } + +#else + + fp = &sc->fp[0]; + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_start_locked(sc, ifp, fp); + } + + BXE_FP_TX_UNLOCK(fp); + } + +#endif /* #if __FreeBSD_version >= 800000 */ + /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { if (bxe_watchdog(sc, &sc->fp[i]) != 0) { @@ -16169,6 +16202,7 @@ bxe_detach(device_t dev) if (sc->state != BXE_STATE_CLOSED) { BXE_CORE_LOCK(sc); bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE); + sc->state = BXE_STATE_DISABLED; BXE_CORE_UNLOCK(sc); } Modified: stable/7/sys/dev/bxe/bxe_stats.h ============================================================================== --- stable/7/sys/dev/bxe/bxe_stats.h Tue Apr 19 19:14:04 2016 (r298289) +++ stable/7/sys/dev/bxe/bxe_stats.h Tue Apr 19 19:18:59 2016 (r298290) @@ -263,6 +263,9 @@ struct bxe_eth_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; @@ -366,6 +369,9 @@ struct bxe_eth_q_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; struct bxe_eth_stats_old { From owner-svn-src-stable@freebsd.org Tue Apr 19 19:22:08 2016 Return-Path: Delivered-To: svn-src-stable@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 AC472B14B2F; Tue, 19 Apr 2016 19:22:08 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 7B9D31DE3; Tue, 19 Apr 2016 19:22:08 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JJM7Tm017598; Tue, 19 Apr 2016 19:22:07 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JJM7TZ017594; Tue, 19 Apr 2016 19:22:07 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604191922.u3JJM7TZ017594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 19 Apr 2016 19:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r298291 - stable/7/sys/dev/bxe X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 19:22:08 -0000 Author: davidcs Date: Tue Apr 19 19:22:07 2016 New Revision: 298291 URL: https://svnweb.freebsd.org/changeset/base/298291 Log: MFC r297884 Add support for Flash Update Submitted by:nrapendra.singh@qlogic.com;vaishali.kulkarni@qlogic.com;davidcs@freebsd.org Modified: stable/7/sys/dev/bxe/bxe.c stable/7/sys/dev/bxe/bxe.h stable/7/sys/dev/bxe/bxe_ioctl.h Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) Modified: stable/7/sys/dev/bxe/bxe.c ============================================================================== --- stable/7/sys/dev/bxe/bxe.c Tue Apr 19 19:18:59 2016 (r298290) +++ stable/7/sys/dev/bxe/bxe.c Tue Apr 19 19:22:07 2016 (r298291) @@ -13685,49 +13685,60 @@ bxe_get_tunable_params(struct bxe_softc sc->udp_rss); } -static void +static int bxe_media_detect(struct bxe_softc *sc) { + int port_type; uint32_t phy_idx = bxe_get_cur_phy_idx(sc); + switch (sc->link_params.phy[phy_idx].media_type) { case ELINK_ETH_PHY_SFPP_10G_FIBER: case ELINK_ETH_PHY_XFP_FIBER: BLOGI(sc, "Found 10Gb Fiber media.\n"); sc->media = IFM_10G_SR; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_SFP_1G_FIBER: BLOGI(sc, "Found 1Gb Fiber media.\n"); sc->media = IFM_1000_SX; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_KR: case ELINK_ETH_PHY_CX4: BLOGI(sc, "Found 10GBase-CX4 media.\n"); sc->media = IFM_10G_CX4; + port_type = PORT_FIBRE; break; case ELINK_ETH_PHY_DA_TWINAX: BLOGI(sc, "Found 10Gb Twinax media.\n"); sc->media = IFM_10G_TWINAX; + port_type = PORT_DA; break; case ELINK_ETH_PHY_BASE_T: if (sc->link_params.speed_cap_mask[0] & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { BLOGI(sc, "Found 10GBase-T media.\n"); sc->media = IFM_10G_T; + port_type = PORT_TP; } else { BLOGI(sc, "Found 1000Base-T media.\n"); sc->media = IFM_1000_T; + port_type = PORT_TP; } break; case ELINK_ETH_PHY_NOT_PRESENT: BLOGI(sc, "Media not present.\n"); sc->media = 0; + port_type = PORT_OTHER; break; case ELINK_ETH_PHY_UNSPECIFIED: default: BLOGI(sc, "Unknown media!\n"); sc->media = 0; + port_type = PORT_OTHER; break; } + return port_type; } #define GET_FIELD(value, fname) \ @@ -18746,6 +18757,14 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->grc_dump == NULL) return (-1); + sc->eeprom = malloc(BXE_EEPROM_MAX_DATA_LEN, M_DEVBUF, M_NOWAIT); + + if (sc->eeprom == NULL) { + BLOGW(sc, "Unable to alloc for eeprom size buffer\n"); + free(sc->grc_dump, M_DEVBUF); sc->grc_dump = NULL; + return (-1); + } + sc->ioctl_dev = make_dev(&bxe_cdevsw, sc->ifnet->if_dunit, UID_ROOT, @@ -18757,6 +18776,8 @@ bxe_add_cdev(struct bxe_softc *sc) if (sc->ioctl_dev == NULL) { free(sc->grc_dump, M_DEVBUF); + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; return (-1); } @@ -18772,12 +18793,152 @@ bxe_del_cdev(struct bxe_softc *sc) if (sc->ioctl_dev != NULL) destroy_dev(sc->ioctl_dev); - if (sc->grc_dump == NULL) + if (sc->grc_dump != NULL) free(sc->grc_dump, M_DEVBUF); + if (sc->eeprom != NULL) { + free(sc->eeprom, M_DEVBUF); + sc->eeprom = NULL; + } + return; } +static bool bxe_is_nvram_accessible(struct bxe_softc *sc) +{ + + if ((sc->ifnet->if_drv_flags & IFF_DRV_RUNNING) == 0) + return FALSE; + + return TRUE; +} + + +static int +bxe_wr_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_write(sc, offset, (uint8_t *)data, len); + + + return (rval); +} + +static int +bxe_rd_eeprom(struct bxe_softc *sc, void *data, uint32_t offset, uint32_t len) +{ + int rval = 0; + + if(!bxe_is_nvram_accessible(sc)) { + BLOGW(sc, "Cannot access eeprom when interface is down\n"); + return (-EAGAIN); + } + rval = bxe_nvram_read(sc, offset, (uint8_t *)data, len); + + return (rval); +} + +static int +bxe_eeprom_rd_wr(struct bxe_softc *sc, bxe_eeprom_t *eeprom) +{ + int rval = 0; + + switch (eeprom->eeprom_cmd) { + + case BXE_EEPROM_CMD_SET_EEPROM: + + rval = copyin(eeprom->eeprom_data, sc->eeprom, + eeprom->eeprom_data_len); + + if (rval) + break; + + rval = bxe_wr_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + break; + + case BXE_EEPROM_CMD_GET_EEPROM: + + rval = bxe_rd_eeprom(sc, sc->eeprom, eeprom->eeprom_offset, + eeprom->eeprom_data_len); + + if (rval) { + break; + } + + rval = copyout(sc->eeprom, eeprom->eeprom_data, + eeprom->eeprom_data_len); + break; + + default: + rval = EINVAL; + break; + } + + if (rval) { + BLOGW(sc, "ioctl cmd %d failed rval %d\n", eeprom->eeprom_cmd, rval); + } + + return (rval); +} + +static int +bxe_get_settings(struct bxe_softc *sc, bxe_dev_setting_t *dev_p) +{ + uint32_t ext_phy_config; + int port = SC_PORT(sc); + int cfg_idx = bxe_get_link_cfg_idx(sc); + + dev_p->supported = sc->port.supported[cfg_idx] | + (sc->port.supported[cfg_idx ^ 1] & + (ELINK_SUPPORTED_TP | ELINK_SUPPORTED_FIBRE)); + dev_p->advertising = sc->port.advertising[cfg_idx]; + if(sc->link_params.phy[bxe_get_cur_phy_idx(sc)].media_type == + ELINK_ETH_PHY_SFP_1G_FIBER) { + dev_p->supported = ~(ELINK_SUPPORTED_10000baseT_Full); + dev_p->advertising &= ~(ADVERTISED_10000baseT_Full); + } + if ((sc->state == BXE_STATE_OPEN) && sc->link_vars.link_up && + !(sc->flags & BXE_MF_FUNC_DIS)) { + dev_p->duplex = sc->link_vars.duplex; + if (IS_MF(sc) && !BXE_NOMCP(sc)) + dev_p->speed = bxe_get_mf_speed(sc); + else + dev_p->speed = sc->link_vars.line_speed; + } else { + dev_p->duplex = DUPLEX_UNKNOWN; + dev_p->speed = SPEED_UNKNOWN; + } + + dev_p->port = bxe_media_detect(sc); + + ext_phy_config = SHMEM_RD(sc, + dev_info.port_hw_config[port].external_phy_config); + if((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) == + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) + dev_p->phy_address = sc->port.phy_addr; + else if(((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE) && + ((ext_phy_config & PORT_HW_CFG_XGXS_EXT_PHY_TYPE_MASK) != + PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN)) + dev_p->phy_address = ELINK_XGXS_EXT_PHY_ADDR(ext_phy_config); + else + dev_p->phy_address = 0; + + if(sc->link_params.req_line_speed[cfg_idx] == ELINK_SPEED_AUTO_NEG) + dev_p->autoneg = AUTONEG_ENABLE; + else + dev_p->autoneg = AUTONEG_DISABLE; + + + return 0; +} + static int bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) @@ -18787,6 +18948,14 @@ bxe_eioctl(struct cdev *dev, u_long cmd, device_t pci_dev; bxe_grcdump_t *dump = NULL; int grc_dump_size; + bxe_drvinfo_t *drv_infop = NULL; + bxe_dev_setting_t *dev_p; + bxe_dev_setting_t dev_set; + bxe_get_regs_t *reg_p; + bxe_reg_rdw_t *reg_rdw_p; + bxe_pcicfg_rdw_t *cfg_rdw_p; + bxe_perm_mac_addr_t *mac_addr_p; + if ((sc = (struct bxe_softc *)dev->si_drv1) == NULL) return ENXIO; @@ -18799,14 +18968,15 @@ bxe_eioctl(struct cdev *dev, u_long cmd, case BXE_GRC_DUMP_SIZE: dump->pci_func = sc->pcie_func; - dump->grcdump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + dump->grcdump_size = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); break; case BXE_GRC_DUMP: grc_dump_size = (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + - sizeof(struct dump_header); + sizeof(struct dump_header); if ((sc->grc_dump == NULL) || (dump->grcdump == NULL) || (dump->grcdump_size < grc_dump_size) || (!sc->grcdump_done)) { @@ -18819,6 +18989,92 @@ bxe_eioctl(struct cdev *dev, u_long cmd, break; + case BXE_DRV_INFO: + drv_infop = (bxe_drvinfo_t *)data; + snprintf(drv_infop->drv_name, BXE_DRV_NAME_LENGTH, "%s", "bxe"); + snprintf(drv_infop->drv_version, BXE_DRV_VERSION_LENGTH, "v:%s", + BXE_DRIVER_VERSION); + snprintf(drv_infop->mfw_version, BXE_MFW_VERSION_LENGTH, "%s", + sc->devinfo.bc_ver_str); + snprintf(drv_infop->stormfw_version, BXE_STORMFW_VERSION_LENGTH, + "%s", sc->fw_ver_str); + drv_infop->eeprom_dump_len = sc->devinfo.flash_size; + drv_infop->reg_dump_len = + (bxe_get_total_regs_len32(sc) * sizeof(uint32_t)) + + sizeof(struct dump_header); + snprintf(drv_infop->bus_info, BXE_BUS_INFO_LENGTH, "%d:%d:%d", + sc->pcie_bus, sc->pcie_device, sc->pcie_func); + break; + case BXE_DEV_SETTING: + dev_p = (bxe_dev_setting_t *)data; + bxe_get_settings(sc, &dev_set); + dev_p->supported = dev_set.supported; + dev_p->advertising = dev_set.advertising; + dev_p->speed = dev_set.speed; + dev_p->duplex = dev_set.duplex; + dev_p->port = dev_set.port; + dev_p->phy_address = dev_set.phy_address; + dev_p->autoneg = dev_set.autoneg; + + break; + + case BXE_GET_REGS: + + reg_p = (bxe_get_regs_t *)data; + grc_dump_size = reg_p->reg_buf_len; + + if (sc->grc_dump == NULL) { + rval = EINVAL; + break; + } + + if(!sc->grcdump_done) { + bxe_grc_dump(sc); + } + if(sc->grcdump_done) { + rval = copyout(sc->grc_dump, reg_p->reg_buf, grc_dump_size); + sc->grcdump_done = 0; + } + + break; + case BXE_RDW_REG: + reg_rdw_p = (bxe_reg_rdw_t *)data; + if((reg_rdw_p->reg_cmd == BXE_READ_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + reg_rdw_p->reg_val = REG_RD(sc, reg_rdw_p->reg_id); + + if((reg_rdw_p->reg_cmd == BXE_WRITE_REG_CMD) && + (reg_rdw_p->reg_access_type == BXE_REG_ACCESS_DIRECT)) + REG_WR(sc, reg_rdw_p->reg_id, reg_rdw_p->reg_val); + + break; + + case BXE_RDW_PCICFG: + cfg_rdw_p = (bxe_pcicfg_rdw_t *)data; + if(cfg_rdw_p->cfg_cmd == BXE_READ_PCICFG) { + + cfg_rdw_p->cfg_val = pci_read_config(sc->dev, cfg_rdw_p->cfg_id, + cfg_rdw_p->cfg_width); + + } else if(cfg_rdw_p->cfg_cmd == BXE_WRITE_PCICFG) { + pci_write_config(sc->dev, cfg_rdw_p->cfg_id, cfg_rdw_p->cfg_val, + cfg_rdw_p->cfg_width); + } else { + BLOGW(sc, "BXE_RDW_PCICFG ioctl wrong cmd passed\n"); + } + break; + + case BXE_MAC_ADDR: + mac_addr_p = (bxe_perm_mac_addr_t *)data; + snprintf(mac_addr_p->mac_addr_str, sizeof(sc->mac_addr_str), "%s", + sc->mac_addr_str); + break; + + case BXE_EEPROM: + rval = bxe_eeprom_rd_wr(sc, (bxe_eeprom_t *)data); + break; + + default: break; } Modified: stable/7/sys/dev/bxe/bxe.h ============================================================================== --- stable/7/sys/dev/bxe/bxe.h Tue Apr 19 19:18:59 2016 (r298290) +++ stable/7/sys/dev/bxe/bxe.h Tue Apr 19 19:22:07 2016 (r298291) @@ -1788,6 +1788,7 @@ struct bxe_softc { struct cdev *ioctl_dev; void *grc_dump; int grcdump_done; + void *eeprom; }; /* struct bxe_softc */ /* IOCTL sub-commands for edebug and firmware upgrade */ @@ -2109,6 +2110,28 @@ static const uint32_t dmae_reg_go_c[] = #define PCI_PM_D0 1 #define PCI_PM_D3hot 2 +#ifndef DUPLEX_UNKNOWN +#define DUPLEX_UNKNOWN (0xff) +#endif + +#ifndef SPEED_UNKNOWN +#define SPEED_UNKNOWN (-1) +#endif + +/* Enable or disable autonegotiation. */ +#define AUTONEG_DISABLE 0x00 +#define AUTONEG_ENABLE 0x01 + +/* Which connector port. */ +#define PORT_TP 0x00 +#define PORT_AUI 0x01 +#define PORT_MII 0x02 +#define PORT_FIBRE 0x03 +#define PORT_BNC 0x04 +#define PORT_DA 0x05 +#define PORT_NONE 0xef +#define PORT_OTHER 0xff + int bxe_test_bit(int nr, volatile unsigned long * addr); void bxe_set_bit(unsigned int nr, volatile unsigned long * addr); void bxe_clear_bit(int nr, volatile unsigned long * addr); Modified: stable/7/sys/dev/bxe/bxe_ioctl.h ============================================================================== --- stable/7/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 19:18:59 2016 (r298290) +++ stable/7/sys/dev/bxe/bxe_ioctl.h Tue Apr 19 19:22:07 2016 (r298291) @@ -42,6 +42,86 @@ struct bxe_grcdump { }; typedef struct bxe_grcdump bxe_grcdump_t; +#define BXE_DRV_NAME_LENGTH 32 +#define BXE_DRV_VERSION_LENGTH 32 +#define BXE_MFW_VERSION_LENGTH 32 +#define BXE_STORMFW_VERSION_LENGTH 32 +#define BXE_BUS_INFO_LENGTH 32 + +struct bxe_drvinfo { + char drv_name[BXE_DRV_NAME_LENGTH]; + char drv_version[BXE_DRV_VERSION_LENGTH]; + char mfw_version[BXE_MFW_VERSION_LENGTH]; + char stormfw_version[BXE_STORMFW_VERSION_LENGTH]; + uint32_t eeprom_dump_len; /* in bytes */ + uint32_t reg_dump_len; /* in bytes */ + char bus_info[BXE_BUS_INFO_LENGTH]; +}; +typedef struct bxe_drvinfo bxe_drvinfo_t; + +struct bxe_dev_setting { + + uint32_t supported; /* Features this interface supports */ + uint32_t advertising;/* Features this interface advertises */ + uint32_t speed; /* The forced speed, 10Mb, 100Mb, gigabit */ + uint32_t duplex; /* Duplex, half or full */ + uint32_t port; /* Which connector port */ + uint32_t phy_address;/* port number*/ + uint32_t autoneg; /* Enable or disable autonegotiation */ +}; +typedef struct bxe_dev_setting bxe_dev_setting_t; + +struct bxe_get_regs { + void *reg_buf; + uint32_t reg_buf_len; +}; +typedef struct bxe_get_regs bxe_get_regs_t; + +#define BXE_EEPROM_MAX_DATA_LEN 524288 + +struct bxe_eeprom { + uint32_t eeprom_cmd; +#define BXE_EEPROM_CMD_SET_EEPROM 0x01 +#define BXE_EEPROM_CMD_GET_EEPROM 0x02 + + void *eeprom_data; + uint32_t eeprom_offset; + uint32_t eeprom_data_len; + uint32_t eeprom_magic; +}; +typedef struct bxe_eeprom bxe_eeprom_t; + +struct bxe_reg_rdw { + uint32_t reg_cmd; +#define BXE_READ_REG_CMD 0x01 +#define BXE_WRITE_REG_CMD 0x02 + + uint32_t reg_id; + uint32_t reg_val; + uint32_t reg_access_type; +#define BXE_REG_ACCESS_DIRECT 0x01 +#define BXE_REG_ACCESS_INDIRECT 0x02 +}; + +typedef struct bxe_reg_rdw bxe_reg_rdw_t; + +struct bxe_pcicfg_rdw { + uint32_t cfg_cmd; +#define BXE_READ_PCICFG 0x01 +#define BXE_WRITE_PCICFG 0x01 + uint32_t cfg_id; + uint32_t cfg_val; + uint32_t cfg_width; +}; + +typedef struct bxe_pcicfg_rdw bxe_pcicfg_rdw_t; + +struct bxe_perm_mac_addr { + char mac_addr_str[32]; +}; + +typedef struct bxe_perm_mac_addr bxe_perm_mac_addr_t; + /* * Read grcdump size @@ -53,5 +133,41 @@ typedef struct bxe_grcdump bxe_grcdump_t */ #define BXE_GRC_DUMP _IOWR('e', 2, bxe_grcdump_t) +/* + * Read driver info + */ +#define BXE_DRV_INFO _IOR('e', 3, bxe_drvinfo_t) + +/* + * Read Device Setting + */ +#define BXE_DEV_SETTING _IOR('e', 4, bxe_dev_setting_t) + +/* + * Get Registers + */ +#define BXE_GET_REGS _IOR('e', 5, bxe_get_regs_t) + +/* + * Get/Set EEPROM + */ +#define BXE_EEPROM _IOWR('e', 6, bxe_eeprom_t) + +/* + * read/write a register + */ +#define BXE_RDW_REG _IOWR('e', 7, bxe_reg_rdw_t) + +/* + * read/write PCIcfg + */ +#define BXE_RDW_PCICFG _IOWR('e', 8, bxe_reg_rdw_t) + +/* + * get permanent mac address + */ + +#define BXE_MAC_ADDR _IOWR('e', 9, bxe_perm_mac_addr_t) + #endif /* #ifndef _QLNX_IOCTL_H_ */ From owner-svn-src-stable@freebsd.org Tue Apr 19 20:56:03 2016 Return-Path: Delivered-To: svn-src-stable@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 D343DB15B4D; Tue, 19 Apr 2016 20:56:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 AA8B21838; Tue, 19 Apr 2016 20:56:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JKu21q046025; Tue, 19 Apr 2016 20:56:02 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JKu2ve046023; Tue, 19 Apr 2016 20:56:02 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604192056.u3JKu2ve046023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Apr 2016 20:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298297 - stable/10/usr.sbin/kbdcontrol X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 20:56:03 -0000 Author: emaste Date: Tue Apr 19 20:56:02 2016 New Revision: 298297 URL: https://svnweb.freebsd.org/changeset/base/298297 Log: MFC r296926: kbdcontrol: add -P path option to add keymap search paths PR: 193865 Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/kbdcontrol/kbdcontrol.1 stable/10/usr.sbin/kbdcontrol/kbdcontrol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kbdcontrol/kbdcontrol.1 ============================================================================== --- stable/10/usr.sbin/kbdcontrol/kbdcontrol.1 Tue Apr 19 20:47:14 2016 (r298296) +++ stable/10/usr.sbin/kbdcontrol/kbdcontrol.1 Tue Apr 19 20:56:02 2016 (r298297) @@ -13,7 +13,7 @@ .\" @(#)kbdcontrol.1 .\" $FreeBSD$ .\" -.Dd January 29, 2008 +.Dd April 19, 2016 .Dt KBDCONTROL 1 .Os .Sh NAME @@ -36,6 +36,7 @@ .Op Fl f Ar # Ar string .Op Fl k Ar keyboard_device .Op Fl L Ar keymap_file +.Op Fl P Ar path .Sh DESCRIPTION The .Nm @@ -171,6 +172,12 @@ and write the compiled from it to stdout. This option is primarily intended for programmers and is probably of little use under normal circumstances. +.It Fl P Ar path +Search for the keymap file in +.Ar path . +The +.Fl P +option may be specified multiple times. .El .Sh ENVIRONMENT The environment variable Modified: stable/10/usr.sbin/kbdcontrol/kbdcontrol.c ============================================================================== --- stable/10/usr.sbin/kbdcontrol/kbdcontrol.c Tue Apr 19 20:47:14 2016 (r298296) +++ stable/10/usr.sbin/kbdcontrol/kbdcontrol.c Tue Apr 19 20:56:02 2016 (r298297) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "path.h" #include "lex.h" @@ -112,11 +113,13 @@ static const int repeats[] = { 34, 38, static const int ndelays = (sizeof(delays) / sizeof(int)); static const int nrepeats = (sizeof(repeats) / sizeof(int)); static int hex = 0; +static int paths_configured = 0; static int token; int number; char letter; +static void add_keymap_path(const char *path); static void dump_accent_definition(char *name, accentmap_t *accentmap); static void dump_entry(int value); static void dump_key_definition(char *name, keymap_t *keymap); @@ -142,6 +145,12 @@ static void set_keyrates(char *opt); static void show_kbd_info(void); static void usage(void) __dead2; +struct pathent { + STAILQ_ENTRY(pathent) next; + char *path; +}; +static STAILQ_HEAD(, pathent) pathlist = STAILQ_HEAD_INITIALIZER(pathlist); + /* Detect presence of vt(4). */ static int is_vt4(void) @@ -279,11 +288,11 @@ get_entry(void) } static int -get_definition_line(FILE *fd, keymap_t *keymap, accentmap_t *accentmap) +get_definition_line(FILE *file, keymap_t *keymap, accentmap_t *accentmap) { int c; - yyin = fd; + yyin = file; if (token < 0) token = yylex(); @@ -791,32 +800,57 @@ dump_accent_definition(char *name, accen } static void +add_keymap_path(const char *path) +{ + struct pathent* pe; + size_t len; + + len = strlen(path); + if ((pe = malloc(sizeof(*pe))) == NULL || + (pe->path = malloc(len + 2)) == NULL) + err(1, "malloc"); + memcpy(pe->path, path, len); + if (len > 0 && path[len - 1] != '/') + pe->path[len++] = '/'; + pe->path[len] = '\0'; + STAILQ_INSERT_TAIL(&pathlist, pe, next); +} + +static void load_keymap(char *opt, int dumponly) { keymap_t keymap; accentmap_t accentmap; - FILE *fd; - int i, j; + struct pathent *pe; + FILE *file; + int j; char *name, *cp; char blank[] = "", keymap_path[] = KEYMAP_PATH; char vt_keymap_path[] = VT_KEYMAP_PATH, dotkbd[] = ".kbd"; - char *prefix[] = {blank, blank, keymap_path, NULL}; char *postfix[] = {blank, dotkbd, NULL}; - if (is_vt4()) - prefix[2] = vt_keymap_path; - cp = getenv("KEYMAP_PATH"); - if (cp != NULL) - asprintf(&(prefix[0]), "%s/", cp); - - fd = NULL; - for (i=0; prefix[i] && fd == NULL; i++) { - for (j=0; postfix[j] && fd == NULL; j++) { - name = mkfullname(prefix[i], opt, postfix[j]); - fd = fopen(name, "r"); + if (!paths_configured) { + cp = getenv("KEYMAP_PATH"); + if (cp != NULL) + add_keymap_path(cp); + add_keymap_path(""); + if (is_vt4()) + add_keymap_path(vt_keymap_path); + else + add_keymap_path(keymap_path); + paths_configured = 1; + } + + file = NULL; + STAILQ_FOREACH(pe, &pathlist, next) { + for (j=0; postfix[j] && file == NULL; j++) { + name = mkfullname(pe->path, opt, postfix[j]); + file = fopen(name, "r"); + if (file != NULL) + break; } } - if (fd == NULL) { + if (file == NULL) { warn("keymap file \"%s\" not found", opt); return; } @@ -824,7 +858,7 @@ load_keymap(char *opt, int dumponly) memset(&accentmap, 0, sizeof(accentmap)); token = -1; while (1) { - if (get_definition_line(fd, &keymap, &accentmap) < 0) + if (get_definition_line(file, &keymap, &accentmap) < 0) break; } if (dumponly) { @@ -841,13 +875,13 @@ load_keymap(char *opt, int dumponly) } if ((keymap.n_keys > 0) && (ioctl(0, PIO_KEYMAP, &keymap) < 0)) { warn("setting keymap"); - fclose(fd); + fclose(file); return; } if ((accentmap.n_accs > 0) && (ioctl(0, PIO_DEADKEYMAP, &accentmap) < 0)) { warn("setting accentmap"); - fclose(fd); + fclose(file); return; } } @@ -1170,7 +1204,7 @@ usage(void) fprintf(stderr, "%s\n%s\n%s\n", "usage: kbdcontrol [-dFKix] [-A name] [-a name] [-b duration.pitch | [quiet.]belltype]", " [-r delay.repeat | speed] [-l mapfile] [-f # string]", -" [-k device] [-L mapfile]"); +" [-k device] [-L mapfile] [-P path]"); exit(1); } @@ -1178,9 +1212,16 @@ usage(void) int main(int argc, char **argv) { + const char *optstring = "A:a:b:df:iKk:Fl:L:P:r:x"; int opt; - while((opt = getopt(argc, argv, "A:a:b:df:iKk:Fl:L:r:x")) != -1) + /* Collect any -P arguments, regardless of where they appear. */ + while ((opt = getopt(argc, argv, optstring)) != -1) + if (opt == 'P') + add_keymap_path(optarg); + + optind = optreset = 1; + while ((opt = getopt(argc, argv, optstring)) != -1) switch(opt) { case 'A': case 'a': @@ -1198,6 +1239,8 @@ main(int argc, char **argv) case 'L': load_keymap(optarg, 1); break; + case 'P': + break; case 'f': set_functionkey(optarg, nextarg(argc, argv, &optind, 'f')); From owner-svn-src-stable@freebsd.org Tue Apr 19 21:06:40 2016 Return-Path: Delivered-To: svn-src-stable@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 C34E8B15F86; Tue, 19 Apr 2016 21:06:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 950B21172; Tue, 19 Apr 2016 21:06:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3JL6dfn049092; Tue, 19 Apr 2016 21:06:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3JL6dGW049091; Tue, 19 Apr 2016 21:06:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604192106.u3JL6dGW049091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 19 Apr 2016 21:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298299 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2016 21:06:40 -0000 Author: emaste Date: Tue Apr 19 21:06:39 2016 New Revision: 298299 URL: https://svnweb.freebsd.org/changeset/base/298299 Log: Bump __FreeBSD_version for kbdcontrol's -P option MFC'd in r298297 Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Tue Apr 19 20:56:45 2016 (r298298) +++ stable/10/sys/sys/param.h Tue Apr 19 21:06:39 2016 (r298299) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1003501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Wed Apr 20 00:44:14 2016 Return-Path: Delivered-To: svn-src-stable@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 5E196B13790; Wed, 20 Apr 2016 00:44:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2EF2614AE; Wed, 20 Apr 2016 00:44:14 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3K0iDIV015471; Wed, 20 Apr 2016 00:44:13 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3K0iDs3015470; Wed, 20 Apr 2016 00:44:13 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604200044.u3K0iDs3015470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Apr 2016 00:44:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298313 - stable/10/sbin/fsck_msdosfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 00:44:14 -0000 Author: pfg Date: Wed Apr 20 00:44:13 2016 New Revision: 298313 URL: https://svnweb.freebsd.org/changeset/base/298313 Log: MFC r297618: fsck_msdosfs(8): Optimimize memsets Obtained from: NetBSD (bin/50908) Modified: stable/10/sbin/fsck_msdosfs/dir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck_msdosfs/dir.c ============================================================================== --- stable/10/sbin/fsck_msdosfs/dir.c Wed Apr 20 00:19:04 2016 (r298312) +++ stable/10/sbin/fsck_msdosfs/dir.c Wed Apr 20 00:44:13 2016 (r298313) @@ -925,6 +925,7 @@ int reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head) { struct dosDirEntry d; + int len; u_char *p; if (!ask(1, "Reconnect")) @@ -976,14 +977,15 @@ reconnect(int dosfs, struct bootblock *b boot->NumFiles++; /* Ensure uniqueness of entry here! XXX */ memset(&d, 0, sizeof d); - (void)snprintf(d.name, sizeof(d.name), "%u", head); + /* worst case -1 = 4294967295, 10 digits */ + len = snprintf(d.name, sizeof(d.name), "%u", head); d.flags = 0; d.head = head; d.size = fat[head].length * boot->ClusterSize; - memset(p, 0, 32); - memset(p, ' ', 11); - memcpy(p, d.name, strlen(d.name)); + memcpy(p, d.name, len); + memset(p + len, ' ', 11 - len); + memset(p + 11, 0, 32 - 11); p[26] = (u_char)d.head; p[27] = (u_char)(d.head >> 8); if (boot->ClustMask == CLUST32_MASK) { From owner-svn-src-stable@freebsd.org Wed Apr 20 00:49:39 2016 Return-Path: Delivered-To: svn-src-stable@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 451BBB1399D; Wed, 20 Apr 2016 00:49:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2188C19F9; Wed, 20 Apr 2016 00:49:39 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3K0ncZn015708; Wed, 20 Apr 2016 00:49:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3K0nbop015698; Wed, 20 Apr 2016 00:49:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604200049.u3K0nbop015698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Apr 2016 00:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298314 - stable/10/lib/libgssapi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 00:49:39 -0000 Author: pfg Date: Wed Apr 20 00:49:37 2016 New Revision: 298314 URL: https://svnweb.freebsd.org/changeset/base/298314 Log: MFC 297942: libgssapi: avoid NULL pointer dereferences. While here also use NULL instead of zero for pointers. Modified: stable/10/lib/libgssapi/gss_add_cred.c stable/10/lib/libgssapi/gss_encapsulate_token.c stable/10/lib/libgssapi/gss_get_mic.c stable/10/lib/libgssapi/gss_inquire_context.c stable/10/lib/libgssapi/gss_mech_switch.c stable/10/lib/libgssapi/gss_pseudo_random.c stable/10/lib/libgssapi/gss_verify_mic.c stable/10/lib/libgssapi/gss_wrap.c stable/10/lib/libgssapi/gss_wrap_size_limit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libgssapi/gss_add_cred.c ============================================================================== --- stable/10/lib/libgssapi/gss_add_cred.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_add_cred.c Wed Apr 20 00:49:37 2016 (r298314) @@ -121,7 +121,7 @@ gss_add_cred(OM_uint32 *minor_status, * gss_add_cred for that mechanism, otherwise we copy the mc * to new_cred. */ - target_mc = 0; + target_mc = NULL; if (cred) { SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { if (gss_oid_equal(mc->gmc_mech_oid, desired_mech)) { @@ -151,7 +151,7 @@ gss_add_cred(OM_uint32 *minor_status, return (major_status); } } else { - mn = 0; + mn = NULL; } m = _gss_find_mech_switch(desired_mech); Modified: stable/10/lib/libgssapi/gss_encapsulate_token.c ============================================================================== --- stable/10/lib/libgssapi/gss_encapsulate_token.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_encapsulate_token.c Wed Apr 20 00:49:37 2016 (r298314) @@ -47,7 +47,7 @@ gss_encapsulate_token(const gss_buffer_t * First time around, we calculate the size, second time, we * encode the token. */ - p = 0; + p = NULL; for (i = 0; i < 2; i++) { len = 0; Modified: stable/10/lib/libgssapi/gss_get_mic.c ============================================================================== --- stable/10/lib/libgssapi/gss_get_mic.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_get_mic.c Wed Apr 20 00:49:37 2016 (r298314) @@ -40,13 +40,14 @@ gss_get_mic(OM_uint32 *minor_status, gss_buffer_t message_token) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; _gss_buffer_zero(message_token); if (ctx == NULL) { *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_get_mic(minor_status, ctx->gc_ctx, qop_req, message_buffer, message_token)); Modified: stable/10/lib/libgssapi/gss_inquire_context.c ============================================================================== --- stable/10/lib/libgssapi/gss_inquire_context.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_inquire_context.c Wed Apr 20 00:49:37 2016 (r298314) @@ -99,7 +99,7 @@ gss_inquire_context(OM_uint32 *minor_sta if (src_name) gss_release_name(minor_status, src_name); m->gm_release_name(minor_status, &src_mn); - minor_status = 0; + minor_status = NULL; return (GSS_S_FAILURE); } *targ_name = (gss_name_t) name; Modified: stable/10/lib/libgssapi/gss_mech_switch.c ============================================================================== --- stable/10/lib/libgssapi/gss_mech_switch.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_mech_switch.c Wed Apr 20 00:49:37 2016 (r298314) @@ -83,7 +83,7 @@ _gss_string_to_oid(const char* s, gss_OI * out the size. Second time around, we actually encode the * number. */ - res = 0; + res = NULL; for (i = 0; i < 2; i++) { byte_count = 0; for (p = s, j = 0; p; p = q, j++) { Modified: stable/10/lib/libgssapi/gss_pseudo_random.c ============================================================================== --- stable/10/lib/libgssapi/gss_pseudo_random.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_pseudo_random.c Wed Apr 20 00:49:37 2016 (r298314) @@ -48,7 +48,7 @@ gss_pseudo_random(OM_uint32 *minor_statu gss_buffer_t prf_out) { struct _gss_context *ctx = (struct _gss_context *) context; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; OM_uint32 major_status; _gss_buffer_zero(prf_out); @@ -58,6 +58,7 @@ gss_pseudo_random(OM_uint32 *minor_statu *minor_status = 0; return GSS_S_NO_CONTEXT; } + m = ctx->gc_mech; if (m->gm_pseudo_random == NULL) return GSS_S_UNAVAILABLE; Modified: stable/10/lib/libgssapi/gss_verify_mic.c ============================================================================== --- stable/10/lib/libgssapi/gss_verify_mic.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_verify_mic.c Wed Apr 20 00:49:37 2016 (r298314) @@ -39,7 +39,7 @@ gss_verify_mic(OM_uint32 *minor_status, gss_qop_t *qop_state) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; if (qop_state) *qop_state = 0; @@ -47,6 +47,7 @@ gss_verify_mic(OM_uint32 *minor_status, *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_verify_mic(minor_status, ctx->gc_ctx, message_buffer, token_buffer, qop_state)); Modified: stable/10/lib/libgssapi/gss_wrap.c ============================================================================== --- stable/10/lib/libgssapi/gss_wrap.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_wrap.c Wed Apr 20 00:49:37 2016 (r298314) @@ -42,7 +42,7 @@ gss_wrap(OM_uint32 *minor_status, gss_buffer_t output_message_buffer) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; if (conf_state) *conf_state = 0; @@ -51,6 +51,7 @@ gss_wrap(OM_uint32 *minor_status, *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_wrap(minor_status, ctx->gc_ctx, conf_req_flag, qop_req, input_message_buffer, Modified: stable/10/lib/libgssapi/gss_wrap_size_limit.c ============================================================================== --- stable/10/lib/libgssapi/gss_wrap_size_limit.c Wed Apr 20 00:44:13 2016 (r298313) +++ stable/10/lib/libgssapi/gss_wrap_size_limit.c Wed Apr 20 00:49:37 2016 (r298314) @@ -40,13 +40,14 @@ gss_wrap_size_limit(OM_uint32 *minor_sta OM_uint32 *max_input_size) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; *max_input_size = 0; if (ctx == NULL) { *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_wrap_size_limit(minor_status, ctx->gc_ctx, conf_req_flag, qop_req, req_output_size, max_input_size)); From owner-svn-src-stable@freebsd.org Wed Apr 20 00:50:19 2016 Return-Path: Delivered-To: svn-src-stable@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 2F7FDB13A9A; Wed, 20 Apr 2016 00:50:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0BDF71D9E; Wed, 20 Apr 2016 00:50:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3K0oIAG015846; Wed, 20 Apr 2016 00:50:18 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3K0oHhZ015836; Wed, 20 Apr 2016 00:50:17 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604200050.u3K0oHhZ015836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 20 Apr 2016 00:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298316 - stable/9/lib/libgssapi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 00:50:19 -0000 Author: pfg Date: Wed Apr 20 00:50:17 2016 New Revision: 298316 URL: https://svnweb.freebsd.org/changeset/base/298316 Log: MFC 297942: libgssapi: avoid NULL pointer dereferences. While here also use NULL instead of zero for pointers. Modified: stable/9/lib/libgssapi/gss_add_cred.c stable/9/lib/libgssapi/gss_encapsulate_token.c stable/9/lib/libgssapi/gss_get_mic.c stable/9/lib/libgssapi/gss_inquire_context.c stable/9/lib/libgssapi/gss_mech_switch.c stable/9/lib/libgssapi/gss_pseudo_random.c stable/9/lib/libgssapi/gss_verify_mic.c stable/9/lib/libgssapi/gss_wrap.c stable/9/lib/libgssapi/gss_wrap_size_limit.c Directory Properties: stable/9/lib/libgssapi/ (props changed) Modified: stable/9/lib/libgssapi/gss_add_cred.c ============================================================================== --- stable/9/lib/libgssapi/gss_add_cred.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_add_cred.c Wed Apr 20 00:50:17 2016 (r298316) @@ -121,7 +121,7 @@ gss_add_cred(OM_uint32 *minor_status, * gss_add_cred for that mechanism, otherwise we copy the mc * to new_cred. */ - target_mc = 0; + target_mc = NULL; if (cred) { SLIST_FOREACH(mc, &cred->gc_mc, gmc_link) { if (gss_oid_equal(mc->gmc_mech_oid, desired_mech)) { @@ -151,7 +151,7 @@ gss_add_cred(OM_uint32 *minor_status, return (major_status); } } else { - mn = 0; + mn = NULL; } m = _gss_find_mech_switch(desired_mech); Modified: stable/9/lib/libgssapi/gss_encapsulate_token.c ============================================================================== --- stable/9/lib/libgssapi/gss_encapsulate_token.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_encapsulate_token.c Wed Apr 20 00:50:17 2016 (r298316) @@ -47,7 +47,7 @@ gss_encapsulate_token(const gss_buffer_t * First time around, we calculate the size, second time, we * encode the token. */ - p = 0; + p = NULL; for (i = 0; i < 2; i++) { len = 0; Modified: stable/9/lib/libgssapi/gss_get_mic.c ============================================================================== --- stable/9/lib/libgssapi/gss_get_mic.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_get_mic.c Wed Apr 20 00:50:17 2016 (r298316) @@ -40,13 +40,14 @@ gss_get_mic(OM_uint32 *minor_status, gss_buffer_t message_token) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; _gss_buffer_zero(message_token); if (ctx == NULL) { *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_get_mic(minor_status, ctx->gc_ctx, qop_req, message_buffer, message_token)); Modified: stable/9/lib/libgssapi/gss_inquire_context.c ============================================================================== --- stable/9/lib/libgssapi/gss_inquire_context.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_inquire_context.c Wed Apr 20 00:50:17 2016 (r298316) @@ -99,7 +99,7 @@ gss_inquire_context(OM_uint32 *minor_sta if (src_name) gss_release_name(minor_status, src_name); m->gm_release_name(minor_status, &src_mn); - minor_status = 0; + minor_status = NULL; return (GSS_S_FAILURE); } *targ_name = (gss_name_t) name; Modified: stable/9/lib/libgssapi/gss_mech_switch.c ============================================================================== --- stable/9/lib/libgssapi/gss_mech_switch.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_mech_switch.c Wed Apr 20 00:50:17 2016 (r298316) @@ -83,7 +83,7 @@ _gss_string_to_oid(const char* s, gss_OI * out the size. Second time around, we actually encode the * number. */ - res = 0; + res = NULL; for (i = 0; i < 2; i++) { byte_count = 0; for (p = s, j = 0; p; p = q, j++) { Modified: stable/9/lib/libgssapi/gss_pseudo_random.c ============================================================================== --- stable/9/lib/libgssapi/gss_pseudo_random.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_pseudo_random.c Wed Apr 20 00:50:17 2016 (r298316) @@ -48,7 +48,7 @@ gss_pseudo_random(OM_uint32 *minor_statu gss_buffer_t prf_out) { struct _gss_context *ctx = (struct _gss_context *) context; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; OM_uint32 major_status; _gss_buffer_zero(prf_out); @@ -58,6 +58,7 @@ gss_pseudo_random(OM_uint32 *minor_statu *minor_status = 0; return GSS_S_NO_CONTEXT; } + m = ctx->gc_mech; if (m->gm_pseudo_random == NULL) return GSS_S_UNAVAILABLE; Modified: stable/9/lib/libgssapi/gss_verify_mic.c ============================================================================== --- stable/9/lib/libgssapi/gss_verify_mic.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_verify_mic.c Wed Apr 20 00:50:17 2016 (r298316) @@ -39,7 +39,7 @@ gss_verify_mic(OM_uint32 *minor_status, gss_qop_t *qop_state) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; if (qop_state) *qop_state = 0; @@ -47,6 +47,7 @@ gss_verify_mic(OM_uint32 *minor_status, *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_verify_mic(minor_status, ctx->gc_ctx, message_buffer, token_buffer, qop_state)); Modified: stable/9/lib/libgssapi/gss_wrap.c ============================================================================== --- stable/9/lib/libgssapi/gss_wrap.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_wrap.c Wed Apr 20 00:50:17 2016 (r298316) @@ -42,7 +42,7 @@ gss_wrap(OM_uint32 *minor_status, gss_buffer_t output_message_buffer) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; if (conf_state) *conf_state = 0; @@ -51,6 +51,7 @@ gss_wrap(OM_uint32 *minor_status, *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_wrap(minor_status, ctx->gc_ctx, conf_req_flag, qop_req, input_message_buffer, Modified: stable/9/lib/libgssapi/gss_wrap_size_limit.c ============================================================================== --- stable/9/lib/libgssapi/gss_wrap_size_limit.c Wed Apr 20 00:49:49 2016 (r298315) +++ stable/9/lib/libgssapi/gss_wrap_size_limit.c Wed Apr 20 00:50:17 2016 (r298316) @@ -40,13 +40,14 @@ gss_wrap_size_limit(OM_uint32 *minor_sta OM_uint32 *max_input_size) { struct _gss_context *ctx = (struct _gss_context *) context_handle; - struct _gss_mech_switch *m = ctx->gc_mech; + struct _gss_mech_switch *m; *max_input_size = 0; if (ctx == NULL) { *minor_status = 0; return (GSS_S_NO_CONTEXT); } + m = ctx->gc_mech; return (m->gm_wrap_size_limit(minor_status, ctx->gc_ctx, conf_req_flag, qop_req, req_output_size, max_input_size)); From owner-svn-src-stable@freebsd.org Thu Apr 21 14:25:46 2016 Return-Path: Delivered-To: svn-src-stable@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 A7B85B16653; Thu, 21 Apr 2016 14:25:46 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 77E4714AF; Thu, 21 Apr 2016 14:25:46 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LEPjmS004720; Thu, 21 Apr 2016 14:25:45 GMT (envelope-from wblock@FreeBSD.org) Received: (from wblock@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LEPjvK004719; Thu, 21 Apr 2016 14:25:45 GMT (envelope-from wblock@FreeBSD.org) Message-Id: <201604211425.u3LEPjvK004719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wblock set sender to wblock@FreeBSD.org using -f From: Warren Block Date: Thu, 21 Apr 2016 14:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298405 - stable/10/usr.sbin/ctm/ctm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 14:25:46 -0000 Author: wblock (doc committer) Date: Thu Apr 21 14:25:45 2016 New Revision: 298405 URL: https://svnweb.freebsd.org/changeset/base/298405 Log: MFC r298005: Remove a link to the CTM section of the Handbook, which no longer exists. Modified: stable/10/usr.sbin/ctm/ctm/ctm.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctm/ctm/ctm.1 ============================================================================== --- stable/10/usr.sbin/ctm/ctm/ctm.1 Thu Apr 21 14:20:45 2016 (r298404) +++ stable/10/usr.sbin/ctm/ctm/ctm.1 Thu Apr 21 14:25:45 2016 (r298405) @@ -12,7 +12,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 14, 2015 +.Dd April 14, 2016 .Dt CTM 1 .Os .Sh NAME @@ -308,11 +308,6 @@ options. .Xr ctm_smail 1 , .Xr ctm 5 .Rs -.%B "The FreeBSD Handbook" -.%T "Using CTM" -.%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/ctm.html -.Re -.Rs .%T "Miscellaneous CTM on FreeBSD Resources" .%U http://ctm.berklix.org .Re From owner-svn-src-stable@freebsd.org Thu Apr 21 14:57:45 2016 Return-Path: Delivered-To: svn-src-stable@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 CD09CB177B5; Thu, 21 Apr 2016 14:57:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9A6DB19B6; Thu, 21 Apr 2016 14:57:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LEviC4013999; Thu, 21 Apr 2016 14:57:44 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LEviow013998; Thu, 21 Apr 2016 14:57:44 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604211457.u3LEviow013998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 Apr 2016 14:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298406 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 14:57:45 -0000 Author: pfg Date: Thu Apr 21 14:57:44 2016 New Revision: 298406 URL: https://svnweb.freebsd.org/changeset/base/298406 Log: MFC r297527, r297688: chdone(): Prevent returning uninitialized scalar value. Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken Modified: stable/10/sys/cam/scsi/scsi_ch.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_ch.c Thu Apr 21 14:25:45 2016 (r298405) +++ stable/10/sys/cam/scsi/scsi_ch.c Thu Apr 21 14:57:44 2016 (r298406) @@ -648,6 +648,11 @@ chdone(struct cam_periph *periph, union softc->sc_counts[CHET_IE], PLURAL(softc->sc_counts[CHET_IE])); #undef PLURAL + if (announce_buf[0] != '\0') { + xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } } else { int error; @@ -714,14 +719,8 @@ chdone(struct cam_periph *periph, union cam_periph_invalidate(periph); - announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); - xpt_announce_quirks(periph, softc->quirks, - CH_Q_BIT_STRING); - } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* From owner-svn-src-stable@freebsd.org Thu Apr 21 15:02:59 2016 Return-Path: Delivered-To: svn-src-stable@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 1B222B17B47; Thu, 21 Apr 2016 15:02:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DFD2D1F5A; Thu, 21 Apr 2016 15:02:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LF2w0Z016828; Thu, 21 Apr 2016 15:02:58 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LF2wT0016827; Thu, 21 Apr 2016 15:02:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604211502.u3LF2wT0016827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 Apr 2016 15:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298407 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 15:02:59 -0000 Author: pfg Date: Thu Apr 21 15:02:57 2016 New Revision: 298407 URL: https://svnweb.freebsd.org/changeset/base/298407 Log: MFC r297527, r297688: chdone(): Prevent returning uninitialized scalar value. Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken Modified: stable/9/sys/cam/scsi/scsi_ch.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_ch.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_ch.c Thu Apr 21 14:57:44 2016 (r298406) +++ stable/9/sys/cam/scsi/scsi_ch.c Thu Apr 21 15:02:57 2016 (r298407) @@ -649,6 +649,11 @@ chdone(struct cam_periph *periph, union softc->sc_counts[CHET_IE], PLURAL(softc->sc_counts[CHET_IE])); #undef PLURAL + if (announce_buf[0] != '\0') { + xpt_announce_periph(periph, announce_buf); + xpt_announce_quirks(periph, softc->quirks, + CH_Q_BIT_STRING); + } } else { int error; @@ -712,14 +717,8 @@ chdone(struct cam_periph *periph, union cam_periph_invalidate(periph); - announce_buf[0] = '\0'; } } - if (announce_buf[0] != '\0') { - xpt_announce_periph(periph, announce_buf); - xpt_announce_quirks(periph, softc->quirks, - CH_Q_BIT_STRING); - } softc->state = CH_STATE_NORMAL; free(mode_header, M_SCSICH); /* From owner-svn-src-stable@freebsd.org Thu Apr 21 15:25:19 2016 Return-Path: Delivered-To: svn-src-stable@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 3D73DB15B77; Thu, 21 Apr 2016 15:25:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0011E19AF; Thu, 21 Apr 2016 15:25:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LFPI3N023175; Thu, 21 Apr 2016 15:25:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LFPHYa023172; Thu, 21 Apr 2016 15:25:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604211525.u3LFPHYa023172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Apr 2016 15:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298410 - stable/10/usr.bin/truss X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 15:25:19 -0000 Author: jhb Date: Thu Apr 21 15:25:17 2016 New Revision: 298410 URL: https://svnweb.freebsd.org/changeset/base/298410 Log: MFC 295677,295678: Fetch the current thread and it's syscall state from the trussinfo object instead of passing some of that state as arguments to print_syscall() and print_syscallret(). This just makes the calls of these functions shorter and easier to read. Modified: stable/10/usr.bin/truss/setup.c stable/10/usr.bin/truss/syscall.h stable/10/usr.bin/truss/syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/truss/setup.c ============================================================================== --- stable/10/usr.bin/truss/setup.c Thu Apr 21 15:24:21 2016 (r298409) +++ stable/10/usr.bin/truss/setup.c Thu Apr 21 15:25:17 2016 (r298410) @@ -422,8 +422,7 @@ exit_syscall(struct trussinfo *info, str } } - print_syscall_ret(info, t->cs.name, t->cs.nargs, t->cs.s_args, - errorp, retval, sc); + print_syscall_ret(info, errorp, retval); free_syscall(t); /* Modified: stable/10/usr.bin/truss/syscall.h ============================================================================== --- stable/10/usr.bin/truss/syscall.h Thu Apr 21 15:24:21 2016 (r298409) +++ stable/10/usr.bin/truss/syscall.h Thu Apr 21 15:25:17 2016 (r298410) @@ -111,7 +111,6 @@ struct linux_socketcall_args { }; void init_syscalls(void); -void print_syscall(struct trussinfo *, const char *, int, char **); -void print_syscall_ret(struct trussinfo *, const char *, int, char **, int, - long *, struct syscall *); +void print_syscall(struct trussinfo *); +void print_syscall_ret(struct trussinfo *, int, long *); void print_summary(struct trussinfo *trussinfo); Modified: stable/10/usr.bin/truss/syscalls.c ============================================================================== --- stable/10/usr.bin/truss/syscalls.c Thu Apr 21 15:24:21 2016 (r298409) +++ stable/10/usr.bin/truss/syscalls.c Thu Apr 21 15:25:17 2016 (r298410) @@ -1620,37 +1620,39 @@ print_arg(struct syscall_args *sc, unsig } /* - * Print (to outfile) the system call and its arguments. Note that - * nargs is the number of arguments (not the number of words; this is - * potentially confusing, I know). + * Print (to outfile) the system call and its arguments. */ void -print_syscall(struct trussinfo *trussinfo, const char *name, int nargs, - char **s_args) +print_syscall(struct trussinfo *trussinfo) { struct timespec timediff; - int i, len; + struct threadinfo *t; + const char *name; + char **s_args; + int i, len, nargs; len = 0; + t = trussinfo->curthread; if (trussinfo->flags & FOLLOWFORKS) len += fprintf(trussinfo->outfile, "%5d: ", - trussinfo->curthread->proc->pid); + t->proc->pid); + name = t->cs.name; + nargs = t->cs.nargs; + s_args = t->cs.s_args; if (name != NULL && (strcmp(name, "execve") == 0 || strcmp(name, "exit") == 0)) { - clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after); + clock_gettime(CLOCK_REALTIME, &t->after); } if (trussinfo->flags & ABSOLUTETIMESTAMPS) { - timespecsubt(&trussinfo->curthread->after, - &trussinfo->start_time, &timediff); + timespecsubt(&t->after, &trussinfo->start_time, &timediff); len += fprintf(trussinfo->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, timediff.tv_nsec); } if (trussinfo->flags & RELATIVETIMESTAMPS) { - timespecsubt(&trussinfo->curthread->after, - &trussinfo->curthread->before, &timediff); + timespecsubt(&t->after, &t->before, &timediff); len += fprintf(trussinfo->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, timediff.tv_nsec); } @@ -1658,7 +1660,7 @@ print_syscall(struct trussinfo *trussinf len += fprintf(trussinfo->outfile, "%s(", name); for (i = 0; i < nargs; i++) { - if (s_args[i]) + if (s_args[i] != NULL) len += fprintf(trussinfo->outfile, "%s", s_args[i]); else len += fprintf(trussinfo->outfile, @@ -1672,15 +1674,17 @@ print_syscall(struct trussinfo *trussinf } void -print_syscall_ret(struct trussinfo *trussinfo, const char *name, int nargs, - char **s_args, int errorp, long *retval, struct syscall *sc) +print_syscall_ret(struct trussinfo *trussinfo, int errorp, long *retval) { struct timespec timediff; + struct threadinfo *t; + struct syscall *sc; + t = trussinfo->curthread; + sc = t->cs.sc; if (trussinfo->flags & COUNTONLY) { - clock_gettime(CLOCK_REALTIME, &trussinfo->curthread->after); - timespecsubt(&trussinfo->curthread->after, - &trussinfo->curthread->before, &timediff); + clock_gettime(CLOCK_REALTIME, &t->after); + timespecsubt(&t->after, &t->before, &timediff); timespecadd(&sc->time, &timediff, &sc->time); sc->ncalls++; if (errorp) @@ -1688,7 +1692,7 @@ print_syscall_ret(struct trussinfo *trus return; } - print_syscall(trussinfo, name, nargs, s_args); + print_syscall(trussinfo); fflush(trussinfo->outfile); if (errorp) fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval[0], From owner-svn-src-stable@freebsd.org Thu Apr 21 18:44:54 2016 Return-Path: Delivered-To: svn-src-stable@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 EF712B187B0; Thu, 21 Apr 2016 18:44:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 CA8DC1391; Thu, 21 Apr 2016 18:44:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LIism3095141; Thu, 21 Apr 2016 18:44:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LIirPi095135; Thu, 21 Apr 2016 18:44:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201604211844.u3LIirPi095135@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 21 Apr 2016 18:44:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298427 - stable/10/usr.bin/truss X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 18:44:55 -0000 Author: jhb Date: Thu Apr 21 18:44:53 2016 New Revision: 298427 URL: https://svnweb.freebsd.org/changeset/base/298427 Log: MFC 295930: Add support for displaying thread IDs to truss(1). - Consolidate duplicate code for printing the metadata at the start of each line into a shared function. - Add an -H option which will log the thread ID of the relevant thread for each event. While here, remove some extraneous calls to clock_gettime() in print_syscall() and print_syscall_ret(). The caller of print_syscall_ret() always updates the current thread's "after" time before it is called. Modified: stable/10/usr.bin/truss/extern.h stable/10/usr.bin/truss/main.c stable/10/usr.bin/truss/setup.c stable/10/usr.bin/truss/syscalls.c stable/10/usr.bin/truss/truss.1 stable/10/usr.bin/truss/truss.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/truss/extern.h ============================================================================== --- stable/10/usr.bin/truss/extern.h Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/extern.h Thu Apr 21 18:44:53 2016 (r298427) @@ -31,6 +31,7 @@ * $FreeBSD$ */ +extern int print_line_prefix(struct trussinfo *); extern void setup_and_wait(struct trussinfo *, char **); extern void start_tracing(struct trussinfo *, pid_t); extern void restore_proc(int); Modified: stable/10/usr.bin/truss/main.c ============================================================================== --- stable/10/usr.bin/truss/main.c Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/main.c Thu Apr 21 18:44:53 2016 (r298427) @@ -95,7 +95,7 @@ main(int ac, char **av) trussinfo->curthread = NULL; LIST_INIT(&trussinfo->proclist); init_syscalls(); - while ((c = getopt(ac, av, "p:o:facedDs:S")) != -1) { + while ((c = getopt(ac, av, "p:o:facedDs:SH")) != -1) { switch (c) { case 'p': /* specified pid */ pid = atoi(optarg); @@ -131,6 +131,9 @@ main(int ac, char **av) case 'S': /* Don't trace signals */ trussinfo->flags |= NOSIGS; break; + case 'H': + trussinfo->flags |= DISPLAYTIDS; + break; default: usage(); } Modified: stable/10/usr.bin/truss/setup.c ============================================================================== --- stable/10/usr.bin/truss/setup.c Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/setup.c Thu Apr 21 18:44:53 2016 (r298427) @@ -439,26 +439,46 @@ exit_syscall(struct trussinfo *info, str } } -static void -report_exit(struct trussinfo *info, siginfo_t *si) +int +print_line_prefix(struct trussinfo *info) { struct timespec timediff; + struct threadinfo *t; + int len; - if (info->flags & FOLLOWFORKS) - fprintf(info->outfile, "%5d: ", si->si_pid); - clock_gettime(CLOCK_REALTIME, &info->curthread->after); + len = 0; + t = info->curthread; + if (info->flags & (FOLLOWFORKS | DISPLAYTIDS)) { + if (info->flags & FOLLOWFORKS) + len += fprintf(info->outfile, "%5d", t->proc->pid); + if ((info->flags & (FOLLOWFORKS | DISPLAYTIDS)) == + (FOLLOWFORKS | DISPLAYTIDS)) + len += fprintf(info->outfile, " "); + if (info->flags & DISPLAYTIDS) + len += fprintf(info->outfile, "%6d", t->tid); + len += fprintf(info->outfile, ": "); + } if (info->flags & ABSOLUTETIMESTAMPS) { - timespecsubt(&info->curthread->after, &info->start_time, - &timediff); - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); + timespecsubt(&t->after, &info->start_time, &timediff); + len += fprintf(info->outfile, "%jd.%09ld ", + (intmax_t)timediff.tv_sec, timediff.tv_nsec); } if (info->flags & RELATIVETIMESTAMPS) { - timespecsubt(&info->curthread->after, &info->curthread->before, - &timediff); - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); + timespecsubt(&t->after, &t->before, &timediff); + len += fprintf(info->outfile, "%jd.%09ld ", + (intmax_t)timediff.tv_sec, timediff.tv_nsec); } + return (len); +} + +static void +report_exit(struct trussinfo *info, siginfo_t *si) +{ + struct threadinfo *t; + + t = info->curthread; + clock_gettime(CLOCK_REALTIME, &t->after); + print_line_prefix(info); if (si->si_code == CLD_EXITED) fprintf(info->outfile, "process exit, rval = %u\n", si->si_status); @@ -469,48 +489,26 @@ report_exit(struct trussinfo *info, sigi } static void -report_new_child(struct trussinfo *info, pid_t pid) +report_new_child(struct trussinfo *info) { - struct timespec timediff; + struct threadinfo *t; - clock_gettime(CLOCK_REALTIME, &info->curthread->after); - assert(info->flags & FOLLOWFORKS); - fprintf(info->outfile, "%5d: ", pid); - if (info->flags & ABSOLUTETIMESTAMPS) { - timespecsubt(&info->curthread->after, &info->start_time, - &timediff); - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); - } - if (info->flags & RELATIVETIMESTAMPS) { - timediff.tv_sec = 0; - timediff.tv_nsec = 0; - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); - } + t = info->curthread; + clock_gettime(CLOCK_REALTIME, &t->after); + t->before = t->after; + print_line_prefix(info); fprintf(info->outfile, "\n"); } static void report_signal(struct trussinfo *info, siginfo_t *si) { - struct timespec timediff; + struct threadinfo *t; char *signame; - if (info->flags & FOLLOWFORKS) - fprintf(info->outfile, "%5d: ", si->si_pid); - if (info->flags & ABSOLUTETIMESTAMPS) { - timespecsubt(&info->curthread->after, &info->start_time, - &timediff); - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); - } - if (info->flags & RELATIVETIMESTAMPS) { - timespecsubt(&info->curthread->after, &info->curthread->before, - &timediff); - fprintf(info->outfile, "%jd.%09ld ", (intmax_t)timediff.tv_sec, - timediff.tv_nsec); - } + t = info->curthread; + clock_gettime(CLOCK_REALTIME, &t->after); + print_line_prefix(info); signame = strsig(si->si_status); fprintf(info->outfile, "SIGNAL %u (%s)\n", si->si_status, signame == NULL ? "?" : signame); @@ -572,7 +570,7 @@ eventloop(struct trussinfo *info) pending_signal = 0; } else if (pl.pl_flags & PL_FLAG_CHILD) { if ((info->flags & COUNTONLY) == 0) - report_new_child(info, si.si_pid); + report_new_child(info); pending_signal = 0; } else { if ((info->flags & NOSIGS) == 0) Modified: stable/10/usr.bin/truss/syscalls.c ============================================================================== --- stable/10/usr.bin/truss/syscalls.c Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/syscalls.c Thu Apr 21 18:44:53 2016 (r298427) @@ -1625,38 +1625,18 @@ print_arg(struct syscall_args *sc, unsig void print_syscall(struct trussinfo *trussinfo) { - struct timespec timediff; struct threadinfo *t; const char *name; char **s_args; int i, len, nargs; - len = 0; t = trussinfo->curthread; - if (trussinfo->flags & FOLLOWFORKS) - len += fprintf(trussinfo->outfile, "%5d: ", - t->proc->pid); name = t->cs.name; nargs = t->cs.nargs; s_args = t->cs.s_args; - if (name != NULL && (strcmp(name, "execve") == 0 || - strcmp(name, "exit") == 0)) { - clock_gettime(CLOCK_REALTIME, &t->after); - } - - if (trussinfo->flags & ABSOLUTETIMESTAMPS) { - timespecsubt(&t->after, &trussinfo->start_time, &timediff); - len += fprintf(trussinfo->outfile, "%jd.%09ld ", - (intmax_t)timediff.tv_sec, timediff.tv_nsec); - } - - if (trussinfo->flags & RELATIVETIMESTAMPS) { - timespecsubt(&t->after, &t->before, &timediff); - len += fprintf(trussinfo->outfile, "%jd.%09ld ", - (intmax_t)timediff.tv_sec, timediff.tv_nsec); - } + len = print_line_prefix(trussinfo); len += fprintf(trussinfo->outfile, "%s(", name); for (i = 0; i < nargs; i++) { @@ -1683,7 +1663,6 @@ print_syscall_ret(struct trussinfo *trus t = trussinfo->curthread; sc = t->cs.sc; if (trussinfo->flags & COUNTONLY) { - clock_gettime(CLOCK_REALTIME, &t->after); timespecsubt(&t->after, &t->before, &timediff); timespecadd(&sc->time, &timediff, &sc->time); sc->ncalls++; Modified: stable/10/usr.bin/truss/truss.1 ============================================================================== --- stable/10/usr.bin/truss/truss.1 Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/truss.1 Thu Apr 21 18:44:53 2016 (r298427) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd October 9, 2015 +.Dd February 23, 2016 .Dt TRUSS 1 .Os .Sh NAME @@ -8,12 +8,12 @@ .Nd trace system calls .Sh SYNOPSIS .Nm -.Op Fl facedDS +.Op Fl facedDHS .Op Fl o Ar file .Op Fl s Ar strsize .Fl p Ar pid .Nm -.Op Fl facedDS +.Op Fl facedDHS .Op Fl o Ar file .Op Fl s Ar strsize .Ar command Op Ar args @@ -32,6 +32,10 @@ Trace descendants of the original traced .Xr fork 2 , .Xr vfork 2 , etc. +To distinguish events between processes, +the process ID +.Pq PID +of the process is included in the output of each event. .It Fl a Show the argument strings that are passed in each .Xr execve 2 @@ -52,6 +56,8 @@ since the trace was started. .It Fl D Include timestamps in the output showing the time elapsed since the last recorded event. +.It Fl H +Include the thread ID of in the output of each event. .It Fl S Do not display information about signals received by the process. (Normally, Modified: stable/10/usr.bin/truss/truss.h ============================================================================== --- stable/10/usr.bin/truss/truss.h Thu Apr 21 18:37:36 2016 (r298426) +++ stable/10/usr.bin/truss/truss.h Thu Apr 21 18:44:53 2016 (r298427) @@ -35,6 +35,7 @@ #define EXECVEARGS 0x00000010 #define EXECVEENVS 0x00000020 #define COUNTONLY 0x00000040 +#define DISPLAYTIDS 0x00000080 struct procinfo; struct trussinfo; From owner-svn-src-stable@freebsd.org Thu Apr 21 19:24:38 2016 Return-Path: Delivered-To: svn-src-stable@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 8DF01B179A5; Thu, 21 Apr 2016 19:24:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 476A41D6D; Thu, 21 Apr 2016 19:24:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LJObIi007437; Thu, 21 Apr 2016 19:24:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LJOabk007432; Thu, 21 Apr 2016 19:24:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604211924.u3LJOabk007432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Apr 2016 19:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298429 - in stable/10: . sys/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 19:24:38 -0000 Author: emaste Date: Thu Apr 21 19:24:36 2016 New Revision: 298429 URL: https://svnweb.freebsd.org/changeset/base/298429 Log: Fix compiled-in keymap generation for sc/vt consoles In r298297 kbdcontrol's -P option was MFC'd to stable/10, which enables this change for a simplified compile-time default keymap build process. PR: 193865 MFC of: r296899, r296914, r297363, r298402 Modified: stable/10/Makefile.inc1 stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/conf/files.pc98 stable/10/sys/conf/files.sparc64 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Thu Apr 21 18:58:06 2016 (r298428) +++ stable/10/Makefile.inc1 Thu Apr 21 19:24:36 2016 (r298429) @@ -1321,6 +1321,12 @@ _cat= bin/cat _awk= usr.bin/awk .endif +# r296926 -P keymap search path, MFC to stable/10 in r298297 +.if ${BOOTSTRAPPING} < 1003501 || \ + (${BOOTSTRAPPING} >= 1100000 && ${BOOTSTRAPPING} < 1100103) +_kbdcontrol= usr.sbin/kbdcontrol +.endif + .if ${MK_BSNMP} != "no" _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif @@ -1391,6 +1397,7 @@ bootstrap-tools: .PHONY ${_dtc} \ ${_awk} \ ${_cat} \ + ${_kbdcontrol} \ usr.bin/lorder \ usr.bin/makewhatis \ ${_mklocale} \ Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Thu Apr 21 18:58:06 2016 (r298428) +++ stable/10/sys/conf/files.amd64 Thu Apr 21 19:24:36 2016 (r298429) @@ -50,12 +50,12 @@ font.h optional sc_dflt_font \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" # atkbdmap.h optional atkbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Thu Apr 21 18:58:06 2016 (r298428) +++ stable/10/sys/conf/files.i386 Thu Apr 21 19:24:36 2016 (r298429) @@ -49,12 +49,12 @@ font.h optional sc_dflt_font \ clean "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8" # atkbdmap.h optional atkbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # Modified: stable/10/sys/conf/files.pc98 ============================================================================== --- stable/10/sys/conf/files.pc98 Thu Apr 21 18:58:06 2016 (r298428) +++ stable/10/sys/conf/files.pc98 Thu Apr 21 19:24:36 2016 (r298429) @@ -46,7 +46,7 @@ svr4_assym.h optional compat_svr4 \ clean "svr4_assym.h" # ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # Modified: stable/10/sys/conf/files.sparc64 ============================================================================== --- stable/10/sys/conf/files.sparc64 Thu Apr 21 18:58:06 2016 (r298428) +++ stable/10/sys/conf/files.sparc64 Thu Apr 21 19:24:36 2016 (r298429) @@ -8,17 +8,17 @@ # dependency lines other than the first are silently ignored. # atkbdmap.h optional atkbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "atkbdmap.h" # sunkbdmap.h optional sunkbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${SUNKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > sunkbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${SUNKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > sunkbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "sunkbdmap.h" # ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "/usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ no-obj no-implicit-rule before-depend \ clean "ukbdmap.h" # From owner-svn-src-stable@freebsd.org Thu Apr 21 19:25:35 2016 Return-Path: Delivered-To: svn-src-stable@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 34D86B17AA2; Thu, 21 Apr 2016 19:25:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 105C71EE3; Thu, 21 Apr 2016 19:25:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3LJPYAe007549; Thu, 21 Apr 2016 19:25:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3LJPXgS007543; Thu, 21 Apr 2016 19:25:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604211925.u3LJPXgS007543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Apr 2016 19:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298430 - in stable/10/sys: conf dev/kbdmux modules/kbdmux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 19:25:35 -0000 Author: emaste Date: Thu Apr 21 19:25:33 2016 New Revision: 298430 URL: https://svnweb.freebsd.org/changeset/base/298430 Log: MFC r297685: Add option to specify built-in keymap for kbdmux PR: 153459 Submitted by: swell.k@gmail.com Modified: stable/10/sys/conf/NOTES stable/10/sys/conf/files stable/10/sys/conf/options stable/10/sys/dev/kbdmux/kbdmux.c stable/10/sys/modules/kbdmux/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Thu Apr 21 19:24:36 2016 (r298429) +++ stable/10/sys/conf/NOTES Thu Apr 21 19:25:33 2016 (r298430) @@ -1413,6 +1413,10 @@ options MSGBUF_SIZE=40960 options KBD_DISABLE_KEYMAP_LOAD # refuse to load a keymap options KBD_INSTALL_CDEV # install a CDEV entry in /dev +device kbdmux # keyboard multiplexer +options KBDMUX_DFLT_KEYMAP # specify the built-in keymap +makeoptions KBDMUX_DFLT_KEYMAP=it.iso + options FB_DEBUG # Frame buffer debugging device splash # Splash screen and screen saver support Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Thu Apr 21 19:24:36 2016 (r298429) +++ stable/10/sys/conf/files Thu Apr 21 19:25:33 2016 (r298430) @@ -47,6 +47,10 @@ pccarddevs.h standard \ compile-with "${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \ no-obj no-implicit-rule before-depend \ clean "pccarddevs.h" +kbdmuxmap.h optional kbdmux_dflt_keymap \ + compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${KBDMUX_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > kbdmuxmap.h" \ + no-obj no-implicit-rule before-depend \ + clean "kbdmuxmap.h" teken_state.h optional sc | vt \ dependency "$S/teken/gensequences $S/teken/sequences" \ compile-with "${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \ Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Thu Apr 21 19:24:36 2016 (r298429) +++ stable/10/sys/conf/options Thu Apr 21 19:25:33 2016 (r298430) @@ -796,6 +796,8 @@ KBD_MAXWAIT opt_kbd.h KBD_RESETDELAY opt_kbd.h KBDIO_DEBUG opt_kbd.h +KBDMUX_DFLT_KEYMAP opt_kbdmux.h + # options for the Atheros driver ATH_DEBUG opt_ath.h ATH_TXBUF opt_ath.h Modified: stable/10/sys/dev/kbdmux/kbdmux.c ============================================================================== --- stable/10/sys/dev/kbdmux/kbdmux.c Thu Apr 21 19:24:36 2016 (r298429) +++ stable/10/sys/dev/kbdmux/kbdmux.c Thu Apr 21 19:25:33 2016 (r298430) @@ -33,6 +33,7 @@ #include "opt_compat.h" #include "opt_kbd.h" +#include "opt_kbdmux.h" #include #include @@ -54,6 +55,13 @@ #include #include #include + +/* the initial key map, accent map and fkey strings */ +#ifdef KBDMUX_DFLT_KEYMAP +#define KBD_DFLT_KEYMAP +#include "kbdmuxmap.h" +#endif + #include #define KEYBOARD_NAME "kbdmux" Modified: stable/10/sys/modules/kbdmux/Makefile ============================================================================== --- stable/10/sys/modules/kbdmux/Makefile Thu Apr 21 19:24:36 2016 (r298429) +++ stable/10/sys/modules/kbdmux/Makefile Thu Apr 21 19:25:33 2016 (r298430) @@ -4,7 +4,7 @@ .PATH: ${.CURDIR}/../../dev/kbdmux KMOD= kbdmux -SRCS= kbdmux.c opt_compat.h opt_kbd.h bus_if.h device_if.h +SRCS= kbdmux.c opt_compat.h opt_kbd.h opt_kbdmux.h bus_if.h device_if.h .if !defined(KERNBUILDDIR) opt_compat.h: From owner-svn-src-stable@freebsd.org Fri Apr 22 08:49:52 2016 Return-Path: Delivered-To: svn-src-stable@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 44EB8B17D80; Fri, 22 Apr 2016 08:49:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 11EF018B6; Fri, 22 Apr 2016 08:49:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3M8np1s049091; Fri, 22 Apr 2016 08:49:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3M8npX1049090; Fri, 22 Apr 2016 08:49:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604220849.u3M8npX1049090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 22 Apr 2016 08:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298465 - stable/10/sys/ddb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 08:49:52 -0000 Author: kib Date: Fri Apr 22 08:49:50 2016 New Revision: 298465 URL: https://svnweb.freebsd.org/changeset/base/298465 Log: MFC r298043: Avoid NULL pointer dereference. Modified: stable/10/sys/ddb/db_ps.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ddb/db_ps.c ============================================================================== --- stable/10/sys/ddb/db_ps.c Fri Apr 22 08:11:26 2016 (r298464) +++ stable/10/sys/ddb/db_ps.c Fri Apr 22 08:49:50 2016 (r298465) @@ -181,7 +181,8 @@ db_ps(db_expr_t addr, boolean_t hasaddr, strlcat(state, "V", sizeof(state)); if (p->p_flag & P_SYSTEM || p->p_lock > 0) strlcat(state, "L", sizeof(state)); - if (p->p_session != NULL && SESS_LEADER(p)) + if (p->p_pgrp != NULL && p->p_session != NULL && + SESS_LEADER(p)) strlcat(state, "s", sizeof(state)); /* Cheated here and didn't compare pgid's. */ if (p->p_flag & P_CONTROLT) From owner-svn-src-stable@freebsd.org Fri Apr 22 08:56:49 2016 Return-Path: Delivered-To: svn-src-stable@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 2ECE9B180E0; Fri, 22 Apr 2016 08:56:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 F00D51D2E; Fri, 22 Apr 2016 08:56:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3M8umFf052174; Fri, 22 Apr 2016 08:56:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3M8umD8052173; Fri, 22 Apr 2016 08:56:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604220856.u3M8umD8052173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 22 Apr 2016 08:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298466 - stable/9/sys/ddb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 08:56:49 -0000 Author: kib Date: Fri Apr 22 08:56:47 2016 New Revision: 298466 URL: https://svnweb.freebsd.org/changeset/base/298466 Log: MFC r298043: Avoid NULL pointer dereference. Modified: stable/9/sys/ddb/db_ps.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ddb/db_ps.c ============================================================================== --- stable/9/sys/ddb/db_ps.c Fri Apr 22 08:49:50 2016 (r298465) +++ stable/9/sys/ddb/db_ps.c Fri Apr 22 08:56:47 2016 (r298466) @@ -181,7 +181,8 @@ db_ps(db_expr_t addr, boolean_t hasaddr, strlcat(state, "V", sizeof(state)); if (p->p_flag & P_SYSTEM || p->p_lock > 0) strlcat(state, "L", sizeof(state)); - if (p->p_session != NULL && SESS_LEADER(p)) + if (p->p_pgrp != NULL && p->p_session != NULL && + SESS_LEADER(p)) strlcat(state, "s", sizeof(state)); /* Cheated here and didn't compare pgid's. */ if (p->p_flag & P_CONTROLT) From owner-svn-src-stable@freebsd.org Fri Apr 22 12:48:54 2016 Return-Path: Delivered-To: svn-src-stable@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 9FC9DB18210; Fri, 22 Apr 2016 12:48:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 694CB19A7; Fri, 22 Apr 2016 12:48:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MCmrad024149; Fri, 22 Apr 2016 12:48:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MCmr2B024148; Fri, 22 Apr 2016 12:48:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604221248.u3MCmr2B024148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Apr 2016 12:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298469 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 12:48:54 -0000 Author: avg Date: Fri Apr 22 12:48:53 2016 New Revision: 298469 URL: https://svnweb.freebsd.org/changeset/base/298469 Log: MFC r297709: zio write issue threads should have lower (numerically greater) priority Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 22 09:46:22 2016 (r298468) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 22 12:48:53 2016 (r298469) @@ -930,7 +930,7 @@ spa_taskqs_init(spa_t *spa, zio_type_t t * than the other taskqs. */ if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE) - pri--; + pri++; tq = taskq_create_proc(name, value, pri, 50, INT_MAX, spa->spa_proc, flags); From owner-svn-src-stable@freebsd.org Fri Apr 22 12:49:01 2016 Return-Path: Delivered-To: svn-src-stable@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 C8076B1825D; Fri, 22 Apr 2016 12:49:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 6EF9C1A9D; Fri, 22 Apr 2016 12:49:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MCn00V024203; Fri, 22 Apr 2016 12:49:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MCn0Fc024202; Fri, 22 Apr 2016 12:49:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201604221249.u3MCn0Fc024202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Apr 2016 12:49:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298470 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 12:49:02 -0000 Author: avg Date: Fri Apr 22 12:49:00 2016 New Revision: 298470 URL: https://svnweb.freebsd.org/changeset/base/298470 Log: MFC r297709: zio write issue threads should have lower (numerically greater) priority Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 22 12:48:53 2016 (r298469) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Fri Apr 22 12:49:00 2016 (r298470) @@ -902,7 +902,7 @@ spa_taskqs_init(spa_t *spa, zio_type_t t * than the other taskqs. */ if (t == ZIO_TYPE_WRITE && q == ZIO_TASKQ_ISSUE) - pri--; + pri++; tq = taskq_create_proc(name, value, pri, 50, INT_MAX, spa->spa_proc, flags); From owner-svn-src-stable@freebsd.org Fri Apr 22 21:26:16 2016 Return-Path: Delivered-To: svn-src-stable@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 67D33B18499; Fri, 22 Apr 2016 21:26:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 39A5D1072; Fri, 22 Apr 2016 21:26:16 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLQFtq082111; Fri, 22 Apr 2016 21:26:15 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLQFNV082110; Fri, 22 Apr 2016 21:26:15 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604222126.u3MLQFNV082110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 22 Apr 2016 21:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298488 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:26:16 -0000 Author: ngie Date: Fri Apr 22 21:26:15 2016 New Revision: 298488 URL: https://svnweb.freebsd.org/changeset/base/298488 Log: MFC r298303: Remove trailing whitespace and use `nitems(mib)` instead of `2` when calling sysctl(3) Modified: stable/10/lib/libc/gen/getpagesize.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/getpagesize.c ============================================================================== --- stable/10/lib/libc/gen/getpagesize.c Fri Apr 22 20:31:29 2016 (r298487) +++ stable/10/lib/libc/gen/getpagesize.c Fri Apr 22 21:26:15 2016 (r298488) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); int getpagesize() { - int mib[2]; + int mib[2]; static int value; size_t size; int error; @@ -68,7 +68,7 @@ getpagesize() mib[0] = CTL_HW; mib[1] = HW_PAGESIZE; size = sizeof value; - if (sysctl(mib, 2, &value, &size, NULL, 0) == -1) + if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1) return (-1); return (value); From owner-svn-src-stable@freebsd.org Fri Apr 22 21:28:51 2016 Return-Path: Delivered-To: svn-src-stable@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 3D16FB1857F; Fri, 22 Apr 2016 21:28:51 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0EEEC11F3; Fri, 22 Apr 2016 21:28:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLSoNI082276; Fri, 22 Apr 2016 21:28:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLSoGM082275; Fri, 22 Apr 2016 21:28:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604222128.u3MLSoGM082275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 22 Apr 2016 21:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298489 - stable/9/lib/libc/gen X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:28:51 -0000 Author: ngie Date: Fri Apr 22 21:28:50 2016 New Revision: 298489 URL: https://svnweb.freebsd.org/changeset/base/298489 Log: MFstable/10 r298488: MFC r298303: Remove trailing whitespace and use `nitems(mib)` instead of `2` when calling sysctl(3) Modified: stable/9/lib/libc/gen/getpagesize.c Directory Properties: stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/getpagesize.c ============================================================================== --- stable/9/lib/libc/gen/getpagesize.c Fri Apr 22 21:26:15 2016 (r298488) +++ stable/9/lib/libc/gen/getpagesize.c Fri Apr 22 21:28:50 2016 (r298489) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); int getpagesize() { - int mib[2]; + int mib[2]; static int value; size_t size; int error; @@ -68,7 +68,7 @@ getpagesize() mib[0] = CTL_HW; mib[1] = HW_PAGESIZE; size = sizeof value; - if (sysctl(mib, 2, &value, &size, NULL, 0) == -1) + if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1) return (-1); return (value); From owner-svn-src-stable@freebsd.org Fri Apr 22 21:30:44 2016 Return-Path: Delivered-To: svn-src-stable@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 038DEB1863D; Fri, 22 Apr 2016 21:30:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B010E1389; Fri, 22 Apr 2016 21:30:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLUghP082439; Fri, 22 Apr 2016 21:30:42 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLUgGq082437; Fri, 22 Apr 2016 21:30:42 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604222130.u3MLUgGq082437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 22 Apr 2016 21:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298490 - stable/10/tests/sys/file X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:30:44 -0000 Author: ngie Date: Fri Apr 22 21:30:42 2016 New Revision: 298490 URL: https://svnweb.freebsd.org/changeset/base/298490 Log: MFC r298024,r298196: r298024: Set test_argv to NULL, not 0, if not executing a specific test r298196: Minor cosmetic cleanup - Remove spurious trailing whitespace in licensing header - Remove unnecessary semi-colon after comment Modified: stable/10/tests/sys/file/flock_helper.c stable/10/tests/sys/file/newfileops_on_fork_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/file/flock_helper.c ============================================================================== --- stable/10/tests/sys/file/flock_helper.c Fri Apr 22 21:28:50 2016 (r298489) +++ stable/10/tests/sys/file/flock_helper.c Fri Apr 22 21:30:42 2016 (r298490) @@ -1566,7 +1566,7 @@ main(int argc, const char *argv[]) } else { testnum = 0; test_argc = 0; - test_argv = 0; + test_argv = NULL; } sa.sa_handler = ignore_alarm; Modified: stable/10/tests/sys/file/newfileops_on_fork_test.c ============================================================================== --- stable/10/tests/sys/file/newfileops_on_fork_test.c Fri Apr 22 21:28:50 2016 (r298489) +++ stable/10/tests/sys/file/newfileops_on_fork_test.c Fri Apr 22 21:30:42 2016 (r298490) @@ -3,7 +3,7 @@ * All rights reserved. * * This software was developed at the University of Cambridge Computer - * Laboratory with support from a grant from Google, Inc. + * Laboratory with support from a grant from Google, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -115,7 +115,7 @@ main(__unused int argc, __unused char *a err(-1, "listen"); if (pthread_create(&accept_thread, NULL, do_accept, NULL) != 0) err(-1, "pthread_create"); - sleep(1); /* Easier than using a CV. */; + sleep(1); /* Easier than using a CV. */ do_fork(); exit(0); } From owner-svn-src-stable@freebsd.org Fri Apr 22 21:32:02 2016 Return-Path: Delivered-To: svn-src-stable@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 5B34BB1879E; Fri, 22 Apr 2016 21:32:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2CA891734; Fri, 22 Apr 2016 21:32:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLW11j083177; Fri, 22 Apr 2016 21:32:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLW1jx083176; Fri, 22 Apr 2016 21:32:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604222132.u3MLW1jx083176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 22 Apr 2016 21:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298491 - stable/10/lib/msun/tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:32:02 -0000 Author: ngie Date: Fri Apr 22 21:32:01 2016 New Revision: 298491 URL: https://svnweb.freebsd.org/changeset/base/298491 Log: MFC r297836: Fix appending -O0 to CFLAGS The previous method would completely nerf CFLAGS once bsd.progs.mk had recursed into the per-PROG logic and make the CFLAGS for tap testcases to -O0, instead of appending to CFLAGS for all of the tap testcases. Modified: stable/10/lib/msun/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/msun/tests/Makefile ============================================================================== --- stable/10/lib/msun/tests/Makefile Fri Apr 22 21:30:42 2016 (r298490) +++ stable/10/lib/msun/tests/Makefile Fri Apr 22 21:32:01 2016 (r298491) @@ -58,9 +58,9 @@ TAP_TESTS_C+= next_test TAP_TESTS_C+= rem_test TAP_TESTS_C+= trig_test -.for t in ${TAP_TESTS_C} -CFLAGS.$t+= -O0 -.endfor +.if !empty(PROG) && !empty(TAP_TESTS_C:M${PROG}) +CFLAGS+= -O0 +.endif CSTD= c99 From owner-svn-src-stable@freebsd.org Fri Apr 22 21:33:13 2016 Return-Path: Delivered-To: svn-src-stable@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 25452B1889B; Fri, 22 Apr 2016 21:33:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 E6CA61B7C; Fri, 22 Apr 2016 21:33:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLXCnv085249; Fri, 22 Apr 2016 21:33:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLXCTb085248; Fri, 22 Apr 2016 21:33:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604222133.u3MLXCTb085248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 22 Apr 2016 21:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298492 - stable/10/usr.sbin/kldxref X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:33:13 -0000 Author: emaste Date: Fri Apr 22 21:33:11 2016 New Revision: 298492 URL: https://svnweb.freebsd.org/changeset/base/298492 Log: MFC r275940 (imp): Bump the largest record we can cope with from 1k to 8k. Other users of the hints file don't have any real limits, and longer records will need to be written shortly. Modified: stable/10/usr.sbin/kldxref/kldxref.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kldxref/kldxref.c ============================================================================== --- stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:32:01 2016 (r298491) +++ stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:33:11 2016 (r298492) @@ -53,7 +53,7 @@ #include "ef.h" -#define MAXRECSIZE 1024 +#define MAXRECSIZE 8192 #define check(val) if ((error = (val)) != 0) break static int dflag; /* do not create a hint file, only write on stdout */ From owner-svn-src-stable@freebsd.org Fri Apr 22 21:38:39 2016 Return-Path: Delivered-To: svn-src-stable@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 0C799B1898B; Fri, 22 Apr 2016 21:38:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 A6EE11D69; Fri, 22 Apr 2016 21:38:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLcbhQ085527; Fri, 22 Apr 2016 21:38:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLcbwE085524; Fri, 22 Apr 2016 21:38:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604222138.u3MLcbwE085524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 22 Apr 2016 21:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298493 - in stable/10: sys/boot/common sys/sys usr.sbin/kldxref X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:38:39 -0000 Author: emaste Date: Fri Apr 22 21:38:37 2016 New Revision: 298493 URL: https://svnweb.freebsd.org/changeset/base/298493 Log: MFC r277205 (imp): Reserve and ignore the a new module metadata type MDT_PNP_INFO for associating an optional PNP hint table with this module. In the future, when these are added, these changes will silently ignore the new type they would otherwise warn about. It will always be safe to ignore this data. Get this into the builds today for some future proofing. Modified: stable/10/sys/boot/common/load_elf_obj.c stable/10/sys/sys/module.h stable/10/usr.sbin/kldxref/kldxref.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/common/load_elf_obj.c ============================================================================== --- stable/10/sys/boot/common/load_elf_obj.c Fri Apr 22 21:33:11 2016 (r298492) +++ stable/10/sys/boot/common/load_elf_obj.c Fri Apr 22 21:38:37 2016 (r298493) @@ -412,6 +412,7 @@ __elfN(obj_parse_modmetadata)(struct pre modcnt++; break; case MDT_MODULE: + case MDT_PNP_INFO: break; default: printf("unknown type %d\n", md.md_type); Modified: stable/10/sys/sys/module.h ============================================================================== --- stable/10/sys/sys/module.h Fri Apr 22 21:33:11 2016 (r298492) +++ stable/10/sys/sys/module.h Fri Apr 22 21:38:37 2016 (r298493) @@ -35,6 +35,7 @@ #define MDT_DEPEND 1 /* argument is a module name */ #define MDT_MODULE 2 /* module declaration */ #define MDT_VERSION 3 /* module version(s) */ +#define MDT_PNP_INFO 4 /* Plug and play hints record */ #define MDT_STRUCT_VERSION 1 /* version of metadata structure */ #define MDT_SETNAME "modmetadata_set" Modified: stable/10/usr.sbin/kldxref/kldxref.c ============================================================================== --- stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:33:11 2016 (r298492) +++ stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:38:37 2016 (r298493) @@ -172,6 +172,10 @@ parse_entry(struct mod_metadata *md, con record_string(kldname); } break; + case MDT_PNP_INFO: + if (dflag) { + printf(" pnp info for bus %s\n", cval); + } default: warnx("unknown metadata record %d in file %s", md->md_type, kldname); } From owner-svn-src-stable@freebsd.org Fri Apr 22 21:43:46 2016 Return-Path: Delivered-To: svn-src-stable@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 F3AD1B18C18; Fri, 22 Apr 2016 21:43:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 C54911281; Fri, 22 Apr 2016 21:43:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3MLhjx8088577; Fri, 22 Apr 2016 21:43:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3MLhjbW088576; Fri, 22 Apr 2016 21:43:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201604222143.u3MLhjbW088576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 22 Apr 2016 21:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298494 - stable/10/usr.sbin/kldxref X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:43:46 -0000 Author: emaste Date: Fri Apr 22 21:43:44 2016 New Revision: 298494 URL: https://svnweb.freebsd.org/changeset/base/298494 Log: MFC r288490: Add debug file extension to kldxref(8) After r288176 [in head] kernel debug files have the extension .debug. They also moved [in head] 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. Merged this change to avoid warnings when a stable/10 kldxref runs against a head install, perhaps on an upgrade to 11-CURRENT. The change to kernel debug files will not be merged to stable/10. Modified: stable/10/usr.sbin/kldxref/kldxref.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kldxref/kldxref.c ============================================================================== --- stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:38:37 2016 (r298493) +++ stable/10/usr.sbin/kldxref/kldxref.c Fri Apr 22 21:43:44 2016 (r298494) @@ -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-stable@freebsd.org Fri Apr 22 21:49:49 2016 Return-Path: Delivered-To: svn-src-stable@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 5862CB18EAE; Fri, 22 Apr 2016 21:49:49 +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 396E017C7; Fri, 22 Apr 2016 21:49:49 +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 00491B94A; Fri, 22 Apr 2016 17:49:48 -0400 (EDT) From: John Baldwin To: Garrett Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r298491 - stable/10/lib/msun/tests Date: Fri, 22 Apr 2016 14:49:43 -0700 Message-ID: <1686086.xOFMeakFfv@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201604222132.u3MLW1jx083176@repo.freebsd.org> References: <201604222132.u3MLW1jx083176@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); Fri, 22 Apr 2016 17:49:48 -0400 (EDT) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:49:49 -0000 On Friday, April 22, 2016 09:32:01 PM Garrett Cooper wrote: > Author: ngie > Date: Fri Apr 22 21:32:01 2016 > New Revision: 298491 > URL: https://svnweb.freebsd.org/changeset/base/298491 > > Log: > MFC r297836: > > Fix appending -O0 to CFLAGS > > The previous method would completely nerf CFLAGS once bsd.progs.mk had > recursed into the per-PROG logic and make the CFLAGS for tap testcases > to -O0, instead of appending to CFLAGS for all of the tap testcases. Eh, Bryan replied to the commit that put this into HEAD saying it was a no-op but you didn't reply. Shouldn't you address that first before MFC'ing? -- John Baldwin From owner-svn-src-stable@freebsd.org Fri Apr 22 21:53:28 2016 Return-Path: Delivered-To: svn-src-stable@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 638EDB19045; Fri, 22 Apr 2016 21:53:28 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com [IPv6:2a00:1450:4010:c04::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 D50DD1BCE; Fri, 22 Apr 2016 21:53:27 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-lb0-x22f.google.com with SMTP id jj5so3826648lbc.0; Fri, 22 Apr 2016 14:53:27 -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; bh=az4hXxJR6UoNjrSq0fqkvvoYlCE0IO4HHPZzdVf0F6M=; b=WHUUgcLCcbWqtoJQlW3mEgDKaqYVf1uUO7Cardl5L8aGcjtpiq+3EK0l9qzz6tt8qZ vVJtNnjgk99nH64VivAjEtVYH8AIkXYrGSUPAJIem3SAMKVIUQrx6Mjqt6bJUHv2zYfF iiddm6LUlvKQis9uQ2XJQ9llUSCfW2Z8wZSU80VwJvUnJIToPP/X2aUIAAXAN5+oagny icGV6FYb5o2Is2qSA4hfZPLcIDp2Fj9hbwHQadHALodFDtghIGIRI2kLB4vRZV01Vf1y hx7mIxbxAWRk+hfMwW5y7jMioTvm/arn81nEcBXb5cFjQlGDGiEJhY17dMqgeNicc5lg FRxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=az4hXxJR6UoNjrSq0fqkvvoYlCE0IO4HHPZzdVf0F6M=; b=cxoMPSjHRDqe7uXC2RnmhTxkhMfiVEy+VdP1um5TzfNsrGpIfTJ71wDP/MVpTRpxkU yVpMBtgTtdcK+gTOjGX1wXxE/CU7+C63YeXVqsxb1d9pv1VKmB3QBvN8ULwHVLCN9vfj IVfJv5lfnKttRQOZ4wzD84iXEgepCExMgg8rN/0Dg02FL2Jk4NDkdgAfs1KfSKkI4S7g 6ZcOnDSVvKsWLoHrz5Jai+7E2YEAnrKRxblame3mKvfEXgOzLEJmesOayzF4rvuNrnUo us3KGAE8mCiA6O2U38A1lB1vWun6t+E8X55usGPNvWUlLiGJk/yyyA51otbmQf/l9j0A EHrg== X-Gm-Message-State: AOPr4FWcMOr+ruSSLBqJW+N+NYO9ZVV+juwEkx/oAKU+BhG95Eq2C0OsB4LD/UtZaGEk4luM8bBN8RDxIbhXIg== MIME-Version: 1.0 X-Received: by 10.112.189.1 with SMTP id ge1mr9438185lbc.9.1461362004947; Fri, 22 Apr 2016 14:53:24 -0700 (PDT) Received: by 10.112.236.33 with HTTP; Fri, 22 Apr 2016 14:53:24 -0700 (PDT) In-Reply-To: <1686086.xOFMeakFfv@ralph.baldwin.cx> References: <201604222132.u3MLW1jx083176@repo.freebsd.org> <1686086.xOFMeakFfv@ralph.baldwin.cx> Date: Fri, 22 Apr 2016 14:53:24 -0700 Message-ID: Subject: Re: svn commit: r298491 - stable/10/lib/msun/tests From: Ngie Cooper To: John Baldwin Cc: Garrett Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Apr 2016 21:53:28 -0000 On Fri, Apr 22, 2016 at 2:49 PM, John Baldwin wrote: > On Friday, April 22, 2016 09:32:01 PM Garrett Cooper wrote: >> Author: ngie >> Date: Fri Apr 22 21:32:01 2016 >> New Revision: 298491 >> URL: https://svnweb.freebsd.org/changeset/base/298491 >> >> Log: >> MFC r297836: >> >> Fix appending -O0 to CFLAGS >> >> The previous method would completely nerf CFLAGS once bsd.progs.mk had >> recursed into the per-PROG logic and make the CFLAGS for tap testcases >> to -O0, instead of appending to CFLAGS for all of the tap testcases. > > Eh, Bryan replied to the commit that put this into HEAD saying it was a > no-op but you didn't reply. Shouldn't you address that first before MFC'ing? Yeah, I should have... I'll do that now. From owner-svn-src-stable@freebsd.org Sat Apr 23 07:09:24 2016 Return-Path: Delivered-To: svn-src-stable@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 A8781B1953C; Sat, 23 Apr 2016 07:09:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 728611504; Sat, 23 Apr 2016 07:09:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3N79NBB063035; Sat, 23 Apr 2016 07:09:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3N79N4R063031; Sat, 23 Apr 2016 07:09:23 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201604230709.u3N79N4R063031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 23 Apr 2016 07:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298503 - in stable/10: kerberos5/lib/libroken share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2016 07:09:24 -0000 Author: ngie Date: Sat Apr 23 07:09:23 2016 New Revision: 298503 URL: https://svnweb.freebsd.org/changeset/base/298503 Log: MFC r297282,r297456,r298012,r298013,r298014: r297282 (by bdrewery): We don't have a CPPFLAGS, COPTS or CPUFLAGS. r297456 (by bdrewery): We don't support DPLIBS. r298012: Add DEBUG_FLAGS to PROG_VARS and STRIP to PROG_OVERRIDE_VARS This will allow the variables [*] to be overridden on a per-PROG basis, which is useful when controlling "stripping" behavior for some tests that require debug symbols or to be unstripped DEBUG_FLAGS (similar to CFLAGS) supports appending, whereas STRIP is an override *: Due to how STRIP is defined in bsd.own.mk (in addition to bsd.lib.mk and bsd.prog.mk), and the fact that bsd.test.mk pulls in bsd.own.mk first, overriding STRIP doesn't work today. A follow up commit is pending to "rectify" this after additional testing is done. Discussed with: bdrewery r298013: Commit documentation change for r298012 Requested by: bdrewery r298014: Regenerate the list of bsd.progs.mk supported variables Prefix with dashes (unordered list) and put one variable on each line (to avoid future conflicts) Done via the following one-liner: > sh -c 'for i in $(make -C tests/sys/aio PROG=foo -VPROG_VARS:O); do printf "\t\t- $i\n"; done' Modified: stable/10/kerberos5/lib/libroken/Makefile stable/10/share/mk/bsd.README stable/10/share/mk/bsd.prog.mk stable/10/share/mk/bsd.progs.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/kerberos5/lib/libroken/Makefile ============================================================================== --- stable/10/kerberos5/lib/libroken/Makefile Sat Apr 23 06:31:46 2016 (r298502) +++ stable/10/kerberos5/lib/libroken/Makefile Sat Apr 23 07:09:23 2016 (r298503) @@ -77,7 +77,6 @@ SRCS= base64.c \ write_pid.c \ xfree.c -CPPFLAGS+= -DBUILD_ROKEN_LIB CFLAGS+=-I${KRB5DIR}/lib/roken -I. CLEANFILES= roken.h Modified: stable/10/share/mk/bsd.README ============================================================================== --- stable/10/share/mk/bsd.README Sat Apr 23 06:31:46 2016 (r298502) +++ stable/10/share/mk/bsd.README Sat Apr 23 07:09:23 2016 (r298503) @@ -262,9 +262,26 @@ PROGS_CXX PROG and PROGS_CXX in one Make LDADD.foo= -lutil SRCS.bar= bar_src.c - The supported variables are BINDIR BINGRP BINMODE BINOWN - CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS DPSRCS LDADD - LDFLAGS MAN MLINKS PROGNAME SRCS. + The supported variables are: + - BINDIR + - BINGRP + - BINMODE + - BINOWN + - CFLAGS + - CXXFLAGS + - DEBUG_FLAGS + - DPADD + - DPSRCS + - LDADD + - LDFLAGS + - LINKS + - MAN + - MLINKS + - NO_WERROR + - PROGNAME + - SRCS + - STRIP + - WARNS PROGNAME The name that the above program will be installed as, if different from ${PROG}. Modified: stable/10/share/mk/bsd.prog.mk ============================================================================== --- stable/10/share/mk/bsd.prog.mk Sat Apr 23 06:31:46 2016 (r298502) +++ stable/10/share/mk/bsd.prog.mk Sat Apr 23 07:09:23 2016 (r298503) @@ -7,6 +7,7 @@ # XXX The use of COPTS in modern makefiles is discouraged. .if defined(COPTS) +.warning COPTS should be CFLAGS. CFLAGS+=${COPTS} .endif Modified: stable/10/share/mk/bsd.progs.mk ============================================================================== --- stable/10/share/mk/bsd.progs.mk Sat Apr 23 06:31:46 2016 (r298502) +++ stable/10/share/mk/bsd.progs.mk Sat Apr 23 07:09:23 2016 (r298503) @@ -34,8 +34,8 @@ UPDATE_DEPENDFILE_PROG?= no .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \ - PROGNAME SRCS WARNS -PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LINKS \ + PROGNAME SRCS STRIP WARNS +PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD LDADD LIBADD LINKS \ LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} .if empty(${PROG_OVERRIDE_VARS:M$v}) From owner-svn-src-stable@freebsd.org Sat Apr 23 07:36:14 2016 Return-Path: Delivered-To: svn-src-stable@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 C1C2AB19E0D; Sat, 23 Apr 2016 07:36:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9C82A13C4; Sat, 23 Apr 2016 07:36:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3N7aD4Q072182; Sat, 23 Apr 2016 07:36:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3N7aDRf072180; Sat, 23 Apr 2016 07:36:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201604230736.u3N7aDRf072180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 Apr 2016 07:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298506 - in stable/10/sys/x86: include x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2016 07:36:14 -0000 Author: kib Date: Sat Apr 23 07:36:13 2016 New Revision: 298506 URL: https://svnweb.freebsd.org/changeset/base/298506 Log: MFC r298101: Add x86 CPU features definitions published in the Intel SDM rev. 58. Modified: stable/10/sys/x86/include/specialreg.h stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/include/specialreg.h ============================================================================== --- stable/10/sys/x86/include/specialreg.h Sat Apr 23 07:28:32 2016 (r298505) +++ stable/10/sys/x86/include/specialreg.h Sat Apr 23 07:36:13 2016 (r298506) @@ -331,6 +331,7 @@ */ #define CPUID_STDEXT_FSGSBASE 0x00000001 #define CPUID_STDEXT_TSC_ADJUST 0x00000002 +#define CPUID_STDEXT_SGX 0x00000004 #define CPUID_STDEXT_BMI1 0x00000008 #define CPUID_STDEXT_HLE 0x00000010 #define CPUID_STDEXT_AVX2 0x00000020 @@ -340,7 +341,10 @@ #define CPUID_STDEXT_ERMS 0x00000200 #define CPUID_STDEXT_INVPCID 0x00000400 #define CPUID_STDEXT_RTM 0x00000800 +#define CPUID_STDEXT_PQM 0x00001000 +#define CPUID_STDEXT_NFPUSG 0x00002000 #define CPUID_STDEXT_MPX 0x00004000 +#define CPUID_STDEXT_PQE 0x00008000 #define CPUID_STDEXT_AVX512F 0x00010000 #define CPUID_STDEXT_RDSEED 0x00040000 #define CPUID_STDEXT_ADX 0x00080000 @@ -353,6 +357,16 @@ #define CPUID_STDEXT_SHA 0x20000000 /* + * CPUID instruction 7 Structured Extended Features, leaf 0 ecx info + */ +#define CPUID_STDEXT2_PREFETCHWT1 0x00000001 +#define CPUID_STDEXT2_UMIP 0x00000004 +#define CPUID_STDEXT2_PKU 0x00000008 +#define CPUID_STDEXT2_OSPKE 0x00000010 +#define CPUID_STDEXT2_RDPID 0x00400000 +#define CPUID_STDEXT2_SGXLC 0x40000000 + +/* * CPUID manufacturers identifiers */ #define AMD_VENDOR_ID "AuthenticAMD" Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Sat Apr 23 07:28:32 2016 (r298505) +++ stable/10/sys/x86/x86/identcpu.c Sat Apr 23 07:36:13 2016 (r298506) @@ -888,6 +888,7 @@ printcpuinfo(void) /* RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */ "\001FSGSBASE" "\002TSCADJ" + "\003SGX" /* Bit Manipulation Instructions */ "\004BMI1" /* Hardware Lock Elision */ @@ -907,9 +908,9 @@ printcpuinfo(void) "\014RTM" "\015PQM" "\016NFPUSG" - "\020PQE" /* Intel Memory Protection Extensions */ "\017MPX" + "\020PQE" /* AVX512 Foundation */ "\021AVX512F" /* Enhanced NRBG */ @@ -932,8 +933,11 @@ printcpuinfo(void) cpu_stdext_feature2, "\020" "\001PREFETCHWT1" + "\003UMIP" "\004PKU" "\005OSPKE" + "\027RDPID" + "\037SGXLC" ); } @@ -1880,7 +1884,10 @@ print_INTEL_TLB(u_int data) printf("Instruction TLB: 4 KByte pages, fully associative, 48 entries\n"); break; case 0x63: - printf("Data TLB: 1 GByte pages, 4-way set associative, 4 entries\n"); + printf("Data TLB: 2 MByte or 4 MByte pages, 4-way set associative, 32 entries and a separate array with 1 GByte pages, 4-way set associative, 4 entries\n"); + break; + case 0x64: + printf("Data TLB: 4 KBytes pages, 4-way set associative, 512 entries\n"); break; case 0x66: printf("1st-level data cache: 8 KB, 4-way set associative, sectored cache, 64 byte line size\n"); @@ -1996,6 +2003,9 @@ print_INTEL_TLB(u_int data) case 0xc3: printf("Shared 2nd-Level TLB: 4 KByte /2 MByte pages, 6-way associative, 1536 entries. Also 1GBbyte pages, 4-way, 16 entries\n"); break; + case 0xc4: + printf("DTLB: 2M/4M Byte pages, 4-way associative, 32 entries\n"); + break; case 0xca: printf("Shared 2nd-Level TLB: 4 KByte pages, 4-way associative, 512 entries\n"); break; From owner-svn-src-stable@freebsd.org Sat Apr 23 10:06:59 2016 Return-Path: Delivered-To: svn-src-stable@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 0ED16B190D5; Sat, 23 Apr 2016 10:06:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 B616C144F; Sat, 23 Apr 2016 10:06:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3NA6vgW017442; Sat, 23 Apr 2016 10:06:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3NA6vcu017441; Sat, 23 Apr 2016 10:06:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201604231006.u3NA6vcu017441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Apr 2016 10:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298509 - stable/10/usr.sbin/inetd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2016 10:06:59 -0000 Author: bapt Date: Sat Apr 23 10:06:57 2016 New Revision: 298509 URL: https://svnweb.freebsd.org/changeset/base/298509 Log: MFC: r298111 r298114 Directly set the O_CLOEXEC flags via the open(2) attributes Use the SOCK_CLOEXEC flags in the socket(2) 'type' attribute instead of calling fcntl(2) Sponsored by: Essen Hackathon Modified: stable/10/usr.sbin/inetd/inetd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/inetd/inetd.c ============================================================================== --- stable/10/usr.sbin/inetd/inetd.c Sat Apr 23 09:15:58 2016 (r298508) +++ stable/10/usr.sbin/inetd/inetd.c Sat Apr 23 10:06:57 2016 (r298509) @@ -539,15 +539,10 @@ main(int argc, char **argv) (void)setenv("inetd_dummy", dummy, 1); } - if (pipe(signalpipe) != 0) { + if (pipe2(signalpipe, O_CLOEXEC) != 0) { syslog(LOG_ERR, "pipe: %m"); exit(EX_OSERR); } - if (fcntl(signalpipe[0], F_SETFD, FD_CLOEXEC) < 0 || - fcntl(signalpipe[1], F_SETFD, FD_CLOEXEC) < 0) { - syslog(LOG_ERR, "signalpipe: fcntl (F_SETFD, FD_CLOEXEC): %m"); - exit(EX_OSERR); - } FD_SET(signalpipe[0], &allsock); #ifdef SANITY_CHECK nsock++; @@ -1256,7 +1251,9 @@ setup(struct servtab *sep) { int on = 1; - if ((sep->se_fd = socket(sep->se_family, sep->se_socktype, 0)) < 0) { + /* Set all listening sockets to close-on-exec. */ + if ((sep->se_fd = socket(sep->se_family, + sep->se_socktype | SOCK_CLOEXEC, 0)) < 0) { if (debug) warn("socket failed on %s/%s", sep->se_service, sep->se_proto); @@ -1264,13 +1261,6 @@ setup(struct servtab *sep) sep->se_service, sep->se_proto); return; } - /* Set all listening sockets to close-on-exec. */ - if (fcntl(sep->se_fd, F_SETFD, FD_CLOEXEC) < 0) { - syslog(LOG_ERR, "%s/%s: fcntl (F_SETFD, FD_CLOEXEC): %m", - sep->se_service, sep->se_proto); - close(sep->se_fd); - return; - } #define turnon(fd, opt) \ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (on)) if (strcmp(sep->se_proto, "tcp") == 0 && (options & SO_DEBUG) && From owner-svn-src-stable@freebsd.org Sat Apr 23 10:10:30 2016 Return-Path: Delivered-To: svn-src-stable@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 4FD80B19205; Sat, 23 Apr 2016 10:10:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 219CF170A; Sat, 23 Apr 2016 10:10:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3NAATol017616; Sat, 23 Apr 2016 10:10:29 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3NAATcj017615; Sat, 23 Apr 2016 10:10:29 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201604231010.u3NAATcj017615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 23 Apr 2016 10:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298510 - stable/10/usr.bin/script X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Apr 2016 10:10:30 -0000 Author: bapt Date: Sat Apr 23 10:10:29 2016 New Revision: 298510 URL: https://svnweb.freebsd.org/changeset/base/298510 Log: MFC: 298112 Directly set the O_CLOEXEC flags via the open(2) attributes Sponsored by: Essen Hackathon Modified: stable/10/usr.bin/script/script.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/script/script.c ============================================================================== --- stable/10/usr.bin/script/script.c Sat Apr 23 10:06:57 2016 (r298509) +++ stable/10/usr.bin/script/script.c Sat Apr 23 10:10:29 2016 (r298510) @@ -158,17 +158,14 @@ main(int argc, char *argv[]) asprintf(&fmfname, "%s.filemon", fname); if (!fmfname) err(1, "%s.filemon", fname); - if ((fm_fd = open("/dev/filemon", O_RDWR)) == -1) + if ((fm_fd = open("/dev/filemon", O_RDWR | O_CLOEXEC)) == -1) err(1, "open(\"/dev/filemon\", O_RDWR)"); - if ((fm_log = open(fmfname, O_WRONLY | O_CREAT | O_TRUNC, + if ((fm_log = open(fmfname, + O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1) err(1, "open(%s)", fmfname); if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) < 0) err(1, "Cannot set filemon log file descriptor"); - - /* Set up these two fd's to close on exec. */ - (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC); - (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC); } if (pflg)