From owner-svn-src-stable@freebsd.org Sun Oct 14 01:16:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A5C110B95E0; Sun, 14 Oct 2018 01:16:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E1E3F71614; Sun, 14 Oct 2018 01:16:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCB4E16F62; Sun, 14 Oct 2018 01:16:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9E1GmcG038912; Sun, 14 Oct 2018 01:16:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9E1GmAE038911; Sun, 14 Oct 2018 01:16:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201810140116.w9E1GmAE038911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 14 Oct 2018 01:16:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339353 - stable/11/gnu/usr.bin/binutils/libbfd X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/gnu/usr.bin/binutils/libbfd X-SVN-Commit-Revision: 339353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Oct 2018 01:16:49 -0000 Author: emaste Date: Sun Oct 14 01:16:48 2018 New Revision: 339353 URL: https://svnweb.freebsd.org/changeset/base/339353 Log: MFC r336027 (andrew): Teach binutils that arm64 is a 64bit architecture. This is needed to cross build from arm64 to other architectures that use binutils. Modified: stable/11/gnu/usr.bin/binutils/libbfd/bfd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/gnu/usr.bin/binutils/libbfd/bfd.h ============================================================================== --- stable/11/gnu/usr.bin/binutils/libbfd/bfd.h Sun Oct 14 00:29:57 2018 (r339352) +++ stable/11/gnu/usr.bin/binutils/libbfd/bfd.h Sun Oct 14 01:16:48 2018 (r339353) @@ -85,7 +85,7 @@ extern "C" { #define BFD_HOST_64BIT_LONG 0 #define BFD_HOST_64_BIT long long #define BFD_HOST_U_64_BIT unsigned long long -#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) +#elif defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__aarch64__) #define BFD_HOST_64BIT_LONG 1 #define BFD_HOST_64_BIT long #define BFD_HOST_U_64_BIT unsigned long From owner-svn-src-stable@freebsd.org Mon Oct 15 10:50:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9791B10D70F5; Mon, 15 Oct 2018 10:50:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8EC8F23C; Mon, 15 Oct 2018 10:50:05 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 485E342E1; Mon, 15 Oct 2018 10:50:05 +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 w9FAo5DK078470; Mon, 15 Oct 2018 10:50:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9FAo5ST078469; Mon, 15 Oct 2018 10:50:05 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201810151050.w9FAo5ST078469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 15 Oct 2018 10:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339359 - stable/11/lib/libc/stdtime X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/stdtime X-SVN-Commit-Revision: 339359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2018 10:50:05 -0000 Author: kib Date: Mon Oct 15 10:50:04 2018 New Revision: 339359 URL: https://svnweb.freebsd.org/changeset/base/339359 Log: MFC r339241: Disallow zero day of month from strptime("%d"). PR: 232072 Modified: stable/11/lib/libc/stdtime/strptime.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/stdtime/strptime.c ============================================================================== --- stable/11/lib/libc/stdtime/strptime.c Mon Oct 15 10:29:29 2018 (r339358) +++ stable/11/lib/libc/stdtime/strptime.c Mon Oct 15 10:50:04 2018 (r339359) @@ -417,7 +417,7 @@ label: i += *buf - '0'; len--; } - if (i > 31) + if (i == 0 || i > 31) return (NULL); tm->tm_mday = i; From owner-svn-src-stable@freebsd.org Tue Oct 16 19:26:05 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B347210DEE2E; Tue, 16 Oct 2018 19:26:05 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EF8C7B6F2; Tue, 16 Oct 2018 19:26:05 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59E2520E84; Tue, 16 Oct 2018 19:26:05 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9GJQ516089093; Tue, 16 Oct 2018 19:26:05 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9GJQ4f1089091; Tue, 16 Oct 2018 19:26:04 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810161926.w9GJQ4f1089091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 16 Oct 2018 19:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339389 - stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 339389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 19:26:05 -0000 Author: np Date: Tue Oct 16 19:26:04 2018 New Revision: 339389 URL: https://svnweb.freebsd.org/changeset/base/339389 Log: MFC r327254, r327904, and r328994. r327254: cxgbe/iw_cxgbe: Fix iWARP over VLANs (catch up with r326169). r327904: cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc. r328994: iw_cxgbe: Remove declaration of a function that no longer exists. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Tue Oct 16 18:47:13 2018 (r339388) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Tue Oct 16 19:26:04 2018 (r339389) @@ -337,24 +337,28 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep, { struct adapter *adap = NULL; struct c4iw_listen_ep *lep = NULL; - struct sockaddr_storage remote = { 0 }; - struct ifnet *new_conn_ifp = NULL; + struct ifnet *ifp = NULL, *hw_ifp = NULL; struct listen_port_info *port_info = NULL; - int err = 0, i = 0, - found_portinfo = 0, found_lep = 0; + int i = 0, found_portinfo = 0, found_lep = 0; uint16_t port; - /* STEP 1: get 'ifnet' based on socket's remote address */ - GET_REMOTE_ADDR(&remote, so); + /* + * STEP 1: Figure out 'ifp' of the physical interface, not pseudo + * interfaces like vlan, lagg, etc.. + * TBD: lagg support, lagg + vlan support. + */ + ifp = TOEPCB(so)->l2te->ifp; + if (ifp->if_type == IFT_L2VLAN) { + hw_ifp = VLAN_TRUNKDEV(ifp); + if (hw_ifp == NULL) { + CTR4(KTR_IW_CXGBE, "%s: Failed to get parent ifnet of " + "vlan ifnet %p, sock %p, master_lep %p", + __func__, ifp, so, master_lep); + return (NULL); + } + } else + hw_ifp = ifp; - err = get_ifnet_from_raddr(&remote, &new_conn_ifp); - if (err) { - CTR4(KTR_IW_CXGBE, "%s: Failed to get ifnet, sock %p, " - "master_lep %p err %d", - __func__, so, master_lep, err); - return (NULL); - } - /* STEP 2: Find 'port_info' with listener local port address. */ port = (master_lep->com.local_addr.ss_family == AF_INET) ? ((struct sockaddr_in *)&master_lep->com.local_addr)->sin_port : @@ -377,7 +381,7 @@ find_real_listen_ep(struct c4iw_listen_ep *master_lep, list_for_each_entry(lep, &port_info->lep_list, listen_ep_list) { adap = lep->com.dev->rdev.adap; for_each_port(adap, i) { - if (new_conn_ifp == adap->port[i]->vi[0].ifp) { + if (hw_ifp == adap->port[i]->vi[0].ifp) { found_lep =1; goto out; } Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Oct 16 18:47:13 2018 (r339388) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Oct 16 19:26:04 2018 (r339389) @@ -897,8 +897,6 @@ typedef int (*c4iw_handler_func)(struct c4iw_dev *dev, int c4iw_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new, struct l2t_entry *l2t); -void c4iw_put_qpid(struct c4iw_rdev *rdev, u32 qpid, - struct c4iw_dev_ucontext *uctx); u32 c4iw_get_resource(struct c4iw_id_table *id_table); void c4iw_put_resource(struct c4iw_id_table *id_table, u32 entry); int c4iw_init_resource(struct c4iw_rdev *rdev, u32 nr_tpt, u32 nr_pdid); @@ -964,7 +962,6 @@ void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 add int c4iw_ofld_send(struct c4iw_rdev *rdev, struct mbuf *m); void c4iw_flush_hw_cq(struct c4iw_cq *cq); void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count); -void c4iw_count_scqes(struct t4_cq *cq, struct t4_wq *wq, int *count); int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp); int __c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp); int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count); @@ -984,7 +981,6 @@ void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int *pbar2_qid, u64 *pbar2_pa); extern struct cxgb4_client t4c_client; extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS]; -extern int c4iw_max_read_depth; #if defined(__i386__) || defined(__amd64__) #define L1_CACHE_BYTES 128 From owner-svn-src-stable@freebsd.org Tue Oct 16 20:53:18 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFF3D10E1C9F; Tue, 16 Oct 2018 20:53:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8059D80285; Tue, 16 Oct 2018 20:53: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 610D221D9E; Tue, 16 Oct 2018 20:53: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 w9GKrHaG037030; Tue, 16 Oct 2018 20:53:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9GKrHtO037028; Tue, 16 Oct 2018 20:53:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201810162053.w9GKrHtO037028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 16 Oct 2018 20:53:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339392 - stable/11/usr.bin/vmstat X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/11/usr.bin/vmstat X-SVN-Commit-Revision: 339392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 20:53:18 -0000 Author: jhb Date: Tue Oct 16 20:53:16 2018 New Revision: 339392 URL: https://svnweb.freebsd.org/changeset/base/339392 Log: MFC 326138,326436,326852: Style fixes to kdump. 326138: Use C standard spelling uint64_t for u_int64_t. 326436: vmstat: fix style(9) violations and bump WARNS. 326852: Re-add spaces lost in r326436. Modified: stable/11/usr.bin/vmstat/Makefile stable/11/usr.bin/vmstat/vmstat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/vmstat/Makefile ============================================================================== --- stable/11/usr.bin/vmstat/Makefile Tue Oct 16 20:12:35 2018 (r339391) +++ stable/11/usr.bin/vmstat/Makefile Tue Oct 16 20:53:16 2018 (r339392) @@ -5,6 +5,6 @@ PROG= vmstat MAN= vmstat.8 LIBADD= devstat kvm memstat xo util -WARNS?= 1 +WARNS?= 6 .include Modified: stable/11/usr.bin/vmstat/vmstat.c ============================================================================== --- stable/11/usr.bin/vmstat/vmstat.c Tue Oct 16 20:12:35 2018 (r339391) +++ stable/11/usr.bin/vmstat/vmstat.c Tue Oct 16 20:53:16 2018 (r339392) @@ -82,55 +82,43 @@ __FBSDID("$FreeBSD$"); static char da[] = "da"; +enum x_stats { X_SUM, X_HZ, X_STATHZ, X_NCHSTATS, X_INTRNAMES, X_SINTRNAMES, + X_INTRCNT, X_SINTRCNT, X_DEFICIT, X_REC, X_PGIN, X_XSTATS }; + static struct nlist namelist[] = { -#define X_SUM 0 - { "_vm_cnt" }, -#define X_HZ 1 - { "_hz" }, -#define X_STATHZ 2 - { "_stathz" }, -#define X_NCHSTATS 3 - { "_nchstats" }, -#define X_INTRNAMES 4 - { "_intrnames" }, -#define X_SINTRNAMES 5 - { "_sintrnames" }, -#define X_INTRCNT 6 - { "_intrcnt" }, -#define X_SINTRCNT 7 - { "_sintrcnt" }, + [X_SUM] = { .n_name = "_vm_cnt", }, + [X_HZ] = { .n_name = "_hz", }, + [X_STATHZ] = { .n_name = "_stathz", }, + [X_NCHSTATS] = { .n_name = "_nchstats", }, + [X_INTRNAMES] = { .n_name = "_intrnames", }, + [X_SINTRNAMES] = { .n_name = "_sintrnames", }, + [X_INTRCNT] = { .n_name = "_intrcnt", }, + [X_SINTRCNT] = { .n_name = "_sintrcnt", }, #ifdef notyet -#define X_DEFICIT XXX - { "_deficit" }, -#define X_REC XXX - { "_rectime" }, -#define X_PGIN XXX - { "_pgintime" }, -#define X_XSTATS XXX - { "_xstats" }, -#define X_END XXX -#else -#define X_END 8 + [X_DEFICIT] = { .n_name = "_deficit", }, + [X_REC] = { .n_name = "_rectime", }, + [X_PGIN] = { .n_name = "_pgintime", }, + [X_XSTATS] = { .n_name = "_xstats", }, #endif - { "" }, + { .n_name = NULL, }, }; -static struct statinfo cur, last; -static int num_devices, maxshowdevs; -static long generation; -static struct device_selection *dev_select; -static int num_selected; static struct devstat_match *matches; -static int num_matches = 0; -static int num_devices_specified, num_selections; -static long select_generation; -static char **specified_devices; +static struct device_selection *dev_select; +static struct statinfo cur, last; static devstat_select_mode select_mode; +static size_t size_cp_times; +static long *cur_cp_times, *last_cp_times; +static long generation, select_generation; +static int hz, hdrcnt, maxshowdevs; +static int num_devices, num_devices_specified; +static int num_matches, num_selected, num_selections; +static char **specified_devices; static struct vmmeter sum, osum; #define VMSTAT_DEFAULT_LINES 20 /* Default number of `winlines'. */ -volatile sig_atomic_t wresized; /* Tty resized, when non-zero. */ +static volatile sig_atomic_t wresized; /* Tty resized when non-zero. */ static int winlines = VMSTAT_DEFAULT_LINES; /* Current number of tty rows. */ static int aflag; @@ -138,7 +126,7 @@ static int nflag; static int Pflag; static int hflag; -static kvm_t *kd; +static kvm_t *kd; #define FORKSTAT 0x01 #define INTRSTAT 0x02 @@ -146,11 +134,11 @@ static kvm_t *kd; #define SUMSTAT 0x08 #define TIMESTAT 0x10 #define VMSTAT 0x20 -#define ZMEMSTAT 0x40 +#define ZMEMSTAT 0x40 #define OBJSTAT 0x80 static void cpustats(void); -static void pcpustats(int, u_long, int); +static void pcpustats(u_long, int); static void devstats(void); static void doforkst(void); static void dointr(unsigned int, int); @@ -161,7 +149,6 @@ static void domemstat_malloc(void); static void domemstat_zone(void); static void kread(int, void *, size_t); static void kreado(int, void *, size_t, size_t); -static char *kgetstr(const char *); static void needhdr(int); static void needresize(int); static void doresize(void); @@ -171,16 +158,15 @@ static void usage(void); static long pct(long, long); static long long getuptime(void); -static char **getdrivedata(char **); +static char **getdrivedata(char **); int main(int argc, char *argv[]) { - int c, todo; - unsigned int interval; + char *bp, *buf, *memf, *nlistf; float f; - int reps; - char *memf, *nlistf; + int bufsize, c, len, reps, todo; + unsigned int interval; char errbuf[_POSIX2_LINE_MAX]; memf = nlistf = NULL; @@ -190,7 +176,7 @@ main(int argc, char *argv[]) argc = xo_parse_args(argc, argv); if (argc < 0) - return argc; + return (argc); while ((c = getopt(argc, argv, "ac:fhHiM:mN:n:oPp:stw:z")) != -1) { switch (c) { @@ -229,13 +215,14 @@ main(int argc, char *argv[]) maxshowdevs = atoi(optarg); if (maxshowdevs < 0) xo_errx(1, "number of devices %d is < 0", - maxshowdevs); + maxshowdevs); break; case 'o': todo |= OBJSTAT; break; case 'p': - if (devstat_buildmatch(optarg, &matches, &num_matches) != 0) + if (devstat_buildmatch(optarg, &matches, &num_matches) + != 0) xo_errx(1, "%s", devstat_errbuf); break; case 's': @@ -245,7 +232,8 @@ main(int argc, char *argv[]) #ifdef notyet todo |= TIMESTAT; #else - xo_errx(EX_USAGE, "sorry, -t is not (re)implemented yet"); + xo_errx(EX_USAGE, + "sorry, -t is not (re)implemented yet"); #endif break; case 'w': @@ -277,10 +265,10 @@ main(int argc, char *argv[]) retry_nlist: if (kd != NULL && (c = kvm_nlist(kd, namelist)) != 0) { if (c > 0) { - int bufsize = 0, len = 0; - char *buf, *bp; + bufsize = 0, len = 0; + /* - * 'cnt' was renamed to 'vm_cnt'. If 'vm_cnt' is not + * 'cnt' was renamed to 'vm_cnt'. If 'vm_cnt' is not * found try looking up older 'cnt' symbol. * */ if (namelist[X_SUM].n_type == 0 && @@ -288,9 +276,11 @@ retry_nlist: namelist[X_SUM].n_name = "_cnt"; goto retry_nlist; } + for (c = 0; c < (int)(nitems(namelist)); c++) if (namelist[c].n_type == 0) - bufsize += strlen(namelist[c].n_name) + 1; + bufsize += strlen(namelist[c].n_name) + + 1; bufsize += len + 1; buf = bp = alloca(bufsize); @@ -376,6 +366,7 @@ mysysctl(const char *name, void *oldp, size_t *oldlenp static char ** getdrivedata(char **argv) { + if ((num_devices = devstat_getnumdevs(NULL)) < 0) xo_errx(1, "%s", devstat_errbuf); @@ -388,20 +379,19 @@ getdrivedata(char **argv) num_devices = cur.dinfo->numdevs; generation = cur.dinfo->generation; - specified_devices = (char **)malloc(sizeof(char *)); + specified_devices = malloc(sizeof(char *)); for (num_devices_specified = 0; *argv; ++argv) { if (isdigit(**argv)) break; num_devices_specified++; - specified_devices = (char **)realloc(specified_devices, - sizeof(char *) * - num_devices_specified); + specified_devices = realloc(specified_devices, + sizeof(char *) * num_devices_specified); specified_devices[num_devices_specified - 1] = *argv; } dev_select = NULL; if (nflag == 0 && maxshowdevs < num_devices_specified) - maxshowdevs = num_devices_specified; + maxshowdevs = num_devices_specified; /* * People are generally only interested in disk statistics when @@ -416,7 +406,6 @@ getdrivedata(char **argv) if ((num_devices_specified == 0) && (num_matches == 0)) { if (devstat_buildmatch(da, &matches, &num_matches) != 0) xo_errx(1, "%s", devstat_errbuf); - select_mode = DS_SELECT_ADD; } else select_mode = DS_SELECT_ONLY; @@ -427,10 +416,10 @@ getdrivedata(char **argv) * or 1. If we get back -1, though, there is an error. */ if (devstat_selectdevs(&dev_select, &num_selected, &num_selections, - &select_generation, generation, cur.dinfo->devices, - num_devices, matches, num_matches, specified_devices, - num_devices_specified, select_mode, - maxshowdevs, 0) == -1) + &select_generation, generation, cur.dinfo->devices, + num_devices, matches, num_matches, specified_devices, + num_devices_specified, select_mode, + maxshowdevs, 0) == -1) xo_errx(1, "%s", devstat_errbuf); return(argv); @@ -443,7 +432,6 @@ getuptime(void) struct timespec sp; (void)clock_gettime(CLOCK_UPTIME, &sp); - return((long long)sp.tv_sec * 1000000000LL + sp.tv_nsec); } @@ -451,11 +439,11 @@ static void fill_pcpu(struct pcpu ***pcpup, int* maxcpup) { struct pcpu **pcpu; - int maxcpu, i; *pcpup = NULL; - + *maxcpup = 0; + if (kd == NULL) return; @@ -492,6 +480,7 @@ fill_vmmeter(struct vmmeter *vmmp) { struct pcpu **pcpu; int maxcpu, i; + size_t size; if (kd != NULL) { kread(X_SUM, vmmp, sizeof(*vmmp)); @@ -534,7 +523,7 @@ fill_vmmeter(struct vmmeter *vmmp) } free_pcpu(pcpu, maxcpu); } else { - size_t size = sizeof(unsigned int); + size = sizeof(unsigned int); #define GET_VM_STATS(cat, name) \ mysysctl("vm.stats." #cat "." #name, &vmmp->name, &size, NULL, 0) /* sys */ @@ -596,11 +585,13 @@ fill_vmmeter(struct vmmeter *vmmp) static void fill_vmtotal(struct vmtotal *vmtp) { + size_t size; + if (kd != NULL) { /* XXX fill vmtp */ xo_errx(1, "not implemented"); } else { - size_t size = sizeof(*vmtp); + size = sizeof(*vmtp); mysysctl("vm.vmtotal", vmtp, &size, NULL, 0); if (size != sizeof(*vmtp)) xo_errx(1, "vm.total size mismatch"); @@ -611,14 +602,10 @@ fill_vmtotal(struct vmtotal *vmtp) static int getcpuinfo(u_long *maskp, int *maxidp) { - int maxcpu; - int maxid; - int ncpus; - int i, j; - int empty; - size_t size; long *times; u_long mask; + size_t size; + int empty, i, j, maxcpu, maxid, ncpus; if (kd != NULL) xo_errx(1, "not implemented"); @@ -654,10 +641,10 @@ getcpuinfo(u_long *maskp, int *maxidp) static void -prthuman(const char *name, u_int64_t val, int size) +prthuman(const char *name, uint64_t val, int size) { - char buf[10]; int flags; + char buf[10]; char fmt[128]; snprintf(fmt, sizeof(fmt), "{:%s/%%*s}", name); @@ -670,28 +657,23 @@ prthuman(const char *name, u_int64_t val, int size) xo_emit(fmt, size, buf); } -static int hz, hdrcnt; - -static long *cur_cp_times; -static long *last_cp_times; -static size_t size_cp_times; - static void dovmstat(unsigned int interval, int reps) { + struct clockinfo clockrate; struct vmtotal total; - time_t uptime, halfuptime; struct devinfo *tmp_dinfo; - size_t size; - int ncpus, maxid; u_long cpumask; - int rate_adj; + size_t size; + time_t uptime, halfuptime; + int ncpus, maxid, rate_adj, retval; uptime = getuptime() / 1000000000LL; halfuptime = uptime / 2; rate_adj = 1; ncpus = 1; maxid = 0; + cpumask = 0; /* * If the user stops the program (control-Z) and then resumes it, @@ -720,8 +702,6 @@ dovmstat(unsigned int interval, int reps) if (!hz) kread(X_HZ, &hz, sizeof(hz)); } else { - struct clockinfo clockrate; - size = sizeof(clockrate); mysysctl("kern.clockrate", &clockrate, &size, NULL, 0); if (size != sizeof(clockrate)) @@ -770,19 +750,17 @@ dovmstat(unsigned int interval, int reps) case -1: xo_errx(1, "%s", devstat_errbuf); break; - case 1: { - int retval; - + case 1: num_devices = cur.dinfo->numdevs; generation = cur.dinfo->generation; retval = devstat_selectdevs(&dev_select, &num_selected, - &num_selections, &select_generation, - generation, cur.dinfo->devices, - num_devices, matches, num_matches, - specified_devices, - num_devices_specified, select_mode, - maxshowdevs, 0); + &num_selections, &select_generation, + generation, cur.dinfo->devices, + num_devices, matches, num_matches, + specified_devices, + num_devices_specified, select_mode, + maxshowdevs, 0); switch (retval) { case -1: xo_errx(1, "%s", devstat_errbuf); @@ -793,7 +771,7 @@ dovmstat(unsigned int interval, int reps) default: break; } - } + break; default: break; } @@ -802,8 +780,8 @@ dovmstat(unsigned int interval, int reps) fill_vmtotal(&total); xo_open_container("processes"); xo_emit("{:runnable/%1d} {:waiting/%ld} " - "{:swapped-out/%ld}", - total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); + "{:swapped-out/%ld}", total.t_rq - 1, total.t_dw + + total.t_pw, total.t_sw); xo_close_container("processes"); xo_open_container("memory"); #define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) @@ -811,27 +789,28 @@ dovmstat(unsigned int interval, int reps) if (hflag) { xo_emit(""); prthuman("available-memory", - total.t_avm * (u_int64_t)sum.v_page_size, 5); + total.t_avm * (uint64_t)sum.v_page_size, 5); xo_emit(" "); prthuman("free-memory", - total.t_free * (u_int64_t)sum.v_page_size, 5); + total.t_free * (uint64_t)sum.v_page_size, 5); xo_emit(" "); } else { xo_emit(" "); xo_emit("{:available-memory/%7d}", - vmstat_pgtok(total.t_avm)); + vmstat_pgtok(total.t_avm)); xo_emit(" "); xo_emit("{:free-memory/%7d}", - vmstat_pgtok(total.t_free)); + vmstat_pgtok(total.t_free)); } xo_emit("{:total-page-faults/%5lu} ", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults)); + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); xo_close_container("memory"); xo_open_container("paging-rates"); xo_emit("{:page-reactivated/%3lu} ", - (unsigned long)rate(sum.v_reactivated - osum.v_reactivated)); + (unsigned long)rate(sum.v_reactivated - + osum.v_reactivated)); xo_emit("{:paged-in/%3lu} ", (unsigned long)rate(sum.v_swapin + sum.v_vnodein - (osum.v_swapin + osum.v_vnodein))); @@ -847,13 +826,13 @@ dovmstat(unsigned int interval, int reps) devstats(); xo_open_container("fault-rates"); xo_emit("{:interrupts/%4lu} {:system-calls/%5lu} " - "{:context-switches/%5u}", + "{:context-switches/%5lu}", (unsigned long)rate(sum.v_intr - osum.v_intr), (unsigned long)rate(sum.v_syscall - osum.v_syscall), (unsigned long)rate(sum.v_swtch - osum.v_swtch)); xo_close_container("fault-rates"); if (Pflag) - pcpustats(ncpus, cpumask, maxid); + pcpustats(cpumask, maxid); else cpustats(); xo_emit("\n"); @@ -881,13 +860,12 @@ printhdr(int maxid, u_long cpumask) int i, num_shown; num_shown = MIN(num_selected, maxshowdevs); - if (hflag) { + if (hflag) xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); - } else { + else xo_emit("{T:procs} {T:memory} {T:/page%*s}", 19, ""); - } if (num_shown > 1) - xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, ""); + xo_emit(" {T:/disks %*s}", num_shown * 4 - 7, ""); else if (num_shown == 1) xo_emit(" {T:disks}"); xo_emit(" {T:faults} "); @@ -900,16 +878,18 @@ printhdr(int maxid, u_long cpumask) } else xo_emit(" {T:cpu}\n"); if (hflag) { - xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re} {T:pi} {T:po} {T:fr} {T:sr} "); + xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re}" + " {T:pi} {T:po} {T:fr} {T:sr} "); } else { - xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} {T:re} {T:pi} {T:po} {T:fr} {T:sr} "); + xo_emit("{T:r} {T:b} {T:w} {T:avm} {T:fre} {T:flt} " + "{T:re} {T:pi} {T:po} {T:fr} {T:sr} "); } for (i = 0; i < num_devices; i++) - if ((dev_select[i].selected) - && (dev_select[i].selected <= maxshowdevs)) + if ((dev_select[i].selected) && + (dev_select[i].selected <= maxshowdevs)) xo_emit("{T:/%c%c%d} ", dev_select[i].device_name[0], - dev_select[i].device_name[1], - dev_select[i].unit_number); + dev_select[i].device_name[1], + dev_select[i].unit_number); xo_emit(" {T:in} {T:sy} {T:cs}"); if (Pflag) { for (i = 0; i <= maxid; i++) { @@ -940,7 +920,7 @@ needhdr(int dummy __unused) * prepended to the next output. */ void -needresize(int signo) +needresize(int signo __unused) { wresized = 1; @@ -953,8 +933,8 @@ needresize(int signo) void doresize(void) { - int status; struct winsize w; + int status; for (;;) { status = ioctl(fileno(stdout), TIOCGWINSZ, &w); @@ -985,13 +965,13 @@ dotimes(void) kread(X_PGIN, &pgintime, sizeof(pgintime)); kread(X_SUM, &sum, sizeof(sum)); xo_emit("{:page-reclaims/%u} {N:reclaims}, " - "{:reclaim-time/%u} {N:total time (usec)}\n", + "{:reclaim-time/%u} {N:total time (usec)}\n", sum.v_pgrec, rectime); xo_emit("{L:average}: {:reclaim-average/%u} {N:usec \\/ reclaim}\n", - rectime / sum.v_pgrec); + rectime / sum.v_pgrec); xo_emit("\n"); xo_emit("{:page-ins/%u} {N:page ins}, " - "{:page-in-time/%u} {N:total time (msec)}\n", + "{:page-in-time/%u} {N:total time (msec)}\n", sum.v_pgin, pgintime / 10); xo_emit("{L:average}: {:average/%8.1f} {N:msec \\/ page in}\n", pgintime / (sum.v_pgin * 10.0)); @@ -1015,93 +995,94 @@ static void dosum(void) { struct nchstats lnchstats; + size_t size; long nchtotal; fill_vmmeter(&sum); xo_open_container("summary-statistics"); xo_emit("{:context-switches/%9u} {N:cpu context switches}\n", - sum.v_swtch); + sum.v_swtch); xo_emit("{:interrupts/%9u} {N:device interrupts}\n", - sum.v_intr); + sum.v_intr); xo_emit("{:software-interrupts/%9u} {N:software interrupts}\n", - sum.v_soft); + sum.v_soft); xo_emit("{:traps/%9u} {N:traps}\n", sum.v_trap); xo_emit("{:system-calls/%9u} {N:system calls}\n", - sum.v_syscall); + sum.v_syscall); xo_emit("{:kernel-threads/%9u} {N:kernel threads created}\n", - sum.v_kthreads); + sum.v_kthreads); xo_emit("{:forks/%9u} {N: fork() calls}\n", sum.v_forks); xo_emit("{:vforks/%9u} {N:vfork() calls}\n", - sum.v_vforks); + sum.v_vforks); xo_emit("{:rforks/%9u} {N:rfork() calls}\n", - sum.v_rforks); + sum.v_rforks); xo_emit("{:swap-ins/%9u} {N:swap pager pageins}\n", - sum.v_swapin); + sum.v_swapin); xo_emit("{:swap-in-pages/%9u} {N:swap pager pages paged in}\n", - sum.v_swappgsin); + sum.v_swappgsin); xo_emit("{:swap-outs/%9u} {N:swap pager pageouts}\n", - sum.v_swapout); + sum.v_swapout); xo_emit("{:swap-out-pages/%9u} {N:swap pager pages paged out}\n", - sum.v_swappgsout); + sum.v_swappgsout); xo_emit("{:vnode-page-ins/%9u} {N:vnode pager pageins}\n", - sum.v_vnodein); + sum.v_vnodein); xo_emit("{:vnode-page-in-pages/%9u} {N:vnode pager pages paged in}\n", - sum.v_vnodepgsin); + sum.v_vnodepgsin); xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pageouts}\n", - sum.v_vnodeout); + sum.v_vnodeout); xo_emit("{:vnode-page-outs/%9u} {N:vnode pager pages paged out}\n", - sum.v_vnodepgsout); + sum.v_vnodepgsout); xo_emit("{:page-daemon-wakeups/%9u} {N:page daemon wakeups}\n", - sum.v_pdwakeups); - xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page daemon}\n", - sum.v_pdpages); - xo_emit("{:page-reclamation-shortfalls/%9u} {N:clean page reclamation shortfalls}\n", - sum.v_pdshortfalls); + sum.v_pdwakeups); + xo_emit("{:page-daemon-pages/%9u} {N:pages examined by the page " + "daemon}\n", sum.v_pdpages); + xo_emit("{:page-reclamation-shortfalls/%9u} {N:clean page reclamation " + "shortfalls}\n", sum.v_pdshortfalls); xo_emit("{:reactivated/%9u} {N:pages reactivated by the page daemon}\n", - sum.v_reactivated); + sum.v_reactivated); xo_emit("{:copy-on-write-faults/%9u} {N:copy-on-write faults}\n", - sum.v_cow_faults); - xo_emit("{:copy-on-write-optimized-faults/%9u} {N:copy-on-write optimized faults}\n", - sum.v_cow_optim); + sum.v_cow_faults); + xo_emit("{:copy-on-write-optimized-faults/%9u} {N:copy-on-write " + "optimized faults}\n", sum.v_cow_optim); xo_emit("{:zero-fill-pages/%9u} {N:zero fill pages zeroed}\n", - sum.v_zfod); + sum.v_zfod); xo_emit("{:zero-fill-prezeroed/%9u} {N:zero fill pages prezeroed}\n", - sum.v_ozfod); + sum.v_ozfod); xo_emit("{:intransit-blocking/%9u} {N:intransit blocking page faults}\n", - sum.v_intrans); + sum.v_intrans); xo_emit("{:total-faults/%9u} {N:total VM faults taken}\n", - sum.v_vm_faults); + sum.v_vm_faults); xo_emit("{:faults-requiring-io/%9u} {N:page faults requiring I\\/O}\n", - sum.v_io_faults); - xo_emit("{:faults-from-thread-creation/%9u} {N:pages affected by kernel thread creation}\n", - sum.v_kthreadpages); + sum.v_io_faults); + xo_emit("{:faults-from-thread-creation/%9u} {N:pages affected by " + "kernel thread creation}\n", sum.v_kthreadpages); xo_emit("{:faults-from-fork/%9u} {N:pages affected by fork}()\n", - sum.v_forkpages); + sum.v_forkpages); xo_emit("{:faults-from-vfork/%9u} {N:pages affected by vfork}()\n", - sum.v_vforkpages); + sum.v_vforkpages); xo_emit("{:pages-rfork/%9u} {N:pages affected by rfork}()\n", - sum.v_rforkpages); + sum.v_rforkpages); xo_emit("{:pages-freed/%9u} {N:pages freed}\n", - sum.v_tfree); + sum.v_tfree); xo_emit("{:pages-freed-by-daemon/%9u} {N:pages freed by daemon}\n", - sum.v_dfree); + sum.v_dfree); xo_emit("{:pages-freed-on-exit/%9u} {N:pages freed by exiting processes}\n", - sum.v_pfree); + sum.v_pfree); xo_emit("{:active-pages/%9u} {N:pages active}\n", - sum.v_active_count); + sum.v_active_count); xo_emit("{:inactive-pages/%9u} {N:pages inactive}\n", - sum.v_inactive_count); + sum.v_inactive_count); xo_emit("{:laundry-pages/%9u} {N:pages in the laundry queue}\n", - sum.v_laundry_count); + sum.v_laundry_count); xo_emit("{:wired-pages/%9u} {N:pages wired down}\n", - sum.v_wire_count); + sum.v_wire_count); xo_emit("{:free-pages/%9u} {N:pages free}\n", - sum.v_free_count); + sum.v_free_count); xo_emit("{:bytes-per-page/%9u} {N:bytes per page}\n", sum.v_page_size); if (kd != NULL) { kread(X_NCHSTATS, &lnchstats, sizeof(lnchstats)); } else { - size_t size = sizeof(lnchstats); + size = sizeof(lnchstats); mysysctl("vfs.cache.nchstats", &lnchstats, &size, NULL, 0); if (size != sizeof(lnchstats)) xo_errx(1, "vfs.cache.nchstats size mismatch"); @@ -1110,17 +1091,17 @@ dosum(void) lnchstats.ncs_badhits + lnchstats.ncs_falsehits + lnchstats.ncs_miss + lnchstats.ncs_long; xo_emit("{:total-name-lookups/%9ld} {N:total name lookups}\n", - nchtotal); + nchtotal); xo_emit("{P:/%9s} {N:cache hits} " - "({:positive-cache-hits/%ld}% pos + " - "{:negative-cache-hits/%ld}% {N:neg}) " - "system {:cache-hit-percent/%ld}% per-directory\n", + "({:positive-cache-hits/%ld}% pos + " + "{:negative-cache-hits/%ld}% {N:neg}) " + "system {:cache-hit-percent/%ld}% per-directory\n", "", PCT(lnchstats.ncs_goodhits, nchtotal), PCT(lnchstats.ncs_neghits, nchtotal), PCT(lnchstats.ncs_pass2, nchtotal)); xo_emit("{P:/%9s} {L:deletions} {:deletions/%ld}%, " - "{L:falsehits} {:false-hits/%ld}%, " - "{L:toolong} {:too-long/%ld}%\n", "", + "{L:falsehits} {:false-hits/%ld}%, " + "{L:toolong} {:too-long/%ld}%\n", "", PCT(lnchstats.ncs_badhits, nchtotal), PCT(lnchstats.ncs_falsehits, nchtotal), PCT(lnchstats.ncs_long, nchtotal)); @@ -1130,20 +1111,21 @@ dosum(void) static void doforkst(void) { + fill_vmmeter(&sum); xo_open_container("fork-statistics"); xo_emit("{:fork/%u} {N:forks}, {:fork-pages/%u} {N:pages}, " - "{L:average} {:fork-average/%.2f}\n", + "{L:average} {:fork-average/%.2f}\n", sum.v_forks, sum.v_forkpages, sum.v_forks == 0 ? 0.0 : (double)sum.v_forkpages / sum.v_forks); xo_emit("{:vfork/%u} {N:vforks}, {:vfork-pages/%u} {N:pages}, " - "{L:average} {:vfork-average/%.2f}\n", + "{L:average} {:vfork-average/%.2f}\n", sum.v_vforks, sum.v_vforkpages, sum.v_vforks == 0 ? 0.0 : (double)sum.v_vforkpages / sum.v_vforks); xo_emit("{:rfork/%u} {N:rforks}, {:rfork-pages/%u} {N:pages}, " - "{L:average} {:rfork-average/%.2f}\n", + "{L:average} {:rfork-average/%.2f}\n", sum.v_rforks, sum.v_rforkpages, sum.v_rforks == 0 ? 0.0 : (double)sum.v_rforkpages / sum.v_rforks); @@ -1153,10 +1135,9 @@ doforkst(void) static void devstats(void) { - int dn, state; - long double transfers_per_second; - long double busy_seconds; + long double busy_seconds, transfers_per_second; long tmp; + int di, dn, state; for (state = 0; state < CPUSTATES; ++state) { tmp = cur.cp_time[state]; @@ -1168,10 +1149,8 @@ devstats(void) xo_open_list("device"); for (dn = 0; dn < num_devices; dn++) { - int di; - - if ((dev_select[dn].selected == 0) - || (dev_select[dn].selected > maxshowdevs)) + if (dev_select[dn].selected == 0 || + dev_select[dn].selected > maxshowdevs) continue; di = dev_select[dn].position; @@ -1184,24 +1163,24 @@ devstats(void) xo_open_instance("device"); xo_emit("{ekq:name/%c%c%d}{:transfers/%3.0Lf} ", - dev_select[dn].device_name[0], - dev_select[dn].device_name[1], - dev_select[dn].unit_number, - transfers_per_second); + dev_select[dn].device_name[0], + dev_select[dn].device_name[1], + dev_select[dn].unit_number, + transfers_per_second); xo_close_instance("device"); } xo_close_list("device"); } static void -percent(const char *name, double pct, int *over) +percent(const char *name, double pctv, int *over) { + int l; char buf[10]; char fmt[128]; - int l; snprintf(fmt, sizeof(fmt), " {:%s/%%*s}", name); - l = snprintf(buf, sizeof(buf), "%.0f", pct); + l = snprintf(buf, sizeof(buf), "%.0f", pctv); if (l == 1 && *over) { xo_emit(fmt, 1, buf); (*over)--; @@ -1214,8 +1193,8 @@ percent(const char *name, double pct, int *over) static void cpustats(void) { - int state, over; double lpct, total; + int state, over; total = 0; for (state = 0; state < CPUSTATES; ++state) @@ -1226,19 +1205,20 @@ cpustats(void) lpct = 0.0; over = 0; xo_open_container("cpu-statistics"); - percent("user", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * lpct, &over); - percent("system", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * lpct, &over); + percent("user", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * lpct, + &over); + percent("system", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * lpct, + &over); percent("idle", cur.cp_time[CP_IDLE] * lpct, &over); xo_close_container("cpu-statistics"); } static void -pcpustats(int ncpus, u_long cpumask, int maxid) +pcpustats(u_long cpumask, int maxid) { - int state, i; double lpct, total; long tmp; - int over; + int i, over, state; /* devstats does this for cp_time */ for (i = 0; i <= maxid; i++) { @@ -1267,11 +1247,11 @@ pcpustats(int ncpus, u_long cpumask, int maxid) else lpct = 0.0; percent("user", (cur_cp_times[i * CPUSTATES + CP_USER] + - cur_cp_times[i * CPUSTATES + CP_NICE]) * lpct, &over); + cur_cp_times[i * CPUSTATES + CP_NICE]) * lpct, &over); percent("system", (cur_cp_times[i * CPUSTATES + CP_SYS] + - cur_cp_times[i * CPUSTATES + CP_INTR]) * lpct, &over); + cur_cp_times[i * CPUSTATES + CP_INTR]) * lpct, &over); percent("idle", cur_cp_times[i * CPUSTATES + CP_IDLE] * lpct, - &over); + &over); xo_close_instance("cpu"); } xo_close_list("cpu"); @@ -1303,12 +1283,12 @@ read_intrcnts(unsigned long **intrcnts) static void print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts, - char *intrnames, unsigned int nintr, - size_t istrnamlen, long long period_ms) + char *intrnames, unsigned int nintr, size_t istrnamlen, long long period_ms) { unsigned long *intrcnt, *old_intrcnt; + char *intrname; uint64_t inttotal, old_inttotal, total_count, total_rate; - char* intrname; + unsigned long count, rate; unsigned int i; inttotal = 0; @@ -1317,15 +1297,12 @@ print_intrcnts(unsigned long *intrcnts, unsigned long xo_open_list("interrupt"); for (i = 0, intrcnt=intrcnts, old_intrcnt=old_intrcnts; i < nintr; i++) { if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) { - unsigned long count, rate; - count = *intrcnt - *old_intrcnt; rate = (count * 1000 + period_ms / 2) / period_ms; xo_open_instance("interrupt"); xo_emit("{d:name/%-*s}{ket:name/%s} " "{:total/%20lu} {:rate/%10lu}\n", - (int)istrnamlen, intrname, - intrname, count, rate); + (int)istrnamlen, intrname, intrname, count, rate); xo_close_instance("interrupt"); } intrname += strlen(intrname) + 1; @@ -1335,20 +1312,21 @@ print_intrcnts(unsigned long *intrcnts, unsigned long total_count = inttotal - old_inttotal; total_rate = (total_count * 1000 + period_ms / 2) / period_ms; xo_close_list("interrupt"); - xo_emit("{L:/%-*s} {:total-interrupts/%20" PRIu64 "} " - "{:total-rate/%10" PRIu64 "}\n", (int)istrnamlen, - "Total", total_count, total_rate); + xo_emit("{L:/%-*s} {:total-interrupts/%20ju} " + "{:total-rate/%10ju}\n", (int)istrnamlen, + "Total", (uintmax_t)total_count, (uintmax_t)total_rate); } static void dointr(unsigned int interval, int reps) { - unsigned long *intrcnts; - long long uptime, period_ms; - unsigned long *old_intrcnts = NULL; + unsigned long *intrcnts, *old_intrcnts; + char *intrname, *intrnames; + long long period_ms, old_uptime, uptime; size_t clen, inamlen, istrnamlen; - char *intrnames, *intrname; + unsigned int nintr; + old_intrcnts = NULL; uptime = getuptime(); /* Get the names of each interrupt source */ @@ -1377,7 +1355,7 @@ dointr(unsigned int interval, int reps) intrname += strlen(intrname) + 1; } xo_emit("{T:/%-*s} {T:/%20s} {T:/%10s}\n", - (int)istrnamlen, "interrupt", "total", "rate"); + (int)istrnamlen, "interrupt", "total", "rate"); /* * Loop reps times printing differential interrupt counts. If reps is @@ -1387,9 +1365,6 @@ dointr(unsigned int interval, int reps) period_ms = uptime / 1000000; while(1) { - unsigned int nintr; - long long old_uptime; - nintr = read_intrcnts(&intrcnts); /* * Initialize old_intrcnts to 0 for the first pass, so @@ -1449,7 +1424,7 @@ domemstat_malloc(void) } xo_open_container("malloc-statistics"); xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n", - "Type", "InUse", "MemUse", "HighUse", "Requests"); + "Type", "InUse", "MemUse", "HighUse", "Requests"); xo_open_list("memory"); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; mtp = memstat_mtl_next(mtp)) { @@ -1457,12 +1432,12 @@ domemstat_malloc(void) memstat_get_count(mtp) == 0) continue; xo_open_instance("memory"); - xo_emit("{k:type/%13s/%s} {:in-use/%5" PRIu64 "} " - "{:memory-use/%5" PRIu64 "}{U:K} {:high-use/%7s} " - "{:requests/%8" PRIu64 "} ", - memstat_get_name(mtp), memstat_get_count(mtp), - (memstat_get_bytes(mtp) + 1023) / 1024, "-", - memstat_get_numallocs(mtp)); + xo_emit("{k:type/%13s/%s} {:in-use/%5ju} " + "{:memory-use/%5ju}{U:K} {:high-use/%7s} " + "{:requests/%8ju} ", + memstat_get_name(mtp), (uintmax_t)memstat_get_count(mtp), + ((uintmax_t)memstat_get_bytes(mtp) + 1023) / 1024, "-", + (uintmax_t)memstat_get_numallocs(mtp)); first = 1; xo_open_list("size"); for (i = 0; i < 32; i++) { @@ -1487,8 +1462,8 @@ domemstat_zone(void) { struct memory_type_list *mtlp; struct memory_type *mtp; - char name[MEMTYPE_MAXNAME + 1]; int error; + char name[MEMTYPE_MAXNAME + 1]; mtlp = memstat_mtl_alloc(); if (mtlp == NULL) { @@ -1514,23 +1489,26 @@ domemstat_zone(void) } xo_open_container("memory-zone-statistics"); xo_emit("{T:/%-20s} {T:/%6s} {T:/%6s} {T:/%8s} {T:/%8s} {T:/%8s} " - "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE", - "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP"); + "{T:/%4s} {T:/%4s}\n\n", "ITEM", "SIZE", + "LIMIT", "USED", "FREE", "REQ", "FAIL", "SLEEP"); xo_open_list("zone"); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; mtp = memstat_mtl_next(mtp)) { strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME); strcat(name, ":"); xo_open_instance("zone"); - xo_emit("{d:name/%-20s}{ke:name/%s} {:size/%6" PRIu64 "}, " - "{:limit/%6" PRIu64 "},{:used/%8" PRIu64 "}," *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Oct 16 22:09:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1943F10E35E1; Tue, 16 Oct 2018 22:09:35 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2CD2823A8; Tue, 16 Oct 2018 22:09:34 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B978D228CA; Tue, 16 Oct 2018 22:09:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9GM9YNP072936; Tue, 16 Oct 2018 22:09:34 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9GM9XOd072929; Tue, 16 Oct 2018 22:09:33 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810162209.w9GM9XOd072929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 16 Oct 2018 22:09:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339393 - stable/11/usr.sbin/cxgbetool X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/usr.sbin/cxgbetool X-SVN-Commit-Revision: 339393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 22:09:35 -0000 Author: np Date: Tue Oct 16 22:09:33 2018 New Revision: 339393 URL: https://svnweb.freebsd.org/changeset/base/339393 Log: MFC r330887: cxgbetool(8): Add the ability to decode hardware TCBs. Sponsored by: Chelsio Communications Added: stable/11/usr.sbin/cxgbetool/tcb_common.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcb_common.c stable/11/usr.sbin/cxgbetool/tcb_common.h - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcb_common.h stable/11/usr.sbin/cxgbetool/tcbinfot4.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbinfot4.c stable/11/usr.sbin/cxgbetool/tcbinfot5.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbinfot5.c stable/11/usr.sbin/cxgbetool/tcbinfot6.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbinfot6.c stable/11/usr.sbin/cxgbetool/tcbshowt4.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbshowt4.c stable/11/usr.sbin/cxgbetool/tcbshowt5.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbshowt5.c stable/11/usr.sbin/cxgbetool/tcbshowt6.c - copied unchanged from r330887, head/usr.sbin/cxgbetool/tcbshowt6.c Modified: stable/11/usr.sbin/cxgbetool/Makefile stable/11/usr.sbin/cxgbetool/cxgbetool.c Directory Properties: stable/11/ (props changed) stable/11/usr.sbin/cxgbetool/reg_defs_t5.c (props changed) stable/11/usr.sbin/cxgbetool/reg_defs_t6.c (props changed) Modified: stable/11/usr.sbin/cxgbetool/Makefile ============================================================================== --- stable/11/usr.sbin/cxgbetool/Makefile Tue Oct 16 20:53:16 2018 (r339392) +++ stable/11/usr.sbin/cxgbetool/Makefile Tue Oct 16 22:09:33 2018 (r339393) @@ -2,6 +2,11 @@ PROG= cxgbetool MAN= cxgbetool.8 +SRCS= cxgbetool.c +SRCS+= tcb_common.c +SRCS+= tcbinfot4.c tcbshowt4.c +SRCS+= tcbinfot5.c tcbshowt5.c +SRCS+= tcbinfot6.c tcbshowt6.c CFLAGS+= -I${SRCTOP}/sys/dev/cxgbe -I${SRCTOP}/sys -I. WARNS?= 2 Modified: stable/11/usr.sbin/cxgbetool/cxgbetool.c ============================================================================== --- stable/11/usr.sbin/cxgbetool/cxgbetool.c Tue Oct 16 20:53:16 2018 (r339392) +++ stable/11/usr.sbin/cxgbetool/cxgbetool.c Tue Oct 16 22:09:33 2018 (r339393) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include "t4_ioctl.h" +#include "tcb_common.h" #define in_range(val, lo, hi) ( val < 0 || (val <= hi && val >= lo)) #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -2102,6 +2103,7 @@ memdump(int argc, const char *argv[]) static void show_tcb(uint32_t *buf, uint32_t len) { + unsigned char *tcb = (unsigned char *)buf; const char *s; int i, n = 8; @@ -2112,6 +2114,10 @@ show_tcb(uint32_t *buf, uint32_t len) } printf("\n"); } + set_tcb_info(TIDTYPE_TCB, chip_id); + set_print_style(PRNTSTYL_COMP); + swizzle_tcb(tcb); + parse_n_display_xcb(tcb); } #define A_TP_CMM_TCB_BASE 0x7d10 Copied: stable/11/usr.sbin/cxgbetool/tcb_common.c (from r330887, head/usr.sbin/cxgbetool/tcb_common.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.sbin/cxgbetool/tcb_common.c Tue Oct 16 22:09:33 2018 (r339393, copy of r330887, head/usr.sbin/cxgbetool/tcb_common.c) @@ -0,0 +1,703 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "tcb_common.h" + +/***:----------------------------------------------------------------------- + ***: externals + ***:----------------------------------------------------------------------- + */ + +extern _TCBVAR g_tcb_info4[]; +extern _TCBVAR g_scb_info4[]; +extern _TCBVAR g_fcb_info4[]; +extern void t4_display_tcb_aux_0(_TCBVAR *tvp,int aux); +extern void t4_display_tcb_aux_1(_TCBVAR *tvp,int aux); +extern void t4_display_tcb_aux_2(_TCBVAR *tvp,int aux); +extern void t4_display_tcb_aux_3(_TCBVAR *tvp,int aux); + +extern _TCBVAR g_tcb_info5[]; +extern _TCBVAR g_scb_info5[]; +extern _TCBVAR g_fcb_info5[]; +extern void t5_display_tcb_aux_0(_TCBVAR *tvp,int aux); +extern void t5_display_tcb_aux_1(_TCBVAR *tvp,int aux); +extern void t5_display_tcb_aux_2(_TCBVAR *tvp,int aux); +extern void t5_display_tcb_aux_3(_TCBVAR *tvp,int aux); + +extern _TCBVAR g_tcb_info6[]; +extern _TCBVAR g_scb_info6[]; +extern _TCBVAR g_fcb_info6[]; +extern void t6_display_tcb_aux_0(_TCBVAR *tvp,int aux); +extern void t6_display_tcb_aux_1(_TCBVAR *tvp,int aux); +extern void t6_display_tcb_aux_2(_TCBVAR *tvp,int aux); +extern void t6_display_tcb_aux_3(_TCBVAR *tvp,int aux); +extern void t6_display_tcb_aux_4(_TCBVAR *tvp,int aux); + +/***:----------------------------------------------------------------------- + ***: globals + ***:----------------------------------------------------------------------- + */ + +_TCBVAR *g_tcb_info=g_tcb_info5; +_TCBVAR *g_scb_info=g_scb_info5; +_TCBVAR *g_fcb_info=g_fcb_info5; +static int g_tN=0; + +static int g_prntstyl=PRNTSTYL_COMP; + +static int g_got_scb=0; +static int g_got_fcb=0; + + +/***:----------------------------------------------------------------------- +***: error exit functions +***:----------------------------------------------------------------------- +*/ + +/**: err_exit functions +*: ------------------ +*/ + +void tcb_prflush(void) +{ + fflush(stdout); + fflush(stderr); +} + + +void tcb_code_err_exit(char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + printf("Coding Error in: "); + vprintf(fmt, args); + printf("\n"); + tcb_prflush(); + va_end(args); + exit(1); +} + +/***:----------------------------------------------------------------------- +***: tcb_hexdump functions +***:----------------------------------------------------------------------- +*/ + +void +tcb_hexdump(unsigned base, unsigned char *buf, unsigned int size) +{ + unsigned offset; + + for (offset = 0; offset < size; ++offset) { + if (!(offset % 16)) printf("\n0x%4.4x: ", base + offset); + else if (!(offset % 8)) printf(" "); + printf("%2.2x ", (unsigned char)buf[offset]); + } +} + +int tcb_strmatch_nc(char *cs, char *ct) { + while (*cs) + if (tolower(*cs++) != tolower(*ct++)) return (FALSE); + return (!(*ct)); /*return TRUE if *ct NULL at same time as *cs==NULL*/ +} + + +/*: ------------------------------------------------------------------------- +string functions +tcb_strmatch_nc: Similar to exact match, but case insensitive. +*/ + + +int +tcb_strncmp_nc(char *cs, char *ct, int n) +{ + /*case insensitive version of the standard strncmp() function */ + int i = 0; + int ret; + + + ret = 0; + for (i = 0; i < n && 0 == ret && !(EOS == *cs && EOS == *ct); ++i) { + /* this is weird, but it matched GCC linux when strings don't + * have any upper case characters. + */ + ret = tolower(*cs++) - tolower(*ct++); + } + return ret; +} + +int +tcb_startswith_nc(char *cs, char *ct) +{ /* return true if cs start with ct */ + return (0 == tcb_strncmp_nc(cs, ct, (int)strlen(ct))); +} + + + + +/***:----------------------------------------------------------------------- + ***: START OF WINDOWS FUNCTIONS + ***:----------------------------------------------------------------------- + */ + + +/***:----------------------------------------------------------------------- + ***: print utilties + ***:----------------------------------------------------------------------- + */ + +static int g_PR_indent=1; + +void PR(char *fmt, ...) +{ + int fmt_len; + va_list args; + va_start(args,fmt); + + if (g_PR_indent) printf(" "); + g_PR_indent=0; + fmt_len=(int) strlen(fmt); + if (fmt_len>0 && fmt[fmt_len-1]=='\n') g_PR_indent=1; + + vprintf(fmt,args); + tcb_prflush(); + va_end(args); +} + + +/***:----------------------------------------------------------------------- + ***: val() + ***:----------------------------------------------------------------------- + */ + +_TCBVAR * +lu_tcbvar(char *name) +{ + _TCBVAR *tvp=g_tcb_info; + + while (tvp->name!=NULL) { + if (tcb_strmatch_nc(name,tvp->name)) return tvp; + else if (tcb_strmatch_nc(name,tvp->aka )) return tvp; + tvp+=1; + } + tcb_code_err_exit("lu_tcbvar: bad name %s\n",name); + return NULL; +} + +unsigned +val(char *name) +{ + _TCBVAR *tvp; + + tvp=lu_tcbvar(name); + return tvp->val; +} + +ui64 +val64(char *name) +{ + _TCBVAR *tvp; + + tvp=lu_tcbvar(name); + return tvp->rawval; +} + + + +/***:----------------------------------------------------------------------- + ***: get_tcb_bits + ***:----------------------------------------------------------------------- + */ + + +static int +get_tcb_bit(unsigned char *A, int bit) +{ + int ret=0; + int ix,shift; + + ix = 127 - (bit>>3); + shift=bit&0x7; + /* prdbg(" ix: %u, shift=%u\n",ix,shift); */ + ret=(A[ix] >> shift) & 1; + return ret; +} + +static ui64 +get_tcb_bits (unsigned char *A, int hi, int lo) +{ + ui64 ret=0; + + if (lo>hi) { + int temp=lo; + lo=hi; + hi=temp; + } + + while (hi>=lo) { + ret = (ret<<1) | get_tcb_bit(A,hi); + --hi; + } + + return ret; +} + + +void +decompress_val(_TCBVAR *tvp,unsigned ulp_type,unsigned tx_max, + unsigned rcv_nxt,unsigned rx_frag0_start_idx_raw) +{ + unsigned rawval=(unsigned) tvp->rawval; + + switch(tvp->comp) { + case COMP_NONE: tvp->val=rawval; break; + case COMP_ULP: tvp->val=rawval; break; + case COMP_TX_MAX: + tvp->val=(tx_max - rawval) & 0xFFFFFFFF; + break; + case COMP_RCV_NXT: + if (tcb_startswith_nc(tvp->name,"rx_frag")) { + unsigned fragx=0; + if (!tcb_strmatch_nc(tvp->name,"rx_frag0_start_idx_raw")) + fragx=rawval; + tvp->val=(rcv_nxt+rx_frag0_start_idx_raw+fragx) & 0xFFFFFFFF; + } else { + tvp->val=(rcv_nxt - rawval) & 0xFFFFFFFF; + } + break; + case COMP_PTR: tvp->val=rawval; break; + case COMP_LEN: + { + tvp->val=rawval; + if (PM_MODE_RDDP==ulp_type || PM_MODE_DDP==ulp_type || + PM_MODE_IANDP==ulp_type) { + /* TP does this internally. Not sure if I should show the + * unaltered value or the raw value. For now I + * will diplay the raw value. For now I've added the code + * mainly to stop windows compiler from warning about ulp_type + * being an unreferenced parameter. + */ + tvp->val=0; + tvp->val=rawval; /* comment this out to display altered value */ + } + } + break; + default: + tcb_code_err_exit("decompress_val, bad switch: %d",tvp->comp); + break; + } + + + +} + + +void +get_tcb_field(_TCBVAR *tvp,unsigned char *buf) +{ + assert(tvp->hi-tvp->lo+1<=64); + assert(tvp->hi>=tvp->lo); + + tvp->rawval=get_tcb_bits(buf,tvp->lo,tvp->hi); + /* assume no compression and 32-bit value for now */ + tvp->val=(unsigned) (tvp->rawval & 0xFFFFFFFF); + + +} + + +/***:----------------------------------------------------------------------- + ***: spr_* functions + ***:----------------------------------------------------------------------- + */ + +char * +spr_tcp_state (unsigned state) +{ + char *ret="UNKNOWN"; + + if ( 0 == state) {ret = "CLOSED";} + else if ( 1 == state) {ret = "LISTEN";} + else if ( 2 == state) {ret = "SYN_SENT";} + else if ( 3 == state) {ret = "SYN_RCVD";} + else if ( 4 == state) {ret = "ESTABLISHED";} + else if ( 5 == state) {ret = "CLOSE_WAIT";} + else if ( 6 == state) {ret = "FIN_WAIT_1";} + else if ( 7 == state) {ret = "CLOSING";} + else if ( 8 == state) {ret = "LAST_ACK";} + else if ( 9 == state) {ret = "FIN_WAIT_2";} + else if (10 == state) {ret = "TIME_WAIT";} + else if (11 == state) {ret = "ESTABLISHED_RX";} + else if (12 == state) {ret = "ESTABLISHED_TX";} + else if (13 == state) {ret = "SYN_PEND";} + else if (14 == state) {ret = "ESC_1_STATE";} + else if (15 == state) {ret = "ESC_2_STATE";} + + return ret; +} + +char * +spr_cctrl_sel(unsigned sel0,unsigned sel1) +{ + unsigned sel=(sel1<<1) | sel0; + char *ret="UNKNOWN"; + + if ( 0 == sel) {ret = "Reno";} + else if ( 1 == sel) {ret = "Tahoe";} + else if ( 2 == sel) {ret = "NewReno";} + else if ( 3 == sel) {ret = "HighSpeed";} + + return ret; +} + + +char * +spr_ulp_type(unsigned ulp_type) +{ + char *ret="UNKNOWN"; + + /*The tp.h PM_MODE_XXX call 1 DDP and 5 IANDP, but external + * documentation (tcb.h" calls 5 ddp, and doesn't mention 1 or 3. + */ + + if ( PM_MODE_PASS == ulp_type) {ret = "TOE";} + else if ( PM_MODE_DDP == ulp_type) {ret = "DDP";} + else if ( PM_MODE_ISCSI == ulp_type) {ret = "ISCSI";} + else if ( PM_MODE_IWARP == ulp_type) {ret = "IWARP";} + else if ( PM_MODE_RDDP == ulp_type) {ret = "RDMA";} + else if ( PM_MODE_IANDP == ulp_type) {ret = "IANDP_DDP";} + else if ( PM_MODE_FCOE == ulp_type) {ret = "FCoE";} + else if ( PM_MODE_USER == ulp_type) {ret = "USER";} + else if ( PM_MODE_TLS == ulp_type) {ret = "TLS";} + else if ( PM_MODE_DTLS == ulp_type) {ret = "DTLS";} + + return ret; +} + +char * +spr_ip_version(unsigned ip_version) +{ + char *ret="UNKNOWN"; + + if ( 0 == ip_version) {ret = "IPv4";} + else if ( 1 == ip_version) {ret = "IPv6";} + + return ret; +} + + + +/***:----------------------------------------------------------------------- + ***: display_tcb() + ***:----------------------------------------------------------------------- + */ + +void +display_tcb_compressed(_TCBVAR *tvp,int aux) +{ + + if (g_tN==4) { + t4_display_tcb_aux_0(tvp,aux); + if (1==aux) t4_display_tcb_aux_1(tvp,aux); + else if (2==aux) t4_display_tcb_aux_2(tvp,aux); + else if (3==aux) t4_display_tcb_aux_3(tvp,aux); + + } else if (g_tN==5) { + t5_display_tcb_aux_0(tvp,aux); + if (1==aux) t5_display_tcb_aux_1(tvp,aux); + else if (2==aux) t5_display_tcb_aux_2(tvp,aux); + else if (3==aux) t5_display_tcb_aux_3(tvp,aux); + } else if (g_tN==6) { + t6_display_tcb_aux_0(tvp,aux); + if (1==aux) t6_display_tcb_aux_1(tvp,aux); + else if (2==aux) t6_display_tcb_aux_2(tvp,aux); + else if (3==aux) t6_display_tcb_aux_3(tvp,aux); + else if (4==aux) t6_display_tcb_aux_4(tvp,aux); + } +} + + + + +/***:----------------------------------------------------------------------- + ***: parse_n_decode_tcb + ***:----------------------------------------------------------------------- + */ + + +unsigned +parse_tcb( _TCBVAR *base_tvp, unsigned char *buf) +{ /* parse the TCB */ + _TCBVAR *tvp=base_tvp; + unsigned ulp_type; + int aux=1; /* assume TOE or iSCSI */ + unsigned tx_max=0, rcv_nxt=0, rx_frag0_start_idx_raw=0; + int got_tx_max=0, got_rcv_nxt=0, got_rx_frag0_start_idx_raw=0; + + + /* parse the TCB */ + while (tvp->name!=NULL) { + get_tcb_field(tvp,buf); + if (!got_tx_max && tcb_strmatch_nc("tx_max",tvp->name)) { + tx_max=tvp->val; + got_tx_max=1; + } + if (!got_rcv_nxt && tcb_strmatch_nc("rcv_nxt",tvp->name)) { + rcv_nxt=tvp->val; + got_rcv_nxt=1; + } + if (!got_rx_frag0_start_idx_raw && + tcb_strmatch_nc("rx_frag0_start_idx_raw",tvp->name)) { + rx_frag0_start_idx_raw=tvp->val; + got_rx_frag0_start_idx_raw=1; + } + tvp+=1; + } + + tvp=base_tvp; + ulp_type=tvp->val; /* ULP type is always first variable in TCB */ + if (PM_MODE_IANDP==ulp_type || PM_MODE_FCOE==ulp_type) aux=3; + else if (PM_MODE_RDDP==ulp_type) aux=2; + else if (6==g_tN && (PM_MODE_TLS==ulp_type || PM_MODE_DTLS==ulp_type)) aux=4; + else aux=1; + + assert(got_tx_max && got_rcv_nxt && got_rx_frag0_start_idx_raw); + + /* decompress the compressed values */ + tvp=base_tvp; + while (tvp->name!=NULL) { + decompress_val(tvp,ulp_type,tx_max,rcv_nxt,rx_frag0_start_idx_raw); + tvp+=1; + } + + return aux; +} + + + +void +parse_scb( _TCBVAR *base_tvp, unsigned char *buf) +{ /* parse the SCB */ + _TCBVAR *tvp=base_tvp; + + while (tvp->name!=NULL) { + if (tcb_strmatch_nc("scb_slush",tvp->name)) { + /* the scb_slush field is all of remaining memory */ + tvp->rawval=0; + tvp->val=0; + } else { + get_tcb_field(tvp,buf); + } + tvp+=1; + } +} + + +void +parse_fcb( _TCBVAR *base_tvp, unsigned char *buf) +{ /* parse the FCB */ + _TCBVAR *tvp=base_tvp; + + while (tvp->name!=NULL) { + get_tcb_field(tvp,buf); + tvp+=1; + } +} + + +void +display_list_tcb(_TCBVAR *base_tvp,int aux) +{ + _TCBVAR *tvp=base_tvp; + while (tvp->name!=NULL) { + if (tvp->aux==0 || tvp->aux==aux) { + if (tvp->hi-tvp->lo+1<=32) { + printf(" %4d:%4d %31s: %10u (0x%1x)",tvp->lo,tvp->hi,tvp->name, + (unsigned) tvp->rawval,(unsigned) tvp->rawval); + if (COMP_TX_MAX==tvp->comp || COMP_RCV_NXT==tvp->comp) + printf(" -> %1u (0x%x)", tvp->val,tvp->val); + } else { + printf(" %4d:%4d %31s: 0x%1llx",tvp->lo,tvp->hi,tvp->name, + tvp->rawval); + } + printf("\n"); + } + tvp+=1; + } +} + +void +display_tcb(_TCBVAR *tvp,unsigned char *buf,int aux) +{ + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_RAW) { + tcb_hexdump(0,buf,128); + printf("\n"); + } + + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_LIST) { + display_list_tcb(tvp,aux); + } + + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_COMP) { + display_tcb_compressed(tvp,aux); + } + +} + +void +parse_n_display_tcb(unsigned char *buf) +{ + _TCBVAR *tvp=g_tcb_info; + int aux; + + aux=parse_tcb(tvp,buf); + display_tcb(tvp,buf,aux); +} + +void +parse_n_display_scb(unsigned char *buf) +{ + _TCBVAR *tvp=g_scb_info; + + parse_scb(tvp,buf); + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_RAW) { + tcb_hexdump(0,buf,128); + printf("\n"); + } + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_LIST || + g_prntstyl==PRNTSTYL_COMP) { + display_list_tcb(tvp,0); + } +} + +void +parse_n_display_fcb(unsigned char *buf) +{ + _TCBVAR *tvp=g_fcb_info; + + parse_fcb(tvp,buf); + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_RAW) { + tcb_hexdump(0,buf,128); + printf("\n"); + } + + if (g_prntstyl==PRNTSTYL_VERBOSE || + g_prntstyl==PRNTSTYL_LIST || + g_prntstyl==PRNTSTYL_COMP) { + display_list_tcb(tvp,0); + } +} + +void +parse_n_display_xcb(unsigned char *buf) +{ + if (g_got_scb) parse_n_display_scb(buf); + else if (g_got_fcb) parse_n_display_fcb(buf); + else parse_n_display_tcb(buf); +} + +/***:----------------------------------------------------------------------- + ***: swizzle_tcb + ***:----------------------------------------------------------------------- + */ + +void +swizzle_tcb(unsigned char *buf) +{ + int i,j,k; + + for (i=0, j=128-16 ; i +#include +#include +#include +#include +#include + + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef EOS +#define EOS '\0' +#endif + +#ifndef __variable_sizes + +/* windows has _UI64_MAX. C99 has ULLONG_MAX, but I don't compile +with C99 for portability with windows, so the ui64 is a guess. +I'll add an assert to cl_main to confirm these sizes are accurate. +*/ +#ifdef _UI64_MAX /* windows */ +#if (_UI64_MAX == 0xFFFFFFFFFFFFFFFF) +typedef __int64 si64; +typedef unsigned __int64 ui64; +#endif +#else /*else of #ifdef _UI64_MAX */ +typedef long long int si64; +typedef unsigned long long int ui64; +#endif /*endif of #ifdef _UI64_MAX */ +#endif /* endif of #ifndef __variable_sizes */ + + + + +typedef struct tcb_var { + char *name; + int aux; + int lo; + int hi; + + char *faka; + int flo; + int fhi; + + char *aka; + + int comp; + + char *desc; + char *akadesc; + + ui64 rawval; + unsigned val; + +} _TCBVAR; + + +enum comp_types { + + COMP_NONE=0, + COMP_ULP, + COMP_TX_MAX, + COMP_RCV_NXT, + COMP_PTR, + COMP_LEN, + +}; + + +enum tidtypes { + TIDTYPE_TCB=0, + TIDTYPE_SCB=1, + TIDTYPE_FCB=2, + +}; + + +enum prntstyls { + PRNTSTYL_VERBOSE=0, + PRNTSTYL_LIST=1, + PRNTSTYL_COMP=2, + PRNTSTYL_RAW=3, + +}; + + +/* from tp/src/tp.h */ +#define PM_MODE_PASS 0 +#define PM_MODE_DDP 1 +#define PM_MODE_ISCSI 2 +#define PM_MODE_IWARP 3 +#define PM_MODE_RDDP 4 +#define PM_MODE_IANDP 5 +#define PM_MODE_FCOE 6 +#define PM_MODE_USER 7 +#define PM_MODE_TLS 8 +#define PM_MODE_DTLS 9 + + + +#define SEQ_ADD(a,b) (((a)+(b)) & 0xFFFFFFFF) +#define SEQ_SUB(a,b) (((a)-(b)) & 0xFFFFFFFF) + +///* functions needed by the tcbshowtN.c code */ +extern unsigned val(char *name); +extern ui64 val64(char *name); +extern void PR(char *fmt, ...); +extern char *spr_tcp_state(unsigned state); +extern char *spr_ip_version(unsigned ipver); +extern char *spr_cctrl_sel(unsigned cctrl_sel0,unsigned cctrl_sel1); +extern char *spr_ulp_type(unsigned ulp_type); + + +extern unsigned parse_tcb( _TCBVAR *base_tvp, unsigned char *buf); +extern void display_tcb(_TCBVAR *tvp,unsigned char *buf,int aux); +extern void parse_n_display_xcb(unsigned char *buf); + +extern void swizzle_tcb(unsigned char *buf); +extern void set_tidtype(unsigned int tidtype); +extern void set_tcb_info(unsigned int tidtype, unsigned int cardtype); +extern void set_print_style(unsigned int prntstyl); + +#endif /* __tcb_common_h */ Copied: stable/11/usr.sbin/cxgbetool/tcbinfot4.c (from r330887, head/usr.sbin/cxgbetool/tcbinfot4.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.sbin/cxgbetool/tcbinfot4.c Tue Oct 16 22:09:33 2018 (r339393, copy of r330887, head/usr.sbin/cxgbetool/tcbinfot4.c) @@ -0,0 +1,1423 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Chelsio Communications, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* Auto-generated file. Avoid direct editing. */ +/* Edits will be lost when file regenerated. */ +#include +#include "tcb_common.h" +_TCBVAR g_tcb_info4[]={ + {"ulp_type" , 0, 0, 3, /* name,aux,lo,hi */ + NULL , 0, 0, /* faka,flo,fhi */ + "ulp_type" , /* aka */ + COMP_NONE , /* comp */ + "ULP mode: 0 =toe, 2=iscsi, 4=rdma, 5=ddp, remaining values are reserved", /*desc*/ + NULL, /*akadesc */ + }, + {"ulp_raw" , 0, 4, 11, /* name,aux,lo,hi */ + NULL , 0, 0, /* faka,flo,fhi */ + "ulp" , /* aka */ + COMP_ULP , /* comp */ + "ULP subtype", /*desc*/ + NULL, /*akadesc */ + }, + {"l2t_ix" , 0, 12, 23, /* name,aux,lo,hi */ + NULL , 0, 0, /* faka,flo,fhi */ + "l2t_ix" , /* aka */ + COMP_NONE , /* comp */ + "Destination MAC address index", /*desc*/ + NULL, /*akadesc */ + }, + {"smac_sel" , 0, 24, 31, /* name,aux,lo,hi */ + NULL , 0, 0, /* faka,flo,fhi */ + "smac_sel" , /* aka */ + COMP_NONE , /* comp */ + "Source MAC address index", /*desc*/ + NULL, /*akadesc */ + }, + {"TF_MIGRATING" , 0, 32, 32, /* name,aux,lo,hi */ + "t_flags" , 0, 0, /* faka,flo,fhi */ + "migrating" , /* aka */ + COMP_NONE , /* comp */ + NULL, /*desc*/ + NULL, /*akadesc */ + }, + {"TF_NON_OFFLOAD" , 0, 33, 33, /* name,aux,lo,hi */ + "t_flags" , 1, 1, /* faka,flo,fhi */ + "non_offload" , /* aka */ + COMP_NONE , /* comp */ + NULL, /*desc*/ + NULL, /*akadesc */ + }, + {"TF_LOCK_TID" , 0, 34, 34, /* name,aux,lo,hi */ + "t_flags" , 2, 2, /* faka,flo,fhi */ + "lock_tid" , /* aka */ + COMP_NONE , /* comp */ + NULL, /*desc*/ + NULL, /*akadesc */ + }, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Oct 16 22:13:06 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9365E10E37EB; Tue, 16 Oct 2018 22:13:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49A4782806; Tue, 16 Oct 2018 22:13:06 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 448D222A73; Tue, 16 Oct 2018 22:13:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9GMD6ct077766; Tue, 16 Oct 2018 22:13:06 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9GMD6IG077764; Tue, 16 Oct 2018 22:13:06 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810162213.w9GMD6IG077764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 16 Oct 2018 22:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339394 - stable/11/usr.sbin/cxgbetool X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/usr.sbin/cxgbetool X-SVN-Commit-Revision: 339394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 22:13:06 -0000 Author: np Date: Tue Oct 16 22:13:05 2018 New Revision: 339394 URL: https://svnweb.freebsd.org/changeset/base/339394 Log: MFC r332515: Fix typo in cxgbetool.8. Modified: stable/11/usr.sbin/cxgbetool/cxgbetool.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/cxgbetool/cxgbetool.8 ============================================================================== --- stable/11/usr.sbin/cxgbetool/cxgbetool.8 Tue Oct 16 22:09:33 2018 (r339393) +++ stable/11/usr.sbin/cxgbetool/cxgbetool.8 Tue Oct 16 22:13:05 2018 (r339394) @@ -420,7 +420,7 @@ Class Rate Limiting. .It Sy cl-wrr Class Weighted Round Robin. .Pp -.It Sy cl-wrr +.It Sy ch-rl Channel Rate Limiting. .El .It Sy mode Ar scheduler-mode From owner-svn-src-stable@freebsd.org Wed Oct 17 00:27:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A916A10E604B; Wed, 17 Oct 2018 00:27:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EC8488269; Wed, 17 Oct 2018 00:27:22 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43DA723FC8; Wed, 17 Oct 2018 00:27:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H0RMFp044255; Wed, 17 Oct 2018 00:27:22 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H0RLZ3044253; Wed, 17 Oct 2018 00:27:21 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170027.w9H0RLZ3044253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 00:27:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339395 - stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 339395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 00:27:22 -0000 Author: np Date: Wed Oct 17 00:27:21 2018 New Revision: 339395 URL: https://svnweb.freebsd.org/changeset/base/339395 Log: MFC r320419, r337679, r338366, and r338652. r320419: cxgbe/iw_cxgbe: Disable debug output by default. The help text for the sysctl already says that the default is 0. r337679: Remove unused stuff from iw_cxgbe.h r338366: cxgbe/iw_cxgbe: Fix iWARP RDMA + VIMAGE operation by setting the VNET properly in a couple of places in the driver. r338652: cxgbe/iw_cxgbe: Fix reported build breakage when the kernel configuration has "device cxgbe' but no VIMAGE. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Tue Oct 16 22:13:05 2018 (r339394) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Wed Oct 17 00:27:21 2018 (r339395) @@ -74,6 +74,7 @@ struct cpl_set_tcb_rpl; #include #include #include +#include static spinlock_t req_lock; static TAILQ_HEAD(c4iw_ep_list, c4iw_ep_common) req_list; @@ -1195,7 +1196,7 @@ static int enable_tcp_window_scaling = 1; SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, enable_tcp_window_scaling, CTLFLAG_RWTUN, &enable_tcp_window_scaling, 0, "Enable tcp window scaling (default = 1)"); -int c4iw_debug = 1; +int c4iw_debug = 0; SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, c4iw_debug, CTLFLAG_RWTUN, &c4iw_debug, 0, "Enable debug logging (default = 0)"); @@ -2514,6 +2515,10 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_ struct c4iw_dev *dev = to_c4iw_dev(cm_id->device); struct c4iw_ep *ep = NULL; struct ifnet *nh_ifp; /* Logical egress interface */ +#ifdef VIMAGE + struct rdma_cm_id *rdma_id = (struct rdma_cm_id*)cm_id->context; + struct vnet *vnet = rdma_id->route.addr.dev_addr.net; +#endif CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id); @@ -2559,7 +2564,10 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_ ref_qp(ep); ep->com.thread = curthread; + CURVNET_SET(vnet); err = get_ifnet_from_raddr(&cm_id->remote_addr, &nh_ifp); + CURVNET_RESTORE(); + if (err) { CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep); @@ -2802,7 +2810,10 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, if (!ep->parent_ep) ep->com.state = MORIBUND; + + CURVNET_SET(ep->com.so->so_vnet); sodisconnect(ep->com.so); + CURVNET_RESTORE(); } } Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Oct 16 22:13:05 2018 (r339394) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Wed Oct 17 00:27:21 2018 (r339395) @@ -976,20 +976,4 @@ u32 c4iw_get_qpid(struct c4iw_rdev *rdev, struct c4iw_ void c4iw_put_qpid(struct c4iw_rdev *rdev, u32 qid, struct c4iw_dev_ucontext *uctx); void c4iw_ev_dispatch(struct c4iw_dev *dev, struct t4_cqe *err_cqe); -void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid, - enum t4_bar2_qtype qtype, - unsigned int *pbar2_qid, u64 *pbar2_pa); -extern struct cxgb4_client t4c_client; -extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS]; - -#if defined(__i386__) || defined(__amd64__) -#define L1_CACHE_BYTES 128 -#else -#define L1_CACHE_BYTES 32 -#endif - -void your_reg_device(struct c4iw_dev *dev); - -#define SGE_CTRLQ_NUM 0 - #endif From owner-svn-src-stable@freebsd.org Wed Oct 17 00:45:02 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E40E10E66CA; Wed, 17 Oct 2018 00:45:02 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 394FA88ACC; Wed, 17 Oct 2018 00:45:02 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A39824304; Wed, 17 Oct 2018 00:45:02 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H0j1Aw054122; Wed, 17 Oct 2018 00:45:01 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H0j1dw054119; Wed, 17 Oct 2018 00:45:01 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170045.w9H0j1dw054119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 00:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339396 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 339396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 00:45:02 -0000 Author: np Date: Wed Oct 17 00:45:01 2018 New Revision: 339396 URL: https://svnweb.freebsd.org/changeset/base/339396 Log: MFC r325840, r327811, and r329701. r325840: CXGBE: fix big-endian behaviour The setbit/clearbit pair casts the bitfield pointer to uint8_t* which effectively treats its contents as little-endian variable. The ffs() function accepts int as the parameter, which is big-endian. Use uint8_t here to avoid mismatch, as we have only 4 doorbells. Submitted by: Wojciech Macek Reviewed by: np Obtained from: Semihalf Sponsored by: QCM Technologies Differential revision: https://reviews.freebsd.org/D13084 r327811: CXGBE: fix get_filt to be endianness-aware Unconditional 32-bit shift is not endianness-safe. Modify the logic to work both on LE and BE. Submitted by: Wojciech Macek Reviewed by: np Obtained from: Semihalf Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13102 r329701: CXGBE: implement prefetch on non-Intel architectures Submitted by: Michal Stanek Obtained from: Semihalf Reviewed by: np, pdk@semihalf.com Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D14452 Modified: stable/11/sys/dev/cxgbe/adapter.h stable/11/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/11/sys/dev/cxgbe/adapter.h Wed Oct 17 00:27:21 2018 (r339395) +++ stable/11/sys/dev/cxgbe/adapter.h Wed Oct 17 00:45:01 2018 (r339396) @@ -70,7 +70,7 @@ prefetch(void *x) __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); } #else -#define prefetch(x) +#define prefetch(x) __builtin_prefetch(x) #endif #ifndef SYSCTL_ADD_UQUAD @@ -422,7 +422,7 @@ struct sge_eq { struct mtx eq_lock; struct tx_desc *desc; /* KVA of descriptor ring */ - uint16_t doorbells; + uint8_t doorbells; volatile uint32_t *udb; /* KVA of doorbell (lies within BAR2) */ u_int udb_qid; /* relative qid within the doorbell page */ uint16_t sidx; /* index of the entry with the status page */ @@ -692,7 +692,7 @@ struct sge_nm_txq { uint16_t equiqidx; /* EQUIQ last requested at this pidx */ uint16_t equeqidx; /* EQUEQ last requested at this pidx */ uint16_t dbidx; /* pidx of the most recent doorbell */ - uint16_t doorbells; + uint8_t doorbells; volatile uint32_t *udb; u_int udb_qid; u_int cntxt_id; @@ -804,7 +804,7 @@ struct adapter { struct l2t_data *l2t; /* L2 table */ struct tid_info tids; - uint16_t doorbells; + uint8_t doorbells; int offload_map; /* ports with IFCAP_TOE enabled */ int active_ulds; /* ULDs activated on this adapter */ int flags; Modified: stable/11/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_sge.c Wed Oct 17 00:27:21 2018 (r339395) +++ stable/11/sys/dev/cxgbe/t4_sge.c Wed Oct 17 00:45:01 2018 (r339396) @@ -4731,13 +4731,13 @@ get_flit(struct sglist_seg *segs, int nsegs, int idx) switch (idx % 3) { case 0: { - __be64 rc; + uint64_t rc; - rc = htobe32(segs[i].ss_len); + rc = (uint64_t)segs[i].ss_len << 32; if (i + 1 < nsegs) - rc |= (uint64_t)htobe32(segs[i + 1].ss_len) << 32; + rc |= (uint64_t)(segs[i + 1].ss_len); - return (rc); + return (htobe64(rc)); } case 1: return (htobe64(segs[i].ss_paddr)); From owner-svn-src-stable@freebsd.org Wed Oct 17 00:57:29 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C4EF10E6986; Wed, 17 Oct 2018 00:57:29 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBFA088F61; Wed, 17 Oct 2018 00:57:28 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B83CD24497; Wed, 17 Oct 2018 00:57:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H0vSST059513; Wed, 17 Oct 2018 00:57:28 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H0vSnX059512; Wed, 17 Oct 2018 00:57:28 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170057.w9H0vSnX059512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 00:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339397 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 339397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 00:57:29 -0000 Author: np Date: Wed Oct 17 00:57:28 2018 New Revision: 339397 URL: https://svnweb.freebsd.org/changeset/base/339397 Log: MFC r333139: cxgbe(4): Destroy the cdev before disabling interrupts in driver detach. Filter work requests are submitted in the nexus cdev's ioctl which then blocks waiting for a reply. If driver detach runs in this state and disables interrupts the ioctl will never complete and detach will hang in destroy_cdev. Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 00:45:01 2018 (r339396) +++ stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 00:57:28 2018 (r339397) @@ -1308,15 +1308,15 @@ t4_detach_common(device_t dev) sc = device_get_softc(dev); + if (sc->cdev) { + destroy_dev(sc->cdev); + sc->cdev = NULL; + } + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) t4_intr_disable(sc); - } - - if (sc->cdev) { - destroy_dev(sc->cdev); - sc->cdev = NULL; } if (device_is_attached(dev)) { From owner-svn-src-stable@freebsd.org Wed Oct 17 01:05:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5534110E6CDD; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B66789624; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05BCB2462E; Wed, 17 Oct 2018 01:05:53 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H15qcw065225; Wed, 17 Oct 2018 01:05:52 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H15q2M065224; Wed, 17 Oct 2018 01:05:52 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170105.w9H15q2M065224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339398 - stable/11/sys/dev/cxgbe/common X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/common X-SVN-Commit-Revision: 339398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:05:53 -0000 Author: np Date: Wed Oct 17 01:05:52 2018 New Revision: 339398 URL: https://svnweb.freebsd.org/changeset/base/339398 Log: MFC r336042: cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB sectors, instead of refusing to attach to the card. Submitted by: Casey Leedom @ Chelsio Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 00:57:28 2018 (r339397) +++ stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 01:05:52 2018 (r339398) @@ -7844,7 +7844,7 @@ int t4_get_flash_params(struct adapter *adapter) int ret; u32 flashid = 0; unsigned int part, manufacturer; - unsigned int density, size; + unsigned int density, size = 0; /* @@ -7883,7 +7883,7 @@ int t4_get_flash_params(struct adapter *adapter) */ manufacturer = flashid & 0xff; switch (manufacturer) { - case 0x20: { /* Micron/Numonix */ + case 0x20: /* Micron/Numonix */ /* * This Density -> Size decoding table is taken from Micron * Data Sheets. @@ -7899,17 +7899,10 @@ int t4_get_flash_params(struct adapter *adapter) case 0x20: size = 1 << 26; break; /* 64MB */ case 0x21: size = 1 << 27; break; /* 128MB */ case 0x22: size = 1 << 28; break; /* 256MB */ - - default: - CH_ERR(adapter, "Micron Flash Part has bad size, " - "ID = %#x, Density code = %#x\n", - flashid, density); - return -EINVAL; } break; - } - case 0x9d: { /* ISSI -- Integrated Silicon Solution, Inc. */ + case 0x9d: /* ISSI -- Integrated Silicon Solution, Inc. */ /* * This Density -> Size decoding table is taken from ISSI * Data Sheets. @@ -7918,17 +7911,10 @@ int t4_get_flash_params(struct adapter *adapter) switch (density) { case 0x16: size = 1 << 25; break; /* 32MB */ case 0x17: size = 1 << 26; break; /* 64MB */ - - default: - CH_ERR(adapter, "ISSI Flash Part has bad size, " - "ID = %#x, Density code = %#x\n", - flashid, density); - return -EINVAL; } break; - } - case 0xc2: { /* Macronix */ + case 0xc2: /* Macronix */ /* * This Density -> Size decoding table is taken from Macronix * Data Sheets. @@ -7937,17 +7923,10 @@ int t4_get_flash_params(struct adapter *adapter) switch (density) { case 0x17: size = 1 << 23; break; /* 8MB */ case 0x18: size = 1 << 24; break; /* 16MB */ - - default: - CH_ERR(adapter, "Macronix Flash Part has bad size, " - "ID = %#x, Density code = %#x\n", - flashid, density); - return -EINVAL; } break; - } - case 0xef: { /* Winbond */ + case 0xef: /* Winbond */ /* * This Density -> Size decoding table is taken from Winbond * Data Sheets. @@ -7956,19 +7935,19 @@ int t4_get_flash_params(struct adapter *adapter) switch (density) { case 0x17: size = 1 << 23; break; /* 8MB */ case 0x18: size = 1 << 24; break; /* 16MB */ - - default: - CH_ERR(adapter, "Winbond Flash Part has bad size, " - "ID = %#x, Density code = %#x\n", - flashid, density); - return -EINVAL; } break; } - default: - CH_ERR(adapter, "Unsupported Flash Part, ID = %#x\n", flashid); - return -EINVAL; + /* If we didn't recognize the FLASH part, that's no real issue: the + * Hardware/Software contract says that Hardware will _*ALWAYS*_ + * use a FLASH part which is at least 4MB in size and has 64KB + * sectors. The unrecognized FLASH part is likely to be much larger + * than 4MB, but that's all we really need. + */ + if (size == 0) { + CH_WARN(adapter, "Unknown Flash Part, ID = %#x, assuming 4MB\n", flashid); + size = 1 << 22; } /* From owner-svn-src-stable@freebsd.org Wed Oct 17 01:20:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10E0B10E702B; Wed, 17 Oct 2018 01:20:20 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B3F8489B0B; Wed, 17 Oct 2018 01:20:19 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A56DC247DD; Wed, 17 Oct 2018 01:20:19 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H1KJo0070358; Wed, 17 Oct 2018 01:20:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H1KIqi070352; Wed, 17 Oct 2018 01:20:18 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170120.w9H1KIqi070352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339399 - in stable/11: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/tom X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/tom X-SVN-Commit-Revision: 339399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:20:20 -0000 Author: np Date: Wed Oct 17 01:20:18 2018 New Revision: 339399 URL: https://svnweb.freebsd.org/changeset/base/339399 Log: MFC r338924: cxgbe(4): Link related changes. - Switch to using 32b port/link capabilities in the driver. The 32b format is used internally by firmwares > 1.16.45.0 and the driver will now interact with the firmware in its native format, whether it's 16b or 32b. Note that the 16b format doesn't have room for 50G, 200G, or 400G speeds. - Add a bit in the pause_settings knobs to allow negotiated PAUSE settings to override manual settings. - Ensure that manual link settings persist across an administrative down/up as well as transceiver unplug/replug. - Remove unused is_*G_port() functions. Sponsored by: Chelsio Communications Modified: stable/11/share/man/man4/cxgbe.4 stable/11/sys/dev/cxgbe/adapter.h stable/11/sys/dev/cxgbe/common/common.h stable/11/sys/dev/cxgbe/common/t4_hw.c stable/11/sys/dev/cxgbe/osdep.h stable/11/sys/dev/cxgbe/t4_main.c stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/cxgbe.4 ============================================================================== --- stable/11/share/man/man4/cxgbe.4 Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/share/man/man4/cxgbe.4 Wed Oct 17 01:20:18 2018 (r339399) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 22, 2016 +.Dd Sep 24, 2018 .Dt CXGBE 4 .Os .Sh NAME @@ -278,19 +278,21 @@ This usually results in the port emitting PAUSE frames 1 instructs the hardware to drop frames destined for congested queues. .It Va hw.cxgbe.pause_settings PAUSE frame settings. -Bit 0 is rx_pause, bit 1 is tx_pause. +Bit 0 is rx_pause, bit 1 is tx_pause, bit 2 is pause_autoneg. rx_pause = 1 instructs the hardware to heed incoming PAUSE frames, 0 instructs it to ignore them. tx_pause = 1 allows the hardware to emit PAUSE frames when its receive FIFO reaches a high threshold, 0 prohibits the hardware from emitting PAUSE frames. -The default is 3 (both rx_pause and tx_pause = 1). +pause_autoneg = 1 overrides the rx_pause and tx_pause bits and instructs the +hardware to negotiate PAUSE settings with the link peer. +The default is 7 (all three = 1). This tunable establishes the default PAUSE settings for all ports. Settings can be displayed and controlled on a per-port basis via the dev..X.pause_settings sysctl. .It Va hw.cxgbe.fec FEC (Forward Error Correction) settings. 0 diables FEC. -Bit 0 enables RS FEC, bit 1 enables BASE-R RS, bit 3 is reserved. +Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC). The default is -1 which lets the driver pick a value. This tunable establishes the default FEC settings for all ports. Settings can be displayed and controlled on a per-port basis via the Modified: stable/11/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/11/sys/dev/cxgbe/adapter.h Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/sys/dev/cxgbe/adapter.h Wed Oct 17 01:20:18 2018 (r339399) @@ -289,7 +289,6 @@ struct port_info { uint8_t rx_e_chan_map; /* rx TP e-channel bitmap */ struct link_config link_cfg; - struct link_config old_link_cfg; struct ifmedia media; struct timeval last_refreshed; @@ -1050,52 +1049,6 @@ t4_os_set_hw_addr(struct port_info *pi, uint8_t hw_add { bcopy(hw_addr, pi->vi[0].hw_addr, ETHER_ADDR_LEN); -} - -static inline bool -is_10G_port(const struct port_info *pi) -{ - - return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) != 0); -} - -static inline bool -is_25G_port(const struct port_info *pi) -{ - - return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_25G) != 0); -} - -static inline bool -is_40G_port(const struct port_info *pi) -{ - - return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) != 0); -} - -static inline bool -is_100G_port(const struct port_info *pi) -{ - - return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G) != 0); -} - -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_25G) - return (25); - 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 Modified: stable/11/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/11/sys/dev/cxgbe/common/common.h Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/sys/dev/cxgbe/common/common.h Wed Oct 17 01:20:18 2018 (r339399) @@ -64,9 +64,10 @@ enum { }; enum { + FEC_NONE = 0, FEC_RS = 1 << 0, FEC_BASER_RS = 1 << 1, - FEC_RESERVED = 1 << 2, + FEC_AUTO = 1 << 5, /* M_FW_PORT_CAP32_FEC + 1 */ }; enum t4_bar2_qtype { T4_BAR2_QTYPE_EGRESS, T4_BAR2_QTYPE_INGRESS }; @@ -368,6 +369,7 @@ struct adapter_params { resources for TOE operation. */ unsigned int bypass:1; /* this is a bypass card */ unsigned int ethoffload:1; + unsigned int port_caps32:1; unsigned int ofldq_wr_cred; unsigned int eo_wr_cred; @@ -409,20 +411,21 @@ struct trace_params { }; struct link_config { - /* OS-specific code owns all the requested_* fields */ - unsigned char requested_aneg; /* link aneg user has requested */ - unsigned char requested_fc; /* flow control user has requested */ - unsigned char requested_fec; /* FEC user has requested */ - unsigned int requested_speed; /* speed user has requested (Mbps) */ + /* OS-specific code owns all the requested_* fields. */ + int8_t requested_aneg; /* link autonegotiation */ + int8_t requested_fc; /* flow control */ + int8_t requested_fec; /* FEC */ + u_int requested_speed; /* speed (Mbps) */ - unsigned short supported; /* link capabilities */ - unsigned short advertising; /* advertised capabilities */ - unsigned short lp_advertising; /* peer advertised capabilities */ - unsigned int speed; /* actual link speed (Mbps) */ - unsigned char fc; /* actual link flow control */ - unsigned char fec; /* actual FEC */ - unsigned char link_ok; /* link up? */ - unsigned char link_down_rc; /* link down reason */ + uint32_t supported; /* link capabilities */ + uint32_t advertising; /* advertised capabilities */ + uint32_t lp_advertising; /* peer advertised capabilities */ + uint32_t fec_hint; /* use this fec */ + u_int speed; /* actual link speed (Mbps) */ + int8_t fc; /* actual link flow control */ + int8_t fec; /* actual FEC */ + bool link_ok; /* link up? */ + uint8_t link_down_rc; /* link down reason */ }; #include "adapter.h" @@ -854,5 +857,16 @@ int t4vf_prep_adapter(struct adapter *adapter); int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid, enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset, unsigned int *pbar2_qid); +unsigned int fwcap_to_speed(uint32_t caps); +uint32_t speed_to_fwcap(unsigned int speed); +uint32_t fwcap_top_speed(uint32_t caps); + +static inline int +port_top_speed(const struct port_info *pi) +{ + + /* Mbps -> Gbps */ + return (fwcap_to_speed(pi->link_cfg.supported) / 1000); +} #endif /* __CHELSIO_COMMON_H */ Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 01:20:18 2018 (r339399) @@ -3690,6 +3690,93 @@ void t4_ulprx_read_la(struct adapter *adap, u32 *la_bu } /** + * fwcaps16_to_caps32 - convert 16-bit Port Capabilities to 32-bits + * @caps16: a 16-bit Port Capabilities value + * + * Returns the equivalent 32-bit Port Capabilities value. + */ +static uint32_t fwcaps16_to_caps32(uint16_t caps16) +{ + uint32_t caps32 = 0; + + #define CAP16_TO_CAP32(__cap) \ + do { \ + if (caps16 & FW_PORT_CAP_##__cap) \ + caps32 |= FW_PORT_CAP32_##__cap; \ + } while (0) + + CAP16_TO_CAP32(SPEED_100M); + CAP16_TO_CAP32(SPEED_1G); + CAP16_TO_CAP32(SPEED_25G); + CAP16_TO_CAP32(SPEED_10G); + CAP16_TO_CAP32(SPEED_40G); + CAP16_TO_CAP32(SPEED_100G); + CAP16_TO_CAP32(FC_RX); + CAP16_TO_CAP32(FC_TX); + CAP16_TO_CAP32(ANEG); + CAP16_TO_CAP32(FORCE_PAUSE); + CAP16_TO_CAP32(MDIAUTO); + CAP16_TO_CAP32(MDISTRAIGHT); + CAP16_TO_CAP32(FEC_RS); + CAP16_TO_CAP32(FEC_BASER_RS); + CAP16_TO_CAP32(802_3_PAUSE); + CAP16_TO_CAP32(802_3_ASM_DIR); + + #undef CAP16_TO_CAP32 + + return caps32; +} + +/** + * fwcaps32_to_caps16 - convert 32-bit Port Capabilities to 16-bits + * @caps32: a 32-bit Port Capabilities value + * + * Returns the equivalent 16-bit Port Capabilities value. Note that + * not all 32-bit Port Capabilities can be represented in the 16-bit + * Port Capabilities and some fields/values may not make it. + */ +static uint16_t fwcaps32_to_caps16(uint32_t caps32) +{ + uint16_t caps16 = 0; + + #define CAP32_TO_CAP16(__cap) \ + do { \ + if (caps32 & FW_PORT_CAP32_##__cap) \ + caps16 |= FW_PORT_CAP_##__cap; \ + } while (0) + + CAP32_TO_CAP16(SPEED_100M); + CAP32_TO_CAP16(SPEED_1G); + CAP32_TO_CAP16(SPEED_10G); + CAP32_TO_CAP16(SPEED_25G); + CAP32_TO_CAP16(SPEED_40G); + CAP32_TO_CAP16(SPEED_100G); + CAP32_TO_CAP16(FC_RX); + CAP32_TO_CAP16(FC_TX); + CAP32_TO_CAP16(802_3_PAUSE); + CAP32_TO_CAP16(802_3_ASM_DIR); + CAP32_TO_CAP16(ANEG); + CAP32_TO_CAP16(FORCE_PAUSE); + CAP32_TO_CAP16(MDIAUTO); + CAP32_TO_CAP16(MDISTRAIGHT); + CAP32_TO_CAP16(FEC_RS); + CAP32_TO_CAP16(FEC_BASER_RS); + + #undef CAP32_TO_CAP16 + + return caps16; +} + +static bool +is_bt(struct port_info *pi) +{ + + return (pi->port_type == FW_PORT_TYPE_BT_SGMII || + pi->port_type == FW_PORT_TYPE_BT_XFI || + pi->port_type == FW_PORT_TYPE_BT_XAUI); +} + +/** * t4_link_l1cfg - apply link configuration to MAC/PHY * @phy: the PHY to setup * @mac: the MAC to setup @@ -3706,53 +3793,45 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m struct link_config *lc) { struct fw_port_cmd c; - unsigned int mdi = V_FW_PORT_CAP_MDI(FW_PORT_CAP_MDI_AUTO); + unsigned int mdi = V_FW_PORT_CAP32_MDI(FW_PORT_CAP32_MDI_AUTO); unsigned int aneg, fc, fec, speed, rcap; fc = 0; if (lc->requested_fc & PAUSE_RX) - fc |= FW_PORT_CAP_FC_RX; + fc |= FW_PORT_CAP32_FC_RX; if (lc->requested_fc & PAUSE_TX) - fc |= FW_PORT_CAP_FC_TX; + fc |= FW_PORT_CAP32_FC_TX; + if (!(lc->requested_fc & PAUSE_AUTONEG)) + fc |= FW_PORT_CAP32_FORCE_PAUSE; fec = 0; - if (lc->requested_fec & FEC_RS) - fec = FW_PORT_CAP_FEC_RS; - else if (lc->requested_fec & FEC_BASER_RS) - fec = FW_PORT_CAP_FEC_BASER_RS; + if (lc->requested_fec == FEC_AUTO) + fec = lc->fec_hint; + else { + if (lc->requested_fec & FEC_RS) + fec |= FW_PORT_CAP32_FEC_RS; + if (lc->requested_fec & FEC_BASER_RS) + fec |= FW_PORT_CAP32_FEC_BASER_RS; + } - if (!(lc->supported & FW_PORT_CAP_ANEG) || - lc->requested_aneg == AUTONEG_DISABLE) { + if (lc->requested_aneg == AUTONEG_DISABLE) aneg = 0; - switch (lc->requested_speed) { - case 100000: - speed = FW_PORT_CAP_SPEED_100G; - break; - case 40000: - speed = FW_PORT_CAP_SPEED_40G; - break; - case 25000: - speed = FW_PORT_CAP_SPEED_25G; - break; - case 10000: - speed = FW_PORT_CAP_SPEED_10G; - break; - case 1000: - speed = FW_PORT_CAP_SPEED_1G; - break; - case 100: - speed = FW_PORT_CAP_SPEED_100M; - break; - default: - return -EINVAL; - break; - } - } else { - aneg = FW_PORT_CAP_ANEG; - speed = lc->supported & - V_FW_PORT_CAP_SPEED(M_FW_PORT_CAP_SPEED); - } + else if (lc->requested_aneg == AUTONEG_ENABLE) + aneg = FW_PORT_CAP32_ANEG; + else + aneg = lc->supported & FW_PORT_CAP32_ANEG; + if (aneg) { + speed = lc->supported & V_FW_PORT_CAP32_SPEED(M_FW_PORT_CAP32_SPEED); + } else if (lc->requested_speed != 0) + speed = speed_to_fwcap(lc->requested_speed); + else + speed = fwcap_top_speed(lc->supported); + + /* Force AN on for BT cards. */ + if (is_bt(adap->port[port])) + aneg = lc->supported & FW_PORT_CAP32_ANEG; + rcap = aneg | speed | fc | fec; if ((rcap | lc->supported) != lc->supported) { #ifdef INVARIANTS @@ -3767,10 +3846,17 @@ int t4_link_l1cfg(struct adapter *adap, unsigned int m c.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_EXEC | V_FW_PORT_CMD_PORTID(port)); - c.action_to_len16 = - cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG) | + if (adap->params.port_caps32) { + c.action_to_len16 = + cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG32) | + FW_LEN16(c)); + c.u.l1cfg32.rcap32 = cpu_to_be32(rcap); + } else { + c.action_to_len16 = + cpu_to_be32(V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_L1_CFG) | FW_LEN16(c)); - c.u.l1cfg.rcap = cpu_to_be32(rcap); + c.u.l1cfg.rcap = cpu_to_be32(fwcaps32_to_caps16(rcap)); + } return t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), NULL); } @@ -7670,56 +7756,205 @@ const char *t4_link_down_rc_str(unsigned char link_dow } /* + * Return the highest speed set in the port capabilities, in Mb/s. + */ +unsigned int fwcap_to_speed(uint32_t caps) +{ + #define TEST_SPEED_RETURN(__caps_speed, __speed) \ + do { \ + if (caps & FW_PORT_CAP32_SPEED_##__caps_speed) \ + return __speed; \ + } while (0) + + TEST_SPEED_RETURN(400G, 400000); + TEST_SPEED_RETURN(200G, 200000); + TEST_SPEED_RETURN(100G, 100000); + TEST_SPEED_RETURN(50G, 50000); + TEST_SPEED_RETURN(40G, 40000); + TEST_SPEED_RETURN(25G, 25000); + TEST_SPEED_RETURN(10G, 10000); + TEST_SPEED_RETURN(1G, 1000); + TEST_SPEED_RETURN(100M, 100); + + #undef TEST_SPEED_RETURN + + return 0; +} + +/* + * Return the port capabilities bit for the given speed, which is in Mb/s. + */ +uint32_t speed_to_fwcap(unsigned int speed) +{ + #define TEST_SPEED_RETURN(__caps_speed, __speed) \ + do { \ + if (speed == __speed) \ + return FW_PORT_CAP32_SPEED_##__caps_speed; \ + } while (0) + + TEST_SPEED_RETURN(400G, 400000); + TEST_SPEED_RETURN(200G, 200000); + TEST_SPEED_RETURN(100G, 100000); + TEST_SPEED_RETURN(50G, 50000); + TEST_SPEED_RETURN(40G, 40000); + TEST_SPEED_RETURN(25G, 25000); + TEST_SPEED_RETURN(10G, 10000); + TEST_SPEED_RETURN(1G, 1000); + TEST_SPEED_RETURN(100M, 100); + + #undef TEST_SPEED_RETURN + + return 0; +} + +/* + * Return the port capabilities bit for the highest speed in the capabilities. + */ +uint32_t fwcap_top_speed(uint32_t caps) +{ + #define TEST_SPEED_RETURN(__caps_speed) \ + do { \ + if (caps & FW_PORT_CAP32_SPEED_##__caps_speed) \ + return FW_PORT_CAP32_SPEED_##__caps_speed; \ + } while (0) + + TEST_SPEED_RETURN(400G); + TEST_SPEED_RETURN(200G); + TEST_SPEED_RETURN(100G); + TEST_SPEED_RETURN(50G); + TEST_SPEED_RETURN(40G); + TEST_SPEED_RETURN(25G); + TEST_SPEED_RETURN(10G); + TEST_SPEED_RETURN(1G); + TEST_SPEED_RETURN(100M); + + #undef TEST_SPEED_RETURN + + return 0; +} + + +/** + * lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities + * @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value + * + * Translates old FW_PORT_ACTION_GET_PORT_INFO lstatus field into new + * 32-bit Port Capabilities value. + */ +static uint32_t lstatus_to_fwcap(u32 lstatus) +{ + uint32_t linkattr = 0; + + /* + * Unfortunately the format of the Link Status in the old + * 16-bit Port Information message isn't the same as the + * 16-bit Port Capabilities bitfield used everywhere else ... + */ + if (lstatus & F_FW_PORT_CMD_RXPAUSE) + linkattr |= FW_PORT_CAP32_FC_RX; + if (lstatus & F_FW_PORT_CMD_TXPAUSE) + linkattr |= FW_PORT_CAP32_FC_TX; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M)) + linkattr |= FW_PORT_CAP32_SPEED_100M; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G)) + linkattr |= FW_PORT_CAP32_SPEED_1G; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G)) + linkattr |= FW_PORT_CAP32_SPEED_10G; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_25G)) + linkattr |= FW_PORT_CAP32_SPEED_25G; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G)) + linkattr |= FW_PORT_CAP32_SPEED_40G; + if (lstatus & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100G)) + linkattr |= FW_PORT_CAP32_SPEED_100G; + + return linkattr; +} + +/* * Updates all fields owned by the common code in port_info and link_config * based on information provided by the firmware. Does not touch any * requested_* field. */ -static void handle_port_info(struct port_info *pi, const struct fw_port_info *p) +static void handle_port_info(struct port_info *pi, const struct fw_port_cmd *p, + enum fw_port_action action, bool *mod_changed, bool *link_changed) { - struct link_config *lc = &pi->link_cfg; - int speed; + struct link_config old_lc, *lc = &pi->link_cfg; unsigned char fc, fec; - u32 stat = be32_to_cpu(p->lstatus_to_modtype); + u32 stat, linkattr; + int old_ptype, old_mtype; - pi->port_type = G_FW_PORT_CMD_PTYPE(stat); - pi->mod_type = G_FW_PORT_CMD_MODTYPE(stat); - pi->mdio_addr = stat & F_FW_PORT_CMD_MDIOCAP ? - G_FW_PORT_CMD_MDIOADDR(stat) : -1; + old_ptype = pi->port_type; + old_mtype = pi->mod_type; + old_lc = *lc; + if (action == FW_PORT_ACTION_GET_PORT_INFO) { + stat = be32_to_cpu(p->u.info.lstatus_to_modtype); - lc->supported = be16_to_cpu(p->pcap); - lc->advertising = be16_to_cpu(p->acap); - lc->lp_advertising = be16_to_cpu(p->lpacap); - lc->link_ok = (stat & F_FW_PORT_CMD_LSTATUS) != 0; - lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC(stat); + pi->port_type = G_FW_PORT_CMD_PTYPE(stat); + pi->mod_type = G_FW_PORT_CMD_MODTYPE(stat); + pi->mdio_addr = stat & F_FW_PORT_CMD_MDIOCAP ? + G_FW_PORT_CMD_MDIOADDR(stat) : -1; - speed = 0; - if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M)) - speed = 100; - else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G)) - speed = 1000; - else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G)) - speed = 10000; - else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_25G)) - speed = 25000; - else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G)) - speed = 40000; - else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100G)) - speed = 100000; - lc->speed = speed; + lc->supported = fwcaps16_to_caps32(be16_to_cpu(p->u.info.pcap)); + lc->advertising = fwcaps16_to_caps32(be16_to_cpu(p->u.info.acap)); + lc->lp_advertising = fwcaps16_to_caps32(be16_to_cpu(p->u.info.lpacap)); + lc->link_ok = (stat & F_FW_PORT_CMD_LSTATUS) != 0; + lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC(stat); + linkattr = lstatus_to_fwcap(stat); + } else if (action == FW_PORT_ACTION_GET_PORT_INFO32) { + stat = be32_to_cpu(p->u.info32.lstatus32_to_cbllen32); + + pi->port_type = G_FW_PORT_CMD_PORTTYPE32(stat); + pi->mod_type = G_FW_PORT_CMD_MODTYPE32(stat); + pi->mdio_addr = stat & F_FW_PORT_CMD_MDIOCAP32 ? + G_FW_PORT_CMD_MDIOADDR32(stat) : -1; + + lc->supported = be32_to_cpu(p->u.info32.pcaps32); + lc->advertising = be32_to_cpu(p->u.info32.acaps32); + lc->lp_advertising = be16_to_cpu(p->u.info32.lpacaps32); + lc->link_ok = (stat & F_FW_PORT_CMD_LSTATUS32) != 0; + lc->link_down_rc = G_FW_PORT_CMD_LINKDNRC32(stat); + + linkattr = be32_to_cpu(p->u.info32.linkattr32); + } else { + CH_ERR(pi->adapter, "bad port_info action 0x%x\n", action); + return; + } + + lc->speed = fwcap_to_speed(linkattr); + fc = 0; - if (stat & F_FW_PORT_CMD_RXPAUSE) + if (linkattr & FW_PORT_CAP32_FC_RX) fc |= PAUSE_RX; - if (stat & F_FW_PORT_CMD_TXPAUSE) + if (linkattr & FW_PORT_CAP32_FC_TX) fc |= PAUSE_TX; lc->fc = fc; - fec = 0; - if (lc->advertising & FW_PORT_CAP_FEC_RS) - fec = FEC_RS; - else if (lc->advertising & FW_PORT_CAP_FEC_BASER_RS) - fec = FEC_BASER_RS; + fec = FEC_NONE; + if (linkattr & FW_PORT_CAP32_FEC_RS) + fec |= FEC_RS; + if (linkattr & FW_PORT_CAP32_FEC_BASER_RS) + fec |= FEC_BASER_RS; lc->fec = fec; + + if (mod_changed != NULL) + *mod_changed = false; + if (link_changed != NULL) + *link_changed = false; + if (old_ptype != pi->port_type || old_mtype != pi->mod_type || + old_lc.supported != lc->supported) { + if (pi->mod_type != FW_PORT_MOD_TYPE_NONE) { + lc->fec_hint = lc->advertising & + V_FW_PORT_CAP32_FEC(M_FW_PORT_CAP32_FEC); + } + if (mod_changed != NULL) + *mod_changed = true; + } + if (old_lc.link_ok != lc->link_ok || old_lc.speed != lc->speed || + old_lc.fec != lc->fec || old_lc.fc != lc->fc) { + if (link_changed != NULL) + *link_changed = true; + } } /** @@ -7732,22 +7967,24 @@ static void handle_port_info(struct port_info *pi, con */ int t4_update_port_info(struct port_info *pi) { - struct fw_port_cmd port_cmd; + struct adapter *sc = pi->adapter; + struct fw_port_cmd cmd; + enum fw_port_action action; int ret; - memset(&port_cmd, 0, sizeof port_cmd); - port_cmd.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) | - F_FW_CMD_REQUEST | F_FW_CMD_READ | - V_FW_PORT_CMD_PORTID(pi->tx_chan)); - port_cmd.action_to_len16 = cpu_to_be32( - V_FW_PORT_CMD_ACTION(FW_PORT_ACTION_GET_PORT_INFO) | - FW_LEN16(port_cmd)); - ret = t4_wr_mbox_ns(pi->adapter, pi->adapter->mbox, - &port_cmd, sizeof(port_cmd), &port_cmd); + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_portid = cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_READ | + V_FW_PORT_CMD_PORTID(pi->tx_chan)); + action = sc->params.port_caps32 ? FW_PORT_ACTION_GET_PORT_INFO32 : + FW_PORT_ACTION_GET_PORT_INFO; + cmd.action_to_len16 = cpu_to_be32(V_FW_PORT_CMD_ACTION(action) | + FW_LEN16(cmd)); + ret = t4_wr_mbox_ns(sc, sc->mbox, &cmd, sizeof(cmd), &cmd); if (ret) return ret; - handle_port_info(pi, &port_cmd.u.info); + handle_port_info(pi, &cmd, action, NULL, NULL); return 0; } @@ -7762,15 +7999,18 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 { u8 opcode = *(const u8 *)rpl; const struct fw_port_cmd *p = (const void *)rpl; - unsigned int action = - G_FW_PORT_CMD_ACTION(be32_to_cpu(p->action_to_len16)); + enum fw_port_action action = + G_FW_PORT_CMD_ACTION(be32_to_cpu(p->action_to_len16)); + bool mod_changed, link_changed; - if (opcode == FW_PORT_CMD && action == FW_PORT_ACTION_GET_PORT_INFO) { + if (opcode == FW_PORT_CMD && + (action == FW_PORT_ACTION_GET_PORT_INFO || + action == FW_PORT_ACTION_GET_PORT_INFO32)) { /* link/module state change message */ - int i, old_ptype, old_mtype; + int i; int chan = G_FW_PORT_CMD_PORTID(be32_to_cpu(p->op_to_portid)); struct port_info *pi = NULL; - struct link_config *lc, *old_lc; + struct link_config *lc; for_each_port(adap, i) { pi = adap2pinfo(adap, i); @@ -7780,23 +8020,15 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be6 lc = &pi->link_cfg; PORT_LOCK(pi); - old_lc = &pi->old_link_cfg; - old_ptype = pi->port_type; - old_mtype = pi->mod_type; - handle_port_info(pi, &p->u.info); + handle_port_info(pi, p, action, &mod_changed, &link_changed); PORT_UNLOCK(pi); - if (old_ptype != pi->port_type || old_mtype != pi->mod_type) { + if (mod_changed) t4_os_portmod_changed(pi); - } - PORT_LOCK(pi); - if (old_lc->link_ok != lc->link_ok || - old_lc->speed != lc->speed || - old_lc->fec != lc->fec || - old_lc->fc != lc->fc) { + if (link_changed) { + PORT_LOCK(pi); t4_os_link_changed(pi); - *old_lc = *lc; + PORT_UNLOCK(pi); } - PORT_UNLOCK(pi); } else { CH_WARN_RATELIMIT(adap, "Unknown firmware reply %d\n", opcode); return -EINVAL; @@ -8528,6 +8760,11 @@ int t4_port_init(struct adapter *adap, int mbox, int p } while ((adap->params.portvec & (1 << j)) == 0); } + p->tx_chan = j; + p->mps_bg_map = t4_get_mps_bg_map(adap, j); + p->rx_e_chan_map = t4_get_rx_e_chan_map(adap, j); + p->lport = j; + if (!(adap->flags & IS_VF) || adap->params.vfres.r_caps & FW_CMD_CAP_PORT) { t4_update_port_info(p); @@ -8542,10 +8779,6 @@ int t4_port_init(struct adapter *adap, int mbox, int p p->vi[0].smt_idx = (ret & 0x7f) << 1; else p->vi[0].smt_idx = (ret & 0x7f); - p->tx_chan = j; - p->mps_bg_map = t4_get_mps_bg_map(adap, j); - p->rx_e_chan_map = t4_get_rx_e_chan_map(adap, j); - p->lport = j; p->vi[0].rss_size = rss_size; t4_os_set_hw_addr(p, addr); Modified: stable/11/sys/dev/cxgbe/osdep.h ============================================================================== --- stable/11/sys/dev/cxgbe/osdep.h Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/sys/dev/cxgbe/osdep.h Wed Oct 17 01:20:18 2018 (r339399) @@ -109,6 +109,7 @@ typedef boolean_t bool; #define DUPLEX_HALF 0 #define DUPLEX_FULL 1 +#define AUTONEG_AUTO (-1) #define AUTONEG_DISABLE 0 #define AUTONEG_ENABLE 1 Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 01:05:52 2018 (r339398) +++ stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 01:20:18 2018 (r339399) @@ -387,18 +387,20 @@ static char t4_cfg_file[32] = DEFAULT_CF; TUNABLE_STR("hw.cxgbe.config_file", t4_cfg_file, sizeof(t4_cfg_file)); /* - * PAUSE settings (bit 0, 1 = rx_pause, tx_pause respectively). + * PAUSE settings (bit 0, 1, 2 = rx_pause, tx_pause, pause_autoneg respectively). * rx_pause = 1 to heed incoming PAUSE frames, 0 to ignore them. * tx_pause = 1 to emit PAUSE frames when the rx FIFO reaches its high water * mark or when signalled to do so, 0 to never emit PAUSE. + * pause_autoneg = 1 means PAUSE will be negotiated if possible and the + * negotiated settings will override rx_pause/tx_pause. + * Otherwise rx_pause/tx_pause are applied forcibly. */ -static int t4_pause_settings = PAUSE_TX | PAUSE_RX; +static int t4_pause_settings = PAUSE_RX | PAUSE_TX | PAUSE_AUTONEG; TUNABLE_INT("hw.cxgbe.pause_settings", &t4_pause_settings); /* - * Forward Error Correction settings (bit 0, 1, 2 = FEC_RS, FEC_BASER_RS, - * FEC_RESERVED respectively). - * -1 to run with the firmware default. + * Forward Error Correction settings (bit 0, 1 = RS, BASER respectively). + * -1 to run with the firmware default. Same as FEC_AUTO (bit 5) * 0 to disable FEC. */ static int t4_fec = -1; @@ -527,9 +529,11 @@ static int get_params__pre_init(struct adapter *); static int get_params__post_init(struct adapter *); 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 void init_l1cfg(struct port_info *); -static int apply_l1cfg(struct port_info *); +static bool fixed_ifmedia(struct port_info *); +static void build_medialist(struct port_info *); +static void init_link_config(struct port_info *); +static int fixup_link_config(struct port_info *); +static int apply_link_config(struct port_info *); static int cxgbe_init_synchronized(struct vi_info *); static int cxgbe_uninit_synchronized(struct vi_info *); static void quiesce_txq(struct adapter *, struct sge_txq *); @@ -1027,6 +1031,14 @@ t4_attach(device_t dev) ifmedia_init(&pi->media, IFM_IMASK, cxgbe_media_change, cxgbe_media_status); + PORT_LOCK(pi); + init_link_config(pi); + fixup_link_config(pi); + build_medialist(pi); + if (fixed_ifmedia(pi)) + pi->flags |= FIXED_IFMEDIA; + PORT_UNLOCK(pi); + pi->dev = device_add_child(dev, sc->names->ifnet_name, -1); if (pi->dev == NULL) { device_printf(dev, @@ -1852,7 +1864,7 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) M_ASSERTPKTHDR(m); MPASS(m->m_nextpkt == NULL); /* not quite ready for this yet */ - if (__predict_false(pi->link_cfg.link_ok == 0)) { + if (__predict_false(pi->link_cfg.link_ok == false)) { m_freem(m); return (ENETDOWN); } @@ -2019,8 +2031,8 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) } /* - * The kernel picks a media from the list we had provided so we do not have to - * validate the request. + * The kernel picks a media from the list we had provided but we still validate + * the requeste. */ static int cxgbe_media_change(struct ifnet *ifp) @@ -2037,8 +2049,14 @@ cxgbe_media_change(struct ifnet *ifp) return (rc); PORT_LOCK(pi); if (IFM_SUBTYPE(ifm->ifm_media) == IFM_AUTO) { - MPASS(lc->supported & FW_PORT_CAP_ANEG); + /* ifconfig .. media autoselect */ + if (!(lc->supported & FW_PORT_CAP32_ANEG)) { + rc = ENOTSUP; /* AN not supported by transceiver */ + goto done; + } lc->requested_aneg = AUTONEG_ENABLE; + lc->requested_speed = 0; + lc->requested_fc |= PAUSE_AUTONEG; } else { lc->requested_aneg = AUTONEG_DISABLE; lc->requested_speed = @@ -2049,47 +2067,25 @@ cxgbe_media_change(struct ifnet *ifp) if (IFM_OPTIONS(ifm->ifm_media) & IFM_ETH_TXPAUSE) lc->requested_fc |= PAUSE_TX; } - if (pi->up_vis > 0) - rc = apply_l1cfg(pi); + if (pi->up_vis > 0) { + fixup_link_config(pi); + rc = apply_link_config(pi); + } +done: PORT_UNLOCK(pi); end_synchronized_op(sc, 0); return (rc); } /* - * Mbps to FW_PORT_CAP_SPEED_* bit. - */ -static uint16_t -speed_to_fwspeed(int speed) -{ - - switch (speed) { - case 100000: - return (FW_PORT_CAP_SPEED_100G); - case 40000: - return (FW_PORT_CAP_SPEED_40G); - case 25000: - return (FW_PORT_CAP_SPEED_25G); - case 10000: - return (FW_PORT_CAP_SPEED_10G); - case 1000: - return (FW_PORT_CAP_SPEED_1G); - case 100: - return (FW_PORT_CAP_SPEED_100M); - } - - return (0); -} - -/* * Base media word (without ETHER, pause, link active, etc.) for the port at the * given speed. */ static int -port_mword(struct port_info *pi, uint16_t speed) +port_mword(struct port_info *pi, uint32_t speed) { - MPASS(speed & M_FW_PORT_CAP_SPEED); + MPASS(speed & M_FW_PORT_CAP32_SPEED); MPASS(powerof2(speed)); switch(pi->port_type) { @@ -2098,24 +2094,24 @@ port_mword(struct port_info *pi, uint16_t speed) case FW_PORT_TYPE_BT_XAUI: /* BaseT */ switch (speed) { - case FW_PORT_CAP_SPEED_100M: + case FW_PORT_CAP32_SPEED_100M: return (IFM_100_T); - case FW_PORT_CAP_SPEED_1G: + case FW_PORT_CAP32_SPEED_1G: return (IFM_1000_T); - case FW_PORT_CAP_SPEED_10G: + case FW_PORT_CAP32_SPEED_10G: return (IFM_10G_T); } break; case FW_PORT_TYPE_KX4: - if (speed == FW_PORT_CAP_SPEED_10G) + if (speed == FW_PORT_CAP32_SPEED_10G) return (IFM_10G_KX4); break; case FW_PORT_TYPE_CX4: - if (speed == FW_PORT_CAP_SPEED_10G) + if (speed == FW_PORT_CAP32_SPEED_10G) return (IFM_10G_CX4); break; case FW_PORT_TYPE_KX: - if (speed == FW_PORT_CAP_SPEED_1G) + if (speed == FW_PORT_CAP32_SPEED_1G) return (IFM_1000_KX); break; case FW_PORT_TYPE_KR: @@ -2126,15 +2122,17 @@ port_mword(struct port_info *pi, uint16_t speed) case FW_PORT_TYPE_KR_SFP28: case FW_PORT_TYPE_KR_XLAUI: switch (speed) { - case FW_PORT_CAP_SPEED_1G: + case FW_PORT_CAP32_SPEED_1G: return (IFM_1000_KX); - case FW_PORT_CAP_SPEED_10G: + case FW_PORT_CAP32_SPEED_10G: return (IFM_10G_KR); - case FW_PORT_CAP_SPEED_25G: + case FW_PORT_CAP32_SPEED_25G: return (IFM_25G_KR); - case FW_PORT_CAP_SPEED_40G: + case FW_PORT_CAP32_SPEED_40G: return (IFM_40G_KR4); - case FW_PORT_CAP_SPEED_100G: + case FW_PORT_CAP32_SPEED_50G: + return (IFM_50G_KR2); + case FW_PORT_CAP32_SPEED_100G: return (IFM_100G_KR4); } break; @@ -2152,53 +2150,59 @@ port_mword(struct port_info *pi, uint16_t speed) switch (pi->mod_type) { case FW_PORT_MOD_TYPE_LR: switch (speed) { - case FW_PORT_CAP_SPEED_1G: + case FW_PORT_CAP32_SPEED_1G: return (IFM_1000_LX); - case FW_PORT_CAP_SPEED_10G: + case FW_PORT_CAP32_SPEED_10G: return (IFM_10G_LR); - case FW_PORT_CAP_SPEED_25G: + case FW_PORT_CAP32_SPEED_25G: return (IFM_25G_LR); - case FW_PORT_CAP_SPEED_40G: + case FW_PORT_CAP32_SPEED_40G: return (IFM_40G_LR4); - case FW_PORT_CAP_SPEED_100G: + case FW_PORT_CAP32_SPEED_50G: + return (IFM_50G_LR2); + case FW_PORT_CAP32_SPEED_100G: return (IFM_100G_LR4); } break; case FW_PORT_MOD_TYPE_SR: switch (speed) { - case FW_PORT_CAP_SPEED_1G: + case FW_PORT_CAP32_SPEED_1G: return (IFM_1000_SX); - case FW_PORT_CAP_SPEED_10G: + case FW_PORT_CAP32_SPEED_10G: return (IFM_10G_SR); - case FW_PORT_CAP_SPEED_25G: + case FW_PORT_CAP32_SPEED_25G: return (IFM_25G_SR); - case FW_PORT_CAP_SPEED_40G: + case FW_PORT_CAP32_SPEED_40G: return (IFM_40G_SR4); - case FW_PORT_CAP_SPEED_100G: + case FW_PORT_CAP32_SPEED_50G: + return (IFM_50G_SR2); + case FW_PORT_CAP32_SPEED_100G: return (IFM_100G_SR4); } break; case FW_PORT_MOD_TYPE_ER: - if (speed == FW_PORT_CAP_SPEED_10G) + if (speed == FW_PORT_CAP32_SPEED_10G) return (IFM_10G_ER); break; case FW_PORT_MOD_TYPE_TWINAX_PASSIVE: case FW_PORT_MOD_TYPE_TWINAX_ACTIVE: switch (speed) { - case FW_PORT_CAP_SPEED_1G: + case FW_PORT_CAP32_SPEED_1G: return (IFM_1000_CX); - case FW_PORT_CAP_SPEED_10G: + case FW_PORT_CAP32_SPEED_10G: return (IFM_10G_TWINAX); - case FW_PORT_CAP_SPEED_25G: + case FW_PORT_CAP32_SPEED_25G: return (IFM_25G_CR); - case FW_PORT_CAP_SPEED_40G: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Oct 17 01:30:52 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8520C10E7382; Wed, 17 Oct 2018 01:30:52 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38EAA8A1BA; Wed, 17 Oct 2018 01:30:52 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19C3024A7F; Wed, 17 Oct 2018 01:30:52 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H1UpUS075731; Wed, 17 Oct 2018 01:30:51 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H1Upj1075730; Wed, 17 Oct 2018 01:30:51 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170130.w9H1Upj1075730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339400 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 339400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:30:52 -0000 Author: np Date: Wed Oct 17 01:30:51 2018 New Revision: 339400 URL: https://svnweb.freebsd.org/changeset/base/339400 Log: MFC r338254: cxgbe(4): Use fcmpset instead of cmpset when appropriate. Modified: stable/11/sys/dev/cxgbe/t4_mp_ring.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_mp_ring.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_mp_ring.c Wed Oct 17 01:20:18 2018 (r339399) +++ stable/11/sys/dev/cxgbe/t4_mp_ring.c Wed Oct 17 01:30:51 2018 (r339400) @@ -122,11 +122,12 @@ drain_ring(struct mp_ring *r, union ring_state os, uin n = r->drain(r, cidx, pidx); if (n == 0) { critical_enter(); + os.state = r->state; do { - os.state = ns.state = r->state; + ns.state = os.state; ns.cidx = cidx; ns.flags = STALLED; - } while (atomic_cmpset_64(&r->state, os.state, + } while (atomic_fcmpset_64(&r->state, &os.state, ns.state) == 0); critical_exit(); if (prev != STALLED) @@ -149,11 +150,12 @@ drain_ring(struct mp_ring *r, union ring_state os, uin if (cidx != pidx && pending < 64 && total < budget) continue; critical_enter(); + os.state = r->state; do { - os.state = ns.state = r->state; + ns.state = os.state; ns.cidx = cidx; ns.flags = state_to_flags(ns, total >= budget); - } while (atomic_cmpset_acq_64(&r->state, os.state, ns.state) == 0); + } while (atomic_fcmpset_acq_64(&r->state, &os.state, ns.state) == 0); critical_exit(); if (ns.flags == ABDICATED) @@ -259,8 +261,8 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Reserve room for the new items. Our reservation, if successful, is * from 'pidx_start' to 'pidx_stop'. */ + os.state = r->state; for (;;) { - os.state = r->state; if (n >= space_available(r, os)) { counter_u64_add(r->drops, n); MPASS(os.flags != IDLE); @@ -271,7 +273,7 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n ns.state = os.state; ns.pidx_head = increment_idx(r, os.pidx_head, n); critical_enter(); - if (atomic_cmpset_64(&r->state, os.state, ns.state)) + if (atomic_fcmpset_64(&r->state, &os.state, ns.state)) break; critical_exit(); cpu_spinwait(); @@ -301,11 +303,12 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Update the ring's pidx_tail. The release style atomic guarantees * that the items are visible to any thread that sees the updated pidx. */ + os.state = r->state; do { - os.state = ns.state = r->state; + ns.state = os.state; ns.pidx_tail = pidx_stop; ns.flags = BUSY; - } while (atomic_cmpset_rel_64(&r->state, os.state, ns.state) == 0); + } while (atomic_fcmpset_rel_64(&r->state, &os.state, ns.state) == 0); critical_exit(); counter_u64_add(r->enqueues, n); From owner-svn-src-stable@freebsd.org Wed Oct 17 01:49:44 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4958910E7752; Wed, 17 Oct 2018 01:49:44 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F35BB8A987; Wed, 17 Oct 2018 01:49:43 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE48B24C93; Wed, 17 Oct 2018 01:49:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H1nhFw086067; Wed, 17 Oct 2018 01:49:43 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H1nhum086066; Wed, 17 Oct 2018 01:49:43 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170149.w9H1nhum086066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339401 - stable/11/sys/dev/cxgbe/tom X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 339401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:49:44 -0000 Author: np Date: Wed Oct 17 01:49:43 2018 New Revision: 339401 URL: https://svnweb.freebsd.org/changeset/base/339401 Log: MFC r320426: cxgbe/t4_tom: Do not include space taken by the TCP timestamp option in the "effective MSS" for the connection. The chip expects it this way. Modified: stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Oct 17 01:30:51 2018 (r339400) +++ stable/11/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Oct 17 01:49:43 2018 (r339401) @@ -260,6 +260,8 @@ assign_rxopt(struct tcpcb *tp, unsigned int opt) n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else n = sizeof(struct ip) + sizeof(struct tcphdr); + if (V_tcp_do_rfc1323) + n += TCPOLEN_TSTAMP_APPA; tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n; CTR4(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u)", __func__, toep->tid, From owner-svn-src-stable@freebsd.org Wed Oct 17 01:59:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C40710E798F; Wed, 17 Oct 2018 01:59:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2E4578AE40; Wed, 17 Oct 2018 01:59:46 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28FB824E44; Wed, 17 Oct 2018 01:59:46 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H1xjoU090975; Wed, 17 Oct 2018 01:59:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H1xjps090973; Wed, 17 Oct 2018 01:59:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170159.w9H1xjps090973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 01:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339402 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 339402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 01:59:46 -0000 Author: np Date: Wed Oct 17 01:59:45 2018 New Revision: 339402 URL: https://svnweb.freebsd.org/changeset/base/339402 Log: MFC r334987: cxgbe(4): Remove homemade version of htobe32 from the driver. It was needed only for ia64 where it was implemented as a call to bswapXX, which was always a real function. htobeXX with a constant argument is calculated at compile-time everywhere else. Modified: stable/11/sys/dev/cxgbe/osdep.h stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/osdep.h ============================================================================== --- stable/11/sys/dev/cxgbe/osdep.h Wed Oct 17 01:49:43 2018 (r339401) +++ stable/11/sys/dev/cxgbe/osdep.h Wed Oct 17 01:59:45 2018 (r339402) @@ -65,11 +65,8 @@ typedef uint64_t __be64; #if BYTE_ORDER == BIG_ENDIAN #define __BIG_ENDIAN_BITFIELD -#define htobe32_const(x) (x) #elif BYTE_ORDER == LITTLE_ENDIAN #define __LITTLE_ENDIAN_BITFIELD -#define htobe32_const(x) (((x) >> 24) | (((x) >> 8) & 0xff00) | \ - ((((x) & 0xffffff) << 8) & 0xff0000) | ((((x) & 0xff) << 24) & 0xff000000)) #else #error "Must set BYTE_ORDER" #endif Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 01:49:43 2018 (r339401) +++ stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 01:59:45 2018 (r339402) @@ -3064,7 +3064,7 @@ struct fw_info { .fw_mod_name = "t4fw", .fw_hdr = { .chip = FW_HDR_CHIP_T4, - .fw_ver = htobe32_const(FW_VERSION(T4)), + .fw_ver = htobe32(FW_VERSION(T4)), .intfver_nic = FW_INTFVER(T4, NIC), .intfver_vnic = FW_INTFVER(T4, VNIC), .intfver_ofld = FW_INTFVER(T4, OFLD), @@ -3080,7 +3080,7 @@ struct fw_info { .fw_mod_name = "t5fw", .fw_hdr = { .chip = FW_HDR_CHIP_T5, - .fw_ver = htobe32_const(FW_VERSION(T5)), + .fw_ver = htobe32(FW_VERSION(T5)), .intfver_nic = FW_INTFVER(T5, NIC), .intfver_vnic = FW_INTFVER(T5, VNIC), .intfver_ofld = FW_INTFVER(T5, OFLD), @@ -3096,7 +3096,7 @@ struct fw_info { .fw_mod_name = "t6fw", .fw_hdr = { .chip = FW_HDR_CHIP_T6, - .fw_ver = htobe32_const(FW_VERSION(T6)), + .fw_ver = htobe32(FW_VERSION(T6)), .intfver_nic = FW_INTFVER(T6, NIC), .intfver_vnic = FW_INTFVER(T6, VNIC), .intfver_ofld = FW_INTFVER(T6, OFLD), From owner-svn-src-stable@freebsd.org Wed Oct 17 02:05:32 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 822A310E7BC9; Wed, 17 Oct 2018 02:05:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 363778B26D; Wed, 17 Oct 2018 02:05:32 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1301124FD6; Wed, 17 Oct 2018 02:05:32 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H25V4i096173; Wed, 17 Oct 2018 02:05:31 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H25VWM096172; Wed, 17 Oct 2018 02:05:31 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170205.w9H25VWM096172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 02:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339403 - stable/11/sys/dev/cxgbe/common X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe/common X-SVN-Commit-Revision: 339403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 02:05:32 -0000 Author: np Date: Wed Oct 17 02:05:31 2018 New Revision: 339403 URL: https://svnweb.freebsd.org/changeset/base/339403 Log: MFC r335352: cxgbe(4): Some mailbox commands require access to the Tx pipeline and can time out if it's backed up due to a non-stop deluge of PAUSE frames from a misbehaving peer. Detect this situation and toggle MPS TxEn to allow forward progress. Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 01:59:45 2018 (r339402) +++ stable/11/sys/dev/cxgbe/common/t4_hw.c Wed Oct 17 02:05:31 2018 (r339403) @@ -237,6 +237,63 @@ static void fw_asrt(struct adapter *adap, struct fw_de be32_to_cpu(asrt->u.assert.y)); } +struct port_tx_state { + uint64_t rx_pause; + uint64_t tx_frames; +}; + +static void +read_tx_state_one(struct adapter *sc, int i, struct port_tx_state *tx_state) +{ + uint32_t rx_pause_reg, tx_frames_reg; + + if (is_t4(sc)) { + tx_frames_reg = PORT_REG(i, A_MPS_PORT_STAT_TX_PORT_FRAMES_L); + rx_pause_reg = PORT_REG(i, A_MPS_PORT_STAT_RX_PORT_PAUSE_L); + } else { + tx_frames_reg = T5_PORT_REG(i, A_MPS_PORT_STAT_TX_PORT_FRAMES_L); + rx_pause_reg = T5_PORT_REG(i, A_MPS_PORT_STAT_RX_PORT_PAUSE_L); + } + + tx_state->rx_pause = t4_read_reg64(sc, rx_pause_reg); + tx_state->tx_frames = t4_read_reg64(sc, tx_frames_reg); +} + +static void +read_tx_state(struct adapter *sc, struct port_tx_state *tx_state) +{ + int i; + + for_each_port(sc, i) + read_tx_state_one(sc, i, &tx_state[i]); +} + +static void +check_tx_state(struct adapter *sc, struct port_tx_state *tx_state) +{ + uint32_t port_ctl_reg; + uint64_t tx_frames, rx_pause; + int i; + + for_each_port(sc, i) { + rx_pause = tx_state[i].rx_pause; + tx_frames = tx_state[i].tx_frames; + read_tx_state_one(sc, i, &tx_state[i]); /* update */ + + if (is_t4(sc)) + port_ctl_reg = PORT_REG(i, A_MPS_PORT_CTL); + else + port_ctl_reg = T5_PORT_REG(i, A_MPS_PORT_CTL); + if (t4_read_reg(sc, port_ctl_reg) & F_PORTTXEN && + rx_pause != tx_state[i].rx_pause && + tx_frames == tx_state[i].tx_frames) { + t4_set_reg_field(sc, port_ctl_reg, F_PORTTXEN, 0); + mdelay(1); + t4_set_reg_field(sc, port_ctl_reg, F_PORTTXEN, F_PORTTXEN); + } + } +} + #define X_CIM_PF_NOACCESS 0xeeeeeeee /** * t4_wr_mbox_meat_timeout - send a command to FW through the given mailbox @@ -278,13 +335,14 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int }; u32 v; u64 res; - int i, ms, delay_idx, ret; + int i, ms, delay_idx, ret, next_tx_check; 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; + struct port_tx_state tx_state[MAX_NPORTS]; if (adap->flags & CHK_MBOX_ACCESS) ASSERT_SYNCHRONIZED_OP(adap); @@ -373,8 +431,8 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int 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 */ - + read_tx_state(adap, &tx_state[0]); /* also flushes the write_reg */ + next_tx_check = 1000; delay_idx = 0; ms = delay[0]; @@ -389,6 +447,12 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int if (pcie_fw & F_PCIE_FW_ERR) break; } + + if (i >= next_tx_check) { + check_tx_state(adap, &tx_state[0]); + next_tx_check = i + 1000; + } + if (sleep_ok) { ms = delay[delay_idx]; /* last element may repeat */ if (delay_idx < ARRAY_SIZE(delay) - 1) From owner-svn-src-stable@freebsd.org Wed Oct 17 02:25:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2918D10E7F6F; Wed, 17 Oct 2018 02:25:16 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C46188B9D5; Wed, 17 Oct 2018 02:25:15 +0000 (UTC) (envelope-from np@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF4212530F; Wed, 17 Oct 2018 02:25:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H2PFaS006443; Wed, 17 Oct 2018 02:25:15 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H2PFg8006442; Wed, 17 Oct 2018 02:25:15 GMT (envelope-from np@FreeBSD.org) Message-Id: <201810170225.w9H2PFg8006442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 17 Oct 2018 02:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339404 - stable/11/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/11/sys/dev/cxgbe X-SVN-Commit-Revision: 339404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 02:25:16 -0000 Author: np Date: Wed Oct 17 02:25:15 2018 New Revision: 339404 URL: https://svnweb.freebsd.org/changeset/base/339404 Log: MFC r336159: cxgbe(4): Add a sysctl to report the chip's microprocessor's load averages. This works with debug or custom firmwares only. sysctl dev...loadavg sysctl dev.t6nex.0.loadavg Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 02:05:31 2018 (r339403) +++ stable/11/sys/dev/cxgbe/t4_main.c Wed Oct 17 02:25:15 2018 (r339404) @@ -563,6 +563,7 @@ static int sysctl_autoneg(SYSCTL_HANDLER_ARGS); static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS); static int sysctl_temperature(SYSCTL_HANDLER_ARGS); #ifdef SBUF_DRAIN +static int sysctl_loadavg(SYSCTL_HANDLER_ARGS); static int sysctl_cctrl(SYSCTL_HANDLER_ARGS); static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS); static int sysctl_cim_la(SYSCTL_HANDLER_ARGS); @@ -5460,6 +5461,10 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RD, sc, 0, sysctl_temperature, "I", "chip temperature (in Celsius)"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "loadavg", CTLTYPE_STRING | + CTLFLAG_RD, sc, 0, sysctl_loadavg, "A", + "microprocessor load averages (debug firmwares only)"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD, &sc->params.core_vdd, 0, "core Vdd (in mV)"); @@ -6516,6 +6521,45 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS) } #ifdef SBUF_DRAIN +static int +sysctl_loadavg(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct sbuf *sb; + int rc; + uint32_t param, val; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4lavg"); + if (rc) + return (rc); + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_LOAD); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + end_synchronized_op(sc, 0); + if (rc) + return (rc); + + 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); + + if (val == 0xffffffff) { + /* Only debug and custom firmwares report load averages. */ + sbuf_printf(sb, "not available"); + } else { + sbuf_printf(sb, "%d %d %d", val & 0xff, (val >> 8) & 0xff, + (val >> 16) & 0xff); + } + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} + static int sysctl_cctrl(SYSCTL_HANDLER_ARGS) { From owner-svn-src-stable@freebsd.org Wed Oct 17 02:45:16 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5AC9108B8D5; Wed, 17 Oct 2018 02:45:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 792F08C3E3; Wed, 17 Oct 2018 02:45:16 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F6152562F; Wed, 17 Oct 2018 02:45:16 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H2jGWR016698; Wed, 17 Oct 2018 02:45:16 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H2jGIP016697; Wed, 17 Oct 2018 02:45:16 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201810170245.w9H2jGIP016697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 17 Oct 2018 02:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339405 - stable/11/stand/pc98/loader X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: stable/11/stand/pc98/loader X-SVN-Commit-Revision: 339405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 02:45:17 -0000 Author: imp Date: Wed Oct 17 02:45:15 2018 New Revision: 339405 URL: https://svnweb.freebsd.org/changeset/base/339405 Log: Direct commit to stable, file not present in current Catch up to r332154: Fix d_dev removal of d_type. Modified: stable/11/stand/pc98/loader/main.c Modified: stable/11/stand/pc98/loader/main.c ============================================================================== --- stable/11/stand/pc98/loader/main.c Wed Oct 17 02:25:15 2018 (r339404) +++ stable/11/stand/pc98/loader/main.c Wed Oct 17 02:45:15 2018 (r339405) @@ -253,13 +253,12 @@ extract_currdev(void) biosdev = (major << 3) + 0x80 + B_UNIT(initial_bootdev); } } - new_currdev.dd.d_type = new_currdev.dd.d_dev->dv_type; /* * If we are booting off of a BIOS disk and we didn't succeed in determining * which one we booted off of, just use disk0: as a reasonable default. */ - if ((new_currdev.dd.d_type == biosdisk.dv_type) && + if ((new_currdev.dd.d_dev->dv_type == biosdisk.dv_type) && ((new_currdev.dd.d_unit = bd_bios2unit(biosdev)) == -1)) { printf("Can't work out which disk we are booting from.\n" "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); From owner-svn-src-stable@freebsd.org Wed Oct 17 04:10:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51EFD10C4729; Wed, 17 Oct 2018 04:10:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F2F3A8E88C; Wed, 17 Oct 2018 04:10:24 +0000 (UTC) (envelope-from imp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA21326367; Wed, 17 Oct 2018 04:10:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9H4AOa0059105; Wed, 17 Oct 2018 04:10:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9H4AOCm059102; Wed, 17 Oct 2018 04:10:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201810170410.w9H4AOCm059102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 17 Oct 2018 04:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339406 - in stable/11/stand: common pc98/btx/lib pc98/libpc98 X-SVN-Group: stable-11 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/11/stand: common pc98/btx/lib pc98/libpc98 X-SVN-Commit-Revision: 339406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 04:10:25 -0000 Author: imp Date: Wed Oct 17 04:10:23 2018 New Revision: 339406 URL: https://svnweb.freebsd.org/changeset/base/339406 Log: Direct commit since these files have gone away in head Move pc98's biosdisk.c to the new style disk access. This is missing support in common/part.c, however, for pc98 partitions, so it's unlikely to actually work. Lack of a pc98 machine that's in sevice limits my ability to test, but this allows pc98 to compile again. Modified: stable/11/stand/common/part.c stable/11/stand/pc98/btx/lib/btxv86.h stable/11/stand/pc98/libpc98/biosdisk.c Modified: stable/11/stand/common/part.c ============================================================================== --- stable/11/stand/common/part.c Wed Oct 17 02:45:15 2018 (r339405) +++ stable/11/stand/common/part.c Wed Oct 17 04:10:23 2018 (r339406) @@ -898,6 +898,38 @@ ptable_getbestpart(const struct ptable *table, struct pref = PREF_NONE; } #endif /* LOADER_GPT_SUPPORT */ +#ifdef LOADER_PC98_SUPPORT + if (table->type == PTABLE_PC98) { + switch(entry->part.type & PC98_MID_MASK) { + case PC98_MID_386BSD: /* FreeBSD */ + if ((entry->part.type & PC98_MID_BOOTABLE) && + (preflevel > PREF_FBSD_ACT)) { + pref = i; + preflevel = PREF_FBSD_ACT; + } else if (preflevel > PREF_FBSD) { + pref = i; + preflevel = PREF_FBSD; + } + break; + + case 0x11: /* DOS/Windows */ + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x63: + if ((entry->part.type & PC98_MID_BOOTABLE) && + (preflevel > PREF_DOS_ACT)) { + pref = i; + preflevel = PREF_DOS_ACT; + } else if (preflevel > PREF_DOS) { + pref = i; + preflevel = PREF_DOS; + } + break; + } + } +#endif /* LOADER_PC98_SUPPORT */ if (pref < preflevel) { preflevel = pref; best = entry; @@ -943,3 +975,162 @@ ptable_iterate(const struct ptable *table, void *arg, } return (ret); } +#ifdef LOADER_PC98_SUPPORT +static int +bd_open_pc98(struct open_disk *od, struct i386_devdesc *dev) +{ + struct pc98_partition *dptr; + struct disklabel *lp; + int sector, slice, i; + char buf[BUFSIZE]; + + /* + * Following calculations attempt to determine the correct value + * for d->od_boff by looking for the slice and partition specified, + * or searching for reasonable defaults. + */ + + /* + * Find the slice in the DOS slice table. + */ + od->od_nslices = 0; + if (od->od_flags & BD_FLOPPY) { + sector = 0; + goto unsliced; + } + if (bd_read(od, 0, 1, buf)) { + DEBUG("error reading MBR"); + return (EIO); + } + + /* + * Check the slice table magic. + */ + if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { + /* If a slice number was explicitly supplied, this is an error */ + if (dev->d_kind.biosdisk.slice > 0) { + DEBUG("no slice table/MBR (no magic)"); + return (ENOENT); + } + sector = 0; + goto unsliced; /* may be a floppy */ + } + if (bd_read(od, 1, 1, buf)) { + DEBUG("error reading MBR"); + return (EIO); + } + + /* + * copy the partition table, then pick up any extended partitions. + */ + bcopy(buf + PC98_PARTOFF, &od->od_slicetab, + sizeof(struct pc98_partition) * PC98_NPARTS); + od->od_nslices = PC98_NPARTS; /* extended slices start here */ + od->od_flags |= BD_PARTTABOK; + dptr = &od->od_slicetab[0]; + + /* Is this a request for the whole disk? */ + if (dev->d_kind.biosdisk.slice == -1) { + sector = 0; + goto unsliced; + } + + /* + * if a slice number was supplied but not found, this is an error. + */ + if (dev->d_kind.biosdisk.slice > 0) { + slice = dev->d_kind.biosdisk.slice - 1; + if (slice >= od->od_nslices) { + DEBUG("slice %d not found", slice); + return (ENOENT); + } + } + + /* Try to auto-detect the best slice; this should always give a slice number */ + if (dev->d_kind.biosdisk.slice == 0) { + slice = bd_bestslice(od); + if (slice == -1) { + return (ENOENT); + } + dev->d_kind.biosdisk.slice = slice; + } + + dptr = &od->od_slicetab[0]; + /* + * Accept the supplied slice number unequivocally (we may be looking + * at a DOS partition). + */ + dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */ + sector = dptr->dp_scyl * od->od_hds * od->od_sec + + dptr->dp_shd * od->od_sec + dptr->dp_ssect; + { + int end = dptr->dp_ecyl * od->od_hds * od->od_sec + + dptr->dp_ehd * od->od_sec + dptr->dp_esect; + DEBUG("slice entry %d at %d, %d sectors", + dev->d_kind.biosdisk.slice - 1, sector, end-sector); + } + + /* + * If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition + */ + if ((dptr->dp_mid == DOSMID_386BSD) && (dev->d_kind.biosdisk.partition < 0)) + dev->d_kind.biosdisk.partition = 0; + + unsliced: + /* + * Now we have the slice offset, look for the partition in the disklabel if we have + * a partition to start with. + * + * XXX we might want to check the label checksum. + */ + if (dev->d_kind.biosdisk.partition < 0) { + od->od_boff = sector; /* no partition, must be after the slice */ + DEBUG("opening raw slice"); + } else { + + if (bd_read(od, sector + LABELSECTOR, 1, buf)) { + DEBUG("error reading disklabel"); + return (EIO); + } + DEBUG("copy %d bytes of label from %p to %p", sizeof(struct disklabel), buf + LABELOFFSET, &od->od_disklabel); + bcopy(buf + LABELOFFSET, &od->od_disklabel, sizeof(struct disklabel)); + lp = &od->od_disklabel; + od->od_flags |= BD_LABELOK; + + if (lp->d_magic != DISKMAGIC) { + DEBUG("no disklabel"); + return (ENOENT); + } + if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) { + DEBUG("partition '%c' exceeds partitions in table (a-'%c')", + 'a' + dev->d_kind.biosdisk.partition, 'a' + lp->d_npartitions); + return (EPART); + } + +#ifdef DISK_DEBUG + /* Complain if the partition is unused unless this is a floppy. */ + if ((lp->d_partitions[dev->d_kind.biosdisk.partition].p_fstype == FS_UNUSED) && + !(od->od_flags & BD_FLOPPY)) + DEBUG("warning, partition marked as unused"); +#endif + + od->od_boff = + lp->d_partitions[dev->d_kind.biosdisk.partition].p_offset - + lp->d_partitions[RAW_PART].p_offset + + sector; + } + return (0); +} +static void +bd_closedisk(struct open_disk *od) +{ + DEBUG("open_disk %p", od); +#if 0 + /* XXX is this required? (especially if disk already open...) */ + if (od->od_flags & BD_FLOPPY) + delay(3000000); +#endif + free(od); +} + +#endif /* LOADER_PC98_SUPPORT */ Modified: stable/11/stand/pc98/btx/lib/btxv86.h ============================================================================== --- stable/11/stand/pc98/btx/lib/btxv86.h Wed Oct 17 02:45:15 2018 (r339405) +++ stable/11/stand/pc98/btx/lib/btxv86.h Wed Oct 17 04:10:23 2018 (r339406) @@ -23,6 +23,15 @@ #include #include +/* + * Memory buffer space for real mode IO. + * Just one page is not much, but the space is rather limited. + * See ../btx/btx.S for details. + * XXX TEST THIS XXX + */ +#define V86_IO_BUFFER 0x8000 +#define V86_IO_BUFFER_SIZE 0x1000 + #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ #define V86_FLAGS 0x40000 /* Return flags */ Modified: stable/11/stand/pc98/libpc98/biosdisk.c ============================================================================== --- stable/11/stand/pc98/libpc98/biosdisk.c Wed Oct 17 02:45:15 2018 (r339405) +++ stable/11/stand/pc98/libpc98/biosdisk.c Wed Oct 17 04:10:23 2018 (r339406) @@ -37,18 +37,24 @@ __FBSDID("$FreeBSD$"); * */ +#include +#include #include +#include +#include #include #include -#include -#include - #include #include +#include "disk.h" #include "libi386.h" +#ifdef LOADER_GELI_SUPPORT +#error "Nope! No GELI on pc98 so sorry." +#endif + #define BIOS_NUMDRIVES 0x475 #define BIOSDISK_SECSIZE 512 #define BUFSIZE (1 * BIOSDISK_SECSIZE) @@ -65,27 +71,6 @@ __FBSDID("$FreeBSD$"); # define DEBUG(fmt, args...) #endif -struct open_disk { - int od_dkunit; /* disk unit number */ - int od_unit; /* BIOS unit number */ - int od_cyl; /* BIOS geometry */ - int od_hds; - int od_sec; - int od_boff; /* block offset from beginning of BIOS disk */ - int od_flags; -#define BD_MODEINT13 0x0000 -#define BD_MODEEDD1 0x0001 -#define BD_MODEEDD3 0x0002 -#define BD_MODEMASK 0x0003 -#define BD_FLOPPY 0x0004 -#define BD_LABELOK 0x0008 -#define BD_PARTTABOK 0x0010 -#define BD_OPTICAL 0x0020 - struct disklabel od_disklabel; - int od_nslices; /* slice count */ - struct pc98_partition od_slicetab[PC98_NPARTS]; -}; - /* * List of BIOS devices, translation from disk unit number to * BIOS unit number. @@ -93,8 +78,21 @@ struct open_disk { static struct bdinfo { int bd_unit; /* BIOS unit number */ + int bd_cyl; /* BIOS geometry */ + int bd_hds; + int bd_sec; int bd_flags; +#define BD_MODEINT13 0x0000 +#define BD_MODEEDD1 0x0001 +#define BD_MODEEDD3 0x0002 +#define BD_MODEMASK 0x0003 +#define BD_FLOPPY 0x0004 +#define BD_LABELOK 0x0008 +#define BD_PARTTABOK 0x0010 +#define BD_OPTICAL 0x0020 int bd_type; /* BIOS 'drive type' (floppy only) */ + uint16_t bd_sectorsize; /* Sector size */ + uint64_t bd_sectors; /* Disk size */ int bd_da_unit; /* kernel unit number for da */ int bd_open; /* reference counter */ void *bd_bcache; /* buffer cache data */ @@ -103,18 +101,12 @@ static int nbdinfo = 0; #define BD(dev) (bdinfo[(dev)->dd.d_unit]) -static int bd_getgeom(struct open_disk *od); -static int bd_read(struct open_disk *od, daddr_t dblk, int blks, +static int bd_read(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); -static int bd_write(struct open_disk *od, daddr_t dblk, int blks, +static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest); static int bd_int13probe(struct bdinfo *bd); -static int bd_printslice(struct open_disk *od, struct pc98_partition *dp, - char *prefix, int verbose); -static int bd_printbsdslice(struct open_disk *od, daddr_t offset, - char *prefix, int verbose); - static int bd_init(void); static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, size_t *rsize); @@ -122,6 +114,7 @@ static int bd_realstrategy(void *devdata, int flag, da char *buf, size_t *rsize); static int bd_open(struct open_file *f, ...); static int bd_close(struct open_file *f); +static int bd_ioctl(struct open_file *f, u_long cmd, void *data); static int bd_print(int verbose); struct devsw biosdisk = { @@ -131,17 +124,11 @@ struct devsw biosdisk = { bd_strategy, bd_open, bd_close, - noioctl, + bd_ioctl, bd_print, NULL }; -static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); -static void bd_closedisk(struct open_disk *od); -static int bd_open_pc98(struct open_disk *od, struct i386_devdesc *dev); -static int bd_bestslice(struct open_disk *od); -static void bd_checkextended(struct open_disk *od, int slicenum); - /* * Translate between BIOS device numbers and our private unit numbers. */ @@ -260,10 +247,9 @@ bd_int13probe(struct bdinfo *bd) static int bd_print(int verbose) { - int i, j, ret = 0; char line[80]; - struct i386_devdesc dev; - struct open_disk *od; + struct disk_devdesc dev; + int i, ret = 0; struct pc98_partition *dptr; if (nbdinfo == 0) @@ -274,34 +260,28 @@ bd_print(int verbose) return (ret); for (i = 0; i < nbdinfo; i++) { - snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", - i, 'A' + i); + snprintf(line, sizeof(line), + " disk%d: BIOS drive %c (%ju X %u):\n", i, + (bdinfo[i].bd_unit < 0x80) ? ('A' + bdinfo[i].bd_unit): + ('C' + bdinfo[i].bd_unit - 0x80), + (uintmax_t)bdinfo[i].bd_sectors, + bdinfo[i].bd_sectorsize); if ((ret = pager_output(line)) != 0) break; /* try to open the whole disk */ + dev.dd.d_dev = &biosdisk; dev.dd.d_unit = i; - dev.d_kind.biosdisk.slice = -1; - dev.d_kind.biosdisk.partition = -1; - - if (!bd_opendisk(&od, &dev)) { - - /* Do we have a partition table? */ - if (od->od_flags & BD_PARTTABOK) { - dptr = &od->od_slicetab[0]; - - /* Check for a "dedicated" disk */ - for (j = 0; j < od->od_nslices; j++) { - snprintf(line, sizeof(line), - " disk%ds%d", i, j + 1); - if ((ret = bd_printslice(od, &dptr[j], - line, verbose)) != 0) - break; - } - } - bd_closedisk(od); + dev.d_slice = -1; + dev.d_partition = -1; + if (disk_open(&dev, + bdinfo[i].bd_sectorsize * bdinfo[i].bd_sectors, + bdinfo[i].bd_sectorsize) == 0) { + snprintf(line, sizeof(line), " disk%d", i); + ret = disk_print(&dev, line, verbose); + disk_close(&dev); if (ret != 0) - break; + return (ret); } } return (ret); @@ -331,109 +311,6 @@ display_size(uint64_t size) } /* - * Print information about slices on a disk. For the size calculations we - * assume a 512 byte sector. - */ -static int -bd_printslice(struct open_disk *od, struct pc98_partition *dp, char *prefix, - int verbose) -{ - int cylsecs, start, size; - char stats[80]; - char line[80]; - - cylsecs = od->od_hds * od->od_sec; - start = dp->dp_scyl * cylsecs + dp->dp_shd * od->od_sec + dp->dp_ssect; - size = (dp->dp_ecyl - dp->dp_scyl + 1) * cylsecs; - - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(size), - start, start + size); - else - stats[0] = '\0'; - - switch(dp->dp_mid & PC98_MID_MASK) { - case PC98_MID_386BSD: - return (bd_printbsdslice(od, start, prefix, verbose)); - case 0x00: /* unused partition */ - return (0); - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x11: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_mid, - stats); - } - return (pager_output(line)); -} - -/* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static int -bd_printbsdslice(struct open_disk *od, daddr_t offset, char *prefix, - int verbose) -{ - char line[80]; - char buf[BIOSDISK_SECSIZE]; - struct disklabel *lp; - int i; - - /* read disklabel */ - if (bd_read(od, offset + LABELSECTOR, 1, buf)) - return (0); - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - return (pager_output(line)); - } - - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it is. If - * not, then skip it. However, since floppies often have bogus - * fstypes, print the 'a' partition on a floppy even if it is marked - * unused. - */ - if ((lp->d_partitions[i].p_fstype == FS_BSDFFS) || - (lp->d_partitions[i].p_fstype == FS_SWAP) || - (lp->d_partitions[i].p_fstype == FS_VINUM) || - ((lp->d_partitions[i].p_fstype == FS_UNUSED) && - (od->od_flags & BD_FLOPPY) && (i == 0))) { - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap " : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - lp->d_partitions[i].p_offset + lp->d_partitions[i].p_size); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap" : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS"); - if (pager_output(line)) - return (1); - } - } - return (0); -} - - -/* * Attempt to open the disk described by (dev) for use by (f). * * Note that the philosophy here is "give them exactly what @@ -446,359 +323,177 @@ bd_printbsdslice(struct open_disk *od, daddr_t offset, static int bd_open(struct open_file *f, ...) { - va_list ap; - struct i386_devdesc *dev; - struct open_disk *od; - int error; + va_list ap; + struct disk_devdesc *dev; + struct disk_devdesc disk; + int err; + uint64_t size; - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if ((error = bd_opendisk(&od, dev))) - return(error); + va_start(ap, f); + dev = va_arg(ap, struct disk_devdesc *); + va_end(ap); - BD(dev).bd_open++; - if (BD(dev).bd_bcache == NULL) - BD(dev).bd_bcache = bcache_allocate(); + if (dev->dd.d_unit < 0 || dev->dd.d_unit >= nbdinfo) + return (EIO); + BD(dev).bd_open++; + if (BD(dev).bd_bcache == NULL) + BD(dev).bd_bcache = bcache_allocate(); - /* - * Save our context - */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return(0); -} + /* + * Read disk size from partition. + * This is needed to work around buggy BIOS systems returning + * wrong (truncated) disk media size. + * During bd_probe() we tested if the mulitplication of bd_sectors + * would overflow so it should be safe to perform here. + */ + disk.dd.d_dev = dev->dd.d_dev; + disk.dd.d_unit = dev->dd.d_unit; + disk.d_slice = -1; + disk.d_partition = -1; + disk.d_offset = 0; + if (disk_open(&disk, BD(dev).bd_sectors * BD(dev).bd_sectorsize, + BD(dev).bd_sectorsize) == 0) { -static int -bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) -{ - struct open_disk *od; - int error; + if (disk_ioctl(&disk, DIOCGMEDIASIZE, &size) == 0) { + size /= BD(dev).bd_sectorsize; + if (size > BD(dev).bd_sectors) + BD(dev).bd_sectors = size; + } + disk_close(&disk); + } - if (dev->dd.d_unit >= nbdinfo) { - DEBUG("attempt to open nonexistent disk"); - return(ENXIO); - } - - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (!od) { - DEBUG("no memory"); - return (ENOMEM); - } - - /* Look up BIOS unit number, intialise open_disk structure */ - od->od_dkunit = dev->dd.d_unit; - od->od_unit = bdinfo[od->od_dkunit].bd_unit; - od->od_flags = bdinfo[od->od_dkunit].bd_flags; - od->od_boff = 0; - error = 0; - DEBUG("open '%s', unit 0x%x slice %d partition %d", - i386_fmtdev(dev), dev->dd.d_unit, - dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition); - - /* Get geometry for this open (removable device may have changed) */ - if (bd_getgeom(od)) { - DEBUG("can't get geometry"); - error = ENXIO; - goto out; - } - - /* Determine disk layout. */ - error = bd_open_pc98(od, dev); - - out: - if (error) { - free(od); - } else { - *odp = od; /* return the open disk */ - } - return(error); + err = disk_open(dev, BD(dev).bd_sectors * BD(dev).bd_sectorsize, + BD(dev).bd_sectorsize); + /* i386 has GELI here */ + return(err); } -static int -bd_open_pc98(struct open_disk *od, struct i386_devdesc *dev) +static int +bd_close(struct open_file *f) { - struct pc98_partition *dptr; - struct disklabel *lp; - int sector, slice, i; - char buf[BUFSIZE]; + struct disk_devdesc *dev; - /* - * Following calculations attempt to determine the correct value - * for d->od_boff by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - - /* - * Find the slice in the DOS slice table. - */ - od->od_nslices = 0; - if (od->od_flags & BD_FLOPPY) { - sector = 0; - goto unsliced; - } - if (bd_read(od, 0, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * Check the slice table magic. - */ - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - /* If a slice number was explicitly supplied, this is an error */ - if (dev->d_kind.biosdisk.slice > 0) { - DEBUG("no slice table/MBR (no magic)"); - return (ENOENT); + dev = (struct disk_devdesc *)f->f_devdata; + BD(dev).bd_open--; + if (BD(dev).bd_open == 0) { + bcache_free(BD(dev).bd_bcache); + BD(dev).bd_bcache = NULL; } - sector = 0; - goto unsliced; /* may be a floppy */ - } - if (bd_read(od, 1, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - bcopy(buf + PC98_PARTOFF, &od->od_slicetab, - sizeof(struct pc98_partition) * PC98_NPARTS); - od->od_nslices = PC98_NPARTS; /* extended slices start here */ - od->od_flags |= BD_PARTTABOK; - dptr = &od->od_slicetab[0]; - - /* Is this a request for the whole disk? */ - if (dev->d_kind.biosdisk.slice == -1) { - sector = 0; - goto unsliced; - } - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_kind.biosdisk.slice > 0) { - slice = dev->d_kind.biosdisk.slice - 1; - if (slice >= od->od_nslices) { - DEBUG("slice %d not found", slice); - return (ENOENT); - } - } - - /* Try to auto-detect the best slice; this should always give a slice number */ - if (dev->d_kind.biosdisk.slice == 0) { - slice = bd_bestslice(od); - if (slice == -1) { - return (ENOENT); - } - dev->d_kind.biosdisk.slice = slice; - } - - dptr = &od->od_slicetab[0]; - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - */ - dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */ - sector = dptr->dp_scyl * od->od_hds * od->od_sec + - dptr->dp_shd * od->od_sec + dptr->dp_ssect; - { - int end = dptr->dp_ecyl * od->od_hds * od->od_sec + - dptr->dp_ehd * od->od_sec + dptr->dp_esect; - DEBUG("slice entry %d at %d, %d sectors", - dev->d_kind.biosdisk.slice - 1, sector, end-sector); - } - - /* - * If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition - */ - if ((dptr->dp_mid == DOSMID_386BSD) && (dev->d_kind.biosdisk.partition < 0)) - dev->d_kind.biosdisk.partition = 0; - - unsliced: - /* - * Now we have the slice offset, look for the partition in the disklabel if we have - * a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_kind.biosdisk.partition < 0) { - od->od_boff = sector; /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - } else { - - if (bd_read(od, sector + LABELSECTOR, 1, buf)) { - DEBUG("error reading disklabel"); - return (EIO); - } - DEBUG("copy %d bytes of label from %p to %p", sizeof(struct disklabel), buf + LABELOFFSET, &od->od_disklabel); - bcopy(buf + LABELOFFSET, &od->od_disklabel, sizeof(struct disklabel)); - lp = &od->od_disklabel; - od->od_flags |= BD_LABELOK; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - return (ENOENT); - } - if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_kind.biosdisk.partition, 'a' + lp->d_npartitions); - return (EPART); - } - -#ifdef DISK_DEBUG - /* Complain if the partition is unused unless this is a floppy. */ - if ((lp->d_partitions[dev->d_kind.biosdisk.partition].p_fstype == FS_UNUSED) && - !(od->od_flags & BD_FLOPPY)) - DEBUG("warning, partition marked as unused"); -#endif - - od->od_boff = - lp->d_partitions[dev->d_kind.biosdisk.partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - } - return (0); + return (disk_close(dev)); } -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -/* - * slicelimit is in the range 0 .. PC98_NPARTS - */ static int -bd_bestslice(struct open_disk *od) +bd_ioctl(struct open_file *f, u_long cmd, void *data) { - struct pc98_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; + struct disk_devdesc *dev; + int rc; - dp = &od->od_slicetab[0]; - for (i = 0; i < od->od_nslices; i++, dp++) { - switch(dp->dp_mid & PC98_MID_MASK) { - case PC98_MID_386BSD: /* FreeBSD */ - if ((dp->dp_mid & PC98_MID_BOOTABLE) && - (preflevel > PREF_FBSD_ACT)) { - pref = i; - preflevel = PREF_FBSD_ACT; - } else if (preflevel > PREF_FBSD) { - pref = i; - preflevel = PREF_FBSD; - } - break; + dev = (struct disk_devdesc *)f->f_devdata; - case 0x11: /* DOS/Windows */ - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x63: - if ((dp->dp_mid & PC98_MID_BOOTABLE) && - (preflevel > PREF_DOS_ACT)) { - pref = i; - preflevel = PREF_DOS_ACT; - } else if (preflevel > PREF_DOS) { - pref = i; - preflevel = PREF_DOS; - } - break; - } + rc = disk_ioctl(dev, cmd, data); + if (rc != ENOTTY) + return (rc); + + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = BD(dev).bd_sectorsize; + break; + case DIOCGMEDIASIZE: + *(uint64_t *)data = BD(dev).bd_sectors * BD(dev).bd_sectorsize; + break; + default: + return (ENOTTY); } - return (prefslice); + return (0); } - -static int -bd_close(struct open_file *f) -{ - struct i386_devdesc *dev = f->f_devdata; - struct open_disk *od = (struct open_disk *)(dev->d_kind.biosdisk.data); - BD(dev).bd_open--; - if (BD(dev).bd_open == 0) { - bcache_free(BD(dev).bd_bcache); - BD(dev).bd_bcache = NULL; - } - - bd_closedisk(od); - return(0); -} - -static void -bd_closedisk(struct open_disk *od) -{ - DEBUG("open_disk %p", od); -#if 0 - /* XXX is this required? (especially if disk already open...) */ - if (od->od_flags & BD_FLOPPY) - delay(3000000); -#endif - free(od); -} - static int bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { - struct bcache_devdata bcd; - struct i386_devdesc *dev = devdata; - struct open_disk *od = (struct open_disk *)(dev->d_kind.biosdisk.data); + struct bcache_devdata bcd; + struct disk_devdesc *dev; - bcd.dv_strategy = bd_realstrategy; - bcd.dv_devdata = devdata; - bcd.dv_cache = BD(dev).bd_bcache; - return(bcache_strategy(&bcd, rw, dblk+od->od_boff, size, buf, rsize)); + dev = (struct disk_devdesc *)devdata; + bcd.dv_strategy = bd_realstrategy; + bcd.dv_devdata = devdata; + bcd.dv_cache = BD(dev).bd_bcache; + return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, + size, buf, rsize)); } static int bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize) { - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); - int blks; -#ifdef BD_SUPPORT_FRAGS + struct disk_devdesc *dev = (struct disk_devdesc *)devdata; + uint64_t disk_blocks; + int blks, rc; +#ifdef BD_SUPPORT_FRAGS /* XXX: sector size */ char fragbuf[BIOSDISK_SECSIZE]; size_t fragsize; fragsize = size % BIOSDISK_SECSIZE; #else - if (size % BIOSDISK_SECSIZE) + if (size % BD(dev).bd_sectorsize) panic("bd_strategy: %d bytes I/O not multiple of block size", size); #endif - DEBUG("open_disk %p", od); - blks = size / BIOSDISK_SECSIZE; + DEBUG("open_disk %p", dev); + + /* + * Check the value of the size argument. We do have quite small + * heap (64MB), but we do not know good upper limit, so we check against + * INT_MAX here. This will also protect us against possible overflows + * while translating block count to bytes. + */ + if (size > INT_MAX) { + DEBUG("too large read: %zu bytes", size); + return (EIO); + } + + blks = size / BD(dev).bd_sectorsize; + if (dblk > dblk + blks) + return (EIO); + if (rsize) *rsize = 0; - switch(rw){ + /* Get disk blocks, this value is either for whole disk or for partition */ + if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks)) { + /* DIOCGMEDIASIZE does return bytes. */ + disk_blocks /= BD(dev).bd_sectorsize; + } else { + /* We should not get here. Just try to survive. */ + disk_blocks = BD(dev).bd_sectors - dev->d_offset; + } + + /* Validate source block address. */ + if (dblk < dev->d_offset || dblk >= dev->d_offset + disk_blocks) + return (EIO); + + /* + * Truncate if we are crossing disk or partition end. + */ + if (dblk + blks >= dev->d_offset + disk_blocks) { + blks = dev->d_offset + disk_blocks - dblk; + size = blks * BD(dev).bd_sectorsize; + DEBUG("short read %d", blks); + } + + switch (rw & F_MASK) { case F_READ: - DEBUG("read %d from %d to %p", blks, dblk, buf); + DEBUG("read %d from %lld to %p", blks, dblk, buf); - if (blks && bd_read(od, dblk, blks, buf)) { - DEBUG("read error"); + if (blks && (rc = bd_read(dev, dblk, blks, buf))) { + /* Filter out floppy controller errors */ + if (BD(dev).bd_flags != BD_FLOPPY || rc != 0x20) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Oct 17 16:17:58 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ED3F10D9264; Wed, 17 Oct 2018 16:17:58 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8BC8856A4; Wed, 17 Oct 2018 16:17:57 +0000 (UTC) (envelope-from jamie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3BAE5DAC; Wed, 17 Oct 2018 16:17:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9HGHvQV031754; Wed, 17 Oct 2018 16:17:57 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9HGHvVx031753; Wed, 17 Oct 2018 16:17:57 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201810171617.w9HGHvVx031753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Wed, 17 Oct 2018 16:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339411 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 339411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 16:17:58 -0000 Author: jamie Date: Wed Oct 17 16:17:57 2018 New Revision: 339411 URL: https://svnweb.freebsd.org/changeset/base/339411 Log: MFC r339211: Fix the test prohibiting jails from sharing IP addresses. It's not supposed to be legal for two jails to contain the same IP address, unless both jails contain only that one address. This is the behavior documented in jail(8), and is there to prevent confusion when multiple jails are listening on IADDR_ANY. VIMAGE jails (now the default for GENERIC kernels) test this correctly, but non-VIMAGE jails have been performing an incomplete test when nested jails are used. Modified: stable/11/sys/kern/kern_jail.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_jail.c ============================================================================== --- stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:56 2018 (r339410) +++ stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:57 2018 (r339411) @@ -1411,11 +1411,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i * there is a duplicate on a jail with more than one * IP stop checking and return error. */ - tppr = ppr; #ifdef VIMAGE - for (; tppr != &prison0; tppr = tppr->pr_parent) + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) if (tppr->pr_flags & PR_VNET) break; +#else + tppr = &prison0; #endif FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { if (tpr == pr || @@ -1478,11 +1479,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i } } /* Check for conflicting IP addresses. */ - tppr = ppr; #ifdef VIMAGE - for (; tppr != &prison0; tppr = tppr->pr_parent) + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) if (tppr->pr_flags & PR_VNET) break; +#else + tppr = &prison0; #endif FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { if (tpr == pr || From owner-svn-src-stable@freebsd.org Wed Oct 17 16:17:57 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB05710D925F; Wed, 17 Oct 2018 16:17:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54A04856A3; Wed, 17 Oct 2018 16:17:57 +0000 (UTC) (envelope-from jamie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 449D55DAB; Wed, 17 Oct 2018 16:17:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9HGHv7o031723; Wed, 17 Oct 2018 16:17:57 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9HGHvqJ031721; Wed, 17 Oct 2018 16:17:57 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201810171617.w9HGHvqJ031721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Wed, 17 Oct 2018 16:17: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: r339410 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 339410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2018 16:17:57 -0000 Author: jamie Date: Wed Oct 17 16:17:56 2018 New Revision: 339410 URL: https://svnweb.freebsd.org/changeset/base/339410 Log: MFC r339211: Fix the test prohibiting jails from sharing IP addresses. It's not supposed to be legal for two jails to contain the same IP address, unless both jails contain only that one address. This is the behavior documented in jail(8), and is there to prevent confusion when multiple jails are listening on IADDR_ANY. VIMAGE jails (now the default for GENERIC kernels) test this correctly, but non-VIMAGE jails have been performing an incomplete test when nested jails are used. Modified: stable/10/sys/kern/kern_jail.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_jail.c ============================================================================== --- stable/10/sys/kern/kern_jail.c Wed Oct 17 16:11:43 2018 (r339409) +++ stable/10/sys/kern/kern_jail.c Wed Oct 17 16:17:56 2018 (r339410) @@ -1478,11 +1478,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i * there is a duplicate on a jail with more than one * IP stop checking and return error. */ - tppr = ppr; #ifdef VIMAGE - for (; tppr != &prison0; tppr = tppr->pr_parent) + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) if (tppr->pr_flags & PR_VNET) break; +#else + tppr = &prison0; #endif FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { if (tpr == pr || @@ -1544,11 +1545,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i } } /* Check for conflicting IP addresses. */ - tppr = ppr; #ifdef VIMAGE - for (; tppr != &prison0; tppr = tppr->pr_parent) + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) if (tppr->pr_flags & PR_VNET) break; +#else + tppr = &prison0; #endif FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { if (tpr == pr || From owner-svn-src-stable@freebsd.org Thu Oct 18 04:36:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D338310C9A8F; Thu, 18 Oct 2018 04:36:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8894A79E1D; Thu, 18 Oct 2018 04:36:27 +0000 (UTC) (envelope-from kp@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F54F1AFE6; Thu, 18 Oct 2018 04:36:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9I4aRZk010596; Thu, 18 Oct 2018 04:36:27 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9I4aPTR010587; Thu, 18 Oct 2018 04:36:25 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201810180436.w9I4aPTR010587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 18 Oct 2018 04:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339418 - in stable/11/sys: net netpfil/pf X-SVN-Group: stable-11 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in stable/11/sys: net netpfil/pf X-SVN-Commit-Revision: 339418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 04:36:28 -0000 Author: kp Date: Thu Oct 18 04:36:25 2018 New Revision: 339418 URL: https://svnweb.freebsd.org/changeset/base/339418 Log: MFC r334375, r334379: pf: Replace rwlock on PF_RULES_LOCK with rmlock Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock with rmlock. This change improves packet processing rate in high pps environments. Benchmarking by olivier@ shows a 65% improvement in pps. While here, also eliminate all appearances of "sys/rwlock.h" includes since it is not used anymore. Submitted by: farrokhi@ Modified: stable/11/sys/net/pfvar.h stable/11/sys/netpfil/pf/if_pfsync.c stable/11/sys/netpfil/pf/pf.c stable/11/sys/netpfil/pf/pf_if.c stable/11/sys/netpfil/pf/pf_ioctl.c stable/11/sys/netpfil/pf/pf_lb.c stable/11/sys/netpfil/pf/pf_norm.c stable/11/sys/netpfil/pf/pf_osfp.c stable/11/sys/netpfil/pf/pf_table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/pfvar.h ============================================================================== --- stable/11/sys/net/pfvar.h Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/net/pfvar.h Thu Oct 18 04:36:25 2018 (r339418) @@ -36,8 +36,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -145,14 +148,15 @@ extern struct mtx pf_unlnkdrules_mtx; #define PF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #define PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) -extern struct rwlock pf_rules_lock; -#define PF_RULES_RLOCK() rw_rlock(&pf_rules_lock) -#define PF_RULES_RUNLOCK() rw_runlock(&pf_rules_lock) -#define PF_RULES_WLOCK() rw_wlock(&pf_rules_lock) -#define PF_RULES_WUNLOCK() rw_wunlock(&pf_rules_lock) -#define PF_RULES_ASSERT() rw_assert(&pf_rules_lock, RA_LOCKED) -#define PF_RULES_RASSERT() rw_assert(&pf_rules_lock, RA_RLOCKED) -#define PF_RULES_WASSERT() rw_assert(&pf_rules_lock, RA_WLOCKED) +extern struct rmlock pf_rules_lock; +#define PF_RULES_RLOCK_TRACKER struct rm_priotracker _pf_rules_tracker +#define PF_RULES_RLOCK() rm_rlock(&pf_rules_lock, &_pf_rules_tracker) +#define PF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) +#define PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) +#define PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) +#define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) +#define PF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) #define PF_MODVER 1 #define PFLOG_MODVER 1 Modified: stable/11/sys/netpfil/pf/if_pfsync.c ============================================================================== --- stable/11/sys/netpfil/pf/if_pfsync.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/if_pfsync.c Thu Oct 18 04:36:25 2018 (r339418) @@ -585,6 +585,8 @@ pfsync_input(struct mbuf **mp, int *offp __unused, int int rv; uint16_t count; + PF_RULES_RLOCK_TRACKER; + *mp = NULL; V_pfsyncstats.pfsyncs_ipackets++; Modified: stable/11/sys/netpfil/pf/pf.c ============================================================================== --- stable/11/sys/netpfil/pf/pf.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf.c Thu Oct 18 04:36:25 2018 (r339418) @@ -1454,9 +1454,11 @@ pf_purge_thread(void *unused __unused) VNET_ITERATOR_DECL(vnet_iter); u_int idx = 0; + PF_RULES_RLOCK_TRACKER; + for (;;) { PF_RULES_RLOCK(); - rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftm", hz / 10); + rm_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftm", hz / 10); PF_RULES_RUNLOCK(); VNET_LIST_RLOCK(); @@ -5908,6 +5910,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct struct pf_pdesc pd; int off, dirndx, pqid = 0; + PF_RULES_RLOCK_TRACKER; + M_ASSERTPKTHDR(m); if (!V_pf_status.running) @@ -6295,6 +6299,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struc struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; + PF_RULES_RLOCK_TRACKER; M_ASSERTPKTHDR(m); if (!V_pf_status.running) Modified: stable/11/sys/netpfil/pf/pf_if.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_if.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_if.c Thu Oct 18 04:36:25 2018 (r339418) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_ioctl.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_ioctl.c Thu Oct 18 04:36:25 2018 (r339418) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -201,7 +200,7 @@ VNET_DEFINE(int, pf_vnet_active); int pf_end_threads; -struct rwlock pf_rules_lock; +struct rmlock pf_rules_lock; struct sx pf_ioctl_lock; /* pfsync */ @@ -991,6 +990,7 @@ static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { int error = 0; + PF_RULES_RLOCK_TRACKER; /* XXX keep in sync with switch() below */ if (securelevel_gt(td->td_ucred, 2)) @@ -3912,7 +3912,7 @@ pf_load(void) { int error; - rw_init(&pf_rules_lock, "pf rulesets"); + rm_init(&pf_rules_lock, "pf rulesets"); sx_init(&pf_ioctl_lock, "pf ioctl"); pf_mtag_initialize(); @@ -3976,7 +3976,7 @@ pf_unload(void) pf_end_threads = 1; while (pf_end_threads < 2) { wakeup_one(pf_purge_thread); - rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); + rm_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); } if (pf_dev != NULL) @@ -3984,7 +3984,7 @@ pf_unload(void) pfi_cleanup(); - rw_destroy(&pf_rules_lock); + rm_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); return (error); Modified: stable/11/sys/netpfil/pf/pf_lb.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_lb.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_lb.c Thu Oct 18 04:36:25 2018 (r339418) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_norm.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_norm.c Thu Oct 18 04:36:25 2018 (r339418) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/netpfil/pf/pf_osfp.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_osfp.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_osfp.c Thu Oct 18 04:36:25 2018 (r339418) @@ -25,7 +25,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: stable/11/sys/netpfil/pf/pf_table.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_table.c Thu Oct 18 02:07:30 2018 (r339417) +++ stable/11/sys/netpfil/pf/pf_table.c Thu Oct 18 04:36:25 2018 (r339418) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-stable@freebsd.org Thu Oct 18 17:33:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCE21EFC3B4; Thu, 18 Oct 2018 17:33:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6916A7489B; Thu, 18 Oct 2018 17:33:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6069823015; Thu, 18 Oct 2018 17:33:31 +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 w9IHXV5k011728; Thu, 18 Oct 2018 17:33:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9IHXVbO011727; Thu, 18 Oct 2018 17:33:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201810181733.w9IHXVbO011727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 18 Oct 2018 17:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339426 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 339426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 17:33:31 -0000 Author: gjb Date: Thu Oct 18 17:33:30 2018 New Revision: 339426 URL: https://svnweb.freebsd.org/changeset/base/339426 Log: Document the krpc module requirement in 11.x that was not present in 10.x if the system has a custom kernel configuration that excludes NFS and, for example, uses MODULES_OVERRIDE="zfs opensolaris". Reported by: eugen (via -stable) Sponsored by: The FreeBSD Foundation Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Oct 18 16:18:22 2018 (r339425) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Thu Oct 18 17:33:30 2018 (r339426) @@ -234,6 +234,20 @@ boot xlink:href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228536">228536 for more information. + + + [2018-10-18] A &os; system with a custom kernel + configuration excluding NFS on 10.x did + not explicitly require the krpc option to + be included when booting via ZFS-on-root + and, for example, setting + MODULES_OVERRIDE="zfs opensolaris" in the + kernel configuration. + + In 11.x, however, krpc is explicitly + required if the kernel configuration excludes + NFS. + From owner-svn-src-stable@freebsd.org Thu Oct 18 19:19:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12E2CEFF885; Thu, 18 Oct 2018 19:19:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC656797FD; Thu, 18 Oct 2018 19:19:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2D7224129; Thu, 18 Oct 2018 19:19:45 +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 w9IJJjhK064077; Thu, 18 Oct 2018 19:19:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9IJJjfB064076; Thu, 18 Oct 2018 19:19:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201810181919.w9IJJjfB064076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 18 Oct 2018 19:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339429 - stable/11/contrib/llvm/tools/lld/ELF X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/contrib/llvm/tools/lld/ELF X-SVN-Commit-Revision: 339429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 19:19:46 -0000 Author: dim Date: Thu Oct 18 19:19:45 2018 New Revision: 339429 URL: https://svnweb.freebsd.org/changeset/base/339429 Log: MFC r339013: Pull in r329557 from upstream lld trunk (by George Rimar): [ELF] - Allow LLD to produce file symbols. This is for PR36716 and this enables emitting STT_FILE symbols. Output size affect is minor: lld binary size changes from 52,883,408 to 52,949,400 clang binary size changes from 83,136,456 to 83,219,600 Differential revision: https://reviews.llvm.org/D45261 This fixes a regression in lld that made it stop emitting STT_FILE symbols, which ctfmerge relies upon to uniquify function table entries that reference STB_LOCAL symbols. Consequently, ctfmerge stopped emitting entries for static functions into the function table, and dtrace no longer gets type info for them. Reported by: markj PR: 230444 Modified: stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp Thu Oct 18 19:07:15 2018 (r339428) +++ stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp Thu Oct 18 19:19:45 2018 (r339429) @@ -487,7 +487,7 @@ template void Writer::run() { static bool shouldKeepInSymtab(SectionBase *Sec, StringRef SymName, const Symbol &B) { - if (B.isFile() || B.isSection()) + if (B.isSection()) return false; // If sym references a section in a discarded group, don't keep it. From owner-svn-src-stable@freebsd.org Thu Oct 18 22:14:50 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3CCDF76EFD; Thu, 18 Oct 2018 22:14:50 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 44DD1813D7; Thu, 18 Oct 2018 22:14:50 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local ([199.201.64.140]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id w9IMEmKI006642 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 18 Oct 2018 15:14:48 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r339411 - stable/11/sys/kern To: Jamie Gritton , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201810171617.w9HGHvVx031753@repo.freebsd.org> From: Julian Elischer Message-ID: Date: Thu, 18 Oct 2018 15:14:42 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201810171617.w9HGHvVx031753@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2018 22:14:50 -0000 On 17/10/18 9:17 am, Jamie Gritton wrote: > Author: jamie > Date: Wed Oct 17 16:17:57 2018 > New Revision: 339411 > URL: https://svnweb.freebsd.org/changeset/base/339411 > > Log: > MFC r339211: > > Fix the test prohibiting jails from sharing IP addresses. > > It's not supposed to be legal for two jails to contain the same IP address, > unless both jails contain only that one address. This is the behavior > documented in jail(8), and is there to prevent confusion when multiple > jails are listening on IADDR_ANY. > > VIMAGE jails (now the default for GENERIC kernels) test this correctly, > but non-VIMAGE jails have been performing an incomplete test when nested > jails are used. I think VIMAGE Jails should be able to have the same address optionally..  who says they are even in the same universe? > > Modified: > stable/11/sys/kern/kern_jail.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/kern/kern_jail.c > ============================================================================== > --- stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:56 2018 (r339410) > +++ stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:57 2018 (r339411) > @@ -1411,11 +1411,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i > * there is a duplicate on a jail with more than one > * IP stop checking and return error. > */ > - tppr = ppr; > #ifdef VIMAGE > - for (; tppr != &prison0; tppr = tppr->pr_parent) > + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) > if (tppr->pr_flags & PR_VNET) > break; > +#else > + tppr = &prison0; > #endif > FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { > if (tpr == pr || > @@ -1478,11 +1479,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i > } > } > /* Check for conflicting IP addresses. */ > - tppr = ppr; > #ifdef VIMAGE > - for (; tppr != &prison0; tppr = tppr->pr_parent) > + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) > if (tppr->pr_flags & PR_VNET) > break; > +#else > + tppr = &prison0; > #endif > FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { > if (tpr == pr || > > From owner-svn-src-stable@freebsd.org Fri Oct 19 00:09:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B078BF797DB; Fri, 19 Oct 2018 00:09:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6716384D48; Fri, 19 Oct 2018 00:09:25 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47F7B2718F; Fri, 19 Oct 2018 00:09:25 +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 w9J09Ph0016445; Fri, 19 Oct 2018 00:09:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J09P1x016444; Fri, 19 Oct 2018 00:09:25 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201810190009.w9J09P1x016444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 19 Oct 2018 00:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339434 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 339434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 00:09:25 -0000 Author: gjb Date: Fri Oct 19 00:09:24 2018 New Revision: 339434 URL: https://svnweb.freebsd.org/changeset/base/339434 Log: Copy head@r339432 to stable/12 as part of the 12.0-RELEASE cycle. Additional post-branch commits will follow. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Added: - copied from r339432, head/ Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Fri Oct 19 00:24:26 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51C92F79DF6; Fri, 19 Oct 2018 00:24:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F380F857FC; Fri, 19 Oct 2018 00:24:25 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA543274B5; Fri, 19 Oct 2018 00:24:25 +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 w9J0OPsR026252; Fri, 19 Oct 2018 00:24:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J0ONUI026241; Fri, 19 Oct 2018 00:24:23 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201810190024.w9J0ONUI026241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 19 Oct 2018 00:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r339435 - in stable/12: . contrib/jemalloc/include/jemalloc lib/libc/locale libexec/rc release sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/powerpc/conf sys/spa... X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable/12: . contrib/jemalloc/include/jemalloc lib/libc/locale libexec/rc release sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/powerpc/conf sys/sparc64/conf usr.sbin/bhyve X-SVN-Commit-Revision: 339435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 00:24:26 -0000 Author: gjb Date: Fri Oct 19 00:24:23 2018 New Revision: 339435 URL: https://svnweb.freebsd.org/changeset/base/339435 Log: - Prune svn:mergeinfo from the new branch, as nothing has been merged here. - Remove debugging from GENERIC* kernel configurations - Enable MALLOC_PRODUCTION - Default dumpdev=NO - Remove UPDATING entry regarding debugging features - Switch 12.0 from -ALPHA10 to -BETA1 to prepare for builds. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Deleted: stable/12/sys/amd64/conf/GENERIC-NODEBUG stable/12/sys/arm/conf/GENERIC-NODEBUG stable/12/sys/arm64/conf/GENERIC-NODEBUG stable/12/sys/i386/conf/GENERIC-NODEBUG stable/12/sys/powerpc/conf/GENERIC-NODEBUG stable/12/sys/powerpc/conf/GENERIC64-NODEBUG stable/12/sys/sparc64/conf/GENERIC-NODEBUG Modified: stable/12/UPDATING stable/12/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h stable/12/libexec/rc/rc.conf stable/12/release/release.conf.sample stable/12/sys/amd64/conf/GENERIC stable/12/sys/arm64/conf/GENERIC stable/12/sys/conf/newvers.sh stable/12/sys/i386/conf/GENERIC stable/12/sys/powerpc/conf/GENERIC stable/12/sys/powerpc/conf/GENERIC64 stable/12/sys/sparc64/conf/GENERIC Directory Properties: stable/12/ (props changed) stable/12/MAINTAINERS (props changed) stable/12/cddl/ (props changed) stable/12/cddl/contrib/opensolaris/ (props changed) stable/12/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/ (props changed) stable/12/cddl/contrib/opensolaris/cmd/zdb/ (props changed) stable/12/cddl/contrib/opensolaris/cmd/zfs/ (props changed) stable/12/cddl/contrib/opensolaris/lib/libzfs/ (props changed) stable/12/contrib/amd/ (props changed) stable/12/contrib/apr/ (props changed) stable/12/contrib/apr-util/ (props changed) stable/12/contrib/atf/ (props changed) stable/12/contrib/binutils/ (props changed) stable/12/contrib/blacklist/ (props changed) stable/12/contrib/bmake/ (props changed) stable/12/contrib/byacc/ (props changed) stable/12/contrib/bzip2/ (props changed) stable/12/contrib/com_err/ (props changed) stable/12/contrib/compiler-rt/ (props changed) stable/12/contrib/dialog/ (props changed) stable/12/contrib/dma/ (props changed) stable/12/contrib/dtc/ (props changed) stable/12/contrib/ee/ (props changed) stable/12/contrib/elftoolchain/ (props changed) stable/12/contrib/elftoolchain/ar/ (props changed) stable/12/contrib/elftoolchain/brandelf/ (props changed) stable/12/contrib/elftoolchain/elfdump/ (props changed) stable/12/contrib/expat/ (props changed) stable/12/contrib/file/ (props changed) stable/12/contrib/gcc/ (props changed) stable/12/contrib/gcclibs/libgomp/ (props changed) stable/12/contrib/gdb/ (props changed) stable/12/contrib/gdtoa/ (props changed) stable/12/contrib/ipfilter/ (props changed) stable/12/contrib/ldns/ (props changed) stable/12/contrib/ldns-host/ (props changed) stable/12/contrib/less/ (props changed) stable/12/contrib/libarchive/ (props changed) stable/12/contrib/libc++/ (props changed) stable/12/contrib/libc-vis/ (props changed) stable/12/contrib/libcxxrt/ (props changed) stable/12/contrib/libexecinfo/ (props changed) stable/12/contrib/libstdc++/ (props changed) stable/12/contrib/libucl/ (props changed) stable/12/contrib/libxo/ (props changed) stable/12/contrib/llvm/ (props changed) stable/12/contrib/llvm/projects/libunwind/ (props changed) stable/12/contrib/llvm/tools/clang/ (props changed) stable/12/contrib/llvm/tools/lld/ (props changed) stable/12/contrib/llvm/tools/lldb/ (props changed) stable/12/contrib/lua/ (props changed) stable/12/contrib/mandoc/ (props changed) stable/12/contrib/mtree/ (props changed) stable/12/contrib/ncurses/ (props changed) stable/12/contrib/netbsd-tests/ (props changed) stable/12/contrib/netcat/ (props changed) stable/12/contrib/ntp/ (props changed) stable/12/contrib/nvi/ (props changed) stable/12/contrib/one-true-awk/ (props changed) stable/12/contrib/openbsm/ (props changed) stable/12/contrib/openpam/ (props changed) stable/12/contrib/openresolv/ (props changed) stable/12/contrib/pf/ (props changed) stable/12/contrib/pjdfstest/ (props changed) stable/12/contrib/sendmail/ (props changed) stable/12/contrib/serf/ (props changed) stable/12/contrib/sqlite3/ (props changed) stable/12/contrib/subversion/ (props changed) stable/12/contrib/tcpdump/ (props changed) stable/12/contrib/tcsh/ (props changed) stable/12/contrib/tnftp/ (props changed) stable/12/contrib/tzcode/stdtime/ (props changed) stable/12/contrib/tzcode/zic/ (props changed) stable/12/contrib/tzdata/ (props changed) stable/12/contrib/unbound/ (props changed) stable/12/contrib/vis/ (props changed) stable/12/contrib/wpa/ (props changed) stable/12/contrib/xz/ (props changed) stable/12/contrib/zlib/ (props changed) stable/12/crypto/heimdal/ (props changed) stable/12/crypto/openssh/ (props changed) stable/12/crypto/openssl/ (props changed) stable/12/gnu/lib/ (props changed) stable/12/gnu/usr.bin/binutils/ (props changed) stable/12/gnu/usr.bin/cc/cc_tools/ (props changed) stable/12/gnu/usr.bin/gdb/ (props changed) stable/12/lib/libc/locale/ascii.c (props changed) stable/12/lib/libedit/ (props changed) stable/12/lib/libedit/edit/readline/ (props changed) stable/12/sys/cddl/contrib/opensolaris/ (props changed) stable/12/sys/contrib/ck/ (props changed) stable/12/sys/contrib/dev/acpica/ (props changed) stable/12/sys/contrib/ena-com/ (props changed) stable/12/sys/contrib/ipfilter/ (props changed) stable/12/sys/contrib/libfdt/ (props changed) stable/12/sys/contrib/octeon-sdk/ (props changed) stable/12/sys/contrib/x86emu/ (props changed) stable/12/sys/contrib/xz-embedded/ (props changed) stable/12/sys/contrib/zstd/ (props changed) stable/12/sys/gnu/dts/arm/ (props changed) stable/12/sys/gnu/dts/arm64/ (props changed) stable/12/sys/gnu/dts/include/ (props changed) stable/12/usr.sbin/bhyve/atkbdc.h (props changed) stable/12/usr.sbin/bhyve/bhyvegc.c (props changed) stable/12/usr.sbin/bhyve/bhyvegc.h (props changed) stable/12/usr.sbin/bhyve/console.c (props changed) stable/12/usr.sbin/bhyve/console.h (props changed) stable/12/usr.sbin/bhyve/pci_fbuf.c (props changed) stable/12/usr.sbin/bhyve/pci_xhci.c (props changed) stable/12/usr.sbin/bhyve/pci_xhci.h (props changed) stable/12/usr.sbin/bhyve/ps2kbd.c (props changed) stable/12/usr.sbin/bhyve/ps2kbd.h (props changed) stable/12/usr.sbin/bhyve/ps2mouse.c (props changed) stable/12/usr.sbin/bhyve/ps2mouse.h (props changed) stable/12/usr.sbin/bhyve/rfb.c (props changed) stable/12/usr.sbin/bhyve/rfb.h (props changed) stable/12/usr.sbin/bhyve/sockstream.c (props changed) stable/12/usr.sbin/bhyve/sockstream.h (props changed) stable/12/usr.sbin/bhyve/usb_emul.c (props changed) stable/12/usr.sbin/bhyve/usb_emul.h (props changed) stable/12/usr.sbin/bhyve/usb_mouse.c (props changed) stable/12/usr.sbin/bhyve/vga.c (props changed) stable/12/usr.sbin/bhyve/vga.h (props changed) Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/UPDATING Fri Oct 19 00:24:23 2018 (r339435) @@ -16,20 +16,9 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: - FreeBSD 12.x has many debugging features turned on, in both the kernel - and userland. These features attempt to detect incorrect use of - system primitives, and encourage loud failure through extra sanity - checking and fail stop semantics. They also substantially impact - system performance. If you want to do performance measurement, - benchmarking, and optimization, you'll want to turn them off. This - includes various WITNESS- related kernel options, INVARIANTS, malloc - debugging flags in userland, and various verbose features in the - kernel. Many developers choose to disable these features on build - machines to maximize performance. (To completely disable malloc - debugging, define MALLOC_PRODUCTION in /etc/make.conf, or to merely - disable the most expensive debugging functionality run - "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20181019: + The stable/12 branch has been created in subversion from head + revision r339432. 20181009: OpenSSL has been updated to version 1.1.1. This update included Modified: stable/12/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h ============================================================================== --- stable/12/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h Fri Oct 19 00:24:23 2018 (r339435) @@ -5,7 +5,7 @@ #undef JEMALLOC_OVERRIDE_VALLOC #ifndef MALLOC_PRODUCTION -#define JEMALLOC_DEBUG +#define MALLOC_PRODUCTION #endif #undef JEMALLOC_DSS Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/libexec/rc/rc.conf Fri Oct 19 00:24:23 2018 (r339435) @@ -609,7 +609,7 @@ lpd_flags="" # Flags to lpd (if enabled). nscd_enable="NO" # Run the nsswitch caching daemon. chkprintcap_enable="NO" # Run chkprintcap(8) before running lpd. chkprintcap_flags="-d" # Create missing directories by default. -dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). +dumpdev="NO" # Device to crashdump to (device name, AUTO, or NO). dumpon_flags="" # Options to pass to dumpon(8), followed by dumpdev. dumpdir="/var/crash" # Directory where crash dumps are to be stored savecore_enable="YES" # Extract core from dump devices if any Modified: stable/12/release/release.conf.sample ============================================================================== --- stable/12/release/release.conf.sample Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/release/release.conf.sample Fri Oct 19 00:24:23 2018 (r339435) @@ -16,7 +16,7 @@ CHROOTDIR="/scratch" SVNROOT="svn://svn.FreeBSD.org/" ## Set the src/, ports/, and doc/ branches or tags. -SRCBRANCH="base/head@rHEAD" +SRCBRANCH="base/stable/12@rHEAD" DOCBRANCH="doc/head@rHEAD" PORTBRANCH="ports/head@rHEAD" Modified: stable/12/sys/amd64/conf/GENERIC ============================================================================== --- stable/12/sys/amd64/conf/GENERIC Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/amd64/conf/GENERIC Fri Oct 19 00:24:23 2018 (r339435) @@ -88,17 +88,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options BUF_TRACKING # Track buffer history -options DDB # Support DDB. -options FULL_BUF_TRACKING # Track more buffer history -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: stable/12/sys/arm64/conf/GENERIC ============================================================================== --- stable/12/sys/arm64/conf/GENERIC Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/arm64/conf/GENERIC Fri Oct 19 00:24:23 2018 (r339435) @@ -80,17 +80,6 @@ options INTRNG # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -#options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options USB_DEBUG # enable debug msgs # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: stable/12/sys/conf/newvers.sh ============================================================================== --- stable/12/sys/conf/newvers.sh Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/conf/newvers.sh Fri Oct 19 00:24:23 2018 (r339435) @@ -46,7 +46,7 @@ TYPE="FreeBSD" REVISION="12.0" -BRANCH="ALPHA10" +BRANCH="BETA1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: stable/12/sys/i386/conf/GENERIC ============================================================================== --- stable/12/sys/i386/conf/GENERIC Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/i386/conf/GENERIC Fri Oct 19 00:24:23 2018 (r339435) @@ -84,15 +84,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: stable/12/sys/powerpc/conf/GENERIC ============================================================================== --- stable/12/sys/powerpc/conf/GENERIC Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/powerpc/conf/GENERIC Fri Oct 19 00:24:23 2018 (r339435) @@ -90,14 +90,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB #Support DDB -#options DEADLKRES #Enable the deadlock resolver -options INVARIANTS #Enable calls of extra sanity checking -options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: stable/12/sys/powerpc/conf/GENERIC64 ============================================================================== --- stable/12/sys/powerpc/conf/GENERIC64 Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/powerpc/conf/GENERIC64 Fri Oct 19 00:24:23 2018 (r339435) @@ -87,14 +87,6 @@ options INCLUDE_CONFIG_FILE # Include this file i # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB #Support DDB -#options DEADLKRES #Enable the deadlock resolver -options INVARIANTS #Enable calls of extra sanity checking -options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS #Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Kernel dump features. options EKCD # Support for encrypted kernel dumps Modified: stable/12/sys/sparc64/conf/GENERIC ============================================================================== --- stable/12/sys/sparc64/conf/GENERIC Fri Oct 19 00:09:24 2018 (r339434) +++ stable/12/sys/sparc64/conf/GENERIC Fri Oct 19 00:24:23 2018 (r339435) @@ -79,15 +79,6 @@ options RCTL # Resource limits # Debugging support. Always need this: options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. -# For full debugger support use (turn off in stable branch): -options DDB # Support DDB. -options GDB # Support remote GDB. -options DEADLKRES # Enable the deadlock resolver -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Kernel dump features. options EKCD # Support for encrypted kernel dumps From owner-svn-src-stable@freebsd.org Fri Oct 19 00:44:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E4B0F7A946; Fri, 19 Oct 2018 00:44:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B38B864FD; Fri, 19 Oct 2018 00:44:07 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0057B27816; Fri, 19 Oct 2018 00:44:07 +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 w9J0i6XT036922; Fri, 19 Oct 2018 00:44:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J0i6Vn036921; Fri, 19 Oct 2018 00:44:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201810190044.w9J0i6Vn036921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 19 Oct 2018 00:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339437 - stable/11/sys/amd64/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/include X-SVN-Commit-Revision: 339437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 00:44:07 -0000 Author: kib Date: Fri Oct 19 00:44:06 2018 New Revision: 339437 URL: https://svnweb.freebsd.org/changeset/base/339437 Log: MFC r339384: Add clwb(). Modified: stable/11/sys/amd64/include/cpufunc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/cpufunc.h ============================================================================== --- stable/11/sys/amd64/include/cpufunc.h Fri Oct 19 00:37:47 2018 (r339436) +++ stable/11/sys/amd64/include/cpufunc.h Fri Oct 19 00:44:06 2018 (r339437) @@ -114,6 +114,13 @@ clflushopt(u_long addr) } static __inline void +clwb(u_long addr) +{ + + __asm __volatile("clwb %0" : : "m" (*(char *)addr)); +} + +static __inline void clts(void) { From owner-svn-src-stable@freebsd.org Fri Oct 19 00:47:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAB00F7AA3B; Fri, 19 Oct 2018 00:47:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60EA586684; Fri, 19 Oct 2018 00:47:20 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D95027817; Fri, 19 Oct 2018 00:47:20 +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 w9J0lKxr037101; Fri, 19 Oct 2018 00:47:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J0lKt5037100; Fri, 19 Oct 2018 00:47:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201810190047.w9J0lKt5037100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 19 Oct 2018 00:47:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339438 - stable/11/sys/amd64/vmm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/vmm X-SVN-Commit-Revision: 339438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 00:47:20 -0000 Author: kib Date: Fri Oct 19 00:47:19 2018 New Revision: 339438 URL: https://svnweb.freebsd.org/changeset/base/339438 Log: MFC r339331: bhyve: emulate CLFLUSH and CLFLUSHOPT. Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_instruction_emul.c Fri Oct 19 00:44:06 2018 (r339437) +++ stable/11/sys/amd64/vmm/vmm_instruction_emul.c Fri Oct 19 00:47:19 2018 (r339438) @@ -74,6 +74,7 @@ enum { VIE_OP_TYPE_GROUP1, VIE_OP_TYPE_STOS, VIE_OP_TYPE_BITTEST, + VIE_OP_TYPE_TWOB_GRP15, VIE_OP_TYPE_LAST }; @@ -85,6 +86,10 @@ enum { #define VIE_OP_F_NO_GLA_VERIFICATION (1 << 4) static const struct vie_op two_byte_opcodes[256] = { + [0xAE] = { + .op_byte = 0xAE, + .op_type = VIE_OP_TYPE_TWOB_GRP15, + }, [0xB6] = { .op_byte = 0xB6, .op_type = VIE_OP_TYPE_MOVZX, @@ -1441,6 +1446,37 @@ emulate_bittest(void *vm, int vcpuid, uint64_t gpa, st return (0); } +static int +emulate_twob_group15(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, + mem_region_read_t memread, mem_region_write_t memwrite, void *memarg) +{ + int error; + uint64_t buf; + + switch (vie->reg & 7) { + case 0x7: /* CLFLUSH, CLFLUSHOPT, and SFENCE */ + if (vie->mod == 0x3) { + /* + * SFENCE. Ignore it, VM exit provides enough + * barriers on its own. + */ + error = 0; + } else { + /* + * CLFLUSH, CLFLUSHOPT. Only check for access + * rights. + */ + error = memread(vm, vcpuid, gpa, &buf, 1, memarg); + } + break; + default: + error = EINVAL; + break; + } + + return (error); +} + int vmm_emulate_instruction(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, struct vm_guest_paging *paging, mem_region_read_t memread, @@ -1499,6 +1535,10 @@ vmm_emulate_instruction(void *vm, int vcpuid, uint64_t break; case VIE_OP_TYPE_BITTEST: error = emulate_bittest(vm, vcpuid, gpa, vie, + memread, memwrite, memarg); + break; + case VIE_OP_TYPE_TWOB_GRP15: + error = emulate_twob_group15(vm, vcpuid, gpa, vie, memread, memwrite, memarg); break; default: From owner-svn-src-stable@freebsd.org Fri Oct 19 02:35:27 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56305F7E297; Fri, 19 Oct 2018 02:35:27 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org (gritton.org [199.192.165.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gritton.org", Issuer "Let's Encrypt Authority X3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CC1BB89B84; Fri, 19 Oct 2018 02:35:26 +0000 (UTC) (envelope-from jamie@freebsd.org) Received: from gritton.org ([127.0.0.131]) by gritton.org (8.15.2/8.15.2) with ESMTP id w9J2ZOeW047627; Thu, 18 Oct 2018 20:35:25 -0600 (MDT) (envelope-from jamie@freebsd.org) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 18 Oct 2018 20:35:24 -0600 From: James Gritton To: Julian Elischer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r339411 - stable/11/sys/kern In-Reply-To: References: <201810171617.w9HGHvVx031753@repo.freebsd.org> Message-ID: X-Sender: jamie@freebsd.org User-Agent: Roundcube Webmail/1.3.6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 02:35:27 -0000 On 2018-10-18 16:14, Julian Elischer wrote: > On 17/10/18 9:17 am, Jamie Gritton wrote: >> Author: jamie >> Date: Wed Oct 17 16:17:57 2018 >> New Revision: 339411 >> URL: https://svnweb.freebsd.org/changeset/base/339411 >> >> Log: >> MFC r339211: >> Fix the test prohibiting jails from sharing IP addresses. >> It's not supposed to be legal for two jails to contain the >> same IP address, >> unless both jails contain only that one address. This is the >> behavior >> documented in jail(8), and is there to prevent confusion when >> multiple >> jails are listening on IADDR_ANY. >> VIMAGE jails (now the default for GENERIC kernels) test this >> correctly, >> but non-VIMAGE jails have been performing an incomplete test when >> nested >> jails are used. > I think VIMAGE Jails should be able to have the same address > optionally..  who says they are even in the same universe? Indeed. This is just bad wording - vnet jails didn't have such a restriction before this commit, and nothing has changed. When I said they test this correctly, it was about how jails that are descendants of vnet jails correctly check all other descendants of their vnet-enabled ancestor (also correct before, and unchanged). For vnet jails themselves, the altered code blocks aren't even executed (because "ip4s > 0" and "ip6s > 0" apply only to non-vnet). - Jamie >> >> Modified: >> stable/11/sys/kern/kern_jail.c >> Directory Properties: >> stable/11/ (props changed) >> >> Modified: stable/11/sys/kern/kern_jail.c >> ============================================================================== >> --- stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:56 2018 (r339410) >> +++ stable/11/sys/kern/kern_jail.c Wed Oct 17 16:17:57 2018 (r339411) >> @@ -1411,11 +1411,12 @@ kern_jail_set(struct thread *td, struct uio >> *optuio, i >> * there is a duplicate on a jail with more than one >> * IP stop checking and return error. >> */ >> - tppr = ppr; >> #ifdef VIMAGE >> - for (; tppr != &prison0; tppr = tppr->pr_parent) >> + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) >> if (tppr->pr_flags & PR_VNET) >> break; >> +#else >> + tppr = &prison0; >> #endif >> FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { >> if (tpr == pr || >> @@ -1478,11 +1479,12 @@ kern_jail_set(struct thread *td, struct uio >> *optuio, i >> } >> } >> /* Check for conflicting IP addresses. */ >> - tppr = ppr; >> #ifdef VIMAGE >> - for (; tppr != &prison0; tppr = tppr->pr_parent) >> + for (tppr = ppr; tppr != &prison0; tppr = tppr->pr_parent) >> if (tppr->pr_flags & PR_VNET) >> break; >> +#else >> + tppr = &prison0; >> #endif >> FOREACH_PRISON_DESCENDANT(tppr, tpr, descend) { >> if (tpr == pr || >> >> From owner-svn-src-stable@freebsd.org Fri Oct 19 04:28:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A39E5FCCE60; Fri, 19 Oct 2018 04:28:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 560DD8D817; Fri, 19 Oct 2018 04:28:31 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FC4B1CAB; Fri, 19 Oct 2018 04:28:31 +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 w9J4SVQT050689; Fri, 19 Oct 2018 04:28:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J4SV1Q050688; Fri, 19 Oct 2018 04:28:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201810190428.w9J4SV1Q050688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 19 Oct 2018 04:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339439 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 339439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 04:28:31 -0000 Author: mav Date: Fri Oct 19 04:28:30 2018 New Revision: 339439 URL: https://svnweb.freebsd.org/changeset/base/339439 Log: MFC r339335: Avoid zero-sized kmem_alloc() in vdev_compact_children(). The device evacuation code adds a dependency that vdev_compact_children() be able to properly empty the vdev_child array by setting it to NULL and zeroing vdev_children. Under Linux, kmem_alloc() and related functions return a sentinel pointer rather than NULL for zero-sized allocations. This is a part of ZoL port of device removal patch: commit a1d477c24c7badc89c60955995fd84d311938486 Author: Matthew Ahrens Ported-by: Tim Chase Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Oct 19 00:47:19 2018 (r339438) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Fri Oct 19 04:28:30 2018 (r339439) @@ -505,17 +505,24 @@ vdev_compact_children(vdev_t *pvd) ASSERT(spa_config_held(pvd->vdev_spa, SCL_ALL, RW_WRITER) == SCL_ALL); + if (oldc == 0) + return; + for (int c = newc = 0; c < oldc; c++) if (pvd->vdev_child[c]) newc++; - newchild = kmem_alloc(newc * sizeof (vdev_t *), KM_SLEEP); + if (newc > 0) { + newchild = kmem_alloc(newc * sizeof (vdev_t *), KM_SLEEP); - for (int c = newc = 0; c < oldc; c++) { - if ((cvd = pvd->vdev_child[c]) != NULL) { - newchild[newc] = cvd; - cvd->vdev_id = newc++; + for (int c = newc = 0; c < oldc; c++) { + if ((cvd = pvd->vdev_child[c]) != NULL) { + newchild[newc] = cvd; + cvd->vdev_id = newc++; + } } + } else { + newchild = NULL; } kmem_free(pvd->vdev_child, oldc * sizeof (vdev_t *)); From owner-svn-src-stable@freebsd.org Fri Oct 19 04:30:26 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66D32FCCFBA; Fri, 19 Oct 2018 04:30:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 155A78D9AE; Fri, 19 Oct 2018 04:30:26 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DE931CB3; Fri, 19 Oct 2018 04:30:26 +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 w9J4UP38050843; Fri, 19 Oct 2018 04:30:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J4UPb7050842; Fri, 19 Oct 2018 04:30:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201810190430.w9J4UPb7050842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 19 Oct 2018 04:30:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339440 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 339440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 04:30:26 -0000 Author: mav Date: Fri Oct 19 04:30:25 2018 New Revision: 339440 URL: https://svnweb.freebsd.org/changeset/base/339440 Log: MFC r339329: Add ZIO_TYPE_FREE support for indirect vdevs. Upstream code expects only ZIO_TYPE_READ and some ZIO_TYPE_WRITE requests to removed (indirect) vdevs, while on FreeBSD there is also ZIO_TYPE_FREE (TRIM). ZIO_TYPE_FREE requests do not have the data buffers, so don't need the pointer adjustment. PR: 228750, 229007 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Fri Oct 19 04:28:30 2018 (r339439) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Fri Oct 19 04:30:25 2018 (r339440) @@ -1147,6 +1147,9 @@ vdev_indirect_child_io_done(zio_t *zio) pio->io_error = zio_worst_error(pio->io_error, zio->io_error); mutex_exit(&pio->io_lock); +#ifdef __FreeBSD__ + if (zio->io_abd != NULL) +#endif abd_put(zio->io_abd); } @@ -1262,8 +1265,12 @@ vdev_indirect_io_start(zio_t *zio) zio->io_vsd_ops = &vdev_indirect_vsd_ops; ASSERT(spa_config_held(spa, SCL_ALL, RW_READER) != 0); +#ifdef __FreeBSD__ + if (zio->io_type == ZIO_TYPE_WRITE) { +#else if (zio->io_type != ZIO_TYPE_READ) { ASSERT3U(zio->io_type, ==, ZIO_TYPE_WRITE); +#endif /* * Note: this code can handle other kinds of writes, * but we don't expect them. @@ -1295,6 +1302,9 @@ vdev_indirect_io_start(zio_t *zio) ASSERT3P(list_next(&iv->iv_splits, first), ==, NULL); zio_nowait(zio_vdev_child_io(zio, zio->io_bp, first->is_vdev, first->is_target_offset, +#ifdef __FreeBSD__ + zio->io_abd == NULL ? NULL : +#endif abd_get_offset(zio->io_abd, 0), zio->io_size, zio->io_type, zio->io_priority, 0, vdev_indirect_child_io_done, zio)); @@ -1321,6 +1331,9 @@ vdev_indirect_io_start(zio_t *zio) is != NULL; is = list_next(&iv->iv_splits, is)) { zio_nowait(zio_vdev_child_io(zio, NULL, is->is_vdev, is->is_target_offset, +#ifdef __FreeBSD__ + zio->io_abd == NULL ? NULL : +#endif abd_get_offset(zio->io_abd, is->is_split_offset), is->is_size, zio->io_type, From owner-svn-src-stable@freebsd.org Fri Oct 19 04:37:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BD92FCD40B; Fri, 19 Oct 2018 04:37:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7938DEFF; Fri, 19 Oct 2018 04:37:28 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 483A31E44; Fri, 19 Oct 2018 04:37:28 +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 w9J4bSA6055760; Fri, 19 Oct 2018 04:37:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J4bSvu055759; Fri, 19 Oct 2018 04:37:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201810190437.w9J4bSvu055759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 19 Oct 2018 04:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339441 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 339441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 04:37:28 -0000 Author: mav Date: Fri Oct 19 04:37:27 2018 New Revision: 339441 URL: https://svnweb.freebsd.org/changeset/base/339441 Log: MFC r339372: Skip VDEV_IO_DONE stage only for ZIO_TYPE_FREE. Device removal code uses zio_vdev_child_io() with ZIO_TYPE_NULL parent, that never happened before. It confused FreeBSD-specific TRIM code, which does not use VDEV_IO_DONE for logical ZIO_TYPE_FREE ZIOs. As result of that stage being skipped device removal ZIOs leaked references and memory that supposed to be freed by VDEV_IO_DONE, making it stuck. It is a quick patch rather then a nice fix, but hopefully we'll be able to drop it all together when alternative TRIM implementation finally get landed. PR: 228750, 229007 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Oct 19 04:30:25 2018 (r339440) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Oct 19 04:37:27 2018 (r339441) @@ -1180,7 +1180,8 @@ zio_vdev_child_io(zio_t *pio, blkptr_t *bp, vdev_t *vd } /* Not all IO types require vdev io done stage e.g. free */ - if (!(pio->io_pipeline & ZIO_STAGE_VDEV_IO_DONE)) + if (type == ZIO_TYPE_FREE && + !(pio->io_pipeline & ZIO_STAGE_VDEV_IO_DONE)) pipeline &= ~ZIO_STAGE_VDEV_IO_DONE; if (vd->vdev_ops->vdev_op_leaf) { From owner-svn-src-stable@freebsd.org Fri Oct 19 08:38:35 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3947FFD7A9F; Fri, 19 Oct 2018 08:38:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3FA7746D8; Fri, 19 Oct 2018 08:38:34 +0000 (UTC) (envelope-from hselasky@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA57A4982; Fri, 19 Oct 2018 08:38:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9J8cYO0078716; Fri, 19 Oct 2018 08:38:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J8cYNA078715; Fri, 19 Oct 2018 08:38:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810190838.w9J8cYNA078715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 19 Oct 2018 08:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339442 - stable/11/sys/dev/usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/usb/controller X-SVN-Commit-Revision: 339442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 08:38:35 -0000 Author: hselasky Date: Fri Oct 19 08:38:34 2018 New Revision: 339442 URL: https://svnweb.freebsd.org/changeset/base/339442 Log: MFC r339388: Fix for reception of large full speed isochronous frames via the transaction translator, when using the DWC OTG USB controller driver. Make sure to re-try getting the complete split packets until a DATA0 packet is received. Larger isochronous frames may be split into multiple MDATA packets terminated by a single DATA0 packet. PR: 230434 Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/usb/controller/dwc_otg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- stable/11/sys/dev/usb/controller/dwc_otg.c Fri Oct 19 04:37:27 2018 (r339441) +++ stable/11/sys/dev/usb/controller/dwc_otg.c Fri Oct 19 08:38:34 2018 (r339442) @@ -1460,6 +1460,8 @@ dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct /* check if we are complete */ if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN) { goto complete; + } else if (td->hcsplt != 0) { + goto receive_pkt; } else { /* get more packets */ goto busy; @@ -1518,8 +1520,10 @@ receive_pkt: if (td->hcsplt != 0) { delta = td->tt_complete_slot - sc->sc_last_frame_num - 1; if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { - td->state = DWC_CHAN_ST_WAIT_C_PKT; - goto busy; + if (td->ep_type != UE_ISOCHRONOUS) { + td->state = DWC_CHAN_ST_WAIT_C_PKT; + goto busy; + } } delta = sc->sc_last_frame_num - td->tt_start_slot; if (delta > DWC_OTG_TT_SLOT_MAX) { @@ -1565,12 +1569,23 @@ receive_pkt: hcchar = td->hcchar; hcchar |= HCCHAR_EPDIR_IN; - /* receive complete split ASAP */ - if ((sc->sc_last_frame_num & 1) != 0 && - td->ep_type == UE_ISOCHRONOUS) - hcchar |= HCCHAR_ODDFRM; - else + if (td->ep_type == UE_ISOCHRONOUS) { + if (td->hcsplt != 0) { + /* continously buffer */ + if (sc->sc_last_frame_num & 1) + hcchar &= ~HCCHAR_ODDFRM; + else + hcchar |= HCCHAR_ODDFRM; + } else { + /* multi buffer, if any */ + if (sc->sc_last_frame_num & 1) + hcchar |= HCCHAR_ODDFRM; + else + hcchar &= ~HCCHAR_ODDFRM; + } + } else { hcchar &= ~HCCHAR_ODDFRM; + } /* must enable channel before data can be received */ DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(channel), hcchar); From owner-svn-src-stable@freebsd.org Fri Oct 19 08:40:26 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC31FD7B7C; Fri, 19 Oct 2018 08:40:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C68074929; Fri, 19 Oct 2018 08:40:26 +0000 (UTC) (envelope-from hselasky@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 550AF498A; Fri, 19 Oct 2018 08:40:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9J8eQNZ079030; Fri, 19 Oct 2018 08:40:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9J8eQSk079029; Fri, 19 Oct 2018 08:40:26 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201810190840.w9J8eQSk079029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 19 Oct 2018 08:40: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: r339443 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb/controller X-SVN-Commit-Revision: 339443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 08:40:26 -0000 Author: hselasky Date: Fri Oct 19 08:40:25 2018 New Revision: 339443 URL: https://svnweb.freebsd.org/changeset/base/339443 Log: MFC r339388: Fix for reception of large full speed isochronous frames via the transaction translator, when using the DWC OTG USB controller driver. Make sure to re-try getting the complete split packets until a DATA0 packet is received. Larger isochronous frames may be split into multiple MDATA packets terminated by a single DATA0 packet. PR: 230434 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/controller/dwc_otg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- stable/10/sys/dev/usb/controller/dwc_otg.c Fri Oct 19 08:38:34 2018 (r339442) +++ stable/10/sys/dev/usb/controller/dwc_otg.c Fri Oct 19 08:40:25 2018 (r339443) @@ -1461,6 +1461,8 @@ dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct /* check if we are complete */ if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN) { goto complete; + } else if (td->hcsplt != 0) { + goto receive_pkt; } else { /* get more packets */ goto busy; @@ -1519,8 +1521,10 @@ receive_pkt: if (td->hcsplt != 0) { delta = td->tt_complete_slot - sc->sc_last_frame_num - 1; if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { - td->state = DWC_CHAN_ST_WAIT_C_PKT; - goto busy; + if (td->ep_type != UE_ISOCHRONOUS) { + td->state = DWC_CHAN_ST_WAIT_C_PKT; + goto busy; + } } delta = sc->sc_last_frame_num - td->tt_start_slot; if (delta > DWC_OTG_TT_SLOT_MAX) { @@ -1566,12 +1570,23 @@ receive_pkt: hcchar = td->hcchar; hcchar |= HCCHAR_EPDIR_IN; - /* receive complete split ASAP */ - if ((sc->sc_last_frame_num & 1) != 0 && - td->ep_type == UE_ISOCHRONOUS) - hcchar |= HCCHAR_ODDFRM; - else + if (td->ep_type == UE_ISOCHRONOUS) { + if (td->hcsplt != 0) { + /* continously buffer */ + if (sc->sc_last_frame_num & 1) + hcchar &= ~HCCHAR_ODDFRM; + else + hcchar |= HCCHAR_ODDFRM; + } else { + /* multi buffer, if any */ + if (sc->sc_last_frame_num & 1) + hcchar |= HCCHAR_ODDFRM; + else + hcchar &= ~HCCHAR_ODDFRM; + } + } else { hcchar &= ~HCCHAR_ODDFRM; + } /* must enable channel before data can be received */ DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(channel), hcchar); From owner-svn-src-stable@freebsd.org Sat Oct 20 16:20:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BDB5FEB22B; Sat, 20 Oct 2018 16:20:38 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D418478FDC; Sat, 20 Oct 2018 16:20:37 +0000 (UTC) (envelope-from jamie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CED7520562; Sat, 20 Oct 2018 16:20:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9KGKbOV071858; Sat, 20 Oct 2018 16:20:37 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9KGKaRQ071853; Sat, 20 Oct 2018 16:20:36 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201810201620.w9KGKaRQ071853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Sat, 20 Oct 2018 16:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339446 - in stable/11: sys/kern sys/sys usr.sbin/jail X-SVN-Group: stable-11 X-SVN-Commit-Author: jamie X-SVN-Commit-Paths: in stable/11: sys/kern sys/sys usr.sbin/jail X-SVN-Commit-Revision: 339446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Oct 2018 16:20:38 -0000 Author: jamie Date: Sat Oct 20 16:20:36 2018 New Revision: 339446 URL: https://svnweb.freebsd.org/changeset/base/339446 Log: MFC r339409, r339420: Add a new jail permission, allow.read_msgbuf. When true, jailed processes can see the dmesg buffer (this is the current behavior). When false (the new default), dmesg will be unavailable to jailed users, whether root or not. The security.bsd.unprivileged_read_msgbuf sysctl still works as before, controlling system-wide whether non-root users can see the buffer. PR: 211580 Submitted by: bz Modified: stable/11/sys/kern/kern_jail.c stable/11/sys/kern/kern_priv.c stable/11/sys/kern/subr_prf.c stable/11/sys/sys/jail.h stable/11/usr.sbin/jail/jail.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_jail.c ============================================================================== --- stable/11/sys/kern/kern_jail.c Fri Oct 19 10:05:02 2018 (r339445) +++ stable/11/sys/kern/kern_jail.c Sat Oct 20 16:20:36 2018 (r339446) @@ -200,6 +200,7 @@ static char *pr_allow_names[] = { "allow.mount.fdescfs", "allow.mount.linprocfs", "allow.mount.linsysfs", + "allow.read_msgbuf", }; const size_t pr_allow_names_size = sizeof(pr_allow_names); @@ -219,6 +220,7 @@ static char *pr_allow_nonames[] = { "allow.mount.nofdescfs", "allow.mount.nolinprocfs", "allow.mount.nolinsysfs", + "allow.noread_msgbuf", }; const size_t pr_allow_nonames_size = sizeof(pr_allow_nonames); @@ -3348,6 +3350,15 @@ prison_priv_check(struct ucred *cred, int priv) case PRIV_PROC_SETLOGINCLASS: return (0); + /* + * Do not allow a process inside a jail to read the kernel + * message buffer unless explicitly permitted. + */ + case PRIV_MSGBUF: + if (cred->cr_prison->pr_allow & PR_ALLOW_READ_MSGBUF) + return (0); + return (EPERM); + default: /* * In all remaining cases, deny the privilege request. This @@ -3796,6 +3807,8 @@ SYSCTL_JAIL_PARAM(_allow, quotas, CTLTYPE_INT | CTLFLA "B", "Jail may set file quotas"); SYSCTL_JAIL_PARAM(_allow, socket_af, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may create sockets other than just UNIX/IPv4/IPv6/route"); +SYSCTL_JAIL_PARAM(_allow, read_msgbuf, CTLTYPE_INT | CTLFLAG_RW, + "B", "Jail may read the kernel message buffer"); SYSCTL_JAIL_PARAM_SUBNODE(allow, mount, "Jail mount/unmount permission flags"); SYSCTL_JAIL_PARAM(_allow_mount, , CTLTYPE_INT | CTLFLAG_RW, Modified: stable/11/sys/kern/kern_priv.c ============================================================================== --- stable/11/sys/kern/kern_priv.c Fri Oct 19 10:05:02 2018 (r339445) +++ stable/11/sys/kern/kern_priv.c Sat Oct 20 16:20:36 2018 (r339446) @@ -60,6 +60,11 @@ static int unprivileged_mlock = 1; SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_mlock, CTLFLAG_RWTUN, &unprivileged_mlock, 0, "Allow non-root users to call mlock(2)"); +static int unprivileged_read_msgbuf = 1; +SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_read_msgbuf, + CTLFLAG_RW, &unprivileged_read_msgbuf, 0, + "Unprivileged processes may read the kernel message buffer"); + SDT_PROVIDER_DEFINE(priv); SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv__ok, "int"); SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv__err, "int"); @@ -102,6 +107,17 @@ priv_check_cred(struct ucred *cred, int priv, int flag switch (priv) { case PRIV_VM_MLOCK: case PRIV_VM_MUNLOCK: + error = 0; + goto out; + } + } + + if (unprivileged_read_msgbuf) { + /* + * Allow an unprivileged user to read the kernel message + * buffer. + */ + if (priv == PRIV_MSGBUF) { error = 0; goto out; } Modified: stable/11/sys/kern/subr_prf.c ============================================================================== --- stable/11/sys/kern/subr_prf.c Fri Oct 19 10:05:02 2018 (r339445) +++ stable/11/sys/kern/subr_prf.c Sat Oct 20 16:20:36 2018 (r339446) @@ -1042,11 +1042,6 @@ msgbufinit(void *ptr, int size) oldp = msgbufp; } -static int unprivileged_read_msgbuf = 1; -SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_read_msgbuf, - CTLFLAG_RW, &unprivileged_read_msgbuf, 0, - "Unprivileged processes may read the kernel message buffer"); - /* Sysctls for accessing/clearing the msgbuf */ static int sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS) @@ -1055,11 +1050,9 @@ sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS) u_int seq; int error, len; - if (!unprivileged_read_msgbuf) { - error = priv_check(req->td, PRIV_MSGBUF); - if (error) - return (error); - } + error = priv_check(req->td, PRIV_MSGBUF); + if (error) + return (error); /* Read the whole buffer, one chunk at a time. */ mtx_lock(&msgbuf_lock); Modified: stable/11/sys/sys/jail.h ============================================================================== --- stable/11/sys/sys/jail.h Fri Oct 19 10:05:02 2018 (r339445) +++ stable/11/sys/sys/jail.h Sat Oct 20 16:20:36 2018 (r339446) @@ -230,7 +230,8 @@ struct prison_racct { #define PR_ALLOW_MOUNT_FDESCFS 0x1000 #define PR_ALLOW_MOUNT_LINPROCFS 0x2000 #define PR_ALLOW_MOUNT_LINSYSFS 0x4000 -#define PR_ALLOW_ALL 0x7fff +#define PR_ALLOW_READ_MSGBUF 0x8000 +#define PR_ALLOW_ALL 0xffff /* * OSD methods Modified: stable/11/usr.sbin/jail/jail.8 ============================================================================== --- stable/11/usr.sbin/jail/jail.8 Fri Oct 19 10:05:02 2018 (r339445) +++ stable/11/usr.sbin/jail/jail.8 Sat Oct 20 16:20:36 2018 (r339446) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2016 +.Dd October 20, 2018 .Dt JAIL 8 .Os .Sh NAME @@ -607,6 +607,11 @@ within a jail. The jail root may administer quotas on the jail's filesystem(s). This includes filesystems that the jail may share with other jails or with non-jailed parts of the system. +.It Va allow.read_msgbuf +Jailed users may read the kernel message buffer. +If the +.Va security.bsd.unprivileged_read_msgbuf +MIB entry is zero, this will be restricted to the root user. .It Va allow.socket_af Sockets within a jail are normally restricted to IPv4, IPv6, local (UNIX), and route. This allows access to other protocol stacks that