From owner-svn-src-stable@FreeBSD.ORG Sun Oct 19 08:47:28 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97687ACD; Sun, 19 Oct 2014 08:47:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 823D3B55; Sun, 19 Oct 2014 08:47:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J8lSBq086984; Sun, 19 Oct 2014 08:47:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J8lSks086983; Sun, 19 Oct 2014 08:47:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410190847.s9J8lSks086983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 19 Oct 2014 08:47:28 +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: r273272 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 19 Oct 2014 08:47:28 -0000 Author: mav Date: Sun Oct 19 08:47:27 2014 New Revision: 273272 URL: https://svnweb.freebsd.org/changeset/base/273272 Log: MFC r273143: Remove setting BIO_DONE flag for BIOs that have done() method. This fixes use-after-free, caused by geom_disk, completing same BIO twice to save extra allocation, and getting BIO_DONE set after the first. Modified: stable/10/sys/kern/vfs_bio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_bio.c ============================================================================== --- stable/10/sys/kern/vfs_bio.c Sun Oct 19 06:59:33 2014 (r273271) +++ stable/10/sys/kern/vfs_bio.c Sun Oct 19 08:47:27 2014 (r273272) @@ -3585,10 +3585,8 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else { - bp->bio_flags |= BIO_DONE; + } else done(bp); - } } /* From owner-svn-src-stable@FreeBSD.ORG Sun Oct 19 11:31:24 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C397D3AA; Sun, 19 Oct 2014 11:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF27BBCA; Sun, 19 Oct 2014 11:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBVO7S066209; Sun, 19 Oct 2014 11:31:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBVOEg066205; Sun, 19 Oct 2014 11:31:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410191131.s9JBVOEg066205@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 19 Oct 2014 11:31:24 +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: r273275 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 19 Oct 2014 11:31:25 -0000 Author: tuexen Date: Sun Oct 19 11:31:23 2014 New Revision: 273275 URL: https://svnweb.freebsd.org/changeset/base/273275 Log: MFC 273168: Fix the reported streams in a SCTP_STREAM_RESET_EVENT, if a sent incoming stream reset request was responded with failed or denied. Thanks to Peter Bostroem from Google for reporting the issue. Modified: stable/10/sys/netinet/sctp_header.h stable/10/sys/netinet/sctp_input.c stable/10/sys/netinet/sctp_input.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/sctp_header.h ============================================================================== --- stable/10/sys/netinet/sctp_header.h Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_header.h Sun Oct 19 11:31:23 2014 (r273275) @@ -450,6 +450,11 @@ struct sctp_pktdrop_chunk { /**********STREAM RESET STUFF ******************/ +struct sctp_stream_reset_request { + struct sctp_paramhdr ph; + uint32_t request_seq; +} SCTP_PACKED; + struct sctp_stream_reset_out_request { struct sctp_paramhdr ph; uint32_t request_seq; /* monotonically increasing seq no */ @@ -464,7 +469,6 @@ struct sctp_stream_reset_in_request { uint16_t list_of_streams[]; /* if not all list of streams */ } SCTP_PACKED; - struct sctp_stream_reset_tsn_request { struct sctp_paramhdr ph; uint32_t request_seq; Modified: stable/10/sys/netinet/sctp_input.c ============================================================================== --- stable/10/sys/netinet/sctp_input.c Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_input.c Sun Oct 19 11:31:23 2014 (r273275) @@ -3496,12 +3496,12 @@ sctp_reset_out_streams(struct sctp_tcb * } -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) { struct sctp_association *asoc; struct sctp_chunkhdr *ch; - struct sctp_stream_reset_out_request *r; + struct sctp_stream_reset_request *r; struct sctp_tmit_chunk *chk; int len, clen; @@ -3524,7 +3524,7 @@ sctp_find_stream_reset(struct sctp_tcb * } clen = chk->send_size; ch = mtod(chk->data, struct sctp_chunkhdr *); - r = (struct sctp_stream_reset_out_request *)(ch + 1); + r = (struct sctp_stream_reset_request *)(ch + 1); if (ntohl(r->request_seq) == seq) { /* found it */ return (r); @@ -3532,7 +3532,7 @@ sctp_find_stream_reset(struct sctp_tcb * len = SCTP_SIZE32(ntohs(r->ph.param_length)); if (clen > (len + (int)sizeof(struct sctp_chunkhdr))) { /* move to the next one, there can only be a max of two */ - r = (struct sctp_stream_reset_out_request *)((caddr_t)r + len); + r = (struct sctp_stream_reset_request *)((caddr_t)r + len); if (ntohl(r->request_seq) == seq) { return (r); } @@ -3576,7 +3576,9 @@ sctp_handle_stream_reset_response(struct int lparm_len; struct sctp_association *asoc = &stcb->asoc; struct sctp_tmit_chunk *chk; - struct sctp_stream_reset_out_request *srparam; + struct sctp_stream_reset_request *req_param; + struct sctp_stream_reset_out_request *req_out_param; + struct sctp_stream_reset_in_request *req_in_param; uint32_t number_entries; if (asoc->stream_reset_outstanding == 0) { @@ -3584,35 +3586,36 @@ sctp_handle_stream_reset_response(struct return (0); } if (seq == stcb->asoc.str_reset_seq_out) { - srparam = sctp_find_stream_reset(stcb, seq, &chk); - if (srparam) { + req_param = sctp_find_stream_reset(stcb, seq, &chk); + if (req_param != NULL) { stcb->asoc.str_reset_seq_out++; - type = ntohs(srparam->ph.param_type); - lparm_len = ntohs(srparam->ph.param_length); + type = ntohs(req_param->ph.param_type); + lparm_len = ntohs(req_param->ph.param_length); if (type == SCTP_STR_RESET_OUT_REQUEST) { + req_out_param = (struct sctp_stream_reset_out_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_out_request)) / sizeof(uint16_t); asoc->stream_reset_out_is_outstanding = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ - sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); + sctp_reset_out_streams(stcb, number_entries, req_out_param->list_of_streams); } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_IN_REQUEST) { - /* Answered my request */ + req_in_param = (struct sctp_stream_reset_in_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, - number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + number_entries, req_in_param->list_of_streams, SCTP_SO_NOT_LOCKED); } } else if (type == SCTP_STR_RESET_ADD_OUT_STREAMS) { /* Ok we now may have more streams */ Modified: stable/10/sys/netinet/sctp_input.h ============================================================================== --- stable/10/sys/netinet/sctp_input.h Sun Oct 19 11:15:19 2014 (r273274) +++ stable/10/sys/netinet/sctp_input.h Sun Oct 19 11:31:23 2014 (r273275) @@ -48,7 +48,7 @@ sctp_common_input_processing(struct mbuf uint8_t, uint32_t, uint32_t, uint16_t); -struct sctp_stream_reset_out_request * +struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk); From owner-svn-src-stable@FreeBSD.ORG Sun Oct 19 12:11:27 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B79FD5B; Sun, 19 Oct 2014 12:11:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1C47ED9; Sun, 19 Oct 2014 12:11:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JCBQ9o083164; Sun, 19 Oct 2014 12:11:26 GMT (envelope-from antoine@FreeBSD.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JCBQ0E083161; Sun, 19 Oct 2014 12:11:26 GMT (envelope-from antoine@FreeBSD.org) Message-Id: <201410191211.s9JCBQ0E083161@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: antoine set sender to antoine@FreeBSD.org using -f From: Antoine Brodin Date: Sun, 19 Oct 2014 12:11: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: r273277 - in stable/10: . contrib/opie lib/libopie X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 19 Oct 2014 12:11:27 -0000 Author: antoine Date: Sun Oct 19 12:11:25 2014 New Revision: 273277 URL: https://svnweb.freebsd.org/changeset/base/273277 Log: Restore ABI compatibility with 10.0-RELEASE, so that stable/10 users can use official freebsd packages Modified: stable/10/ObsoleteFiles.inc stable/10/contrib/opie/opie.h stable/10/lib/libopie/Makefile Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/ObsoleteFiles.inc Sun Oct 19 12:11:25 2014 (r273277) @@ -43,8 +43,8 @@ OLD_FILES+=usr/share/openssl/man/man3/CM # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140814: libopie version bump -OLD_LIBS+=usr/lib/libopie.so.7 -OLD_LIBS+=usr/lib32/libopie.so.7 +OLD_LIBS+=usr/lib/libopie.so.8 +OLD_LIBS+=usr/lib32/libopie.so.8 # 20140811: otp-sha renamed to otp-sha1 OLD_FILES+=usr/bin/otp-sha OLD_FILES+=usr/share/man/man1/otp-sha.1.gz Modified: stable/10/contrib/opie/opie.h ============================================================================== --- stable/10/contrib/opie/opie.h Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/contrib/opie/opie.h Sun Oct 19 12:11:25 2014 (r273277) @@ -69,11 +69,11 @@ struct opie { /* Maximum length of a seed */ #define OPIE_SEED_MAX 16 -/* Max length of hash algorithm name (md4/md5/sha1) */ -#define OPIE_HASHNAME_MAX 4 +/* Max length of hash algorithm name (md4/md5) */ +#define OPIE_HASHNAME_MAX 3 -/* Maximum length of a challenge (otp-md? 9999 seed ext) */ -#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX+1+3) +/* Maximum length of a challenge (otp-md? 9999 seed) */ +#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX) /* Maximum length of a response that we allow */ #define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) Modified: stable/10/lib/libopie/Makefile ============================================================================== --- stable/10/lib/libopie/Makefile Sun Oct 19 11:59:15 2014 (r273276) +++ stable/10/lib/libopie/Makefile Sun Oct 19 12:11:25 2014 (r273277) @@ -4,7 +4,7 @@ # OPIE_DIST?= ${.CURDIR}/../../contrib/opie DIST_DIR= ${OPIE_DIST}/${.CURDIR:T} -SHLIB_MAJOR= 8 +SHLIB_MAJOR= 7 KEYFILE?= \"/etc/opiekeys\" From owner-svn-src-stable@FreeBSD.ORG Sun Oct 19 20:54:05 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4ECF0252; Sun, 19 Oct 2014 20:54:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39224670; Sun, 19 Oct 2014 20:54:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKs5FE057646; Sun, 19 Oct 2014 20:54:05 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKs4uD057644; Sun, 19 Oct 2014 20:54:04 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410192054.s9JKs4uD057644@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 19 Oct 2014 20:54:04 +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: r273286 - in stable/10: . etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 19 Oct 2014 20:54:05 -0000 Author: hrs Date: Sun Oct 19 20:54:04 2014 New Revision: 273286 URL: https://svnweb.freebsd.org/changeset/base/273286 Log: MFC r273285: - Honer MK_KERBEROS for Heimdal rc.d scripts. - Add rc.c/kerberos to OLD_FILES. Modified: stable/10/ObsoleteFiles.inc stable/10/etc/rc.d/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Sun Oct 19 20:46:59 2014 (r273285) +++ stable/10/ObsoleteFiles.inc Sun Oct 19 20:54:04 2014 (r273286) @@ -40,6 +40,8 @@ # 20141015: OpenSSL 1.0.1j import OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz +# 20141010: rc.d/kerberos removed +OLD_FILES+=etc/rc.d/kerberos # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140814: libopie version bump Modified: stable/10/etc/rc.d/Makefile ============================================================================== --- stable/10/etc/rc.d/Makefile Sun Oct 19 20:46:59 2014 (r273285) +++ stable/10/etc/rc.d/Makefile Sun Oct 19 20:54:04 2014 (r273286) @@ -71,13 +71,13 @@ FILES= DAEMON \ iscsictl \ iscsid \ jail \ - kadmind \ - kdc \ + ${_kadmind} \ + ${_kdc} \ keyserv \ - kfd \ + ${_kfd} \ kld \ kldxref \ - kpasswdd \ + ${_kpasswdd} \ ldconfig \ local \ localpkg \ @@ -173,6 +173,13 @@ FILES= DAEMON \ _ipxrouted= ipxrouted .endif +.if ${MK_KERBEROS} != "no" +_kadmind= kadmind +_kdc= kdc +_kfd= kfd +_kpasswdd= kpasswdd +.endif + .if ${MK_OFED} != "no" _opensm= opensm .endif From owner-svn-src-stable@FreeBSD.ORG Sun Oct 19 21:16:25 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E126DC4; Sun, 19 Oct 2014 21:16:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49BE1951; Sun, 19 Oct 2014 21:16:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JLGPca067648; Sun, 19 Oct 2014 21:16:25 GMT (envelope-from ache@FreeBSD.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JLGPVM067647; Sun, 19 Oct 2014 21:16:25 GMT (envelope-from ache@FreeBSD.org) Message-Id: <201410192116.s9JLGPVM067647@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ache set sender to ache@FreeBSD.org using -f From: "Andrey A. Chernov" Date: Sun, 19 Oct 2014 21:16:25 +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: r273290 - stable/10/lib/libc/stdtime X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 19 Oct 2014 21:16:25 -0000 Author: ache Date: Sun Oct 19 21:16:24 2014 New Revision: 273290 URL: https://svnweb.freebsd.org/changeset/base/273290 Log: MFC r272562,r272678,r272679 1) Fix the case we have less arguments for format string than we expected. 2) Return error on unsupported format specs. (both according to POSIX) 3) For %Z format, understand "UTC" name too. PR: 93197 Modified: stable/10/lib/libc/stdtime/strptime.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdtime/strptime.c ============================================================================== --- stable/10/lib/libc/stdtime/strptime.c Sun Oct 19 21:07:35 2014 (r273289) +++ stable/10/lib/libc/stdtime/strptime.c Sun Oct 19 21:16:24 2014 (r273290) @@ -103,9 +103,6 @@ _strptime(const char *buf, const char *f ptr = fmt; while (*ptr != 0) { - if (*buf == 0) - break; - c = *ptr++; if (c != '%') { @@ -123,7 +120,6 @@ _strptime(const char *buf, const char *f label: c = *ptr++; switch (c) { - case 0: case '%': if (*buf++ != '%') return (NULL); @@ -552,7 +548,8 @@ label: strncpy(zonestr, buf, cp - buf); zonestr[cp - buf] = '\0'; tzset(); - if (0 == strcmp(zonestr, "GMT")) { + if (0 == strcmp(zonestr, "GMT") || + 0 == strcmp(zonestr, "UTC")) { *GMTp = 1; } else if (0 == strcmp(zonestr, tzname[0])) { tm->tm_isdst = 0; @@ -599,6 +596,9 @@ label: while (isspace_l((unsigned char)*buf, locale)) buf++; break; + + default: + return (NULL); } } @@ -674,6 +674,7 @@ strptime_l(const char * __restrict buf, ret = _strptime(buf, fmt, tm, &gmt, loc); if (ret && gmt) { time_t t = timegm(tm); + localtime_r(&t, tm); } From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 00:22:09 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E2C59AA; Mon, 20 Oct 2014 00:22:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F5FAC72; Mon, 20 Oct 2014 00:22:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K0M9Hh061745; Mon, 20 Oct 2014 00:22:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K0M91x061744; Mon, 20 Oct 2014 00:22:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200022.s9K0M91x061744@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 00:22:09 +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: r273294 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 00:22:09 -0000 Author: emaste Date: Mon Oct 20 00:22:08 2014 New Revision: 273294 URL: https://svnweb.freebsd.org/changeset/base/273294 Log: MFC r273178: Update vt(4) for UEFI defaults and special keys vt(4) is the default console for UEFI boot [1], and the bitmapped kern.vt.spclkeys sysctl has been replaced with individual kern.vt.kbd_* enable sysctls. PR: 193710 Modified: stable/10/share/man/man4/vt.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/vt.4 ============================================================================== --- stable/10/share/man/man4/vt.4 Sun Oct 19 23:13:16 2014 (r273293) +++ stable/10/share/man/man4/vt.4 Mon Oct 20 00:22:08 2014 (r273294) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 2, 2014 +.Dd October 16, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -45,6 +45,15 @@ In .Xr loader.conf 5 : .Cd hw.vga.textmode=1 .Cd kern.vty=vt +.Pp +In +.Xr loader.conf 5 or +.Xr sysctl.conf 5 : +.Cd kern.vt.kbd_halt=1 +.Cd kern.vt.kbd_poweroff=1 +.Cd kern.vt.kbd_reboot=1 +.Cd kern.vt.kbd_debug=1 +.Cd kern.vt.kbd_panic=0 .Sh DESCRIPTION The .Nm @@ -184,17 +193,41 @@ Set to 1 to use virtual terminals in tex Features that require graphics mode, like loadable fonts, will be disabled. .It Va kern.vty -When both -.Nm -and -.Xr sc 4 have been compiled into the kernel, the one to use for the -system console can be selected by setting this value to +Set this value to .Ql vt or -.Ql sc . -If this value is not set, +.Ql sc +to override the default driver used for the system console. +By default, .Xr sc 4 -is used. +is used on computers that boot from BIOS, and +.Nm +is used on computers that boot from UEFI. +.Sh KEYBOARD SYSCTL TUNABLES +These settings control whether certain special key combinations are enabled or +ignored. +The specific key combinations can be configured by using a +.Xr keymap 5 +file. +.Pp +These settings can be entered at the +.Xr loader 8 +prompt or in +.Xr loader.conf 5 +and can also be changed at runtime with the +.Xr sysctl 8 +command. +.Bl -tag -width indent +.It Va kern.vt.kbd_halt +Enable halt keyboard combination. +.It Va kern.vt.kbd_poweroff +Enable power off key combination. +.It Va kern.vt.kbd_reboot. +Enable reboot key combination, usually Ctrl+Alt+Del. +.It Va kern.vt.kbd_debug +Enable debug request key combination, usually Ctrl+Alt+Esc. +.It Va kern.vt.kbd_panic +Enable panic key combination. .El .Sh FILES .Bl -tag -width /usr/share/vt/keymaps/* -compact From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 01:01:56 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 123F8A3; Mon, 20 Oct 2014 01:01:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE1B0F79; Mon, 20 Oct 2014 01:01:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K11tNA080339; Mon, 20 Oct 2014 01:01:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K11tH4080338; Mon, 20 Oct 2014 01:01:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410200101.s9K11tH4080338@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 01:01:55 +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: r273296 - stable/10/sys/dev/vt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 01:01:56 -0000 Author: emaste Date: Mon Oct 20 01:01:55 2014 New Revision: 273296 URL: https://svnweb.freebsd.org/changeset/base/273296 Log: MFC r273219: Do nothing in vt_upgrade if there is no vt driver Previously, if no drivers attached at boot we would panic with "vtbuf_fill_locked begin.tp_row 0 must be < screen height 0". PR: 192248 Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Mon Oct 20 00:27:40 2014 (r273295) +++ stable/10/sys/dev/vt/vt_core.c Mon Oct 20 01:01:55 2014 (r273296) @@ -2491,6 +2491,8 @@ vt_upgrade(struct vt_device *vd) if (!vty_enabled(VTY_VT)) return; + if (main_vd->vd_driver == NULL) + return; for (i = 0; i < VT_MAXWINDOWS; i++) { vw = vd->vd_windows[i]; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 04:42:29 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A470845; Mon, 20 Oct 2014 04:42:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05087800; Mon, 20 Oct 2014 04:42:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K4gSg0084229; Mon, 20 Oct 2014 04:42:28 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K4gSHq084227; Mon, 20 Oct 2014 04:42:28 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410200442.s9K4gSHq084227@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Mon, 20 Oct 2014 04:42:28 +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: r273302 - stable/10/sys/dev/asmc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 04:42:29 -0000 Author: rpaulo Date: Mon Oct 20 04:42:28 2014 New Revision: 273302 URL: https://svnweb.freebsd.org/changeset/base/273302 Log: MFC r271975: Improvements to asmc(4): 1. changed the code so that 2**16 keys are supported 2. changed the number of possible fans in a system from 2 to 6 3. added write support for some fan sysctls 4. added a new sysctl which shows the ID of the fan 5. added four more apple models with their temperature keys 6. changed the maxnumber of temperature keys from 36 to 80 7. replaced several fixed buf sizes to sizeof buf Obtained from: Denis Ahrens denis at h3q.com Modified: stable/10/sys/dev/asmc/asmc.c stable/10/sys/dev/asmc/asmcvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/asmc/asmc.c ============================================================================== --- stable/10/sys/dev/asmc/asmc.c Mon Oct 20 04:14:35 2014 (r273301) +++ stable/10/sys/dev/asmc/asmc.c Mon Oct 20 04:42:28 2014 (r273302) @@ -77,6 +77,7 @@ static int asmc_key_read(device_t dev, uint8_t); static int asmc_fan_count(device_t dev); static int asmc_fan_getvalue(device_t dev, const char *key, int fan); +static int asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed); static int asmc_temp_getvalue(device_t dev, const char *key); static int asmc_sms_read(device_t, const char *key, int16_t *val); static void asmc_sms_calibrate(device_t dev); @@ -94,6 +95,7 @@ static int asmc_key_dump(device_t, int); /* * Model functions. */ +static int asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS); static int asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLER_ARGS); @@ -115,6 +117,7 @@ struct asmc_model { int (*smc_sms_x)(SYSCTL_HANDLER_ARGS); int (*smc_sms_y)(SYSCTL_HANDLER_ARGS); int (*smc_sms_z)(SYSCTL_HANDLER_ARGS); + int (*smc_fan_id)(SYSCTL_HANDLER_ARGS); int (*smc_fan_speed)(SYSCTL_HANDLER_ARGS); int (*smc_fan_safespeed)(SYSCTL_HANDLER_ARGS); int (*smc_fan_minspeed)(SYSCTL_HANDLER_ARGS); @@ -134,7 +137,7 @@ static struct asmc_model *asmc_match(dev #define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \ asmc_mb_sysctl_sms_z -#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \ +#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \ asmc_mb_sysctl_fanminspeed, \ asmc_mb_sysctl_fanmaxspeed, \ asmc_mb_sysctl_fantargetspeed @@ -196,6 +199,18 @@ struct asmc_model asmc_models[] = { ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, ASMC_MBP4_TEMPS, ASMC_MBP4_TEMPNAMES, ASMC_MBP4_TEMPDESCS }, + + { + "MacBookPro8,2", "Apple SMC MacBook Pro (early 2011)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP8_TEMPS, ASMC_MBP8_TEMPNAMES, ASMC_MBP8_TEMPDESCS + }, + + { + "MacBookPro11,3", "Apple SMC MacBook Pro Retina Core i7 (2013/2014)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP11_TEMPS, ASMC_MBP11_TEMPNAMES, ASMC_MBP11_TEMPDESCS + }, /* The Mac Mini has no SMS */ { @@ -224,12 +239,27 @@ struct asmc_model asmc_models[] = { ASMC_MP_TEMPS, ASMC_MP_TEMPNAMES, ASMC_MP_TEMPDESCS }, + /* Idem for the MacPro 2010*/ + { + "MacPro5,1", "Apple SMC MacPro (2010)", + NULL, NULL, NULL, + ASMC_FAN_FUNCS, + NULL, NULL, NULL, + ASMC_MP5_TEMPS, ASMC_MP5_TEMPNAMES, ASMC_MP5_TEMPDESCS + }, + { "MacBookAir1,1", "Apple SMC MacBook Air", ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MBA_TEMPS, ASMC_MBA_TEMPNAMES, ASMC_MBA_TEMPDESCS }, + { + "MacBookAir3,1", "Apple SMC MacBook Air Core 2 Duo (Late 2010)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, + ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS + }, + { NULL, NULL } }; @@ -361,6 +391,12 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), + OID_AUTO, "id", CTLTYPE_STRING | CTLFLAG_RD, + dev, j, model->smc_fan_id, "I", + "Fan ID"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "speed", CTLTYPE_INT | CTLFLAG_RD, dev, j, model->smc_fan_speed, "I", "Fan speed in RPM"); @@ -375,21 +411,21 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "minspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_minspeed, "I", "Fan minimum speed in RPM"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "maxspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_maxspeed, "I", "Fan maximum speed in RPM"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_fan_tree[i]), OID_AUTO, "targetspeed", - CTLTYPE_INT | CTLFLAG_RD, + CTLTYPE_INT | CTLFLAG_RW, dev, j, model->smc_fan_targetspeed, "I", "Fan target speed in RPM"); } @@ -641,11 +677,10 @@ nosms: if (bootverbose) { /* - * XXX: The number of keys is a 32 bit buffer, but - * right now Apple only uses the last 8 bit. + * The number of keys is a 32 bit buffer */ asmc_key_read(dev, ASMC_NKEYS, buf, 4); - device_printf(dev, "number of keys: %d\n", buf[3]); + device_printf(dev, "number of keys: %d\n", ntohl(*(uint32_t*)buf)); } #ifdef DEBUG @@ -906,7 +941,7 @@ asmc_fan_count(device_t dev) { uint8_t buf[1]; - if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, 1) < 0) + if (asmc_key_read(dev, ASMC_KEY_FANCOUNT, buf, sizeof buf) < 0) return (-1); return (buf[0]); @@ -920,13 +955,46 @@ asmc_fan_getvalue(device_t dev, const ch char fankey[5]; snprintf(fankey, sizeof(fankey), key, fan); - if (asmc_key_read(dev, fankey, buf, 2) < 0) + if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0) return (-1); speed = (buf[0] << 6) | (buf[1] >> 2); return (speed); } +static char* +asmc_fan_getstring(device_t dev, const char *key, int fan) +{ + uint8_t buf[16]; + char fankey[5]; + char* desc; + + snprintf(fankey, sizeof(fankey), key, fan); + if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0) + return (NULL); + desc = buf+4; + + return (desc); +} + +static int +asmc_fan_setvalue(device_t dev, const char *key, int fan, int speed) +{ + uint8_t buf[2]; + char fankey[5]; + + speed *= 4; + + buf[0] = speed>>8; + buf[1] = speed; + + snprintf(fankey, sizeof(fankey), key, fan); + if (asmc_key_write(dev, fankey, buf, sizeof buf) < 0) + return (-1); + + return (0); +} + static int asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS) { @@ -942,6 +1010,22 @@ asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_A } static int +asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS) +{ + device_t dev = (device_t) arg1; + int fan = arg2; + int error = true; + char* desc; + + desc = asmc_fan_getstring(dev, ASMC_KEY_FANID, fan); + + if (desc != NULL) + error = sysctl_handle_string(oidp, desc, 0, req); + + return (error); +} + +static int asmc_mb_sysctl_fansafespeed(SYSCTL_HANDLER_ARGS) { device_t dev = (device_t) arg1; @@ -967,6 +1051,11 @@ asmc_mb_sysctl_fanminspeed(SYSCTL_HANDLE v = asmc_fan_getvalue(dev, ASMC_KEY_FANMINSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANMINSPEED, fan, newspeed); + } + return (error); } @@ -981,6 +1070,11 @@ asmc_mb_sysctl_fanmaxspeed(SYSCTL_HANDLE v = asmc_fan_getvalue(dev, ASMC_KEY_FANMAXSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANMAXSPEED, fan, newspeed); + } + return (error); } @@ -995,6 +1089,11 @@ asmc_mb_sysctl_fantargetspeed(SYSCTL_HAN v = asmc_fan_getvalue(dev, ASMC_KEY_FANTARGETSPEED, fan); error = sysctl_handle_int(oidp, &v, 0, req); + if (error == 0 && req->newptr != NULL) { + unsigned int newspeed = *(unsigned int *)req->newptr; + asmc_fan_setvalue(dev, ASMC_KEY_FANTARGETSPEED, fan, newspeed); + } + return (error); } @@ -1009,7 +1108,7 @@ asmc_temp_getvalue(device_t dev, const c /* * Check for invalid temperatures. */ - if (asmc_key_read(dev, key, buf, 2) < 0) + if (asmc_key_read(dev, key, buf, sizeof buf) < 0) return (-1); return (buf[0]); @@ -1042,7 +1141,7 @@ asmc_sms_read(device_t dev, const char * case 'X': case 'Y': case 'Z': - error = asmc_key_read(dev, key, buf, 2); + error = asmc_key_read(dev, key, buf, sizeof buf); break; default: device_printf(dev, "%s called with invalid argument %s\n", @@ -1197,7 +1296,7 @@ asmc_mbp_sysctl_light_left(SYSCTL_HANDLE int error; int32_t v; - asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, 6); + asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, sizeof buf); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); @@ -1212,7 +1311,7 @@ asmc_mbp_sysctl_light_right(SYSCTL_HANDL int error; int32_t v; - asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, 6); + asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, sizeof buf); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); @@ -1236,7 +1335,7 @@ asmc_mbp_sysctl_light_control(SYSCTL_HAN v = level; buf[0] = level; buf[1] = 0x00; - asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, 2); + asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf); } return (error); Modified: stable/10/sys/dev/asmc/asmcvar.h ============================================================================== --- stable/10/sys/dev/asmc/asmcvar.h Mon Oct 20 04:14:35 2014 (r273301) +++ stable/10/sys/dev/asmc/asmcvar.h Mon Oct 20 04:42:28 2014 (r273302) @@ -27,7 +27,7 @@ * */ -#define ASMC_MAXFANS 2 +#define ASMC_MAXFANS 6 struct asmc_softc { device_t sc_dev; @@ -83,6 +83,7 @@ struct asmc_softc { */ #define ASMC_KEY_FANCOUNT "FNum" /* RO; 1 byte */ #define ASMC_KEY_FANMANUAL "FS! " /* RW; 2 bytes */ +#define ASMC_KEY_FANID "F%dID" /* RO; 16 bytes */ #define ASMC_KEY_FANSPEED "F%dAc" /* RO; 2 bytes */ #define ASMC_KEY_FANMINSPEED "F%dMn" /* RO; 2 bytes */ #define ASMC_KEY_FANMAXSPEED "F%dMx" /* RO; 2 bytes */ @@ -132,7 +133,7 @@ struct asmc_softc { * */ /* maximum array size for temperatures including the last NULL */ -#define ASMC_TEMP_MAX 36 +#define ASMC_TEMP_MAX 80 #define ASMC_MB_TEMPS { "TB0T", "TN0P", "TN1P", "Th0H", "Th1H", \ "TM0P", NULL } #define ASMC_MB_TEMPNAMES { "enclosure", "northbridge1", \ @@ -175,6 +176,57 @@ struct asmc_softc { "Unknown", "Unknown", \ "Wireless Module", } +#define ASMC_MBP8_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ + "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL } + +#define ASMC_MBP8_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "graphics", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "wireless", "Th1H", \ + "Th2H", "memory", "Ts0P", "Ts0S" } + +#define ASMC_MBP8_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ + "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ + "Th2H", "Tm0P", "Ts0P", "Ts0S" } + +#define ASMC_MBP11_TEMPS { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S", NULL } + +#define ASMC_MBP11_TEMPNAMES { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S" } + +#define ASMC_MBP11_TEMPDESCS { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ + "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ + "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ + "TCXC", "TG0D", "TG0P", "TG1D", "TG1F", \ + "TG1d", "TH0A", "TH0B", "TH0F", "TH0R", \ + "TH0V", "TH0a", "TH0b", "TH0c", "TM0P", \ + "TM0S", "TP0P", "TPCD", "TW0P", "Ta0P", \ + "TaSP", "Th1H", "Th2H", "Ts0P", "Ts0S", \ + "Ts1S" } + #define ASMC_MM_TEMPS { "TN0P", "TN1P", NULL } #define ASMC_MM_TEMPNAMES { "northbridge1", "northbridge2" } #define ASMC_MM_TEMPDESCS { "Northbridge Point 1", \ @@ -214,8 +266,7 @@ struct asmc_softc { "TH0P", "TH1P", "TH2P", "TH3P", "TMAP", \ "TMAS", "TMBS", "TM0P", "TM0S", "TM1P", \ "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", \ - "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", \ - NULL } + "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", } #define ASMC_MP_TEMPDESCS { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \ "TC0C", "TC0D", "TC0P", "TC1C", "TC1D", \ @@ -223,9 +274,66 @@ struct asmc_softc { "TH0P", "TH1P", "TH2P", "TH3P", "TMAP", \ "TMAS", "TMBS", "TM0P", "TM0S", "TM1P", \ "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", \ - "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", \ + "TM8S", "TM9P", "TM9S", "TN0H", "TS0C", } + +#define ASMC_MP5_TEMPS { "TA0P", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "TMA1", \ + "TMA2", "TMA3", "TMA4", "TMB1", "TMB2", \ + "TMB3", "TMB4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", \ NULL } +#define ASMC_MP5_TEMPNAMES { "ambient", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "ram_a1", \ + "ram_a2", "ram_a3", "ram_a4", "ram_b1", "ram_b2", \ + "ram_b3", "ram_b4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", } + +#define ASMC_MP5_TEMPDESCS { "TA0P", "TCAC", "TCAD", "TCAG", "TCAH", \ + "TCAS", "TCBC", "TCBD", "TCBG", "TCBH", \ + "TCBS", "TH1F", "TH1P", "TH1V", "TH2F", \ + "TH2P", "TH2V", "TH3F", "TH3P", "TH3V", \ + "TH4F", "TH4P", "TH4V", "THPS", "THTG", \ + "TM1P", "TM2P", "TM2V", "TM3P", "TM3V", \ + "TM4P", "TM5P", "TM6P", "TM6V", "TM7P", \ + "TM7V", "TM8P", "TM8V", "TM9V", "TMA1", \ + "TMA2", "TMA3", "TMA4", "TMB1", "TMB2", \ + "TMB3", "TMB4", "TMHS", "TMLS", "TMPS", \ + "TMPV", "TMTG", "TN0D", "TN0H", "TNTG", \ + "Te1F", "Te1P", "Te1S", "Te2F", "Te2S", \ + "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \ + "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \ + "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", } + #define ASMC_MBA_TEMPS { "TB0T", NULL } #define ASMC_MBA_TEMPNAMES { "enclosure" } #define ASMC_MBA_TEMPDESCS { "Enclosure Bottom" } + +#define ASMC_MBA3_TEMPS { "TB0T", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P", NULL } + +#define ASMC_MBA3_TEMPNAMES { "enclosure", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P" } + +#define ASMC_MBA3_TEMPDESCS { "Enclosure Bottom", "TB1T", "TB2T", \ + "TC0D", "TC0E", "TC0P" } From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:25:58 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A7DB959; Mon, 20 Oct 2014 07:25:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E06E17DA; Mon, 20 Oct 2014 07:25:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7Pvjf068805; Mon, 20 Oct 2014 07:25:57 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7PvHl068804; Mon, 20 Oct 2014 07:25:57 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410200725.s9K7PvHl068804@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Mon, 20 Oct 2014 07:25: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: r273305 - stable/10/sys/dev/mii X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:25:58 -0000 Author: yongari Date: Mon Oct 20 07:25:57 2014 New Revision: 273305 URL: https://svnweb.freebsd.org/changeset/base/273305 Log: MFC r271073: Do not blindly announce 1000baseT half-duplex capability in autonegotiation. Some controllers like cgem(4) do not support half-duplex at gigabit speeds. Modified: stable/10/sys/dev/mii/e1000phy.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mii/e1000phy.c ============================================================================== --- stable/10/sys/dev/mii/e1000phy.c Mon Oct 20 07:15:04 2014 (r273304) +++ stable/10/sys/dev/mii/e1000phy.c Mon Oct 20 07:25:57 2014 (r273305) @@ -169,8 +169,12 @@ e1000phy_attach(device_t dev) PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; - if (sc->mii_capabilities & BMSR_EXTSTAT) + if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + sc->mii_flags |= MIIF_HAVE_GTCR; + } device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -325,8 +329,7 @@ e1000phy_service(struct mii_softc *sc, s speed = 0; switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) == 0) + if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; @@ -363,10 +366,9 @@ e1000phy_service(struct mii_softc *sc, s if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { gig |= E1000_1GCR_MS_ENABLE; - if ((ife->ifm_media & IFM_ETH_MASTER) != 0) + if ((ife->ifm_media & IFM_ETH_MASTER) != 0) gig |= E1000_1GCR_MS_VALUE; - } else if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + } else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) gig = 0; PHY_WRITE(sc, E1000_1GCR, gig); PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); @@ -497,9 +499,14 @@ e1000phy_mii_phy_auto(struct mii_softc * PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD); } else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X); - if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) - PHY_WRITE(sc, E1000_1GCR, - E1000_1GCR_1000T_FD | E1000_1GCR_1000T); + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + reg = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) + reg |= E1000_1GCR_1000T_FD; + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) + reg |= E1000_1GCR_1000T; + PHY_WRITE(sc, E1000_1GCR, reg); + } PHY_WRITE(sc, E1000_CR, E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:27:34 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EDF68A99; Mon, 20 Oct 2014 07:27:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C03A07ED; Mon, 20 Oct 2014 07:27:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7RYFm069091; Mon, 20 Oct 2014 07:27:34 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7RYWQ069090; Mon, 20 Oct 2014 07:27:34 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410200727.s9K7RYWQ069090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Mon, 20 Oct 2014 07:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273306 - stable/9/sys/dev/mii X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:27:35 -0000 Author: yongari Date: Mon Oct 20 07:27:34 2014 New Revision: 273306 URL: https://svnweb.freebsd.org/changeset/base/273306 Log: MFC r271073: Do not blindly announce 1000baseT half-duplex capability in autonegotiation. Some controllers like cgem(4) do not support half-duplex at gigabit speeds. Modified: stable/9/sys/dev/mii/e1000phy.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mii/e1000phy.c ============================================================================== --- stable/9/sys/dev/mii/e1000phy.c Mon Oct 20 07:25:57 2014 (r273305) +++ stable/9/sys/dev/mii/e1000phy.c Mon Oct 20 07:27:34 2014 (r273306) @@ -167,8 +167,12 @@ e1000phy_attach(device_t dev) PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; - if (sc->mii_capabilities & BMSR_EXTSTAT) + if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + if ((sc->mii_extcapabilities & + (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + sc->mii_flags |= MIIF_HAVE_GTCR; + } device_printf(dev, " "); mii_phy_add_media(sc); printf("\n"); @@ -319,8 +323,7 @@ e1000phy_service(struct mii_softc *sc, s speed = 0; switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) == 0) + if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0) return (EINVAL); speed = E1000_CR_SPEED_1000; break; @@ -357,10 +360,9 @@ e1000phy_service(struct mii_softc *sc, s if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { gig |= E1000_1GCR_MS_ENABLE; - if ((ife->ifm_media & IFM_ETH_MASTER) != 0) + if ((ife->ifm_media & IFM_ETH_MASTER) != 0) gig |= E1000_1GCR_MS_VALUE; - } else if ((sc->mii_extcapabilities & - (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) + } else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) gig = 0; PHY_WRITE(sc, E1000_1GCR, gig); PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); @@ -491,9 +493,14 @@ e1000phy_mii_phy_auto(struct mii_softc * PHY_WRITE(sc, E1000_AR, reg | E1000_AR_SELECTOR_FIELD); } else PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X); - if ((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0) - PHY_WRITE(sc, E1000_1GCR, - E1000_1GCR_1000T_FD | E1000_1GCR_1000T); + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + reg = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) + reg |= E1000_1GCR_1000T_FD; + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) + reg |= E1000_1GCR_1000T; + PHY_WRITE(sc, E1000_1GCR, reg); + } PHY_WRITE(sc, E1000_CR, E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:28:20 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 059ACBD3; Mon, 20 Oct 2014 07:28:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB75E7F6; Mon, 20 Oct 2014 07:28:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7SJLQ069386; Mon, 20 Oct 2014 07:28:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7SJv6069384; Mon, 20 Oct 2014 07:28:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200728.s9K7SJv6069384@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:28:19 +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: r273307 - in stable/10/sys: cam/ctl dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:28:20 -0000 Author: mav Date: Mon Oct 20 07:28:18 2014 New Revision: 273307 URL: https://svnweb.freebsd.org/changeset/base/273307 Log: MFC r271395 (by trasz): Make sure we handle less than zero timeouts in iSCSI initiator and target in a reasonable way. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:27:34 2014 (r273306) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:28:18 2014 (r273307) @@ -997,7 +997,7 @@ cfiscsi_callout(void *context) #ifdef ICL_KERNEL_PROXY if (cs->cs_waiting_for_ctld || cs->cs_login_phase) { - if (cs->cs_timeout > login_timeout) { + if (login_timeout > 0 && cs->cs_timeout > login_timeout) { CFISCSI_SESSION_WARN(cs, "login timed out after " "%d seconds; dropping connection", cs->cs_timeout); cfiscsi_session_terminate(cs); Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:27:34 2014 (r273306) +++ stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:28:18 2014 (r273307) @@ -543,7 +543,7 @@ iscsi_callout(void *context) is->is_timeout++; if (is->is_waiting_for_iscsid) { - if (is->is_timeout > iscsid_timeout) { + if (iscsid_timeout > 0 && is->is_timeout > iscsid_timeout) { ISCSI_SESSION_WARN(is, "timed out waiting for iscsid(8) " "for %d seconds; reconnecting", is->is_timeout); @@ -553,7 +553,7 @@ iscsi_callout(void *context) } if (is->is_login_phase) { - if (is->is_timeout > login_timeout) { + if (login_timeout > 0 && is->is_timeout > login_timeout) { ISCSI_SESSION_WARN(is, "login timed out after %d seconds; " "reconnecting", is->is_timeout); reconnect_needed = true; @@ -561,6 +561,16 @@ iscsi_callout(void *context) goto out; } + if (ping_timeout <= 0) { + /* + * Pings are disabled. Don't send NOP-Out in this case. + * Reset the timeout, to avoid triggering reconnection, + * should the user decide to reenable them. + */ + is->is_timeout = 0; + goto out; + } + if (is->is_timeout >= ping_timeout) { ISCSI_SESSION_WARN(is, "no ping reply (NOP-In) after %d seconds; " "reconnecting", ping_timeout); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:29:44 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ABF84D0C; Mon, 20 Oct 2014 07:29:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98227800; Mon, 20 Oct 2014 07:29:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7TiSm069617; Mon, 20 Oct 2014 07:29:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7TiEQ069616; Mon, 20 Oct 2014 07:29:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200729.s9K7TiEQ069616@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:29:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273308 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:29:44 -0000 Author: mav Date: Mon Oct 20 07:29:43 2014 New Revision: 273308 URL: https://svnweb.freebsd.org/changeset/base/273308 Log: MFC r271718 (by bdrewery): Correct a comment Modified: stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Mon Oct 20 07:28:18 2014 (r273307) +++ stable/10/sys/cam/cam_xpt.c Mon Oct 20 07:29:43 2014 (r273308) @@ -3056,7 +3056,7 @@ xpt_polled_action(union ccb *start_ccb) } /* - * Schedule a peripheral driver to receive a ccb when it's + * Schedule a peripheral driver to receive a ccb when its * target device has space for more transactions. */ void From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:31:24 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55BAEE5E; Mon, 20 Oct 2014 07:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41C2189C; Mon, 20 Oct 2014 07:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7VOSj073337; Mon, 20 Oct 2014 07:31:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7VOMR073336; Mon, 20 Oct 2014 07:31:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200731.s9K7VOMR073336@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:31:24 +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: r273309 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:31:24 -0000 Author: mav Date: Mon Oct 20 07:31:23 2014 New Revision: 273309 URL: https://svnweb.freebsd.org/changeset/base/273309 Log: MFC r272597: Fix length of Extended INQUIRY Data VPD page. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:29:43 2014 (r273308) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:31:23 2014 (r273309) @@ -9914,9 +9914,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio * lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - data_len = sizeof(struct scsi_vpd_mode_page_policy) + - sizeof(struct scsi_vpd_mode_page_policy_descr); - + data_len = sizeof(struct scsi_vpd_extended_inquiry_data); ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); eid_ptr = (struct scsi_vpd_extended_inquiry_data *)ctsio->kern_data_ptr; ctsio->kern_sg_entries = 0; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:32:34 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FEB0F90; Mon, 20 Oct 2014 07:32:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 110F48A5; Mon, 20 Oct 2014 07:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7WXqM073544; Mon, 20 Oct 2014 07:32:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7WX6u073542; Mon, 20 Oct 2014 07:32:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200732.s9K7WX6u073542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273310 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:32:34 -0000 Author: mav Date: Mon Oct 20 07:32:33 2014 New Revision: 273310 URL: https://svnweb.freebsd.org/changeset/base/273310 Log: MFC r272613: Add support for MaxBurstLength and Expected Data transfer Length parameters. Before this change target could send R2T request for write transfer of any size, that could violate iSCSI RFC, which allows initiator to limit maximum R2T size by negotiating MaxBurstLength connection parameter. Also report an error in case of write underflow, when initiator provides less data than initiator expects. Previously in such case our target sent R2T request for non-existing data, violating the RFC, and confusing some initiators. SCSI specs don't explicitly define how write underflows should be handled and there are different oppinions, but reporting error is hopefully better then violating iSCSI RFC with unpredictable results. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:31:23 2014 (r273309) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:32:33 2014 (r273310) @@ -158,6 +158,8 @@ static uint32_t cfiscsi_lun_map(void *ar static int cfiscsi_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); static void cfiscsi_datamove(union ctl_io *io); +static void cfiscsi_datamove_in(union ctl_io *io); +static void cfiscsi_datamove_out(union ctl_io *io); static void cfiscsi_done(union ctl_io *io); static bool cfiscsi_pdu_update_cmdsn(const struct icl_pdu *request); static void cfiscsi_pdu_handle_nop_out(struct icl_pdu *request); @@ -828,7 +830,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) == 0) { CFISCSI_SESSION_WARN(cs, "got the final packet without " "the F flag; flags = 0x%x; dropping connection", @@ -838,7 +840,7 @@ cfiscsi_handle_data_segment(struct icl_p return (true); } - if (io->scsiio.ext_data_filled != io->scsiio.kern_data_len && + if (io->scsiio.ext_data_filled != cdw->cdw_r2t_end && (bhsdo->bhsdo_flags & BHSDO_FLAGS_F) != 0) { if ((request->ip_bhs->bhs_opcode & ~ISCSI_BHS_OPCODE_IMMEDIATE) == ISCSI_BHS_OPCODE_SCSI_DATA_OUT) { @@ -846,7 +848,7 @@ cfiscsi_handle_data_segment(struct icl_p "transmitted size was %zd bytes instead of %d; " "dropping connection", (size_t)io->scsiio.ext_data_filled, - io->scsiio.kern_data_len); + cdw->cdw_r2t_end); ctl_set_data_phase_error(&io->scsiio); cfiscsi_session_terminate(cs); return (true); @@ -859,7 +861,7 @@ cfiscsi_handle_data_segment(struct icl_p } } - if (io->scsiio.ext_data_filled == io->scsiio.kern_data_len) { + if (io->scsiio.ext_data_filled == cdw->cdw_r2t_end) { #if 0 CFISCSI_SESSION_DEBUG(cs, "no longer expecting Data-Out with target " "transfer tag 0x%x", cdw->cdw_target_transfer_tag); @@ -915,8 +917,13 @@ cfiscsi_pdu_handle_data_out(struct icl_p CFISCSI_SESSION_LOCK(cs); TAILQ_REMOVE(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); + done = (io->scsiio.ext_data_filled != cdw->cdw_r2t_end || + io->scsiio.ext_data_filled == io->scsiio.kern_data_len); uma_zfree(cfiscsi_data_wait_zone, cdw); - io->scsiio.be_move_done(io); + if (done) + io->scsiio.be_move_done(io); + else + cfiscsi_datamove_out(io); } icl_pdu_free(request); @@ -2571,6 +2578,8 @@ cfiscsi_datamove_out(union ctl_io *io) const struct iscsi_bhs_scsi_command *bhssc; struct iscsi_bhs_r2t *bhsr2t; struct cfiscsi_data_wait *cdw; + struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; + uint32_t expected_len, r2t_off, r2t_len; uint32_t target_transfer_tag; bool done; @@ -2589,9 +2598,16 @@ cfiscsi_datamove_out(union ctl_io *io) PDU_TOTAL_TRANSFER_LEN(request) = io->scsiio.kern_total_len; /* - * We hadn't received anything during this datamove yet. + * Report write underflow as error since CTL and backends don't + * really support it, and SCSI does not tell how to do it right. */ - io->scsiio.ext_data_filled = 0; + expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); + if (io->scsiio.kern_rel_offset + io->scsiio.kern_data_len > + expected_len) { + io->scsiio.io_hdr.port_status = 43; + io->scsiio.be_move_done(io); + return; + } target_transfer_tag = atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); @@ -2613,8 +2629,35 @@ cfiscsi_datamove_out(union ctl_io *io) cdw->cdw_ctl_io = io; cdw->cdw_target_transfer_tag = target_transfer_tag; cdw->cdw_initiator_task_tag = bhssc->bhssc_initiator_task_tag; + cdw->cdw_r2t_end = io->scsiio.kern_data_len; + + /* Set initial data pointer for the CDW respecting ext_data_filled. */ + if (io->scsiio.kern_sg_entries > 0) { + ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + } else { + ctl_sglist = &ctl_sg_entry; + ctl_sglist->addr = io->scsiio.kern_data_ptr; + ctl_sglist->len = io->scsiio.kern_data_len; + } + cdw->cdw_sg_index = 0; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + r2t_off = io->scsiio.ext_data_filled; + while (r2t_off > 0) { + if (r2t_off >= cdw->cdw_sg_len) { + r2t_off -= cdw->cdw_sg_len; + cdw->cdw_sg_index++; + cdw->cdw_sg_addr = ctl_sglist[cdw->cdw_sg_index].addr; + cdw->cdw_sg_len = ctl_sglist[cdw->cdw_sg_index].len; + continue; + } + cdw->cdw_sg_addr += r2t_off; + cdw->cdw_sg_len -= r2t_off; + r2t_off = 0; + } - if (cs->cs_immediate_data && io->scsiio.kern_rel_offset < + if (cs->cs_immediate_data && + io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled < icl_pdu_data_segment_length(request)) { done = cfiscsi_handle_data_segment(request, cdw); if (done) { @@ -2624,6 +2667,11 @@ cfiscsi_datamove_out(union ctl_io *io) } } + r2t_off = io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled; + r2t_len = MIN(io->scsiio.kern_data_len - io->scsiio.ext_data_filled, + cs->cs_max_burst_length); + cdw->cdw_r2t_end = io->scsiio.ext_data_filled + r2t_len; + CFISCSI_SESSION_LOCK(cs); TAILQ_INSERT_TAIL(&cs->cs_waiting_for_data_out, cdw, cdw_next); CFISCSI_SESSION_UNLOCK(cs); @@ -2663,16 +2711,13 @@ cfiscsi_datamove_out(union ctl_io *io) * The ext_data_filled is to account for unsolicited * (immediate) data that might have already arrived. */ - bhsr2t->bhsr2t_buffer_offset = - htonl(io->scsiio.kern_rel_offset + io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_buffer_offset = htonl(r2t_off); /* * This is the total length (sum of S/G lengths) this call - * to cfiscsi_datamove() is supposed to handle. - * - * XXX: Limit it to MaxBurstLength. + * to cfiscsi_datamove() is supposed to handle, limited by + * MaxBurstLength. */ - bhsr2t->bhsr2t_desired_data_transfer_length = - htonl(io->scsiio.kern_data_len - io->scsiio.ext_data_filled); + bhsr2t->bhsr2t_desired_data_transfer_length = htonl(r2t_len); cfiscsi_pdu_queue(response); } @@ -2682,8 +2727,11 @@ cfiscsi_datamove(union ctl_io *io) if ((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) cfiscsi_datamove_in(io); - else + else { + /* We hadn't received anything during this datamove yet. */ + io->scsiio.ext_data_filled = 0; cfiscsi_datamove_out(io); + } } static void Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:31:23 2014 (r273309) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:32:33 2014 (r273310) @@ -56,6 +56,7 @@ struct cfiscsi_data_wait { int cdw_sg_index; char *cdw_sg_addr; size_t cdw_sg_len; + uint32_t cdw_r2t_end; }; #define CFISCSI_SESSION_STATE_INVALID 0 From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:33:43 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E77437A; Mon, 20 Oct 2014 07:33:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6FCAA8BE; Mon, 20 Oct 2014 07:33:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7Xh6A073872; Mon, 20 Oct 2014 07:33:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7Xfi5073862; Mon, 20 Oct 2014 07:33:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200733.s9K7Xfi5073862@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:33:41 +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: r273311 - in stable/10/sys/cam: ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:33:43 -0000 Author: mav Date: Mon Oct 20 07:33:41 2014 New Revision: 273311 URL: https://svnweb.freebsd.org/changeset/base/273311 Log: MFC r272734: Add support for WRITE ATOMIC (16) command and report SBC-4 compliance. Atomic writes are only supported for ZVOLs in "dev" mode. In other cases atomicity can not be guarantied and so the command is blocked. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_backend_ramdisk.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/scsi_ctl.c stable/10/sys/cam/scsi/scsi_all.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:33:41 2014 (r273311) @@ -9128,6 +9128,31 @@ ctl_read_write(struct ctl_scsiio *ctsio) num_blocks = scsi_4btoul(cdb->length); break; } + case WRITE_ATOMIC_16: { + struct scsi_rw_16 *cdb; + + if (lun->be_lun->atomicblock == 0) { + ctl_set_invalid_opcode(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + cdb = (struct scsi_rw_16 *)ctsio->cdb; + if (cdb->byte2 & SRW12_FUA) + flags |= CTL_LLF_FUA; + if (cdb->byte2 & SRW12_DPO) + flags |= CTL_LLF_DPO; + lba = scsi_8btou64(cdb->addr); + num_blocks = scsi_4btoul(cdb->length); + if (num_blocks > lun->be_lun->atomicblock) { + ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, + /*command*/ 1, /*field*/ 12, /*bit_valid*/ 0, + /*bit*/ 0); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + break; + } case WRITE_VERIFY_16: { struct scsi_write_verify_16 *cdb; @@ -10301,6 +10326,10 @@ ctl_inquiry_evpd_block_limits(struct ctl bl_ptr->unmap_grain_align); } } + scsi_ulto4b(lun->be_lun->atomicblock, + bl_ptr->max_atomic_transfer_length); + scsi_ulto4b(0, bl_ptr->atomic_alignment); + scsi_ulto4b(0, bl_ptr->atomic_transfer_length_granularity); } scsi_u64to8b(UINT64_MAX, bl_ptr->max_write_same_length); @@ -10696,13 +10725,13 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } if (lun == NULL) { - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); } else { switch (lun->be_lun->lun_type) { case T_DIRECT: - /* SBC-3 (no version claimed) */ - scsi_ulto2b(0x04C0, inq_ptr->version4); + /* SBC-4 (no version claimed) */ + scsi_ulto2b(0x0600, inq_ptr->version4); break; case T_PROCESSOR: default: @@ -10820,7 +10849,8 @@ ctl_get_lba_len(union ctl_io *io, uint64 break; } case READ_16: - case WRITE_16: { + case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb; cdb = (struct scsi_rw_16 *)io->scsiio.cdb; @@ -10834,7 +10864,6 @@ ctl_get_lba_len(union ctl_io *io, uint64 cdb = (struct scsi_write_verify_16 *)io->scsiio.cdb; - *lba = scsi_8btou64(cdb->addr); *len = scsi_4btoul(cdb->length); break; Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:33:41 2014 (r273311) @@ -144,6 +144,8 @@ typedef void (*be_lun_config_t)(void *be * * pblockoff is the lowest LBA on the LUN aligned ot physical sector. * + * atomicblock is the number of blocks that can be written atomically. + * * req_lun_id is the requested LUN ID. CTL only pays attention to this * field if the CTL_LUN_FLAG_ID_REQ flag is set. If the requested LUN ID is * not available, the LUN addition will fail. If a particular LUN ID isn't @@ -188,6 +190,7 @@ struct ctl_be_lun { uint32_t blocksize; /* passed to CTL */ uint16_t pblockexp; /* passed to CTL */ uint16_t pblockoff; /* passed to CTL */ + uint32_t atomicblock; /* passed to CTL */ uint32_t req_lun_id; /* passed to CTL */ uint32_t lun_id; /* returned from CTL */ uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */ Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:33:41 2014 (r273311) @@ -2006,6 +2006,9 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; Modified: stable/10/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_backend_ramdisk.c Mon Oct 20 07:33:41 2014 (r273311) @@ -595,6 +595,7 @@ ctl_backend_ramdisk_create(struct ctl_be be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; + be_lun->ctl_be_lun.atomicblock = UINT32_MAX; be_lun->ctl_be_lun.be_lun = be_lun; if (params->flags & CTL_LUN_FLAG_ID_REQ) { Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:33:41 2014 (r273311) @@ -1117,8 +1117,11 @@ const struct ctl_cmd_entry ctl_cmd_table /* 9B */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, -/* 9C */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +/* 9C WRITE ATOMIC (16) */ +{ctl_read_write, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN| CTL_FLAG_DATA_OUT, + CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE, + 16, {0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0, 0, 0xff, 0xff, 0, 0x07}}, /* 9D */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:33:41 2014 (r273311) @@ -1115,6 +1115,7 @@ ctlfe_adjust_cdb(struct ccb_accept_tio * } case READ_16: case WRITE_16: + case WRITE_ATOMIC_16: { struct scsi_rw_16 *cdb = (struct scsi_rw_16 *)cmdbyt; lba = scsi_8btou64(cdb->addr); Modified: stable/10/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_all.h Mon Oct 20 07:32:33 2014 (r273310) +++ stable/10/sys/cam/scsi/scsi_all.h Mon Oct 20 07:33:41 2014 (r273311) @@ -1720,6 +1720,7 @@ struct ata_pass_16 { #define VERIFY_16 0x8F #define SYNCHRONIZE_CACHE_16 0x91 #define WRITE_SAME_16 0x93 +#define WRITE_ATOMIC_16 0x9C #define SERVICE_ACTION_IN 0x9E #define REPORT_LUNS 0xA0 #define ATA_PASS_12 0xA1 @@ -2437,8 +2438,7 @@ struct scsi_vpd_logical_block_prov }; /* - * Block Limits VDP Page based on - * T10/1799-D Revision 31 + * Block Limits VDP Page based on SBC-4 Revision 2 */ struct scsi_vpd_block_limits { @@ -2459,7 +2459,10 @@ struct scsi_vpd_block_limits u_int8_t opt_unmap_grain[4]; u_int8_t unmap_grain_align[4]; u_int8_t max_write_same_length[8]; - u_int8_t reserved2[20]; + u_int8_t max_atomic_transfer_length[4]; + u_int8_t atomic_alignment[4]; + u_int8_t atomic_transfer_length_granularity[4]; + u_int8_t reserved2[8]; }; struct scsi_read_capacity From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:34:38 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 986714BA; Mon, 20 Oct 2014 07:34:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79D1A8C9; Mon, 20 Oct 2014 07:34:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7YcW9074057; Mon, 20 Oct 2014 07:34:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7YbE7074051; Mon, 20 Oct 2014 07:34:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200734.s9K7YbE7074051@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273312 - in stable/10: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:34:38 -0000 Author: mav Date: Mon Oct 20 07:34:37 2014 New Revision: 273312 URL: https://svnweb.freebsd.org/changeset/base/273312 Log: MFC r272748: Implement software (mode page) and hardware (config) write protection. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h stable/10/usr.sbin/ctladm/ctladm.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:34:37 2014 (r273312) @@ -293,7 +293,7 @@ static struct scsi_control_page control_ /*page_length*/sizeof(struct scsi_control_page) - 2, /*rlec*/SCP_DSENSE, /*queue_flags*/SCP_QUEUE_ALG_MASK, - /*eca_and_aen*/0, + /*eca_and_aen*/SCP_SWP, /*flags4*/0, /*aen_holdoff_period*/{0, 0}, /*busy_timeout_period*/{0, 0}, @@ -4449,7 +4449,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft struct ctl_port *port; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; - const char *eui, *naa, *scsiname, *vendor; + const char *eui, *naa, *scsiname, *vendor, *value; int lun_number, i, lun_malloced; int devidlen, idlen1, idlen2 = 0, len; @@ -4611,6 +4611,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft if (be_lun->flags & CTL_LUN_FLAG_PRIMARY) lun->flags |= CTL_LUN_PRIMARY_SC; + value = ctl_get_opt(&be_lun->options, "readonly"); + if (value != NULL && strcmp(value, "on") == 0) + lun->flags |= CTL_LUN_READONLY; + lun->ctl_softc = ctl_softc; TAILQ_INIT(&lun->ooa_queue); TAILQ_INIT(&lun->blocked_queue); @@ -6221,6 +6225,14 @@ ctl_control_page_handler(struct ctl_scsi saved_cp->queue_flags |= user_cp->queue_flags & SCP_QUEUE_ALG_MASK; set_ua = 1; } + if ((current_cp->eca_and_aen & SCP_SWP) != + (user_cp->eca_and_aen & SCP_SWP)) { + current_cp->eca_and_aen &= ~SCP_SWP; + current_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + saved_cp->eca_and_aen &= ~SCP_SWP; + saved_cp->eca_and_aen |= user_cp->eca_and_aen & SCP_SWP; + set_ua = 1; + } if (set_ua != 0) { int i; /* @@ -7047,8 +7059,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr; header->datalen = ctl_min(total_len - 1, 254); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) header->block_descr_len = 0; else @@ -7065,8 +7082,13 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) datalen = ctl_min(total_len - 2, 65533); scsi_ulto2b(datalen, header->datalen); - if (control_dev == 0) + if (control_dev == 0) { header->dev_specific = 0x10; /* DPOFUA */ + if ((lun->flags & CTL_LUN_READONLY) || + (lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) + header->dev_specific |= 0x80; /* WP */ + } if (dbd) scsi_ulto2b(0, header->block_descr_len); else @@ -11315,6 +11337,24 @@ ctl_scsiio_lun_check(struct ctl_softc *c } #endif + if (entry->pattern & CTL_LUN_PAT_WRITE) { + if (lun->flags & CTL_LUN_READONLY) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x01, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT] + .eca_and_aen & SCP_SWP) != 0) { + ctl_set_sense(ctsio, /*current_error*/ 1, + /*sense_key*/ SSD_KEY_DATA_PROTECT, + /*asc*/ 0x27, /*ascq*/ 0x02, SSD_ELEM_NONE); + retval = 1; + goto bailout; + } + } + /* * Check for a reservation conflict. If this command isn't allowed * even on reserved LUNs, and if this initiator isn't the one who Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:34:37 2014 (r273312) @@ -198,7 +198,8 @@ typedef enum { CTL_LUN_OFFLINE = 0x080, CTL_LUN_PR_RESERVED = 0x100, CTL_LUN_PRIMARY_SC = 0x200, - CTL_LUN_SENSE_DESC = 0x400 + CTL_LUN_SENSE_DESC = 0x400, + CTL_LUN_READONLY = 0x800 } ctl_lun_flags; typedef enum { Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:33:41 2014 (r273311) +++ stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:34:37 2014 (r273312) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd September 13, 2014 +.Dd October 8, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -961,6 +961,9 @@ This allows to offload copying between d on the same host in trusted environments. .It Va readcache Set to "off", disables read caching for the LUN, if supported by the backend. +.It Va readonly +Set to "on", blocks all media write operations to the LUN, reporting it +as write protected. .It Va reordering Set to "unrestricted", allows target to process commands with SIMPLE task attribute in arbitrary order. Any data integrity exposures related to From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:35:48 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18028603; Mon, 20 Oct 2014 07:35:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 037F98D3; Mon, 20 Oct 2014 07:35:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7ZlOI074290; Mon, 20 Oct 2014 07:35:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7Zlod074277; Mon, 20 Oct 2014 07:35:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200735.s9K7Zlod074277@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:35:47 +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: r273313 - in stable/10/sys: cam/ctl dev/iscsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:35:48 -0000 Author: mav Date: Mon Oct 20 07:35:46 2014 New Revision: 273313 URL: https://svnweb.freebsd.org/changeset/base/273313 Log: MFC r272812: Make iSCSI connection close somewhat less aggressive. It allows to push out some final data from the send queue to the socket before its close. In particular, it increases chances for logout response to be delivered to the initiator. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/dev/iscsi/icl.c stable/10/sys/dev/iscsi/icl.h stable/10/sys/dev/iscsi/iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:35:46 2014 (r273313) @@ -1139,7 +1139,6 @@ cfiscsi_maintenance_thread(void *arg) * that anymore. We might need to revisit that. */ callout_drain(&cs->cs_callout); - icl_conn_shutdown(cs->cs_conn); icl_conn_close(cs->cs_conn); /* Modified: stable/10/sys/dev/iscsi/icl.c ============================================================================== --- stable/10/sys/dev/iscsi/icl.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/icl.c Mon Oct 20 07:35:46 2014 (r273313) @@ -877,8 +877,6 @@ icl_conn_send_pdus(struct icl_conn *ic, SOCKBUF_UNLOCK(&so->so_snd); while (!STAILQ_EMPTY(queue)) { - if (ic->ic_disconnecting) - return; request = STAILQ_FIRST(queue); size = icl_pdu_size(request); if (available < size) { @@ -975,11 +973,6 @@ icl_send_thread(void *arg) ic->ic_send_running = true; for (;;) { - if (ic->ic_disconnecting) { - //ICL_DEBUG("terminating"); - break; - } - for (;;) { /* * If the local queue is empty, populate it from @@ -1018,6 +1011,11 @@ icl_send_thread(void *arg) break; } + if (ic->ic_disconnecting) { + //ICL_DEBUG("terminating"); + break; + } + cv_wait(&ic->ic_send_cv, ic->ic_lock); } @@ -1301,21 +1299,6 @@ icl_conn_handoff(struct icl_conn *ic, in } void -icl_conn_shutdown(struct icl_conn *ic) -{ - ICL_CONN_LOCK_ASSERT_NOT(ic); - - ICL_CONN_LOCK(ic); - if (ic->ic_socket == NULL) { - ICL_CONN_UNLOCK(ic); - return; - } - ICL_CONN_UNLOCK(ic); - - soshutdown(ic->ic_socket, SHUT_RDWR); -} - -void icl_conn_close(struct icl_conn *ic) { struct icl_pdu *pdu; Modified: stable/10/sys/dev/iscsi/icl.h ============================================================================== --- stable/10/sys/dev/iscsi/icl.h Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/icl.h Mon Oct 20 07:35:46 2014 (r273313) @@ -107,7 +107,6 @@ struct icl_conn { struct icl_conn *icl_conn_new(const char *name, struct mtx *lock); void icl_conn_free(struct icl_conn *ic); int icl_conn_handoff(struct icl_conn *ic, int fd); -void icl_conn_shutdown(struct icl_conn *ic); void icl_conn_close(struct icl_conn *ic); bool icl_conn_connected(struct icl_conn *ic); Modified: stable/10/sys/dev/iscsi/iscsi.c ============================================================================== --- stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:34:37 2014 (r273312) +++ stable/10/sys/dev/iscsi/iscsi.c Mon Oct 20 07:35:46 2014 (r273313) @@ -372,7 +372,6 @@ static void iscsi_maintenance_thread_reconnect(struct iscsi_session *is) { - icl_conn_shutdown(is->is_conn); icl_conn_close(is->is_conn); ISCSI_SESSION_LOCK(is); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:38:37 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 18730856; Mon, 20 Oct 2014 07:38:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 038788F4; Mon, 20 Oct 2014 07:38:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7caVT074671; Mon, 20 Oct 2014 07:38:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7caw8074669; Mon, 20 Oct 2014 07:38:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200738.s9K7caw8074669@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273314 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:38:37 -0000 Author: mav Date: Mon Oct 20 07:38:36 2014 New Revision: 273314 URL: https://svnweb.freebsd.org/changeset/base/273314 Log: MFC r272893: Store persistent reservation keys as uint64_t instead of uint8_t[8]. This allows to simplify the code and save 512KB of RAM per LUN (8%) by removing no longer needed "registered" keys flags. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_private.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:35:46 2014 (r273313) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:38:36 2014 (r273314) @@ -2992,12 +2992,11 @@ ctl_ioctl(struct cdev *dev, u_long cmd, for (j = 0; j < (CTL_MAX_PORTS * 2); j++) { for (k = 0; k < CTL_MAX_INIT_PER_PORT; k++){ idx = j * CTL_MAX_INIT_PER_PORT + k; - if (lun->per_res[idx].registered == 0) + if (lun->pr_keys[idx] == 0) continue; printf(" LUN %d port %d iid %d key " "%#jx\n", i, j, k, - (uintmax_t)scsi_8btou64( - lun->per_res[idx].res_key.key)); + (uintmax_t)lun->pr_keys[idx]); } } } @@ -5538,7 +5537,7 @@ ctl_start_stop(struct ctl_scsiio *ctsio) uint32_t residx; residx = ctl_get_resindex(&ctsio->io_hdr.nexus); - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (lun->pr_res_idx!=residx && lun->res_type < 4)) { ctl_set_reservation_conflict(ctsio); @@ -5829,7 +5828,7 @@ ctl_read_buffer(struct ctl_scsiio *ctsio && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -6884,7 +6883,7 @@ ctl_mode_sense(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -7827,7 +7826,7 @@ retry: lun->pr_key_count, res_keys->header.length); for (i = 0, key_count = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; /* @@ -7853,10 +7852,8 @@ retry: key_count++; continue; } - memcpy(res_keys->keys[key_count].key, - lun->per_res[i].res_key.key, - ctl_min(sizeof(res_keys->keys[key_count].key), - sizeof(lun->per_res[i].res_key))); + scsi_u64to8b(lun->pr_keys[i], + res_keys->keys[key_count].key); key_count++; } break; @@ -7907,9 +7904,8 @@ retry: * is 0, since it doesn't really matter. */ if (lun->pr_res_idx != CTL_PR_ALL_REGISTRANTS) { - memcpy(res->data.reservation, - &lun->per_res[lun->pr_res_idx].res_key, - sizeof(struct scsi_per_res_key)); + scsi_u64to8b(lun->pr_keys[lun->pr_res_idx], + res->data.reservation); } res->data.scopetype = lun->res_type; break; @@ -7960,11 +7956,10 @@ retry: res_desc = &res_status->desc[0]; for (i = 0; i < 2*CTL_MAX_INITIATORS; i++) { - if (!lun->per_res[i].registered) + if (lun->pr_keys[i] == 0) continue; - memcpy(&res_desc->res_key, &lun->per_res[i].res_key.key, - sizeof(res_desc->res_key)); + scsi_u64to8b(lun->pr_keys[i], res_desc->res_key.key); if ((lun->flags & CTL_LUN_PR_RESERVED) && (lun->pr_res_idx == i || lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS)) { @@ -8057,15 +8052,12 @@ ctl_pro_preempt(struct ctl_softc *softc, return (1); } - /* temporarily unregister this nexus */ - lun->per_res[residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8076,11 +8068,8 @@ ctl_pro_preempt(struct ctl_softc *softc, && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[residx].registered = 1; lun->pr_key_count = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8144,16 +8133,11 @@ ctl_pro_preempt(struct ctl_softc *softc, } for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered - && memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (lun->pr_keys[i] != sa_res_key) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8187,9 +8171,7 @@ ctl_pro_preempt(struct ctl_softc *softc, } else { /* Reserved but not all registrants */ /* sa_res_key is res holder */ - if (memcmp(param->serv_act_res_key, - lun->per_res[lun->pr_res_idx].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { + if (sa_res_key == lun->pr_keys[lun->pr_res_idx]) { /* validate scope and type */ if ((cdb->scope_type & SPR_SCOPE_MASK) != SPR_LU_SCOPE) { @@ -8230,22 +8212,12 @@ ctl_pro_preempt(struct ctl_softc *softc, * except don't unregister the res holder. */ - /* - * Temporarily unregister so it won't get - * removed or UA generated - */ - lun->per_res[residx].registered = 0; for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == residx || lun->pr_keys[i] == 0) continue; - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, - 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8270,7 +8242,6 @@ ctl_pro_preempt(struct ctl_softc *softc, CTL_UA_RES_RELEASE; } } - lun->per_res[residx].registered = 1; lun->res_type = type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8301,15 +8272,11 @@ ctl_pro_preempt(struct ctl_softc *softc, int found=0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(param->serv_act_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key != lun->pr_keys[i]) continue; found = 1; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8356,26 +8323,22 @@ ctl_pro_preempt(struct ctl_softc *softc, static void ctl_pro_preempt_other(struct ctl_lun *lun, union ctl_ha_msg *msg) { + uint64_t sa_res_key; int i; + sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); + if (lun->pr_res_idx == CTL_PR_ALL_REGISTRANTS || lun->pr_res_idx == CTL_PR_NO_RESERVATION - || memcmp(&lun->per_res[lun->pr_res_idx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)) != 0) { - uint64_t sa_res_key; - sa_res_key = scsi_8btou64(msg->pr.pr_info.sa_res_key); - + || sa_res_key != lun->pr_keys[lun->pr_res_idx]) { if (sa_res_key == 0) { - /* temporarily unregister this nexus */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; - /* * Unregister everybody else and build UA for * them */ for(i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; if (!persis_offset @@ -8385,12 +8348,9 @@ ctl_pro_preempt_other(struct ctl_lun *lu else if (persis_offset && i >= persis_offset) lun->pending_ua[i - persis_offset] |= CTL_UA_REG_PREEMPT; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->pr_key_count = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR @@ -8398,14 +8358,10 @@ ctl_pro_preempt_other(struct ctl_lun *lu lun->pr_res_idx = msg->pr.pr_info.residx; } else { for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) != 0) + if (sa_res_key == lun->pr_keys[i]) continue; - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset @@ -8419,21 +8375,13 @@ ctl_pro_preempt_other(struct ctl_lun *lu } } } else { - /* - * Temporarily unregister so it won't get removed - * or UA generated - */ - lun->per_res[msg->pr.pr_info.residx].registered = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (i == msg->pr.pr_info.residx || + lun->pr_keys[i] == 0) continue; - if (memcmp(msg->pr.pr_info.sa_res_key, - lun->per_res[i].res_key.key, - sizeof(struct scsi_per_res_key)) == 0) { - lun->per_res[i].registered = 0; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); + if (sa_res_key == lun->pr_keys[i]) { + lun->pr_keys[i] = 0; lun->pr_key_count--; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -8456,7 +8404,6 @@ ctl_pro_preempt_other(struct ctl_lun *lu CTL_UA_RES_RELEASE; } } - lun->per_res[msg->pr.pr_info.residx].registered = 1; lun->res_type = msg->pr.pr_info.res_type; if (lun->res_type != SPR_TYPE_WR_EX_AR && lun->res_type != SPR_TYPE_EX_AC_AR) @@ -8554,11 +8501,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ if ((cdb->action & SPRO_ACTION_MASK) != SPRO_REG_IGNO) { mtx_lock(&lun->lun_lock); - if (lun->per_res[residx].registered) { - if (memcmp(param->res_key.key, - lun->per_res[residx].res_key.key, - ctl_min(sizeof(param->res_key), - sizeof(lun->per_res[residx].res_key))) != 0) { + if (lun->pr_keys[residx] != 0) { + if (res_key != lun->pr_keys[residx]) { /* * The current key passed in doesn't match * the one the initiator previously @@ -8639,14 +8583,12 @@ ctl_persistent_reserve_out(struct ctl_sc if ((res_key == 0 && (cdb->action & SPRO_ACTION_MASK) == SPRO_REGISTER) || ((cdb->action & SPRO_ACTION_MASK) == SPRO_REG_IGNO - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { mtx_unlock(&lun->lun_lock); goto done; } - lun->per_res[residx].registered = 0; - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); + lun->pr_keys[residx] = 0; lun->pr_key_count--; if (residx == lun->pr_res_idx) { @@ -8665,9 +8607,8 @@ ctl_persistent_reserve_out(struct ctl_sc */ for (i = 0; i < CTL_MAX_INITIATORS;i++){ - if (lun->per_res[ - i+persis_offset].registered - == 0) + if (lun->pr_keys[ + i + persis_offset] == 0) continue; lun->pending_ua[i] |= CTL_UA_RES_RELEASE; @@ -8697,15 +8638,9 @@ ctl_persistent_reserve_out(struct ctl_sc * If we aren't registered currently then increment * the key count and set the registered flag. */ - if (!lun->per_res[residx].registered) { + if (lun->pr_keys[residx] == 0) lun->pr_key_count++; - lun->per_res[residx].registered = 1; - } - - memcpy(&lun->per_res[residx].res_key, - param->serv_act_res_key, - ctl_min(sizeof(param->serv_act_res_key), - sizeof(lun->per_res[residx].res_key))); + lun->pr_keys[residx] = sa_res_key; persis_io.hdr.nexus = ctsio->io_hdr.nexus; persis_io.hdr.msg_type = CTL_MSG_PERS_ACTION; @@ -8818,20 +8753,12 @@ ctl_persistent_reserve_out(struct ctl_sc */ if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX) { - /* - * temporarily unregister so we don't generate UA - */ - lun->per_res[residx].registered = 0; - for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+persis_offset].registered - == 0) + if (i == residx || + lun->pr_keys[i + persis_offset] == 0) continue; - lun->pending_ua[i] |= - CTL_UA_RES_RELEASE; + lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } - - lun->per_res[residx].registered = 1; } mtx_unlock(&lun->lun_lock); /* Send msg to other side */ @@ -8854,13 +8781,10 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pr_key_count = 0; lun->pr_res_idx = CTL_PR_NO_RESERVATION; - - memset(&lun->per_res[residx].res_key, - 0, sizeof(lun->per_res[residx].res_key)); - lun->per_res[residx].registered = 0; + lun->pr_keys[residx] = 0; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) - if (lun->per_res[i].registered) { + if (lun->pr_keys[i] != 0) { if (!persis_offset && i < CTL_MAX_INITIATORS) lun->pending_ua[i] |= CTL_UA_RES_PREEMPT; @@ -8868,9 +8792,7 @@ ctl_persistent_reserve_out(struct ctl_sc lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, - 0, sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; mtx_unlock(&lun->lun_lock); @@ -8926,20 +8848,15 @@ ctl_hndl_per_res_out_on_other_sc(union c mtx_lock(&lun->lun_lock); switch(msg->pr.pr_info.action) { case CTL_PR_REG_KEY: - if (!lun->per_res[msg->pr.pr_info.residx].registered) { - lun->per_res[msg->pr.pr_info.residx].registered = 1; + if (lun->pr_keys[msg->pr.pr_info.residx] == 0) lun->pr_key_count++; - } + lun->pr_keys[msg->pr.pr_info.residx] = + scsi_8btou64(msg->pr.pr_info.sa_res_key); lun->PRGeneration++; - memcpy(&lun->per_res[msg->pr.pr_info.residx].res_key, - msg->pr.pr_info.sa_res_key, - sizeof(struct scsi_per_res_key)); break; case CTL_PR_UNREG_KEY: - lun->per_res[msg->pr.pr_info.residx].registered = 0; - memset(&lun->per_res[msg->pr.pr_info.residx].res_key, - 0, sizeof(struct scsi_per_res_key)); + lun->pr_keys[msg->pr.pr_info.residx] = 0; lun->pr_key_count--; /* XXX Need to see if the reservation has been released */ @@ -8960,8 +8877,8 @@ ctl_hndl_per_res_out_on_other_sc(union c */ for (i = 0; i < CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i+ - persis_offset].registered == 0) + if (lun->pr_keys[i+ + persis_offset] == 0) continue; lun->pending_ua[i] |= @@ -8994,7 +8911,7 @@ ctl_hndl_per_res_out_on_other_sc(union c if (lun->res_type != SPR_TYPE_EX_AC && lun->res_type != SPR_TYPE_WR_EX) { for (i = 0; i < CTL_MAX_INITIATORS; i++) - if (lun->per_res[i+persis_offset].registered) + if (lun->pr_keys[i+persis_offset] != 0) lun->pending_ua[i] |= CTL_UA_RES_RELEASE; } @@ -9014,7 +8931,7 @@ ctl_hndl_per_res_out_on_other_sc(union c lun->pr_res_idx = CTL_PR_NO_RESERVATION; for (i=0; i < 2*CTL_MAX_INITIATORS; i++) { - if (lun->per_res[i].registered == 0) + if (lun->pr_keys[i] == 0) continue; if (!persis_offset && i < CTL_MAX_INITIATORS) @@ -9023,9 +8940,7 @@ ctl_hndl_per_res_out_on_other_sc(union c && i >= persis_offset) lun->pending_ua[i-persis_offset] |= CTL_UA_RES_PREEMPT; - memset(&lun->per_res[i].res_key, 0, - sizeof(struct scsi_per_res_key)); - lun->per_res[i].registered = 0; + lun->pr_keys[i] = 0; } lun->PRGeneration++; break; @@ -9064,7 +8979,7 @@ ctl_read_write(struct ctl_scsiio *ctsio) && residx != lun->pr_res_idx) || ((lun->res_type == SPR_TYPE_EX_AC_RO || lun->res_type == SPR_TYPE_EX_AC_AR) - && !lun->per_res[residx].registered)) { + && lun->pr_keys[residx] == 0)) { ctl_set_reservation_conflict(ctsio); ctl_done((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); @@ -11381,7 +11296,7 @@ ctl_scsiio_lun_check(struct ctl_softc *c * type reservations are checked in the particular command * for a conflict. Read and SSU are the only ones. */ - if (!lun->per_res[residx].registered + if (lun->pr_keys[residx] == 0 || (residx != lun->pr_res_idx && lun->res_type < 4)) { ctsio->scsi_status = SCSI_STATUS_RESERV_CONFLICT; ctsio->io_hdr.status = CTL_SCSI_ERROR; Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:35:46 2014 (r273313) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 07:38:36 2014 (r273314) @@ -353,11 +353,6 @@ typedef enum { CTL_PR_FLAG_ACTIVE_RES = 0x02 } ctl_per_res_flags; -struct ctl_per_res_info { - struct scsi_per_res_key res_key; - uint8_t registered; -}; - #define CTL_PR_ALL_REGISTRANTS 0xFFFFFFFF #define CTL_PR_NO_RESERVATION 0xFFFFFFF0 @@ -398,8 +393,8 @@ struct ctl_lun { struct ctl_mode_pages mode_pages; struct ctl_lun_io_stats stats; uint32_t res_idx; - struct ctl_per_res_info per_res[2*CTL_MAX_INITIATORS]; unsigned int PRGeneration; + uint64_t pr_keys[2*CTL_MAX_INITIATORS]; int pr_key_count; uint32_t pr_res_idx; uint8_t res_type; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:41:40 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FD85A47; Mon, 20 Oct 2014 07:41:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE22699C; Mon, 20 Oct 2014 07:41:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7fdNp078493; Mon, 20 Oct 2014 07:41:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7fcgG078477; Mon, 20 Oct 2014 07:41:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200741.s9K7fcgG078477@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:41:38 +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: r273315 - in stable/10: sys/cam/ctl usr.sbin/ctladm usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:41:40 -0000 Author: mav Date: Mon Oct 20 07:41:37 2014 New Revision: 273315 URL: https://svnweb.freebsd.org/changeset/base/273315 Log: MFC r272911: Make ctld start even if some LUNs are unable to open backing storage. Such LUNs will be visible to initiators, but return "not ready" status on media access commands. If backing storage become available later, `ctladm modify ...` or `service ctld reload` can trigger its reopen. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_backend.h stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_ioctl.h stable/10/usr.sbin/ctladm/ctladm.c stable/10/usr.sbin/ctld/kernel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:41:37 2014 (r273315) @@ -4601,6 +4601,9 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; atomic_add_int(&be_lun->be->num_luns, 1); + if (be_lun->flags & CTL_LUN_FLAG_OFFLINE) + lun->flags |= CTL_LUN_OFFLINE; + if (be_lun->flags & CTL_LUN_FLAG_POWERED_OFF) lun->flags |= CTL_LUN_STOPPED; Modified: stable/10/sys/cam/ctl/ctl_backend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_backend.h Mon Oct 20 07:41:37 2014 (r273315) @@ -73,6 +73,8 @@ * The DEV_TYPE flag tells us that the device_type field is filled in. * * The UNMAP flag tells us that this LUN supports UNMAP. + * + * The OFFLINE flag tells us that this LUN can not access backing store. */ typedef enum { CTL_LUN_FLAG_ID_REQ = 0x01, @@ -82,7 +84,8 @@ typedef enum { CTL_LUN_FLAG_SERIAL_NUM = 0x10, CTL_LUN_FLAG_DEVID = 0x20, CTL_LUN_FLAG_DEV_TYPE = 0x40, - CTL_LUN_FLAG_UNMAP = 0x80 + CTL_LUN_FLAG_UNMAP = 0x80, + CTL_LUN_FLAG_OFFLINE = 0x100 } ctl_backend_lun_flags; #ifdef _KERNEL Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 07:41:37 2014 (r273315) @@ -153,6 +153,7 @@ typedef void (*cbb_dispatch_t)(struct ct * and a backend block LUN, and between a backend block LUN and a CTL LUN. */ struct ctl_be_block_lun { + struct ctl_lun_create_params params; struct ctl_block_disk *disk; char lunname[32]; char *dev_path; @@ -1524,7 +1525,7 @@ ctl_be_block_ioctl(struct cdev *dev, u_l default: lun_req->status = CTL_LUN_ERROR; snprintf(lun_req->error_str, sizeof(lun_req->error_str), - "%s: invalid LUN request type %d", __func__, + "invalid LUN request type %d", lun_req->reqtype); break; } @@ -1548,7 +1549,7 @@ ctl_be_block_open_file(struct ctl_be_blo error = 0; file_data = &be_lun->backend.file; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_FILE; be_lun->dispatch = ctl_be_block_dispatch_file; @@ -1631,7 +1632,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc int error; off_t ps, pss, po, pos; - params = &req->reqdata.create; + params = &be_lun->params; be_lun->dev_type = CTL_BE_BLOCK_DEV; be_lun->backend.dev.cdev = be_lun->vn->v_rdev; @@ -1649,8 +1650,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc error = VOP_GETATTR(be_lun->vn, &vattr, NOCRED); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error getting vnode attributes for device %s", - __func__, be_lun->dev_path); + "error getting vnode attributes for device %s", + be_lun->dev_path); return (error); } @@ -1658,7 +1659,7 @@ ctl_be_block_open_dev(struct ctl_be_bloc devsw = dev->si_devsw; if (!devsw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -1668,8 +1669,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGSECTORSIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGSECTORSIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } @@ -1691,9 +1692,9 @@ ctl_be_block_open_dev(struct ctl_be_bloc be_lun->blocksize = params->blocksize_bytes; } else { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u is not an even " + "requested blocksize %u is not an even " "multiple of backing device blocksize %u", - __func__, params->blocksize_bytes, + params->blocksize_bytes, be_lun->blocksize); return (EINVAL); @@ -1701,8 +1702,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc } else if ((params->blocksize_bytes != 0) && (params->blocksize_bytes != be_lun->blocksize)) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested blocksize %u < backing device " - "blocksize %u", __func__, params->blocksize_bytes, + "requested blocksize %u < backing device " + "blocksize %u", params->blocksize_bytes, be_lun->blocksize); return (EINVAL); } @@ -1712,8 +1713,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE " - " ioctl on %s!", __func__, error, + "error %d returned for DIOCGMEDIASIZE " + " ioctl on %s!", error, be_lun->dev_path); return (error); } @@ -1721,8 +1722,8 @@ ctl_be_block_open_dev(struct ctl_be_bloc if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > be_lun->size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)be_lun->size_bytes); return (EINVAL); @@ -1795,6 +1796,7 @@ ctl_be_block_close(struct ctl_be_block_l panic("Unexpected backend type."); break; } + be_lun->dev_type = CTL_BE_BLOCK_NONE; } PICKUP_GIANT(); @@ -1817,7 +1819,7 @@ ctl_be_block_open(struct ctl_be_block_so if (rootvnode == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Root filesystem is not mounted", __func__); + "Root filesystem is not mounted"); return (1); } @@ -1861,7 +1863,7 @@ ctl_be_block_open(struct ctl_be_block_so } } snprintf(req->error_str, sizeof(req->error_str), - "%s: error opening %s", __func__, be_lun->dev_path); + "error opening %s: %d", be_lun->dev_path, error); return (error); } @@ -1905,11 +1907,13 @@ ctl_be_block_create(struct ctl_be_block_ params = &req->reqdata.create; retval = 0; + req->status = CTL_LUN_OK; num_threads = cbb_num_threads; be_lun = malloc(sizeof(*be_lun), M_CTLBLK, M_ZERO | M_WAITOK); + be_lun->params = req->reqdata.create; be_lun->softc = softc; STAILQ_INIT(&be_lun->input_queue); STAILQ_INIT(&be_lun->config_write_queue); @@ -1925,7 +1929,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error allocating UMA zone", __func__); + "error allocating UMA zone"); goto bailout_error; } @@ -1938,26 +1942,18 @@ ctl_be_block_create(struct ctl_be_block_ value = ctl_get_opt(&be_lun->ctl_be_lun.options, "file"); if (value == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no file argument specified", __func__); + "no file argument specified"); goto bailout_error; } be_lun->dev_path = strdup(value, M_CTLBLK); + be_lun->blocksize = 512; + be_lun->blocksize_shift = fls(be_lun->blocksize) - 1; retval = ctl_be_block_open(softc, be_lun, req); if (retval != 0) { retval = 0; - goto bailout_error; + req->status = CTL_LUN_WARNING; } - - /* - * Tell the user the size of the file/device. - */ - params->lun_size_bytes = be_lun->size_bytes; - - /* - * The maximum LBA is the size - 1. - */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; } else { /* * For processor devices, we don't have any size. @@ -1968,7 +1964,6 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->size_blocks = 0; be_lun->size_bytes = 0; be_lun->ctl_be_lun.maxlba = 0; - params->lun_size_bytes = 0; /* * Default to just 1 thread for processor devices. @@ -1991,8 +1986,8 @@ ctl_be_block_create(struct ctl_be_block_ */ if (tmp_num_threads < 1) { snprintf(req->error_str, sizeof(req->error_str), - "%s: invalid number of threads %s", - __func__, num_thread_str); + "invalid number of threads %s", + num_thread_str); goto bailout_error; } num_threads = tmp_num_threads; @@ -2004,16 +1999,22 @@ ctl_be_block_create(struct ctl_be_block_ be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; be_lun->ctl_be_lun.flags = CTL_LUN_FLAG_PRIMARY; + if (be_lun->vn == NULL) + be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_OFFLINE; if (unmap) be_lun->ctl_be_lun.flags |= CTL_LUN_FLAG_UNMAP; - if (be_lun->dispatch == ctl_be_block_dispatch_zvol) - be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / - be_lun->blocksize; be_lun->ctl_be_lun.be_lun = be_lun; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); be_lun->ctl_be_lun.blocksize = be_lun->blocksize; be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; /* Tell the user the blocksize we ended up using */ + params->lun_size_bytes = be_lun->size_bytes; params->blocksize_bytes = be_lun->blocksize; if (params->flags & CTL_LUN_FLAG_ID_REQ) { be_lun->ctl_be_lun.req_lun_id = params->req_lun_id; @@ -2065,7 +2066,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->io_taskqueue == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: Unable to create taskqueue", __func__); + "unable to create taskqueue"); goto bailout_error; } @@ -2108,8 +2109,8 @@ ctl_be_block_create(struct ctl_be_block_ softc->num_luns--; mtx_unlock(&softc->lock); snprintf(req->error_str, sizeof(req->error_str), - "%s: ctl_add_lun() returned error %d, see dmesg for " - "details", __func__, retval); + "ctl_add_lun() returned error %d, see dmesg for " + "details", retval); retval = 0; goto bailout_error; } @@ -2131,8 +2132,7 @@ ctl_be_block_create(struct ctl_be_block_ if (be_lun->flags & CTL_BE_BLOCK_LUN_CONFIG_ERR) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN configuration error, see dmesg for details", - __func__); + "LUN configuration error, see dmesg for details"); STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, links); softc->num_luns--; @@ -2151,9 +2151,6 @@ ctl_be_block_create(struct ctl_be_block_ | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_OTHER); - - req->status = CTL_LUN_OK; - return (retval); bailout_error: @@ -2195,8 +2192,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } @@ -2204,8 +2201,8 @@ ctl_be_block_rm(struct ctl_be_block_soft if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_disable_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_disable_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2213,8 +2210,8 @@ ctl_be_block_rm(struct ctl_be_block_soft retval = ctl_invalidate_lun(&be_lun->ctl_be_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned from ctl_invalidate_lun() for " - "LUN %d", __func__, retval, params->lun_id); + "error %d returned from ctl_invalidate_lun() for " + "LUN %d", retval, params->lun_id); goto bailout_error; } @@ -2232,8 +2229,7 @@ ctl_be_block_rm(struct ctl_be_block_soft if ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { snprintf(req->error_str, sizeof(req->error_str), - "%s: interrupted waiting for LUN to be freed", - __func__); + "interrupted waiting for LUN to be freed"); mtx_unlock(&softc->lock); goto bailout_error; } @@ -2277,9 +2273,7 @@ ctl_be_block_modify_file(struct ctl_be_b { struct vattr vattr; int error; - struct ctl_lun_modify_params *params; - - params = &req->reqdata.modify; + struct ctl_lun_create_params *params = &be_lun->params; if (params->lun_size_bytes != 0) { be_lun->size_bytes = params->lun_size_bytes; @@ -2306,16 +2300,13 @@ ctl_be_block_modify_dev(struct ctl_be_bl { struct ctl_be_block_devdata *dev_data; int error; - struct ctl_lun_modify_params *params; + struct ctl_lun_create_params *params = &be_lun->params; uint64_t size_bytes; - params = &req->reqdata.modify; - dev_data = &be_lun->backend.dev; if (!dev_data->csw->d_ioctl) { snprintf(req->error_str, sizeof(req->error_str), - "%s: no d_ioctl for device %s!", __func__, - be_lun->dev_path); + "no d_ioctl for device %s!", be_lun->dev_path); return (ENODEV); } @@ -2324,16 +2315,16 @@ ctl_be_block_modify_dev(struct ctl_be_bl curthread); if (error) { snprintf(req->error_str, sizeof(req->error_str), - "%s: error %d returned for DIOCGMEDIASIZE ioctl " - "on %s!", __func__, error, be_lun->dev_path); + "error %d returned for DIOCGMEDIASIZE ioctl " + "on %s!", error, be_lun->dev_path); return (error); } if (params->lun_size_bytes != 0) { if (params->lun_size_bytes > size_bytes) { snprintf(req->error_str, sizeof(req->error_str), - "%s: requested LUN size %ju > backing device " - "size %ju", __func__, + "requested LUN size %ju > backing device " + "size %ju", (uintmax_t)params->lun_size_bytes, (uintmax_t)size_bytes); return (EINVAL); @@ -2358,9 +2349,7 @@ ctl_be_block_modify(struct ctl_be_block_ params = &req->reqdata.modify; mtx_lock(&softc->lock); - be_lun = NULL; - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->ctl_be_lun.lun_id == params->lun_id) break; @@ -2369,29 +2358,22 @@ ctl_be_block_modify(struct ctl_be_block_ if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN %u is not managed by the block backend", - __func__, params->lun_id); + "LUN %u is not managed by the block backend", + params->lun_id); goto bailout_error; } - if (params->lun_size_bytes != 0) { - if (params->lun_size_bytes < be_lun->blocksize) { - snprintf(req->error_str, sizeof(req->error_str), - "%s: LUN size %ju < blocksize %u", __func__, - params->lun_size_bytes, be_lun->blocksize); - goto bailout_error; - } - } + be_lun->params.lun_size_bytes = params->lun_size_bytes; - oldsize = be_lun->size_bytes; - if (be_lun->vn->v_type == VREG) + oldsize = be_lun->size_blocks; + if (be_lun->vn == NULL) + error = ctl_be_block_open(softc, be_lun, req); + else if (be_lun->vn->v_type == VREG) error = ctl_be_block_modify_file(be_lun, req); else error = ctl_be_block_modify_dev(be_lun, req); - if (error != 0) - goto bailout_error; - if (be_lun->size_bytes != oldsize) { + if (error == 0 && be_lun->size_blocks != oldsize) { be_lun->size_blocks = be_lun->size_bytes >> be_lun->blocksize_shift; @@ -2401,14 +2383,24 @@ ctl_be_block_modify(struct ctl_be_block_ * XXX: Note that this field is being updated without locking, * which might cause problems on 32-bit architectures. */ - be_lun->ctl_be_lun.maxlba = be_lun->size_blocks - 1; + be_lun->ctl_be_lun.maxlba = (be_lun->size_blocks == 0) ? + 0 : (be_lun->size_blocks - 1); + be_lun->ctl_be_lun.blocksize = be_lun->blocksize; + be_lun->ctl_be_lun.pblockexp = be_lun->pblockexp; + be_lun->ctl_be_lun.pblockoff = be_lun->pblockoff; + if (be_lun->dispatch == ctl_be_block_dispatch_zvol && + be_lun->blocksize != 0) + be_lun->ctl_be_lun.atomicblock = CTLBLK_MAX_IO_SIZE / + be_lun->blocksize; ctl_lun_capacity_changed(&be_lun->ctl_be_lun); + if (oldsize == 0 && be_lun->size_blocks != 0) + ctl_lun_online(&be_lun->ctl_be_lun); } /* Tell the user the exact size we ended up using */ params->lun_size_bytes = be_lun->size_bytes; - req->status = CTL_LUN_OK; + req->status = error ? CTL_LUN_WARNING : CTL_LUN_OK; return (0); Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 07:41:37 2014 (r273315) @@ -70,6 +70,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -81,6 +82,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -92,6 +94,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -103,6 +106,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -120,6 +124,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -131,6 +136,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -142,6 +148,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -153,6 +160,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -164,6 +172,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -178,6 +187,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -460,6 +470,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_tagret_port_groups, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -472,6 +483,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_opcodes, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -482,6 +494,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_supported_tmf, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -495,6 +508,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_report_timestamp, CTL_SERIDX_INQ, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN, CTL_LUN_PAT_NONE, @@ -601,6 +615,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0x11, 0, 0, 0xff, 0x07}}, @@ -610,6 +625,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -619,6 +635,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_NONE, CTL_LUN_PAT_NONE, 6, {0, 0, 0, 0, 0x07}}, @@ -633,6 +650,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, @@ -855,6 +873,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_select, CTL_SERIDX_MD_SEL, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x11, 0, 0, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -864,6 +883,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -873,6 +893,7 @@ const struct ctl_cmd_entry ctl_cmd_table CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_OUT, CTL_LUN_PAT_NONE, 10, {0x02, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0x07} }, @@ -887,6 +908,7 @@ const struct ctl_cmd_entry ctl_cmd_table {ctl_mode_sense, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_BOTH | CTL_CMD_FLAG_OK_ON_STOPPED | CTL_CMD_FLAG_OK_ON_INOPERABLE | + CTL_CMD_FLAG_OK_ON_OFFLINE | CTL_CMD_FLAG_OK_ON_SECONDARY | CTL_FLAG_DATA_IN | CTL_CMD_FLAG_ALLOW_ON_PR_RESV, Modified: stable/10/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/sys/cam/ctl/ctl_ioctl.h Mon Oct 20 07:41:37 2014 (r273315) @@ -363,7 +363,8 @@ struct ctl_port_list { typedef enum { CTL_LUN_NOSTATUS, CTL_LUN_OK, - CTL_LUN_ERROR + CTL_LUN_ERROR, + CTL_LUN_WARNING } ctl_lun_status; #define CTL_ERROR_STR_LEN 160 Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:41:37 2014 (r273315) @@ -3174,14 +3174,18 @@ cctl_create_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN creation request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN creation error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN creation request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN creation status: %d", req.status); retval = 1; goto bailout; } @@ -3320,19 +3324,23 @@ cctl_rm_lun(int fd, int argc, char **arg goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN removal request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN removal error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN removal request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN removal status: %d", req.status); retval = 1; goto bailout; } - printf("LUN %d deleted successfully\n", lun_id); + printf("LUN %d removed successfully\n", lun_id); bailout: return (retval); @@ -3397,14 +3405,18 @@ cctl_modify_lun(int fd, int argc, char * goto bailout; } - if (req.status == CTL_LUN_ERROR) { - warnx("%s: error returned from LUN modification request:\n%s", - __func__, req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + warnx("LUN modification error: %s", req.error_str); retval = 1; goto bailout; - } else if (req.status != CTL_LUN_OK) { - warnx("%s: unknown LUN modification request status %d", - __func__, req.status); + case CTL_LUN_WARNING: + warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + warnx("unknown LUN modification status: %d", req.status); retval = 1; goto bailout; } Modified: stable/10/usr.sbin/ctld/kernel.c ============================================================================== --- stable/10/usr.sbin/ctld/kernel.c Mon Oct 20 07:38:36 2014 (r273314) +++ stable/10/usr.sbin/ctld/kernel.c Mon Oct 20 07:41:37 2014 (r273315) @@ -700,20 +700,22 @@ kernel_lun_add(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN creation request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN creation request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN creation error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN creation status: %d", req.status); return (1); } lun_set_ctl_lun(lun, req.reqdata.create.req_lun_id); - return (0); } @@ -735,14 +737,17 @@ kernel_lun_resize(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN modification request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN modification request status %d", + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN modification error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN modification status: %d", req.status); return (1); } @@ -767,14 +772,17 @@ kernel_lun_remove(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN removal request: %s", - req.error_str); - return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN removal request status %d", req.status); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN removal error: %s", req.error_str); + return (1); + case CTL_LUN_WARNING: + log_warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN removal status: %d", req.status); return (1); } From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:52:48 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CFF49D58; Mon, 20 Oct 2014 07:52:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBEFEA9C; Mon, 20 Oct 2014 07:52:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7qmoU083472; Mon, 20 Oct 2014 07:52:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7qm8L083471; Mon, 20 Oct 2014 07:52:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200752.s9K7qm8L083471@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:52:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273316 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:52:48 -0000 Author: mav Date: Mon Oct 20 07:52:48 2014 New Revision: 273316 URL: https://svnweb.freebsd.org/changeset/base/273316 Log: MFC r272935: Mark CTL frontend's CAM driver as CAM_PERIPH_DRV_EARLY. Target mode operation does not depend on the initiator mode scan process. This change allows the target driver to attach earlier and receive some async events (like AC_CONTRACT) that could be lost otherwise. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:41:37 2014 (r273315) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:52:48 2014 (r273316) @@ -224,7 +224,8 @@ static void ctlfe_dump(void); static struct periph_driver ctlfe_driver = { ctlfeperiphinit, "ctl", - TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0 + TAILQ_HEAD_INITIALIZER(ctlfe_driver.units), /*generation*/ 0, + CAM_PERIPH_DRV_EARLY }; static struct ctl_frontend ctlfe_frontend = From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:57:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2FA7AF74; Mon, 20 Oct 2014 07:57:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B597AD5; Mon, 20 Oct 2014 07:57:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7v7Mk084074; Mon, 20 Oct 2014 07:57:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7v7f0084073; Mon, 20 Oct 2014 07:57:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200757.s9K7v7f0084073@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:57:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273317 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:57:08 -0000 Author: mav Date: Mon Oct 20 07:57:07 2014 New Revision: 273317 URL: https://svnweb.freebsd.org/changeset/base/273317 Log: MFC r272938: Filter out duplicate AC_PATH_REGISTERED async events. Queued async events handling in CAM opened race, that may lead to duplicate AC_PATH_REGISTERED events delivery during boot. That was not happening before r272935 because the driver was initialized later. After that change it started create duplicate ports in CTL. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:52:48 2014 (r273316) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:57:07 2014 (r273317) @@ -271,11 +271,19 @@ ctlfeperiphinit(void) static void ctlfeasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) { + struct ctlfe_softc *softc; #ifdef CTLFEDEBUG printf("%s: entered\n", __func__); #endif + mtx_lock(&ctlfe_list_mtx); + STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { + if (softc->path_id == xpt_path_path_id(path)) + break; + } + mtx_unlock(&ctlfe_list_mtx); + /* * When a new path gets registered, and it is capable of target * mode, go ahead and attach. Later on, we may need to be more @@ -284,7 +292,6 @@ ctlfeasync(void *callback_arg, uint32_t switch (code) { case AC_PATH_REGISTERED: { struct ctl_port *port; - struct ctlfe_softc *bus_softc; struct ccb_pathinq *cpi; int retval; @@ -299,6 +306,14 @@ ctlfeasync(void *callback_arg, uint32_t break; } + if (softc != NULL) { +#ifdef CTLFEDEBUG + printf("%s: CTL port for CAM path %u already exists\n", + __func__, xpt_path_path_id(path)); +#endif + break; + } + #ifdef CTLFE_INIT_ENABLE if (ctlfe_num_targets >= ctlfe_max_targets) { union ccb *ccb; @@ -347,25 +362,23 @@ ctlfeasync(void *callback_arg, uint32_t * use M_NOWAIT. Of course this means trouble if we * can't allocate memory. */ - bus_softc = malloc(sizeof(*bus_softc), M_CTLFE, - M_NOWAIT | M_ZERO); - if (bus_softc == NULL) { + softc = malloc(sizeof(*softc), M_CTLFE, M_NOWAIT | M_ZERO); + if (softc == NULL) { printf("%s: unable to malloc %zd bytes for softc\n", - __func__, sizeof(*bus_softc)); + __func__, sizeof(*softc)); return; } - bus_softc->path_id = cpi->ccb_h.path_id; - bus_softc->sim = xpt_path_sim(path); + softc->path_id = cpi->ccb_h.path_id; + softc->sim = xpt_path_sim(path); if (cpi->maxio != 0) - bus_softc->maxio = cpi->maxio; + softc->maxio = cpi->maxio; else - bus_softc->maxio = DFLTPHYS; - mtx_init(&bus_softc->lun_softc_mtx, "LUN softc mtx", NULL, - MTX_DEF); - STAILQ_INIT(&bus_softc->lun_softc_list); + softc->maxio = DFLTPHYS; + mtx_init(&softc->lun_softc_mtx, "LUN softc mtx", NULL, MTX_DEF); + STAILQ_INIT(&softc->lun_softc_list); - port = &bus_softc->port; + port = &softc->port; port->frontend = &ctlfe_frontend; /* @@ -380,21 +393,21 @@ ctlfeasync(void *callback_arg, uint32_t /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; - snprintf(bus_softc->port_name, sizeof(bus_softc->port_name), + snprintf(softc->port_name, sizeof(softc->port_name), "%s%d", cpi->dev_name, cpi->unit_number); /* * XXX KDM it would be nice to allocate storage in the * frontend structure itself. */ - port->port_name = bus_softc->port_name; + port->port_name = softc->port_name; port->physical_port = cpi->unit_number; port->virtual_port = cpi->bus_id; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; - port->onoff_arg = bus_softc; + port->onoff_arg = softc; port->lun_enable = ctlfe_lun_enable; port->lun_disable = ctlfe_lun_disable; - port->targ_lun_arg = bus_softc; + port->targ_lun_arg = softc; port->fe_datamove = ctlfe_datamove_done; port->fe_done = ctlfe_datamove_done; /* @@ -416,35 +429,28 @@ ctlfeasync(void *callback_arg, uint32_t if (retval != 0) { printf("%s: ctl_port_register() failed with " "error %d!\n", __func__, retval); - mtx_destroy(&bus_softc->lun_softc_mtx); - free(bus_softc, M_CTLFE); + mtx_destroy(&softc->lun_softc_mtx); + free(softc, M_CTLFE); break; } else { mtx_lock(&ctlfe_list_mtx); - STAILQ_INSERT_TAIL(&ctlfe_softc_list, bus_softc, links); + STAILQ_INSERT_TAIL(&ctlfe_softc_list, softc, links); mtx_unlock(&ctlfe_list_mtx); } break; } case AC_PATH_DEREGISTERED: { - struct ctlfe_softc *softc = NULL; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - STAILQ_REMOVE(&ctlfe_softc_list, softc, - ctlfe_softc, links); - break; - } - } - mtx_unlock(&ctlfe_list_mtx); if (softc != NULL) { /* * XXX KDM are we certain at this point that there * are no outstanding commands for this frontend? */ + mtx_lock(&ctlfe_list_mtx); + STAILQ_REMOVE(&ctlfe_softc_list, softc, ctlfe_softc, + links); + mtx_unlock(&ctlfe_list_mtx); ctl_port_deregister(&softc->port); mtx_destroy(&softc->lun_softc_mtx); free(softc, M_CTLFE); @@ -459,8 +465,7 @@ ctlfeasync(void *callback_arg, uint32_t switch (ac->contract_number) { case AC_CONTRACT_DEV_CHG: { struct ac_device_changed *dev_chg; - struct ctlfe_softc *softc; - int retval, found; + int retval; dev_chg = (struct ac_device_changed *)ac->contract_data; @@ -469,18 +474,7 @@ ctlfeasync(void *callback_arg, uint32_t xpt_path_path_id(path), dev_chg->target, (dev_chg->arrived == 0) ? "left" : "arrived"); - found = 0; - - mtx_lock(&ctlfe_list_mtx); - STAILQ_FOREACH(softc, &ctlfe_softc_list, links) { - if (softc->path_id == xpt_path_path_id(path)) { - found = 1; - break; - } - } - mtx_unlock(&ctlfe_list_mtx); - - if (found == 0) { + if (softc == NULL) { printf("%s: CTL port for CAM path %u not " "found!\n", __func__, xpt_path_path_id(path)); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:58:02 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB7EC130; Mon, 20 Oct 2014 07:58:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97485ADB; Mon, 20 Oct 2014 07:58:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7w26c084242; Mon, 20 Oct 2014 07:58:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7w2VL084241; Mon, 20 Oct 2014 07:58:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200758.s9K7w2VL084241@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273318 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:58:02 -0000 Author: mav Date: Mon Oct 20 07:58:01 2014 New Revision: 273318 URL: https://svnweb.freebsd.org/changeset/base/273318 Log: MFC r272939: Shorten frontend name. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:57:07 2014 (r273317) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:58:01 2014 (r273318) @@ -230,7 +230,7 @@ static struct periph_driver ctlfe_driver static struct ctl_frontend ctlfe_frontend = { - .name = "camtarget", + .name = "camtgt", .init = ctlfeinitialize, .fe_dump = ctlfe_dump, .shutdown = ctlfeshutdown, From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 07:59:31 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AE3A2A7; Mon, 20 Oct 2014 07:59:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0650AEF; Mon, 20 Oct 2014 07:59:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K7xUWx084466; Mon, 20 Oct 2014 07:59:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K7xU2c084463; Mon, 20 Oct 2014 07:59:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200759.s9K7xU2c084463@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 07:59:30 +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: r273319 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 07:59:31 -0000 Author: mav Date: Mon Oct 20 07:59:29 2014 New Revision: 273319 URL: https://svnweb.freebsd.org/changeset/base/273319 Log: MFC r272947: Give physical and virtual ports numbers some more meaning. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.h stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Mon Oct 20 07:59:29 2014 (r273319) @@ -2000,7 +2000,8 @@ cfiscsi_ioctl_port_create(struct ctl_req /* XXX KDM what should the real number be here? */ port->num_requested_ctl_io = 4096; port->port_name = "iscsi"; - port->virtual_port = strtoul(tag, NULL, 0); + port->physical_port = strtoul(tag, NULL, 0); + port->virtual_port = ct->ct_target_id; port->port_online = cfiscsi_online; port->port_offline = cfiscsi_offline; port->port_info = cfiscsi_info; @@ -2033,7 +2034,7 @@ cfiscsi_ioctl_port_create(struct ctl_req SVPD_ID_TYPE_SCSI_NAME; desc->length = idlen; snprintf(desc->identifier, idlen, "%s,t,0x%4.4x", - target, port->virtual_port); + target, port->physical_port); /* Generate Target ID. */ idlen = strlen(target) + 1; @@ -2261,6 +2262,9 @@ cfiscsi_target_find_or_create(struct cfi strlcpy(newct->ct_alias, alias, sizeof(newct->ct_alias)); refcount_init(&newct->ct_refcount, 1); newct->ct_softc = softc; + if (TAILQ_EMPTY(&softc->targets)) + softc->last_target_id = 0; + newct->ct_target_id = ++softc->last_target_id; TAILQ_INSERT_TAIL(&softc->targets, newct, ct_next); mtx_unlock(&softc->lock); Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h Mon Oct 20 07:59:29 2014 (r273319) @@ -45,6 +45,7 @@ struct cfiscsi_target { char ct_alias[CTL_ISCSI_ALIAS_LEN]; int ct_state; int ct_online; + int ct_target_id; struct ctl_port ct_port; }; @@ -110,6 +111,7 @@ struct cfiscsi_softc { struct mtx lock; char port_name[32]; int online; + int last_target_id; unsigned int last_session_id; TAILQ_HEAD(, cfiscsi_target) targets; TAILQ_HEAD(, cfiscsi_session) sessions; Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:58:01 2014 (r273318) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 07:59:29 2014 (r273319) @@ -400,8 +400,8 @@ ctlfeasync(void *callback_arg, uint32_t * frontend structure itself. */ port->port_name = softc->port_name; - port->physical_port = cpi->unit_number; - port->virtual_port = cpi->bus_id; + port->physical_port = cpi->bus_id; + port->virtual_port = 0; port->port_online = ctlfe_online; port->port_offline = ctlfe_offline; port->onoff_arg = softc; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:03:24 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E5515F1; Mon, 20 Oct 2014 08:03:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F1B2BE4; Mon, 20 Oct 2014 08:03:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K83ORw088552; Mon, 20 Oct 2014 08:03:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K83NAs088549; Mon, 20 Oct 2014 08:03:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200803.s9K83NAs088549@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273320 - in stable/10: sys/cam/ctl usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:03:24 -0000 Author: mav Date: Mon Oct 20 08:03:23 2014 New Revision: 273320 URL: https://svnweb.freebsd.org/changeset/base/273320 Log: MFC r272978: Improve and document `ctladm portlist` subcommand. Make this subcommand less FC-specific, reporting target and port addresses in more generic way. Also make it report list of connected initiators in unified way, working for both FC and iSCSI, and potentially others. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/usr.sbin/ctladm/ctladm.8 stable/10/usr.sbin/ctladm/ctladm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:03:23 2014 (r273320) @@ -2239,6 +2239,43 @@ ctl_sbuf_printf_esc(struct sbuf *sb, cha return (retval); } +static void +ctl_id_sbuf(struct ctl_devid *id, struct sbuf *sb) +{ + struct scsi_vpd_id_descriptor *desc; + int i; + + if (id == NULL || id->len < 4) + return; + desc = (struct scsi_vpd_id_descriptor *)id->data; + switch (desc->id_type & SVPD_ID_TYPE_MASK) { + case SVPD_ID_TYPE_T10: + sbuf_printf(sb, "t10."); + break; + case SVPD_ID_TYPE_EUI64: + sbuf_printf(sb, "eui."); + break; + case SVPD_ID_TYPE_NAA: + sbuf_printf(sb, "naa."); + break; + case SVPD_ID_TYPE_SCSI_NAME: + break; + } + switch (desc->proto_codeset & SVPD_ID_CODESET_MASK) { + case SVPD_ID_CODESET_BINARY: + for (i = 0; i < desc->length; i++) + sbuf_printf(sb, "%02x", desc->identifier[i]); + break; + case SVPD_ID_CODESET_ASCII: + sbuf_printf(sb, "%.*s", (int)desc->length, + (char *)desc->identifier); + break; + case SVPD_ID_CODESET_UTF8: + sbuf_printf(sb, "%s", (char *)desc->identifier); + break; + } +} + static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) @@ -3290,6 +3327,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, struct ctl_port *port; struct ctl_lun_list *list; struct ctl_option *opt; + int j; list = (struct ctl_lun_list *)addr; @@ -3346,15 +3384,17 @@ ctl_ioctl(struct cdev *dev, u_long cmd, if (retval != 0) break; - retval = sbuf_printf(sb, "\t%#jx\n", - (uintmax_t)port->wwnn); - if (retval != 0) - break; + if (port->target_devid != NULL) { + sbuf_printf(sb, "\t"); + ctl_id_sbuf(port->target_devid, sb); + sbuf_printf(sb, "\n"); + } - retval = sbuf_printf(sb, "\t%#jx\n", - (uintmax_t)port->wwpn); - if (retval != 0) - break; + if (port->port_devid != NULL) { + sbuf_printf(sb, "\t"); + ctl_id_sbuf(port->port_devid, sb); + sbuf_printf(sb, "\n"); + } if (port->port_info != NULL) { retval = port->port_info(port->onoff_arg, sb); @@ -3368,6 +3408,26 @@ ctl_ioctl(struct cdev *dev, u_long cmd, break; } + for (j = 0; j < CTL_MAX_INIT_PER_PORT; j++) { + if (port->wwpn_iid[j].in_use == 0 || + (port->wwpn_iid[j].wwpn == 0 && + port->wwpn_iid[j].name == NULL)) + continue; + + if (port->wwpn_iid[j].name != NULL) + retval = sbuf_printf(sb, + "\t%u %s\n", + j, port->wwpn_iid[j].name); + else + retval = sbuf_printf(sb, + "\t%u naa.%08jx\n", + j, port->wwpn_iid[j].wwpn); + if (retval != 0) + break; + } + if (retval != 0) + break; + retval = sbuf_printf(sb, "\n"); if (retval != 0) break; Modified: stable/10/usr.sbin/ctladm/ctladm.8 ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/usr.sbin/ctladm/ctladm.8 Mon Oct 20 08:03:23 2014 (r273320) @@ -34,7 +34,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd October 8, 2014 +.Dd October 12, 2014 .Dt CTLADM 8 .Os .Sh NAME @@ -193,6 +193,14 @@ .Op Fl q .Op Fl x .Nm +.Ic portlist +.Op Fl f Ar frontend +.Op Fl i +.Op Fl p Ar targ_port +.Op Fl q +.Op Fl v +.Op Fl x +.Nm .Ic dumpooa .Nm .Ic dumpstructs @@ -768,6 +776,22 @@ As a general rule, the WWPN must be diff .It Fl x Output the port list in XML format. .El +.It Ic portlist +List CTL frontend ports. +.Bl -tag -width 12n +.It Fl f Ar frontend +Specify the frontend type. +.It Fl i +Report target and connected initiators addresses +.It Fl p Ar targ_port +Specify the frontend port number. +.It Fl q +Omit the header in the port list output. +.It Fl v +Enable verbose output (report all port options). +.It Fl x +Output the port list in XML format. +.El .It Ic dumpooa Dump the OOA (Order Of Arrival) queue for each LUN registered with CTL. .It Ic dumpstructs Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 07:59:29 2014 (r273319) +++ stable/10/usr.sbin/ctladm/ctladm.c Mon Oct 20 08:03:23 2014 (r273320) @@ -191,7 +191,7 @@ static struct ctladm_opts option_table[] {"modesense", CTLADM_CMD_MODESENSE, CTLADM_ARG_NEED_TL, "P:S:dlm:c:"}, {"modify", CTLADM_CMD_MODIFY, CTLADM_ARG_NONE, "b:l:s:"}, {"port", CTLADM_CMD_PORT, CTLADM_ARG_NONE, "lo:p:qt:w:W:x"}, - {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:vx"}, + {"portlist", CTLADM_CMD_PORTLIST, CTLADM_ARG_NONE, "f:ip:qvx"}, {"prin", CTLADM_CMD_PRES_IN, CTLADM_ARG_NEED_TL, "a:"}, {"prout", CTLADM_CMD_PRES_OUT, CTLADM_ARG_NEED_TL, "a:k:r:s:"}, {"read", CTLADM_CMD_READ, CTLADM_ARG_NEED_TL, rw_opts}, @@ -4100,7 +4100,8 @@ struct cctl_port { char *frontend_type; char *name; int pp, vp; - char *wwnn, *wwpn; + char *target, *port; + STAILQ_HEAD(,cctl_lun_nv) init_list; STAILQ_HEAD(,cctl_lun_nv) attr_list; STAILQ_ENTRY(cctl_port) links; }; @@ -4144,6 +4145,7 @@ cctl_start_pelement(void *user_data, con portlist->num_ports++; portlist->cur_port = cur_port; + STAILQ_INIT(&cur_port->init_list); STAILQ_INIT(&cur_port->attr_list); STAILQ_INSERT_TAIL(&portlist->port_list, cur_port, links); @@ -4205,11 +4207,11 @@ cctl_end_pelement(void *user_data, const cur_port->pp = strtoull(str, NULL, 0); } else if (strcmp(name, "virtual_port") == 0) { cur_port->vp = strtoull(str, NULL, 0); - } else if (strcmp(name, "wwnn") == 0) { - cur_port->wwnn = str; + } else if (strcmp(name, "target") == 0) { + cur_port->target = str; str = NULL; - } else if (strcmp(name, "wwpn") == 0) { - cur_port->wwpn = str; + } else if (strcmp(name, "port") == 0) { + cur_port->port = str; str = NULL; } else if (strcmp(name, "targ_port") == 0) { portlist->cur_port = NULL; @@ -4230,7 +4232,10 @@ cctl_end_pelement(void *user_data, const nv->value = str; str = NULL; - STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links); + if (strcmp(name, "initiator") == 0) + STAILQ_INSERT_TAIL(&cur_port->init_list, nv, links); + else + STAILQ_INSERT_TAIL(&cur_port->attr_list, nv, links); } free(str); @@ -4258,7 +4263,8 @@ cctl_portlist(int fd, int argc, char **a int dump_xml = 0; int retval, c; char *frontend = NULL; - int verbose = 0; + uint64_t portarg = UINT64_MAX; + int verbose = 0, init = 0, quiet = 0; retval = 0; port_len = 4096; @@ -4271,6 +4277,15 @@ cctl_portlist(int fd, int argc, char **a case 'f': frontend = strdup(optarg); break; + case 'i': + init++; + break; + case 'p': + portarg = strtoll(optarg, NULL, 0); + break; + case 'q': + quiet++; + break; case 'v': verbose++; break; @@ -4327,8 +4342,8 @@ retry: goto bailout; } - printf("Port Online Frontend %-12s pp vp %-18s %-18s\n", - "Name", "WWNN", "WWPN"); + if (quiet == 0) + printf("Port Online Frontend Name pp vp\n"); STAILQ_FOREACH(port, &portlist.port_list, links) { struct cctl_lun_nv *nv; @@ -4336,16 +4351,26 @@ retry: && (strcmp(port->frontend_type, frontend) != 0)) continue; - printf("%-4ju %-6s %-8s %-12s %-2d %-2d %-18s %-18s\n", + if ((portarg != UINT64_MAX) && (portarg != port->port_id)) + continue; + + printf("%-4ju %-6s %-8s %-8s %-2d %-2d %s\n", (uintmax_t)port->port_id, port->online, port->frontend_type, port->name, port->pp, port->vp, - port->wwnn, port->wwpn); + port->port ? port->port : ""); - if (verbose == 0) - continue; + if (init || verbose) { + if (port->target) + printf(" Target: %s\n", port->target); + STAILQ_FOREACH(nv, &port->init_list, links) { + printf(" Initiator: %s\n", nv->value); + } + } - STAILQ_FOREACH(nv, &port->attr_list, links) { - printf(" %s=%s\n", nv->name, nv->value); + if (verbose) { + STAILQ_FOREACH(nv, &port->attr_list, links) { + printf(" %s=%s\n", nv->name, nv->value); + } } } bailout: @@ -4401,7 +4426,7 @@ usage(int error) " [-s len fmt [args]] [-c] [-d delete_id]\n" " ctladm port <-l | -o | [-w wwnn][-W wwpn]>\n" " [-p targ_port] [-t port_type] [-q] [-x]\n" -" ctladm portlist [-f frontend] [-v] [-x]\n" +" ctladm portlist [-f frontend] [-i] [-p targ_port] [-q] [-v] [-x]\n" " ctladm islist [-v | -x]\n" " ctladm islogout <-a | -c connection-id | -i name | -p portal>\n" " ctladm isterminate <-a | -c connection-id | -i name | -p portal>\n" @@ -4487,6 +4512,13 @@ usage(int error) "-p targ_port : specify target port number\n" "-q : omit header in list output\n" "-x : output port list in XML format\n" +"portlist options:\n" +"-f fronetnd : specify frontend type\n" +"-i : report target and initiators addresses\n" +"-p targ_port : specify target port number\n" +"-q : omit header in list output\n" +"-v : verbose output (report all port options)\n" +"-x : output port list in XML format\n" "bbrread options:\n" "-l lba : starting LBA\n" "-d datalen : length, in bytes, to read\n", From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:04:47 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 599B372D; Mon, 20 Oct 2014 08:04:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45A64BED; Mon, 20 Oct 2014 08:04:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K84lDo088768; Mon, 20 Oct 2014 08:04:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K84lU5088767; Mon, 20 Oct 2014 08:04:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200804.s9K84lU5088767@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:04:47 +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: r273321 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:04:47 -0000 Author: mav Date: Mon Oct 20 08:04:46 2014 New Revision: 273321 URL: https://svnweb.freebsd.org/changeset/base/273321 Log: MFC r273008: Remove stale comments. Modified: stable/10/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 08:03:23 2014 (r273320) +++ stable/10/sys/cam/ctl/scsi_ctl.c Mon Oct 20 08:04:46 2014 (r273321) @@ -1513,11 +1513,6 @@ ctlfedone(struct cam_periph *periph, uni case CAM_MESSAGE_RECV: switch (inot->arg) { case MSG_ABORT_TASK_SET: - /* - * XXX KDM this isn't currently - * supported by CTL. It ends up - * being a no-op. - */ io->taskio.task_action = CTL_TASK_ABORT_TASK_SET; break; @@ -1534,11 +1529,6 @@ ctlfedone(struct cam_periph *periph, uni CTL_TASK_LUN_RESET; break; case MSG_CLEAR_TASK_SET: - /* - * XXX KDM this isn't currently - * supported by CTL. It ends up - * being a no-op. - */ io->taskio.task_action = CTL_TASK_CLEAR_TASK_SET; break; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:06:18 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 509C487C; Mon, 20 Oct 2014 08:06:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 228FABFA; Mon, 20 Oct 2014 08:06:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K86I1h089041; Mon, 20 Oct 2014 08:06:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K86IYm089040; Mon, 20 Oct 2014 08:06:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200806.s9K86IYm089040@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:06:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273322 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:06:18 -0000 Author: mav Date: Mon Oct 20 08:06:17 2014 New Revision: 273322 URL: https://svnweb.freebsd.org/changeset/base/273322 Log: MFC r273029: Report physical block size for file-backed LUNs, using vattr.va_blocksize. Modified: stable/10/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 08:04:46 2014 (r273321) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 20 08:06:17 2014 (r273322) @@ -1545,6 +1545,7 @@ ctl_be_block_open_file(struct ctl_be_blo struct ctl_be_block_filedata *file_data; struct ctl_lun_create_params *params; struct vattr vattr; + off_t pss; int error; error = 0; @@ -1593,21 +1594,21 @@ ctl_be_block_open_file(struct ctl_be_blo be_lun->flags |= CTL_BE_BLOCK_LUN_MULTI_THREAD; /* - * XXX KDM vattr.va_blocksize may be larger than 512 bytes here. - * With ZFS, it is 131072 bytes. Block sizes that large don't work - * with disklabel and UFS on FreeBSD at least. Large block sizes - * may not work with other OSes as well. So just export a sector - * size of 512 bytes, which should work with any OS or - * application. Since our backing is a file, any block size will - * work fine for the backing store. + * For files we can use any logical block size. Prefer 512 bytes + * for compatibility reasons. If file's vattr.va_blocksize + * (preferred I/O block size) is bigger and multiple to chosen + * logical block size -- report it as physical block size. */ -#if 0 - be_lun->blocksize= vattr.va_blocksize; -#endif if (params->blocksize_bytes != 0) be_lun->blocksize = params->blocksize_bytes; else be_lun->blocksize = 512; + pss = vattr.va_blocksize / be_lun->blocksize; + if ((pss > 0) && (pss * be_lun->blocksize == vattr.va_blocksize) && + ((pss & (pss - 1)) == 0)) { + be_lun->pblockexp = fls(pss) - 1; + be_lun->pblockoff = 0; + } /* * Sanity check. The media size has to be at least one From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:07:31 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 961B59AA; Mon, 20 Oct 2014 08:07:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81975C06; Mon, 20 Oct 2014 08:07:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K87VA2089253; Mon, 20 Oct 2014 08:07:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K87UtX089249; Mon, 20 Oct 2014 08:07:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200807.s9K87UtX089249@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:07:30 +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: r273323 - in stable/10/sys/cam: ctl scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:07:31 -0000 Author: mav Date: Mon Oct 20 08:07:29 2014 New Revision: 273323 URL: https://svnweb.freebsd.org/changeset/base/273323 Log: MFC r273038: Add support for READ DEFECT DATA (10/12) commands. SPC-4 r2 allows to return empty defect list if the list is not supported. We don't reallu support defect data lists, but this suppresses some errors. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_cmd_table.c stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/scsi/scsi_da.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:07:29 2014 (r273323) @@ -7391,6 +7391,89 @@ ctl_read_capacity_16(struct ctl_scsiio * } int +ctl_read_defect(struct ctl_scsiio *ctsio) +{ + struct scsi_read_defect_data_10 *ccb10; + struct scsi_read_defect_data_12 *ccb12; + struct scsi_read_defect_data_hdr_10 *data10; + struct scsi_read_defect_data_hdr_12 *data12; + struct ctl_lun *lun; + uint32_t alloc_len, data_len; + uint8_t format; + + CTL_DEBUG_PRINT(("ctl_read_defect\n")); + + lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + if (lun->flags & CTL_LUN_PR_RESERVED) { + uint32_t residx; + + /* + * XXX KDM need a lock here. + */ + residx = ctl_get_resindex(&ctsio->io_hdr.nexus); + if ((lun->res_type == SPR_TYPE_EX_AC + && residx != lun->pr_res_idx) + || ((lun->res_type == SPR_TYPE_EX_AC_RO + || lun->res_type == SPR_TYPE_EX_AC_AR) + && lun->pr_keys[residx] == 0)) { + ctl_set_reservation_conflict(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + } + + if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { + ccb10 = (struct scsi_read_defect_data_10 *)&ctsio->cdb; + format = ccb10->format; + alloc_len = scsi_2btoul(ccb10->alloc_length); + data_len = sizeof(*data10); + } else { + ccb12 = (struct scsi_read_defect_data_12 *)&ctsio->cdb; + format = ccb12->format; + alloc_len = scsi_4btoul(ccb12->alloc_length); + data_len = sizeof(*data12); + } + if (alloc_len == 0) { + ctl_set_success(ctsio); + ctl_done((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); + } + + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; + } else { + ctsio->residual = 0; + ctsio->kern_data_len = alloc_len; + ctsio->kern_total_len = alloc_len; + } + ctsio->kern_data_resid = 0; + ctsio->kern_rel_offset = 0; + ctsio->kern_sg_entries = 0; + + if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { + data10 = (struct scsi_read_defect_data_hdr_10 *) + ctsio->kern_data_ptr; + data10->format = format; + scsi_ulto2b(0, data10->length); + } else { + data12 = (struct scsi_read_defect_data_hdr_12 *) + ctsio->kern_data_ptr; + data12->format = format; + scsi_ulto2b(0, data12->generation); + scsi_ulto4b(0, data12->length); + } + + ctsio->scsi_status = SCSI_STATUS_OK; + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); + return (CTL_RETVAL_COMPLETE); +} + +int ctl_report_tagret_port_groups(struct ctl_scsiio *ctsio) { struct scsi_maintenance_in *cdb; Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl_cmd_table.c Mon Oct 20 08:07:29 2014 (r273323) @@ -768,7 +768,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* 37 READ DEFECT DATA(10) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 10, {0, 0x1f, 0, 0, 0, 0, 0xff, 0xff, 0x07}}, /* 38 MEDIUM SCAN */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, @@ -1247,7 +1251,11 @@ const struct ctl_cmd_entry ctl_cmd_table {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, /* B7 READ DEFECT DATA(12) */ -{NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, +{ctl_read_defect, CTL_SERIDX_MD_SNS, CTL_CMD_FLAG_OK_ON_SLUN | + CTL_FLAG_DATA_IN | + CTL_CMD_FLAG_ALLOW_ON_PR_RESV, + CTL_LUN_PAT_NONE, + 12, {0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}}, /* B8 READ ELEMENT STATUS */ {NULL, CTL_SERIDX_INVLD, CTL_CMD_FLAG_NONE, CTL_LUN_PAT_NONE}, Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/ctl/ctl_private.h Mon Oct 20 08:07:29 2014 (r273323) @@ -486,6 +486,7 @@ int ctl_mode_select(struct ctl_scsiio *c int ctl_mode_sense(struct ctl_scsiio *ctsio); int ctl_read_capacity(struct ctl_scsiio *ctsio); int ctl_read_capacity_16(struct ctl_scsiio *ctsio); +int ctl_read_defect(struct ctl_scsiio *ctsio); int ctl_read_write(struct ctl_scsiio *ctsio); int ctl_cnw(struct ctl_scsiio *ctsio); int ctl_report_luns(struct ctl_scsiio *ctsio); Modified: stable/10/sys/cam/scsi/scsi_da.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:06:17 2014 (r273322) +++ stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:07:29 2014 (r273323) @@ -92,28 +92,19 @@ struct scsi_reassign_blocks struct scsi_read_defect_data_10 { - u_int8_t opcode; - - /* - * The most significant 3 bits are the LUN, the other 5 are - * reserved. - */ -#define SRDD10_LUN_MASK 0xE0 - u_int8_t byte2; + uint8_t opcode; + uint8_t byte2; #define SRDD10_GLIST 0x08 #define SRDD10_PLIST 0x10 #define SRDD10_DLIST_FORMAT_MASK 0x07 #define SRDD10_BLOCK_FORMAT 0x00 #define SRDD10_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDD10_PHYSICAL_SECTOR_FORMAT 0x05 - u_int8_t format; - - u_int8_t reserved[4]; - - u_int8_t alloc_length[2]; + uint8_t format; + uint8_t reserved[4]; + uint8_t alloc_length[2]; #define SRDD10_MAX_LENGTH 0xffff - - u_int8_t control; + uint8_t control; }; struct scsi_sanitize @@ -143,29 +134,18 @@ struct scsi_sanitize_parameter_list struct scsi_read_defect_data_12 { - u_int8_t opcode; - - /* - * The most significant 3 bits are the LUN, the other 5 are - * reserved. - */ -#define SRDD12_LUN_MASK 0xE0 - u_int8_t byte2; - + uint8_t opcode; #define SRDD12_GLIST 0x08 #define SRDD12_PLIST 0x10 #define SRDD12_DLIST_FORMAT_MASK 0x07 #define SRDD12_BLOCK_FORMAT 0x00 #define SRDD12_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDD12_PHYSICAL_SECTOR_FORMAT 0x05 - u_int8_t format; - - u_int8_t reserved[4]; - - u_int8_t alloc_length[4]; - - u_int8_t control; - + uint8_t format; + uint8_t address_descriptor_index[4]; + uint8_t alloc_length[4]; + uint8_t reserved; + uint8_t control; }; @@ -376,6 +356,7 @@ struct scsi_read_defect_data_hdr_12 #define SRDDH12_BYTES_FROM_INDEX_FORMAT 0x04 #define SRDDH12_PHYSICAL_SECTOR_FORMAT 0x05 u_int8_t format; + u_int8_t generation[2]; u_int8_t length[4]; }; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:08:44 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F29E7B1C; Mon, 20 Oct 2014 08:08:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEB56C18; Mon, 20 Oct 2014 08:08:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K88hEQ089459; Mon, 20 Oct 2014 08:08:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K88htU089458; Mon, 20 Oct 2014 08:08:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200808.s9K88htU089458@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:08:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273324 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:08:44 -0000 Author: mav Date: Mon Oct 20 08:08:43 2014 New Revision: 273324 URL: https://svnweb.freebsd.org/changeset/base/273324 Log: MFC r273046: Don't confuse frontend with zero length data moves, just return immediately. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:07:29 2014 (r273323) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 20 08:08:43 2014 (r273324) @@ -10823,15 +10823,9 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio } ctsio->scsi_status = SCSI_STATUS_OK; - if (ctsio->kern_data_len > 0) { - ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; - ctsio->be_move_done = ctl_config_move_done; - ctl_datamove((union ctl_io *)ctsio); - } else { - ctsio->io_hdr.status = CTL_SUCCESS; - ctl_done((union ctl_io *)ctsio); - } - + ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; + ctsio->be_move_done = ctl_config_move_done; + ctl_datamove((union ctl_io *)ctsio); return (CTL_RETVAL_COMPLETE); } @@ -12903,6 +12897,12 @@ ctl_datamove(union ctl_io *io) return; } + /* Don't confuse frontend with zero length data move. */ + if (io->scsiio.kern_data_len == 0) { + io->scsiio.be_move_done(io); + return; + } + /* * If we're in XFER mode and this I/O is from the other shelf * controller, we need to send the DMA to the other side to From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:09:37 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA49FC52; Mon, 20 Oct 2014 08:09:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9659FC21; Mon, 20 Oct 2014 08:09:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K89b4t089982; Mon, 20 Oct 2014 08:09:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K89bPZ089980; Mon, 20 Oct 2014 08:09:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410200809.s9K89bPZ089980@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 08:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273325 - in stable/10: share/misc sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:09:37 -0000 Author: mav Date: Mon Oct 20 08:09:36 2014 New Revision: 273325 URL: https://svnweb.freebsd.org/changeset/base/273325 Log: MFC r273072: Add LBPERE mode bit definition. Modified: stable/10/share/misc/scsi_modes stable/10/sys/cam/scsi/scsi_da.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/misc/scsi_modes ============================================================================== --- stable/10/share/misc/scsi_modes Mon Oct 20 08:08:43 2014 (r273324) +++ stable/10/share/misc/scsi_modes Mon Oct 20 08:09:36 2014 (r273325) @@ -223,7 +223,8 @@ {Correction Span} i1 {Head Offset Count} i1 {Data Strobe Offset Count} i1 - {Reserved} *i1 + {LBPERE (LBP Error Reporting Enabled)} t1 + {Reserved} *t7 {Write Retry Count} i1 {Reserved} *i1 {Recovery Time Limit} i2 Modified: stable/10/sys/cam/scsi/scsi_da.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:08:43 2014 (r273324) +++ stable/10/sys/cam/scsi/scsi_da.h Mon Oct 20 08:09:36 2014 (r273325) @@ -527,7 +527,8 @@ struct scsi_da_rw_recovery_page { u_int8_t correction_span; u_int8_t head_offset_count; u_int8_t data_strobe_offset_cnt; - u_int8_t reserved; + u_int8_t byte8; +#define SMS_RWER_LBPERE 0x80 u_int8_t write_retry_count; u_int8_t reserved2; u_int8_t recovery_time_limit[2]; From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 08:59:31 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3BA72CAA; Mon, 20 Oct 2014 08:59:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EF1515B; Mon, 20 Oct 2014 08:59:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K8xU2g015378; Mon, 20 Oct 2014 08:59:30 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K8xUvP015377; Mon, 20 Oct 2014 08:59:30 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410200859.s9K8xUvP015377@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Mon, 20 Oct 2014 08:59:30 +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: r273326 - stable/10/contrib/openpam/lib/libpam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 08:59:31 -0000 Author: des Date: Mon Oct 20 08:59:30 2014 New Revision: 273326 URL: https://svnweb.freebsd.org/changeset/base/273326 Log: MFH (r273273): Merge upstream r825: fix line continuation in whitespace Modified: stable/10/contrib/openpam/lib/libpam/openpam_readword.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/openpam/lib/libpam/openpam_readword.c ============================================================================== --- stable/10/contrib/openpam/lib/libpam/openpam_readword.c Mon Oct 20 08:09:36 2014 (r273325) +++ stable/10/contrib/openpam/lib/libpam/openpam_readword.c Mon Oct 20 08:59:30 2014 (r273326) @@ -55,18 +55,35 @@ openpam_readword(FILE *f, int *lineno, s { char *word; size_t size, len; - int ch, comment, escape, quote; + int ch, escape, quote; int serrno; errno = 0; /* skip initial whitespace */ - comment = 0; - while ((ch = getc(f)) != EOF && ch != '\n') { - if (ch == '#') - comment = 1; - if (!is_lws(ch) && !comment) + escape = quote = 0; + while ((ch = getc(f)) != EOF) { + if (ch == '\n') { + /* either EOL or line continuation */ + if (!escape) + break; + if (lineno != NULL) + ++*lineno; + escape = 0; + } else if (escape) { + /* escaped something else */ + break; + } else if (ch == '#') { + /* comment: until EOL, no continuation */ + while ((ch = getc(f)) != EOF) + if (ch == '\n') + break; break; + } else if (ch == '\\') { + escape = 1; + } else if (!is_ws(ch)) { + break; + } } if (ch == EOF) return (NULL); @@ -76,7 +93,6 @@ openpam_readword(FILE *f, int *lineno, s word = NULL; size = len = 0; - escape = quote = 0; while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { if (ch == '\\' && !escape && quote != '\'') { /* escape next character */ @@ -90,7 +106,7 @@ openpam_readword(FILE *f, int *lineno, s } else if (ch == quote && !escape) { /* end quote */ quote = 0; - } else if (ch == '\n' && escape && quote != '\'') { + } else if (ch == '\n' && escape) { /* line continuation */ escape = 0; } else { From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 18:53:55 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C5071DE; Mon, 20 Oct 2014 18:53:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4813BA03; Mon, 20 Oct 2014 18:53:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KIrtnv039629; Mon, 20 Oct 2014 18:53:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KIrtlC039628; Mon, 20 Oct 2014 18:53:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410201853.s9KIrtlC039628@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 18:53:55 +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: r273340 - stable/10/lib/libc/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 18:53:55 -0000 Author: delphij Date: Mon Oct 20 18:53:54 2014 New Revision: 273340 URL: https://svnweb.freebsd.org/changeset/base/273340 Log: MFC r272884: accept(2) may and can return EAGAIN, document it. Modified: stable/10/lib/libc/sys/accept.2 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/accept.2 ============================================================================== --- stable/10/lib/libc/sys/accept.2 Mon Oct 20 18:33:34 2014 (r273339) +++ stable/10/lib/libc/sys/accept.2 Mon Oct 20 18:53:54 2014 (r273340) @@ -28,7 +28,7 @@ .\" @(#)accept.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd October 9, 2014 .Dt ACCEPT 2 .Os .Sh NAME @@ -201,7 +201,7 @@ The .Fa addr argument is not in a writable part of the user address space. -.It Bq Er EWOULDBLOCK +.It Bo Er EWOULDBLOCK Bc or Bq Er EAGAIN The socket is marked non-blocking and no connections are present to be accepted. .It Bq Er ECONNABORTED From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 18:58:47 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5ED4A39E; Mon, 20 Oct 2014 18:58:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3FFF0A4F; Mon, 20 Oct 2014 18:58:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KIwlNF040308; Mon, 20 Oct 2014 18:58:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KIwkXf040300; Mon, 20 Oct 2014 18:58:46 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410201858.s9KIwkXf040300@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 18:58:46 +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: r273341 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 18:58:47 -0000 Author: delphij Date: Mon Oct 20 18:58:45 2014 New Revision: 273341 URL: https://svnweb.freebsd.org/changeset/base/273341 Log: MFC r272504: MFV r272494: Make space_map_truncate() always do space_map_reallocate(). Without this, setting space_map_max_blksz would cause panic for existing pool, as dmu_objset_set_blocksize would fail if the object have multiple blocks. Illumos issues: 5164 space_map_max_blksz causes panic, does not work 5165 zdb fails assertion when run on pool with recently-enabled spacemap_histogram feature Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c Mon Oct 20 18:58:45 2014 (r273341) @@ -77,7 +77,7 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, condense_ /* * Condensing a metaslab is not guaranteed to actually reduce the amount of * space used on disk. In particular, a space map uses data in increments of - * MAX(1 << ashift, SPACE_MAP_INITIAL_BLOCKSIZE), so a metaslab might use the + * MAX(1 << ashift, space_map_blksize), so a metaslab might use the * same number of blocks after condensing. Since the goal of condensing is to * reduce the number of IOPs required to read the space map, we only want to * condense when we can be sure we will reduce the number of blocks used by the @@ -1491,10 +1491,12 @@ metaslab_fragmentation(metaslab_t *msp) uint64_t txg = spa_syncing_txg(spa); vdev_t *vd = msp->ms_group->mg_vd; - msp->ms_condense_wanted = B_TRUE; - vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); - spa_dbgmsg(spa, "txg %llu, requesting force condense: " - "msp %p, vd %p", txg, msp, vd); + if (spa_writeable(spa)) { + msp->ms_condense_wanted = B_TRUE; + vdev_dirty(vd, VDD_METASLAB, msp, txg + 1); + spa_dbgmsg(spa, "txg %llu, requesting force condense: " + "msp %p, vd %p", txg, msp, vd); + } return (ZFS_FRAG_INVALID); } @@ -1938,6 +1940,15 @@ metaslab_sync(metaslab_t *msp, uint64_t mutex_enter(&msp->ms_lock); + /* + * Note: metaslab_condense() clears the space_map's histogram. + * Therefore we must verify and remove this histogram before + * condensing. + */ + metaslab_group_histogram_verify(mg); + metaslab_class_histogram_verify(mg->mg_class); + metaslab_group_histogram_remove(mg, msp); + if (msp->ms_loaded && spa_sync_pass(spa) == 1 && metaslab_should_condense(msp)) { metaslab_condense(msp, txg, tx); @@ -1946,9 +1957,6 @@ metaslab_sync(metaslab_t *msp, uint64_t space_map_write(msp->ms_sm, *freetree, SM_FREE, tx); } - metaslab_group_histogram_verify(mg); - metaslab_class_histogram_verify(mg->mg_class); - metaslab_group_histogram_remove(mg, msp); if (msp->ms_loaded) { /* * When the space map is loaded, we have an accruate Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Mon Oct 20 18:58:45 2014 (r273341) @@ -38,15 +38,12 @@ #include /* - * This value controls how the space map's block size is allowed to grow. - * If the value is set to the same size as SPACE_MAP_INITIAL_BLOCKSIZE then - * the space map block size will remain fixed. Setting this value to something - * greater than SPACE_MAP_INITIAL_BLOCKSIZE will allow the space map to - * increase its block size as needed. To maintain backwards compatibilty the - * space map's block size must be a power of 2 and SPACE_MAP_INITIAL_BLOCKSIZE - * or larger. + * The data for a given space map can be kept on blocks of any size. + * Larger blocks entail fewer i/o operations, but they also cause the + * DMU to keep more data in-core, and also to waste more i/o bandwidth + * when only a few blocks have changed since the last transaction group. */ -int space_map_max_blksz = (1 << 12); +int space_map_blksz = (1 << 12); /* * Load the space map disk into the specified range tree. Segments of maptype @@ -233,58 +230,6 @@ space_map_entries(space_map_t *sm, range return (entries); } -void -space_map_set_blocksize(space_map_t *sm, uint64_t size, dmu_tx_t *tx) -{ - uint32_t blksz; - u_longlong_t blocks; - - ASSERT3U(sm->sm_blksz, !=, 0); - ASSERT3U(space_map_object(sm), !=, 0); - ASSERT(sm->sm_dbuf != NULL); - VERIFY(ISP2(space_map_max_blksz)); - - if (sm->sm_blksz >= space_map_max_blksz) - return; - - /* - * The object contains more than one block so we can't adjust - * its size. - */ - if (sm->sm_phys->smp_objsize > sm->sm_blksz) - return; - - if (size > sm->sm_blksz) { - uint64_t newsz; - - /* - * Older software versions treat space map blocks as fixed - * entities. The DMU is capable of handling different block - * sizes making it possible for us to increase the - * block size and maintain backwards compatibility. The - * caveat is that the new block sizes must be a - * power of 2 so that old software can append to the file, - * adding more blocks. The block size can grow until it - * reaches space_map_max_blksz. - */ - newsz = ISP2(size) ? size : 1ULL << highbit64(size); - if (newsz > space_map_max_blksz) - newsz = space_map_max_blksz; - - VERIFY0(dmu_object_set_blocksize(sm->sm_os, - space_map_object(sm), newsz, 0, tx)); - dmu_object_size_from_db(sm->sm_dbuf, &blksz, &blocks); - - zfs_dbgmsg("txg %llu, spa %s, increasing blksz from %d to %d", - dmu_tx_get_txg(tx), spa_name(dmu_objset_spa(sm->sm_os)), - sm->sm_blksz, blksz); - - VERIFY3U(newsz, ==, blksz); - VERIFY3U(sm->sm_blksz, <, blksz); - sm->sm_blksz = blksz; - } -} - /* * Note: space_map_write() will drop sm_lock across dmu_write() calls. */ @@ -298,7 +243,7 @@ space_map_write(space_map_t *sm, range_t range_seg_t *rs; uint64_t size, total, rt_space, nodes; uint64_t *entry, *entry_map, *entry_map_end; - uint64_t newsz, expected_entries, actual_entries = 1; + uint64_t expected_entries, actual_entries = 1; ASSERT(MUTEX_HELD(rt->rt_lock)); ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); @@ -324,13 +269,6 @@ space_map_write(space_map_t *sm, range_t expected_entries = space_map_entries(sm, rt); - /* - * Calculate the new size for the space map on-disk and see if - * we can grow the block size to accommodate the new size. - */ - newsz = sm->sm_phys->smp_objsize + expected_entries * sizeof (uint64_t); - space_map_set_blocksize(sm, newsz, tx); - entry_map = zio_buf_alloc(sm->sm_blksz); entry_map_end = entry_map + (sm->sm_blksz / sizeof (uint64_t)); entry = entry_map; @@ -457,46 +395,48 @@ space_map_close(space_map_t *sm) kmem_free(sm, sizeof (*sm)); } -static void -space_map_reallocate(space_map_t *sm, dmu_tx_t *tx) -{ - ASSERT(dmu_tx_is_syncing(tx)); - - space_map_free(sm, tx); - dmu_buf_rele(sm->sm_dbuf, sm); - - sm->sm_object = space_map_alloc(sm->sm_os, tx); - VERIFY0(space_map_open_impl(sm)); -} - void space_map_truncate(space_map_t *sm, dmu_tx_t *tx) { objset_t *os = sm->sm_os; spa_t *spa = dmu_objset_spa(os); dmu_object_info_t doi; - int bonuslen; ASSERT(dsl_pool_sync_context(dmu_objset_pool(os))); ASSERT(dmu_tx_is_syncing(tx)); - VERIFY0(dmu_free_range(os, space_map_object(sm), 0, -1ULL, tx)); dmu_object_info_from_db(sm->sm_dbuf, &doi); - if (spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM)) { - bonuslen = sizeof (space_map_phys_t); - ASSERT3U(bonuslen, <=, dmu_bonus_max()); - } else { - bonuslen = SPACE_MAP_SIZE_V0; - } - - if (bonuslen != doi.doi_bonus_size || - doi.doi_data_block_size != SPACE_MAP_INITIAL_BLOCKSIZE) { + /* + * If the space map has the wrong bonus size (because + * SPA_FEATURE_SPACEMAP_HISTOGRAM has recently been enabled), or + * the wrong block size (because space_map_blksz has changed), + * free and re-allocate its object with the updated sizes. + * + * Otherwise, just truncate the current object. + */ + if ((spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM) && + doi.doi_bonus_size != sizeof (space_map_phys_t)) || + doi.doi_data_block_size != space_map_blksz) { zfs_dbgmsg("txg %llu, spa %s, reallocating: " "old bonus %u, old blocksz %u", dmu_tx_get_txg(tx), spa_name(spa), doi.doi_bonus_size, doi.doi_data_block_size); - space_map_reallocate(sm, tx); - VERIFY3U(sm->sm_blksz, ==, SPACE_MAP_INITIAL_BLOCKSIZE); + + space_map_free(sm, tx); + dmu_buf_rele(sm->sm_dbuf, sm); + + sm->sm_object = space_map_alloc(sm->sm_os, tx); + VERIFY0(space_map_open_impl(sm)); + } else { + VERIFY0(dmu_free_range(os, space_map_object(sm), 0, -1ULL, tx)); + + /* + * If the spacemap is reallocated, its histogram + * will be reset. Do the same in the common case so that + * bugs related to the uncommon case do not go unnoticed. + */ + bzero(sm->sm_phys->smp_histogram, + sizeof (sm->sm_phys->smp_histogram)); } dmu_buf_will_dirty(sm->sm_dbuf, tx); @@ -535,7 +475,7 @@ space_map_alloc(objset_t *os, dmu_tx_t * } object = dmu_object_alloc(os, - DMU_OT_SPACE_MAP, SPACE_MAP_INITIAL_BLOCKSIZE, + DMU_OT_SPACE_MAP, space_map_blksz, DMU_OT_SPACE_MAP_HEADER, bonuslen, tx); return (object); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Mon Oct 20 18:53:54 2014 (r273340) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h Mon Oct 20 18:58:45 2014 (r273341) @@ -133,17 +133,6 @@ typedef enum { SM_FREE } maptype_t; -/* - * The data for a given space map can be kept on blocks of any size. - * Larger blocks entail fewer i/o operations, but they also cause the - * DMU to keep more data in-core, and also to waste more i/o bandwidth - * when only a few blocks have changed since the last transaction group. - * Rather than having a fixed block size for all space maps the block size - * can adjust as needed (see space_map_max_blksz). Set the initial block - * size for the space map to 4k. - */ -#define SPACE_MAP_INITIAL_BLOCKSIZE (1ULL << 12) - int space_map_load(space_map_t *sm, range_tree_t *rt, maptype_t maptype); void space_map_histogram_clear(space_map_t *sm); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 21:53:52 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CA06560; Mon, 20 Oct 2014 21:53:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07BC2FC1; Mon, 20 Oct 2014 21:53:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLrp6f026057; Mon, 20 Oct 2014 21:53:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLrpDQ026056; Mon, 20 Oct 2014 21:53:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202153.s9KLrpDQ026056@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 21:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273343 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 21:53:52 -0000 Author: delphij Date: Mon Oct 20 21:53:51 2014 New Revision: 273343 URL: https://svnweb.freebsd.org/changeset/base/273343 Log: MFC r272507: MFV r272496: Add tunable for number of metaslabs per vdev (vfs.zfs.vdev.metaslabs_per_vdev). The default remains at 200. Illumos issue: 5161 add tunable for number of metaslabs per vdev Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Oct 20 20:21:40 2014 (r273342) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Mon Oct 20 21:53:51 2014 (r273343) @@ -156,6 +156,15 @@ static vdev_ops_t *vdev_ops_table[] = { /* + * When a vdev is added, it will be divided into approximately (but no + * more than) this number of metaslabs. + */ +int metaslabs_per_vdev = 200; +SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, metaslabs_per_vdev, CTLFLAG_RDTUN, + &metaslabs_per_vdev, 0, + "When a vdev is added, how many metaslabs the vdev should be divided into"); + +/* * Given a vdev type, return the appropriate ops vector. */ static vdev_ops_t * @@ -1663,9 +1672,9 @@ void vdev_metaslab_set_size(vdev_t *vd) { /* - * Aim for roughly 200 metaslabs per vdev. + * Aim for roughly metaslabs_per_vdev (default 200) metaslabs per vdev. */ - vd->vdev_ms_shift = highbit64(vd->vdev_asize / 200); + vd->vdev_ms_shift = highbit64(vd->vdev_asize / metaslabs_per_vdev); vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT); } From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 21:59:12 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20BAC82E; Mon, 20 Oct 2014 21:59:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDFB74; Mon, 20 Oct 2014 21:59:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLxBdc026839; Mon, 20 Oct 2014 21:59:11 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLxBko026838; Mon, 20 Oct 2014 21:59:11 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202159.s9KLxBko026838@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 21:59:11 +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: r273345 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 21:59:12 -0000 Author: delphij Date: Mon Oct 20 21:59:11 2014 New Revision: 273345 URL: https://svnweb.freebsd.org/changeset/base/273345 Log: MFC r272510: MFV r272498: Add a new sysctl, vfs.zfs.vol.unmap_enabled, which allows the system administrator to toggle whether ZFS should ignore UNMAP requests. Illumos issue: 5149 zvols need a way to ignore DKIOCFREE Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 20 21:57:24 2014 (r273344) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Oct 20 21:59:11 2014 (r273345) @@ -168,6 +168,14 @@ static LIST_HEAD(, zvol_state) all_zvols */ int zvol_maxphys = DMU_MAX_ACCESS/2; +/* + * Toggle unmap functionality. + */ +boolean_t zvol_unmap_enabled = B_TRUE; +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN, + &zvol_unmap_enabled, 0, + "Enable UNMAP functionality"); + static d_open_t zvol_d_open; static d_close_t zvol_d_close; static d_read_t zvol_read; @@ -1972,6 +1980,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t dkioc_free_t df; dmu_tx_t *tx; + if (!zvol_unmap_enabled) + break; + if (ddi_copyin((void *)arg, &df, sizeof (df), flag)) { error = SET_ERROR(EFAULT); break; @@ -2816,6 +2827,9 @@ zvol_d_ioctl(struct cdev *dev, u_long cm zil_commit(zv->zv_zilog, ZVOL_OBJ); break; case DIOCGDELETE: + if (!zvol_unmap_enabled) + break; + offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; if ((offset % DEV_BSIZE) != 0 || (length % DEV_BSIZE) != 0 || From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 22:04:50 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58AF79AA; Mon, 20 Oct 2014 22:04:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43D7115E; Mon, 20 Oct 2014 22:04:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KM4oAx031091; Mon, 20 Oct 2014 22:04:50 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KM4oJB031090; Mon, 20 Oct 2014 22:04:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202204.s9KM4oJB031090@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273346 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 22:04:50 -0000 Author: delphij Date: Mon Oct 20 22:04:49 2014 New Revision: 273346 URL: https://svnweb.freebsd.org/changeset/base/273346 Log: MFC r272511: MFV r272499: Illumos issue: 5174 add sdt probe for blocked read in dbuf_read() Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Oct 20 21:59:11 2014 (r273345) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Mon Oct 20 22:04:49 2014 (r273346) @@ -671,6 +671,8 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio db->db_state == DB_FILL) { ASSERT(db->db_state == DB_READ || (flags & DB_RF_HAVESTRUCT) == 0); + DTRACE_PROBE2(blocked__read, dmu_buf_impl_t *, + db, zio_t *, zio); cv_wait(&db->db_changed, &db->db_mtx); } if (db->db_state == DB_UNCACHED) From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 22:09:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE361B11; Mon, 20 Oct 2014 22:09:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D055C187; Mon, 20 Oct 2014 22:09:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KM9U7M031806; Mon, 20 Oct 2014 22:09:30 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KM9UoC031805; Mon, 20 Oct 2014 22:09:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202209.s9KM9UoC031805@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:09:30 +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: r273347 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 22:09:31 -0000 Author: delphij Date: Mon Oct 20 22:09:30 2014 New Revision: 273347 URL: https://svnweb.freebsd.org/changeset/base/273347 Log: MFC r272584: MFV r272501: Illumos issue: 5177 remove dead code from dsl_scan.c Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 20 22:04:49 2014 (r273346) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Oct 20 22:09:30 2014 (r273347) @@ -384,13 +384,12 @@ dsl_scan_cancel(dsl_pool_t *dp) dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED)); } -static void dsl_scan_visitbp(blkptr_t *bp, - const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx); +static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx); static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds, dmu_objset_type_t ostype, - dnode_phys_t *dnp, arc_buf_t *buf, uint64_t object, dmu_tx_t *tx); + dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx); void dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp) @@ -624,7 +623,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, c static int dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, dnode_phys_t *dnp, const blkptr_t *bp, - const zbookmark_phys_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) + const zbookmark_phys_t *zb, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; @@ -635,76 +634,72 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da int i; blkptr_t *cbp; int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { - dsl_scan_prefetch(scn, *bufp, cbp, zb->zb_objset, + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_object, zb->zb_blkid * epb + i); } - for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { + for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) { zbookmark_phys_t czb; SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, zb->zb_level - 1, zb->zb_blkid * epb + i); dsl_scan_visitbp(cbp, &czb, dnp, - *bufp, ds, scn, ostype, tx); - } - } else if (BP_GET_TYPE(bp) == DMU_OT_USERGROUP_USED) { - uint32_t flags = ARC_WAIT; - - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, - ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); - if (err) { - scn->scn_phys.scn_errors++; - return (err); + ds, scn, ostype, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) { uint32_t flags = ARC_WAIT; dnode_phys_t *cdnp; int i, j; int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { for (j = 0; j < cdnp->dn_nblkptr; j++) { blkptr_t *cbp = &cdnp->dn_blkptr[j]; - dsl_scan_prefetch(scn, *bufp, cbp, + dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset, zb->zb_blkid * epb + i, j); } } - for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { + for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) { dsl_scan_visitdnode(scn, ds, ostype, - cdnp, *bufp, zb->zb_blkid * epb + i, tx); + cdnp, zb->zb_blkid * epb + i, tx); } + (void) arc_buf_remove_ref(buf, &buf); } else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { uint32_t flags = ARC_WAIT; objset_phys_t *osp; + arc_buf_t *buf; - err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, + err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf, ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); if (err) { scn->scn_phys.scn_errors++; return (err); } - osp = (*bufp)->b_data; + osp = buf->b_data; dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_meta_dnode, *bufp, DMU_META_DNODE_OBJECT, tx); + &osp->os_meta_dnode, DMU_META_DNODE_OBJECT, tx); - if (OBJSET_BUF_HAS_USERUSED(*bufp)) { + if (OBJSET_BUF_HAS_USERUSED(buf)) { /* * We also always visit user/group accounting * objects, and never skip them, even if we are @@ -712,12 +707,13 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da * deltas from this txg get integrated. */ dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_groupused_dnode, *bufp, + &osp->os_groupused_dnode, DMU_GROUPUSED_OBJECT, tx); dsl_scan_visitdnode(scn, ds, osp->os_type, - &osp->os_userused_dnode, *bufp, + &osp->os_userused_dnode, DMU_USERUSED_OBJECT, tx); } + (void) arc_buf_remove_ref(buf, &buf); } return (0); @@ -725,7 +721,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_da static void dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, - dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf, + dmu_objset_type_t ostype, dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx) { int j; @@ -736,7 +732,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, dnp->dn_nlevels - 1, j); dsl_scan_visitbp(&dnp->dn_blkptr[j], - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { @@ -744,7 +740,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, 0, DMU_SPILL_BLKID); dsl_scan_visitbp(&dnp->dn_spill, - &czb, dnp, buf, ds, scn, ostype, tx); + &czb, dnp, ds, scn, ostype, tx); } } @@ -754,9 +750,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl */ static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb, - dnode_phys_t *dnp, arc_buf_t *pbuf, - dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, - dmu_tx_t *tx) + dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn, + dmu_objset_type_t ostype, dmu_tx_t *tx) { dsl_pool_t *dp = scn->scn_dp; arc_buf_t *buf = NULL; @@ -776,16 +771,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo scn->scn_visited_this_txg++; dprintf_bp(bp, - "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p", + "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p", ds, ds ? ds->ds_object : 0, zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid, - pbuf, bp); + bp); if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) return; - if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx, - &buf) != 0) + if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx) != 0) return; /* @@ -809,8 +803,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbo if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) { scan_funcs[scn->scn_phys.scn_func](dp, bp, zb); } - if (buf) - (void) arc_buf_remove_ref(buf, &buf); } static void @@ -821,7 +813,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, d SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); - dsl_scan_visitbp(bp, &zb, NULL, NULL, + dsl_scan_visitbp(bp, &zb, NULL, ds, scn, DMU_OST_NONE, tx); dprintf_ds(ds, "finished scan%s", ""); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 22:13:52 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 23CE7CAF; Mon, 20 Oct 2014 22:13:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0491C251; Mon, 20 Oct 2014 22:13:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMDpJ8035802; Mon, 20 Oct 2014 22:13:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMDovX035797; Mon, 20 Oct 2014 22:13:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202213.s9KMDovX035797@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:13:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273348 - in stable/10: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 22:13:52 -0000 Author: delphij Date: Mon Oct 20 22:13:50 2014 New Revision: 273348 URL: https://svnweb.freebsd.org/changeset/base/273348 Log: MFC r272598: MFV r272585: Split the godfather zio into CPU number's to reduce lock contention. Illumos issue: 5176 lock contention on godfather zio Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:13:50 2014 (r273348) @@ -2594,10 +2594,12 @@ dump_block_stats(spa_t *spa) * all async I/Os to complete. */ if (dump_opt['c']) { - (void) zio_wait(spa->spa_async_zio_root); - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | - ZIO_FLAG_GODFATHER); + for (int i = 0; i < max_ncpus; i++) { + (void) zio_wait(spa->spa_async_zio_root[i]); + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } } if (zcb.zcb_haderrors) { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon Oct 20 22:13:50 2014 (r273348) @@ -1274,7 +1274,9 @@ spa_unload(spa_t *spa) * Wait for any outstanding async I/O to complete. */ if (spa->spa_async_zio_root != NULL) { - (void) zio_wait(spa->spa_async_zio_root); + for (int i = 0; i < max_ncpus; i++) + (void) zio_wait(spa->spa_async_zio_root[i]); + kmem_free(spa->spa_async_zio_root, max_ncpus * sizeof (void *)); spa->spa_async_zio_root = NULL; } @@ -2210,8 +2212,13 @@ spa_load_impl(spa_t *spa, uint64_t pool_ /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Parse the configuration into a vdev tree. We explicitly set the @@ -3564,8 +3571,13 @@ spa_create(const char *pool, nvlist_t *n /* * Create "The Godfather" zio to hold all async IOs */ - spa->spa_async_zio_root = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); + spa->spa_async_zio_root = kmem_alloc(max_ncpus * sizeof (void *), + KM_SLEEP); + for (int i = 0; i < max_ncpus; i++) { + spa->spa_async_zio_root[i] = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } /* * Create the root vdev. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Mon Oct 20 22:13:50 2014 (r273348) @@ -206,7 +206,8 @@ struct spa { uint64_t spa_failmode; /* failure mode for the pool */ uint64_t spa_delegation; /* delegation on/off */ list_t spa_config_list; /* previous cache file(s) */ - zio_t *spa_async_zio_root; /* root of all async I/O */ + /* per-CPU array of root of async I/O: */ + zio_t **spa_async_zio_root; zio_t *spa_suspend_zio_root; /* root of all suspended I/O */ kmutex_t spa_suspend_lock; /* protects suspend_zio_root */ kcondvar_t spa_suspend_cv; /* notification of resume */ Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 20 22:09:30 2014 (r273347) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon Oct 20 22:13:50 2014 (r273348) @@ -1462,7 +1462,7 @@ zio_nowait(zio_t *zio) */ spa_t *spa = zio->io_spa; - zio_add_child(spa->spa_async_zio_root, zio); + zio_add_child(spa->spa_async_zio_root[CPU_SEQID], zio); } zio_execute(zio); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 22:18:22 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6298FEAD; Mon, 20 Oct 2014 22:18:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DEC727D; Mon, 20 Oct 2014 22:18:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMIMGO036448; Mon, 20 Oct 2014 22:18:22 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMIMIS036447; Mon, 20 Oct 2014 22:18:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202218.s9KMIMIS036447@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273349 - stable/10/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 22:18:22 -0000 Author: delphij Date: Mon Oct 20 22:18:21 2014 New Revision: 273349 URL: https://svnweb.freebsd.org/changeset/base/273349 Log: MFC r272599: MFV r272588: Handle old format deadlist. Illumos issue: 5178 zdb -vvvvv on old-format pool fails in dump_deadlist() Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:13:50 2014 (r273348) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Oct 20 22:18:21 2014 (r273349) @@ -1461,6 +1461,11 @@ dump_deadlist(dsl_deadlist_t *dl) if (dump_opt['d'] < 3) return; + if (dl->dl_oldfmt) { + dump_bpobj(&dl->dl_bpobj, "old-format deadlist", 0); + return; + } + zdb_nicenum(dl->dl_phys->dl_used, bytes); zdb_nicenum(dl->dl_phys->dl_comp, comp); zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); From owner-svn-src-stable@FreeBSD.ORG Mon Oct 20 22:22:40 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86C4C1EE; Mon, 20 Oct 2014 22:22:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6899037A; Mon, 20 Oct 2014 22:22:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMMePf040428; Mon, 20 Oct 2014 22:22:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMMe4E040424; Mon, 20 Oct 2014 22:22:40 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410202222.s9KMMe4E040424@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 20 Oct 2014 22:22:40 +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: r273350 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 20 Oct 2014 22:22:40 -0000 Author: delphij Date: Mon Oct 20 22:22:39 2014 New Revision: 273350 URL: https://svnweb.freebsd.org/changeset/base/273350 Log: MFC r272601: MFV r272591: Use loaned ARC buffer for zfs receive to avoid copy. Illumos issue: 5162 zfs recv should use loaned arc buffer to avoid copy Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 20 22:18:21 2014 (r273349) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Mon Oct 20 22:22:39 2014 (r273350) @@ -1333,7 +1333,14 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin rw_exit(&dn->dn_struct_rwlock); DB_DNODE_EXIT(dbuf); - if (offset == db->db.db_offset && blksz == db->db.db_size) { + /* + * We can only assign if the offset is aligned, the arc buf is the + * same size as the dbuf, and the dbuf is not metadata. It + * can't be metadata because the loaned arc buf comes from the + * user-data kmem arena. + */ + if (offset == db->db.db_offset && blksz == db->db.db_size && + DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) { dbuf_assign_arcbuf(db, buf, tx); dbuf_rele(db, FTAG); } else { Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 20 22:18:21 2014 (r273349) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Oct 20 22:22:39 2014 (r273350) @@ -1273,18 +1273,20 @@ restore_bytes(struct restorearg *ra, voi } static void * -restore_read(struct restorearg *ra, int len) +restore_read(struct restorearg *ra, int len, char *buf) { - void *rv; int done = 0; + if (buf == NULL) + buf = ra->buf; + /* some things will require 8-byte alignment, so everything must */ ASSERT0(len % 8); while (done < len) { ssize_t resid; - ra->err = restore_bytes(ra, (caddr_t)ra->buf + done, + ra->err = restore_bytes(ra, buf + done, len - done, ra->voff, &resid); if (resid == len - done) @@ -1296,12 +1298,11 @@ restore_read(struct restorearg *ra, int } ASSERT3U(done, ==, len); - rv = ra->buf; if (ra->byteswap) - fletcher_4_incremental_byteswap(rv, len, &ra->cksum); + fletcher_4_incremental_byteswap(buf, len, &ra->cksum); else - fletcher_4_incremental_native(rv, len, &ra->cksum); - return (rv); + fletcher_4_incremental_native(buf, len, &ra->cksum); + return (buf); } static void @@ -1416,7 +1417,7 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); if (drro->drr_bonuslen) { - data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8)); + data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); if (ra->err != 0) return (ra->err); } @@ -1513,19 +1514,30 @@ restore_write(struct restorearg *ra, obj !DMU_OT_IS_VALID(drrw->drr_type)) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrw->drr_length); - if (data == NULL) - return (ra->err); - if (dmu_object_info(os, drrw->drr_object, NULL) != 0) return (SET_ERROR(EINVAL)); + dmu_buf_t *bonus; + if (dmu_bonus_hold(os, drrw->drr_object, FTAG, &bonus) != 0) + return (SET_ERROR(EINVAL)); + + arc_buf_t *abuf = dmu_request_arcbuf(bonus, drrw->drr_length); + + data = restore_read(ra, drrw->drr_length, abuf->b_data); + if (data == NULL) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); + return (ra->err); + } + tx = dmu_tx_create(os); dmu_tx_hold_write(tx, drrw->drr_object, drrw->drr_offset, drrw->drr_length); err = dmu_tx_assign(tx, TXG_WAIT); if (err != 0) { + dmu_return_arcbuf(abuf); + dmu_buf_rele(bonus, FTAG); dmu_tx_abort(tx); return (err); } @@ -1534,9 +1546,9 @@ restore_write(struct restorearg *ra, obj DMU_OT_BYTESWAP(drrw->drr_type); dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); } - dmu_write(os, drrw->drr_object, - drrw->drr_offset, drrw->drr_length, data, tx); + dmu_assign_arcbuf(bonus, drrw->drr_offset, abuf, tx); dmu_tx_commit(tx); + dmu_buf_rele(bonus, FTAG); return (0); } @@ -1618,7 +1630,7 @@ restore_write_embedded(struct restorearg if (drrwnp->drr_compression >= ZIO_COMPRESS_FUNCTIONS) return (EINVAL); - data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8)); + data = restore_read(ra, P2ROUNDUP(drrwnp->drr_psize, 8), NULL); if (data == NULL) return (ra->err); @@ -1653,7 +1665,7 @@ restore_spill(struct restorearg *ra, obj drrs->drr_length > SPA_MAXBLOCKSIZE) return (SET_ERROR(EINVAL)); - data = restore_read(ra, drrs->drr_length); + data = restore_read(ra, drrs->drr_length, NULL); if (data == NULL) return (ra->err); @@ -1795,7 +1807,7 @@ dmu_recv_stream(dmu_recv_cookie_t *drc, */ pcksum = ra.cksum; while (ra.err == 0 && - NULL != (drr = restore_read(&ra, sizeof (*drr)))) { + NULL != (drr = restore_read(&ra, sizeof (*drr), NULL))) { if (issig(JUSTLOOKING) && issig(FORREAL)) { ra.err = SET_ERROR(EINTR); goto out; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 00:06:04 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC7E5CBE; Tue, 21 Oct 2014 00:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E2A2E9A; Tue, 21 Oct 2014 00:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L064CZ088587; Tue, 21 Oct 2014 00:06:04 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L064OB088586; Tue, 21 Oct 2014 00:06:04 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410210006.s9L064OB088586@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 00:06:04 +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: r273354 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 00:06:04 -0000 Author: gjb Date: Tue Oct 21 00:06:03 2014 New Revision: 273354 URL: https://svnweb.freebsd.org/changeset/base/273354 Log: MFC r273204: Add more descriptive metadata to the ISO images. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Mon Oct 20 23:34:47 2014 (r273353) +++ stable/10/release/Makefile Tue Oct 21 00:06:03 2014 (r273354) @@ -62,6 +62,8 @@ OSRELEASE= ${TYPE}-${REVISION}-${BRANCH} .endfor .endif +VOLUME_LABEL= ${OSRELEASE:C/[-\.]/_/g:S/^$${TYPE}_//} + .if !exists(${DOCDIR}) NODOC= true .endif @@ -254,28 +256,31 @@ dvd: release.iso: disc1.iso disc1.iso: system - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} release uefi-disc1.iso: system .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} release + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + ${.TARGET} release .endif uefi-bootonly.iso: bootonly .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + ${.TARGET} bootonly .endif dvd1.iso: dvd pkg-stage - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd uefi-dvd1.iso: dvd pkg-stage .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b FreeBSD_Install ${.TARGET} dvd + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIDVD \ + ${.TARGET} dvd .endif bootonly.iso: bootonly - sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b FreeBSD_Install ${.TARGET} bootonly + sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly memstick: memstick.img memstick.img: system From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 00:07:38 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F1CCE0C; Tue, 21 Oct 2014 00:07:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AEBDEB0; Tue, 21 Oct 2014 00:07:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L07cBj088877; Tue, 21 Oct 2014 00:07:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L07cv9088876; Tue, 21 Oct 2014 00:07:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410210007.s9L07cv9088876@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 00:07:38 +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: r273355 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 00:07:38 -0000 Author: gjb Date: Tue Oct 21 00:07:37 2014 New Revision: 273355 URL: https://svnweb.freebsd.org/changeset/base/273355 Log: Fix label for the UEFI bootonly cd. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile Modified: stable/10/release/Makefile ============================================================================== --- stable/10/release/Makefile Tue Oct 21 00:06:03 2014 (r273354) +++ stable/10/release/Makefile Tue Oct 21 00:07:37 2014 (r273355) @@ -266,7 +266,7 @@ uefi-disc1.iso: system uefi-bootonly.iso: bootonly .if exists(${.CURDIR}/${TARGET}/mkisoimages-uefi.sh) - sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFICD \ + sh ${.CURDIR}/${TARGET}/mkisoimages-uefi.sh -b ${VOLUME_LABEL}_UEFIBO \ ${.TARGET} bootonly .endif From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 00:09:18 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from hub.FreeBSD.org (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55033F4F; Tue, 21 Oct 2014 00:09:17 +0000 (UTC) Date: Tue, 21 Oct 2014 00:09:13 +0000 From: Glen Barber To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r273355 - stable/10/release Message-ID: <20141021000913.GB1212@hub.FreeBSD.org> References: <201410210007.s9L07cv9088876@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="i0/AhcQY5QxfSsSZ" Content-Disposition: inline In-Reply-To: <201410210007.s9L07cv9088876@svn.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 00:09:18 -0000 --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 21, 2014 at 12:07:38AM +0000, Glen Barber wrote: > Author: gjb > Date: Tue Oct 21 00:07:37 2014 > New Revision: 273355 > URL: https://svnweb.freebsd.org/changeset/base/273355 >=20 > Log: > Fix label for the UEFI bootonly cd. > =20 This is a direct commit to stable/10, head/ does not have this differentiation between UEFI and non-UEFI CDs. Glen --i0/AhcQY5QxfSsSZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJURaQpAAoJEAMUWKVHj+KTL4oP/0oUxdDCqVwLPXxfGIW838WR GMMxk23TyNF/0hgBISYWpltxADIthGEhSBLICIZ9/Cs59WOs5c3PZQUOPBzHIWJK hYU1cMGBC3hwyYPa8et8Ws/BQ2+IPDcrn5uqMV8l4yahaY5uXxXYfcQetTmRdBKF Y9hNDol3J9+PYr7YuulCEad5WUnxPQBt+RIHmoTP/BsymathsH1cmFHJLPY655n2 +uwOm7bidp7hOMSaDK4aaTupLaoQW87dVB5hG5kR82Gmg4+Sq1y+WGuEPmerCKl/ iJef3Uqwd3mn1NyporKsbRHcr7EH6XXOutZNy876+Xr09HuMjNaNeTUkaE47MfC9 U3ZkQxNndXWsADW+jlWPplou/P09wnKGWYoXP0keHSP0JQ1MuW2JYkWyamOqZE/4 lMem5D3MIJtTd78ZEnZ1uTOJb7gvRtw2zywg3OCzkHMpfjT3O9MNNnDZnDbd0THN qmmDmcxAaKCmIjrpxW/DXJhOjVVSCZVHiTAb+dXPSDLjD63mdZUvtIKbnOLbLsHA srSKQHlTZFMAJq6vIahhtLdKKiFEsfR6beBRfTuxe0eNjpRP7xEYUgdXB5+UedlB QZneQQ/MM3l2j3VljIgiK5eV+Hif0lb2bZMUzQa9VEQ3CZar5bB8ONyBsh2z6F+c fGtmrfPNbGkF4/BqRpwH =NhAD -----END PGP SIGNATURE----- --i0/AhcQY5QxfSsSZ-- From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 01:14:58 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A4849A9; Tue, 21 Oct 2014 01:14:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C282782; Tue, 21 Oct 2014 01:14:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1EwFj021193; Tue, 21 Oct 2014 01:14:58 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1Eva9021187; Tue, 21 Oct 2014 01:14:57 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210114.s9L1Eva9021187@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:14: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: r273357 - in stable/10/sys/dev: alc ale X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 01:14:58 -0000 Author: yongari Date: Tue Oct 21 01:14:56 2014 New Revision: 273357 URL: https://svnweb.freebsd.org/changeset/base/273357 Log: MFC r272721: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. Modified: stable/10/sys/dev/alc/if_alc.c stable/10/sys/dev/alc/if_alcreg.h stable/10/sys/dev/ale/if_ale.c stable/10/sys/dev/ale/if_alereg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/alc/if_alc.c ============================================================================== --- stable/10/sys/dev/alc/if_alc.c Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/alc/if_alc.c Tue Oct 21 01:14:56 2014 (r273357) @@ -1286,8 +1286,6 @@ alc_sysctl_node(struct alc_softc *sc) &stats->tx_late_colls, "Late collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALC_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALC_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2603,7 +2601,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2616,7 +2613,7 @@ alc_stats_update(struct alc_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; /* * XXX @@ -2625,8 +2622,8 @@ alc_stats_update(struct alc_softc *sc) * the counter name is not correct one so I've removed the * counter in output errors. */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/10/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/10/sys/dev/alc/if_alcreg.h Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/alc/if_alcreg.h Tue Oct 21 01:14:56 2014 (r273357) @@ -860,7 +860,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; Modified: stable/10/sys/dev/ale/if_ale.c ============================================================================== --- stable/10/sys/dev/ale/if_ale.c Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/ale/if_ale.c Tue Oct 21 01:14:56 2014 (r273357) @@ -945,8 +945,6 @@ ale_sysctl_node(struct ale_softc *sc) &stats->tx_late_colls, "Late collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALE_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2200,7 +2198,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2213,17 +2210,10 @@ ale_stats_update(struct ale_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/10/sys/dev/ale/if_alereg.h ============================================================================== --- stable/10/sys/dev/ale/if_alereg.h Tue Oct 21 01:06:58 2014 (r273356) +++ stable/10/sys/dev/ale/if_alereg.h Tue Oct 21 01:14:56 2014 (r273357) @@ -605,7 +605,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 01:15:45 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DBBBAE1; Tue, 21 Oct 2014 01:15:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE5A78B; Tue, 21 Oct 2014 01:15:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1FigD021390; Tue, 21 Oct 2014 01:15:44 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1FieL021383; Tue, 21 Oct 2014 01:15:44 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210115.s9L1FieL021383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:15:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273358 - in stable/9/sys/dev: alc ale X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 01:15:45 -0000 Author: yongari Date: Tue Oct 21 01:15:43 2014 New Revision: 273358 URL: https://svnweb.freebsd.org/changeset/base/273358 Log: MFC r272721: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. Modified: stable/9/sys/dev/alc/if_alc.c stable/9/sys/dev/alc/if_alcreg.h stable/9/sys/dev/ale/if_ale.c stable/9/sys/dev/ale/if_alereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/alc/if_alc.c ============================================================================== --- stable/9/sys/dev/alc/if_alc.c Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/alc/if_alc.c Tue Oct 21 01:15:43 2014 (r273358) @@ -1286,8 +1286,6 @@ alc_sysctl_node(struct alc_softc *sc) &stats->tx_late_colls, "Late collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALC_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALC_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALC_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2603,7 +2601,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2616,17 +2613,10 @@ alc_stats_update(struct alc_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/9/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/9/sys/dev/alc/if_alcreg.h Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/alc/if_alcreg.h Tue Oct 21 01:15:43 2014 (r273358) @@ -860,7 +860,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; Modified: stable/9/sys/dev/ale/if_ale.c ============================================================================== --- stable/9/sys/dev/ale/if_ale.c Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/ale/if_ale.c Tue Oct 21 01:15:43 2014 (r273358) @@ -945,8 +945,6 @@ ale_sysctl_node(struct ale_softc *sc) &stats->tx_late_colls, "Late collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "excess_colls", &stats->tx_excess_colls, "Excessive collisions"); - ALE_SYSCTL_STAT_ADD32(ctx, child, "abort", - &stats->tx_abort, "Aborted frames due to Excessive collisions"); ALE_SYSCTL_STAT_ADD32(ctx, child, "underruns", &stats->tx_underrun, "FIFO underruns"); ALE_SYSCTL_STAT_ADD32(ctx, child, "desc_underruns", @@ -2200,7 +2198,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -2213,17 +2210,10 @@ ale_stats_update(struct ale_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; Modified: stable/9/sys/dev/ale/if_alereg.h ============================================================================== --- stable/9/sys/dev/ale/if_alereg.h Tue Oct 21 01:14:56 2014 (r273357) +++ stable/9/sys/dev/ale/if_alereg.h Tue Oct 21 01:15:43 2014 (r273358) @@ -605,7 +605,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 01:48:20 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32CF5357; Tue, 21 Oct 2014 01:48:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04C37A39; Tue, 21 Oct 2014 01:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1mJR0035616; Tue, 21 Oct 2014 01:48:19 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1mJ0d035615; Tue, 21 Oct 2014 01:48:19 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210148.s9L1mJ0d035615@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:48:19 +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: r273361 - stable/10/sys/dev/pci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 01:48:20 -0000 Author: yongari Date: Tue Oct 21 01:48:19 2014 New Revision: 273361 URL: https://svnweb.freebsd.org/changeset/base/273361 Log: MFC r272729,272732: Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4). QAC AR816x/E2200 controller has a silicon bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of command register is set. Modified: stable/10/sys/dev/pci/pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/pci/pci.c ============================================================================== --- stable/10/sys/dev/pci/pci.c Tue Oct 21 01:34:18 2014 (r273360) +++ stable/10/sys/dev/pci/pci.c Tue Oct 21 01:48:19 2014 (r273361) @@ -196,6 +196,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ +#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; @@ -255,6 +256,15 @@ static const struct pci_quirk pci_quirks */ { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + /* + * Atheros AR8161/AR8162/E2200 ethernet controller has a bug that + * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the + * command register is set. + */ + { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0 } }; @@ -3624,8 +3634,14 @@ pci_setup_intr(device_t dev, device_t ch mte->mte_handlers++; } - /* Make sure that INTx is disabled if we are using MSI/MSIX */ - pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + if (!pci_has_quirk(pci_get_devid(dev), + PCI_QUIRK_MSI_INTX_BUG)) { + /* + * Make sure that INTx is disabled if we are + * using MSI/MSIX + */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 01:49:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B96648B; Tue, 21 Oct 2014 01:49:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D16FA41; Tue, 21 Oct 2014 01:49:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1n8Jx035761; Tue, 21 Oct 2014 01:49:08 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1n8gT035760; Tue, 21 Oct 2014 01:49:08 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210149.s9L1n8gT035760@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:49:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273362 - stable/9/sys/dev/pci X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 01:49:08 -0000 Author: yongari Date: Tue Oct 21 01:49:07 2014 New Revision: 273362 URL: https://svnweb.freebsd.org/changeset/base/273362 Log: MFC r272729,272732: Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4). QAC AR816x/E2200 controller has a silicon bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of command register is set. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Tue Oct 21 01:48:19 2014 (r273361) +++ stable/9/sys/dev/pci/pci.c Tue Oct 21 01:49:07 2014 (r273362) @@ -209,6 +209,7 @@ struct pci_quirk { #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ +#define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ int arg1; int arg2; }; @@ -268,6 +269,15 @@ static const struct pci_quirk pci_quirks */ { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + /* + * Atheros AR8161/AR8162/E2200 ethernet controller has a bug that + * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the + * command register is set. + */ + { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0 } }; @@ -3557,8 +3567,14 @@ pci_setup_intr(device_t dev, device_t ch mte->mte_handlers++; } - /* Make sure that INTx is disabled if we are using MSI/MSIX */ - pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + if (!pci_has_quirk(pci_get_devid(dev), + PCI_QUIRK_MSI_INTX_BUG)) { + /* + * Make sure that INTx is disabled if we are + * using MSI/MSIX + */ + pci_set_command_bit(dev, child, PCIM_CMD_INTxDIS); + } bad: if (error) { (void)bus_generic_teardown_intr(dev, child, irq, From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 04:48:50 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D062A7F; Tue, 21 Oct 2014 04:48:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3770CD34; Tue, 21 Oct 2014 04:48:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4moYO020538; Tue, 21 Oct 2014 04:48:50 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4mobH020536; Tue, 21 Oct 2014 04:48:50 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210448.s9L4mobH020536@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273366 - stable/10/sys/dev/alc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 04:48:50 -0000 Author: yongari Date: Tue Oct 21 04:48:49 2014 New Revision: 273366 URL: https://svnweb.freebsd.org/changeset/base/273366 Log: MFC r272730,273018: Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers. These controllers seem to have the same feature of AR813x/AR815x and improved RSS support(4 TX queues and 8 RX queues). alc(4) supports all hardware features except RSS. I didn't implement RX checksum offloading for AR816x/AR817x just because I couldn't get confirmation from the Vendor whether AR816x/AR817x corrected its predecessor's RX checksum offloading bug on fragmented packets. This change adds supports for the following controllers. o AR8161 PCIe Gigabit Ethernet controller o AR8162 PCIe Fast Ethernet controller o AR8171 PCIe Gigabit Ethernet controller o AR8172 PCIe Fast Ethernet controller o Killer E2200 Gigabit Ethernet controller Relnotes: yes Modified: stable/10/sys/dev/alc/if_alc.c stable/10/sys/dev/alc/if_alcreg.h stable/10/sys/dev/alc/if_alcvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/alc/if_alc.c ============================================================================== --- stable/10/sys/dev/alc/if_alc.c Tue Oct 21 04:30:00 2014 (r273365) +++ stable/10/sys/dev/alc/if_alc.c Tue Oct 21 04:48:49 2014 (r273366) @@ -110,17 +110,31 @@ static struct alc_ident alc_ident_table[ "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8161, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8162, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8171, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8172, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024, + "Killer E2200 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *, int); +static void alc_aspm(struct alc_softc *, int, int); +static void alc_aspm_813x(struct alc_softc *, int); +static void alc_aspm_816x(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); +static void alc_config_msi(struct alc_softc *); static int alc_detach(device_t); static void alc_disable_l0s_l1(struct alc_softc *); static int alc_dma_alloc(struct alc_softc *); static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static void alc_dsp_fixup(struct alc_softc *, int); static int alc_encap(struct alc_softc *, struct mbuf **); static struct alc_ident * alc_find_ident(device_t); @@ -129,6 +143,9 @@ static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); #endif static void alc_get_macaddr(struct alc_softc *); +static void alc_get_macaddr_813x(struct alc_softc *); +static void alc_get_macaddr_816x(struct alc_softc *); +static void alc_get_macaddr_par(struct alc_softc *); static void alc_init(void *); static void alc_init_cmb(struct alc_softc *); static void alc_init_locked(struct alc_softc *); @@ -140,14 +157,26 @@ static void alc_int_task(void *, int); static int alc_intr(void *); static int alc_ioctl(struct ifnet *, u_long, caddr_t); static void alc_mac_config(struct alc_softc *); +static uint32_t alc_mii_readreg_813x(struct alc_softc *, int, int); +static uint32_t alc_mii_readreg_816x(struct alc_softc *, int, int); +static uint32_t alc_mii_writereg_813x(struct alc_softc *, int, int, int); +static uint32_t alc_mii_writereg_816x(struct alc_softc *, int, int, int); static int alc_miibus_readreg(device_t, int, int); static void alc_miibus_statchg(device_t); static int alc_miibus_writereg(device_t, int, int, int); +static uint32_t alc_miidbg_readreg(struct alc_softc *, int); +static uint32_t alc_miidbg_writereg(struct alc_softc *, int, int); +static uint32_t alc_miiext_readreg(struct alc_softc *, int, int); +static uint32_t alc_miiext_writereg(struct alc_softc *, int, int, int); static int alc_mediachange(struct ifnet *); +static int alc_mediachange_locked(struct alc_softc *); static void alc_mediastatus(struct ifnet *, struct ifmediareq *); static int alc_newbuf(struct alc_softc *, struct alc_rxdesc *); +static void alc_osc_reset(struct alc_softc *); static void alc_phy_down(struct alc_softc *); static void alc_phy_reset(struct alc_softc *); +static void alc_phy_reset_813x(struct alc_softc *); +static void alc_phy_reset_816x(struct alc_softc *); static int alc_probe(device_t); static void alc_reset(struct alc_softc *); static int alc_resume(device_t); @@ -157,6 +186,8 @@ static void alc_rxfilter(struct alc_soft static void alc_rxvlan(struct alc_softc *); static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); +static void alc_setwol_813x(struct alc_softc *); +static void alc_setwol_816x(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); static void alc_start_locked(struct ifnet *); @@ -229,10 +260,21 @@ static int alc_miibus_readreg(device_t dev, int phy, int reg) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_readreg_816x(sc, phy, reg); + else + v = alc_mii_readreg_813x(sc, phy, reg); + return (v); +} + +static uint32_t +alc_mii_readreg_813x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t v; + int i; /* * For AR8132 fast ethernet controller, do not report 1000baseT @@ -261,14 +303,52 @@ alc_miibus_readreg(device_t dev, int phy return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); } +static uint32_t +alc_mii_readreg_816x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_REG_ADDR(reg)); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + static int alc_miibus_writereg(device_t dev, int phy, int reg, int val) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_writereg_816x(sc, phy, reg, val); + else + v = alc_mii_writereg_813x(sc, phy, reg, val); + return (v); +} + +static uint32_t +alc_mii_writereg_813x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t v; + int i; CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -286,6 +366,32 @@ alc_miibus_writereg(device_t dev, int ph return (0); } +static uint32_t +alc_mii_writereg_816x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | MDIO_REG_ADDR(reg) | + MDIO_SUP_PREAMBLE | clk); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy write timeout : %d\n", reg); + + return (0); +} + static void alc_miibus_statchg(device_t dev) { @@ -318,7 +424,6 @@ alc_miibus_statchg(device_t dev) break; } } - alc_stop_queue(sc); /* Stop Rx/Tx MACs. */ alc_stop_mac(sc); @@ -330,7 +435,159 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); + } + alc_aspm(sc, 0, IFM_SUBTYPE(mii->mii_media_active)); + alc_dsp_fixup(sc, IFM_SUBTYPE(mii->mii_media_active)); +} + +static uint32_t +alc_miidbg_readreg(struct alc_softc *sc, int reg) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA)); +} + +static uint32_t +alc_miidbg_writereg(struct alc_softc *sc, int reg, int val) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val)); +} + +static uint32_t +alc_miiext_readreg(struct alc_softc *sc, int devaddr, int reg) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy ext read timeout : %d, %d\n", + devaddr, reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + +static uint32_t +alc_miiext_writereg(struct alc_softc *sc, int devaddr, int reg, int val) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy ext write timeout : %d, %d\n", + devaddr, reg); + + return (0); +} + +static void +alc_dsp_fixup(struct alc_softc *sc, int media) +{ + uint16_t agc, len, val; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + return; + if (AR816X_REV(sc->alc_rev) >= AR816X_REV_C0) + return; + + /* + * Vendor PHY magic. + * 1000BT/AZ, wrong cable length + */ + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + len = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL6); + len = (len >> EXT_CLDCTL6_CAB_LEN_SHIFT) & + EXT_CLDCTL6_CAB_LEN_MASK; + agc = alc_miidbg_readreg(sc, MII_DBG_AGC); + agc = (agc >> DBG_AGC_2_VGA_SHIFT) & DBG_AGC_2_VGA_MASK; + if ((media == IFM_1000_T && len > EXT_CLDCTL6_CAB_LEN_SHORT1G && + agc > DBG_AGC_LONG1G_LIMT) || + (media == IFM_100_TX && len > DBG_AGC_LONG100M_LIMT && + agc > DBG_AGC_LONG1G_LIMT)) { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_LONG); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val |= ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } else { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_DEFAULT); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + if (media == IFM_1000_T) { + /* + * Giga link threshold, raise the tolerance of + * noise 50%. + */ + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_HI << + DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } else if (media == IFM_100_TX) + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_UP); + } + } else { + val = alc_miiext_readreg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, val); + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_DOWN); + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_DEFAULT << DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } } } @@ -358,17 +615,29 @@ static int alc_mediachange(struct ifnet *ifp) { struct alc_softc *sc; - struct mii_data *mii; - struct mii_softc *miisc; int error; sc = ifp->if_softc; ALC_LOCK(sc); + error = alc_mediachange_locked(sc); + ALC_UNLOCK(sc); + + return (error); +} + +static int +alc_mediachange_locked(struct alc_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + ALC_LOCK_ASSERT(sc); + mii = device_get_softc(sc->alc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); - ALC_UNLOCK(sc); return (error); } @@ -406,7 +675,17 @@ alc_probe(device_t dev) static void alc_get_macaddr(struct alc_softc *sc) { - uint32_t ea[2], opt; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_get_macaddr_816x(sc); + else + alc_get_macaddr_813x(sc); +} + +static void +alc_get_macaddr_813x(struct alc_softc *sc) +{ + uint32_t opt; uint16_t val; int eeprom, i; @@ -501,6 +780,73 @@ alc_get_macaddr(struct alc_softc *sc) } } + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_816x(struct alc_softc *sc) +{ + uint32_t reg; + int i, reloaded; + + reloaded = 0; + /* Try to reload station address via TWSI. */ + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & (SLD_PROGRESS | SLD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_SLD, reg | SLD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & SLD_START) == 0) + break; + } + if (i != 0) + reloaded++; + else if (bootverbose) + device_printf(sc->alc_dev, + "reloading station address via TWSI timed out!\n"); + } + + /* Try to reload station address from EEPROM or FLASH. */ + if (reloaded == 0) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_EEPROM_EXIST | + EEPROM_LD_FLASH_EXIST)) != 0) { + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_PROGRESS | + EEPROM_LD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_EEPROM_LD, reg | + EEPROM_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & EEPROM_LD_START) == 0) + break; + } + } else if (bootverbose) + device_printf(sc->alc_dev, + "reloading EEPROM/FLASH timed out!\n"); + } + } + + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_par(struct alc_softc *sc) +{ + uint32_t ea[2]; + ea[0] = CSR_READ_4(sc, ALC_PAR0); ea[1] = CSR_READ_4(sc, ALC_PAR1); sc->alc_eaddr[0] = (ea[1] >> 8) & 0xFF; @@ -516,19 +862,31 @@ alc_disable_l0s_l1(struct alc_softc *sc) { uint32_t pmcfg; - /* Another magic from vendor. */ - pmcfg = CSR_READ_4(sc, ALC_PM_CFG); - pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | - PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK | - PM_CFG_SERDES_PD_EX_L1); - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | - PM_CFG_SERDES_L1_ENB; - CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { + /* Another magic from vendor. */ + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_SERDES_PD_EX_L1); + pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | PM_CFG_SERDES_L1_ENB; + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + } } static void alc_phy_reset(struct alc_softc *sc) { + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_phy_reset_816x(sc); + else + alc_phy_reset_813x(sc); +} + +static void +alc_phy_reset_813x(struct alc_softc *sc) +{ uint16_t data; /* Reset magic from Linux. */ @@ -641,12 +999,101 @@ alc_phy_reset(struct alc_softc *sc) } static void +alc_phy_reset_816x(struct alc_softc *sc) +{ + uint32_t val; + + val = CSR_READ_4(sc, ALC_GPHY_CFG); + val &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_GATE_25M_ENB | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PHY_PLL_ON | + GPHY_CFG_PWDOWN_HW | GPHY_CFG_100AB_ENB); + val |= GPHY_CFG_SEL_ANA_RESET; +#ifdef notyet + val |= GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN | GPHY_CFG_SEL_ANA_RESET; +#else + /* Disable PHY hibernation. */ + val &= ~(GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN); +#endif + CSR_WRITE_4(sc, ALC_GPHY_CFG, val); + DELAY(10); + CSR_WRITE_4(sc, ALC_GPHY_CFG, val | GPHY_CFG_EXT_RESET); + DELAY(800); + + /* Vendor PHY magic. */ +#ifdef notyet + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, DBG_LEGCYPS_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SYSMODCTL, DBG_SYSMODCTL_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_VDRVBIAS, + EXT_VDRVBIAS_DEFAULT); +#else + /* Disable PHY hibernation. */ + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, + DBG_LEGCYPS_DEFAULT & ~DBG_LEGCYPS_ENB); + alc_miidbg_writereg(sc, MII_DBG_HIBNEG, + DBG_HIBNEG_DEFAULT & ~(DBG_HIBNEG_PSHIB_EN | DBG_HIBNEG_HIB_PULSE)); + alc_miidbg_writereg(sc, MII_DBG_GREENCFG, DBG_GREENCFG_DEFAULT); +#endif + + /* XXX Disable EEE. */ + val = CSR_READ_4(sc, ALC_LPI_CTL); + val &= ~LPI_CTL_ENB; + CSR_WRITE_4(sc, ALC_LPI_CTL, val); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_LOCAL_EEEADV, 0); + + /* PHY power saving. */ + alc_miidbg_writereg(sc, MII_DBG_TST10BTCFG, DBG_TST10BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SRDSYSMOD, DBG_SRDSYSMOD_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_TST100BTCFG, DBG_TST100BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_ANACTL, DBG_ANACTL_DEFAULT); + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val &= ~DBG_GREENCFG2_GATE_DFSE_EN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + + /* RTL8139C, 120m issue. */ + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_NLP78, + ANEG_NLP78_120M_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_S3DIG10, + ANEG_S3DIG10_DEFAULT); + + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0) { + /* Turn off half amplitude. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3); + val |= EXT_CLDCTL3_BP_CABLE1TH_DET_GT; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3, val); + /* Turn off Green feature. */ + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val |= DBG_GREENCFG2_BP_GREEN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + /* Turn off half bias. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5); + val |= EXT_CLDCTL5_BP_VD_HLFBIAS; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5, val); + } +} + +static void alc_phy_down(struct alc_softc *sc) { + uint32_t gphy; switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8171: + case DEVICEID_ATHEROS_AR8172: + gphy = CSR_READ_4(sc, ALC_GPHY_CFG); + gphy &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_100AB_ENB | GPHY_CFG_PHY_PLL_ON); + gphy |= GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET; + gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW; + CSR_WRITE_4(sc, ALC_GPHY_CFG, gphy); + break; case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: /* * GPHY power down caused more problems on AR8151 v2.0. * When driver is reloaded after GPHY power down, @@ -672,12 +1119,23 @@ alc_phy_down(struct alc_softc *sc) } static void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, int init, int media) +{ + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_aspm_816x(sc, init); + else + alc_aspm_813x(sc, media); +} + +static void +alc_aspm_813x(struct alc_softc *sc, int media) { uint32_t pmcfg; uint16_t linkcfg; - ALC_LOCK_ASSERT(sc); + if ((sc->alc_flags & ALC_FLAG_LINK) == 0) + return; pmcfg = CSR_READ_4(sc, ALC_PM_CFG); if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == @@ -758,71 +1216,61 @@ alc_aspm(struct alc_softc *sc, int media CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } -static int -alc_attach(device_t dev) +static void +alc_aspm_816x(struct alc_softc *sc, int init) { - struct alc_softc *sc; - struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; - uint16_t burst; - int base, error, i, msic, msixc, state; - uint32_t cap, ctl, val; - - error = 0; - sc = device_get_softc(dev); - sc->alc_dev = dev; - - mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); - TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); - sc->alc_ident = alc_find_ident(dev); + uint32_t pmcfg; - /* Map the device. */ - pci_enable_busmaster(dev); - sc->alc_res_spec = alc_res_spec_mem; - sc->alc_irq_spec = alc_irq_spec_legacy; - error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); - if (error != 0) { - device_printf(dev, "cannot allocate memory resources.\n"); - goto fail; + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_816X_MASK; + pmcfg |= PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= PM_CFG_PM_REQ_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_LCKDET_TIMER_MASK; + pmcfg |= PM_CFG_LCKDET_TIMER_DEFAULT; + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_CLK_SWH_L1 | PM_CFG_PCIE_RECV; + pmcfg &= ~(PM_CFG_RX_L1_AFTER_L0S | PM_CFG_TX_L1_AFTER_L0S | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB | + PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SA_DLY_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_HOTRST); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) + pmcfg |= PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + /* Link up, enable both L0s, L1s. */ + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + } else { + if (init != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK; } + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); +} - /* Set PHY address. */ - sc->alc_phyaddr = ALC_PHY_ADDR; +static void +alc_init_pcie(struct alc_softc *sc) +{ + const char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; + uint32_t cap, ctl, val; + int state; - /* Initialize DMA parameters. */ - sc->alc_dma_rd_burst = 0; - sc->alc_dma_wr_burst = 0; - sc->alc_rcb = DMA_CFG_RCB_64; - if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { - sc->alc_flags |= ALC_FLAG_PCIE; - sc->alc_expcap = base; - burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); - sc->alc_dma_rd_burst = - (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; - sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; - if (bootverbose) { - device_printf(dev, "Read request size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_rd_burst]); - device_printf(dev, "TLP payload size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_wr_burst]); - } - if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) - sc->alc_dma_rd_burst = 3; - if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) - sc->alc_dma_wr_burst = 3; - /* Clear data link and flow-control protocol error. */ - val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); - val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); - CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + /* Clear data link and flow-control protocol error. */ + val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); + val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); + CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, CSR_READ_4(sc, ALC_PCIE_PHYMISC) | PCIE_PHYMISC_FORCE_RCV_DET); if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && - pci_get_revid(dev) == ATHEROS_AR8152_B_V10) { + sc->alc_rev == ATHEROS_AR8152_B_V10) { val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | PCIE_PHYMISC2_SERDES_TH_MASK); @@ -831,13 +1279,13 @@ alc_attach(device_t dev) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); } /* Disable ASPM L0S and L1. */ - cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); + cap = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { - ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); + ctl = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CTL); if ((ctl & PCIEM_LINK_CTL_RCB) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) - device_printf(dev, "RCB %u bytes\n", + device_printf(sc->alc_dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & PCIEM_LINK_CTL_ASPMC; if (state & PCIEM_LINK_CTL_ASPMC_L0S) @@ -854,13 +1302,91 @@ alc_attach(device_t dev) device_printf(sc->alc_dev, "no ASPM support\n"); } + } else { + val = CSR_READ_4(sc, ALC_PDLL_TRNS1); + val &= ~PDLL_TRNS1_D3PLLOFF_ENB; + CSR_WRITE_4(sc, ALC_PDLL_TRNS1, val); + val = CSR_READ_4(sc, ALC_MASTER_CFG); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) == 0) { + val |= MASTER_WAKEN_25M | MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } else { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) != 0) { + val |= MASTER_WAKEN_25M; + val &= ~MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } } + alc_aspm(sc, 1, IFM_UNKNOWN); +} - /* Reset PHY. */ - alc_phy_reset(sc); +static void +alc_config_msi(struct alc_softc *sc) +{ + uint32_t ctl, mod; - /* Reset the ethernet controller. */ - alc_reset(sc); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) { + /* + * It seems interrupt moderation is controlled by + * ALC_MSI_RETRANS_TIMER register if MSI/MSIX is active. + * Driver uses RX interrupt moderation parameter to + * program ALC_MSI_RETRANS_TIMER register. + */ + ctl = CSR_READ_4(sc, ALC_MSI_RETRANS_TIMER); + ctl &= ~MSI_RETRANS_TIMER_MASK; + ctl &= ~MSI_RETRANS_MASK_SEL_LINE; + mod = ALC_USECS(sc->alc_int_rx_mod); + if (mod == 0) + mod = 1; + ctl |= mod; + if ((sc->alc_flags & ALC_FLAG_MSIX) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_STD); + else if ((sc->alc_flags & ALC_FLAG_MSI) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_LINE); + else + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, 0); + } +} + +static int +alc_attach(device_t dev) +{ + struct alc_softc *sc; + struct ifnet *ifp; + int base, error, i, msic, msixc; + uint16_t burst; + + error = 0; + sc = device_get_softc(dev); + sc->alc_dev = dev; + sc->alc_rev = pci_get_revid(dev); + + mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); + TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->alc_res_spec = alc_res_spec_mem; + sc->alc_irq_spec = alc_irq_spec_legacy; + error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); + if (error != 0) { + device_printf(dev, "cannot allocate memory resources.\n"); + goto fail; + } + + /* Set PHY address. */ + sc->alc_phyaddr = ALC_PHY_ADDR; /* * One odd thing is AR8132 uses the same PHY hardware(F1 @@ -870,6 +1396,19 @@ alc_attach(device_t dev) * shows the same PHY model/revision number of AR8131. */ switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + if (pci_get_subvendor(dev) == VENDORID_ATHEROS && + pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0) + sc->alc_flags |= ALC_FLAG_LINK_WAR; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8171: + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; + break; + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8172: + sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_AR816X_FAMILY; + break; case DEVICEID_ATHEROS_AR8152_B: case DEVICEID_ATHEROS_AR8152_B2: sc->alc_flags |= ALC_FLAG_APS; @@ -884,7 +1423,7 @@ alc_attach(device_t dev) default: break; } - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + sc->alc_flags |= ALC_FLAG_JUMBO; /* * It seems that AR813x/AR815x has silicon bug for SMB. In @@ -897,7 +1436,6 @@ alc_attach(device_t dev) * Don't use Tx CMB. It is known to have silicon bug. */ sc->alc_flags |= ALC_FLAG_CMB_BUG; - sc->alc_rev = pci_get_revid(dev); sc->alc_chip_rev = CSR_READ_4(sc, ALC_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { @@ -905,11 +1443,45 @@ alc_attach(device_t dev) sc->alc_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->alc_chip_rev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + device_printf(dev, "AR816x revision : 0x%x\n", + AR816X_REV(sc->alc_rev)); } device_printf(dev, "%u Tx FIFO, %u Rx FIFO\n", CSR_READ_4(sc, ALC_SRAM_TX_FIFO_LEN) * 8, CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN) * 8); + /* Initialize DMA parameters. */ + sc->alc_dma_rd_burst = 0; + sc->alc_dma_wr_burst = 0; + sc->alc_rcb = DMA_CFG_RCB_64; + if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { + sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; + burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); + sc->alc_dma_rd_burst = + (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; + sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; + if (bootverbose) { + device_printf(dev, "Read request size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_rd_burst]); + device_printf(dev, "TLP payload size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_wr_burst]); + } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; + alc_init_pcie(sc); + } + + /* Reset PHY. */ + alc_phy_reset(sc); + + /* Reset the ethernet controller. */ + alc_stop_mac(sc); + alc_reset(sc); + /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); @@ -917,11 +1489,20 @@ alc_attach(device_t dev) device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } - /* Prefer MSIX over MSI. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; + /* + * Prefer MSIX over MSI. + * AR816x controller has a silicon bug that MSI interrupt + * does not assert if PCIM_CMD_INTxDIS bit of command + * register is set. pci(4) was taught to handle that case. + */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALC_MSIX_MESSAGES) { + if (msic == 1) { device_printf(dev, "Using %d MSIX message(s).\n", msixc); sc->alc_flags |= ALC_FLAG_MSIX; @@ -930,9 +1511,8 @@ alc_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->alc_flags & ALC_FLAG_MSIX) == 0 && - msic == ALC_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == ALC_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 04:50:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 129BCBBE; Tue, 21 Oct 2014 04:50:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1085D40; Tue, 21 Oct 2014 04:50:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4o7aC022656; Tue, 21 Oct 2014 04:50:07 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4o7oM022654; Tue, 21 Oct 2014 04:50:07 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210450.s9L4o7oM022654@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:50:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273367 - stable/9/sys/dev/alc X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 04:50:08 -0000 Author: yongari Date: Tue Oct 21 04:50:07 2014 New Revision: 273367 URL: https://svnweb.freebsd.org/changeset/base/273367 Log: MFC r272730,273018: Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers. These controllers seem to have the same feature of AR813x/AR815x and improved RSS support(4 TX queues and 8 RX queues). alc(4) supports all hardware features except RSS. I didn't implement RX checksum offloading for AR816x/AR817x just because I couldn't get confirmation from the Vendor whether AR816x/AR817x corrected its predecessor's RX checksum offloading bug on fragmented packets. This change adds supports for the following controllers. o AR8161 PCIe Gigabit Ethernet controller o AR8162 PCIe Fast Ethernet controller o AR8171 PCIe Gigabit Ethernet controller o AR8172 PCIe Fast Ethernet controller o Killer E2200 Gigabit Ethernet controller Modified: stable/9/sys/dev/alc/if_alc.c stable/9/sys/dev/alc/if_alcreg.h stable/9/sys/dev/alc/if_alcvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/alc/if_alc.c ============================================================================== --- stable/9/sys/dev/alc/if_alc.c Tue Oct 21 04:48:49 2014 (r273366) +++ stable/9/sys/dev/alc/if_alc.c Tue Oct 21 04:50:07 2014 (r273367) @@ -110,17 +110,31 @@ static struct alc_ident alc_ident_table[ "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8161, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8162, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8171, 9 * 1024, + "Atheros AR8161 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8172, 9 * 1024, + "Atheros AR8161 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024, + "Killer E2200 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *, int); +static void alc_aspm(struct alc_softc *, int, int); +static void alc_aspm_813x(struct alc_softc *, int); +static void alc_aspm_816x(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); +static void alc_config_msi(struct alc_softc *); static int alc_detach(device_t); static void alc_disable_l0s_l1(struct alc_softc *); static int alc_dma_alloc(struct alc_softc *); static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static void alc_dsp_fixup(struct alc_softc *, int); static int alc_encap(struct alc_softc *, struct mbuf **); static struct alc_ident * alc_find_ident(device_t); @@ -129,6 +143,9 @@ static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); #endif static void alc_get_macaddr(struct alc_softc *); +static void alc_get_macaddr_813x(struct alc_softc *); +static void alc_get_macaddr_816x(struct alc_softc *); +static void alc_get_macaddr_par(struct alc_softc *); static void alc_init(void *); static void alc_init_cmb(struct alc_softc *); static void alc_init_locked(struct alc_softc *); @@ -140,14 +157,26 @@ static void alc_int_task(void *, int); static int alc_intr(void *); static int alc_ioctl(struct ifnet *, u_long, caddr_t); static void alc_mac_config(struct alc_softc *); +static uint32_t alc_mii_readreg_813x(struct alc_softc *, int, int); +static uint32_t alc_mii_readreg_816x(struct alc_softc *, int, int); +static uint32_t alc_mii_writereg_813x(struct alc_softc *, int, int, int); +static uint32_t alc_mii_writereg_816x(struct alc_softc *, int, int, int); static int alc_miibus_readreg(device_t, int, int); static void alc_miibus_statchg(device_t); static int alc_miibus_writereg(device_t, int, int, int); +static uint32_t alc_miidbg_readreg(struct alc_softc *, int); +static uint32_t alc_miidbg_writereg(struct alc_softc *, int, int); +static uint32_t alc_miiext_readreg(struct alc_softc *, int, int); +static uint32_t alc_miiext_writereg(struct alc_softc *, int, int, int); static int alc_mediachange(struct ifnet *); +static int alc_mediachange_locked(struct alc_softc *); static void alc_mediastatus(struct ifnet *, struct ifmediareq *); static int alc_newbuf(struct alc_softc *, struct alc_rxdesc *); +static void alc_osc_reset(struct alc_softc *); static void alc_phy_down(struct alc_softc *); static void alc_phy_reset(struct alc_softc *); +static void alc_phy_reset_813x(struct alc_softc *); +static void alc_phy_reset_816x(struct alc_softc *); static int alc_probe(device_t); static void alc_reset(struct alc_softc *); static int alc_resume(device_t); @@ -157,6 +186,8 @@ static void alc_rxfilter(struct alc_soft static void alc_rxvlan(struct alc_softc *); static void alc_setlinkspeed(struct alc_softc *); static void alc_setwol(struct alc_softc *); +static void alc_setwol_813x(struct alc_softc *); +static void alc_setwol_816x(struct alc_softc *); static int alc_shutdown(device_t); static void alc_start(struct ifnet *); static void alc_start_locked(struct ifnet *); @@ -229,10 +260,21 @@ static int alc_miibus_readreg(device_t dev, int phy, int reg) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_readreg_816x(sc, phy, reg); + else + v = alc_mii_readreg_813x(sc, phy, reg); + return (v); +} + +static uint32_t +alc_mii_readreg_813x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t v; + int i; /* * For AR8132 fast ethernet controller, do not report 1000baseT @@ -261,14 +303,52 @@ alc_miibus_readreg(device_t dev, int phy return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); } +static uint32_t +alc_mii_readreg_816x(struct alc_softc *sc, int phy, int reg) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_REG_ADDR(reg)); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy read timeout : %d\n", reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + static int alc_miibus_writereg(device_t dev, int phy, int reg, int val) { struct alc_softc *sc; - uint32_t v; - int i; + int v; sc = device_get_softc(dev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + v = alc_mii_writereg_816x(sc, phy, reg, val); + else + v = alc_mii_writereg_813x(sc, phy, reg, val); + return (v); +} + +static uint32_t +alc_mii_writereg_813x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t v; + int i; CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -286,6 +366,32 @@ alc_miibus_writereg(device_t dev, int ph return (0); } +static uint32_t +alc_mii_writereg_816x(struct alc_softc *sc, int phy, int reg, int val) +{ + uint32_t clk, v; + int i; + + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | MDIO_REG_ADDR(reg) | + MDIO_SUP_PREAMBLE | clk); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy write timeout : %d\n", reg); + + return (0); +} + static void alc_miibus_statchg(device_t dev) { @@ -318,7 +424,6 @@ alc_miibus_statchg(device_t dev) break; } } - alc_stop_queue(sc); /* Stop Rx/Tx MACs. */ alc_stop_mac(sc); @@ -330,7 +435,159 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); + } + alc_aspm(sc, 0, IFM_SUBTYPE(mii->mii_media_active)); + alc_dsp_fixup(sc, IFM_SUBTYPE(mii->mii_media_active)); +} + +static uint32_t +alc_miidbg_readreg(struct alc_softc *sc, int reg) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA)); +} + +static uint32_t +alc_miidbg_writereg(struct alc_softc *sc, int reg, int val) +{ + + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR, + reg); + return (alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val)); +} + +static uint32_t +alc_miiext_readreg(struct alc_softc *sc, int devaddr, int reg) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) { + device_printf(sc->alc_dev, "phy ext read timeout : %d, %d\n", + devaddr, reg); + return (0); + } + + return ((v & MDIO_DATA_MASK) >> MDIO_DATA_SHIFT); +} + +static uint32_t +alc_miiext_writereg(struct alc_softc *sc, int devaddr, int reg, int val) +{ + uint32_t clk, v; + int i; + + CSR_WRITE_4(sc, ALC_EXT_MDIO, EXT_MDIO_REG(reg) | + EXT_MDIO_DEVADDR(devaddr)); + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) + clk = MDIO_CLK_25_128; + else + clk = MDIO_CLK_25_4; + CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | + ((val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT) | + MDIO_SUP_PREAMBLE | clk | MDIO_MODE_EXT); + for (i = ALC_PHY_TIMEOUT; i > 0; i--) { + DELAY(5); + v = CSR_READ_4(sc, ALC_MDIO); + if ((v & MDIO_OP_BUSY) == 0) + break; + } + + if (i == 0) + device_printf(sc->alc_dev, "phy ext write timeout : %d, %d\n", + devaddr, reg); + + return (0); +} + +static void +alc_dsp_fixup(struct alc_softc *sc, int media) +{ + uint16_t agc, len, val; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + return; + if (AR816X_REV(sc->alc_rev) >= AR816X_REV_C0) + return; + + /* + * Vendor PHY magic. + * 1000BT/AZ, wrong cable length + */ + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + len = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL6); + len = (len >> EXT_CLDCTL6_CAB_LEN_SHIFT) & + EXT_CLDCTL6_CAB_LEN_MASK; + agc = alc_miidbg_readreg(sc, MII_DBG_AGC); + agc = (agc >> DBG_AGC_2_VGA_SHIFT) & DBG_AGC_2_VGA_MASK; + if ((media == IFM_1000_T && len > EXT_CLDCTL6_CAB_LEN_SHORT1G && + agc > DBG_AGC_LONG1G_LIMT) || + (media == IFM_100_TX && len > DBG_AGC_LONG100M_LIMT && + agc > DBG_AGC_LONG1G_LIMT)) { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_LONG); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val |= ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } else { + alc_miidbg_writereg(sc, MII_DBG_AZ_ANADECT, + DBG_AZ_ANADECT_DEFAULT); + val = alc_miiext_readreg(sc, MII_EXT_ANEG, + MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, + val); + } + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + if (media == IFM_1000_T) { + /* + * Giga link threshold, raise the tolerance of + * noise 50%. + */ + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_HI << + DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } else if (media == IFM_100_TX) + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_UP); + } + } else { + val = alc_miiext_readreg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE); + val &= ~ANEG_AFEE_10BT_100M_TH; + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_AFE, val); + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0 && + AR816X_REV(sc->alc_rev) == AR816X_REV_B0) { + alc_miidbg_writereg(sc, MII_DBG_MSE16DB, + DBG_MSE16DB_DOWN); + val = alc_miidbg_readreg(sc, MII_DBG_MSE20DB); + val &= ~DBG_MSE20DB_TH_MASK; + val |= (DBG_MSE20DB_TH_DEFAULT << DBG_MSE20DB_TH_SHIFT); + alc_miidbg_writereg(sc, MII_DBG_MSE20DB, val); + } } } @@ -358,17 +615,29 @@ static int alc_mediachange(struct ifnet *ifp) { struct alc_softc *sc; - struct mii_data *mii; - struct mii_softc *miisc; int error; sc = ifp->if_softc; ALC_LOCK(sc); + error = alc_mediachange_locked(sc); + ALC_UNLOCK(sc); + + return (error); +} + +static int +alc_mediachange_locked(struct alc_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + + ALC_LOCK_ASSERT(sc); + mii = device_get_softc(sc->alc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); - ALC_UNLOCK(sc); return (error); } @@ -406,7 +675,17 @@ alc_probe(device_t dev) static void alc_get_macaddr(struct alc_softc *sc) { - uint32_t ea[2], opt; + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_get_macaddr_816x(sc); + else + alc_get_macaddr_813x(sc); +} + +static void +alc_get_macaddr_813x(struct alc_softc *sc) +{ + uint32_t opt; uint16_t val; int eeprom, i; @@ -501,6 +780,73 @@ alc_get_macaddr(struct alc_softc *sc) } } + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_816x(struct alc_softc *sc) +{ + uint32_t reg; + int i, reloaded; + + reloaded = 0; + /* Try to reload station address via TWSI. */ + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & (SLD_PROGRESS | SLD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_SLD, reg | SLD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_SLD); + if ((reg & SLD_START) == 0) + break; + } + if (i != 0) + reloaded++; + else if (bootverbose) + device_printf(sc->alc_dev, + "reloading station address via TWSI timed out!\n"); + } + + /* Try to reload station address from EEPROM or FLASH. */ + if (reloaded == 0) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_EEPROM_EXIST | + EEPROM_LD_FLASH_EXIST)) != 0) { + for (i = 100; i > 0; i--) { + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & (EEPROM_LD_PROGRESS | + EEPROM_LD_START)) == 0) + break; + DELAY(1000); + } + if (i != 0) { + CSR_WRITE_4(sc, ALC_EEPROM_LD, reg | + EEPROM_LD_START); + for (i = 100; i > 0; i--) { + DELAY(1000); + reg = CSR_READ_4(sc, ALC_EEPROM_LD); + if ((reg & EEPROM_LD_START) == 0) + break; + } + } else if (bootverbose) + device_printf(sc->alc_dev, + "reloading EEPROM/FLASH timed out!\n"); + } + } + + alc_get_macaddr_par(sc); +} + +static void +alc_get_macaddr_par(struct alc_softc *sc) +{ + uint32_t ea[2]; + ea[0] = CSR_READ_4(sc, ALC_PAR0); ea[1] = CSR_READ_4(sc, ALC_PAR1); sc->alc_eaddr[0] = (ea[1] >> 8) & 0xFF; @@ -516,19 +862,31 @@ alc_disable_l0s_l1(struct alc_softc *sc) { uint32_t pmcfg; - /* Another magic from vendor. */ - pmcfg = CSR_READ_4(sc, ALC_PM_CFG); - pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | - PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK | - PM_CFG_SERDES_PD_EX_L1); - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | - PM_CFG_SERDES_L1_ENB; - CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { + /* Another magic from vendor. */ + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_SERDES_PD_EX_L1); + pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | PM_CFG_SERDES_L1_ENB; + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); + } } static void alc_phy_reset(struct alc_softc *sc) { + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_phy_reset_816x(sc); + else + alc_phy_reset_813x(sc); +} + +static void +alc_phy_reset_813x(struct alc_softc *sc) +{ uint16_t data; /* Reset magic from Linux. */ @@ -641,12 +999,101 @@ alc_phy_reset(struct alc_softc *sc) } static void +alc_phy_reset_816x(struct alc_softc *sc) +{ + uint32_t val; + + val = CSR_READ_4(sc, ALC_GPHY_CFG); + val &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_GATE_25M_ENB | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PHY_PLL_ON | + GPHY_CFG_PWDOWN_HW | GPHY_CFG_100AB_ENB); + val |= GPHY_CFG_SEL_ANA_RESET; +#ifdef notyet + val |= GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN | GPHY_CFG_SEL_ANA_RESET; +#else + /* Disable PHY hibernation. */ + val &= ~(GPHY_CFG_HIB_PULSE | GPHY_CFG_HIB_EN); +#endif + CSR_WRITE_4(sc, ALC_GPHY_CFG, val); + DELAY(10); + CSR_WRITE_4(sc, ALC_GPHY_CFG, val | GPHY_CFG_EXT_RESET); + DELAY(800); + + /* Vendor PHY magic. */ +#ifdef notyet + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, DBG_LEGCYPS_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SYSMODCTL, DBG_SYSMODCTL_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_VDRVBIAS, + EXT_VDRVBIAS_DEFAULT); +#else + /* Disable PHY hibernation. */ + alc_miidbg_writereg(sc, MII_DBG_LEGCYPS, + DBG_LEGCYPS_DEFAULT & ~DBG_LEGCYPS_ENB); + alc_miidbg_writereg(sc, MII_DBG_HIBNEG, + DBG_HIBNEG_DEFAULT & ~(DBG_HIBNEG_PSHIB_EN | DBG_HIBNEG_HIB_PULSE)); + alc_miidbg_writereg(sc, MII_DBG_GREENCFG, DBG_GREENCFG_DEFAULT); +#endif + + /* XXX Disable EEE. */ + val = CSR_READ_4(sc, ALC_LPI_CTL); + val &= ~LPI_CTL_ENB; + CSR_WRITE_4(sc, ALC_LPI_CTL, val); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_LOCAL_EEEADV, 0); + + /* PHY power saving. */ + alc_miidbg_writereg(sc, MII_DBG_TST10BTCFG, DBG_TST10BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_SRDSYSMOD, DBG_SRDSYSMOD_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_TST100BTCFG, DBG_TST100BTCFG_DEFAULT); + alc_miidbg_writereg(sc, MII_DBG_ANACTL, DBG_ANACTL_DEFAULT); + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val &= ~DBG_GREENCFG2_GATE_DFSE_EN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + + /* RTL8139C, 120m issue. */ + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_NLP78, + ANEG_NLP78_120M_DEFAULT); + alc_miiext_writereg(sc, MII_EXT_ANEG, MII_EXT_ANEG_S3DIG10, + ANEG_S3DIG10_DEFAULT); + + if ((sc->alc_flags & ALC_FLAG_LINK_WAR) != 0) { + /* Turn off half amplitude. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3); + val |= EXT_CLDCTL3_BP_CABLE1TH_DET_GT; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL3, val); + /* Turn off Green feature. */ + val = alc_miidbg_readreg(sc, MII_DBG_GREENCFG2); + val |= DBG_GREENCFG2_BP_GREEN; + alc_miidbg_writereg(sc, MII_DBG_GREENCFG2, val); + /* Turn off half bias. */ + val = alc_miiext_readreg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5); + val |= EXT_CLDCTL5_BP_VD_HLFBIAS; + alc_miiext_writereg(sc, MII_EXT_PCS, MII_EXT_CLDCTL5, val); + } +} + +static void alc_phy_down(struct alc_softc *sc) { + uint32_t gphy; switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8171: + case DEVICEID_ATHEROS_AR8172: + gphy = CSR_READ_4(sc, ALC_GPHY_CFG); + gphy &= ~(GPHY_CFG_EXT_RESET | GPHY_CFG_LED_MODE | + GPHY_CFG_100AB_ENB | GPHY_CFG_PHY_PLL_ON); + gphy |= GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET; + gphy |= GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW; + CSR_WRITE_4(sc, ALC_GPHY_CFG, gphy); + break; case DEVICEID_ATHEROS_AR8151: case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: /* * GPHY power down caused more problems on AR8151 v2.0. * When driver is reloaded after GPHY power down, @@ -672,12 +1119,23 @@ alc_phy_down(struct alc_softc *sc) } static void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, int init, int media) +{ + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + alc_aspm_816x(sc, init); + else + alc_aspm_813x(sc, media); +} + +static void +alc_aspm_813x(struct alc_softc *sc, int media) { uint32_t pmcfg; uint16_t linkcfg; - ALC_LOCK_ASSERT(sc); + if ((sc->alc_flags & ALC_FLAG_LINK) == 0) + return; pmcfg = CSR_READ_4(sc, ALC_PM_CFG); if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == @@ -758,71 +1216,61 @@ alc_aspm(struct alc_softc *sc, int media CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } -static int -alc_attach(device_t dev) +static void +alc_aspm_816x(struct alc_softc *sc, int init) { - struct alc_softc *sc; - struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; - uint16_t burst; - int base, error, i, msic, msixc, state; - uint32_t cap, ctl, val; - - error = 0; - sc = device_get_softc(dev); - sc->alc_dev = dev; - - mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); - TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); - sc->alc_ident = alc_find_ident(dev); + uint32_t pmcfg; - /* Map the device. */ - pci_enable_busmaster(dev); - sc->alc_res_spec = alc_res_spec_mem; - sc->alc_irq_spec = alc_irq_spec_legacy; - error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); - if (error != 0) { - device_printf(dev, "cannot allocate memory resources.\n"); - goto fail; + pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_816X_MASK; + pmcfg |= PM_CFG_L1_ENTRY_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= PM_CFG_PM_REQ_TIMER_816X_DEFAULT; + pmcfg &= ~PM_CFG_LCKDET_TIMER_MASK; + pmcfg |= PM_CFG_LCKDET_TIMER_DEFAULT; + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_CLK_SWH_L1 | PM_CFG_PCIE_RECV; + pmcfg &= ~(PM_CFG_RX_L1_AFTER_L0S | PM_CFG_TX_L1_AFTER_L0S | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB | + PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SA_DLY_ENB | + PM_CFG_MAC_ASPM_CHK | PM_CFG_HOTRST); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) + pmcfg |= PM_CFG_SERDES_L1_ENB | PM_CFG_SERDES_PLL_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { + /* Link up, enable both L0s, L1s. */ + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + } else { + if (init != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB | PM_CFG_ASPM_L1_ENB | + PM_CFG_MAC_ASPM_CHK; + else if ((sc->alc_ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB | PM_CFG_MAC_ASPM_CHK; } + CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); +} - /* Set PHY address. */ - sc->alc_phyaddr = ALC_PHY_ADDR; +static void +alc_init_pcie(struct alc_softc *sc) +{ + const char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; + uint32_t cap, ctl, val; + int state; - /* Initialize DMA parameters. */ - sc->alc_dma_rd_burst = 0; - sc->alc_dma_wr_burst = 0; - sc->alc_rcb = DMA_CFG_RCB_64; - if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { - sc->alc_flags |= ALC_FLAG_PCIE; - sc->alc_expcap = base; - burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); - sc->alc_dma_rd_burst = - (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; - sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; - if (bootverbose) { - device_printf(dev, "Read request size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_rd_burst]); - device_printf(dev, "TLP payload size : %u bytes.\n", - alc_dma_burst[sc->alc_dma_wr_burst]); - } - if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) - sc->alc_dma_rd_burst = 3; - if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) - sc->alc_dma_wr_burst = 3; - /* Clear data link and flow-control protocol error. */ - val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); - val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); - CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + /* Clear data link and flow-control protocol error. */ + val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); + val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); + CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) == 0) { CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, CSR_READ_4(sc, ALC_PCIE_PHYMISC) | PCIE_PHYMISC_FORCE_RCV_DET); if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && - pci_get_revid(dev) == ATHEROS_AR8152_B_V10) { + sc->alc_rev == ATHEROS_AR8152_B_V10) { val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | PCIE_PHYMISC2_SERDES_TH_MASK); @@ -831,13 +1279,13 @@ alc_attach(device_t dev) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); } /* Disable ASPM L0S and L1. */ - cap = CSR_READ_2(sc, base + PCIER_LINK_CAP); + cap = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CAP); if ((cap & PCIEM_LINK_CAP_ASPM) != 0) { - ctl = CSR_READ_2(sc, base + PCIER_LINK_CTL); + ctl = CSR_READ_2(sc, sc->alc_expcap + PCIER_LINK_CTL); if ((ctl & 0x08) != 0) sc->alc_rcb = DMA_CFG_RCB_128; if (bootverbose) - device_printf(dev, "RCB %u bytes\n", + device_printf(sc->alc_dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; if (state & 0x01) @@ -854,13 +1302,91 @@ alc_attach(device_t dev) device_printf(sc->alc_dev, "no ASPM support\n"); } + } else { + val = CSR_READ_4(sc, ALC_PDLL_TRNS1); + val &= ~PDLL_TRNS1_D3PLLOFF_ENB; + CSR_WRITE_4(sc, ALC_PDLL_TRNS1, val); + val = CSR_READ_4(sc, ALC_MASTER_CFG); + if (AR816X_REV(sc->alc_rev) <= AR816X_REV_A1 && + (sc->alc_rev & 0x01) != 0) { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) == 0) { + val |= MASTER_WAKEN_25M | MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } else { + if ((val & MASTER_WAKEN_25M) == 0 || + (val & MASTER_CLK_SEL_DIS) != 0) { + val |= MASTER_WAKEN_25M; + val &= ~MASTER_CLK_SEL_DIS; + CSR_WRITE_4(sc, ALC_MASTER_CFG, val); + } + } } + alc_aspm(sc, 1, IFM_UNKNOWN); +} - /* Reset PHY. */ - alc_phy_reset(sc); +static void +alc_config_msi(struct alc_softc *sc) +{ + uint32_t ctl, mod; - /* Reset the ethernet controller. */ - alc_reset(sc); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) { + /* + * It seems interrupt moderation is controlled by + * ALC_MSI_RETRANS_TIMER register if MSI/MSIX is active. + * Driver uses RX interrupt moderation parameter to + * program ALC_MSI_RETRANS_TIMER register. + */ + ctl = CSR_READ_4(sc, ALC_MSI_RETRANS_TIMER); + ctl &= ~MSI_RETRANS_TIMER_MASK; + ctl &= ~MSI_RETRANS_MASK_SEL_LINE; + mod = ALC_USECS(sc->alc_int_rx_mod); + if (mod == 0) + mod = 1; + ctl |= mod; + if ((sc->alc_flags & ALC_FLAG_MSIX) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_STD); + else if ((sc->alc_flags & ALC_FLAG_MSI) != 0) + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, ctl | + MSI_RETRANS_MASK_SEL_LINE); + else + CSR_WRITE_4(sc, ALC_MSI_RETRANS_TIMER, 0); + } +} + +static int +alc_attach(device_t dev) +{ + struct alc_softc *sc; + struct ifnet *ifp; + int base, error, i, msic, msixc; + uint16_t burst; + + error = 0; + sc = device_get_softc(dev); + sc->alc_dev = dev; + sc->alc_rev = pci_get_revid(dev); + + mtx_init(&sc->alc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); + TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); + + /* Map the device. */ + pci_enable_busmaster(dev); + sc->alc_res_spec = alc_res_spec_mem; + sc->alc_irq_spec = alc_irq_spec_legacy; + error = bus_alloc_resources(dev, sc->alc_res_spec, sc->alc_res); + if (error != 0) { + device_printf(dev, "cannot allocate memory resources.\n"); + goto fail; + } + + /* Set PHY address. */ + sc->alc_phyaddr = ALC_PHY_ADDR; /* * One odd thing is AR8132 uses the same PHY hardware(F1 @@ -870,6 +1396,19 @@ alc_attach(device_t dev) * shows the same PHY model/revision number of AR8131. */ switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8161: + if (pci_get_subvendor(dev) == VENDORID_ATHEROS && + pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0) + sc->alc_flags |= ALC_FLAG_LINK_WAR; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_E2200: + case DEVICEID_ATHEROS_AR8171: + sc->alc_flags |= ALC_FLAG_AR816X_FAMILY; + break; + case DEVICEID_ATHEROS_AR8162: + case DEVICEID_ATHEROS_AR8172: + sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_AR816X_FAMILY; + break; case DEVICEID_ATHEROS_AR8152_B: case DEVICEID_ATHEROS_AR8152_B2: sc->alc_flags |= ALC_FLAG_APS; @@ -884,7 +1423,7 @@ alc_attach(device_t dev) default: break; } - sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + sc->alc_flags |= ALC_FLAG_JUMBO; /* * It seems that AR813x/AR815x has silicon bug for SMB. In @@ -897,7 +1436,6 @@ alc_attach(device_t dev) * Don't use Tx CMB. It is known to have silicon bug. */ sc->alc_flags |= ALC_FLAG_CMB_BUG; - sc->alc_rev = pci_get_revid(dev); sc->alc_chip_rev = CSR_READ_4(sc, ALC_MASTER_CFG) >> MASTER_CHIP_REV_SHIFT; if (bootverbose) { @@ -905,11 +1443,45 @@ alc_attach(device_t dev) sc->alc_rev); device_printf(dev, "Chip id/revision : 0x%04x\n", sc->alc_chip_rev); + if ((sc->alc_flags & ALC_FLAG_AR816X_FAMILY) != 0) + device_printf(dev, "AR816x revision : 0x%x\n", + AR816X_REV(sc->alc_rev)); } device_printf(dev, "%u Tx FIFO, %u Rx FIFO\n", CSR_READ_4(sc, ALC_SRAM_TX_FIFO_LEN) * 8, CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN) * 8); + /* Initialize DMA parameters. */ + sc->alc_dma_rd_burst = 0; + sc->alc_dma_wr_burst = 0; + sc->alc_rcb = DMA_CFG_RCB_64; + if (pci_find_cap(dev, PCIY_EXPRESS, &base) == 0) { + sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; + burst = CSR_READ_2(sc, base + PCIER_DEVICE_CTL); + sc->alc_dma_rd_burst = + (burst & PCIEM_CTL_MAX_READ_REQUEST) >> 12; + sc->alc_dma_wr_burst = (burst & PCIEM_CTL_MAX_PAYLOAD) >> 5; + if (bootverbose) { + device_printf(dev, "Read request size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_rd_burst]); + device_printf(dev, "TLP payload size : %u bytes.\n", + alc_dma_burst[sc->alc_dma_wr_burst]); + } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; + alc_init_pcie(sc); + } + + /* Reset PHY. */ + alc_phy_reset(sc); + + /* Reset the ethernet controller. */ + alc_stop_mac(sc); + alc_reset(sc); + /* Allocate IRQ resources. */ msixc = pci_msix_count(dev); msic = pci_msi_count(dev); @@ -917,11 +1489,20 @@ alc_attach(device_t dev) device_printf(dev, "MSIX count : %d\n", msixc); device_printf(dev, "MSI count : %d\n", msic); } - /* Prefer MSIX over MSI. */ + if (msixc > 1) + msixc = 1; + if (msic > 1) + msic = 1; + /* + * Prefer MSIX over MSI. + * AR816x controller has a silicon bug that MSI interrupt + * does not assert if PCIM_CMD_INTxDIS bit of command + * register is set. pci(4) was taught to handle that case. + */ if (msix_disable == 0 || msi_disable == 0) { - if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES && + if (msix_disable == 0 && msixc > 0 && pci_alloc_msix(dev, &msixc) == 0) { - if (msic == ALC_MSIX_MESSAGES) { + if (msic == 1) { device_printf(dev, "Using %d MSIX message(s).\n", msixc); sc->alc_flags |= ALC_FLAG_MSIX; @@ -930,9 +1511,8 @@ alc_attach(device_t dev) pci_release_msi(dev); } if (msi_disable == 0 && (sc->alc_flags & ALC_FLAG_MSIX) == 0 && - msic == ALC_MSI_MESSAGES && - pci_alloc_msi(dev, &msic) == 0) { - if (msic == ALC_MSI_MESSAGES) { + msic > 0 && pci_alloc_msi(dev, &msic) == 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 04:54:37 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED0A5D42; Tue, 21 Oct 2014 04:54:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE27ADE6; Tue, 21 Oct 2014 04:54:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4sbwt024747; Tue, 21 Oct 2014 04:54:37 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4sbMY024746; Tue, 21 Oct 2014 04:54:37 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210454.s9L4sbMY024746@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273368 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 04:54:38 -0000 Author: yongari Date: Tue Oct 21 04:54:37 2014 New Revision: 273368 URL: https://svnweb.freebsd.org/changeset/base/273368 Log: MFC r272731: Document newly added controller AR816x/AR817x. Modified: stable/10/share/man/man4/alc.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/alc.4 ============================================================================== --- stable/10/share/man/man4/alc.4 Tue Oct 21 04:50:07 2014 (r273367) +++ stable/10/share/man/man4/alc.4 Tue Oct 21 04:54:37 2014 (r273368) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 8, 2014 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x/AR816x/AR817x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,8 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR813x and AR815x PCI -Express Gigabit/Fast Ethernet controllers. +device driver provides support for Atheros AR813x, AR815x, AR816x +and AR817x PCI Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -58,9 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 -bytes, respectively), which can be configured via the interface -MTU setting. +The AR813x, AR815x, AR816x and AR817x supports Jumbo Frames (up to +9216, 6144, 9216 and 9216 bytes, respectively), which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -112,6 +112,16 @@ Atheros AR8151 v2.0 PCI Express Gigabit Atheros AR8152 v1.1 PCI Express Fast Ethernet controller .It Atheros AR8152 v2.0 PCI Express Fast Ethernet controller +.It +Atheros AR8161 PCI Express Gigabit Ethernet controller +.It +Atheros AR8162 PCI Express Fast Ethernet controller +.It +Atheros AR8171 PCI Express Gigabit Ethernet controller +.It +Atheros AR8172 PCI Express Fast Ethernet controller +.It +Killer E2200 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 04:55:56 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77D84E7B; Tue, 21 Oct 2014 04:55:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49457DF0; Tue, 21 Oct 2014 04:55:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4tuM9025050; Tue, 21 Oct 2014 04:55:56 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4tuCs025049; Tue, 21 Oct 2014 04:55:56 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210455.s9L4tuCs025049@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 04:55:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273369 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 04:55:56 -0000 Author: yongari Date: Tue Oct 21 04:55:55 2014 New Revision: 273369 URL: https://svnweb.freebsd.org/changeset/base/273369 Log: MFC r272731: Document newly added controller AR816x/AR817x. Modified: stable/9/share/man/man4/alc.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/alc.4 ============================================================================== --- stable/9/share/man/man4/alc.4 Tue Oct 21 04:54:37 2014 (r273368) +++ stable/9/share/man/man4/alc.4 Tue Oct 21 04:55:55 2014 (r273369) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2010 +.Dd October 8, 2014 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x/AR816x/AR817x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,8 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR813x and AR815x PCI -Express Gigabit/Fast Ethernet controllers. +device driver provides support for Atheros AR813x, AR815x, AR816x +and AR817x PCI Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -58,9 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 -bytes, respectively), which can be configured via the interface -MTU setting. +The AR813x, AR815x, AR816x and AR817x supports Jumbo Frames (up to +9216, 6144, 9216 and 9216 bytes, respectively), which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -112,6 +112,16 @@ Atheros AR8151 v2.0 PCI Express Gigabit Atheros AR8152 v1.1 PCI Express Fast Ethernet controller .It Atheros AR8152 v2.0 PCI Express Fast Ethernet controller +.It +Atheros AR8161 PCI Express Gigabit Ethernet controller +.It +Atheros AR8162 PCI Express Fast Ethernet controller +.It +Atheros AR8171 PCI Express Gigabit Ethernet controller +.It +Atheros AR8172 PCI Express Fast Ethernet controller +.It +Killer E2200 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 06:23:15 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5044634F; Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF5F8F7; Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6NFIw067151; Tue, 21 Oct 2014 06:23:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6NFUh067150; Tue, 21 Oct 2014 06:23:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210623.s9L6NFUh067150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:23:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273372 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 06:23:15 -0000 Author: mav Date: Tue Oct 21 06:23:14 2014 New Revision: 273372 URL: https://svnweb.freebsd.org/changeset/base/273372 Log: MFC r262294 (by ivoras): Explain how and where kern.cam.ada.write_cache can be set in practical situations. Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 05:45:57 2014 (r273371) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:23:14 2014 (r273372) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd February 21, 2014 .Dt ADA 4 .Os .Sh NAME @@ -129,8 +129,13 @@ The default is currently enabled. These variables determines whether device write cache should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. -Values modified in runtime take effect only after device reset. -The global default is currently enabled. +Values modified at runtime take effect only after device reset +.Pq using the reset subcommand of Xr camcontrol 8 . +Because of that, this setting should be changed in +.Pa /boot/loader.conf +instead of +.Pa /etc/sysctl.conf . +The global default is currently 1. The per-device default is to leave it as-is (follow global setting). .El .Sh FILES From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 06:24:16 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 646AF486; Tue, 21 Oct 2014 06:24:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5026A900; Tue, 21 Oct 2014 06:24:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6OGoG067339; Tue, 21 Oct 2014 06:24:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6OGXU067338; Tue, 21 Oct 2014 06:24:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210624.s9L6OGXU067338@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:24:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273373 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 06:24:16 -0000 Author: mav Date: Tue Oct 21 06:24:15 2014 New Revision: 273373 URL: https://svnweb.freebsd.org/changeset/base/273373 Log: MFC r262332 (by ivoras): Grammar fix Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 06:23:14 2014 (r273372) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:24:15 2014 (r273373) @@ -126,7 +126,7 @@ The default is currently enabled. .It Va kern.cam.ada.write_cache .It Va kern.cam.ada. Ns Ar X Ns Va .write_cache .Pp -These variables determines whether device write cache should be enabled +These variables determine whether device write cache should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. Values modified at runtime take effect only after device reset From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 06:25:42 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A9B45EA; Tue, 21 Oct 2014 06:25:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2667B914; Tue, 21 Oct 2014 06:25:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L6PgU1067601; Tue, 21 Oct 2014 06:25:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L6PgQk067600; Tue, 21 Oct 2014 06:25:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410210625.s9L6PgQk067600@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 21 Oct 2014 06:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273374 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 06:25:42 -0000 Author: mav Date: Tue Oct 21 06:25:41 2014 New Revision: 273374 URL: https://svnweb.freebsd.org/changeset/base/273374 Log: MFC r271926: Mention read_ahead tunables/sysctls. Modified: stable/10/share/man/man4/ada.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ada.4 ============================================================================== --- stable/10/share/man/man4/ada.4 Tue Oct 21 06:24:15 2014 (r273373) +++ stable/10/share/man/man4/ada.4 Tue Oct 21 06:25:41 2014 (r273374) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 21, 2014 +.Dd September 21, 2014 .Dt ADA 4 .Os .Sh NAME @@ -123,11 +123,13 @@ seconds. This variable determines whether to spin-down disks when shutting down. Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. +.It Va kern.cam.ada.read_ahead +.It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead .It Va kern.cam.ada.write_cache .It Va kern.cam.ada. Ns Ar X Ns Va .write_cache .Pp -These variables determine whether device write cache should be enabled -globally or per-device or disabled. +These variables determine whether device read-ahead and write caches +should be enabled globally or per-device or disabled. Set to 1 to enable write cache, 0 to disable, -1 to leave it as-is. Values modified at runtime take effect only after device reset .Pq using the reset subcommand of Xr camcontrol 8 . From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 08:24:14 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4217DEB7; Tue, 21 Oct 2014 08:24:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 138296C5; Tue, 21 Oct 2014 08:24:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L8OD6g023615; Tue, 21 Oct 2014 08:24:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L8ODM1023612; Tue, 21 Oct 2014 08:24:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210824.s9L8ODM1023612@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 08:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273379 - in stable/10/sys/ofed: drivers/net/mlx4 include/linux/mlx4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 08:24:14 -0000 Author: hselasky Date: Tue Oct 21 08:24:12 2014 New Revision: 273379 URL: https://svnweb.freebsd.org/changeset/base/273379 Log: MFC r272683: - Fix compile warning when compiling with GCC. - Add missed chunk in previous driver code MFC. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c stable/10/sys/ofed/drivers/net/mlx4/mlx4.h stable/10/sys/ofed/include/linux/mlx4/device.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_tx.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/drivers/net/mlx4/en_tx.c Tue Oct 21 08:24:12 2014 (r273379) @@ -1028,9 +1028,6 @@ mlx4_en_transmit_locked(struct ifnet *de } drbr_advance(dev, ring->br); enqueued++; - dev->if_obytes += next->m_pkthdr.len; - if (next->m_flags & M_MCAST) - dev->if_omcasts++; if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) break; } Modified: stable/10/sys/ofed/drivers/net/mlx4/mlx4.h ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/drivers/net/mlx4/mlx4.h Tue Oct 21 08:24:12 2014 (r273379) @@ -1234,6 +1234,7 @@ int mlx4_trans_to_dmfs_attach(struct mlx u8 gid[16], u8 port, int block_mcast_loopback, enum mlx4_protocol prot, u64 *reg_id); +int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_SET_MCAST_FLTR_wrapper(struct mlx4_dev *dev, int slave, struct mlx4_vhcr *vhcr, struct mlx4_cmd_mailbox *inbox, Modified: stable/10/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- stable/10/sys/ofed/include/linux/mlx4/device.h Tue Oct 21 07:49:34 2014 (r273378) +++ stable/10/sys/ofed/include/linux/mlx4/device.h Tue Oct 21 08:24:12 2014 (r273379) @@ -1210,7 +1210,6 @@ int mlx4_multicast_promisc_add(struct ml int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port); int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port); -int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode); int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac); void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 13:07:36 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD3E2FFF; Tue, 21 Oct 2014 13:07:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B99BFA5C; Tue, 21 Oct 2014 13:07:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LD7a43058773; Tue, 21 Oct 2014 13:07:36 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LD7a18058771; Tue, 21 Oct 2014 13:07:36 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201410211307.s9LD7a18058771@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 21 Oct 2014 13:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273383 - stable/10/sys/dev/amdtemp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 13:07:36 -0000 Author: brueffer Date: Tue Oct 21 13:07:36 2014 New Revision: 273383 URL: https://svnweb.freebsd.org/changeset/base/273383 Log: MFC: r273034 Add one more AMD Kaveri APU device ID. Submitted by: Remy Nonnenmacher Modified: stable/10/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/10/sys/dev/amdtemp/amdtemp.c Tue Oct 21 12:52:01 2014 (r273382) +++ stable/10/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:07:36 2014 (r273383) @@ -80,6 +80,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC14 0x1703 #define DEVICEID_AMD_MISC15 0x1603 #define DEVICEID_AMD_MISC16 0x1533 +#define DEVICEID_AMD_MISC17 0x141d static struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -92,6 +93,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC14 }, { VENDORID_AMD, DEVICEID_AMD_MISC15 }, { VENDORID_AMD, DEVICEID_AMD_MISC16 }, + { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { 0, 0 } }; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 13:09:53 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9503C205; Tue, 21 Oct 2014 13:09:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80CC4A88; Tue, 21 Oct 2014 13:09:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LD9r5V059186; Tue, 21 Oct 2014 13:09:53 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LD9rZx059185; Tue, 21 Oct 2014 13:09:53 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201410211309.s9LD9rZx059185@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Tue, 21 Oct 2014 13:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273384 - stable/9/sys/dev/amdtemp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 13:09:53 -0000 Author: brueffer Date: Tue Oct 21 13:09:52 2014 New Revision: 273384 URL: https://svnweb.freebsd.org/changeset/base/273384 Log: MFC: r273034 Add one more AMD Kaveri APU device ID. Submitted by: Remy Nonnenmacher Modified: stable/9/sys/dev/amdtemp/amdtemp.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/amdtemp/amdtemp.c ============================================================================== --- stable/9/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:07:36 2014 (r273383) +++ stable/9/sys/dev/amdtemp/amdtemp.c Tue Oct 21 13:09:52 2014 (r273384) @@ -77,6 +77,7 @@ struct amdtemp_softc { #define DEVICEID_AMD_MISC10 0x1203 #define DEVICEID_AMD_MISC11 0x1303 #define DEVICEID_AMD_MISC16 0x1533 +#define DEVICEID_AMD_MISC17 0x141d static struct amdtemp_product { uint16_t amdtemp_vendorid; @@ -86,6 +87,7 @@ static struct amdtemp_product { { VENDORID_AMD, DEVICEID_AMD_MISC10 }, { VENDORID_AMD, DEVICEID_AMD_MISC11 }, { VENDORID_AMD, DEVICEID_AMD_MISC16 }, + { VENDORID_AMD, DEVICEID_AMD_MISC17 }, { 0, 0 } }; From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 14:47:27 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4BD1370D; Tue, 21 Oct 2014 14:47:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36E5B854; Tue, 21 Oct 2014 14:47:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LElRkN005863; Tue, 21 Oct 2014 14:47:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LElQ7I005861; Tue, 21 Oct 2014 14:47:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410211447.s9LElQ7I005861@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 14:47: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: r273385 - stable/10/share/man/man8 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 14:47:27 -0000 Author: emaste Date: Tue Oct 21 14:47:26 2014 New Revision: 273385 URL: https://svnweb.freebsd.org/changeset/base/273385 Log: Add basic UEFI boot procedure manpage MFC of r273218 and r273235. Added: stable/10/share/man/man8/uefi.8 - copied, changed from r273218, head/share/man/man8/uefi.8 Modified: stable/10/share/man/man8/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man8/Makefile ============================================================================== --- stable/10/share/man/man8/Makefile Tue Oct 21 13:09:52 2014 (r273384) +++ stable/10/share/man/man8/Makefile Tue Oct 21 14:47:26 2014 (r273385) @@ -11,6 +11,7 @@ MAN= crash.8 \ rc.sendmail.8 \ rc.subr.8 \ rescue.8 \ + ${_uefi.8} \ yp.8 MLINKS= rc.8 rc.atm.8 \ @@ -25,4 +26,8 @@ MLINKS+=yp.8 NIS.8 \ yp.8 nis.8 \ yp.8 YP.8 +.if ${MACHINE_CPUARCH} == "amd64" +_uefi.8= uefi.8 +.endif + .include Copied and modified: stable/10/share/man/man8/uefi.8 (from r273218, head/share/man/man8/uefi.8) ============================================================================== --- head/share/man/man8/uefi.8 Fri Oct 17 13:50:37 2014 (r273218, copy source) +++ stable/10/share/man/man8/uefi.8 Tue Oct 21 14:47:26 2014 (r273385) @@ -31,10 +31,10 @@ .Nm UEFI .Nd Unified Extensible Firmware Interface bootstrapping procedures .Sh DESCRIPTION -The +The .Nm Unified Extensible Firmware Interface provides boot- and run-time services -services to operating systems. +to operating systems. .Nm is a replacement for the legacy BIOS on the i386 and amd64 CPU architectures, and is also used on arm64 and ia64. @@ -43,7 +43,7 @@ The .Nm boot process loads system bootstrap code located in an EFI System Partition (ESP). -The ESP is a GPT or MBR parition with a specific identifier that contains an +The ESP is a GPT or MBR partition with a specific identifier that contains an .Xr msdosfs 5 FAT file system with a specified file hierarchy. .Bl -column -offset indent ".Sy Partition Scheme" ".Sy ESP Identifier" @@ -100,7 +100,7 @@ FAT file system image containing for use by .Xr bsdinstall 8 and the -.Ar bootcode +.Ar bootcode argument to .Xr gpart 8 . .It Pa /boot/loader.efi @@ -110,26 +110,6 @@ default kernel .It Pa /boot/kernel.old/kernel typical non-default kernel (optional) .El -.Sh CAVEATS -EFI environment variables are not supported by -.Xr loader 8 -or the kernel. -.Pp -.Pa boot1.efi -loads -.Pa loader.efi -from the first FreeBSD-UFS file system it locates, even if it is on a -different disk. -.Pp -.Pa boot1.efi -cannot load -.Pa loader.efi -from a -.Xr ZFS 8 -file system. -As a result, -.Nm -does not support a typical root file system on ZFS configuration. .Sh SEE ALSO .Xr vt 4 , .Xr msdosfs 5 , @@ -150,3 +130,23 @@ and The .Fx Foundation sponsored portions of the work. +.Sh CAVEATS +EFI environment variables are not supported by +.Xr loader 8 +or the kernel. +.Pp +.Pa boot1.efi +loads +.Pa loader.efi +from the first FreeBSD-UFS file system it locates, even if it is on a +different disk. +.Pp +.Pa boot1.efi +cannot load +.Pa loader.efi +from a +.Xr ZFS 8 +file system. +As a result, +.Nm +does not support a typical root file system on ZFS configuration. From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 16:44:04 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C8433B0; Tue, 21 Oct 2014 16:44:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D0D3798; Tue, 21 Oct 2014 16:44:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LGi3Ct062985; Tue, 21 Oct 2014 16:44:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LGi3B7062984; Tue, 21 Oct 2014 16:44:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410211644.s9LGi3B7062984@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 21 Oct 2014 16:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273387 - stable/9/contrib/libc-vis X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 16:44:04 -0000 Author: brooks Date: Tue Oct 21 16:44:03 2014 New Revision: 273387 URL: https://svnweb.freebsd.org/changeset/base/273387 Log: MFC r271287: Merge from NetBSD: PR/49185: Conrad Meyer: strvisx: Handle zero-length input strings gracefully. (don't abuse 0 to mean compute string length internally) PR: 193447 Submitted by: Conrad Meyer Modified: stable/9/contrib/libc-vis/vis.c Directory Properties: stable/9/contrib/libc-vis/ (props changed) Modified: stable/9/contrib/libc-vis/vis.c ============================================================================== --- stable/9/contrib/libc-vis/vis.c Tue Oct 21 16:20:23 2014 (r273386) +++ stable/9/contrib/libc-vis/vis.c Tue Oct 21 16:44:03 2014 (r273387) @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $ */ +/* $NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -57,7 +57,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: vis.c,v 1.60 2013/02/21 16:21:20 joerg Exp $"); +__RCSID("$NetBSD: vis.c,v 1.62 2014/09/08 17:35:01 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef __FBSDID __FBSDID("$FreeBSD$"); @@ -357,7 +357,7 @@ istrsenvisx(char *mbdst, size_t *dlen, c ssize_t mbslength, maxolen; _DIAGASSERT(mbdst != NULL); - _DIAGASSERT(mbsrc != NULL); + _DIAGASSERT(mbsrc != NULL || mblength == 0); _DIAGASSERT(mbextra != NULL); /* @@ -375,8 +375,6 @@ istrsenvisx(char *mbdst, size_t *dlen, c /* Allocate space for the wide char strings */ psrc = pdst = extra = NULL; - if (!mblength) - mblength = strlen(mbsrc); if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL) return -1; if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL) @@ -528,6 +526,15 @@ out: free(psrc); return error; } + +static int +istrsenvisxl(char *mbdst, size_t *dlen, const char *mbsrc, + int flags, const char *mbextra, int *cerr_ptr) +{ + return istrsenvisx(mbdst, dlen, mbsrc, + mbsrc != NULL ? strlen(mbsrc) : 0, flags, mbextra, cerr_ptr); +} + #endif #if !HAVE_SVIS @@ -571,13 +578,13 @@ snvis(char *mbdst, size_t dlen, int c, i int strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, mbextra, NULL); } int strsnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags, const char *mbextra) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, mbextra, NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, mbextra, NULL); } int @@ -646,13 +653,13 @@ nvis(char *mbdst, size_t dlen, int c, in int strvis(char *mbdst, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, NULL, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, NULL, mbsrc, flags, "", NULL); } int strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags) { - return istrsenvisx(mbdst, &dlen, mbsrc, 0, flags, "", NULL); + return istrsenvisxl(mbdst, &dlen, mbsrc, flags, "", NULL); } /* From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 18:31:13 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E3B0BA93; Tue, 21 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC44635F; Tue, 21 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LIVCvk016553; Tue, 21 Oct 2014 18:31:12 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LIV8Hh016529; Tue, 21 Oct 2014 18:31:08 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201410211831.s9LIV8Hh016529@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Tue, 21 Oct 2014 18:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273398 - in stable/9/usr.sbin/bsdconfig: dot dot/include examples include includes share share/media share/packages X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 18:31:13 -0000 Author: dteske Date: Tue Oct 21 18:31:08 2014 New Revision: 273398 URL: https://svnweb.freebsd.org/changeset/base/273398 Log: MFC revisions 253175, 268999, 269027, 269351-269352, 269354, 269460, 270283, 270505, 270954, 270989, 273067, and 273068: r253175: Introduce f_which() to common.subr r268999: Add new bsdconfig example scripts; remove obsolete ones r269027: Update bsdconfig dot module; fixes and enhancements r269351: Add setvar() for non-FreeBSD platforms using bash as /bin/sh r269352: Fix syntax error when run under bash r269354: Update setvar() function introduced in r269351 r269460: Update f_xdialog_info() in bsdconfig's dialog.subr include r270283: Add `-A' flag to pkg-install(8) when installing dependencies r270505: Optimize f_which() to be slightly faster still (common.subr) r270954: Update f_dialog_init() for safer getopts usage (dialog.subr) r270989: Fix for previously mentioned r270954 r273067: Fix awk(1) asorti() implementation to work when called in a loop r273068: Rename awk(1) asorti() to prevent conflict with GNU awk(1) Added: stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh - copied unchanged from r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr - copied unchanged from r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr Deleted: stable/9/usr.sbin/bsdconfig/examples/browse_packages_ftp.sh Modified: stable/9/usr.sbin/bsdconfig/dot/dot stable/9/usr.sbin/bsdconfig/dot/include/messages.subr stable/9/usr.sbin/bsdconfig/examples/Makefile stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh stable/9/usr.sbin/bsdconfig/include/messages.subr stable/9/usr.sbin/bsdconfig/includes/includes stable/9/usr.sbin/bsdconfig/share/common.subr stable/9/usr.sbin/bsdconfig/share/device.subr stable/9/usr.sbin/bsdconfig/share/dialog.subr stable/9/usr.sbin/bsdconfig/share/media/http.subr stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr stable/9/usr.sbin/bsdconfig/share/packages/Makefile stable/9/usr.sbin/bsdconfig/share/packages/index.subr (contents, props changed) stable/9/usr.sbin/bsdconfig/share/packages/packages.subr (contents, props changed) Directory Properties: stable/9/usr.sbin/bsdconfig/ (props changed) stable/9/usr.sbin/bsdconfig/share/packages/categories.subr (props changed) Modified: stable/9/usr.sbin/bsdconfig/dot/dot ============================================================================== --- stable/9/usr.sbin/bsdconfig/dot/dot Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/dot/dot Tue Oct 21 18:31:08 2014 (r273398) @@ -249,6 +249,7 @@ if [ "$SHOW_INCLUDES" ]; then $menu_program_list \ $submenu_program_list \ $cmd_program_list \ + $BSDCFG_SHARE/script.subr \ ; do [ -e "$file" ] && echo $file done | sort -u @@ -299,12 +300,6 @@ if [ "$SHOW_INCLUDES" ]; then fi # -# Add script.subr to includes if it exists -# -[ -f $BSDCFG_SHARE/script.subr ] && - include_file_list="$include_file_list script.subr" - -# # Start the directional-graph (digraph) output # printf 'strict digraph "" { // Empty name to prevent SVG Auto-Tooltip\n' @@ -352,7 +347,7 @@ printf '\tnode [\n' printf '\t\tfontname = "Times-Roman",\n' printf '\t\tfontsize = 12,\n' printf '\t\twidth = 2.5, // arbitrary minimum width for all nodes\n' -printf '\t\tfixedsize, // turn minimum width into exact width\n' +printf '\t\tfixedsize = true, // turn minimum width into exact width\n' printf '\t];\n' # @@ -546,34 +541,36 @@ printf '\t\tbgcolor = "%s";\n' "$bgcolor printf '\t\tlabel = "bsdconfig(8)";\n' printf '\t\ttooltip = "bsdconfig(8)";\n' print_node "bsdconfig" +end_nodelist if [ "$SHOW_INCLUDES" ]; then - printf '\t\tsubgraph "cluster_includes" {\n' - printf '\t\t\tbgcolor = "%s";\n' "$bgcolor_includes" - printf '\t\t\tlabel = "%s";\n' "$msg_includes" - for include_file in $include_file_list; do echo $include_file - done | awk -v bgcolor="$bgcolor_bsdconfig" ' - BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } - ( $0 !~ "/" ) { - if ( ! created ) - { - printf "\t\t\tsubgraph \"%s\" {\n", - "cluster_bsdconfig_includes" - printf "\t\t\t\tbgcolor = \"%s\";\n", bgcolor - printf "\t\t\t\tlabel = \"bsdconfig\";\n" - created++ + done | awk \ + -v bgcolor="$bgcolor_bsdconfig" \ + -v msg_subroutines="$msg_subroutines" \ + ' + BEGIN { created = 0 } + function end_subgraph() { printf "\t};\n" } + ( $0 !~ "/" ) { + if ( ! created ) + { + printf "\tsubgraph \"%s\" {\n", + "cluster_bsdconfig_includes" + printf "\t\tbgcolor = \"%s\";\n", bgcolor + printf "\t\tlabel = \"bsdconfig %s\";\n", + msg_subroutines + created++ + } + printf "\t\t\"%s\";\n", $1 } - printf "\t\t\t\t\"%s\";\n", $1 - } - END { created && end_subgraph() }' + END { created && end_subgraph() } + ' # END-QUOTE for include_file in $include_file_list; do echo $include_file - done | awk ' + done | awk -v msg_subroutines="$msg_subroutines" ' BEGIN { created = 0 } - function end_subgraph() { printf "\t\t\t};\n" } + function end_subgraph() { printf "\t};\n" } ( $0 ~ "/" ) { include_dir_tmp = $1 sub("/[^/]*$", "", include_dir_tmp) @@ -588,20 +585,18 @@ if [ "$SHOW_INCLUDES" ]; then if ( ! created ) { include_dir = include_dir_tmp - printf "\t\t\tsubgraph \"cluster_%s_includes\" {\n", + printf "\tsubgraph \"cluster_%s_includes\" {\n", include_dir - printf "\t\t\t\tbgcolor = \"white\";\n" - printf "\t\t\t\tlabel = \"%s\";\n", include_dir + printf "\t\tbgcolor = \"thistle\";\n" + printf "\t\tlabel = \"%s %s\";\n", include_dir, + msg_subroutines created++ } - printf "\t\t\t\t\"%s\";\n", $1 + printf "\t\t\"%s\";\n", $1 } END { created && end_subgraph() }' - - printf '\t\t};\n' fi -end_nodelist for INDEX in */INDEX; do menu_title= menu_help= @@ -676,7 +671,7 @@ for INDEX in */INDEX; do end_nodelist done -printf '\n};\n' +printf '\n}\n' ################################################################################ # END Modified: stable/9/usr.sbin/bsdconfig/dot/include/messages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/dot/include/messages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/dot/include/messages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -28,3 +28,4 @@ msg_graph_label_with_command="bsdconfig( msg_graph_label_with_command_and_date="bsdconfig(8)\\\ndot(1) output generated by \`\`%s'' on\\\n%s" msg_includes="Includes" msg_shortcuts="Shortcuts" +msg_subroutines="Subroutines" Modified: stable/9/usr.sbin/bsdconfig/examples/Makefile ============================================================================== --- stable/9/usr.sbin/bsdconfig/examples/Makefile Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/examples/Makefile Tue Oct 21 18:31:08 2014 (r273398) @@ -3,7 +3,7 @@ NO_OBJ= FILESDIR= ${SHAREDIR}/examples/bsdconfig -FILES= browse_packages_ftp.sh browse_packages_http.sh bsdconfigrc +FILES= add_some_packages.sh browse_packages_http.sh bsdconfigrc beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Copied: stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh (from r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/bsdconfig/examples/add_some_packages.sh Tue Oct 21 18:31:08 2014 (r273398, copy of r268999, head/usr.sbin/bsdconfig/examples/add_some_packages.sh) @@ -0,0 +1,13 @@ +#!/bin/sh +# $FreeBSD$ +# +# This sample installs a short list of packages from the main HTTP site. +# +[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 +nonInteractive=1 +_httpPath=http://pkg.freebsd.org +mediaSetHTTP +mediaOpen +for package in wget bash rsync; do + packageAdd +done Modified: stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh ============================================================================== --- stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/examples/browse_packages_http.sh Tue Oct 21 18:31:08 2014 (r273398) @@ -1,25 +1,32 @@ #!/bin/sh # $FreeBSD$ # -# This sample downloads the package INDEX file from HTTP to /tmp (if it doesn't -# already exist) and then displays the package configuration/management screen -# using the local INDEX file (results in faster browsing of packages from-start -# since the INDEX can be loaded from local media). +# This sample downloads the package digests.txz and packagesite.txz files from +# HTTP to /tmp (if they don't already exist) and then displays the package +# configuration/management screen using the local files (resulting in faster +# browsing of packages from-start since digests.txz/packagesite.txz can be +# loaded from local media). # -# NOTE: Packages cannot be installed unless staged to /tmp/packages/All +# NOTE: Packages cannot be installed unless staged to +# /tmp/packages/$PKG_ABI/All # -. /usr/share/bsdconfig/script.subr +[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr || exit 1 nonInteractive=1 +f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI TMPDIR=/tmp -if [ ! -e "$TMPDIR/packages/INDEX" ]; then - [ -d "$TMPDIR/packages" ] || mkdir -p "$TMPDIR/packages" || exit 1 - _httpPath=http://ftp.freebsd.org - # For older releases, use http://ftp-archive.freebsd.org - mediaSetHTTP - mediaOpen - f_show_info "Downloading packages/INDEX from\n %s" "$_httpPath" - f_device_get device_media packages/INDEX > $TMPDIR/packages/INDEX -fi +PKGDIR=$TMPDIR/packages/$PKG_ABI +[ -d "$PKGDIR" ] || mkdir -p "$PKGDIR" || exit 1 +for file in digests.txz packagesite.txz; do + [ -s "$PKGDIR/$file" ] && continue + if [ ! "$HTTP_INITIALIZED" ]; then + _httpPath=http://pkg.freebsd.org + mediaSetHTTP + mediaOpen + fi + f_show_info "Downloading %s from\n %s" "$file" "$_httpPath" + f_device_get device_media "/$PKG_ABI/latest/$file" > $PKGDIR/$file || + exit 1 +done _directoryPath=$TMPDIR mediaSetDirectory configPackages Modified: stable/9/usr.sbin/bsdconfig/include/messages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/include/messages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/include/messages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -57,6 +57,7 @@ msg_back="Back" msg_becoming_root_via_sudo="Becoming root via sudo(8)..." msg_benchmarks_desc="Utilities for measuring system performance." msg_biology_desc="Software related to biology." +msg_bootstrapping_pkg="Bootstrapping pkg(8)..." msg_brazil="Brazil" msg_building_package_menus="Building package menu(s)..." msg_cad_desc="Computer Aided Design utilities." @@ -142,8 +143,6 @@ msg_generating_index_from_pkg_database=" msg_geography_desc="Geography-related software." msg_german_desc="Ported software for Germanic countries." msg_germany="Germany" -msg_getting_package_categories_via_pkg_rquery="Getting package categories via pkg-rquery(8)..." -msg_getting_package_dependencies_via_pkg_rquery="Getting package dependencies via pkg-rquery(8)\n(this can take a while)..." msg_gnome_desc="Components of the Gnome Desktop environment." msg_gnustep_desc="Software for GNUstep desktop environment." msg_graphics_desc="Graphics libraries and utilities." @@ -219,6 +218,7 @@ msg_misc_desc="Miscellaneous utilities." msg_missing_ftp_host_or_directory="Missing FTP host or directory specification. FTP media not initialized." msg_multimedia_desc="Multimedia software." msg_must_be_root_to_execute="%s: must be root to execute" +msg_must_have_pkg_to_execute="%s: must have pkg(8) to execute" msg_must_specify_a_host_name_of_some_sort="Must specify a host name of some sort!" msg_name_server="Name server" msg_net_desc="Networking utilities." @@ -274,6 +274,7 @@ msg_perl5_desc="Utilities/modules for th msg_permission_denied="%s: %s: Permission denied" msg_pkg_delete_failed="Warning: pkg-delete(8) of %s failed.\n Run with debugging for details." msg_pkg_install_apparently_did_not_like_the_package="pkg-install(8) apparently did not like the %s package." +msg_pkg_not_yet_installed_install_now="pkg(8) not yet installed. Install now?" msg_plan9_desc="Software from the Plan9 operating system." msg_please_check_the_url_and_try_again="No such directory: %s\nplease check the URL and try again.\n" msg_please_enter_password="Please enter your password for sudo(8):" @@ -376,15 +377,13 @@ msg_unable_to_get_proper_ftp_path="Unabl msg_unable_to_initialize_media_type_for_package_extract="Unable to initialize media type for package extract." msg_unable_to_make_directory_mountpoint="Unable to make %s directory mountpoint for %s!" msg_unable_to_open="Unable to open %s" -msg_unable_to_pkg_rquery_package_categories="Unable to pkg-rquery(8) package categories!" -msg_unable_to_pkg_rquery_package_dependencies="Unable to pkg-rquery(8) package dependencies!" msg_unable_to_update_pkg_from_selected_media="Unable to update pkg(8) from selected media." msg_uninstall="Uninstall" msg_uninstall_desc="Mark this package for deletion" msg_uninstalling_package_waiting_for_pkg_delete="Uninstalling %s package - waiting for pkg-delete(8)" msg_unknown="unknown" msg_unknown_user="Unknown user: %s" -msg_url_was_not_found="%s was not found, maybe directory or release-version are wrong?" +msg_url_was_not_found="%s was not found,\nmaybe directory or release-version are wrong?" msg_usa="USA" msg_usage="Usage" msg_usb="USB" Modified: stable/9/usr.sbin/bsdconfig/includes/includes ============================================================================== --- stable/9/usr.sbin/bsdconfig/includes/includes Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/includes/includes Tue Oct 21 18:31:08 2014 (r273398) @@ -69,10 +69,12 @@ show_include() -v use_color=${USE_COLOR:-0} \ -v re="$pattern" \ -v show_desc=${SHOW_DESC:-0} ' - function asorti(src, dest) + function _asorti(src, dest) { + k = nitems = 0; + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) @@ -118,7 +120,7 @@ show_include() } } END { - n = asorti(syntax, sorted_indices) + n = _asorti(syntax, sorted_indices) for (i = 1; i <= n; i++) printf "%s", syntax[sorted_indices[i]] }' "$file" ) Modified: stable/9/usr.sbin/bsdconfig/share/common.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/common.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/common.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -62,12 +62,6 @@ export UNAME_S="$( uname -s )" # Operati export UNAME_P="$( uname -p )" # Processor Architecture (i.e. i386) export UNAME_M="$( uname -m )" # Machine platform (i.e. i386) export UNAME_R="$( uname -r )" # Release Level (i.e. X.Y-RELEASE) -if [ ! "${PKG_ABI+set}" ]; then - export PKG_ABI="$( - ASSUME_ALWAYS_YES=1 pkg -vv 2> /dev/null | - awk '$1=="ABI"{print $3;exit}' - )" -fi # # Default behavior is to call f_debug_init() automatically when loaded. @@ -226,6 +220,65 @@ f_have() f_quietly type "$@" } +# setvar $var_to_set [$value] +# +# Implement setvar for shells unlike FreeBSD sh(1). +# +if ! f_have setvar; then +setvar() +{ + [ $# -gt 0 ] || return $SUCCESS + local __setvar_var_to_set="$1" __setvar_right="$2" __setvar_left= + case $# in + 1) unset "$__setvar_var_to_set" + return $? ;; + 2) : fall through ;; + *) f_err "setvar: too many arguments\n" + return $FAILURE + esac + case "$__setvar_var_to_set" in *[!0-9A-Za-z_]*) + f_err "setvar: %s: bad variable name\n" "$__setvar_var_to_set" + return 2 + esac + while case "$__setvar_r" in *\'*) : ;; *) false ; esac + do + __setvar_left="$__setvar_left${__setvar_right%%\'*}'\\''" + __setvar_right="${__setvar_right#*\'}" + done + __setvar_left="$__setvar_left${__setvar_right#*\'}" + eval "$__setvar_var_to_set='$__setvar_left'" +} +fi + +# f_which $anything [$var_to_set] +# +# A fast built-in replacement for syntaxes such as foo=$( which bar ). In a +# comparison of 10,000 runs of this function versus which, this function +# completed in under 3 seconds, while `which' took almost a full minute. +# +# If $var_to_set is missing or NULL, output is (like which) to standard out. +# Returns success if a match was found, failure otherwise. +# +f_which() +{ + local __name="$1" __var_to_set="$2" + case "$__name" in */*|'') return $FAILURE; esac + local __p __exec IFS=":" __found= + for __p in $PATH; do + __exec="$__p/$__name" + [ -f "$__exec" -a -x "$__exec" ] && __found=1 break + done + if [ "$__found" ]; then + if [ "$__var_to_set" ]; then + setvar "$__var_to_set" "$__exec" + else + echo "$__exec" + fi + return $SUCCESS + fi + return $FAILURE +} + # f_getvar $var_to_get [$var_to_set] # # Utility function designed to go along with the already-builtin setvar. Modified: stable/9/usr.sbin/bsdconfig/share/device.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/device.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/device.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -1116,8 +1116,9 @@ f_device_shutdown() f_device_sort_by_awk=' # Variables that should be defined on the invocation line: # -v prop="property" -function asorti(src, dest) +function _asorti(src, dest) { + k = nitems = 0 for (i in src) dest[++nitems] = i for (i = 1; i <= nitems; k = i++) { idx = dest[i] @@ -1136,7 +1137,7 @@ function asorti(src, dest) } } END { - nitems = asorti(devices, devices_sorted) + nitems = _asorti(devices, devices_sorted) for (i = 1; i <= nitems; i++) print devices[devices_sorted[i]] } ' Modified: stable/9/usr.sbin/bsdconfig/share/dialog.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/dialog.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/dialog.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -1557,12 +1557,22 @@ f_dialog_info() # EOF. This implies that you must execute this either as an rvalue to a pipe, # lvalue to indirection or in a sub-shell that provides data on stdin. # +# To open an Xdialog(1) infobox that does not disappear until expeclitly dis- +# missed, use the following: +# +# f_xdialog_info "$info_text" < /dev/tty & +# pid=$! +# # Perform some lengthy actions +# kill $pid +# +# NB: Check $USE_XDIALOG if you need to support both dialog(1) and Xdialog(1). +# f_xdialog_info() { local info_text="$*" height width f_dialog_infobox_size height width \ "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$info_text" - $DIALOG \ + exec $DIALOG \ --title "$DIALOG_TITLE" \ --backtitle "$DIALOG_BACKTITLE" \ --no-close --no-buttons \ @@ -2099,9 +2109,14 @@ f_dialog_init() # # Process stored command-line arguments # + # NB: Using backticks instead of $(...) for portability since Linux + # bash(1) balks at the right parentheses encountered in the case- + # statement (incorrectly interpreting it as the close of $(...)). + # f_dprintf "f_dialog_init: ARGV=[%s] GETOPTS_STDARGS=[%s]" \ "$ARGV" "$GETOPTS_STDARGS" - SECURE=$( set -- $ARGV + SECURE=`set -- $ARGV + OPTIND=1 while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2109,8 +2124,9 @@ f_dialog_init() S) echo 1 ;; esac done - ) - USE_XDIALOG=$( set -- $ARGV + ` # END-BACKTICK + USE_XDIALOG=`set -- $ARGV + OPTIND=1 while getopts \ "$GETOPTS_STDARGS$GETOPTS_EXTRA$GETOPTS_ALLFLAGS" \ flag > /dev/null; do @@ -2118,7 +2134,7 @@ f_dialog_init() S|X) echo 1 ;; esac done - ) + ` # END-BACKTICK f_dprintf "f_dialog_init: SECURE=[%s] USE_XDIALOG=[%s]" \ "$SECURE" "$USE_XDIALOG" Modified: stable/9/usr.sbin/bsdconfig/share/media/http.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/media/http.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/media/http.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -515,10 +515,7 @@ f_media_init_http() fi esac - if [ $http_found -eq $SUCCESS ]; then - HTTP_INITIALIZED=YES - break - fi + [ $http_found -eq $SUCCESS ] && HTTP_INITIALIZED=YES break f_getvar $VAR_HTTP_PATH http_path f_show_msg "$msg_please_check_the_url_and_try_again" \ @@ -668,7 +665,7 @@ f_media_get_http() 44) f_show_msg "$msg_url_was_not_found" "$url" ;; 4) f_show_msg "$msg_client_error" ;; *) f_show_msg "$msg_error_when_requesting_url" "$url" ;; - esac + esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD return $FAILURE } Modified: stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/media/httpproxy.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -452,7 +452,7 @@ f_media_get_http_proxy() 44) f_show_msg "$msg_url_was_not_found" "$url" ;; 4) f_show_msg "$msg_client_error" ;; *) f_show_msg "$msg_error_when_requesting_url" "$url" ;; - esac + esac 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD return $FAILURE } Modified: stable/9/usr.sbin/bsdconfig/share/packages/Makefile ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/Makefile Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/Makefile Tue Oct 21 18:31:08 2014 (r273398) @@ -3,7 +3,7 @@ NO_OBJ= FILESDIR= ${SHAREDIR}/bsdconfig/packages -FILES= categories.subr index.subr packages.subr +FILES= categories.subr index.subr musthavepkg.subr packages.subr beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} Modified: stable/9/usr.sbin/bsdconfig/share/packages/index.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/index.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -33,6 +33,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig" f_dprintf "%s: loading includes..." packages/index.subr f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/media/common.subr +f_include $BSDCFG_SHARE/packages/musthavepkg.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -53,27 +54,6 @@ SQLITE_REPO="/var/db/pkg/repo-packagesit # PACKAGES_INDEX_CACHEFILE="/var/run/bsdconfig/packages_INDEX.cache" -# -# INDEX format for FreeBSD-6.0 or higher: -# -# package|port-origin|install-prefix|comment|port-desc-file|maintainer| -# categories|build-deps|run-deps|www-site|reserve|reserve|reserve|disc -# -INDEX_FORMAT="%n-%v" # package -INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o" # port-origin -INDEX_FORMAT="$INDEX_FORMAT|%p" # install-prefix -INDEX_FORMAT="$INDEX_FORMAT|%c" # comment -INDEX_FORMAT="$INDEX_FORMAT|/usr/ports/%o/pkg-descr" # port-desc-file -INDEX_FORMAT="$INDEX_FORMAT|%m" # maintainer -INDEX_FORMAT="$INDEX_FORMAT|@CATEGORIES@" # place-holder -INDEX_FORMAT="$INDEX_FORMAT|" # build-deps -INDEX_FORMAT="$INDEX_FORMAT|@RUNDEPS@" # place-holder -INDEX_FORMAT="$INDEX_FORMAT|%w" # www-site -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # reserved -INDEX_FORMAT="$INDEX_FORMAT|" # disc - ############################################################ FUNCTIONS # f_index_initialize [$var_to_set] @@ -87,13 +67,16 @@ INDEX_FORMAT="$INDEX_FORMAT|" # disc f_index_initialize() { local __funcname=f_index_initialize - local __var_to_set="${2:-PACKAGE_INDEX}" + local __var_to_set="${1:-PACKAGE_INDEX}" [ "$_INDEX_INITTED" ] && return $SUCCESS # Got any media? f_media_verify || return $FAILURE + # Make sure we have a usable pkg(8) with $PKG_ABI + f_musthavepkg_init + # Does it move when you kick it? f_device_init device_media || return $FAILURE @@ -126,9 +109,10 @@ f_index_initialize() __site="file://$MOUNTPOINT/packages/$PKG_ABI" esac - export PACKAGESITE="$__site" - f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE" - if ! f_eval_catch $__funcname pkg "pkg update"; then + f_dprintf "PACKAGESITE=[%s]" "$__site" + if ! f_eval_catch $__funcname pkg \ + 'PACKAGESITE="%s" pkg update' "$__site" + then f_show_err "$msg_unable_to_update_pkg_from_selected_media" f_device_shutdown device_media return $FAILURE @@ -195,53 +179,8 @@ f_index_initialize() # If we reach this point, we need to generate the data from scratch # - f_show_info "$msg_getting_package_categories_via_pkg_rquery" - if ! eval "$( pkg rquery "%n-%v %C" | awk ' - { categories[$1] = categories[$1] " " $2 } - END { - for (package in categories) - { - cats = categories[package] - sub(/^ /, "", cats) - gsub(/[^[:alnum:]_]/, "_", package) - printf "local _%s_categories=\"%s\";\n", package, cats - } - }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" - f_device_shutdown device_media - return $FAILURE - fi - - f_show_info "$msg_getting_package_dependencies_via_pkg_rquery" - if ! eval "$( pkg rquery "%n-%v %dn-%dv" | awk ' - { rundeps[$1] = rundeps[$1] " " $2 } - END { - for (package in rundeps) - { - deps = rundeps[package] - sub(/^ /, "", deps) - gsub(/[^[:alnum:]_]/, "_", package) - printf "local _%s_rundeps=\"%s\";\n", package, deps - } - }' )"; then - f_show_err "$msg_unable_to_pkg_rquery_package_dependencies" - f_device_shutdown device_media - return $FAILURE - fi - f_show_info "$msg_generating_index_from_pkg_database" - eval "$__var_to_set"='$( pkg rquery "$INDEX_FORMAT" | - while read LINE; do - package="${LINE%%|*}"; - f_str2varname "$package" varpkg; - eval f_replaceall \"\$LINE\" \"\|@CATEGORIES@\|\" \ - \"\|\$_${varpkg}_categories\|\" LINE - eval f_replaceall \"\$LINE\" \"\|@RUNDEPS@\|\" \ - \"\|\$_${varpkg}_rundeps\|\" LINE - echo "$LINE" - done - )' # always returns true (status of last item in pipe-chain) - eval "$__var_to_set"='$( debug= f_getvar "$__var_to_set" | sort )' + eval "$__var_to_set"='$( pkg rquery -I | sort )' # # Attempt to create the persistant on-disk cache @@ -302,10 +241,12 @@ f_index_read() export msg_packages eval "$( debug= f_getvar "$var_to_get" | awk -F'|' ' - function asorti(src, dest) + function _asorti(src, dest) { + k = nitems = 0 + # Copy src indices to dest and calculate array length - nitems = 0; for (i in src) dest[++nitems] = i + for (i in src) dest[++nitems] = i # Sort the array of indices (dest) using insertion sort method for (i = 1; i <= nitems; k = i++) @@ -351,7 +292,7 @@ f_index_read() END { print "_npkgs=" tpkgs # For convenience, total package count - n = asorti(categories, categories_sorted) + n = _asorti(categories, categories_sorted) # Produce package counts for each category for (i = 1; i <= n; i++) Copied: stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr (from r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/bsdconfig/share/packages/musthavepkg.subr Tue Oct 21 18:31:08 2014 (r273398, copy of r268999, head/usr.sbin/bsdconfig/share/packages/musthavepkg.subr) @@ -0,0 +1,87 @@ +if [ ! "$_PACKAGES_MUSTHAVEPKG_SUBR" ]; then _PACKAGES_MUSTHAVEPKG_SUBR=1 +# +# Copyright (c) 2014 Devin Teske +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." packages/musthavepkg.subr +f_include $BSDCFG_SHARE/dialog.subr +f_include $BSDCFG_SHARE/mustberoot.subr + +############################################################ FUNCTIONS + +# f_musthavepkg_init +# +# Validate pkg(8) is installed and set $PKG_ABI global if not already set. +# Returns success unless pkg(8) is not installed and user refuses to install +# it (upon prompt when running interactively). +# +f_musthavepkg_init() +{ + local funcname=f_musthavepkg_init + local pkg_abi_awk='$1~/^ABI/{print $NF; exit}' + + if [ "$PKG_ABI" ]; then # Already set + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + f_quietly pkg -N -vv # return status (pkg(8) functional?) + return $? + fi + + # Attempt to get PKG_ABI without prematurely bootstrapping pkg(8) + if f_eval_catch -k PKG_ABI $funcname pkg \ + "pkg -N -vv | awk '%s'" "$pkg_abi_awk" + then + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + return $SUCCESS + fi + + # pkg(8) not yet bootstrapped; ask for permission unless nonInteractive + f_dialog_yesno "$msg_pkg_not_yet_installed_install_now" || + f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" + + f_mustberoot_init # Have to be root to install pkg(8) + + # Bootstrap pkg(8) + f_dialog_info "$msg_bootstrapping_pkg" + f_eval_catch -k PKG_ABI $funcname pkg \ + "ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" || + f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" + + f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" + export PKG_ABI + return $SUCCESS +} + +############################################################ MAIN + +f_dprintf "%s: Successfully loaded." packages/musthavepkg.subr + +fi # ! $_PACKAGES_MUSTHAVEPKG_SUBR Modified: stable/9/usr.sbin/bsdconfig/share/packages/packages.subr ============================================================================== --- stable/9/usr.sbin/bsdconfig/share/packages/packages.subr Tue Oct 21 18:10:05 2014 (r273397) +++ stable/9/usr.sbin/bsdconfig/share/packages/packages.subr Tue Oct 21 18:31:08 2014 (r273398) @@ -36,6 +36,7 @@ f_include $BSDCFG_SHARE/device.subr f_include $BSDCFG_SHARE/media/common.subr f_include $BSDCFG_SHARE/packages/categories.subr f_include $BSDCFG_SHARE/packages/index.subr +f_include $BSDCFG_SHARE/packages/musthavepkg.subr f_include $BSDCFG_SHARE/strings.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" @@ -662,7 +663,7 @@ f_package_review() f_package_config() { # Did we get an INDEX? - f_index_initialize packages/INDEX || return $FAILURE + f_index_initialize || return $FAILURE # Creates following variables (indirectly via f_index_read()) # CATEGORY_MENU_LIST _categories_{varpkg} _rundeps_{varpkg} # PACKAGE_CATEGORIES _npkgs @@ -839,7 +840,7 @@ f_package_add() { # Verify and initialize device media if-defined f_media_verify && f_device_init device_media && - f_index_initialize packages/INDEX + f_index_initialize } || return $FAILURE # Now we have (indirectly via f_index_read()): @@ -946,6 +947,8 @@ f_package_extract() local device="$1" name="$2" depended="$3" local devname= + f_musthavepkg_init # Make sure we have a usable pkg(8) with $PKG_ABI + $device get name devname f_dprintf "$funcname: device=[%s] name=[%s] depended=[%s]" \ "$devname" "$name" "$depended" @@ -1026,9 +1029,11 @@ f_package_extract() # Request the package be added via pkg-install(8) if f_debugging; then - f_eval_catch $funcname pkg 'pkg -d install -y "%s"' "$name" + f_eval_catch $funcname pkg \ + 'pkg -d install -${depended:+A}y "%s"' "$name" else - f_eval_catch $funcname pkg 'pkg install -y "%s"' "$name" + f_eval_catch $funcname pkg \ + 'pkg install -${depended:+A}y "%s"' "$name" fi if [ $? -ne $SUCCESS ]; then $alert "$msg_pkg_install_apparently_did_not_like_the_package" \ @@ -1065,7 +1070,7 @@ f_package_delete() { # Verify and initialize device media if-defined f_media_verify && f_device_init device_media && - f_index_initialize packages/INDEX + f_index_initialize } || return $FAILURE # Now we have (indirectly via f_index_read()): From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 19:40:35 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C326549C; Tue, 21 Oct 2014 19:40:35 +0000 (UTC) Received: from frv153.fwdcdn.com (frv153.fwdcdn.com [212.42.77.153]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8018ACFF; Tue, 21 Oct 2014 19:40:34 +0000 (UTC) Received: from [10.10.10.28] (helo=frv154.fwdcdn.com) by frv153.fwdcdn.com QID:1Xgf30-00057Y-IN/RC:5; Tue, 21 Oct 2014 22:24:46 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=4uUHO+fg6YevOw+ZvbjXChnnhYemMY0eQNK6sEWldHc=; b=EIZMGIGQTWsVL5pcVi38ZymD+FDScs27VdgH82kHyAJPFuQnHnWH61JDbAPwzDw6WEQEut5MC2C+7hS/E/IeO7Zc5EpWrqTU4bQfzumEJSQzVjfWV028/voYxK+JYU8kCysyMo4wam8QnbbbLMQsGig4V5aRfMuN1NXVn77OKyw=; Received: from [5.248.240.192] (helo=nonamehost.local) by frv154.fwdcdn.com with esmtpsa ID 1Xgf2k-0001tN-Of ; Tue, 21 Oct 2014 22:24:30 +0300 Date: Tue, 21 Oct 2014 22:24:29 +0300 From: Ivan Klymenko To: Alexander Motin Subject: Re: svn commit: r273372 - stable/10/share/man/man4 Message-ID: <20141021222429.215400ca@nonamehost.local> In-Reply-To: <201410210623.s9L6NFUh067150@svn.freebsd.org> References: <201410210623.s9L6NFUh067150@svn.freebsd.org> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.22; amd64-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Authentication-Result: IP=5.248.240.192; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-Ukrnet-Yellow: 0 Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 19:40:35 -0000 =D0=92 Tue, 21 Oct 2014 06:23:15 +0000 (UTC) Alexander Motin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Author: mav > Date: Tue Oct 21 06:23:14 2014 > New Revision: 273372 > URL: https://svnweb.freebsd.org/changeset/base/273372 >=20 > Log: > MFC r262294 (by ivoras): > Explain how and where kern.cam.ada.write_cache can be set in > practical situations. >=20 > Modified: > stable/10/share/man/man4/ada.4 > Directory Properties: > stable/10/ (props changed) Please document the SYSCTL VARIABLE kern.cam.ada.X.sort_io_queue Thanks. From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 20:20:08 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95B0B993; Tue, 21 Oct 2014 20:20:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80BE11BD; Tue, 21 Oct 2014 20:20:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKK85m069007; Tue, 21 Oct 2014 20:20:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKK89k069005; Tue, 21 Oct 2014 20:20:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKK89k069005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:08 +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: r273411 - in stable/10: sys/kern usr.sbin/rtsold X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 20:20:08 -0000 Author: delphij Date: Tue Oct 21 20:20:07 2014 New Revision: 273411 URL: https://svnweb.freebsd.org/changeset/base/273411 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix memory leak in sandboxed namei lookup. [SA-14:22] Modified: stable/10/sys/kern/vfs_lookup.c stable/10/usr.sbin/rtsold/rtsol.c Modified: stable/10/sys/kern/vfs_lookup.c ============================================================================== --- stable/10/sys/kern/vfs_lookup.c Tue Oct 21 20:17:05 2014 (r273410) +++ stable/10/sys/kern/vfs_lookup.c Tue Oct 21 20:20:07 2014 (r273411) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -185,11 +195,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -256,11 +262,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -286,6 +288,7 @@ namei(struct nameidata *ndp) if (KTRPOINT(curthread, KTR_CAPFAIL)) ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); #endif + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); } while (*(cnp->cn_nameptr) == '/') { @@ -298,11 +301,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -312,11 +311,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -378,11 +373,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: stable/10/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/10/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:17:05 2014 (r273410) +++ stable/10/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:07 2014 (r273411) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 20:20:18 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A554EABD; Tue, 21 Oct 2014 20:20:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9093E24A; Tue, 21 Oct 2014 20:20:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKKIgl069338; Tue, 21 Oct 2014 20:20:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKKHrj069253; Tue, 21 Oct 2014 20:20:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKKHrj069253@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273412 - in stable/9: sbin/routed sys/kern usr.sbin/rtsold X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 20:20:18 -0000 Author: delphij Date: Tue Oct 21 20:20:17 2014 New Revision: 273412 URL: https://svnweb.freebsd.org/changeset/base/273412 Log: Fix rtsold(8) remote buffer overflow vulnerability. [SA-14:20] Fix routed(8) remote denial of service vulnerability. [SA-14:21] Fix memory leak in sandboxed namei lookup. [SA-14:22] Modified: stable/9/sbin/routed/input.c stable/9/sys/kern/vfs_lookup.c stable/9/usr.sbin/rtsold/rtsol.c Modified: stable/9/sbin/routed/input.c ============================================================================== --- stable/9/sbin/routed/input.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/sbin/routed/input.c Tue Oct 21 20:20:17 2014 (r273412) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); Modified: stable/9/sys/kern/vfs_lookup.c ============================================================================== --- stable/9/sys/kern/vfs_lookup.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/sys/kern/vfs_lookup.c Tue Oct 21 20:20:17 2014 (r273412) @@ -121,6 +121,16 @@ TUNABLE_INT("vfs.lookup_shared", &lookup * if symbolic link, massage name in buffer and continue * } */ +static void +namei_cleanup_cnp(struct componentname *cnp) +{ + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif +} + int namei(struct nameidata *ndp) { @@ -182,11 +192,7 @@ namei(struct nameidata *ndp) } #endif if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); ndp->ni_vp = NULL; return (error); } @@ -248,11 +254,7 @@ namei(struct nameidata *ndp) } } if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); return (error); } } @@ -278,8 +280,10 @@ namei(struct nameidata *ndp) if (*(cnp->cn_nameptr) == '/') { vrele(dp); VFS_UNLOCK_GIANT(vfslocked); - if (ndp->ni_strictrelative != 0) + if (ndp->ni_strictrelative != 0) { + namei_cleanup_cnp(cnp); return (ENOTCAPABLE); + } while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -293,11 +297,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir = dp; error = lookup(ndp); if (error) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); SDT_PROBE(vfs, namei, lookup, return, error, NULL, 0, 0, 0); return (error); @@ -309,11 +309,7 @@ namei(struct nameidata *ndp) */ if ((cnp->cn_flags & ISSYMLINK) == 0) { if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) { - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; @@ -379,11 +375,7 @@ namei(struct nameidata *ndp) vput(ndp->ni_vp); dp = ndp->ni_dvp; } - uma_zfree(namei_zone, cnp->cn_pnbuf); -#ifdef DIAGNOSTIC - cnp->cn_pnbuf = NULL; - cnp->cn_nameptr = NULL; -#endif + namei_cleanup_cnp(cnp); vput(ndp->ni_vp); ndp->ni_vp = NULL; vrele(ndp->ni_dvp); Modified: stable/9/usr.sbin/rtsold/rtsol.c ============================================================================== --- stable/9/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:07 2014 (r273411) +++ stable/9/usr.sbin/rtsold/rtsol.c Tue Oct 21 20:20:17 2014 (r273412) @@ -933,7 +933,8 @@ dname_labeldec(char *dst, size_t dlen, c dst_origin = dst; memset(dst, '\0', dlen); while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last) { + (src + len) <= src_last && + (dst - dst_origin < (ssize_t)dlen)) { if (dst != dst_origin) *dst++ = '.'; warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 20:20:26 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6187BE9; Tue, 21 Oct 2014 20:20:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C23CA24D; Tue, 21 Oct 2014 20:20:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKKQde069599; Tue, 21 Oct 2014 20:20:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKKQUb069598; Tue, 21 Oct 2014 20:20:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212020.s9LKKQUb069598@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 20:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r273413 - stable/8/sbin/routed X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 20:20:27 -0000 Author: delphij Date: Tue Oct 21 20:20:26 2014 New Revision: 273413 URL: https://svnweb.freebsd.org/changeset/base/273413 Log: Fix routed(8) remote denial of service vulnerability. [SA-14:21] Modified: stable/8/sbin/routed/input.c Modified: stable/8/sbin/routed/input.c ============================================================================== --- stable/8/sbin/routed/input.c Tue Oct 21 20:20:17 2014 (r273412) +++ stable/8/sbin/routed/input.c Tue Oct 21 20:20:26 2014 (r273413) @@ -288,6 +288,10 @@ input(struct sockaddr_in *from, /* rece /* Answer a query from a utility program * with all we know. */ + if (aifp == NULL) { + trace_pkt("ignore remote query"); + return; + } if (from->sin_port != htons(RIP_PORT)) { supply(from, aifp, OUT_QUERY, 0, rip->rip_vers, ap != 0); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:09:55 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32067599; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03F88928; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL9sHB094326; Tue, 21 Oct 2014 21:09:54 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL9s3g094325; Tue, 21 Oct 2014 21:09:54 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212109.s9LL9s3g094325@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 21:09:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273425 - stable/9/lib/libcrypt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:09:55 -0000 Author: delphij Date: Tue Oct 21 21:09:54 2014 New Revision: 273425 URL: https://svnweb.freebsd.org/changeset/base/273425 Log: MFC r272830 (des): Change the hardcoded default back from SHA512 to DES. This will become EN-14:11.crypt. PR: 192277 Modified: stable/9/lib/libcrypt/crypt.c Directory Properties: stable/9/lib/libcrypt/ (props changed) Modified: stable/9/lib/libcrypt/crypt.c ============================================================================== --- stable/9/lib/libcrypt/crypt.c Tue Oct 21 21:08:45 2014 (r273424) +++ stable/9/lib/libcrypt/crypt.c Tue Oct 21 21:09:54 2014 (r273425) @@ -37,24 +37,26 @@ __FBSDID("$FreeBSD$"); #include "crypt.h" /* - * List of supported crypt(3) formats. The first element in the list will - * be the default. + * List of supported crypt(3) formats. + * + * The default algorithm is the last entry in the list (second-to-last + * array element since the last is a sentinel). The reason for placing + * the default last rather than first is that DES needs to be at the + * bottom for the algorithm guessing logic in crypt(3) to work correctly, + * and it needs to be the default for backward compatibility. */ static const struct crypt_format { const char *const name; char *(*const func)(const char *, const char *); const char *const magic; } crypt_formats[] = { - /* default format */ - { "sha512", crypt_sha512, "$6$" }, - - /* other supported formats */ { "md5", crypt_md5, "$1$" }, #ifdef HAS_BLOWFISH { "blf", crypt_blowfish, "$2" }, #endif { "nth", crypt_nthash, "$3$" }, { "sha256", crypt_sha256, "$5$" }, + { "sha512", crypt_sha512, "$6$" }, #ifdef HAS_DES { "des", crypt_des, "_" }, #endif @@ -63,7 +65,8 @@ static const struct crypt_format { { NULL, NULL, NULL } }; -static const struct crypt_format *crypt_format = &crypt_formats[0]; +static const struct crypt_format *crypt_format = + &crypt_formats[(sizeof crypt_formats / sizeof *crypt_formats) - 2]; #define DES_SALT_ALPHABET \ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:11:26 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24EA784C; Tue, 21 Oct 2014 21:11:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10BE59CA; Tue, 21 Oct 2014 21:11:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLBPgQ095231; Tue, 21 Oct 2014 21:11:25 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLBPho095230; Tue, 21 Oct 2014 21:11:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410212111.s9LLBPho095230@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 21 Oct 2014 21:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273427 - stable/9/usr.sbin/pw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:11:26 -0000 Author: delphij Date: Tue Oct 21 21:11:25 2014 New Revision: 273427 URL: https://svnweb.freebsd.org/changeset/base/273427 Log: MFC r272833 (des): Two more places where login_setcryptfmt() defaults to MD5 were missed in r252688. Modified: stable/9/usr.sbin/pw/pw_user.c Directory Properties: stable/9/usr.sbin/pw/ (props changed) Modified: stable/9/usr.sbin/pw/pw_user.c ============================================================================== --- stable/9/usr.sbin/pw/pw_user.c Tue Oct 21 21:09:54 2014 (r273426) +++ stable/9/usr.sbin/pw/pw_user.c Tue Oct 21 21:11:25 2014 (r273427) @@ -586,7 +586,7 @@ pw_user(struct userconf * cnf, int mode, pwd->pw_dir = pw_homepolicy(cnf, args, pwd->pw_name); pwd->pw_shell = pw_shellpolicy(cnf, args, NULL); lc = login_getpwclass(pwd); - if (lc == NULL || login_setcryptfmt(lc, "md5", NULL) == NULL) + if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_password(cnf, args, pwd->pw_name); @@ -661,7 +661,7 @@ pw_user(struct userconf * cnf, int mode, } else { lc = login_getpwclass(pwd); if (lc == NULL || - login_setcryptfmt(lc, "md5", NULL) == NULL) + login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); pwd->pw_passwd = pw_pwcrypt(line); From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:27:14 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C23861A; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87D36F4E; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLREDK003938; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLREot003937; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212127.s9LLREot003937@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:27:14 +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: r273429 - stable/10/sys/dev/hyperv/storvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:27:14 -0000 Author: gjb Date: Tue Oct 21 21:27:13 2014 New Revision: 273429 URL: https://svnweb.freebsd.org/changeset/base/273429 Log: MFC r273402: Fix an issue where a FreeBSD virtual machine provisioned in the Microsoft Azure service does not recognize the second attached disk on the system. PR: 194376 Insta-MFC OK: re (rodrigc) Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 21:17:44 2014 (r273428) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 21:27:13 2014 (r273429) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS -#define STORVSC_MAX_TARGETS (1) +#define STORVSC_MAX_TARGETS (2) struct storvsc_softc; @@ -584,7 +584,6 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; - request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:37:54 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A208CF55; Tue, 21 Oct 2014 21:37:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D0D7138; Tue, 21 Oct 2014 21:37:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbsWf008902; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbsaH008901; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbsaH008901@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:37:54 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/8/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/10/sys/sys/param.h stable/9/sys/sys/param.h Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/8/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 804505 /* Master, propagated to newvers */ +#define __FreeBSD_version 804506 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:37:56 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 55E60A8; Tue, 21 Oct 2014 21:37:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2690413B; Tue, 21 Oct 2014 21:37:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbu8s008928; Tue, 21 Oct 2014 21:37:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbuxZ008927; Tue, 21 Oct 2014 21:37:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbuxZ008927@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:37:56 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/9/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/10/sys/sys/param.h stable/8/sys/sys/param.h Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/9/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 903504 /* Master, propagated to newvers */ +#define __FreeBSD_version 903505 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:37:55 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BA39F56; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16285139; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbsuJ008909; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbskG008908; Tue, 21 Oct 2014 21:37:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbskG008908@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:37:55 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/sys/param.h Changes in other areas also in this revision: Modified: head/sys/sys/param.h stable/8/sys/sys/param.h stable/9/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ stable/10/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@FreeBSD.ORG Tue Oct 21 21:44:26 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 73AD172B; Tue, 21 Oct 2014 21:44:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 446F622D; Tue, 21 Oct 2014 21:44:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLiQEg013222; Tue, 21 Oct 2014 21:44:26 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLiQuv013221; Tue, 21 Oct 2014 21:44:26 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212144.s9LLiQuv013221@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273433 - releng/10.1/release/doc/en_US.ISO8859-1/relnotes stable/9/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 21 Oct 2014 21:44:26 -0000 Author: gjb Date: Tue Oct 21 21:44:24 2014 New Revision: 273433 URL: https://svnweb.freebsd.org/changeset/base/273433 Log: Document the following security advisories: FreeBSD-SA-14:20.rtsold FreeBSD-SA-14:21.routed FreeBSD-SA-14:22.namei FreeBSD-SA-14:23.openssl Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Changes in other areas also in this revision: Modified: releng/10.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 21 21:37:53 2014 (r273432) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.xml Tue Oct 21 21:44:24 2014 (r273433) @@ -112,6 +112,33 @@ Denial of Service in TCP packet processing. + + + SA-14:20.rtsold + 21 October 2014 + Remote buffer overflow + vulnerability. + + + + SA-14:21.routed + 21 October 2014 + Remote denial of service + vulnerability. + + + + SA-14:22.namei + 21 October 2014 + Memory leak in sandboxed namei + lookup. + + + + SA-14:23.openssl + 21 October 2014 + Multiple vulerabilities. + From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 04:01:27 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C8FA288B; Wed, 22 Oct 2014 04:01:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4B42CCB; Wed, 22 Oct 2014 04:01:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M41RlW090851; Wed, 22 Oct 2014 04:01:27 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M41RRY090850; Wed, 22 Oct 2014 04:01:27 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410220401.s9M41RRY090850@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Wed, 22 Oct 2014 04:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273450 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 04:01:27 -0000 Author: bryanv Date: Wed Oct 22 04:01:27 2014 New Revision: 273450 URL: https://svnweb.freebsd.org/changeset/base/273450 Log: MFC r272796: Add M_FLOWID to M_COPYFLAGS The M_FLOWID flag should be propagated to the new mbuf pkthdr in m_move_pkthdr() and m_dup_pkthdr(). The new mbuf already got the existing flowid value, but would be ignored since the flag was not set. Modified: stable/10/sys/sys/mbuf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/mbuf.h ============================================================================== --- stable/10/sys/sys/mbuf.h Wed Oct 22 03:39:11 2014 (r273449) +++ stable/10/sys/sys/mbuf.h Wed Oct 22 04:01:27 2014 (r273450) @@ -247,7 +247,7 @@ struct mbuf { * Flags preserved when copying m_pkthdr. */ #define M_COPYFLAGS \ - (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_VLANTAG|M_PROMISC| \ + (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID| \ M_PROTOFLAGS) /* From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 04:09:48 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2CA06A90; Wed, 22 Oct 2014 04:09:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DC3FD02; Wed, 22 Oct 2014 04:09:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M49llE093816; Wed, 22 Oct 2014 04:09:47 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M49lWH093815; Wed, 22 Oct 2014 04:09:47 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410220409.s9M49lWH093815@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Wed, 22 Oct 2014 04:09:47 +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: r273451 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 04:09:48 -0000 Author: bryanv Date: Wed Oct 22 04:09:47 2014 New Revision: 273451 URL: https://svnweb.freebsd.org/changeset/base/273451 Log: MFC r272573: Change the UMA mutex into a rwlock Acquire the lock in read mode when just needed to ensure the stability of the keg list. The UMA lock may be held for a long time (relatively speaking) in uma_reclaim() on machines with lots of zones/kegs. If the uma_timeout() would fire during that period, subsequent callouts on that CPU may be significantly delayed. Modified: stable/10/sys/vm/uma_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/uma_core.c ============================================================================== --- stable/10/sys/vm/uma_core.c Wed Oct 22 04:01:27 2014 (r273450) +++ stable/10/sys/vm/uma_core.c Wed Oct 22 04:09:47 2014 (r273451) @@ -135,8 +135,8 @@ static LIST_HEAD(,uma_keg) uma_kegs = LI static LIST_HEAD(,uma_zone) uma_cachezones = LIST_HEAD_INITIALIZER(uma_cachezones); -/* This mutex protects the keg list */ -static struct mtx_padalign uma_mtx; +/* This RW lock protects the keg list */ +static struct rwlock_padalign uma_rwlock; /* Linked list of boot time pages */ static LIST_HEAD(,uma_slab) uma_boot_pages = @@ -905,7 +905,7 @@ zone_drain_wait(uma_zone_t zone, int wai ZONE_UNLOCK(zone); /* * The DRAINING flag protects us from being freed while - * we're running. Normally the uma_mtx would protect us but we + * we're running. Normally the uma_rwlock would protect us but we * must be able to release and acquire the right lock for each keg. */ zone_foreach_keg(zone, &keg_drain); @@ -1541,9 +1541,9 @@ keg_ctor(void *mem, int size, void *udat LIST_INSERT_HEAD(&keg->uk_zones, zone, uz_link); - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_INSERT_HEAD(&uma_kegs, keg, uk_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); return (0); } @@ -1593,9 +1593,9 @@ zone_ctor(void *mem, int size, void *uda zone->uz_release = arg->release; zone->uz_arg = arg->arg; zone->uz_lockptr = &zone->uz_lock; - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_INSERT_HEAD(&uma_cachezones, zone, uz_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); goto out; } @@ -1612,7 +1612,7 @@ zone_ctor(void *mem, int size, void *uda zone->uz_fini = arg->fini; zone->uz_lockptr = &keg->uk_lock; zone->uz_flags |= UMA_ZONE_SECONDARY; - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); ZONE_LOCK(zone); LIST_FOREACH(z, &keg->uk_zones, uz_link) { if (LIST_NEXT(z, uz_link) == NULL) { @@ -1621,7 +1621,7 @@ zone_ctor(void *mem, int size, void *uda } } ZONE_UNLOCK(zone); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); } else if (keg == NULL) { if ((keg = uma_kcreate(zone, arg->size, arg->uminit, arg->fini, arg->align, arg->flags)) == NULL) @@ -1719,9 +1719,9 @@ zone_dtor(void *arg, int size, void *uda if (!(zone->uz_flags & UMA_ZFLAG_INTERNAL)) cache_drain(zone); - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_REMOVE(zone, uz_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); /* * XXX there are some races here where * the zone can be drained but zone lock @@ -1743,9 +1743,9 @@ zone_dtor(void *arg, int size, void *uda * We only destroy kegs from non secondary zones. */ if (keg != NULL && (zone->uz_flags & UMA_ZONE_SECONDARY) == 0) { - mtx_lock(&uma_mtx); + rw_wlock(&uma_rwlock); LIST_REMOVE(keg, uk_link); - mtx_unlock(&uma_mtx); + rw_wunlock(&uma_rwlock); zone_free_item(kegs, keg, NULL, SKIP_NONE); } ZONE_LOCK_FINI(zone); @@ -1767,12 +1767,12 @@ zone_foreach(void (*zfunc)(uma_zone_t)) uma_keg_t keg; uma_zone_t zone; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(keg, &uma_kegs, uk_link) { LIST_FOREACH(zone, &keg->uk_zones, uz_link) zfunc(zone); } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); } /* Public functions */ @@ -1788,7 +1788,7 @@ uma_startup(void *bootmem, int boot_page #ifdef UMA_DEBUG printf("Creating uma keg headers zone and keg.\n"); #endif - mtx_init(&uma_mtx, "UMA lock", NULL, MTX_DEF); + rw_init(&uma_rwlock, "UMA lock"); /* "manually" create the initial zone */ memset(&args, 0, sizeof(args)); @@ -3363,12 +3363,12 @@ sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS int count; count = 0; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) count++; } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); return (sysctl_handle_int(oidp, &count, 0, req)); } @@ -3393,7 +3393,7 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS sbuf_new_for_sysctl(&sbuf, NULL, 128, req); count = 0; - mtx_lock(&uma_mtx); + rw_rlock(&uma_rwlock); LIST_FOREACH(kz, &uma_kegs, uk_link) { LIST_FOREACH(z, &kz->uk_zones, uz_link) count++; @@ -3469,7 +3469,7 @@ skip: ZONE_UNLOCK(z); } } - mtx_unlock(&uma_mtx); + rw_runlock(&uma_rwlock); error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); return (error); From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 09:04:56 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D696A8C9; Wed, 22 Oct 2014 09:04:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2BF8EA2; Wed, 22 Oct 2014 09:04:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M94uHl034078; Wed, 22 Oct 2014 09:04:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M94uUH034077; Wed, 22 Oct 2014 09:04:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410220904.s9M94uUH034077@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Oct 2014 09:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273460 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 09:04:57 -0000 Author: kib Date: Wed Oct 22 09:04:56 2014 New Revision: 273460 URL: https://svnweb.freebsd.org/changeset/base/273460 Log: MFC r273129: Implement FIODTYPE for master ptys. Modified: stable/10/sys/kern/tty_pts.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/tty_pts.c ============================================================================== --- stable/10/sys/kern/tty_pts.c Wed Oct 22 08:59:23 2014 (r273459) +++ stable/10/sys/kern/tty_pts.c Wed Oct 22 09:04:56 2014 (r273460) @@ -269,6 +269,9 @@ ptsdev_ioctl(struct file *fp, u_long cmd int error = 0, sig; switch (cmd) { + case FIODTYPE: + *(int *)data = D_TTY; + return (0); case FIONBIO: /* This device supports non-blocking operation. */ return (0); From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 09:06:37 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 042BDA12; Wed, 22 Oct 2014 09:06:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E490EEB8; Wed, 22 Oct 2014 09:06:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M96af3034388; Wed, 22 Oct 2014 09:06:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M96aS7034387; Wed, 22 Oct 2014 09:06:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410220906.s9M96aS7034387@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Oct 2014 09:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273461 - stable/10/sys/fs/deadfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 09:06:37 -0000 Author: kib Date: Wed Oct 22 09:06:36 2014 New Revision: 273461 URL: https://svnweb.freebsd.org/changeset/base/273461 Log: MFC r273130: Change the deadfs poll VOP to return POLLIN|POLLRDNORM if the caller is interested in i/o state. Return POLLNVAL for invalid bits, similar to poll_no_poll(). Modified: stable/10/sys/fs/deadfs/dead_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/deadfs/dead_vnops.c ============================================================================== --- stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:04:56 2014 (r273460) +++ stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:06:36 2014 (r273461) @@ -163,16 +163,19 @@ dead_write(ap) return (EIO); } -/* - * Trivial poll routine that always returns POLLHUP. - * This is necessary so that a process which is polling a file - * gets notified when that file is revoke()d. - */ static int dead_poll(ap) struct vop_poll_args *ap; { - return (POLLHUP); + + if (ap->a_events & ~POLLSTANDARD) + return (POLLNVAL); + + /* + * Let the user find out that the descriptor is gone. + */ + return (POLLHUP | ((POLLIN | POLLRDNORM) & ap->a_events)); + } static int From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 09:09:43 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 392D6BA2; Wed, 22 Oct 2014 09:09:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24DB4EEB; Wed, 22 Oct 2014 09:09:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M99hl6034925; Wed, 22 Oct 2014 09:09:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M99g7f034920; Wed, 22 Oct 2014 09:09:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410220909.s9M99g7f034920@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Oct 2014 09:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273462 - in stable/10/sys: fs/deadfs fs/devfs sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 09:09:43 -0000 Author: kib Date: Wed Oct 22 09:09:41 2014 New Revision: 273462 URL: https://svnweb.freebsd.org/changeset/base/273462 Log: MFC r273131: When vnode bypass cannot be performed on the cdev file descriptor for read/write/poll/ioctl, call standard vnode filedescriptor fop. Modified: stable/10/sys/fs/deadfs/dead_vnops.c stable/10/sys/fs/devfs/devfs_vnops.c stable/10/sys/sys/vnode.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/deadfs/dead_vnops.c ============================================================================== --- stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:06:36 2014 (r273461) +++ stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:09:41 2014 (r273462) @@ -43,9 +43,6 @@ */ static vop_lookup_t dead_lookup; static vop_open_t dead_open; -static vop_poll_t dead_poll; -static vop_read_t dead_read; -static vop_write_t dead_write; static vop_getwritemount_t dead_getwritemount; static vop_rename_t dead_rename; @@ -130,7 +127,7 @@ dead_open(ap) * Vnode op for read */ /* ARGSUSED */ -static int +int dead_read(ap) struct vop_read_args /* { struct vnode *a_vp; @@ -151,7 +148,7 @@ dead_read(ap) * Vnode op for write */ /* ARGSUSED */ -static int +int dead_write(ap) struct vop_write_args /* { struct vnode *a_vp; @@ -163,7 +160,7 @@ dead_write(ap) return (EIO); } -static int +int dead_poll(ap) struct vop_poll_args *ap; { Modified: stable/10/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/10/sys/fs/devfs/devfs_vnops.c Wed Oct 22 09:06:36 2014 (r273461) +++ stable/10/sys/fs/devfs/devfs_vnops.c Wed Oct 22 09:09:41 2014 (r273462) @@ -734,8 +734,10 @@ devfs_ioctl_f(struct file *fp, u_long co fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); - if (error) + if (error != 0) { + error = vnops.fo_ioctl(fp, com, data, cred, td); return (error); + } if (com == FIODTYPE) { *(int *)data = dsw->d_flags & D_TYPEMASK; @@ -1149,8 +1151,10 @@ devfs_poll_f(struct file *fp, int events fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); - if (error) - return (poll_no_poll(events)); + if (error != 0) { + error = vnops.fo_poll(fp, events, cred, td); + return (error); + } error = dsw->d_poll(dev, events, td); td->td_fpop = fpop; dev_relthread(dev, ref); @@ -1182,8 +1186,10 @@ devfs_read_f(struct file *fp, struct uio return (EINVAL); fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); - if (error) + if (error != 0) { + error = vnops.fo_read(fp, uio, cred, flags, td); return (error); + } resid = uio->uio_resid; ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT); if (ioflag & O_DIRECT) @@ -1657,8 +1663,10 @@ devfs_write_f(struct file *fp, struct ui return (EINVAL); fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw, &ref); - if (error) + if (error != 0) { + error = vnops.fo_write(fp, uio, cred, flags, td); return (error); + } KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); ioflag = fp->f_flag & (O_NONBLOCK | O_DIRECT | O_FSYNC); if (ioflag & O_DIRECT) @@ -1740,8 +1748,9 @@ static struct vop_vector devfs_specops = .vop_mknod = VOP_PANIC, .vop_open = devfs_open, .vop_pathconf = devfs_pathconf, + .vop_poll = dead_poll, .vop_print = devfs_print, - .vop_read = VOP_PANIC, + .vop_read = dead_read, .vop_readdir = VOP_PANIC, .vop_readlink = VOP_PANIC, .vop_reallocblks = VOP_PANIC, @@ -1757,7 +1766,7 @@ static struct vop_vector devfs_specops = .vop_strategy = VOP_PANIC, .vop_symlink = VOP_PANIC, .vop_vptocnp = devfs_vptocnp, - .vop_write = VOP_PANIC, + .vop_write = dead_write, }; /* Modified: stable/10/sys/sys/vnode.h ============================================================================== --- stable/10/sys/sys/vnode.h Wed Oct 22 09:06:36 2014 (r273461) +++ stable/10/sys/sys/vnode.h Wed Oct 22 09:09:41 2014 (r273462) @@ -756,6 +756,9 @@ int vop_enoent(struct vop_generic_args * int vop_enotty(struct vop_generic_args *ap); int vop_null(struct vop_generic_args *ap); int vop_panic(struct vop_generic_args *ap); +int dead_poll(struct vop_poll_args *ap); +int dead_read(struct vop_read_args *ap); +int dead_write(struct vop_write_args *ap); /* These are called from within the actual VOPS. */ void vop_create_post(void *a, int rc); From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 09:12:21 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79812D25; Wed, 22 Oct 2014 09:12:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C154FA4; Wed, 22 Oct 2014 09:12:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9CLKr038764; Wed, 22 Oct 2014 09:12:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9CL9R038763; Wed, 22 Oct 2014 09:12:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410220912.s9M9CL9R038763@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 22 Oct 2014 09:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273463 - stable/10/sys/fs/deadfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 09:12:21 -0000 Author: kib Date: Wed Oct 22 09:12:20 2014 New Revision: 273463 URL: https://svnweb.freebsd.org/changeset/base/273463 Log: MFC r273132: Style changes for deadfs. Modified: stable/10/sys/fs/deadfs/dead_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/deadfs/dead_vnops.c ============================================================================== --- stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:09:41 2014 (r273462) +++ stable/10/sys/fs/deadfs/dead_vnops.c Wed Oct 22 09:12:20 2014 (r273463) @@ -77,14 +77,10 @@ struct vop_vector dead_vnodeops = { .vop_write = dead_write, }; -/* ARGSUSED */ static int -dead_getwritemount(ap) - struct vop_getwritemount_args /* { - struct vnode *a_vp; - struct mount **a_mpp; - } */ *ap; +dead_getwritemount(struct vop_getwritemount_args *ap) { + *(ap->a_mpp) = NULL; return (0); } @@ -92,14 +88,8 @@ dead_getwritemount(ap) /* * Trivial lookup routine that always fails. */ -/* ARGSUSED */ static int -dead_lookup(ap) - struct vop_lookup_args /* { - struct vnode * a_dvp; - struct vnode ** a_vpp; - struct componentname * a_cnp; - } */ *ap; +dead_lookup(struct vop_lookup_args *ap) { *ap->a_vpp = NULL; @@ -109,33 +99,17 @@ dead_lookup(ap) /* * Open always fails as if device did not exist. */ -/* ARGSUSED */ static int -dead_open(ap) - struct vop_open_args /* { - struct vnode *a_vp; - int a_mode; - struct ucred *a_cred; - struct proc *a_p; - } */ *ap; +dead_open(struct vop_open_args *ap) { return (ENXIO); } -/* - * Vnode op for read - */ -/* ARGSUSED */ int -dead_read(ap) - struct vop_read_args /* { - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; - } */ *ap; +dead_read(struct vop_read_args *ap) { + /* * Return EOF for tty devices, EIO for others */ @@ -144,25 +118,15 @@ dead_read(ap) return (0); } -/* - * Vnode op for write - */ -/* ARGSUSED */ int -dead_write(ap) - struct vop_write_args /* { - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; - } */ *ap; +dead_write(struct vop_write_args *ap) { + return (EIO); } int -dead_poll(ap) - struct vop_poll_args *ap; +dead_poll(struct vop_poll_args *ap) { if (ap->a_events & ~POLLSTANDARD) @@ -176,15 +140,7 @@ dead_poll(ap) } static int -dead_rename(ap) - struct vop_rename_args /* { - struct vnode *a_fdvp; - struct vnode *a_fvp; - struct componentname *a_fcnp; - struct vnode *a_tdvp; - struct vnode *a_tvp; - struct componentname *a_tcnp; - } */ *ap; +dead_rename(struct vop_rename_args *ap) { vop_rename_fail(ap); From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 13:50:41 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 46650800; Wed, 22 Oct 2014 13:50:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FE7DAE8; Wed, 22 Oct 2014 13:50:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MDofov069045; Wed, 22 Oct 2014 13:50:41 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MDodek069036; Wed, 22 Oct 2014 13:50:39 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410221350.s9MDodek069036@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 22 Oct 2014 13:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273471 - stable/10/lib/libc/arm/aeabi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 13:50:41 -0000 Author: andrew Date: Wed Oct 22 13:50:38 2014 New Revision: 273471 URL: https://svnweb.freebsd.org/changeset/base/273471 Log: MFC r273088: Add support for the __aeabi_c*cmp* functions. These are similar to the existing functions with the exception they use the condition flags to store the result. Added: stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S - copied unchanged from r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S - copied unchanged from r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S Modified: stable/10/lib/libc/arm/aeabi/Makefile.inc stable/10/lib/libc/arm/aeabi/Symbol.map stable/10/lib/libc/arm/aeabi/aeabi_double.c stable/10/lib/libc/arm/aeabi/aeabi_float.c stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/arm/aeabi/Makefile.inc ============================================================================== --- stable/10/lib/libc/arm/aeabi/Makefile.inc Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/Makefile.inc Wed Oct 22 13:50:38 2014 (r273471) @@ -2,7 +2,9 @@ .PATH: ${.CURDIR}/arm/aeabi -SRCS+= aeabi_atexit.c \ +SRCS+= aeabi_asm_double.S \ + aeabi_asm_float.S \ + aeabi_atexit.c \ aeabi_double.c \ aeabi_float.c \ aeabi_unwind_cpp.c \ Modified: stable/10/lib/libc/arm/aeabi/Symbol.map ============================================================================== --- stable/10/lib/libc/arm/aeabi/Symbol.map Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/Symbol.map Wed Oct 22 13:50:38 2014 (r273471) @@ -17,6 +17,10 @@ FBSDprivate_1.0 { __aeabi_dcmpgt; __aeabi_dcmpun; + __aeabi_cdcmpeq; + __aeabi_cdcmple; + __aeabi_cdrcmple; + __aeabi_d2iz; __aeabi_d2f; @@ -33,6 +37,10 @@ FBSDprivate_1.0 { __aeabi_fcmpgt; __aeabi_fcmpun; + __aeabi_cfcmpeq; + __aeabi_cfcmple; + __aeabi_cfrcmple; + __aeabi_f2iz; __aeabi_f2d; Copied: stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S (from r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/arm/aeabi/aeabi_asm_double.S Wed Oct 22 13:50:38 2014 (r273471, copy of r273088, head/lib/libc/arm/aeabi/aeabi_asm_double.S) @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2014 Andrew Turner + * 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$"); + +#define PCR_Z (1 << 30) +#define PCR_C (1 << 29) + +/* + * These functions return the result in the CPSR register. + * + * For __aeabi_cdcmple: + * Z C + * LT 0 0 + * EQ 1 1 + * else 0 1 + * + * __aeabi_cdrcmple is the same as __aeabi_cdcmple, however the arguments + * have been swapped. + */ +ENTRY(__aeabi_cdcmple) + push {r4, r5, r6, r7, ip, lr} + + /* Backup the input registers */ + mov r4, r0 + mov r5, r1 + mov r6, r2 + mov r7, r3 + /* Is it less than? */ + bl __aeabi_dcmplt + cmp r0, #1 + bne 1f + /* Yes, clear Z and C */ + msr cpsr_c, #(0) + b 99f + +1: + /* Restore the input regsters for the next function call */ + mov r0, r4 + mov r1, r5 + mov r2, r6 + mov r3, r7 + /* Is it equal? */ + bl __aeabi_dcmpeq + cmp r0, #1 + bne 2f + /* Yes, set Z and C */ + msr cpsr_c, #(PCR_Z | PCR_C) + b 99f + +2: + /* Not less than or equal, set C and clear Z */ + msr cpsr_c, #(PCR_C) + +99: + pop {r4, r5, r6, r7, ip, pc} +END(__aeabi_cdcmple) + +ENTRY(__aeabi_cdrcmple) + /* Swap the first half of the arguments */ + mov ip, r0 + mov r0, r2 + mov r2, ip + + /* And the second half */ + mov ip, r1 + mov r1, r3 + mov r3, ip + + b __aeabi_cdcmple +END(__aeabi_cdrcmple) + +/* + * This is just like __aeabi_cdcmple except it will not throw an exception + * in the presence of a quiet NaN. If either argument is a signalling NaN we + * will still signal. + */ +ENTRY(__aeabi_cdcmpeq) + /* Check if we can call __aeabi_cfcmple safely */ + push {r0, r1, r2, r3, r4, lr} + bl __aeabi_cdcmpeq_helper + cmp r0, #1 + pop {r0, r1, r2, r3, r4, lr} + beq 1f + + bl __aeabi_cdcmple + RET + +1: + msr cpsr_c, #(PCR_C) + RET +END(__aeabi_cdcmpeq) Copied: stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S (from r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/arm/aeabi/aeabi_asm_float.S Wed Oct 22 13:50:38 2014 (r273471, copy of r273088, head/lib/libc/arm/aeabi/aeabi_asm_float.S) @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2014 Andrew Turner + * 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$"); + +#define PCR_Z (1 << 30) +#define PCR_C (1 << 29) + +/* + * These functions return the result in the CPSR register. + * + * For __aeabi_cfcmple: + * Z C + * LT 0 0 + * EQ 1 1 + * else 0 1 + * + * __aeabi_cfrcmple is the same as __aeabi_cfcmple, however the arguments + * have been swapped. + */ +ENTRY(__aeabi_cfcmple) + push {r4, r5, ip, lr} + + /* Backup the input registers */ + mov r4, r0 + mov r5, r1 + /* Is it less than? */ + bl __aeabi_fcmplt + cmp r0, #1 + bne 1f + /* Yes, clear Z and C */ + msr cpsr_c, #(0) + b 99f + +1: + /* Restore the input regsters for the next function call */ + mov r0, r4 + mov r1, r5 + /* Is it equal? */ + bl __aeabi_fcmpeq + cmp r0, #1 + bne 2f + /* Yes, set Z and C */ + msr cpsr_c, #(PCR_Z | PCR_C) + b 99f + +2: + /* Not less than or equal, set C and clear Z */ + msr cpsr_c, #(PCR_C) + +99: + pop {r4, r5, ip, pc} +END(__aeabi_cfcmple) + +ENTRY(__aeabi_cfrcmple) + /* Swap the arguments */ + mov ip, r0 + mov r0, r1 + mov r1, ip + + b __aeabi_cfcmple +END(__aeabi_cfrcmple) + +/* + * This is just like __aeabi_cfcmple except it will not throw an exception + * in the presence of a quiet NaN. If either argument is a signalling NaN we + * will still signal. + */ +ENTRY(__aeabi_cfcmpeq) + /* Check if we can call __aeabi_cfcmple safely */ + push {r0, r1, r2, lr} + bl __aeabi_cfcmpeq_helper + cmp r0, #1 + pop {r0, r1, r2, lr} + beq 1f + + bl __aeabi_cfcmple + RET + +1: + msreq cpsr_c, #(PCR_C) + RET +END(__aeabi_cfcmpeq) Modified: stable/10/lib/libc/arm/aeabi/aeabi_double.c ============================================================================== --- stable/10/lib/libc/arm/aeabi/aeabi_double.c Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/aeabi_double.c Wed Oct 22 13:50:38 2014 (r273471) @@ -74,3 +74,28 @@ float64 AEABI_FUNC2(ddiv, float64, float float64 AEABI_FUNC2(dmul, float64, float64_mul) float64 AEABI_FUNC2(dsub, float64, float64_sub) +int +__aeabi_cdcmpeq_helper(float64 a, float64 b) +{ + int quiet = 0; + + /* Check if a is a NaN */ + if ((a << 1) > 0xffe0000000000000ull) { + /* If it's a signalling NaN we will always signal */ + if ((a & 0x0008000000000000ull) == 0) + return (0); + + quiet = 1; + } + + /* Check if b is a NaN */ + if ((b << 1) > 0xffe0000000000000ull) { + /* If it's a signalling NaN we will always signal */ + if ((b & 0x0008000000000000ull) == 0) + return (0); + + quiet = 1; + } + + return (quiet); +} Modified: stable/10/lib/libc/arm/aeabi/aeabi_float.c ============================================================================== --- stable/10/lib/libc/arm/aeabi/aeabi_float.c Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/aeabi_float.c Wed Oct 22 13:50:38 2014 (r273471) @@ -74,3 +74,28 @@ float32 AEABI_FUNC2(fdiv, float32, float float32 AEABI_FUNC2(fmul, float32, float32_mul) float32 AEABI_FUNC2(fsub, float32, float32_sub) +int +__aeabi_cfcmpeq_helper(float32 a, float32 b) +{ + int quiet = 0; + + /* Check if a is a NaN */ + if ((a << 1) > 0xff000000u) { + /* If it's a signalling NaN we will always signal */ + if ((a & 0x00400000u) == 0) + return (0); + + quiet = 1; + } + + /* Check if b is a NaN */ + if ((b << 1) > 0xff000000u) { + /* If it's a signalling NaN we will always signal */ + if ((b & 0x00400000u) == 0) + return (0); + + quiet = 1; + } + + return (quiet); +} Modified: stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S ============================================================================== --- stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/aeabi_vfp_double.S Wed Oct 22 13:50:38 2014 (r273471) @@ -33,6 +33,33 @@ __FBSDID("$FreeBSD$"); .fpu vfp .syntax unified +/* void __aeabi_cdcmpeq(double, double) */ +AEABI_ENTRY(cdcmpeq) + LOAD_DREG(d0, r0, r1) + LOAD_DREG(d1, r2, r3) + vcmp.f64 d0, d1 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cdcmpeq) + +/* void __aeabi_cdcmple(double, double) */ +AEABI_ENTRY(cdcmple) + LOAD_DREG(d0, r0, r1) + LOAD_DREG(d1, r2, r3) + vcmpe.f64 d0, d1 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cdcmple) + +/* void __aeabi_cdrcmple(double, double) */ +AEABI_ENTRY(cdrcmple) + LOAD_DREG(d0, r0, r1) + LOAD_DREG(d1, r2, r3) + vcmpe.f64 d1, d0 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cdrcmple) + /* int __aeabi_dcmpeq(double, double) */ AEABI_ENTRY(dcmpeq) LOAD_DREG(d0, r0, r1) Modified: stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S ============================================================================== --- stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S Wed Oct 22 11:30:56 2014 (r273470) +++ stable/10/lib/libc/arm/aeabi/aeabi_vfp_float.S Wed Oct 22 13:50:38 2014 (r273471) @@ -33,6 +33,30 @@ __FBSDID("$FreeBSD$"); .fpu vfp .syntax unified +/* void __aeabi_cfcmpeq(float, float) */ +AEABI_ENTRY(cfcmpeq) + LOAD_SREGS(s0, s1, r0, r1) + vcmp.f32 s0, s1 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cfcmpeq) + +/* void __aeabi_cfcmple(float, float) */ +AEABI_ENTRY(cfcmple) + LOAD_SREGS(s0, s1, r0, r1) + vcmpe.f32 s0, s1 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cfcmple) + +/* void __aeabi_cfrcmple(float, float) */ +AEABI_ENTRY(cfrcmple) + LOAD_SREGS(s0, s1, r0, r1) + vcmpe.f32 s1, s0 + vmrs APSR_nzcv, fpscr + RET +AEABI_END(cfrcmple) + /* int __aeabi_fcmpeq(float, float) */ AEABI_ENTRY(fcmpeq) LOAD_SREGS(s0, s1, r0, r1) From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 23:55:07 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CAFA0671; Wed, 22 Oct 2014 23:55:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5F10785; Wed, 22 Oct 2014 23:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNt7Xl054437; Wed, 22 Oct 2014 23:55:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNt7W5054436; Wed, 22 Oct 2014 23:55:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410222355.s9MNt7W5054436@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 22 Oct 2014 23:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273490 - stable/9/usr.bin/elfdump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 23:55:07 -0000 Author: markj Date: Wed Oct 22 23:55:06 2014 New Revision: 273490 URL: https://svnweb.freebsd.org/changeset/base/273490 Log: MFC r271692: Fix a typo. Modified: stable/9/usr.bin/elfdump/elfdump.1 Directory Properties: stable/9/usr.bin/elfdump/ (props changed) Modified: stable/9/usr.bin/elfdump/elfdump.1 ============================================================================== --- stable/9/usr.bin/elfdump/elfdump.1 Wed Oct 22 23:41:15 2014 (r273489) +++ stable/9/usr.bin/elfdump/elfdump.1 Wed Oct 22 23:55:06 2014 (r273490) @@ -50,7 +50,7 @@ The options are as follows: .It Fl a Dump all information. .It Fl c -Dump shared headers. +Dump section headers. .It Fl d Dump dynamic symbols. .It Fl e From owner-svn-src-stable@FreeBSD.ORG Wed Oct 22 23:55:09 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 79BAA674; Wed, 22 Oct 2014 23:55:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65913786; Wed, 22 Oct 2014 23:55:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNt9jm054485; Wed, 22 Oct 2014 23:55:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNt9br054484; Wed, 22 Oct 2014 23:55:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410222355.s9MNt9br054484@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 22 Oct 2014 23:55:09 +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: r273491 - stable/10/usr.bin/elfdump X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 22 Oct 2014 23:55:09 -0000 Author: markj Date: Wed Oct 22 23:55:08 2014 New Revision: 273491 URL: https://svnweb.freebsd.org/changeset/base/273491 Log: MFC r271692: Fix a typo. Modified: stable/10/usr.bin/elfdump/elfdump.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/elfdump/elfdump.1 ============================================================================== --- stable/10/usr.bin/elfdump/elfdump.1 Wed Oct 22 23:55:06 2014 (r273490) +++ stable/10/usr.bin/elfdump/elfdump.1 Wed Oct 22 23:55:08 2014 (r273491) @@ -50,7 +50,7 @@ The options are as follows: .It Fl a Dump all information. .It Fl c -Dump shared headers. +Dump section headers. .It Fl d Dump dynamic symbols. .It Fl e From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 00:39:20 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E4DC35D3; Thu, 23 Oct 2014 00:39:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4F6EB51; Thu, 23 Oct 2014 00:39:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0dKmh075467; Thu, 23 Oct 2014 00:39:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0dJxi075459; Thu, 23 Oct 2014 00:39:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230039.s9N0dJxi075459@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 00:39:19 +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: r273496 - stable/10/usr.bin/talk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 00:39:21 -0000 Author: ngie Date: Thu Oct 23 00:39:19 2014 New Revision: 273496 URL: https://svnweb.freebsd.org/changeset/base/273496 Log: MFC r263264 (by glebius): Make talk(1) capable of displaying UTF-8 characters. Sponsored by: Nginx, Inc. Modified: stable/10/usr.bin/talk/Makefile stable/10/usr.bin/talk/display.c stable/10/usr.bin/talk/io.c stable/10/usr.bin/talk/talk.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/talk/Makefile ============================================================================== --- stable/10/usr.bin/talk/Makefile Thu Oct 23 00:37:52 2014 (r273495) +++ stable/10/usr.bin/talk/Makefile Thu Oct 23 00:39:19 2014 (r273496) @@ -4,7 +4,7 @@ PROG= talk SRCS= ctl.c ctl_transact.c display.c get_addrs.c get_iface.c get_names.c \ init_disp.c invite.c io.c look_up.c msgs.c talk.c -DPADD= ${LIBCURSES} -LDADD= -lcurses +DPADD= ${LIBCURSESW} +LDADD= -lcursesw .include Modified: stable/10/usr.bin/talk/display.c ============================================================================== --- stable/10/usr.bin/talk/display.c Thu Oct 23 00:37:52 2014 (r273495) +++ stable/10/usr.bin/talk/display.c Thu Oct 23 00:39:19 2014 (r273496) @@ -41,9 +41,14 @@ static const char sccsid[] = "@(#)displa */ #include #include +#include +#define _XOPEN_SOURCE_EXTENDED +#include #include "talk.h" +void display(xwin_t *, wchar_t *); + xwin_t my_win; xwin_t his_win; WINDOW *line_win; @@ -61,111 +66,130 @@ max(int a, int b) return (a > b ? a : b); } +static cchar_t * +makecchar(wchar_t in) +{ + static cchar_t cc; + wchar_t wc[2]; + + wc[0] = in; + wc[1] = L'\0'; + + if (setcchar(&cc, wc, A_NORMAL, 0, NULL) != OK) + p_error("settchar(3) failure"); + + return (&cc); +} + /* - * Display some text on somebody's window, processing some control + * Display a symbol on somebody's window, processing some control * characters while we are at it. */ void -display(xwin_t *win, char *text, int size) +display(xwin_t *win, wchar_t *wc) { - int i; - char cch; - for (i = 0; i < size; i++) { - if (*text == '\n' || *text == '\r') { - waddch(win->x_win, '\n'); - getyx(win->x_win, win->x_line, win->x_col); - text++; - continue; - } - if (*text == 004 && win == &my_win) { - /* control-D clears the screen */ + /* + * Alas, can't use variables in C switch statement. + * Workaround these 3 cases with goto. + */ + if (*wc == win->kill) + goto kill; + else if (*wc == win->cerase) + goto cerase; + else if (*wc == win->werase) + goto werase; + + switch (*wc) { + case L'\n': + case L'\r': + wadd_wch(win->x_win, makecchar(L'\n')); + getyx(win->x_win, win->x_line, win->x_col); + wrefresh(win->x_win); + return; + + case 004: + if (win == &my_win) { + /* Ctrl-D clears the screen. */ werase(my_win.x_win); getyx(my_win.x_win, my_win.x_line, my_win.x_col); wrefresh(my_win.x_win); werase(his_win.x_win); getyx(his_win.x_win, his_win.x_line, his_win.x_col); wrefresh(his_win.x_win); - text++; - continue; } + return; - /* erase character */ - if ( *text == win->cerase - || *text == 010 /* BS */ - || *text == 0177 /* DEL */ - ) { - wmove(win->x_win, win->x_line, max(--win->x_col, 0)); - getyx(win->x_win, win->x_line, win->x_col); - waddch(win->x_win, ' '); - wmove(win->x_win, win->x_line, win->x_col); - getyx(win->x_win, win->x_line, win->x_col); - text++; - continue; - } + /* Erase character. */ + case 010: /* BS */ + case 0177: /* DEL */ +cerase: + wmove(win->x_win, win->x_line, max(--win->x_col, 0)); + getyx(win->x_win, win->x_line, win->x_col); + waddch(win->x_win, ' '); + wmove(win->x_win, win->x_line, win->x_col); + getyx(win->x_win, win->x_line, win->x_col); + wrefresh(win->x_win); + return; + + case 027: /* ^W */ +werase: + { /* * On word erase search backwards until we find * the beginning of a word or the beginning of * the line. */ - if ( *text == win->werase - || *text == 027 /* ^W */ - ) { - int endcol, xcol, ii, c; - - endcol = win->x_col; - xcol = endcol - 1; - while (xcol >= 0) { - c = readwin(win->x_win, win->x_line, xcol); - if (c != ' ') - break; - xcol--; - } - while (xcol >= 0) { - c = readwin(win->x_win, win->x_line, xcol); - if (c == ' ') - break; - xcol--; - } - wmove(win->x_win, win->x_line, xcol + 1); - for (ii = xcol + 1; ii < endcol; ii++) - waddch(win->x_win, ' '); - wmove(win->x_win, win->x_line, xcol + 1); - getyx(win->x_win, win->x_line, win->x_col); - text++; - continue; - } - /* line kill */ - if ( *text == win->kill - || *text == 025 /* ^U */ - ) { - wmove(win->x_win, win->x_line, 0); - wclrtoeol(win->x_win); - getyx(win->x_win, win->x_line, win->x_col); - text++; - continue; - } - if (*text == '\f') { - if (win == &my_win) - wrefresh(curscr); - text++; - continue; - } - if (*text == '\7') { - write(STDOUT_FILENO, text, 1); - text++; - continue; + int endcol, xcol, c; + + endcol = win->x_col; + xcol = endcol - 1; + while (xcol >= 0) { + c = readwin(win->x_win, win->x_line, xcol); + if (c != ' ') + break; + xcol--; + } + while (xcol >= 0) { + c = readwin(win->x_win, win->x_line, xcol); + if (c == ' ') + break; + xcol--; } - if (!isprint((unsigned char)*text) && *text != '\t') { - waddch(win->x_win, '^'); - getyx(win->x_win, win->x_line, win->x_col); - cch = (*text & 63) + 64; - waddch(win->x_win, cch); - } else - waddch(win->x_win, (unsigned char)*text); + wmove(win->x_win, win->x_line, xcol + 1); + for (int i = xcol + 1; i < endcol; i++) + waddch(win->x_win, ' '); + wmove(win->x_win, win->x_line, xcol + 1); + getyx(win->x_win, win->x_line, win->x_col); + wrefresh(win->x_win); + return; + } + + case 025: /* ^U */ +kill: + wmove(win->x_win, win->x_line, 0); + wclrtoeol(win->x_win); getyx(win->x_win, win->x_line, win->x_col); - text++; + wrefresh(win->x_win); + return; + + case L'\f': + if (win == &my_win) + wrefresh(curscr); + return; + + case L'\7': + write(STDOUT_FILENO, wc, sizeof(*wc)); + return; } + + + if (iswprint(*wc) || *wc == L'\t') + wadd_wch(win->x_win, makecchar(*wc)); + else + beep(); + + getyx(win->x_win, win->x_line, win->x_col); wrefresh(win->x_win); } Modified: stable/10/usr.bin/talk/io.c ============================================================================== --- stable/10/usr.bin/talk/io.c Thu Oct 23 00:37:52 2014 (r273495) +++ stable/10/usr.bin/talk/io.c Thu Oct 23 00:39:19 2014 (r273496) @@ -46,14 +46,17 @@ static const char sccsid[] = "@(#)io.c 8 #include #include #include +#include #include #include #include +#define _XOPEN_SOURCE_EXTENDED +#include #include "talk.h" #include "talk_ctl.h" -#define A_LONG_TIME 10000000 +extern void display(xwin_t *, wchar_t *); volatile sig_atomic_t gotwinch = 0; @@ -65,9 +68,10 @@ talk(void) { struct hostent *hp, *hp2; int nb; - fd_set read_set, read_template; - char buf[BUFSIZ], **addr, *his_machine_name; - struct timeval wait; + fd_set read_set; + wchar_t buf[BUFSIZ]; + char **addr, *his_machine_name; + FILE *sockfp; his_machine_name = NULL; hp = gethostbyaddr((const char *)&his_machine_addr.s_addr, @@ -85,64 +89,58 @@ talk(void) } if (his_machine_name == NULL) his_machine_name = strdup(inet_ntoa(his_machine_addr)); - snprintf(buf, sizeof(buf), "Connection established with %s@%s.", + snprintf((char *)buf, sizeof(buf), "Connection established with %s@%s.", msg.r_name, his_machine_name); free(his_machine_name); - message(buf); + message((char *)buf); write(STDOUT_FILENO, "\007\007\007", 3); current_line = 0; + if ((sockfp = fdopen(sockt, "w+")) == NULL) + p_error("fdopen"); + + setvbuf(sockfp, NULL, _IONBF, 0); + setvbuf(stdin, NULL, _IONBF, 0); + /* - * Wait on both the other process (sockt_mask) and - * standard input ( STDIN_MASK ) + * Wait on both the other process (sockt) and standard input. */ - FD_ZERO(&read_template); - FD_SET(sockt, &read_template); - FD_SET(fileno(stdin), &read_template); for (;;) { - read_set = read_template; - wait.tv_sec = A_LONG_TIME; - wait.tv_usec = 0; - nb = select(32, &read_set, 0, 0, &wait); + FD_ZERO(&read_set); + FD_SET(sockt, &read_set); + FD_SET(fileno(stdin), &read_set); + nb = select(32, &read_set, 0, 0, NULL); if (gotwinch) { resize_display(); gotwinch = 0; } if (nb <= 0) { - if (errno == EINTR) { - read_set = read_template; + if (errno == EINTR) continue; - } - /* panic, we don't know what happened */ + /* Panic, we don't know what happened. */ p_error("Unexpected error from select"); quit(); } if (FD_ISSET(sockt, &read_set)) { - /* There is data on sockt */ - nb = read(sockt, buf, sizeof buf); - if (nb <= 0) { + wint_t w; + + /* There is data on sockt. */ + w = fgetwc(sockfp); + if (w == WEOF) { message("Connection closed. Exiting"); quit(); } - display(&his_win, buf, nb); + display(&his_win, &w); } if (FD_ISSET(fileno(stdin), &read_set)) { - /* - * We can't make the tty non_blocking, because - * curses's output routines would screw up - */ - int i; - ioctl(0, FIONREAD, (void *) &nb); - if (nb > (ssize_t)(sizeof buf)) - nb = sizeof buf; - nb = read(STDIN_FILENO, buf, nb); - display(&my_win, buf, nb); - /* might lose data here because sockt is non-blocking */ - for (i = 0; i < nb; ++i) - if (buf[i] == '\r') - buf[i] = '\n'; - write(sockt, buf, nb); + wint_t w; + + if ((w = getwchar()) != WEOF) { + display(&my_win, &w); + (void )fputwc(w, sockfp); + (void )fflush(sockfp); + } } } } Modified: stable/10/usr.bin/talk/talk.h ============================================================================== --- stable/10/usr.bin/talk/talk.h Thu Oct 23 00:37:52 2014 (r273495) +++ stable/10/usr.bin/talk/talk.h Thu Oct 23 00:39:19 2014 (r273496) @@ -69,7 +69,6 @@ extern int check_local(void); extern void check_writeable(void); extern void ctl_transact(struct in_addr,CTL_MSG,int,CTL_RESPONSE *); extern void disp_msg(int); -extern void display(xwin_t *, char *, int); extern void end_msgs(void); extern void get_addrs(const char *, const char *); extern int get_iface(struct in_addr *, struct in_addr *); From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 00:40:40 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5E2A70C; Thu, 23 Oct 2014 00:40:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A79A1B5E; Thu, 23 Oct 2014 00:40:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0eek7076347; Thu, 23 Oct 2014 00:40:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0eeme076345; Thu, 23 Oct 2014 00:40:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230040.s9N0eeme076345@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 00:40:40 +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: r273497 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 00:40:41 -0000 Author: ngie Date: Thu Oct 23 00:40:40 2014 New Revision: 273497 URL: https://svnweb.freebsd.org/changeset/base/273497 Log: MFC r270650: Convert LIBCURSES to LIBNCURSES to fix "make checkdpadd" Also, add a missing LIBPANEL dependency for lldb Approved by: rpaulo (mentor) Suggested by: brooks Phabric: D675 (as part of a larger diff) PR: 192762 Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 00:43:09 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBD139AB; Thu, 23 Oct 2014 00:43:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C77FC08; Thu, 23 Oct 2014 00:43:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0h9E4079515; Thu, 23 Oct 2014 00:43:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0h8WJ079511; Thu, 23 Oct 2014 00:43:08 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230043.s9N0h8WJ079511@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 00:43:08 +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: r273499 - in stable/10: usr.bin/bc usr.bin/clang/lldb usr.bin/talk usr.sbin/gstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 00:43:09 -0000 Author: ngie Date: Thu Oct 23 00:43:08 2014 New Revision: 273499 URL: https://svnweb.freebsd.org/changeset/base/273499 Log: MFC r270650 (this is what should have been committed in r273497): Convert LIBCURSES to LIBNCURSES to fix "make checkdpadd" Also, add a missing LIBPANEL dependency for lldb Approved by: rpaulo (mentor) Suggested by: brooks Phabric: D675 (as part of a larger diff) PR: 192762 Modified: stable/10/usr.bin/bc/Makefile stable/10/usr.bin/clang/lldb/Makefile stable/10/usr.bin/talk/Makefile stable/10/usr.sbin/gstat/Makefile Modified: stable/10/usr.bin/bc/Makefile ============================================================================== --- stable/10/usr.bin/bc/Makefile Thu Oct 23 00:40:56 2014 (r273498) +++ stable/10/usr.bin/bc/Makefile Thu Oct 23 00:43:08 2014 (r273499) @@ -5,8 +5,8 @@ PROG= bc SRCS= bc.y scan.l tty.c CFLAGS+= -I. -I${.CURDIR} -LDADD+= -ledit -lcurses -DPADD+= ${LIBEDIT} ${LIBCURSES} +DPADD+= ${LIBEDIT} ${LIBNCURSESW} +LDADD+= -ledit -lncursesw NO_WMISSING_VARIABLE_DECLARATIONS= Modified: stable/10/usr.bin/clang/lldb/Makefile ============================================================================== --- stable/10/usr.bin/clang/lldb/Makefile Thu Oct 23 00:40:56 2014 (r273498) +++ stable/10/usr.bin/clang/lldb/Makefile Thu Oct 23 00:43:08 2014 (r273499) @@ -16,8 +16,8 @@ SRCS= Driver.cpp \ lldb.1: ln -fs ${LLDB_SRCS}/docs/lldb.1 ${.TARGET} -DPADD= ${LIBEDIT} ${LIBCURSES} ${LIBEXECINFO} -LDADD= -lcurses -ledit -lexecinfo -lpanel +DPADD= ${LIBEDIT} ${LIBNCURSESW} ${LIBEXECINFO} ${LIBPANEL} +LDADD= -ledit -lncursesw -lexecinfo -lpanel LLDB_LIBS=\ lldb \ Modified: stable/10/usr.bin/talk/Makefile ============================================================================== --- stable/10/usr.bin/talk/Makefile Thu Oct 23 00:40:56 2014 (r273498) +++ stable/10/usr.bin/talk/Makefile Thu Oct 23 00:43:08 2014 (r273499) @@ -4,7 +4,7 @@ PROG= talk SRCS= ctl.c ctl_transact.c display.c get_addrs.c get_iface.c get_names.c \ init_disp.c invite.c io.c look_up.c msgs.c talk.c -DPADD= ${LIBCURSESW} -LDADD= -lcursesw +DPADD= ${LIBNCURSESW} +LDADD= -lncursesw .include Modified: stable/10/usr.sbin/gstat/Makefile ============================================================================== --- stable/10/usr.sbin/gstat/Makefile Thu Oct 23 00:40:56 2014 (r273498) +++ stable/10/usr.sbin/gstat/Makefile Thu Oct 23 00:43:08 2014 (r273499) @@ -2,7 +2,7 @@ PROG= gstat MAN= gstat.8 -DPADD= ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBCURSES} -LDADD= -ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lcurses +DPADD= ${LIBDEVSTAT} ${LIBKVM} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBEDIT} ${LIBNCURSESW} +LDADD= -ldevstat -lkvm -lgeom -lbsdxml -lsbuf -ledit -lncursesw .include From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 00:51:53 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D8B8B42; Thu, 23 Oct 2014 00:51:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69009CC2; Thu, 23 Oct 2014 00:51:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0pro8083701; Thu, 23 Oct 2014 00:51:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0prbv083700; Thu, 23 Oct 2014 00:51:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230051.s9N0prbv083700@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 00:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273500 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 00:51:53 -0000 Author: ngie Date: Thu Oct 23 00:51:52 2014 New Revision: 273500 URL: https://svnweb.freebsd.org/changeset/base/273500 Log: MFC r271365: Remove many false positives with make checkdpadd - Reduce DPADD and LDADD in checkdpadd to -l - Skip over -Wl,[es]*-group because -Wl,--end-group and -Wl,--start-group might be required to properly link objects (see usr.bin/clang/lldb as an example) This caveat has been present for a while with some components of the build. However, these false positives were made more more apparent after r269648. Phabric: D635 Reviewed by: jmmv (an earlier version) PR: 192730 Modified: stable/10/share/mk/bsd.dep.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.dep.mk ============================================================================== --- stable/10/share/mk/bsd.dep.mk Thu Oct 23 00:43:08 2014 (r273499) +++ stable/10/share/mk/bsd.dep.mk Thu Oct 23 00:51:52 2014 (r273500) @@ -215,8 +215,10 @@ cleandepend: .endif .if !target(checkdpadd) && (defined(DPADD) || defined(LDADD)) -_LDADD_FROM_DPADD= ${DPADD:C;^/usr/lib/lib(.*)\.a$;-l\1;} -_LDADD_CANONICALIZED= ${LDADD:S/$//} +_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g} +# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the +# LDADD list due to unresolved symbols +_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group} checkdpadd: .if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED} @echo ${.CURDIR} From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 00:54:53 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBE83E38; Thu, 23 Oct 2014 00:54:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CA76CFA; Thu, 23 Oct 2014 00:54:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0srL5084581; Thu, 23 Oct 2014 00:54:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0srfB084580; Thu, 23 Oct 2014 00:54:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230054.s9N0srfB084580@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 00:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273501 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 00:54:53 -0000 Author: ngie Date: Thu Oct 23 00:54:52 2014 New Revision: 273501 URL: https://svnweb.freebsd.org/changeset/base/273501 Log: MFC r272055: Improve bsd.progs.mk compatibility with bsd.prog.mk 1. Do not install FILES/SCRIPTS multiple times if PROGS is specified; this is already handled via bsd.prog.mk when it's called recursively (PR: 191055, 191955). 2. Some variables, like BINDIR and PROGNAME, default to a value if unset whereas others get appended to, like CFLAGS. Add support for the former case (PR: 191056) 3. Make "checkdpadd" and "clean" available targets for recursive execution. Reviewed by: marcel, sjg Phabric: D822 PR: 191055, 191056, 191955 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/share/mk/bsd.progs.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.progs.mk ============================================================================== --- stable/10/share/mk/bsd.progs.mk Thu Oct 23 00:51:52 2014 (r273500) +++ stable/10/share/mk/bsd.progs.mk Thu Oct 23 00:54:52 2014 (r273501) @@ -42,10 +42,15 @@ PROG ?= $t .if defined(PROG) # just one of many -PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS +PROG_OVERRIDE_VARS += BINDIR MAN SRCS +PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} -.if defined(${v}.${PROG}) || defined(${v}_${PROG}) -$v += ${${v}_${PROG}:U${${v}.${PROG}}} +.if empty(${PROG_OVERRIDE_VARS:M$v}) +.if defined(${v}.${PROG}) +$v += ${${v}.${PROG}} +.elif defined(${v}_${PROG}) +$v += ${${v}_${PROG}} +.endif .else $v ?= .endif @@ -61,7 +66,7 @@ UPDATE_DEPENDFILE ?= NO DEPENDFILE?= .depend.${PROG} # prog.mk will do the rest .else -all: ${PROGS} +all: ${FILES} ${PROGS} ${SCRIPTS} # We cannot capture dependencies for meta mode here UPDATE_DEPENDFILE = NO @@ -75,7 +80,7 @@ UPDATE_DEPENDFILE = NO .ifndef _RECURSING_PROGS # tell progs.mk we might want to install things -PROGS_TARGETS+= cleandepend cleandir cleanobj depend install +PROGS_TARGETS+= checkdpadd clean cleandepend cleandir cleanobj depend install .for p in ${PROGS} .if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p) @@ -98,18 +103,15 @@ $p.$t: .PHONY .MAKE $t: ${PROGS:%=%.$t} .endfor -SCRIPTS_TARGETS+= cleandepend cleandir cleanobj depend install +.if empty(PROGS) && !empty(SCRIPTS) -.for p in ${SCRIPTS} -.for t in ${SCRIPTS_TARGETS:O:u} -$p.$t: .PHONY .MAKE - (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ - SUBDIR= SCRIPT=$p ${x.$p} ${@:E}) -.endfor +.for t in ${PROGS_TARGETS:O:u} +scripts.$t: .PHONY .MAKE + (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} SUBDIR= _RECURSING_PROGS= \ + $t) +$t: scripts.$t .endfor -.for t in ${SCRIPTS_TARGETS:O:u} -$t: ${SCRIPTS:%=%.$t} -.endfor +.endif .endif From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:01:59 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E2AEB3; Thu, 23 Oct 2014 01:01:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F40CCDC4; Thu, 23 Oct 2014 01:01:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N11w2E089121; Thu, 23 Oct 2014 01:01:58 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N11wIu089120; Thu, 23 Oct 2014 01:01:58 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230101.s9N11wIu089120@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 01:01:58 +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: r273502 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:01:59 -0000 Author: ngie Date: Thu Oct 23 01:01:58 2014 New Revision: 273502 URL: https://svnweb.freebsd.org/changeset/base/273502 Log: MFC r271336: Expand the tests structure in test_small(..) to workaround the "initializer not constant" warning with gcc Approved by: jmmv (mentor) Phabric: D744 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-invctrig.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-invctrig.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-invctrig.c Thu Oct 23 00:54:52 2014 (r273501) +++ stable/10/tools/regression/lib/msun/test-invctrig.c Thu Oct 23 01:01:58 2014 (r273502) @@ -315,25 +315,20 @@ test_small(void) * asin(z) = Pi/4 + i ln(2)/2 * atan(z) = atan(4)/2 + i ln(17/9)/4 */ - static const struct { - complex long double z; - complex long double acos_z; - complex long double asin_z; - complex long double atan_z; - } tests[] = { - { CMPLXL(0.75L, 0.25L), - CMPLXL(pi / 4, -0.34657359027997265470861606072908828L), - CMPLXL(pi / 4, 0.34657359027997265470861606072908828L), - CMPLXL(0.66290883183401623252961960521423782L, - 0.15899719167999917436476103600701878L) }, - }; - int i; - - for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { - testall_tol(cacos, tests[i].z, tests[i].acos_z, 2); - testall_odd_tol(casin, tests[i].z, tests[i].asin_z, 2); - testall_odd_tol(catan, tests[i].z, tests[i].atan_z, 2); - } + complex long double z; + complex long double acos_z; + complex long double asin_z; + complex long double atan_z; + + z = CMPLXL(0.75L, 0.25L); + acos_z = CMPLXL(pi / 4, -0.34657359027997265470861606072908828L); + asin_z = CMPLXL(pi / 4, 0.34657359027997265470861606072908828L); + atan_z = CMPLXL(0.66290883183401623252961960521423782L, + 0.15899719167999917436476103600701878L); + + testall_tol(cacos, z, acos_z, 2); + testall_odd_tol(casin, z, asin_z, 2); + testall_odd_tol(catan, z, atan_z, 2); } /* Test inputs that might cause overflow in a sloppy implementation. */ From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:02:38 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E1CC1E0; Thu, 23 Oct 2014 01:02:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D43ECDC8; Thu, 23 Oct 2014 01:02:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N12bLp089272; Thu, 23 Oct 2014 01:02:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N12bK6089271; Thu, 23 Oct 2014 01:02:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230102.s9N12bK6089271@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 01:02:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273503 - stable/10/tools/regression/lib/msun X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:02:38 -0000 Author: ngie Date: Thu Oct 23 01:02:37 2014 New Revision: 273503 URL: https://svnweb.freebsd.org/changeset/base/273503 Log: MFC r271349: Add diagnostic printfs and disable test # 4 on i386 Reviewed by: jmmv, rpaulo Phabric: D749 PR: 191676 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/tools/regression/lib/msun/test-cexp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tools/regression/lib/msun/test-cexp.c ============================================================================== --- stable/10/tools/regression/lib/msun/test-cexp.c Thu Oct 23 01:01:58 2014 (r273502) +++ stable/10/tools/regression/lib/msun/test-cexp.c Thu Oct 23 01:02:37 2014 (r273503) @@ -117,6 +117,7 @@ test_nan() /* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */ /* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */ for (i = 0; i < N(finites); i++) { + printf("# Run %d..\n", i); testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN), ALL_STD_EXCEPT & ~FE_INVALID, 0, 0); if (finites[i] == 0.0) @@ -148,6 +149,7 @@ test_inf(void) /* cexp(x + inf i) = NaN + NaNi and raises invalid */ for (i = 0; i < N(finites); i++) { + printf("# Run %d..\n", i); testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 1); } @@ -189,6 +191,7 @@ test_reals(void) for (i = 0; i < N(finites); i++) { /* XXX could check exceptions more meticulously */ + printf("# Run %d..\n", i); test(cexp, CMPLXL(finites[i], 0.0), CMPLXL(exp(finites[i]), 0.0), FE_INVALID | FE_DIVBYZERO, 0, 1); @@ -210,6 +213,7 @@ test_imaginaries(void) int i; for (i = 0; i < N(finites); i++) { + printf("# Run %d..\n", i); test(cexp, CMPLXL(0.0, finites[i]), CMPLXL(cos(finites[i]), sin(finites[i])), ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1); @@ -241,6 +245,7 @@ test_small(void) int i; for (i = 0; i < N(tests); i += 4) { + printf("# Run %d..\n", i); a = tests[i]; b = tests[i + 1]; x = tests[i + 2]; @@ -297,8 +302,12 @@ main(int argc, char *argv[]) test_inf(); printf("ok 3 - cexp inf\n"); +#if defined(__i386__) + printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on i386\n"); +#else test_reals(); printf("ok 4 - cexp reals\n"); +#endif test_imaginaries(); printf("ok 5 - cexp imaginaries\n"); From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:06:01 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6472937F; Thu, 23 Oct 2014 01:06:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37832DEC; Thu, 23 Oct 2014 01:06:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N161F2089799; Thu, 23 Oct 2014 01:06:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N161aj089798; Thu, 23 Oct 2014 01:06:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230106.s9N161aj089798@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 01:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273504 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:06:01 -0000 Author: ngie Date: Thu Oct 23 01:06:00 2014 New Revision: 273504 URL: https://svnweb.freebsd.org/changeset/base/273504 Log: MFC r272053: Have distrib-dirs, distribution, hier, hierarchy, redistribute, and reinstall depend on the .MAKE special target This will allow users to do something like the following to print out the results of the running the simulated make target with bmake, like some of the other top-level make targets in Makefile.inc1: % make -f Makefile.inc1 -n distribution TARGET=i386 TARGET_ARCH=i386 Sponsored by: EMC / Isilon Storage Division Modified: stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Thu Oct 23 01:02:37 2014 (r273503) +++ stable/10/Makefile.inc1 Thu Oct 23 01:06:00 2014 (r273504) @@ -925,7 +925,7 @@ packageworld: # and do a 'make reinstall' on the *client* to install new binaries from the # most recent server build. # -reinstall: +reinstall: .MAKE @echo "--------------------------------------------------------------" @echo ">>> Making hierarchy" @echo "--------------------------------------------------------------" @@ -940,7 +940,7 @@ reinstall: ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 .endif -redistribute: +redistribute: .MAKE @echo "--------------------------------------------------------------" @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" @@ -950,7 +950,7 @@ redistribute: DISTRIBUTION=lib32 .endif -distrib-dirs distribution: +distrib-dirs distribution: .MAKE cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} @@ -1449,7 +1449,7 @@ cross-tools: .MAKE # # hierarchy - ensure that all the needed directories are present # -hierarchy hier: +hierarchy hier: .MAKE cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs # From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:08:31 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CD6CC4D6; Thu, 23 Oct 2014 01:08:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8E78E08; Thu, 23 Oct 2014 01:08:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N18V1f090177; Thu, 23 Oct 2014 01:08:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N18VKq090176; Thu, 23 Oct 2014 01:08:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230108.s9N18VKq090176@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 01:08:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273505 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:08:31 -0000 Author: ngie Date: Thu Oct 23 01:08:31 2014 New Revision: 273505 URL: https://svnweb.freebsd.org/changeset/base/273505 Log: MFC r272917: Add LDFLAGS to PROG_VARS so it can be overridden on a per-PROG basis Sponsored by: EMC / Isilon Storage Division Modified: stable/10/share/mk/bsd.progs.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.progs.mk ============================================================================== --- stable/10/share/mk/bsd.progs.mk Thu Oct 23 01:06:00 2014 (r273504) +++ stable/10/share/mk/bsd.progs.mk Thu Oct 23 01:08:31 2014 (r273505) @@ -43,7 +43,7 @@ PROG ?= $t .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR MAN SRCS -PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD ${PROG_OVERRIDE_VARS} +PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LDFLAGS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} .if empty(${PROG_OVERRIDE_VARS:M$v}) .if defined(${v}.${PROG}) From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:09:02 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E406605; Thu, 23 Oct 2014 01:09:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19A88E0D; Thu, 23 Oct 2014 01:09:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N191c8090471; Thu, 23 Oct 2014 01:09:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N191cE090469; Thu, 23 Oct 2014 01:09:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230109.s9N191cE090469@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 01:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273506 - stable/10/etc/mtree X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:09:02 -0000 Author: ngie Date: Thu Oct 23 01:09:01 2014 New Revision: 273506 URL: https://svnweb.freebsd.org/changeset/base/273506 Log: MFC r272778: Set the autoindent to 4 spaces with vim in BSD.tests.dist This will prevent vim users from accidentally checking in buggy mtree files (mixed tabs/spaces). Sponsored by: EMC / Isilon Storage Division Modified: stable/10/etc/mtree/BSD.tests.dist Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Thu Oct 23 01:08:31 2014 (r273505) +++ stable/10/etc/mtree/BSD.tests.dist Thu Oct 23 01:09:01 2014 (r273506) @@ -278,3 +278,5 @@ .. .. .. + +# vim: set expandtab ts=4 sw=4: From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:36:44 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A660DAEA; Thu, 23 Oct 2014 01:36:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90E34F6; Thu, 23 Oct 2014 01:36:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1aiZd004353; Thu, 23 Oct 2014 01:36:44 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1aihu004352; Thu, 23 Oct 2014 01:36:44 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230136.s9N1aihu004352@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 01:36:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273508 - stable/10/cddl/contrib/opensolaris/cmd/zdb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:36:44 -0000 Author: delphij Date: Thu Oct 23 01:36:43 2014 New Revision: 273508 URL: https://svnweb.freebsd.org/changeset/base/273508 Log: MFC r272806: MFV r272802: - Limit ARC for zdb at 256MB. zdb do not typically revisit data in the ARC. - Increase default max_inflight from 200 to 1000 (can be overriden by -I) so we can queue more I/Os when doing scrubbing. - Print status while loading meataslabs for leak detection. Illumos issues: 5169 zdb should limit its ARC size 5170 zdb -c should create more scrub i/os by default 5171 zdb should print status while loading metaslabs for leak detection Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct 23 01:22:29 2014 (r273507) +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Oct 23 01:36:43 2014 (r273508) @@ -76,8 +76,10 @@ #ifndef lint extern boolean_t zfs_recover; +extern uint64_t zfs_arc_max, zfs_arc_meta_limit; #else boolean_t zfs_recover; +uint64_t zfs_arc_max, zfs_arc_meta_limit; #endif const char cmdname[] = "zdb"; @@ -89,7 +91,7 @@ extern void dump_intent_log(zilog_t *); uint64_t *zopt_object = NULL; int zopt_objects = 0; libzfs_handle_t *g_zfs; -uint64_t max_inflight = 200; +uint64_t max_inflight = 1000; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -2382,7 +2384,7 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog zcb->zcb_readfails = 0; - if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && + if (dump_opt['b'] < 5 && gethrtime() > zcb->zcb_lastprint + NANOSEC) { uint64_t now = gethrtime(); char buf[10]; @@ -2467,9 +2469,9 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) if (!dump_opt['L']) { vdev_t *rvd = spa->spa_root_vdev; - for (int c = 0; c < rvd->vdev_children; c++) { + for (uint64_t c = 0; c < rvd->vdev_children; c++) { vdev_t *vd = rvd->vdev_child[c]; - for (int m = 0; m < vd->vdev_ms_count; m++) { + for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); metaslab_unload(msp); @@ -2482,6 +2484,15 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) * interfaces. */ if (msp->ms_sm != NULL) { + (void) fprintf(stderr, + "\rloading space map for " + "vdev %llu of %llu, " + "metaslab %llu of %llu ...", + (longlong_t)c, + (longlong_t)rvd->vdev_children, + (longlong_t)m, + (longlong_t)vd->vdev_ms_count); + msp->ms_ops = &zdb_metaslab_ops; VERIFY0(space_map_load(msp->ms_sm, msp->ms_tree, SM_ALLOC)); @@ -2490,6 +2501,7 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) mutex_exit(&msp->ms_lock); } } + (void) fprintf(stderr, "\n"); } spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); @@ -3490,6 +3502,12 @@ main(int argc, char **argv) usage(); } + /* + * ZDB does not typically re-read blocks; therefore limit the ARC + * to 256 MB, which can be used entirely for metadata. + */ + zfs_arc_max = zfs_arc_meta_limit = 256 * 1024 * 1024; + kernel_init(FREAD); g_zfs = libzfs_init(); ASSERT(g_zfs != NULL); From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:40:32 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AC53C38; Thu, 23 Oct 2014 01:40:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54E6E106; Thu, 23 Oct 2014 01:40:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1eWvl005349; Thu, 23 Oct 2014 01:40:32 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1eVlk005341; Thu, 23 Oct 2014 01:40:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230140.s9N1eVlk005341@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 01:40:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273509 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:40:32 -0000 Author: delphij Date: Thu Oct 23 01:40:31 2014 New Revision: 273509 URL: https://svnweb.freebsd.org/changeset/base/273509 Log: MFC r272809: MFV r272803: Illumos issue: 5175 implement dmu_read_uio_dbuf() to improve cached read performance Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 23 01:36:43 2014 (r273508) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 23 01:40:31 2014 (r273509) @@ -1022,8 +1022,8 @@ xuio_stat_wbuf_nocopy() } #ifdef _KERNEL -int -dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) +static int +dmu_read_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size) { dmu_buf_t **dbp; int numbufs, i, err; @@ -1033,8 +1033,8 @@ dmu_read_uio(objset_t *os, uint64_t obje * NB: we could do this block-at-a-time, but it's nice * to be reading in parallel. */ - err = dmu_buf_hold_array(os, object, uio->uio_loffset, size, TRUE, FTAG, - &numbufs, &dbp); + err = dmu_buf_hold_array_by_dnode(dn, uio->uio_loffset, size, + TRUE, FTAG, &numbufs, &dbp, 0); if (err) return (err); @@ -1081,6 +1081,58 @@ dmu_read_uio(objset_t *os, uint64_t obje return (err); } +/* + * Read 'size' bytes into the uio buffer. + * From object zdb->db_object. + * Starting at offset uio->uio_loffset. + * + * If the caller already has a dbuf in the target object + * (e.g. its bonus buffer), this routine is faster than dmu_read_uio(), + * because we don't have to find the dnode_t for the object. + */ +int +dmu_read_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size) +{ + dmu_buf_impl_t *db = (dmu_buf_impl_t *)zdb; + dnode_t *dn; + int err; + + if (size == 0) + return (0); + + DB_DNODE_ENTER(db); + dn = DB_DNODE(db); + err = dmu_read_uio_dnode(dn, uio, size); + DB_DNODE_EXIT(db); + + return (err); +} + +/* + * Read 'size' bytes into the uio buffer. + * From the specified object + * Starting at offset uio->uio_loffset. + */ +int +dmu_read_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size) +{ + dnode_t *dn; + int err; + + if (size == 0) + return (0); + + err = dnode_hold(os, object, FTAG, &dn); + if (err) + return (err); + + err = dmu_read_uio_dnode(dn, uio, size); + + dnode_rele(dn, FTAG); + + return (err); +} + static int dmu_write_uio_dnode(dnode_t *dn, uio_t *uio, uint64_t size, dmu_tx_t *tx) { @@ -1133,6 +1185,15 @@ dmu_write_uio_dnode(dnode_t *dn, uio_t * return (err); } +/* + * Write 'size' bytes from the uio buffer. + * To object zdb->db_object. + * Starting at offset uio->uio_loffset. + * + * If the caller already has a dbuf in the target object + * (e.g. its bonus buffer), this routine is faster than dmu_write_uio(), + * because we don't have to find the dnode_t for the object. + */ int dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t *uio, uint64_t size, dmu_tx_t *tx) @@ -1152,6 +1213,11 @@ dmu_write_uio_dbuf(dmu_buf_t *zdb, uio_t return (err); } +/* + * Write 'size' bytes from the uio buffer. + * To the specified object. + * Starting at offset uio->uio_loffset. + */ int dmu_write_uio(objset_t *os, uint64_t object, uio_t *uio, uint64_t size, dmu_tx_t *tx) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 23 01:36:43 2014 (r273508) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 23 01:40:31 2014 (r273509) @@ -616,6 +616,7 @@ void dmu_write(objset_t *os, uint64_t ob void dmu_prealloc(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, dmu_tx_t *tx); int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); +int dmu_read_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size); int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size, dmu_tx_t *tx); int dmu_write_uio_dbuf(dmu_buf_t *zdb, struct uio *uio, uint64_t size, Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 23 01:36:43 2014 (r273508) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Oct 23 01:40:31 2014 (r273509) @@ -582,7 +582,6 @@ static int mappedread(vnode_t *vp, int nbytes, uio_t *uio) { znode_t *zp = VTOZ(vp); - objset_t *os = zp->z_zfsvfs->z_os; vm_object_t obj; int64_t start; caddr_t va; @@ -613,7 +612,8 @@ mappedread(vnode_t *vp, int nbytes, uio_ page_unhold(pp); } else { zfs_vmobject_wunlock(obj); - error = dmu_read_uio(os, zp->z_id, uio, bytes); + error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), + uio, bytes); zfs_vmobject_wlock(obj); } len -= bytes; @@ -650,7 +650,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io { znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; - objset_t *os; ssize_t n, nbytes; int error = 0; rl_t *rl; @@ -658,7 +657,6 @@ zfs_read(vnode_t *vp, uio_t *uio, int io ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); - os = zfsvfs->z_os; if (zp->z_pflags & ZFS_AV_QUARANTINED) { ZFS_EXIT(zfsvfs); @@ -756,10 +754,12 @@ zfs_read(vnode_t *vp, uio_t *uio, int io error = mappedread_sf(vp, nbytes, uio); else #endif /* __FreeBSD__ */ - if (vn_has_cached_data(vp)) + if (vn_has_cached_data(vp)) { error = mappedread(vp, nbytes, uio); - else - error = dmu_read_uio(os, zp->z_id, uio, nbytes); + } else { + error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl), + uio, nbytes); + } if (error) { /* convert checksum errors into IO errors */ if (error == ECKSUM) From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 01:47:10 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C54A5E1C; Thu, 23 Oct 2014 01:47:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF05A1CF; Thu, 23 Oct 2014 01:47:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1lAqX009122; Thu, 23 Oct 2014 01:47:10 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1l9mF009116; Thu, 23 Oct 2014 01:47:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230147.s9N1l9mF009116@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 01:47:09 +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: r273510 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 01:47:11 -0000 Author: delphij Date: Thu Oct 23 01:47:09 2014 New Revision: 273510 URL: https://svnweb.freebsd.org/changeset/base/273510 Log: MFC r272810: FV r272804: Refactor the code and stop restore_object from creating two transactions. Illumos issue: 3693 restore_object uses at least two transactions to restore an object Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 23 01:40:31 2014 (r273509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Oct 23 01:47:09 2014 (r273510) @@ -1920,6 +1920,7 @@ dmu_object_info_from_dnode(dnode_t *dn, doi->doi_indirection = dn->dn_nlevels; doi->doi_checksum = dn->dn_checksum; doi->doi_compress = dn->dn_compress; + doi->doi_nblkptr = dn->dn_nblkptr; doi->doi_physical_blocks_512 = (DN_USED_BYTES(dnp) + 256) >> 9; doi->doi_max_offset = (dn->dn_maxblkid + 1) * dn->dn_datablksz; doi->doi_fill_count = 0; Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Thu Oct 23 01:40:31 2014 (r273509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Thu Oct 23 01:47:09 2014 (r273510) @@ -20,7 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2013, 2014 by Delphix. All rights reserved. + * Copyright 2014 HybridCluster. All rights reserved. */ #include @@ -107,11 +108,9 @@ dmu_object_claim(objset_t *os, uint64_t int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot, - int blocksize, dmu_object_type_t bonustype, int bonuslen) + int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { dnode_t *dn; - dmu_tx_t *tx; - int nblkptr; int err; if (object == DMU_META_DNODE_OBJECT) @@ -122,44 +121,9 @@ dmu_object_reclaim(objset_t *os, uint64_ if (err) return (err); - if (dn->dn_type == ot && dn->dn_datablksz == blocksize && - dn->dn_bonustype == bonustype && dn->dn_bonuslen == bonuslen) { - /* nothing is changing, this is a noop */ - dnode_rele(dn, FTAG); - return (0); - } - - if (bonustype == DMU_OT_SA) { - nblkptr = 1; - } else { - nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); - } - - /* - * If we are losing blkptrs or changing the block size this must - * be a new file instance. We must clear out the previous file - * contents before we can change this type of metadata in the dnode. - */ - if (dn->dn_nblkptr > nblkptr || dn->dn_datablksz != blocksize) { - err = dmu_free_long_range(os, object, 0, DMU_OBJECT_END); - if (err) - goto out; - } - - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, object); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err) { - dmu_tx_abort(tx); - goto out; - } - dnode_reallocate(dn, ot, blocksize, bonustype, bonuslen, tx); - dmu_tx_commit(tx); -out: dnode_rele(dn, FTAG); - return (err); } Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Oct 23 01:40:31 2014 (r273509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Oct 23 01:47:09 2014 (r273510) @@ -24,6 +24,7 @@ * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2014, Joyent, Inc. All rights reserved. * Copyright (c) 2012, Martin Matuska . All rights reserved. + * Copyright 2014 HybridCluster. All rights reserved. */ #include @@ -1392,12 +1393,25 @@ backup_byteswap(dmu_replay_record_t *drr #undef DO32 } +static inline uint8_t +deduce_nblkptr(dmu_object_type_t bonus_type, uint64_t bonus_size) +{ + if (bonus_type == DMU_OT_SA) { + return (1); + } else { + return (1 + + ((DN_MAX_BONUSLEN - bonus_size) >> SPA_BLKPTRSHIFT)); + } +} + static int restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) { - int err; + dmu_object_info_t doi; dmu_tx_t *tx; void *data = NULL; + uint64_t object; + int err; if (drro->drr_type == DMU_OT_NONE || !DMU_OT_IS_VALID(drro->drr_type) || @@ -1411,10 +1425,11 @@ restore_object(struct restorearg *ra, ob return (SET_ERROR(EINVAL)); } - err = dmu_object_info(os, drro->drr_object, NULL); + err = dmu_object_info(os, drro->drr_object, &doi); if (err != 0 && err != ENOENT) return (SET_ERROR(EINVAL)); + object = err == 0 ? drro->drr_object : DMU_NEW_OBJECT; if (drro->drr_bonuslen) { data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8), NULL); @@ -1422,37 +1437,53 @@ restore_object(struct restorearg *ra, ob return (ra->err); } - if (err == ENOENT) { - /* currently free, want to be allocated */ - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err != 0) { - dmu_tx_abort(tx); - return (err); + /* + * If we are losing blkptrs or changing the block size this must + * be a new file instance. We must clear out the previous file + * contents before we can change this type of metadata in the dnode. + */ + if (err == 0) { + int nblkptr; + + nblkptr = deduce_nblkptr(drro->drr_bonustype, + drro->drr_bonuslen); + + if (drro->drr_blksz != doi.doi_data_block_size || + nblkptr < doi.doi_nblkptr) { + err = dmu_free_long_range(os, drro->drr_object, + 0, DMU_OBJECT_END); + if (err != 0) + return (SET_ERROR(EINVAL)); } + } + + tx = dmu_tx_create(os); + dmu_tx_hold_bonus(tx, object); + err = dmu_tx_assign(tx, TXG_WAIT); + if (err != 0) { + dmu_tx_abort(tx); + return (err); + } + + if (object == DMU_NEW_OBJECT) { + /* currently free, want to be allocated */ err = dmu_object_claim(os, drro->drr_object, drro->drr_type, drro->drr_blksz, drro->drr_bonustype, drro->drr_bonuslen, tx); - dmu_tx_commit(tx); - } else { - /* currently allocated, want to be allocated */ + } else if (drro->drr_type != doi.doi_type || + drro->drr_blksz != doi.doi_data_block_size || + drro->drr_bonustype != doi.doi_bonus_type || + drro->drr_bonuslen != doi.doi_bonus_size) { + /* currently allocated, but with different properties */ err = dmu_object_reclaim(os, drro->drr_object, drro->drr_type, drro->drr_blksz, - drro->drr_bonustype, drro->drr_bonuslen); + drro->drr_bonustype, drro->drr_bonuslen, tx); } if (err != 0) { + dmu_tx_commit(tx); return (SET_ERROR(EINVAL)); } - tx = dmu_tx_create(os); - dmu_tx_hold_bonus(tx, drro->drr_object); - err = dmu_tx_assign(tx, TXG_WAIT); - if (err != 0) { - dmu_tx_abort(tx); - return (err); - } - dmu_object_set_checksum(os, drro->drr_object, drro->drr_checksumtype, tx); dmu_object_set_compress(os, drro->drr_object, drro->drr_compress, tx); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 23 01:40:31 2014 (r273509) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Thu Oct 23 01:47:09 2014 (r273510) @@ -25,6 +25,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright 2013 DEY Storage Systems, Inc. + * Copyright 2014 HybridCluster. All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -341,7 +342,7 @@ uint64_t dmu_object_alloc(objset_t *os, int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx); int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot, - int blocksize, dmu_object_type_t bonustype, int bonuslen); + int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *txp); /* * Free an object from this objset. @@ -662,7 +663,8 @@ typedef struct dmu_object_info { uint8_t doi_indirection; /* 2 = dnode->indirect->data */ uint8_t doi_checksum; uint8_t doi_compress; - uint8_t doi_pad[5]; + uint8_t doi_nblkptr; + uint8_t doi_pad[4]; uint64_t doi_physical_blocks_512; /* data + metadata, 512b blks */ uint64_t doi_max_offset; uint64_t doi_fill_count; /* number of non-empty blocks */ From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 02:18:24 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BAF8F579; Thu, 23 Oct 2014 02:18:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6AD9678; Thu, 23 Oct 2014 02:18:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2IO1f023188; Thu, 23 Oct 2014 02:18:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2IOh6023187; Thu, 23 Oct 2014 02:18:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410230218.s9N2IOh6023187@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 23 Oct 2014 02:18:24 +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: r273511 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 02:18:24 -0000 Author: emaste Date: Thu Oct 23 02:18:23 2014 New Revision: 273511 URL: https://svnweb.freebsd.org/changeset/base/273511 Log: Add vtfontcvt(8) cross-reference to vt(4) man page MFC of r273332 Modified: stable/10/share/man/man4/vt.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/vt.4 ============================================================================== --- stable/10/share/man/man4/vt.4 Thu Oct 23 01:47:09 2014 (r273510) +++ stable/10/share/man/man4/vt.4 Thu Oct 23 02:18:23 2014 (r273511) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16, 2014 +.Dd October 20, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -273,7 +273,8 @@ on a black background, or black on a bri .Xr getty 8 , .Xr kbdmux 8 , .Xr kldload 8 , -.Xr moused 8 +.Xr moused 8 , +.Xr vtfontcvt 8 .Sh HISTORY The .Nm From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 02:50:19 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2C2349D3; Thu, 23 Oct 2014 02:50:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CD4F97A; Thu, 23 Oct 2014 02:50:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2oIoG038319; Thu, 23 Oct 2014 02:50:18 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2oIFk038311; Thu, 23 Oct 2014 02:50:18 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410230250.s9N2oIFk038311@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 23 Oct 2014 02:50:18 +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: r273512 - stable/10/release/picobsd/tinyware/simple_httpd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 02:50:19 -0000 Author: pfg Date: Thu Oct 23 02:50:18 2014 New Revision: 273512 URL: https://svnweb.freebsd.org/changeset/base/273512 Log: MFC r271787: simple_httpd: cosmetic cleanups. Many tab vs space cleanups. Use setpgid() instead of setpgrp() which is more portable. Modified: stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c ============================================================================== --- stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c Thu Oct 23 02:18:23 2014 (r273511) +++ stable/10/release/picobsd/tinyware/simple_httpd/simple_httpd.c Thu Oct 23 02:50:18 2014 (r273512) @@ -160,8 +160,8 @@ http_date(void) void http_output(const char *html) { - write(con_sock, html, strlen(html)); - write(con_sock, "\r\n", 2); + write(con_sock, html, strlen(html)); + write(con_sock, "\r\n", 2); } @@ -172,30 +172,30 @@ http_output(const char *html) void log_line(char *req) { - char log_buff[256]; - char msg[1024]; - char env_host[80], env_addr[80]; - long addr; - FILE *log; + char log_buff[256]; + char msg[1024]; + char env_host[80], env_addr[80]; + long addr; + FILE *log; strcpy(log_buff,inet_ntoa(source.sin_addr)); sprintf(env_addr, "REMOTE_ADDR=%s",log_buff); - addr=inet_addr(log_buff); - - strcpy(msg,adate()); - strcat(msg," "); - hst=gethostbyaddr((char*) &addr, 4, AF_INET); + addr=inet_addr(log_buff); + + strcpy(msg,adate()); + strcat(msg," "); + hst=gethostbyaddr((char*) &addr, 4, AF_INET); /* If DNS hostname exists */ - if (hst) { + if (hst) { strcat(msg,hst->h_name); sprintf(env_host, "REMOTE_HOST=%s",hst->h_name); } - strcat(msg," ("); - strcat(msg,log_buff); - strcat(msg,") "); - strcat(msg,req); + strcat(msg," ("); + strcat(msg,log_buff); + strcat(msg,") "); + strcat(msg,req); if (daemonize) { log=fopen(logfile,"a"); @@ -226,8 +226,8 @@ http_request(void) lg = read(con_sock, req, 1024); - if ((p=strstr(req,"\n"))) *p=0; - if ((p=strstr(req,"\r"))) *p=0; + if ((p=strstr(req,"\n"))) *p=0; + if ((p=strstr(req,"\r"))) *p=0; log_line(req); @@ -253,40 +253,40 @@ http_request(void) filename = strtok(NULL, " "); c = strtok(NULL, " "); - if (fetch_mode != NULL) filename=fetch_mode; - if (filename == NULL || - strlen(filename)==1) filename="/index.html"; + if (fetch_mode != NULL) filename=fetch_mode; + if (filename == NULL || + strlen(filename)==1) filename="/index.html"; - while (filename[0]== '/') filename++; + while (filename[0]== '/') filename++; - /* CGI handling. Untested */ - if (!strncmp(filename,"cgi-bin/",8)) - { - par=0; - if ((par=strstr(filename,"?"))) - { - *par=0; - par++; - } - if (access(filename,X_OK)) goto conti; - stat (filename,&file_status); - if (setuid(file_status.st_uid)) return; - if (seteuid(file_status.st_uid)) return; - if (!fork()) - { - close(1); - dup(con_sock); - /*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/ + /* CGI handling. Untested */ + if (!strncmp(filename,"cgi-bin/",8)) + { + par=0; + if ((par=strstr(filename,"?"))) + { + *par=0; + par++; + } + if (access(filename,X_OK)) goto conti; + stat (filename,&file_status); + if (setuid(file_status.st_uid)) return; + if (seteuid(file_status.st_uid)) return; + if (!fork()) + { + close(1); + dup(con_sock); + /*printf("HTTP/1.0 200 OK\nContent-type: text/html\n\n\n");*/ printf("HTTP/1.0 200 OK\r\n"); - /* Plug in environment variable, others in log_line */ + /* Plug in environment variable, others in log_line */ setenv("SERVER_SOFTWARE", "FreeBSD/PicoBSD", 1); execlp (filename,filename,par,(char *)0); - } - wait(&i); - return; - } - conti: + } + wait(&i); + return; + } + conti: if (filename == NULL) { http_output(http_405[0]); http_output(http_405[1]); @@ -307,8 +307,8 @@ http_request(void) /* Open filename */ fd = open(filename, O_RDONLY); if (fd < 0) { - http_output(http_404[0]); - http_output(http_404[1]); + http_output(http_404[0]); + http_output(http_404[1]); goto end_request; } @@ -325,7 +325,7 @@ http_request(void) http_output(http_404[1]); goto end_request2; } - + /* Past this point we are serving either a GET or HEAD */ /* Print all the header info */ http_output(http_200); @@ -371,14 +371,14 @@ end_request: int main(int argc, char *argv[]) { - int ch, ld; - int httpd_group = 65534; - pid_t server_pid; - + int ch, ld; + pid_t httpd_group = 65534; + pid_t server_pid; + /* Default for html directory */ strcpy (homedir,getenv("HOME")); - if (!geteuid()) strcpy (homedir,"/httphome"); - else strcat (homedir,"/httphome"); + if (!geteuid()) strcpy (homedir,"/httphome"); + else strcat (homedir,"/httphome"); /* Defaults for log file */ if (geteuid()) { @@ -420,10 +420,10 @@ main(int argc, char *argv[]) printf("usage: simple_httpd [[-d directory][-g grpid][-l logfile][-p port][-vD]]\n"); exit(1); /* NOTREACHED */ - } + } /* Not running as root and no port supplied, assume 1080 */ - if ((http_port == 80) && geteuid()) { + if ((http_port == 80) && geteuid()) { http_port = 1080; } @@ -437,15 +437,15 @@ main(int argc, char *argv[]) } /* Create log file if it doesn't exit */ - if ((access(logfile,W_OK)) && daemonize) { - ld = open (logfile,O_WRONLY); + if ((access(logfile,W_OK)) && daemonize) { + ld = open (logfile,O_WRONLY); chmod (logfile,00600); close(ld); } - init_servconnection(); + init_servconnection(); - if (verbose) { + if (verbose) { printf("Server started with options \n"); printf("port: %d\n",http_port); if (fetch_mode == NULL) printf("html home: %s\n",homedir); @@ -453,7 +453,7 @@ main(int argc, char *argv[]) } /* httpd is spawned */ - if (daemonize) { + if (daemonize) { if ((server_pid = fork()) != 0) { wait3(0,WNOHANG,0); if (verbose) printf("pid: %d\n",server_pid); @@ -462,16 +462,17 @@ main(int argc, char *argv[]) wait3(0,WNOHANG,0); } - if (fetch_mode == NULL) setpgrp(0,httpd_group); + if (fetch_mode == NULL) + setpgrp((pid_t)0, httpd_group); /* How many connections do you want? * Keep this lower than the available number of processes */ - if (listen(http_sock,15) < 0) exit(1); + if (listen(http_sock,15) < 0) exit(1); - label: + label: wait_connection(); - + if (fork()) { wait3(0,WNOHANG,0); close(con_sock); @@ -488,13 +489,13 @@ main(int argc, char *argv[]) char * adate(void) { - static char out[50]; - time_t now; - struct tm *t; - time(&now); - t = localtime(&now); - sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d", - t->tm_hour, t->tm_min, t->tm_sec, - t->tm_mday, t->tm_mon+1, t->tm_year ); - return out; + static char out[50]; + time_t now; + struct tm *t; + time(&now); + t = localtime(&now); + sprintf(out, "%02d:%02d:%02d %02d/%02d/%02d", + t->tm_hour, t->tm_min, t->tm_sec, + t->tm_mday, t->tm_mon+1, t->tm_year ); + return out; } From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 02:53:58 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BE151D84; Thu, 23 Oct 2014 02:53:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9797A4C; Thu, 23 Oct 2014 02:53:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N2rwa5041068; Thu, 23 Oct 2014 02:53:58 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N2rwDt041067; Thu, 23 Oct 2014 02:53:58 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201410230253.s9N2rwDt041067@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 23 Oct 2014 02:53:58 +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: r273513 - stable/10/usr.sbin/lpr/lpd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 02:53:58 -0000 Author: pfg Date: Thu Oct 23 02:53:57 2014 New Revision: 273513 URL: https://svnweb.freebsd.org/changeset/base/273513 Log: MFC r271789: lpr: replace setpgrp(2) with setpgid(2). setpgid(2) is more portable than setpgrp(2). The BSD variant of setpgrp is a wrapper for setpgid(2) anyways. Modified: stable/10/usr.sbin/lpr/lpd/printjob.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/lpr/lpd/printjob.c ============================================================================== --- stable/10/usr.sbin/lpr/lpd/printjob.c Thu Oct 23 02:50:18 2014 (r273512) +++ stable/10/usr.sbin/lpr/lpd/printjob.c Thu Oct 23 02:53:57 2014 (r273513) @@ -176,7 +176,7 @@ printjob(struct printer *pp) } if(setgid(getegid()) != 0) err(1, "setgid() failed"); printpid = getpid(); /* for use with lprm */ - setpgrp(0, printpid); + setpgid((pid_t)0, printpid); /* * At initial lpd startup, printjob may be called with various From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 07:36:36 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 339B980; Thu, 23 Oct 2014 07:36:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 153778B5; Thu, 23 Oct 2014 07:36:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7aZY5072948; Thu, 23 Oct 2014 07:36:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7aYe4072941; Thu, 23 Oct 2014 07:36:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410230736.s9N7aYe4072941@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 23 Oct 2014 07:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273531 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 07:36:36 -0000 Author: mav Date: Thu Oct 23 07:36:33 2014 New Revision: 273531 URL: https://svnweb.freebsd.org/changeset/base/273531 Log: MFC r273163: Implement more functional CTL debug logging. Setting bits in kern.cam.ctl.debug allows to log errors, commands and some commands data respectively. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_debug.h stable/10/sys/cam/ctl/ctl_private.h stable/10/sys/cam/ctl/ctl_scsi_all.c stable/10/sys/cam/ctl/ctl_util.c stable/10/sys/cam/ctl/ctl_util.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:36:33 2014 (r273531) @@ -315,10 +315,10 @@ static int worker_threads = -1; TUNABLE_INT("kern.cam.ctl.worker_threads", &worker_threads); SYSCTL_INT(_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, &worker_threads, 1, "Number of worker threads"); -static int verbose = 0; -TUNABLE_INT("kern.cam.ctl.verbose", &verbose); -SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verbose, CTLFLAG_RWTUN, - &verbose, 0, "Show SCSI errors returned to initiator"); +static int ctl_debug = CTL_DEBUG_NONE; +TUNABLE_INT("kern.cam.ctl.debug", &ctl_debug); +SYSCTL_INT(_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, + &ctl_debug, 0, "Enabled debug flags"); /* * Supported pages (0x00), Serial number (0x80), Device ID (0x83), @@ -5294,6 +5294,8 @@ ctl_config_move_done(union ctl_io *io) * * - Call some other function once the data is in? */ + if (ctl_debug & CTL_DEBUG_CDB_DATA) + ctl_data_print(io); /* * XXX KDM call ctl_scsiio() again for now, and check flag @@ -13766,17 +13768,14 @@ ctl_process_done(union ctl_io *io) case CTL_IO_SCSI: break; case CTL_IO_TASK: - if (bootverbose || verbose > 0) + if (bootverbose || (ctl_debug & CTL_DEBUG_INFO)) ctl_io_error_print(io, NULL); if (io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) ctl_free_io(io); else fe_done(io); return (CTL_RETVAL_COMPLETE); - break; default: - printf("ctl_process_done: invalid io type %d\n", - io->io_hdr.io_type); panic("ctl_process_done: invalid io type %d\n", io->io_hdr.io_type); break; /* NOTREACHED */ @@ -13870,74 +13869,28 @@ ctl_process_done(union ctl_io *io) ctl_set_task_aborted(&io->scsiio); /* - * We print out status for every task management command. For SCSI - * commands, we filter out any unit attention errors; they happen - * on every boot, and would clutter up the log. Note: task - * management commands aren't printed here, they are printed above, - * since they should never even make it down here. + * If enabled, print command error status. + * We don't print UAs unless debugging was enabled explicitly. */ - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: { - int error_code, sense_key, asc, ascq; - - sense_key = 0; + do { + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) + break; + if (!bootverbose && (ctl_debug & CTL_DEBUG_INFO) == 0) + break; + if ((ctl_debug & CTL_DEBUG_INFO) == 0 && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) && + (io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) { + int error_code, sense_key, asc, ascq; - if (((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR) - && (io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND)) { - /* - * Since this is just for printing, no need to - * show errors here. - */ scsi_extract_sense_len(&io->scsiio.sense_data, - io->scsiio.sense_len, - &error_code, - &sense_key, - &asc, - &ascq, - /*show_errors*/ 0); + io->scsiio.sense_len, &error_code, &sense_key, + &asc, &ascq, /*show_errors*/ 0); + if (sense_key == SSD_KEY_UNIT_ATTENTION) + break; } - if (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SUCCESS) - && (((io->io_hdr.status & CTL_STATUS_MASK) != CTL_SCSI_ERROR) - || (io->scsiio.scsi_status != SCSI_STATUS_CHECK_COND) - || (sense_key != SSD_KEY_UNIT_ATTENTION))) { - - if ((time_uptime - ctl_softc->last_print_jiffies) <= 0){ - ctl_softc->skipped_prints++; - } else { - uint32_t skipped_prints; - - skipped_prints = ctl_softc->skipped_prints; - - ctl_softc->skipped_prints = 0; - ctl_softc->last_print_jiffies = time_uptime; - - if (skipped_prints > 0) { -#ifdef NEEDTOPORT - csevent_log(CSC_CTL | CSC_SHELF_SW | - CTL_ERROR_REPORT, - csevent_LogType_Trace, - csevent_Severity_Information, - csevent_AlertLevel_Green, - csevent_FRU_Firmware, - csevent_FRU_Unknown, - "High CTL error volume, %d prints " - "skipped", skipped_prints); -#endif - } - if (bootverbose || verbose > 0) - ctl_io_error_print(io, NULL); - } - } - break; - } - case CTL_IO_TASK: - if (bootverbose || verbose > 0) - ctl_io_error_print(io, NULL); - break; - default: - break; - } + ctl_io_error_print(io, NULL); + } while (0); /* * Tell the FETD or the other shelf controller we're done with this @@ -14082,6 +14035,8 @@ ctl_queue(union ctl_io *io) switch (io->io_hdr.io_type) { case CTL_IO_SCSI: case CTL_IO_TASK: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); ctl_enqueue_incoming(io); break; default: Modified: stable/10/sys/cam/ctl/ctl_debug.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_debug.h Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl_debug.h Thu Oct 23 07:36:33 2014 (r273531) @@ -39,6 +39,16 @@ #ifndef _CTL_DEBUG_H_ #define _CTL_DEBUG_H_ +/* + * Debugging flags. + */ +typedef enum { + CTL_DEBUG_NONE = 0x00, /* no debugging */ + CTL_DEBUG_INFO = 0x01, /* SCSI errors */ + CTL_DEBUG_CDB = 0x02, /* SCSI CDBs and tasks */ + CTL_DEBUG_CDB_DATA = 0x04 /* SCSI CDB DATA */ +} ctl_debug_flags; + #ifdef CAM_CTL_DEBUG #define CTL_DEBUG_PRINT(X) \ do { \ Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl_private.h Thu Oct 23 07:36:33 2014 (r273531) @@ -456,8 +456,6 @@ struct ctl_softc { uint32_t num_pools; uint32_t cur_pool_id; STAILQ_HEAD(, ctl_io_pool) io_pools; - time_t last_print_jiffies; - uint32_t skipped_prints; struct ctl_thread threads[CTL_MAX_THREADS]; TAILQ_HEAD(tpc_tokens, tpc_token) tpc_tokens; struct callout tpc_timeout; Modified: stable/10/sys/cam/ctl/ctl_scsi_all.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_scsi_all.c Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl_scsi_all.c Thu Oct 23 07:36:33 2014 (r273531) @@ -112,32 +112,10 @@ ctl_scsi_command_string(struct ctl_scsii void ctl_scsi_path_string(union ctl_io *io, char *path_str, int len) { - if (io->io_hdr.nexus.targ_target.wwid[0] == 0) { - snprintf(path_str, len, "(%ju:%d:%ju:%d): ", - (uintmax_t)io->io_hdr.nexus.initid.id, - io->io_hdr.nexus.targ_port, - (uintmax_t)io->io_hdr.nexus.targ_target.id, - io->io_hdr.nexus.targ_lun); - } else { - /* - * XXX KDM find a better way to display FC WWIDs. - */ -#ifdef _KERNEL - snprintf(path_str, len, "(%ju:%d:%#jx,%#jx:%d): ", - (uintmax_t)io->io_hdr.nexus.initid.id, - io->io_hdr.nexus.targ_port, - (intmax_t)io->io_hdr.nexus.targ_target.wwid[0], - (intmax_t)io->io_hdr.nexus.targ_target.wwid[1], - io->io_hdr.nexus.targ_lun); -#else /* _KERNEL */ - snprintf(path_str, len, "(%ju:%d:%#jx,%#jx:%d): ", - (uintmax_t)io->io_hdr.nexus.initid.id, - io->io_hdr.nexus.targ_port, - (intmax_t)io->io_hdr.nexus.targ_target.wwid[0], - (intmax_t)io->io_hdr.nexus.targ_target.wwid[1], - io->io_hdr.nexus.targ_lun); -#endif /* _KERNEL */ - } + + snprintf(path_str, len, "(%u:%u:%u/%u): ", + io->io_hdr.nexus.initid.id, io->io_hdr.nexus.targ_port, + io->io_hdr.nexus.targ_lun, io->io_hdr.nexus.targ_mapped_lun); } /* Modified: stable/10/sys/cam/ctl/ctl_util.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.c Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl_util.c Thu Oct 23 07:36:33 2014 (r273531) @@ -731,69 +731,64 @@ ctl_scsi_task_string(struct ctl_taskio * } void -ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data, - struct sbuf *sb) +ctl_io_sbuf(union ctl_io *io, struct sbuf *sb) { - struct ctl_status_desc *status_desc; + const char *task_desc; char path_str[64]; - unsigned int i; - - status_desc = NULL; - - for (i = 0; i < (sizeof(ctl_status_table)/sizeof(ctl_status_table[0])); - i++) { - if ((io->io_hdr.status & CTL_STATUS_MASK) == - ctl_status_table[i].status) { - status_desc = &ctl_status_table[i]; - break; - } - } ctl_scsi_path_string(io, path_str, sizeof(path_str)); switch (io->io_hdr.io_type) { case CTL_IO_SCSI: sbuf_cat(sb, path_str); - ctl_scsi_command_string(&io->scsiio, NULL, sb); - - sbuf_printf(sb, "\n"); - - sbuf_printf(sb, "%sTag: 0x%04x, Type: %d\n", path_str, + sbuf_printf(sb, " Tag: %#x/%d\n", io->scsiio.tag_num, io->scsiio.tag_type); break; - case CTL_IO_TASK: { - const char *task_desc; - + case CTL_IO_TASK: sbuf_cat(sb, path_str); - task_desc = ctl_scsi_task_string(&io->taskio); - if (task_desc == NULL) sbuf_printf(sb, "Unknown Task Action %d (%#x)", - io->taskio.task_action, - io->taskio.task_action); + io->taskio.task_action, io->taskio.task_action); else sbuf_printf(sb, "Task Action: %s", task_desc); - - sbuf_printf(sb, "\n"); - switch (io->taskio.task_action) { case CTL_TASK_ABORT_TASK: - case CTL_TASK_ABORT_TASK_SET: - case CTL_TASK_CLEAR_TASK_SET: - sbuf_printf(sb, "%sTag: 0x%04x, Type: %d\n", path_str, - io->taskio.tag_num, - io->taskio.tag_type); + sbuf_printf(sb, " Tag: %#x/%d\n", + io->taskio.tag_num, io->taskio.tag_type); break; default: + sbuf_printf(sb, "\n"); break; } break; - } default: break; } +} + +void +ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data, + struct sbuf *sb) +{ + struct ctl_status_desc *status_desc; + char path_str[64]; + unsigned int i; + + ctl_io_sbuf(io, sb); + + status_desc = NULL; + for (i = 0; i < (sizeof(ctl_status_table)/sizeof(ctl_status_table[0])); + i++) { + if ((io->io_hdr.status & CTL_STATUS_MASK) == + ctl_status_table[i].status) { + status_desc = &ctl_status_table[i]; + break; + } + } + + ctl_scsi_path_string(io, path_str, sizeof(path_str)); sbuf_cat(sb, path_str); if (status_desc == NULL) @@ -815,23 +810,39 @@ ctl_io_error_sbuf(union ctl_io *io, stru } char * +ctl_io_string(union ctl_io *io, char *str, int str_len) +{ + struct sbuf sb; + + sbuf_new(&sb, str, str_len, SBUF_FIXEDLEN); + ctl_io_sbuf(io, &sb); + sbuf_finish(&sb); + return (sbuf_data(&sb)); +} + +char * ctl_io_error_string(union ctl_io *io, struct scsi_inquiry_data *inq_data, char *str, int str_len) { struct sbuf sb; sbuf_new(&sb, str, str_len, SBUF_FIXEDLEN); - ctl_io_error_sbuf(io, inq_data, &sb); - sbuf_finish(&sb); - return (sbuf_data(&sb)); } #ifdef _KERNEL void +ctl_io_print(union ctl_io *io) +{ + char str[512]; + + printf("%s", ctl_io_string(io, str, sizeof(str))); +} + +void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data) { char str[512]; @@ -856,6 +867,37 @@ ctl_io_error_print(union ctl_io *io, str } +void +ctl_data_print(union ctl_io *io) +{ + char str[128]; + char path_str[64]; + struct sbuf sb; + int i, j, len; + + if (io->io_hdr.io_type != CTL_IO_SCSI) + return; + if (io->io_hdr.flags & CTL_FLAG_BUS_ADDR) + return; + if (io->io_hdr.flags & CTL_FLAG_EDPTR_SGLIST) /* XXX: Implement */ + return; + ctl_scsi_path_string(io, path_str, sizeof(path_str)); + len = min(io->scsiio.kern_data_len, 4096); + for (i = 0; i < len; ) { + sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); + sbuf_cat(&sb, path_str); + sbuf_printf(&sb, " %#6x:%04x:", io->scsiio.tag_num, i); + for (j = 0; j < 16 && i < len; i++, j++) { + if (j == 8) + sbuf_cat(&sb, " "); + sbuf_printf(&sb, " %02x", io->scsiio.kern_data_ptr[i]); + } + sbuf_cat(&sb, "\n"); + sbuf_finish(&sb); + printf("%s", sbuf_data(&sb)); + } +} + #else /* _KERNEL */ void Modified: stable/10/sys/cam/ctl/ctl_util.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_util.h Thu Oct 23 07:22:18 2014 (r273530) +++ stable/10/sys/cam/ctl/ctl_util.h Thu Oct 23 07:36:33 2014 (r273531) @@ -99,19 +99,20 @@ void ctl_scsi_free_io(union ctl_io *io); #endif /* !_KERNEL */ void ctl_scsi_zero_io(union ctl_io *io); const char *ctl_scsi_task_string(struct ctl_taskio *taskio); +void ctl_io_sbuf(union ctl_io *io, struct sbuf *sb); void ctl_io_error_sbuf(union ctl_io *io, struct scsi_inquiry_data *inq_data, struct sbuf *sb); +char *ctl_io_string(union ctl_io *io, char *str, int str_len); char *ctl_io_error_string(union ctl_io *io, struct scsi_inquiry_data *inq_data, char *str, int str_len); #ifdef _KERNEL - +void ctl_io_print(union ctl_io *io); void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data); +void ctl_data_print(union ctl_io *io); #else /* _KERNEL */ -void -ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data, +void ctl_io_error_print(union ctl_io *io, struct scsi_inquiry_data *inq_data, FILE *ofile); - #endif /* _KERNEL */ __END_DECLS From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 07:37:49 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5FA5E1CE; Thu, 23 Oct 2014 07:37:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 325D28C4; Thu, 23 Oct 2014 07:37:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7bn5L073178; Thu, 23 Oct 2014 07:37:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7bnHj073177; Thu, 23 Oct 2014 07:37:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410230737.s9N7bnHj073177@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 23 Oct 2014 07:37:49 +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: r273532 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 07:37:49 -0000 Author: mav Date: Thu Oct 23 07:37:48 2014 New Revision: 273532 URL: https://svnweb.freebsd.org/changeset/base/273532 Log: MFC r273259: Make VPD 80h (Serial Number) transfer length match serial number length. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:36:33 2014 (r273531) +++ stable/10/sys/cam/ctl/ctl.c Thu Oct 23 07:37:48 2014 (r273532) @@ -9963,17 +9963,17 @@ ctl_inquiry_evpd_serial(struct ctl_scsii { struct scsi_vpd_unit_serial_number *sn_ptr; struct ctl_lun *lun; + int data_len; lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - ctsio->kern_data_ptr = malloc(sizeof(*sn_ptr), M_CTL, M_WAITOK | M_ZERO); + data_len = 4 + CTL_SN_LEN; + ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO); sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr; - ctsio->kern_sg_entries = 0; - - if (sizeof(*sn_ptr) < alloc_len) { - ctsio->residual = alloc_len - sizeof(*sn_ptr); - ctsio->kern_data_len = sizeof(*sn_ptr); - ctsio->kern_total_len = sizeof(*sn_ptr); + if (data_len < alloc_len) { + ctsio->residual = alloc_len - data_len; + ctsio->kern_data_len = data_len; + ctsio->kern_total_len = data_len; } else { ctsio->residual = 0; ctsio->kern_data_len = alloc_len; @@ -9995,16 +9995,16 @@ ctl_inquiry_evpd_serial(struct ctl_scsii sn_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT; sn_ptr->page_code = SVPD_UNIT_SERIAL_NUMBER; - sn_ptr->length = ctl_min(sizeof(*sn_ptr) - 4, CTL_SN_LEN); + sn_ptr->length = CTL_SN_LEN; /* * If we don't have a LUN, we just leave the serial number as * all spaces. */ - memset(sn_ptr->serial_num, 0x20, sizeof(sn_ptr->serial_num)); if (lun != NULL) { strncpy((char *)sn_ptr->serial_num, (char *)lun->be_lun->serial_num, CTL_SN_LEN); - } + } else + memset(sn_ptr->serial_num, 0x20, CTL_SN_LEN); ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED; From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 13:32:02 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32D99AC7; Thu, 23 Oct 2014 13:32:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DFFC77E; Thu, 23 Oct 2014 13:32:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NDW1CO045071; Thu, 23 Oct 2014 13:32:01 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NDW1mK045070; Thu, 23 Oct 2014 13:32:01 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201410231332.s9NDW1mK045070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Thu, 23 Oct 2014 13:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273545 - stable/10/sys/dev/vt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 13:32:02 -0000 Author: dumbbell Date: Thu Oct 23 13:32:01 2014 New Revision: 273545 URL: https://svnweb.freebsd.org/changeset/base/273545 Log: vt(4): Refuse to load a font if hw.vga.textmode is selected Before, the font was loaded and the window size recalculated, giving an unusable terminal, even if the actual font didn't change. Reported by: beeessdee@ruggedinbox.com MFC of: r273330 Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Thu Oct 23 12:38:05 2014 (r273544) +++ stable/10/sys/dev/vt/vt_core.c Thu Oct 23 13:32:01 2014 (r273545) @@ -2200,6 +2200,9 @@ skip_thunk: case PIO_VFONT: { struct vt_font *vf; + if (vd->vd_flags & VDF_TEXTMODE) + return (ENOTSUP); + error = vtfont_load((void *)data, &vf); if (error != 0) return (error); From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 18:48:44 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2F0974B1; Thu, 23 Oct 2014 18:48:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AD42E59; Thu, 23 Oct 2014 18:48:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NImhqP092766; Thu, 23 Oct 2014 18:48:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NImhOr092765; Thu, 23 Oct 2014 18:48:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410231848.s9NImhOr092765@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 23 Oct 2014 18:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273553 - stable/9/usr.sbin/newsyslog X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 18:48:44 -0000 Author: markj Date: Thu Oct 23 18:48:43 2014 New Revision: 273553 URL: https://svnweb.freebsd.org/changeset/base/273553 Log: MFC 272763: If we fail to send a signal after rotation, print the pidfile from which the corresponding PID was obtained. PR: 194143 Modified: stable/9/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/9/usr.sbin/newsyslog/ (props changed) Modified: stable/9/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/9/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:23:50 2014 (r273552) +++ stable/9/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:48:43 2014 (r273553) @@ -1966,8 +1966,8 @@ do_sigwork(struct sigwork_entry *swork) */ if (errno != ESRCH) swork->sw_pidok = 0; - warn("can't notify %s, pid %d", swork->sw_pidtype, - (int)swork->sw_pid); + warn("can't notify %s, pid %d = %s", swork->sw_pidtype, + (int)swork->sw_pid, swork->sw_fname); } else { if (verbose) printf("Notified %s pid %d = %s\n", swork->sw_pidtype, From owner-svn-src-stable@FreeBSD.ORG Thu Oct 23 18:50:45 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47D86639; Thu, 23 Oct 2014 18:50:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33AD1F15; Thu, 23 Oct 2014 18:50:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NIojme093870; Thu, 23 Oct 2014 18:50:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NIojiw093869; Thu, 23 Oct 2014 18:50:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410231850.s9NIojiw093869@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 23 Oct 2014 18:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273554 - stable/10/usr.sbin/newsyslog X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 23 Oct 2014 18:50:45 -0000 Author: markj Date: Thu Oct 23 18:50:44 2014 New Revision: 273554 URL: https://svnweb.freebsd.org/changeset/base/273554 Log: MFC r272763: If we fail to send a signal after rotation, print the pidfile from which the corresponding PID was obtained. PR: 194143 Modified: stable/10/usr.sbin/newsyslog/newsyslog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- stable/10/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:48:43 2014 (r273553) +++ stable/10/usr.sbin/newsyslog/newsyslog.c Thu Oct 23 18:50:44 2014 (r273554) @@ -1968,8 +1968,8 @@ do_sigwork(struct sigwork_entry *swork) */ if (errno != ESRCH) swork->sw_pidok = 0; - warn("can't notify %s, pid %d", swork->sw_pidtype, - (int)swork->sw_pid); + warn("can't notify %s, pid %d = %s", swork->sw_pidtype, + (int)swork->sw_pid, swork->sw_fname); } else { if (verbose) printf("Notified %s pid %d = %s\n", swork->sw_pidtype, From owner-svn-src-stable@FreeBSD.ORG Fri Oct 24 03:48:54 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E2989F6C; Fri, 24 Oct 2014 03:48:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEB33D67; Fri, 24 Oct 2014 03:48:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3msQT051410; Fri, 24 Oct 2014 03:48:54 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3msY0051409; Fri, 24 Oct 2014 03:48:54 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410240348.s9O3msY0051409@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Fri, 24 Oct 2014 03:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273573 - stable/10/sys/amd64/amd64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 24 Oct 2014 03:48:55 -0000 Author: neel Date: Fri Oct 24 03:48:54 2014 New Revision: 273573 URL: https://svnweb.freebsd.org/changeset/base/273573 Log: MFC r273356: Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT misconfiguration VM-exit. Modified: stable/10/sys/amd64/amd64/pmap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c ============================================================================== --- stable/10/sys/amd64/amd64/pmap.c Fri Oct 24 03:42:37 2014 (r273572) +++ stable/10/sys/amd64/amd64/pmap.c Fri Oct 24 03:48:54 2014 (r273573) @@ -6791,9 +6791,19 @@ retry: if (ftype == VM_PROT_WRITE) { if ((*pte & PG_RW) == 0) goto done; - *pte |= PG_M; + /* + * Set the modified and accessed bits simultaneously. + * + * Intel EPT PTEs that do software emulation of A/D bits map + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively. + * An EPT misconfiguration is triggered if the PTE is writable + * but not readable (WR=10). This is avoided by setting PG_A + * and PG_M simultaneously. + */ + *pte |= PG_M | PG_A; + } else { + *pte |= PG_A; } - *pte |= PG_A; /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) From owner-svn-src-stable@FreeBSD.ORG Fri Oct 24 07:06:03 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31DE0608; Fri, 24 Oct 2014 07:06:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12F7B189; Fri, 24 Oct 2014 07:06:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O762Is044022; Fri, 24 Oct 2014 07:06:02 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O762ZV044014; Fri, 24 Oct 2014 07:06:02 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410240706.s9O762ZV044014@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 24 Oct 2014 07:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273580 - in stable/10/sys/dev/hyperv: netvsc stordisengage storvsc utilities X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 24 Oct 2014 07:06:03 -0000 Author: delphij Date: Fri Oct 24 07:06:01 2014 New Revision: 273580 URL: https://svnweb.freebsd.org/changeset/base/273580 Log: MFC r273577: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Instant MFC approved by: re (kib) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c stable/10/sys/dev/hyperv/utilities/hv_util.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 07:06:01 2014 (r273580) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 07:06:01 2014 (r273580) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: stable/10/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 06:57:16 2014 (r273579) +++ stable/10/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 07:06:01 2014 (r273580) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } From owner-svn-src-stable@FreeBSD.ORG Fri Oct 24 13:14:25 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 385AD9E0; Fri, 24 Oct 2014 13:14:25 +0000 (UTC) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5A5513C; Fri, 24 Oct 2014 13:14:24 +0000 (UTC) Received: from mh0.gentlemail.de (mh0.gentlemail.de [78.138.80.135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id s9ODELil099716; Fri, 24 Oct 2014 15:14:21 +0200 (CEST) (envelope-from h.schmalzbauer@omnilan.de) Received: from titan.inop.mo1.omnilan.net (titan.inop.mo1.omnilan.net [IPv6:2001:a60:f0bb:1::3:1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 98E043E05; Fri, 24 Oct 2014 15:14:20 +0200 (CEST) Message-ID: <544A50A3.9030309@omnilan.de> Date: Fri, 24 Oct 2014 15:14:11 +0200 From: Harald Schmalzbauer Organization: OmniLAN User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.9.2.8) Gecko/20100906 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Luigi Rizzo Subject: Re: svn commit: r272604 - stable/10/sys/dev/netmap References: <201410060946.s969kMiO074394@svn.freebsd.org> In-Reply-To: <201410060946.s969kMiO074394@svn.freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig429F4304986C41C3A227CE63" X-Greylist: ACL 119 matched, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [78.138.80.130]); Fri, 24 Oct 2014 15:14:21 +0200 (CEST) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: 78.138.80.135; Sender-helo: mh0.gentlemail.de; ) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 24 Oct 2014 13:14:25 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig429F4304986C41C3A227CE63 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Bez=FCglich Luigi Rizzo's Nachricht vom 06.10.2014 11:46 (localtime): > Author: luigi > Date: Mon Oct 6 09:46:21 2014 > New Revision: 272604 > URL: https://svnweb.freebsd.org/changeset/base/272604 > > Log: > MFC r272111 > fix a panic when passing ifioctl from a netmap file descriptor to > the underlying device. This needs to be merged to 10.1 > Was MFS rejected by re? Thanks, -Harry --------------enig429F4304986C41C3A227CE63 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAlRKUKwACgkQLDqVQ9VXb8jVVQCgmZSyZUCfOcVr6C84WCCbcvXd PtwAnRMYq5wLmdxLrHoK7KpikdeB005V =QNFi -----END PGP SIGNATURE----- --------------enig429F4304986C41C3A227CE63-- From owner-svn-src-stable@FreeBSD.ORG Fri Oct 24 17:24:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E653658B; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7B0B1EC; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OHOUUn043211; Fri, 24 Oct 2014 17:24:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OHOU4l043210; Fri, 24 Oct 2014 17:24:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410241724.s9OHOU4l043210@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 17:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273596 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 24 Oct 2014 17:24:31 -0000 Author: markj Date: Fri Oct 24 17:24:29 2014 New Revision: 273596 URL: https://svnweb.freebsd.org/changeset/base/273596 Log: MFC r258902: The uaddr, ufunc, umod and usym functions all seem to work as expected on FreeBSD, so stop hiding them behind a "#if defined(sun)". Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273595) +++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273596) @@ -487,22 +487,16 @@ static const dt_ident_t _dtrace_globals[ DT_VERS_1_0, &dt_idops_func, "void(...)" }, { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" }, -#if defined(sun) { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint64_t" }, -#if defined(sun) { "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uid_t" }, -#if defined(sun) { "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_regs, NULL }, { "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -510,10 +504,8 @@ static const dt_ident_t _dtrace_globals[ { "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint32_t" }, -#if defined(sun) { "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint64_t" }, From owner-svn-src-stable@FreeBSD.ORG Fri Oct 24 17:24:30 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2320258A; Fri, 24 Oct 2014 17:24:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E86941EB; Fri, 24 Oct 2014 17:24:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OHOTr0043188; Fri, 24 Oct 2014 17:24:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OHOTOq043186; Fri, 24 Oct 2014 17:24:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410241724.s9OHOTOq043186@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 17:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273595 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 24 Oct 2014 17:24:30 -0000 Author: markj Date: Fri Oct 24 17:24:29 2014 New Revision: 273595 URL: https://svnweb.freebsd.org/changeset/base/273595 Log: MFC r258902: The uaddr, ufunc, umod and usym functions all seem to work as expected on FreeBSD, so stop hiding them behind a "#if defined(sun)". Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:06:56 2014 (r273594) +++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Fri Oct 24 17:24:29 2014 (r273595) @@ -501,22 +501,16 @@ static const dt_ident_t _dtrace_globals[ DT_VERS_1_0, &dt_idops_func, "void(...)" }, { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" }, -#if defined(sun) { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint64_t" }, -#if defined(sun) { "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uid_t" }, -#if defined(sun) { "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_regs, NULL }, { "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0, @@ -524,10 +518,8 @@ static const dt_ident_t _dtrace_globals[ { "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_type, "uint32_t" }, -#if defined(sun) { "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN, DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" }, -#endif { "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "uint64_t" }, From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 01:59:03 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F1E10C29; Sat, 25 Oct 2014 01:59:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD4BDC84; Sat, 25 Oct 2014 01:59:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P1x2ug085445; Sat, 25 Oct 2014 01:59:02 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P1x28A085442; Sat, 25 Oct 2014 01:59:02 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250159.s9P1x28A085442@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 01:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273621 - stable/10/usr.sbin/watchdogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 01:59:03 -0000 Author: rpaulo Date: Sat Oct 25 01:59:01 2014 New Revision: 273621 URL: https://svnweb.freebsd.org/changeset/base/273621 Log: MFC r273247: Fix the watchdog/watchdog man pages. The default timeout is 128 seconds. Modified: stable/10/usr.sbin/watchdogd/watchdog.8 stable/10/usr.sbin/watchdogd/watchdogd.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/watchdogd/watchdog.8 ============================================================================== --- stable/10/usr.sbin/watchdogd/watchdog.8 Sat Oct 25 01:17:29 2014 (r273620) +++ stable/10/usr.sbin/watchdogd/watchdog.8 Sat Oct 25 01:59:01 2014 (r273621) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 2, 2006 +.Dd October 18, 2014 .Dt WATCHDOG 8 .Os .Sh NAME @@ -50,7 +50,7 @@ The option specifies the desired timeout period in seconds, a value of zero will disable the watchdog. -The default timeout is 16 seconds. +The default timeout is 128 seconds. .Sh SEE ALSO .Xr watchdog 4 , .Xr watchdogd 8 , Modified: stable/10/usr.sbin/watchdogd/watchdogd.8 ============================================================================== --- stable/10/usr.sbin/watchdogd/watchdogd.8 Sat Oct 25 01:17:29 2014 (r273620) +++ stable/10/usr.sbin/watchdogd/watchdogd.8 Sat Oct 25 01:59:01 2014 (r273621) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2013 +.Dd October 18, 2014 .Dt WATCHDOGD 8 .Os .Sh NAME @@ -84,7 +84,7 @@ of the check and defaults to one second. The .Fl t Ar timeout specifies the desired timeout period in seconds. -The default timeout is 16 seconds. +The default timeout is 128 seconds. .Pp One possible circumstance which will cause a watchdog timeout is an interrupt storm. From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 02:00:33 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1DB43E5C; Sat, 25 Oct 2014 02:00:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09B05CA0; Sat, 25 Oct 2014 02:00:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P20WSO088205; Sat, 25 Oct 2014 02:00:32 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P20Wkw088204; Sat, 25 Oct 2014 02:00:32 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250200.s9P20Wkw088204@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273622 - stable/10/sys/boot/fdt/dts/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 02:00:33 -0000 Author: rpaulo Date: Sat Oct 25 02:00:32 2014 New Revision: 273622 URL: https://svnweb.freebsd.org/changeset/base/273622 Log: MFC r273248: AM335x FDT: add an entry for the watchdog. Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 01:59:01 2014 (r273621) +++ stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:00:32 2014 (r273622) @@ -81,6 +81,13 @@ interrupts = < 16 >; interrupt-parent = <&AINTC>; }; + + wdt1@44E35000 { + compatible = "ti,wdt"; + reg = <0x44E35000 0x1000>; + interrupts = <91>; + interrupt-parent = <&AINTC>; + }; GPIO: gpio { #gpio-cells = <3>; From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 02:02:21 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 40C2BF9A; Sat, 25 Oct 2014 02:02:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C54CD33; Sat, 25 Oct 2014 02:02:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P22LmN089540; Sat, 25 Oct 2014 02:02:21 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P22LuT089539; Sat, 25 Oct 2014 02:02:21 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250202.s9P22LuT089539@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273623 - stable/10/sys/boot/fdt/dts/arm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 02:02:21 -0000 Author: rpaulo Date: Sat Oct 25 02:02:20 2014 New Revision: 273623 URL: https://svnweb.freebsd.org/changeset/base/273623 Log: MFC r273256: AM335X FDT: use the omap3-wdt string for compatibility with Linux. Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/fdt/dts/arm/am335x.dtsi ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:00:32 2014 (r273622) +++ stable/10/sys/boot/fdt/dts/arm/am335x.dtsi Sat Oct 25 02:02:20 2014 (r273623) @@ -83,7 +83,7 @@ }; wdt1@44E35000 { - compatible = "ti,wdt"; + compatible = "ti,omap3-wdt"; reg = <0x44E35000 0x1000>; interrupts = <91>; interrupt-parent = <&AINTC>; From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 02:05:23 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8DEC317F; Sat, 25 Oct 2014 02:05:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECB3D45; Sat, 25 Oct 2014 02:05:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P25Nq3089964; Sat, 25 Oct 2014 02:05:23 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P25Msb089958; Sat, 25 Oct 2014 02:05:22 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250205.s9P25Msb089958@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273624 - in stable/10/sys/arm: conf ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 02:05:23 -0000 Author: rpaulo Date: Sat Oct 25 02:05:21 2014 New Revision: 273624 URL: https://svnweb.freebsd.org/changeset/base/273624 Log: MFC r273257: Add a driver for the TI watchdog. The TI watchdog timer is present on BeagleBone's. Since 2014, U-Boot has been booting the BeagleBone with the watchdog enabled. We need to disable it on boot to avoid a spurious reset. The timer isn't exactly precise, but it will do as a watchdog. This is also a reflection of the watchdog(9) API. In the future, we could handle interrupts, but the watchdog(9) API needs to be a bit smarter before that can happen. Added: stable/10/sys/arm/ti/ti_wdt.c - copied unchanged from r273257, head/sys/arm/ti/ti_wdt.c stable/10/sys/arm/ti/ti_wdt.h - copied unchanged from r273257, head/sys/arm/ti/ti_wdt.h Modified: stable/10/sys/arm/conf/BEAGLEBONE stable/10/sys/arm/ti/files.ti Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:02:20 2014 (r273623) +++ stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:05:21 2014 (r273624) @@ -108,6 +108,12 @@ device gpioled # ADC support device ti_adc +# Watchdog support +# If we don't enable the watchdog driver, the system could potentially +# reboot automatically because the boot loader might have enabled the +# watchdog. +device ti_wdt + # USB support device usb options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. Modified: stable/10/sys/arm/ti/files.ti ============================================================================== --- stable/10/sys/arm/ti/files.ti Sat Oct 25 02:02:20 2014 (r273623) +++ stable/10/sys/arm/ti/files.ti Sat Oct 25 02:05:21 2014 (r273624) @@ -19,6 +19,8 @@ dev/mbox/mbox_if.m standard arm/ti/ti_mbox.c standard arm/ti/ti_pruss.c standard +arm/ti/ti_wdt.c optional ti_wdt + arm/ti/ti_adc.c optional ti_adc arm/ti/ti_gpio.c optional gpio arm/ti/ti_i2c.c optional ti_i2c Copied: stable/10/sys/arm/ti/ti_wdt.c (from r273257, head/sys/arm/ti/ti_wdt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:05:21 2014 (r273624, copy of r273257, head/sys/arm/ti/ti_wdt.c) @@ -0,0 +1,275 @@ +/*- + * Copyright (c) 2014 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#ifdef DEBUG +#define DPRINTF(fmt, ...) do { \ + printf("%s: ", __func__); \ + printf(fmt, __VA_ARGS__); \ +} while (0) +#else +#define DPRINTF(fmt, ...) +#endif + +static device_probe_t ti_wdt_probe; +static device_attach_t ti_wdt_attach; +static device_detach_t ti_wdt_detach; +static void ti_wdt_intr(void *); +static void ti_wdt_event(void *, unsigned int, int *); + +struct ti_wdt_softc { + struct mtx sc_mtx; + struct resource *sc_mem_res; + struct resource *sc_irq_res; + void *sc_intr; + bus_space_tag_t sc_bt; + bus_space_handle_t sc_bh; + eventhandler_tag sc_ev_tag; +}; + +static device_method_t ti_wdt_methods[] = { + DEVMETHOD(device_probe, ti_wdt_probe), + DEVMETHOD(device_attach, ti_wdt_attach), + DEVMETHOD(device_detach, ti_wdt_detach), + + DEVMETHOD_END +}; + +static driver_t ti_wdt_driver = { + "ti_wdt", + ti_wdt_methods, + sizeof(struct ti_wdt_softc) +}; + +static devclass_t ti_wdt_devclass; + +DRIVER_MODULE(ti_wdt, simplebus, ti_wdt_driver, ti_wdt_devclass, 0, 0); + +static volatile __inline uint32_t +ti_wdt_reg_read(struct ti_wdt_softc *sc, uint32_t reg) +{ + return (bus_space_read_4(sc->sc_bt, sc->sc_bh, reg)); +} + +static __inline void +ti_wdt_reg_write(struct ti_wdt_softc *sc, uint32_t reg, uint32_t val) +{ + bus_space_write_4(sc->sc_bt, sc->sc_bh, reg, val); +} + +/* + * Wait for the write to a specific synchronised register to complete. + */ +static __inline void +ti_wdt_reg_wait(struct ti_wdt_softc *sc, uint32_t bit) +{ + while (ti_wdt_reg_read(sc, TI_WDT_WWPS) & bit) + DELAY(10); + +} + +static __inline void +ti_wdt_disable(struct ti_wdt_softc *sc) +{ + DPRINTF("disabling watchdog %p\n", sc); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xAAAA); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0x5555); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); +} + +static __inline void +ti_wdt_enable(struct ti_wdt_softc *sc) +{ + DPRINTF("enabling watchdog %p\n", sc); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xBBBB); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); + ti_wdt_reg_write(sc, TI_WDT_WSPR, 0x4444); + ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); +} + +static int +ti_wdt_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_is_compatible(dev, "ti,omap3-wdt")) { + device_set_desc(dev, "TI Watchdog Timer"); + return (BUS_PROBE_DEFAULT); + } + + return (ENXIO); +} + +static int +ti_wdt_attach(device_t dev) +{ + struct ti_wdt_softc *sc; + int rid; + + sc = device_get_softc(dev); + rid = 0; + mtx_init(&sc->sc_mtx, "TI WDT", NULL, MTX_DEF); + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + device_printf(dev, "could not allocate memory resource\n"); + return (ENXIO); + } + sc->sc_bt = rman_get_bustag(sc->sc_mem_res); + sc->sc_bh = rman_get_bushandle(sc->sc_mem_res); + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(dev, "could not allocate interrupt resource\n"); + ti_wdt_detach(dev); + return (ENXIO); + } + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_MPSAFE | INTR_TYPE_MISC, + NULL, ti_wdt_intr, sc, &sc->sc_intr) != 0) { + device_printf(dev, + "unable to setup the interrupt handler\n"); + ti_wdt_detach(dev); + return (ENXIO); + } + /* Reset, enable interrupts and stop the watchdog. */ + ti_wdt_reg_write(sc, TI_WDT_WDSC, + ti_wdt_reg_read(sc, TI_WDT_WDSC) | TI_WDSC_SR); + while (ti_wdt_reg_read(sc, TI_WDT_WDSC) & TI_WDSC_SR) + DELAY(10); + ti_wdt_reg_write(sc, TI_WDT_WIRQENSET, TI_IRQ_EN_OVF | TI_IRQ_EN_DLY); + ti_wdt_disable(sc); + if (bootverbose) + device_printf(dev, "revision: 0x%x\n", + ti_wdt_reg_read(sc, TI_WDT_WIDR)); + sc->sc_ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ti_wdt_event, sc, + 0); + + return (0); +} + +static int +ti_wdt_detach(device_t dev) +{ + struct ti_wdt_softc *sc; + + sc = device_get_softc(dev); + if (sc->sc_ev_tag) + EVENTHANDLER_DEREGISTER(watchdog_list, sc->sc_ev_tag); + if (sc->sc_intr) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intr); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); + + return (0); +} + +static void +ti_wdt_intr(void *arg) +{ + struct ti_wdt_softc *sc; + + sc = arg; + DPRINTF("interrupt %p", sc); + ti_wdt_reg_write(sc, TI_WDT_WIRQSTAT, TI_IRQ_EV_OVF | TI_IRQ_EV_DLY); + /* TODO: handle interrupt */ +} + +static void +ti_wdt_event(void *arg, unsigned int cmd, int *error) +{ + struct ti_wdt_softc *sc; + uint8_t s; + uint32_t wldr; + uint32_t ptv; + + sc = arg; + ti_wdt_disable(sc); + if (cmd == WD_TO_NEVER) { + *error = 0; + return; + } + DPRINTF("cmd 0x%x\n", cmd); + cmd &= WD_INTERVAL; + if (cmd < WD_TO_1SEC) { + *error = EINVAL; + return; + } + s = 1 << (cmd - WD_TO_1SEC); + DPRINTF("seconds %u\n", s); + /* + * Leave the pre-scaler with its default values: + * PTV = 0 == 2**0 == 1 + * PRE = 1 (enabled) + * + * Compute the load register value assuming a 32kHz clock. + * See OVF_Rate in the WDT section of the AM335x TRM. + */ + ptv = 0; + wldr = 0xffffffff - (s * (32768 / (1 << ptv))) + 1; + DPRINTF("wldr 0x%x\n", wldr); + ti_wdt_reg_write(sc, TI_WDT_WLDR, wldr); + /* + * Trigger a timer reload. + */ + ti_wdt_reg_write(sc, TI_WDT_WTGR, + ti_wdt_reg_read(sc, TI_WDT_WTGR) + 1); + ti_wdt_reg_wait(sc, TI_W_PEND_WTGR); + ti_wdt_enable(sc); + *error = 0; +} Copied: stable/10/sys/arm/ti/ti_wdt.h (from r273257, head/sys/arm/ti/ti_wdt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/arm/ti/ti_wdt.h Sat Oct 25 02:05:21 2014 (r273624, copy of r273257, head/sys/arm/ti/ti_wdt.h) @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2014 Rui Paulo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _TI_WDT_H_ +#define _TI_WDT_H_ + +/* TI WDT registers */ +#define TI_WDT_WIDR 0x00 /* Watchdog Identification Register */ +#define TI_WDT_WDSC 0x10 /* Watchdog System Control Register */ +#define TI_WDT_WDST 0x14 /* Watchdog Status Register */ +#define TI_WDT_WISR 0x18 /* Watchdog Interrupt Status Register */ +#define TI_WDT_WIER 0x1c /* Watchdog Interrupt Enable Register */ +#define TI_WDT_WCLR 0x24 /* Watchdog Control Register */ +#define TI_WDT_WCRR 0x28 /* Watchdog Counter Register */ +#define TI_WDT_WLDR 0x2c /* Watchdog Load Register */ +#define TI_WDT_WTGR 0x30 /* Watchdog Trigger Register */ +#define TI_WDT_WWPS 0x34 /* Watchdog Write Posting Register */ +#define TI_WDT_WDLY 0x44 /* Watchdog Delay Configuration Reg */ +#define TI_WDT_WSPR 0x48 /* Watchdog Start/Stop Register */ +#define TI_WDT_WIRQSTATRAW 0x54 /* Watchdog Raw Interrupt Status Reg. */ +#define TI_WDT_WIRQSTAT 0x58 /* Watchdog Int. Status Register */ +#define TI_WDT_WIRQENSET 0x5c /* Watchdog Int. Enable Set Register */ +#define TI_WDT_WIRQENCLR 0x60 /* Watchdog Int. Enable Clear Reg. */ + +/* WDT_WDSC Register */ +#define TI_WDSC_SR (1 << 1) /* Soft reset */ + +/* + * WDT_WWPS Register + * + * Writes to some registers require synchronisation with a different clock + * domain. The WDT_WWPS register is the place where this synchronisation + * happens. + */ +#define TI_W_PEND_WCLR (1 << 0) +#define TI_W_PEND_WCRR (1 << 1) +#define TI_W_PEND_WLDR (1 << 2) +#define TI_W_PEND_WTGR (1 << 3) +#define TI_W_PEND_WSPR (1 << 4) +#define TI_W_PEND_WDLY (1 << 5) + +/* WDT_WIRQENSET Register */ +#define TI_IRQ_EN_OVF (1 << 0) /* Overflow interrupt */ +#define TI_IRQ_EN_DLY (1 << 1) /* Delay interrupt */ + +/* WDT_WIRQSTAT Register */ +#define TI_IRQ_EV_OVF (1 << 0) /* Overflow event */ +#define TI_IRQ_EV_DLY (1 << 1) /* Delay event */ + +#endif /* _TI_WDT_H_ */ From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 02:06:41 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1F7D2C2; Sat, 25 Oct 2014 02:06:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD99FD57; Sat, 25 Oct 2014 02:06:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P26fKW090160; Sat, 25 Oct 2014 02:06:41 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P26f3o090158; Sat, 25 Oct 2014 02:06:41 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250206.s9P26f3o090158@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:06:41 +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: r273625 - in stable/10/sys/arm: conf ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 02:06:41 -0000 Author: rpaulo Date: Sat Oct 25 02:06:40 2014 New Revision: 273625 URL: https://svnweb.freebsd.org/changeset/base/273625 Log: MFC r273258: Make the ti_mbox and ti_pruss drivers optional. Modified: stable/10/sys/arm/conf/BEAGLEBONE stable/10/sys/arm/ti/files.ti Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:05:21 2014 (r273624) +++ stable/10/sys/arm/conf/BEAGLEBONE Sat Oct 25 02:06:40 2014 (r273625) @@ -114,6 +114,12 @@ device ti_adc # watchdog. device ti_wdt +# TI Programmable Realtime Unit support +device ti_pruss + +# Mailbox support +device ti_mbox + # USB support device usb options USB_HOST_ALIGN=64 # Cacheline size is 64 on AM335x. Modified: stable/10/sys/arm/ti/files.ti ============================================================================== --- stable/10/sys/arm/ti/files.ti Sat Oct 25 02:05:21 2014 (r273624) +++ stable/10/sys/arm/ti/files.ti Sat Oct 25 02:06:40 2014 (r273625) @@ -15,12 +15,10 @@ arm/ti/ti_cpuid.c standard arm/ti/ti_machdep.c standard arm/ti/ti_prcm.c standard arm/ti/ti_scm.c standard -dev/mbox/mbox_if.m standard -arm/ti/ti_mbox.c standard -arm/ti/ti_pruss.c standard - +dev/mbox/mbox_if.m optional ti_mbox +arm/ti/ti_mbox.c optional ti_mbox +arm/ti/ti_pruss.c optional ti_pruss arm/ti/ti_wdt.c optional ti_wdt - arm/ti/ti_adc.c optional ti_adc arm/ti/ti_gpio.c optional gpio arm/ti/ti_i2c.c optional ti_i2c From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 02:08:03 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1ED1A415; Sat, 25 Oct 2014 02:08:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A803D6B; Sat, 25 Oct 2014 02:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P282ei090386; Sat, 25 Oct 2014 02:08:02 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P2824a090385; Sat, 25 Oct 2014 02:08:02 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410250208.s9P2824a090385@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sat, 25 Oct 2014 02:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273626 - stable/10/sys/arm/ti X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 02:08:03 -0000 Author: rpaulo Date: Sat Oct 25 02:08:02 2014 New Revision: 273626 URL: https://svnweb.freebsd.org/changeset/base/273626 Log: MFC r273261: Remove an unused mutex. Modified: stable/10/sys/arm/ti/ti_wdt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/ti/ti_wdt.c ============================================================================== --- stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:06:40 2014 (r273625) +++ stable/10/sys/arm/ti/ti_wdt.c Sat Oct 25 02:08:02 2014 (r273626) @@ -69,7 +69,6 @@ static void ti_wdt_intr(void *); static void ti_wdt_event(void *, unsigned int, int *); struct ti_wdt_softc { - struct mtx sc_mtx; struct resource *sc_mem_res; struct resource *sc_irq_res; void *sc_intr; @@ -161,7 +160,6 @@ ti_wdt_attach(device_t dev) sc = device_get_softc(dev); rid = 0; - mtx_init(&sc->sc_mtx, "TI WDT", NULL, MTX_DEF); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 15:06:10 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9744A53A; Sat, 25 Oct 2014 15:06:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82CB0126; Sat, 25 Oct 2014 15:06:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PF6AaT054256; Sat, 25 Oct 2014 15:06:10 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PF6ACu054255; Sat, 25 Oct 2014 15:06:10 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410251506.s9PF6ACu054255@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sat, 25 Oct 2014 15:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273636 - stable/10/sys/dev/usb/wlan X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 15:06:10 -0000 Author: kevlo Date: Sat Oct 25 15:06:09 2014 New Revision: 273636 URL: https://svnweb.freebsd.org/changeset/base/273636 Log: MFC r273448: Fix the kernel panic in hostap mode. rvp->beacon_mbuf was NULL in run_update_beacon(). PR: 189405 Submitted by: Gabor Simon Modified: stable/10/sys/dev/usb/wlan/if_run.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/10/sys/dev/usb/wlan/if_run.c Sat Oct 25 12:50:26 2014 (r273635) +++ stable/10/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:06:09 2014 (r273636) @@ -4911,6 +4911,12 @@ run_update_beacon(struct ieee80211vap *v } setbit(rvp->bo.bo_flags, item); + if (rvp->beacon_mbuf == NULL) { + rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss, + &rvp->bo); + if (rvp->beacon_mbuf == NULL) + return; + } ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 15:14:20 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20074738; Sat, 25 Oct 2014 15:14:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B98420B; Sat, 25 Oct 2014 15:14:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PFEJvE058849; Sat, 25 Oct 2014 15:14:19 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PFEJmp058848; Sat, 25 Oct 2014 15:14:19 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410251514.s9PFEJmp058848@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sat, 25 Oct 2014 15:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r273637 - stable/9/sys/dev/usb/wlan X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 15:14:20 -0000 Author: kevlo Date: Sat Oct 25 15:14:19 2014 New Revision: 273637 URL: https://svnweb.freebsd.org/changeset/base/273637 Log: MFC r270643, r273448: - Fix typo: s/mac_rev/mac_ver/ - Fix the kernel panic in hostap mode. rvp->beacon_mbuf was NULL in run_update_beacon(). Modified: stable/9/sys/dev/usb/wlan/if_run.c (contents, props changed) Modified: stable/9/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:06:09 2014 (r273636) +++ stable/9/sys/dev/usb/wlan/if_run.c Sat Oct 25 15:14:19 2014 (r273637) @@ -4910,6 +4910,12 @@ run_update_beacon(struct ieee80211vap *v } setbit(rvp->bo.bo_flags, item); + if (rvp->beacon_mbuf == NULL) { + rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss, + &rvp->bo); + if (rvp->beacon_mbuf == NULL) + return; + } ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); @@ -5487,7 +5493,7 @@ run_rt3070_rf_init(struct run_softc *sc) run_rt3070_rf_write(sc, 17, rf); } - if (sc->mac_rev == 0x3071) { + if (sc->mac_ver == 0x3071) { run_rt3070_rf_read(sc, 1, &rf); rf &= ~(RT3070_RX0_PD | RT3070_TX0_PD); rf |= RT3070_RF_BLOCK | RT3070_RX1_PD | RT3070_TX1_PD; From owner-svn-src-stable@FreeBSD.ORG Sat Oct 25 20:34:12 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB28C301; Sat, 25 Oct 2014 20:34:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C549C772; Sat, 25 Oct 2014 20:34:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PKYCKs008765; Sat, 25 Oct 2014 20:34:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PKYBYA008753; Sat, 25 Oct 2014 20:34:11 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410252034.s9PKYBYA008753@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 25 Oct 2014 20:34:11 +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: r273645 - in stable/10/sys: arm/conf arm/xilinx boot/fdt/dts/arm dev/cadence X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 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, 25 Oct 2014 20:34:13 -0000 Author: ian Date: Sat Oct 25 20:34:10 2014 New Revision: 273645 URL: https://svnweb.freebsd.org/changeset/base/273645 Log: MFC r268633, r271046: Fixes and enhancements for the if_cgem driver... - miibus fixes as suggested by Yonghyeon Pyun. - enable VLAN MTU support. - fix a few WITNESS complaints in cgem_attach(). - have cgem_attach() properly init the ifnet struct before calling mii_attach() to fix panic when using e1000phy. - fix ethernet address changing. - fix transmit queue overflow handling. - tweak receive queue handling to reduce receive overflows. - bring out MAC statistic counters to sysctls. - add e1000phy to config file. - implement receive hang work-around described in reference guide. - change device name from if_cgem to cgem to be consistent with other interfaces. Fix the Zedboard/Zynq ethernet driver to handle media speed changes so that it can connect to switches at speeds other than 1gb. Modified: stable/10/sys/arm/conf/ZEDBOARD stable/10/sys/arm/xilinx/files.zynq7 stable/10/sys/arm/xilinx/zy7_slcr.c stable/10/sys/arm/xilinx/zy7_slcr.h stable/10/sys/boot/fdt/dts/arm/zedboard.dts stable/10/sys/dev/cadence/if_cgem.c stable/10/sys/dev/cadence/if_cgem_hw.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/ZEDBOARD ============================================================================== --- stable/10/sys/arm/conf/ZEDBOARD Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/conf/ZEDBOARD Sat Oct 25 20:34:10 2014 (r273645) @@ -72,8 +72,9 @@ options KDB device loop device random device ether -device if_cgem # Zynq-7000 gig ethernet device +device cgem # Zynq-7000 gig ethernet device device mii +device e1000phy device pty device uart device gpio Modified: stable/10/sys/arm/xilinx/files.zynq7 ============================================================================== --- stable/10/sys/arm/xilinx/files.zynq7 Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/files.zynq7 Sat Oct 25 20:34:10 2014 (r273645) @@ -23,7 +23,7 @@ arm/xilinx/zy7_slcr.c standard arm/xilinx/zy7_devcfg.c standard arm/xilinx/zy7_mp.c optional smp -dev/cadence/if_cgem.c optional if_cgem +dev/cadence/if_cgem.c optional cgem dev/sdhci/sdhci_fdt.c optional sdhci arm/xilinx/zy7_ehci.c optional ehci arm/xilinx/uart_dev_cdnc.c optional uart Modified: stable/10/sys/arm/xilinx/zy7_slcr.c ============================================================================== --- stable/10/sys/arm/xilinx/zy7_slcr.c Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/zy7_slcr.c Sat Oct 25 20:34:10 2014 (r273645) @@ -71,12 +71,14 @@ extern void (*zynq7_cpu_reset); #define ZSLCR_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define ZSLCR_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \ - "zy7_slcr", MTX_SPIN) + "zy7_slcr", MTX_DEF) #define ZSLCR_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define RD4(sc, off) (bus_read_4((sc)->mem_res, (off))) #define WR4(sc, off, val) (bus_write_4((sc)->mem_res, (off), (val))) +#define ZYNQ_DEFAULT_PS_CLK_FREQUENCY 33333333 /* 33.3 Mhz */ + SYSCTL_NODE(_hw, OID_AUTO, zynq, CTLFLAG_RD, 0, "Xilinx Zynq-7000"); @@ -84,7 +86,7 @@ static char zynq_bootmode[64]; SYSCTL_STRING(_hw_zynq, OID_AUTO, bootmode, CTLFLAG_RD, zynq_bootmode, 0, "Zynq boot mode"); -static char zynq_pssid[80]; +static char zynq_pssid[100]; SYSCTL_STRING(_hw_zynq, OID_AUTO, pssid, CTLFLAG_RD, zynq_pssid, 0, "Zynq PSS IDCODE"); @@ -92,6 +94,22 @@ static uint32_t zynq_reboot_status; SYSCTL_INT(_hw_zynq, OID_AUTO, reboot_status, CTLFLAG_RD, &zynq_reboot_status, 0, "Zynq REBOOT_STATUS register"); +static int ps_clk_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ps_clk_frequency, CTLFLAG_RD, &ps_clk_frequency, + 0, "Zynq PS_CLK Frequency"); + +static int io_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, io_pll_frequency, CTLFLAG_RD, &io_pll_frequency, + 0, "Zynq IO PLL Frequency"); + +static int arm_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, arm_pll_frequency, CTLFLAG_RD, + &arm_pll_frequency, 0, "Zynq ARM PLL Frequency"); + +static int ddr_pll_frequency; +SYSCTL_INT(_hw_zynq, OID_AUTO, ddr_pll_frequency, CTLFLAG_RD, + &ddr_pll_frequency, 0, "Zynq DDR PLL Frequency"); + static void zy7_slcr_unlock(struct zy7_slcr_softc *sc) { @@ -189,6 +207,54 @@ zy7_slcr_postload_pl(int en_level_shifte ZSLCR_UNLOCK(sc); } +/* Override cgem_set_refclk() in gigabit ethernet driver + * (sys/dev/cadence/if_cgem.c). This function is called to + * request a change in the gem's reference clock speed. + */ +int +cgem_set_ref_clk(int unit, int frequency) +{ + struct zy7_slcr_softc *sc = zy7_slcr_softc_p; + int div0, div1; + + if (!sc) + return (-1); + + /* Find suitable divisor pairs. Round result to nearest khz + * to test for match. + */ + for (div1 = 1; div1 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX; div1++) { + div0 = (io_pll_frequency + div1 * frequency / 2) / + div1 / frequency; + if (div0 > 0 && div0 <= ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX && + ((io_pll_frequency / div0 / div1) + 500) / 1000 == + (frequency + 500) / 1000) + break; + } + + if (div1 > ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX) + return (-1); + + ZSLCR_LOCK(sc); + + /* Unlock SLCR registers. */ + zy7_slcr_unlock(sc); + + /* Modify GEM reference clock. */ + WR4(sc, unit ? ZY7_SLCR_GEM1_CLK_CTRL : ZY7_SLCR_GEM0_CLK_CTRL, + (div1 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT) | + (div0 << ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT) | + ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL | + ZY7_SLCR_GEM_CLK_CTRL_CLKACT); + + /* Lock SLCR registers. */ + zy7_slcr_lock(sc); + + ZSLCR_UNLOCK(sc); + + return (0); +} + static int zy7_slcr_probe(device_t dev) { @@ -208,8 +274,13 @@ zy7_slcr_attach(device_t dev) { struct zy7_slcr_softc *sc = device_get_softc(dev); int rid; + phandle_t node; + pcell_t cell; uint32_t bootmode; uint32_t pss_idcode; + uint32_t arm_pll_ctrl; + uint32_t ddr_pll_ctrl; + uint32_t io_pll_ctrl; static char *bootdev_names[] = { "JTAG", "Quad-SPI", "NOR", "(3?)", "NAND", "SD Card", "(6?)", "(7?)" @@ -260,6 +331,53 @@ zy7_slcr_attach(device_t dev) zynq_reboot_status = RD4(sc, ZY7_SLCR_REBOOT_STAT); + /* Derive PLL frequencies from PS_CLK. */ + node = ofw_bus_get_node(dev); + if (OF_getprop(node, "clock-frequency", &cell, sizeof(cell)) > 0) + ps_clk_frequency = fdt32_to_cpu(cell); + else + ps_clk_frequency = ZYNQ_DEFAULT_PS_CLK_FREQUENCY; + + arm_pll_ctrl = RD4(sc, ZY7_SLCR_ARM_PLL_CTRL); + ddr_pll_ctrl = RD4(sc, ZY7_SLCR_DDR_PLL_CTRL); + io_pll_ctrl = RD4(sc, ZY7_SLCR_IO_PLL_CTRL); + + /* Determine ARM PLL frequency. */ + if (((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + arm_pll_frequency = ps_clk_frequency; + else + arm_pll_frequency = ps_clk_frequency * + ((arm_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine DDR PLL frequency. */ + if (((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + ddr_pll_frequency = ps_clk_frequency; + else + ddr_pll_frequency = ps_clk_frequency * + ((ddr_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + + /* Determine IO PLL frequency. */ + if (((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) == 0 && + (io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_FORCE) != 0) || + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_BYPASS_QUAL) != 0 && + (bootmode & ZY7_SLCR_BOOT_MODE_PLL_BYPASS) != 0)) + /* PLL is bypassed. */ + io_pll_frequency = ps_clk_frequency; + else + io_pll_frequency = ps_clk_frequency * + ((io_pll_ctrl & ZY7_SLCR_PLL_CTRL_FDIV_MASK) >> + ZY7_SLCR_PLL_CTRL_FDIV_SHIFT); + /* Lock SLCR registers. */ zy7_slcr_lock(sc); Modified: stable/10/sys/arm/xilinx/zy7_slcr.h ============================================================================== --- stable/10/sys/arm/xilinx/zy7_slcr.h Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/arm/xilinx/zy7_slcr.h Sat Oct 25 20:34:10 2014 (r273645) @@ -126,6 +126,18 @@ #define ZY7_SLCR_GEM1_RCLK_CTRL 0x013c #define ZY7_SLCR_GEM0_CLK_CTRL 0x0140 #define ZY7_SLCR_GEM1_CLK_CTRL 0x0144 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MASK (0x3f<<20) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_SHIFT 20 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR1_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MASK (0x3f<<8) +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_SHIFT 8 +#define ZY7_SLCR_GEM_CLK_CTRL_DIVISOR_MAX 0x3f +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_MASK (7<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_IO_PLL (0<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_ARM_PLL (2<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_DDR_PLL (3<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_SRCSEL_EMIO_CLK (4<<4) +#define ZY7_SLCR_GEM_CLK_CTRL_CLKACT 1 #define ZY7_SLCR_SMC_CLK_CTRL 0x0148 #define ZY7_SLCR_LQSPI_CLK_CTRL 0x014c #define ZY7_SLCR_SDIO_CLK_CTRL 0x0150 @@ -274,6 +286,7 @@ #ifdef _KERNEL extern void zy7_slcr_preload_pl(void); -extern void zy7_slcr_postload_pl(int); +extern void zy7_slcr_postload_pl(int en_level_shifters); +extern int cgem_set_ref_clk(int unit, int frequency); #endif #endif /* _ZY7_SLCR_H_ */ Modified: stable/10/sys/boot/fdt/dts/arm/zedboard.dts ============================================================================== --- stable/10/sys/boot/fdt/dts/arm/zedboard.dts Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/boot/fdt/dts/arm/zedboard.dts Sat Oct 25 20:34:10 2014 (r273645) @@ -63,6 +63,7 @@ slcr: slcr@7000 { compatible = "xlnx,zy7_slcr"; reg = <0x0 0x1000>; + clock-frequency = <33333333>; // 33Mhz PS_CLK }; // Interrupt controller @@ -175,6 +176,7 @@ reg = <0xb000 0x1000>; interrupts = <54 55>; interrupt-parent = <&GIC>; + ref-clock-num = <0>; }; // SDIO Modified: stable/10/sys/dev/cadence/if_cgem.c ============================================================================== --- stable/10/sys/dev/cadence/if_cgem.c Sat Oct 25 19:31:34 2014 (r273644) +++ stable/10/sys/dev/cadence/if_cgem.c Sat Oct 25 20:34:10 2014 (r273645) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Thomas Skibo + * Copyright (c) 2012-2014 Thomas Skibo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,17 +81,17 @@ __FBSDID("$FreeBSD$"); #define IF_CGEM_NAME "cgem" -#define CGEM_NUM_RX_DESCS 256 /* size of receive descriptor ring */ -#define CGEM_NUM_TX_DESCS 256 /* size of transmit descriptor ring */ +#define CGEM_NUM_RX_DESCS 512 /* size of receive descriptor ring */ +#define CGEM_NUM_TX_DESCS 512 /* size of transmit descriptor ring */ #define MAX_DESC_RING_SIZE (MAX(CGEM_NUM_RX_DESCS*sizeof(struct cgem_rx_desc),\ CGEM_NUM_TX_DESCS*sizeof(struct cgem_tx_desc))) /* Default for sysctl rxbufs. Must be < CGEM_NUM_RX_DESCS of course. */ -#define DEFAULT_NUM_RX_BUFS 64 /* number of receive bufs to queue. */ +#define DEFAULT_NUM_RX_BUFS 256 /* number of receive bufs to queue. */ -#define TX_MAX_DMA_SEGS 4 /* maximum segs in a tx mbuf dma */ +#define TX_MAX_DMA_SEGS 8 /* maximum segs in a tx mbuf dma */ #define CGEM_CKSUM_ASSIST (CSUM_IP | CSUM_TCP | CSUM_UDP | \ CSUM_TCP_IPV6 | CSUM_UDP_IPV6) @@ -101,12 +101,14 @@ struct cgem_softc { struct mtx sc_mtx; device_t dev; device_t miibus; + u_int mii_media_active; /* last active media */ int if_old_flags; struct resource *mem_res; struct resource *irq_res; void *intrhand; struct callout tick_ch; uint32_t net_ctl_shadow; + int ref_clk_num; u_char eaddr[6]; bus_dma_tag_t desc_dma_tag; @@ -122,7 +124,11 @@ struct cgem_softc { int rxring_queued; /* how many rcv bufs queued */ bus_dmamap_t rxring_dma_map; int rxbufs; /* tunable number rcv bufs */ - int rxoverruns; /* rx ring overruns */ + int rxhangwar; /* rx hang work-around */ + u_int rxoverruns; /* rx overruns */ + u_int rxnobufs; /* rx buf ring empty events */ + u_int rxdmamapfails; /* rx dmamap failures */ + uint32_t rx_frames_prev; /* transmit descriptor ring */ struct cgem_tx_desc *txring; @@ -133,6 +139,56 @@ struct cgem_softc { int txring_tl_ptr; /* next xmit mbuf to free */ int txring_queued; /* num xmits segs queued */ bus_dmamap_t txring_dma_map; + u_int txfull; /* tx ring full events */ + u_int txdefrags; /* tx calls to m_defrag() */ + u_int txdefragfails; /* tx m_defrag() failures */ + u_int txdmamapfails; /* tx dmamap failures */ + + /* hardware provided statistics */ + struct cgem_hw_stats { + uint64_t tx_bytes; + uint32_t tx_frames; + uint32_t tx_frames_bcast; + uint32_t tx_frames_multi; + uint32_t tx_frames_pause; + uint32_t tx_frames_64b; + uint32_t tx_frames_65to127b; + uint32_t tx_frames_128to255b; + uint32_t tx_frames_256to511b; + uint32_t tx_frames_512to1023b; + uint32_t tx_frames_1024to1536b; + uint32_t tx_under_runs; + uint32_t tx_single_collisn; + uint32_t tx_multi_collisn; + uint32_t tx_excsv_collisn; + uint32_t tx_late_collisn; + uint32_t tx_deferred_frames; + uint32_t tx_carrier_sense_errs; + + uint64_t rx_bytes; + uint32_t rx_frames; + uint32_t rx_frames_bcast; + uint32_t rx_frames_multi; + uint32_t rx_frames_pause; + uint32_t rx_frames_64b; + uint32_t rx_frames_65to127b; + uint32_t rx_frames_128to255b; + uint32_t rx_frames_256to511b; + uint32_t rx_frames_512to1023b; + uint32_t rx_frames_1024to1536b; + uint32_t rx_frames_undersize; + uint32_t rx_frames_oversize; + uint32_t rx_frames_jabber; + uint32_t rx_frames_fcs_errs; + uint32_t rx_frames_length_errs; + uint32_t rx_symbol_errs; + uint32_t rx_align_errs; + uint32_t rx_resource_errs; + uint32_t rx_overrun_errs; + uint32_t rx_ip_hdr_csum_errs; + uint32_t rx_tcp_csum_errs; + uint32_t rx_udp_csum_errs; + } stats; }; #define RD4(sc, off) (bus_read_4((sc)->mem_res, (off))) @@ -148,6 +204,9 @@ struct cgem_softc { #define CGEM_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) #define CGEM_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) +/* Allow platforms to optionally provide a way to set the reference clock. */ +int cgem_set_ref_clk(int unit, int frequency); + static devclass_t cgem_devclass; static int cgem_probe(device_t dev); @@ -156,6 +215,8 @@ static int cgem_detach(device_t dev); static void cgem_tick(void *); static void cgem_intr(void *); +static void cgem_mediachange(struct cgem_softc *, struct mii_data *); + static void cgem_get_mac(struct cgem_softc *sc, u_char eaddr[]) { @@ -192,10 +253,16 @@ cgem_get_mac(struct cgem_softc *sc, u_ch "random: %02x:%02x:%02x:%02x:%02x:%02x\n", eaddr[0], eaddr[1], eaddr[2], eaddr[3], eaddr[4], eaddr[5]); + } - WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | - (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); - WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + /* Move address to first slot and zero out the rest. */ + WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | + (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); + WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + + for (i = 1; i < 4; i++) { + WR4(sc, CGEM_SPEC_ADDR_LOW(i), 0); + WR4(sc, CGEM_SPEC_ADDR_HI(i), 0); } } @@ -421,7 +488,7 @@ cgem_fill_rqueue(struct cgem_softc *sc) if (bus_dmamap_load_mbuf_sg(sc->mbuf_dma_tag, sc->rxring_m_dmamap[sc->rxring_hd_ptr], m, segs, &nsegs, BUS_DMA_NOWAIT)) { - /* XXX: warn? */ + sc->rxdmamapfails++; m_free(m); break; } @@ -450,12 +517,14 @@ static void cgem_recv(struct cgem_softc *sc) { struct ifnet *ifp = sc->ifp; - struct mbuf *m; + struct mbuf *m, *m_hd, **m_tl; uint32_t ctl; CGEM_ASSERT_LOCKED(sc); /* Pick up all packets in which the OWN bit is set. */ + m_hd = NULL; + m_tl = &m_hd; while (sc->rxring_queued > 0 && (sc->rxring[sc->rxring_tl_ptr].addr & CGEM_RXDESC_OWN) != 0) { @@ -492,7 +561,7 @@ cgem_recv(struct cgem_softc *sc) continue; } - /* Hand it off to upper layers. */ + /* Ready it to hand off to upper layers. */ m->m_data += ETHER_ALIGN; m->m_len = (ctl & CGEM_RXDESC_LENGTH_MASK); m->m_pkthdr.rcvif = ifp; @@ -520,11 +589,24 @@ cgem_recv(struct cgem_softc *sc) } } + /* Queue it up for delivery below. */ + *m_tl = m; + m_tl = &m->m_next; + } + + /* Replenish receive buffers. */ + cgem_fill_rqueue(sc); + + /* Unlock and send up packets. */ + CGEM_UNLOCK(sc); + while (m_hd != NULL) { + m = m_hd; + m_hd = m_hd->m_next; + m->m_next = NULL; ifp->if_ipackets++; - CGEM_UNLOCK(sc); (*ifp->if_input)(ifp, m); - CGEM_LOCK(sc); } + CGEM_LOCK(sc); } /* Find completed transmits and free their mbufs. */ @@ -590,6 +672,8 @@ cgem_clean_tx(struct cgem_softc *sc) else sc->txring_tl_ptr++; sc->txring_queued--; + + sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } } @@ -610,16 +694,17 @@ cgem_start_locked(struct ifnet *ifp) for (;;) { /* Check that there is room in the descriptor ring. */ - if (sc->txring_queued >= CGEM_NUM_TX_DESCS - - TX_MAX_DMA_SEGS - 1) { + if (sc->txring_queued >= + CGEM_NUM_TX_DESCS - TX_MAX_DMA_SEGS * 2) { /* Try to make room. */ cgem_clean_tx(sc); /* Still no room? */ - if (sc->txring_queued >= CGEM_NUM_TX_DESCS - - TX_MAX_DMA_SEGS - 1) { + if (sc->txring_queued >= + CGEM_NUM_TX_DESCS - TX_MAX_DMA_SEGS * 2) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; + sc->txfull++; break; } } @@ -638,6 +723,7 @@ cgem_start_locked(struct ifnet *ifp) struct mbuf *m2 = m_defrag(m, M_NOWAIT); if (m2 == NULL) { + sc->txdefragfails++; m_freem(m); continue; } @@ -645,10 +731,12 @@ cgem_start_locked(struct ifnet *ifp) err = bus_dmamap_load_mbuf_sg(sc->mbuf_dma_tag, sc->txring_m_dmamap[sc->txring_hd_ptr], m, segs, &nsegs, BUS_DMA_NOWAIT); + sc->txdefrags++; } if (err) { /* Give up. */ m_freem(m); + sc->txdmamapfails++; continue; } sc->txring_m[sc->txring_hd_ptr] = m; @@ -692,8 +780,10 @@ cgem_start_locked(struct ifnet *ifp) /* Kick the transmitter. */ WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow | CGEM_NET_CTRL_START_TX); - } + /* If there is a BPF listener, bounce a copy to to him. */ + ETHER_BPF_MTAP(ifp, m); + } } static void @@ -706,27 +796,69 @@ cgem_start(struct ifnet *ifp) CGEM_UNLOCK(sc); } -/* Respond to changes in media. */ static void -cgem_media_update(struct cgem_softc *sc, int active) +cgem_poll_hw_stats(struct cgem_softc *sc) { - uint32_t net_cfg; + uint32_t n; CGEM_ASSERT_LOCKED(sc); - /* Update hardware to reflect phy status. */ - net_cfg = RD4(sc, CGEM_NET_CFG); - net_cfg &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | - CGEM_NET_CFG_FULL_DUPLEX); - - if (IFM_SUBTYPE(active) == IFM_1000_T) - net_cfg |= (CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN); - else if (IFM_SUBTYPE(active) == IFM_100_TX) - net_cfg |= CGEM_NET_CFG_SPEED100; + sc->stats.tx_bytes += RD4(sc, CGEM_OCTETS_TX_BOT); + sc->stats.tx_bytes += (uint64_t)RD4(sc, CGEM_OCTETS_TX_TOP) << 32; - if ((active & IFM_FDX) != 0) - net_cfg |= CGEM_NET_CFG_FULL_DUPLEX; - WR4(sc, CGEM_NET_CFG, net_cfg); + sc->stats.tx_frames += RD4(sc, CGEM_FRAMES_TX); + sc->stats.tx_frames_bcast += RD4(sc, CGEM_BCAST_FRAMES_TX); + sc->stats.tx_frames_multi += RD4(sc, CGEM_MULTI_FRAMES_TX); + sc->stats.tx_frames_pause += RD4(sc, CGEM_PAUSE_FRAMES_TX); + sc->stats.tx_frames_64b += RD4(sc, CGEM_FRAMES_64B_TX); + sc->stats.tx_frames_65to127b += RD4(sc, CGEM_FRAMES_65_127B_TX); + sc->stats.tx_frames_128to255b += RD4(sc, CGEM_FRAMES_128_255B_TX); + sc->stats.tx_frames_256to511b += RD4(sc, CGEM_FRAMES_256_511B_TX); + sc->stats.tx_frames_512to1023b += RD4(sc, CGEM_FRAMES_512_1023B_TX); + sc->stats.tx_frames_1024to1536b += RD4(sc, CGEM_FRAMES_1024_1518B_TX); + sc->stats.tx_under_runs += RD4(sc, CGEM_TX_UNDERRUNS); + + n = RD4(sc, CGEM_SINGLE_COLL_FRAMES); + sc->stats.tx_single_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_MULTI_COLL_FRAMES); + sc->stats.tx_multi_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_EXCESSIVE_COLL_FRAMES); + sc->stats.tx_excsv_collisn += n; + sc->ifp->if_collisions += n; + n = RD4(sc, CGEM_LATE_COLL); + sc->stats.tx_late_collisn += n; + sc->ifp->if_collisions += n; + + sc->stats.tx_deferred_frames += RD4(sc, CGEM_DEFERRED_TX_FRAMES); + sc->stats.tx_carrier_sense_errs += RD4(sc, CGEM_CARRIER_SENSE_ERRS); + + sc->stats.rx_bytes += RD4(sc, CGEM_OCTETS_RX_BOT); + sc->stats.rx_bytes += (uint64_t)RD4(sc, CGEM_OCTETS_RX_TOP) << 32; + + sc->stats.rx_frames += RD4(sc, CGEM_FRAMES_RX); + sc->stats.rx_frames_bcast += RD4(sc, CGEM_BCAST_FRAMES_RX); + sc->stats.rx_frames_multi += RD4(sc, CGEM_MULTI_FRAMES_RX); + sc->stats.rx_frames_pause += RD4(sc, CGEM_PAUSE_FRAMES_RX); + sc->stats.rx_frames_64b += RD4(sc, CGEM_FRAMES_64B_RX); + sc->stats.rx_frames_65to127b += RD4(sc, CGEM_FRAMES_65_127B_RX); + sc->stats.rx_frames_128to255b += RD4(sc, CGEM_FRAMES_128_255B_RX); + sc->stats.rx_frames_256to511b += RD4(sc, CGEM_FRAMES_256_511B_RX); + sc->stats.rx_frames_512to1023b += RD4(sc, CGEM_FRAMES_512_1023B_RX); + sc->stats.rx_frames_1024to1536b += RD4(sc, CGEM_FRAMES_1024_1518B_RX); + sc->stats.rx_frames_undersize += RD4(sc, CGEM_UNDERSZ_RX); + sc->stats.rx_frames_oversize += RD4(sc, CGEM_OVERSZ_RX); + sc->stats.rx_frames_jabber += RD4(sc, CGEM_JABBERS_RX); + sc->stats.rx_frames_fcs_errs += RD4(sc, CGEM_FCS_ERRS); + sc->stats.rx_frames_length_errs += RD4(sc, CGEM_LENGTH_FIELD_ERRS); + sc->stats.rx_symbol_errs += RD4(sc, CGEM_RX_SYMBOL_ERRS); + sc->stats.rx_align_errs += RD4(sc, CGEM_ALIGN_ERRS); + sc->stats.rx_resource_errs += RD4(sc, CGEM_RX_RESOURCE_ERRS); + sc->stats.rx_overrun_errs += RD4(sc, CGEM_RX_OVERRUN_ERRS); + sc->stats.rx_ip_hdr_csum_errs += RD4(sc, CGEM_IP_HDR_CKSUM_ERRS); + sc->stats.rx_tcp_csum_errs += RD4(sc, CGEM_TCP_CKSUM_ERRS); + sc->stats.rx_udp_csum_errs += RD4(sc, CGEM_UDP_CKSUM_ERRS); } static void @@ -734,21 +866,32 @@ cgem_tick(void *arg) { struct cgem_softc *sc = (struct cgem_softc *)arg; struct mii_data *mii; - int active; CGEM_ASSERT_LOCKED(sc); /* Poll the phy. */ if (sc->miibus != NULL) { mii = device_get_softc(sc->miibus); - active = mii->mii_media_active; mii_tick(mii); - if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == - (IFM_ACTIVE | IFM_AVALID) && - active != mii->mii_media_active) - cgem_media_update(sc, mii->mii_media_active); } + /* Poll statistics registers. */ + cgem_poll_hw_stats(sc); + + /* Check for receiver hang. */ + if (sc->rxhangwar && sc->rx_frames_prev == sc->stats.rx_frames) { + /* + * Reset receiver logic by toggling RX_EN bit. 1usec + * delay is necessary especially when operating at 100mbps + * and 10mbps speeds. + */ + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow & + ~CGEM_NET_CTRL_RX_EN); + DELAY(1); + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow); + } + sc->rx_frames_prev = sc->stats.rx_frames; + /* Next callout in one second. */ callout_reset(&sc->tick_ch, hz, cgem_tick, sc); } @@ -767,33 +910,43 @@ cgem_intr(void *arg) return; } + /* Read interrupt status and immediately clear the bits. */ istatus = RD4(sc, CGEM_INTR_STAT); - WR4(sc, CGEM_INTR_STAT, istatus & - (CGEM_INTR_RX_COMPLETE | CGEM_INTR_TX_USED_READ | - CGEM_INTR_RX_OVERRUN | CGEM_INTR_HRESP_NOT_OK)); + WR4(sc, CGEM_INTR_STAT, istatus); - /* Hresp not ok. Something very bad with DMA. Try to clear. */ + /* Packets received. */ + if ((istatus & CGEM_INTR_RX_COMPLETE) != 0) + cgem_recv(sc); + + /* Free up any completed transmit buffers. */ + cgem_clean_tx(sc); + + /* Hresp not ok. Something is very bad with DMA. Try to clear. */ if ((istatus & CGEM_INTR_HRESP_NOT_OK) != 0) { - printf("cgem_intr: hresp not okay! rx_status=0x%x\n", - RD4(sc, CGEM_RX_STAT)); + device_printf(sc->dev, "cgem_intr: hresp not okay! " + "rx_status=0x%x\n", RD4(sc, CGEM_RX_STAT)); WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_HRESP_NOT_OK); } - /* Transmitter has idled. Free up any spent transmit buffers. */ - if ((istatus & CGEM_INTR_TX_USED_READ) != 0) - cgem_clean_tx(sc); + /* Receiver overrun. */ + if ((istatus & CGEM_INTR_RX_OVERRUN) != 0) { + /* Clear status bit. */ + WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_OVERRUN); + sc->rxoverruns++; + } - /* Packets received or overflow. */ - if ((istatus & (CGEM_INTR_RX_COMPLETE | CGEM_INTR_RX_OVERRUN)) != 0) { - cgem_recv(sc); + /* Receiver ran out of bufs. */ + if ((istatus & CGEM_INTR_RX_USED_READ) != 0) { + WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow | + CGEM_NET_CTRL_FLUSH_DPRAM_PKT); cgem_fill_rqueue(sc); - if ((istatus & CGEM_INTR_RX_OVERRUN) != 0) { - /* Clear rx status register. */ - sc->rxoverruns++; - WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_ALL); - } + sc->rxnobufs++; } + /* Restart transmitter if needed. */ + if (!IFQ_DRV_IS_EMPTY(&sc->ifp->if_snd)) + cgem_start_locked(sc->ifp); + CGEM_UNLOCK(sc); } @@ -830,6 +983,7 @@ cgem_config(struct cgem_softc *sc) { uint32_t net_cfg; uint32_t dma_cfg; + u_char *eaddr = IF_LLADDR(sc->ifp); CGEM_ASSERT_LOCKED(sc); @@ -839,6 +993,7 @@ cgem_config(struct cgem_softc *sc) CGEM_NET_CFG_FCS_REMOVE | CGEM_NET_CFG_RX_BUF_OFFSET(ETHER_ALIGN) | CGEM_NET_CFG_GIGE_EN | + CGEM_NET_CFG_1536RXEN | CGEM_NET_CFG_FULL_DUPLEX | CGEM_NET_CFG_SPEED100; @@ -852,7 +1007,8 @@ cgem_config(struct cgem_softc *sc) dma_cfg = CGEM_DMA_CFG_RX_BUF_SIZE(MCLBYTES) | CGEM_DMA_CFG_RX_PKTBUF_MEMSZ_SEL_8K | CGEM_DMA_CFG_TX_PKTBUF_MEMSZ_SEL | - CGEM_DMA_CFG_AHB_FIXED_BURST_LEN_16; + CGEM_DMA_CFG_AHB_FIXED_BURST_LEN_16 | + CGEM_DMA_CFG_DISC_WHEN_NO_AHB; /* Enable transmit checksum offloading? */ if ((sc->ifp->if_capenable & IFCAP_TXCSUM) != 0) @@ -868,10 +1024,16 @@ cgem_config(struct cgem_softc *sc) sc->net_ctl_shadow |= (CGEM_NET_CTRL_TX_EN | CGEM_NET_CTRL_RX_EN); WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow); + /* Set receive address in case it changed. */ + WR4(sc, CGEM_SPEC_ADDR_LOW(0), (eaddr[3] << 24) | + (eaddr[2] << 16) | (eaddr[1] << 8) | eaddr[0]); + WR4(sc, CGEM_SPEC_ADDR_HI(0), (eaddr[5] << 8) | eaddr[4]); + /* Set up interrupts. */ WR4(sc, CGEM_INTR_EN, - CGEM_INTR_RX_COMPLETE | CGEM_INTR_TX_USED_READ | - CGEM_INTR_RX_OVERRUN | CGEM_INTR_HRESP_NOT_OK); + CGEM_INTR_RX_COMPLETE | CGEM_INTR_RX_OVERRUN | + CGEM_INTR_TX_USED_READ | CGEM_INTR_RX_USED_READ | + CGEM_INTR_HRESP_NOT_OK); } /* Turn on interface and load up receive ring with buffers. */ @@ -892,9 +1054,7 @@ cgem_init_locked(struct cgem_softc *sc) sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; mii = device_get_softc(sc->miibus); - mii_pollstat(mii); - cgem_media_update(sc, mii->mii_media_active); - cgem_start_locked(sc->ifp); + mii_mediachg(mii); callout_reset(&sc->tick_ch, hz, cgem_tick, sc); } @@ -957,6 +1117,9 @@ cgem_stop(struct cgem_softc *sc) sc->rxring_hd_ptr = 0; sc->rxring_tl_ptr = 0; sc->rxring_queued = 0; + + /* Force next statchg or linkchg to program net config register. */ + sc->mii_media_active = 0; } @@ -1046,6 +1209,11 @@ cgem_ioctl(struct ifnet *ifp, u_long cmd ~CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN); } } + if ((ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_TXCSUM)) == + (IFCAP_RXCSUM | IFCAP_TXCSUM)) + ifp->if_capenable |= IFCAP_VLAN_HWCSUM; + else + ifp->if_capenable &= ~IFCAP_VLAN_HWCSUM; CGEM_UNLOCK(sc); break; @@ -1063,6 +1231,7 @@ static void cgem_child_detached(device_t dev, device_t child) { struct cgem_softc *sc = device_get_softc(dev); + if (child == sc->miibus) sc->miibus = NULL; } @@ -1072,12 +1241,19 @@ cgem_ifmedia_upd(struct ifnet *ifp) { struct cgem_softc *sc = (struct cgem_softc *) ifp->if_softc; struct mii_data *mii; + struct mii_softc *miisc; + int error = 0; mii = device_get_softc(sc->miibus); CGEM_LOCK(sc); - mii_mediachg(mii); + if ((ifp->if_flags & IFF_UP) != 0) { + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + error = mii_mediachg(mii); + } CGEM_UNLOCK(sc); - return (0); + + return (error); } static void @@ -1118,6 +1294,13 @@ cgem_miibus_readreg(device_t dev, int ph val = RD4(sc, CGEM_PHY_MAINT) & CGEM_PHY_MAINT_DATA_MASK; + if (reg == MII_EXTSR) + /* + * MAC does not support half-duplex at gig speeds. + * Let mii(4) exclude the capability. + */ + val &= ~(EXTSR_1000XHDX | EXTSR_1000THDX); + return (val); } @@ -1147,6 +1330,265 @@ cgem_miibus_writereg(device_t dev, int p return (0); } +static void +cgem_miibus_statchg(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct mii_data *mii = device_get_softc(sc->miibus); + + CGEM_ASSERT_LOCKED(sc); + + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID) && + sc->mii_media_active != mii->mii_media_active) + cgem_mediachange(sc, mii); +} + +static void +cgem_miibus_linkchg(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct mii_data *mii = device_get_softc(sc->miibus); + + CGEM_ASSERT_LOCKED(sc); + + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID) && + sc->mii_media_active != mii->mii_media_active) + cgem_mediachange(sc, mii); +} + +/* + * Overridable weak symbol cgem_set_ref_clk(). This allows platforms to + * provide a function to set the cgem's reference clock. + */ +static int __used +cgem_default_set_ref_clk(int unit, int frequency) +{ + + return 0; +} +__weak_reference(cgem_default_set_ref_clk, cgem_set_ref_clk); + +/* Call to set reference clock and network config bits according to media. */ +static void +cgem_mediachange(struct cgem_softc *sc, struct mii_data *mii) +{ + uint32_t net_cfg; + int ref_clk_freq; + + CGEM_ASSERT_LOCKED(sc); + + /* Update hardware to reflect media. */ + net_cfg = RD4(sc, CGEM_NET_CFG); + net_cfg &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | + CGEM_NET_CFG_FULL_DUPLEX); + + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_1000_T: + net_cfg |= (CGEM_NET_CFG_SPEED100 | + CGEM_NET_CFG_GIGE_EN); + ref_clk_freq = 125000000; + break; + case IFM_100_TX: + net_cfg |= CGEM_NET_CFG_SPEED100; + ref_clk_freq = 25000000; + break; + default: + ref_clk_freq = 2500000; + } + + if ((mii->mii_media_active & IFM_FDX) != 0) + net_cfg |= CGEM_NET_CFG_FULL_DUPLEX; + + WR4(sc, CGEM_NET_CFG, net_cfg); + + /* Set the reference clock if necessary. */ + if (cgem_set_ref_clk(sc->ref_clk_num, ref_clk_freq)) + device_printf(sc->dev, "cgem_mediachange: " + "could not set ref clk%d to %d.\n", + sc->ref_clk_num, ref_clk_freq); + + sc->mii_media_active = mii->mii_media_active; +} + +static void +cgem_add_sysctls(device_t dev) +{ + struct cgem_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + struct sysctl_oid *tree; + + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rxbufs", CTLFLAG_RW, + &sc->rxbufs, 0, + "Number receive buffers to provide"); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rxhangwar", CTLFLAG_RW, + &sc->rxhangwar, 0, + "Enable receive hang work-around"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxoverruns", CTLFLAG_RD, + &sc->rxoverruns, 0, + "Receive overrun events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxnobufs", CTLFLAG_RD, + &sc->rxnobufs, 0, + "Receive buf queue empty events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_rxdmamapfails", CTLFLAG_RD, + &sc->rxdmamapfails, 0, + "Receive DMA map failures"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txfull", CTLFLAG_RD, + &sc->txfull, 0, + "Transmit ring full events"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdmamapfails", CTLFLAG_RD, + &sc->txdmamapfails, 0, + "Transmit DMA map failures"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdefrags", CTLFLAG_RD, + &sc->txdefrags, 0, + "Transmit m_defrag() calls"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "_txdefragfails", CTLFLAG_RD, + &sc->txdefragfails, 0, + "Transmit m_defrag() failures"); + + tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "GEM statistics"); + child = SYSCTL_CHILDREN(tree); + + SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_bytes", CTLFLAG_RD, + &sc->stats.tx_bytes, "Total bytes transmitted"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames", CTLFLAG_RD, + &sc->stats.tx_frames, 0, "Total frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_bcast", CTLFLAG_RD, + &sc->stats.tx_frames_bcast, 0, + "Number broadcast frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_multi", CTLFLAG_RD, + &sc->stats.tx_frames_multi, 0, + "Number multicast frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_pause", + CTLFLAG_RD, &sc->stats.tx_frames_pause, 0, + "Number pause frames transmitted"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_64b", CTLFLAG_RD, + &sc->stats.tx_frames_64b, 0, + "Number frames transmitted of size 64 bytes or less"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_65to127b", CTLFLAG_RD, + &sc->stats.tx_frames_65to127b, 0, + "Number frames transmitted of size 65-127 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_128to255b", + CTLFLAG_RD, &sc->stats.tx_frames_128to255b, 0, + "Number frames transmitted of size 128-255 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_256to511b", + CTLFLAG_RD, &sc->stats.tx_frames_256to511b, 0, + "Number frames transmitted of size 256-511 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_512to1023b", + CTLFLAG_RD, &sc->stats.tx_frames_512to1023b, 0, + "Number frames transmitted of size 512-1023 bytes"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_frames_1024to1536b", + CTLFLAG_RD, &sc->stats.tx_frames_1024to1536b, 0, *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***