From owner-svn-src-stable-10@freebsd.org Sun Oct 30 11:45:02 2016 Return-Path: Delivered-To: svn-src-stable-10@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 D4557C145DE; Sun, 30 Oct 2016 11:45:02 +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 A37B712A7; Sun, 30 Oct 2016 11:45:02 +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 u9UBj1NZ013271; Sun, 30 Oct 2016 11:45:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9UBj1eu013270; Sun, 30 Oct 2016 11:45:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201610301145.u9UBj1eu013270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Oct 2016 11:45: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: r308103 - stable/10/sys/kern 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2016 11:45:02 -0000 Author: kib Date: Sun Oct 30 11:45:01 2016 New Revision: 308103 URL: https://svnweb.freebsd.org/changeset/base/308103 Log: MFC r307821: Use proper type for local variable. PR: 212520 Modified: stable/10/sys/kern/subr_uio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_uio.c ============================================================================== --- stable/10/sys/kern/subr_uio.c Sun Oct 30 11:42:05 2016 (r308102) +++ stable/10/sys/kern/subr_uio.c Sun Oct 30 11:45:01 2016 (r308103) @@ -534,7 +534,7 @@ fueword32(volatile const void *base, int int fueword64(volatile const void *base, int64_t *val) { - int32_t res; + int64_t res; res = fuword64(base); if (res == -1) From owner-svn-src-stable-10@freebsd.org Mon Oct 31 07:21:38 2016 Return-Path: Delivered-To: svn-src-stable-10@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 8AB1FC26C0C; Mon, 31 Oct 2016 07:21:38 +0000 (UTC) (envelope-from mav@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 3F8CB1423; Mon, 31 Oct 2016 07:21:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9V7Lb0E061547; Mon, 31 Oct 2016 07:21:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9V7Lb8O061546; Mon, 31 Oct 2016 07:21:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201610310721.u9V7Lb8O061546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 31 Oct 2016 07:21: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: r308123 - 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 07:21:38 -0000 Author: mav Date: Mon Oct 31 07:21:37 2016 New Revision: 308123 URL: https://svnweb.freebsd.org/changeset/base/308123 Log: MFC r307523: Make pass driver better support CAM_CDB_POINTER flag. Previously pass driver just ignored the flag, making random kernel code access user-space pointer, sometime causing crashes even for correctly written applications if user-level context was switched or swapped out. This patch tries to copyin the CDB into kernel space to avoid it. Modified: stable/10/sys/cam/scsi/scsi_pass.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_pass.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_pass.c Mon Oct 31 07:21:07 2016 (r308122) +++ stable/10/sys/cam/scsi/scsi_pass.c Mon Oct 31 07:21:37 2016 (r308123) @@ -1881,6 +1881,18 @@ passdoioctl(struct cdev *dev, u_long cmd break; } + if (ccb->ccb_h.flags & CAM_CDB_POINTER) { + if (ccb->csio.cdb_len > IOCDBLEN) { + error = EINVAL; + break; + } + error = copyin(ccb->csio.cdb_io.cdb_ptr, + ccb->csio.cdb_io.cdb_bytes, ccb->csio.cdb_len); + if (error) + break; + ccb->ccb_h.flags &= ~CAM_CDB_POINTER; + } + /* * Some CCB types, like scan bus and scan lun can only go * through the transport layer device. @@ -2148,6 +2160,7 @@ passsendccb(struct cam_periph *periph, u { struct pass_softc *softc; struct cam_periph_map_info mapinfo; + uint8_t *cmd; xpt_opcode fc; int error; @@ -2159,6 +2172,14 @@ passsendccb(struct cam_periph *periph, u */ xpt_merge_ccb(ccb, inccb); + if (ccb->ccb_h.flags & CAM_CDB_POINTER) { + cmd = __builtin_alloca(ccb->csio.cdb_len); + error = copyin(ccb->csio.cdb_io.cdb_ptr, cmd, ccb->csio.cdb_len); + if (error) + return (error); + ccb->csio.cdb_io.cdb_ptr = cmd; + } + /* */ ccb->ccb_h.cbfcnp = passdone; From owner-svn-src-stable-10@freebsd.org Mon Oct 31 16:44:33 2016 Return-Path: Delivered-To: svn-src-stable-10@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 41CDDC28DF7; Mon, 31 Oct 2016 16:44:33 +0000 (UTC) (envelope-from gjb@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 027BD1627; Mon, 31 Oct 2016 16:44:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9VGiWT1079926; Mon, 31 Oct 2016 16:44:32 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VGiWlb079925; Mon, 31 Oct 2016 16:44:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201610311644.u9VGiWlb079925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 31 Oct 2016 16:44:32 +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: r308135 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml 9/release/doc/share/xml 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 16:44:33 -0000 Author: gjb Date: Mon Oct 31 16:44:31 2016 New Revision: 308135 URL: https://svnweb.freebsd.org/changeset/base/308135 Log: Document EN-16:17-18, SA-16:26-32 Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/errata.xml stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/11/release/doc/share/xml/errata.xml stable/11/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/errata.xml ============================================================================== --- stable/10/release/doc/share/xml/errata.xml Mon Oct 31 16:06:57 2016 (r308134) +++ stable/10/release/doc/share/xml/errata.xml Mon Oct 31 16:44:31 2016 (r308135) @@ -104,6 +104,13 @@ Fix SCSI INQUIRY checks and error handling + + + FreeBSD-EN-16:17.vm + 25 October 2016 + Several virtual memory issues + Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Mon Oct 31 16:06:57 2016 (r308134) +++ stable/10/release/doc/share/xml/security.xml Mon Oct 31 16:44:31 2016 (r308135) @@ -95,6 +95,42 @@ 25 July 2016 heap overflow vulnerability + + + FreeBSD-SA-16:26.openssl + 23 September 2016 + Multiple vulnerabilities + + + + FreeBSD-SA-16:27.openssl + 26 September 2016 + Regression in OpenSSL + suite + + + + FreeBSD-SA-16:29.bspatch + 10 October 2016 + Heap overflow vulnerability + + + + FreeBSD-SA-16:30.portsnap + 10 October 2016 + Multiple vulnerabilities + + + + FreeBSD-SA-16:31.libarchive + 10 October 2016 + Multiple vulnerabilities + From owner-svn-src-stable-10@freebsd.org Mon Oct 31 16:48:17 2016 Return-Path: Delivered-To: svn-src-stable-10@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 E7DCAC28F76; Mon, 31 Oct 2016 16:48:17 +0000 (UTC) (envelope-from sbruno@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 B3CA91B14; Mon, 31 Oct 2016 16:48:17 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9VGmG0T080164; Mon, 31 Oct 2016 16:48:16 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VGmGKr080163; Mon, 31 Oct 2016 16:48:16 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201610311648.u9VGmGKr080163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Mon, 31 Oct 2016 16:48:16 +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: r308136 - stable/10/sys/dev/netmap 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 16:48:18 -0000 Author: sbruno Date: Mon Oct 31 16:48:16 2016 New Revision: 308136 URL: https://svnweb.freebsd.org/changeset/base/308136 Log: MFC r308038: The buffer address is always overwritten in the extended descriptor format, we have to refresh it ... always. This fixes problems reported in NetMap with em(4) devices after conversion to extended descriptor format in svn r293331. Modified: stable/10/sys/dev/netmap/if_em_netmap.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/netmap/if_em_netmap.h ============================================================================== --- stable/10/sys/dev/netmap/if_em_netmap.h Mon Oct 31 16:44:31 2016 (r308135) +++ stable/10/sys/dev/netmap/if_em_netmap.h Mon Oct 31 16:48:16 2016 (r308136) @@ -279,9 +279,9 @@ em_netmap_rxsync(struct netmap_kring *kr if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ goto ring_reset; + curr->read.buffer_addr = htole64(paddr); if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ - curr->read.buffer_addr = htole64(paddr); netmap_reload_map(na, rxr->rxtag, rxbuf->map, addr); slot->flags &= ~NS_BUF_CHANGED; } From owner-svn-src-stable-10@freebsd.org Mon Oct 31 18:12:08 2016 Return-Path: Delivered-To: svn-src-stable-10@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 912A6C16C0E; Mon, 31 Oct 2016 18:12:08 +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 54AB81E21; Mon, 31 Oct 2016 18:12:08 +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 u9VIC7us015095; Mon, 31 Oct 2016 18:12:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VIC7nL015094; Mon, 31 Oct 2016 18:12:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610311812.u9VIC7nL015094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 31 Oct 2016 18:12:07 +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: r308138 - stable/10/sys/dev/cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 18:12:08 -0000 Author: jhb Date: Mon Oct 31 18:12:07 2016 New Revision: 308138 URL: https://svnweb.freebsd.org/changeset/base/308138 Log: MFC 282039: Don't use ifm_data. It was used only for self checking debug. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 16:55:14 2016 (r308137) +++ stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 18:12:07 2016 (r308138) @@ -1525,9 +1525,6 @@ cxgbe_media_status(struct ifnet *ifp, st struct ifmedia *media = NULL; struct ifmedia_entry *cur; int speed = pi->link_cfg.speed; -#ifdef INVARIANTS - int data = (pi->port_type << 8) | pi->mod_type; -#endif if (ifp == pi->ifp) media = &pi->media; @@ -1538,7 +1535,6 @@ cxgbe_media_status(struct ifnet *ifp, st MPASS(media != NULL); cur = media->ifm_cur; - MPASS(cur->ifm_data == data); ifmr->ifm_status = IFM_AVALID; if (!pi->link_cfg.link_ok) @@ -2838,30 +2834,29 @@ t4_set_desc(struct adapter *sc) static void build_medialist(struct port_info *pi, struct ifmedia *media) { - int data, m; + int m; PORT_LOCK(pi); ifmedia_removeall(media); m = IFM_ETHER | IFM_FDX; - data = (pi->port_type << 8) | pi->mod_type; switch(pi->port_type) { case FW_PORT_TYPE_BT_XFI: case FW_PORT_TYPE_BT_XAUI: - ifmedia_add(media, m | IFM_10G_T, data, NULL); + ifmedia_add(media, m | IFM_10G_T, 0, NULL); /* fall through */ case FW_PORT_TYPE_BT_SGMII: - ifmedia_add(media, m | IFM_1000_T, data, NULL); - ifmedia_add(media, m | IFM_100_TX, data, NULL); - ifmedia_add(media, IFM_ETHER | IFM_AUTO, data, NULL); + ifmedia_add(media, m | IFM_1000_T, 0, NULL); + ifmedia_add(media, m | IFM_100_TX, 0, NULL); + ifmedia_add(media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(media, IFM_ETHER | IFM_AUTO); break; case FW_PORT_TYPE_CX4: - ifmedia_add(media, m | IFM_10G_CX4, data, NULL); + ifmedia_add(media, m | IFM_10G_CX4, 0, NULL); ifmedia_set(media, m | IFM_10G_CX4); break; @@ -2872,29 +2867,29 @@ build_medialist(struct port_info *pi, st switch (pi->mod_type) { case FW_PORT_MOD_TYPE_LR: - ifmedia_add(media, m | IFM_10G_LR, data, NULL); + ifmedia_add(media, m | IFM_10G_LR, 0, NULL); ifmedia_set(media, m | IFM_10G_LR); break; case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_10G_SR, data, NULL); + ifmedia_add(media, m | IFM_10G_SR, 0, NULL); ifmedia_set(media, m | IFM_10G_SR); break; case FW_PORT_MOD_TYPE_LRM: - ifmedia_add(media, m | IFM_10G_LRM, data, NULL); + ifmedia_add(media, m | IFM_10G_LRM, 0, NULL); ifmedia_set(media, m | IFM_10G_LRM); break; case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_10G_TWINAX, data, NULL); + ifmedia_add(media, m | IFM_10G_TWINAX, 0, NULL); ifmedia_set(media, m | IFM_10G_TWINAX); break; case FW_PORT_MOD_TYPE_NONE: m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, data, NULL); + ifmedia_add(media, m | IFM_NONE, 0, NULL); ifmedia_set(media, m | IFM_NONE); break; @@ -2904,7 +2899,7 @@ build_medialist(struct port_info *pi, st device_printf(pi->dev, "unknown port_type (%d), mod_type (%d)\n", pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); + ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); ifmedia_set(media, m | IFM_UNKNOWN); break; } @@ -2914,24 +2909,24 @@ build_medialist(struct port_info *pi, st switch (pi->mod_type) { case FW_PORT_MOD_TYPE_LR: - ifmedia_add(media, m | IFM_40G_LR4, data, NULL); + ifmedia_add(media, m | IFM_40G_LR4, 0, NULL); ifmedia_set(media, m | IFM_40G_LR4); break; case FW_PORT_MOD_TYPE_SR: - ifmedia_add(media, m | IFM_40G_SR4, data, NULL); + ifmedia_add(media, m | IFM_40G_SR4, 0, NULL); ifmedia_set(media, m | IFM_40G_SR4); break; case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: - ifmedia_add(media, m | IFM_40G_CR4, data, NULL); + ifmedia_add(media, m | IFM_40G_CR4, 0, NULL); ifmedia_set(media, m | IFM_40G_CR4); break; case FW_PORT_MOD_TYPE_NONE: m &= ~IFM_FDX; - ifmedia_add(media, m | IFM_NONE, data, NULL); + ifmedia_add(media, m | IFM_NONE, 0, NULL); ifmedia_set(media, m | IFM_NONE); break; @@ -2939,7 +2934,7 @@ build_medialist(struct port_info *pi, st device_printf(pi->dev, "unknown port_type (%d), mod_type (%d)\n", pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); + ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); ifmedia_set(media, m | IFM_UNKNOWN); break; } @@ -2949,7 +2944,7 @@ build_medialist(struct port_info *pi, st device_printf(pi->dev, "unknown port_type (%d), mod_type (%d)\n", pi->port_type, pi->mod_type); - ifmedia_add(media, m | IFM_UNKNOWN, data, NULL); + ifmedia_add(media, m | IFM_UNKNOWN, 0, NULL); ifmedia_set(media, m | IFM_UNKNOWN); break; } From owner-svn-src-stable-10@freebsd.org Mon Oct 31 18:29:17 2016 Return-Path: Delivered-To: svn-src-stable-10@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 831B7C271BD; Mon, 31 Oct 2016 18:29:17 +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 52A5C1A4D; Mon, 31 Oct 2016 18:29:17 +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 u9VITGT8019386; Mon, 31 Oct 2016 18:29:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VITGC4019385; Mon, 31 Oct 2016 18:29:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201610311829.u9VITGC4019385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 31 Oct 2016 18:29:16 +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: r308141 - stable/10/share/misc 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 18:29:17 -0000 Author: bapt Date: Mon Oct 31 18:29:16 2016 New Revision: 308141 URL: https://svnweb.freebsd.org/changeset/base/308141 Log: MFC r307785: Import pci_vendors 2016.10.20 Modified: stable/10/share/misc/pci_vendors Directory Properties: stable/10/ (props changed) Modified: stable/10/share/misc/pci_vendors ============================================================================== --- stable/10/share/misc/pci_vendors Mon Oct 31 18:27:38 2016 (r308140) +++ stable/10/share/misc/pci_vendors Mon Oct 31 18:29:16 2016 (r308141) @@ -3,8 +3,8 @@ # # List of PCI ID's # -# Version: 2016.10.03 -# Date: 2016-10-03 03:15:01 +# Version: 2016.10.20 +# Date: 2016-10-20 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at http://pci-ids.ucw.cz/. @@ -245,8 +245,13 @@ 0013 53c875a 1000 1000 LSI53C875A PCI to Ultra SCSI Controller 0014 MegaRAID Tri-Mode SAS3516 + 1028 1fd4 PERC H745P MX 1d49 0602 ThinkSystem RAID 930-16i 4GB Flash PCIe 12Gb Adapter 0016 MegaRAID Tri-Mode SAS3508 + 1028 1fc9 PERC H840 Adapter + 1028 1fcb PERC H740P Adapter + 1028 1fcd PERC H740P Mini + 1028 1fcf PERC H740P Mini 1d49 0601 ThinkSystem RAID 930-8i 2GB Flash PCIe 12Gb Adapter 1d49 0603 ThinkSystem RAID 930-24i 4GB Flash PCIe 12Gb Adapter 1d49 0604 ThinkSystem RAID 930-8e 4GB Flash PCIe 12Gb Adapter @@ -376,6 +381,7 @@ 1028 1f4d PERC FD33xS 1028 1f4f PERC H730P Slim 1028 1f54 PERC FD33xD + 1028 1fd1 PERC H730P MX 17aa 1052 ThinkServer RAID 720i 17aa 1053 ThinkServer RAID 720ix 1d49 0600 ThinkSystem RAID 730-8i 1GB Cache PCIe 12Gb Adapter @@ -535,8 +541,11 @@ 0097 SAS3008 PCI-Express Fusion-MPT SAS-3 1000 3090 SAS9311-8i 1000 30e0 SAS9300-8i - 1028 1f45 12GB/s HBA internal + 1028 1f45 HBA330 Adapter 1028 1f46 12Gbps HBA + 1028 1f53 HBA330 Mini + 1028 1fd2 HBA330 MX + 1028 1fd3 HBA330 MMZ 00ab SAS3516 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00ac SAS3416 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) 1d49 0201 ThinkSystem 9400-16i PCIe 12Gb HBA @@ -1588,7 +1597,7 @@ 1462 2938 Radeon R9 360 OEM 1462 3271 Radeon R9 360 OEM 1682 7360 Radeon R7 360 - 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330] + 6660 Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430] 1028 05ea Radeon HD 8670M 1028 06bf Radeon R5 M335 103c 1970 Radeon HD 8670M @@ -1596,6 +1605,7 @@ 103c 8136 Radeon R5 M330 17aa 3804 Radeon R5 M330 17aa 3809 Radeon R5 M330 + 17aa 381a Radeon R5 M430 17aa 390c Radeon R5 M330 6663 Sun PRO [Radeon HD 8570A/8570M] 1025 0846 Radeon HD 8570A @@ -2866,11 +2876,12 @@ 174b e180 Radeon HD 7350 17af 3015 Radeon HD 7350 68fe Cedar LE - 6900 Topaz XT [Radeon R7 M260/M265 / M340/M360] + 6900 Topaz XT [Radeon R7 M260/M265 / M340/M360 / M440/M445] 1025 1056 Radeon R7 M360 / R8 M365DX 1028 0640 Radeon R7 M260/M265 1028 0643 Radeon R7 M260/M265 1028 067f Radeon R7 M260 + 1028 0767 Radeon R7 M445 1028 130a Radeon R7 M260 103c 2263 Radeon R7 M260 103c 2269 Radeon R7 M260 @@ -2881,6 +2892,7 @@ 103c 80b5 Radeon R7 M360 103c 80b9 Radeon R7 M360 103c 811c Radeon R7 M340 + 103c 8226 Radeon R7 M440 10cf 1906 Radeon R7 M260 1170 9979 Radeon R7 M360 1179 f903 Radeon R7 M260 @@ -2892,6 +2904,7 @@ 17aa 5021 Radeon R7 M260 6901 Topaz PRO [Radeon R5 M255] 103c 1318 Radeon R6 M255DX + 6907 Meso XT [Radeon R5 M315] 6921 Amethyst XT [Radeon R9 M295X] 6929 Tonga XT GL [FirePro S7150] 692b Tonga PRO GL [FirePro W7100] @@ -3349,7 +3362,7 @@ 99a4 Trinity [Radeon HD 7400G] aa00 R600 HDMI Audio [Radeon HD 2900 GT/PRO/XT] aa01 RV635 HDMI Audio [Radeon HD 3650/3730/3750] - aa08 RV630 HDMI Audio [Radeon HD 2600 Series] + aa08 RV630 HDMI Audio [Radeon HD 2600 PRO/XT / HD 3610] aa10 RV610 HDMI Audio [Radeon HD 2350 PRO / 2400 PRO/XT / HD 3410] 174b aa10 Radeon HD 2400 PRO 18bc aa10 Radeon HD 2400 PRO @@ -3369,10 +3382,10 @@ aa68 Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series] 1028 aa68 XPS 8300 aa80 Cayman/Antilles HDMI Audio [Radeon HD 6930/6950/6970/6990] - aa88 Barts HDMI Audio [Radeon HD 6800 Series] + aa88 Barts HDMI Audio [Radeon HD 6790/6850/6870 / 7720 OEM] aa90 Turks HDMI Audio [Radeon HD 6500/6600 / 6700M Series] 1028 04a3 Precision M4600 - aa98 Caicos HDMI Audio [Radeon HD 6400 Series] + aa98 Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] 174b aa98 Radeon HD 6450 1GB DDR3 aaa0 Tahiti HDMI Audio [Radeon HD 7870 XT / 7950/7970] aab0 Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] @@ -7347,6 +7360,7 @@ 8533 PEX 8533 32-lane, 6-port PCI Express Switch 8547 PEX 8547 48-lane, 3-port PCI Express Switch 8548 PEX 8548 48-lane, 9-port PCI Express Switch + 8603 PEX 8603 3-lane, 3-Port PCI Express Gen 2 (5.0 GT/s) Switch 8604 PEX 8604 4-lane, 4-Port PCI Express Gen 2 (5.0 GT/s) Switch 8605 PEX 8605 PCI Express 4-port Gen2 Switch 8606 PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch @@ -17921,7 +17935,7 @@ 1015 MT27710 Family [ConnectX-4 Lx] 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] 1017 MT27800 Family [ConnectX-5] - 1018 MT28800 Family [ConnectX-5 Virtual Function] + 1018 MT27800 Family [ConnectX-5 Virtual Function] 1019 MT28800 Family [ConnectX-5 Ex] 101a MT28800 Family [ConnectX-5 Ex Virtual Function] 101b MT28831 @@ -17932,6 +17946,7 @@ 1020 MT28860 1021 MT28861 1974 MT28800 Family [ConnectX-5 PCIe Bridge] + 1975 MT416842 Family [BlueField SoC PCIe Bridge] 5274 MT21108 InfiniBridge 5a44 MT23108 InfiniHost 5a45 MT23108 [Infinihost HCA Flash Recovery] @@ -17966,6 +17981,9 @@ 7121 NPS-600 configuration and management interface 7122 NPS-600 network interface PF 7123 NPS-600 network interface VF + a2d0 MT416842 + a2d1 MT416842 + a2d3 MT416842 BlueField multicore SoC family VF # SwitchX-2, 40GbE switch c738 MT51136 c739 MT51136 GW @@ -18638,7 +18656,12 @@ 7018 AP408: 32-Channel Digital I/O Module 701a AP220-16 12-Bit, 16-Channel Analog Output Module 701b AP231-16 16-Bit, 16-Channel Analog Output Module + 7021 APA7-201 Reconfigurable Artix-7 FPGA module 48 TTL channels + 7022 APA7-202 Reconfigurable Artix-7 FPGA module 24 RS485 channels + 7023 APA7-203 Reconfigurable Artix-7 FPGA module 24 TTL & 12 RS485 channels + 7024 APA7-204 Reconfigurable Artix-7 FPGA module 24 LVDS channels 7042 AP482 Counter Timer Module with TTL Level Input/Output + 7043 AP483 Counter Timer Module with TTL Level and RS422 Input/Output 7044 AP484 Counter Timer Module with RS422 Input/Output 16da Advantech Co., Ltd. 0011 INES GPIB-PCI @@ -18881,6 +18904,7 @@ 0401 Datacenter Technologies QDF2400 PCI Express Root Port 17cc NetChip Technology, Inc 2280 USB 2.0 +17cd Cadence Design Systems, Inc. 17cf Z-Com, Inc. 17d3 Areca Technology Corp. 1110 ARC-1110 4-Port PCI-X to SATA RAID Controller @@ -20290,7 +20314,8 @@ 1432 8102 EN-8102P 10GbE Ethernet Adapter 1fc9 3015 Ethernet Adapter 4026 TN9610 10GbE SFP+ Ethernet Adapter - 4027 TN9710 10GBase-T/NBASE-T Ethernet Adapter + 4027 TN9710P 10GBase-T/NBASE-T Ethernet Adapter + 4527 TN9710Q 5GBase-T/NBASE-T Ethernet Adapter 1fcc StreamLabs f416 MS416 fb01 MH4LM @@ -22295,6 +22320,7 @@ 17aa 4007 82599ES 10-Gigabit SFI/SFP+ Network Connection 17aa 402b 82599ES 10Gb 2-port Server Adapter X520-DA2 17aa 402f FPGA Card XC7VX690T-3FFG1157E + 18d4 0c09 82599ES 10Gb 2-port SFP+ OCP Mezz Card MOP81-I-10GS2 1bd4 001b 10G SFP+ DP ER102Fi4 Rack Adapter 1bd4 002f 10G SFP+ DP EP102Fi4A Adapter 1bd4 0032 10G SFP+ DP EP102Fi4 Adapter @@ -22570,8 +22596,15 @@ 1520 I350 Ethernet Controller Virtual Function 1521 I350 Gigabit Network Connection 1028 0602 Gigabit 2P I350-t LOM + 1028 0693 Gigabit 2P I350-t LOM + 1028 06e2 Gigabit 2P I350-t LOM + 1028 0757 Gigabit I350-t LOM + 1028 075a Gigabit I350-t LOM 1028 1f60 Gigabit 4P I350-t rNDC 1028 1f62 Gigabit 4P X540/I350 rNDC + 1028 1fa8 Ethernet 10G 4P X550/I350 rNDC + 1028 1fa9 Ethernet 10G 4P X550 rNDC + 1028 1faa Gigabit 4P X550/I350 rNDC 1028 ff9a Gigabit 4P X710/I350 rNDC 103c 17d1 Ethernet 1Gb 4-port 366FLR Adapter 103c 2003 Ethernet 1Gb 2-port 367i Adapter @@ -22590,6 +22623,7 @@ 15d9 0652 Dual Port i350 GbE MicroLP [AOC-CGP-i2] 17aa 1074 ThinkServer I350-T4 AnyFabric 17aa 4005 I350 Gigabit Network Connection + 18d4 0c07 I350 1Gb 2-port RJ45 OCP Mezz Card MOP41-I-1GT2 1bd4 001d 1G base-T QP EP014Ti1 Adapter 1bd4 0035 1G base-T QP EP014Ti1 Adapter 8086 0001 Ethernet Server Adapter I350-T4 @@ -22698,6 +22732,7 @@ 1028 1fa9 Ethernet 10G 4P X550 rNDC 1590 00d1 Ethernet 10Gb 2-port 562T Adapter 1590 00d2 Ethernet 10Gb 2-port 562FLR-T Adapter + 18d4 0c08 X550 10Gb 2-port RJ45 OCP Mezz Card MOP81-I-10GT2 8086 0001 Ethernet Converged Network Adapter X550-T2 8086 001a Ethernet Converged Network Adapter X550-T2 8086 0022 Ethernet Converged Network Adapter X550-T2 @@ -22782,11 +22817,11 @@ 108e 0000 Ethernet Controller X710 for 10GBASE-T 108e 4857 Ethernet Controller X710 for 10GBASE-T 1587 Ethernet Controller XL710 for 20GbE backplane - 103c 0000 HP Flex-20 20Gb 2-port 660FLB Adapter - 103c 22fe HP Flex-20 20Gb 2-port 660FLB Adapter + 103c 0000 HPE Ethernet 10/20Gb 2-port 660FLB Adapter + 103c 22fe HPE Ethernet 10/20Gb 2-port 660FLB Adapter 1588 Ethernet Controller XL710 for 20GbE backplane - 103c 0000 HP Flex-20 20Gb 2-port 660M Adapter - 103c 22ff HP Flex-20 20Gb 2-port 660M Adapter + 103c 0000 HPE Ethernet 10/20Gb 2-port 660M Adapter + 103c 22ff HPE Ethernet 10/20Gb 2-port 660M Adapter 1589 Ethernet Controller X710/X557-AT 10GBASE-T 108e 0000 Quad Port 10GBase-T Adapter 108e 7b1c Quad Port 10GBase-T Adapter @@ -23169,7 +23204,7 @@ 1e09 7 Series Chipset Family 2-port SATA Controller [IDE mode] 144d c652 NP300E5C series laptop 1e0e 7 Series/C210 Series Chipset Family SATA Controller [RAID mode] - 1e10 7 Series/C210 Series Chipset Family PCI Express Root Port 1 + 1e10 7 Series/C216 Chipset Family PCI Express Root Port 1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23181,7 +23216,7 @@ 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A 1e14 7 Series/C210 Series Chipset Family PCI Express Root Port 3 - 1e16 7 Series/C210 Series Chipset Family PCI Express Root Port 4 + 1e16 7 Series/C216 Chipset Family PCI Express Root Port 4 1043 108d VivoBook X202EV 1043 1477 N56VZ 144d c652 NP300E5C series laptop @@ -23194,7 +23229,7 @@ 1e1c 7 Series/C210 Series Chipset Family PCI Express Root Port 7 1e1e 7 Series/C210 Series Chipset Family PCI Express Root Port 8 1849 1e1e Motherboard - 1e20 7 Series/C210 Series Chipset Family High Definition Audio Controller + 1e20 7 Series/C216 Chipset Family High Definition Audio Controller 1028 054b Dell XPS One 2710 1043 108d VivoBook X202EV 1043 1477 N56VZ @@ -23203,7 +23238,7 @@ 1043 8445 ASUS P8Z77-V LX Motherboard 144d c652 NP300E5C series laptop 1849 1898 Z77 Extreme4 motherboard - 1e22 7 Series/C210 Series Chipset Family SMBus Controller + 1e22 7 Series/C216 Chipset Family SMBus Controller 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23213,14 +23248,14 @@ 1e24 7 Series/C210 Series Chipset Family Thermal Management Controller 1043 1517 Zenbook Prime UX31A 1e25 7 Series/C210 Series Chipset Family DMI to PCI Bridge - 1e26 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 + 1e26 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A 1043 84ca P8 series motherboard 144d c652 NP300E5C series laptop 1849 1e26 Motherboard - 1e2d 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 + 1e2d 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -23235,7 +23270,7 @@ 1043 84ca P8 series motherboard 1849 1e31 Motherboard 1e33 7 Series/C210 Series Chipset Family LAN Controller - 1e3a 7 Series/C210 Series Chipset Family MEI Controller #1 + 1e3a 7 Series/C216 Chipset Family MEI Controller #1 1043 108d VivoBook X202EV 1043 1477 N56VZ 1043 1517 Zenbook Prime UX31A @@ -26234,10 +26269,21 @@ 37cd X722 Virtual Function 37ce Ethernet Connection X722 for 10GbE backplane 1590 0215 Ethernet 10Gb 2-port 568i Adapter + 17aa 4023 Intel Ethernet Connection X722 for 10GbE backplane 37cf Ethernet Connection X722 for 10GbE QSFP+ 37d0 Ethernet Connection X722 for 10GbE SFP+ 37d1 Ethernet Connection X722 for 1GbE + 17aa 4020 Intel Ethernet Connection X722 for 1GbE + 17aa 4021 Intel Ethernet Connection X722 for 1GbE + 17aa 4022 Intel Ethernet Connection X722 for 1GbE + 8086 4020 Ethernet Connection X722 for 1GbE + 8086 4021 Ethernet Connection X722 for 1GbE + 8086 4022 Ethernet Connection X722 for 1GbE 37d2 Ethernet Connection X722 for 10GBASE-T + 17aa 4020 Intel Ethernet Connection X722 for 10GBASE + 17aa 4021 Intel Ethernet Connection X722 for 10GBASE + 8086 4020 Ethernet Connection X722 for 10GBASE + 8086 4021 Ethernet Connection X722 for 10GBASE 37d3 Ethernet Connection X722 for 10GbE SFP+ 37d4 Ethernet Connection X722 for 10GbE QSFP+ 37d9 X722 Hyper-V Virtual Function From owner-svn-src-stable-10@freebsd.org Mon Oct 31 18:37:46 2016 Return-Path: Delivered-To: svn-src-stable-10@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 50A20C273E9; Mon, 31 Oct 2016 18:37:46 +0000 (UTC) (envelope-from dim@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 2A2A31035; Mon, 31 Oct 2016 18:37:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9VIbjWb023536; Mon, 31 Oct 2016 18:37:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VIbjhs023532; Mon, 31 Oct 2016 18:37:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201610311837.u9VIbjhs023532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 31 Oct 2016 18:37: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: r308143 - stable/10/contrib/libc++/include 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 18:37:46 -0000 Author: dim Date: Mon Oct 31 18:37:44 2016 New Revision: 308143 URL: https://svnweb.freebsd.org/changeset/base/308143 Log: Pull in r228705 from upstream libc++ trunk (by Eric Fiselier): [libcxx] Fix PR 22468 - std::function does not accept non-void-returning functions Summary: The bug can be found here: https://llvm.org/bugs/show_bug.cgi?id=22468 `__invoke_void_return_wrapper` is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause `function::operator()(...)` to not compile. Reviewers: eugenis, K-ballo, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D7444 This should allow newer versions of the graphics/aseprite port to compile without modification. Direct commit to stable/10, since stable/11 and head already have this change. Reported by: yuri@rawbw.com PR: 213773 Modified: stable/10/contrib/libc++/include/__functional_03 stable/10/contrib/libc++/include/__functional_base stable/10/contrib/libc++/include/__functional_base_03 stable/10/contrib/libc++/include/functional Modified: stable/10/contrib/libc++/include/__functional_03 ============================================================================== --- stable/10/contrib/libc++/include/__functional_03 Mon Oct 31 18:37:05 2016 (r308142) +++ stable/10/contrib/libc++/include/__functional_03 Mon Oct 31 18:37:44 2016 (r308143) @@ -369,7 +369,8 @@ template::operator()() { - return __invoke(__f_.first()); + typedef __invoke_void_return_wrapper<_Rp> _Invoker; + return _Invoker::__call(__f_.first()); } #ifndef _LIBCPP_NO_RTTI @@ -452,7 +453,8 @@ template::operator()(_A0 __a0) { - return __invoke(__f_.first(), __a0); + typedef __invoke_void_return_wrapper<_Rp> _Invoker; + return _Invoker::__call(__f_.first(), __a0); } #ifndef _LIBCPP_NO_RTTI @@ -535,7 +537,8 @@ template::operator()(_A0 __a0, _A1 __a1) { - return __invoke(__f_.first(), __a0, __a1); + typedef __invoke_void_return_wrapper<_Rp> _Invoker; + return _Invoker::__call(__f_.first(), __a0, __a1); } #ifndef _LIBCPP_NO_RTTI @@ -618,7 +621,8 @@ template::operator()(_A0 __a0, _A1 __a1, _A2 __a2) { - return __invoke(__f_.first(), __a0, __a1, __a2); + typedef __invoke_void_return_wrapper<_Rp> _Invoker; + return _Invoker::__call(__f_.first(), __a0, __a1, __a2); } #ifndef _LIBCPP_NO_RTTI Modified: stable/10/contrib/libc++/include/__functional_base ============================================================================== --- stable/10/contrib/libc++/include/__functional_base Mon Oct 31 18:37:05 2016 (r308142) +++ stable/10/contrib/libc++/include/__functional_base Mon Oct 31 18:37:44 2016 (r308143) @@ -419,6 +419,26 @@ struct __invoke_return typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type; }; +template +struct __invoke_void_return_wrapper +{ + template + static _Ret __call(_Args&&... __args) + { + return __invoke(_VSTD::forward<_Args>(__args)...); + } +}; + +template <> +struct __invoke_void_return_wrapper +{ + template + static void __call(_Args&&... __args) + { + __invoke(_VSTD::forward<_Args>(__args)...); + } +}; + template class _LIBCPP_TYPE_VIS_ONLY reference_wrapper : public __weak_result_type<_Tp> Modified: stable/10/contrib/libc++/include/__functional_base_03 ============================================================================== --- stable/10/contrib/libc++/include/__functional_base_03 Mon Oct 31 18:37:05 2016 (r308142) +++ stable/10/contrib/libc++/include/__functional_base_03 Mon Oct 31 18:37:44 2016 (r308143) @@ -995,6 +995,63 @@ struct __invoke_return2 _VSTD::declval<_A2>())) type; }; +template +struct __invoke_void_return_wrapper +{ + template + static _Ret __call(_Fn __f) + { + return __invoke(__f); + } + + template + static _Ret __call(_Fn __f, _A0& __a0) + { + return __invoke(__f, __a0); + } + + template + static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) + { + return __invoke(__f, __a0, __a1); + } + + template + static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) + { + return __invoke(__f, __a0, __a1, __a2); + } +}; + + +template <> +struct __invoke_void_return_wrapper +{ + template + static void __call(_Fn __f) + { + __invoke(__f); + } + + template + static void __call(_Fn __f, _A0& __a0) + { + __invoke(__f, __a0); + } + + template + static void __call(_Fn __f, _A0& __a0, _A1& __a1) + { + __invoke(__f, __a0, __a1); + } + + template + static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) + { + __invoke(__f, __a0, __a1, __a2); + } +}; + template class _LIBCPP_TYPE_VIS_ONLY reference_wrapper : public __weak_result_type<_Tp> Modified: stable/10/contrib/libc++/include/functional ============================================================================== --- stable/10/contrib/libc++/include/functional Mon Oct 31 18:37:05 2016 (r308142) +++ stable/10/contrib/libc++/include/functional Mon Oct 31 18:37:44 2016 (r308143) @@ -1367,7 +1367,8 @@ template::operator()(_ArgTypes&& ... __arg) { - return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); + typedef __invoke_void_return_wrapper<_Rp> _Invoker; + return _Invoker::__call(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...); } #ifndef _LIBCPP_NO_RTTI @@ -1429,7 +1430,7 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp template struct __callable<_Fp, true> { - static const bool value = + static const bool value = is_same::value || is_convertible::type, _Rp>::value; }; From owner-svn-src-stable-10@freebsd.org Mon Oct 31 21:57:46 2016 Return-Path: Delivered-To: svn-src-stable-10@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 CAD76C28732; Mon, 31 Oct 2016 21:57:46 +0000 (UTC) (envelope-from mm@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 928F610D5; Mon, 31 Oct 2016 21:57:46 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9VLvj0q001120; Mon, 31 Oct 2016 21:57:45 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VLvhg7001099; Mon, 31 Oct 2016 21:57:43 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201610312157.u9VLvhg7001099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 31 Oct 2016 21:57:43 +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: r308152 - in stable/10: contrib/libarchive contrib/libarchive/cat/test contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/t... 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 21:57:47 -0000 Author: mm Date: Mon Oct 31 21:57:43 2016 New Revision: 308152 URL: https://svnweb.freebsd.org/changeset/base/308152 Log: MFC r307861: Update libarchive to 3.2.2 Most of the post-3.2.1 fixes have already been merged. This update contains just the version bump and some fixes to the test framework. Modified: stable/10/contrib/libarchive/NEWS stable/10/contrib/libarchive/cat/test/main.c stable/10/contrib/libarchive/cat/test/test.h stable/10/contrib/libarchive/cpio/test/main.c stable/10/contrib/libarchive/cpio/test/test.h stable/10/contrib/libarchive/libarchive/archive.h stable/10/contrib/libarchive/libarchive/archive_entry.h stable/10/contrib/libarchive/libarchive/test/main.c stable/10/contrib/libarchive/libarchive/test/test.h stable/10/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c stable/10/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c stable/10/contrib/libarchive/libarchive/test/test_write_format_iso9660.c stable/10/contrib/libarchive/tar/test/main.c stable/10/contrib/libarchive/tar/test/test.h stable/10/contrib/libarchive/tar/test/test_option_b.c stable/10/contrib/libarchive/tar/test/test_symlink_dir.c stable/10/usr.bin/bsdcat/Makefile stable/10/usr.bin/cpio/Makefile stable/10/usr.bin/tar/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/NEWS ============================================================================== --- stable/10/contrib/libarchive/NEWS Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/NEWS Mon Oct 31 21:57:43 2016 (r308152) @@ -1,3 +1,6 @@ +Oct 23, 2016: libarchive 3.2.2 released + Security release + Jun 20, 2016: libarchive 3.2.1 released This fixes a handful of security and other critical issues with 3.2.0 Modified: stable/10/contrib/libarchive/cat/test/main.c ============================================================================== --- stable/10/contrib/libarchive/cat/test/main.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/cat/test/main.c Mon Oct 31 21:57:43 2016 (r308152) @@ -129,6 +129,13 @@ # include #endif +mode_t umasked(mode_t expected_mode) +{ + mode_t mode = umask(0); + umask(mode); + return expected_mode & ~mode; +} + /* Path to working directory for current test */ const char *testworkdir; #ifdef PROGRAM @@ -1156,6 +1163,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1293,6 +1329,11 @@ assertion_file_time(const char *file, in switch (type) { case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; case 'b': filet = st.st_birthtime; + /* FreeBSD filesystems that don't support birthtime + * (e.g., UFS1) always return -1 here. */ + if (filet == -1) { + return (1); + } filet_nsec = st.st_birthtimespec.tv_nsec; break; case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); @@ -1370,6 +1411,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; @@ -1424,7 +1467,7 @@ assertion_file_nlinks(const char *file, assertion_count(file, line); r = lstat(pathname, &st); if (r == 0 && (int)st.st_nlink == nlinks) - return (1); + return (1); failure_start(file, line, "File %s has %d links, expected %d", pathname, st.st_nlink, nlinks); failure_finish(NULL); @@ -1660,6 +1703,7 @@ assertion_make_file(const char *file, in if (0 != chmod(path, mode)) { failure_start(file, line, "Could not chmod %s", path); failure_finish(NULL); + close(fd); return (0); } if (contents != NULL) { @@ -1674,6 +1718,7 @@ assertion_make_file(const char *file, in failure_start(file, line, "Could not write to %s", path); failure_finish(NULL); + close(fd); return (0); } } Modified: stable/10/contrib/libarchive/cat/test/test.h ============================================================================== --- stable/10/contrib/libarchive/cat/test/test.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/cat/test/test.h Mon Oct 31 21:57:43 2016 (r308152) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -182,6 +185,8 @@ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) #define assertFileSize(pathname, size) \ assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertFileMode(pathname, mode) \ + assertion_file_mode(__FILE__, __LINE__, pathname, mode) #define assertTextFileContents(text, pathname) \ assertion_text_file_contents(__FILE__, __LINE__, text, pathname) #define assertFileContainsLinesAnyOrder(pathname, lines) \ @@ -239,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); @@ -327,6 +333,9 @@ void copy_reference_file(const char *); */ void extract_reference_files(const char **); +/* Subtract umask from mode */ +mode_t umasked(mode_t expected_mode); + /* Path to working directory for current test */ extern const char *testworkdir; Modified: stable/10/contrib/libarchive/cpio/test/main.c ============================================================================== --- stable/10/contrib/libarchive/cpio/test/main.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/cpio/test/main.c Mon Oct 31 21:57:43 2016 (r308152) @@ -1164,6 +1164,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1383,6 +1412,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: stable/10/contrib/libarchive/cpio/test/test.h ============================================================================== --- stable/10/contrib/libarchive/cpio/test/test.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/cpio/test/test.h Mon Oct 31 21:57:43 2016 (r308152) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -241,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: stable/10/contrib/libarchive/libarchive/archive.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/archive.h Mon Oct 31 21:57:43 2016 (r308152) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(vo /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.2.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); Modified: stable/10/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_entry.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/archive_entry.h Mon Oct 31 21:57:43 2016 (r308152) @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3002001 +#define ARCHIVE_VERSION_NUMBER 3002002 /* * Note: archive_entry.h is for use outside of libarchive; the Modified: stable/10/contrib/libarchive/libarchive/test/main.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/main.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/main.c Mon Oct 31 21:57:43 2016 (r308152) @@ -1162,6 +1162,35 @@ assertion_file_contains_lines_any_order( return (0); } +/* Verify that a text file does not contains the specified strings */ +int +assertion_file_contains_no_invalid_strings(const char *file, int line, + const char *pathname, const char *strings[]) +{ + char *buff; + int i; + + buff = slurpfile(NULL, "%s", pathname); + if (buff == NULL) { + failure_start(file, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + for (i = 0; strings[i] != NULL; ++i) { + if (strstr(buff, strings[i]) != NULL) { + failure_start(file, line, "Invalid string in %s: %s", pathname, + strings[i]); + failure_finish(NULL); + free(buff); + return(0); + } + } + + free(buff); + return (0); +} + /* Test that two paths point to the same file. */ /* As a side-effect, asserts that both files exist. */ static int @@ -1381,6 +1410,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: stable/10/contrib/libarchive/libarchive/test/test.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/test.h Mon Oct 31 21:57:43 2016 (r308152) @@ -174,6 +174,9 @@ /* Assert that file contents match a string. */ #define assertFileContents(data, data_size, pathname) \ assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +/* Verify that a file does not contain invalid strings */ +#define assertFileContainsNoInvalidStrings(pathname, strings) \ + assertion_file_contains_no_invalid_strings(__FILE__, __LINE__, pathname, strings) #define assertFileMtime(pathname, sec, nsec) \ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) #define assertFileMtimeRecent(pathname) \ @@ -241,6 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: stable/10/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_mtree_crash747.c Mon Oct 31 21:57:43 2016 (r308152) @@ -33,6 +33,11 @@ DEFINE_TEST(test_read_format_mtree_crash const char *reffile = "test_read_format_mtree_crash747.mtree.bz2"; struct archive *a; + if (archive_bzlib_version() == NULL) { + skipping("This test requires bzlib"); + return; + } + extract_reference_file(reffile); assert((a = archive_read_new()) != NULL); Modified: stable/10/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c Mon Oct 31 21:57:43 2016 (r308152) @@ -50,6 +50,11 @@ DEFINE_TEST(test_read_format_zip_high_co size_t s; int64_t o; + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + extract_reference_file(refname); p = slurpfile(&archive_size, refname); @@ -82,6 +87,11 @@ DEFINE_TEST(test_read_format_zip_high_co char *body, *body_read, *buff; int n; + if (archive_zlib_version() == NULL) { + skipping("Zip compression test requires zlib"); + return; + } + assert((body = malloc(body_size)) != NULL); assert((body_read = malloc(body_size)) != NULL); assert((buff = malloc(buff_size)) != NULL); Modified: stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/test_read_set_format.c Mon Oct 31 21:57:43 2016 (r308152) @@ -133,11 +133,12 @@ DEFINE_TEST(test_read_append_filter) assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); r = archive_read_append_filter(a, ARCHIVE_FILTER_GZIP); - if (r == ARCHIVE_WARN && !canGzip()) { - skipping("gzip reading not fully supported on this platform"); + if (r != ARCHIVE_OK && archive_zlib_version() == NULL && !canGzip()) { + skipping("gzip tests require zlib or working gzip command"); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); return; } + assertEqualIntA(a, ARCHIVE_OK, r); assertEqualInt(ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -200,8 +201,11 @@ DEFINE_TEST(test_read_append_filter_wron { struct archive_entry *ae; struct archive *a; +#if !defined(_WIN32) || defined(__CYGWIN__) + FILE * fp; int fd; fpos_t pos; +#endif /* * If we have "bunzip2 -q", try using that. @@ -211,11 +215,13 @@ DEFINE_TEST(test_read_append_filter_wron return; } +#if !defined(_WIN32) || defined(__CYGWIN__) /* bunzip2 will write to stderr, redirect it to a file */ fflush(stderr); fgetpos(stderr, &pos); fd = dup(fileno(stderr)); - freopen("stderr1", "w", stderr); + fp = freopen("stderr1", "w", stderr); +#endif assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); @@ -227,12 +233,15 @@ DEFINE_TEST(test_read_append_filter_wron assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); - /* restore stderr */ - fflush(stderr); - dup2(fd, fileno(stderr)); - close(fd); - clearerr(stderr); - fsetpos(stderr, &pos); - +#if !defined(_WIN32) || defined(__CYGWIN__) + /* restore stderr and verify results */ + if (fp != NULL) { + fflush(stderr); + dup2(fd, fileno(stderr)); + close(fd); + clearerr(stderr); + fsetpos(stderr, &pos); + } assertTextFileContents("bunzip2: (stdin) is not a bzip2 file.\n", "stderr1"); +#endif } Modified: stable/10/contrib/libarchive/libarchive/test/test_write_format_iso9660.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/libarchive/test/test_write_format_iso9660.c Mon Oct 31 21:57:43 2016 (r308152) @@ -117,8 +117,8 @@ DEFINE_TEST(test_write_format_iso9660) */ dirname[0] = '\0'; strcpy(dir, "/dir0"); - for (i = 0; i < 10; i++) { - dir[4] = '0' + i; + for (i = 0; i < 13; i++) { + dir[4] = "0123456789ABCDEF"[i]; if (i == 0) strcat(dirname, dir+1); else @@ -134,6 +134,19 @@ DEFINE_TEST(test_write_format_iso9660) archive_entry_free(ae); } + strcat(dirname, "/file"); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 20); + archive_entry_set_birthtime(ae, 3, 30); + archive_entry_set_ctime(ae, 4, 40); + archive_entry_set_mtime(ae, 5, 50); + archive_entry_copy_pathname(ae, dirname); + archive_entry_set_mode(ae, S_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9)); + /* * "dir0/dir1/file1" has 8 bytes of data. */ @@ -333,6 +346,45 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0555) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -386,6 +438,21 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_birthtime(ae)); + assertEqualInt(4, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", archive_entry_pathname(ae)); + assert((AE_IFREG | 0555) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -580,29 +647,65 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "hardlnk" + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "file" + * Read "hardlnk" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("file", archive_entry_pathname(ae)); - assertEqualString("hardlnk", archive_entry_hardlink(ae)); + assertEqualString("hardlnk", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); @@ -625,6 +728,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dirA/dirB/dirC/file", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -746,6 +865,42 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* + * Read "rr_moved/dir7/dir8/dir9/dira" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dira/dirB" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString("RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC", + archive_entry_pathname(ae)); + assert((S_IFDIR | 0700) == archive_entry_mode(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + + /* * Read "dir0" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); @@ -827,33 +982,35 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualInt(2048, archive_entry_size(ae)); /* - * Read "file" + * Read "hardlink" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); - assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(8, archive_entry_size(ae)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); assertEqualMem(buff2, "12345678", 8); /* - * Read "hardlink" + * Read "file" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_birthtime(ae)); assertEqualInt(5, archive_entry_ctime(ae)); assertEqualInt(5, archive_entry_mtime(ae)); - assertEqualString("HARDLNK", archive_entry_pathname(ae)); - assertEqualString("FILE", archive_entry_hardlink(ae)); + assertEqualString("FILE", archive_entry_pathname(ae)); + assertEqualString("HARDLNK", archive_entry_hardlink(ae)); assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualIntA(a, 0, archive_read_data(a, buff2, 10)); + /* * Read longname */ @@ -871,6 +1028,22 @@ DEFINE_TEST(test_write_format_iso9660) assertEqualMem(buff2, "12345678", 8); /* + * Read "rr_moved/dir7/dir8/dir9/dirA/dirB/dirC/file" + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(5, archive_entry_atime(ae)); + assertEqualInt(5, archive_entry_ctime(ae)); + assertEqualInt(5, archive_entry_mtime(ae)); + assertEqualString( + "RR_MOVED/DIR7/DIR8/DIR9/DIRA/DIRB/DIRC/FILE", + archive_entry_pathname(ae)); + assert((AE_IFREG | 0400) == archive_entry_mode(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, archive_read_data(a, buff2, 10)); + assertEqualMem(buff2, "12345678", 8); + + /* * Read "dir0/dir1/file1" */ assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); Modified: stable/10/contrib/libarchive/tar/test/main.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/main.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/tar/test/main.c Mon Oct 31 21:57:43 2016 (r308152) @@ -1188,7 +1188,7 @@ assertion_file_contains_no_invalid_strin return(0); } } - + free(buff); return (0); } @@ -1412,6 +1412,8 @@ assertion_file_mode(const char *file, in assertion_count(file, line); #if defined(_WIN32) && !defined(__CYGWIN__) failure_start(file, line, "assertFileMode not yet implemented for Windows"); + (void)mode; /* UNUSED */ + (void)r; /* UNUSED */ #else { struct stat st; Modified: stable/10/contrib/libarchive/tar/test/test.h ============================================================================== --- stable/10/contrib/libarchive/tar/test/test.h Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/tar/test/test.h Mon Oct 31 21:57:43 2016 (r308152) @@ -244,7 +244,7 @@ int assertion_file_atime_recent(const ch int assertion_file_birthtime(const char *, int, const char *, long, long); int assertion_file_birthtime_recent(const char *, int, const char *); int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); -int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); +int assertion_file_contains_no_invalid_strings(const char *, int, const char *, const char **); int assertion_file_contents(const char *, int, const void *, int, const char *); int assertion_file_exists(const char *, int, const char *); int assertion_file_mode(const char *, int, const char *, int); Modified: stable/10/contrib/libarchive/tar/test/test_option_b.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/test_option_b.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/tar/test/test_option_b.c Mon Oct 31 21:57:43 2016 (r308152) @@ -33,7 +33,7 @@ DEFINE_TEST(test_option_b) assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { - skipping("Platform doesn't have cat"); + skipping("This test requires a `cat` program"); return; } testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1); Modified: stable/10/contrib/libarchive/tar/test/test_symlink_dir.c ============================================================================== --- stable/10/contrib/libarchive/tar/test/test_symlink_dir.c Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/contrib/libarchive/tar/test/test_symlink_dir.c Mon Oct 31 21:57:43 2016 (r308152) @@ -63,7 +63,7 @@ DEFINE_TEST(test_symlink_dir) /* "dir2" is a symlink to a non-existing "real_dir2" */ assertMakeSymlink("dest1/dir2", "real_dir2"); } else { - skipping("some symlink checks"); + skipping("Symlinks are not supported on this platform"); } /* "dir3" is a symlink to an existing "non_dir3" */ assertMakeFile("dest1/non_dir3", 0755, "abcdef"); Modified: stable/10/usr.bin/bsdcat/Makefile ============================================================================== --- stable/10/usr.bin/bsdcat/Makefile Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/usr.bin/bsdcat/Makefile Mon Oct 31 21:57:43 2016 (r308152) @@ -6,7 +6,7 @@ _LIBARCHIVEDIR= ${.CURDIR}/../../contrib _LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive PROG= bsdcat -BSDCAT_VERSION_STRING= 3.2.1 +BSDCAT_VERSION_STRING= 3.2.2 .PATH: ${_LIBARCHIVEDIR}/cat SRCS= bsdcat.c cmdline.c Modified: stable/10/usr.bin/cpio/Makefile ============================================================================== --- stable/10/usr.bin/cpio/Makefile Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/usr.bin/cpio/Makefile Mon Oct 31 21:57:43 2016 (r308152) @@ -6,7 +6,7 @@ LIBARCHIVEDIR= ${.CURDIR}/../../contrib/ LIBARCHIVECONFDIR= ${.CURDIR}/../../lib/libarchive PROG= bsdcpio -BSDCPIO_VERSION_STRING= 3.2.1 +BSDCPIO_VERSION_STRING= 3.2.2 .PATH: ${LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c Modified: stable/10/usr.bin/tar/Makefile ============================================================================== --- stable/10/usr.bin/tar/Makefile Mon Oct 31 21:57:18 2016 (r308151) +++ stable/10/usr.bin/tar/Makefile Mon Oct 31 21:57:43 2016 (r308152) @@ -4,7 +4,7 @@ LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive PROG= bsdtar -BSDTAR_VERSION_STRING= 3.2.1 +BSDTAR_VERSION_STRING= 3.2.2 .PATH: ${LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ From owner-svn-src-stable-10@freebsd.org Mon Oct 31 22:03:46 2016 Return-Path: Delivered-To: svn-src-stable-10@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 33384C288DE; Mon, 31 Oct 2016 22:03:46 +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 E724D151D; Mon, 31 Oct 2016 22:03:45 +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 u9VM3j4x004905; Mon, 31 Oct 2016 22:03:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VM3jD1004904; Mon, 31 Oct 2016 22:03:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610312203.u9VM3jD1004904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 31 Oct 2016 22:03: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: r308153 - stable/10/sys/dev/cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 22:03:46 -0000 Author: jhb Date: Mon Oct 31 22:03:44 2016 New Revision: 308153 URL: https://svnweb.freebsd.org/changeset/base/308153 Log: MFC 289401: cxgbe(4): support for the kernel RSS option. You need PCBGROUP and RSS in the kernel config to use this. Note: Since RSS is not present in 10.x this is mostly a no-op and is stubbed out by removing the #include of opt_rss.h. This is merged primarily to reduce conflicts in future merges, however it does add a couple of diagnostic messages related to RSS buckets vs RX queue counts. Discussed with: np Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 21:57:43 2016 (r308152) +++ stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 22:03:44 2016 (r308153) @@ -57,6 +57,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef RSS +#include +#endif #if defined(__i386__) || defined(__amd64__) #include #include @@ -3432,6 +3435,71 @@ adapter_full_uninit(struct adapter *sc) return (0); } +#ifdef RSS +#define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \ + RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \ + RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \ + RSS_HASHTYPE_RSS_UDP_IPV6) + +/* Translates kernel hash types to hardware. */ +static int +hashconfig_to_hashen(int hashconfig) +{ + int hashen = 0; + + if (hashconfig & RSS_HASHTYPE_RSS_IPV4) + hashen |= F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN; + if (hashconfig & RSS_HASHTYPE_RSS_IPV6) + hashen |= F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN; + if (hashconfig & RSS_HASHTYPE_RSS_UDP_IPV4) { + hashen |= F_FW_RSS_VI_CONFIG_CMD_UDPEN | + F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN; + } + if (hashconfig & RSS_HASHTYPE_RSS_UDP_IPV6) { + hashen |= F_FW_RSS_VI_CONFIG_CMD_UDPEN | + F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN; + } + if (hashconfig & RSS_HASHTYPE_RSS_TCP_IPV4) + hashen |= F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN; + if (hashconfig & RSS_HASHTYPE_RSS_TCP_IPV6) + hashen |= F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN; + + return (hashen); +} + +/* Translates hardware hash types to kernel. */ +static int +hashen_to_hashconfig(int hashen) +{ + int hashconfig = 0; + + if (hashen & F_FW_RSS_VI_CONFIG_CMD_UDPEN) { + /* + * If UDP hashing was enabled it must have been enabled for + * either IPv4 or IPv6 (inclusive or). Enabling UDP without + * enabling any 4-tuple hash is nonsense configuration. + */ + MPASS(hashen & (F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | + F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN)); + + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_UDP_IPV4; + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_UDP_IPV6; + } + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_TCP_IPV4; + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_TCP_IPV6; + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_IPV4; + if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN) + hashconfig |= RSS_HASHTYPE_RSS_IPV6; + + return (hashconfig); +} +#endif + int port_full_init(struct port_info *pi) { @@ -3439,7 +3507,14 @@ port_full_init(struct port_info *pi) struct ifnet *ifp = pi->ifp; uint16_t *rss; struct sge_rxq *rxq; - int rc, i, j; + int rc, i, j, hashen; +#ifdef RSS + int nbuckets = rss_getnumbuckets(); + int hashconfig = rss_gethashconfig(); + int extra; + uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; + uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; +#endif ASSERT_SYNCHRONIZED_OP(sc); KASSERT((pi->flags & PORT_INIT_DONE) == 0, @@ -3458,13 +3533,42 @@ port_full_init(struct port_info *pi) /* * Setup RSS for this port. Save a copy of the RSS table for later use. */ + if (pi->nrxq > pi->rss_size) { + if_printf(ifp, "nrxq (%d) > hw RSS table size (%d); " + "some queues will never receive traffic.\n", pi->nrxq, + pi->rss_size); + } else if (pi->rss_size % pi->nrxq) { + if_printf(ifp, "nrxq (%d), hw RSS table size (%d); " + "expect uneven traffic distribution.\n", pi->nrxq, + pi->rss_size); + } +#ifdef RSS + MPASS(RSS_KEYSIZE == 40); + if (pi->nrxq != nbuckets) { + if_printf(ifp, "nrxq (%d) != kernel RSS buckets (%d);" + "performance will be impacted.\n", pi->nrxq, nbuckets); + } + + rss_getkey((void *)&raw_rss_key[0]); + for (i = 0; i < nitems(rss_key); i++) { + rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); + } + t4_write_rss_key(sc, (void *)&rss_key[0], -1); +#endif rss = malloc(pi->rss_size * sizeof (*rss), M_CXGBE, M_ZERO | M_WAITOK); for (i = 0; i < pi->rss_size;) { +#ifdef RSS + j = rss_get_indirection_to_bucket(i); + j %= pi->nrxq; + rxq = &sc->sge.rxq[pi->first_rxq + j]; + rss[i++] = rxq->iq.abs_id; +#else for_each_rxq(pi, j, rxq) { rss[i++] = rxq->iq.abs_id; if (i == pi->rss_size) break; } +#endif } rc = -t4_config_rss_range(sc, sc->mbox, pi->viid, 0, pi->rss_size, rss, @@ -3474,6 +3578,54 @@ port_full_init(struct port_info *pi) goto done; } +#ifdef RSS + hashen = hashconfig_to_hashen(hashconfig); + + /* + * We may have had to enable some hashes even though the global config + * wants them disabled. This is a potential problem that must be + * reported to the user. + */ + extra = hashen_to_hashconfig(hashen) ^ hashconfig; + + /* + * If we consider only the supported hash types, then the enabled hashes + * are a superset of the requested hashes. In other words, there cannot + * be any supported hash that was requested but not enabled, but there + * can be hashes that were not requested but had to be enabled. + */ + extra &= SUPPORTED_RSS_HASHTYPES; + MPASS((extra & hashconfig) == 0); + + if (extra) { + if_printf(ifp, + "global RSS config (0x%x) cannot be accomodated.\n", + hashconfig); + } + if (extra & RSS_HASHTYPE_RSS_IPV4) + if_printf(ifp, "IPv4 2-tuple hashing forced on.\n"); + if (extra & RSS_HASHTYPE_RSS_TCP_IPV4) + if_printf(ifp, "TCP/IPv4 4-tuple hashing forced on.\n"); + if (extra & RSS_HASHTYPE_RSS_IPV6) + if_printf(ifp, "IPv6 2-tuple hashing forced on.\n"); + if (extra & RSS_HASHTYPE_RSS_TCP_IPV6) + if_printf(ifp, "TCP/IPv6 4-tuple hashing forced on.\n"); + if (extra & RSS_HASHTYPE_RSS_UDP_IPV4) + if_printf(ifp, "UDP/IPv4 4-tuple hashing forced on.\n"); + if (extra & RSS_HASHTYPE_RSS_UDP_IPV6) + if_printf(ifp, "UDP/IPv6 4-tuple hashing forced on.\n"); +#else + hashen = F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN | + F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN | + F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | + F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN | F_FW_RSS_VI_CONFIG_CMD_UDPEN; +#endif + rc = -t4_config_vi_rss(sc, sc->mbox, pi->viid, hashen, rss[0]); + if (rc != 0) { + if_printf(ifp, "rss hash/defaultq config failed: %d\n", rc); + goto done; + } + pi->rss = rss; pi->flags |= PORT_INIT_DONE; done: @@ -8371,17 +8523,39 @@ tweak_tunables(void) { int nc = mp_ncpus; /* our snapshot of the number of CPUs */ - if (t4_ntxq10g < 1) + if (t4_ntxq10g < 1) { +#ifdef RSS + t4_ntxq10g = rss_getnumbuckets(); +#else t4_ntxq10g = min(nc, NTXQ_10G); +#endif + } - if (t4_ntxq1g < 1) + if (t4_ntxq1g < 1) { +#ifdef RSS + /* XXX: way too many for 1GbE? */ + t4_ntxq1g = rss_getnumbuckets(); +#else t4_ntxq1g = min(nc, NTXQ_1G); +#endif + } - if (t4_nrxq10g < 1) + if (t4_nrxq10g < 1) { +#ifdef RSS + t4_nrxq10g = rss_getnumbuckets(); +#else t4_nrxq10g = min(nc, NRXQ_10G); +#endif + } - if (t4_nrxq1g < 1) + if (t4_nrxq1g < 1) { +#ifdef RSS + /* XXX: way too many for 1GbE? */ + t4_nrxq1g = rss_getnumbuckets(); +#else t4_nrxq1g = min(nc, NRXQ_1G); +#endif + } #ifdef TCP_OFFLOAD if (t4_nofldtxq10g < 1) From owner-svn-src-stable-10@freebsd.org Mon Oct 31 22:45:13 2016 Return-Path: Delivered-To: svn-src-stable-10@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 E151AC283CB; Mon, 31 Oct 2016 22:45:13 +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 7B65519B7; Mon, 31 Oct 2016 22:45:13 +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 u9VMjCiQ019854; Mon, 31 Oct 2016 22:45:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9VMjCTB019847; Mon, 31 Oct 2016 22:45:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201610312245.u9VMjCTB019847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 31 Oct 2016 22:45: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: r308154 - in stable/10: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/iw_cxgbe sys/dev/cxgbe/tom 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 22:45:14 -0000 Author: jhb Date: Mon Oct 31 22:45:11 2016 New Revision: 308154 URL: https://svnweb.freebsd.org/changeset/base/308154 Log: MFC 291665,291685,291856,297467,302110,302263: Add support for VIs. 291665: Add support for configuring additional virtual interfaces (VIs) on a port. Each virtual interface has its own MAC address, queues, and statistics. The dedicated netmap interfaces (ncxgbeX / ncxlX) were already implemented as additional VIs on each port. This change allows additional non-netmap interfaces to be configured on each port. Additional virtual interfaces use the naming scheme vcxgbeX or vcxlX. Additional VIs are enabled by setting the hw.cxgbe.num_vis tunable to a value greater than 1 before loading the cxgbe(4) or cxl(4) driver. NB: The first VI on each port is the "main" interface (cxgbeX or cxlX). T4/T5 NICs provide a limited number of MAC addresses for each physical port. As a result, a maximum of six VIs can be configured on each port (including the "main" interface and the netmap interface when netmap is enabled). One user-visible result is that when netmap is enabled, packets received or transmitted via the netmap interface are no longer counted in the stats for the "main" interface, but are not accounted to the netmap interface. The netmap interfaces now also have a new-bus device and export various information sysctl nodes via dev.n(cxgbe|cxl).X. The cxgbetool 'clearstats' command clears the stats for all VIs on the specified port along with the port's stats. There is currently no way to clear the stats of an individual VI. 291685: Fix build for !TCP_OFFLOAD case. 291856: Fix RSS build. 297467: Remove #ifdef's from various structures used in the cxgbe/cxl driver. This provides a constant ABI and layout for these structures (especially struct adapter) avoiding some foot shooting. 302110: cxgbe(4): Merge netmap support from the ncxgbe/ncxl interfaces to the vcxgbe/vcxl interfaces and retire the 'n' interfaces. The main cxgbe/cxl interfaces and tunables related to them are not affected by any of this and will continue to operate as usual. The driver used to create an additional 'n' interface for every cxgbe/cxl interface if "device netmap" was in the kernel. The 'n' interface shared the wire with the main interface but was otherwise autonomous (with its own MAC address, etc.). It did not have normal tx/rx but had a specialized netmap-only data path. r291665 added another set of virtual interfaces (the 'v' interfaces) to the driver. These had normal tx/rx but no netmap support. This revision consolidates the features of both the interfaces into the 'v' interface which now has a normal data path, TOE support, and native netmap support. The 'v' interfaces need to be created explicitly with the hw.cxgbe.num_vis tunable. This means "device netmap" will not result in the automatic creation of any virtual interfaces. The following tunables can be used to override the default number of queues allocated for each 'v' interface. nofld* = 0 will disable TOE on the virtual interface and nnm* = 0 to will disable native netmap support. # number of normal NIC queues hw.cxgbe.ntxq_vi hw.cxgbe.nrxq_vi # number of TOE queues hw.cxgbe.nofldtxq_vi hw.cxgbe.nofldrxq_vi # number of netmap queues hw.cxgbe.nnmtxq_vi hw.cxgbe.nnmrxq_vi hw.cxgbe.nnm{t,r}xq{10,1}g tunables have been removed. --- tl;dr version --- The workflow for netmap on cxgbe starting with FreeBSD 11 is: 1) "device netmap" in the kernel config. 2) "hw.cxgbe.num_vis=2" in loader.conf. num_vis > 2 is ok too, you'll end up with multiple autonomous netmap-capable interfaces for every port. 3) "dmesg | grep vcxl | grep netmap" to verify that the interface has netmap queues. 4) Use any of the 'v' interfaces for netmap. pkt-gen -i vcxl... . One major improvement is that the netmap interface has a normal data path as expected. 5) Just ignore the cxl interfaces if you want to use netmap only. No need to bring them up. The vcxl interfaces are completely independent and everything should just work. --------------------- 302263: cxgbe(4): Do not bring up an interface when IFCAP_TOE is enabled on it. The interface's queues are functional after VI_INIT_DONE (which is short of interface-up) and that's all that's needed for t4_tom to communicate with the chip. Relnotes: yes Sponsored by: Chelsio Communications Modified: stable/10/share/man/man4/cxgbe.4 stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c stable/10/sys/dev/cxgbe/offload.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_netmap.c stable/10/sys/dev/cxgbe/t4_sge.c stable/10/sys/dev/cxgbe/tom/t4_connect.c stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c stable/10/sys/dev/cxgbe/tom/t4_listen.c stable/10/sys/dev/cxgbe/tom/t4_tom.c stable/10/sys/dev/cxgbe/tom/t4_tom.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/cxgbe.4 ============================================================================== --- stable/10/share/man/man4/cxgbe.4 Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/share/man/man4/cxgbe.4 Mon Oct 31 22:45:11 2016 (r308154) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 20, 2014 +.Dd December 2, 2015 .Dt CXGBE 4 .Os .Sh NAME @@ -171,6 +171,16 @@ number of CPU cores in the system, which .It Va hw.cxgbe.nofldrxq1g The number of TOE rx queues to use for a 1Gb port. The default is 1. +.It Va hw.cxgbe.num_vis +The number of virtual interfaces (VIs) created for each port. +Each virtual interface creates a separate network interface. +The first virtual interface on each port is required and represents +the primary network interface on the port. +Additional virtual interfaces on a port are named vcxgbe (T4) or +vcxl (T5) and only use a single rx and tx queue. +Additional virtual interfaces use a single pair of queues +for rx and tx as well an additional pair of queues for TOE rx and tx. +The default is 1. .It Va hw.cxgbe.holdoff_timer_idx_10G .It Va hw.cxgbe.holdoff_timer_idx_1G The timer index value to use to delay interrupts. Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/sys/dev/cxgbe/adapter.h Mon Oct 31 22:45:11 2016 (r308154) @@ -192,49 +192,46 @@ enum { CXGBE_BUSY = (1 << 9), /* port flags */ - DOOMED = (1 << 0), - PORT_INIT_DONE = (1 << 1), - PORT_SYSCTL_CTX = (1 << 2), HAS_TRACEQ = (1 << 3), + + /* VI flags */ + DOOMED = (1 << 0), + VI_INIT_DONE = (1 << 1), + VI_SYSCTL_CTX = (1 << 2), INTR_RXQ = (1 << 4), /* All NIC rxq's take interrupts */ INTR_OFLD_RXQ = (1 << 5), /* All TOE rxq's take interrupts */ - INTR_NM_RXQ = (1 << 6), /* All netmap rxq's take interrupts */ - INTR_ALL = (INTR_RXQ | INTR_OFLD_RXQ | INTR_NM_RXQ), + INTR_ALL = (INTR_RXQ | INTR_OFLD_RXQ), /* adapter debug_flags */ DF_DUMP_MBOX = (1 << 0), }; -#define IS_DOOMED(pi) ((pi)->flags & DOOMED) -#define SET_DOOMED(pi) do {(pi)->flags |= DOOMED;} while (0) +#define IS_DOOMED(vi) ((vi)->flags & DOOMED) +#define SET_DOOMED(vi) do {(vi)->flags |= DOOMED;} while (0) #define IS_BUSY(sc) ((sc)->flags & CXGBE_BUSY) #define SET_BUSY(sc) do {(sc)->flags |= CXGBE_BUSY;} while (0) #define CLR_BUSY(sc) do {(sc)->flags &= ~CXGBE_BUSY;} while (0) -struct port_info { +struct vi_info { device_t dev; - struct adapter *adapter; + struct port_info *pi; struct ifnet *ifp; struct ifmedia media; - struct mtx pi_lock; - char lockname[16]; unsigned long flags; int if_flags; - uint16_t *rss; + uint16_t *rss, *nm_rss; uint16_t viid; int16_t xact_addr_filt;/* index of exact MAC address filter */ uint16_t rss_size; /* size of VI's RSS table slice */ uint16_t rss_base; /* start of VI's RSS table slice */ - uint8_t lport; /* associated offload logical port */ - int8_t mdio_addr; - uint8_t port_type; - uint8_t mod_type; - uint8_t port_id; - uint8_t tx_chan; - uint8_t rx_chan_map; /* rx MPS channel bitmap */ + + eventhandler_tag vlan_c; + + int nintr; + int first_intr; /* These need to be int as they are used in sysctl */ int ntxq; /* # of tx queues */ @@ -242,30 +239,49 @@ struct port_info { int rsrv_noflowq; /* Reserve queue 0 for non-flowid packets */ int nrxq; /* # of rx queues */ int first_rxq; /* index of first rx queue */ -#ifdef TCP_OFFLOAD int nofldtxq; /* # of offload tx queues */ int first_ofld_txq; /* index of first offload tx queue */ int nofldrxq; /* # of offload rx queues */ int first_ofld_rxq; /* index of first offload rx queue */ -#endif -#ifdef DEV_NETMAP - int nnmtxq; /* # of netmap tx queues */ - int first_nm_txq; /* index of first netmap tx queue */ - int nnmrxq; /* # of netmap rx queues */ - int first_nm_rxq; /* index of first netmap rx queue */ - - struct ifnet *nm_ifp; - struct ifmedia nm_media; - int nmif_flags; - uint16_t nm_viid; - int16_t nm_xact_addr_filt; - uint16_t nm_rss_size; /* size of netmap VI's RSS table slice */ -#endif + int nnmtxq; + int first_nm_txq; + int nnmrxq; + int first_nm_rxq; int tmr_idx; int pktc_idx; int qsize_rxq; int qsize_txq; + struct timeval last_refreshed; + struct fw_vi_stats_vf stats; + + struct callout tick; + struct sysctl_ctx_list ctx; /* from ifconfig up to driver detach */ + + uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ +}; + +struct port_info { + device_t dev; + struct adapter *adapter; + + struct vi_info *vi; + int nvi; + int up_vis; + int uld_vis; + + struct mtx pi_lock; + char lockname[16]; + unsigned long flags; + + uint8_t lport; /* associated offload logical port */ + int8_t mdio_addr; + uint8_t port_type; + uint8_t mod_type; + uint8_t port_id; + uint8_t tx_chan; + uint8_t rx_chan_map; /* rx MPS channel bitmap */ + int linkdnrc; struct link_config link_cfg; @@ -273,14 +289,11 @@ struct port_info { struct port_stats stats; u_int tx_parse_error; - eventhandler_tag vlan_c; - struct callout tick; - struct sysctl_ctx_list ctx; /* from ifconfig up to driver detach */ - - uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ }; +#define IS_MAIN_VI(vi) ((vi) == &((vi)->pi->vi[0])) + /* Where the cluster came from, how it has been carved up. */ struct cluster_layout { int8_t zidx; @@ -292,9 +305,7 @@ struct cluster_layout { struct cluster_metadata { u_int refcount; -#ifdef INVARIANTS struct fl_sdesc *sd; /* For debug only. Could easily be stale */ -#endif }; struct fl_sdesc { @@ -333,6 +344,11 @@ enum { IQS_DISABLED = 0, IQS_BUSY = 1, IQS_IDLE = 2, + + /* netmap related flags */ + NM_OFF = 0, + NM_ON = 1, + NM_BUSY = 2, }; /* @@ -529,7 +545,6 @@ iq_to_rxq(struct sge_iq *iq) } -#ifdef TCP_OFFLOAD /* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ struct sge_ofld_rxq { struct sge_iq iq; /* MUST be first */ @@ -542,7 +557,6 @@ iq_to_ofld_rxq(struct sge_iq *iq) return (__containerof(iq, struct sge_ofld_rxq, iq)); } -#endif struct wrqe { STAILQ_ENTRY(wrqe) link; @@ -594,9 +608,8 @@ struct sge_wrq { } __aligned(CACHE_LINE_SIZE); -#ifdef DEV_NETMAP struct sge_nm_rxq { - struct port_info *pi; + struct vi_info *vi; struct iq_desc *iq_desc; uint16_t iq_abs_id; @@ -649,7 +662,6 @@ struct sge_nm_txq { bus_addr_t ba; int iqidx; } __aligned(CACHE_LINE_SIZE); -#endif struct sge { int timer_val[SGE_NTIMERS]; @@ -661,14 +673,10 @@ struct sge { int nrxq; /* total # of Ethernet rx queues */ int ntxq; /* total # of Ethernet tx tx queues */ -#ifdef TCP_OFFLOAD int nofldrxq; /* total # of TOE rx queues */ int nofldtxq; /* total # of TOE tx queues */ -#endif -#ifdef DEV_NETMAP int nnmrxq; /* total # of netmap rx queues */ int nnmtxq; /* total # of netmap tx queues */ -#endif int niq; /* total # of ingress queues */ int neq; /* total # of egress queues */ @@ -677,14 +685,10 @@ struct sge { struct sge_wrq *ctrlq; /* Control queues */ struct sge_txq *txq; /* NIC tx queues */ struct sge_rxq *rxq; /* NIC rx queues */ -#ifdef TCP_OFFLOAD struct sge_wrq *ofld_txq; /* TOE tx queues */ struct sge_ofld_rxq *ofld_rxq; /* TOE rx queues */ -#endif -#ifdef DEV_NETMAP struct sge_nm_txq *nm_txq; /* netmap tx queues */ struct sge_nm_rxq *nm_rxq; /* netmap rx queues */ -#endif uint16_t iq_start; int eq_start; @@ -731,8 +735,11 @@ struct adapter { struct irq { struct resource *res; int rid; + volatile int nm_state; /* NM_OFF, NM_ON, or NM_BUSY */ void *tag; - } *irq; + struct sge_rxq *rxq; + struct sge_nm_rxq *nm_rxq; + } __aligned(CACHE_LINE_SIZE) *irq; bus_dma_tag_t dmat; /* Parent DMA tag */ @@ -743,21 +750,16 @@ struct adapter { struct port_info *port[MAX_NPORTS]; uint8_t chan_map[NCHAN]; -#ifdef TCP_OFFLOAD void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; void *iwarp_softc; /* (struct c4iw_dev *) */ void *iscsi_softc; -#endif struct l2t_data *l2t; /* L2 table */ struct tid_info tids; uint16_t doorbells; - int open_device_map; -#ifdef TCP_OFFLOAD int offload_map; /* ports with IFCAP_TOE enabled */ int active_ulds; /* ULDs activated on this adapter */ -#endif int flags; int debug_flags; @@ -798,11 +800,9 @@ struct adapter { fw_msg_handler_t fw_msg_handler[5]; /* NUM_FW6_TYPES */ cpl_handler_t cpl_handler[0xef]; /* NUM_CPL_CMDS */ -#ifdef INVARIANTS const char *last_op; const void *last_op_thr; int last_op_flags; -#endif int sc_do_rxcopy; }; @@ -863,24 +863,27 @@ struct adapter { } \ } while (0) -#define for_each_txq(pi, iter, q) \ - for (q = &pi->adapter->sge.txq[pi->first_txq], iter = 0; \ - iter < pi->ntxq; ++iter, ++q) -#define for_each_rxq(pi, iter, q) \ - for (q = &pi->adapter->sge.rxq[pi->first_rxq], iter = 0; \ - iter < pi->nrxq; ++iter, ++q) -#define for_each_ofld_txq(pi, iter, q) \ - for (q = &pi->adapter->sge.ofld_txq[pi->first_ofld_txq], iter = 0; \ - iter < pi->nofldtxq; ++iter, ++q) -#define for_each_ofld_rxq(pi, iter, q) \ - for (q = &pi->adapter->sge.ofld_rxq[pi->first_ofld_rxq], iter = 0; \ - iter < pi->nofldrxq; ++iter, ++q) -#define for_each_nm_txq(pi, iter, q) \ - for (q = &pi->adapter->sge.nm_txq[pi->first_nm_txq], iter = 0; \ - iter < pi->nnmtxq; ++iter, ++q) -#define for_each_nm_rxq(pi, iter, q) \ - for (q = &pi->adapter->sge.nm_rxq[pi->first_nm_rxq], iter = 0; \ - iter < pi->nnmrxq; ++iter, ++q) +#define for_each_txq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.txq[vi->first_txq], iter = 0; \ + iter < vi->ntxq; ++iter, ++q) +#define for_each_rxq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.rxq[vi->first_rxq], iter = 0; \ + iter < vi->nrxq; ++iter, ++q) +#define for_each_ofld_txq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.ofld_txq[vi->first_ofld_txq], iter = 0; \ + iter < vi->nofldtxq; ++iter, ++q) +#define for_each_ofld_rxq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.ofld_rxq[vi->first_ofld_rxq], iter = 0; \ + iter < vi->nofldrxq; ++iter, ++q) +#define for_each_nm_txq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.nm_txq[vi->first_nm_txq], iter = 0; \ + iter < vi->nnmtxq; ++iter, ++q) +#define for_each_nm_rxq(vi, iter, q) \ + for (q = &vi->pi->adapter->sge.nm_rxq[vi->first_nm_rxq], iter = 0; \ + iter < vi->nnmrxq; ++iter, ++q) +#define for_each_vi(_pi, _iter, _vi) \ + for ((_vi) = (_pi)->vi, (_iter) = 0; (_iter) < (_pi)->nvi; \ + ++(_iter), ++(_vi)) #define IDXINCR(idx, incr, wrap) do { \ idx = wrap - idx > incr ? idx + incr : incr - (wrap - idx); \ @@ -972,7 +975,7 @@ static inline void t4_os_set_hw_addr(struct adapter *sc, int idx, uint8_t hw_addr[]) { - bcopy(hw_addr, sc->port[idx]->hw_addr, ETHER_ADDR_LEN); + bcopy(hw_addr, sc->port[idx]->vi[0].hw_addr, ETHER_ADDR_LEN); } static inline bool @@ -1008,18 +1011,22 @@ int t4_register_cpl_handler(struct adapt int t4_register_an_handler(struct adapter *, an_handler_t); int t4_register_fw_msg_handler(struct adapter *, int, fw_msg_handler_t); int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); -int begin_synchronized_op(struct adapter *, struct port_info *, int, char *); +int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *); +void doom_vi(struct adapter *, struct vi_info *); void end_synchronized_op(struct adapter *, int); int update_mac_settings(struct ifnet *, int); int adapter_full_init(struct adapter *); int adapter_full_uninit(struct adapter *); -int port_full_init(struct port_info *); -int port_full_uninit(struct port_info *); +uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); +int vi_full_init(struct vi_info *); +int vi_full_uninit(struct vi_info *); +void vi_sysctls(struct vi_info *); +void vi_tick(void *); #ifdef DEV_NETMAP /* t4_netmap.c */ -int create_netmap_ifnet(struct port_info *); -int destroy_netmap_ifnet(struct port_info *); +void cxgbe_nm_attach(struct vi_info *); +void cxgbe_nm_detach(struct vi_info *); void t4_nm_intr(void *); #endif @@ -1036,10 +1043,11 @@ void t4_sge_sysctls(struct adapter *, st int t4_destroy_dma_tag(struct adapter *); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); -int t4_setup_port_queues(struct port_info *); -int t4_teardown_port_queues(struct port_info *); +int t4_setup_vi_queues(struct vi_info *); +int t4_teardown_vi_queues(struct vi_info *); void t4_intr_all(void *); void t4_intr(void *); +void t4_vi_intr(void *); void t4_intr_err(void *); void t4_intr_evt(void *); void t4_wrq_tx_locked(struct adapter *, struct sge_wrq *, struct wrqe *); Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Mon Oct 31 22:45:11 2016 (r308154) @@ -5720,11 +5720,11 @@ int __devinit t4_port_init(struct port_i if (ret < 0) return ret; - p->viid = ret; + p->vi[0].viid = ret; p->tx_chan = j; p->rx_chan_map = get_mps_bg_map(adap, j); p->lport = j; - p->rss_size = rss_size; + p->vi[0].rss_size = rss_size; t4_os_set_hw_addr(adap, p->port_id, addr); ret = ntohl(c.u.info.lstatus_to_modtype); @@ -5737,13 +5737,13 @@ int __devinit t4_port_init(struct port_i param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) | - V_FW_PARAMS_PARAM_YZ(p->viid); + V_FW_PARAMS_PARAM_YZ(p->vi[0].viid); ret = t4_query_params(adap, mbox, pf, vf, 1, ¶m, &val); if (ret) - p->rss_base = 0xffff; + p->vi[0].rss_base = 0xffff; else { /* MPASS((val >> 16) == rss_size); */ - p->rss_base = val & 0xffff; + p->vi[0].rss_base = val & 0xffff; } return 0; Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c ============================================================================== --- stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c Mon Oct 31 22:45:11 2016 (r308154) @@ -296,7 +296,7 @@ c4iw_query_gid(struct ib_device *ibdev, if (port == 0 || port > sc->params.nports) return (-EINVAL); pi = sc->port[port - 1]; - memcpy(&gid->raw[0], pi->hw_addr, sizeof(pi->hw_addr)); + memcpy(&gid->raw[0], pi->vi[0].hw_addr, ETHER_ADDR_LEN); return (0); } @@ -309,7 +309,8 @@ c4iw_query_device(struct ib_device *ibde CTR3(KTR_IW_CXGBE, "%s ibdev %p, props %p", __func__, ibdev, props); memset(props, 0, sizeof *props); - memcpy(&props->sys_image_guid, sc->port[0]->hw_addr, 6); + memcpy(&props->sys_image_guid, sc->port[0]->vi[0].hw_addr, + ETHER_ADDR_LEN); props->hw_ver = sc->params.chipid; props->fw_ver = sc->params.fw_vers; props->device_cap_flags = dev->device_cap_flags; @@ -352,7 +353,7 @@ c4iw_query_port(struct ib_device *ibdev, if (port > sc->params.nports) return (-EINVAL); pi = sc->port[port - 1]; - ifp = pi->ifp; + ifp = pi->vi[0].ifp; memset(props, 0, sizeof(struct ib_port_attr)); props->max_mtu = IB_MTU_4096; @@ -397,7 +398,7 @@ c4iw_register_device(struct c4iw_dev *de BUG_ON(!sc->port[0]); strlcpy(ibdev->name, device_get_nameunit(sc->dev), sizeof(ibdev->name)); memset(&ibdev->node_guid, 0, sizeof(ibdev->node_guid)); - memcpy(&ibdev->node_guid, sc->port[0]->hw_addr, 6); + memcpy(&ibdev->node_guid, sc->port[0]->vi[0].hw_addr, ETHER_ADDR_LEN); ibdev->owner = THIS_MODULE; dev->device_cap_flags = IB_DEVICE_LOCAL_DMA_LKEY | IB_DEVICE_MEM_WINDOW; if (fastreg_support) Modified: stable/10/sys/dev/cxgbe/offload.h ============================================================================== --- stable/10/sys/dev/cxgbe/offload.h Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/sys/dev/cxgbe/offload.h Mon Oct 31 22:45:11 2016 (r308154) @@ -125,7 +125,6 @@ struct t4_virt_res { struct t4_range l2t; }; -#ifdef TCP_OFFLOAD enum { ULD_TOM = 0, ULD_IWARP, @@ -152,6 +151,7 @@ struct tom_tunables { int tx_align; }; +#ifdef TCP_OFFLOAD int t4_register_uld(struct uld_info *); int t4_unregister_uld(struct uld_info *); int t4_activate_uld(struct adapter *, int); Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 22:03:44 2016 (r308153) +++ stable/10/sys/dev/cxgbe/t4_main.c Mon Oct 31 22:45:11 2016 (r308154) @@ -107,6 +107,22 @@ static driver_t cxgbe_driver = { sizeof(struct port_info) }; +/* T4 VI (vcxgbe) interface */ +static int vcxgbe_probe(device_t); +static int vcxgbe_attach(device_t); +static int vcxgbe_detach(device_t); +static device_method_t vcxgbe_methods[] = { + DEVMETHOD(device_probe, vcxgbe_probe), + DEVMETHOD(device_attach, vcxgbe_attach), + DEVMETHOD(device_detach, vcxgbe_detach), + { 0, 0 } +}; +static driver_t vcxgbe_driver = { + "vcxgbe", + vcxgbe_methods, + sizeof(struct vi_info) +}; + static d_ioctl_t t4_ioctl; static d_open_t t4_open; static d_close_t t4_close; @@ -143,6 +159,13 @@ static driver_t cxl_driver = { sizeof(struct port_info) }; +/* T5 VI (vcxl) interface */ +static driver_t vcxl_driver = { + "vcxl", + vcxgbe_methods, + sizeof(struct vi_info) +}; + static struct cdevsw t5_cdevsw = { .d_version = D_VERSION, .d_flags = 0, @@ -203,6 +226,14 @@ TUNABLE_INT("hw.cxgbe.ntxq1g", &t4_ntxq1 static int t4_nrxq1g = -1; TUNABLE_INT("hw.cxgbe.nrxq1g", &t4_nrxq1g); +#define NTXQ_VI 1 +static int t4_ntxq_vi = -1; +TUNABLE_INT("hw.cxgbe.ntxq_vi", &t4_ntxq_vi); + +#define NRXQ_VI 1 +static int t4_nrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nrxq_vi", &t4_nrxq_vi); + static int t4_rsrv_noflowq = 0; TUNABLE_INT("hw.cxgbe.rsrv_noflowq", &t4_rsrv_noflowq); @@ -222,24 +253,24 @@ TUNABLE_INT("hw.cxgbe.nofldtxq1g", &t4_n #define NOFLDRXQ_1G 1 static int t4_nofldrxq1g = -1; TUNABLE_INT("hw.cxgbe.nofldrxq1g", &t4_nofldrxq1g); + +#define NOFLDTXQ_VI 1 +static int t4_nofldtxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nofldtxq_vi", &t4_nofldtxq_vi); + +#define NOFLDRXQ_VI 1 +static int t4_nofldrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nofldrxq_vi", &t4_nofldrxq_vi); #endif #ifdef DEV_NETMAP -#define NNMTXQ_10G 2 -static int t4_nnmtxq10g = -1; -TUNABLE_INT("hw.cxgbe.nnmtxq10g", &t4_nnmtxq10g); - -#define NNMRXQ_10G 2 -static int t4_nnmrxq10g = -1; -TUNABLE_INT("hw.cxgbe.nnmrxq10g", &t4_nnmrxq10g); - -#define NNMTXQ_1G 1 -static int t4_nnmtxq1g = -1; -TUNABLE_INT("hw.cxgbe.nnmtxq1g", &t4_nnmtxq1g); - -#define NNMRXQ_1G 1 -static int t4_nnmrxq1g = -1; -TUNABLE_INT("hw.cxgbe.nnmrxq1g", &t4_nnmrxq1g); +#define NNMTXQ_VI 2 +static int t4_nnmtxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nnmtxq_vi", &t4_nnmtxq_vi); + +#define NNMRXQ_VI 2 +static int t4_nnmrxq_vi = -1; +TUNABLE_INT("hw.cxgbe.nnmrxq_vi", &t4_nnmrxq_vi); #endif /* @@ -327,6 +358,19 @@ TUNABLE_INT("hw.cxgbe.fcoecaps_allowed", static int t5_write_combine = 0; TUNABLE_INT("hw.cxl.write_combine", &t5_write_combine); +static int t4_num_vis = 1; +TUNABLE_INT("hw.cxgbe.num_vis", &t4_num_vis); + +/* Functions used by extra VIs to obtain unique MAC addresses for each VI. */ +static int vi_mac_funcs[] = { + FW_VI_FUNC_OFLD, + FW_VI_FUNC_IWARP, + FW_VI_FUNC_OPENISCSI, + FW_VI_FUNC_OPENFCOE, + FW_VI_FUNC_FOISCSI, + FW_VI_FUNC_FOFCOE, +}; + struct intrs_and_queues { uint16_t intr_type; /* INTx, MSI, or MSI-X */ uint16_t nirq; /* Total # of vectors */ @@ -337,18 +381,18 @@ struct intrs_and_queues { uint16_t ntxq1g; /* # of NIC txq's for each 1G port */ uint16_t nrxq1g; /* # of NIC rxq's for each 1G port */ uint16_t rsrv_noflowq; /* Flag whether to reserve queue 0 */ -#ifdef TCP_OFFLOAD uint16_t nofldtxq10g; /* # of TOE txq's for each 10G port */ uint16_t nofldrxq10g; /* # of TOE rxq's for each 10G port */ uint16_t nofldtxq1g; /* # of TOE txq's for each 1G port */ uint16_t nofldrxq1g; /* # of TOE rxq's for each 1G port */ -#endif -#ifdef DEV_NETMAP - uint16_t nnmtxq10g; /* # of netmap txq's for each 10G port */ - uint16_t nnmrxq10g; /* # of netmap rxq's for each 10G port */ - uint16_t nnmtxq1g; /* # of netmap txq's for each 1G port */ - uint16_t nnmrxq1g; /* # of netmap rxq's for each 1G port */ -#endif + + /* The vcxgbe/vcxl interfaces use these and not the ones above. */ + uint16_t ntxq_vi; /* # of NIC txq's */ + uint16_t nrxq_vi; /* # of NIC rxq's */ + uint16_t nofldtxq_vi; /* # of TOE txq's */ + uint16_t nofldrxq_vi; /* # of TOE rxq's */ + uint16_t nnmtxq_vi; /* # of netmap txq's */ + uint16_t nnmrxq_vi; /* # of netmap rxq's */ }; struct filter_entry { @@ -370,7 +414,7 @@ static int validate_mt_off_len(struct ad uint32_t *); static void memwin_info(struct adapter *, int, uint32_t *, uint32_t *); static uint32_t position_memwin(struct adapter *, int, uint32_t); -static int cfg_itype_and_nqueues(struct adapter *, int, int, +static int cfg_itype_and_nqueues(struct adapter *, int, int, int, struct intrs_and_queues *); static int prep_firmware(struct adapter *); static int partition_resources(struct adapter *, const struct firmware *, @@ -380,8 +424,8 @@ static int get_params__post_init(struct static int set_params__post_init(struct adapter *); static void t4_set_desc(struct adapter *); static void build_medialist(struct port_info *, struct ifmedia *); -static int cxgbe_init_synchronized(struct port_info *); -static int cxgbe_uninit_synchronized(struct port_info *); +static int cxgbe_init_synchronized(struct vi_info *); +static int cxgbe_uninit_synchronized(struct vi_info *); static int setup_intr_handlers(struct adapter *); static void quiesce_txq(struct adapter *, struct sge_txq *); static void quiesce_wrq(struct adapter *, struct sge_wrq *); @@ -393,6 +437,7 @@ static int t4_free_irq(struct adapter *, static void reg_block_dump(struct adapter *, uint8_t *, unsigned int, unsigned int); static void t4_get_regs(struct adapter *, struct t4_regdump *, uint8_t *); +static void vi_refresh_stats(struct adapter *, struct vi_info *); static void cxgbe_refresh_stats(struct adapter *, struct port_info *); static void cxgbe_tick(void *); static void cxgbe_vlan_config(void *, struct ifnet *, uint16_t); @@ -400,8 +445,8 @@ static int cpl_not_handled(struct sge_iq struct mbuf *); static int an_not_handled(struct sge_iq *, const struct rsp_ctrl *); static int fw_msg_not_handled(struct adapter *, const __be64 *); -static int t4_sysctls(struct adapter *); -static int cxgbe_sysctls(struct port_info *); +static void t4_sysctls(struct adapter *); +static void cxgbe_sysctls(struct port_info *); static int sysctl_int_array(SYSCTL_HANDLER_ARGS); static int sysctl_bitfield(SYSCTL_HANDLER_ARGS); static int sysctl_btphy(SYSCTL_HANDLER_ARGS); @@ -459,7 +504,7 @@ static int read_i2c(struct adapter *, st static int set_sched_class(struct adapter *, struct t4_sched_params *); static int set_sched_queue(struct adapter *, struct t4_sched_queue *); #ifdef TCP_OFFLOAD -static int toe_capability(struct port_info *, int); +static int toe_capability(struct vi_info *, int); #endif static int mod_event(module_t, int, void *); @@ -604,7 +649,7 @@ static int t4_attach(device_t dev) { struct adapter *sc; - int rc = 0, i, n10g, n1g, rqidx, tqidx; + int rc = 0, i, j, n10g, n1g, rqidx, tqidx; struct intrs_and_queues iaq; struct sge *s; #ifdef TCP_OFFLOAD @@ -613,6 +658,7 @@ t4_attach(device_t dev) #ifdef DEV_NETMAP int nm_rqidx, nm_tqidx; #endif + int num_vis; sc = device_get_softc(dev); sc->dev = dev; @@ -646,7 +692,7 @@ t4_attach(device_t dev) mtx_init(&sc->sfl_lock, "starving freelists", 0, MTX_DEF); TAILQ_INIT(&sc->sfl); - callout_init(&sc->sfl_callout, CALLOUT_MPSAFE); + callout_init_mtx(&sc->sfl_callout, &sc->sfl_lock, 0); mtx_init(&sc->regwin_lock, "register and memory window", 0, MTX_DEF); @@ -731,6 +777,24 @@ t4_attach(device_t dev) goto done; /* error message displayed already */ /* + * Number of VIs to create per-port. The first VI is the "main" regular + * VI for the port. The rest are additional virtual interfaces on the + * same physical port. Note that the main VI does not have native + * netmap support but the extra VIs do. + * + * Limit the number of VIs per port to the number of available + * MAC addresses per port. + */ + if (t4_num_vis >= 1) + num_vis = t4_num_vis; + else + num_vis = 1; + if (num_vis > nitems(vi_mac_funcs)) { + num_vis = nitems(vi_mac_funcs); + device_printf(dev, "Number of VIs limited to %d\n", num_vis); + } + + /* * First pass over all the ports - allocate VIs and initialize some * basic parameters like mac address, port type, etc. We also figure * out whether a port is 10G or 1G and use that information when @@ -746,12 +810,22 @@ t4_attach(device_t dev) /* These must be set before t4_port_init */ pi->adapter = sc; pi->port_id = i; + /* + * XXX: vi[0] is special so we can't delay this allocation until + * pi->nvi's final value is known. + */ + pi->vi = malloc(sizeof(struct vi_info) * num_vis, M_CXGBE, + M_ZERO | M_WAITOK); - /* Allocate the vi and initialize parameters like mac addr */ + /* + * Allocate the "main" VI and initialize parameters + * like mac addr. + */ rc = -t4_port_init(pi, sc->mbox, sc->pf, 0); if (rc != 0) { device_printf(dev, "unable to initialize port %d: %d\n", i, rc); + free(pi->vi, M_CXGBE); free(pi, M_CXGBE); sc->port[i] = NULL; goto done; @@ -765,6 +839,7 @@ t4_attach(device_t dev) rc = -t4_link_start(sc, sc->mbox, pi->tx_chan, &pi->link_cfg); if (rc != 0) { device_printf(dev, "port %d l1cfg failed: %d\n", i, rc); + free(pi->vi, M_CXGBE); free(pi, M_CXGBE); sc->port[i] = NULL; goto done; @@ -777,20 +852,12 @@ t4_attach(device_t dev) if (is_10G_port(pi) || is_40G_port(pi)) { n10g++; - pi->tmr_idx = t4_tmr_idx_10g; - pi->pktc_idx = t4_pktc_idx_10g; } else { n1g++; - pi->tmr_idx = t4_tmr_idx_1g; - pi->pktc_idx = t4_pktc_idx_1g; } - pi->xact_addr_filt = -1; pi->linkdnrc = -1; - pi->qsize_rxq = t4_qsize_rxq; - pi->qsize_txq = t4_qsize_txq; - pi->dev = device_add_child(dev, is_t4(sc) ? "cxgbe" : "cxl", -1); if (pi->dev == NULL) { device_printf(dev, @@ -798,15 +865,18 @@ t4_attach(device_t dev) rc = ENXIO; goto done; } + pi->vi[0].dev = pi->dev; device_set_softc(pi->dev, pi); } /* * Interrupt type, # of interrupts, # of rx/tx queues, etc. */ - rc = cfg_itype_and_nqueues(sc, n10g, n1g, &iaq); + rc = cfg_itype_and_nqueues(sc, n10g, n1g, num_vis, &iaq); if (rc != 0) goto done; /* error message displayed already */ + if (iaq.nrxq_vi + iaq.nofldrxq_vi + iaq.nnmrxq_vi == 0) + num_vis = 1; sc->intr_type = iaq.intr_type; sc->intr_count = iaq.nirq; @@ -814,6 +884,10 @@ t4_attach(device_t dev) s = &sc->sge; s->nrxq = n10g * iaq.nrxq10g + n1g * iaq.nrxq1g; s->ntxq = n10g * iaq.ntxq10g + n1g * iaq.ntxq1g; + if (num_vis > 1) { + s->nrxq += (n10g + n1g) * (num_vis - 1) * iaq.nrxq_vi; + s->ntxq += (n10g + n1g) * (num_vis - 1) * iaq.ntxq_vi; + } s->neq = s->ntxq + s->nrxq; /* the free list in an rxq is an eq */ s->neq += sc->params.nports + 1;/* ctrl queues: 1 per port + 1 mgmt */ s->niq = s->nrxq + 1; /* 1 extra for firmware event queue */ @@ -821,6 +895,12 @@ t4_attach(device_t dev) if (is_offload(sc)) { s->nofldrxq = n10g * iaq.nofldrxq10g + n1g * iaq.nofldrxq1g; s->nofldtxq = n10g * iaq.nofldtxq10g + n1g * iaq.nofldtxq1g; + if (num_vis > 1) { + s->nofldrxq += (n10g + n1g) * (num_vis - 1) * + iaq.nofldrxq_vi; + s->nofldtxq += (n10g + n1g) * (num_vis - 1) * + iaq.nofldtxq_vi; + } s->neq += s->nofldtxq + s->nofldrxq; s->niq += s->nofldrxq; @@ -831,8 +911,10 @@ t4_attach(device_t dev) } #endif #ifdef DEV_NETMAP - s->nnmrxq = n10g * iaq.nnmrxq10g + n1g * iaq.nnmrxq1g; - s->nnmtxq = n10g * iaq.nnmtxq10g + n1g * iaq.nnmtxq1g; + if (num_vis > 1) { + s->nnmrxq = (n10g + n1g) * (num_vis - 1) * iaq.nnmrxq_vi; + s->nnmtxq = (n10g + n1g) * (num_vis - 1) * iaq.nnmtxq_vi; + } s->neq += s->nnmtxq + s->nnmrxq; s->niq += s->nnmrxq; @@ -871,57 +953,70 @@ t4_attach(device_t dev) #endif for_each_port(sc, i) { struct port_info *pi = sc->port[i]; + struct vi_info *vi; if (pi == NULL) continue; - pi->first_rxq = rqidx; - pi->first_txq = tqidx; - if (is_10G_port(pi) || is_40G_port(pi)) { - pi->flags |= iaq.intr_flags_10g; - pi->nrxq = iaq.nrxq10g; - pi->ntxq = iaq.ntxq10g; - } else { - pi->flags |= iaq.intr_flags_1g; - pi->nrxq = iaq.nrxq1g; - pi->ntxq = iaq.ntxq1g; - } + pi->nvi = num_vis; + for_each_vi(pi, j, vi) { + vi->pi = pi; + vi->qsize_rxq = t4_qsize_rxq; + vi->qsize_txq = t4_qsize_txq; - if (pi->ntxq > 1) - pi->rsrv_noflowq = iaq.rsrv_noflowq ? 1 : 0; - else - pi->rsrv_noflowq = 0; + vi->first_rxq = rqidx; + vi->first_txq = tqidx; + if (is_10G_port(pi) || is_40G_port(pi)) { + vi->tmr_idx = t4_tmr_idx_10g; + vi->pktc_idx = t4_pktc_idx_10g; + vi->flags |= iaq.intr_flags_10g & INTR_RXQ; + vi->nrxq = j == 0 ? iaq.nrxq10g : iaq.nrxq_vi; + vi->ntxq = j == 0 ? iaq.ntxq10g : iaq.ntxq_vi; + } else { + vi->tmr_idx = t4_tmr_idx_1g; + vi->pktc_idx = t4_pktc_idx_1g; + vi->flags |= iaq.intr_flags_1g & INTR_RXQ; + vi->nrxq = j == 0 ? iaq.nrxq1g : iaq.nrxq_vi; + vi->ntxq = j == 0 ? iaq.ntxq1g : iaq.ntxq_vi; + } + rqidx += vi->nrxq; + tqidx += vi->ntxq; + + if (j == 0 && vi->ntxq > 1) + vi->rsrv_noflowq = iaq.rsrv_noflowq ? 1 : 0; + else + vi->rsrv_noflowq = 0; - rqidx += pi->nrxq; - tqidx += pi->ntxq; #ifdef TCP_OFFLOAD - if (is_offload(sc)) { - pi->first_ofld_rxq = ofld_rqidx; - pi->first_ofld_txq = ofld_tqidx; + vi->first_ofld_rxq = ofld_rqidx; + vi->first_ofld_txq = ofld_tqidx; if (is_10G_port(pi) || is_40G_port(pi)) { - pi->nofldrxq = iaq.nofldrxq10g; - pi->nofldtxq = iaq.nofldtxq10g; + vi->flags |= iaq.intr_flags_10g & INTR_OFLD_RXQ; + vi->nofldrxq = j == 0 ? iaq.nofldrxq10g : + iaq.nofldrxq_vi; + vi->nofldtxq = j == 0 ? iaq.nofldtxq10g : + iaq.nofldtxq_vi; } else { - pi->nofldrxq = iaq.nofldrxq1g; - pi->nofldtxq = iaq.nofldtxq1g; + vi->flags |= iaq.intr_flags_1g & INTR_OFLD_RXQ; + vi->nofldrxq = j == 0 ? iaq.nofldrxq1g : + iaq.nofldrxq_vi; + vi->nofldtxq = j == 0 ? iaq.nofldtxq1g : + iaq.nofldtxq_vi; } - ofld_rqidx += pi->nofldrxq; - ofld_tqidx += pi->nofldtxq; - } + ofld_rqidx += vi->nofldrxq; + ofld_tqidx += vi->nofldtxq; #endif #ifdef DEV_NETMAP - pi->first_nm_rxq = nm_rqidx; - pi->first_nm_txq = nm_tqidx; - if (is_10G_port(pi) || is_40G_port(pi)) { - pi->nnmrxq = iaq.nnmrxq10g; - pi->nnmtxq = iaq.nnmtxq10g; - } else { - pi->nnmrxq = iaq.nnmrxq1g; - pi->nnmtxq = iaq.nnmtxq1g; - } - nm_rqidx += pi->nnmrxq; - nm_tqidx += pi->nnmtxq; + if (j > 0) { + vi->first_nm_rxq = nm_rqidx; + vi->first_nm_txq = nm_tqidx; + vi->nnmrxq = iaq.nnmrxq_vi; + vi->nnmtxq = iaq.nnmtxq_vi; + nm_rqidx += vi->nnmrxq; + nm_tqidx += vi->nnmtxq; + } #endif + } } rc = setup_intr_handlers(sc); @@ -996,11 +1091,12 @@ t4_detach(device_t dev) for (i = 0; i < MAX_NPORTS; i++) { pi = sc->port[i]; if (pi) { - t4_free_vi(sc, sc->mbox, sc->pf, 0, pi->viid); + t4_free_vi(sc, sc->mbox, sc->pf, 0, pi->vi[0].viid); if (pi->dev) device_delete_child(dev, pi->dev); mtx_destroy(&pi->pi_lock); + free(pi->vi, M_CXGBE); free(pi, M_CXGBE); } } @@ -1052,6 +1148,7 @@ t4_detach(device_t dev) mtx_destroy(&sc->sc_lock); } + callout_drain(&sc->sfl_callout); if (mtx_initialized(&sc->tids.ftid_lock)) mtx_destroy(&sc->tids.ftid_lock); if (mtx_initialized(&sc->sfl_lock)) @@ -1084,12 +1181,13 @@ cxgbe_probe(device_t dev) #define T4_CAP_ENABLE (T4_CAP) static int -cxgbe_attach(device_t dev) +cxgbe_vi_attach(device_t dev, struct vi_info *vi) { - struct port_info *pi = device_get_softc(dev); struct ifnet *ifp; - char *s; - int n, o; + struct sbuf *sb; + + vi->xact_addr_filt = -1; + callout_init(&vi->tick, 1); /* Allocate an ifnet and set it up */ ifp = if_alloc(IFT_ETHER); @@ -1097,10 +1195,8 @@ cxgbe_attach(device_t dev) device_printf(dev, "Cannot allocate ifnet\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Wed Nov 2 06:58:49 2016 Return-Path: Delivered-To: svn-src-stable-10@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 4210DC2B999; Wed, 2 Nov 2016 06:58:49 +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 DCB2C159B; Wed, 2 Nov 2016 06:58:48 +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 uA26wmw6066798; Wed, 2 Nov 2016 06:58:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA26wmiA066797; Wed, 2 Nov 2016 06:58:48 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201611020658.uA26wmiA066797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Nov 2016 06:58:48 +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: r308199 - stable/10/crypto/openssh 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 06:58:49 -0000 Author: delphij Date: Wed Nov 2 06:58:47 2016 New Revision: 308199 URL: https://svnweb.freebsd.org/changeset/base/308199 Log: MFC r308197: MFV r308196: Fix OpenSSH remote Denial of Service vulnerability. Security: CVE-2016-8858 Modified: stable/10/crypto/openssh/kex.c Directory Properties: stable/10/ (props changed) Modified: stable/10/crypto/openssh/kex.c ============================================================================== --- stable/10/crypto/openssh/kex.c Wed Nov 2 06:56:35 2016 (r308198) +++ stable/10/crypto/openssh/kex.c Wed Nov 2 06:58:47 2016 (r308199) @@ -468,6 +468,7 @@ kex_input_kexinit(int type, u_int32_t se if (kex == NULL) return SSH_ERR_INVALID_ARGUMENT; + ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL); ptr = sshpkt_ptr(ssh, &dlen); if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0) return r; From owner-svn-src-stable-10@freebsd.org Wed Nov 2 07:09:34 2016 Return-Path: Delivered-To: svn-src-stable-10@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 26BD2C2BB71; Wed, 2 Nov 2016 07:09:34 +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 D0B081584; Wed, 2 Nov 2016 07:09:33 +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 uA279XXX070571; Wed, 2 Nov 2016 07:09:33 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA279WM3070566; Wed, 2 Nov 2016 07:09:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201611020709.uA279WM3070566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 2 Nov 2016 07:09:32 +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: r308200 - in stable: 10/crypto/openssl/ssl 9/crypto/openssl/ssl 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 07:09:34 -0000 Author: delphij Date: Wed Nov 2 07:09:31 2016 New Revision: 308200 URL: https://svnweb.freebsd.org/changeset/base/308200 Log: Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401: Don't allow too many consecutive warning alerts Certain warning alerts are ignored if they are received. This can mean that no progress will be made if one peer continually sends those warning alerts. Implement a count so that we abort the connection if we receive too many. Issue reported by Shi Lei. This is a direct commit to stable/10 and stable/9. Security: CVE-2016-8610 Modified: stable/10/crypto/openssl/ssl/d1_pkt.c stable/10/crypto/openssl/ssl/s3_pkt.c stable/10/crypto/openssl/ssl/ssl.h stable/10/crypto/openssl/ssl/ssl3.h stable/10/crypto/openssl/ssl/ssl_locl.h Changes in other areas also in this revision: Modified: stable/9/crypto/openssl/ssl/d1_pkt.c stable/9/crypto/openssl/ssl/s3_pkt.c stable/9/crypto/openssl/ssl/ssl.h stable/9/crypto/openssl/ssl/ssl3.h stable/9/crypto/openssl/ssl/ssl_locl.h Modified: stable/10/crypto/openssl/ssl/d1_pkt.c ============================================================================== --- stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 06:58:47 2016 (r308199) +++ stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 07:09:31 2016 (r308200) @@ -924,6 +924,13 @@ int dtls1_read_bytes(SSL *s, int type, u goto start; } + /* + * Reset the count of consecutive warning alerts if we've got a non-empty + * record that isn't an alert. + */ + if (rr->type != SSL3_RT_ALERT && rr->length != 0) + s->s3->alert_count = 0; + /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, @@ -1190,6 +1197,14 @@ int dtls1_read_bytes(SSL *s, int type, u if (alert_level == SSL3_AL_WARNING) { s->s3->warn_alert = alert_descr; + + s->s3->alert_count++; + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { + al = SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); + goto f_err; + } + if (alert_descr == SSL_AD_CLOSE_NOTIFY) { #ifndef OPENSSL_NO_SCTP /* Modified: stable/10/crypto/openssl/ssl/s3_pkt.c ============================================================================== --- stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 06:58:47 2016 (r308199) +++ stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 07:09:31 2016 (r308200) @@ -1057,6 +1057,13 @@ int ssl3_read_bytes(SSL *s, int type, un return (ret); } + /* + * Reset the count of consecutive warning alerts if we've got a non-empty + * record that isn't an alert. + */ + if (rr->type != SSL3_RT_ALERT && rr->length != 0) + s->s3->alert_count = 0; + /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, @@ -1271,6 +1278,14 @@ int ssl3_read_bytes(SSL *s, int type, un if (alert_level == SSL3_AL_WARNING) { s->s3->warn_alert = alert_descr; + + s->s3->alert_count++; + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { + al = SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); + goto f_err; + } + if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return (0); Modified: stable/10/crypto/openssl/ssl/ssl.h ============================================================================== --- stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 06:58:47 2016 (r308199) +++ stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 07:09:31 2016 (r308200) @@ -2717,6 +2717,7 @@ void ERR_load_SSL_strings(void); # define SSL_R_TLS_HEARTBEAT_PENDING 366 # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 +# define SSL_R_TOO_MANY_WARN_ALERTS 409 # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 Modified: stable/10/crypto/openssl/ssl/ssl3.h ============================================================================== --- stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 06:58:47 2016 (r308199) +++ stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 07:09:31 2016 (r308200) @@ -587,6 +587,8 @@ typedef struct ssl3_state_st { char is_probably_safari; # endif /* !OPENSSL_NO_EC */ # endif /* !OPENSSL_NO_TLSEXT */ + /* Count of the number of consecutive warning alerts received */ + unsigned int alert_count; } SSL3_STATE; # endif Modified: stable/10/crypto/openssl/ssl/ssl_locl.h ============================================================================== --- stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 06:58:47 2016 (r308199) +++ stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 07:09:31 2016 (r308200) @@ -389,6 +389,8 @@ */ # define SSL_MAX_DIGEST 6 +# define MAX_WARN_ALERT_COUNT 5 + # define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) # define TLS1_PRF_DGST_SHIFT 10 From owner-svn-src-stable-10@freebsd.org Wed Nov 2 13:25:34 2016 Return-Path: Delivered-To: svn-src-stable-10@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 EF3D7C2ADC8; Wed, 2 Nov 2016 13:25:34 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7368E16DE; Wed, 2 Nov 2016 13:25:33 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 1vXnccfCKKjjy1vXocCL3v; Wed, 02 Nov 2016 07:25:32 -0600 X-Authority-Analysis: v=2.2 cv=SPoybKnH c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=9UAayGe7GN0uLcUlLsMA:9 a=cKY4NFMCPIwHAR8d:21 a=pv6zkBOfaY07lfdN:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id C04CE762; Wed, 2 Nov 2016 06:25:30 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uA2DPUGv029025; Wed, 2 Nov 2016 06:25:30 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611021325.uA2DPUGv029025@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Xin LI 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: r308200 - in stable: 10/crypto/openssl/ssl 9/crypto/openssl/ssl In-Reply-To: Message from Xin LI of "Wed, 02 Nov 2016 07:09:32 -0000." <201611020709.uA279WM3070566@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Nov 2016 06:25:30 -0700 X-CMAE-Envelope: MS4wfBTk/z3p1VuTw9wQRe+UV9DNaTq3xhkPu5tuhKs+N510rdrvPEHr15f/vdGlxpcJ3005bEhGg9Cnj8FyJjy5Fnced6Kk5XIMMfZ/4yppnmwshCtuqdok WDHLDWYnmvrB5ZK1O+Xpec3KsduhU4g5G5i9Q5of/nugHCxYFNrjqjXh1YkCx3UK7x3/oQP2q8bJiFAtkzePq2jCVf0oh3fazeizgtndElphMnCfV5bVTAJP rwwUtvPjOC4wvoo0EqDGVkwreU4Ixa+QpRz0698StbIPfUpkdEt+jaFMNTXhtWNQfir0V8Cn6xqF9eMs1TFS2FlhggPXCBwfWX5JqNOkI9s= X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 13:25:35 -0000 In message <201611020709.uA279WM3070566@repo.freebsd.org>, Xin LI writes: > Author: delphij > Date: Wed Nov 2 07:09:31 2016 > New Revision: 308200 > URL: https://svnweb.freebsd.org/changeset/base/308200 > > Log: > Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401: > > Don't allow too many consecutive warning alerts > > Certain warning alerts are ignored if they are received. This can mean th > at > no progress will be made if one peer continually sends those warning aler > ts. > Implement a count so that we abort the connection if we receive too many. > > Issue reported by Shi Lei. > > This is a direct commit to stable/10 and stable/9. > > Security: CVE-2016-8610 > > Modified: > stable/10/crypto/openssl/ssl/d1_pkt.c > stable/10/crypto/openssl/ssl/s3_pkt.c > stable/10/crypto/openssl/ssl/ssl.h > stable/10/crypto/openssl/ssl/ssl3.h > stable/10/crypto/openssl/ssl/ssl_locl.h > > Changes in other areas also in this revision: > Modified: > stable/9/crypto/openssl/ssl/d1_pkt.c > stable/9/crypto/openssl/ssl/s3_pkt.c > stable/9/crypto/openssl/ssl/ssl.h > stable/9/crypto/openssl/ssl/ssl3.h > stable/9/crypto/openssl/ssl/ssl_locl.h > > Modified: stable/10/crypto/openssl/ssl/d1_pkt.c > ============================================================================= > = > --- stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 06:58:47 2016 > (r308199) > +++ stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 07:09:31 2016 > (r308200) > @@ -924,6 +924,13 @@ int dtls1_read_bytes(SSL *s, int type, u > goto start; > } > > + /* > + * Reset the count of consecutive warning alerts if we've got a non-empt > y > + * record that isn't an alert. > + */ > + if (rr->type != SSL3_RT_ALERT && rr->length != 0) > + s->s3->alert_count = 0; > + > /* we now have a packet which can be read and processed */ > > if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, > @@ -1190,6 +1197,14 @@ int dtls1_read_bytes(SSL *s, int type, u > > if (alert_level == SSL3_AL_WARNING) { > s->s3->warn_alert = alert_descr; > + > + s->s3->alert_count++; > + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > + al = SSL_AD_UNEXPECTED_MESSAGE; > + SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); > + goto f_err; > + } > + > if (alert_descr == SSL_AD_CLOSE_NOTIFY) { > #ifndef OPENSSL_NO_SCTP > /* > > Modified: stable/10/crypto/openssl/ssl/s3_pkt.c > ============================================================================= > = > --- stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 06:58:47 2016 > (r308199) > +++ stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 07:09:31 2016 > (r308200) > @@ -1057,6 +1057,13 @@ int ssl3_read_bytes(SSL *s, int type, un > return (ret); > } > > + /* > + * Reset the count of consecutive warning alerts if we've got a non-empt > y > + * record that isn't an alert. > + */ > + if (rr->type != SSL3_RT_ALERT && rr->length != 0) > + s->s3->alert_count = 0; > + > /* we now have a packet which can be read and processed */ > > if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, > @@ -1271,6 +1278,14 @@ int ssl3_read_bytes(SSL *s, int type, un > > if (alert_level == SSL3_AL_WARNING) { > s->s3->warn_alert = alert_descr; > + > + s->s3->alert_count++; > + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > + al = SSL_AD_UNEXPECTED_MESSAGE; > + SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); > + goto f_err; > + } > + > if (alert_descr == SSL_AD_CLOSE_NOTIFY) { > s->shutdown |= SSL_RECEIVED_SHUTDOWN; > return (0); > > Modified: stable/10/crypto/openssl/ssl/ssl.h > ============================================================================= > = > --- stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 06:58:47 2016 > (r308199) > +++ stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 07:09:31 2016 > (r308200) > @@ -2717,6 +2717,7 @@ void ERR_load_SSL_strings(void); > # define SSL_R_TLS_HEARTBEAT_PENDING 366 > # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 > # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 > +# define SSL_R_TOO_MANY_WARN_ALERTS 409 > # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 > # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 > # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 > > Modified: stable/10/crypto/openssl/ssl/ssl3.h > ============================================================================= > = > --- stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 06:58:47 2016 > (r308199) > +++ stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 07:09:31 2016 > (r308200) > @@ -587,6 +587,8 @@ typedef struct ssl3_state_st { > char is_probably_safari; > # endif /* !OPENSSL_NO_EC */ > # endif /* !OPENSSL_NO_TLSEXT */ > + /* Count of the number of consecutive warning alerts received */ > + unsigned int alert_count; > } SSL3_STATE; > > # endif > > Modified: stable/10/crypto/openssl/ssl/ssl_locl.h > ============================================================================= > = > --- stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 06:58:47 2016 > (r308199) > +++ stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 07:09:31 2016 > (r308200) > @@ -389,6 +389,8 @@ > */ > # define SSL_MAX_DIGEST 6 > > +# define MAX_WARN_ALERT_COUNT 5 > + > # define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) > > # define TLS1_PRF_DGST_SHIFT 10 > > Hi delphij@, This broke stable10 builds. --- d1_pkt.So --- /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c :932:16: error: no member named 'alert_count' in 'struct ssl3_state_st' s->s3->alert_count = 0; ~~~~~ ^ /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c :1201:20: error: no member named 'alert_count' in 'struct ssl3_state_st' s->s3->alert_count++; ~~~~~ ^ /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c :1202:24: error: no member named 'alert_count' in 'struct ssl3_state_st' if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { ~~~~~ ^ /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c :1204:48: error: use of undeclared identifier 'SSL_R_TOO_MANY_WARN_ALERTS' SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); ^ /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:217:54: note: expanded from macro 'SSLerr' # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) ^ /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:135:61: note: expanded from macro 'ERR_PUT_error' # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) ^ 4 errors generated. *** [d1_pkt.So] Error code 1 make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl 1 error make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl *** [secure/lib/libssl__L] Error code 2 make[3]: stopped in /opt/src/svn-stable10 -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-stable-10@freebsd.org Wed Nov 2 14:01:52 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0CC5FC2BCEF for ; Wed, 2 Nov 2016 14:01:52 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 368FA1593 for ; Wed, 2 Nov 2016 14:01:51 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-lf0-x231.google.com with SMTP id t196so13446150lff.3 for ; Wed, 02 Nov 2016 07:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2o5j+K32I3Pg3qZxc9tAOEZwP+hKtFhO8XAfJdxmCn8=; b=YNoDxDxRTFlacY/7ZTnlAE+fKouMxPtGQ66LEU14V6RWT5u/JfAJHQEHujaml0fvTk DHhZnkSBRuhqKdJkenedZ8DFE+qJ53McelhMkml95rn0lrfYi2ocVPIlqlUajLpJj7G9 BWEa9c2WXlB4hgplx/GSDTZ/htzxh7ioZqVjXYPISbTNJUdRdNSQGyehm7jo7/B78bmo 9J2ITa0pcEDRRFsGZe+NnEScWsMXY593ESpUy/gyE3EC2lKwo2EhXkY/cVbDW4VwRrrf sOHCvRX3kIU4fZSu0TExrrXWH0MNCB923A0LwpF62HY3EApbn68Jx7RMKhutd8jqSUHM LmkA== 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:from:date :message-id:subject:to:cc; bh=2o5j+K32I3Pg3qZxc9tAOEZwP+hKtFhO8XAfJdxmCn8=; b=miWymoezT5N5r9vGt1QRZirkuvivIKreJ5X3r6YPJgkuhJuL2Woi6R+btsR30hrfts NmUD6QryYxbyKUnCDHei94OWyB8wpvFGnoNkjmwLUQJufc+LVNNrX53UMwT0tZqg/zG9 Tbrn/cVzkGeuq6HXplla5/rXrsTEeNt8n4iWwJxF+f73iVUzfnKVGffz77yWVmocAb/B bzrswbFOwFVjqE3Zp3/9ZU68Yhg8UgnmXgBKWBhzSg12qUG84WAewRkkZP+67pFvCFYL ot3TVTrL0Cpdv8vIOqTu3Vl68NfR2tb9VI94EoFg0ILDiA9OksVCYSRM1IzFRfXWVYZn F4KQ== X-Gm-Message-State: ABUngvc/z6pc0ZSHQXLh6P+GwGLj2h/eNDGwgso/rlzbumeZjro4LFO0r8iAkRfq+IJD1q/y2/EYKMIAQPr5/XW4 X-Received: by 10.194.117.10 with SMTP id ka10mr4012005wjb.148.1478095308671; Wed, 02 Nov 2016 07:01:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.153.6 with HTTP; Wed, 2 Nov 2016 07:01:48 -0700 (PDT) In-Reply-To: <201611021325.uA2DPUGv029025@slippy.cwsent.com> References: <201611020709.uA279WM3070566@repo.freebsd.org> <201611021325.uA2DPUGv029025@slippy.cwsent.com> From: Oliver Pinter Date: Wed, 2 Nov 2016 15:01:48 +0100 Message-ID: Subject: Re: svn commit: r308200 - in stable: 10/crypto/openssl/ssl 9/crypto/openssl/ssl To: Cy Schubert Cc: Xin LI , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 14:01:52 -0000 On 11/2/16, Cy Schubert wrote: > In message <201611020709.uA279WM3070566@repo.freebsd.org>, Xin LI writes: >> Author: delphij >> Date: Wed Nov 2 07:09:31 2016 >> New Revision: 308200 >> URL: https://svnweb.freebsd.org/changeset/base/308200 >> >> Log: >> Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401: >> >> Don't allow too many consecutive warning alerts >> >> Certain warning alerts are ignored if they are received. This can mean >> th >> at >> no progress will be made if one peer continually sends those warning >> aler >> ts. >> Implement a count so that we abort the connection if we receive too >> many. >> >> Issue reported by Shi Lei. >> >> This is a direct commit to stable/10 and stable/9. >> >> Security: CVE-2016-8610 >> >> Modified: >> stable/10/crypto/openssl/ssl/d1_pkt.c >> stable/10/crypto/openssl/ssl/s3_pkt.c >> stable/10/crypto/openssl/ssl/ssl.h >> stable/10/crypto/openssl/ssl/ssl3.h >> stable/10/crypto/openssl/ssl/ssl_locl.h >> >> Changes in other areas also in this revision: >> Modified: >> stable/9/crypto/openssl/ssl/d1_pkt.c >> stable/9/crypto/openssl/ssl/s3_pkt.c >> stable/9/crypto/openssl/ssl/ssl.h >> stable/9/crypto/openssl/ssl/ssl3.h >> stable/9/crypto/openssl/ssl/ssl_locl.h >> >> Modified: stable/10/crypto/openssl/ssl/d1_pkt.c >> ============================================================================= >> = >> --- stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 06:58:47 2016 >> (r308199) >> +++ stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 07:09:31 2016 >> (r308200) >> @@ -924,6 +924,13 @@ int dtls1_read_bytes(SSL *s, int type, u >> goto start; >> } >> >> + /* >> + * Reset the count of consecutive warning alerts if we've got a >> non-empt >> y >> + * record that isn't an alert. >> + */ >> + if (rr->type != SSL3_RT_ALERT && rr->length != 0) >> + s->s3->alert_count = 0; >> + >> /* we now have a packet which can be read and processed */ >> >> if (s->s3->change_cipher_spec /* set when we receive >> ChangeCipherSpec, >> @@ -1190,6 +1197,14 @@ int dtls1_read_bytes(SSL *s, int type, u >> >> if (alert_level == SSL3_AL_WARNING) { >> s->s3->warn_alert = alert_descr; >> + >> + s->s3->alert_count++; >> + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { >> + al = SSL_AD_UNEXPECTED_MESSAGE; >> + SSLerr(SSL_F_DTLS1_READ_BYTES, >> SSL_R_TOO_MANY_WARN_ALERTS); >> + goto f_err; >> + } >> + >> if (alert_descr == SSL_AD_CLOSE_NOTIFY) { >> #ifndef OPENSSL_NO_SCTP >> /* >> >> Modified: stable/10/crypto/openssl/ssl/s3_pkt.c >> ============================================================================= >> = >> --- stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 06:58:47 2016 >> (r308199) >> +++ stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 07:09:31 2016 >> (r308200) >> @@ -1057,6 +1057,13 @@ int ssl3_read_bytes(SSL *s, int type, un >> return (ret); >> } >> >> + /* >> + * Reset the count of consecutive warning alerts if we've got a >> non-empt >> y >> + * record that isn't an alert. >> + */ >> + if (rr->type != SSL3_RT_ALERT && rr->length != 0) >> + s->s3->alert_count = 0; >> + >> /* we now have a packet which can be read and processed */ >> >> if (s->s3->change_cipher_spec /* set when we receive >> ChangeCipherSpec, >> @@ -1271,6 +1278,14 @@ int ssl3_read_bytes(SSL *s, int type, un >> >> if (alert_level == SSL3_AL_WARNING) { >> s->s3->warn_alert = alert_descr; >> + >> + s->s3->alert_count++; >> + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { >> + al = SSL_AD_UNEXPECTED_MESSAGE; >> + SSLerr(SSL_F_SSL3_READ_BYTES, >> SSL_R_TOO_MANY_WARN_ALERTS); >> + goto f_err; >> + } >> + >> if (alert_descr == SSL_AD_CLOSE_NOTIFY) { >> s->shutdown |= SSL_RECEIVED_SHUTDOWN; >> return (0); >> >> Modified: stable/10/crypto/openssl/ssl/ssl.h >> ============================================================================= >> = >> --- stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 06:58:47 2016 >> (r308199) >> +++ stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 07:09:31 2016 >> (r308200) >> @@ -2717,6 +2717,7 @@ void ERR_load_SSL_strings(void); >> # define SSL_R_TLS_HEARTBEAT_PENDING 366 >> # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 >> # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 >> +# define SSL_R_TOO_MANY_WARN_ALERTS 409 >> # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 >> # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 >> # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 >> >> Modified: stable/10/crypto/openssl/ssl/ssl3.h >> ============================================================================= >> = >> --- stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 06:58:47 2016 >> (r308199) >> +++ stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 07:09:31 2016 >> (r308200) >> @@ -587,6 +587,8 @@ typedef struct ssl3_state_st { >> char is_probably_safari; >> # endif /* !OPENSSL_NO_EC */ >> # endif /* !OPENSSL_NO_TLSEXT */ >> + /* Count of the number of consecutive warning alerts received */ >> + unsigned int alert_count; >> } SSL3_STATE; >> >> # endif >> >> Modified: stable/10/crypto/openssl/ssl/ssl_locl.h >> ============================================================================= >> = >> --- stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 06:58:47 2016 >> (r308199) >> +++ stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 07:09:31 2016 >> (r308200) >> @@ -389,6 +389,8 @@ >> */ >> # define SSL_MAX_DIGEST 6 >> >> +# define MAX_WARN_ALERT_COUNT 5 >> + >> # define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) >> >> # define TLS1_PRF_DGST_SHIFT 10 >> >> > > Hi delphij@, > > This broke stable10 builds. > > --- d1_pkt.So --- > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c > :932:16: error: no member named 'alert_count' in 'struct ssl3_state_st' > s->s3->alert_count = 0; > ~~~~~ ^ > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c > :1201:20: error: no member named 'alert_count' in 'struct ssl3_state_st' > s->s3->alert_count++; > ~~~~~ ^ > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c > :1202:24: error: no member named 'alert_count' in 'struct ssl3_state_st' > if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > ~~~~~ ^ > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt.c > :1204:48: error: use of undeclared identifier 'SSL_R_TOO_MANY_WARN_ALERTS' > SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); > ^ > /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:217:54: note: > expanded from macro 'SSLerr' > # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) > ^ > /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:135:61: note: > expanded from macro 'ERR_PUT_error' > # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) > ^ > 4 errors generated. > *** [d1_pkt.So] Error code 1 > > make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl > 1 error > > make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl > *** [secure/lib/libssl__L] Error code 2 > > make[3]: stopped in /opt/src/svn-stable10 Are you sure about this? Our build tests finished properly on stable/10: http://jenkins.hardenedbsd.org:8180/jenkins/job/HardenedBSD-stable-10-STABLE-master-amd64/74/ and the release build too. > > > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > _______________________________________________ > svn-src-stable-10@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 > To unsubscribe, send any mail to > "svn-src-stable-10-unsubscribe@freebsd.org" > From owner-svn-src-stable-10@freebsd.org Wed Nov 2 18:11:08 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0A438C2B29D; Wed, 2 Nov 2016 18:11:08 +0000 (UTC) (envelope-from gjb@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 9A0171A33; Wed, 2 Nov 2016 18:11:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA2IB6ID029097; Wed, 2 Nov 2016 18:11:06 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA2IB6Hx029096; Wed, 2 Nov 2016 18:11:06 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611021811.uA2IB6Hx029096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 2 Nov 2016 18:11:06 +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: r308226 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml 9/release/doc/share/xml 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 18:11:08 -0000 Author: gjb Date: Wed Nov 2 18:11:06 2016 New Revision: 308226 URL: https://svnweb.freebsd.org/changeset/base/308226 Log: Document SA-16:33-35. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/11/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Wed Nov 2 17:47:19 2016 (r308225) +++ stable/10/release/doc/share/xml/security.xml Wed Nov 2 18:11:06 2016 (r308226) @@ -131,6 +131,22 @@ 10 October 2016 Multiple vulnerabilities + + + FreeBSD-SA-16:33.openssh + 2 November 2016 + Remote Denial of Service + vulnerability + + + + FreeBSD-SA-16:35.openssl + 2 November 2016 + Remote Denial of Service + vulnerability + From owner-svn-src-stable-10@freebsd.org Thu Nov 3 00:17:11 2016 Return-Path: Delivered-To: svn-src-stable-10@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 44515C2CDBB; Thu, 3 Nov 2016 00:17:11 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AA6401131; Thu, 3 Nov 2016 00:17:10 +0000 (UTC) (envelope-from cy.schubert@komquats.com) Received: from spqr.komquats.com ([96.50.22.10]) by shaw.ca with SMTP id 25iMcyDcAeeHN25iNcRf68; Wed, 02 Nov 2016 18:17:08 -0600 X-Authority-Analysis: v=2.2 cv=abURpVgt c=1 sm=1 tr=0 a=jvE2nwUzI0ECrNeyr98KWA==:117 a=jvE2nwUzI0ECrNeyr98KWA==:17 a=kj9zAlcOel0A:10 a=L24OOQBejmoA:10 a=BWvPGDcYAAAA:8 a=6I5d2MoRAAAA:8 a=ypVJL4-jAAAA:8 a=YxBL1-UpAAAA:8 a=LxPD5kH9G9su0gnwfeAA:9 a=XWpA3F0KNrHPGJVI:21 a=rMy_yf_Yi90kAFeX:21 a=CjuIK1q_8ugA:10 a=pxhY87DP9d2VeQe4joPk:22 a=IjZwj45LgO3ly-622nXo:22 a=khIbc0fXALFIcTpOSxgJ:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id C6A1BD1C; Wed, 2 Nov 2016 17:17:05 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id uA30H4UJ078504; Wed, 2 Nov 2016 17:17:04 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201611030017.uA30H4UJ078504@slippy.cwsent.com> X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Oliver Pinter cc: Cy Schubert , Xin LI , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r308200 - in stable: 10/crypto/openssl/ssl 9/crypto/openssl/ssl In-Reply-To: Message from Oliver Pinter of "Wed, 02 Nov 2016 15:01:48 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Nov 2016 17:17:04 -0700 X-CMAE-Envelope: MS4wfJ9wn23DQGiA864SmehVUjHTx+UbzfQIcX8+WxJSKpmfN1qzvc4DSVtsJN5mHnHJ8rYbl1zJ1CVs61CWfA2Weg9oyFQOybIRqONy0T70wQJoiMIyy3Pz kwVAKNDybjRsEXsvqok6litJzcPxjqzUB/3Pwv/3T6/XmGmfkLTKBGHt1afTmwhqhaCxjxaLe/xzRK1WrWX0sJOtYQwu7vK9mthhcWNh7KDYFbiVtLTzIza+ ASvvO64KoqM7HxfgqJFN61YRUDBAu+8kaM/TofINwrwRIIeKr+bcjxB/Aya6NSs8xfHjsqCg5MJ4gmetrlKpGmFm16QpLFtagC1IFt7RdosiuxEUY7uZyXQ5 zpdShqxk51Ss+Pq0BV6Ba7PRh7VeeA== X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 00:17:11 -0000 In message , Oliver Pinter writes: > On 11/2/16, Cy Schubert wrote: > > In message <201611020709.uA279WM3070566@repo.freebsd.org>, Xin LI writes: > >> Author: delphij > >> Date: Wed Nov 2 07:09:31 2016 > >> New Revision: 308200 > >> URL: https://svnweb.freebsd.org/changeset/base/308200 > >> > >> Log: > >> Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401: > >> > >> Don't allow too many consecutive warning alerts > >> > >> Certain warning alerts are ignored if they are received. This can mean > >> th > >> at > >> no progress will be made if one peer continually sends those warning > >> aler > >> ts. > >> Implement a count so that we abort the connection if we receive too > >> many. > >> > >> Issue reported by Shi Lei. > >> > >> This is a direct commit to stable/10 and stable/9. > >> > >> Security: CVE-2016-8610 > >> > >> Modified: > >> stable/10/crypto/openssl/ssl/d1_pkt.c > >> stable/10/crypto/openssl/ssl/s3_pkt.c > >> stable/10/crypto/openssl/ssl/ssl.h > >> stable/10/crypto/openssl/ssl/ssl3.h > >> stable/10/crypto/openssl/ssl/ssl_locl.h > >> > >> Changes in other areas also in this revision: > >> Modified: > >> stable/9/crypto/openssl/ssl/d1_pkt.c > >> stable/9/crypto/openssl/ssl/s3_pkt.c > >> stable/9/crypto/openssl/ssl/ssl.h > >> stable/9/crypto/openssl/ssl/ssl3.h > >> stable/9/crypto/openssl/ssl/ssl_locl.h > >> > >> Modified: stable/10/crypto/openssl/ssl/d1_pkt.c > >> ========================================================================== > === > >> = > >> --- stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 06:58:47 2016 > >> (r308199) > >> +++ stable/10/crypto/openssl/ssl/d1_pkt.c Wed Nov 2 07:09:31 2016 > >> (r308200) > >> @@ -924,6 +924,13 @@ int dtls1_read_bytes(SSL *s, int type, u > >> goto start; > >> } > >> > >> + /* > >> + * Reset the count of consecutive warning alerts if we've got a > >> non-empt > >> y > >> + * record that isn't an alert. > >> + */ > >> + if (rr->type != SSL3_RT_ALERT && rr->length != 0) > >> + s->s3->alert_count = 0; > >> + > >> /* we now have a packet which can be read and processed */ > >> > >> if (s->s3->change_cipher_spec /* set when we receive > >> ChangeCipherSpec, > >> @@ -1190,6 +1197,14 @@ int dtls1_read_bytes(SSL *s, int type, u > >> > >> if (alert_level == SSL3_AL_WARNING) { > >> s->s3->warn_alert = alert_descr; > >> + > >> + s->s3->alert_count++; > >> + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > >> + al = SSL_AD_UNEXPECTED_MESSAGE; > >> + SSLerr(SSL_F_DTLS1_READ_BYTES, > >> SSL_R_TOO_MANY_WARN_ALERTS); > >> + goto f_err; > >> + } > >> + > >> if (alert_descr == SSL_AD_CLOSE_NOTIFY) { > >> #ifndef OPENSSL_NO_SCTP > >> /* > >> > >> Modified: stable/10/crypto/openssl/ssl/s3_pkt.c > >> ========================================================================== > === > >> = > >> --- stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 06:58:47 2016 > >> (r308199) > >> +++ stable/10/crypto/openssl/ssl/s3_pkt.c Wed Nov 2 07:09:31 2016 > >> (r308200) > >> @@ -1057,6 +1057,13 @@ int ssl3_read_bytes(SSL *s, int type, un > >> return (ret); > >> } > >> > >> + /* > >> + * Reset the count of consecutive warning alerts if we've got a > >> non-empt > >> y > >> + * record that isn't an alert. > >> + */ > >> + if (rr->type != SSL3_RT_ALERT && rr->length != 0) > >> + s->s3->alert_count = 0; > >> + > >> /* we now have a packet which can be read and processed */ > >> > >> if (s->s3->change_cipher_spec /* set when we receive > >> ChangeCipherSpec, > >> @@ -1271,6 +1278,14 @@ int ssl3_read_bytes(SSL *s, int type, un > >> > >> if (alert_level == SSL3_AL_WARNING) { > >> s->s3->warn_alert = alert_descr; > >> + > >> + s->s3->alert_count++; > >> + if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > >> + al = SSL_AD_UNEXPECTED_MESSAGE; > >> + SSLerr(SSL_F_SSL3_READ_BYTES, > >> SSL_R_TOO_MANY_WARN_ALERTS); > >> + goto f_err; > >> + } > >> + > >> if (alert_descr == SSL_AD_CLOSE_NOTIFY) { > >> s->shutdown |= SSL_RECEIVED_SHUTDOWN; > >> return (0); > >> > >> Modified: stable/10/crypto/openssl/ssl/ssl.h > >> ========================================================================== > === > >> = > >> --- stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 06:58:47 2016 > >> (r308199) > >> +++ stable/10/crypto/openssl/ssl/ssl.h Wed Nov 2 07:09:31 2016 > >> (r308200) > >> @@ -2717,6 +2717,7 @@ void ERR_load_SSL_strings(void); > >> # define SSL_R_TLS_HEARTBEAT_PENDING 366 > >> # define SSL_R_TLS_ILLEGAL_EXPORTER_LABEL 367 > >> # define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST 157 > >> +# define SSL_R_TOO_MANY_WARN_ALERTS 409 > >> # define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233 > >> # define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234 > >> # define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235 > >> > >> Modified: stable/10/crypto/openssl/ssl/ssl3.h > >> ========================================================================== > === > >> = > >> --- stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 06:58:47 2016 > >> (r308199) > >> +++ stable/10/crypto/openssl/ssl/ssl3.h Wed Nov 2 07:09:31 2016 > >> (r308200) > >> @@ -587,6 +587,8 @@ typedef struct ssl3_state_st { > >> char is_probably_safari; > >> # endif /* !OPENSSL_NO_EC */ > >> # endif /* !OPENSSL_NO_TLSEXT */ > >> + /* Count of the number of consecutive warning alerts received */ > >> + unsigned int alert_count; > >> } SSL3_STATE; > >> > >> # endif > >> > >> Modified: stable/10/crypto/openssl/ssl/ssl_locl.h > >> ========================================================================== > === > >> = > >> --- stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 06:58:47 201 > 6 > >> (r308199) > >> +++ stable/10/crypto/openssl/ssl/ssl_locl.h Wed Nov 2 07:09:31 201 > 6 > >> (r308200) > >> @@ -389,6 +389,8 @@ > >> */ > >> # define SSL_MAX_DIGEST 6 > >> > >> +# define MAX_WARN_ALERT_COUNT 5 > >> + > >> # define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) > >> > >> # define TLS1_PRF_DGST_SHIFT 10 > >> > >> > > > > Hi delphij@, > > > > This broke stable10 builds. > > > > --- d1_pkt.So --- > > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt. > c > > :932:16: error: no member named 'alert_count' in 'struct ssl3_state_st' > > s->s3->alert_count = 0; > > ~~~~~ ^ > > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt. > c > > :1201:20: error: no member named 'alert_count' in 'struct ssl3_state_st' > > s->s3->alert_count++; > > ~~~~~ ^ > > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt. > c > > :1202:24: error: no member named 'alert_count' in 'struct ssl3_state_st' > > if (s->s3->alert_count == MAX_WARN_ALERT_COUNT) { > > ~~~~~ ^ > > /opt/src/svn-stable10/secure/lib/libssl/../../../crypto/openssl/ssl/d1_pkt. > c > > :1204:48: error: use of undeclared identifier 'SSL_R_TOO_MANY_WARN_ALERTS' > > SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_TOO_MANY_WARN_ALERTS); > > ^ > > /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:217:54: note: > > expanded from macro 'SSLerr' > > # define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) > > ^ > > /usr/obj/opt/src/svn-stable10/tmp/usr/include/openssl/err.h:135:61: note: > > expanded from macro 'ERR_PUT_error' > > # define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e) > > ^ > > 4 errors generated. > > *** [d1_pkt.So] Error code 1 > > > > make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl > > 1 error > > > > make[4]: stopped in /opt/src/svn-stable10/secure/lib/libssl > > *** [secure/lib/libssl__L] Error code 2 > > > > make[3]: stopped in /opt/src/svn-stable10 > > Are you sure about this? Our build tests finished properly on > stable/10: http://jenkins.hardenedbsd.org:8180/jenkins/job/HardenedBSD-stable > -10-STABLE-master-amd64/74/ > and the release build too. Rebuilt this time without -DNO_CLEAN allowed it to pass. Sorry for the noise. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-stable-10@freebsd.org Thu Nov 3 00:58:52 2016 Return-Path: Delivered-To: svn-src-stable-10@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 3A932C2BA66; Thu, 3 Nov 2016 00:58:52 +0000 (UTC) (envelope-from rmacklem@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 A32921CE2; Thu, 3 Nov 2016 00:58:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA30wo57088989; Thu, 3 Nov 2016 00:58:50 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA30wojs088988; Thu, 3 Nov 2016 00:58:50 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201611030058.uA30wojs088988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 3 Nov 2016 00:58:50 +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: r308241 - stable/10/sys/fs/nfsserver 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 00:58:52 -0000 Author: rmacklem Date: Thu Nov 3 00:58:50 2016 New Revision: 308241 URL: https://svnweb.freebsd.org/changeset/base/308241 Log: MFC: r307694 A problem w.r.t. interoperation between the FreeBSD NFSv4.1 server with delegations enabled and the Linux NFSv4.1 client was reported in reviews.freebsd.org/D7891. I believe that the FreeBSD server behaviour conforms to the RFC and that the Linux client has a bug. Therefore, I do not think the proposed patch is appropriate. When nfsrv_writedelegifpos is non-zero, the FreeBSD server will issue a write delegation for a read open if possible. The Linux client then erroneously assumes that the credentials used for the read open can write the file. This patch reverses the default value for nfsrv_writedelegifpos to 0 so that the default behaviour is Linux compatible and adds a sysctl that can be used to set nfsrv_writedelegifpos. This change should only affect users that are mounting a FreeBSD server with delegations enabled (they are not enabled by default) with a Linux NFSv4.1 client mount. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Thu Nov 3 00:56:59 2016 (r308240) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Thu Nov 3 00:58:50 2016 (r308241) @@ -75,6 +75,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, v4statel &nfsrv_v4statelimit, 0, "High water limit for NFSv4 opens+locks+delegations"); +static int nfsrv_writedelegifpos = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedelegifpos, CTLFLAG_RW, + &nfsrv_writedelegifpos, 0, + "Issue a write delegation for read opens if possible"); + /* * Hash lists for nfs V4. */ @@ -85,7 +90,6 @@ struct nfssessionhash *nfssessionhash; static u_int32_t nfsrv_openpluslock = 0, nfsrv_delegatecnt = 0; static time_t nfsrvboottime; -static int nfsrv_writedelegifpos = 1; static int nfsrv_returnoldstateid = 0, nfsrv_clients = 0; static int nfsrv_clienthighwater = NFSRV_CLIENTHIGHWATER; static int nfsrv_nogsscallback = 0; From owner-svn-src-stable-10@freebsd.org Thu Nov 3 08:34:39 2016 Return-Path: Delivered-To: svn-src-stable-10@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 33BB6C2CE49; Thu, 3 Nov 2016 08:34:39 +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 ED3CE11A6; Thu, 3 Nov 2016 08:34:38 +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 uA38YbM6069266; Thu, 3 Nov 2016 08:34:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA38Ybot069262; Thu, 3 Nov 2016 08:34:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611030834.uA38Ybot069262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 Nov 2016 08:34: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: r308244 - in stable/10: etc/rc.d tools/build/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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 08:34:39 -0000 Author: avg Date: Thu Nov 3 08:34:37 2016 New Revision: 308244 URL: https://svnweb.freebsd.org/changeset/base/308244 Log: MFC r307182,307191,307192: rc.d/zfsbe: new script designed for BE support Added: stable/10/etc/rc.d/zfsbe - copied unchanged from r307182, head/etc/rc.d/zfsbe Modified: stable/10/etc/rc.d/Makefile stable/10/etc/rc.d/zfs stable/10/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/Makefile ============================================================================== --- stable/10/etc/rc.d/Makefile Thu Nov 3 08:34:24 2016 (r308243) +++ stable/10/etc/rc.d/Makefile Thu Nov 3 08:34:37 2016 (r308244) @@ -283,6 +283,7 @@ FILES+= wpa_supplicant .if ${MK_ZFS} != "no" FILES+= zfs +FILES+= zfsbe FILES+= zvol .endif Modified: stable/10/etc/rc.d/zfs ============================================================================== --- stable/10/etc/rc.d/zfs Thu Nov 3 08:34:24 2016 (r308243) +++ stable/10/etc/rc.d/zfs Thu Nov 3 08:34:37 2016 (r308244) @@ -4,7 +4,7 @@ # # PROVIDE: zfs -# REQUIRE: mountcritlocal +# REQUIRE: zfsbe # BEFORE: FILESYSTEMS var . /etc/rc.subr Copied: stable/10/etc/rc.d/zfsbe (from r307182, head/etc/rc.d/zfsbe) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/etc/rc.d/zfsbe Thu Nov 3 08:34:37 2016 (r308244, copy of r307182, head/etc/rc.d/zfsbe) @@ -0,0 +1,71 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: zfsbe +# REQUIRE: mountcritlocal + +# Handle boot environment subordinate filesystems +# that may have canmount property set to noauto. +# For these filesystems mountpoint relative to / +# must be the same as their dataset name relative +# to BE root dataset. + +. /etc/rc.subr + +name="zfsbe" +rcvar="zfs_enable" +start_cmd="be_start" +stop_cmd="be_stop" +required_modules="zfs" + +mount_subordinate() +{ + local _be + + _be=$1 + zfs list -rH -o mountpoint,name,canmount,mounted -s mountpoint -t filesystem $_be | \ + while read _mp _name _canmount _mounted ; do + # skip filesystems that must not be mounted + [ "$_canmount" = "off" ] && continue + # skip filesystems that are already mounted + [ "$_mounted" = "yes" ] && continue + case "$_mp" in + "none" | "legacy" | "/" | "/$_be") + # do nothing for filesystems with unset or legacy mountpoint + # or those that would be mounted over / + ;; + "/$_be/"*) + # filesystems with mountpoint relative to BE + mount -t zfs $_name ${_mp#/$_be} + ;; + *) + # filesystems with mountpoint elsewhere + zfs mount $_name + ;; + esac + done +} + +be_start() +{ + if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then + : + else + mount -p | while read _dev _mp _type _rest; do + [ $_mp = "/" ] || continue + if [ $_type = "zfs" ] ; then + mount_subordinate $_dev + fi + break + done + fi +} + +be_stop() +{ +} + +load_rc_config $name +run_rc_command "$1" Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/10/tools/build/mk/OptionalObsoleteFiles.inc Thu Nov 3 08:34:24 2016 (r308243) +++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc Thu Nov 3 08:34:37 2016 (r308244) @@ -711,6 +711,7 @@ OLD_FILES+=boot/gptzfsboot OLD_FILES+=boot/zfsboot OLD_FILES+=boot/zfsloader OLD_FILES+=etc/rc.d/zfs +OLD_FILES+=etc/rc.d/zfsbe OLD_FILES+=etc/rc.d/zvol OLD_FILES+=etc/devd/zfs.conf OLD_FILES+=etc/periodic/daily/404.status-zfs From owner-svn-src-stable-10@freebsd.org Thu Nov 3 08:54:37 2016 Return-Path: Delivered-To: svn-src-stable-10@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 C1ADEC2D7CC; Thu, 3 Nov 2016 08:54:37 +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 27EBA1781; Thu, 3 Nov 2016 08:54:36 +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 uA38sZWE077029; Thu, 3 Nov 2016 08:54:35 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA38sZwV077028; Thu, 3 Nov 2016 08:54:35 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201611030854.uA38sZwV077028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 Nov 2016 08:54:35 +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: r308246 - 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 08:54:37 -0000 Author: avg Date: Thu Nov 3 08:54:35 2016 New Revision: 308246 URL: https://svnweb.freebsd.org/changeset/base/308246 Log: MFC r307994: 3746 ZRLs are racy PR: 204037 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Thu Nov 3 08:54:04 2016 (r308245) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c Thu Nov 3 08:54:35 2016 (r308246) @@ -21,6 +21,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015 by Delphix. All rights reserved. + * Copyright 2016 The MathWorks, Inc. All rights reserved. */ /* @@ -71,37 +72,32 @@ zrl_destroy(zrlock_t *zrl) void zrl_add_impl(zrlock_t *zrl, const char *zc) { - uint32_t n = (uint32_t)zrl->zr_refcount; - - while (n != ZRL_LOCKED) { - uint32_t cas = atomic_cas_32( - (uint32_t *)&zrl->zr_refcount, n, n + 1); - if (cas == n) { - ASSERT3S((int32_t)n, >=, 0); -#ifdef ZFS_DEBUG - if (zrl->zr_owner == curthread) { - DTRACE_PROBE2(zrlock__reentry, - zrlock_t *, zrl, uint32_t, n); - } - zrl->zr_owner = curthread; - zrl->zr_caller = zc; + for (;;) { + uint32_t n = (uint32_t)zrl->zr_refcount; + while (n != ZRL_LOCKED) { + uint32_t cas = atomic_cas_32( + (uint32_t *)&zrl->zr_refcount, n, n + 1); + if (cas == n) { + ASSERT3S((int32_t)n, >=, 0); +#ifdef ZFS_DEBUG + if (zrl->zr_owner == curthread) { + DTRACE_PROBE2(zrlock__reentry, + zrlock_t *, zrl, uint32_t, n); + } + zrl->zr_owner = curthread; + zrl->zr_caller = zc; #endif - return; + return; + } + n = cas; } - n = cas; - } - mutex_enter(&zrl->zr_mtx); - while (zrl->zr_refcount == ZRL_LOCKED) { - cv_wait(&zrl->zr_cv, &zrl->zr_mtx); + mutex_enter(&zrl->zr_mtx); + while (zrl->zr_refcount == ZRL_LOCKED) { + cv_wait(&zrl->zr_cv, &zrl->zr_mtx); + } + mutex_exit(&zrl->zr_mtx); } - ASSERT3S(zrl->zr_refcount, >=, 0); - zrl->zr_refcount++; -#ifdef ZFS_DEBUG - zrl->zr_owner = curthread; - zrl->zr_caller = zc; -#endif - mutex_exit(&zrl->zr_mtx); } void From owner-svn-src-stable-10@freebsd.org Thu Nov 3 19:58:13 2016 Return-Path: Delivered-To: svn-src-stable-10@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 9057BC1310D; Thu, 3 Nov 2016 19:58:13 +0000 (UTC) (envelope-from jch@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 618BD1398; Thu, 3 Nov 2016 19:58:13 +0000 (UTC) (envelope-from jch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA3JwCDp036261; Thu, 3 Nov 2016 19:58:12 GMT (envelope-from jch@FreeBSD.org) Received: (from jch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA3JwClI036260; Thu, 3 Nov 2016 19:58:12 GMT (envelope-from jch@FreeBSD.org) Message-Id: <201611031958.uA3JwClI036260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jch set sender to jch@FreeBSD.org using -f From: Julien Charbon Date: Thu, 3 Nov 2016 19:58: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: r308263 - stable/10/sys/netinet 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 19:58:13 -0000 Author: jch Date: Thu Nov 3 19:58:12 2016 New Revision: 308263 URL: https://svnweb.freebsd.org/changeset/base/308263 Log: MFC r307966: Remove an extraneous call to soisconnected() in syncache_socket(), introduced with r261242. The useful and expected soisconnected() call is done in tcp_do_segment(). Has been found as part of unrelated PR:212920 investigation. Improve slightly (~2%) the maximum number of TCP accept per second. Tested by: kevin.bowling_kev009.com, jch Approved by: gnn, hiren MFC after: 1 week Sponsored by: Verisign, Inc Differential Revision: https://reviews.freebsd.org/D8072 Modified: stable/10/sys/netinet/tcp_syncache.c Modified: stable/10/sys/netinet/tcp_syncache.c ============================================================================== --- stable/10/sys/netinet/tcp_syncache.c Thu Nov 3 19:39:32 2016 (r308262) +++ stable/10/sys/netinet/tcp_syncache.c Thu Nov 3 19:58:12 2016 (r308263) @@ -922,10 +922,6 @@ syncache_socket(struct syncache *sc, str INP_WUNLOCK(inp); - if ((so->so_options & SO_ACCEPTFILTER) == 0) { - soisconnected(so); - } - TCPSTAT_INC(tcps_accepts); return (so); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 03:25:36 2016 Return-Path: Delivered-To: svn-src-stable-10@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 031ADC2B053; Fri, 4 Nov 2016 03:25:36 +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 B61A61525; Fri, 4 Nov 2016 03:25:35 +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 uA43PYkF010408; Fri, 4 Nov 2016 03:25:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA43PYjq010404; Fri, 4 Nov 2016 03:25:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611040325.uA43PYjq010404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 03:25: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: r308281 - stable/10/sys/dev/cxgbe/tom 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 03:25:36 -0000 Author: jhb Date: Fri Nov 4 03:25:34 2016 New Revision: 308281 URL: https://svnweb.freebsd.org/changeset/base/308281 Log: MFC 277763,280146,287631: Various fixes to DDP. 277763: Lock the socket buffer before jumping to the 'out' label if sblock() fails in t4_soreceive_ddp(). 280146: Move special DDP handling for closing a connection into a new handle_ddp_close() function in t4_ddp.c as the logic is similar to handle_ddp_data(). This allows all knowledge of the special DDP mbufs to be private to t4_ddp.c as well. 287631: Add a comment to clarify how to determine the amount of received DDP data. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c stable/10/sys/dev/cxgbe/tom/t4_ddp.c stable/10/sys/dev/cxgbe/tom/t4_tom.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 01:56:29 2016 (r308280) +++ stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 03:25:34 2016 (r308281) @@ -1102,19 +1102,7 @@ do_peer_close(struct sge_iq *iq, const s sb = &so->so_rcv; SOCKBUF_LOCK(sb); if (__predict_false(toep->ddp_flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) { - m = get_ddp_mbuf(be32toh(cpl->rcv_nxt) - tp->rcv_nxt); - tp->rcv_nxt = be32toh(cpl->rcv_nxt); - toep->ddp_flags &= ~(DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE); - - KASSERT(toep->sb_cc >= sb->sb_cc, - ("%s: sb %p has more data (%d) than last time (%d).", - __func__, sb, sb->sb_cc, toep->sb_cc)); - toep->rx_credits += toep->sb_cc - sb->sb_cc; -#ifdef USE_DDP_RX_FLOW_CONTROL - toep->rx_credits -= m->m_len; /* adjust for F_RX_FC_DDP */ -#endif - sbappendstream_locked(sb, m); - toep->sb_cc = sb->sb_cc; + handle_ddp_close(toep, tp, sb, cpl->rcv_nxt); } socantrcvmore_locked(so); /* unlocks the sockbuf */ Modified: stable/10/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_ddp.c Fri Nov 4 01:56:29 2016 (r308280) +++ stable/10/sys/dev/cxgbe/tom/t4_ddp.c Fri Nov 4 03:25:34 2016 (r308281) @@ -72,6 +72,8 @@ VNET_DECLARE(int, tcp_autorcvbuf_inc); VNET_DECLARE(int, tcp_autorcvbuf_max); #define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) +static struct mbuf *get_ddp_mbuf(int len); + #define PPOD_SZ(n) ((n) * sizeof(struct pagepod)) #define PPOD_SIZE (PPOD_SZ(1)) @@ -403,6 +405,19 @@ handle_ddp_data(struct toepcb *toep, __b } tp = intotcpcb(inp); + + /* + * For RX_DDP_COMPLETE, len will be zero and rcv_nxt is the + * sequence number of the next byte to receive. The length of + * the data received for this message must be computed by + * comparing the new and old values of rcv_nxt. + * + * For RX_DATA_DDP, len might be non-zero, but it is only the + * length of the most recent DMA. It does not include the + * total length of the data received since the previous update + * for this DDP buffer. rcv_nxt is the sequence number of the + * first received byte from the most recent DMA. + */ len += be32toh(rcv_nxt) - tp->rcv_nxt; tp->rcv_nxt += len; tp->t_rcvtime = ticks; @@ -454,6 +469,37 @@ wakeup: return (0); } +void +handle_ddp_close(struct toepcb *toep, struct tcpcb *tp, struct sockbuf *sb, + __be32 rcv_nxt) +{ + struct mbuf *m; + int len; + + SOCKBUF_LOCK_ASSERT(sb); + INP_WLOCK_ASSERT(toep->inp); + len = be32toh(rcv_nxt) - tp->rcv_nxt; + + /* Signal handle_ddp() to break out of its sleep loop. */ + toep->ddp_flags &= ~(DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE); + if (len == 0) + return; + + tp->rcv_nxt += len; + KASSERT(toep->sb_cc >= sb->sb_cc, + ("%s: sb %p has more data (%d) than last time (%d).", + __func__, sb, sb->sb_cc, toep->sb_cc)); + toep->rx_credits += toep->sb_cc - sb->sb_cc; +#ifdef USE_DDP_RX_FLOW_CONTROL + toep->rx_credits -= len; /* adjust for F_RX_FC_DDP */ +#endif + + m = get_ddp_mbuf(len); + + sbappendstream_locked(sb, m); + toep->sb_cc = sb->sb_cc; +} + #define DDP_ERR (F_DDP_PPOD_MISMATCH | F_DDP_LLIMIT_ERR | F_DDP_ULIMIT_ERR |\ F_DDP_PPOD_PARITY_ERR | F_DDP_PADDING_ERR | F_DDP_OFFSET_ERR |\ F_DDP_INVALID_TAG | F_DDP_COLOR_ERR | F_DDP_TID_MISMATCH |\ @@ -991,7 +1037,7 @@ soreceive_rcvoob(struct socket *so, stru static char ddp_magic_str[] = "nothing to see here"; -struct mbuf * +static struct mbuf * get_ddp_mbuf(int len) { struct mbuf *m; @@ -1078,9 +1124,9 @@ t4_soreceive_ddp(struct socket *so, stru /* Prevent other readers from entering the socket. */ error = sblock(sb, SBLOCKWAIT(flags)); + SOCKBUF_LOCK(sb); if (error) goto out; - SOCKBUF_LOCK(sb); /* Easy one, no space to copyout anything. */ if (uio->uio_resid == 0) { Modified: stable/10/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_tom.h Fri Nov 4 01:56:29 2016 (r308280) +++ stable/10/sys/dev/cxgbe/tom/t4_tom.h Fri Nov 4 03:25:34 2016 (r308281) @@ -281,9 +281,10 @@ void t4_init_ddp(struct adapter *, struc void t4_uninit_ddp(struct adapter *, struct tom_data *); int t4_soreceive_ddp(struct socket *, struct sockaddr **, struct uio *, struct mbuf **, struct mbuf **, int *); -struct mbuf *get_ddp_mbuf(int); void enable_ddp(struct adapter *, struct toepcb *toep); void release_ddp_resources(struct toepcb *toep); +void handle_ddp_close(struct toepcb *, struct tcpcb *, struct sockbuf *, + uint32_t); void insert_ddp_data(struct toepcb *, uint32_t); /* ULP related */ From owner-svn-src-stable-10@freebsd.org Fri Nov 4 03:49:55 2016 Return-Path: Delivered-To: svn-src-stable-10@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 80F26C2BB51; Fri, 4 Nov 2016 03:49:55 +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 43F851298; Fri, 4 Nov 2016 03:49:55 +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 uA43nset018106; Fri, 4 Nov 2016 03:49:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA43nsmb018102; Fri, 4 Nov 2016 03:49:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611040349.uA43nsmb018102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 03:49:54 +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: r308282 - in stable/10/sys/dev/cxgbe: firmware tom 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 03:49:55 -0000 Author: jhb Date: Fri Nov 4 03:49:53 2016 New Revision: 308282 URL: https://svnweb.freebsd.org/changeset/base/308282 Log: MFC 290175,290633,299206,300895,301898: Various TOE fixes. 290175: cxgbe/tom: decide whether to shove segments or not only if there is payload to transmit. 290633: cxgbe/t4_tom: add a knob to the default configuration file to tune the TOE for LAN operation. It is possible to set this to other values (cluster for networks with little loss and really tight RTTs, and wan for relatively large RTTs and/or lossy networks) depending on the environment in which the TOE is being used. None of this affects plain NIC operation in any way. 299206: Set the correct vnet in TOE event handlers. 300895: cxgbe/t4_tom: Exempt RDMA connections from a TCP sanity test for now, to avoid panicking debug kernels. t4_tom does not keep track of a connection once it switches to ULP mode iWARP. If the connection falls out of ULP mode the driver/hardware seq# etc. are out of sync. A better fix would be to figure out what the current seq# are, update the driver's state, and perform all sanity checks as usual. 301898: cxgbe/t4_tom: Fix inverted assertion in r300895. It is RDMA connections and not others that are allowed to fail the receive window check. Modified: stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c stable/10/sys/dev/cxgbe/tom/t4_listen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt ============================================================================== --- stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Nov 4 03:25:34 2016 (r308281) +++ stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Nov 4 03:49:53 2016 (r308282) @@ -33,6 +33,9 @@ tp_pmrx_pagesize = 64K tp_pmtx_pagesize = 64K + # cluster, lan, or wan. + tp_tcptuning = lan + # TP OFLD MTUs tp_mtus = 88, 256, 512, 576, 808, 1024, 1280, 1488, 1500, 2002, 2048, 4096, 4352, 8192, 9000, 9600 @@ -160,7 +163,7 @@ [fini] version = 0x1 - checksum = 0xb4168add + checksum = 0xc5e9ef34 # # $FreeBSD$ # Modified: stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt ============================================================================== --- stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Nov 4 03:25:34 2016 (r308281) +++ stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Nov 4 03:49:53 2016 (r308282) @@ -42,6 +42,9 @@ tp_pmrx_pagesize = 64K tp_pmtx_pagesize = 64K + # cluster, lan, or wan. + tp_tcptuning = lan + # TP OFLD MTUs tp_mtus = 88, 256, 512, 576, 808, 1024, 1280, 1488, 1500, 2002, 2048, 4096, 4352, 8192, 9000, 9600 @@ -173,7 +176,7 @@ [fini] version = 0x1 - checksum = 0x4f45e608 + checksum = 0x6b54f66d # # $FreeBSD$ # Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 03:25:34 2016 (r308281) +++ stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 03:49:53 2016 (r308282) @@ -295,6 +295,7 @@ make_established(struct toepcb *toep, ui uint16_t tcpopt = be16toh(opt); struct flowc_tx_params ftxp; + CURVNET_SET(so->so_vnet); INP_WLOCK_ASSERT(inp); KASSERT(tp->t_state == TCPS_SYN_SENT || tp->t_state == TCPS_SYN_RECEIVED, @@ -345,6 +346,7 @@ make_established(struct toepcb *toep, ui send_flowc_wr(toep, &ftxp); soisconnected(so); + CURVNET_RESTORE(); } static int @@ -676,7 +678,6 @@ t4_push_frames(struct adapter *sc, struc } } - shove = m == NULL && !(tp->t_flags & TF_MORETOCOME); space = sbspace(sb); if (space <= sb->sb_hiwat * 3 / 8 && @@ -713,6 +714,7 @@ t4_push_frames(struct adapter *sc, struc if (__predict_false(toep->flags & TPF_FIN_SENT)) panic("%s: excess tx.", __func__); + shove = m == NULL && !(tp->t_flags & TF_MORETOCOME); if (plen <= max_imm) { /* Immediate data tx */ @@ -1501,7 +1503,11 @@ do_rx_data(struct sge_iq *iq, const stru ddp_placed = be32toh(cpl->seq) - tp->rcv_nxt; tp->rcv_nxt += len; - KASSERT(tp->rcv_wnd >= len, ("%s: negative window size", __func__)); + if (tp->rcv_wnd < len) { + KASSERT(toep->ulp_mode == ULP_MODE_RDMA, + ("%s: negative window size", __func__)); + } + tp->rcv_wnd -= len; tp->t_rcvtime = ticks; @@ -1527,6 +1533,7 @@ do_rx_data(struct sge_iq *iq, const stru } /* receive buffer autosize */ + CURVNET_SET(so->so_vnet); if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autorcvbuf && sb->sb_hiwat < V_tcp_autorcvbuf_max && @@ -1615,6 +1622,7 @@ do_rx_data(struct sge_iq *iq, const stru SOCKBUF_UNLOCK_ASSERT(sb); INP_WUNLOCK(inp); + CURVNET_RESTORE(); return (0); } Modified: stable/10/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_listen.c Fri Nov 4 03:25:34 2016 (r308281) +++ stable/10/sys/dev/cxgbe/tom/t4_listen.c Fri Nov 4 03:49:53 2016 (r308282) @@ -1357,6 +1357,7 @@ found: REJECT_PASS_ACCEPT(); } so = inp->inp_socket; + CURVNET_SET(so->so_vnet); mtu_idx = find_best_mtu_idx(sc, &inc, be16toh(cpl->tcpopt.mss)); rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; @@ -1403,6 +1404,7 @@ found: */ toe_syncache_add(&inc, &to, &th, inp, tod, synqe); INP_UNLOCK_ASSERT(inp); /* ok to assert, we have a ref on the inp */ + CURVNET_RESTORE(); /* * If we replied during syncache_add (synqe->wr has been consumed), From owner-svn-src-stable-10@freebsd.org Fri Nov 4 04:02:00 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DB722C2F094; Fri, 4 Nov 2016 04:02:00 +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 8FD931AE6; Fri, 4 Nov 2016 04:02:00 +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 uA441xjN025497; Fri, 4 Nov 2016 04:01:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA441xnF025496; Fri, 4 Nov 2016 04:01:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611040401.uA441xnF025496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 04:01:59 +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: r308283 - stable/10/sys/dev/cxgbe/tom 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 04:02:01 -0000 Author: jhb Date: Fri Nov 4 04:01:59 2016 New Revision: 308283 URL: https://svnweb.freebsd.org/changeset/base/308283 Log: MFC 301932: Use sbused() instead of sbspace() to avoid signed issues. Inserting a full mbuf with an external cluster into the socket buffer resulted in sbspace() returning -MLEN. However, since sb_hiwat is unsigned, the -MLEN value was converted to unsigned in comparisons. As a result, the socket buffer was never autosized. Note that sb_lowat is signed to permit direct comparisons with sbspace(), but sb_hiwat is unsigned. Follow suit with what tcp_output() does and compare the value of sbused() with sb_hiwat instead. Note: Since stable/10 does not include sbused(), this uses sb->sb_cc instead. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 03:49:53 2016 (r308282) +++ stable/10/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Nov 4 04:01:59 2016 (r308283) @@ -606,7 +606,7 @@ t4_push_frames(struct adapter *sc, struc struct tcpcb *tp = intotcpcb(inp); struct socket *so = inp->inp_socket; struct sockbuf *sb = &so->so_snd; - int tx_credits, shove, compl, space, sowwakeup; + int tx_credits, shove, compl, sowwakeup; struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; INP_WLOCK_ASSERT(inp); @@ -678,9 +678,7 @@ t4_push_frames(struct adapter *sc, struc } } - space = sbspace(sb); - - if (space <= sb->sb_hiwat * 3 / 8 && + if (sb->sb_cc > sb->sb_hiwat * 5 / 8 && toep->plen_nocompl + plen >= sb->sb_hiwat / 4) compl = 1; else @@ -689,7 +687,7 @@ t4_push_frames(struct adapter *sc, struc if (sb->sb_flags & SB_AUTOSIZE && V_tcp_do_autosndbuf && sb->sb_hiwat < V_tcp_autosndbuf_max && - space < sb->sb_hiwat / 8) { + sb->sb_cc >= sb->sb_hiwat * 7 / 8) { int newsize = min(sb->sb_hiwat + V_tcp_autosndbuf_inc, V_tcp_autosndbuf_max); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 04:06:57 2016 Return-Path: Delivered-To: svn-src-stable-10@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 52842C2F2FF; Fri, 4 Nov 2016 04:06:57 +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 205F31E97; Fri, 4 Nov 2016 04:06:57 +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 uA446u6i025716; Fri, 4 Nov 2016 04:06:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA446uRp025714; Fri, 4 Nov 2016 04:06:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611040406.uA446uRp025714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 04:06:56 +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: r308284 - in stable/10/sys/dev/cxgbe: . 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 04:06:57 -0000 Author: jhb Date: Fri Nov 4 04:06:55 2016 New Revision: 308284 URL: https://svnweb.freebsd.org/changeset/base/308284 Log: MFC 295573: Remove duplicate definition (CPL_TRACE_PKT_T5). Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/common/t4_msg.h stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/common/t4_msg.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_msg.h Fri Nov 4 04:01:59 2016 (r308283) +++ stable/10/sys/dev/cxgbe/common/t4_msg.h Fri Nov 4 04:06:55 2016 (r308284) @@ -126,7 +126,6 @@ enum { CPL_RDMA_IMM_DATA_SE = 0xAD, CPL_TRACE_PKT = 0xB0, - CPL_TRACE_PKT_T5 = 0x48, CPL_RX2TX_DATA = 0xB1, CPL_ISCSI_DATA = 0xB2, CPL_FCOE_DATA = 0xB3, Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 04:01:59 2016 (r308283) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 04:06:55 2016 (r308284) @@ -717,7 +717,7 @@ t4_attach(device_t dev) sc->fw_msg_handler[i] = fw_msg_not_handled; t4_register_cpl_handler(sc, CPL_SET_TCB_RPL, t4_filter_rpl); t4_register_cpl_handler(sc, CPL_TRACE_PKT, t4_trace_pkt); - t4_register_cpl_handler(sc, CPL_TRACE_PKT_T5, t5_trace_pkt); + t4_register_cpl_handler(sc, CPL_T5_TRACE_PKT, t5_trace_pkt); t4_init_sge_cpl_handlers(sc); /* Prepare the adapter for operation */ From owner-svn-src-stable-10@freebsd.org Fri Nov 4 13:51:11 2016 Return-Path: Delivered-To: svn-src-stable-10@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 9A14EC2F5AB; Fri, 4 Nov 2016 13:51:11 +0000 (UTC) (envelope-from trasz@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 6B9591C7; Fri, 4 Nov 2016 13:51:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA4DpAPC053537; Fri, 4 Nov 2016 13:51:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4DpAgC053536; Fri, 4 Nov 2016 13:51:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611041351.uA4DpAgC053536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 4 Nov 2016 13:51:10 +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: r308290 - 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 13:51:11 -0000 Author: trasz Date: Fri Nov 4 13:51:10 2016 New Revision: 308290 URL: https://svnweb.freebsd.org/changeset/base/308290 Log: MFC r292210: Fix kernel build with "options GEOM_MOUNTVER". Previously it was only working as a kernel module. PR: 205026 Modified: stable/10/sys/conf/options Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Fri Nov 4 13:07:54 2016 (r308289) +++ stable/10/sys/conf/options Fri Nov 4 13:51:10 2016 (r308290) @@ -106,6 +106,7 @@ GEOM_LABEL opt_geom.h GEOM_LINUX_LVM opt_geom.h GEOM_MBR opt_geom.h GEOM_MIRROR opt_geom.h +GEOM_MOUNTVER opt_geom.h GEOM_MULTIPATH opt_geom.h GEOM_NOP opt_geom.h GEOM_PART_APM opt_geom.h From owner-svn-src-stable-10@freebsd.org Fri Nov 4 13:59:58 2016 Return-Path: Delivered-To: svn-src-stable-10@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 725A5C2F8B3; Fri, 4 Nov 2016 13:59:58 +0000 (UTC) (envelope-from trasz@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 403C294A; Fri, 4 Nov 2016 13:59:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA4Dxvr0057652; Fri, 4 Nov 2016 13:59:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4DxvrZ057651; Fri, 4 Nov 2016 13:59:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611041359.uA4DxvrZ057651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 4 Nov 2016 13:59: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: r308291 - stable/10/share/man/man5 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 13:59:58 -0000 Author: trasz Date: Fri Nov 4 13:59:57 2016 New Revision: 308291 URL: https://svnweb.freebsd.org/changeset/base/308291 Log: MFC r287032: Tweak the "rctl_enable" description to not give the impression of being disabled by default. Modified: stable/10/share/man/man5/rc.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man5/rc.conf.5 ============================================================================== --- stable/10/share/man/man5/rc.conf.5 Fri Nov 4 13:51:10 2016 (r308290) +++ stable/10/share/man/man5/rc.conf.5 Fri Nov 4 13:59:57 2016 (r308291) @@ -4508,9 +4508,9 @@ polled at a 1-second interval. The default is 30. .It Va rctl_enable .Pq Vt bool -Set to -.Dq Li YES -to load +If set to +.Dq Li YES , +load .Xr rctl 8 rules from the defined ruleset. The kernel must be built with From owner-svn-src-stable-10@freebsd.org Fri Nov 4 14:06:22 2016 Return-Path: Delivered-To: svn-src-stable-10@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 7140AC2FB69; Fri, 4 Nov 2016 14:06:22 +0000 (UTC) (envelope-from trasz@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 4E355DFE; Fri, 4 Nov 2016 14:06:22 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA4E6LZ4061295; Fri, 4 Nov 2016 14:06:21 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4E6L1A061292; Fri, 4 Nov 2016 14:06:21 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201611041406.uA4E6L1A061292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 4 Nov 2016 14:06:21 +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: r308292 - in stable/10: etc/autofs usr.bin/showmount 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 14:06:22 -0000 Author: trasz Date: Fri Nov 4 14:06:21 2016 New Revision: 308292 URL: https://svnweb.freebsd.org/changeset/base/308292 Log: MFC r297207: Make the autofs(5) -hosts map more robust, primarily to make it correctly handle NFS shares containing whitespace. This also adds the -E parameter to showmount(8). PR: 207596 Differential Revision: https://reviews.freebsd.org/D5649 Modified: stable/10/etc/autofs/special_hosts stable/10/usr.bin/showmount/showmount.8 stable/10/usr.bin/showmount/showmount.c Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/autofs/special_hosts ============================================================================== --- stable/10/etc/autofs/special_hosts Fri Nov 4 13:59:57 2016 (r308291) +++ stable/10/etc/autofs/special_hosts Fri Nov 4 14:06:21 2016 (r308292) @@ -10,8 +10,8 @@ if [ $# -eq 0 ]; then exit 0 fi -out=`showmount -e "$1"` +out=`showmount -E "$1"` [ $? -eq 0 ] || exit 1 echo "$out" | awk -v host="$1" \ - 'NR > 1 { printf "%s\t%s:%s ", $1, host, $1 } END { printf "\n" }' + '{ printf "\"%s\"\t\"%s:%s\" ", $0, host, $0 } END { printf "\n" }' Modified: stable/10/usr.bin/showmount/showmount.8 ============================================================================== --- stable/10/usr.bin/showmount/showmount.8 Fri Nov 4 13:59:57 2016 (r308291) +++ stable/10/usr.bin/showmount/showmount.8 Fri Nov 4 14:06:21 2016 (r308292) @@ -31,7 +31,7 @@ .\" @(#)showmount.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd August 16, 2014 +.Dd March 20, 2016 .Dt SHOWMOUNT 8 .Os .Sh NAME @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl a | d +.Op Fl E .Op Fl e .Op Fl 1 .Op Fl 3 @@ -73,6 +74,12 @@ List all mount points in the form: .Ed .It Fl d List directory paths of mount points instead of hosts. +.It Fl E +Show the +.Ar host Ns 's +exports list in a script-friendly format. +Client addresses and the header are not shown, and special +characters are escaped. .It Fl e Show the .Ar host Ns 's Modified: stable/10/usr.bin/showmount/showmount.c ============================================================================== --- stable/10/usr.bin/showmount/showmount.c Fri Nov 4 13:59:57 2016 (r308291) +++ stable/10/usr.bin/showmount/showmount.c Fri Nov 4 14:06:21 2016 (r308292) @@ -61,13 +61,15 @@ static const char rcsid[] = #include #include #include +#include /* Constant defs */ #define ALL 1 #define DIRS 2 -#define DODUMP 0x1 -#define DOEXPORTS 0x2 +#define DODUMP 0x1 +#define DOEXPORTS 0x2 +#define DOPARSABLEEXPORTS 0x4 struct mountlist { struct mountlist *ml_left; @@ -108,13 +110,14 @@ int tcp_callrpc(const char *host, int pr int main(int argc, char **argv) { + char strvised[MNTPATHLEN * 4 + 1]; register struct exportslist *exp; register struct grouplist *grp; register int rpcs = 0, mntvers = 3; const char *host; - int ch, estat; + int ch, estat, nbytes; - while ((ch = getopt(argc, argv, "ade13")) != -1) + while ((ch = getopt(argc, argv, "adEe13")) != -1) switch (ch) { case 'a': if (type == 0) { @@ -130,6 +133,9 @@ main(int argc, char **argv) } else usage(); break; + case 'E': + rpcs |= DOPARSABLEEXPORTS; + break; case 'e': rpcs |= DOEXPORTS; break; @@ -146,6 +152,13 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if ((rpcs & DOPARSABLEEXPORTS) != 0) { + if ((rpcs & DOEXPORTS) != 0) + errx(1, "-E cannot be used with -e"); + if ((rpcs & DODUMP) != 0) + errx(1, "-E cannot be used with -a or -d"); + } + if (argc > 0) host = *argv; else @@ -161,7 +174,7 @@ main(int argc, char **argv) clnt_perrno(estat); errx(1, "can't do mountdump rpc"); } - if (rpcs & DOEXPORTS) + if (rpcs & (DOEXPORTS | DOPARSABLEEXPORTS)) if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers, MOUNTPROC_EXPORT, (xdrproc_t)xdr_void, (char *)0, (xdrproc_t)xdr_exportslist, (char *)&exportslist)) != 0) { @@ -202,6 +215,17 @@ main(int argc, char **argv) exp = exp->ex_next; } } + if (rpcs & DOPARSABLEEXPORTS) { + exp = exportslist; + while (exp) { + nbytes = strsnvis(strvised, sizeof(strvised), + exp->ex_dirp, VIS_GLOB | VIS_NL, "\"'$"); + if (nbytes == -1) + err(1, "strsnvis"); + printf("%s\n", strvised); + exp = exp->ex_next; + } + } exit(0); } From owner-svn-src-stable-10@freebsd.org Fri Nov 4 17:55:51 2016 Return-Path: Delivered-To: svn-src-stable-10@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 DC636C2F493; Fri, 4 Nov 2016 17:55:51 +0000 (UTC) (envelope-from gjb@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 928D823A; Fri, 4 Nov 2016 17:55:51 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA4HtoRe051695; Fri, 4 Nov 2016 17:55:50 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4HtoOJ051689; Fri, 4 Nov 2016 17:55:50 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201611041755.uA4HtoOJ051689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 4 Nov 2016 17:55:50 +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: r308302 - in stable: 10/contrib/tzdata 11/contrib/tzdata 9/contrib/tzdata 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 17:55:52 -0000 Author: gjb Date: Fri Nov 4 17:55:50 2016 New Revision: 308302 URL: https://svnweb.freebsd.org/changeset/base/308302 Log: MFC r308270: MFV r308265: Update tzdata to 2016i. Sponsored by: The FreeBSD Foundation Added: stable/10/contrib/tzdata/CONTRIBUTING - copied unchanged from r308270, head/contrib/tzdata/CONTRIBUTING stable/10/contrib/tzdata/LICENSE - copied unchanged from r308270, head/contrib/tzdata/LICENSE stable/10/contrib/tzdata/Makefile - copied unchanged from r308270, head/contrib/tzdata/Makefile stable/10/contrib/tzdata/NEWS - copied unchanged from r308270, head/contrib/tzdata/NEWS stable/10/contrib/tzdata/README - copied unchanged from r308270, head/contrib/tzdata/README stable/10/contrib/tzdata/Theory - copied unchanged from r308270, head/contrib/tzdata/Theory stable/10/contrib/tzdata/backzone - copied unchanged from r308270, head/contrib/tzdata/backzone stable/10/contrib/tzdata/checklinks.awk - copied unchanged from r308270, head/contrib/tzdata/checklinks.awk stable/10/contrib/tzdata/checktab.awk - copied unchanged from r308270, head/contrib/tzdata/checktab.awk stable/10/contrib/tzdata/leapseconds.awk - copied unchanged from r308270, head/contrib/tzdata/leapseconds.awk stable/10/contrib/tzdata/version - copied unchanged from r308270, head/contrib/tzdata/version stable/10/contrib/tzdata/zoneinfo2tdf.pl - copied unchanged from r308270, head/contrib/tzdata/zoneinfo2tdf.pl Modified: stable/10/contrib/tzdata/antarctica stable/10/contrib/tzdata/asia stable/10/contrib/tzdata/australasia stable/10/contrib/tzdata/europe stable/10/contrib/tzdata/zone.tab stable/10/contrib/tzdata/zone1970.tab Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Added: stable/11/contrib/tzdata/CONTRIBUTING - copied unchanged from r308270, head/contrib/tzdata/CONTRIBUTING stable/11/contrib/tzdata/LICENSE - copied unchanged from r308270, head/contrib/tzdata/LICENSE stable/11/contrib/tzdata/Makefile - copied unchanged from r308270, head/contrib/tzdata/Makefile stable/11/contrib/tzdata/NEWS - copied unchanged from r308270, head/contrib/tzdata/NEWS stable/11/contrib/tzdata/README - copied unchanged from r308270, head/contrib/tzdata/README stable/11/contrib/tzdata/Theory - copied unchanged from r308270, head/contrib/tzdata/Theory stable/11/contrib/tzdata/backzone - copied unchanged from r308270, head/contrib/tzdata/backzone stable/11/contrib/tzdata/checklinks.awk - copied unchanged from r308270, head/contrib/tzdata/checklinks.awk stable/11/contrib/tzdata/checktab.awk - copied unchanged from r308270, head/contrib/tzdata/checktab.awk stable/11/contrib/tzdata/leapseconds.awk - copied unchanged from r308270, head/contrib/tzdata/leapseconds.awk stable/11/contrib/tzdata/version - copied unchanged from r308270, head/contrib/tzdata/version stable/11/contrib/tzdata/zoneinfo2tdf.pl - copied unchanged from r308270, head/contrib/tzdata/zoneinfo2tdf.pl stable/9/contrib/tzdata/CONTRIBUTING - copied unchanged from r308270, head/contrib/tzdata/CONTRIBUTING stable/9/contrib/tzdata/LICENSE - copied unchanged from r308270, head/contrib/tzdata/LICENSE stable/9/contrib/tzdata/Makefile - copied unchanged from r308270, head/contrib/tzdata/Makefile stable/9/contrib/tzdata/NEWS - copied unchanged from r308270, head/contrib/tzdata/NEWS stable/9/contrib/tzdata/README - copied unchanged from r308270, head/contrib/tzdata/README stable/9/contrib/tzdata/Theory - copied unchanged from r308270, head/contrib/tzdata/Theory stable/9/contrib/tzdata/backzone - copied unchanged from r308270, head/contrib/tzdata/backzone stable/9/contrib/tzdata/checklinks.awk - copied unchanged from r308270, head/contrib/tzdata/checklinks.awk stable/9/contrib/tzdata/checktab.awk - copied unchanged from r308270, head/contrib/tzdata/checktab.awk stable/9/contrib/tzdata/leapseconds.awk - copied unchanged from r308270, head/contrib/tzdata/leapseconds.awk stable/9/contrib/tzdata/version - copied unchanged from r308270, head/contrib/tzdata/version stable/9/contrib/tzdata/zoneinfo2tdf.pl - copied unchanged from r308270, head/contrib/tzdata/zoneinfo2tdf.pl Modified: stable/11/contrib/tzdata/antarctica stable/11/contrib/tzdata/asia stable/11/contrib/tzdata/australasia stable/11/contrib/tzdata/europe stable/11/contrib/tzdata/zone.tab stable/11/contrib/tzdata/zone1970.tab stable/9/contrib/tzdata/antarctica stable/9/contrib/tzdata/asia stable/9/contrib/tzdata/australasia stable/9/contrib/tzdata/europe stable/9/contrib/tzdata/zone.tab stable/9/contrib/tzdata/zone1970.tab Directory Properties: stable/11/ (props changed) stable/9/contrib/tzdata/ (props changed) Copied: stable/10/contrib/tzdata/CONTRIBUTING (from r308270, head/contrib/tzdata/CONTRIBUTING) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/tzdata/CONTRIBUTING Fri Nov 4 17:55:50 2016 (r308302, copy of r308270, head/contrib/tzdata/CONTRIBUTING) @@ -0,0 +1,73 @@ +Contributing to the tz code and data + +The time zone database is by no means authoritative: governments +change timekeeping rules erratically and sometimes with little +warning, the data entries do not cover all of civil time before +1970, and undoubtedly errors remain in the code and data. Feel +free to fill gaps or fix mistakes, and please email improvements +to tz@iana.org for use in the future. + +To email small changes, please run a POSIX shell command like +'diff -u old/europe new/europe >myfix.patch', and attach +myfix.patch to the email. + +For more-elaborate changes, please read the Theory file and browse +the mailing list archives for +examples of patches that tend to work well. Ideally, additions to +data should contain commentary citing reliable sources as +justification. + +Please submit changes against either the latest release in + or the master branch of the experimental +Git repository. If you use Git the following workflow may be helpful: + + * Copy the experimental repository. + + git clone https://github.com/eggert/tz.git + cd tz + + * Get current with the master branch. + + git checkout master + git pull + + * Switch to a new branch for the changes. Choose a different + branch name for each change set. + + git checkout -b mybranch + + * Edit source files. Include commentary that justifies the + changes by citing reliable sources. + + * Debug the changes, e.g.: + + make check + make install + ./zdump -v America/Los_Angeles + + * For each separable change, commit it in the new branch, e.g.: + + git add northamerica + git commit + + See recent 'git log' output for the commit-message style. + + * Create patch files 0001-*, 0002-*, ... + + git format-patch master + + * After reviewing the patch files, send the patches to tz@iana.org + for others to review. + + git send-email master + + * Start anew by getting current with the master branch again + (the second step above). + +Please do not create issues or pull requests on GitHub, as the +proper procedure for proposing and distributing patches is via +email as illustrated above. + +----- + +This file is in the public domain. Copied: stable/10/contrib/tzdata/LICENSE (from r308270, head/contrib/tzdata/LICENSE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/tzdata/LICENSE Fri Nov 4 17:55:50 2016 (r308302, copy of r308270, head/contrib/tzdata/LICENSE) @@ -0,0 +1,4 @@ +With a few exceptions, all files in the tz code and data (including +this one) are in the public domain. The exceptions are date.c, +newstrftime.3, and strftime.c, which contain material derived from BSD +and which use the BSD 3-clause license. Copied: stable/10/contrib/tzdata/Makefile (from r308270, head/contrib/tzdata/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/tzdata/Makefile Fri Nov 4 17:55:50 2016 (r308302, copy of r308270, head/contrib/tzdata/Makefile) @@ -0,0 +1,793 @@ +# This file is in the public domain, so clarified as of +# 2009-05-17 by Arthur David Olson. + +# Package name for the code distribution. +PACKAGE= tzcode + +# Version number for the distribution, overridden in the 'tarballs' rule below. +VERSION= unknown + +# Email address for bug reports. +BUGEMAIL= tz@iana.org + +# Change the line below for your time zone (after finding the zone you want in +# the time zone files, or adding it to a time zone file). +# Alternately, if you discover you've got the wrong time zone, you can just +# zic -l rightzone +# to correct things. +# Use the command +# make zonenames +# to get a list of the values you can use for LOCALTIME. + +LOCALTIME= GMT + +# If you want something other than Eastern United States time as a template +# for handling POSIX-style time zone environment variables, +# change the line below (after finding the zone you want in the +# time zone files, or adding it to a time zone file). +# (When a POSIX-style environment variable is handled, the rules in the +# template file are used to determine "spring forward" and "fall back" days and +# times; the environment variable itself specifies UT offsets of standard and +# summer time.) +# Alternately, if you discover you've got the wrong time zone, you can just +# zic -p rightzone +# to correct things. +# Use the command +# make zonenames +# to get a list of the values you can use for POSIXRULES. +# If you want POSIX compatibility, use "America/New_York". + +POSIXRULES= America/New_York + +# Also see TZDEFRULESTRING below, which takes effect only +# if the time zone files cannot be accessed. + +# Everything gets put in subdirectories of. . . + +TOPDIR= /usr/local + +# "Compiled" time zone information is placed in the "TZDIR" directory +# (and subdirectories). +# Use an absolute path name for TZDIR unless you're just testing the software. + +TZDIR_BASENAME= zoneinfo +TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) + +# Types to try, as an alternative to time_t. int64_t should be first. +TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t + +# The "tzselect", "zic", and "zdump" commands get installed in. . . + +ETCDIR= $(TOPDIR)/etc + +# If you "make INSTALL", the "date" command gets installed in. . . + +BINDIR= $(TOPDIR)/bin + +# Manual pages go in subdirectories of. . . + +MANDIR= $(TOPDIR)/man + +# Library functions are put in an archive in LIBDIR. + +LIBDIR= $(TOPDIR)/lib + +# If you always want time values interpreted as "seconds since the epoch +# (not counting leap seconds)", use +# REDO= posix_only +# below. If you always want right time values interpreted as "seconds since +# the epoch" (counting leap seconds)", use +# REDO= right_only +# below. If you want both sets of data available, with leap seconds not +# counted normally, use +# REDO= posix_right +# below. If you want both sets of data available, with leap seconds counted +# normally, use +# REDO= right_posix +# below. POSIX mandates that leap seconds not be counted; for compatibility +# with it, use "posix_only" or "posix_right". + +REDO= posix_right + +# If you want out-of-scope and often-wrong data from the file 'backzone', use +# PACKRATDATA= backzone +# To omit this data, use +# PACKRATDATA= + +PACKRATDATA= + +# Since "." may not be in PATH... + +YEARISTYPE= ./yearistype + +# Non-default libraries needed to link. +LDLIBS= + +# Add the following to the end of the "CFLAGS=" line as needed. +# -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c) +# -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DIRECT_H if mkdir needs (MS-Windows) +# -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS) +# -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) +# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares +# ctime_r and asctime_r incompatibly with the POSIX standard +# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). +# -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h" +# -DHAVE_LINK=0 if your system lacks a link function +# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function +# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz +# This defaults to 1 if a working localtime_rz seems to be available. +# localtime_rz can make zdump significantly faster, but is nonstandard. +# -DHAVE_POSIX_DECLS=0 if your system's include files do not declare +# functions like 'link' or variables like 'tzname' required by POSIX +# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" +# -DHAVE_STRFTIME_L=1 if declares locale_t and strftime_l +# This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise. +# -DHAVE_STRDUP=0 if your system lacks the strdup function +# -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" +# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" +# -DHAVE_TZSET=0 if your system lacks a tzset function +# -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?) +# -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. +# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1 +# if you do not want run time warnings about formats that may cause +# year 2000 grief +# -Dssize_t=long on ancient hosts that lack ssize_t +# -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires; +# not needed by the main-program tz code, which is single-threaded. +# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. +# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" +# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; +# the default is system-supplied, typically "/usr/lib/locale" +# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified +# DST transitions if the time zone files cannot be accessed +# -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems +# other than simply getting garbage data +# -DUSE_LTZ=0 to build zdump with the system time zone library +# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. +# -DZIC_MAX_ABBR_LEN_WO_WARN=3 +# (or some other number) to set the maximum time zone abbreviation length +# that zic will accept without a warning (the default is 6) +# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking +GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \ + -Wall -Wextra \ + -Wbad-function-cast -Wcast-align -Wdate-time \ + -Wdeclaration-after-statement \ + -Wdouble-promotion \ + -Wformat=2 -Winit-self -Wjump-misses-init \ + -Wlogical-op -Wmissing-prototypes -Wnested-externs \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ + -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \ + -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \ + -Wsuggest-attribute=pure -Wtrampolines \ + -Wunused -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter +# +# If you want to use System V compatibility code, add +# -DUSG_COMPAT +# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight" +# variables to be kept up-to-date by the time conversion functions. Neither +# "timezone" nor "daylight" is described in X3J11's work. +# +# If your system has a "GMT offset" field in its "struct tm"s +# (or if you decide to add such a field in your system's "time.h" file), +# add the name to a define such as +# -DTM_GMTOFF=tm_gmtoff +# to the end of the "CFLAGS=" line. If not defined, the code attempts to +# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. +# Similarly, if your system has a "zone abbreviation" field, define +# -DTM_ZONE=tm_zone +# and define NO_TM_ZONE to suppress any guessing. These two fields are not +# required by POSIX, but are widely available on GNU/Linux and BSD systems. +# +# If you want functions that were inspired by early versions of X3J11's work, +# add +# -DSTD_INSPIRED +# to the end of the "CFLAGS=" line. This arranges for the functions +# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff", +# "posix2time", and "time2posix" to be added to the time conversion library. +# "tzsetwall" is like "tzset" except that it arranges for local wall clock +# time (rather than the time specified in the TZ environment variable) +# to be used. +# "offtime" is like "gmtime" except that it accepts a second (long) argument +# that gives an offset to add to the time_t when converting it. +# "timelocal" is equivalent to "mktime". +# "timegm" is like "timelocal" except that it turns a struct tm into +# a time_t using UT (rather than local time as "timelocal" does). +# "timeoff" is like "timegm" except that it accepts a second (long) argument +# that gives an offset to use when converting to a time_t. +# "posix2time" and "time2posix" are described in an included manual page. +# X3J11's work does not describe any of these functions. +# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0. +# These functions may well disappear in future releases of the time +# conversion package. +# +# If you don't want functions that were inspired by NetBSD, add +# -DNETBSD_INSPIRED=0 +# to the end of the "CFLAGS=" line. Otherwise, the functions +# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the +# time library, and if STD_INSPIRED is also defined the functions +# "posix2time_z" and "time2posix_z" are added as well. +# The functions ending in "_z" (or "_rz") are like their unsuffixed +# (or suffixed-by-"_r") counterparts, except with an extra first +# argument of opaque type timezone_t that specifies the time zone. +# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. +# +# If you want to allocate state structures in localtime, add +# -DALL_STATE +# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. +# +# If you want an "altzone" variable (a la System V Release 3.1), add +# -DALTZONE +# to the end of the "CFLAGS=" line. +# This variable is not described in X3J11's work. +# +# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put +# out by the National Institute of Standards and Technology +# which claims to test C and Posix conformance. If you want to pass PCTS, add +# -DPCTS +# to the end of the "CFLAGS=" line. +# +# If you want strict compliance with XPG4 as of 1994-04-09, add +# -DXPG4_1994_04_09 +# to the end of the "CFLAGS=" line. This causes "strftime" to always return +# 53 as a week number (rather than 52 or 53) for those days in January that +# before the first Monday in January when a "%V" format is used and January 1 +# falls on a Friday, Saturday, or Sunday. + +CFLAGS= + +# Linker flags. Default to $(LFLAGS) for backwards compatibility +# to release 2012h and earlier. + +LDFLAGS= $(LFLAGS) + +# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in +# submake command lines. The default is no leap seconds. + +LEAPSECONDS= + +# The zic command and its arguments. + +zic= ./zic +ZIC= $(zic) $(ZFLAGS) + +ZFLAGS= + +# How to use zic to install tz binary files. + +ZIC_INSTALL= $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) + +# The name of a Posix-compliant 'awk' on your system. +AWK= awk + +# The full path name of a Posix-compliant shell, preferably one that supports +# the Korn shell's 'select' statement as an extension. +# These days, Bash is the most popular. +# It should be OK to set this to /bin/sh, on platforms where /bin/sh +# lacks 'select' or doesn't completely conform to Posix, but /bin/bash +# is typically nicer if it works. +KSHELL= /bin/bash + +# The path where SGML DTDs are kept and the catalog file(s) to use when +# validating. The default should work on both Debian and Red Hat. +SGML_TOPDIR= /usr +SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd +SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224 +SGML_CATALOG_FILES= \ + $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat:$(SGML_TOPDIR)/share/sgml/html/4.01/HTML4.cat + +# The name, arguments and environment of a program to validate your web pages. +# See for a validator, and +# for a validation library. +VALIDATE = nsgmls +VALIDATE_FLAGS = -s -B -wall -wno-unused-param +VALIDATE_ENV = \ + SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ + SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ + SP_CHARSET_FIXED=YES \ + SP_ENCODING=UTF-8 + +# This expensive test requires USE_LTZ. +# To suppress it, define this macro to be empty. +CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives + +# SAFE_CHAR is a regular expression that matches a safe character. +# Some parts of this distribution are limited to safe characters; +# others can use any UTF-8 character. +# For now, the safe characters are a safe subset of ASCII. +# The caller must set the shell variable 'sharp' to the character '#', +# since Makefile macros cannot contain '#'. +# TAB_CHAR is a single tab character, in single quotes. +TAB_CHAR= ' ' +SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' +SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' +SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' +SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) +SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' + +# OK_CHAR matches any character allowed in the distributed files. +# This is the same as SAFE_CHAR, except that multibyte letters are +# also allowed so that commentary can contain people's names and quote +# non-English sources. For non-letters the sources are limited to +# ASCII renderings for the convenience of maintainers whose text editors +# mishandle UTF-8 by default (e.g., XEmacs 21.4.22). +OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]' + +# SAFE_LINE matches a line of safe characters. +# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; +# this is so that comments can contain non-ASCII characters. +# OK_LINE matches a line of OK characters. +SAFE_LINE= '^'$(SAFE_CHAR)'*$$' +SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' +OK_LINE= '^'$(OK_CHAR)'*$$' + +# Flags to give 'tar' when making a distribution. +# Try to use flags appropriate for GNU tar. +GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w --sort=name +TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ + then echo $(GNUTARFLAGS); \ + else :; \ + fi` + +# Flags to give 'gzip' when making a distribution. +GZIPFLAGS= -9n + +############################################################################### + +#MAKE= make + +cc= cc +CC= $(cc) -DTZDIR=\"$(TZDIR)\" + +AR= ar + +# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. +RANLIB= : + +TZCOBJS= zic.o +TZDOBJS= zdump.o localtime.o asctime.o +DATEOBJS= date.o localtime.o strftime.o asctime.o +LIBSRCS= localtime.c asctime.c difftime.c +LIBOBJS= localtime.o asctime.o difftime.o +HEADERS= tzfile.h private.h +NONLIBSRCS= zic.c zdump.c +NEWUCBSRCS= date.c strftime.c +SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ + tzselect.ksh workman.sh +MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ + tzfile.5 tzselect.8 zic.8 zdump.8 +MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ + time2posix.3.txt \ + tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ + date.1.txt +COMMON= CONTRIBUTING LICENSE Makefile NEWS README Theory version +WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm +DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) +PRIMARY_YDATA= africa antarctica asia australasia \ + europe northamerica southamerica +YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward +NDATA= systemv factory +TDATA= $(YDATA) $(NDATA) +ZONETABLES= zone1970.tab zone.tab +TABDATA= iso3166.tab leapseconds $(ZONETABLES) +LEAP_DEPS= leapseconds.awk leap-seconds.list +DATA= $(YDATA) $(NDATA) backzone $(TABDATA) \ + leap-seconds.list yearistype.sh +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk +MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl +TZS_YEAR= 2050 +TZS= to$(TZS_YEAR).tzs +TZS_NEW= to$(TZS_YEAR)new.tzs +TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \ + private.h tzfile.h zdump.c zic.c +ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) + +# Consult these files when deciding whether to rebuild the 'version' file. +# This list is not the same as the output of 'git ls-files', since +# .gitignore is not distributed. +VERSION_DEPS= \ + CONTRIBUTING LICENSE Makefile NEWS README Theory \ + africa antarctica asctime.c asia australasia \ + backward backzone \ + checklinks.awk checktab.awk \ + date.1 date.c difftime.c \ + etcetera europe factory iso3166.tab \ + leap-seconds.list leapseconds.awk localtime.c \ + newctime.3 newstrftime.3 newtzset.3 northamerica \ + pacificnew private.h \ + southamerica strftime.c systemv \ + time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ + tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ + workman.sh yearistype.sh \ + zdump.8 zdump.c zic.8 zic.c \ + zone.tab zone1970.tab zoneinfo2tdf.pl + +# And for the benefit of csh users on systems that assume the user +# shell should be used to handle commands in Makefiles. . . + +SHELL= /bin/sh + +all: tzselect yearistype zic zdump libtz.a $(TABDATA) + +ALL: all date $(ENCHILADA) + +install: all $(DATA) $(REDO) $(MANS) + mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ + $(DESTDIR)$(LIBDIR) \ + $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ + $(DESTDIR)$(MANDIR)/man8 + $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) + cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/. + cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. + cp libtz.a $(DESTDIR)$(LIBDIR)/. + $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a + cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. + cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. + cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. + +INSTALL: ALL install date.1 + mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 + cp date $(DESTDIR)$(BINDIR)/. + cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. + +version: $(VERSION_DEPS) + { (type git) >/dev/null 2>&1 && \ + V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \ + --abbrev=7 --dirty` || \ + V=$(VERSION); } && \ + printf '%s\n' "$$V" >$@.out + mv $@.out $@ + +version.h: version + VERSION=`cat version` && printf '%s\n' \ + 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ + "static char const TZVERSION[]=\"$$VERSION\";" \ + 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \ + >$@.out + mv $@.out $@ + +zdump: $(TZDOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) + +zic: $(TZCOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) + +yearistype: yearistype.sh + cp yearistype.sh yearistype + chmod +x yearistype + +leapseconds: $(LEAP_DEPS) + $(AWK) -f leapseconds.awk leap-seconds.list >$@.out + mv $@.out $@ + +# Arguments to pass to submakes of install_data. +# They can be overridden by later submake arguments. +INSTALLARGS = \ + DESTDIR=$(DESTDIR) \ + LEAPSECONDS='$(LEAPSECONDS)' \ + PACKRATDATA='$(PACKRATDATA)' \ + TZDIR=$(TZDIR) \ + YEARISTYPE=$(YEARISTYPE) \ + ZIC='$(ZIC)' + +# 'make install_data' installs one set of tz binary files. +# It can be tailored by setting LEAPSECONDS, PACKRATDATA, etc. +install_data: zic leapseconds yearistype $(PACKRATDATA) $(TDATA) + $(ZIC_INSTALL) $(TDATA) + $(AWK) '/^Rule/' $(TDATA) | $(ZIC_INSTALL) - $(PACKRATDATA) + +posix_only: + $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data + +right_only: + $(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \ + install_data + +# In earlier versions of this makefile, the other two directories were +# subdirectories of $(TZDIR). However, this led to configuration errors. +# For example, with posix_right under the earlier scheme, +# TZ='right/Australia/Adelaide' got you localtime with leap seconds, +# but gmtime without leap seconds, which led to problems with applications +# like sendmail that subtract gmtime from localtime. +# Therefore, the other two directories are now siblings of $(TZDIR). +# You must replace all of $(TZDIR) to switch from not using leap seconds +# to using them, or vice versa. +right_posix: right_only + rm -fr $(DESTDIR)$(TZDIR)-leaps + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ + $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + +posix_right: posix_only + rm -fr $(DESTDIR)$(TZDIR)-posix + ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ + $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-posix posix_only + $(MAKE) $(INSTALLARGS) TZDIR=$(TZDIR)-leaps right_only + +# This obsolescent rule is present for backwards compatibility with +# tz releases 2014g through 2015g. It should go away eventually. +posix_packrat: + $(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only + +zones: $(REDO) + +$(TZS_NEW): $(TDATA) zdump zic + mkdir -p tzs.dir + $(zic) -d tzs.dir $(TDATA) + $(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \ + $(TDATA) | LC_ALL=C sort >$@.out + wd=`pwd` && \ + zones=`$(AWK) -v wd="$$wd" \ + '/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \ + | LC_ALL=C sort` && \ + ./zdump -i -c $(TZS_YEAR) $$zones >>$@.out + sed 's,^TZ=".*tzs\.dir/,TZ=",' $@.out >$@.sed.out + rm -fr tzs.dir $@.out + mv $@.sed.out $@ + +# If $(TZS) does not already exist (e.g., old-format tarballs), create it. +# If it exists but 'make check_tzs' fails, a maintainer should inspect the +# failed output and fix the inconsistency, perhaps by running 'make force_tzs'. +$(TZS): + $(MAKE) force_tzs + +force_tzs: $(TZS_NEW) + cp $(TZS_NEW) $(TZS) + +libtz.a: $(LIBOBJS) + $(AR) ru $@ $(LIBOBJS) + $(RANLIB) $@ + +date: $(DATEOBJS) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) + +tzselect: tzselect.ksh version + VERSION=`cat version` && sed \ + -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ + -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ + -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ + -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ + -e 's|\(TZVERSION\)=.*|\1='"$$VERSION"'|' \ + <$@.ksh >$@.out + chmod +x $@.out + mv $@.out $@ + +check: check_character_set check_white_space check_links check_sorted \ + check_tables check_tzs check_web + +check_character_set: $(ENCHILADA) + LC_ALL=en_US.utf8 && export LC_ALL && \ + sharp='#' && \ + ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ + $(MISC) $(SOURCES) $(WEB_PAGES) \ + CONTRIBUTING LICENSE Makefile README version && \ + ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ + leapseconds yearistype.sh zone.tab && \ + ! grep -Env $(OK_LINE) $(ENCHILADA) + +check_white_space: $(ENCHILADA) + patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ + ! grep -En "$$pat" $(ENCHILADA) + ! grep -n '[[:space:]]$$' $(ENCHILADA) + +CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } + +check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab + $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu + $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu + $(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu + $(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c + $(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \ + LC_ALL=C sort -c + $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ + LC_ALL=C sort -cu + +check_links: checklinks.awk $(TDATA) + $(AWK) -f checklinks.awk $(TDATA) + +check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) + for tab in $(ZONETABLES); do \ + $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \ + || exit; \ + done + +check_tzs: $(TZS) $(TZS_NEW) + diff -u $(TZS) $(TZS_NEW) + +check_web: $(WEB_PAGES) + $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) + +clean_misc: + rm -f core *.o *.out \ + date tzselect version.h zdump zic yearistype libtz.a +clean: clean_misc + rm -fr *.dir tzdb-*/ $(TZS_NEW) + +maintainer-clean: clean + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + rm -f leapseconds version $(MANTXTS) $(TZS) *.asc *.tar.* + +names: + @echo $(ENCHILADA) + +public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ + tarballs signatures + +date.1.txt: date.1 +newctime.3.txt: newctime.3 +newstrftime.3.txt: newstrftime.3 +newtzset.3.txt: newtzset.3 +time2posix.3.txt: time2posix.3 +tzfile.5.txt: tzfile.5 +tzselect.8.txt: tzselect.8 +zdump.8.txt: zdump.8 +zic.8.txt: zic.8 + +$(MANTXTS): workman.sh + LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out + mv $@.out $@ + +# Set the time stamps to those of the git repository, if available, +# and if the files have not changed since then. +# This uses GNU 'touch' syntax 'touch -d@N FILE', +# where N is the number of seconds since 1970. +# If git or GNU 'touch' is absent, don't bother to sync with git timestamps. +# Also, set the timestamp of each prebuilt file like 'leapseconds' +# to be the maximum of the files it depends on. +set-timestamps.out: $(ENCHILADA) + rm -f $@ + if (type git) >/dev/null 2>&1 && \ + files=`git ls-files $(ENCHILADA)` && \ + touch -md @1 test.out; then \ + rm -f test.out && \ + for file in $$files; do \ + if git diff --quiet $$file; then \ + time=`git log -1 --format='tformat:%ct' $$file` && \ + touch -cmd @$$time $$file; \ + else \ + echo >&2 "$$file: warning: does not match repository"; \ + fi || exit; \ + done; \ + fi + touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds + for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ + touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \ + exit; \ + done + touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS) + touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version + touch $@ + +# The zics below ensure that each data file can stand on its own. +# We also do an all-files run to catch links to links. + +check_public: + $(MAKE) maintainer-clean + $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL + mkdir -p public.dir + for i in $(TDATA) ; do \ + $(zic) -v -d public.dir $$i 2>&1 || exit; \ + done + $(zic) -v -d public.dir $(TDATA) + rm -fr public.dir + +# Check that the code works under various alternative +# implementations of time_t. +check_time_t_alternatives: + if diff -q Makefile Makefile 2>/dev/null; then \ + quiet_option='-q'; \ + else \ + quiet_option=''; \ + fi && \ + wd=`pwd` && \ + zones=`$(AWK) '/^[^#]/ { print $$3 }' time_t.dir/int64_t.out && \ + time_t.dir/$$type/etc/zdump -V -t $$range $$zones \ + >time_t.dir/$$type.out && \ + diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \ + || exit; \ + done + rm -fr time_t.dir + +tarballs traditional_tarballs signatures traditional_signatures: version + VERSION=`cat version` && \ + $(MAKE) VERSION="$$VERSION" $@_version + +tarballs_version: traditional_tarballs_version tzdb-$(VERSION).tar.lz +traditional_tarballs_version: \ + tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz +signatures_version: traditional_signatures_version tzdb-$(VERSION).tar.lz.asc +traditional_signatures_version: \ + tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc \ + +tzcode$(VERSION).tar.gz: set-timestamps.out + LC_ALL=C && export LC_ALL && \ + tar $(TARFLAGS) -cf - \ + $(COMMON) $(DOCS) $(SOURCES) | \ + gzip $(GZIPFLAGS) >$@.out + mv $@.out $@ + +tzdata$(VERSION).tar.gz: set-timestamps.out + LC_ALL=C && export LC_ALL && \ + tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \ + gzip $(GZIPFLAGS) >$@.out + mv $@.out $@ + +tzdb-$(VERSION).tar.lz: set-timestamps.out + rm -fr tzdb-$(VERSION) + mkdir tzdb-$(VERSION) + ln $(ENCHILADA) tzdb-$(VERSION) + touch -cmr `ls -t tzdb-$(VERSION)/* | sed 1q` tzdb-$(VERSION) + LC_ALL=C && export LC_ALL && \ + tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out + mv $@.out $@ + +tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz + gpg --armor --detach-sign $? + +tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz + gpg --armor --detach-sign $? + +tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz + gpg --armor --detach-sign $? + +typecheck: + $(MAKE) clean + for i in "long long" unsigned; \ + do \ + $(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \ + ./zdump -v Europe/Rome ; \ + $(MAKE) clean ; \ + done + +zonenames: $(TDATA) + @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA) + +asctime.o: private.h tzfile.h +date.o: private.h +difftime.o: private.h +localtime.o: private.h tzfile.h +strftime.o: private.h tzfile.h +zdump.o: version.h +zic.o: private.h tzfile.h version.h + +.KEEP_STATE: + +.PHONY: ALL INSTALL all +.PHONY: check check_character_set check_links +.PHONY: check_public check_sorted check_tables +.PHONY: check_time_t_alternatives check_tzs check_web check_white_space +.PHONY: clean clean_misc force_tzs +.PHONY: install install_data maintainer-clean names +.PHONY: posix_only posix_packrat posix_right +.PHONY: public right_only right_posix signatures signatures_version +.PHONY: tarballs tarballs_version typecheck +.PHONY: zonenames zones Copied: stable/10/contrib/tzdata/NEWS (from r308270, head/contrib/tzdata/NEWS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/tzdata/NEWS Fri Nov 4 17:55:50 2016 (r308302, copy of r308270, head/contrib/tzdata/NEWS) @@ -0,0 +1,3782 @@ +News for the tz database + +Release 2016i - 2016-11-01 23:19:52 -0700 + + Briefly: Cyprus split into two time zones on 2016-10-30, and Tonga + reintroduces DST on 2016-11-06. + + Changes to future time stamps + + Pacific/Tongatapu begins DST on 2016-11-06 at 02:00, ending on + 2017-01-15 at 03:00. Assume future observances in Tonga will be + from the first Sunday in November through the third Sunday in + January, like Fiji. (Thanks to Pulu Ê»Anau.) Switch to numeric + time zone abbreviations for this zone. + + Changes to past and future time stamps + + Northern Cyprus is now +03 year round, causing a split in Cyprus + time zones starting 2016-10-30 at 04:00. This creates a zone + Asia/Famagusta. (Thanks to Even Scharning and Matt Johnson.) + + Antarctica/Casey switched from +08 to +11 on 2016-10-22. + (Thanks to Steffen Thorsen.) + + Changes to past time stamps + + Several corrections were made for pre-1975 time stamps in Italy. + These affect Europe/Malta, Europe/Rome, Europe/San_Marino, and + Europe/Vatican. + + First, the 1893-11-01 00:00 transition in Italy used the new UT + offset (+01), not the old (+00:49:56). (Thanks to Michael + Deckers.) + + Second, rules for daylight saving in Italy were changed to agree + with Italy's National Institute of Metrological Research (INRiM) + except for 1944, as follows (thanks to Pierpaolo Bernardi, Brian + Inglis, and Michael Deckers): + + The 1916-06-03 transition was at 24:00, not 00:00. + + The 1916-10-01, 1919-10-05, and 1920-09-19 transitions were at + 00:00, not 01:00. + + The 1917-09-30 and 1918-10-06 transitions were at 24:00, not + 01:00. + + The 1944-09-17 transition was at 03:00, not 01:00. This + particular change is taken from Italian law as INRiM's table, + (which says 02:00) appears to have a typo here. Also, keep the + 1944-04-03 transition for Europe/Rome, as Rome was controlled by + Germany then. + + The 1967-1970 and 1972-1974 fallback transitions were at 01:00, + not 00:00. + + Changes to code + + The code should now be buildable on AmigaOS merely by setting the + appropriate Makefile variables. (From a patch by Carsten Larsen.) + + +Release 2016h - 2016-10-19 23:17:57 -0700 + + Changes to future time stamps + + Asia/Gaza and Asia/Hebron end DST on 2016-10-29 at 01:00, not + 2016-10-21 at 00:00. (Thanks to Sharef Mustafa.) Predict that + future fall transitions will be on the last Saturday of October + at 01:00, which is consistent with predicted spring transitions + on the last Saturday of March. (Thanks to Tim Parenti.) + + Changes to past time stamps + + In Turkey, transitions in 1986-1990 were at 01:00 standard time + not at 02:00, and the spring 1994 transition was on March 20, not + March 27. (Thanks to Kıvanç Yazan.) + + Changes to past and future time zone abbreviations + + Asia/Colombo now uses numeric time zone abbreviations like "+0530" + instead of alphabetic ones like "IST" and "LKT". Various + English-language sources use "IST", "LKT" and "SLST", with no + working consensus. (Usage of "SLST" mentioned by Sadika + Sumanapala.) + + Changes to code + + zic no longer mishandles relativizing file names when creating + symbolic links like /etc/localtime, when these symbolic links + are outside the usual directory hierarchy. This fixes a bug + introduced in 2016g. (Problem reported by Andreas Stieger.) + + Changes to build procedure + + New rules 'traditional_tarballs' and 'traditional_signatures' for + building just the traditional-format distribution. (Requested by + Deborah Goldsmith.) + + The file 'version' is now put into the tzdata tarball too. + (Requested by Howard Hinnant.) + + Changes to documentation and commentary + + The 'Theory' file now has a section on interface stability. + (Requested by Paul Koning.) It also mentions features like + tm_zone and localtime_rz that have long been supported by the + reference code. + + tz-link.htm has improved coverage of time zone boundaries suitable + for geolocation. (Thanks to heads-ups from Evan Siroky and Matt + Johnson.) + + The US commentary now mentions Allen and the "day of two noons". + + The Fiji commentary mentions the government's 2016-10-03 press + release. (Thanks to Raymond Kumar.) + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Fri Nov 4 18:16:01 2016 Return-Path: Delivered-To: svn-src-stable-10@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 436FCC2FCDD; Fri, 4 Nov 2016 18:16:01 +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 1EACB379; Fri, 4 Nov 2016 18:16:01 +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 uA4IG0i7059854; Fri, 4 Nov 2016 18:16:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4IG0Om059853; Fri, 4 Nov 2016 18:16:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611041816.uA4IG0Om059853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 18:16:00 +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: r308303 - stable/10/tools/tools/cxgbetool 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 18:16:01 -0000 Author: jhb Date: Fri Nov 4 18:16:00 2016 New Revision: 308303 URL: https://svnweb.freebsd.org/changeset/base/308303 Log: MFC 287297,296236: Cleanups to cxgbetool. 287297: - Replace N(a)/N(i)/N(T)/LEN(a)/ARRAY_SIZE(a) with nitems() - Add missing for err() and for sysctlbyname() - NULL -> 0 for 5th parameter of sysctlbyname() Note, the original commit touched several files under tools/tools, but this commit only includes changes to cxgbetool. 296236: Fix some whitespace nits in cxgbetool.c. No functional change. Sponsored by: Chelsio Communications Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/10/tools/tools/cxgbetool/cxgbetool.c Fri Nov 4 17:55:50 2016 (r308302) +++ stable/10/tools/tools/cxgbetool/cxgbetool.c Fri Nov 4 18:16:00 2016 (r308303) @@ -28,29 +28,30 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include #include -#include #include #include -#include -#include + #include +#include #include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "t4_ioctl.h" -#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo)) #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -345,7 +346,7 @@ dump_regs_t4(int argc, const char *argv[ T4_MODREGS(xgmac) }; - return dump_regs_table(argc, argv, regs, t4_mod, ARRAY_SIZE(t4_mod)); + return dump_regs_table(argc, argv, regs, t4_mod, nitems(t4_mod)); } #undef T4_MODREGS @@ -360,8 +361,7 @@ dump_regs_t4vf(int argc, const char *arg { "cim", t4vf_cim_regs }, }; - return dump_regs_table(argc, argv, regs, t4vf_mod, - ARRAY_SIZE(t4vf_mod)); + return dump_regs_table(argc, argv, regs, t4vf_mod, nitems(t4vf_mod)); } #define T5_MODREGS(name) { #name, t5_##name##_regs } @@ -398,7 +398,7 @@ dump_regs_t5(int argc, const char *argv[ { "hma", t5_hma_t5_regs } }; - return dump_regs_table(argc, argv, regs, t5_mod, ARRAY_SIZE(t5_mod)); + return dump_regs_table(argc, argv, regs, t5_mod, nitems(t5_mod)); } #undef T5_MODREGS @@ -446,47 +446,47 @@ do_show_info_header(uint32_t mode) { uint32_t i; - printf ("%4s %8s", "Idx", "Hits"); + printf("%4s %8s", "Idx", "Hits"); for (i = T4_FILTER_FCoE; i <= T4_FILTER_IP_FRAGMENT; i <<= 1) { switch (mode & i) { case T4_FILTER_FCoE: - printf (" FCoE"); + printf(" FCoE"); break; case T4_FILTER_PORT: - printf (" Port"); + printf(" Port"); break; case T4_FILTER_VNIC: - printf (" vld:VNIC"); + printf(" vld:VNIC"); break; case T4_FILTER_VLAN: - printf (" vld:VLAN"); + printf(" vld:VLAN"); break; case T4_FILTER_IP_TOS: - printf (" TOS"); + printf(" TOS"); break; case T4_FILTER_IP_PROTO: - printf (" Prot"); + printf(" Prot"); break; case T4_FILTER_ETH_TYPE: - printf (" EthType"); + printf(" EthType"); break; case T4_FILTER_MAC_IDX: - printf (" MACIdx"); + printf(" MACIdx"); break; case T4_FILTER_MPS_HIT_TYPE: - printf (" MPS"); + printf(" MPS"); break; case T4_FILTER_IP_FRAGMENT: - printf (" Frag"); + printf(" Frag"); break; default: @@ -866,7 +866,7 @@ get_filter_mode(void) if (mode & T4_FILTER_IP_SADDR) printf("sip "); - + if (mode & T4_FILTER_IP_DADDR) printf("dip "); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 18:45:07 2016 Return-Path: Delivered-To: svn-src-stable-10@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 EC7C0C303AE; Fri, 4 Nov 2016 18:45:07 +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 996D3301; Fri, 4 Nov 2016 18:45:07 +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 uA4Ij6ne071098; Fri, 4 Nov 2016 18:45:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4Ij6sF071093; Fri, 4 Nov 2016 18:45:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611041845.uA4Ij6sF071093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 18:45:06 +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: r308304 - in stable/10: sys/conf sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/firmware sys/dev/cxgbe/iw_cxgbe sys/dev/cxgbe/tom sys/modules/cxgbe/t4_firmware sys/modules/cxgbe/t5_fi... 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 18:45:08 -0000 Author: jhb Date: Fri Nov 4 18:45:06 2016 New Revision: 308304 URL: https://svnweb.freebsd.org/changeset/base/308304 Log: MFC 295778,296249,296333,296383,296471,296478,296481,296485,296488-296491, 296493-296496,296544,296710-296711,297863,299685: Catch up to changes to the internal shared code. Note that this merge includes two different firmware updates, but the effective change is to update to the last version (1.15.37.0). As such, I've trimmed the log message of the first update (1.15.28.0). In addition, the M_WAIT macro added in t4_regs.h had to be renamed to CXGBE_M_WAIT to avoid a collision on 10.x that is not present on 11. 295778: cxgbe: catch up with the latest hardware-related definitions. 296249: cxgbe(4): Update T5 and T4 firmwares to 1.15.28.0. 296333: cxgbe(4): First of many changes to reduce diffs with internal shared code: - Rename some CamelCase variables. - s/t4_link_start/t4_link_l1cfg/g - Pull in t4_get_port_type_description. - Move t4_wait_op_done to t4_hw.c. - Flip the order of the RDMA stats. - Remove unsused function t4_iq_start_stop. - Move t4_wait_op_done and t4_wait_op_done_val to t4_hw.c 296383: cxgbe(4): Very basic T6 awareness. This is part of ongoing work to update to the latest internal shared code. - Add a chip_params structure to keep track of hardware constants for all generations of Terminators handled by cxgbe. - Update t4_hw_pci_read_cfg4 to work with T6. - Update the hardware debug sysctls (hidden within dev...misc.*) to work with T6. Most of the changes are in the decoders for the CIM logic analyzer and the MPS TCAM. - Acquire the regwin lock around indirect register accesses. 296471: cxgbe(4): Updated register dumps. - Get the list of registers to read during a regdump from the shared code instead of the OS specific code. This follows a similar move internally. The shared code includes the list for T6. - Update cxgbetool to be able to decode T5 VF, T6, and T6 VF register dumps (and catch up with some updates to T4 and T5 register decode). 296478: cxgbe(4): Add a struct sge_params to store per-adapter SGE parameters. Move the code that reads all the parameters to t4_init_sge_params in the shared code. Use these per-adapter values instead of globals. 296481: cxgbe(4): Overhaul the shared code that deals with the chip's TP block, which is responsible for filtering and RSS. Add the ability to use filters that match on PF/VF (aka "VNIC id") while here. This is mutually exclusive with filtering on outer VLAN tag with Q-in-Q. 296485: cxgbe(4): Update the interrupt handlers for hardware errors. 296488: cxgbe(4): Updates to mailbox routines in the shared code. 296489: cxgbe(4): Updates to the shared routines that deal with the serial EEPROM, flash, and VPD. 296490: cxgbe(4): Remove __devinit and SPEED_ as part of catch up with internal shared code. 296491: cxgbe(4): Updates to shared routines that get/set various parameters via the firmware. 296493: cxgbe(4): Use t4_link_down_rc_str in shared code to decode the reason the link is down, instead of doing it in OS specific code. 296494: cxgbe(4): Many new functions in the shared code, unused at this time. 296495: cxgbe(4): Fix t4_tp_get_rdma_stats. 296496: cxgbe(4): Minor updates to the shared routines that deal with firmware images. 296544: cxgbe(4): Reshuffle and rototill t4_hw.c, solely to reduce diffs with the internal shared code. 296710: cxgbe(4): Catch up with the latest list of card capabilities as reported by the firmware. 296711: cxgbe(4): Fix typo in previous commit. 297863: Rename the 'M_B' macro in t4_regs.h to 'CXGBE_M_B'. This fixes a conflict with the M_B macro in powerpc's exposed by the recent addition of DDB commands to the cxgbe driver. 299685: cxgbe(4): Update T5 and T4 firmwares to 1.15.37.0. These firmwares were obtained from the "Chelsio T5/T4 Unified Wire v2.12.0.3 for Linux" release. Changes since 1.14.4.0 (which is the firmware in -STABLE branches) are in the "Release Notes" accompanying the Unified Wire release and are copy-pasted here as well. 22.1. T5 Firmware +++++++++++++++++++++++++++++++++ Version : 1.15.37.0 Date : 04/27/2016 ================================================================================ FIXES ----- BASE: - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where the default ingress queue was ignored. - Fixed an issue where adapter failed to load fw by adjusting DRAM frequency. - Fixed an issue in watchdog which was causing VM bring-up failure after reboot. - Fixed 40G link failures with some switches when auto-negotiation enabled. - Fixed to improve on link bring-up time. - Per port buffer groups size doubled to improve performance. - Fixed an issue where bogus d3hot bits were set causing traffic stall. - Fixed an issue where sometimes adapter was not seen after reboot. - Fixed an issue where iWARP was crashing in conjunction with traffic management. - Fixed an issue where link failed to come up after removing twinax cable and inserting optical module. ETH - Fixed a link flap issue on T580-CR. OFLD - Fixed a potential iSCSI data corruption issue by disabling RxFragEn flag. FOiSCSI - Fixed an issue in recovery path where connection was getting closed before recovery processing was done. - Fixed an issue in TCP port reuse. - Fixed an issue in recovery path when large number (>64) of iSCSI connections were in use. - Returned ENETUNREACH if IP was not been provisioned yet and driver tried to use given inerface. - Fixed an issue where fw was sending ENETUNREACH event for normal tcp disconnection. DCBX - Fixed an issue where iscsi tlv is sent incorrectly to host. (DCBX CEE) - Fixed an issue where apply bit set for APP id was affecting the ETS and PFC settings.(DCBX IEEE) - Fixed an issue where app priority values are not handled correctly in fw. (DCBX IEEE) - Fixed an issue where enable/disable dcbx can cause crash. (DCBX CEE,DCBX IEEE) FOFCoE - Removed BB6 support. ENHANCEMENTS ------------ BASE: - Added new interface to program DCA settings in SGE contexts; allow 32-byte IQE size - Added PTP interface fw_ptp_ts to support PTP Frequeny and Offset adjustment. - Added MPS raw interface. ETH: - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx. OFLD: - WR opcode is returned to host in cqe error response. 22.2. T4 Firmware +++++++++++++++++ Version : 1.15.37.0 Date : 04/27/2016 ================================================================================ FIXES ----- BASE: - Fixed an issue in FW_RSS_VI_CONFIG_CMD handling where default ingress queue was ignored. - Fixed an issue in watchdog which was causing VM bring-up failure after reboot. - Per port buffer groups size doubled to improve performance. - Fixed an issue where iWARP was crashing in conjunction with traffic management. FOiSCSI: - Fixed an issue in recovery path where connection was getting closed before recovery processing was done. - Fixed an issue in TCP port reuse. - Fixed an issue in recovery path when large number (>64) of iSCSI connections were in use. - Returned ENETUNREACH if IP had not been provisioned yet and driver tried to use given inerface. DCBX - Fixed an issue where iscsi tlv is sent incorrectly to host.(DCBX CEE) - Fixed an issue where enable/disable dcbx can cause crash in firmware.(DCBX CEE) FOiSCSI - Fixes an issue where fw was sending ENETUNREACH event for normal tcp disconnection. FOFCoE - Removed BB6 support. ENHANCEMENTS ------------ BASE: - Added MPS raw interface. ETH: - New mailbox command FW_DCB_IEEE_CMD api added for IEEE dcbx. ================================================================================ Sponsored by: Chelsio Communications Added: stable/10/sys/dev/cxgbe/firmware/t4fw-1.15.37.0.bin.uu - copied unchanged from r299685, head/sys/dev/cxgbe/firmware/t4fw-1.15.37.0.bin.uu stable/10/sys/dev/cxgbe/firmware/t5fw-1.15.37.0.bin.uu - copied unchanged from r299685, head/sys/dev/cxgbe/firmware/t5fw-1.15.37.0.bin.uu stable/10/tools/tools/cxgbetool/reg_defs_t6.c - copied unchanged from r296471, head/tools/tools/cxgbetool/reg_defs_t6.c Deleted: stable/10/sys/dev/cxgbe/firmware/t4fw-1.14.4.0.bin.uu stable/10/sys/dev/cxgbe/firmware/t5fw-1.14.4.0.bin.uu Modified: stable/10/sys/conf/files stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/common/t4_hw.h stable/10/sys/dev/cxgbe/common/t4_msg.h stable/10/sys/dev/cxgbe/common/t4_regs.h stable/10/sys/dev/cxgbe/common/t4_regs_values.h stable/10/sys/dev/cxgbe/common/t4_tcb.h stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt stable/10/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt stable/10/sys/dev/cxgbe/firmware/t4fw_interface.h stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt stable/10/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt stable/10/sys/dev/cxgbe/iw_cxgbe/device.c stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h stable/10/sys/dev/cxgbe/iw_cxgbe/qp.c stable/10/sys/dev/cxgbe/osdep.h stable/10/sys/dev/cxgbe/t4_ioctl.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_netmap.c stable/10/sys/dev/cxgbe/t4_sge.c stable/10/sys/dev/cxgbe/tom/t4_connect.c stable/10/sys/modules/cxgbe/t4_firmware/Makefile stable/10/sys/modules/cxgbe/t5_firmware/Makefile stable/10/tools/tools/cxgbetool/cxgbetool.c stable/10/tools/tools/cxgbetool/reg_defs_t4.c stable/10/tools/tools/cxgbetool/reg_defs_t4vf.c stable/10/tools/tools/cxgbetool/reg_defs_t5.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Fri Nov 4 18:16:00 2016 (r308303) +++ stable/10/sys/conf/files Fri Nov 4 18:45:06 2016 (r308304) @@ -1188,7 +1188,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.14.4.0.bin.uu" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.15.37.0.bin.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1212,7 +1212,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.14.4.0.bin.uu" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.15.37.0.bin.uu" \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t5fw.fw" Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 18:16:00 2016 (r308303) +++ stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 18:45:06 2016 (r308304) @@ -664,13 +664,6 @@ struct sge_nm_txq { } __aligned(CACHE_LINE_SIZE); struct sge { - int timer_val[SGE_NTIMERS]; - int counter_val[SGE_NCOUNTERS]; - int fl_starve_threshold; - int fl_starve_threshold2; - int eq_s_qpp; - int iq_s_qpp; - int nrxq; /* total # of Ethernet rx queues */ int ntxq; /* total # of Ethernet tx tx queues */ int nofldrxq; /* total # of TOE rx queues */ @@ -695,8 +688,6 @@ struct sge { struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */ struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ - int pad_boundary; - int pack_boundary; int8_t safe_hwidx1; /* may not have room for metadata */ int8_t safe_hwidx2; /* with room for metadata and maybe more */ struct sw_zone_info sw_zone_info[SW_ZONE_SIZES]; @@ -728,6 +719,8 @@ struct adapter { unsigned int pf; unsigned int mbox; + unsigned int vpd_busy; + unsigned int vpd_flag; /* Interrupt information */ int intr_type; @@ -746,9 +739,9 @@ struct adapter { struct sge sge; int lro_timeout; - struct taskqueue *tq[NCHAN]; /* General purpose taskqueues */ + struct taskqueue *tq[MAX_NCHAN]; /* General purpose taskqueues */ struct port_info *port[MAX_NPORTS]; - uint8_t chan_map[NCHAN]; + uint8_t chan_map[MAX_NCHAN]; void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; @@ -775,12 +768,16 @@ struct adapter { char cfg_file[32]; u_int cfcsum; struct adapter_params params; + const struct chip_params *chip_params; struct t4_virt_res vres; + uint16_t nbmcaps; uint16_t linkcaps; + uint16_t switchcaps; uint16_t niccaps; uint16_t toecaps; uint16_t rdmacaps; + uint16_t tlscaps; uint16_t iscsicaps; uint16_t fcoecaps; @@ -797,7 +794,7 @@ struct adapter { struct mtx regwin_lock; /* for indirect reads and memory windows */ an_handler_t an_handler __aligned(CACHE_LINE_SIZE); - fw_msg_handler_t fw_msg_handler[5]; /* NUM_FW6_TYPES */ + fw_msg_handler_t fw_msg_handler[7]; /* NUM_FW6_TYPES */ cpl_handler_t cpl_handler[0xef]; /* NUM_CPL_CMDS */ const char *last_op; @@ -1000,6 +997,17 @@ tx_resume_threshold(struct sge_eq *eq) return (eq->sidx / 4); } +static inline int +t4_use_ldst(struct adapter *sc) +{ + +#ifdef notyet + return (sc->flags & FW_OK || !sc->use_bd); +#else + return (0); +#endif +} + /* t4_main.c */ int t4_os_find_pci_capability(struct adapter *, int); int t4_os_pci_save_state(struct adapter *); Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 18:16:00 2016 (r308303) +++ stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 18:45:06 2016 (r308304) @@ -32,6 +32,9 @@ #include "t4_hw.h" +#define GLBL_INTR_MASK (F_CIM | F_MPS | F_PL | F_PCIE | F_MC0 | F_EDC0 | \ + F_EDC1 | F_LE | F_TP | F_MA | F_PM_TX | F_PM_RX | F_ULP_RX | \ + F_CPL_SWITCH | F_SGE | F_ULP_TX) enum { MAX_NPORTS = 4, /* max # of ports */ @@ -42,11 +45,17 @@ enum { MACADDR_LEN = 12, /* MAC Address length */ }; +enum { + T4_REGMAP_SIZE = (160 * 1024), + T5_REGMAP_SIZE = (332 * 1024), +}; + enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 }; enum { MEMWIN0_APERTURE = 2048, MEMWIN0_BASE = 0x1b800, + MEMWIN1_APERTURE = 32768, MEMWIN1_BASE = 0x28000, @@ -168,10 +177,10 @@ struct lb_port_stats { }; struct tp_tcp_stats { - u32 tcpOutRsts; - u64 tcpInSegs; - u64 tcpOutSegs; - u64 tcpRetransSegs; + u32 tcp_out_rsts; + u64 tcp_in_segs; + u64 tcp_out_segs; + u64 tcp_retrans_segs; }; struct tp_usm_stats { @@ -181,50 +190,72 @@ struct tp_usm_stats { }; struct tp_fcoe_stats { - u32 framesDDP; - u32 framesDrop; - u64 octetsDDP; + u32 frames_ddp; + u32 frames_drop; + u64 octets_ddp; }; struct tp_err_stats { - u32 macInErrs[4]; - u32 hdrInErrs[4]; - u32 tcpInErrs[4]; - u32 tnlCongDrops[4]; - u32 ofldChanDrops[4]; - u32 tnlTxDrops[4]; - u32 ofldVlanDrops[4]; - u32 tcp6InErrs[4]; - u32 ofldNoNeigh; - u32 ofldCongDefer; + u32 mac_in_errs[MAX_NCHAN]; + u32 hdr_in_errs[MAX_NCHAN]; + u32 tcp_in_errs[MAX_NCHAN]; + u32 tnl_cong_drops[MAX_NCHAN]; + u32 ofld_chan_drops[MAX_NCHAN]; + u32 tnl_tx_drops[MAX_NCHAN]; + u32 ofld_vlan_drops[MAX_NCHAN]; + u32 tcp6_in_errs[MAX_NCHAN]; + u32 ofld_no_neigh; + u32 ofld_cong_defer; }; struct tp_proxy_stats { - u32 proxy[4]; + u32 proxy[MAX_NCHAN]; }; struct tp_cpl_stats { - u32 req[4]; - u32 rsp[4]; + u32 req[MAX_NCHAN]; + u32 rsp[MAX_NCHAN]; }; struct tp_rdma_stats { - u32 rqe_dfr_mod; u32 rqe_dfr_pkt; + u32 rqe_dfr_mod; +}; + +struct sge_params { + int timer_val[SGE_NTIMERS]; + int counter_val[SGE_NCOUNTERS]; + int fl_starve_threshold; + int fl_starve_threshold2; + int page_shift; + int eq_s_qpp; + int iq_s_qpp; + int spg_len; + int pad_boundary; + int pack_boundary; + int fl_pktshift; }; struct tp_params { - unsigned int ntxchan; /* # of Tx channels */ unsigned int tre; /* log2 of core clocks per TP tick */ unsigned int dack_re; /* DACK timer resolution */ unsigned int la_mask; /* what events are recorded by TP LA */ - unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */ + unsigned short tx_modq[MAX_NCHAN]; /* channel to modulation queue map */ + uint32_t vlan_pri_map; uint32_t ingress_config; - int8_t vlan_shift; - int8_t vnic_shift; + uint32_t rx_pkt_encap; + + int8_t fcoe_shift; int8_t port_shift; + int8_t vnic_shift; + int8_t vlan_shift; + int8_t tos_shift; int8_t protocol_shift; + int8_t ethertype_shift; + int8_t macmatch_shift; + int8_t matchtype_shift; + int8_t frag_shift; }; struct vpd_params { @@ -252,7 +283,21 @@ struct devlog_params { u32 size; /* size of log */ }; +/* Stores chip specific parameters */ +struct chip_params { + u8 nchan; + u8 pm_stats_cnt; + u8 cng_ch_bits_log; /* congestion channel map bits width */ + u8 nsched_cls; + u8 cim_num_obq; + u16 mps_rplc_size; + u16 vfcount; + u32 sge_fl_db; + u16 mps_tcam_size; +}; + struct adapter_params { + struct sge_params sge; struct tp_params tp; struct vpd_params vpd; struct pci_params pci; @@ -291,6 +336,19 @@ struct adapter_params { #define CHELSIO_T4 0x4 #define CHELSIO_T5 0x5 +#define CHELSIO_T6 0x6 + +/* + * State needed to monitor the forward progress of SGE Ingress DMA activities + * and possible hangs. + */ +struct sge_idma_monitor_state { + unsigned int idma_1s_thresh; /* 1s threshold in Core Clock ticks */ + unsigned int idma_stalled[2]; /* synthesized stalled timers in HZ */ + unsigned int idma_state[2]; /* IDMA Hang detect state */ + unsigned int idma_qid[2]; /* IDMA Hung Ingress Queue ID */ + unsigned int idma_warn[2]; /* time to warning in HZ */ +}; struct trace_params { u32 data[TRACE_LEN / 4]; @@ -365,6 +423,11 @@ static inline int is_t5(struct adapter * return adap->params.chipid == CHELSIO_T5; } +static inline int is_t6(struct adapter *adap) +{ + return adap->params.chipid == CHELSIO_T6; +} + static inline int is_fpga(struct adapter *adap) { return adap->params.fpga; @@ -381,6 +444,14 @@ static inline unsigned int us_to_core_ti return (us * adap->params.vpd.cclk) / 1000; } +static inline unsigned int core_ticks_to_us(const struct adapter *adapter, + unsigned int ticks) +{ + /* add Core Clock / 2 to round ticks to nearest uS */ + return ((ticks * 1000 + adapter->params.vpd.cclk/2) / + adapter->params.vpd.cclk); +} + static inline unsigned int dack_ticks_to_usec(const struct adapter *adap, unsigned int ticks) { @@ -388,19 +459,20 @@ static inline unsigned int dack_ticks_to } void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val); -int t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, int polarity, - int attempts, int delay, u32 *valp); - -static inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask, - int polarity, int attempts, int delay) -{ - return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts, - delay, NULL); -} +int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd, + int size, void *rpl, bool sleep_ok, int timeout); int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, void *rpl, bool sleep_ok); +static inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox, + const void *cmd, int size, void *rpl, + int timeout) +{ + return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, true, + timeout); +} + static inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd, int size, void *rpl) { @@ -430,7 +502,7 @@ void t4_intr_clear(struct adapter *adapt int t4_slow_intr_handler(struct adapter *adapter); int t4_hash_mac_addr(const u8 *addr); -int t4_link_start(struct adapter *adap, unsigned int mbox, unsigned int port, +int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, struct link_config *lc); int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port); int t4_seeprom_read(struct adapter *adapter, u32 addr, u32 *data); @@ -439,21 +511,31 @@ int t4_eeprom_ptov(unsigned int phys_add int t4_seeprom_wp(struct adapter *adapter, int enable); int t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); +int t4_write_flash(struct adapter *adapter, unsigned int addr, + unsigned int n, const u8 *data, int byte_oriented); int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); +int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op); +int t5_fw_init_extern_mem(struct adapter *adap); +int t4_load_bootcfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_load_boot(struct adapter *adap, u8 *boot_data, unsigned int boot_addr, unsigned int size); +int t4_flash_erase_sectors(struct adapter *adapter, int start, int end); int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_get_fw_version(struct adapter *adapter, u32 *vers); int t4_get_tp_version(struct adapter *adapter, u32 *vers); -int t4_check_fw_version(struct adapter *adapter); +int t4_get_exprom_version(struct adapter *adapter, u32 *vers); int t4_init_hw(struct adapter *adapter, u32 fw_params); -int t4_prep_adapter(struct adapter *adapter); +int t4_prep_adapter(struct adapter *adapter, u8 *buf); +int t4_shutdown_adapter(struct adapter *adapter); +int t4_init_devlog_params(struct adapter *adapter, int fw_attach); +int t4_init_sge_params(struct adapter *adapter); int t4_init_tp_params(struct adapter *adap); int t4_filter_field_shift(const struct adapter *adap, int filter_sel); -int t4_port_init(struct port_info *p, int mbox, int pf, int vf); -int t4_reinit_adapter(struct adapter *adap); +int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id); void t4_fatal_err(struct adapter *adapter); +void t4_db_full(struct adapter *adapter); +void t4_db_dropped(struct adapter *adapter); int t4_set_trace_filter(struct adapter *adapter, const struct trace_params *tp, int filter_index, int enable); void t4_get_trace_filter(struct adapter *adapter, struct trace_params *tp, @@ -465,8 +547,10 @@ int t4_config_glbl_rss(struct adapter *a int t4_config_vi_rss(struct adapter *adapter, int mbox, unsigned int viid, unsigned int flags, unsigned int defq); int t4_read_rss(struct adapter *adapter, u16 *entries); +void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, + unsigned int start_index, unsigned int rw); void t4_read_rss_key(struct adapter *adapter, u32 *key); -void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx); +void t4_write_rss_key(struct adapter *adap, u32 *key, int idx); void t4_read_rss_pf_config(struct adapter *adapter, unsigned int index, u32 *valp); void t4_write_rss_pf_config(struct adapter *adapter, unsigned int index, u32 val); void t4_read_rss_vf_config(struct adapter *adapter, unsigned int index, @@ -493,12 +577,24 @@ int t4_cim_read_la(struct adapter *adap, void t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp, unsigned int *pif_req_wrptr, unsigned int *pif_rsp_wrptr); void t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp); +int t4_get_flash_params(struct adapter *adapter); + +u32 t4_read_pcie_cfg4(struct adapter *adap, int reg, int drv_fw_attach); int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, u64 *parity); int t4_mem_read(struct adapter *adap, int mtype, u32 addr, u32 size, __be32 *data); +void t4_idma_monitor_init(struct adapter *adapter, + struct sge_idma_monitor_state *idma); +void t4_idma_monitor(struct adapter *adapter, + struct sge_idma_monitor_state *idma, + int hz, int ticks); + +unsigned int t4_get_regs_len(struct adapter *adapter); +void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size); +const char *t4_get_port_type_description(enum fw_port_type port_type); void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p); void t4_get_port_stats_offset(struct adapter *adap, int idx, struct port_stats *stats, @@ -552,6 +648,13 @@ int t4_fw_initialize(struct adapter *ada int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, u32 *val); +int t4_query_params_rw(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int nparams, const u32 *params, + u32 *val, int rw); +int t4_set_params_timeout(struct adapter *adap, unsigned int mbox, + unsigned int pf, unsigned int vf, + unsigned int nparams, const u32 *params, + const u32 *val, int timeout); int t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, const u32 *val); @@ -580,6 +683,8 @@ int t4_change_mac(struct adapter *adap, int idx, const u8 *addr, bool persist, bool add_smt); int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok); +int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, + unsigned int viid, bool rx_en, bool tx_en, bool dcb_en); int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, bool rx_en, bool tx_en); int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, @@ -596,9 +701,9 @@ int t4_i2c_wr(struct adapter *adap, unsi int port, unsigned int devid, unsigned int offset, unsigned int len, u8 *buf); -int t4_iq_start_stop(struct adapter *adap, unsigned int mbox, bool start, - unsigned int pf, unsigned int vf, unsigned int iqid, - unsigned int fl0id, unsigned int fl1id); +int t4_iq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int iqtype, unsigned int iqid, + unsigned int fl0id, unsigned int fl1id); int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); @@ -613,6 +718,7 @@ int t4_sge_ctxt_rd(struct adapter *adap, int t4_sge_ctxt_rd_bd(struct adapter *adap, unsigned int cid, enum ctxt_type ctype, u32 *data); int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox); +const char *t4_link_down_rc_str(unsigned char link_down_rc); int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl); int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, u32 addr, u32 val); int t4_sched_config(struct adapter *adapter, int type, int minmaxen, @@ -621,4 +727,10 @@ int t4_sched_params(struct adapter *adap int rateunit, int ratemode, int channel, int cl, int minrate, int maxrate, int weight, int pktsize, int sleep_ok); +int t4_config_watchdog(struct adapter *adapter, unsigned int mbox, + unsigned int pf, unsigned int vf, + unsigned int timeout, unsigned int action); +int t4_get_devlog_level(struct adapter *adapter, unsigned int *level); +int t4_set_devlog_level(struct adapter *adapter, unsigned int level); +void t4_sge_decode_idma_state(struct adapter *adapter, int state); #endif /* __CHELSIO_COMMON_H */ Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 18:16:00 2016 (r308303) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 18:45:06 2016 (r308304) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Chelsio Communications, Inc. + * Copyright (c) 2012, 2016 Chelsio Communications, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$"); * at the time it indicated completion is stored there. Returns 0 if the * operation completes and -EAGAIN otherwise. */ -int t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, - int polarity, int attempts, int delay, u32 *valp) +static int t4_wait_op_done_val(struct adapter *adapter, int reg, u32 mask, + int polarity, int attempts, int delay, u32 *valp) { while (1) { u32 val = t4_read_reg(adapter, reg); @@ -75,6 +75,13 @@ int t4_wait_op_done_val(struct adapter * } } +static inline int t4_wait_op_done(struct adapter *adapter, int reg, u32 mask, + int polarity, int attempts, int delay) +{ + return t4_wait_op_done_val(adapter, reg, mask, polarity, attempts, + delay, NULL); +} + /** * t4_set_reg_field - set a register field to a value * @adapter: the adapter to program @@ -107,8 +114,8 @@ void t4_set_reg_field(struct adapter *ad * register pair. */ void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, - unsigned int data_reg, u32 *vals, unsigned int nregs, - unsigned int start_idx) + unsigned int data_reg, u32 *vals, + unsigned int nregs, unsigned int start_idx) { while (nregs--) { t4_write_reg(adap, addr_reg, start_idx); @@ -144,26 +151,49 @@ void t4_write_indirect(struct adapter *a * mechanism. This guarantees that we get the real value even if we're * operating within a Virtual Machine and the Hypervisor is trapping our * Configuration Space accesses. + * + * N.B. This routine should only be used as a last resort: the firmware uses + * the backdoor registers on a regular basis and we can end up + * conflicting with it's uses! */ u32 t4_hw_pci_read_cfg4(adapter_t *adap, int reg) { - t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, - F_ENABLE | F_LOCALCFG | V_FUNCTION(adap->pf) | - V_REGISTER(reg)); - return t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); + u32 req = V_FUNCTION(adap->pf) | V_REGISTER(reg); + u32 val; + + if (chip_id(adap) <= CHELSIO_T5) + req |= F_ENABLE; + else + req |= F_T6_ENABLE; + + if (is_t4(adap)) + req |= F_LOCALCFG; + + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, req); + val = t4_read_reg(adap, A_PCIE_CFG_SPACE_DATA); + + /* + * Reset F_ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a + * Configuration Space read. (None of the other fields matter when + * F_ENABLE is 0 so a simple register write is easier than a + * read-modify-write via t4_set_reg_field().) + */ + t4_write_reg(adap, A_PCIE_CFG_SPACE_REQ, 0); + + return val; } /* - * t4_report_fw_error - report firmware error - * @adap: the adapter + * t4_report_fw_error - report firmware error + * @adap: the adapter * - * The adapter firmware can indicate error conditions to the host. - * This routine prints out the reason for the firmware error (as - * reported by the firmware). + * The adapter firmware can indicate error conditions to the host. + * If the firmware has indicated an error, print out the reason for + * the firmware error. */ static void t4_report_fw_error(struct adapter *adap) { - static const char *reason[] = { + static const char *const reason[] = { "Crash", /* PCIE_FW_EVAL_CRASH */ "During Device Preparation", /* PCIE_FW_EVAL_PREP */ "During Device Configuration", /* PCIE_FW_EVAL_CONF */ @@ -178,7 +208,7 @@ static void t4_report_fw_error(struct ad pcie_fw = t4_read_reg(adap, A_PCIE_FW); if (pcie_fw & F_PCIE_FW_ERR) CH_ERR(adap, "Firmware reports adapter error: %s\n", - reason[G_PCIE_FW_EVAL(pcie_fw)]); + reason[G_PCIE_FW_EVAL(pcie_fw)]); } /* @@ -194,25 +224,27 @@ static void get_mbox_rpl(struct adapter /* * Handle a FW assertion reported in a mailbox. */ -static void fw_asrt(struct adapter *adap, u32 mbox_addr) +static void fw_asrt(struct adapter *adap, struct fw_debug_cmd *asrt) { - struct fw_debug_cmd asrt; - - get_mbox_rpl(adap, (__be64 *)&asrt, sizeof(asrt) / 8, mbox_addr); - CH_ALERT(adap, "FW assertion at %.16s:%u, val0 %#x, val1 %#x\n", - asrt.u.assert.filename_0_7, ntohl(asrt.u.assert.line), - ntohl(asrt.u.assert.x), ntohl(asrt.u.assert.y)); + CH_ALERT(adap, + "FW assertion at %.16s:%u, val0 %#x, val1 %#x\n", + asrt->u.assert.filename_0_7, + be32_to_cpu(asrt->u.assert.line), + be32_to_cpu(asrt->u.assert.x), + be32_to_cpu(asrt->u.assert.y)); } #define X_CIM_PF_NOACCESS 0xeeeeeeee /** - * t4_wr_mbox_meat - send a command to FW through the given mailbox + * t4_wr_mbox_meat_timeout - send a command to FW through the given mailbox * @adap: the adapter * @mbox: index of the mailbox to use * @cmd: the command to write * @size: command length in bytes * @rpl: where to optionally store the reply * @sleep_ok: if true we may sleep while awaiting command completion + * @timeout: time to wait for command to finish before timing out + * (negative implies @sleep_ok=false) * * Sends the given command to FW through the selected mailbox and waits * for the FW to execute the command. If @rpl is not %NULL it is used to @@ -221,14 +253,17 @@ static void fw_asrt(struct adapter *adap * INITIALIZE can take a considerable amount of time to execute. * @sleep_ok determines whether we may sleep while awaiting the response. * If sleeping is allowed we use progressive backoff otherwise we spin. + * Note that passing in a negative @timeout is an alternate mechanism + * for specifying @sleep_ok=false. This is useful when a higher level + * interface allows for specification of @timeout but not @sleep_ok ... * * The return value is 0 on success or a negative errno on failure. A * failure can happen either because we are not able to execute the * command or FW executes it but signals an error. In the latter case * the return value is the error code indicated by FW (negated). */ -int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, - void *rpl, bool sleep_ok) +int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd, + int size, void *rpl, bool sleep_ok, int timeout) { /* * We delay in small increments at first in an effort to maintain @@ -238,43 +273,97 @@ int t4_wr_mbox_meat(struct adapter *adap static const int delay[] = { 1, 1, 3, 5, 10, 10, 20, 50, 100 }; - u32 v; u64 res; - int i, ms, delay_idx; + int i, ms, delay_idx, ret; const __be64 *p = cmd; u32 data_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_DATA); u32 ctl_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_CTRL); + u32 ctl; + __be64 cmd_rpl[MBOX_LEN/8]; + u32 pcie_fw; if ((size & 15) || size > MBOX_LEN) return -EINVAL; - v = G_MBOWNER(t4_read_reg(adap, ctl_reg)); - for (i = 0; v == X_MBOWNER_NONE && i < 3; i++) - v = G_MBOWNER(t4_read_reg(adap, ctl_reg)); + /* + * If we have a negative timeout, that implies that we can't sleep. + */ + if (timeout < 0) { + sleep_ok = false; + timeout = -timeout; + } + + /* + * Attempt to gain access to the mailbox. + */ + for (i = 0; i < 4; i++) { + ctl = t4_read_reg(adap, ctl_reg); + v = G_MBOWNER(ctl); + if (v != X_MBOWNER_NONE) + break; + } + + /* + * If we were unable to gain access, dequeue ourselves from the + * mailbox atomic access list and report the error to our caller. + */ + if (v != X_MBOWNER_PL) { + t4_report_fw_error(adap); + ret = (v == X_MBOWNER_FW) ? -EBUSY : -ETIMEDOUT; + return ret; + } - if (v != X_MBOWNER_PL) - return v ? -EBUSY : -ETIMEDOUT; + /* + * If we gain ownership of the mailbox and there's a "valid" message + * in it, this is likely an asynchronous error message from the + * firmware. So we'll report that and then proceed on with attempting + * to issue our own command ... which may well fail if the error + * presaged the firmware crashing ... + */ + if (ctl & F_MBMSGVALID) { + CH_ERR(adap, "found VALID command in mbox %u: " + "%llx %llx %llx %llx %llx %llx %llx %llx\n", mbox, + (unsigned long long)t4_read_reg64(adap, data_reg), + (unsigned long long)t4_read_reg64(adap, data_reg + 8), + (unsigned long long)t4_read_reg64(adap, data_reg + 16), + (unsigned long long)t4_read_reg64(adap, data_reg + 24), + (unsigned long long)t4_read_reg64(adap, data_reg + 32), + (unsigned long long)t4_read_reg64(adap, data_reg + 40), + (unsigned long long)t4_read_reg64(adap, data_reg + 48), + (unsigned long long)t4_read_reg64(adap, data_reg + 56)); + } + /* + * Copy in the new mailbox command and send it on its way ... + */ for (i = 0; i < size; i += 8, p++) t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p)); CH_DUMP_MBOX(adap, mbox, data_reg); t4_write_reg(adap, ctl_reg, F_MBMSGVALID | V_MBOWNER(X_MBOWNER_FW)); - t4_read_reg(adap, ctl_reg); /* flush write */ + t4_read_reg(adap, ctl_reg); /* flush write */ delay_idx = 0; ms = delay[0]; - for (i = 0; i < FW_CMD_MAX_TIMEOUT; i += ms) { + /* + * Loop waiting for the reply; bail out if we time out or the firmware + * reports an error. + */ + for (i = 0; + !((pcie_fw = t4_read_reg(adap, A_PCIE_FW)) & F_PCIE_FW_ERR) && + i < timeout; + i += ms) { if (sleep_ok) { ms = delay[delay_idx]; /* last element may repeat */ if (delay_idx < ARRAY_SIZE(delay) - 1) delay_idx++; msleep(ms); - } else + } else { mdelay(ms); + } v = t4_read_reg(adap, ctl_reg); if (v == X_CIM_PF_NOACCESS) @@ -286,15 +375,20 @@ int t4_wr_mbox_meat(struct adapter *adap continue; } + /* + * Retrieve the command reply and release the mailbox. + */ + get_mbox_rpl(adap, cmd_rpl, size/8, data_reg); + t4_write_reg(adap, ctl_reg, V_MBOWNER(X_MBOWNER_NONE)); + CH_DUMP_MBOX(adap, mbox, data_reg); - res = t4_read_reg64(adap, data_reg); + res = be64_to_cpu(cmd_rpl[0]); if (G_FW_CMD_OP(res >> 32) == FW_DEBUG_CMD) { - fw_asrt(adap, data_reg); + fw_asrt(adap, (struct fw_debug_cmd *)cmd_rpl); res = V_FW_CMD_RETVAL(EIO); } else if (rpl) - get_mbox_rpl(adap, rpl, size / 8, data_reg); - t4_write_reg(adap, ctl_reg, V_MBOWNER(X_MBOWNER_NONE)); + memcpy(rpl, cmd_rpl, size); return -G_FW_CMD_RETVAL((int)res); } } @@ -304,11 +398,58 @@ int t4_wr_mbox_meat(struct adapter *adap * the error and also check to see if the firmware reported any * errors ... */ + ret = (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -ETIMEDOUT; CH_ERR(adap, "command %#x in mailbox %d timed out\n", *(const u8 *)cmd, mbox); - if (t4_read_reg(adap, A_PCIE_FW) & F_PCIE_FW_ERR) - t4_report_fw_error(adap); - return -ETIMEDOUT; + + t4_report_fw_error(adap); + t4_fatal_err(adap); + return ret; +} + +int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, + void *rpl, bool sleep_ok) +{ + return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, + sleep_ok, FW_CMD_MAX_TIMEOUT); + +} + +static int t4_edc_err_read(struct adapter *adap, int idx) +{ + u32 edc_ecc_err_addr_reg; + u32 edc_bist_status_rdata_reg; + + if (is_t4(adap)) { + CH_WARN(adap, "%s: T4 NOT supported.\n", __func__); + return 0; + } + if (idx != 0 && idx != 1) { + CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx); + return 0; + } + + edc_ecc_err_addr_reg = EDC_T5_REG(A_EDC_H_ECC_ERR_ADDR, idx); + edc_bist_status_rdata_reg = EDC_T5_REG(A_EDC_H_BIST_STATUS_RDATA, idx); + + CH_WARN(adap, + "edc%d err addr 0x%x: 0x%x.\n", + idx, edc_ecc_err_addr_reg, + t4_read_reg(adap, edc_ecc_err_addr_reg)); + CH_WARN(adap, + "bist: 0x%x, status %llx %llx %llx %llx %llx %llx %llx %llx %llx.\n", + edc_bist_status_rdata_reg, + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 8), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 16), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 24), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 32), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 40), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 48), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 56), + (unsigned long long)t4_read_reg64(adap, edc_bist_status_rdata_reg + 64)); + + return 0; } /** @@ -493,8 +634,1956 @@ int t4_mem_read(struct adapter *adap, in } /* + * Return the specified PCI-E Configuration Space register from our Physical + * Function. We try first via a Firmware LDST Command (if fw_attach != 0) + * since we prefer to let the firmware own all of these registers, but if that + * fails we go for it directly ourselves. + */ +u32 t4_read_pcie_cfg4(struct adapter *adap, int reg, int drv_fw_attach) +{ + + /* + * If fw_attach != 0, construct and send the Firmware LDST Command to + * retrieve the specified PCI-E Configuration Space register. + */ + if (drv_fw_attach != 0) { + struct fw_ldst_cmd ldst_cmd; + int ret; + + memset(&ldst_cmd, 0, sizeof(ldst_cmd)); + ldst_cmd.op_to_addrspace = + cpu_to_be32(V_FW_CMD_OP(FW_LDST_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_READ | + V_FW_LDST_CMD_ADDRSPACE(FW_LDST_ADDRSPC_FUNC_PCIE)); + ldst_cmd.cycles_to_len16 = cpu_to_be32(FW_LEN16(ldst_cmd)); + ldst_cmd.u.pcie.select_naccess = V_FW_LDST_CMD_NACCESS(1); + ldst_cmd.u.pcie.ctrl_to_fn = + (F_FW_LDST_CMD_LC | V_FW_LDST_CMD_FN(adap->pf)); + ldst_cmd.u.pcie.r = reg; + + /* + * If the LDST Command succeeds, return the result, otherwise + * fall through to reading it directly ourselves ... + */ + ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, sizeof(ldst_cmd), + &ldst_cmd); + if (ret == 0) + return be32_to_cpu(ldst_cmd.u.pcie.data[0]); + + CH_WARN(adap, "Firmware failed to return " + "Configuration Space register %d, err = %d\n", + reg, -ret); + } + + /* + * Read the desired Configuration Space register via the PCI-E + * Backdoor mechanism. + */ + return t4_hw_pci_read_cfg4(adap, reg); +} + +/** + * t4_get_regs_len - return the size of the chips register set + * @adapter: the adapter + * + * Returns the size of the chip's BAR0 register space. + */ +unsigned int t4_get_regs_len(struct adapter *adapter) +{ + unsigned int chip_version = chip_id(adapter); + + switch (chip_version) { + case CHELSIO_T4: + return T4_REGMAP_SIZE; + + case CHELSIO_T5: + case CHELSIO_T6: + return T5_REGMAP_SIZE; + } + + CH_ERR(adapter, + "Unsupported chip version %d\n", chip_version); + return 0; +} + +/** + * t4_get_regs - read chip registers into provided buffer + * @adap: the adapter + * @buf: register buffer + * @buf_size: size (in bytes) of register buffer + * + * If the provided register buffer isn't large enough for the chip's + * full register range, the register dump will be truncated to the + * register buffer's size. + */ +void t4_get_regs(struct adapter *adap, u8 *buf, size_t buf_size) +{ + static const unsigned int t4_reg_ranges[] = { + 0x1008, 0x1108, + 0x1180, 0x1184, + 0x1190, 0x1194, + 0x11a0, 0x11a4, + 0x11b0, 0x11b4, + 0x11fc, 0x123c, + 0x1300, 0x173c, + 0x1800, 0x18fc, + 0x3000, 0x30d8, + 0x30e0, 0x30e4, + 0x30ec, 0x5910, + 0x5920, 0x5924, + 0x5960, 0x5960, + 0x5968, 0x5968, + 0x5970, 0x5970, + 0x5978, 0x5978, + 0x5980, 0x5980, + 0x5988, 0x5988, + 0x5990, 0x5990, + 0x5998, 0x5998, + 0x59a0, 0x59d4, + 0x5a00, 0x5ae0, + 0x5ae8, 0x5ae8, + 0x5af0, 0x5af0, + 0x5af8, 0x5af8, + 0x6000, 0x6098, + 0x6100, 0x6150, + 0x6200, 0x6208, + 0x6240, 0x6248, + 0x6280, 0x62b0, + 0x62c0, 0x6338, + 0x6370, 0x638c, + 0x6400, 0x643c, + 0x6500, 0x6524, + 0x6a00, 0x6a04, + 0x6a14, 0x6a38, + 0x6a60, 0x6a70, + 0x6a78, 0x6a78, + 0x6b00, 0x6b0c, + 0x6b1c, 0x6b84, + 0x6bf0, 0x6bf8, + 0x6c00, 0x6c0c, + 0x6c1c, 0x6c84, + 0x6cf0, 0x6cf8, + 0x6d00, 0x6d0c, + 0x6d1c, 0x6d84, + 0x6df0, 0x6df8, + 0x6e00, 0x6e0c, + 0x6e1c, 0x6e84, + 0x6ef0, 0x6ef8, + 0x6f00, 0x6f0c, + 0x6f1c, 0x6f84, + 0x6ff0, 0x6ff8, + 0x7000, 0x700c, + 0x701c, 0x7084, + 0x70f0, 0x70f8, + 0x7100, 0x710c, + 0x711c, 0x7184, + 0x71f0, 0x71f8, + 0x7200, 0x720c, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Fri Nov 4 19:07:13 2016 Return-Path: Delivered-To: svn-src-stable-10@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 A6106C308C6; Fri, 4 Nov 2016 19:07:13 +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 746951BA; Fri, 4 Nov 2016 19:07:13 +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 uA4J7CCh079427; Fri, 4 Nov 2016 19:07:12 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4J7CEi079424; Fri, 4 Nov 2016 19:07:12 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611041907.uA4J7CEi079424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 19:07: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: r308305 - in stable/10/sys/dev/cxgbe: . 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 19:07:13 -0000 Author: jhb Date: Fri Nov 4 19:07:12 2016 New Revision: 308305 URL: https://svnweb.freebsd.org/changeset/base/308305 Log: MFC 296552,296596,296603,296624,296627: Fixes related to memory windows. 296552: cxgbe(4): Rename regwin_lock to reg_lock. It is used to protect access to indirect registers only. 296596: cxgbe(4): Allow the addr/len pair that is being validated in validate_mem_range to span multiple memory types. Update validate_mt_off_len to use validate_mem_range. 296603: cxgbe(4): Add general purpose routines that offer safe access to the chip's memory windows. Convert existing users of these windows to the new routines. 296624: cxgbe(4): Fix bug in r296603. The memory window needs to be repositioned if the start address isn't in the window already. One of the bounds check used the end address instead. 296627: cxgbe(4): Improvements to the code that deals with the firmware's log. - Query the location of the log very early during attach. Refresh the location later after establishing contact with the firmware. - Save the log's location as a flat address in devlog_params. - Use a memory window instead of backdoor access to the EDC/MC to read the log. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 18:45:06 2016 (r308304) +++ stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 19:07:12 2016 (r308305) @@ -435,6 +435,29 @@ struct hw_buf_info { }; enum { + NUM_MEMWIN = 3, + + MEMWIN0_APERTURE = 2048, + MEMWIN0_BASE = 0x1b800, + + MEMWIN1_APERTURE = 32768, + MEMWIN1_BASE = 0x28000, + + MEMWIN2_APERTURE_T4 = 65536, + MEMWIN2_BASE_T4 = 0x30000, + + MEMWIN2_APERTURE_T5 = 128 * 1024, + MEMWIN2_BASE_T5 = 0x60000, +}; + +struct memwin { + struct rwlock mw_lock __aligned(CACHE_LINE_SIZE); + uint32_t mw_base; /* constant after setup_memwin */ + uint32_t mw_aperture; /* ditto */ + uint32_t mw_curpos; /* protected by mw_lock */ +}; + +enum { FL_STARVING = (1 << 0), /* on the adapter's list of starving fl's */ FL_DOOMED = (1 << 1), /* about to be destroyed */ FL_BUF_PACKING = (1 << 2), /* buffer packing enabled */ @@ -791,7 +814,9 @@ struct adapter { TAILQ_HEAD(, sge_fl) sfl; struct callout sfl_callout; - struct mtx regwin_lock; /* for indirect reads and memory windows */ + struct mtx reg_lock; /* for indirect register access */ + + struct memwin memwin[NUM_MEMWIN]; /* memory windows */ an_handler_t an_handler __aligned(CACHE_LINE_SIZE); fw_msg_handler_t fw_msg_handler[7]; /* NUM_FW6_TYPES */ Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 18:45:06 2016 (r308304) +++ stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 19:07:12 2016 (r308305) @@ -52,20 +52,6 @@ enum { enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 }; -enum { - MEMWIN0_APERTURE = 2048, - MEMWIN0_BASE = 0x1b800, - - MEMWIN1_APERTURE = 32768, - MEMWIN1_BASE = 0x28000, - - MEMWIN2_APERTURE_T4 = 65536, - MEMWIN2_BASE_T4 = 0x30000, - - MEMWIN2_APERTURE_T5 = 128 * 1024, - MEMWIN2_BASE_T5 = 0x60000, -}; - enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; enum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR }; @@ -76,11 +62,6 @@ enum { PAUSE_AUTONEG = 1 << 2 }; -struct memwin { - uint32_t base; - uint32_t aperture; -}; - struct port_stats { u64 tx_octets; /* total # of octets in good frames */ u64 tx_frames; /* all good frames */ @@ -281,6 +262,7 @@ struct devlog_params { u32 memtype; /* which memory (FW_MEMTYPE_* ) */ u32 start; /* start of log in firmware memory */ u32 size; /* size of log */ + u32 addr; /* start address in flat addr space */ }; /* Stores chip specific parameters */ Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 18:45:06 2016 (r308304) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 19:07:12 2016 (r308305) @@ -417,12 +417,17 @@ struct filter_entry { static int map_bars_0_and_4(struct adapter *); static int map_bar_2(struct adapter *); static void setup_memwin(struct adapter *); +static void position_memwin(struct adapter *, int, uint32_t); +static int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); +static inline int read_via_memwin(struct adapter *, int, uint32_t, uint32_t *, + int); +static inline int write_via_memwin(struct adapter *, int, uint32_t, + const uint32_t *, int); static int validate_mem_range(struct adapter *, uint32_t, int); static int fwmtype_to_hwmtype(int); static int validate_mt_off_len(struct adapter *, int, uint32_t, int, uint32_t *); -static void memwin_info(struct adapter *, int, uint32_t *, uint32_t *); -static uint32_t position_memwin(struct adapter *, int, uint32_t); +static int fixup_devlog_params(struct adapter *); static int cfg_itype_and_nqueues(struct adapter *, int, int, int, struct intrs_and_queues *); static int prep_firmware(struct adapter *); @@ -706,7 +711,7 @@ t4_attach(device_t dev) TAILQ_INIT(&sc->sfl); callout_init_mtx(&sc->sfl_callout, &sc->sfl_lock, 0); - mtx_init(&sc->regwin_lock, "register and memory window", 0, MTX_DEF); + mtx_init(&sc->reg_lock, "indirect register access", 0, MTX_DEF); rc = map_bars_0_and_4(sc); if (rc != 0) @@ -747,6 +752,8 @@ t4_attach(device_t dev) * will work even in "recovery mode". */ setup_memwin(sc); + if (t4_init_devlog_params(sc, 0) == 0) + fixup_devlog_params(sc); sc->cdev = make_dev(is_t4(sc) ? &t4_cdevsw : &t5_cdevsw, device_get_unit(dev), UID_ROOT, GID_WHEEL, 0600, "%s", device_get_nameunit(dev)); @@ -1169,8 +1176,15 @@ t4_detach(device_t dev) mtx_destroy(&sc->sfl_lock); if (mtx_initialized(&sc->ifp_lock)) mtx_destroy(&sc->ifp_lock); - if (mtx_initialized(&sc->regwin_lock)) - mtx_destroy(&sc->regwin_lock); + if (mtx_initialized(&sc->reg_lock)) + mtx_destroy(&sc->reg_lock); + + for (i = 0; i < NUM_MEMWIN; i++) { + struct memwin *mw = &sc->memwin[i]; + + if (rw_initialized(&mw->mw_lock)) + rw_destroy(&mw->mw_lock); + } bzero(sc, sizeof(*sc)); @@ -1856,13 +1870,18 @@ map_bar_2(struct adapter *sc) return (0); } -static const struct memwin t4_memwin[] = { +struct memwin_init { + uint32_t base; + uint32_t aperture; +}; + +static const struct memwin_init t4_memwin[NUM_MEMWIN] = { { MEMWIN0_BASE, MEMWIN0_APERTURE }, { MEMWIN1_BASE, MEMWIN1_APERTURE }, { MEMWIN2_BASE_T4, MEMWIN2_APERTURE_T4 } }; -static const struct memwin t5_memwin[] = { +static const struct memwin_init t5_memwin[NUM_MEMWIN] = { { MEMWIN0_BASE, MEMWIN0_APERTURE }, { MEMWIN1_BASE, MEMWIN1_APERTURE }, { MEMWIN2_BASE_T5, MEMWIN2_APERTURE_T5 }, @@ -1871,8 +1890,9 @@ static const struct memwin t5_memwin[] = static void setup_memwin(struct adapter *sc) { - const struct memwin *mw; - int i, n; + const struct memwin_init *mw_init; + struct memwin *mw; + int i; uint32_t bar0; if (is_t4(sc)) { @@ -1886,21 +1906,26 @@ setup_memwin(struct adapter *sc) bar0 = t4_hw_pci_read_cfg4(sc, PCIR_BAR(0)); bar0 &= (uint32_t) PCIM_BAR_MEM_BASE; - mw = &t4_memwin[0]; - n = nitems(t4_memwin); + mw_init = &t4_memwin[0]; } else { - /* T5 uses the relative offset inside the PCIe BAR */ + /* T5+ use the relative offset inside the PCIe BAR */ bar0 = 0; - mw = &t5_memwin[0]; - n = nitems(t5_memwin); + mw_init = &t5_memwin[0]; } - for (i = 0; i < n; i++, mw++) { + for (i = 0, mw = &sc->memwin[0]; i < NUM_MEMWIN; i++, mw_init++, mw++) { + rw_init(&mw->mw_lock, "memory window access"); + mw->mw_base = mw_init->base; + mw->mw_aperture = mw_init->aperture; + mw->mw_curpos = 0; t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, i), - (mw->base + bar0) | V_BIR(0) | - V_WINDOW(ilog2(mw->aperture) - 10)); + (mw->mw_base + bar0) | V_BIR(0) | + V_WINDOW(ilog2(mw->mw_aperture) - 10)); + rw_wlock(&mw->mw_lock); + position_memwin(sc, i, 0); + rw_wunlock(&mw->mw_lock); } /* flush */ @@ -1908,51 +1933,227 @@ setup_memwin(struct adapter *sc) } /* - * Verify that the memory range specified by the addr/len pair is valid and lies - * entirely within a single region (EDCx or MCx). + * Positions the memory window at the given address in the card's address space. + * There are some alignment requirements and the actual position may be at an + * address prior to the requested address. mw->mw_curpos always has the actual + * position of the window. + */ +static void +position_memwin(struct adapter *sc, int idx, uint32_t addr) +{ + struct memwin *mw; + uint32_t pf; + uint32_t reg; + + MPASS(idx >= 0 && idx < NUM_MEMWIN); + mw = &sc->memwin[idx]; + rw_assert(&mw->mw_lock, RA_WLOCKED); + + if (is_t4(sc)) { + pf = 0; + mw->mw_curpos = addr & ~0xf; /* start must be 16B aligned */ + } else { + pf = V_PFNUM(sc->pf); + mw->mw_curpos = addr & ~0x7f; /* start must be 128B aligned */ + } + reg = PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, idx); + t4_write_reg(sc, reg, mw->mw_curpos | pf); + t4_read_reg(sc, reg); /* flush */ +} + +static int +rw_via_memwin(struct adapter *sc, int idx, uint32_t addr, uint32_t *val, + int len, int rw) +{ + struct memwin *mw; + uint32_t mw_end, v; + + MPASS(idx >= 0 && idx < NUM_MEMWIN); + + /* Memory can only be accessed in naturally aligned 4 byte units */ + if (addr & 3 || len & 3 || len <= 0) + return (EINVAL); + + mw = &sc->memwin[idx]; + while (len > 0) { + rw_rlock(&mw->mw_lock); + mw_end = mw->mw_curpos + mw->mw_aperture; + if (addr >= mw_end || addr < mw->mw_curpos) { + /* Will need to reposition the window */ + if (!rw_try_upgrade(&mw->mw_lock)) { + rw_runlock(&mw->mw_lock); + rw_wlock(&mw->mw_lock); + } + rw_assert(&mw->mw_lock, RA_WLOCKED); + position_memwin(sc, idx, addr); + rw_downgrade(&mw->mw_lock); + mw_end = mw->mw_curpos + mw->mw_aperture; + } + rw_assert(&mw->mw_lock, RA_RLOCKED); + while (addr < mw_end && len > 0) { + if (rw == 0) { + v = t4_read_reg(sc, mw->mw_base + addr - + mw->mw_curpos); + *val++ = le32toh(v); + } else { + v = *val++; + t4_write_reg(sc, mw->mw_base + addr - + mw->mw_curpos, htole32(v));; + } + addr += 4; + len -= 4; + } + rw_runlock(&mw->mw_lock); + } + + return (0); +} + +static inline int +read_via_memwin(struct adapter *sc, int idx, uint32_t addr, uint32_t *val, + int len) +{ + + return (rw_via_memwin(sc, idx, addr, val, len, 0)); +} + +static inline int +write_via_memwin(struct adapter *sc, int idx, uint32_t addr, + const uint32_t *val, int len) +{ + + return (rw_via_memwin(sc, idx, addr, (void *)(uintptr_t)val, len, 1)); +} + +static int +t4_range_cmp(const void *a, const void *b) +{ + return ((const struct t4_range *)a)->start - + ((const struct t4_range *)b)->start; +} + +/* + * Verify that the memory range specified by the addr/len pair is valid within + * the card's address space. */ static int validate_mem_range(struct adapter *sc, uint32_t addr, int len) { - uint32_t em, addr_len, maddr, mlen; + struct t4_range mem_ranges[4], *r, *next; + uint32_t em, addr_len; + int i, n, remaining; /* Memory can only be accessed in naturally aligned 4 byte units */ - if (addr & 3 || len & 3 || len == 0) + if (addr & 3 || len & 3 || len <= 0) return (EINVAL); /* Enabled memories */ em = t4_read_reg(sc, A_MA_TARGET_MEM_ENABLE); + + r = &mem_ranges[0]; + n = 0; + bzero(r, sizeof(mem_ranges)); if (em & F_EDRAM0_ENABLE) { addr_len = t4_read_reg(sc, A_MA_EDRAM0_BAR); - maddr = G_EDRAM0_BASE(addr_len) << 20; - mlen = G_EDRAM0_SIZE(addr_len) << 20; - if (mlen > 0 && addr >= maddr && addr < maddr + mlen && - addr + len <= maddr + mlen) - return (0); + r->size = G_EDRAM0_SIZE(addr_len) << 20; + if (r->size > 0) { + r->start = G_EDRAM0_BASE(addr_len) << 20; + if (addr >= r->start && + addr + len <= r->start + r->size) + return (0); + r++; + n++; + } } if (em & F_EDRAM1_ENABLE) { addr_len = t4_read_reg(sc, A_MA_EDRAM1_BAR); - maddr = G_EDRAM1_BASE(addr_len) << 20; - mlen = G_EDRAM1_SIZE(addr_len) << 20; - if (mlen > 0 && addr >= maddr && addr < maddr + mlen && - addr + len <= maddr + mlen) - return (0); + r->size = G_EDRAM1_SIZE(addr_len) << 20; + if (r->size > 0) { + r->start = G_EDRAM1_BASE(addr_len) << 20; + if (addr >= r->start && + addr + len <= r->start + r->size) + return (0); + r++; + n++; + } } if (em & F_EXT_MEM_ENABLE) { addr_len = t4_read_reg(sc, A_MA_EXT_MEMORY_BAR); - maddr = G_EXT_MEM_BASE(addr_len) << 20; - mlen = G_EXT_MEM_SIZE(addr_len) << 20; - if (mlen > 0 && addr >= maddr && addr < maddr + mlen && - addr + len <= maddr + mlen) - return (0); + r->size = G_EXT_MEM_SIZE(addr_len) << 20; + if (r->size > 0) { + r->start = G_EXT_MEM_BASE(addr_len) << 20; + if (addr >= r->start && + addr + len <= r->start + r->size) + return (0); + r++; + n++; + } } - if (!is_t4(sc) && em & F_EXT_MEM1_ENABLE) { + if (is_t5(sc) && em & F_EXT_MEM1_ENABLE) { addr_len = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); - maddr = G_EXT_MEM1_BASE(addr_len) << 20; - mlen = G_EXT_MEM1_SIZE(addr_len) << 20; - if (mlen > 0 && addr >= maddr && addr < maddr + mlen && - addr + len <= maddr + mlen) - return (0); + r->size = G_EXT_MEM1_SIZE(addr_len) << 20; + if (r->size > 0) { + r->start = G_EXT_MEM1_BASE(addr_len) << 20; + if (addr >= r->start && + addr + len <= r->start + r->size) + return (0); + r++; + n++; + } + } + MPASS(n <= nitems(mem_ranges)); + + if (n > 1) { + /* Sort and merge the ranges. */ + qsort(mem_ranges, n, sizeof(struct t4_range), t4_range_cmp); + + /* Start from index 0 and examine the next n - 1 entries. */ + r = &mem_ranges[0]; + for (remaining = n - 1; remaining > 0; remaining--, r++) { + + MPASS(r->size > 0); /* r is a valid entry. */ + next = r + 1; + MPASS(next->size > 0); /* and so is the next one. */ + + while (r->start + r->size >= next->start) { + /* Merge the next one into the current entry. */ + r->size = max(r->start + r->size, + next->start + next->size) - r->start; + n--; /* One fewer entry in total. */ + if (--remaining == 0) + goto done; /* short circuit */ + next++; + } + if (next != r + 1) { + /* + * Some entries were merged into r and next + * points to the first valid entry that couldn't + * be merged. + */ + MPASS(next->size > 0); /* must be valid */ + memcpy(r + 1, next, remaining * sizeof(*r)); +#ifdef INVARIANTS + /* + * This so that the foo->size assertion in the + * next iteration of the loop do the right + * thing for entries that were pulled up and are + * no longer valid. + */ + MPASS(n < nitems(mem_ranges)); + bzero(&mem_ranges[n], (nitems(mem_ranges) - n) * + sizeof(struct t4_range)); +#endif + } + } +done: + /* Done merging the ranges. */ + MPASS(n > 0); + r = &mem_ranges[0]; + for (i = 0; i < n; i++, r++) { + if (addr >= r->start && + addr + len <= r->start + r->size) + return (0); + } } return (EFAULT); @@ -1985,7 +2186,7 @@ static int validate_mt_off_len(struct adapter *sc, int mtype, uint32_t off, int len, uint32_t *addr) { - uint32_t em, addr_len, maddr, mlen; + uint32_t em, addr_len, maddr; /* Memory can only be accessed in naturally aligned 4 byte units */ if (off & 3 || len & 3 || len == 0) @@ -1998,91 +2199,43 @@ validate_mt_off_len(struct adapter *sc, return (EINVAL); addr_len = t4_read_reg(sc, A_MA_EDRAM0_BAR); maddr = G_EDRAM0_BASE(addr_len) << 20; - mlen = G_EDRAM0_SIZE(addr_len) << 20; break; case MEM_EDC1: if (!(em & F_EDRAM1_ENABLE)) return (EINVAL); addr_len = t4_read_reg(sc, A_MA_EDRAM1_BAR); maddr = G_EDRAM1_BASE(addr_len) << 20; - mlen = G_EDRAM1_SIZE(addr_len) << 20; break; case MEM_MC: if (!(em & F_EXT_MEM_ENABLE)) return (EINVAL); addr_len = t4_read_reg(sc, A_MA_EXT_MEMORY_BAR); maddr = G_EXT_MEM_BASE(addr_len) << 20; - mlen = G_EXT_MEM_SIZE(addr_len) << 20; break; case MEM_MC1: - if (is_t4(sc) || !(em & F_EXT_MEM1_ENABLE)) + if (!is_t5(sc) || !(em & F_EXT_MEM1_ENABLE)) return (EINVAL); addr_len = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); maddr = G_EXT_MEM1_BASE(addr_len) << 20; - mlen = G_EXT_MEM1_SIZE(addr_len) << 20; break; default: return (EINVAL); } - if (mlen > 0 && off < mlen && off + len <= mlen) { - *addr = maddr + off; /* global address */ - return (0); - } - - return (EFAULT); + *addr = maddr + off; /* global address */ + return (validate_mem_range(sc, *addr, len)); } -static void -memwin_info(struct adapter *sc, int win, uint32_t *base, uint32_t *aperture) -{ - const struct memwin *mw; - - if (is_t4(sc)) { - KASSERT(win >= 0 && win < nitems(t4_memwin), - ("%s: incorrect memwin# (%d)", __func__, win)); - mw = &t4_memwin[win]; - } else { - KASSERT(win >= 0 && win < nitems(t5_memwin), - ("%s: incorrect memwin# (%d)", __func__, win)); - mw = &t5_memwin[win]; - } - - if (base != NULL) - *base = mw->base; - if (aperture != NULL) - *aperture = mw->aperture; -} - -/* - * Positions the memory window such that it can be used to access the specified - * address in the chip's address space. The return value is the offset of addr - * from the start of the window. - */ -static uint32_t -position_memwin(struct adapter *sc, int n, uint32_t addr) +static int +fixup_devlog_params(struct adapter *sc) { - uint32_t start, pf; - uint32_t reg; - - KASSERT(n >= 0 && n <= 3, - ("%s: invalid window %d.", __func__, n)); - KASSERT((addr & 3) == 0, - ("%s: addr (0x%x) is not at a 4B boundary.", __func__, addr)); - - if (is_t4(sc)) { - pf = 0; - start = addr & ~0xf; /* start must be 16B aligned */ - } else { - pf = V_PFNUM(sc->pf); - start = addr & ~0x7f; /* start must be 128B aligned */ - } - reg = PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, n); + struct devlog_params *dparams = &sc->params.devlog; + int rc; - t4_write_reg(sc, reg, start | pf); - t4_read_reg(sc, reg); + rc = validate_mt_off_len(sc, dparams->memtype, dparams->start, + dparams->size, &dparams->addr); - return (addr - start); + return (rc); } static int @@ -2680,9 +2833,9 @@ partition_resources(struct adapter *sc, } if (strncmp(sc->cfg_file, FLASH_CF, sizeof(sc->cfg_file)) != 0) { - u_int cflen, i, n; + u_int cflen; const uint32_t *cfdata; - uint32_t param, val, addr, off, mw_base, mw_aperture; + uint32_t param, val, addr; KASSERT(cfg != NULL || default_cfg != NULL, ("%s: no config to upload", __func__)); @@ -2732,16 +2885,7 @@ partition_resources(struct adapter *sc, __func__, mtype, moff, cflen, rc); goto use_config_on_flash; } - - memwin_info(sc, 2, &mw_base, &mw_aperture); - while (cflen) { - off = position_memwin(sc, 2, addr); - n = min(cflen, mw_aperture - off); - for (i = 0; i < n; i += 4) - t4_write_reg(sc, mw_base + off + i, *cfdata++); - cflen -= n; - addr += n; - } + write_via_memwin(sc, 2, addr, cfdata, cflen); } else { use_config_on_flash: mtype = FW_MEMTYPE_FLASH; @@ -2812,8 +2956,6 @@ get_params__pre_init(struct adapter *sc) { int rc; uint32_t param[2], val[2]; - struct fw_devlog_cmd cmd; - struct devlog_params *dlog = &sc->params.devlog; param[0] = FW_PARAM_DEV(PORTVEC); param[1] = FW_PARAM_DEV(CCLK); @@ -2829,21 +2971,13 @@ get_params__pre_init(struct adapter *sc) sc->params.vpd.cclk = val[1]; /* Read device log parameters. */ - bzero(&cmd, sizeof(cmd)); - cmd.op_to_write = htobe32(V_FW_CMD_OP(FW_DEVLOG_CMD) | - F_FW_CMD_REQUEST | F_FW_CMD_READ); - cmd.retval_len16 = htobe32(FW_LEN16(cmd)); - rc = -t4_wr_mbox(sc, sc->mbox, &cmd, sizeof(cmd), &cmd); - if (rc != 0) { + rc = -t4_init_devlog_params(sc, 1); + if (rc == 0) + fixup_devlog_params(sc); + else { device_printf(sc->dev, "failed to get devlog parameters: %d.\n", rc); - bzero(dlog, sizeof (*dlog)); rc = 0; /* devlog isn't critical for device operation */ - } else { - val[0] = be32toh(cmd.memtype_devlog_memaddr16_devlog); - dlog->memtype = G_FW_DEVLOG_CMD_MEMTYPE_DEVLOG(val[0]); - dlog->start = G_FW_DEVLOG_CMD_MEMADDR16_DEVLOG(val[0]) << 4; - dlog->size = be32toh(cmd.memsize_devlog); } return (rc); @@ -4078,7 +4212,7 @@ read_vf_stat(struct adapter *sc, unsigne { u32 stats[2]; - mtx_assert(&sc->regwin_lock, MA_OWNED); + mtx_assert(&sc->reg_lock, MA_OWNED); t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | V_PL_VFID(G_FW_VIID_VIN(viid)) | V_PL_ADDR(VF_MPS_REG(reg))); stats[0] = t4_read_reg(sc, A_PL_INDIR_DATA); @@ -4145,7 +4279,7 @@ vi_refresh_stats(struct adapter *sc, str if (timevalcmp(&tv, &vi->last_refreshed, <)) return; - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_get_vi_stats(sc, vi->viid, &vi->stats); ifp->if_ipackets = s->rx_bcast_frames + s->rx_mcast_frames + @@ -4167,7 +4301,7 @@ vi_refresh_stats(struct adapter *sc, str ifp->if_snd.ifq_drops = drops; getmicrotime(&vi->last_refreshed); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); } static void @@ -4201,10 +4335,10 @@ cxgbe_refresh_stats(struct adapter *sc, if (pi->rx_chan_map & (1 << i)) { uint32_t v; - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); ifp->if_iqdrops += v; } } @@ -5632,9 +5766,9 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_tp_get_cpl_stats(sc, &stats); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); if (sc->chip_params->nchan > 2) { sbuf_printf(sb, " channel 0 channel 1" @@ -5685,7 +5819,7 @@ sysctl_ddp_stats(SYSCTL_HANDLER_ARGS) return (rc); } -const char *devlog_level_strings[] = { +static const char * const devlog_level_strings[] = { [FW_DEVLOG_LEVEL_EMERG] = "EMERG", [FW_DEVLOG_LEVEL_CRIT] = "CRIT", [FW_DEVLOG_LEVEL_ERR] = "ERR", @@ -5694,7 +5828,7 @@ const char *devlog_level_strings[] = { [FW_DEVLOG_LEVEL_DEBUG] = "DEBUG" }; -const char *devlog_facility_strings[] = { +static const char * const devlog_facility_strings[] = { [FW_DEVLOG_FACILITY_CORE] = "CORE", [FW_DEVLOG_FACILITY_CF] = "CF", [FW_DEVLOG_FACILITY_SCHED] = "SCHED", @@ -5718,7 +5852,8 @@ const char *devlog_facility_strings[] = [FW_DEVLOG_FACILITY_ISCSI] = "ISCSI", [FW_DEVLOG_FACILITY_FCOE] = "FCOE", [FW_DEVLOG_FACILITY_FOISCSI] = "FOISCSI", - [FW_DEVLOG_FACILITY_FOFCOE] = "FOFCOE" + [FW_DEVLOG_FACILITY_FOFCOE] = "FOFCOE", + [FW_DEVLOG_FACILITY_CHNET] = "CHNET", }; static int @@ -5727,27 +5862,22 @@ sysctl_devlog(SYSCTL_HANDLER_ARGS) struct adapter *sc = arg1; struct devlog_params *dparams = &sc->params.devlog; struct fw_devlog_e *buf, *e; - int i, j, rc, nentries, first = 0, m; + int i, j, rc, nentries, first = 0; struct sbuf *sb; uint64_t ftstamp = UINT64_MAX; - if (dparams->start == 0) { - dparams->memtype = FW_MEMTYPE_EDC0; - dparams->start = 0x84000; - dparams->size = 32768; - } - - nentries = dparams->size / sizeof(struct fw_devlog_e); + if (dparams->addr == 0) + return (ENXIO); buf = malloc(dparams->size, M_CXGBE, M_NOWAIT); if (buf == NULL) return (ENOMEM); - m = fwmtype_to_hwmtype(dparams->memtype); - rc = -t4_mem_read(sc, m, dparams->start, dparams->size, (void *)buf); + rc = read_via_memwin(sc, 1, dparams->addr, (void *)buf, dparams->size); if (rc != 0) goto done; + nentries = dparams->size / sizeof(struct fw_devlog_e); for (i = 0; i < nentries; i++) { e = &buf[i]; @@ -6612,9 +6742,9 @@ sysctl_rdma_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_tp_get_rdma_stats(sc, &stats); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); sbuf_printf(sb, "NoRQEModDefferals: %u\n", stats.rqe_dfr_mod); sbuf_printf(sb, "NoRQEPktDefferals: %u", stats.rqe_dfr_pkt); @@ -6641,9 +6771,9 @@ sysctl_tcp_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_tp_get_tcp_stats(sc, &v4, &v6); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); sbuf_printf(sb, " IP IPv6\n"); @@ -6743,9 +6873,9 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); t4_tp_get_err_stats(sc, &stats); - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); if (sc->chip_params->nchan > 2) { sbuf_printf(sb, " channel 0 channel 1" @@ -7350,22 +7480,22 @@ done: static inline uint64_t get_filter_hits(struct adapter *sc, uint32_t fid) { - uint32_t mw_base, off, tcb_base = t4_read_reg(sc, A_TP_CMM_TCB_BASE); - uint64_t hits; + uint32_t tcb_addr; - memwin_info(sc, 0, &mw_base, NULL); + tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE) + + (fid + sc->tids.ftid_base) * TCB_SIZE; - off = position_memwin(sc, 0, - tcb_base + (fid + sc->tids.ftid_base) * TCB_SIZE); if (is_t4(sc)) { - hits = t4_read_reg64(sc, mw_base + off + 16); - hits = be64toh(hits); + uint64_t hits; + + read_via_memwin(sc, 0, tcb_addr + 16, (uint32_t *)&hits, 8); + return (be64toh(hits)); } else { - hits = t4_read_reg(sc, mw_base + off + 24); - hits = be32toh(hits); - } + uint32_t hits; - return (hits); + read_via_memwin(sc, 0, tcb_addr + 24, &hits, 4); + return (be32toh(hits)); + } } static int @@ -7839,12 +7969,12 @@ done: return (rc); } +#define MAX_READ_BUF_SIZE (128 * 1024) static int read_card_mem(struct adapter *sc, int win, struct t4_mem_range *mr) { - uint32_t addr, off, remaining, i, n; - uint32_t *buf, *b; - uint32_t mw_base, mw_aperture; + uint32_t addr, remaining, n; + uint32_t *buf; int rc; uint8_t *dst; @@ -7852,25 +7982,19 @@ read_card_mem(struct adapter *sc, int wi if (rc != 0) return (rc); - memwin_info(sc, win, &mw_base, &mw_aperture); - buf = b = malloc(min(mr->len, mw_aperture), M_CXGBE, M_WAITOK); + buf = malloc(min(mr->len, MAX_READ_BUF_SIZE), M_CXGBE, M_WAITOK); addr = mr->addr; remaining = mr->len; dst = (void *)mr->data; while (remaining) { - off = position_memwin(sc, win, addr); - - /* number of bytes that we'll copy in the inner loop */ - n = min(remaining, mw_aperture - off); - for (i = 0; i < n; i += 4) - *b++ = t4_read_reg(sc, mw_base + off + i); + n = min(remaining, MAX_READ_BUF_SIZE); + read_via_memwin(sc, 2, addr, buf, n); rc = copyout(buf, dst, n); if (rc != 0) break; - b = buf; dst += n; remaining -= n; addr += n; @@ -7879,6 +8003,7 @@ read_card_mem(struct adapter *sc, int wi free(buf, M_CXGBE); return (rc); } +#undef MAX_READ_BUF_SIZE static int read_i2c(struct adapter *sc, struct t4_i2c_data *i2cd) @@ -8347,12 +8472,12 @@ t4_ioctl(struct cdev *dev, unsigned long /* MAC stats */ t4_clr_port_stats(sc, pi->tx_chan); pi->tx_parse_error = 0; - mtx_lock(&sc->regwin_lock); + mtx_lock(&sc->reg_lock); for_each_vi(pi, v, vi) { if (vi->flags & VI_INIT_DONE) t4_clr_vi_stats(sc, vi->viid); } - mtx_unlock(&sc->regwin_lock); + mtx_unlock(&sc->reg_lock); /* * Since this command accepts a port, clear stats for From owner-svn-src-stable-10@freebsd.org Fri Nov 4 20:30:17 2016 Return-Path: Delivered-To: svn-src-stable-10@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 533D3C30363; Fri, 4 Nov 2016 20:30:17 +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 21DC9E16; Fri, 4 Nov 2016 20:30:17 +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 uA4KUGTZ011659; Fri, 4 Nov 2016 20:30:16 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4KUGC4011656; Fri, 4 Nov 2016 20:30:16 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042030.uA4KUGC4011656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 20:30:16 +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: r308311 - in stable/10/sys/dev/cxgbe: . 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 20:30:17 -0000 Author: jhb Date: Fri Nov 4 20:30:15 2016 New Revision: 308311 URL: https://svnweb.freebsd.org/changeset/base/308311 Log: MFC 296018,296640,296641,296689,296735,296949: Fixes for sysctl handlers. 296018: cxgbe(4): Add a sysctl to retrieve the maximum speed/bandwidth supported by a port. dev.cxgbe..max_speed dev.cxl..max_speed 296640: cxgbe(4): Add a sysctl for the event capture mask of the TP block's logic analyzer. dev.t5nex..misc.tp_la_mask dev.t4nex..misc.tp_la_mask 296641: cxgbe(4): Add sysctls to display the TP microcode version and the expansion rom version (if there's one). trantor:~# sysctl dev.t4nex dev.t5nex | grep _version dev.t4nex.0.firmware_version: 1.15.28.0 dev.t4nex.0.tp_version: 0.1.9.4 dev.t5nex.0.firmware_version: 1.15.28.0 dev.t5nex.0.exprom_version: 1.0.0.68 dev.t5nex.0.tp_version: 0.1.4.9 296689: cxgbe(4): sysctls to display the TOE's TCP timers. cask:~# sysctl -d dev.t5nex.0.toe dev.t5nex.0.toe.finwait2_timer: FINWAIT2 timer (us) dev.t5nex.0.toe.initial_srtt: Initial SRTT (us) dev.t5nex.0.toe.keepalive_intvl: Keepidle interval (us) dev.t5nex.0.toe.keepalive_idle: Keepidle idle timer (us) dev.t5nex.0.toe.persist_max: Persist timer max (us) dev.t5nex.0.toe.persist_min: Persist timer min (us) dev.t5nex.0.toe.rexmt_max: Retransmit max (us) dev.t5nex.0.toe.rexmt_min: Retransmit min (us) dev.t5nex.0.toe.dack_timer: DACK timer (us) dev.t5nex.0.toe.dack_tick: DACK tick (us) dev.t5nex.0.toe.timestamp_tick: TCP timestamp tick (us) dev.t5nex.0.toe.timer_tick: TP timer tick (us) ... cask:~# sysctl dev.t5nex.0.toe dev.t5nex.0.toe.finwait2_timer: 9765440 dev.t5nex.0.toe.initial_srtt: 244128 dev.t5nex.0.toe.keepalive_intvl: 73240800 dev.t5nex.0.toe.keepalive_idle: 7031116800 dev.t5nex.0.toe.persist_max: 9765440 dev.t5nex.0.toe.persist_min: 976544 dev.t5nex.0.toe.rexmt_max: 9765440 dev.t5nex.0.toe.rexmt_min: 244128 dev.t5nex.0.toe.dack_timer: 19520 dev.t5nex.0.toe.dack_tick: 32.768 dev.t5nex.0.toe.timestamp_tick: 1048.576 dev.t5nex.0.toe.timer_tick: 32.768 ... 296735: Fix the following gcc warnings on sparc64, when TCP_OFFLOAD is not defined: sys/dev/cxgbe/t4_main.c:7474: warning: 'sysctl_tp_tick' defined but not used sys/dev/cxgbe/t4_main.c:7505: warning: 'sysctl_tp_dack_timer' defined but not used sys/dev/cxgbe/t4_main.c:7519: warning: 'sysctl_tp_timer' defined but not used This just adds a bunch of #ifdef TCP_OFFLOAD in the right places. 296949: cxgbe(4): Remove a couple of pointless assignments in sysctl_meminfo. Do not display range if start = stop (this is a workaround for some unused regions). Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 20:06:32 2016 (r308310) +++ stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 20:30:15 2016 (r308311) @@ -787,7 +787,9 @@ struct adapter { int tracer_valid; /* bitmap of valid tracers */ int tracer_enabled; /* bitmap of enabled tracers */ - char fw_version[32]; + char fw_version[16]; + char tp_version[16]; + char exprom_version[16]; char cfg_file[32]; u_int cfcsum; struct adapter_params params; @@ -1015,6 +1017,22 @@ is_40G_port(const struct port_info *pi) } static inline int +port_top_speed(const struct port_info *pi) +{ + + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G) + return (100); + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) + return (40); + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) + return (10); + if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_1G) + return (1); + + return (0); +} + +static inline int tx_resume_threshold(struct sge_eq *eq) { Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 20:06:32 2016 (r308310) +++ stable/10/sys/dev/cxgbe/common/common.h Fri Nov 4 20:30:15 2016 (r308311) @@ -290,6 +290,7 @@ struct adapter_params { unsigned int fw_vers; unsigned int tp_vers; + unsigned int exprom_vers; unsigned short mtus[NMTUS]; unsigned short a_wnd[NCCTRL_WIN]; Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:06:32 2016 (r308310) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:30:15 2016 (r308311) @@ -494,11 +494,17 @@ static int sysctl_rdma_stats(SYSCTL_HAND static int sysctl_tcp_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tids(SYSCTL_HANDLER_ARGS); static int sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_tp_la_mask(SYSCTL_HANDLER_ARGS); static int sysctl_tp_la(SYSCTL_HANDLER_ARGS); static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); #endif +#ifdef TCP_OFFLOAD +static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); +static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS); +static int sysctl_tp_timer(SYSCTL_HANDLER_ARGS); +#endif static uint32_t fconf_iconf_to_mode(uint32_t, uint32_t); static uint32_t mode_to_fconf(uint32_t); static uint32_t mode_to_iconf(uint32_t); @@ -2711,7 +2717,24 @@ prep_firmware(struct adapter *sc) G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); + t4_get_tp_version(sc, &sc->params.tp_vers); + snprintf(sc->tp_version, sizeof(sc->tp_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.tp_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.tp_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.tp_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.tp_vers)); + + if (t4_get_exprom_version(sc, &sc->params.exprom_vers) != 0) + sc->params.exprom_vers = 0; + else { + snprintf(sc->exprom_version, sizeof(sc->exprom_version), + "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.exprom_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.exprom_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.exprom_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.exprom_vers)); + } /* Reset device */ if (need_fw_reset && @@ -4529,6 +4552,14 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "hw_revision", CTLFLAG_RD, NULL, chip_rev(sc), "chip hardware revision"); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "tp_version", + CTLFLAG_RD, sc->tp_version, 0, "TP microcode version"); + + if (sc->params.exprom_vers != 0) { + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "exprom_version", + CTLFLAG_RD, sc->exprom_version, 0, "expansion ROM version"); + } + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", CTLFLAG_RD, sc->fw_version, 0, "firmware version"); @@ -4736,6 +4767,10 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_tp_err_stats, "A", "TP error statistics"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tp_la_mask", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_tp_la_mask, "I", + "TP logic analyzer event capture mask"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tp_la", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_tp_la, "A", "TP logic analyzer"); @@ -4788,6 +4823,54 @@ t4_sysctls(struct adapter *sc) sc->tt.tx_align = 1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tx_align", CTLFLAG_RW, &sc->tt.tx_align, 0, "chop and align payload"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timer_tick", + CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_tp_tick, "A", + "TP timer tick (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timestamp_tick", + CTLTYPE_STRING | CTLFLAG_RD, sc, 1, sysctl_tp_tick, "A", + "TCP timestamp tick (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "dack_tick", + CTLTYPE_STRING | CTLFLAG_RD, sc, 2, sysctl_tp_tick, "A", + "DACK tick (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "dack_timer", + CTLTYPE_UINT | CTLFLAG_RD, sc, 0, sysctl_tp_dack_timer, + "IU", "DACK timer (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_min", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MIN, + sysctl_tp_timer, "LU", "Retransmit min (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_max", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MAX, + sysctl_tp_timer, "LU", "Retransmit max (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "persist_min", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_PERS_MIN, + sysctl_tp_timer, "LU", "Persist timer min (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "persist_max", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_PERS_MAX, + sysctl_tp_timer, "LU", "Persist timer max (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_idle", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_IDLE, + sysctl_tp_timer, "LU", "Keepidle idle timer (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_intvl", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_INTVL, + sysctl_tp_timer, "LU", "Keepidle interval (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "initial_srtt", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_INIT_SRTT, + sysctl_tp_timer, "LU", "Initial SRTT (us)"); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "finwait2_timer", + CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_FINWAIT2_TIMER, + sysctl_tp_timer, "LU", "FINWAIT2 timer (us)"); } #endif } @@ -4901,6 +4984,9 @@ cxgbe_sysctls(struct port_info *pi) CTLTYPE_STRING | CTLFLAG_RW, pi, PAUSE_TX, sysctl_pause_settings, "A", "PAUSE settings (bit 0 = rx_pause, bit 1 = tx_pause)"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "max_speed", CTLFLAG_RD, NULL, + port_top_speed(pi), "max speed (in Gbps)"); + /* * dev.cxgbe.X.stats. */ @@ -6127,6 +6213,9 @@ mem_region_show(struct sbuf *sb, const c { unsigned int size; + if (from == to) + return; + size = to - from + 1; if (size == 0) return; @@ -6230,13 +6319,10 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) md++; if (t4_read_reg(sc, A_LE_DB_CONFIG) & F_HASHEN) { - if (chip_id(sc) <= CHELSIO_T5) { - hi = t4_read_reg(sc, A_LE_DB_TID_HASHBASE) / 4; + if (chip_id(sc) <= CHELSIO_T5) md->base = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE); - } else { - hi = t4_read_reg(sc, A_LE_DB_HASH_TID_BASE); + else md->base = t4_read_reg(sc, A_LE_DB_HASH_TBL_BASE_ADDR); - } md->limit = 0; } else { md->base = 0; @@ -6933,6 +7019,26 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS) return (rc); } +static int +sysctl_tp_la_mask(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct tp_params *tpp = &sc->params.tp; + u_int mask; + int rc; + + mask = tpp->la_mask >> 16; + rc = sysctl_handle_int(oidp, &mask, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + if (mask > 0xffff) + return (EINVAL); + tpp->la_mask = mask << 16; + t4_set_reg_field(sc, A_TP_DBG_LA_CONFIG, 0xffff0000U, tpp->la_mask); + + return (0); +} + struct field_desc { const char *name; u_int start; @@ -7277,6 +7383,92 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS) } #endif +#ifdef TCP_OFFLOAD +static void +unit_conv(char *buf, size_t len, u_int val, u_int factor) +{ + u_int rem = val % factor; + + if (rem == 0) + snprintf(buf, len, "%u", val / factor); + else { + while (rem % 10 == 0) + rem /= 10; + snprintf(buf, len, "%u.%u", val / factor, rem); + } +} + +static int +sysctl_tp_tick(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + char buf[16]; + u_int res, re; + u_int cclk_ps = 1000000000 / sc->params.vpd.cclk; + + res = t4_read_reg(sc, A_TP_TIMER_RESOLUTION); + switch (arg2) { + case 0: + /* timer_tick */ + re = G_TIMERRESOLUTION(res); + break; + case 1: + /* TCP timestamp tick */ + re = G_TIMESTAMPRESOLUTION(res); + break; + case 2: + /* DACK tick */ + re = G_DELAYEDACKRESOLUTION(res); + break; + default: + return (EDOOFUS); + } + + unit_conv(buf, sizeof(buf), (cclk_ps << re), 1000000); + + return (sysctl_handle_string(oidp, buf, sizeof(buf), req)); +} + +static int +sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + u_int res, dack_re, v; + u_int cclk_ps = 1000000000 / sc->params.vpd.cclk; + + res = t4_read_reg(sc, A_TP_TIMER_RESOLUTION); + dack_re = G_DELAYEDACKRESOLUTION(res); + v = ((cclk_ps << dack_re) / 1000000) * t4_read_reg(sc, A_TP_DACK_TIMER); + + return (sysctl_handle_int(oidp, &v, 0, req)); +} + +static int +sysctl_tp_timer(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int reg = arg2; + u_int tre; + u_long tp_tick_us, v; + u_int cclk_ps = 1000000000 / sc->params.vpd.cclk; + + MPASS(reg == A_TP_RXT_MIN || reg == A_TP_RXT_MAX || + reg == A_TP_PERS_MIN || reg == A_TP_PERS_MAX || + reg == A_TP_KEEP_IDLE || A_TP_KEEP_INTVL || reg == A_TP_INIT_SRTT || + reg == A_TP_FINWAIT2_TIMER); + + tre = G_TIMERRESOLUTION(t4_read_reg(sc, A_TP_TIMER_RESOLUTION)); + tp_tick_us = (cclk_ps << tre) / 1000000; + + if (reg == A_TP_INIT_SRTT) + v = tp_tick_us * G_INITSRTT(t4_read_reg(sc, reg)); + else + v = tp_tick_us * t4_read_reg(sc, reg); + + return (sysctl_handle_long(oidp, &v, 0, req)); +} +#endif + static uint32_t fconf_iconf_to_mode(uint32_t fconf, uint32_t iconf) { From owner-svn-src-stable-10@freebsd.org Fri Nov 4 20:38:27 2016 Return-Path: Delivered-To: svn-src-stable-10@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 934B3C30A69; Fri, 4 Nov 2016 20:38:27 +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 541A89C6; Fri, 4 Nov 2016 20:38:27 +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 uA4KcQ5X015514; Fri, 4 Nov 2016 20:38:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4KcQXC015511; Fri, 4 Nov 2016 20:38:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042038.uA4KcQXC015511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 20:38:26 +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: r308313 - in stable/10/sys/dev/cxgbe: . firmware 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 20:38:27 -0000 Author: jhb Date: Fri Nov 4 20:38:26 2016 New Revision: 308313 URL: https://svnweb.freebsd.org/changeset/base/308313 Log: MFC 296950,296951: Configuration updates. 296950: cxgbe(4): Update some register settings in the default configuration files to match the "uwire" configuration. 296951: cxgbe(4): Enable additional capabilities in the default configuration files. All features with FreeBSD drivers of some kind are now in the default configuration. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt ============================================================================== --- stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Nov 4 20:32:49 2016 (r308312) +++ stable/10/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Nov 4 20:38:26 2016 (r308313) @@ -10,7 +10,7 @@ [global] rss_glb_config_mode = basicvirtual - rss_glb_config_options = tnlmapen, hashtoeplitz, tnlalllkp + rss_glb_config_options = tnlmapen,hashtoeplitz,tnlalllkp sge_timer_value = 1, 5, 10, 50, 100, 200 # usecs @@ -20,28 +20,29 @@ # disable TP_PARA_REG3.RxFragEn reg[0x7d6c] = 0x00000000/0x00007000 - # TP_SHIFT_CNT - reg[0x7dc0] = 0x62f8849 + reg[0x7dc0] = 0x0e2f8849 # TP_SHIFT_CNT filterMode = fragmentation, mpshittype, protocol, vlan, port, fcoe filterMask = protocol, fcoe - # TP rx and tx channels (0 = auto). + tp_pmrx = 36, 512 + tp_pmrx_pagesize = 64K + + # TP number of RX channels (0 = auto) tp_nrxch = 0 - tp_ntxch = 0 - # TP rx and tx payload memory (% of the total EDRAM + DDR3). - tp_pmrx = 38, 512 - tp_pmtx = 60, 512 - tp_pmrx_pagesize = 64K + tp_pmtx = 46, 512 tp_pmtx_pagesize = 64K - # cluster, lan, or wan. - tp_tcptuning = lan + # TP number of TX channels (0 = auto) + tp_ntxch = 0 # TP OFLD MTUs tp_mtus = 88, 256, 512, 576, 808, 1024, 1280, 1488, 1500, 2002, 2048, 4096, 4352, 8192, 9000, 9600 + # cluster, lan, or wan. + tp_tcptuning = lan + # PFs 0-3. These get 8 MSI/8 MSI-X vectors each. VFs are supported by # these 4 PFs only. Not used here at all. [function "0"] @@ -91,10 +92,14 @@ pmask = all # driver will mask off features it won't use - protocol = ofld + protocol = ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu tp_l2t = 4096 tp_ddp = 2 + tp_ddp_iscsi = 2 + tp_stag = 2 + tp_pbl = 5 + tp_rq = 7 # TCAM has 8K cells; each region must start at a multiple of 128 cell. # Each entry in these categories takes 4 cells each. nhash will use the @@ -166,7 +171,7 @@ [fini] version = 0x1 - checksum = 0x98210e18 + checksum = 0x76b034e0 # # $FreeBSD$ # Modified: stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt ============================================================================== --- stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Nov 4 20:32:49 2016 (r308312) +++ stable/10/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Nov 4 20:38:26 2016 (r308313) @@ -10,12 +10,33 @@ [global] rss_glb_config_mode = basicvirtual - rss_glb_config_options = tnlmapen, hashtoeplitz, tnlalllkp + rss_glb_config_options = tnlmapen,hashtoeplitz,tnlalllkp # PL_TIMEOUT register - pl_timeout_value = 200 # the timeout value in units of us + pl_timeout_value = 10000 # the timeout value in units of us - sge_timer_value = 1, 5, 10, 50, 100, 200 # usecs + # SGE_THROTTLE_CONTROL + bar2throttlecount = 500 # bar2throttlecount in us + + sge_timer_value = 1, 5, 10, 50, 100, 200 # SGE_TIMER_VALUE* in usecs + + reg[0x1124] = 0x00000400/0x00000400 # SGE_CONTROL2, enable VFIFO; if + # SGE_VFIFO_SIZE is not set, then + # firmware will set it up in function + # of number of egress queues used + + reg[0x1130] = 0x00d5ffeb # SGE_DBP_FETCH_THRESHOLD, fetch + # threshold set to queue depth + # minus 128-entries for FL and HP + # queues, and 0xfff for LP which + # prompts the firmware to set it up + # in function of egress queues + # used + + reg[0x113c] = 0x0002ffc0 # SGE_VFIFO_SIZE, set to 0x2ffc0 which + # prompts the firmware to set it up in + # function of number of egress queues + # used # enable TP_OUT_CONFIG.IPIDSPLITMODE reg[0x7d04] = 0x00010000/0x00010000 @@ -26,34 +47,38 @@ # enable TP_PARA_REG6.EnableCSnd reg[0x7d78] = 0x00000400/0x00000000 - # TP_SHIFT_CNT - reg[0x7dc0] = 0x62f8849 - - # TP_GLOBAL_CONFIG - reg[0x7d08] = 0x00000800/0x00000800 # set IssFromCplEnable - - # TP_PARA_REG0 - reg[0x7d60] = 0x06000000/0x07000000 # set InitCWND to 6 + reg[0x7dc0] = 0x0e2f8849 # TP_SHIFT_CNT filterMode = fragmentation, mpshittype, protocol, vlan, port, fcoe filterMask = protocol, fcoe - # TP rx and tx channels (0 = auto). + tp_pmrx = 36, 512 + tp_pmrx_pagesize = 64K + + # TP number of RX channels (0 = auto) tp_nrxch = 0 - tp_ntxch = 0 - # TP rx and tx payload memory (% of the total EDRAM + DDR3). - tp_pmrx = 38, 512 - tp_pmtx = 60, 512 - tp_pmrx_pagesize = 64K + tp_pmtx = 46, 512 tp_pmtx_pagesize = 64K - # cluster, lan, or wan. - tp_tcptuning = lan + # TP number of TX channels (0 = auto) + tp_ntxch = 0 # TP OFLD MTUs tp_mtus = 88, 256, 512, 576, 808, 1024, 1280, 1488, 1500, 2002, 2048, 4096, 4352, 8192, 9000, 9600 + # TP_GLOBAL_CONFIG + reg[0x7d08] = 0x00000800/0x00000800 # set IssFromCplEnable + + # TP_PC_CONFIG + reg[0x7d48] = 0x00000000/0x00000400 # clear EnableFLMError + + # TP_PARA_REG0 + reg[0x7d60] = 0x06000000/0x07000000 # set InitCWND to 6 + + # cluster, lan, or wan. + tp_tcptuning = lan + # MC configuration mc_mode_brc[0] = 1 # mc0 - 1: enable BRC, 0: enable RBC mc_mode_brc[1] = 1 # mc1 - 1: enable BRC, 0: enable RBC @@ -111,10 +136,14 @@ pmask = all # driver will mask off features it won't use - protocol = ofld + protocol = ofld, rddp, rdmac, iscsi_initiator_pdu, iscsi_target_pdu, iscsi_t10dif tp_l2t = 4096 tp_ddp = 2 + tp_ddp_iscsi = 2 + tp_stag = 2 + tp_pbl = 5 + tp_rq = 7 # TCAM has 8K cells; each region must start at a multiple of 128 cell. # Each entry in these categories takes 4 cells each. nhash will use the @@ -186,7 +215,7 @@ [fini] version = 0x1 - checksum = 0x7044b7fd + checksum = 0xebb87494 # # $FreeBSD$ # Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:32:49 2016 (r308312) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:38:26 2016 (r308313) @@ -343,7 +343,8 @@ TUNABLE_INT("hw.cxgbe.nbmcaps_allowed", static int t4_linkcaps_allowed = 0; /* No DCBX, PPP, etc. by default */ TUNABLE_INT("hw.cxgbe.linkcaps_allowed", &t4_linkcaps_allowed); -static int t4_switchcaps_allowed = 0; +static int t4_switchcaps_allowed = FW_CAPS_CONFIG_SWITCH_INGRESS | + FW_CAPS_CONFIG_SWITCH_EGRESS; TUNABLE_INT("hw.cxgbe.switchcaps_allowed", &t4_switchcaps_allowed); static int t4_niccaps_allowed = FW_CAPS_CONFIG_NIC; @@ -352,13 +353,13 @@ TUNABLE_INT("hw.cxgbe.niccaps_allowed", static int t4_toecaps_allowed = -1; TUNABLE_INT("hw.cxgbe.toecaps_allowed", &t4_toecaps_allowed); -static int t4_rdmacaps_allowed = 0; +static int t4_rdmacaps_allowed = -1; TUNABLE_INT("hw.cxgbe.rdmacaps_allowed", &t4_rdmacaps_allowed); static int t4_tlscaps_allowed = 0; TUNABLE_INT("hw.cxgbe.tlscaps_allowed", &t4_tlscaps_allowed); -static int t4_iscsicaps_allowed = 0; +static int t4_iscsicaps_allowed = -1; TUNABLE_INT("hw.cxgbe.iscsicaps_allowed", &t4_iscsicaps_allowed); static int t4_fcoecaps_allowed = 0; @@ -9041,9 +9042,26 @@ tweak_tunables(void) if (t4_toecaps_allowed == -1) t4_toecaps_allowed = FW_CAPS_CONFIG_TOE; + + if (t4_rdmacaps_allowed == -1) { + t4_rdmacaps_allowed = FW_CAPS_CONFIG_RDMA_RDDP | + FW_CAPS_CONFIG_RDMA_RDMAC; + } + + if (t4_iscsicaps_allowed == -1) { + t4_iscsicaps_allowed = FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU | + FW_CAPS_CONFIG_ISCSI_TARGET_PDU | + FW_CAPS_CONFIG_ISCSI_T10DIF; + } #else if (t4_toecaps_allowed == -1) t4_toecaps_allowed = 0; + + if (t4_rdmacaps_allowed == -1) + t4_rdmacaps_allowed = 0; + + if (t4_iscsicaps_allowed == -1) + t4_iscsicaps_allowed = 0; #endif #ifdef DEV_NETMAP From owner-svn-src-stable-10@freebsd.org Fri Nov 4 20:56:30 2016 Return-Path: Delivered-To: svn-src-stable-10@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 0E773C30FD3; Fri, 4 Nov 2016 20:56:30 +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 DF62275B; Fri, 4 Nov 2016 20:56:29 +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 uA4KuTDT023160; Fri, 4 Nov 2016 20:56:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4KuTpv023157; Fri, 4 Nov 2016 20:56:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042056.uA4KuTpv023157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 20:56: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: r308315 - in stable/10/sys/dev/cxgbe: . 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 20:56:30 -0000 Author: jhb Date: Fri Nov 4 20:56:28 2016 New Revision: 308315 URL: https://svnweb.freebsd.org/changeset/base/308315 Log: MFC 296975: cxgbe(4): Tidy up PAUSE frame accounting. Figure out if the chip is counting PAUSE frames in the "normal" stats and take them out if it is. This fixes a bug in the tx stats because the default hardware behavior is different for Tx and Rx but the driver was treating both the same way. The result was that OPACKETS, OBYTES, and OMCASTS were under-reported (if tx_pause > 0) before this change. Note that the mac_stats sysctl still gives you the raw value of these statistics straight from the device registers. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 20:49:59 2016 (r308314) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 20:56:28 2016 (r308315) @@ -5612,6 +5612,7 @@ void t4_get_port_stats_offset(struct ada void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 stat_ctl; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -5619,6 +5620,8 @@ void t4_get_port_stats(struct adapter *a T5_PORT_REG(idx, A_MPS_PORT_STAT_##name##_L))) #define GET_STAT_COM(name) t4_read_reg64(adap, A_MPS_STAT_##name##_L) + stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); + p->tx_pause = GET_STAT(TX_PORT_PAUSE); p->tx_octets = GET_STAT(TX_PORT_BYTES); p->tx_frames = GET_STAT(TX_PORT_FRAMES); @@ -5643,6 +5646,12 @@ void t4_get_port_stats(struct adapter *a p->tx_ppp6 = GET_STAT(TX_PORT_PPP6); p->tx_ppp7 = GET_STAT(TX_PORT_PPP7); + if (stat_ctl & F_COUNTPAUSESTATTX) { + p->tx_frames -= p->tx_pause; + p->tx_octets -= p->tx_pause * 64; + p->tx_mcast_frames -= p->tx_pause; + } + p->rx_pause = GET_STAT(RX_PORT_PAUSE); p->rx_octets = GET_STAT(RX_PORT_BYTES); p->rx_frames = GET_STAT(RX_PORT_FRAMES); @@ -5671,6 +5680,12 @@ void t4_get_port_stats(struct adapter *a p->rx_ppp6 = GET_STAT(RX_PORT_PPP6); p->rx_ppp7 = GET_STAT(RX_PORT_PPP7); + if (stat_ctl & F_COUNTPAUSESTATRX) { + p->rx_frames -= p->rx_pause; + p->rx_octets -= p->rx_pause * 64; + p->rx_mcast_frames -= p->rx_pause; + } + p->rx_ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_MAC_DROP_FRAME) : 0; p->rx_ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_MAC_DROP_FRAME) : 0; p->rx_ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_MAC_DROP_FRAME) : 0; Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:49:59 2016 (r308314) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 20:56:28 2016 (r308315) @@ -4346,12 +4346,12 @@ cxgbe_refresh_stats(struct adapter *sc, t4_get_port_stats(sc, pi->tx_chan, s); - ifp->if_opackets = s->tx_frames - s->tx_pause; - ifp->if_ipackets = s->rx_frames - s->rx_pause; - ifp->if_obytes = s->tx_octets - s->tx_pause * 64; - ifp->if_ibytes = s->rx_octets - s->rx_pause * 64; - ifp->if_omcasts = s->tx_mcast_frames - s->tx_pause; - ifp->if_imcasts = s->rx_mcast_frames - s->rx_pause; + ifp->if_opackets = s->tx_frames; + ifp->if_ipackets = s->rx_frames; + ifp->if_obytes = s->tx_octets; + ifp->if_ibytes = s->rx_octets; + ifp->if_omcasts = s->tx_mcast_frames; + ifp->if_imcasts = s->rx_mcast_frames; ifp->if_iqdrops = s->rx_ovflow0 + s->rx_ovflow1 + s->rx_ovflow2 + s->rx_ovflow3 + s->rx_trunc0 + s->rx_trunc1 + s->rx_trunc2 + s->rx_trunc3; From owner-svn-src-stable-10@freebsd.org Fri Nov 4 21:02:34 2016 Return-Path: Delivered-To: svn-src-stable-10@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 7EFA3C2F278; Fri, 4 Nov 2016 21:02:34 +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 4B326B90; Fri, 4 Nov 2016 21:02:34 +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 uA4L2X6v027021; Fri, 4 Nov 2016 21:02:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4L2XqA027020; Fri, 4 Nov 2016 21:02:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042102.uA4L2XqA027020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 21:02: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: r308316 - stable/10/sys/dev/cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 21:02:34 -0000 Author: jhb Date: Fri Nov 4 21:02:33 2016 New Revision: 308316 URL: https://svnweb.freebsd.org/changeset/base/308316 Log: MFC 297194: cxgbe(4): Be consistent and call ETHER_BPF_MTAP before writing anything to the descriptor ring no matter what path the frame takes within the driver's tx. Modified: stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 20:56:28 2016 (r308315) +++ stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 21:02:33 2016 (r308316) @@ -2362,8 +2362,8 @@ eth_tx(struct mp_ring *r, u_int cidx, u_ } else { total++; remaining--; - n = write_txpkt_wr(txq, (void *)wr, m0, available); ETHER_BPF_MTAP(ifp, m0); + n = write_txpkt_wr(txq, (void *)wr, m0, available); } MPASS(n >= 1 && n <= available && n <= SGE_MAX_WR_NDESC); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 21:43:12 2016 Return-Path: Delivered-To: svn-src-stable-10@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 6E669C2FFB4; Fri, 4 Nov 2016 21:43:12 +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 46529FBE; Fri, 4 Nov 2016 21:43:12 +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 uA4LhBsK042310; Fri, 4 Nov 2016 21:43:11 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4LhATE042305; Fri, 4 Nov 2016 21:43:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042143.uA4LhATE042305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 21:43:10 +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: r308318 - in stable/10/sys: dev/cxgbe dev/cxgbe/tom kern modules/cxgbe/if_cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 21:43:12 -0000 Author: jhb Date: Fri Nov 4 21:43:10 2016 New Revision: 308318 URL: https://svnweb.freebsd.org/changeset/base/308318 Log: MFC 297776,297777,297779: Add DDB commands to cxgbe(4). 297776: Add a function to lookup a device_t object by name. This just walks the global list of devices looking for one with the requested name. The one use case outside of devctl2's implementation is for DDB commands that wish to lookup devices by name. 297777: Add a 'show t4 tcb ' command to dump a TCB from DDB. This allows the contents of a TCB to be extracted from a T4/T5 card in DDB after a panic. 297779: Add a 'show t4 devlog ' DDB command. This command displays the adapter's firmware device log similar to the dev..misc.devlog sysctl. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/tom/t4_ddp.c stable/10/sys/kern/subr_bus.c stable/10/sys/modules/cxgbe/if_cxgbe/Makefile stable/10/sys/sys/bus.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 21:10:02 2016 (r308317) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 21:43:10 2016 (r308318) @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ddb.h" #include "opt_inet.h" #include "opt_inet6.h" @@ -64,6 +65,10 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#ifdef DDB +#include +#include +#endif #include "common/common.h" #include "common/t4_msg.h" @@ -9095,6 +9100,179 @@ tweak_tunables(void) t4_intr_types &= INTR_MSIX | INTR_MSI | INTR_INTX; } +#ifdef DDB +static void +t4_dump_tcb(struct adapter *sc, int tid) +{ + uint32_t base, i, j, off, pf, reg, save, tcb_addr, win_pos; + + reg = PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 2); + save = t4_read_reg(sc, reg); + base = sc->memwin[2].mw_base; + + /* Dump TCB for the tid */ + tcb_addr = t4_read_reg(sc, A_TP_CMM_TCB_BASE); + tcb_addr += tid * TCB_SIZE; + + if (is_t4(sc)) { + pf = 0; + win_pos = tcb_addr & ~0xf; /* start must be 16B aligned */ + } else { + pf = V_PFNUM(sc->pf); + win_pos = tcb_addr & ~0x7f; /* start must be 128B aligned */ + } + t4_write_reg(sc, reg, win_pos | pf); + t4_read_reg(sc, reg); + + off = tcb_addr - win_pos; + for (i = 0; i < 4; i++) { + uint32_t buf[8]; + for (j = 0; j < 8; j++, off += 4) + buf[j] = htonl(t4_read_reg(sc, base + off)); + + db_printf("%08x %08x %08x %08x %08x %08x %08x %08x\n", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], + buf[7]); + } + + t4_write_reg(sc, reg, save); + t4_read_reg(sc, reg); +} + +static void +t4_dump_devlog(struct adapter *sc) +{ + struct devlog_params *dparams = &sc->params.devlog; + struct fw_devlog_e e; + int i, first, j, m, nentries, rc; + uint64_t ftstamp = UINT64_MAX; + + if (dparams->start == 0) { + db_printf("devlog params not valid\n"); + return; + } + + nentries = dparams->size / sizeof(struct fw_devlog_e); + m = fwmtype_to_hwmtype(dparams->memtype); + + /* Find the first entry. */ + first = -1; + for (i = 0; i < nentries && !db_pager_quit; i++) { + rc = -t4_mem_read(sc, m, dparams->start + i * sizeof(e), + sizeof(e), (void *)&e); + if (rc != 0) + break; + + if (e.timestamp == 0) + break; + + e.timestamp = be64toh(e.timestamp); + if (e.timestamp < ftstamp) { + ftstamp = e.timestamp; + first = i; + } + } + + if (first == -1) + return; + + i = first; + do { + rc = -t4_mem_read(sc, m, dparams->start + i * sizeof(e), + sizeof(e), (void *)&e); + if (rc != 0) + return; + + if (e.timestamp == 0) + return; + + e.timestamp = be64toh(e.timestamp); + e.seqno = be32toh(e.seqno); + for (j = 0; j < 8; j++) + e.params[j] = be32toh(e.params[j]); + + db_printf("%10d %15ju %8s %8s ", + e.seqno, e.timestamp, + (e.level < nitems(devlog_level_strings) ? + devlog_level_strings[e.level] : "UNKNOWN"), + (e.facility < nitems(devlog_facility_strings) ? + devlog_facility_strings[e.facility] : "UNKNOWN")); + db_printf(e.fmt, e.params[0], e.params[1], e.params[2], + e.params[3], e.params[4], e.params[5], e.params[6], + e.params[7]); + + if (++i == nentries) + i = 0; + } while (i != first && !db_pager_quit); +} + +static struct command_table db_t4_table = LIST_HEAD_INITIALIZER(db_t4_table); +_DB_SET(_show, t4, NULL, db_show_table, 0, &db_t4_table); + +DB_FUNC(devlog, db_show_devlog, db_t4_table, CS_OWN, NULL) +{ + device_t dev; + int t; + bool valid; + + valid = false; + t = db_read_token(); + if (t == tIDENT) { + dev = device_lookup_by_name(db_tok_string); + valid = true; + } + db_skip_to_eol(); + if (!valid) { + db_printf("usage: show t4 devlog \n"); + return; + } + + if (dev == NULL) { + db_printf("device not found\n"); + return; + } + + t4_dump_devlog(device_get_softc(dev)); +} + +DB_FUNC(tcb, db_show_t4tcb, db_t4_table, CS_OWN, NULL) +{ + device_t dev; + int radix, tid, t; + bool valid; + + valid = false; + radix = db_radix; + db_radix = 10; + t = db_read_token(); + if (t == tIDENT) { + dev = device_lookup_by_name(db_tok_string); + t = db_read_token(); + if (t == tNUMBER) { + tid = db_tok_number; + valid = true; + } + } + db_radix = radix; + db_skip_to_eol(); + if (!valid) { + db_printf("usage: show t4 tcb \n"); + return; + } + + if (dev == NULL) { + db_printf("device not found\n"); + return; + } + if (tid < 0) { + db_printf("invalid tid\n"); + return; + } + + t4_dump_tcb(device_get_softc(dev), tid); +} +#endif + static struct sx mlu; /* mod load unload */ SX_SYSINIT(cxgbe_mlu, &mlu, "cxgbe mod load/unload"); Modified: stable/10/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- stable/10/sys/dev/cxgbe/tom/t4_ddp.c Fri Nov 4 21:10:02 2016 (r308317) +++ stable/10/sys/dev/cxgbe/tom/t4_ddp.c Fri Nov 4 21:43:10 2016 (r308318) @@ -80,31 +80,6 @@ static struct mbuf *get_ddp_mbuf(int len /* XXX: must match A_ULP_RX_TDDP_PSZ */ static int t4_ddp_pgsz[] = {4096, 4096 << 2, 4096 << 4, 4096 << 6}; -#if 0 -static void -t4_dump_tcb(struct adapter *sc, int tid) -{ - uint32_t tcb_base, off, i, j; - - /* Dump TCB for the tid */ - tcb_base = t4_read_reg(sc, A_TP_CMM_TCB_BASE); - t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 2), - tcb_base + tid * TCB_SIZE); - t4_read_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_OFFSET, 2)); - off = 0; - printf("\n"); - for (i = 0; i < 4; i++) { - uint32_t buf[8]; - for (j = 0; j < 8; j++, off += 4) - buf[j] = htonl(t4_read_reg(sc, MEMWIN2_BASE + off)); - - printf("%08x %08x %08x %08x %08x %08x %08x %08x\n", - buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], - buf[7]); - } -} -#endif - #define MAX_DDP_BUFFER_SIZE (M_TCB_RX_DDP_BUF0_LEN) static int alloc_ppods(struct tom_data *td, int n, u_int *ppod_addr) Modified: stable/10/sys/kern/subr_bus.c ============================================================================== --- stable/10/sys/kern/subr_bus.c Fri Nov 4 21:10:02 2016 (r308317) +++ stable/10/sys/kern/subr_bus.c Fri Nov 4 21:43:10 2016 (r308318) @@ -5003,6 +5003,18 @@ bus_free_resource(device_t dev, int type return (bus_release_resource(dev, type, rman_get_rid(r), r)); } +device_t +device_lookup_by_name(const char *name) +{ + device_t dev; + + TAILQ_FOREACH(dev, &bus_data_devices, devlink) { + if (dev->nameunit != NULL && strcmp(dev->nameunit, name) == 0) + return (dev); + } + return (NULL); +} + /* * /dev/devctl2 implementation. The existing /dev/devctl device has * implicit semantics on open, so it could not be reused for this. @@ -5023,12 +5035,10 @@ find_device(struct devreq *req, device_t * Second, try to find an attached device whose name matches * 'name'. */ - TAILQ_FOREACH(dev, &bus_data_devices, devlink) { - if (dev->nameunit != NULL && - strcmp(dev->nameunit, req->dr_name) == 0) { - *devp = dev; - return (0); - } + dev = device_lookup_by_name(req->dr_name); + if (dev != NULL) { + *devp = dev; + return (0); } /* Finally, give device enumerators a chance. */ Modified: stable/10/sys/modules/cxgbe/if_cxgbe/Makefile ============================================================================== --- stable/10/sys/modules/cxgbe/if_cxgbe/Makefile Fri Nov 4 21:10:02 2016 (r308317) +++ stable/10/sys/modules/cxgbe/if_cxgbe/Makefile Fri Nov 4 21:43:10 2016 (r308318) @@ -10,6 +10,7 @@ CXGBE= ${.CURDIR}/../../../dev/cxgbe KMOD= if_cxgbe SRCS= bus_if.h SRCS+= device_if.h +SRCS+= opt_ddb.h SRCS+= opt_inet.h SRCS+= opt_inet6.h SRCS+= opt_ofed.h Modified: stable/10/sys/sys/bus.h ============================================================================== --- stable/10/sys/sys/bus.h Fri Nov 4 21:10:02 2016 (r308317) +++ stable/10/sys/sys/bus.h Fri Nov 4 21:43:10 2016 (r308318) @@ -503,6 +503,7 @@ int device_is_attached(device_t dev); /* int device_is_enabled(device_t dev); int device_is_suspended(device_t dev); int device_is_quiet(device_t dev); +device_t device_lookup_by_name(const char *name); int device_print_prettyname(device_t dev); int device_printf(device_t dev, const char *, ...) __printflike(2, 3); int device_probe(device_t dev); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 21:48:23 2016 Return-Path: Delivered-To: svn-src-stable-10@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 92F83C300E6; Fri, 4 Nov 2016 21:48:23 +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 6217C1FE; Fri, 4 Nov 2016 21:48:23 +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 uA4LmMBO042551; Fri, 4 Nov 2016 21:48:22 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4LmMYg042550; Fri, 4 Nov 2016 21:48:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042148.uA4LmMYg042550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 21:48:22 +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: r308319 - stable/10/sys/dev/cxgbe/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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 21:48:23 -0000 Author: jhb Date: Fri Nov 4 21:48:22 2016 New Revision: 308319 URL: https://svnweb.freebsd.org/changeset/base/308319 Log: MFC 297875: cxgbe(4): Always read the entire mailbox into the reply buffer. The size of the reply can be different from the size of the command in case a debug firmware asserts. fw_asrt() needs the entire reply in order to decode the location of the assert. Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 21:43:10 2016 (r308318) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Fri Nov 4 21:48:22 2016 (r308319) @@ -378,7 +378,7 @@ int t4_wr_mbox_meat_timeout(struct adapt /* * Retrieve the command reply and release the mailbox. */ - get_mbox_rpl(adap, cmd_rpl, size/8, data_reg); + get_mbox_rpl(adap, cmd_rpl, MBOX_LEN/8, data_reg); t4_write_reg(adap, ctl_reg, V_MBOWNER(X_MBOWNER_NONE)); CH_DUMP_MBOX(adap, mbox, data_reg); From owner-svn-src-stable-10@freebsd.org Fri Nov 4 21:52:49 2016 Return-Path: Delivered-To: svn-src-stable-10@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 928CBC30303; Fri, 4 Nov 2016 21:52:49 +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 6133C8E6; Fri, 4 Nov 2016 21:52:49 +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 uA4LqmqS046090; Fri, 4 Nov 2016 21:52:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4LqmsQ046089; Fri, 4 Nov 2016 21:52:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042152.uA4LqmsQ046089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 21:52:48 +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: r308320 - stable/10/sys/dev/cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 21:52:49 -0000 Author: jhb Date: Fri Nov 4 21:52:48 2016 New Revision: 308320 URL: https://svnweb.freebsd.org/changeset/base/308320 Log: MFC 297883: cxgbe(4): Always dispatch all work requests that have been written to the descriptor ring before leaving drain_wrq_wr_list. Modified: stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 21:48:22 2016 (r308319) +++ stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 21:52:48 2016 (r308320) @@ -1750,7 +1750,8 @@ drain_wrq_wr_list(struct adapter *sc, st MPASS(TAILQ_EMPTY(&wrq->incomplete_wrs)); wr = STAILQ_FIRST(&wrq->wr_list); MPASS(wr != NULL); /* Must be called with something useful to do */ - dbdiff = IDXDIFF(eq->pidx, eq->dbidx, eq->sidx); + MPASS(eq->pidx == eq->dbidx); + dbdiff = 0; do { eq->cidx = read_hw_cidx(eq); @@ -1762,7 +1763,7 @@ drain_wrq_wr_list(struct adapter *sc, st MPASS(wr->wrq == wrq); n = howmany(wr->wr_len, EQ_ESIZE); if (available < n) - return; + break; dst = (void *)&eq->desc[eq->pidx]; if (__predict_true(eq->sidx - eq->pidx > n)) { From owner-svn-src-stable-10@freebsd.org Fri Nov 4 21:59:28 2016 Return-Path: Delivered-To: svn-src-stable-10@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 A9A18C30415; Fri, 4 Nov 2016 21:59:28 +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 700DBACD; Fri, 4 Nov 2016 21:59:28 +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 uA4LxR2w046380; Fri, 4 Nov 2016 21:59:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4LxRAL046375; Fri, 4 Nov 2016 21:59:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042159.uA4LxRAL046375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 21:59:27 +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: r308321 - in stable/10: sys/dev/cxgbe tools/tools/cxgbetool 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 21:59:28 -0000 Author: jhb Date: Fri Nov 4 21:59:27 2016 New Revision: 308321 URL: https://svnweb.freebsd.org/changeset/base/308321 Log: MFC 301516,301520,301531,301535,301540,301542,301628: Traffic scheduling updates. 301516: cxgbetool: Allow max-rate > 10Gbps for rate-limited traffic. 301520: cxgbe(4): Create a reusable struct type for scheduling class parameters. 301531: cxgbe(4): Break up set_sched_class. Validate the channel number and min/max rates against their actual limits (which are chip and port specific) instead of hardcoded constants. 301535: cxgbe(4): Track the state of the hardware traffic schedulers in the driver. This works as long as everyone uses set_sched_class_params to program them. 301540: cxgbe(4): Provide information about traffic classes in the sysctl mib. 301542: cxgbe(4): A couple of fixes to set_sched_queue. - Validate the scheduling class against the actual limit (which is chip specific) instead of a magic number. - Return an error if an attempt is made to manipulate the tx queues of a VI that hasn't been initialized. 301628: cxgbe(4): Add a sysctl to manage the binding of a txq to a traffic class. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/t4_ioctl.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c stable/10/tools/tools/cxgbetool/cxgbetool.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 21:52:48 2016 (r308320) +++ stable/10/sys/dev/cxgbe/adapter.h Fri Nov 4 21:59:27 2016 (r308321) @@ -48,6 +48,7 @@ #include #include "offload.h" +#include "t4_ioctl.h" #include "common/t4_msg.h" #include "firmware/t4fw_interface.h" @@ -261,6 +262,17 @@ struct vi_info { uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ }; +enum { + /* tx_sched_class flags */ + TX_SC_OK = (1 << 0), /* Set up in hardware, active. */ +}; + +struct tx_sched_class { + int refcount; + int flags; + struct t4_sched_class_params params; +}; + struct port_info { device_t dev; struct adapter *adapter; @@ -270,6 +282,8 @@ struct port_info { int up_vis; int uld_vis; + struct tx_sched_class *tc; /* traffic classes for this channel */ + struct mtx pi_lock; char lockname[16]; unsigned long flags; @@ -523,6 +537,7 @@ struct sge_txq { struct tx_sdesc *sdesc; /* KVA of software descriptor ring */ struct sglist *gl; __be32 cpl_ctrl0; /* for convenience */ + int tc_idx; /* traffic class */ struct task tx_reclaim_task; /* stats for common events first */ Modified: stable/10/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- stable/10/sys/dev/cxgbe/t4_ioctl.h Fri Nov 4 21:52:48 2016 (r308320) +++ stable/10/sys/dev/cxgbe/t4_ioctl.h Fri Nov 4 21:59:27 2016 (r308321) @@ -215,6 +215,20 @@ struct t4_filter { struct t4_filter_specification fs; }; +/* Tx Scheduling Class parameters */ +struct t4_sched_class_params { + int8_t level; /* scheduler hierarchy level */ + int8_t mode; /* per-class or per-flow */ + int8_t rateunit; /* bit or packet rate */ + int8_t ratemode; /* %port relative or kbps absolute */ + int8_t channel; /* scheduler channel [0..N] */ + int8_t cl; /* scheduler class [0..N] */ + int32_t minrate; /* minimum rate */ + int32_t maxrate; /* maximum rate */ + int16_t weight; /* percent weight */ + int16_t pktsize; /* average packet size */ +}; + /* * Support for "sched-class" command to allow a TX Scheduling Class to be * programmed with various parameters. @@ -226,19 +240,7 @@ struct t4_sched_params { struct { /* sub-command SCHED_CLASS_CONFIG */ int8_t minmax; /* minmax enable */ } config; - struct { /* sub-command SCHED_CLASS_PARAMS */ - int8_t level; /* scheduler hierarchy level */ - int8_t mode; /* per-class or per-flow */ - int8_t rateunit; /* bit or packet rate */ - int8_t ratemode; /* %port relative or kbps - absolute */ - int8_t channel; /* scheduler channel [0..N] */ - int8_t cl; /* scheduler class [0..N] */ - int32_t minrate; /* minimum rate */ - int32_t maxrate; /* maximum rate */ - int16_t weight; /* percent weight */ - int16_t pktsize; /* average packet size */ - } params; + struct t4_sched_class_params params; uint8_t reserved[6 + 8 * 8]; } u; }; Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 21:52:48 2016 (r308320) +++ stable/10/sys/dev/cxgbe/t4_main.c Fri Nov 4 21:59:27 2016 (r308321) @@ -505,6 +505,7 @@ static int sysctl_tp_la(SYSCTL_HANDLER_A static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); static int sysctl_ulprx_la(SYSCTL_HANDLER_ARGS); static int sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_tc_params(SYSCTL_HANDLER_ARGS); #endif #ifdef TCP_OFFLOAD static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); @@ -883,6 +884,9 @@ t4_attach(device_t dev) mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF); sc->chan_map[pi->tx_chan] = i; + pi->tc = malloc(sizeof(struct tx_sched_class) * + sc->chip_params->nsched_cls, M_CXGBE, M_ZERO | M_WAITOK); + if (is_10G_port(pi) || is_40G_port(pi)) { n10g++; } else { @@ -1130,6 +1134,7 @@ t4_detach(device_t dev) mtx_destroy(&pi->pi_lock); free(pi->vi, M_CXGBE); + free(pi->tc, M_CXGBE); free(pi, M_CXGBE); } } @@ -4964,8 +4969,10 @@ cxgbe_sysctls(struct port_info *pi) { struct sysctl_ctx_list *ctx; struct sysctl_oid *oid; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *children2; struct adapter *sc = pi->adapter; + int i; + char name[16]; ctx = device_get_sysctl_ctx(pi->dev); @@ -4994,6 +5001,29 @@ cxgbe_sysctls(struct port_info *pi) port_top_speed(pi), "max speed (in Gbps)"); /* + * dev.(cxgbe|cxl).X.tc. + */ + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "tc", CTLFLAG_RD, NULL, + "Tx scheduler traffic classes"); + for (i = 0; i < sc->chip_params->nsched_cls; i++) { + struct tx_sched_class *tc = &pi->tc[i]; + + snprintf(name, sizeof(name), "%d", i); + children2 = SYSCTL_CHILDREN(SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(oid), OID_AUTO, name, CTLFLAG_RD, NULL, + "traffic class")); + SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "flags", CTLFLAG_RD, + &tc->flags, 0, "flags"); + SYSCTL_ADD_UINT(ctx, children2, OID_AUTO, "refcount", + CTLFLAG_RD, &tc->refcount, 0, "references to this class"); +#ifdef SBUF_DRAIN + SYSCTL_ADD_PROC(ctx, children2, OID_AUTO, "params", + CTLTYPE_STRING | CTLFLAG_RD, sc, (pi->port_id << 16) | i, + sysctl_tc_params, "A", "traffic class parameters"); +#endif + } + + /* * dev.cxgbe.X.stats. */ oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, @@ -7387,6 +7417,101 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS) return (rc); } + +static int +sysctl_tc_params(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct tx_sched_class *tc; + struct t4_sched_class_params p; + struct sbuf *sb; + int i, rc, port_id, flags, mbps, gbps; + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return (rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 4096, req); + if (sb == NULL) + return (ENOMEM); + + port_id = arg2 >> 16; + MPASS(port_id < sc->params.nports); + MPASS(sc->port[port_id] != NULL); + i = arg2 & 0xffff; + MPASS(i < sc->chip_params->nsched_cls); + tc = &sc->port[port_id]->tc[i]; + + rc = begin_synchronized_op(sc, NULL, HOLD_LOCK | SLEEP_OK | INTR_OK, + "t4tc_p"); + if (rc) + goto done; + flags = tc->flags; + p = tc->params; + end_synchronized_op(sc, LOCK_HELD); + + if ((flags & TX_SC_OK) == 0) { + sbuf_printf(sb, "none"); + goto done; + } + + if (p.level == SCHED_CLASS_LEVEL_CL_WRR) { + sbuf_printf(sb, "cl-wrr weight %u", p.weight); + goto done; + } else if (p.level == SCHED_CLASS_LEVEL_CL_RL) + sbuf_printf(sb, "cl-rl"); + else if (p.level == SCHED_CLASS_LEVEL_CH_RL) + sbuf_printf(sb, "ch-rl"); + else { + rc = ENXIO; + goto done; + } + + if (p.ratemode == SCHED_CLASS_RATEMODE_REL) { + /* XXX: top speed or actual link speed? */ + gbps = port_top_speed(sc->port[port_id]); + sbuf_printf(sb, " %u%% of %uGbps", p.maxrate, gbps); + } + else if (p.ratemode == SCHED_CLASS_RATEMODE_ABS) { + switch (p.rateunit) { + case SCHED_CLASS_RATEUNIT_BITS: + mbps = p.maxrate / 1000; + gbps = p.maxrate / 1000000; + if (p.maxrate == gbps * 1000000) + sbuf_printf(sb, " %uGbps", gbps); + else if (p.maxrate == mbps * 1000) + sbuf_printf(sb, " %uMbps", mbps); + else + sbuf_printf(sb, " %uKbps", p.maxrate); + break; + case SCHED_CLASS_RATEUNIT_PKTS: + sbuf_printf(sb, " %upps", p.maxrate); + break; + default: + rc = ENXIO; + goto done; + } + } + + switch (p.mode) { + case SCHED_CLASS_MODE_CLASS: + sbuf_printf(sb, " aggregate"); + break; + case SCHED_CLASS_MODE_FLOW: + sbuf_printf(sb, " per-flow"); + break; + default: + rc = ENXIO; + goto done; + } + +done: + if (rc == 0) + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} #endif #ifdef TCP_OFFLOAD @@ -8232,155 +8357,147 @@ in_range(int val, int lo, int hi) } static int -set_sched_class(struct adapter *sc, struct t4_sched_params *p) +set_sched_class_config(struct adapter *sc, int minmax) { - int fw_subcmd, fw_type, rc; + int rc; + + if (minmax < 0) + return (EINVAL); - rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setsc"); + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4sscc"); if (rc) return (rc); + rc = -t4_sched_config(sc, FW_SCHED_TYPE_PKTSCHED, minmax, 1); + end_synchronized_op(sc, 0); - if (!(sc->flags & FULL_INIT_DONE)) { - rc = EAGAIN; - goto done; - } + return (rc); +} - /* - * Translate the cxgbetool parameters into T4 firmware parameters. (The - * sub-command and type are in common locations.) - */ - if (p->subcmd == SCHED_CLASS_SUBCMD_CONFIG) - fw_subcmd = FW_SCHED_SC_CONFIG; - else if (p->subcmd == SCHED_CLASS_SUBCMD_PARAMS) - fw_subcmd = FW_SCHED_SC_PARAMS; - else { - rc = EINVAL; - goto done; - } - if (p->type == SCHED_CLASS_TYPE_PACKET) - fw_type = FW_SCHED_TYPE_PKTSCHED; - else { - rc = EINVAL; - goto done; - } +static int +set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, + int sleep_ok) +{ + int rc, top_speed, fw_level, fw_mode, fw_rateunit, fw_ratemode; + struct port_info *pi; + struct tx_sched_class *tc; - if (fw_subcmd == FW_SCHED_SC_CONFIG) { - /* Vet our parameters ..*/ - if (p->u.config.minmax < 0) { - rc = EINVAL; - goto done; - } + if (p->level == SCHED_CLASS_LEVEL_CL_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_RL; + else if (p->level == SCHED_CLASS_LEVEL_CL_WRR) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_WRR; + else if (p->level == SCHED_CLASS_LEVEL_CH_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CH_RL; + else + return (EINVAL); - /* And pass the request to the firmware ...*/ - rc = -t4_sched_config(sc, fw_type, p->u.config.minmax, 1); - goto done; - } + if (p->mode == SCHED_CLASS_MODE_CLASS) + fw_mode = FW_SCHED_PARAMS_MODE_CLASS; + else if (p->mode == SCHED_CLASS_MODE_FLOW) + fw_mode = FW_SCHED_PARAMS_MODE_FLOW; + else + return (EINVAL); - if (fw_subcmd == FW_SCHED_SC_PARAMS) { - int fw_level; - int fw_mode; - int fw_rateunit; - int fw_ratemode; - - if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL) - fw_level = FW_SCHED_PARAMS_LEVEL_CL_RL; - else if (p->u.params.level == SCHED_CLASS_LEVEL_CL_WRR) - fw_level = FW_SCHED_PARAMS_LEVEL_CL_WRR; - else if (p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) - fw_level = FW_SCHED_PARAMS_LEVEL_CH_RL; - else { - rc = EINVAL; - goto done; - } + if (p->rateunit == SCHED_CLASS_RATEUNIT_BITS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; + else if (p->rateunit == SCHED_CLASS_RATEUNIT_PKTS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_PKTRATE; + else + return (EINVAL); - if (p->u.params.mode == SCHED_CLASS_MODE_CLASS) - fw_mode = FW_SCHED_PARAMS_MODE_CLASS; - else if (p->u.params.mode == SCHED_CLASS_MODE_FLOW) - fw_mode = FW_SCHED_PARAMS_MODE_FLOW; - else { - rc = EINVAL; - goto done; - } + if (p->ratemode == SCHED_CLASS_RATEMODE_REL) + fw_ratemode = FW_SCHED_PARAMS_RATE_REL; + else if (p->ratemode == SCHED_CLASS_RATEMODE_ABS) + fw_ratemode = FW_SCHED_PARAMS_RATE_ABS; + else + return (EINVAL); - if (p->u.params.rateunit == SCHED_CLASS_RATEUNIT_BITS) - fw_rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; - else if (p->u.params.rateunit == SCHED_CLASS_RATEUNIT_PKTS) - fw_rateunit = FW_SCHED_PARAMS_UNIT_PKTRATE; - else { - rc = EINVAL; - goto done; - } + /* Vet our parameters ... */ + if (!in_range(p->channel, 0, sc->chip_params->nchan - 1)) + return (ERANGE); - if (p->u.params.ratemode == SCHED_CLASS_RATEMODE_REL) - fw_ratemode = FW_SCHED_PARAMS_RATE_REL; - else if (p->u.params.ratemode == SCHED_CLASS_RATEMODE_ABS) - fw_ratemode = FW_SCHED_PARAMS_RATE_ABS; - else { - rc = EINVAL; - goto done; - } + pi = sc->port[sc->chan_map[p->channel]]; + if (pi == NULL) + return (ENXIO); + MPASS(pi->tx_chan == p->channel); + top_speed = port_top_speed(pi) * 1000000; /* Gbps -> Kbps */ - /* Vet our parameters ... */ - if (!in_range(p->u.params.channel, 0, 3) || - !in_range(p->u.params.cl, 0, sc->chip_params->nsched_cls) || - !in_range(p->u.params.minrate, 0, 10000000) || - !in_range(p->u.params.maxrate, 0, 10000000) || - !in_range(p->u.params.weight, 0, 100)) { - rc = ERANGE; - goto done; - } + if (!in_range(p->cl, 0, sc->chip_params->nsched_cls) || + !in_range(p->minrate, 0, top_speed) || + !in_range(p->maxrate, 0, top_speed) || + !in_range(p->weight, 0, 100)) + return (ERANGE); + + /* + * Translate any unset parameters into the firmware's + * nomenclature and/or fail the call if the parameters + * are required ... + */ + if (p->rateunit < 0 || p->ratemode < 0 || p->channel < 0 || p->cl < 0) + return (EINVAL); + + if (p->minrate < 0) + p->minrate = 0; + if (p->maxrate < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_RL || + p->level == SCHED_CLASS_LEVEL_CH_RL) + return (EINVAL); + else + p->maxrate = 0; + } + if (p->weight < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_WRR) + return (EINVAL); + else + p->weight = 0; + } + if (p->pktsize < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_RL || + p->level == SCHED_CLASS_LEVEL_CH_RL) + return (EINVAL); + else + p->pktsize = 0; + } + rc = begin_synchronized_op(sc, NULL, + sleep_ok ? (SLEEP_OK | INTR_OK) : HOLD_LOCK, "t4sscp"); + if (rc) + return (rc); + tc = &pi->tc[p->cl]; + tc->params = *p; + rc = -t4_sched_params(sc, FW_SCHED_TYPE_PKTSCHED, fw_level, fw_mode, + fw_rateunit, fw_ratemode, p->channel, p->cl, p->minrate, p->maxrate, + p->weight, p->pktsize, sleep_ok); + if (rc == 0) + tc->flags |= TX_SC_OK; + else { /* - * Translate any unset parameters into the firmware's - * nomenclature and/or fail the call if the parameters - * are required ... + * Unknown state at this point, see tc->params for what was + * attempted. */ - if (p->u.params.rateunit < 0 || p->u.params.ratemode < 0 || - p->u.params.channel < 0 || p->u.params.cl < 0) { - rc = EINVAL; - goto done; - } - if (p->u.params.minrate < 0) - p->u.params.minrate = 0; - if (p->u.params.maxrate < 0) { - if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL || - p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) { - rc = EINVAL; - goto done; - } else - p->u.params.maxrate = 0; - } - if (p->u.params.weight < 0) { - if (p->u.params.level == SCHED_CLASS_LEVEL_CL_WRR) { - rc = EINVAL; - goto done; - } else - p->u.params.weight = 0; - } - if (p->u.params.pktsize < 0) { - if (p->u.params.level == SCHED_CLASS_LEVEL_CL_RL || - p->u.params.level == SCHED_CLASS_LEVEL_CH_RL) { - rc = EINVAL; - goto done; - } else - p->u.params.pktsize = 0; - } - - /* See what the firmware thinks of the request ... */ - rc = -t4_sched_params(sc, fw_type, fw_level, fw_mode, - fw_rateunit, fw_ratemode, p->u.params.channel, - p->u.params.cl, p->u.params.minrate, p->u.params.maxrate, - p->u.params.weight, p->u.params.pktsize, 1); - goto done; + tc->flags &= ~TX_SC_OK; } + end_synchronized_op(sc, sleep_ok ? 0 : LOCK_HELD); - rc = EINVAL; -done: - end_synchronized_op(sc, 0); return (rc); } static int +set_sched_class(struct adapter *sc, struct t4_sched_params *p) +{ + + if (p->type != SCHED_CLASS_TYPE_PACKET) + return (EINVAL); + + if (p->subcmd == SCHED_CLASS_SUBCMD_CONFIG) + return (set_sched_class_config(sc, p->u.config.minmax)); + + if (p->subcmd == SCHED_CLASS_SUBCMD_PARAMS) + return (set_sched_class_params(sc, &p->u.params, 1)); + + return (EINVAL); +} + +static int set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) { struct port_info *pi = NULL; @@ -8393,11 +8510,6 @@ set_sched_queue(struct adapter *sc, stru if (rc) return (rc); - if (!(sc->flags & FULL_INIT_DONE)) { - rc = EAGAIN; - goto done; - } - if (p->port >= sc->params.nports) { rc = EINVAL; goto done; @@ -8406,7 +8518,14 @@ set_sched_queue(struct adapter *sc, stru /* XXX: Only supported for the main VI. */ pi = sc->port[p->port]; vi = &pi->vi[0]; - if (!in_range(p->queue, 0, vi->ntxq - 1) || !in_range(p->cl, 0, 7)) { + if (!(vi->flags & VI_INIT_DONE)) { + /* tx queues not set up yet */ + rc = EAGAIN; + goto done; + } + + if (!in_range(p->queue, 0, vi->ntxq - 1) || + !in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) { rc = EINVAL; goto done; } Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 21:52:48 2016 (r308320) +++ stable/10/sys/dev/cxgbe/t4_sge.c Fri Nov 4 21:59:27 2016 (r308321) @@ -247,6 +247,7 @@ static void drain_wrq_wr_list(struct ada static int sysctl_uint16(SYSCTL_HANDLER_ARGS); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); +static int sysctl_tc(SYSCTL_HANDLER_ARGS); static counter_u64_t extfree_refs; static counter_u64_t extfree_rels; @@ -3458,6 +3459,7 @@ alloc_txq(struct vi_info *vi, struct sge txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_VF_VLD(1) | V_TXPKT_VF(vi->viid)); + txq->tc_idx = -1; txq->sdesc = malloc(eq->sidx * sizeof(struct tx_sdesc), M_CXGBE, M_ZERO | M_WAITOK); @@ -3475,6 +3477,10 @@ alloc_txq(struct vi_info *vi, struct sge CTLTYPE_INT | CTLFLAG_RD, &eq->pidx, 0, sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "tc", + CTLTYPE_INT | CTLFLAG_RW, vi, idx, sysctl_tc, "I", + "traffic class (-1 means none)"); + SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "txcsum", CTLFLAG_RD, &txq->txcsum, "# of times hardware assisted with checksum"); SYSCTL_ADD_UQUAD(&vi->ctx, children, OID_AUTO, "vlan_insertion", @@ -4708,3 +4714,78 @@ sysctl_bufsizes(SYSCTL_HANDLER_ARGS) sbuf_delete(&sb); return (rc); } + +static int +sysctl_tc(SYSCTL_HANDLER_ARGS) +{ + struct vi_info *vi = arg1; + struct port_info *pi; + struct adapter *sc; + struct sge_txq *txq; + struct tx_sched_class *tc; + int qidx = arg2, rc, tc_idx; + uint32_t fw_queue, fw_class; + + MPASS(qidx >= 0 && qidx < vi->ntxq); + pi = vi->pi; + sc = pi->adapter; + txq = &sc->sge.txq[vi->first_txq + qidx]; + + tc_idx = txq->tc_idx; + rc = sysctl_handle_int(oidp, &tc_idx, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + + /* Note that -1 is legitimate input (it means unbind). */ + if (tc_idx < -1 || tc_idx >= sc->chip_params->nsched_cls) + return (EINVAL); + + rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4stc"); + if (rc) + return (rc); + + if (tc_idx == txq->tc_idx) { + rc = 0; /* No change, nothing to do. */ + goto done; + } + + fw_queue = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH) | + V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id); + + if (tc_idx == -1) + fw_class = 0xffffffff; /* Unbind. */ + else { + /* + * Bind to a different class. Ethernet txq's are only allowed + * to bind to cl-rl mode-class for now. XXX: too restrictive. + */ + tc = &pi->tc[tc_idx]; + if (tc->flags & TX_SC_OK && + tc->params.level == SCHED_CLASS_LEVEL_CL_RL && + tc->params.mode == SCHED_CLASS_MODE_CLASS) { + /* Ok to proceed. */ + fw_class = tc_idx; + } else { + rc = tc->flags & TX_SC_OK ? EBUSY : ENXIO; + goto done; + } + } + + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, &fw_class); + if (rc == 0) { + if (txq->tc_idx != -1) { + tc = &pi->tc[txq->tc_idx]; + MPASS(tc->refcount > 0); + tc->refcount--; + } + if (tc_idx != -1) { + tc = &pi->tc[tc_idx]; + tc->refcount++; + } + txq->tc_idx = tc_idx; + } +done: + end_synchronized_op(sc, 0); + return (rc); +} Modified: stable/10/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- stable/10/tools/tools/cxgbetool/cxgbetool.c Fri Nov 4 21:52:48 2016 (r308320) +++ stable/10/tools/tools/cxgbetool/cxgbetool.c Fri Nov 4 21:59:27 2016 (r308321) @@ -2526,9 +2526,9 @@ sched_class(int argc, const char *argv[] errs++; } if (op.u.params.ratemode == SCHED_CLASS_RATEMODE_ABS && - !in_range(op.u.params.maxrate, 1, 10000000)) { + !in_range(op.u.params.maxrate, 1, 100000000)) { warnx("sched params \"max-rate\" takes " - "value(1-10000000) for rate-mode absolute"); + "value(1-100000000) for rate-mode absolute"); errs++; } if (op.u.params.maxrate > 0 && From owner-svn-src-stable-10@freebsd.org Fri Nov 4 22:03:43 2016 Return-Path: Delivered-To: svn-src-stable-10@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 00166C305D0; Fri, 4 Nov 2016 22:03:42 +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 C5962ED7; Fri, 4 Nov 2016 22:03:42 +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 uA4M3gqP050144; Fri, 4 Nov 2016 22:03:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA4M3gp7050143; Fri, 4 Nov 2016 22:03:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611042203.uA4M3gp7050143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Nov 2016 22:03: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: r308322 - stable/10/sys/dev/cxgbe 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2016 22:03:43 -0000 Author: jhb Date: Fri Nov 4 22:03:41 2016 New Revision: 308322 URL: https://svnweb.freebsd.org/changeset/base/308322 Log: MFC 302313: cxgbe(4): Avoid a NULL dereference while dumping the L2 table. Entries used by switching filters that rewrite L2 information do not have any associated ifnet. Modified: stable/10/sys/dev/cxgbe/t4_l2t.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/t4_l2t.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_l2t.c Fri Nov 4 21:59:27 2016 (r308321) +++ stable/10/sys/dev/cxgbe/t4_l2t.c Fri Nov 4 22:03:41 2016 (r308322) @@ -306,7 +306,6 @@ sysctl_l2t(SYSCTL_HANDLER_ARGS) } /* - * XXX: e->ifp may not be around. * XXX: IPv6 addresses may not align properly in the output. */ sbuf_printf(sb, "\n%4u %-15s %02x:%02x:%02x:%02x:%02x:%02x %4d" @@ -315,7 +314,7 @@ sysctl_l2t(SYSCTL_HANDLER_ARGS) e->dmac[3], e->dmac[4], e->dmac[5], e->vlan & 0xfff, vlan_prio(e), e->lport, l2e_state(e), atomic_load_acq_int(&e->refcnt), - e->ifp->if_xname); + e->ifp ? e->ifp->if_xname : "-"); skip: mtx_unlock(&e->lock); } From owner-svn-src-stable-10@freebsd.org Sat Nov 5 10:22:52 2016 Return-Path: Delivered-To: svn-src-stable-10@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 D7ACCC2FC7B; Sat, 5 Nov 2016 10:22: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 8F4F18DB; Sat, 5 Nov 2016 10:22:52 +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 uA5AMpjO033692; Sat, 5 Nov 2016 10:22:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA5AMp3Y033691; Sat, 5 Nov 2016 10:22:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611051022.uA5AMp3Y033691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 5 Nov 2016 10:22: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: r308332 - stable/10/sys/vm 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2016 10:22:52 -0000 Author: kib Date: Sat Nov 5 10:22:51 2016 New Revision: 308332 URL: https://svnweb.freebsd.org/changeset/base/308332 Log: MFC r308094: Add unlock_vp() helper. MFC r308095 (by markj): Add one more use of unlock_vp(). Modified: stable/10/sys/vm/vm_fault.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_fault.c ============================================================================== --- stable/10/sys/vm/vm_fault.c Sat Nov 5 10:09:21 2016 (r308331) +++ stable/10/sys/vm/vm_fault.c Sat Nov 5 10:22:51 2016 (r308332) @@ -153,6 +153,16 @@ unlock_map(struct faultstate *fs) } static void +unlock_vp(struct faultstate *fs) +{ + + if (fs->vp != NULL) { + vput(fs->vp); + fs->vp = NULL; + } +} + +static void unlock_and_deallocate(struct faultstate *fs) { @@ -168,11 +178,8 @@ unlock_and_deallocate(struct faultstate fs->first_m = NULL; } vm_object_deallocate(fs->first_object); - unlock_map(fs); - if (fs->vp != NULL) { - vput(fs->vp); - fs->vp = NULL; - } + unlock_map(fs); + unlock_vp(fs); } static void @@ -320,8 +327,7 @@ RetryFault:; growstack = FALSE; goto RetryFault; } - if (fs.vp != NULL) - vput(fs.vp); + unlock_vp(&fs); return (result); } @@ -338,10 +344,7 @@ RetryFault:; vm_map_lock(fs.map); if (vm_map_lookup_entry(fs.map, vaddr, &fs.entry) && (fs.entry->eflags & MAP_ENTRY_IN_TRANSITION)) { - if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); fs.entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP; vm_map_unlock_and_wait(fs.map, 0); } else @@ -628,10 +631,7 @@ readrest: vp = fs.object->handle; if (vp == fs.vp) goto vnode_locked; - else if (fs.vp != NULL) { - vput(fs.vp); - fs.vp = NULL; - } + unlock_vp(&fs); locked = VOP_ISLOCKED(vp); if (locked != LK_EXCLUSIVE) From owner-svn-src-stable-10@freebsd.org Sat Nov 5 17:02:40 2016 Return-Path: Delivered-To: svn-src-stable-10@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 40B82AF742A; Sat, 5 Nov 2016 17:02:40 +0000 (UTC) (envelope-from cy@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 1B260B8B; Sat, 5 Nov 2016 17:02:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA5H2dXs090100; Sat, 5 Nov 2016 17:02:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA5H2dh8090097; Sat, 5 Nov 2016 17:02:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201611051702.uA5H2dh8090097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 5 Nov 2016 17:02: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: r308346 - in stable: 10/usr.sbin/amd 10/usr.sbin/amd/amd 10/usr.sbin/amd/libamu 11/usr.sbin/amd 11/usr.sbin/amd/amd 11/usr.sbin/amd/libamu 9/usr.sbin/amd 9/usr.sbin/amd/amd 9/usr.sbin/a... 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2016 17:02:40 -0000 Author: cy Date: Sat Nov 5 17:02:38 2016 New Revision: 308346 URL: https://svnweb.freebsd.org/changeset/base/308346 Log: MFC r307800, r307801 r307800: Sources from the "current" build tree and generated sources in the object tree should be used instead of sources and headers from the already installed source tree on the build host. This was noticed while addressing issues in the upcoming amd update. r307801: Align whitespace. r307801 is related to r307800 however it was a separate commit to HEAD in order to maintain a separation between the functional change and a correction of style. Modified: stable/10/usr.sbin/amd/Makefile.inc stable/10/usr.sbin/amd/amd/Makefile stable/10/usr.sbin/amd/libamu/Makefile Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/amd/Makefile.inc stable/11/usr.sbin/amd/amd/Makefile stable/11/usr.sbin/amd/libamu/Makefile stable/9/usr.sbin/amd/Makefile.inc stable/9/usr.sbin/amd/amd/Makefile stable/9/usr.sbin/amd/libamu/Makefile Directory Properties: stable/11/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/amd/ (props changed) Modified: stable/10/usr.sbin/amd/Makefile.inc ============================================================================== --- stable/10/usr.sbin/amd/Makefile.inc Sat Nov 5 16:30:42 2016 (r308345) +++ stable/10/usr.sbin/amd/Makefile.inc Sat Nov 5 17:02:38 2016 (r308346) @@ -37,8 +37,8 @@ LIBAMUDIR= ${.CURDIR}/../libamu LIBAMU= ${LIBAMUDIR}/libamu.a RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -MOUNT_X= ${DESTDIR}/usr/include/rpcsvc/mount.x -NFS_PROT_X= ${DESTDIR}/usr/include/rpcsvc/nfs_prot.x +MOUNT_X= ${SRCTOP}/include/rpcsvc/mount.x +NFS_PROT_X= ${SRCTOP}/include/rpcsvc/nfs_prot.x WARNS?= 1 Modified: stable/10/usr.sbin/amd/amd/Makefile ============================================================================== --- stable/10/usr.sbin/amd/amd/Makefile Sat Nov 5 16:30:42 2016 (r308345) +++ stable/10/usr.sbin/amd/amd/Makefile Sat Nov 5 17:02:38 2016 (r308346) @@ -25,14 +25,14 @@ SRCS+= ops_unionfs.c opts.c readdir.c re SRCS+= srvr_amfs_auto.c srvr_nfs.c CFLAGS+= -I${.CURDIR}/../../../contrib/amd/amd \ - -I${DESTDIR}/usr/include/rpcsvc + -I${.OBJDIR}/../../../include/rpcsvc DPADD= ${LIBAMU} ${LIBWRAP} LDADD= ${LIBAMU} -lwrap CLEANFILES+= conf_parse.c conf_parse.h conf_tok.c -conf_tok.o: conf_parse.h +conf_tok.o: conf_parse.h # These are generated at compile time SRCS+= mount_xdr.c Modified: stable/10/usr.sbin/amd/libamu/Makefile ============================================================================== --- stable/10/usr.sbin/amd/libamu/Makefile Sat Nov 5 16:30:42 2016 (r308345) +++ stable/10/usr.sbin/amd/libamu/Makefile Sat Nov 5 17:02:38 2016 (r308346) @@ -23,7 +23,7 @@ SRCS+= nfs_prot_x.c xdr_func_%undef.c CLEANFILES+= nfs_prot_x.c xdr_func_%undef.c CFLAGS+= -I${.CURDIR}/../../../contrib/amd/libamu \ - -I${DESTDIR}/usr/include/rpcsvc + -I${.OBJDIR}/../../../include/rpcsvc nfs_prot_x.c: ${NFS_PROT_X} ${RPCCOM} -c -C -DWANT_NFS3 ${NFS_PROT_X} -o ${.TARGET} From owner-svn-src-stable-10@freebsd.org Sat Nov 5 20:14:24 2016 Return-Path: Delivered-To: svn-src-stable-10@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 D90CBAF7779; Sat, 5 Nov 2016 20:14:24 +0000 (UTC) (envelope-from markj@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 9075A21C; Sat, 5 Nov 2016 20:14:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA5KENkb068217; Sat, 5 Nov 2016 20:14:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA5KENgg068214; Sat, 5 Nov 2016 20:14:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201611052014.uA5KENgg068214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 5 Nov 2016 20:14: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: r308349 - stable/10/sys/vm 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Nov 2016 20:14:25 -0000 Author: markj Date: Sat Nov 5 20:14:23 2016 New Revision: 308349 URL: https://svnweb.freebsd.org/changeset/base/308349 Log: MFC r304053, r304054: Initialize busy lock state and strengthen busy lock assertions. Tested by: Oliver Pinter Modified: stable/10/sys/vm/vm_page.c stable/10/sys/vm/vm_phys.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_page.c ============================================================================== --- stable/10/sys/vm/vm_page.c Sat Nov 5 19:51:13 2016 (r308348) +++ stable/10/sys/vm/vm_page.c Sat Nov 5 20:14:23 2016 (r308349) @@ -1574,8 +1574,7 @@ vm_page_alloc(vm_object_t object, vm_pin ("vm_page_alloc: page %p has unexpected queue %d", m, m->queue)); KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); - KASSERT(!vm_page_sbusied(m), - ("vm_page_alloc: page %p is busy", m)); + KASSERT(!vm_page_busied(m), ("vm_page_alloc: page %p is busy", m)); KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, ("vm_page_alloc: page %p has unexpected memattr %d", m, @@ -1887,7 +1886,7 @@ vm_page_alloc_init(vm_page_t m) ("vm_page_alloc_init: page %p is wired", m)); KASSERT(m->hold_count == 0, ("vm_page_alloc_init: page %p is held", m)); - KASSERT(!vm_page_sbusied(m), + KASSERT(!vm_page_busied(m), ("vm_page_alloc_init: page %p is busy", m)); KASSERT(m->dirty == 0, ("vm_page_alloc_init: page %p is dirty", m)); Modified: stable/10/sys/vm/vm_phys.c ============================================================================== --- stable/10/sys/vm/vm_phys.c Sat Nov 5 19:51:13 2016 (r308348) +++ stable/10/sys/vm/vm_phys.c Sat Nov 5 20:14:23 2016 (r308349) @@ -504,6 +504,7 @@ vm_phys_add_page(vm_paddr_t pa) cnt.v_page_count++; m = vm_phys_paddr_to_vm_page(pa); + m->busy_lock = VPB_UNBUSIED; m->phys_addr = pa; m->queue = PQ_NONE; m->segind = vm_phys_paddr_to_segind(pa);