From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:17:33 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5DFAA35AEB; Mon, 23 Nov 2015 08:17:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C25C1F0A; Mon, 23 Nov 2015 08:17:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8HWrY082303; Mon, 23 Nov 2015 08:17:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8HWQY082301; Mon, 23 Nov 2015 08:17:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230817.tAN8HWQY082301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:17: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: r291173 - in stable/10: etc/mtree tests/sys/kern tests/sys/kern/acct tools/regression/acct X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:17:33 -0000 Author: ngie Date: Mon Nov 23 08:17:32 2015 New Revision: 291173 URL: https://svnweb.freebsd.org/changeset/base/291173 Log: MFC r290905,r290922: r290905: Integrate acct(2) testcase in as tests/sys/kern/acct/acct_test The :encode_tv_random_million testcase fails the epsilon tests a few thousand times out of one million, so expect the testcase to fail Submitted by: keramida Sponsored by: EMC / Isilon Storage Division r290922: Remove directory made obsolete by r290905 X-MFC note: stable/10 only Sponsored by: EMC / Isilon Storage Division Added: stable/10/tests/sys/kern/acct/ - copied from r290905, head/tests/sys/kern/acct/ Deleted: stable/10/tools/regression/acct/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/tests/sys/kern/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Mon Nov 23 07:57:41 2015 (r291172) +++ stable/10/etc/mtree/BSD.tests.dist Mon Nov 23 08:17:32 2015 (r291173) @@ -197,6 +197,8 @@ file .. kern + acct + .. execve .. .. Modified: stable/10/tests/sys/kern/Makefile ============================================================================== --- stable/10/tests/sys/kern/Makefile Mon Nov 23 07:57:41 2015 (r291172) +++ stable/10/tests/sys/kern/Makefile Mon Nov 23 08:17:32 2015 (r291173) @@ -12,6 +12,7 @@ LDADD.unix_seqpacket_test+= -lpthread WARNS?= 5 +TESTS_SUBDIRS+= acct TESTS_SUBDIRS+= execve .include From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:18:53 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE5A3A35B67; Mon, 23 Nov 2015 08:18:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95A691072; Mon, 23 Nov 2015 08:18:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8IqMx082407; Mon, 23 Nov 2015 08:18:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8IqWT082406; Mon, 23 Nov 2015 08:18:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230818.tAN8IqWT082406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:18:52 +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: r291174 - stable/10/contrib/netbsd-tests/lib/libcrypt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:18:53 -0000 Author: ngie Date: Mon Nov 23 08:18:52 2015 New Revision: 291174 URL: https://svnweb.freebsd.org/changeset/base/291174 Log: MFC r290907: Expect all testcases dealing with invalid salts to fail on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/lib/libcrypt/t_crypt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libcrypt/t_crypt.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libcrypt/t_crypt.c Mon Nov 23 08:17:32 2015 (r291173) +++ stable/10/contrib/netbsd-tests/lib/libcrypt/t_crypt.c Mon Nov 23 08:18:52 2015 (r291174) @@ -124,6 +124,10 @@ ATF_TC_HEAD(crypt_salts, tc) ATF_TC_BODY(crypt_salts, tc) { for (size_t i = 0; tests[i].hash; i++) { +#if defined(__FreeBSD__) + if (22 <= i) + atf_tc_expect_fail("Old-style/bad inputs fail on FreeBSD"); +#endif char *hash = crypt(tests[i].pw, tests[i].hash); if (!hash) { ATF_CHECK_MSG(0, "Test %zu NULL\n", i); From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:22:41 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA50FA35CE9; Mon, 23 Nov 2015 08:22:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F5B114CB; Mon, 23 Nov 2015 08:22:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8MeWa085082; Mon, 23 Nov 2015 08:22:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8Mea1085077; Mon, 23 Nov 2015 08:22:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230822.tAN8Mea1085077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08: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: r291175 - in stable/10: lib/libc/tests/net tools/regression/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:22:41 -0000 Author: ngie Date: Mon Nov 23 08:22:40 2015 New Revision: 291175 URL: https://svnweb.freebsd.org/changeset/base/291175 Log: MFC r290563,r290868,r291038: r290563: Integrate tools/regression/lib/libc/net into the FreeBSD test suite as lib/libc/tests/net Also, fix eui64_aton_test:test_str(..). The test was comparing the result of eui64_aton to a pointer of the expected result. Sponsored by: EMC / Isilon Storage Division r290868: Fix -Wformat issues Reported by: gcc Sponsored by: EMC / Isilon Storage Division r291038: Do not print out errno if the call succeeded unexpectedly; this was a mistake made in r290868 Reported by: jilles Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/tests/net/ether_test.c - copied, changed from r290563, head/lib/libc/tests/net/ether_test.c stable/10/lib/libc/tests/net/eui64_aton_test.c - copied unchanged from r290563, head/lib/libc/tests/net/eui64_aton_test.c stable/10/lib/libc/tests/net/eui64_ntoa_test.c - copied unchanged from r290563, head/lib/libc/tests/net/eui64_ntoa_test.c stable/10/lib/libc/tests/net/test-eui64.h - copied unchanged from r290563, head/lib/libc/tests/net/test-eui64.h Deleted: stable/10/tools/regression/lib/libc/net/ Modified: stable/10/lib/libc/tests/net/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/net/Makefile ============================================================================== --- stable/10/lib/libc/tests/net/Makefile Mon Nov 23 08:18:52 2015 (r291174) +++ stable/10/lib/libc/tests/net/Makefile Mon Nov 23 08:22:40 2015 (r291175) @@ -1,24 +1,25 @@ # $FreeBSD$ -.include - TESTSDIR= ${TESTSBASE}/lib/libc/net -BINDIR= ${TESTSDIR} +ATF_TESTS_C+= ether_test +ATF_TESTS_C+= eui64_aton_test +ATF_TESTS_C+= eui64_ntoa_test -NETBSD_ATF_TESTS_C= getprotoent_test -NETBSD_ATF_TESTS_C+= ether_aton_test +CFLAGS+= -I${.CURDIR} -SRCS.t_ether_aton= aton_ether_subr.c t_ether_aton.c +NETBSD_ATF_TESTS_C+= getprotoent_test +NETBSD_ATF_TESTS_C+= ether_aton_test -aton_ether_subr.c: gen_ether_subr ${.CURDIR:H:H:H:H}/sys/net/if_ethersubr.c - ${HOST_SH} ${.ALLSRC} ${.TARGET} +SRCS.ether_aton_test= aton_ether_subr.c t_ether_aton.c # TODO: hostent_test NETBSD_ATF_TESTS_SH= nsdispatch_test NETBSD_ATF_TESTS_SH+= protoent_test NETBSD_ATF_TESTS_SH+= servent_test +BINDIR= ${TESTSDIR} + PROGS= h_nsd_recurse PROGS+= h_protoent PROGS+= h_servent @@ -28,12 +29,14 @@ DPADD.h_nsd_recurse+= ${LIBPTHREAD} LDADD.h_nsd_recurse+= -lpthread CLEANFILES+= aton_ether_subr.c +aton_ether_subr.c: gen_ether_subr ${SRCTOP}/sys/net/if_ethersubr.c + ${HOST_SH} ${.ALLSRC} ${.TARGET} .include "../Makefile.netbsd-tests" # TODO: the testcases needs to be ported to FreeBSD #TESTS_SUBDIRS= getaddrinfo -FILES= hosts +FILES+= hosts FILES+= resolv.conf .include Copied and modified: stable/10/lib/libc/tests/net/ether_test.c (from r290563, head/lib/libc/tests/net/ether_test.c) ============================================================================== --- head/lib/libc/tests/net/ether_test.c Sun Nov 8 23:06:40 2015 (r290563, copy source) +++ stable/10/lib/libc/tests/net/ether_test.c Mon Nov 23 08:22:40 2015 (r291175) @@ -65,7 +65,7 @@ ATF_TC_BODY(ether_line_bad_1, tc) char hostname[256]; ATF_REQUIRE_MSG(ether_line(ether_line_bad_1_string, &e, hostname) != 0, - "ether_line succeeded unexpectedly", errno); + "ether_line succeeded unexpectedly"); } static const char *ether_line_bad_2_string = "x x"; @@ -77,7 +77,7 @@ ATF_TC_BODY(ether_line_bad_2, tc) char hostname[256]; ATF_REQUIRE_MSG(ether_line(ether_line_bad_2_string, &e, hostname) != 0, - "ether_line succeeded unexpectedly", errno); + "ether_line succeeded unexpectedly"); } static const char *ether_aton_string = "01:23:45:67:89:ab"; @@ -92,7 +92,7 @@ ATF_TC_BODY(ether_aton_r, tc) ep = ether_aton_r(ether_aton_string, &e); - ATF_REQUIRE_MSG(ep != NULL, "ether_aton_r failed", errno); + ATF_REQUIRE_MSG(ep != NULL, "ether_aton_r failed; errno=%d", errno); ATF_REQUIRE_MSG(ep == &e, "ether_aton_r returned different pointers; %p != %p", ep, &e); } Copied: stable/10/lib/libc/tests/net/eui64_aton_test.c (from r290563, head/lib/libc/tests/net/eui64_aton_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/net/eui64_aton_test.c Mon Nov 23 08:22:40 2015 (r291175, copy of r290563, head/lib/libc/tests/net/eui64_aton_test.c) @@ -0,0 +1,104 @@ +/* + * Copyright 2004 The Aerospace Corporation. 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. + * 3. The name of The Aerospace Corporation may not be used to endorse or + * promote products derived from this software. + * + * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "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 AEROSPACE CORPORATION 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$ + */ + +#include +#include +#include +#include +#include + +#include + +#include "test-eui64.h" + +static void +test_str(const char *str, const struct eui64 *eui) +{ + struct eui64 e; + char buf[EUI64_SIZ]; + int rc; + + ATF_REQUIRE_MSG(eui64_aton(str, &e) == 0, "eui64_aton failed"); + rc = memcmp(&e, eui, sizeof(e)); + if (rc != 0) { + eui64_ntoa(&e, buf, sizeof(buf)); + atf_tc_fail( + "eui64_aton(\"%s\", ..) failed; memcmp returned %d. " + "String obtained form eui64_ntoa was: `%s`", + str, rc, buf); + } +} + +ATF_TC_WITHOUT_HEAD(id_ascii); +ATF_TC_BODY(id_ascii, tc) +{ + + test_str(test_eui64_id_ascii, &test_eui64_id); +} + +ATF_TC_WITHOUT_HEAD(id_colon_ascii); +ATF_TC_BODY(id_colon_ascii, tc) +{ + + test_str(test_eui64_id_colon_ascii, &test_eui64_id); +} + +ATF_TC_WITHOUT_HEAD(mac_ascii); +ATF_TC_BODY(mac_ascii, tc) +{ + + test_str(test_eui64_mac_ascii, &test_eui64_eui48); +} + +ATF_TC_WITHOUT_HEAD(mac_colon_ascii); +ATF_TC_BODY(mac_colon_ascii, tc) +{ + + test_str(test_eui64_mac_colon_ascii, &test_eui64_eui48); +} + +ATF_TC_WITHOUT_HEAD(hex_ascii); +ATF_TC_BODY(hex_ascii, tc) +{ + + test_str(test_eui64_hex_ascii, &test_eui64_id); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, id_ascii); + ATF_TP_ADD_TC(tp, id_colon_ascii); + ATF_TP_ADD_TC(tp, mac_ascii); + ATF_TP_ADD_TC(tp, mac_colon_ascii); + ATF_TP_ADD_TC(tp, hex_ascii); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/net/eui64_ntoa_test.c (from r290563, head/lib/libc/tests/net/eui64_ntoa_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/net/eui64_ntoa_test.c Mon Nov 23 08:22:40 2015 (r291175, copy of r290563, head/lib/libc/tests/net/eui64_ntoa_test.c) @@ -0,0 +1,64 @@ +/* + * Copyright 2004 The Aerospace Corporation. 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. + * 3. The name of The Aerospace Corporation may not be used to endorse or + * promote products derived from this software. + * + * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "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 AEROSPACE CORPORATION 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$ + */ + +#include +#include +#include +#include + +#include + +#include "test-eui64.h" + +static void +test_str(const char *str, const struct eui64 *eui) +{ + char a[EUI64_SIZ]; + + ATF_REQUIRE_MSG(eui64_ntoa(&test_eui64_id, a, sizeof(a)) == 0, + "eui64_ntoa failed"); + ATF_REQUIRE_MSG(strcmp(a, test_eui64_id_ascii) == 0, + "the strings mismatched: `%s` != `%s`", a, test_eui64_id_ascii); +} + +ATF_TC_WITHOUT_HEAD(id_ascii); +ATF_TC_BODY(id_ascii, tc) +{ + + test_str(test_eui64_id_ascii, &test_eui64_id); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, id_ascii); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/net/test-eui64.h (from r290563, head/lib/libc/tests/net/test-eui64.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/net/test-eui64.h Mon Nov 23 08:22:40 2015 (r291175, copy of r290563, head/lib/libc/tests/net/test-eui64.h) @@ -0,0 +1,55 @@ +/* + * Copyright 2004 The Aerospace Corporation. 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. + * 3. The name of The Aerospace Corporation may not be used to endorse or + * promote products derived from this software. + * + * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "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 AEROSPACE CORPORATION 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 _TEST_EUI64_H +#define _TEST_EUI64_H + +struct eui64 test_eui64_id = {{0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77}}; +struct eui64 test_eui64_eui48 = {{0x00,0x11,0x22,0xFF,0xFE,0x33,0x44,0x55}}; +struct eui64 test_eui64_mac48 = {{0x00,0x11,0x22,0xFF,0xFF,0x33,0x44,0x55}}; + +#define test_eui64_id_ascii "00-11-22-33-44-55-66-77" +#define test_eui64_id_colon_ascii "00:11:22:33:44:55:66:77" +#define test_eui64_hex_ascii "0x0011223344556677" +#define test_eui64_eui48_ascii "00-11-22-ff-fe-33-44-55" +#define test_eui64_mac48_ascii "00-11-22-ff-fe-33-44-55" +#define test_eui64_mac_ascii "00-11-22-33-44-55" +#define test_eui64_mac_colon_ascii "00:11:22:33:44:55" +#define test_eui64_id_host "id" +#define test_eui64_eui48_host "eui-48" +#define test_eui64_mac48_host "mac-48" + +#define test_eui64_line_id "00-11-22-33-44-55-66-77 id" +#define test_eui64_line_id_colon "00:11:22:33:44:55:66:77 id" +#define test_eui64_line_eui48 "00-11-22-FF-fe-33-44-55 eui-48" +#define test_eui64_line_mac48 "00-11-22-FF-ff-33-44-55 mac-48" +#define test_eui64_line_eui48_6byte "00-11-22-33-44-55 eui-48" +#define test_eui64_line_eui48_6byte_c "00:11:22:33:44:55 eui-48" + +#endif /* !_TEST_EUI64_H */ From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:24:50 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 642FDA35E16; Mon, 23 Nov 2015 08:24:50 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1167317C7; Mon, 23 Nov 2015 08:24:49 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8OnhY085207; Mon, 23 Nov 2015 08:24:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8On0O085206; Mon, 23 Nov 2015 08:24:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230824.tAN8On0O085206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:24: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: r291176 - stable/10/contrib/netbsd-tests/lib/libc/regex X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:24:50 -0000 Author: ngie Date: Mon Nov 23 08:24:48 2015 New Revision: 291176 URL: https://svnweb.freebsd.org/changeset/base/291176 Log: MFC r290869: Redo r290847: use #ifdef __NetBSD__ on all the non-public APIs to mute -Wunused-but-set-variable warnings with gcc dealing with the function calls Reported by: gcc Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/lib/libc/regex/debug.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/regex/debug.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/regex/debug.c Mon Nov 23 08:22:40 2015 (r291175) +++ stable/10/contrib/netbsd-tests/lib/libc/regex/debug.c Mon Nov 23 08:24:48 2015 (r291176) @@ -45,16 +45,18 @@ #include "test_regex.h" +#ifdef __NetBSD__ static void s_print(struct re_guts *, FILE *); static char *regchar(int); +#endif +#ifdef __NetBSD__ /* * regprint - print a regexp for debugging */ void regprint(regex_t *r, FILE *d) { -#ifdef __NetBSD__ struct re_guts *g = r->re_g; int c; int last; @@ -116,7 +118,6 @@ regprint(regex_t *r, FILE *d) } fprintf(d, "\n"); } -#endif } /* @@ -126,15 +127,11 @@ static void s_print(struct re_guts *g, FILE *d) { sop *s; -#ifdef __NetBSD__ cset *cs; -#endif int done = 0; sop opnd; int col = 0; -#ifdef __NetBSD__ ssize_t last; -#endif sopno offset = 2; # define GAP() { if (offset % 5 == 0) { \ if (col > 40) { \ @@ -181,7 +178,6 @@ s_print(struct re_guts *g, FILE *d) break; case OANYOF: fprintf(d, "[(%ld)", (long)opnd); -#ifdef __NetBSD__ cs = &g->sets[opnd]; last = -1; for (size_t i = 0; i < g->csetsize+1; i++) /* +1 flushes */ @@ -198,7 +194,6 @@ s_print(struct re_guts *g, FILE *d) last = -1; } } -#endif fprintf(d, "]"); break; case OBACK_: @@ -254,11 +249,7 @@ s_print(struct re_guts *g, FILE *d) fprintf(d, ">"); break; default: -#ifdef __FreeBSD__ - fprintf(d, "!%ld(%ld)!", OP(*s), opnd); -#else fprintf(d, "!%d(%d)!", OP(*s), opnd); -#endif break; } if (!done) @@ -280,3 +271,10 @@ regchar(int ch) sprintf(buf, "\\%o", ch); return(buf); } +#else +void +regprint(regex_t *r, FILE *d) +{ + +} +#endif From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:26:27 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FD39A35EB6; Mon, 23 Nov 2015 08:26:27 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B3D31981; Mon, 23 Nov 2015 08:26:27 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8QQfb085329; Mon, 23 Nov 2015 08:26:26 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8QQNC085328; Mon, 23 Nov 2015 08:26:26 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230826.tAN8QQNC085328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:26: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: r291177 - stable/10/contrib/netbsd-tests/lib/libc/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:26:27 -0000 Author: ngie Date: Mon Nov 23 08:26:26 2015 New Revision: 291177 URL: https://svnweb.freebsd.org/changeset/base/291177 Log: MFC r290850: Cast xdr_void to xdrproc_t to mute -Wincompatible-pointer-types warnings from clang This pattern is used in other areas of lib/libc/rpc Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon Nov 23 08:24:48 2015 (r291176) +++ stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon Nov 23 08:26:26 2015 (r291177) @@ -73,8 +73,14 @@ onehost(const char *host, const char *tr tv.tv_sec = 1; tv.tv_usec = 0; +#ifdef __FreeBSD__ + if (clnt_call(clnt, RPCBPROC_NULL, (xdrproc_t)xdr_void, NULL, + (xdrproc_t)xdr_void, NULL, tv) + != RPC_SUCCESS) +#else if (clnt_call(clnt, RPCBPROC_NULL, xdr_void, NULL, xdr_void, NULL, tv) != RPC_SUCCESS) +#endif ERRX(EXIT_FAILURE, "clnt_call (%s)", clnt_sperror(clnt, "")); clnt_control(clnt, CLGET_SVC_ADDR, (char *) &addr); reply(NULL, &addr, NULL); From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:31:44 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D8EFA35F3B; Mon, 23 Nov 2015 08:31:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8CB31BF3; Mon, 23 Nov 2015 08:31:43 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8Vhve088061; Mon, 23 Nov 2015 08:31:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8Vfix088046; Mon, 23 Nov 2015 08:31:41 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230831.tAN8Vfix088046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:31: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: r291178 - in stable/10: lib/libc/tests/locale tools/regression/lib/libc/locale X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:31:44 -0000 Author: ngie Date: Mon Nov 23 08:31:41 2015 New Revision: 291178 URL: https://svnweb.freebsd.org/changeset/base/291178 Log: MFC r290532,r290561,r290843,r290844,r290845: r290532: Integrate tools/regression/lib/libc/locale into the FreeBSD test suite as lib/libc/tests/locale Sponsored by: EMC / Isilon Storage Division r290561: Delete leftover printfs from when these were TAP tests Sponsored by: EMC / Isilon Storage Division r290843: Polish up the tests a bit more after projects/collation was merged to head Provide more meaningful diagnostic messages if LC_CTYPE can't be set properly instead of segfaulting, because setlocale returns NULL and strcmp(NULL, b) will always segfault Split up the testcases so one failing (in this case en_US.ISO8859-15) won't cause the rest of the testcases to be skipped Remove some unused variables Sponsored by: EMC / Isilon Storage Division r290844: Polish up iswctype_test - Split up the testcases into C locale and ja_JP.eucJP testcases. - Avoid a segfault in the event that setlocale fails, similar to r290843 - Replace `sizeof(x) / sizeof(*x)` pattern with `nitems(x)` Sponsored by: EMC / Isilon Storage Division r290845: Remove unused variables; sort by alignment where needed Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/tests/locale/btowc_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/btowc_test.c stable/10/lib/libc/tests/locale/c16rtomb_test.c - copied, changed from r290532, head/lib/libc/tests/locale/c16rtomb_test.c stable/10/lib/libc/tests/locale/iswctype_test.c - copied, changed from r290532, head/lib/libc/tests/locale/iswctype_test.c stable/10/lib/libc/tests/locale/mblen_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mblen_test.c stable/10/lib/libc/tests/locale/mbrlen_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mbrlen_test.c stable/10/lib/libc/tests/locale/mbrtoc16_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mbrtoc16_test.c stable/10/lib/libc/tests/locale/mbrtowc_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mbrtowc_test.c stable/10/lib/libc/tests/locale/mbsnrtowcs_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/mbsnrtowcs_test.c stable/10/lib/libc/tests/locale/mbsrtowcs_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mbsrtowcs_test.c stable/10/lib/libc/tests/locale/mbstowcs_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/mbstowcs_test.c stable/10/lib/libc/tests/locale/mbtowc_test.c - copied, changed from r290532, head/lib/libc/tests/locale/mbtowc_test.c stable/10/lib/libc/tests/locale/towctrans_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/towctrans_test.c stable/10/lib/libc/tests/locale/wcrtomb_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/wcrtomb_test.c stable/10/lib/libc/tests/locale/wcsnrtombs_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/wcsnrtombs_test.c stable/10/lib/libc/tests/locale/wcsrtombs_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/wcsrtombs_test.c stable/10/lib/libc/tests/locale/wcstombs_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/wcstombs_test.c stable/10/lib/libc/tests/locale/wctomb_test.c - copied unchanged from r290532, head/lib/libc/tests/locale/wctomb_test.c Deleted: stable/10/tools/regression/lib/libc/locale/ Modified: stable/10/lib/libc/tests/locale/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/locale/Makefile ============================================================================== --- stable/10/lib/libc/tests/locale/Makefile Mon Nov 23 08:26:26 2015 (r291177) +++ stable/10/lib/libc/tests/locale/Makefile Mon Nov 23 08:31:41 2015 (r291178) @@ -4,6 +4,24 @@ TESTSDIR= ${TESTSBASE}/lib/libc/locale +ATF_TESTS_C+= btowc_test +ATF_TESTS_C+= c16rtomb_test +ATF_TESTS_C+= iswctype_test +ATF_TESTS_C+= mblen_test +ATF_TESTS_C+= mbrlen_test +ATF_TESTS_C+= mbrtoc16_test +ATF_TESTS_C+= mbrtowc_2_test +ATF_TESTS_C+= mbsnrtowcs_2_test +ATF_TESTS_C+= mbsrtowcs_test +ATF_TESTS_C+= mbstowcs_2_test +ATF_TESTS_C+= mbtowc_2_test +ATF_TESTS_C+= towctrans_test +ATF_TESTS_C+= wcrtomb_test +ATF_TESTS_C+= wcsnrtombs_test +ATF_TESTS_C+= wcsrtombs_test +ATF_TESTS_C+= wcstombs_test +ATF_TESTS_C+= wctomb_2_test + NETBSD_ATF_TESTS_C= io_test NETBSD_ATF_TESTS_C+= mbrtowc_test NETBSD_ATF_TESTS_C+= mbstowcs_test @@ -15,7 +33,13 @@ NETBSD_ATF_TESTS_C+= wcsspn_test NETBSD_ATF_TESTS_C+= wcstod_test NETBSD_ATF_TESTS_C+= wctomb_test -CFLAGS.t_wctomb.c+= -Wno-stack-protector +SRCS.mbrtowc_2_test= mbrtowc_test.c +SRCS.mbsnrtowcs_2_test= mbsnrtowcs_test.c +SRCS.mbstowcs_2_test= mbstowcs_test.c +SRCS.mbtowc_2_test= mbtowc_test.c +SRCS.wctomb_2_test= wctomb_test.c + +CFLAGS.t_wctomb.c+= -Wno-stack-protector .include "../Makefile.netbsd-tests" Copied: stable/10/lib/libc/tests/locale/btowc_test.c (from r290532, head/lib/libc/tests/locale/btowc_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/locale/btowc_test.c Mon Nov 23 08:31:41 2015 (r291178, copy of r290532, head/lib/libc/tests/locale/btowc_test.c) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2002 Tim J. Robbins + * 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. + */ + +/* + * Test program for btowc() and wctob() as specified by IEEE Std. 1003.1-2001 + * and ISO/IEC 9899:1999. + * + * The function is tested in the "C" and "ja_JP.eucJP" locales. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(btowc_test); +ATF_TC_BODY(btowc_test, tc) +{ + int i; + + /* C/POSIX locale. */ + ATF_REQUIRE(btowc(EOF) == WEOF); + ATF_REQUIRE(wctob(WEOF) == EOF); + for (i = 0; i < UCHAR_MAX; i++) + ATF_REQUIRE(btowc(i) == (wchar_t)i && i == (int)wctob(i)); + + /* Japanese (EUC) locale. */ + ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); + ATF_REQUIRE(MB_CUR_MAX > 1); + ATF_REQUIRE(btowc('A') == L'A' && wctob(L'A') == 'A'); + ATF_REQUIRE(btowc(0xa3) == WEOF && wctob(0xa3c1) == EOF); + +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, btowc_test); + + return (atf_no_error()); +} Copied and modified: stable/10/lib/libc/tests/locale/c16rtomb_test.c (from r290532, head/lib/libc/tests/locale/c16rtomb_test.c) ============================================================================== --- head/lib/libc/tests/locale/c16rtomb_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/c16rtomb_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -42,13 +42,27 @@ __FBSDID("$FreeBSD$"); #include -ATF_TC_WITHOUT_HEAD(c16rtomb_test); -ATF_TC_BODY(c16rtomb_test, tc) +static void +require_lc_ctype(const char *locale_name) { - mbstate_t s; - char buf[MB_LEN_MAX + 1]; + char *lc_ctype_set; - /* C/POSIX locale. */ + lc_ctype_set = setlocale(LC_CTYPE, locale_name); + if (lc_ctype_set == NULL) + atf_tc_fail("setlocale(LC_CTYPE, \"%s\") failed; errno=%d", + locale_name, errno); + + ATF_REQUIRE(strcmp(lc_ctype_set, locale_name) == 0); +} + +static mbstate_t s; +static char buf[MB_LEN_MAX + 1]; + +ATF_TC_WITHOUT_HEAD(c16rtomb_c_locale_test); +ATF_TC_BODY(c16rtomb_c_locale_test, tc) +{ + + require_lc_ctype("C"); /* * If the buffer argument is NULL, c16 is implicitly 0, @@ -80,11 +94,13 @@ ATF_TC_BODY(c16rtomb_test, tc) ATF_REQUIRE(c16rtomb(buf, 0xdca9, &s) == (size_t)-1); ATF_REQUIRE(errno == EILSEQ); ATF_REQUIRE((unsigned char)buf[0] == 0xcc); +} - /* ISO8859-1. */ +ATF_TC_WITHOUT_HEAD(c16rtomb_iso_8859_1_test); +ATF_TC_BODY(c16rtomb_iso_8859_1_test, tc) +{ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-1"), - "en_US.ISO8859-1") == 0); + require_lc_ctype("en_US.ISO8859-1"); /* Unicode character 'Euro sign'. */ memset(&s, 0, sizeof(s)); @@ -92,21 +108,26 @@ ATF_TC_BODY(c16rtomb_test, tc) ATF_REQUIRE(c16rtomb(buf, 0x20ac, &s) == (size_t)-1); ATF_REQUIRE(errno == EILSEQ); ATF_REQUIRE((unsigned char)buf[0] == 0xcc); +} - /* ISO8859-15. */ +ATF_TC_WITHOUT_HEAD(c16rtomb_iso_8859_15_test); +ATF_TC_BODY(c16rtomb_iso_8859_15_test, tc) +{ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-15"), - "en_US.ISO8859-15") == 0); + require_lc_ctype("en_US.ISO8859-15"); /* Unicode character 'Euro sign'. */ memset(&s, 0, sizeof(s)); memset(buf, 0xcc, sizeof(buf)); ATF_REQUIRE(c16rtomb(buf, 0x20ac, &s) == 1); ATF_REQUIRE((unsigned char)buf[0] == 0xa4 && (unsigned char)buf[1] == 0xcc); +} - /* UTF-8. */ +ATF_TC_WITHOUT_HEAD(c16rtomb_utf_8_test); +ATF_TC_BODY(c16rtomb_utf_8_test, tc) +{ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.UTF-8"), "en_US.UTF-8") == 0); + require_lc_ctype("en_US.UTF-8"); /* Unicode character 'Pile of poo'. */ memset(&s, 0, sizeof(s)); @@ -136,7 +157,10 @@ ATF_TC_BODY(c16rtomb_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, c16rtomb_test); + ATF_TP_ADD_TC(tp, c16rtomb_c_locale_test); + ATF_TP_ADD_TC(tp, c16rtomb_iso_8859_1_test); + ATF_TP_ADD_TC(tp, c16rtomb_iso_8859_15_test); + ATF_TP_ADD_TC(tp, c16rtomb_utf_8_test); return (atf_no_error()); } Copied and modified: stable/10/lib/libc/tests/locale/iswctype_test.c (from r290532, head/lib/libc/tests/locale/iswctype_test.c) ============================================================================== --- head/lib/libc/tests/locale/iswctype_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/iswctype_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include @@ -42,31 +44,45 @@ __FBSDID("$FreeBSD$"); #include -ATF_TC_WITHOUT_HEAD(iswctype_test); -ATF_TC_BODY(iswctype_test, tc) +static void +require_lc_ctype(const char *locale_name) { - wctype_t t; - int i, j; - struct { - const char *name; - int (*func)(wint_t); - } cls[] = { - { "alnum", iswalnum }, - { "alpha", iswalpha }, - { "blank", iswblank }, - { "cntrl", iswcntrl }, - { "digit", iswdigit }, - { "graph", iswgraph }, - { "lower", iswlower }, - { "print", iswprint }, - { "punct", iswpunct }, - { "space", iswspace }, - { "upper", iswupper }, - { "xdigit", iswxdigit } - }; + char *lc_ctype_set; - /* C/POSIX locale. */ - for (i = 0; i < sizeof(cls) / sizeof(*cls); i++) { + lc_ctype_set = setlocale(LC_CTYPE, locale_name); + if (lc_ctype_set == NULL) + atf_tc_fail("setlocale(LC_CTYPE, \"%s\") failed; errno=%d", + locale_name, errno); + + ATF_REQUIRE(strcmp(lc_ctype_set, locale_name) == 0); +} + +static wctype_t t; +static int i, j; +static struct { + const char *name; + int (*func)(wint_t); +} cls[] = { + { "alnum", iswalnum }, + { "alpha", iswalpha }, + { "blank", iswblank }, + { "cntrl", iswcntrl }, + { "digit", iswdigit }, + { "graph", iswgraph }, + { "lower", iswlower }, + { "print", iswprint }, + { "punct", iswpunct }, + { "space", iswspace }, + { "upper", iswupper }, + { "xdigit", iswxdigit } +}; + +ATF_TC_WITHOUT_HEAD(iswctype_c_locale_test); +ATF_TC_BODY(iswctype_c_locale_test, tc) +{ + + require_lc_ctype("C"); + for (i = 0; i < nitems(cls); i++) { t = wctype(cls[i].name); ATF_REQUIRE(t != 0); for (j = 0; j < 256; j++) @@ -76,10 +92,15 @@ ATF_TC_BODY(iswctype_test, tc) ATF_REQUIRE(t == 0); for (i = 0; i < 256; i++) ATF_REQUIRE(iswctype(i, t) == 0); +} + +ATF_TC_WITHOUT_HEAD(iswctype_euc_jp_test); +ATF_TC_BODY(iswctype_euc_jp_test, tc) +{ + + require_lc_ctype("ja_JP.eucJP"); - /* Japanese (EUC) locale. */ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); - for (i = 0; i < sizeof(cls) / sizeof(*cls); i++) { + for (i = 0; i < nitems(cls); i++) { t = wctype(cls[i].name); ATF_REQUIRE(t != 0); for (j = 0; j < 65536; j++) @@ -94,7 +115,8 @@ ATF_TC_BODY(iswctype_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, iswctype_test); + ATF_TP_ADD_TC(tp, iswctype_c_locale_test); + ATF_TP_ADD_TC(tp, iswctype_euc_jp_test); return (atf_no_error()); } Copied and modified: stable/10/lib/libc/tests/locale/mblen_test.c (from r290532, head/lib/libc/tests/locale/mblen_test.c) ============================================================================== --- head/lib/libc/tests/locale/mblen_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mblen_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -46,15 +46,12 @@ __FBSDID("$FreeBSD$"); ATF_TC_WITHOUT_HEAD(mblen_test); ATF_TC_BODY(mblen_test, tc) { - size_t len; char buf[MB_LEN_MAX + 1]; /* * C/POSIX locale. */ - printf("1..1\n"); - ATF_REQUIRE(MB_CUR_MAX == 1); /* No shift states in C locale. */ Copied and modified: stable/10/lib/libc/tests/locale/mbrlen_test.c (from r290532, head/lib/libc/tests/locale/mbrlen_test.c) ============================================================================== --- head/lib/libc/tests/locale/mbrlen_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mbrlen_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -49,7 +49,6 @@ ATF_TC_WITHOUT_HEAD(mbrlen_test); ATF_TC_BODY(mbrlen_test, tc) { mbstate_t s; - size_t len; char buf[MB_LEN_MAX + 1]; /* C/POSIX locale. */ Copied and modified: stable/10/lib/libc/tests/locale/mbrtoc16_test.c (from r290532, head/lib/libc/tests/locale/mbrtoc16_test.c) ============================================================================== --- head/lib/libc/tests/locale/mbrtoc16_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mbrtoc16_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -42,18 +42,27 @@ __FBSDID("$FreeBSD$"); #include -ATF_TC_WITHOUT_HEAD(mbrtoc16_test); -ATF_TC_BODY(mbrtoc16_test, tc) +static void +require_lc_ctype(const char *locale_name) { - mbstate_t s; - size_t len; - char16_t c16; - - /* - * C/POSIX locale. - */ + char *lc_ctype_set; - printf("1..1\n"); + lc_ctype_set = setlocale(LC_CTYPE, locale_name); + if (lc_ctype_set == NULL) + atf_tc_fail("setlocale(LC_CTYPE, \"%s\") failed; errno=%d", + locale_name, errno); + + ATF_REQUIRE(strcmp(lc_ctype_set, locale_name) == 0); +} + +static mbstate_t s; +static char16_t c16; + +ATF_TC_WITHOUT_HEAD(mbrtoc16_c_locale_test); +ATF_TC_BODY(mbrtoc16_c_locale_test, tc) +{ + + require_lc_ctype("C"); /* Null wide character, internal state. */ ATF_REQUIRE(mbrtoc16(&c16, "", 1, NULL) == 0); @@ -93,35 +102,37 @@ ATF_TC_BODY(mbrtoc16_test, tc) ATF_REQUIRE(mbrtoc16(&c16, "C", 1, &s) == 1); ATF_REQUIRE(c16 == L'C'); - /* - * ISO-8859-1. - */ +} - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-1"), - "en_US.ISO8859-1") == 0); +ATF_TC_WITHOUT_HEAD(mbrtoc16_iso_8859_1_test); +ATF_TC_BODY(mbrtoc16_iso_8859_1_test, tc) +{ + + require_lc_ctype("en_US.ISO8859-1"); /* Currency sign. */ memset(&s, 0, sizeof(s)); ATF_REQUIRE(mbrtoc16(&c16, "\xa4", 1, &s) == 1); ATF_REQUIRE(c16 == 0xa4); +} - /* - * ISO-8859-15. - */ +ATF_TC_WITHOUT_HEAD(mbrtoc16_iso_8859_15_test); +ATF_TC_BODY(mbrtoc16_iso_8859_15_test, tc) +{ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.ISO8859-15"), - "en_US.ISO8859-15") == 0); + require_lc_ctype("en_US.ISO8859-15"); /* Euro sign. */ memset(&s, 0, sizeof(s)); ATF_REQUIRE(mbrtoc16(&c16, "\xa4", 1, &s) == 1); ATF_REQUIRE(c16 == 0x20ac); +} - /* - * UTF-8. - */ +ATF_TC_WITHOUT_HEAD(mbrtoc16_utf_8_test); +ATF_TC_BODY(mbrtoc16_utf_8_test, tc) +{ - ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "en_US.UTF-8"), "en_US.UTF-8") == 0); + require_lc_ctype("en_US.UTF-8"); /* Null wide character, internal state. */ ATF_REQUIRE(mbrtoc16(NULL, 0, 0, NULL) == 0); @@ -194,7 +205,10 @@ ATF_TC_BODY(mbrtoc16_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, mbrtoc16_test); + ATF_TP_ADD_TC(tp, mbrtoc16_c_locale_test); + ATF_TP_ADD_TC(tp, mbrtoc16_iso_8859_1_test); + ATF_TP_ADD_TC(tp, mbrtoc16_iso_8859_15_test); + ATF_TP_ADD_TC(tp, mbrtoc16_utf_8_test); return (atf_no_error()); } Copied and modified: stable/10/lib/libc/tests/locale/mbrtowc_test.c (from r290532, head/lib/libc/tests/locale/mbrtowc_test.c) ============================================================================== --- head/lib/libc/tests/locale/mbrtowc_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mbrtowc_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -49,7 +49,6 @@ ATF_TC_WITHOUT_HEAD(mbrtowc_test); ATF_TC_BODY(mbrtowc_test, tc) { mbstate_t s; - size_t len; wchar_t wc; char buf[MB_LEN_MAX + 1]; @@ -57,8 +56,6 @@ ATF_TC_BODY(mbrtowc_test, tc) * C/POSIX locale. */ - printf("1..1\n"); - ATF_REQUIRE(MB_CUR_MAX == 1); /* Null wide character, internal state. */ Copied: stable/10/lib/libc/tests/locale/mbsnrtowcs_test.c (from r290532, head/lib/libc/tests/locale/mbsnrtowcs_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/locale/mbsnrtowcs_test.c Mon Nov 23 08:31:41 2015 (r291178, copy of r290532, head/lib/libc/tests/locale/mbsnrtowcs_test.c) @@ -0,0 +1,195 @@ +/*- + * Copyright (c) 2002-2004 Tim J. Robbins + * 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. + */ + +/* + * Test program for mbsnrtowcs(). + * + * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and + * "ja_JP.eucJP". Other encodings are not tested. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(mbsnrtowcs_test); +ATF_TC_BODY(mbsnrtowcs_test, tc) +{ + char srcbuf[128]; + wchar_t dstbuf[128]; + char *src; + mbstate_t s; + + /* C/POSIX locale. */ + + /* Simple null terminated string. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + src = srcbuf; + memset(&s, 0, sizeof(s)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 6, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 5); + ATF_REQUIRE(wcscmp(dstbuf, L"hello") == 0); + ATF_REQUIRE(dstbuf[6] == 0xcccc); + ATF_REQUIRE(src == NULL); + + /* Simple null terminated string, stopping early. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + src = srcbuf; + memset(&s, 0, sizeof(s)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 4, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 4); + ATF_REQUIRE(wmemcmp(dstbuf, L"hell", 4) == 0); + ATF_REQUIRE(dstbuf[5] == 0xcccc); + ATF_REQUIRE(src == srcbuf + 4); + + /* Not enough space in destination buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + src = srcbuf; + memset(&s, 0, sizeof(s)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 6, 4, &s) == 4); + ATF_REQUIRE(wmemcmp(dstbuf, L"hell", 4) == 0); + ATF_REQUIRE(dstbuf[5] == 0xcccc); + ATF_REQUIRE(src == srcbuf + 4); + + /* Null terminated string, internal dest. buffer */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + src = srcbuf; + memset(&s, 0, sizeof(s)); + ATF_REQUIRE(mbsnrtowcs(NULL, (const char **)&src, 6, 0, &s) == 5); + + /* Null terminated string, internal dest. buffer, stopping early */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + src = srcbuf; + memset(&s, 0, sizeof(s)); + ATF_REQUIRE(mbsnrtowcs(NULL, (const char **)&src, 4, 0, &s) == 4); + + /* Null terminated string, internal state. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + src = srcbuf; + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 6, sizeof(dstbuf) / + sizeof(*dstbuf), NULL) == 5); + ATF_REQUIRE(wcscmp(dstbuf, L"hello") == 0); + ATF_REQUIRE(dstbuf[6] == 0xcccc); + ATF_REQUIRE(src == NULL); + + /* Null terminated string, internal state, internal dest. buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + src = srcbuf; + ATF_REQUIRE(mbsnrtowcs(NULL, (const char **)&src, 6, 0, NULL) == 5); + + /* Empty source buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + srcbuf[0] = '\0'; + src = srcbuf; + memset(&s, 0, sizeof(s)); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 1, 1, &s) == 0); + ATF_REQUIRE(dstbuf[0] == 0); + ATF_REQUIRE(dstbuf[1] == 0xcccc); + ATF_REQUIRE(src == NULL); + + /* Zero length destination buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + src = srcbuf; + memset(&s, 0, sizeof(s)); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 1, 0, &s) == 0); + ATF_REQUIRE(dstbuf[0] == 0xcccc); + ATF_REQUIRE(src == srcbuf); + + /* Zero length source buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + src = srcbuf; + memset(&s, 0, sizeof(s)); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 0, 1, &s) == 0); + ATF_REQUIRE(dstbuf[0] == 0xcccc); + ATF_REQUIRE(src == srcbuf); + + /* + * Japanese (EUC) locale. + */ + + ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); + ATF_REQUIRE(MB_CUR_MAX > 1); + + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "\xA3\xC1 B \xA3\xC3"); + src = srcbuf; + memset(&s, 0, sizeof(s)); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 8, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 5); + ATF_REQUIRE(dstbuf[0] == 0xA3C1 && dstbuf[1] == 0x20 && dstbuf[2] == 0x42 && + dstbuf[3] == 0x20 && dstbuf[4] == 0xA3C3 && dstbuf[5] == 0); + ATF_REQUIRE(src == NULL); + + /* Partial character. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "\xA3\xC1 B \xA3\xC3"); + src = srcbuf; + memset(&s, 0, sizeof(s)); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 6, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 4); + ATF_REQUIRE(src == srcbuf + 6); + ATF_REQUIRE(!mbsinit(&s)); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 1, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 1); + ATF_REQUIRE(src == srcbuf + 7); + ATF_REQUIRE(mbsnrtowcs(dstbuf, (const char **)&src, 1, sizeof(dstbuf) / + sizeof(*dstbuf), &s) == 0); + ATF_REQUIRE(src == NULL); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, mbsnrtowcs_test); + + return (atf_no_error()); +} Copied and modified: stable/10/lib/libc/tests/locale/mbsrtowcs_test.c (from r290532, head/lib/libc/tests/locale/mbsrtowcs_test.c) ============================================================================== --- head/lib/libc/tests/locale/mbsrtowcs_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mbsrtowcs_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -57,8 +57,6 @@ ATF_TC_BODY(mbsrtowcs_test, tc) * C/POSIX locale. */ - printf("1..1\n"); - /* Simple null terminated string. */ memset(srcbuf, 0xcc, sizeof(srcbuf)); strcpy(srcbuf, "hello"); Copied: stable/10/lib/libc/tests/locale/mbstowcs_test.c (from r290532, head/lib/libc/tests/locale/mbstowcs_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/locale/mbstowcs_test.c Mon Nov 23 08:31:41 2015 (r291178, copy of r290532, head/lib/libc/tests/locale/mbstowcs_test.c) @@ -0,0 +1,111 @@ +/*- + * Copyright (c) 2002 Tim J. Robbins + * 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. + */ + +/* + * Test program for mbstowcs(), as specified by IEEE Std. 1003.1-2001 and + * ISO/IEC 9899:1999. + * + * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and + * "ja_JP.eucJP". Other encodings are not tested. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(mbstowcs_test); +ATF_TC_BODY(mbstowcs_test, tc) +{ + char srcbuf[128]; + wchar_t dstbuf[128]; + + /* C/POSIX locale. */ + + /* Simple null terminated string. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbstowcs(dstbuf, srcbuf, sizeof(dstbuf) / sizeof(*dstbuf)) == 5); + ATF_REQUIRE(wcscmp(dstbuf, L"hello") == 0); + ATF_REQUIRE(dstbuf[6] == 0xcccc); + + /* Not enough space in destination buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbstowcs(dstbuf, srcbuf, 4) == 4); + ATF_REQUIRE(wmemcmp(dstbuf, L"hell", 4) == 0); + ATF_REQUIRE(dstbuf[5] == 0xcccc); + + /* Null terminated string, internal dest. buffer (XSI extension) */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + ATF_REQUIRE(mbstowcs(NULL, srcbuf, 0) == 5); + + /* Empty source buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + srcbuf[0] = '\0'; + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbstowcs(dstbuf, srcbuf, 1) == 0); + ATF_REQUIRE(dstbuf[0] == 0); + ATF_REQUIRE(dstbuf[1] == 0xcccc); + + /* Zero length destination buffer. */ + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "hello"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbstowcs(dstbuf, srcbuf, 0) == 0); + ATF_REQUIRE(dstbuf[0] == 0xcccc); + + /* Japanese (EUC) locale. */ + + ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); + ATF_REQUIRE(MB_CUR_MAX > 1); + + memset(srcbuf, 0xcc, sizeof(srcbuf)); + strcpy(srcbuf, "\xA3\xC1 B \xA3\xC3"); + wmemset(dstbuf, 0xcccc, sizeof(dstbuf) / sizeof(*dstbuf)); + ATF_REQUIRE(mbstowcs(dstbuf, srcbuf, sizeof(dstbuf) / sizeof(*dstbuf)) == 5); + ATF_REQUIRE(dstbuf[0] == 0xA3C1 && dstbuf[1] == 0x20 && dstbuf[2] == 0x42 && + dstbuf[3] == 0x20 && dstbuf[4] == 0xA3C3 && dstbuf[5] == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, mbstowcs_test); + + return (atf_no_error()); +} Copied and modified: stable/10/lib/libc/tests/locale/mbtowc_test.c (from r290532, head/lib/libc/tests/locale/mbtowc_test.c) ============================================================================== --- head/lib/libc/tests/locale/mbtowc_test.c Sun Nov 8 02:06:17 2015 (r290532, copy source) +++ stable/10/lib/libc/tests/locale/mbtowc_test.c Mon Nov 23 08:31:41 2015 (r291178) @@ -46,9 +46,8 @@ __FBSDID("$FreeBSD$"); ATF_TC_WITHOUT_HEAD(mbtowc_test); ATF_TC_BODY(mbtowc_test, tc) { - size_t len; - wchar_t wc; char buf[MB_LEN_MAX + 1]; + wchar_t wc; /* C/POSIX locale. */ Copied: stable/10/lib/libc/tests/locale/towctrans_test.c (from r290532, head/lib/libc/tests/locale/towctrans_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/locale/towctrans_test.c Mon Nov 23 08:31:41 2015 (r291178, copy of r290532, head/lib/libc/tests/locale/towctrans_test.c) @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2003 Tim J. Robbins + * 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. + */ + +/* + * Test program for wctrans() and towctrans() as specified by + * IEEE Std. 1003.1-2001 and ISO/IEC 9899:1999. + * + * The functions are tested in the "C" and "ja_JP.eucJP" locales. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(towctrans_test); +ATF_TC_BODY(towctrans_test, tc) +{ + wctype_t t; + int i, j; + struct { + const char *name; + wint_t (*func)(wint_t); + } tran[] = { + { "tolower", towlower }, + { "toupper", towupper }, + }; + + /* C/POSIX locale. */ + for (i = 0; i < sizeof(tran) / sizeof(*tran); i++) { + t = wctrans(tran[i].name); + ATF_REQUIRE(t != 0); + for (j = 0; j < 256; j++) + ATF_REQUIRE(tran[i].func(j) == towctrans(j, t)); + } + t = wctrans("elephant"); + ATF_REQUIRE(t == 0); + for (i = 0; i < 256; i++) + ATF_REQUIRE(towctrans(i, t) == i); + + /* Japanese (EUC) locale. */ + ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); + for (i = 0; i < sizeof(tran) / sizeof(*tran); i++) { + t = wctrans(tran[i].name); + ATF_REQUIRE(t != 0); + for (j = 0; j < 65536; j++) + ATF_REQUIRE(tran[i].func(j) == towctrans(j, t)); + } + t = wctrans("elephant"); + ATF_REQUIRE(t == 0); + for (i = 0; i < 65536; i++) + ATF_REQUIRE(towctrans(i, t) == i); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, towctrans_test); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/locale/wcrtomb_test.c (from r290532, head/lib/libc/tests/locale/wcrtomb_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/locale/wcrtomb_test.c Mon Nov 23 08:31:41 2015 (r291178, copy of r290532, head/lib/libc/tests/locale/wcrtomb_test.c) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2002 Tim J. Robbins + * 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. + */ + +/* + * Test program for wcrtomb(), as specified by IEEE Std. 1003.1-2001 and + * ISO/IEC 9899:1999. + * + * The function is tested with both the "C" ("POSIX") LC_CTYPE setting and + * "ja_JP.eucJP". Other encodings are not tested. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(wcrtomb_test); +ATF_TC_BODY(wcrtomb_test, tc) +{ + mbstate_t s; + size_t len; + char buf[MB_LEN_MAX + 1]; + + /* C/POSIX locale. */ + + ATF_REQUIRE(MB_CUR_MAX == 1); + + /* + * If the buffer argument is NULL, wc is implicitly L'\0', + * wcrtomb() resets its internal state. + */ + ATF_REQUIRE(wcrtomb(NULL, L'\0', NULL) == 1); + ATF_REQUIRE(wcrtomb(NULL, UCHAR_MAX + 1, NULL) == 1); + + /* Null wide character. */ + memset(&s, 0, sizeof(s)); + memset(buf, 0xcc, sizeof(buf)); + len = wcrtomb(buf, L'\0', &s); + ATF_REQUIRE(len == 1); + ATF_REQUIRE((unsigned char)buf[0] == 0 && (unsigned char)buf[1] == 0xcc); + + /* Latin letter A, internal state. */ + ATF_REQUIRE(wcrtomb(NULL, L'\0', NULL) == 1); + ATF_REQUIRE(wcrtomb(NULL, L'A', NULL) == 1); + + /* Latin letter A. */ + memset(&s, 0, sizeof(s)); + memset(buf, 0xcc, sizeof(buf)); + len = wcrtomb(buf, L'A', &s); + ATF_REQUIRE(len == 1); + ATF_REQUIRE((unsigned char)buf[0] == 'A' && (unsigned char)buf[1] == 0xcc); + + /* Invalid code. */ + ATF_REQUIRE(wcrtomb(buf, UCHAR_MAX + 1, NULL) == (size_t)-1); + ATF_REQUIRE(errno == EILSEQ); + + /* + * Japanese (EUC) locale. + */ + + ATF_REQUIRE(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0); + ATF_REQUIRE(MB_CUR_MAX == 3); + + /* + * If the buffer argument is NULL, wc is implicitly L'\0', *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Mon Nov 23 08:52:39 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6986A36592; Mon, 23 Nov 2015 08:52:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 814C51D91; Mon, 23 Nov 2015 08:52:39 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN8qcpQ094057; Mon, 23 Nov 2015 08:52:38 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN8qcxe094055; Mon, 23 Nov 2015 08:52:38 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230852.tAN8qcxe094055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 08:52: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: r291179 - in stable/10: contrib/netbsd-tests/kernel tests/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 08:52:39 -0000 Author: ngie Date: Mon Nov 23 08:52:38 2015 New Revision: 291179 URL: https://svnweb.freebsd.org/changeset/base/291179 Log: MFC r290911,r290912: r290911: Ignore EINTR from usleep(3) in try_locks(..) NetBSD's usleep(3) only returns -1/sets errno=EINVAL when `microseconds` is one million or more Submitted by: pho Sponsored by: EMC / Isilon Storage Division r290912: Integrate contrib/netbsd-tests/kernel/t_lockf.c into the FreeBSD test suite as tests/sys/kern/lockf_test Sponsored by: EMC / Isilon Storage Division Modified: stable/10/contrib/netbsd-tests/kernel/t_lockf.c stable/10/tests/sys/kern/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/kernel/t_lockf.c ============================================================================== --- stable/10/contrib/netbsd-tests/kernel/t_lockf.c Mon Nov 23 08:31:41 2015 (r291178) +++ stable/10/contrib/netbsd-tests/kernel/t_lockf.c Mon Nov 23 08:52:38 2015 (r291179) @@ -102,6 +102,9 @@ trylocks(int id) (void)fcntl(fd, F_SETLKW, &fl); if (usleep(sleeptime) < 0) +#if defined(__FreeBSD__) + if (errno != EINTR) +#endif err(1, "usleep"); } printf("%d: done\n", id); Modified: stable/10/tests/sys/kern/Makefile ============================================================================== --- stable/10/tests/sys/kern/Makefile Mon Nov 23 08:31:41 2015 (r291178) +++ stable/10/tests/sys/kern/Makefile Mon Nov 23 08:52:38 2015 (r291179) @@ -1,5 +1,9 @@ # $FreeBSD$ +SRCTOP= ${.CURDIR:H:H:H} +OBJTOP= ${.OBJDIR:H:H:H} +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel + TESTSDIR= ${TESTSBASE}/sys/kern ATF_TESTS_C+= kern_descrip_test @@ -10,9 +14,13 @@ TEST_METADATA.unix_seqpacket_test+= time LDADD.ptrace_test+= -lpthread LDADD.unix_seqpacket_test+= -lpthread +NETBSD_ATF_TESTS_C+= lockf_test + WARNS?= 5 TESTS_SUBDIRS+= acct TESTS_SUBDIRS+= execve +.include + .include From owner-svn-src-stable-10@freebsd.org Mon Nov 23 09:22:02 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDA30A36C99; Mon, 23 Nov 2015 09:22:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A76691DD2; Mon, 23 Nov 2015 09:22:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN9M16O002846; Mon, 23 Nov 2015 09:22:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN9M1xp002765; Mon, 23 Nov 2015 09:22:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230922.tAN9M1xp002765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 09:22: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: r291182 - stable/10/lib/libc/tests/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 09:22:02 -0000 Author: ngie Date: Mon Nov 23 09:22:01 2015 New Revision: 291182 URL: https://svnweb.freebsd.org/changeset/base/291182 Log: MFC r290909: Add some initial tests for SLIST and STAILQ macros Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/tests/sys/queue_test.c - copied unchanged from r290909, head/lib/libc/tests/sys/queue_test.c Modified: stable/10/lib/libc/tests/sys/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/sys/Makefile ============================================================================== --- stable/10/lib/libc/tests/sys/Makefile Mon Nov 23 09:17:25 2015 (r291181) +++ stable/10/lib/libc/tests/sys/Makefile Mon Nov 23 09:22:01 2015 (r291182) @@ -4,6 +4,8 @@ TESTSDIR= ${TESTSBASE}/lib/libc/sys +ATF_TESTS_C+= queue_test + # TODO: clone, lwp_create, lwp_ctl, posix_fadvise, recvmmsg, # swapcontext NETBSD_ATF_TESTS_C+= access_test Copied: stable/10/lib/libc/tests/sys/queue_test.c (from r290909, head/lib/libc/tests/sys/queue_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/sys/queue_test.c Mon Nov 23 09:22:01 2015 (r291182, copy of r290909, head/lib/libc/tests/sys/queue_test.c) @@ -0,0 +1,237 @@ +/*- + * Copyright (c) 2015 EMC Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +ATF_TC(slist_test); +ATF_TC_HEAD(slist_test, tc) +{ + + atf_tc_set_md_var(tc, "descr", "SLIST macro feature tests"); +} + +ATF_TC_BODY(slist_test, tc) +{ + SLIST_HEAD(stailhead, entry) head = SLIST_HEAD_INITIALIZER(head); + struct entry { + SLIST_ENTRY(entry) entries; + int i; + } *n1, *n2, *n3, *np; + int i, j, length; + + SLIST_INIT(&head); + + printf("Ensuring SLIST_EMPTY works\n"); + + ATF_REQUIRE(SLIST_EMPTY(&head)); + + i = length = 0; + + SLIST_FOREACH(np, &head, entries) { + length++; + } + ATF_REQUIRE_EQ(length, 0); + + printf("Ensuring SLIST_INSERT_HEAD works\n"); + + n1 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n1 != NULL); + n1->i = i++; + + SLIST_INSERT_HEAD(&head, n1, entries); + + printf("Ensuring SLIST_FIRST returns element 1\n"); + ATF_REQUIRE_EQ(SLIST_FIRST(&head), n1); + + j = length = 0; + SLIST_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 1); + + printf("Ensuring SLIST_INSERT_AFTER works\n"); + + n2 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n2 != NULL); + n2->i = i++; + + SLIST_INSERT_AFTER(n1, n2, entries); + + n3 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n3 != NULL); + n3->i = i++; + + SLIST_INSERT_AFTER(n2, n3, entries); + + j = length = 0; + SLIST_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 3); + + printf("Ensuring SLIST_REMOVE_HEAD works\n"); + + printf("Ensuring SLIST_FIRST returns element 1\n"); + ATF_REQUIRE_EQ(SLIST_FIRST(&head), n1); + + SLIST_REMOVE_HEAD(&head, entries); + + printf("Ensuring SLIST_FIRST now returns element 2\n"); + ATF_REQUIRE_EQ(SLIST_FIRST(&head), n2); + + j = 1; /* Starting point's 1 this time */ + length = 0; + SLIST_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 2); + + printf("Ensuring SLIST_REMOVE_AFTER works by removing the tail\n"); + + SLIST_REMOVE_AFTER(n2, entries); + + j = 1; /* Starting point's 1 this time */ + length = 0; + SLIST_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 1); + + printf("Ensuring SLIST_FIRST returns element 2\n"); + ATF_REQUIRE_EQ(SLIST_FIRST(&head), n2); + +} + +ATF_TC(stailq_test); +ATF_TC_HEAD(stailq_test, tc) +{ + + atf_tc_set_md_var(tc, "descr", "STAILQ macro feature tests"); +} + +ATF_TC_BODY(stailq_test, tc) +{ + STAILQ_HEAD(stailhead, entry) head = STAILQ_HEAD_INITIALIZER(head); + struct entry { + STAILQ_ENTRY(entry) entries; + int i; + } *n1, *n2, *n3, *np; + int i, j, length; + + printf("Ensuring empty STAILQs are treated properly\n"); + STAILQ_INIT(&head); + ATF_REQUIRE(STAILQ_EMPTY(&head)); + + i = length = 0; + + STAILQ_FOREACH(np, &head, entries) { + length++; + } + ATF_REQUIRE_EQ(length, 0); + + printf("Ensuring STAILQ_INSERT_HEAD works\n"); + + n1 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n1 != NULL); + n1->i = i++; + + STAILQ_INSERT_HEAD(&head, n1, entries); + + j = length = 0; + STAILQ_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 1); + + printf("Ensuring STAILQ_INSERT_TAIL works\n"); + + n2 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n2 != NULL); + n2->i = i++; + + STAILQ_INSERT_TAIL(&head, n2, entries); + + n3 = malloc(sizeof(struct entry)); + ATF_REQUIRE(n3 != NULL); + n3->i = i++; + + STAILQ_INSERT_TAIL(&head, n3, entries); + + j = length = 0; + STAILQ_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 3); + + printf("Ensuring STAILQ_REMOVE_HEAD works\n"); + + STAILQ_REMOVE_HEAD(&head, entries); + + j = 1; /* Starting point's 1 this time */ + length = 0; + STAILQ_FOREACH(np, &head, entries) { + ATF_REQUIRE_EQ_MSG(np->i, j, + "%d (entry counter) != %d (counter)", np->i, j); + j++; + length++; + } + ATF_REQUIRE_EQ(length, 2); + +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, slist_test); + ATF_TP_ADD_TC(tp, stailq_test); + + return (atf_no_error()); +} From owner-svn-src-stable-10@freebsd.org Mon Nov 23 09:26:55 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3533DA36DB7; Mon, 23 Nov 2015 09:26:55 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 008011FE6; Mon, 23 Nov 2015 09:26:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN9QsiC003080; Mon, 23 Nov 2015 09:26:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN9Qsxg003078; Mon, 23 Nov 2015 09:26:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230926.tAN9Qsxg003078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 09:26: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: r291183 - in stable/10: etc/mtree tests/sys/kern tests/sys/kern/pipe tools/regression/pipe X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 09:26:55 -0000 Author: ngie Date: Mon Nov 23 09:26:53 2015 New Revision: 291183 URL: https://svnweb.freebsd.org/changeset/base/291183 Log: MFC r290914: Integrate tools/regression/pipe in to the FreeBSD test suite as tests/sys/kern/pipe - Fix style(9) bugs - Fix compiler warnings - Use `nitems(x)` instead of `sizeof(x) / sizeof(*x)` pattern The testcases will be converted over to ATF eventually, but for now will be integrated in as plain C tests Sponsored by: EMC / Isilon Storage Division Added: stable/10/tests/sys/kern/pipe/ - copied from r290914, head/tests/sys/kern/pipe/ Deleted: stable/10/tools/regression/pipe/ Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/tests/sys/kern/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Mon Nov 23 09:22:01 2015 (r291182) +++ stable/10/etc/mtree/BSD.tests.dist Mon Nov 23 09:26:53 2015 (r291183) @@ -201,6 +201,8 @@ .. execve .. + pipe + .. .. kqueue .. Modified: stable/10/tests/sys/kern/Makefile ============================================================================== --- stable/10/tests/sys/kern/Makefile Mon Nov 23 09:22:01 2015 (r291182) +++ stable/10/tests/sys/kern/Makefile Mon Nov 23 09:26:53 2015 (r291183) @@ -20,6 +20,7 @@ WARNS?= 5 TESTS_SUBDIRS+= acct TESTS_SUBDIRS+= execve +TESTS_SUBDIRS+= pipe .include From owner-svn-src-stable-10@freebsd.org Mon Nov 23 09:32:34 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E8ABA3500B; Mon, 23 Nov 2015 09:32:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE313145D; Mon, 23 Nov 2015 09:32:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN9WXhM005903; Mon, 23 Nov 2015 09:32:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN9WWHZ005893; Mon, 23 Nov 2015 09:32:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511230932.tAN9WWHZ005893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 23 Nov 2015 09:32: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: r291184 - in stable/10/sys: dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 modules/mlx5en X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 09:32:34 -0000 Author: hselasky Date: Mon Nov 23 09:32:32 2015 New Revision: 291184 URL: https://svnweb.freebsd.org/changeset/base/291184 Log: MFC r290650, r290709, r291067, r291068, r291069 and r291070: Add mlx5 and mlx5en driver(s) for ConnectX-4 and ConnectX-4LX cards from Mellanox Technologies. The current driver supports ethernet speeds up to and including 100 GBit/s. Infiniband support will be done later. The code added is not compiled by default, which will be done by a separate commit. Sponsored by: Mellanox Technologies Differential Revision: https://reviews.freebsd.org/D4177 Differential Revision: https://reviews.freebsd.org/D4178 Differential Revision: https://reviews.freebsd.org/D4179 Differential Revision: https://reviews.freebsd.org/D4180 Added: stable/10/sys/dev/mlx5/ - copied from r290650, head/sys/dev/mlx5/ stable/10/sys/modules/mlx5/ - copied from r290650, head/sys/modules/mlx5/ stable/10/sys/modules/mlx5en/ - copied from r290650, head/sys/modules/mlx5en/ Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/10/sys/dev/mlx5/mlx5_en/en.h stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c stable/10/sys/dev/mlx5/mlx5_en/tcp_tlro.c stable/10/sys/dev/mlx5/mlx5_en/tcp_tlro.h stable/10/sys/modules/mlx5/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Nov 23 09:32:32 2015 (r291184) @@ -115,7 +115,7 @@ static void print_health_info(struct mlx printf("mlx5_core: INFO: ""ext_sync 0x%04x\n", read_be16(&h->ext_sync)); } -static void poll_health(uintptr_t data) +static void poll_health(unsigned long data) { struct mlx5_core_dev *dev = (struct mlx5_core_dev *)data; struct mlx5_core_health *health = &dev->priv.health; @@ -155,7 +155,7 @@ void mlx5_start_health_poll(struct mlx5_ health->health = &dev->iseg->health; health->health_counter = &dev->iseg->health_counter; - setup_timer(&health->timer, poll_health, (uintptr_t)dev); + setup_timer(&health->timer, poll_health, (unsigned long)dev); mod_timer(&health->timer, round_jiffies(jiffies + MLX5_HEALTH_POLL_INTERVAL)); } Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_en/en.h Mon Nov 23 09:32:32 2015 (r291184) @@ -74,9 +74,9 @@ #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xd /* freeBSD HW LRO is limited by 16KB - the size of max mbuf */ -#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES +#define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ MJUM16BYTES #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC 0x10 -#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 +#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3 #define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC 0x10 #define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS 0x20 @@ -89,13 +89,14 @@ ((swmtu) + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN)) #define MLX5E_SW2MB_MTU(swmtu) \ (MLX5E_SW2HW_MTU(swmtu) + MLX5E_NET_IP_ALIGN) -#define MLX5E_MTU_MIN 72 /* Min MTU allowed by the kernel */ -#define MLX5E_MTU_MAX MIN(ETHERMTU_JUMBO, MJUM16BYTES) /* Max MTU of Ethernet jumbo frames */ +#define MLX5E_MTU_MIN 72 /* Min MTU allowed by the kernel */ +#define MLX5E_MTU_MAX MIN(ETHERMTU_JUMBO, MJUM16BYTES) /* Max MTU of Ethernet + * jumbo frames */ #define MLX5E_BUDGET_MAX 8192 /* RX and TX */ #define MLX5E_RX_BUDGET_MAX 256 #define MLX5E_SQ_BF_BUDGET 16 -#define MLX5E_SQ_TX_QUEUE_SIZE 4096 /* SQ drbr queue size */ +#define MLX5E_SQ_TX_QUEUE_SIZE 4096 /* SQ drbr queue size */ #define MLX5E_MAX_TX_NUM_TC 8 /* units */ #define MLX5E_MAX_TX_HEADER 128 /* bytes */ @@ -141,6 +142,7 @@ typedef void (mlx5e_cq_comp_t)(struct ml m(+1, u64 rx_broadcast_bytes, "rx_broadcast_bytes", "Received broadcast bytes") \ m(+1, u64 tx_broadcast_packets, "tx_broadcast_packets", "Transmitted broadcast packets") \ m(+1, u64 tx_broadcast_bytes, "tx_broadcast_bytes", "Transmitted broadcast bytes") \ + m(+1, u64 rx_out_of_buffer, "rx_out_of_buffer", "Receive out of buffer, no recv wqes events") \ /* SW counters */ \ m(+1, u64 tso_packets, "tso_packets", "Transmitted TSO packets") \ m(+1, u64 tso_bytes, "tso_bytes", "Transmitted TSO bytes") \ @@ -158,9 +160,10 @@ typedef void (mlx5e_cq_comp_t)(struct ml #define MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT)) struct mlx5e_vport_stats { - struct sysctl_ctx_list ctx; + struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_VPORT_STATS(MLX5E_STATS_VAR) + u32 rx_out_of_buffer_prev; }; #define MLX5E_PPORT_IEEE802_3_STATS(m) \ @@ -224,7 +227,7 @@ struct mlx5e_vport_stats { m(+1, u64 out_multicast_pkts, "out_multicast_pkts", "Out multicast packets") \ m(+1, u64 out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") -#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ +#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(m) \ m(+1, u64 time_since_last_clear, "time_since_last_clear", \ "Time since the last counters clear event (msec)") \ m(+1, u64 symbol_errors, "symbol_errors", "Symbol errors") \ @@ -265,17 +268,13 @@ struct mlx5e_vport_stats { m(+1, u64 rs_corrected_symbols_lane3, "rs_corrected_symbols_lane3", \ "FEC corrected symbol counter lane 3") \ -#define MLX5E_PPORT_Q_CONTERS(m) \ - m(+1, u64 out_of_rx_buffer, "out_of_rx_buffer", "out of rx buffers aka no recv wqes events") - /* * Make sure to update mlx5e_update_pport_counters() * when adding a new MLX5E_PPORT_STATS block */ #define MLX5E_PPORT_STATS(m) \ MLX5E_PPORT_IEEE802_3_STATS(m) \ - MLX5E_PPORT_RFC2819_STATS(m) \ - MLX5E_PPORT_Q_CONTERS(m) + MLX5E_PPORT_RFC2819_STATS(m) #define MLX5E_PORT_STATS_DEBUG(m) \ MLX5E_PPORT_RFC2819_STATS_DEBUG(m) \ @@ -293,19 +292,19 @@ struct mlx5e_vport_stats { (0 MLX5E_PPORT_RFC2819_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PPORT_RFC2863_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_RFC2863_STATS_DEBUG(MLX5E_STATS_COUNT)) -#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM \ +#define MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM \ (0 MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG(MLX5E_STATS_COUNT)) #define MLX5E_PORT_STATS_DEBUG_NUM \ (0 MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_COUNT)) struct mlx5e_pport_stats { - struct sysctl_ctx_list ctx; + struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_PPORT_STATS(MLX5E_STATS_VAR) }; struct mlx5e_port_stats_debug { - struct sysctl_ctx_list ctx; + struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_VAR) }; @@ -322,7 +321,7 @@ struct mlx5e_port_stats_debug { #define MLX5E_RQ_STATS_NUM (0 MLX5E_RQ_STATS(MLX5E_STATS_COUNT)) struct mlx5e_rq_stats { - struct sysctl_ctx_list ctx; + struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_RQ_STATS(MLX5E_STATS_VAR) }; @@ -339,7 +338,7 @@ struct mlx5e_rq_stats { #define MLX5E_SQ_STATS_NUM (0 MLX5E_SQ_STATS(MLX5E_STATS_COUNT)) struct mlx5e_sq_stats { - struct sysctl_ctx_list ctx; + struct sysctl_ctx_list ctx; u64 arg [0]; MLX5E_SQ_STATS(MLX5E_STATS_VAR) }; @@ -362,8 +361,8 @@ struct mlx5e_params { u16 tx_cq_moderation_usec; u16 tx_cq_moderation_pkts; u16 min_rx_wqes; - bool hw_lro_en; - u32 lro_wqe_sz; + bool hw_lro_en; + u32 lro_wqe_sz; u16 rx_hash_log_tbl_sz; }; @@ -393,31 +392,31 @@ struct mlx5e_params_ethtool { /* EEPROM Standards for plug in modules */ #ifndef MLX5E_ETH_MODULE_SFF_8472 -#define MLX5E_ETH_MODULE_SFF_8472 0x1 -#define MLX5E_ETH_MODULE_SFF_8472_LEN 128 +#define MLX5E_ETH_MODULE_SFF_8472 0x1 +#define MLX5E_ETH_MODULE_SFF_8472_LEN 128 #endif #ifndef MLX5E_ETH_MODULE_SFF_8636 -#define MLX5E_ETH_MODULE_SFF_8636 0x2 -#define MLX5E_ETH_MODULE_SFF_8636_LEN 256 +#define MLX5E_ETH_MODULE_SFF_8636 0x2 +#define MLX5E_ETH_MODULE_SFF_8636_LEN 256 #endif #ifndef MLX5E_ETH_MODULE_SFF_8436 -#define MLX5E_ETH_MODULE_SFF_8436 0x3 -#define MLX5E_ETH_MODULE_SFF_8436_LEN 256 +#define MLX5E_ETH_MODULE_SFF_8436 0x3 +#define MLX5E_ETH_MODULE_SFF_8436_LEN 256 #endif /* EEPROM I2C Addresses */ -#define MLX5E_I2C_ADDR_LOW 0x50 -#define MLX5E_I2C_ADDR_HIGH 0x51 +#define MLX5E_I2C_ADDR_LOW 0x50 +#define MLX5E_I2C_ADDR_HIGH 0x51 -#define MLX5E_EEPROM_LOW_PAGE 0x0 -#define MLX5E_EEPROM_HIGH_PAGE 0x3 +#define MLX5E_EEPROM_LOW_PAGE 0x0 +#define MLX5E_EEPROM_HIGH_PAGE 0x3 -#define MLX5E_EEPROM_HIGH_PAGE_OFFSET 128 -#define MLX5E_EEPROM_PAGE_LENGTH 256 +#define MLX5E_EEPROM_HIGH_PAGE_OFFSET 128 +#define MLX5E_EEPROM_PAGE_LENGTH 256 -#define MLX5E_EEPROM_INFO_BYTES 0x3 +#define MLX5E_EEPROM_INFO_BYTES 0x3 struct mlx5e_cq { /* data path - accessed per cqe */ @@ -432,9 +431,9 @@ struct mlx5e_cq { } __aligned(MLX5E_CACHELINE_SIZE); struct mlx5e_rq_mbuf { - bus_dmamap_t dma_map; - caddr_t data; - struct mbuf *mbuf; + bus_dmamap_t dma_map; + caddr_t data; + struct mbuf *mbuf; }; struct mlx5e_rq { @@ -476,9 +475,9 @@ enum { struct mlx5e_sq { /* data path */ - struct mtx lock; + struct mtx lock; bus_dma_tag_t dma_tag; - struct mtx comp_lock; + struct mtx comp_lock; /* dirtied @completion */ u16 cc; @@ -486,31 +485,31 @@ struct mlx5e_sq { /* dirtied @xmit */ u16 pc __aligned(MLX5E_CACHELINE_SIZE); u16 bf_offset; - struct mlx5e_sq_stats stats; + struct mlx5e_sq_stats stats; - struct mlx5e_cq cq; - struct task sq_task; - struct taskqueue *sq_tq; + struct mlx5e_cq cq; + struct task sq_task; + struct taskqueue *sq_tq; /* pointers to per packet info: write@xmit, read@completion */ - struct mlx5e_sq_mbuf *mbuf; - struct buf_ring *br; + struct mlx5e_sq_mbuf *mbuf; + struct buf_ring *br; /* read only */ - struct mlx5_wq_cyc wq; - void __iomem *uar_map; - void __iomem *uar_bf_map; + struct mlx5_wq_cyc wq; + void __iomem *uar_map; + void __iomem *uar_bf_map; u32 sqn; u32 bf_buf_size; - struct device *pdev; + struct device *pdev; u32 mkey_be; /* control path */ - struct mlx5_wq_ctrl wq_ctrl; - struct mlx5_uar uar; - struct mlx5e_channel *channel; + struct mlx5_wq_ctrl wq_ctrl; + struct mlx5_uar uar; + struct mlx5e_channel *channel; int tc; - unsigned int queue_state; + unsigned int queue_state; } __aligned(MLX5E_CACHELINE_SIZE); static inline bool @@ -618,7 +617,7 @@ struct mlx5e_priv { u32 tdn; struct mlx5_core_mr mr; - struct mlx5e_channel * volatile *channel; + struct mlx5e_channel *volatile *channel; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; u32 tirn[MLX5E_NUM_TT]; @@ -665,15 +664,15 @@ struct mlx5e_rx_wqe { }; struct mlx5e_eeprom { - int lock_bit; - int i2c_addr; - int page_num; - int device_addr; - int module_num; - int len; - int type; - int page_valid; - u32 *data; + int lock_bit; + int i2c_addr; + int page_num; + int device_addr; + int module_num; + int len; + int type; + int page_valid; + u32 *data; }; enum mlx5e_link_mode { @@ -717,7 +716,7 @@ int mlx5e_close_locked(struct ifnet *); void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int event); void mlx5e_rx_cq_comp(struct mlx5_core_cq *); void mlx5e_tx_cq_comp(struct mlx5_core_cq *); -struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); +struct mlx5_cqe64 *mlx5e_get_cqe(struct mlx5e_cq *cq); void mlx5e_tx_que(void *context, int pending); int mlx5e_open_flow_table(struct mlx5e_priv *priv); Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Nov 23 09:32:32 2015 (r291184) @@ -184,8 +184,14 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARG } if (priv->ifp->if_capenable & IFCAP_LRO) priv->params.hw_lro_en = !!MLX5_CAP_ETH(priv->mdev, lro_cap); - } - else { + else { + /* set the correct (0) value to params_ethtool.hw_lro, issue a warning and return error */ + priv->params_ethtool.hw_lro = 0; + error = EINVAL; + if_printf(priv->ifp, "Can't set HW_LRO to a device with LRO turned off"); + goto done; + } + } else { priv->params.hw_lro_en = false; } @@ -236,7 +242,7 @@ mlx5e_get_eeprom_info(struct mlx5e_priv case SFF_8024_ID_QSFPPLUS: case SFF_8024_ID_QSFP28: if ((data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) == SFF_8024_ID_QSFP28 || - ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) { + ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) { eeprom->type = MLX5E_ETH_MODULE_SFF_8636; eeprom->len = MLX5E_ETH_MODULE_SFF_8636_LEN; } else { @@ -251,8 +257,9 @@ mlx5e_get_eeprom_info(struct mlx5e_priv eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN; break; default: - if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x\n", - __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK); + if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n", + __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK, + sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]); return (EINVAL); } return (0); @@ -273,7 +280,7 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv while (ee->device_addr < ee->len) { ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr, ee->len - ee->device_addr, ee->module_num, - ee->data + (ee->device_addr/4), &size_read); + ee->data + (ee->device_addr / 4), &size_read); if (ret) { if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " "error = 0x%02x\n", __func__, __LINE__, ret); @@ -290,8 +297,8 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv while (ee->device_addr < MLX5E_EEPROM_PAGE_LENGTH) { ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr, MLX5E_EEPROM_PAGE_LENGTH - ee->device_addr, - ee->module_num, ee->data + (ee->len/4) + - ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET)/4), + ee->module_num, ee->data + (ee->len / 4) + + ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4), &size_read); if (ret) { if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " @@ -313,9 +320,9 @@ mlx5e_print_eeprom(struct mlx5e_eeprom * printf("\nOffset\t\tValues\n"); printf("------\t\t------\n"); while (row < eeprom->len) { - printf("0x%04x\t\t",row); + printf("0x%04x\t\t", row); for (i = 0; i < 16; i++) { - printf("%02x ", ((u8*)eeprom->data)[j]); + printf("%02x ", ((u8 *)eeprom->data)[j]); j++; row++; } @@ -328,9 +335,9 @@ mlx5e_print_eeprom(struct mlx5e_eeprom * printf("\nOffset\t\tValues\n"); printf("------\t\t------\n"); while (row < MLX5E_EEPROM_PAGE_LENGTH) { - printf("0x%04x\t\t",row); + printf("0x%04x\t\t", row); for (i = 0; i < 16; i++) { - printf("%02x ", ((u8*)eeprom->data)[j]); + printf("%02x ", ((u8 *)eeprom->data)[j]); j++; row++; } @@ -377,8 +384,10 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) error = 0; goto done; } - - /* Allocate needed length buffer and additional space for the 3rd */ + /* + * Allocate needed length buffer and additional space for + * page 0x03 + */ eeprom.data = malloc(eeprom.len + MLX5E_EEPROM_PAGE_LENGTH, M_MLX5EN, M_WAITOK | M_ZERO); @@ -388,9 +397,11 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n", __func__, __LINE__); error = 0; - /* Continue printing partial information in case of an error */ + /* + * Continue printing partial information in case of + * an error + */ } - mlx5e_print_eeprom(&eeprom); free(eeprom.data, M_MLX5EN); } @@ -490,4 +501,3 @@ mlx5e_create_ethtool(struct mlx5e_priv * CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, mlx5e_read_eeprom, "I", "EEPROM information"); } - Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Nov 23 09:32:32 2015 (r291184) @@ -270,7 +270,6 @@ mlx5e_add_eth_addr_rule_sub(struct mlx5e } ai->tt_vec |= (1 << MLX5E_TT_ANY); } - match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; MLX5_SET_TO_ONES(fte_match_param, match_criteria, outer_headers.ethertype); @@ -288,7 +287,6 @@ mlx5e_add_eth_addr_rule_sub(struct mlx5e } ai->tt_vec |= (1 << MLX5E_TT_IPV4); } - if (tt_vec & (1 << MLX5E_TT_IPV6)) { MLX5_SET(fte_match_param, match_value, outer_headers.ethertype, ETHERTYPE_IPV6); @@ -381,7 +379,6 @@ mlx5e_add_eth_addr_rule(struct mlx5e_pri err = -ENOMEM; goto add_eth_addr_rule_out; } - err = mlx5e_add_eth_addr_rule_sub(priv, ai, type, flow_context, match_criteria); if (err) @@ -423,12 +420,12 @@ mlx5e_add_vlan_rule(struct mlx5e_priv *p dest = MLX5_ADDR_OF(flow_context, flow_context, destination); MLX5_SET(flow_context, flow_context, action, - MLX5_FLOW_CONTEXT_ACTION_FWD_DEST); + MLX5_FLOW_CONTEXT_ACTION_FWD_DEST); MLX5_SET(flow_context, flow_context, destination_list_size, 1); MLX5_SET(dest_format_struct, dest, destination_type, - MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE); + MLX5_FLOW_CONTEXT_DEST_TYPE_FLOW_TABLE); MLX5_SET(dest_format_struct, dest, destination_id, - mlx5_get_flow_table_id(priv->ft.main)); + mlx5_get_flow_table_id(priv->ft.main)); match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; MLX5_SET_TO_ONES(fte_match_param, match_criteria, Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Nov 23 09:32:32 2015 (r291184) @@ -261,7 +261,6 @@ mlx5e_media_change(struct ifnet *dev) error = EINVAL; goto done; } - link_mode = mlx5e_find_link_mode(IFM_SUBTYPE(priv->media.ifm_media)); error = mlx5_query_port_proto_cap(mdev, ð_proto_cap, MLX5_PTYS_EN); @@ -279,7 +278,6 @@ mlx5e_media_change(struct ifnet *dev) error = EINVAL; goto done; } - mlx5_set_port_status(mdev, MLX5_PORT_DOWN); mlx5_set_port_proto(mdev, link_mode, MLX5_PTYS_EN); mlx5_set_port_status(mdev, MLX5_PORT_UP); @@ -315,7 +313,7 @@ mlx5e_update_pport_counters(struct mlx5e unsigned x; unsigned y; - in = mlx5_vzalloc(sz); + in = mlx5_vzalloc(sz); out = mlx5_vzalloc(sz); if (in == NULL || out == NULL) goto free_out; @@ -334,7 +332,7 @@ mlx5e_update_pport_counters(struct mlx5e for (x = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM; x++, y++) s->arg[y] = be64toh(ptr[x]); for (y = 0; x != MLX5E_PPORT_RFC2819_STATS_NUM + - MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++) + MLX5E_PPORT_RFC2819_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2863_COUNTERS_GROUP); @@ -343,8 +341,8 @@ mlx5e_update_pport_counters(struct mlx5e s_debug->arg[y] = be64toh(ptr[x]); MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP); - mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); - for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++) + mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0); + for (x = 0; x != MLX5E_PPORT_PHYSICAL_LAYER_STATS_DEBUG_NUM; x++, y++) s_debug->arg[y] = be64toh(ptr[x]); free_out: kvfree(in); @@ -364,6 +362,7 @@ mlx5e_update_stats_work(struct work_stru #if (__FreeBSD_version < 1100000) struct ifnet *ifp = priv->ifp; #endif + u32 in[MLX5_ST_SZ_DW(query_vport_counter_in)]; u32 *out; int outlen = MLX5_ST_SZ_BYTES(query_vport_counter_out); @@ -378,7 +377,7 @@ mlx5e_update_stats_work(struct work_stru u64 sw_lro_flushed = 0; u64 rx_csum_none = 0; u64 rx_wqe_err = 0; - u32 out_of_rx_buffer = 0; + u32 rx_out_of_buffer = 0; int i; int j; @@ -440,6 +439,16 @@ mlx5e_update_stats_work(struct work_stru memset(out, 0, outlen); + /* get number of out-of-buffer drops first */ + if (mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, + &rx_out_of_buffer)) + goto free_out; + + /* accumulate difference into a 64-bit counter */ + s->rx_out_of_buffer += (u64)(u32)(rx_out_of_buffer - s->rx_out_of_buffer_prev); + s->rx_out_of_buffer_prev = rx_out_of_buffer; + + /* get port statistics */ if (mlx5_cmd_exec(mdev, in, sizeof(in), out, outlen)) goto free_out; @@ -485,7 +494,8 @@ mlx5e_update_stats_work(struct work_stru s->rx_packets = s->rx_unicast_packets + s->rx_multicast_packets + - s->rx_broadcast_packets; + s->rx_broadcast_packets - + s->rx_out_of_buffer; s->rx_bytes = s->rx_unicast_bytes + s->rx_multicast_bytes + @@ -503,10 +513,14 @@ mlx5e_update_stats_work(struct work_stru s->tx_csum_offload = s->tx_packets - tx_offload_none; s->rx_csum_good = s->rx_packets - s->rx_csum_none; + /* Update per port counters */ + mlx5e_update_pport_counters(priv); + #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; - ifp->if_ierrors = s->rx_error_packets; + ifp->if_ierrors = s->rx_error_packets; + ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; @@ -514,12 +528,6 @@ mlx5e_update_stats_work(struct work_stru ifp->if_obytes = s->tx_bytes; #endif - mlx5_vport_query_out_of_rx_buffer(mdev, priv->counter_set_id, - &out_of_rx_buffer); - - /* Update per port counters */ - mlx5e_update_pport_counters(priv); - priv->stats.pport.out_of_rx_buffer = (u64)out_of_rx_buffer; free_out: kvfree(out); PRIV_UNLOCK(priv); @@ -596,18 +604,18 @@ mlx5e_create_rq(struct mlx5e_channel *c, /* Create DMA descriptor TAG */ if ((err = -bus_dma_tag_create( - bus_get_dma_tag(mdev->pdev->dev.bsddev), - 1, /* any alignment */ - 0, /* no boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MJUM16BYTES, /* maxsize */ - 1, /* nsegments */ - MJUM16BYTES, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockfuncarg */ - &rq->dma_tag))) + bus_get_dma_tag(mdev->pdev->dev.bsddev), + 1, /* any alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MJUM16BYTES, /* maxsize */ + 1, /* nsegments */ + MJUM16BYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &rq->dma_tag))) goto done; err = mlx5_wq_ll_create(mdev, ¶m->wq, rqc_wq, &rq->wq, @@ -617,10 +625,9 @@ mlx5e_create_rq(struct mlx5e_channel *c, rq->wq.db = &rq->wq.db[MLX5_RCV_DBR]; - if (priv->params.hw_lro_en) { + if (priv->params.hw_lro_en) { rq->wqe_sz = priv->params.lro_wqe_sz; - } - else { + } else { rq->wqe_sz = MLX5E_SW2MB_MTU(priv->ifp->if_mtu); } if (rq->wqe_sz > MJUM16BYTES) { @@ -642,7 +649,6 @@ mlx5e_create_rq(struct mlx5e_channel *c, err = -ENOMEM; goto err_rq_wq_destroy; } - for (i = 0; i != wq_sz; i++) { struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i); uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN; @@ -744,7 +750,7 @@ mlx5e_enable_rq(struct mlx5e_rq *rq, str MLX5_SET(rqc, rqc, state, MLX5_RQC_STATE_RST); MLX5_SET(rqc, rqc, flush_in_error_en, 1); if (priv->counter_set_id >= 0) - MLX5_SET(rqc, rqc, counter_set_id, priv->counter_set_id); + MLX5_SET(rqc, rqc, counter_set_id, priv->counter_set_id); MLX5_SET(wq, wq, log_wq_pg_sz, rq->wq_ctrl.buf.page_shift - PAGE_SHIFT); MLX5_SET64(wq, wq, dbr_addr, rq->wq_ctrl.db.dma); @@ -929,18 +935,18 @@ mlx5e_create_sq(struct mlx5e_channel *c, /* Create DMA descriptor TAG */ if ((err = -bus_dma_tag_create( - bus_get_dma_tag(mdev->pdev->dev.bsddev), - 1, /* any alignment */ - 0, /* no boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MLX5E_MAX_TX_PAYLOAD_SIZE, /* maxsize */ - MLX5E_MAX_TX_MBUF_FRAGS, /* nsegments */ - MLX5E_MAX_TX_MBUF_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockfuncarg */ - &sq->dma_tag))) + bus_get_dma_tag(mdev->pdev->dev.bsddev), + 1, /* any alignment */ + 0, /* no boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MLX5E_MAX_TX_PAYLOAD_SIZE, /* maxsize */ + MLX5E_MAX_TX_MBUF_FRAGS, /* nsegments */ + MLX5E_MAX_TX_MBUF_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &sq->dma_tag))) goto done; err = mlx5_alloc_map_uar(mdev, &sq->uar); @@ -954,7 +960,7 @@ mlx5e_create_sq(struct mlx5e_channel *c, sq->wq.db = &sq->wq.db[MLX5_SND_DBR]; sq->uar_map = sq->uar.map; - sq->uar_bf_map = sq->uar.bf_map; + sq->uar_bf_map = sq->uar.bf_map; sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; err = mlx5e_alloc_sq_db(sq); @@ -983,10 +989,10 @@ mlx5e_create_sq(struct mlx5e_channel *c, err = -ENOMEM; goto err_free_drbr; } + TASK_INIT(&sq->sq_task, 0, mlx5e_tx_que, sq); taskqueue_start_threads(&sq->sq_tq, 1, PI_NET, "%s tx sq", - c->ifp->if_xname); - + c->ifp->if_xname); snprintf(buffer, sizeof(buffer), "txstat%dtc%d", c->ix, tc); mlx5e_create_stats(&sq->stats.ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), @@ -1418,7 +1424,7 @@ mlx5e_chan_mtx_destroy(struct mlx5e_chan static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, struct mlx5e_channel_param *cparam, - struct mlx5e_channel * volatile *cp) + struct mlx5e_channel *volatile *cp) { struct mlx5e_channel *c; u8 rx_moderation_mode; @@ -1496,7 +1502,7 @@ err_free: } static void -mlx5e_close_channel(struct mlx5e_channel * volatile *pp) +mlx5e_close_channel(struct mlx5e_channel *volatile *pp) { struct mlx5e_channel *c = *pp; @@ -1508,7 +1514,7 @@ mlx5e_close_channel(struct mlx5e_channel } static void -mlx5e_close_channel_wait(struct mlx5e_channel * volatile *pp) +mlx5e_close_channel_wait(struct mlx5e_channel *volatile *pp) { struct mlx5e_channel *c = *pp; @@ -1805,19 +1811,17 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *p MLX5_HASH_FIELD_SEL_IPSEC_SPI) if (priv->params.hw_lro_en) { - MLX5_SET(tirc, tirc, lro_enable_mask, - MLX5_TIRC_LRO_ENABLE_MASK_IPV4_LRO | - MLX5_TIRC_LRO_ENABLE_MASK_IPV6_LRO); - MLX5_SET(tirc, tirc, lro_max_msg_sz, - (priv->params.lro_wqe_sz - - ROUGH_MAX_L2_L3_HDR_SZ) >> 8); + MLX5_SET(tirc, tirc, lro_enable_mask, + MLX5_TIRC_LRO_ENABLE_MASK_IPV4_LRO | + MLX5_TIRC_LRO_ENABLE_MASK_IPV6_LRO); + MLX5_SET(tirc, tirc, lro_max_msg_sz, + (priv->params.lro_wqe_sz - + ROUGH_MAX_L2_L3_HDR_SZ) >> 8); /* TODO: add the option to choose timer value dynamically */ - MLX5_SET(tirc, tirc, lro_timeout_period_usecs, - MLX5_CAP_ETH(priv->mdev, - lro_timer_supported_periods[2])); + MLX5_SET(tirc, tirc, lro_timeout_period_usecs, + MLX5_CAP_ETH(priv->mdev, + lro_timer_supported_periods[2])); } - - switch (tt) { case MLX5E_TT_ANY: MLX5_SET(tirc, tirc, disp_type, @@ -2011,6 +2015,7 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp err = mlx5_set_port_mtu(mdev, 0); if (err) return (err); + err = mlx5_query_port_oper_mtu(mdev, &min_mtu); if (err) { if_printf(ifp, "Query port minimal MTU failed\n"); @@ -2178,6 +2183,9 @@ mlx5e_get_counter(struct ifnet *ifp, ift case IFCOUNTER_IERRORS: retval = priv->stats.vport.rx_error_packets; break; + case IFCOUNTER_IQDROPS: + retval = priv->stats.vport.rx_out_of_buffer; + break; case IFCOUNTER_OPACKETS: retval = priv->stats.vport.tx_packets; break; @@ -2330,7 +2338,6 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co ifp->if_capenable ^= IFCAP_RXCSUM; if (mask & IFCAP_RXCSUM_IPV6) ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; - if (mask & IFCAP_TSO4) { if (!(IFCAP_TSO4 & ifp->if_capenable) && !(IFCAP_TXCSUM & ifp->if_capenable)) { @@ -2351,7 +2358,6 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co ifp->if_capenable ^= IFCAP_TSO6; ifp->if_hwassist ^= CSUM_IP6_TSO; } - if (mask & IFCAP_VLAN_HWFILTER) { if (ifp->if_capenable & IFCAP_VLAN_HWFILTER) mlx5e_disable_vlan_filter(priv); @@ -2362,13 +2368,12 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co } if (mask & IFCAP_VLAN_HWTAGGING) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; - if (mask & IFCAP_WOL_MAGIC) ifp->if_capenable ^= IFCAP_WOL_MAGIC; VLAN_CAPABILITIES(ifp); /* turn off LRO means also turn of HW LRO - if it's on */ - if (mask & IFCAP_LRO ) { + if (mask & IFCAP_LRO) { int was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); bool need_restart = false; @@ -2378,7 +2383,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long co priv->params.hw_lro_en = false; need_restart = true; /* Not sure this is the correct way */ - priv->params_ethtool.hw_lro = priv->params.hw_lro_en; + priv->params_ethtool.hw_lro = priv->params.hw_lro_en; } } if (was_opened && need_restart) { @@ -2393,7 +2398,10 @@ out: case SIOCGI2C: ifr = (struct ifreq *)data; - /* Copy from the user-space address ifr_data to the kernel-space address i2c */ + /* + * Copy from the user-space address ifr_data to the + * kernel-space address i2c + */ error = copyin(ifr->ifr_data, &i2c, sizeof(i2c)); if (error) break; @@ -2503,11 +2511,10 @@ mlx5e_build_ifp_priv(struct mlx5_core_de priv->params.default_vlan_prio = 0; priv->counter_set_id = -1; - /* - * hw lro is currently defaulted to off. - * when it won't anymore we will consider the - * HW capability: "!!MLX5_CAP_ETH(mdev, lro_cap)" - */ + /* + * hw lro is currently defaulted to off. when it won't anymore we + * will consider the HW capability: "!!MLX5_CAP_ETH(mdev, lro_cap)" + */ priv->params.hw_lro_en = false; priv->params.lro_wqe_sz = MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ; @@ -2581,11 +2588,12 @@ mlx5e_priv_mtx_destroy(struct mlx5e_priv static int sysctl_firmware(SYSCTL_HANDLER_ARGS) { - /* %d.%d%.d the string format. + /* + * %d.%d%.d the string format. * fw_rev_{maj,min,sub} return u16, 2^16 = 65536. * We need at most 5 chars to store that. - * it also has: two "." and NULL at the end. - * Which means we need 18 (5*3 + 3) chars at most. + * It also has: two "." and NULL at the end, which means we need 18 + * (5*3 + 3) chars at most. */ char fw[18]; struct mlx5e_priv *priv = arg1; @@ -2690,6 +2698,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *m mlx5_core_err(mdev, "SYSCTL_ADD_NODE() failed\n"); goto err_free_sysctl; } + /* HW sysctl tree */ child = SYSCTL_CHILDREN(device_get_sysctl_tree(mdev->pdev->dev.bsddev)); priv->sysctl_hw = SYSCTL_ADD_NODE(&priv->sysctl_ctx, child, @@ -2698,9 +2707,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *m mlx5_core_err(mdev, "SYSCTL_ADD_NODE() failed\n"); goto err_free_sysctl; } - mlx5e_build_ifp_priv(mdev, priv, ncv); - err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n", @@ -2713,15 +2720,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *m __func__, err); goto err_unmap_free_uar; } - err = mlx5_alloc_transport_domain(mdev, &priv->tdn); - if (err) { if_printf(ifp, "%s: mlx5_alloc_transport_domain failed, %d\n", - __func__, err); + __func__, err); goto err_dealloc_pd; } - err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr); if (err) { if_printf(ifp, "%s: mlx5e_create_mkey failed, %d\n", Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Nov 10 12:20:22 2015 (r290650) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Mon Nov 23 09:32:32 2015 (r291184) @@ -95,7 +95,7 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq) } static void -mlx5e_lro_update_hdr(struct mbuf* mb, struct mlx5_cqe64 *cqe) +mlx5e_lro_update_hdr(struct mbuf *mb, struct mlx5_cqe64 *cqe) { /* TODO: consider vlans, ip options, ... */ struct ether_header *eh; @@ -109,8 +109,8 @@ mlx5e_lro_update_hdr(struct mbuf* mb, st eh_type = ntohs(eh->ether_type); u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); - int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || - (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); + int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || + (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); /* TODO: consider vlan */ u16 tot_len = be32_to_cpu(cqe->byte_cnt) - ETHER_HDR_LEN; @@ -131,15 +131,16 @@ mlx5e_lro_update_hdr(struct mbuf* mb, st ts_ptr = (uint32_t *)(th + 1); if (get_cqe_lro_tcppsh(cqe)) - th->th_flags |= TH_PUSH; + th->th_flags |= TH_PUSH; if (tcp_ack) { - th->th_flags |= TH_ACK; - th->th_ack = cqe->lro_ack_seq_num; - th->th_win = cqe->lro_tcp_win; - - /* FreeBSD handles only 32bit aligned timestamp - * right after the TCP hdr + th->th_flags |= TH_ACK; + th->th_ack = cqe->lro_ack_seq_num; + th->th_win = cqe->lro_tcp_win; + + /* + * FreeBSD handles only 32bit aligned timestamp right after + * the TCP hdr * +--------+--------+--------+--------+ * | NOP | NOP | TSopt | 10 | * +--------+--------+--------+--------+ @@ -152,7 +153,8 @@ mlx5e_lro_update_hdr(struct mbuf* mb, st (__predict_true(*ts_ptr) == ntohl(TCPOPT_NOP << 24 | TCPOPT_NOP << 16 | TCPOPT_TIMESTAMP << 8 | TCPOLEN_TIMESTAMP))) { - /* cqe->timestamp is 64bit long. + /* + * cqe->timestamp is 64bit long. * [0-31] - timestamp. * [32-64] - timestamp echo replay. */ @@ -160,15 +162,14 @@ mlx5e_lro_update_hdr(struct mbuf* mb, st ts_ptr[2] = *((uint32_t *)&cqe->timestamp + 1); } } - if (ip4) { - ip4->ip_ttl = cqe->lro_min_ttl; - ip4->ip_len = cpu_to_be16(tot_len); - ip4->ip_sum = 0; - ip4->ip_sum = in_cksum(mb, ip4->ip_hl << 2); + ip4->ip_ttl = cqe->lro_min_ttl; + ip4->ip_len = cpu_to_be16(tot_len); + ip4->ip_sum = 0; + ip4->ip_sum = in_cksum(mb, ip4->ip_hl << 2); } else { - ip6->ip6_hlim = cqe->lro_min_ttl; - ip6->ip6_plen = cpu_to_be16(tot_len - + ip6->ip6_hlim = cqe->lro_min_ttl; + ip6->ip6_plen = cpu_to_be16(tot_len - sizeof(struct ip6_hdr)); } /* TODO: handle tcp checksum */ @@ -180,7 +181,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *c u32 cqe_bcnt) { struct ifnet *ifp = rq->ifp; - int lro_num_seg; /* HW LRO session aggregated packets counter */ + int lro_num_seg; /* HW LRO session aggregated packets counter */ lro_num_seg = be32_to_cpu(cqe->srqn) >> 24; if (lro_num_seg > 1) { @@ -195,6 +196,7 @@ mlx5e_build_rx_mbuf(struct mlx5_cqe64 *c mb->m_pkthdr.flowid = be32_to_cpu(cqe->rss_hash_result); else mb->m_pkthdr.flowid = rq->ix; + M_HASHTYPE_SET(mb, M_HASHTYPE_OPAQUE); mb->m_pkthdr.rcvif = ifp; @@ -306,6 +308,7 @@ mlx5e_rx_cq_comp(struct mlx5_core_cq *mc #ifdef HAVE_PER_CQ_EVENT_PACKET struct mbuf *mb = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, rq->wqe_sz); + if (mb != NULL) { /* this code is used for debugging purpose only */ mb->m_pkthdr.len = mb->m_len = 15; Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Tue Nov 10 12:20:22 2015 (r290650) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Mon Nov 23 09:33:29 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E617A350D6; Mon, 23 Nov 2015 09:33:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCCF61843; Mon, 23 Nov 2015 09:33:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN9XRPC006002; Mon, 23 Nov 2015 09:33:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN9XR1Y006001; Mon, 23 Nov 2015 09:33:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230933.tAN9XR1Y006001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 09:33: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: r291185 - stable/10/sys/ofed/drivers/net/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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 09:33:29 -0000 Author: ngie Date: Mon Nov 23 09:33:27 2015 New Revision: 291185 URL: https://svnweb.freebsd.org/changeset/base/291185 Log: MFC r291047: Don't leak work if __mlx4_register_vlan(..) fails in mlx4_master_immediate_activate_vlan_qos(..) Differential Revision: https://reviews.freebsd.org/D4203 Submitted by: Miles Olrich Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/ofed/drivers/net/mlx4/cmd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/cmd.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/cmd.c Mon Nov 23 09:32:32 2015 (r291184) +++ stable/10/sys/ofed/drivers/net/mlx4/cmd.c Mon Nov 23 09:33:27 2015 (r291185) @@ -1784,6 +1784,7 @@ static int mlx4_master_immediate_activat mlx4_warn((&priv->dev), "No vlan resources slave %d, port %d\n", slave, port); + kfree(work); return err; } } else { From owner-svn-src-stable-10@freebsd.org Mon Nov 23 09:58:58 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F66DA3594D; Mon, 23 Nov 2015 09:58:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE3461629; Mon, 23 Nov 2015 09:58:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAN9wvTF012011; Mon, 23 Nov 2015 09:58:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAN9wvHE012010; Mon, 23 Nov 2015 09:58:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511230958.tAN9wvHE012010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 09:58: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: r291187 - 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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 09:58:58 -0000 Author: ngie Date: Mon Nov 23 09:58:56 2015 New Revision: 291187 URL: https://svnweb.freebsd.org/changeset/base/291187 Log: MFC r264725: r264725 (by jilles): libc: Add fopen() test to regression Makefile. NOTE (ngie): this is a mergeinfo-only commit Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@freebsd.org Mon Nov 23 10:10:00 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65DE4A35EE4; Mon, 23 Nov 2015 10:10:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E47F1390; Mon, 23 Nov 2015 10:10:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANA9xcA015265; Mon, 23 Nov 2015 10:09:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANA9xsT015264; Mon, 23 Nov 2015 10:09:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511231009.tANA9xsT015264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 10:09:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291189 - 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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 10:10:00 -0000 Author: ngie Date: Mon Nov 23 10:09:59 2015 New Revision: 291189 URL: https://svnweb.freebsd.org/changeset/base/291189 Log: MFC r290870: Add NO_WERROR and WARNS to PROG_OVERRIDE_VARS for bsd.prog.mk compatibility 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 Mon Nov 23 10:06:19 2015 (r291188) +++ stable/10/share/mk/bsd.progs.mk Mon Nov 23 10:09:59 2015 (r291189) @@ -42,8 +42,8 @@ PROG ?= $t .if defined(PROG) # just one of many -PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN PROGNAME \ - SRCS +PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \ + PROGNAME SRCS WARNS PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LINKS \ LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} From owner-svn-src-stable-10@freebsd.org Mon Nov 23 10:53:03 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0BA2A30C3E; Mon, 23 Nov 2015 10:53:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D07F1AA6; Mon, 23 Nov 2015 10:53:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANAr2GS029586; Mon, 23 Nov 2015 10:53:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANAr1U4029577; Mon, 23 Nov 2015 10:53:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511231053.tANAr1U4029577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 10:53: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: r291190 - stable/10/lib/libc/tests/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 10:53:04 -0000 Author: ngie Date: Mon Nov 23 10:53:01 2015 New Revision: 291190 URL: https://svnweb.freebsd.org/changeset/base/291190 Log: MFC r290572,r290646,r290848,r290849: r290572: Integrate tools/regression/lib/libc/gen into the FreeBSD test suite as lib/libc/tests/gen The code in test-fnmatch that was used for generating: - bin/sh/tests/builtins/case2.0 - bin/sh/tests/builtins/case3.0 has been left undisturbed. The target `make sh-tests` has been moved over from tools/regression/lib/libc/gen/Makefile to lib/libc/tests/gen/Makefile and made into a PHONY target case2.0 and case3.0 test input generation isn't being done automatically. This needs additional discussion. Sponsored by: EMC / Isilon Storage Division r290646: Add missing licensing boilerplate to test-fnmatch.c Carry over licensing author info from fnmatch_test.c (jilles@) Sponsored by: EMC / Isilon Storage Division r290848: Fix -Wunused warnings Sponsored by: EMC / Isilon Storage Division r290849: Fix -Wmissing-braces warnings by adding braces around all the testcase inputs Sponsored by: EMC / Isilon Storage Division Added: stable/10/lib/libc/tests/gen/fmtcheck_test.c - copied unchanged from r290572, head/lib/libc/tests/gen/fmtcheck_test.c stable/10/lib/libc/tests/gen/fmtmsg_test.c - copied unchanged from r290572, head/lib/libc/tests/gen/fmtmsg_test.c stable/10/lib/libc/tests/gen/fnmatch_test.c - copied unchanged from r290572, head/lib/libc/tests/gen/fnmatch_test.c stable/10/lib/libc/tests/gen/fnmatch_testcases.h - copied, changed from r290572, head/lib/libc/tests/gen/fnmatch_testcases.h stable/10/lib/libc/tests/gen/ftw_test.c - copied, changed from r290572, head/lib/libc/tests/gen/ftw_test.c stable/10/lib/libc/tests/gen/popen_test.c - copied, changed from r290572, head/lib/libc/tests/gen/popen_test.c stable/10/lib/libc/tests/gen/posix_spawn_test.c - copied unchanged from r290572, head/lib/libc/tests/gen/posix_spawn_test.c stable/10/lib/libc/tests/gen/test-fnmatch.c - copied, changed from r290572, head/lib/libc/tests/gen/test-fnmatch.c stable/10/lib/libc/tests/gen/wordexp_test.c - copied unchanged from r290572, head/lib/libc/tests/gen/wordexp_test.c Modified: stable/10/lib/libc/tests/gen/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/gen/Makefile ============================================================================== --- stable/10/lib/libc/tests/gen/Makefile Mon Nov 23 10:09:59 2015 (r291189) +++ stable/10/lib/libc/tests/gen/Makefile Mon Nov 23 10:53:01 2015 (r291190) @@ -4,8 +4,15 @@ TESTSDIR= ${TESTSBASE}/lib/libc/gen -ATF_TESTS_C= arc4random_test +ATF_TESTS_C+= arc4random_test +ATF_TESTS_C+= fmtcheck2_test +ATF_TESTS_C+= fmtmsg_test +ATF_TESTS_C+= fnmatch2_test ATF_TESTS_C+= fpclassify2_test +ATF_TESTS_C+= ftw_test +ATF_TESTS_C+= popen_test +ATF_TESTS_C+= posix_spawn_test +ATF_TESTS_C+= wordexp_test # TODO: t_closefrom, t_cpuset, t_fmtcheck, t_randomid, t_sleep # TODO: t_siginfo (fixes require further inspection) @@ -55,7 +62,25 @@ DPADD.nice_test+= ${LIBPTHREAD} LDADD.syslog_test+= -lpthread DPADD.syslog_test+= ${LIBPTHREAD} +CFLAGS+= -I${.CURDIR} + +SRCS.fmtcheck2_test= fmtcheck_test.c +SRCS.fnmatch2_test= fnmatch_test.c + TESTS_SUBDIRS= execve TESTS_SUBDIRS+= posix_spawn +# The old testcase name +TEST_FNMATCH= test-fnmatch +CLEANFILES+= ${GEN_SH_CASE_TESTCASES} +sh-tests: .PHONY +.for target in clean obj depend all + @cd ${.CURDIR} && ${MAKE} PROG=${TEST_FNMATCH} \ + -DNO_SUBDIR ${target} +.endfor + @cd ${.OBJDIR} && ./${TEST_FNMATCH} -s 1 > \ + ${SRCTOP}/bin/sh/tests/builtins/case2.0 + @cd ${.OBJDIR} && ./${TEST_FNMATCH} -s 2 > \ + ${SRCTOP}/bin/sh/tests/builtins/case3.0 + .include Copied: stable/10/lib/libc/tests/gen/fmtcheck_test.c (from r290572, head/lib/libc/tests/gen/fmtcheck_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/fmtcheck_test.c Mon Nov 23 10:53:01 2015 (r291190, copy of r290572, head/lib/libc/tests/gen/fmtcheck_test.c) @@ -0,0 +1,105 @@ +/* $NetBSD: tfmtcheck.c,v 1.3 2008/04/28 20:23:04 martin Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code was contributed to The NetBSD Foundation by Allen Briggs. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +struct test_fmt { + char *fmt1; + char *fmt2; + int correct; +} test_fmts[] = { + { "%d", "%d", 1 }, + { "%2d", "%2.2d", 1 }, + { "%x", "%d", 1 }, + { "%u", "%d", 1 }, + { "%03d", "%d", 1 }, + { "%-2d", "%d", 1 }, + { "%d", "%-12.1d", 1 }, + { "%d", "%-01.3d", 1 }, + { "%X", "%-01.3d", 1 }, + { "%D", "%ld", 1 }, + { "%s", "%s", 1 }, + { "%s", "This is a %s test", 1 }, + { "Hi, there. This is a %s test", "%s", 1 }, + { "%d", "%s", 2 }, + { "%e", "%s", 2 }, + { "%r", "%d", 2 }, + { "%*.2d", "%*d", 1 }, + { "%2.*d", "%*d", 2 }, + { "%*d", "%*d", 1 }, + { "%-3", "%d", 2 }, + { "%d %s", "%d", 2 }, + { "%*.*.*d", "%*.*.*d", 2 }, + { "%d", "%d %s", 1 }, + { "%40s", "%20s", 1 }, + { "%x %x %x", "%o %u %d", 1 }, + { "%o %u %d", "%x %x %X", 1 }, + { "%#o %u %#-d", "%x %#x %X", 1 }, + { "%qd", "%llx", 1 }, + { "%%", "%llx", 1 }, + { "%p %30s %#llx %-10.*e", "This number %lu%% and string %s has %qd numbers and %.*g floats", 1 }, +}; + +ATF_TC_WITHOUT_HEAD(fmtcheck_test); +ATF_TC_BODY(fmtcheck_test, tc) +{ + int i; + const char *f, *cf, *f1, *f2; + + for (i = 0; i < nitems(test_fmts); i++) { + f1 = test_fmts[i].fmt1; + f2 = test_fmts[i].fmt2; + f = fmtcheck(f1, f2); + if (test_fmts[i].correct == 1) + cf = f1; + else + cf = f2; + ATF_CHECK_MSG(f == cf, + "Test %d: (%s) vs. (%s) failed " + "(should have returned %s)", i + 1, f1, f2, + (test_fmts[i].correct == 1) ? "1st" : "2nd"); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fmtcheck_test); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/gen/fmtmsg_test.c (from r290572, head/lib/libc/tests/gen/fmtmsg_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/fmtmsg_test.c Mon Nov 23 10:53:01 2015 (r291190, copy of r290572, head/lib/libc/tests/gen/fmtmsg_test.c) @@ -0,0 +1,252 @@ +/*- + * Copyright (c) 2012 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static char *run_test(long classification, const char *label, int severity, + const char *text, const char *action, const char *tag); + +struct testcase { + long classification; + const char *label; + int severity; + const char *text; + const char *action; + const char *tag; + const char *msgverb; + const char *result; +} testcases[] = { + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + NULL, + "BSD:ls: ERROR: illegal option -- z\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "text:severity:action:tag", + "illegal option -- z: ERROR\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "text", + "illegal option -- z\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "severity:text", + "ERROR: illegal option -- z\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "ignore me", + "BSD:ls: ERROR: illegal option -- z\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "tag:severity:text:nothing:action", + "BSD:ls: ERROR: illegal option -- z\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + "", + "BSD:ls: ERROR: illegal option -- z\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, MM_NULLLBL, MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + NULL, + "ERROR: illegal option -- z\n" + "TO FIX: refer to manual BSD:ls:001\n" + }, + { + MM_UTIL | MM_PRINT, "BSD:ls", MM_ERROR, + "illegal option -- z", MM_NULLACT, MM_NULLTAG, + NULL, + "BSD:ls: ERROR: illegal option -- z\n" + }, + { + MM_UTIL | MM_NULLMC, "BSD:ls", MM_ERROR, + "illegal option -- z", "refer to manual", "BSD:ls:001", + NULL, + "" + }, + { + MM_APPL | MM_PRINT, "ABCDEFGHIJ:abcdefghijklmn", MM_INFO, + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "refer to manual", "ABCDEFGHIJ:abcdefghijklmn:001", + NULL, + "ABCDEFGHIJ:abcdefghijklmn: INFO: " + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + "TO FIX: refer to manual ABCDEFGHIJ:abcdefghijklmn:001\n" + }, + { + MM_OPSYS | MM_PRINT, "TEST:test", MM_HALT, + "failed", "nothing can help me", "NOTHING", + NULL, + "TEST:test: HALT: failed\n" + "TO FIX: nothing can help me NOTHING\n" + }, + { + MM_OPSYS | MM_PRINT, "TEST:test", MM_WARNING, + "failed", "nothing can help me", "NOTHING", + NULL, + "TEST:test: WARNING: failed\n" + "TO FIX: nothing can help me NOTHING\n" + }, + { + MM_OPSYS | MM_PRINT, "TEST:test", MM_NOSEV, + "failed", "nothing can help me", "NOTHING", + NULL, + "TEST:test: failed\n" + "TO FIX: nothing can help me NOTHING\n" + } +}; + +static char * +run_test(long classification, const char *label, int severity, + const char *text, const char *action, const char *tag) +{ + int pip[2]; + pid_t pid, wpid; + char *result, *p; + size_t resultsize; + ssize_t n; + int status; + + if (pipe(pip) == -1) + err(2, "pipe"); + pid = fork(); + if (pid == -1) + err(2, "fork"); + if (pid == 0) { + close(pip[0]); + if (pip[1] != STDERR_FILENO && + dup2(pip[1], STDERR_FILENO) == -1) + _exit(2); + if (fmtmsg(classification, label, severity, text, action, tag) + != MM_OK) + _exit(1); + else + _exit(0); + } + close(pip[1]); + resultsize = 1024; + result = malloc(resultsize); + p = result; + while ((n = read(pip[0], p, result + resultsize - p - 1)) != 0) { + if (n == -1) { + if (errno == EINTR) + continue; + else + err(2, "read"); + } + p += n; + if (result + resultsize == p - 1) { + resultsize *= 2; + result = realloc(result, resultsize); + if (result == NULL) + err(2, "realloc"); + } + } + if (memchr(result, '\0', p - result) != NULL) { + free(result); + return (NULL); + } + *p = '\0'; + close(pip[0]); + while ((wpid = waitpid(pid, &status, 0)) == -1 && errno == EINTR) + ; + if (wpid == -1) + err(2, "waitpid"); + if (status != 0) { + free(result); + return (NULL); + } + return (result); +} + +ATF_TC_WITHOUT_HEAD(fmtmsg_test); +ATF_TC_BODY(fmtmsg_test, tc) +{ + char *result; + struct testcase *t; + int i; + + for (i = 0; i < nitems(testcases); i++) { + t = &testcases[i]; + if (t->msgverb != NULL) + setenv("MSGVERB", t->msgverb, 1); + else + unsetenv("MSGVERB"); + result = run_test(t->classification, t->label, t->severity, + t->text, t->action, t->tag); + ATF_CHECK_MSG(result != NULL, "testcase %d failed", i + 1); + if (result != NULL) + ATF_CHECK_MSG(strcmp(result, t->result) == 0, + "results for testcase %d didn't match; " + "`%s` != `%s`", i + 1, result, t->result); + free(result); + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fmtmsg_test); + + return (atf_no_error()); +} Copied: stable/10/lib/libc/tests/gen/fnmatch_test.c (from r290572, head/lib/libc/tests/gen/fnmatch_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/fnmatch_test.c Mon Nov 23 10:53:01 2015 (r291190, copy of r290572, head/lib/libc/tests/gen/fnmatch_test.c) @@ -0,0 +1,188 @@ +/*- + * Copyright (c) 2010 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include "fnmatch_testcases.h" + +static const char * +flags_to_string(int flags) +{ + static const int flagvalues[] = { FNM_NOESCAPE, FNM_PATHNAME, + FNM_PERIOD, FNM_LEADING_DIR, FNM_CASEFOLD, 0 }; + static const char flagnames[] = "FNM_NOESCAPE\0FNM_PATHNAME\0FNM_PERIOD\0FNM_LEADING_DIR\0FNM_CASEFOLD\0"; + static char result[sizeof(flagnames) + 3 * sizeof(int) + 2]; + char *p; + size_t i, len; + const char *fp; + + p = result; + fp = flagnames; + for (i = 0; flagvalues[i] != 0; i++) { + len = strlen(fp); + if (flags & flagvalues[i]) { + if (p != result) + *p++ = '|'; + memcpy(p, fp, len); + p += len; + flags &= ~flagvalues[i]; + } + fp += len + 1; + } + if (p == result) + memcpy(p, "0", 2); + else if (flags != 0) + sprintf(p, "%d", flags); + else + *p = '\0'; + return result; +} + +ATF_TC_WITHOUT_HEAD(fnmatch_test); +ATF_TC_BODY(fnmatch_test, tc) +{ + size_t i; + int flags, result; + struct testcase *t; + + for (i = 0; i < nitems(testcases); i++) { + t = &testcases[i]; + flags = t->flags; + do { + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + if (strchr(t->pattern, '\\') == NULL && + !(flags & FNM_NOESCAPE)) { + flags |= FNM_NOESCAPE; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if (strchr(t->pattern, '\\') != NULL && + strchr(t->string, '\\') == NULL && + t->result == FNM_NOMATCH && + !(flags & (FNM_NOESCAPE | FNM_LEADING_DIR))) { + flags |= FNM_NOESCAPE; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if ((t->string[0] != '.' || t->pattern[0] == '.' || + t->result == FNM_NOMATCH) && + !(flags & (FNM_PATHNAME | FNM_PERIOD))) { + flags |= FNM_PERIOD; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if ((strchr(t->string, '/') == NULL || + t->result == FNM_NOMATCH) && + !(flags & FNM_PATHNAME)) { + flags |= FNM_PATHNAME; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if ((((t->string[0] != '.' || t->pattern[0] == '.') && + strstr(t->string, "/.") == NULL) || + t->result == FNM_NOMATCH) && + flags & FNM_PATHNAME && !(flags & FNM_PERIOD)) { + flags |= FNM_PERIOD; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if ((((t->string[0] != '.' || t->pattern[0] == '.') && + strchr(t->string, '/') == NULL) || + t->result == FNM_NOMATCH) && + !(flags & (FNM_PATHNAME | FNM_PERIOD))) { + flags |= FNM_PATHNAME | FNM_PERIOD; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if ((strchr(t->string, '/') == NULL || t->result == 0) + && !(flags & FNM_LEADING_DIR)) { + flags |= FNM_LEADING_DIR; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if (t->result == 0 && !(flags & FNM_CASEFOLD)) { + flags |= FNM_CASEFOLD; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + if (strchr(t->pattern, '\\') == NULL && + t->result == 0 && + !(flags & (FNM_NOESCAPE | FNM_CASEFOLD))) { + flags |= FNM_NOESCAPE | FNM_CASEFOLD; + result = fnmatch(t->pattern, t->string, flags); + if (result != t->result) + break; + flags = t->flags; + } + } while (0); + + ATF_CHECK(result == t->result); + if (result == t->result) + printf("fnmatch(\"%s\", \"%s\", %s) == %d\n", + t->pattern, t->string, flags_to_string(flags), result); + else + printf("fnmatch(\"%s\", \"%s\", %s) != %d (was %d)\n", + t->pattern, t->string, flags_to_string(flags), + t->result, result); + } + +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fnmatch_test); + + return (atf_no_error()); +} Copied and modified: stable/10/lib/libc/tests/gen/fnmatch_testcases.h (from r290572, head/lib/libc/tests/gen/fnmatch_testcases.h) ============================================================================== --- head/lib/libc/tests/gen/fnmatch_testcases.h Mon Nov 9 06:24:11 2015 (r290572, copy source) +++ stable/10/lib/libc/tests/gen/fnmatch_testcases.h Mon Nov 23 10:53:01 2015 (r291190) @@ -35,142 +35,142 @@ struct testcase { int flags; int result; } testcases[] = { - "", "", 0, 0, - "a", "a", 0, 0, - "a", "b", 0, FNM_NOMATCH, - "a", "A", 0, FNM_NOMATCH, - "*", "a", 0, 0, - "*", "aa", 0, 0, - "*a", "a", 0, 0, - "*a", "b", 0, FNM_NOMATCH, - "*a*", "b", 0, FNM_NOMATCH, - "*a*b*", "ab", 0, 0, - "*a*b*", "qaqbq", 0, 0, - "*a*bb*", "qaqbqbbq", 0, 0, - "*a*bc*", "qaqbqbcq", 0, 0, - "*a*bb*", "qaqbqbb", 0, 0, - "*a*bc*", "qaqbqbc", 0, 0, - "*a*bb", "qaqbqbb", 0, 0, - "*a*bc", "qaqbqbc", 0, 0, - "*a*bb", "qaqbqbbq", 0, FNM_NOMATCH, - "*a*bc", "qaqbqbcq", 0, FNM_NOMATCH, - "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaa", 0, FNM_NOMATCH, - "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaa", 0, 0, - "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaaa", 0, 0, - ".*.*.*.*.*.*.*.*.*.*", ".........", 0, FNM_NOMATCH, - ".*.*.*.*.*.*.*.*.*.*", "..........", 0, 0, - ".*.*.*.*.*.*.*.*.*.*", "...........", 0, 0, - "*?*?*?*?*?*?*?*?*?*?*", "123456789", 0, FNM_NOMATCH, - "??????????*", "123456789", 0, FNM_NOMATCH, - "*??????????", "123456789", 0, FNM_NOMATCH, - "*?*?*?*?*?*?*?*?*?*?*", "1234567890", 0, 0, - "??????????*", "1234567890", 0, 0, - "*??????????", "1234567890", 0, 0, - "*?*?*?*?*?*?*?*?*?*?*", "12345678901", 0, 0, - "??????????*", "12345678901", 0, 0, - "*??????????", "12345678901", 0, 0, - "[x]", "x", 0, 0, - "[*]", "*", 0, 0, - "[?]", "?", 0, 0, - "[", "[", 0, 0, - "[[]", "[", 0, 0, - "[[]", "x", 0, FNM_NOMATCH, - "[*]", "", 0, FNM_NOMATCH, - "[*]", "x", 0, FNM_NOMATCH, - "[?]", "x", 0, FNM_NOMATCH, - "*[*]*", "foo*foo", 0, 0, - "*[*]*", "foo", 0, FNM_NOMATCH, - "[0-9]", "0", 0, 0, - "[0-9]", "5", 0, 0, - "[0-9]", "9", 0, 0, - "[0-9]", "/", 0, FNM_NOMATCH, - "[0-9]", ":", 0, FNM_NOMATCH, - "[0-9]", "*", 0, FNM_NOMATCH, - "[!0-9]", "0", 0, FNM_NOMATCH, - "[!0-9]", "5", 0, FNM_NOMATCH, - "[!0-9]", "9", 0, FNM_NOMATCH, - "[!0-9]", "/", 0, 0, - "[!0-9]", ":", 0, 0, - "[!0-9]", "*", 0, 0, - "*[0-9]", "a0", 0, 0, - "*[0-9]", "a5", 0, 0, - "*[0-9]", "a9", 0, 0, - "*[0-9]", "a/", 0, FNM_NOMATCH, - "*[0-9]", "a:", 0, FNM_NOMATCH, - "*[0-9]", "a*", 0, FNM_NOMATCH, - "*[!0-9]", "a0", 0, FNM_NOMATCH, - "*[!0-9]", "a5", 0, FNM_NOMATCH, - "*[!0-9]", "a9", 0, FNM_NOMATCH, - "*[!0-9]", "a/", 0, 0, - "*[!0-9]", "a:", 0, 0, - "*[!0-9]", "a*", 0, 0, - "*[0-9]", "a00", 0, 0, - "*[0-9]", "a55", 0, 0, - "*[0-9]", "a99", 0, 0, - "*[0-9]", "a0a0", 0, 0, - "*[0-9]", "a5a5", 0, 0, - "*[0-9]", "a9a9", 0, 0, - "\\*", "*", 0, 0, - "\\?", "?", 0, 0, - "\\[x]", "[x]", 0, 0, - "\\[", "[", 0, 0, - "\\\\", "\\", 0, 0, - "*\\**", "foo*foo", 0, 0, - "*\\**", "foo", 0, FNM_NOMATCH, - "*\\\\*", "foo\\foo", 0, 0, - "*\\\\*", "foo", 0, FNM_NOMATCH, - "\\(", "(", 0, 0, - "\\a", "a", 0, 0, - "\\*", "a", 0, FNM_NOMATCH, - "\\?", "a", 0, FNM_NOMATCH, - "\\*", "\\*", 0, FNM_NOMATCH, - "\\?", "\\?", 0, FNM_NOMATCH, - "\\[x]", "\\[x]", 0, FNM_NOMATCH, - "\\[x]", "\\x", 0, FNM_NOMATCH, - "\\[", "\\[", 0, FNM_NOMATCH, - "\\(", "\\(", 0, FNM_NOMATCH, - "\\a", "\\a", 0, FNM_NOMATCH, - "\\", "\\", 0, FNM_NOMATCH, - "\\", "", 0, 0, - "\\*", "\\*", FNM_NOESCAPE, 0, - "\\?", "\\?", FNM_NOESCAPE, 0, - "\\", "\\", FNM_NOESCAPE, 0, - "\\\\", "\\", FNM_NOESCAPE, FNM_NOMATCH, - "\\\\", "\\\\", FNM_NOESCAPE, 0, - "*\\*", "foo\\foo", FNM_NOESCAPE, 0, - "*\\*", "foo", FNM_NOESCAPE, FNM_NOMATCH, - "*", ".", FNM_PERIOD, FNM_NOMATCH, - "?", ".", FNM_PERIOD, FNM_NOMATCH, - ".*", ".", 0, 0, - ".*", "..", 0, 0, - ".*", ".a", 0, 0, - "[0-9]", ".", FNM_PERIOD, FNM_NOMATCH, - "a*", "a.", 0, 0, - "a/a", "a/a", FNM_PATHNAME, 0, - "a/*", "a/a", FNM_PATHNAME, 0, - "*/a", "a/a", FNM_PATHNAME, 0, - "*/*", "a/a", FNM_PATHNAME, 0, - "a*b/*", "abbb/x", FNM_PATHNAME, 0, - "a*b/*", "abbb/.x", FNM_PATHNAME, 0, - "*", "a/a", FNM_PATHNAME, FNM_NOMATCH, - "*/*", "a/a/a", FNM_PATHNAME, FNM_NOMATCH, - "b/*", "b/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH, - "b*/*", "a/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH, - "b/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0, - "b*/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0, - "a", "A", FNM_CASEFOLD, 0, - "A", "a", FNM_CASEFOLD, 0, - "[a]", "A", FNM_CASEFOLD, 0, - "[A]", "a", FNM_CASEFOLD, 0, - "a", "b", FNM_CASEFOLD, FNM_NOMATCH, - "a", "a/b", FNM_PATHNAME, FNM_NOMATCH, - "*", "a/b", FNM_PATHNAME, FNM_NOMATCH, - "*b", "a/b", FNM_PATHNAME, FNM_NOMATCH, - "a", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0, - "*", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0, - "*", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0, - "*a", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0, - "*", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH, - "*a", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH, - "a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH, + { "", "", 0, 0 }, + { "a", "a", 0, 0 }, + { "a", "b", 0, FNM_NOMATCH }, + { "a", "A", 0, FNM_NOMATCH }, + { "*", "a", 0, 0 }, + { "*", "aa", 0, 0 }, + { "*a", "a", 0, 0 }, + { "*a", "b", 0, FNM_NOMATCH }, + { "*a*", "b", 0, FNM_NOMATCH }, + { "*a*b*", "ab", 0, 0 }, + { "*a*b*", "qaqbq", 0, 0 }, + { "*a*bb*", "qaqbqbbq", 0, 0 }, + { "*a*bc*", "qaqbqbcq", 0, 0 }, + { "*a*bb*", "qaqbqbb", 0, 0 }, + { "*a*bc*", "qaqbqbc", 0, 0 }, + { "*a*bb", "qaqbqbb", 0, 0 }, + { "*a*bc", "qaqbqbc", 0, 0 }, + { "*a*bb", "qaqbqbbq", 0, FNM_NOMATCH }, + { "*a*bc", "qaqbqbcq", 0, FNM_NOMATCH }, + { "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaa", 0, FNM_NOMATCH }, + { "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaa", 0, 0 }, + { "*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaaa", 0, 0 }, + { ".*.*.*.*.*.*.*.*.*.*", ".........", 0, FNM_NOMATCH }, + { ".*.*.*.*.*.*.*.*.*.*", "..........", 0, 0 }, + { ".*.*.*.*.*.*.*.*.*.*", "...........", 0, 0 }, + { "*?*?*?*?*?*?*?*?*?*?*", "123456789", 0, FNM_NOMATCH }, + { "??????????*", "123456789", 0, FNM_NOMATCH }, + { "*??????????", "123456789", 0, FNM_NOMATCH }, + { "*?*?*?*?*?*?*?*?*?*?*", "1234567890", 0, 0 }, + { "??????????*", "1234567890", 0, 0 }, + { "*??????????", "1234567890", 0, 0 }, + { "*?*?*?*?*?*?*?*?*?*?*", "12345678901", 0, 0 }, + { "??????????*", "12345678901", 0, 0 }, + { "*??????????", "12345678901", 0, 0 }, + { "[x]", "x", 0, 0 }, + { "[*]", "*", 0, 0 }, + { "[?]", "?", 0, 0 }, + { "[", "[", 0, 0 }, + { "[[]", "[", 0, 0 }, + { "[[]", "x", 0, FNM_NOMATCH }, + { "[*]", "", 0, FNM_NOMATCH }, + { "[*]", "x", 0, FNM_NOMATCH }, + { "[?]", "x", 0, FNM_NOMATCH }, + { "*[*]*", "foo*foo", 0, 0 }, + { "*[*]*", "foo", 0, FNM_NOMATCH }, + { "[0-9]", "0", 0, 0 }, + { "[0-9]", "5", 0, 0 }, + { "[0-9]", "9", 0, 0 }, + { "[0-9]", "/", 0, FNM_NOMATCH }, + { "[0-9]", ":", 0, FNM_NOMATCH }, + { "[0-9]", "*", 0, FNM_NOMATCH }, + { "[!0-9]", "0", 0, FNM_NOMATCH }, + { "[!0-9]", "5", 0, FNM_NOMATCH }, + { "[!0-9]", "9", 0, FNM_NOMATCH }, + { "[!0-9]", "/", 0, 0 }, + { "[!0-9]", ":", 0, 0 }, + { "[!0-9]", "*", 0, 0 }, + { "*[0-9]", "a0", 0, 0 }, + { "*[0-9]", "a5", 0, 0 }, + { "*[0-9]", "a9", 0, 0 }, + { "*[0-9]", "a/", 0, FNM_NOMATCH }, + { "*[0-9]", "a:", 0, FNM_NOMATCH }, + { "*[0-9]", "a*", 0, FNM_NOMATCH }, + { "*[!0-9]", "a0", 0, FNM_NOMATCH }, + { "*[!0-9]", "a5", 0, FNM_NOMATCH }, + { "*[!0-9]", "a9", 0, FNM_NOMATCH }, + { "*[!0-9]", "a/", 0, 0 }, + { "*[!0-9]", "a:", 0, 0 }, + { "*[!0-9]", "a*", 0, 0 }, + { "*[0-9]", "a00", 0, 0 }, + { "*[0-9]", "a55", 0, 0 }, + { "*[0-9]", "a99", 0, 0 }, + { "*[0-9]", "a0a0", 0, 0 }, + { "*[0-9]", "a5a5", 0, 0 }, + { "*[0-9]", "a9a9", 0, 0 }, + { "\\*", "*", 0, 0 }, + { "\\?", "?", 0, 0 }, + { "\\[x]", "[x]", 0, 0 }, + { "\\[", "[", 0, 0 }, + { "\\\\", "\\", 0, 0 }, + { "*\\**", "foo*foo", 0, 0 }, + { "*\\**", "foo", 0, FNM_NOMATCH }, + { "*\\\\*", "foo\\foo", 0, 0 }, + { "*\\\\*", "foo", 0, FNM_NOMATCH }, + { "\\(", "(", 0, 0 }, + { "\\a", "a", 0, 0 }, + { "\\*", "a", 0, FNM_NOMATCH }, + { "\\?", "a", 0, FNM_NOMATCH }, + { "\\*", "\\*", 0, FNM_NOMATCH }, + { "\\?", "\\?", 0, FNM_NOMATCH }, + { "\\[x]", "\\[x]", 0, FNM_NOMATCH }, + { "\\[x]", "\\x", 0, FNM_NOMATCH }, + { "\\[", "\\[", 0, FNM_NOMATCH }, + { "\\(", "\\(", 0, FNM_NOMATCH }, + { "\\a", "\\a", 0, FNM_NOMATCH }, + { "\\", "\\", 0, FNM_NOMATCH }, + { "\\", "", 0, 0 }, + { "\\*", "\\*", FNM_NOESCAPE, 0 }, + { "\\?", "\\?", FNM_NOESCAPE, 0 }, + { "\\", "\\", FNM_NOESCAPE, 0 }, + { "\\\\", "\\", FNM_NOESCAPE, FNM_NOMATCH }, + { "\\\\", "\\\\", FNM_NOESCAPE, 0 }, + { "*\\*", "foo\\foo", FNM_NOESCAPE, 0 }, + { "*\\*", "foo", FNM_NOESCAPE, FNM_NOMATCH }, + { "*", ".", FNM_PERIOD, FNM_NOMATCH }, + { "?", ".", FNM_PERIOD, FNM_NOMATCH }, + { ".*", ".", 0, 0 }, + { ".*", "..", 0, 0 }, + { ".*", ".a", 0, 0 }, + { "[0-9]", ".", FNM_PERIOD, FNM_NOMATCH }, + { "a*", "a.", 0, 0 }, + { "a/a", "a/a", FNM_PATHNAME, 0 }, + { "a/*", "a/a", FNM_PATHNAME, 0 }, + { "*/a", "a/a", FNM_PATHNAME, 0 }, + { "*/*", "a/a", FNM_PATHNAME, 0 }, + { "a*b/*", "abbb/x", FNM_PATHNAME, 0 }, + { "a*b/*", "abbb/.x", FNM_PATHNAME, 0 }, + { "*", "a/a", FNM_PATHNAME, FNM_NOMATCH }, + { "*/*", "a/a/a", FNM_PATHNAME, FNM_NOMATCH }, + { "b/*", "b/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH }, + { "b*/*", "a/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH }, + { "b/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0 }, + { "b*/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0 }, + { "a", "A", FNM_CASEFOLD, 0 }, + { "A", "a", FNM_CASEFOLD, 0 }, + { "[a]", "A", FNM_CASEFOLD, 0 }, + { "[A]", "a", FNM_CASEFOLD, 0 }, + { "a", "b", FNM_CASEFOLD, FNM_NOMATCH }, + { "a", "a/b", FNM_PATHNAME, FNM_NOMATCH }, + { "*", "a/b", FNM_PATHNAME, FNM_NOMATCH }, + { "*b", "a/b", FNM_PATHNAME, FNM_NOMATCH }, + { "a", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0 }, + { "*", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0 }, + { "*", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0 }, + { "*a", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0 }, + { "*", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH }, + { "*a", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH }, + { "a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH }, }; Copied and modified: stable/10/lib/libc/tests/gen/ftw_test.c (from r290572, head/lib/libc/tests/gen/ftw_test.c) ============================================================================== --- head/lib/libc/tests/gen/ftw_test.c Mon Nov 9 06:24:11 2015 (r290572, copy source) +++ stable/10/lib/libc/tests/gen/ftw_test.c Mon Nov 23 10:53:01 2015 (r291190) @@ -49,7 +49,6 @@ extern char **environ; static char template[] = "testftw.XXXXXXXXXX"; static char dir[PATH_MAX]; -static int failures; static int ftwflags; static int Copied and modified: stable/10/lib/libc/tests/gen/popen_test.c (from r290572, head/lib/libc/tests/gen/popen_test.c) ============================================================================== --- head/lib/libc/tests/gen/popen_test.c Mon Nov 9 06:24:11 2015 (r290572, copy source) +++ stable/10/lib/libc/tests/gen/popen_test.c Mon Nov 23 10:53:01 2015 (r291190) @@ -71,7 +71,7 @@ check_cloexec(FILE *fp, const char *mode ATF_TC_WITHOUT_HEAD(popen_all_modes_test); ATF_TC_BODY(popen_all_modes_test, tc) { - FILE *fp, *fp2; + FILE *fp; int i, status; const char *mode; const char *allmodes[] = { "r", "w", "r+", "re", "we", "r+e", "re+" }; @@ -92,7 +92,7 @@ ATF_TC_BODY(popen_all_modes_test, tc) ATF_TC_WITHOUT_HEAD(popen_rmodes_test); ATF_TC_BODY(popen_rmodes_test, tc) { - FILE *fp, *fp2; + FILE *fp; const char *rmodes[] = { "r", "r+", "re", "r+e", "re+" }; const char *mode; char buf[80]; @@ -211,7 +211,7 @@ ATF_TC_WITHOUT_HEAD(popen_rwmodes_test); ATF_TC_BODY(popen_rwmodes_test, tc) { const char *rwmodes[] = { "r+", "r+e", "re+" }; - FILE *fp, *fp2; + FILE *fp; const char *mode; char *sres; char buf[80]; Copied: stable/10/lib/libc/tests/gen/posix_spawn_test.c (from r290572, head/lib/libc/tests/gen/posix_spawn_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/lib/libc/tests/gen/posix_spawn_test.c Mon Nov 23 10:53:01 2015 (r291190, copy of r290572, head/lib/libc/tests/gen/posix_spawn_test.c) @@ -0,0 +1,103 @@ +/*- + * Copyright (c) 2011 Jilles Tjoelker + * 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. + */ + +/* + * Test program for posix_spawn() and posix_spawnp() as specified by + * IEEE Std. 1003.1-2008. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +char *myenv[2] = { "answer=42", NULL }; + +ATF_TC_WITHOUT_HEAD(posix_spawn_simple_test); +ATF_TC_BODY(posix_spawn_simple_test, tc) +{ + char *myargs[4]; + int error, status; + pid_t pid, waitres; + + /* Make sure we have no child processes. */ + while (waitpid(-1, NULL, 0) != -1) + ; + ATF_REQUIRE_MSG(errno == ECHILD, "errno was not ECHILD: %d", errno); + + /* Simple test. */ + myargs[0] = "sh"; + myargs[1] = "-c"; + myargs[2] = "exit $answer"; + myargs[3] = NULL; + error = posix_spawnp(&pid, myargs[0], NULL, NULL, myargs, myenv); + ATF_REQUIRE(error == 0); + waitres = waitpid(pid, &status, 0); + ATF_REQUIRE(waitres == pid); + ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42); +} + +ATF_TC_WITHOUT_HEAD(posix_spawn_no_such_command_negative_test); +ATF_TC_BODY(posix_spawn_no_such_command_negative_test, tc) +{ + char *myargs[4]; + int error, status; + pid_t pid, waitres; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Mon Nov 23 10:57:06 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A25EA30D07; Mon, 23 Nov 2015 10:57:06 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 030031C35; Mon, 23 Nov 2015 10:57:05 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANAv5Cw029795; Mon, 23 Nov 2015 10:57:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANAv52V029794; Mon, 23 Nov 2015 10:57:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511231057.tANAv52V029794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Mon, 23 Nov 2015 10:57:05 +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: r291191 - stable/10/contrib/netbsd-tests/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 10:57:06 -0000 Author: ngie Date: Mon Nov 23 10:57:04 2015 New Revision: 291191 URL: https://svnweb.freebsd.org/changeset/base/291191 Log: MFC r290856: r290856 (by bap): also skip the definition of ':fopen_regular' to avoid the build to fail due to unused variables defined by ATF macros Modified: stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Mon Nov 23 10:53:01 2015 (r291190) +++ stable/10/contrib/netbsd-tests/lib/libc/stdio/t_fopen.c Mon Nov 23 10:57:04 2015 (r291191) @@ -303,6 +303,7 @@ ATF_TC_BODY(fopen_perm, tc) ATF_REQUIRE_ERRNO(EACCES, fopen("/bin/ls", "w+") == NULL); } +#ifdef __NetBSD__ ATF_TC(fopen_regular); ATF_TC_HEAD(fopen_regular, tc) { @@ -335,6 +336,7 @@ ATF_TC_BODY(fopen_regular, tc) } } } +#endif ATF_TC_WITH_CLEANUP(fopen_seek); ATF_TC_HEAD(fopen_seek, tc) From owner-svn-src-stable-10@freebsd.org Mon Nov 23 12:10:30 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF821A35600; Mon, 23 Nov 2015 12:10:30 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B981B1B8F; Mon, 23 Nov 2015 12:10:30 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANCATDg051004; Mon, 23 Nov 2015 12:10:29 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANCATi3051003; Mon, 23 Nov 2015 12:10:29 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511231210.tANCATi3051003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 23 Nov 2015 12:10:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291194 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 12:10:31 -0000 Author: smh Date: Mon Nov 23 12:10:29 2015 New Revision: 291194 URL: https://svnweb.freebsd.org/changeset/base/291194 Log: MFC r290708: Fix ixl debug sysctls panic Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/if_ixl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/if_ixl.c ============================================================================== --- stable/10/sys/dev/ixl/if_ixl.c Mon Nov 23 11:19:00 2015 (r291193) +++ stable/10/sys/dev/ixl/if_ixl.c Mon Nov 23 12:10:29 2015 (r291194) @@ -4676,17 +4676,9 @@ ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_A } error = sbuf_finish(buf); - if (error) { - device_printf(dev, "Error finishing sbuf: %d\n", error); - sbuf_delete(buf); - return error; - } - - error = sysctl_handle_string(oidp, sbuf_data(buf), sbuf_len(buf), req); - if (error) - device_printf(dev, "sysctl error: %d\n", error); sbuf_delete(buf); - return error; + + return (error); } /* @@ -4789,15 +4781,6 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ sbuf_delete(nmbuf); error = sbuf_finish(buf); - if (error) { - device_printf(dev, "Error finishing sbuf: %d\n", error); - sbuf_delete(buf); - return error; - } - - error = sysctl_handle_string(oidp, sbuf_data(buf), sbuf_len(buf), req); - if (error) - device_printf(dev, "sysctl error: %d\n", error); sbuf_delete(buf); return (error); From owner-svn-src-stable-10@freebsd.org Mon Nov 23 12:17:48 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 315EFA35882; Mon, 23 Nov 2015 12:17:48 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DAC6A1089; Mon, 23 Nov 2015 12:17:47 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANCHlac053834; Mon, 23 Nov 2015 12:17:47 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANCHl1p053833; Mon, 23 Nov 2015 12:17:47 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511231217.tANCHl1p053833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 23 Nov 2015 12:17: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: r291195 - stable/10/sys/geom/eli X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 12:17:48 -0000 Author: smh Date: Mon Nov 23 12:17:46 2015 New Revision: 291195 URL: https://svnweb.freebsd.org/changeset/base/291195 Log: MFC r290406: Fix g_eli error loss conditions Sponsored by: Multiplay Modified: stable/10/sys/geom/eli/g_eli.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/eli/g_eli.c ============================================================================== --- stable/10/sys/geom/eli/g_eli.c Mon Nov 23 12:10:29 2015 (r291194) +++ stable/10/sys/geom/eli/g_eli.c Mon Nov 23 12:17:46 2015 (r291195) @@ -201,7 +201,7 @@ g_eli_read_done(struct bio *bp) G_ELI_LOGREQ(2, bp, "Request done."); pbp = bp->bio_parent; - if (pbp->bio_error == 0) + if (pbp->bio_error == 0 && bp->bio_error != 0) pbp->bio_error = bp->bio_error; g_destroy_bio(bp); /* @@ -212,7 +212,8 @@ g_eli_read_done(struct bio *bp) return; sc = pbp->bio_to->geom->softc; if (pbp->bio_error != 0) { - G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); + G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, + pbp->bio_error); pbp->bio_completed = 0; if (pbp->bio_driver2 != NULL) { free(pbp->bio_driver2, M_ELI); @@ -241,10 +242,8 @@ g_eli_write_done(struct bio *bp) G_ELI_LOGREQ(2, bp, "Request done."); pbp = bp->bio_parent; - if (pbp->bio_error == 0) { - if (bp->bio_error != 0) - pbp->bio_error = bp->bio_error; - } + if (pbp->bio_error == 0 && bp->bio_error != 0) + pbp->bio_error = bp->bio_error; g_destroy_bio(bp); /* * Do we have all sectors already? @@ -255,14 +254,15 @@ g_eli_write_done(struct bio *bp) free(pbp->bio_driver2, M_ELI); pbp->bio_driver2 = NULL; if (pbp->bio_error != 0) { - G_ELI_LOGREQ(0, pbp, "Crypto WRITE request failed (error=%d).", + G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, pbp->bio_error); pbp->bio_completed = 0; - } + } else + pbp->bio_completed = pbp->bio_length; + /* * Write is finished, send it up. */ - pbp->bio_completed = pbp->bio_length; sc = pbp->bio_to->geom->softc; g_io_deliver(pbp, pbp->bio_error); atomic_subtract_int(&sc->sc_inflight, 1); From owner-svn-src-stable-10@freebsd.org Mon Nov 23 12:19:37 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E835CA3593D; Mon, 23 Nov 2015 12:19:37 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6264133D; Mon, 23 Nov 2015 12:19:37 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANCJagv053964; Mon, 23 Nov 2015 12:19:36 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANCJatU053963; Mon, 23 Nov 2015 12:19:36 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511231219.tANCJatU053963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 23 Nov 2015 12:19: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: r291196 - stable/10/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 12:19:38 -0000 Author: smh Date: Mon Nov 23 12:19:36 2015 New Revision: 291196 URL: https://svnweb.freebsd.org/changeset/base/291196 Log: MFC r291071: Fix zfs(8) set options Sponsored by: Multiplay Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Nov 23 12:17:46 2015 (r291195) +++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Mon Nov 23 12:19:36 2015 (r291196) @@ -117,7 +117,7 @@ .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm set -.Ar property Ns = Ns Ar value Oc ... +.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ... .Nm .Cm get @@ -2121,7 +2121,7 @@ option, but sorts by property in descend .It Xo .Nm .Cm set -.Ar property Ns = Ns Ar value Oc ... +.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc .Pp From owner-svn-src-stable-10@freebsd.org Mon Nov 23 13:30:14 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E94CFA34C90; Mon, 23 Nov 2015 13:30:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C47131BC1; Mon, 23 Nov 2015 13:30:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANDUDTP074415; Mon, 23 Nov 2015 13:30:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANDUDav074409; Mon, 23 Nov 2015 13:30:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511231330.tANDUDav074409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 23 Nov 2015 13:30: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: r291201 - in stable/10: share/man/man4 sys/conf sys/modules X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 13:30:15 -0000 Author: hselasky Date: Mon Nov 23 13:30:13 2015 New Revision: 291201 URL: https://svnweb.freebsd.org/changeset/base/291201 Log: MFC r291072, r291168 and r291169: Add the mlx5 and mlx5en modules to the i386 and amd64 kernel builds by default and add a manual page for mlx5en. The mlx5 module contains shared code for both infiniband and ethernet. The mlx5en module contains specific code for ethernet functionality only. A mlx5ib module is in the works for infiniband support. Supported hardware: - ConnectX-4: 10/20/25/40/50/56/100Gb/s speeds. - ConnectX-4 LX: 10/25/40/50Gb/s speeds (low power consumption) Refer to the mlx5en(4) manual page for a comprehensive list. The team porting the mlx5 driver(s) to FreeBSD: - Hans Petter Selasky - Oded Shanoon - Meny Yossefi - Shany Michaely - Shahar Klein - Daria Genzel - Mark Bloch Differential Revision: https://reviews.freebsd.org/D4163 Sponsored by: Mellanox Technologies Added: stable/10/share/man/man4/mlx5en.4 - copied, changed from r291072, head/share/man/man4/mlx5en.4 Modified: stable/10/share/man/man4/Makefile stable/10/sys/conf/NOTES stable/10/sys/conf/files stable/10/sys/conf/options stable/10/sys/modules/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Mon Nov 23 13:23:53 2015 (r291200) +++ stable/10/share/man/man4/Makefile Mon Nov 23 13:30:13 2015 (r291201) @@ -260,6 +260,7 @@ MAN= aac.4 \ mk48txx.4 \ mld.4 \ mlx.4 \ + mlx5en.4 \ mly.4 \ mmc.4 \ mmcsd.4 \ @@ -636,6 +637,7 @@ MLINKS+=lp.4 plip.4 MLINKS+=malo.4 if_malo.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 +MLINKS+=mlx5en.4 mce.4 MLINKS+=mn.4 if_mn.4 MLINKS+=mos.4 if_mos.4 MLINKS+=msk.4 if_msk.4 Copied and modified: stable/10/share/man/man4/mlx5en.4 (from r291072, head/share/man/man4/mlx5en.4) ============================================================================== --- head/share/man/man4/mlx5en.4 Thu Nov 19 12:55:43 2015 (r291072, copy source) +++ stable/10/share/man/man4/mlx5en.4 Mon Nov 23 13:30:13 2015 (r291201) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 15, 2015 +.Dd November 22, 2015 .Dt mlx5en 4 .Os .Sh NAME @@ -53,10 +53,10 @@ driver provides support for PCI Express ConnectX-4 and ConnectX-4 LX. The driver supports Jumbo Frames, Transmit/Receive checksum offload, TCP segmentation offload (TSO), Large Receive Offload (LRO), -HW Large Receive Offload (HW LRO), VLAN tag insertion/extraction, +HW Large Receive Offload (HW LRO), VLAN tag insertion/extraction, VLAN checksum offload, VLAN TSO, and Receive Side Steering (RSS). .br -The network Interface is named mce. +The network interface is named mce. .br For further hardware information and questions related to hardware requirements, see Modified: stable/10/sys/conf/NOTES ============================================================================== --- stable/10/sys/conf/NOTES Mon Nov 23 13:23:53 2015 (r291200) +++ stable/10/sys/conf/NOTES Mon Nov 23 13:30:13 2015 (r291201) @@ -351,6 +351,9 @@ options COMPAT_FREEBSD6 # Enable FreeBSD7 compatibility syscalls options COMPAT_FREEBSD7 +# Enable Linux Kernel Programming Interface +#options COMPAT_LINUXKPI + # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared @@ -1953,6 +1956,8 @@ device xmphy # XaQti XMAC II # 88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053, # 88E8055, 88E8056 and D-Link 560T/550SX. # lmc: Support for the LMC/SBE wide-area network interface cards. +# mlx5: Mellanox ConnectX-4 and ConnectX-4 LX IB and Eth shared code module. +# mlx5en:Mellanox ConnectX-4 and ConnectX-4 LX PCIe Ethernet adapters. # my: Myson Fast Ethernet (MTD80X, MTD89X) # nge: Support for PCI gigabit ethernet adapters based on the National # Semiconductor DP83820 and DP83821 chipset. This includes the @@ -2071,6 +2076,8 @@ device gem # Apple GMAC/Sun ERI/Sun GE device hme # Sun HME (Happy Meal Ethernet) device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet device lge # Level 1 LXT1001 gigabit Ethernet +#device mlx5 # Shared code module between IB and Ethernet +#device mlx5en # Mellanox ConnectX-4 and ConnectX-4 LX device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device my # Myson Fast Ethernet (MTD80X, MTD89X) device nge # NatSemi DP83820 gigabit Ethernet Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Mon Nov 23 13:23:53 2015 (r291200) +++ stable/10/sys/conf/files Mon Nov 23 13:30:13 2015 (r291201) @@ -3639,11 +3639,11 @@ nlm/nlm_prot_xdr.c optional nfslockd | nlm/sm_inter_xdr.c optional nfslockd | nfsd # OpenFabrics Enterprise Distribution (Infiniband) -ofed/include/linux/linux_compat.c optional ofed \ +ofed/include/linux/linux_compat.c optional ofed | compat_linuxkpi \ no-depend compile-with "${OFED_C}" -ofed/include/linux/linux_idr.c optional ofed \ +ofed/include/linux/linux_idr.c optional ofed | compat_linuxkpi \ no-depend compile-with "${OFED_C}" -ofed/include/linux/linux_radix.c optional ofed \ +ofed/include/linux/linux_radix.c optional ofed | compat_linuxkpi \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/core/addr.c optional ofed \ no-depend \ @@ -3890,6 +3890,60 @@ ofed/drivers/net/mlx4/en_tx.c optional no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" +dev/mlx5/mlx5_core/mlx5_alloc.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_cq.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_eq.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_flow_table.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_fw.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_health.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_mad.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_main.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_mcg.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_mr.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_pagealloc.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_pd.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_port.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_qp.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_srq.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_transobj.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_uar.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_vport.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_wq.c optional mlx5 pci \ + no-depend compile-with "${OFED_C}" + +dev/mlx5/mlx5_en/mlx5_en_ethtool.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_main.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_tx.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_flow_table.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_rx.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_txrx.c optional mlx5en pci inet inet6 \ + no-depend compile-with "${OFED_C}" + ofed/drivers/infiniband/hw/mthca/mthca_allocator.c optional mthca \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/hw/mthca/mthca_av.c optional mthca \ Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Mon Nov 23 13:23:53 2015 (r291200) +++ stable/10/sys/conf/options Mon Nov 23 13:30:13 2015 (r291201) @@ -83,6 +83,7 @@ COMPAT_FREEBSD4 opt_compat.h COMPAT_FREEBSD5 opt_compat.h COMPAT_FREEBSD6 opt_compat.h COMPAT_FREEBSD7 opt_compat.h +COMPAT_LINUXKPI opt_compat.h COMPILING_LINT opt_global.h COMPRESS_USER_CORES opt_core.h CY_PCI_FASTINTR Modified: stable/10/sys/modules/Makefile ============================================================================== --- stable/10/sys/modules/Makefile Mon Nov 23 13:23:53 2015 (r291200) +++ stable/10/sys/modules/Makefile Mon Nov 23 13:30:13 2015 (r291201) @@ -220,6 +220,8 @@ SUBDIR= \ ${_mlx4} \ ${_mlx4ib} \ ${_mlxen} \ + ${_mlx5} \ + ${_mlx5en} \ ${_mly} \ mmc \ mmcsd \ @@ -545,6 +547,11 @@ _mlx4ib= mlx4ib _mlxen= mlxen _mthca= mthca .endif +_mlx5= mlx5 +.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ + defined(ALL_MODULES) +_mlx5en= mlx5en +.endif _ncv= ncv _ndis= ndis _nsp= nsp @@ -749,6 +756,11 @@ _mlx4ib= mlx4ib _mlxen= mlxen _mthca= mthca .endif +_mlx5= mlx5 +.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ + defined(ALL_MODULES) +_mlx5en= mlx5en +.endif _ndis= ndis _nfe= nfe _ntb= ntb From owner-svn-src-stable-10@freebsd.org Mon Nov 23 13:36:43 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D201A34F59; Mon, 23 Nov 2015 13:36:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF89B1130; Mon, 23 Nov 2015 13:36:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANDaglZ077107; Mon, 23 Nov 2015 13:36:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANDagwD077106; Mon, 23 Nov 2015 13:36:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511231336.tANDagwD077106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 23 Nov 2015 13:36: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: r291202 - stable/10/sys/dev/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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 13:36:43 -0000 Author: hselasky Date: Mon Nov 23 13:36:41 2015 New Revision: 291202 URL: https://svnweb.freebsd.org/changeset/base/291202 Log: MFC r284722 and r284724: Fix endless recursion in ti(4)'s ti_ifmedia_upd(), found by clang 3.7.0. Modified: stable/10/sys/dev/ti/if_ti.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ti/if_ti.c ============================================================================== --- stable/10/sys/dev/ti/if_ti.c Mon Nov 23 13:30:13 2015 (r291201) +++ stable/10/sys/dev/ti/if_ti.c Mon Nov 23 13:36:41 2015 (r291202) @@ -3335,7 +3335,7 @@ ti_ifmedia_upd(struct ifnet *ifp) sc = ifp->if_softc; TI_LOCK(sc); - error = ti_ifmedia_upd(ifp); + error = ti_ifmedia_upd_locked(sc); TI_UNLOCK(sc); return (error); From owner-svn-src-stable-10@freebsd.org Mon Nov 23 13:47:33 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03B3FA3536D; Mon, 23 Nov 2015 13:47:33 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A83021BA5; Mon, 23 Nov 2015 13:47:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANDlVkh080309; Mon, 23 Nov 2015 13:47:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANDlVuT080308; Mon, 23 Nov 2015 13:47:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511231347.tANDlVuT080308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 23 Nov 2015 13:47: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: r291205 - stable/10/sys/dev/usb/input X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 13:47:33 -0000 Author: hselasky Date: Mon Nov 23 13:47:31 2015 New Revision: 291205 URL: https://svnweb.freebsd.org/changeset/base/291205 Log: MFC r277974: Fix a bunch of -Wcast-qual warnings in sys/dev/usb/input/uhid.c, by using __DECONST. No functional change. Differential Revision: https://reviews.freebsd.org/D1743 Modified: stable/10/sys/dev/usb/input/uhid.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/uhid.c ============================================================================== --- stable/10/sys/dev/usb/input/uhid.c Mon Nov 23 13:44:25 2015 (r291204) +++ stable/10/sys/dev/usb/input/uhid.c Mon Nov 23 13:47:31 2015 (r291205) @@ -736,7 +736,7 @@ uhid_attach(device_t dev) if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE) { sc->sc_repdesc_size = sizeof(uhid_graphire_report_descr); - sc->sc_repdesc_ptr = (void *)&uhid_graphire_report_descr; + sc->sc_repdesc_ptr = __DECONST(void *, &uhid_graphire_report_descr); sc->sc_flags |= UHID_FLAG_STATIC_DESC; } else if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE3_4X5) { @@ -757,7 +757,7 @@ uhid_attach(device_t dev) usbd_errstr(error)); } sc->sc_repdesc_size = sizeof(uhid_graphire3_4x5_report_descr); - sc->sc_repdesc_ptr = (void *)&uhid_graphire3_4x5_report_descr; + sc->sc_repdesc_ptr = __DECONST(void *, &uhid_graphire3_4x5_report_descr); sc->sc_flags |= UHID_FLAG_STATIC_DESC; } } else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) && @@ -777,7 +777,7 @@ uhid_attach(device_t dev) } /* the Xbox 360 gamepad has no report descriptor */ sc->sc_repdesc_size = sizeof(uhid_xb360gp_report_descr); - sc->sc_repdesc_ptr = (void *)&uhid_xb360gp_report_descr; + sc->sc_repdesc_ptr = __DECONST(void *, &uhid_xb360gp_report_descr); sc->sc_flags |= UHID_FLAG_STATIC_DESC; } if (sc->sc_repdesc_ptr == NULL) { From owner-svn-src-stable-10@freebsd.org Mon Nov 23 17:26:21 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A513AA32880; Mon, 23 Nov 2015 17:26:21 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 635B11C80; Mon, 23 Nov 2015 17:26:21 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANHQKLf048758; Mon, 23 Nov 2015 17:26:20 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANHQKs8048757; Mon, 23 Nov 2015 17:26:20 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201511231726.tANHQKs8048757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 23 Nov 2015 17:26:20 +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: r291213 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 17:26:21 -0000 Author: jimharris Date: Mon Nov 23 17:26:20 2015 New Revision: 291213 URL: https://svnweb.freebsd.org/changeset/base/291213 Log: MFC r290198: nvme: fix race condition in split bio completion path Sponsored by: Intel Modified: stable/10/sys/dev/nvme/nvme_ns.c Modified: stable/10/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ns.c Mon Nov 23 17:09:35 2015 (r291212) +++ stable/10/sys/dev/nvme/nvme_ns.c Mon Nov 23 17:26:20 2015 (r291213) @@ -239,7 +239,7 @@ static void nvme_bio_child_inbed(struct bio *parent, int bio_error) { struct nvme_completion parent_cpl; - int inbed; + int children, inbed; if (bio_error != 0) { parent->bio_flags |= BIO_ERROR; @@ -248,10 +248,13 @@ nvme_bio_child_inbed(struct bio *parent, /* * atomic_fetchadd will return value before adding 1, so we still - * must add 1 to get the updated inbed number. + * must add 1 to get the updated inbed number. Save bio_children + * before incrementing to guard against race conditions when + * two children bios complete on different queues. */ + children = atomic_load_acq_int(&parent->bio_children); inbed = atomic_fetchadd_int(&parent->bio_inbed, 1) + 1; - if (inbed == parent->bio_children) { + if (inbed == children) { bzero(&parent_cpl, sizeof(parent_cpl)); if (parent->bio_flags & BIO_ERROR) parent_cpl.status.sc = NVME_SC_DATA_TRANSFER_ERROR; From owner-svn-src-stable-10@freebsd.org Mon Nov 23 17:27:31 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 791EAA328E4; Mon, 23 Nov 2015 17:27:31 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 298751DDD; Mon, 23 Nov 2015 17:27:31 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANHRUT9048902; Mon, 23 Nov 2015 17:27:30 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANHRU5k048899; Mon, 23 Nov 2015 17:27:30 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201511231727.tANHRU5k048899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 23 Nov 2015 17:27: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: r291214 - in stable/10/sys/dev: nvd nvme X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 17:27:31 -0000 Author: jimharris Date: Mon Nov 23 17:27:29 2015 New Revision: 291214 URL: https://svnweb.freebsd.org/changeset/base/291214 Log: MFC r290199: nvd, nvme: report stripesize through GEOM disk layer Sponsored by: Intel Modified: stable/10/sys/dev/nvd/nvd.c stable/10/sys/dev/nvme/nvme.h stable/10/sys/dev/nvme/nvme_ns.c Modified: stable/10/sys/dev/nvd/nvd.c ============================================================================== --- stable/10/sys/dev/nvd/nvd.c Mon Nov 23 17:26:20 2015 (r291213) +++ stable/10/sys/dev/nvd/nvd.c Mon Nov 23 17:27:29 2015 (r291214) @@ -279,6 +279,7 @@ nvd_new_disk(struct nvme_namespace *ns, disk->d_sectorsize = nvme_ns_get_sector_size(ns); disk->d_mediasize = (off_t)nvme_ns_get_size(ns); disk->d_delmaxsize = (off_t)nvme_ns_get_size(ns); + disk->d_stripesize = nvme_ns_get_stripesize(ns); if (TAILQ_EMPTY(&disk_head)) disk->d_unit = 0; Modified: stable/10/sys/dev/nvme/nvme.h ============================================================================== --- stable/10/sys/dev/nvme/nvme.h Mon Nov 23 17:26:20 2015 (r291213) +++ stable/10/sys/dev/nvme/nvme.h Mon Nov 23 17:27:29 2015 (r291214) @@ -870,6 +870,7 @@ const char * nvme_ns_get_serial_number(s const char * nvme_ns_get_model_number(struct nvme_namespace *ns); const struct nvme_namespace_data * nvme_ns_get_data(struct nvme_namespace *ns); +uint32_t nvme_ns_get_stripesize(struct nvme_namespace *ns); int nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp, nvme_cb_fn_t cb_fn); Modified: stable/10/sys/dev/nvme/nvme_ns.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ns.c Mon Nov 23 17:26:20 2015 (r291213) +++ stable/10/sys/dev/nvme/nvme_ns.c Mon Nov 23 17:27:29 2015 (r291214) @@ -210,6 +210,13 @@ nvme_ns_get_data(struct nvme_namespace * return (&ns->data); } +uint32_t +nvme_ns_get_stripesize(struct nvme_namespace *ns) +{ + + return (ns->stripesize); +} + static void nvme_ns_bio_done(void *arg, const struct nvme_completion *status) { From owner-svn-src-stable-10@freebsd.org Mon Nov 23 18:00:56 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA019A35188; Mon, 23 Nov 2015 18:00:56 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C53D22000; Mon, 23 Nov 2015 18:00:56 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tANI0t9q058067; Mon, 23 Nov 2015 18:00:55 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tANI0t3F058063; Mon, 23 Nov 2015 18:00:55 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511231800.tANI0t3F058063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 23 Nov 2015 18:00: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: r291215 - in stable/10/sys: dev/null geom kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 18:00:57 -0000 Author: smh Date: Mon Nov 23 18:00:55 2015 New Revision: 291215 URL: https://svnweb.freebsd.org/changeset/base/291215 Log: MFC r274366: Add missing privilege check when setting the dump device. Approved by: pjd, secteam (both no objections) Sponsored by: Multiplay Modified: stable/10/sys/dev/null/null.c stable/10/sys/geom/geom_dev.c stable/10/sys/kern/kern_shutdown.c stable/10/sys/sys/conf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/null/null.c ============================================================================== --- stable/10/sys/dev/null/null.c Mon Nov 23 17:27:29 2015 (r291214) +++ stable/10/sys/dev/null/null.c Mon Nov 23 18:00:55 2015 (r291215) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -89,9 +88,7 @@ null_ioctl(struct cdev *dev __unused, u_ switch (cmd) { case DIOCSKERNELDUMP: - error = priv_check(td, PRIV_SETDUMPER); - if (error == 0) - error = set_dumper(NULL, NULL); + error = set_dumper(NULL, NULL, td); break; case FIONBIO: break; Modified: stable/10/sys/geom/geom_dev.c ============================================================================== --- stable/10/sys/geom/geom_dev.c Mon Nov 23 17:27:29 2015 (r291214) +++ stable/10/sys/geom/geom_dev.c Mon Nov 23 18:00:55 2015 (r291215) @@ -127,14 +127,14 @@ g_dev_fini(struct g_class *mp) } static int -g_dev_setdumpdev(struct cdev *dev) +g_dev_setdumpdev(struct cdev *dev, struct thread *td) { struct g_kerneldump kd; struct g_consumer *cp; int error, len; if (dev == NULL) - return (set_dumper(NULL, NULL)); + return (set_dumper(NULL, NULL, td)); cp = dev->si_drv2; len = sizeof(kd); @@ -142,7 +142,7 @@ g_dev_setdumpdev(struct cdev *dev) kd.length = OFF_MAX; error = g_io_getattr("GEOM::kerneldump", cp, &len, &kd); if (error == 0) { - error = set_dumper(&kd.di, devtoname(dev)); + error = set_dumper(&kd.di, devtoname(dev), td); if (error == 0) dev->si_flags |= SI_DUMPDEV; } @@ -157,7 +157,7 @@ init_dumpdev(struct cdev *dev) return; if (strcmp(devtoname(dev), dumpdev) != 0) return; - if (g_dev_setdumpdev(dev) == 0) { + if (g_dev_setdumpdev(dev, curthread) == 0) { freeenv(dumpdev); dumpdev = NULL; } @@ -480,9 +480,9 @@ g_dev_ioctl(struct cdev *dev, u_long cmd break; case DIOCSKERNELDUMP: if (*(u_int *)data == 0) - error = g_dev_setdumpdev(NULL); + error = g_dev_setdumpdev(NULL, td); else - error = g_dev_setdumpdev(dev); + error = g_dev_setdumpdev(dev, td); break; case DIOCGFLUSH: error = g_io_flush(cp); @@ -700,7 +700,7 @@ g_dev_orphan(struct g_consumer *cp) /* Reset any dump-area set on this device */ if (dev->si_flags & SI_DUMPDEV) - set_dumper(NULL, NULL); + (void)set_dumper(NULL, NULL, curthread); /* Destroy the struct cdev *so we get no more requests */ destroy_dev_sched_cb(dev, g_dev_callback, cp); Modified: stable/10/sys/kern/kern_shutdown.c ============================================================================== --- stable/10/sys/kern/kern_shutdown.c Mon Nov 23 17:27:29 2015 (r291214) +++ stable/10/sys/kern/kern_shutdown.c Mon Nov 23 18:00:55 2015 (r291215) @@ -843,9 +843,14 @@ SYSCTL_STRING(_kern_shutdown, OID_AUTO, /* Registration of dumpers */ int -set_dumper(struct dumperinfo *di, const char *devname) +set_dumper(struct dumperinfo *di, const char *devname, struct thread *td) { size_t wantcopy; + int error; + + error = priv_check(td, PRIV_SETDUMPER); + if (error != 0) + return (error); if (di == NULL) { bzero(&dumper, sizeof dumper); Modified: stable/10/sys/sys/conf.h ============================================================================== --- stable/10/sys/sys/conf.h Mon Nov 23 17:27:29 2015 (r291214) +++ stable/10/sys/sys/conf.h Mon Nov 23 18:00:55 2015 (r291215) @@ -337,7 +337,7 @@ struct dumperinfo { off_t mediasize; /* Space available in bytes. */ }; -int set_dumper(struct dumperinfo *, const char *_devname); +int set_dumper(struct dumperinfo *, const char *_devname, struct thread *td); int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t); void dumpsys(struct dumperinfo *); int doadump(boolean_t); From owner-svn-src-stable-10@freebsd.org Tue Nov 24 08:41:29 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60737A36605; Tue, 24 Nov 2015 08:41:29 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3660E1251; Tue, 24 Nov 2015 08:41:29 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAO8fS9d022581; Tue, 24 Nov 2015 08:41:28 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAO8fRbl021905; Tue, 24 Nov 2015 08:41:27 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201511240841.tAO8fRbl021905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Tue, 24 Nov 2015 08:41: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: r291239 - in stable/10/sys: dev/xen/blkfront dev/xen/netfront x86/xen xen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 08:41:29 -0000 Author: royger Date: Tue Nov 24 08:41:27 2015 New Revision: 291239 URL: https://svnweb.freebsd.org/changeset/base/291239 Log: MFC r286999: xen: allow disabling PV disks and nics Sponsored by: Citrix Systems R&D Modified: stable/10/sys/dev/xen/blkfront/blkfront.c stable/10/sys/dev/xen/netfront/netfront.c stable/10/sys/x86/xen/hvm.c stable/10/sys/xen/xen-os.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Tue Nov 24 08:34:48 2015 (r291238) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Tue Nov 24 08:41:27 2015 (r291239) @@ -1367,6 +1367,11 @@ xbd_probe(device_t dev) if (strcmp(xenbus_get_type(dev), "vbd") != 0) return (ENXIO); +#ifdef XENHVM + if (xen_disable_pv_disks != 0) + return (ENXIO); +#endif + if (xen_hvm_domain()) { int error; char *type; Modified: stable/10/sys/dev/xen/netfront/netfront.c ============================================================================== --- stable/10/sys/dev/xen/netfront/netfront.c Tue Nov 24 08:34:48 2015 (r291238) +++ stable/10/sys/dev/xen/netfront/netfront.c Tue Nov 24 08:41:27 2015 (r291239) @@ -451,6 +451,11 @@ static int netfront_probe(device_t dev) { +#ifdef XENHVM + if (xen_disable_pv_nics != 0) + return (ENXIO); +#endif + if (!strcmp(xenbus_get_type(dev), "vif")) { device_set_desc(dev, "Virtual Network Interface"); return (0); Modified: stable/10/sys/x86/xen/hvm.c ============================================================================== --- stable/10/sys/x86/xen/hvm.c Tue Nov 24 08:34:48 2015 (r291238) +++ stable/10/sys/x86/xen/hvm.c Tue Nov 24 08:41:27 2015 (r291239) @@ -152,6 +152,13 @@ DPCPU_DEFINE(xen_intr_handle_t, ipi_hand char *hypercall_stubs; shared_info_t *HYPERVISOR_shared_info; + +/*------------------------------ Sysctl tunables -----------------------------*/ +int xen_disable_pv_disks = 0; +int xen_disable_pv_nics = 0; +TUNABLE_INT("hw.xen.disable_pv_disks", &xen_disable_pv_disks); +TUNABLE_INT("hw.xen.disable_pv_nics", &xen_disable_pv_nics); + #ifdef SMP /*---------------------------- XEN PV IPI Handlers ---------------------------*/ /* @@ -303,7 +310,7 @@ xen_ipi_vectored(u_int vector, int dest) } } -/* XEN diverged cpu operations */ +/*---------------------- XEN diverged cpu operations -------------------------*/ static void xen_hvm_cpu_resume(void) { @@ -503,12 +510,24 @@ enum { static void xen_hvm_disable_emulated_devices(void) { + u_short disable_devs = 0; + if (inw(XEN_MAGIC_IOPORT) != XMI_MAGIC) return; - if (bootverbose) - printf("XEN: Disabling emulated block and network devices\n"); - outw(XEN_MAGIC_IOPORT, XMI_UNPLUG_IDE_DISKS|XMI_UNPLUG_NICS); + if (xen_disable_pv_disks == 0) { + if (bootverbose) + printf("XEN: disabling emulated disks\n"); + disable_devs |= XMI_UNPLUG_IDE_DISKS; + } + if (xen_disable_pv_nics == 0) { + if (bootverbose) + printf("XEN: disabling emulated nics\n"); + disable_devs |= XMI_UNPLUG_NICS; + } + + if (disable_devs != 0) + outw(XEN_MAGIC_IOPORT, disable_devs); } static void Modified: stable/10/sys/xen/xen-os.h ============================================================================== --- stable/10/sys/xen/xen-os.h Tue Nov 24 08:34:48 2015 (r291238) +++ stable/10/sys/xen/xen-os.h Tue Nov 24 08:41:27 2015 (r291239) @@ -52,6 +52,11 @@ void force_evtchn_callback(void); extern shared_info_t *HYPERVISOR_shared_info; +#ifdef XENHVM +extern int xen_disable_pv_disks; +extern int xen_disable_pv_nics; +#endif + enum xen_domain_type { XEN_NATIVE, /* running on bare hardware */ XEN_PV_DOMAIN, /* running in a PV domain */ From owner-svn-src-stable-10@freebsd.org Tue Nov 24 09:17:52 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C27FA36ECB; Tue, 24 Nov 2015 09:17:52 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qg0-x22a.google.com (mail-qg0-x22a.google.com [IPv6:2607:f8b0:400d:c04::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06C431840; Tue, 24 Nov 2015 09:17:52 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by qgea14 with SMTP id a14so6266963qge.0; Tue, 24 Nov 2015 01:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/MzzZVoCVvPU5WT4sL+qhQYSvZFThlCPqphdphqAcWQ=; b=K5XfDhK6gZWj07h7eP31shXDmVJaQVg9KdPS6W2R5L+oypHIC1vgYrMAfVu59B/SWs pUofNirrZ6/93BFW5NeUoy7ZlHpdEb8qqbDgOvGjWhlJyLz5ZnF/51KWcdo5JPin47mk 09gn5vpez0V0kTyvl+HGpM5aZ0rCwNTGh7nG4nxIRExj0z5X4Z2X/Couj88AgFNlISoE pX1Jc4LRpLoaD3fZ/XkU7feOg/SynX9+f59HWT8zx5UKB1IKwCyPdTFGsTO3DciMXVcx sYHSu+EW/pC5nYdRYfmuqeLsVNSp0AbKsmMfR2HvHq/4e1m4fMmPxFud5u82dhthWmAK S5BQ== X-Received: by 10.140.159.134 with SMTP id f128mr33415974qhf.72.1448356671018; Tue, 24 Nov 2015 01:17:51 -0800 (PST) Received: from mbp.home (179-125-129-84.desktop.com.br. [179.125.129.84]) by smtp.gmail.com with ESMTPSA id 79sm4046902qkv.23.2015.11.24.01.17.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Nov 2015 01:17:50 -0800 (PST) Sender: Renato Botelho Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Subject: Re: svn commit: r291239 - in stable/10/sys: dev/xen/blkfront dev/xen/netfront x86/xen xen From: Renato Botelho In-Reply-To: <201511240841.tAO8fRbl021905@repo.freebsd.org> Date: Tue, 24 Nov 2015 07:17:46 -0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0DE43DB0-F3EB-4CD7-8637-1356E4DFD84C@FreeBSD.org> References: <201511240841.tAO8fRbl021905@repo.freebsd.org> To: =?utf-8?Q?Roger_Pau_Monn=C3=A9?= X-Mailer: Apple Mail (2.3096.5) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 09:17:52 -0000 > On Nov 24, 2015, at 06:41, Roger Pau Monn=C3=A9 = wrote: >=20 > Author: royger > Date: Tue Nov 24 08:41:27 2015 > New Revision: 291239 > URL: https://svnweb.freebsd.org/changeset/base/291239 >=20 > Log: > MFC r286999: >=20 > xen: allow disabling PV disks and nics >=20 > Sponsored by: Citrix Systems R&D Thanks! -- Renato Botelho From owner-svn-src-stable-10@freebsd.org Tue Nov 24 09:41:51 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 900E9A35643; Tue, 24 Nov 2015 09:41:51 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58A8B1885; Tue, 24 Nov 2015 09:41:51 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAO9fonB041051; Tue, 24 Nov 2015 09:41:50 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAO9fonq041050; Tue, 24 Nov 2015 09:41:50 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511240941.tAO9fonq041050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 24 Nov 2015 09:41: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: r291243 - 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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 09:41:51 -0000 Author: smh Date: Tue Nov 24 09:41:50 2015 New Revision: 291243 URL: https://svnweb.freebsd.org/changeset/base/291243 Log: Belatedly bump __FreeBSD_version after r291215 Due to the change in args for g_dev_setdumpdev by r291215 belatedly bump __FreeBSD_version to allow any potential consumers to check for this, as requested by delphij. This is a direct commit to stable/10 Approved by: so (delphij) Sponsored by: Multiplay Modified: stable/10/sys/sys/param.h Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Tue Nov 24 09:13:21 2015 (r291242) +++ stable/10/sys/sys/param.h Tue Nov 24 09:41:50 2015 (r291243) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1002501 /* Master, propagated to newvers */ +#define __FreeBSD_version 1002502 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-10@freebsd.org Tue Nov 24 11:09:41 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7CCBA36A1D; Tue, 24 Nov 2015 11:09:41 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 416EE13DF; Tue, 24 Nov 2015 11:09:41 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAOB9emZ064517; Tue, 24 Nov 2015 11:09:40 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAOB9ehU064512; Tue, 24 Nov 2015 11:09:40 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511241109.tAOB9ehU064512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 24 Nov 2015 11:09: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: r291248 - stable/10/sys/dev/ixl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 11:09:41 -0000 Author: smh Date: Tue Nov 24 11:09:39 2015 New Revision: 291248 URL: https://svnweb.freebsd.org/changeset/base/291248 Log: MFC r277082: Update to the shared code for Intel I40E drivers (by jfv) Sponsored by: Multiplay Modified: stable/10/sys/dev/ixl/i40e_adminq.c stable/10/sys/dev/ixl/i40e_adminq.h stable/10/sys/dev/ixl/i40e_adminq_cmd.h stable/10/sys/dev/ixl/i40e_common.c stable/10/sys/dev/ixl/i40e_lan_hmc.c stable/10/sys/dev/ixl/i40e_nvm.c stable/10/sys/dev/ixl/i40e_prototype.h stable/10/sys/dev/ixl/i40e_register.h stable/10/sys/dev/ixl/i40e_type.h stable/10/sys/dev/ixl/i40e_virtchnl.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ixl/i40e_adminq.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq.c Tue Nov 24 11:07:37 2015 (r291247) +++ stable/10/sys/dev/ixl/i40e_adminq.c Tue Nov 24 11:09:39 2015 (r291248) @@ -589,10 +589,10 @@ enum i40e_status_code i40e_init_adminq(s if (ret_code != I40E_SUCCESS) goto init_adminq_free_asq; - if (i40e_is_vf(hw)) /* VF has no need of firmware */ - goto init_adminq_exit; - -/* There are some cases where the firmware may not be quite ready + /* VF has no need of firmware */ + if (i40e_is_vf(hw)) + goto init_adminq_exit; + /* There are some cases where the firmware may not be quite ready * for AdminQ operations, so we retry the AdminQ setup a few times * if we see timeouts in this first AQ call. */ @@ -600,6 +600,7 @@ enum i40e_status_code i40e_init_adminq(s ret_code = i40e_aq_get_firmware_version(hw, &hw->aq.fw_maj_ver, &hw->aq.fw_min_ver, + &hw->aq.fw_build, &hw->aq.api_maj_ver, &hw->aq.api_min_ver, NULL); @@ -625,7 +626,8 @@ enum i40e_status_code i40e_init_adminq(s /* pre-emptive resource lock release */ i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL); - hw->aq.nvm_busy = FALSE; + hw->aq.nvm_release_on_done = FALSE; + hw->nvmupd_state = I40E_NVMUPD_STATE_INIT; ret_code = i40e_aq_set_hmc_resource_profile(hw, I40E_HMC_PROFILE_DEFAULT, @@ -767,12 +769,6 @@ enum i40e_status_code i40e_asq_send_comm goto asq_send_command_exit; } - if (i40e_is_nvm_update_op(desc) && hw->aq.nvm_busy) { - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: NVM busy.\n"); - status = I40E_ERR_NVM; - goto asq_send_command_exit; - } - details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); if (cmd_details) { i40e_memcpy(details, @@ -924,9 +920,6 @@ enum i40e_status_code i40e_asq_send_comm status = I40E_ERR_ADMIN_QUEUE_TIMEOUT; } - if (!status && i40e_is_nvm_update_op(desc)) - hw->aq.nvm_busy = TRUE; - asq_send_command_error: i40e_release_spinlock(&hw->aq.asq_spinlock); asq_send_command_exit: @@ -1042,7 +1035,6 @@ clean_arq_element_out: i40e_release_spinlock(&hw->aq.arq_spinlock); if (i40e_is_nvm_update_op(&e->desc)) { - hw->aq.nvm_busy = FALSE; if (hw->aq.nvm_release_on_done) { i40e_release_nvm(hw); hw->aq.nvm_release_on_done = FALSE; Modified: stable/10/sys/dev/ixl/i40e_adminq.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq.h Tue Nov 24 11:07:37 2015 (r291247) +++ stable/10/sys/dev/ixl/i40e_adminq.h Tue Nov 24 11:09:39 2015 (r291248) @@ -36,6 +36,7 @@ #define _I40E_ADMINQ_H_ #include "i40e_osdep.h" +#include "i40e_status.h" #include "i40e_adminq_cmd.h" #define I40E_ADMINQ_DESC(R, i) \ @@ -100,9 +101,9 @@ struct i40e_adminq_info { u16 asq_buf_size; /* send queue buffer size */ u16 fw_maj_ver; /* firmware major version */ u16 fw_min_ver; /* firmware minor version */ + u32 fw_build; /* firmware build number */ u16 api_maj_ver; /* api major version */ u16 api_min_ver; /* api minor version */ - bool nvm_busy; bool nvm_release_on_done; struct i40e_spinlock asq_spinlock; /* Send queue spinlock */ @@ -115,7 +116,7 @@ struct i40e_adminq_info { /* general information */ #define I40E_AQ_LARGE_BUF 512 -#define I40E_ASQ_CMD_TIMEOUT 100 /* msecs */ +#define I40E_ASQ_CMD_TIMEOUT 250 /* msecs */ void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc, u16 opcode); Modified: stable/10/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- stable/10/sys/dev/ixl/i40e_adminq_cmd.h Tue Nov 24 11:07:37 2015 (r291247) +++ stable/10/sys/dev/ixl/i40e_adminq_cmd.h Tue Nov 24 11:09:39 2015 (r291248) @@ -263,6 +263,9 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_lldp_delete_tlv = 0x0A04, i40e_aqc_opc_lldp_stop = 0x0A05, i40e_aqc_opc_lldp_start = 0x0A06, + i40e_aqc_opc_get_cee_dcb_cfg = 0x0A07, + i40e_aqc_opc_lldp_set_local_mib = 0x0A08, + i40e_aqc_opc_lldp_stop_start_spec_agent = 0x0A09, /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, @@ -275,6 +278,8 @@ enum i40e_admin_queue_opc { /* OEM commands */ i40e_aqc_opc_oem_parameter_change = 0xFE00, i40e_aqc_opc_oem_device_status_change = 0xFE01, + i40e_aqc_opc_oem_ocsd_initialize = 0xFE02, + i40e_aqc_opc_oem_ocbb_initialize = 0xFE03, /* debug commands */ i40e_aqc_opc_debug_get_deviceid = 0xFF00, @@ -283,7 +288,6 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_debug_write_reg = 0xFF04, i40e_aqc_opc_debug_modify_reg = 0xFF07, i40e_aqc_opc_debug_dump_internals = 0xFF08, - i40e_aqc_opc_debug_modify_internals = 0xFF09, }; /* command structures and indirect data structures */ @@ -417,6 +421,7 @@ struct i40e_aqc_list_capabilities_elemen #define I40E_AQ_CAP_ID_VSI 0x0017 #define I40E_AQ_CAP_ID_DCB 0x0018 #define I40E_AQ_CAP_ID_FCOE 0x0021 +#define I40E_AQ_CAP_ID_ISCSI 0x0022 #define I40E_AQ_CAP_ID_RSS 0x0040 #define I40E_AQ_CAP_ID_RXQ 0x0041 #define I40E_AQ_CAP_ID_TXQ 0x0042 @@ -461,8 +466,11 @@ struct i40e_aqc_arp_proxy_data { __le32 pfpm_proxyfc; __le32 ip_addr; u8 mac_addr[6]; + u8 reserved[2]; }; +I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data); + /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct i40e_aqc_ns_proxy_data { __le16 table_idx_mac_addr_0; @@ -488,6 +496,8 @@ struct i40e_aqc_ns_proxy_data { u8 ipv6_addr_1[16]; }; +I40E_CHECK_STRUCT_LEN(0x3c, i40e_aqc_ns_proxy_data); + /* Manage LAA Command (0x0106) - obsolete */ struct i40e_aqc_mng_laa { __le16 command_flags; @@ -498,6 +508,8 @@ struct i40e_aqc_mng_laa { u8 reserved2[6]; }; +I40E_CHECK_CMD_LENGTH(i40e_aqc_mng_laa); + /* Manage MAC Address Read Command (indirect 0x0107) */ struct i40e_aqc_mac_address_read { __le16 command_flags; @@ -569,6 +581,8 @@ struct i40e_aqc_get_switch_config_header u8 reserved[12]; }; +I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_config_header_resp); + struct i40e_aqc_switch_config_element_resp { u8 element_type; #define I40E_AQ_SW_ELEM_TYPE_MAC 1 @@ -594,6 +608,8 @@ struct i40e_aqc_switch_config_element_re __le16 element_info; }; +I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_config_element_resp); + /* Get Switch Configuration (indirect 0x0200) * an array of elements are returned in the response buffer * the first in the array is the header, remainder are elements @@ -603,6 +619,8 @@ struct i40e_aqc_get_switch_config_resp { struct i40e_aqc_switch_config_element_resp element[1]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_switch_config_resp); + /* Add Statistics (direct 0x0201) * Remove Statistics (direct 0x0202) */ @@ -668,6 +686,8 @@ struct i40e_aqc_switch_resource_alloc_el u8 reserved2[6]; }; +I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp); + /* Add VSI (indirect 0x0210) * this indirect command uses struct i40e_aqc_vsi_properties_data * as the indirect buffer (128 bytes) @@ -1099,6 +1119,8 @@ struct i40e_aqc_remove_tag { u8 reserved[12]; }; +I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_tag); + /* Add multicast E-Tag (direct 0x0257) * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields * and no external data @@ -1214,7 +1236,7 @@ struct i40e_aqc_add_remove_cloud_filters } ipaddr; __le16 flags; #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0 -#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \ +#define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \ I40E_AQC_ADD_CLOUD_FILTER_SHIFT) /* 0x0000 reserved */ #define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001 @@ -1247,7 +1269,7 @@ struct i40e_aqc_add_remove_cloud_filters u8 reserved[4]; __le16 queue_number; #define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0 -#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x3F << \ +#define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x7FF << \ I40E_AQC_ADD_CLOUD_QUEUE_SHIFT) u8 reserved2[14]; /* response section */ @@ -1366,6 +1388,8 @@ struct i40e_aqc_configure_vsi_ets_sla_bw u8 reserved1[28]; }; +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_vsi_ets_sla_bw_data); + /* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407) * responds with i40e_aqc_qs_handles_resp */ @@ -1377,6 +1401,8 @@ struct i40e_aqc_configure_vsi_tc_bw_data __le16 qs_handles[8]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_vsi_tc_bw_data); + /* Query vsi bw configuration (indirect 0x0408) */ struct i40e_aqc_query_vsi_bw_config_resp { u8 tc_valid_bits; @@ -1390,6 +1416,8 @@ struct i40e_aqc_query_vsi_bw_config_resp u8 reserved3[23]; }; +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_vsi_bw_config_resp); + /* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */ struct i40e_aqc_query_vsi_ets_sla_config_resp { u8 tc_valid_bits; @@ -1401,6 +1429,8 @@ struct i40e_aqc_query_vsi_ets_sla_config __le16 tc_bw_max[2]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_vsi_ets_sla_config_resp); + /* Configure Switching Component Bandwidth Limit (direct 0x0410) */ struct i40e_aqc_configure_switching_comp_bw_limit { __le16 seid; @@ -1428,6 +1458,8 @@ struct i40e_aqc_configure_switching_comp u8 reserved2[96]; }; +I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_configure_switching_comp_ets_data); + /* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */ struct i40e_aqc_configure_switching_comp_ets_bw_limit_data { u8 tc_valid_bits; @@ -1439,6 +1471,8 @@ struct i40e_aqc_configure_switching_comp u8 reserved1[28]; }; +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_switching_comp_ets_bw_limit_data); + /* Configure Switching Component Bandwidth Allocation per Tc * (indirect 0x0417) */ @@ -1450,6 +1484,8 @@ struct i40e_aqc_configure_switching_comp u8 reserved1[20]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_switching_comp_bw_config_data); + /* Query Switching Component Configuration (indirect 0x0418) */ struct i40e_aqc_query_switching_comp_ets_config_resp { u8 tc_valid_bits; @@ -1460,6 +1496,8 @@ struct i40e_aqc_query_switching_comp_ets u8 reserved2[23]; }; +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_switching_comp_ets_config_resp); + /* Query PhysicalPort ETS Configuration (indirect 0x0419) */ struct i40e_aqc_query_port_ets_config_resp { u8 reserved[4]; @@ -1475,6 +1513,8 @@ struct i40e_aqc_query_port_ets_config_re u8 reserved3[32]; }; +I40E_CHECK_STRUCT_LEN(0x44, i40e_aqc_query_port_ets_config_resp); + /* Query Switching Component Bandwidth Allocation per Traffic Type * (indirect 0x041A) */ @@ -1489,6 +1529,8 @@ struct i40e_aqc_query_switching_comp_bw_ __le16 tc_bw_max[2]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_switching_comp_bw_config_resp); + /* Suspend/resume port TX traffic * (direct 0x041B and 0x041C) uses the generic SEID struct */ @@ -1502,6 +1544,8 @@ struct i40e_aqc_configure_partition_bw_d u8 max_bw[16]; /* bandwidth limit */ }; +I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data); + /* Get and set the active HMC resource profile and status. * (direct 0x0500) and (direct 0x0501) */ @@ -1584,6 +1628,8 @@ struct i40e_aqc_module_desc { u8 reserved2[8]; }; +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_module_desc); + struct i40e_aq_get_phy_abilities_resp { __le32 phy_type; /* bitmap using the above enum for offsets */ u8 link_speed; /* bitmap using the above enum bit patterns */ @@ -1612,6 +1658,8 @@ struct i40e_aq_get_phy_abilities_resp { struct i40e_aqc_module_desc qualified_module[I40E_AQ_PHY_MAX_QMS]; }; +I40E_CHECK_STRUCT_LEN(0x218, i40e_aq_get_phy_abilities_resp); + /* Set PHY Config (direct 0x0601) */ struct i40e_aq_set_phy_config { /* same bits as above in all */ __le32 phy_type; @@ -1795,12 +1843,12 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_updat /* NVM Config Read (indirect 0x0704) */ struct i40e_aqc_nvm_config_read { __le16 cmd_flags; -#define ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1 -#define ANVM_READ_SINGLE_FEATURE 0 -#define ANVM_READ_MULTIPLE_FEATURES 1 +#define I40E_AQ_ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1 +#define I40E_AQ_ANVM_READ_SINGLE_FEATURE 0 +#define I40E_AQ_ANVM_READ_MULTIPLE_FEATURES 1 __le16 element_count; - __le16 element_id; /* Feature/field ID */ - u8 reserved[2]; + __le16 element_id; /* Feature/field ID */ + __le16 element_id_msw; /* MSWord of field ID */ __le32 address_high; __le32 address_low; }; @@ -1818,21 +1866,31 @@ struct i40e_aqc_nvm_config_write { I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write); +/* Used for 0x0704 as well as for 0x0705 commands */ +#define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT 1 +#define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK (1 << I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT) +#define I40E_AQ_ANVM_FEATURE 0 +#define I40E_AQ_ANVM_IMMEDIATE_FIELD (1 << FEATURE_OR_IMMEDIATE_SHIFT) struct i40e_aqc_nvm_config_data_feature { __le16 feature_id; - __le16 instance_id; +#define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY 0x01 +#define I40E_AQ_ANVM_FEATURE_OPTION_DWORD_MAP 0x08 +#define I40E_AQ_ANVM_FEATURE_OPTION_POR_CSR 0x10 __le16 feature_options; __le16 feature_selection; }; +I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature); + struct i40e_aqc_nvm_config_data_immediate_field { -#define ANVM_FEATURE_OR_IMMEDIATE_MASK 0x2 - __le16 field_id; - __le16 instance_id; + __le32 field_id; + __le32 field_value; __le16 field_options; - __le16 field_value; + __le16 reserved; }; +I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field); + /* Send to PF command (indirect 0x0801) id is only used by PF * Send to VF command (indirect 0x0802) id is only used by PF * Send to Peer PF command (indirect 0x0803) @@ -1995,9 +2053,77 @@ struct i40e_aqc_lldp_start { I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start); -/* Apply MIB changes (0x0A07) - * uses the generic struc as it contains no data +/* Get CEE DCBX Oper Config (0x0A07) + * uses the generic descriptor struct + * returns below as indirect response + */ + +#define I40E_AQC_CEE_APP_FCOE_SHIFT 0x0 +#define I40E_AQC_CEE_APP_FCOE_MASK (0x7 << I40E_AQC_CEE_APP_FCOE_SHIFT) +#define I40E_AQC_CEE_APP_ISCSI_SHIFT 0x3 +#define I40E_AQC_CEE_APP_ISCSI_MASK (0x7 << I40E_AQC_CEE_APP_ISCSI_SHIFT) +#define I40E_AQC_CEE_APP_FIP_SHIFT 0x8 +#define I40E_AQC_CEE_APP_FIP_MASK (0x7 << I40E_AQC_CEE_APP_FIP_SHIFT) +#define I40E_AQC_CEE_PG_STATUS_SHIFT 0x0 +#define I40E_AQC_CEE_PG_STATUS_MASK (0x7 << I40E_AQC_CEE_PG_STATUS_SHIFT) +#define I40E_AQC_CEE_PFC_STATUS_SHIFT 0x3 +#define I40E_AQC_CEE_PFC_STATUS_MASK (0x7 << I40E_AQC_CEE_PFC_STATUS_SHIFT) +#define I40E_AQC_CEE_APP_STATUS_SHIFT 0x8 +#define I40E_AQC_CEE_APP_STATUS_MASK (0x7 << I40E_AQC_CEE_APP_STATUS_SHIFT) +struct i40e_aqc_get_cee_dcb_cfg_v1_resp { + u8 reserved1; + u8 oper_num_tc; + u8 oper_prio_tc[4]; + u8 reserved2; + u8 oper_tc_bw[8]; + u8 oper_pfc_en; + u8 reserved3; + __le16 oper_app_prio; + u8 reserved4; + __le16 tlv_status; +}; + +I40E_CHECK_STRUCT_LEN(0x18, i40e_aqc_get_cee_dcb_cfg_v1_resp); + +struct i40e_aqc_get_cee_dcb_cfg_resp { + u8 oper_num_tc; + u8 oper_prio_tc[4]; + u8 oper_tc_bw[8]; + u8 oper_pfc_en; + __le16 oper_app_prio; + __le32 tlv_status; + u8 reserved[12]; +}; + +I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_cee_dcb_cfg_resp); + +/* Set Local LLDP MIB (indirect 0x0A08) + * Used to replace the local MIB of a given LLDP agent. e.g. DCBx + */ +struct i40e_aqc_lldp_set_local_mib { +#define SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT 0 +#define SET_LOCAL_MIB_AC_TYPE_DCBX_MASK (1 << SET_LOCAL_MIB_AC_TYPE_DCBX_SHIFT) + u8 type; + u8 reserved0; + __le16 length; + u8 reserved1[4]; + __le32 address_high; + __le32 address_low; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_set_local_mib); + +/* Stop/Start LLDP Agent (direct 0x0A09) + * Used for stopping/starting specific LLDP agent. e.g. DCBx */ +struct i40e_aqc_lldp_stop_start_specific_agent { +#define I40E_AQC_START_SPECIFIC_AGENT_SHIFT 0 +#define I40E_AQC_START_SPECIFIC_AGENT_MASK (1 << I40E_AQC_START_SPECIFIC_AGENT_SHIFT) + u8 command; + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent); /* Add Udp Tunnel command and completion (direct 0x0B00) */ struct i40e_aqc_add_udp_tunnel { @@ -2073,7 +2199,8 @@ struct i40e_aqc_oem_param_change { #define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1 #define I40E_AQ_OEM_PARAM_MAC 2 __le32 param_value1; - u8 param_value2[8]; + __le16 param_value2; + u8 reserved[6]; }; I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change); @@ -2087,6 +2214,28 @@ struct i40e_aqc_oem_state_change { I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change); +/* Initialize OCSD (0xFE02, direct) */ +struct i40e_aqc_opc_oem_ocsd_initialize { + u8 type_status; + u8 reserved1[3]; + __le32 ocsd_memory_block_addr_high; + __le32 ocsd_memory_block_addr_low; + __le32 requested_update_interval; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocsd_initialize); + +/* Initialize OCBB (0xFE03, direct) */ +struct i40e_aqc_opc_oem_ocbb_initialize { + u8 type_status; + u8 reserved1[3]; + __le32 ocbb_memory_block_addr_high; + __le32 ocbb_memory_block_addr_low; + u8 reserved2[4]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocbb_initialize); + /* debug commands */ /* get device id (0xFF00) uses the generic structure */ Modified: stable/10/sys/dev/ixl/i40e_common.c ============================================================================== --- stable/10/sys/dev/ixl/i40e_common.c Tue Nov 24 11:07:37 2015 (r291247) +++ stable/10/sys/dev/ixl/i40e_common.c Tue Nov 24 11:09:39 2015 (r291248) @@ -95,47 +95,51 @@ void i40e_debug_aq(struct i40e_hw *hw, e { struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; u16 len = LE16_TO_CPU(aq_desc->datalen); - u8 *aq_buffer = (u8 *)buffer; - u32 data[4]; - u32 i = 0; + u8 *buf = (u8 *)buffer; + u16 i = 0; if ((!(mask & hw->debug_mask)) || (desc == NULL)) return; i40e_debug(hw, mask, "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n", - aq_desc->opcode, aq_desc->flags, aq_desc->datalen, - aq_desc->retval); + LE16_TO_CPU(aq_desc->opcode), + LE16_TO_CPU(aq_desc->flags), + LE16_TO_CPU(aq_desc->datalen), + LE16_TO_CPU(aq_desc->retval)); i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n", - aq_desc->cookie_high, aq_desc->cookie_low); + LE32_TO_CPU(aq_desc->cookie_high), + LE32_TO_CPU(aq_desc->cookie_low)); i40e_debug(hw, mask, "\tparam (0,1) 0x%08X 0x%08X\n", - aq_desc->params.internal.param0, - aq_desc->params.internal.param1); + LE32_TO_CPU(aq_desc->params.internal.param0), + LE32_TO_CPU(aq_desc->params.internal.param1)); i40e_debug(hw, mask, "\taddr (h,l) 0x%08X 0x%08X\n", - aq_desc->params.external.addr_high, - aq_desc->params.external.addr_low); + LE32_TO_CPU(aq_desc->params.external.addr_high), + LE32_TO_CPU(aq_desc->params.external.addr_low)); if ((buffer != NULL) && (aq_desc->datalen != 0)) { - i40e_memset(data, 0, sizeof(data), I40E_NONDMA_MEM); i40e_debug(hw, mask, "AQ CMD Buffer:\n"); if (buf_len < len) len = buf_len; - for (i = 0; i < len; i++) { - data[((i % 16) / 4)] |= - ((u32)aq_buffer[i]) << (8 * (i % 4)); - if ((i % 16) == 15) { - i40e_debug(hw, mask, - "\t0x%04X %08X %08X %08X %08X\n", - i - 15, data[0], data[1], data[2], - data[3]); - i40e_memset(data, 0, sizeof(data), - I40E_NONDMA_MEM); - } + /* write the full 16-byte chunks */ + for (i = 0; i < (len - 16); i += 16) + i40e_debug(hw, mask, + "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + i, buf[i], buf[i+1], buf[i+2], buf[i+3], + buf[i+4], buf[i+5], buf[i+6], buf[i+7], + buf[i+8], buf[i+9], buf[i+10], buf[i+11], + buf[i+12], buf[i+13], buf[i+14], buf[i+15]); + /* write whatever's left over without overrunning the buffer */ + if (i < len) { + char d_buf[80]; + int j = 0; + + memset(d_buf, 0, sizeof(d_buf)); + j += sprintf(d_buf, "\t0x%04X ", i); + while (i < len) + j += sprintf(&d_buf[j], " %02X", buf[i++]); + i40e_debug(hw, mask, "%s\n", d_buf); } - if ((i % 16) != 0) - i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n", - i - (i % 16), data[0], data[1], data[2], - data[3]); } } @@ -546,6 +550,30 @@ struct i40e_rx_ptype_decoded i40e_ptype_ /** + * i40e_validate_mac_addr - Validate unicast MAC address + * @mac_addr: pointer to MAC address + * + * Tests a MAC address to ensure it is a valid Individual Address + **/ +enum i40e_status_code i40e_validate_mac_addr(u8 *mac_addr) +{ + enum i40e_status_code status = I40E_SUCCESS; + + DEBUGFUNC("i40e_validate_mac_addr"); + + /* Broadcast addresses ARE multicast addresses + * Make sure it is not a multicast address + * Reject the zero address + */ + if (I40E_IS_MULTICAST(mac_addr) || + (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 && + mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)) + status = I40E_ERR_INVALID_MAC_ADDR; + + return status; +} + +/** * i40e_init_shared_code - Initialize the shared code * @hw: pointer to hardware structure * @@ -560,7 +588,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw) { enum i40e_status_code status = I40E_SUCCESS; - u32 reg; + u32 port, ari, func_rid; DEBUGFUNC("i40e_init_shared_code"); @@ -575,18 +603,17 @@ enum i40e_status_code i40e_init_shared_c hw->phy.get_link_info = TRUE; - /* Determine port number */ - reg = rd32(hw, I40E_PFGEN_PORTNUM); - reg = ((reg & I40E_PFGEN_PORTNUM_PORT_NUM_MASK) >> - I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT); - hw->port = (u8)reg; - - /* Determine the PF number based on the PCI fn */ - reg = rd32(hw, I40E_GLPCI_CAPSUP); - if (reg & I40E_GLPCI_CAPSUP_ARI_EN_MASK) - hw->pf_id = (u8)((hw->bus.device << 3) | hw->bus.func); + /* Determine port number and PF number*/ + port = (rd32(hw, I40E_PFGEN_PORTNUM) & I40E_PFGEN_PORTNUM_PORT_NUM_MASK) + >> I40E_PFGEN_PORTNUM_PORT_NUM_SHIFT; + hw->port = (u8)port; + ari = (rd32(hw, I40E_GLPCI_CAPSUP) & I40E_GLPCI_CAPSUP_ARI_EN_MASK) >> + I40E_GLPCI_CAPSUP_ARI_EN_SHIFT; + func_rid = rd32(hw, I40E_PF_FUNC_RID); + if (ari) + hw->pf_id = (u8)(func_rid & 0xff); else - hw->pf_id = (u8)hw->bus.func; + hw->pf_id = (u8)(func_rid & 0x7); status = i40e_init_nvm(hw); return status; @@ -728,25 +755,60 @@ void i40e_pre_tx_queue_cfg(struct i40e_h } /** - * i40e_validate_mac_addr - Validate unicast MAC address - * @mac_addr: pointer to MAC address + * i40e_read_pba_string - Reads part number string from EEPROM + * @hw: pointer to hardware structure + * @pba_num: stores the part number string from the EEPROM + * @pba_num_size: part number string buffer length * - * Tests a MAC address to ensure it is a valid Individual Address + * Reads the part number string from the EEPROM. **/ -enum i40e_status_code i40e_validate_mac_addr(u8 *mac_addr) +enum i40e_status_code i40e_read_pba_string(struct i40e_hw *hw, u8 *pba_num, + u32 pba_num_size) { enum i40e_status_code status = I40E_SUCCESS; + u16 pba_word = 0; + u16 pba_size = 0; + u16 pba_ptr = 0; + u16 i = 0; + + status = i40e_read_nvm_word(hw, I40E_SR_PBA_FLAGS, &pba_word); + if ((status != I40E_SUCCESS) || (pba_word != 0xFAFA)) { + DEBUGOUT("Failed to read PBA flags or flag is invalid.\n"); + return status; + } - DEBUGFUNC("i40e_validate_mac_addr"); + status = i40e_read_nvm_word(hw, I40E_SR_PBA_BLOCK_PTR, &pba_ptr); + if (status != I40E_SUCCESS) { + DEBUGOUT("Failed to read PBA Block pointer.\n"); + return status; + } - /* Broadcast addresses ARE multicast addresses - * Make sure it is not a multicast address - * Reject the zero address + status = i40e_read_nvm_word(hw, pba_ptr, &pba_size); + if (status != I40E_SUCCESS) { + DEBUGOUT("Failed to read PBA Block size.\n"); + return status; + } + + /* Subtract one to get PBA word count (PBA Size word is included in + * total size) */ - if (I40E_IS_MULTICAST(mac_addr) || - (mac_addr[0] == 0 && mac_addr[1] == 0 && mac_addr[2] == 0 && - mac_addr[3] == 0 && mac_addr[4] == 0 && mac_addr[5] == 0)) - status = I40E_ERR_INVALID_MAC_ADDR; + pba_size--; + if (pba_num_size < (((u32)pba_size * 2) + 1)) { + DEBUGOUT("Buffer to small for PBA data.\n"); + return I40E_ERR_PARAM; + } + + for (i = 0; i < pba_size; i++) { + status = i40e_read_nvm_word(hw, (pba_ptr + 1) + i, &pba_word); + if (status != I40E_SUCCESS) { + DEBUGOUT1("Failed to read PBA Block word %d.\n", i); + return status; + } + + pba_num[(i * 2)] = (pba_word >> 8) & 0xFF; + pba_num[(i * 2) + 1] = pba_word & 0xFF; + } + pba_num[(pba_size * 2)] = '\0'; return status; } @@ -799,7 +861,7 @@ static enum i40e_media_type i40e_get_med return media; } -#define I40E_PF_RESET_WAIT_COUNT 100 +#define I40E_PF_RESET_WAIT_COUNT 110 /** * i40e_pf_reset - Reset the PF * @hw: pointer to the hardware structure @@ -818,8 +880,9 @@ enum i40e_status_code i40e_pf_reset(stru * The grst delay value is in 100ms units, and we'll wait a * couple counts longer to be sure we don't just miss the end. */ - grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK - >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; + grst_del = (rd32(hw, I40E_GLGEN_RSTCTL) & + I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> + I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; for (cnt = 0; cnt < grst_del + 2; cnt++) { reg = rd32(hw, I40E_GLGEN_RSTAT); if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) @@ -1010,8 +1073,11 @@ static u32 i40e_led_is_mine(struct i40e_ return gpio_val; } -#define I40E_LED0 22 +#define I40E_COMBINED_ACTIVITY 0xA +#define I40E_FILTER_ACTIVITY 0xE #define I40E_LINK_ACTIVITY 0xC +#define I40E_MAC_ACTIVITY 0xD +#define I40E_LED0 22 /** * i40e_led_get - return current on/off mode @@ -1024,6 +1090,7 @@ static u32 i40e_led_is_mine(struct i40e_ **/ u32 i40e_led_get(struct i40e_hw *hw) { + u32 current_mode = 0; u32 mode = 0; int i; @@ -1036,6 +1103,20 @@ u32 i40e_led_get(struct i40e_hw *hw) if (!gpio_val) continue; + /* ignore gpio LED src mode entries related to the activity + * LEDs + */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) + >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + switch (current_mode) { + case I40E_COMBINED_ACTIVITY: + case I40E_FILTER_ACTIVITY: + case I40E_MAC_ACTIVITY: + continue; + default: + break; + } + mode = (gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT; break; @@ -1055,6 +1136,7 @@ u32 i40e_led_get(struct i40e_hw *hw) **/ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink) { + u32 current_mode = 0; int i; if (mode & 0xfffffff0) @@ -1069,6 +1151,20 @@ void i40e_led_set(struct i40e_hw *hw, u3 if (!gpio_val) continue; + /* ignore gpio LED src mode entries related to the activity + * LEDs + */ + current_mode = ((gpio_val & I40E_GLGEN_GPIO_CTL_LED_MODE_MASK) + >> I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT); + switch (current_mode) { + case I40E_COMBINED_ACTIVITY: + case I40E_FILTER_ACTIVITY: + case I40E_MAC_ACTIVITY: + continue; + default: + break; + } + gpio_val &= ~I40E_GLGEN_GPIO_CTL_LED_MODE_MASK; /* this & is a bit of paranoia, but serves as a range check */ gpio_val |= ((mode << I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) & @@ -1077,8 +1173,10 @@ void i40e_led_set(struct i40e_hw *hw, u3 if (mode == I40E_LINK_ACTIVITY) blink = FALSE; - gpio_val |= (blink ? 1 : 0) << - I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT; + if (blink) + gpio_val |= (1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); + else + gpio_val &= ~(1 << I40E_GLGEN_GPIO_CTL_LED_BLINK_SHIFT); wr32(hw, I40E_GLGEN_GPIO_CTL(i), gpio_val); break; @@ -1207,7 +1305,7 @@ enum i40e_status_code i40e_set_fc(struct return status; } - memset(&config, 0, sizeof(struct i40e_aq_set_phy_config)); + memset(&config, 0, sizeof(config)); /* clear the old pause settings */ config.abilities = abilities.abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX) & ~(I40E_AQ_PHY_FLAG_PAUSE_RX); @@ -1230,14 +1328,14 @@ enum i40e_status_code i40e_set_fc(struct *aq_failures |= I40E_SET_FC_AQ_FAIL_SET; } /* Update the link info */ - status = i40e_update_link_info(hw, TRUE); + status = i40e_aq_get_link_info(hw, TRUE, NULL, NULL); if (status) { /* Wait a little bit (on 40G cards it sometimes takes a really * long time for link to come back from the atomic reset) * and try once more */ i40e_msec_delay(1000); - status = i40e_update_link_info(hw, TRUE); + status = i40e_aq_get_link_info(hw, TRUE, NULL, NULL); } if (status) *aq_failures |= I40E_SET_FC_AQ_FAIL_UPDATE; @@ -1375,7 +1473,7 @@ enum i40e_status_code i40e_aq_get_link_i /* save off old link status information */ i40e_memcpy(&hw->phy.link_info_old, hw_link_info, - sizeof(struct i40e_link_status), I40E_NONDMA_TO_NONDMA); + sizeof(*hw_link_info), I40E_NONDMA_TO_NONDMA); /* update link status */ hw_link_info->phy_type = (enum i40e_aq_phy_type)resp->phy_type; @@ -1412,7 +1510,7 @@ enum i40e_status_code i40e_aq_get_link_i /* save link status information */ if (link) - i40e_memcpy(link, hw_link_info, sizeof(struct i40e_link_status), + i40e_memcpy(link, hw_link_info, sizeof(*hw_link_info), I40E_NONDMA_TO_NONDMA); /* flag cleared so helper functions don't call AQ again */ @@ -1423,36 +1521,6 @@ aq_get_link_info_exit: } /** - * i40e_update_link_info - * @hw: pointer to the hw struct - * @enable_lse: enable/disable LinkStatusEvent reporting - * - * Returns the link status of the adapter - **/ -enum i40e_status_code i40e_update_link_info(struct i40e_hw *hw, - bool enable_lse) -{ - struct i40e_aq_get_phy_abilities_resp abilities; - enum i40e_status_code status; - - status = i40e_aq_get_link_info(hw, enable_lse, NULL, NULL); - if (status) - return status; - - status = i40e_aq_get_phy_capabilities(hw, FALSE, false, - &abilities, NULL); - if (status) - return status; - - if (abilities.abilities & I40E_AQ_PHY_AN_ENABLED) - hw->phy.link_info.an_enabled = TRUE; - else - hw->phy.link_info.an_enabled = FALSE; - - return status; -} - -/** * i40e_aq_set_phy_int_mask * @hw: pointer to the hw struct * @mask: interrupt mask to be set @@ -1904,6 +1972,7 @@ enum i40e_status_code i40e_aq_get_switch * @hw: pointer to the hw struct * @fw_major_version: firmware major version * @fw_minor_version: firmware minor version + * @fw_build: firmware build number * @api_major_version: major queue version * @api_minor_version: minor queue version * @cmd_details: pointer to command details structure or NULL @@ -1912,6 +1981,7 @@ enum i40e_status_code i40e_aq_get_switch **/ enum i40e_status_code i40e_aq_get_firmware_version(struct i40e_hw *hw, u16 *fw_major_version, u16 *fw_minor_version, + u32 *fw_build, u16 *api_major_version, u16 *api_minor_version, struct i40e_asq_cmd_details *cmd_details) { @@ -1929,6 +1999,8 @@ enum i40e_status_code i40e_aq_get_firmwa *fw_major_version = LE16_TO_CPU(resp->fw_major); if (fw_minor_version != NULL) *fw_minor_version = LE16_TO_CPU(resp->fw_minor); + if (fw_build != NULL) + *fw_build = LE32_TO_CPU(resp->fw_build); if (api_major_version != NULL) *api_major_version = LE16_TO_CPU(resp->api_major); if (api_minor_version != NULL) @@ -1969,7 +2041,7 @@ enum i40e_status_code i40e_aq_send_drive i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_driver_version); - desc.flags |= CPU_TO_LE16(I40E_AQ_FLAG_SI); + desc.flags |= CPU_TO_LE16(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD); cmd->driver_major_ver = dv->major_version; cmd->driver_minor_ver = dv->minor_version; cmd->driver_build_ver = dv->build_version; @@ -2173,7 +2245,7 @@ enum i40e_status_code i40e_aq_add_macvla if (count == 0 || !mv_list || !hw) return I40E_ERR_PARAM; - buf_size = count * sizeof(struct i40e_aqc_add_macvlan_element_data); + buf_size = count * sizeof(*mv_list); /* prep the rest of the request */ i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_add_macvlan); @@ -2215,7 +2287,7 @@ enum i40e_status_code i40e_aq_remove_mac if (count == 0 || !mv_list || !hw) return I40E_ERR_PARAM; - buf_size = count * sizeof(struct i40e_aqc_remove_macvlan_element_data); + buf_size = count * sizeof(*mv_list); /* prep the rest of the request */ i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_remove_macvlan); @@ -2255,7 +2327,7 @@ enum i40e_status_code i40e_aq_add_vlan(s if (count == 0 || !v_list || !hw) return I40E_ERR_PARAM; - buf_size = count * sizeof(struct i40e_aqc_add_remove_vlan_element_data); + buf_size = count * sizeof(*v_list); /* prep the rest of the request */ i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_add_vlan); @@ -2295,7 +2367,7 @@ enum i40e_status_code i40e_aq_remove_vla if (count == 0 || !v_list || !hw) return I40E_ERR_PARAM; - buf_size = count * sizeof(struct i40e_aqc_add_remove_vlan_element_data); + buf_size = count * sizeof(*v_list); /* prep the rest of the request */ i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_remove_vlan); @@ -2353,6 +2425,41 @@ enum i40e_status_code i40e_aq_send_msg_t } /** + * i40e_aq_debug_read_register *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Tue Nov 24 12:17:02 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13225A35106; Tue, 24 Nov 2015 12:17:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDDC41B0E; Tue, 24 Nov 2015 12:17:01 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAOCH0nJ084764; Tue, 24 Nov 2015 12:17:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAOCH0v9084763; Tue, 24 Nov 2015 12:17:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511241217.tAOCH0v9084763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 24 Nov 2015 12:17:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291250 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 12:17:02 -0000 Author: hselasky Date: Tue Nov 24 12:17:00 2015 New Revision: 291250 URL: https://svnweb.freebsd.org/changeset/base/291250 Log: MFC r290326: Relax the BUS_DMA_KEEP_PG_OFFSET requirement to allow optimising allocation of DMA bounce buffers. Discussed with: ian @ Modified: stable/10/sys/dev/usb/usb_busdma.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_busdma.c ============================================================================== --- stable/10/sys/dev/usb/usb_busdma.c Tue Nov 24 12:11:56 2015 (r291249) +++ stable/10/sys/dev/usb/usb_busdma.c Tue Nov 24 12:17:00 2015 (r291250) @@ -474,9 +474,13 @@ usb_pc_common_mem_cb(void *arg, bus_dma_ pc->page_offset_buf = rem; pc->page_offset_end += rem; #ifdef USB_DEBUG - if (rem != (USB_P2U(pc->buffer) & (USB_PAGE_SIZE - 1))) { + if (nseg > 1 && + ((segs->ds_addr + segs->ds_len) & (USB_PAGE_SIZE - 1)) != + ((segs + 1)->ds_addr & (USB_PAGE_SIZE - 1))) { /* - * This check verifies that the physical address is correct: + * This check verifies there is no page offset hole + * between the first and second segment. See the + * BUS_DMA_KEEP_PG_OFFSET flag. */ DPRINTFN(0, "Page offset was not preserved\n"); error = 1; From owner-svn-src-stable-10@freebsd.org Tue Nov 24 12:25:36 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CCC1A354B8; Tue, 24 Nov 2015 12:25:36 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC2FD159B; Tue, 24 Nov 2015 12:25:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAOCPYwF087889; Tue, 24 Nov 2015 12:25:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAOCPYBW087888; Tue, 24 Nov 2015 12:25:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511241225.tAOCPYBW087888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 24 Nov 2015 12:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291253 - stable/10/usr.sbin/bluetooth/bthidd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 12:25:36 -0000 Author: hselasky Date: Tue Nov 24 12:25:34 2015 New Revision: 291253 URL: https://svnweb.freebsd.org/changeset/base/291253 Log: MFC r291145: Fix scancodes for Kana and Eisu keys. PR: 204709 Modified: stable/10/usr.sbin/bluetooth/bthidd/kbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bluetooth/bthidd/kbd.c ============================================================================== --- stable/10/usr.sbin/bluetooth/bthidd/kbd.c Tue Nov 24 12:23:15 2015 (r291252) +++ stable/10/usr.sbin/bluetooth/bthidd/kbd.c Tue Nov 24 12:25:34 2015 (r291253) @@ -225,8 +225,8 @@ static int32_t const x[] = /* Keyboard Int'l 7 8D */ -1, /* Unassigned */ /* Keyboard Int'l 8 8E */ -1, /* Unassigned */ /* Keyboard Int'l 9 8F */ -1, /* Unassigned */ -/* Keyboard Lang 1 90 */ 0x71, /* eisu */ -/* Keyboard Lang 2 91 */ 0x72, /* kana */ +/* Keyboard Lang 1 90 */ 0x71, /* Kana */ +/* Keyboard Lang 2 91 */ 0x72, /* Eisu */ /* Keyboard Lang 3 92 */ 0x78, /* F8 */ /* Keyboard Lang 4 93 */ 0x77, /* F7 */ /* Keyboard Lang 5 94 */ 0x76, /* F6 */ From owner-svn-src-stable-10@freebsd.org Tue Nov 24 12:28:38 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13532A35556; Tue, 24 Nov 2015 12:28:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4B2C18DE; Tue, 24 Nov 2015 12:28:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAOCSamo088047; Tue, 24 Nov 2015 12:28:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAOCSaaG088046; Tue, 24 Nov 2015 12:28:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201511241228.tAOCSaaG088046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 24 Nov 2015 12:28: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: r291254 - stable/10/sys/dev/usb/input X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 12:28:38 -0000 Author: hselasky Date: Tue Nov 24 12:28:36 2015 New Revision: 291254 URL: https://svnweb.freebsd.org/changeset/base/291254 Log: MFC r291146: Add support for Kana and Eisu keys to the USB keyboard driver. PR: 204709 Modified: stable/10/sys/dev/usb/input/ukbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/ukbd.c ============================================================================== --- stable/10/sys/dev/usb/input/ukbd.c Tue Nov 24 12:25:34 2015 (r291253) +++ stable/10/sys/dev/usb/input/ukbd.c Tue Nov 24 12:28:36 2015 (r291254) @@ -302,6 +302,10 @@ static const struct ukbd_mods ukbd_mods[ * 0x68: F13 * 0x69: F14 * 0x6a: F15 + * + * USB Apple Keyboard JIS generates: + * 0x90: Kana + * 0x91: Eisu */ static const uint8_t ukbd_trtab[256] = { 0, 0, 0, 0, 30, 48, 46, 32, /* 00 - 07 */ @@ -322,7 +326,7 @@ static const uint8_t ukbd_trtab[256] = { 109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */ 121, 120, NN, NN, NN, NN, NN, 123, /* 80 - 87 */ 124, 125, 126, 127, 128, NN, NN, NN, /* 88 - 8F */ - NN, NN, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ + 129, 130, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */ NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */ NN, NN, NN, NN, NN, NN, NN, NN, /* A8 - AF */ @@ -2070,7 +2074,7 @@ ukbd_key2scan(struct ukbd_softc *sc, int 0x166, /* Sun Type 6 Find */ 0x167, /* Sun Type 6 Cut */ 0x125, /* Sun Type 6 Mute */ - /* 120 - 128 */ + /* 120 - 130 */ 0x11f, /* Sun Type 6 VolumeDown */ 0x11e, /* Sun Type 6 VolumeUp */ 0x120, /* Sun Type 6 PowerDown */ @@ -2082,6 +2086,8 @@ ukbd_key2scan(struct ukbd_softc *sc, int 0x79, /* Keyboard Intl' 4 (Henkan) */ 0x7b, /* Keyboard Intl' 5 (Muhenkan) */ 0x5c, /* Keyboard Intl' 6 (Keypad ,) (For PC-9821 layout) */ + 0x71, /* Apple Keyboard JIS (Kana) */ + 0x72, /* Apple Keyboard JIS (Eisu) */ }; if ((code >= 89) && (code < (int)(89 + (sizeof(scan) / sizeof(scan[0]))))) { From owner-svn-src-stable-10@freebsd.org Tue Nov 24 23:04:05 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 116E8A3794C; Tue, 24 Nov 2015 23:04:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C56161176; Tue, 24 Nov 2015 23:04:04 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAON43W3043279; Tue, 24 Nov 2015 23:04:03 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAON43uF043278; Tue, 24 Nov 2015 23:04:03 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201511242304.tAON43uF043278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 24 Nov 2015 23:04:03 +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: r291268 - stable/10/usr.bin/ldd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2015 23:04:05 -0000 Author: jkim Date: Tue Nov 24 23:04:03 2015 New Revision: 291268 URL: https://svnweb.freebsd.org/changeset/base/291268 Log: MFC: r289425 Add support for ARM EABI. Note it is not a direct MFC because some macros are not defined in this branch. Modified: stable/10/usr.bin/ldd/ldd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ldd/ldd.c ============================================================================== --- stable/10/usr.bin/ldd/ldd.c Tue Nov 24 22:47:19 2015 (r291267) +++ stable/10/usr.bin/ldd/ldd.c Tue Nov 24 23:04:03 2015 (r291268) @@ -377,9 +377,19 @@ is_executable(const char *fname, int fd, return (0); } if (hdr.elf.e_type == ET_DYN) { - if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { + switch (hdr.elf.e_ident[EI_OSABI]) { + case ELFOSABI_FREEBSD: *is_shlib = 1; return (1); +#ifdef __ARM_EABI__ + case ELFOSABI_NONE: + if (hdr.elf.e_machine != EM_ARM) + break; + if (((hdr.elf.e_flags & 0xff000000) >> 24) < 4) + break; + *is_shlib = 1; + return (1); +#endif } warnx("%s: not a FreeBSD ELF shared object", fname); return (0); From owner-svn-src-stable-10@freebsd.org Wed Nov 25 08:19:03 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DF12A37894; Wed, 25 Nov 2015 08:19:03 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 088FB1358; Wed, 25 Nov 2015 08:19:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAP8J2Vp002903; Wed, 25 Nov 2015 08:19:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAP8J1OX002896; Wed, 25 Nov 2015 08:19:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511250819.tAP8J1OX002896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 25 Nov 2015 08:19: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: r291293 - in stable/10: lib/libc/stdio tools/regression/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 08:19:03 -0000 Author: ngie Date: Wed Nov 25 08:19:01 2015 New Revision: 291293 URL: https://svnweb.freebsd.org/changeset/base/291293 Log: MFC r264737: Discussed with: jilles r264737 (by jilles): libc/stdio: Fail fdopen() on an execute-only fd. An execute-only fd (opened with O_EXEC) allows neither read() nor write() and is therefore incompatible with all stdio modes. Therefore, the [EINVAL] error applies. Also adjust the similar check in freopen() with a NULL path, even though this checks an fd which is already from a FILE. Added: stable/10/tools/regression/lib/libc/stdio/test-fdopen.c - copied unchanged from r264737, head/tools/regression/lib/libc/stdio/test-fdopen.c stable/10/tools/regression/lib/libc/stdio/test-fdopen.t - copied unchanged from r264737, head/tools/regression/lib/libc/stdio/test-fdopen.t stable/10/tools/regression/lib/libc/stdio/test-freopen.c - copied unchanged from r264737, head/tools/regression/lib/libc/stdio/test-freopen.c stable/10/tools/regression/lib/libc/stdio/test-freopen.t - copied unchanged from r264737, head/tools/regression/lib/libc/stdio/test-freopen.t Modified: stable/10/lib/libc/stdio/fdopen.c stable/10/lib/libc/stdio/freopen.c stable/10/tools/regression/lib/libc/stdio/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/fdopen.c ============================================================================== --- stable/10/lib/libc/stdio/fdopen.c Wed Nov 25 07:31:59 2015 (r291292) +++ stable/10/lib/libc/stdio/fdopen.c Wed Nov 25 08:19:01 2015 (r291293) @@ -70,7 +70,8 @@ fdopen(int fd, const char *mode) /* Make sure the mode the user wants is a subset of the actual mode. */ if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0) return (NULL); - tmp = fdflags & O_ACCMODE; + /* Work around incorrect O_ACCMODE. */ + tmp = fdflags & (O_ACCMODE | O_EXEC); if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) { errno = EINVAL; return (NULL); Modified: stable/10/lib/libc/stdio/freopen.c ============================================================================== --- stable/10/lib/libc/stdio/freopen.c Wed Nov 25 07:31:59 2015 (r291292) +++ stable/10/lib/libc/stdio/freopen.c Wed Nov 25 08:19:01 2015 (r291293) @@ -92,8 +92,9 @@ freopen(const char * __restrict file, co errno = sverrno; return (NULL); } - if ((dflags & O_ACCMODE) != O_RDWR && (dflags & O_ACCMODE) != - (oflags & O_ACCMODE)) { + /* Work around incorrect O_ACCMODE. */ + if ((dflags & O_ACCMODE) != O_RDWR && + (dflags & (O_ACCMODE | O_EXEC)) != (oflags & O_ACCMODE)) { fclose(fp); FUNLOCKFILE(fp); errno = EBADF; Modified: stable/10/tools/regression/lib/libc/stdio/Makefile ============================================================================== --- stable/10/tools/regression/lib/libc/stdio/Makefile Wed Nov 25 07:31:59 2015 (r291292) +++ stable/10/tools/regression/lib/libc/stdio/Makefile Wed Nov 25 08:19:01 2015 (r291293) @@ -1,6 +1,8 @@ # $FreeBSD$ -TESTS= test-fopen \ +TESTS= test-fdopen \ + test-fopen \ + test-freopen \ test-getdelim \ test-mkostemp \ test-open_memstream \ Copied: stable/10/tools/regression/lib/libc/stdio/test-fdopen.c (from r264737, head/tools/regression/lib/libc/stdio/test-fdopen.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/regression/lib/libc/stdio/test-fdopen.c Wed Nov 25 08:19:01 2015 (r291293, copy of r264737, head/tools/regression/lib/libc/stdio/test-fdopen.c) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2014 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +static int testnum = 1; + +static void +runtest(const char *fname, int intmode, const char *strmode, bool success) +{ + FILE *fp; + int fd; + + fd = open(fname, intmode); + if (fd == -1) { + printf("not ok %d - open(\"%s\", %#x) failed\n", + testnum++, fname, intmode); + return; + } + fp = fdopen(fd, strmode); + if (fp == NULL) { + close(fd); + if (success) + printf("not ok %d - " + "fdopen(open(\"%s\", %#x), \"%s\") failed\n", + testnum++, fname, intmode, strmode); + else + printf("ok %d - " + "fdopen(open(\"%s\", %#x), \"%s\") failed\n", + testnum++, fname, intmode, strmode); + return; + } + if (success) + printf("ok %d - " + "fdopen(open(\"%s\", %#x), \"%s\") succeeded\n", + testnum++, fname, intmode, strmode); + else + printf("not ok %d - " + "fdopen(open(\"%s\", %#x), \"%s\") succeeded\n", + testnum++, fname, intmode, strmode); + fclose(fp); +} + +/* + * Test program for fdopen(). + */ +int +main(int argc, char *argv[]) +{ + printf("1..19\n"); + runtest("/dev/null", O_RDONLY, "r", true); + runtest("/dev/null", O_WRONLY, "r", false); + runtest("/dev/null", O_RDWR, "r", true); + runtest("/dev/null", O_RDONLY, "w", false); + runtest("/dev/null", O_WRONLY, "w", true); + runtest("/dev/null", O_RDWR, "w", true); + runtest("/dev/null", O_RDONLY, "a", false); + runtest("/dev/null", O_WRONLY, "a", true); + runtest("/dev/null", O_RDWR, "a", true); + runtest("/dev/null", O_RDONLY, "r+", false); + runtest("/dev/null", O_WRONLY, "r+", false); + runtest("/dev/null", O_RDWR, "r+", true); + runtest("/dev/null", O_RDONLY, "w+", false); + runtest("/dev/null", O_WRONLY, "w+", false); + runtest("/dev/null", O_RDWR, "w+", true); + runtest("/bin/sh", O_EXEC, "r", false); + runtest("/bin/sh", O_EXEC, "w", false); + runtest("/bin/sh", O_EXEC, "r+", false); + runtest("/bin/sh", O_EXEC, "w+", false); + + return 0; +} + +/* vim:ts=8:cin:sw=8 + * */ Copied: stable/10/tools/regression/lib/libc/stdio/test-fdopen.t (from r264737, head/tools/regression/lib/libc/stdio/test-fdopen.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/regression/lib/libc/stdio/test-fdopen.t Wed Nov 25 08:19:01 2015 (r291293, copy of r264737, head/tools/regression/lib/libc/stdio/test-fdopen.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable Copied: stable/10/tools/regression/lib/libc/stdio/test-freopen.c (from r264737, head/tools/regression/lib/libc/stdio/test-freopen.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/regression/lib/libc/stdio/test-freopen.c Wed Nov 25 08:19:01 2015 (r291293, copy of r264737, head/tools/regression/lib/libc/stdio/test-freopen.c) @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2014 Jilles Tjoelker + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +static int testnum = 1; + +static void +runtest(const char *fname1, const char *mode1, const char *fname2, + const char *mode2, bool success) +{ + FILE *fp1, *fp2; + const char *fname2_print; + + fname2_print = fname2 != NULL ? fname2 : ""; + fp1 = fopen(fname1, mode1); + if (fp1 == NULL) { + printf("not ok %d - fopen(\"%s\", \"%s\") failed\n", + testnum++, fname1, mode1); + return; + } + fp2 = freopen(fname2, mode2, fp1); + if (fp2 == NULL) { + fclose(fp1); + if (success) + printf("not ok %d - " + "freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) " + "failed\n", + testnum++, fname2_print, mode2, fname1, mode1); + else + printf("ok %d - " + "freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) " + "failed\n", + testnum++, fname2_print, mode2, fname1, mode1); + return; + } + if (success) + printf("ok %d - " + "freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) " + "succeeded\n", + testnum++, fname2_print, mode2, fname1, mode1); + else + printf("not ok %d - " + "freopen(\"%s\", \"%s\", fopen(\"%s\", \"%s\")) " + "succeeded\n", + testnum++, fname2_print, mode2, fname1, mode1); + fclose(fp2); +} + +/* + * Test program for freopen(). + */ +int +main(int argc, char *argv[]) +{ + printf("1..19\n"); + runtest("/dev/null", "r", NULL, "r", true); + runtest("/dev/null", "w", NULL, "r", false); + runtest("/dev/null", "r+", NULL, "r", true); + runtest("/dev/null", "r", NULL, "w", false); + runtest("/dev/null", "w", NULL, "w", true); + runtest("/dev/null", "r+", NULL, "w", true); + runtest("/dev/null", "r", NULL, "a", false); + runtest("/dev/null", "w", NULL, "a", true); + runtest("/dev/null", "r+", NULL, "a", true); + runtest("/dev/null", "r", NULL, "r+", false); + runtest("/dev/null", "w", NULL, "r+", false); + runtest("/dev/null", "r+", NULL, "r+", true); + runtest("/dev/null", "r", NULL, "w+", false); + runtest("/dev/null", "w", NULL, "w+", false); + runtest("/dev/null", "r+", NULL, "w+", true); + runtest("/bin/sh", "r", NULL, "r", true); + runtest("/bin/sh", "r", "/bin/sh", "r", true); + runtest("/bin/sh", "r", "/dev/null", "r", true); + runtest("/bin/sh", "r", "/dev/null", "w", true); + + return 0; +} + +/* vim:ts=8:cin:sw=8 + * */ Copied: stable/10/tools/regression/lib/libc/stdio/test-freopen.t (from r264737, head/tools/regression/lib/libc/stdio/test-freopen.t) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/tools/regression/lib/libc/stdio/test-freopen.t Wed Nov 25 08:19:01 2015 (r291293, copy of r264737, head/tools/regression/lib/libc/stdio/test-freopen.t) @@ -0,0 +1,10 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +executable=`basename $0 .t` + +make $executable 2>&1 > /dev/null + +exec ./$executable From owner-svn-src-stable-10@freebsd.org Wed Nov 25 08:51:44 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1DE0A37DE9; Wed, 25 Nov 2015 08:51:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D099121A; Wed, 25 Nov 2015 08:51:44 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAP8phTd014314; Wed, 25 Nov 2015 08:51:43 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAP8ph5B014312; Wed, 25 Nov 2015 08:51:43 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511250851.tAP8ph5B014312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 25 Nov 2015 08:51: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: r291294 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 08:51:44 -0000 Author: ngie Date: Wed Nov 25 08:51:43 2015 New Revision: 291294 URL: https://svnweb.freebsd.org/changeset/base/291294 Log: MFC r258245: r258245 (by eadler): Add missing include files for the printf_l and scanf_l man pages. Reported by: swildner@dragonflybsd.org Modified: stable/10/lib/libc/stdio/printf_l.3 stable/10/lib/libc/stdio/scanf_l.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/printf_l.3 ============================================================================== --- stable/10/lib/libc/stdio/printf_l.3 Wed Nov 25 08:19:01 2015 (r291293) +++ stable/10/lib/libc/stdio/printf_l.3 Wed Nov 25 08:51:43 2015 (r291294) @@ -43,6 +43,7 @@ .Lb libc .Sh SYNOPSIS .In stdio.h +.In xlocale.h .Ft int .Fn printf_l "locale_t loc" "const char * restrict format" "..." .Ft int Modified: stable/10/lib/libc/stdio/scanf_l.3 ============================================================================== --- stable/10/lib/libc/stdio/scanf_l.3 Wed Nov 25 08:19:01 2015 (r291293) +++ stable/10/lib/libc/stdio/scanf_l.3 Wed Nov 25 08:51:43 2015 (r291294) @@ -39,6 +39,7 @@ .Lb libc .Sh SYNOPSIS .In stdio.h +.In xlocale.h .Ft int .Fn scanf_l "locale_t loc" "const char * restrict format" "..." .Ft int From owner-svn-src-stable-10@freebsd.org Wed Nov 25 08:58:08 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BCC8BA37F68; Wed, 25 Nov 2015 08:58:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857E414C0; Wed, 25 Nov 2015 08:58:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAP8w7wT014936; Wed, 25 Nov 2015 08:58:07 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAP8w7gE014935; Wed, 25 Nov 2015 08:58:07 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201511250858.tAP8w7gE014935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 25 Nov 2015 08:58: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: r291295 - stable/10/sys/boot/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 08:58:08 -0000 Author: smh Date: Wed Nov 25 08:58:07 2015 New Revision: 291295 URL: https://svnweb.freebsd.org/changeset/base/291295 Log: MFC r291012: Document loader(8) dumpdev option Sponsored by: Multiplay Modified: stable/10/sys/boot/common/loader.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/common/loader.8 ============================================================================== --- stable/10/sys/boot/common/loader.8 Wed Nov 25 08:51:43 2015 (r291294) +++ stable/10/sys/boot/common/loader.8 Wed Nov 25 08:58:07 2015 (r291295) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2015 +.Dd November 18, 2015 .Dt LOADER 8 .Os .Sh NAME @@ -471,6 +471,14 @@ userland output (e.g.\& from .It Va currdev Selects the default device. Syntax for devices is odd. +.It Va dumpdev +Sets the device for kernel dumps. +This can be used to ensure that a device is configured before the corresponding +.Va dumpdev +directive from +.Xr rc.conf 5 +has been processed, allowing kernel panics that happen during the early stages +of boot to be captured. .It Va init_chroot If set to a valid directory in the root file system, it causes .Xr init 8 From owner-svn-src-stable-10@freebsd.org Wed Nov 25 21:43:07 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D906A37701; Wed, 25 Nov 2015 21:43:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36CFB1769; Wed, 25 Nov 2015 21:43:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAPLh6YV040051; Wed, 25 Nov 2015 21:43:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAPLh5Yu040046; Wed, 25 Nov 2015 21:43:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511252143.tAPLh5Yu040046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 25 Nov 2015 21:43:05 +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: r291336 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 21:43:07 -0000 Author: ngie Date: Wed Nov 25 21:43:05 2015 New Revision: 291336 URL: https://svnweb.freebsd.org/changeset/base/291336 Log: MFC r288006,r288031,r288032,r288033: r288006 (by rodrigc): Add declarations to eliminate -Wmissing-prototypes warnings r288031 (by rodrigc): Remove names from some prototypes r288032 (by rodrigc): Remove names from some prototypes r288033 (by rodrigc): Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. Modified: stable/10/lib/libc/stdio/_flock_stub.c stable/10/lib/libc/stdio/fgetwln.c stable/10/lib/libc/stdio/findfp.c stable/10/lib/libc/stdio/getchar.c stable/10/lib/libc/stdio/vfscanf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/_flock_stub.c ============================================================================== --- stable/10/lib/libc/stdio/_flock_stub.c Wed Nov 25 21:16:10 2015 (r291335) +++ stable/10/lib/libc/stdio/_flock_stub.c Wed Nov 25 21:43:05 2015 (r291336) @@ -55,6 +55,9 @@ __weak_reference(_flockfile_debug_stub, __weak_reference(_ftrylockfile, ftrylockfile); __weak_reference(_funlockfile, funlockfile); +void _flockfile_debug_stub(FILE *, char *, int); +int _ftrylockfile(FILE *); + void _flockfile(FILE *fp) { Modified: stable/10/lib/libc/stdio/fgetwln.c ============================================================================== --- stable/10/lib/libc/stdio/fgetwln.c Wed Nov 25 21:16:10 2015 (r291335) +++ stable/10/lib/libc/stdio/fgetwln.c Wed Nov 25 21:43:05 2015 (r291336) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include "local.h" #include "xlocale_private.h" +wchar_t *fgetwln_l(FILE * __restrict, size_t *, locale_t); + wchar_t * fgetwln_l(FILE * __restrict fp, size_t *lenp, locale_t locale) { Modified: stable/10/lib/libc/stdio/findfp.c ============================================================================== --- stable/10/lib/libc/stdio/findfp.c Wed Nov 25 21:16:10 2015 (r291335) +++ stable/10/lib/libc/stdio/findfp.c Wed Nov 25 21:43:05 2015 (r291336) @@ -113,7 +113,7 @@ moreglue(int n) * Find a free FILE for fopen et al. */ FILE * -__sfp() +__sfp(void) { FILE *fp; int n; @@ -165,6 +165,7 @@ found: */ __warn_references(f_prealloc, "warning: this program uses f_prealloc(), which is not recommended."); +void f_prealloc(void); void f_prealloc(void) @@ -196,7 +197,7 @@ f_prealloc(void) * The name `_cleanup' is, alas, fairly well known outside stdio. */ void -_cleanup() +_cleanup(void) { /* (void) _fwalk(fclose); */ (void) _fwalk(__sflush); /* `cheating' */ @@ -206,7 +207,7 @@ _cleanup() * __sinit() is called whenever stdio's internal variables must be set up. */ void -__sinit() +__sinit(void) { /* Make sure we clean up on exit. */ Modified: stable/10/lib/libc/stdio/getchar.c ============================================================================== --- stable/10/lib/libc/stdio/getchar.c Wed Nov 25 21:16:10 2015 (r291335) +++ stable/10/lib/libc/stdio/getchar.c Wed Nov 25 21:43:05 2015 (r291336) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #undef getchar_unlocked int -getchar() +getchar(void) { int retval; FLOCKFILE(stdin); Modified: stable/10/lib/libc/stdio/vfscanf.c ============================================================================== --- stable/10/lib/libc/stdio/vfscanf.c Wed Nov 25 21:16:10 2015 (r291335) +++ stable/10/lib/libc/stdio/vfscanf.c Wed Nov 25 21:43:05 2015 (r291336) @@ -814,9 +814,7 @@ match_failure: * considered part of the scanset. */ static const u_char * -__sccl(tab, fmt) - char *tab; - const u_char *fmt; +__sccl(char *tab, const u_char *fmt) { int c, n, v, i; struct xlocale_collate *table = From owner-svn-src-stable-10@freebsd.org Thu Nov 26 00:48:10 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F02FA37DB2; Thu, 26 Nov 2015 00:48:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0361B7D; Thu, 26 Nov 2015 00:48:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAQ0m95R091756; Thu, 26 Nov 2015 00:48:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAQ0m9OI091755; Thu, 26 Nov 2015 00:48:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511260048.tAQ0m9OI091755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 26 Nov 2015 00:48: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: r291343 - stable/10/lib/libc/tests/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2015 00:48:10 -0000 Author: ngie Date: Thu Nov 26 00:48:09 2015 New Revision: 291343 URL: https://svnweb.freebsd.org/changeset/base/291343 Log: Fix bad MFC (r291175) Replace SRCTOP with the relevant path via .CURDIR Pointyhat to: ngie Sponsored by: EMC / Isilon Storage Division Modified: stable/10/lib/libc/tests/net/Makefile Modified: stable/10/lib/libc/tests/net/Makefile ============================================================================== --- stable/10/lib/libc/tests/net/Makefile Thu Nov 26 00:26:23 2015 (r291342) +++ stable/10/lib/libc/tests/net/Makefile Thu Nov 26 00:48:09 2015 (r291343) @@ -29,7 +29,7 @@ DPADD.h_nsd_recurse+= ${LIBPTHREAD} LDADD.h_nsd_recurse+= -lpthread CLEANFILES+= aton_ether_subr.c -aton_ether_subr.c: gen_ether_subr ${SRCTOP}/sys/net/if_ethersubr.c +aton_ether_subr.c: gen_ether_subr ${.CURDIR:H:H:H:H}/sys/net/if_ethersubr.c ${HOST_SH} ${.ALLSRC} ${.TARGET} .include "../Makefile.netbsd-tests" From owner-svn-src-stable-10@freebsd.org Thu Nov 26 00:56:08 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8C7DA37FC1; Thu, 26 Nov 2015 00:56:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4DA211CE; Thu, 26 Nov 2015 00:56:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAQ0u7mD094719; Thu, 26 Nov 2015 00:56:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAQ0u7JY094718; Thu, 26 Nov 2015 00:56:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201511260056.tAQ0u7JY094718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 26 Nov 2015 00:56: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: r291345 - stable/10/lib/libc/tests/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2015 00:56:09 -0000 Author: ngie Date: Thu Nov 26 00:56:07 2015 New Revision: 291345 URL: https://svnweb.freebsd.org/changeset/base/291345 Log: MFC r291172: Use __MAKE_SHELL instead of HOST_SHELL when generating aton_ether_subr.c (HOST_SHELL is used in NetBSD) This fixes permission denied issues when gen_ether_subr is not executable Reported by: José Pérez Suggested by: bdrewery, sjg Modified: stable/10/lib/libc/tests/net/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/net/Makefile ============================================================================== --- stable/10/lib/libc/tests/net/Makefile Thu Nov 26 00:53:39 2015 (r291344) +++ stable/10/lib/libc/tests/net/Makefile Thu Nov 26 00:56:07 2015 (r291345) @@ -30,7 +30,7 @@ LDADD.h_nsd_recurse+= -lpthread CLEANFILES+= aton_ether_subr.c aton_ether_subr.c: gen_ether_subr ${.CURDIR:H:H:H:H}/sys/net/if_ethersubr.c - ${HOST_SH} ${.ALLSRC} ${.TARGET} + ${__MAKE_SHELL} ${.ALLSRC} ${.TARGET} .include "../Makefile.netbsd-tests" From owner-svn-src-stable-10@freebsd.org Thu Nov 26 02:24:47 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 867C1A36816; Thu, 26 Nov 2015 02:24:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31A051D61; Thu, 26 Nov 2015 02:24:47 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAQ2OkNW023026; Thu, 26 Nov 2015 02:24:46 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAQ2Ok8T023023; Thu, 26 Nov 2015 02:24:46 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201511260224.tAQ2Ok8T023023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Thu, 26 Nov 2015 02:24: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: r291355 - in stable/10/sys: netinet netipsec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2015 02:24:47 -0000 Author: gnn Date: Thu Nov 26 02:24:45 2015 New Revision: 291355 URL: https://svnweb.freebsd.org/changeset/base/291355 Log: MFC 290028: Turning on IPSEC used to introduce a slight amount of performance degradation (7%) for host host TCP connections over 10Gbps links, even when there were no secuirty policies in place. There is no change in performance on 1Gbps network links. Testing GENERIC vs. GENERIC-NOIPSEC vs. GENERIC with this change shows that the new code removes any overhead introduced by having IPSEC always in the kernel. Differential Revision: D3993 Sponsored by: Rubicon Communications (Netgate) Modified: stable/10/sys/netinet/ip_ipsec.c stable/10/sys/netinet/tcp_subr.c stable/10/sys/netipsec/ipsec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_ipsec.c ============================================================================== --- stable/10/sys/netinet/ip_ipsec.c Thu Nov 26 02:16:25 2015 (r291354) +++ stable/10/sys/netinet/ip_ipsec.c Thu Nov 26 02:24:45 2015 (r291355) @@ -230,6 +230,10 @@ ip_ipsec_output(struct mbuf **m, struct struct secpolicy *sp = NULL; struct tdb_ident *tdbi; struct m_tag *mtag; + + if (!key_havesp(IPSEC_DIR_OUTBOUND)) + return 0; + /* * Check the security policy (SP) for the packet and, if * required, do IPsec-related processing. There are two Modified: stable/10/sys/netinet/tcp_subr.c ============================================================================== --- stable/10/sys/netinet/tcp_subr.c Thu Nov 26 02:16:25 2015 (r291354) +++ stable/10/sys/netinet/tcp_subr.c Thu Nov 26 02:24:45 2015 (r291355) @@ -1947,7 +1947,8 @@ ipsec_hdrsiz_tcp(struct tcpcb *tp) #endif struct tcphdr *th; - if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) + if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL) || + (!key_havesp(IPSEC_DIR_OUTBOUND))) return (0); m = m_gethdr(M_NOWAIT, MT_DATA); if (!m) Modified: stable/10/sys/netipsec/ipsec.c ============================================================================== --- stable/10/sys/netipsec/ipsec.c Thu Nov 26 02:16:25 2015 (r291354) +++ stable/10/sys/netipsec/ipsec.c Thu Nov 26 02:24:45 2015 (r291355) @@ -1273,6 +1273,9 @@ ipsec46_in_reject(struct mbuf *m, struct int error; int result; + if (!key_havesp(IPSEC_DIR_INBOUND)) + return 0; + IPSEC_ASSERT(m != NULL, ("null mbuf")); /* @@ -1405,6 +1408,9 @@ ipsec_hdrsiz(struct mbuf *m, u_int dir, int error; size_t size; + if (!key_havesp(dir)) + return 0; + IPSEC_ASSERT(m != NULL, ("null mbuf")); /* Get SP for this packet. From owner-svn-src-stable-10@freebsd.org Fri Nov 27 01:03:44 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B661A39BEA; Fri, 27 Nov 2015 01:03:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66248125C; Fri, 27 Nov 2015 01:03:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAR13hrx021352; Fri, 27 Nov 2015 01:03:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAR13hjY021351; Fri, 27 Nov 2015 01:03:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201511270103.tAR13hjY021351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 27 Nov 2015 01:03: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: r291378 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 01:03:44 -0000 Author: kib Date: Fri Nov 27 01:03:43 2015 New Revision: 291378 URL: https://svnweb.freebsd.org/changeset/base/291378 Log: MFC r291266: Correct the number of DTLB entries reported for the CPUID Leaf 2 descriptor 0x6c. Modified: stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Fri Nov 27 00:04:39 2015 (r291377) +++ stable/10/sys/x86/x86/identcpu.c Fri Nov 27 01:03:43 2015 (r291378) @@ -1894,7 +1894,7 @@ print_INTEL_TLB(u_int data) printf("DTLB: 4KByte pages, 8-way set associative, 256 entries\n"); break; case 0x6c: - printf("DTLB: 2M/4M pages, 8-way set associative, 126 entries\n"); + printf("DTLB: 2M/4M pages, 8-way set associative, 128 entries\n"); break; case 0x6d: printf("DTLB: 1 GByte pages, fully associative, 16 entries\n"); From owner-svn-src-stable-10@freebsd.org Fri Nov 27 03:48:03 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E34A2A364BB; Fri, 27 Nov 2015 03:48:03 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFD3310B1; Fri, 27 Nov 2015 03:48:03 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAR3m2bm068570; Fri, 27 Nov 2015 03:48:02 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAR3m2k5068569; Fri, 27 Nov 2015 03:48:02 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201511270348.tAR3m2k5068569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 27 Nov 2015 03:48: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: r291381 - stable/10/usr.bin/netstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 03:48:04 -0000 Author: ume Date: Fri Nov 27 03:48:02 2015 New Revision: 291381 URL: https://svnweb.freebsd.org/changeset/base/291381 Log: MFC r291097: Don't truncate an interface name when -W option is specified. Modified: stable/10/usr.bin/netstat/route.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/netstat/route.c ============================================================================== --- stable/10/usr.bin/netstat/route.c Fri Nov 27 01:45:40 2015 (r291380) +++ stable/10/usr.bin/netstat/route.c Fri Nov 27 03:48:02 2015 (r291381) @@ -664,7 +664,10 @@ p_rtentry_sysctl(struct rt_msghdr *rtm) strlcpy(prettyname, "---", sizeof(prettyname)); } - printf("%*.*s", wid_if, wid_if, prettyname); + if (Wflag) + printf("%*s", wid_if, prettyname); + else + printf("%*.*s", wid_if, wid_if, prettyname); if (rtm->rtm_rmx.rmx_expire) { time_t expire_time; From owner-svn-src-stable-10@freebsd.org Fri Nov 27 09:21:04 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2645DA36EFA; Fri, 27 Nov 2015 09:21:04 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qk0-x231.google.com (mail-qk0-x231.google.com [IPv6:2607:f8b0:400d:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5F671A95; Fri, 27 Nov 2015 09:21:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by qkda6 with SMTP id a6so34383183qkd.3; Fri, 27 Nov 2015 01:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=1LvRa+xzNxplrkbjnuPl4BLPCEnZ1WPMVbydZSNoD1U=; b=0npoGGVQI0mlZXv5VaOC2thtZSLRRal5hnBTpfSCitsOAKk6aseRpQz87ERqJPmxrz 9Dm8t38HBV93Lzv/HkP0skP/otZTBANmkNp2gji4nD9qP1WVfqDAI/HECqA2OU+5XbeC gkJPQ/dlWb7c/qyCy2Ckibs1tKknrMjquTx0Q4QfbFDgyRDgwpg/kSH64zU0/jVrK0UI nt7KPj03n94hcaFIOJ2ksg2ULzDvkjfmMBg344QVwethFI2IPH8h1Vu7dyLguffUdriC VRIIm2RpEBSaGZ+WWVgJRu4mvlqe9DVQ2aSI4K/Jb0sR7R6MIszEk/Bldux4JnWPx8/V rUAA== X-Received: by 10.55.71.199 with SMTP id u190mr48817760qka.3.1448616063049; Fri, 27 Nov 2015 01:21:03 -0800 (PST) Received: from mbp.home (179-125-135-253.desktop.com.br. [179.125.135.253]) by smtp.gmail.com with ESMTPSA id a15sm8967347qge.18.2015.11.27.01.21.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Nov 2015 01:21:02 -0800 (PST) Sender: Renato Botelho Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Subject: Re: svn commit: r291355 - in stable/10/sys: netinet netipsec From: Renato Botelho In-Reply-To: <201511260224.tAQ2Ok8T023023@repo.freebsd.org> Date: Fri, 27 Nov 2015 07:20:59 -0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <37232D6B-AEC9-4271-8DB7-0606C298B25F@FreeBSD.org> References: <201511260224.tAQ2Ok8T023023@repo.freebsd.org> To: "George V. Neville-Neil" X-Mailer: Apple Mail (2.3096.5) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 09:21:04 -0000 > On Nov 26, 2015, at 00:24, George V. Neville-Neil = wrote: >=20 > Author: gnn > Date: Thu Nov 26 02:24:45 2015 > New Revision: 291355 > URL: https://svnweb.freebsd.org/changeset/base/291355 >=20 > Log: > MFC 290028: > Turning on IPSEC used to introduce a slight amount of performance > degradation (7%) for host host TCP connections over 10Gbps links, > even when there were no secuirty policies in place. There is no > change in performance on 1Gbps network links. Testing GENERIC vs. > GENERIC-NOIPSEC vs. GENERIC with this change shows that the new > code removes any overhead introduced by having IPSEC always in the > kernel. >=20 > Differential Revision: D3993 > Sponsored by: Rubicon Communications (Netgate) >=20 > Modified: > stable/10/sys/netinet/ip_ipsec.c > stable/10/sys/netinet/tcp_subr.c > stable/10/sys/netipsec/ipsec.c > Directory Properties: > stable/10/ (props changed) >=20 > Modified: stable/10/sys/netinet/ip_ipsec.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/ip_ipsec.c Thu Nov 26 02:16:25 2015 = (r291354) > +++ stable/10/sys/netinet/ip_ipsec.c Thu Nov 26 02:24:45 2015 = (r291355) > @@ -230,6 +230,10 @@ ip_ipsec_output(struct mbuf **m, struct=20 > struct secpolicy *sp =3D NULL; > struct tdb_ident *tdbi; > struct m_tag *mtag; > + > + if (!key_havesp(IPSEC_DIR_OUTBOUND)) > + return 0; > + > /* > * Check the security policy (SP) for the packet and, if > * required, do IPsec-related processing. There are two >=20 > Modified: stable/10/sys/netinet/tcp_subr.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/10/sys/netinet/tcp_subr.c Thu Nov 26 02:16:25 2015 = (r291354) > +++ stable/10/sys/netinet/tcp_subr.c Thu Nov 26 02:24:45 2015 = (r291355) > @@ -1947,7 +1947,8 @@ ipsec_hdrsiz_tcp(struct tcpcb *tp) > #endif > struct tcphdr *th; >=20 > - if ((tp =3D=3D NULL) || ((inp =3D tp->t_inpcb) =3D=3D NULL)) > + if ((tp =3D=3D NULL) || ((inp =3D tp->t_inpcb) =3D=3D NULL) || > + (!key_havesp(IPSEC_DIR_OUTBOUND))) Looks like style is broken here ^ -- Renato Botelho From owner-svn-src-stable-10@freebsd.org Fri Nov 27 14:38:38 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47691A3A0F0; Fri, 27 Nov 2015 14:38:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 148FD1D32; Fri, 27 Nov 2015 14:38:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAREcbtj055647; Fri, 27 Nov 2015 14:38:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAREcb7Y055646; Fri, 27 Nov 2015 14:38:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511271438.tAREcb7Y055646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Nov 2015 14:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r291384 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 14:38:38 -0000 Author: mav Date: Fri Nov 27 14:38:36 2015 New Revision: 291384 URL: https://svnweb.freebsd.org/changeset/base/291384 Log: MFC r291061: Improve locking of sg_threadcount. Modified: stable/10/sys/rpc/svc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/svc.c ============================================================================== --- stable/10/sys/rpc/svc.c Fri Nov 27 14:29:04 2015 (r291383) +++ stable/10/sys/rpc/svc.c Fri Nov 27 14:38:36 2015 (r291384) @@ -1303,7 +1303,9 @@ svc_new_thread(SVCGROUP *grp) SVCPOOL *pool = grp->sg_pool; struct thread *td; + mtx_lock(&grp->sg_lock); grp->sg_threadcount++; + mtx_unlock(&grp->sg_lock); kthread_add(svc_thread_start, grp, pool->sp_proc, &td, 0, 0, "%s: service", pool->sp_name); } @@ -1336,12 +1338,12 @@ svc_run(SVCPOOL *pool) } /* Starting threads */ + pool->sp_groups[0].sg_threadcount++; for (g = 0; g < pool->sp_groupcount; g++) { grp = &pool->sp_groups[g]; for (i = ((g == 0) ? 1 : 0); i < grp->sg_minthreads; i++) svc_new_thread(grp); } - pool->sp_groups[0].sg_threadcount++; svc_run_internal(&pool->sp_groups[0], TRUE); /* Waiting for threads to stop. */ From owner-svn-src-stable-10@freebsd.org Fri Nov 27 15:19:38 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 026A6A3ABC5; Fri, 27 Nov 2015 15:19:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B39331372; Fri, 27 Nov 2015 15:19:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tARFJaAo067327; Fri, 27 Nov 2015 15:19:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tARFJafn067322; Fri, 27 Nov 2015 15:19:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511271519.tARFJafn067322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Nov 2015 15:19: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: r291387 - stable/10/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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 15:19:38 -0000 Author: mav Date: Fri Nov 27 15:19:36 2015 New Revision: 291387 URL: https://svnweb.freebsd.org/changeset/base/291387 Log: MFC r290615: Introduce portal group options in ctl.conf. While CTL has concept of port options, used at least for iSCSI ports now, before this change it was impossible to set them manually. There still no user-configurable port options now, but I am planning to change that. Modified: stable/10/usr.sbin/ctld/ctl.conf.5 stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/kernel.c stable/10/usr.sbin/ctld/parse.y Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Fri Nov 27 14:40:59 2015 (r291386) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Fri Nov 27 15:19:36 2015 (r291387) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2015 +.Dd November 9, 2015 .Dt CTL.CONF 5 .Os .Sh NAME @@ -229,7 +229,9 @@ An IPv4 or IPv6 address and port to list .\".It Ic listen-iser Ar address .\"An IPv4 or IPv6 address and port to listen on for incoming connections .\"using iSER (iSCSI over RDMA) protocol. -.It Ic redirect Aq Ar address +.It Ic option Ar name Ar value +The CTL-specific port options passed to the kernel. +.It Ic redirect Ar address IPv4 or IPv6 address to redirect initiators to. When configured, all initiators attempting to connect to portal belonging to this Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Fri Nov 27 14:40:59 2015 (r291386) +++ stable/10/usr.sbin/ctld/ctld.c Fri Nov 27 15:19:36 2015 (r291387) @@ -615,6 +615,7 @@ portal_group_new(struct conf *conf, cons if (pg == NULL) log_err(1, "calloc"); pg->pg_name = checked_strdup(name); + TAILQ_INIT(&pg->pg_options); TAILQ_INIT(&pg->pg_portals); TAILQ_INIT(&pg->pg_ports); pg->pg_conf = conf; @@ -629,6 +630,7 @@ portal_group_delete(struct portal_group { struct portal *portal, *tmp; struct port *port, *tport; + struct option *o, *otmp; TAILQ_FOREACH_SAFE(port, &pg->pg_ports, p_pgs, tport) port_delete(port); @@ -636,6 +638,8 @@ portal_group_delete(struct portal_group TAILQ_FOREACH_SAFE(portal, &pg->pg_portals, p_next, tmp) portal_delete(portal); + TAILQ_FOREACH_SAFE(o, &pg->pg_options, o_next, otmp) + option_delete(&pg->pg_options, o); free(pg->pg_name); free(pg->pg_redirection); free(pg); @@ -1389,7 +1393,7 @@ void lun_delete(struct lun *lun) { struct target *targ; - struct lun_option *lo, *tmp; + struct option *o, *tmp; int i; TAILQ_FOREACH(targ, &lun->l_conf->conf_targets, t_next) { @@ -1400,8 +1404,8 @@ lun_delete(struct lun *lun) } TAILQ_REMOVE(&lun->l_conf->conf_luns, lun, l_next); - TAILQ_FOREACH_SAFE(lo, &lun->l_options, lo_next, tmp) - lun_option_delete(lo); + TAILQ_FOREACH_SAFE(o, &lun->l_options, o_next, tmp) + option_delete(&lun->l_options, o); free(lun->l_name); free(lun->l_backend); free(lun->l_device_id); @@ -1487,59 +1491,56 @@ lun_set_ctl_lun(struct lun *lun, uint32_ lun->l_ctl_lun = value; } -struct lun_option * -lun_option_new(struct lun *lun, const char *name, const char *value) +struct option * +option_new(struct options *options, const char *name, const char *value) { - struct lun_option *lo; + struct option *o; - lo = lun_option_find(lun, name); - if (lo != NULL) { - log_warnx("duplicated lun option \"%s\" for lun \"%s\"", - name, lun->l_name); + o = option_find(options, name); + if (o != NULL) { + log_warnx("duplicated option \"%s\"", name); return (NULL); } - lo = calloc(1, sizeof(*lo)); - if (lo == NULL) + o = calloc(1, sizeof(*o)); + if (o == NULL) log_err(1, "calloc"); - lo->lo_name = checked_strdup(name); - lo->lo_value = checked_strdup(value); - lo->lo_lun = lun; - TAILQ_INSERT_TAIL(&lun->l_options, lo, lo_next); + o->o_name = checked_strdup(name); + o->o_value = checked_strdup(value); + TAILQ_INSERT_TAIL(options, o, o_next); - return (lo); + return (o); } void -lun_option_delete(struct lun_option *lo) +option_delete(struct options *options, struct option *o) { - TAILQ_REMOVE(&lo->lo_lun->l_options, lo, lo_next); - - free(lo->lo_name); - free(lo->lo_value); - free(lo); + TAILQ_REMOVE(options, o, o_next); + free(o->o_name); + free(o->o_value); + free(o); } -struct lun_option * -lun_option_find(const struct lun *lun, const char *name) +struct option * +option_find(const struct options *options, const char *name) { - struct lun_option *lo; + struct option *o; - TAILQ_FOREACH(lo, &lun->l_options, lo_next) { - if (strcmp(lo->lo_name, name) == 0) - return (lo); + TAILQ_FOREACH(o, options, o_next) { + if (strcmp(o->o_name, name) == 0) + return (o); } return (NULL); } void -lun_option_set(struct lun_option *lo, const char *value) +option_set(struct option *o, const char *value) { - free(lo->lo_value); - lo->lo_value = checked_strdup(value); + free(o->o_value); + o->o_value = checked_strdup(value); } static struct connection * @@ -1578,7 +1579,7 @@ conf_print(struct conf *conf) struct portal *portal; struct target *targ; struct lun *lun; - struct lun_option *lo; + struct option *o; TAILQ_FOREACH(ag, &conf->conf_auth_groups, ag_next) { fprintf(stderr, "auth-group %s {\n", ag->ag_name); @@ -1603,9 +1604,9 @@ conf_print(struct conf *conf) TAILQ_FOREACH(lun, &conf->conf_luns, l_next) { fprintf(stderr, "\tlun %s {\n", lun->l_name); fprintf(stderr, "\t\tpath %s\n", lun->l_path); - TAILQ_FOREACH(lo, &lun->l_options, lo_next) + TAILQ_FOREACH(o, &lun->l_options, o_next) fprintf(stderr, "\t\toption %s %s\n", - lo->lo_name, lo->lo_value); + lo->o_name, lo->o_value); fprintf(stderr, "\t}\n"); } TAILQ_FOREACH(targ, &conf->conf_targets, t_next) { Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Fri Nov 27 14:40:59 2015 (r291386) +++ stable/10/usr.sbin/ctld/ctld.h Fri Nov 27 15:19:36 2015 (r291387) @@ -105,6 +105,8 @@ struct portal { int p_socket; }; +TAILQ_HEAD(options, option); + #define PG_FILTER_UNKNOWN 0 #define PG_FILTER_NONE 1 #define PG_FILTER_PORTAL 2 @@ -114,6 +116,7 @@ struct portal { struct portal_group { TAILQ_ENTRY(portal_group) pg_next; struct conf *pg_conf; + struct options pg_options; char *pg_name; struct auth_group *pg_discovery_auth_group; int pg_discovery_filter; @@ -151,17 +154,16 @@ struct port { uint32_t p_ctl_port; }; -struct lun_option { - TAILQ_ENTRY(lun_option) lo_next; - struct lun *lo_lun; - char *lo_name; - char *lo_value; +struct option { + TAILQ_ENTRY(option) o_next; + char *o_name; + char *o_value; }; struct lun { TAILQ_ENTRY(lun) l_next; struct conf *l_conf; - TAILQ_HEAD(, lun_option) l_options; + struct options l_options; char *l_name; char *l_backend; uint8_t l_device_type; @@ -382,13 +384,11 @@ void lun_set_serial(struct lun *lun, c void lun_set_size(struct lun *lun, size_t value); void lun_set_ctl_lun(struct lun *lun, uint32_t value); -struct lun_option *lun_option_new(struct lun *lun, +struct option *option_new(struct options *os, const char *name, const char *value); -void lun_option_delete(struct lun_option *clo); -struct lun_option *lun_option_find(const struct lun *lun, - const char *name); -void lun_option_set(struct lun_option *clo, - const char *value); +void option_delete(struct options *os, struct option *co); +struct option *option_find(const struct options *os, const char *name); +void option_set(struct option *o, const char *value); void kernel_init(void); int kernel_lun_add(struct lun *lun); Modified: stable/10/usr.sbin/ctld/kernel.c ============================================================================== --- stable/10/usr.sbin/ctld/kernel.c Fri Nov 27 14:40:59 2015 (r291386) +++ stable/10/usr.sbin/ctld/kernel.c Fri Nov 27 15:19:36 2015 (r291387) @@ -396,7 +396,7 @@ conf_new_from_kernel(void) struct pport *pp; struct port *cp; struct lun *cl; - struct lun_option *lo; + struct option *o; struct ctl_lun_list list; struct cctl_devlist_data devlist; struct cctl_lun *lun; @@ -626,8 +626,8 @@ retry_port: lun_set_path(cl, nv->value); continue; } - lo = lun_option_new(cl, nv->name, nv->value); - if (lo == NULL) + o = option_new(&cl->l_options, nv->name, nv->value); + if (o == NULL) log_warnx("unable to add CTL lun option %s " "for CTL lun %ju \"%s\"", nv->name, (uintmax_t) lun->lun_id, @@ -652,7 +652,7 @@ str_arg(struct ctl_be_arg *arg, const ch int kernel_lun_add(struct lun *lun) { - struct lun_option *lo; + struct option *o; struct ctl_lun_req req; int error, i, num_options; @@ -687,31 +687,31 @@ kernel_lun_add(struct lun *lun) } if (lun->l_path != NULL) { - lo = lun_option_find(lun, "file"); - if (lo != NULL) { - lun_option_set(lo, lun->l_path); + o = option_find(&lun->l_options, "file"); + if (o != NULL) { + option_set(o, lun->l_path); } else { - lo = lun_option_new(lun, "file", lun->l_path); - assert(lo != NULL); + o = option_new(&lun->l_options, "file", lun->l_path); + assert(o != NULL); } } - lo = lun_option_find(lun, "ctld_name"); - if (lo != NULL) { - lun_option_set(lo, lun->l_name); + o = option_find(&lun->l_options, "ctld_name"); + if (o != NULL) { + option_set(o, lun->l_name); } else { - lo = lun_option_new(lun, "ctld_name", lun->l_name); - assert(lo != NULL); + o = option_new(&lun->l_options, "ctld_name", lun->l_name); + assert(o != NULL); } - lo = lun_option_find(lun, "scsiname"); - if (lo == NULL && lun->l_scsiname != NULL) { - lo = lun_option_new(lun, "scsiname", lun->l_scsiname); - assert(lo != NULL); + o = option_find(&lun->l_options, "scsiname"); + if (o == NULL && lun->l_scsiname != NULL) { + o = option_new(&lun->l_options, "scsiname", lun->l_scsiname); + assert(o != NULL); } num_options = 0; - TAILQ_FOREACH(lo, &lun->l_options, lo_next) + TAILQ_FOREACH(o, &lun->l_options, o_next) num_options++; req.num_be_args = num_options; @@ -724,8 +724,8 @@ kernel_lun_add(struct lun *lun) } i = 0; - TAILQ_FOREACH(lo, &lun->l_options, lo_next) { - str_arg(&req.be_args[i], lo->lo_name, lo->lo_value); + TAILQ_FOREACH(o, &lun->l_options, o_next) { + str_arg(&req.be_args[i], o->o_name, o->o_value); i++; } assert(i == num_options); @@ -760,7 +760,7 @@ kernel_lun_add(struct lun *lun) int kernel_lun_modify(struct lun *lun) { - struct lun_option *lo; + struct option *o; struct ctl_lun_req req; int error, i, num_options; @@ -773,7 +773,7 @@ kernel_lun_modify(struct lun *lun) req.reqdata.modify.lun_size_bytes = lun->l_size; num_options = 0; - TAILQ_FOREACH(lo, &lun->l_options, lo_next) + TAILQ_FOREACH(o, &lun->l_options, o_next) num_options++; req.num_be_args = num_options; @@ -786,8 +786,8 @@ kernel_lun_modify(struct lun *lun) } i = 0; - TAILQ_FOREACH(lo, &lun->l_options, lo_next) { - str_arg(&req.be_args[i], lo->lo_name, lo->lo_value); + TAILQ_FOREACH(o, &lun->l_options, o_next) { + str_arg(&req.be_args[i], o->o_name, o->o_value); i++; } assert(i == num_options); @@ -907,6 +907,7 @@ kernel_handoff(struct connection *conn) int kernel_port_add(struct port *port) { + struct option *o; struct ctl_port_entry entry; struct ctl_req req; struct ctl_lun_map lm; @@ -921,6 +922,8 @@ kernel_port_add(struct port *port) strlcpy(req.driver, "iscsi", sizeof(req.driver)); req.reqtype = CTL_REQ_CREATE; req.num_args = 5; + TAILQ_FOREACH(o, &pg->pg_options, o_next) + req.num_args++; req.args = malloc(req.num_args * sizeof(*req.args)); if (req.args == NULL) log_err(1, "malloc"); @@ -936,6 +939,8 @@ kernel_port_add(struct port *port) if (targ->t_alias) str_arg(&req.args[n++], "cfiscsi_target_alias", targ->t_alias); str_arg(&req.args[n++], "ctld_portal_group_name", pg->pg_name); + TAILQ_FOREACH(o, &pg->pg_options, o_next) + str_arg(&req.args[n++], o->o_name, o->o_value); req.num_args = n; error = ioctl(ctl_fd, CTL_PORT_REQ, &req); free(req.args); Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Fri Nov 27 14:40:59 2015 (r291386) +++ stable/10/usr.sbin/ctld/parse.y Fri Nov 27 15:19:36 2015 (r291387) @@ -344,6 +344,8 @@ portal_group_entry: | portal_group_listen_iser | + portal_group_option + | portal_group_redirect | portal_group_tag @@ -409,6 +411,18 @@ portal_group_listen_iser: LISTEN_ISER ST } ; +portal_group_option: OPTION STR STR + { + struct option *o; + + o = option_new(&portal_group->pg_options, $2, $3); + free($2); + free($3); + if (o == NULL) + return (1); + } + ; + portal_group_redirect: REDIRECT STR { int error; @@ -950,12 +964,12 @@ lun_ctl_lun: CTL_LUN STR lun_option: OPTION STR STR { - struct lun_option *clo; + struct option *o; - clo = lun_option_new(lun, $2, $3); + o = option_new(&lun->l_options, $2, $3); free($2); free($3); - if (clo == NULL) + if (o == NULL) return (1); } ; From owner-svn-src-stable-10@freebsd.org Fri Nov 27 15:26:20 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CE83A3AD59; Fri, 27 Nov 2015 15:26:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B8618B1; Fri, 27 Nov 2015 15:26:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tARFQJus070085; Fri, 27 Nov 2015 15:26:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tARFQJGE070081; Fri, 27 Nov 2015 15:26:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511271526.tARFQJGE070081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Nov 2015 15:26: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: r291388 - 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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 15:26:20 -0000 Author: mav Date: Fri Nov 27 15:26:19 2015 New Revision: 291388 URL: https://svnweb.freebsd.org/changeset/base/291388 Log: MFC r290670: Modify target port groups logic in CTL. - Introduce "ha_shared" port option, which being set to "on" moves the port into separate port group, shared between HA nodes. This allows to better handle cases when iSCSI portals are bound to CARP address that can dynamically move between nodes. Some initiators (at least VMware) don't detect that after iSCSI reconnect they've attached to different SCSI port from different port group, that totally breakes ALUA status parsing. In theory, I believe, it should be enough to have different iSCSI portal group tags on different nodes to make initiators detect this condition, but it seems like VMware ignores those values, and even full LUN retaste forced by UA does not help. - Make CTL report up to three port groups: 1 -- non-HA mode or ports with "ha_shared" option set, 2 -- HA node 1, 3 -- HA node 2. - Report Transitioning state for all port groups when HA interlink is connected, but neither of nodes is primary for the LUN. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend.c stable/10/sys/cam/ctl/ctl_frontend.h 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 Fri Nov 27 15:19:36 2015 (r291387) +++ stable/10/sys/cam/ctl/ctl.c Fri Nov 27 15:26:19 2015 (r291388) @@ -1821,13 +1821,13 @@ ctl_init(void) SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "ha_id", CTLFLAG_RDTUN, &softc->ha_id, 0, "HA head ID (0 - no HA)"); - if (softc->ha_id == 0 || softc->ha_id > NUM_TARGET_PORT_GROUPS) { + if (softc->ha_id == 0 || softc->ha_id > NUM_HA_SHELVES) { softc->flags |= CTL_FLAG_ACTIVE_SHELF; softc->is_single = 1; softc->port_cnt = CTL_MAX_PORTS; softc->port_min = 0; } else { - softc->port_cnt = CTL_MAX_PORTS / NUM_TARGET_PORT_GROUPS; + softc->port_cnt = CTL_MAX_PORTS / NUM_HA_SHELVES; softc->port_min = (softc->ha_id - 1) * softc->port_cnt; } softc->port_max = softc->port_min + softc->port_cnt; @@ -7139,8 +7139,8 @@ ctl_report_tagret_port_groups(struct ctl { struct scsi_maintenance_in *cdb; int retval; - int alloc_len, ext, total_len = 0, g, pc, pg, gs, os; - int num_target_port_groups, num_target_ports; + int alloc_len, ext, total_len = 0, g, pc, pg, ts, os; + int num_ha_groups, num_target_ports, shared_group; struct ctl_lun *lun; struct ctl_softc *softc; struct ctl_port *port; @@ -7174,11 +7174,8 @@ ctl_report_tagret_port_groups(struct ctl return(retval); } - if (softc->is_single) - num_target_port_groups = 1; - else - num_target_port_groups = NUM_TARGET_PORT_GROUPS; num_target_ports = 0; + shared_group = (softc->is_single != 0); mtx_lock(&softc->ctl_lock); STAILQ_FOREACH(port, &softc->port_list, links) { if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) @@ -7186,15 +7183,18 @@ ctl_report_tagret_port_groups(struct ctl if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) continue; num_target_ports++; + if (port->status & CTL_PORT_STATUS_HA_SHARED) + shared_group = 1; } mtx_unlock(&softc->ctl_lock); + num_ha_groups = (softc->is_single) ? 0 : NUM_HA_SHELVES; if (ext) total_len = sizeof(struct scsi_target_group_data_extended); else total_len = sizeof(struct scsi_target_group_data); total_len += sizeof(struct scsi_target_port_group_descriptor) * - num_target_port_groups + + (shared_group + num_ha_groups) + sizeof(struct scsi_target_port_descriptor) * num_target_ports; alloc_len = scsi_4btoul(cdb->length); @@ -7231,24 +7231,62 @@ ctl_report_tagret_port_groups(struct ctl mtx_lock(&softc->ctl_lock); pg = softc->port_min / softc->port_cnt; - if (softc->ha_link == CTL_HA_LINK_OFFLINE) - gs = TPG_ASYMMETRIC_ACCESS_UNAVAILABLE; - else if (softc->ha_link == CTL_HA_LINK_UNKNOWN) - gs = TPG_ASYMMETRIC_ACCESS_TRANSITIONING; - else if (softc->ha_mode == CTL_HA_MODE_ACT_STBY) - gs = TPG_ASYMMETRIC_ACCESS_STANDBY; - else - gs = TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; - if (lun->flags & CTL_LUN_PRIMARY_SC) { - os = gs; - gs = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; - } else - os = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; - for (g = 0; g < num_target_port_groups; g++) { - tpg_desc->pref_state = (g == pg) ? gs : os; + if (lun->flags & (CTL_LUN_PRIMARY_SC | CTL_LUN_PEER_SC_PRIMARY)) { + /* Some shelf is known to be primary. */ + if (softc->ha_link == CTL_HA_LINK_OFFLINE) + os = TPG_ASYMMETRIC_ACCESS_UNAVAILABLE; + else if (softc->ha_link == CTL_HA_LINK_UNKNOWN) + os = TPG_ASYMMETRIC_ACCESS_TRANSITIONING; + else if (softc->ha_mode == CTL_HA_MODE_ACT_STBY) + os = TPG_ASYMMETRIC_ACCESS_STANDBY; + else + os = TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED; + if (lun->flags & CTL_LUN_PRIMARY_SC) { + ts = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; + } else { + ts = os; + os = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; + } + } else { + /* No known primary shelf. */ + if (softc->ha_link == CTL_HA_LINK_OFFLINE) { + ts = TPG_ASYMMETRIC_ACCESS_UNAVAILABLE; + os = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; + } else if (softc->ha_link == CTL_HA_LINK_UNKNOWN) { + ts = TPG_ASYMMETRIC_ACCESS_TRANSITIONING; + os = TPG_ASYMMETRIC_ACCESS_OPTIMIZED; + } else { + ts = os = TPG_ASYMMETRIC_ACCESS_TRANSITIONING; + } + } + if (shared_group) { + tpg_desc->pref_state = ts; tpg_desc->support = TPG_AO_SUP | TPG_AN_SUP | TPG_S_SUP | TPG_U_SUP | TPG_T_SUP; - scsi_ulto2b(g + 1, tpg_desc->target_port_group); + scsi_ulto2b(1, tpg_desc->target_port_group); + tpg_desc->status = TPG_IMPLICIT; + pc = 0; + STAILQ_FOREACH(port, &softc->port_list, links) { + if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) + continue; + if (!softc->is_single && + (port->status & CTL_PORT_STATUS_HA_SHARED) == 0) + continue; + if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) + continue; + scsi_ulto2b(port->targ_port, tpg_desc->descriptors[pc]. + relative_target_port_identifier); + pc++; + } + tpg_desc->target_port_count = pc; + tpg_desc = (struct scsi_target_port_group_descriptor *) + &tpg_desc->descriptors[pc]; + } + for (g = 0; g < num_ha_groups; g++) { + tpg_desc->pref_state = (g == pg) ? ts : os; + tpg_desc->support = TPG_AO_SUP | TPG_AN_SUP | TPG_S_SUP | + TPG_U_SUP | TPG_T_SUP; + scsi_ulto2b(2 + g, tpg_desc->target_port_group); tpg_desc->status = TPG_IMPLICIT; pc = 0; STAILQ_FOREACH(port, &softc->port_list, links) { @@ -7257,6 +7295,8 @@ ctl_report_tagret_port_groups(struct ctl continue; if ((port->status & CTL_PORT_STATUS_ONLINE) == 0) continue; + if (port->status & CTL_PORT_STATUS_HA_SHARED) + continue; if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) continue; scsi_ulto2b(port->targ_port, tpg_desc->descriptors[pc]. @@ -9628,7 +9668,7 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio struct ctl_softc *softc; struct ctl_lun *lun; struct ctl_port *port; - int data_len; + int data_len, g; uint8_t proto; softc = control_softc; @@ -9722,8 +9762,11 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | SVPD_ID_TYPE_TPORTGRP; desc->length = 4; - scsi_ulto2b(ctsio->io_hdr.nexus.targ_port / softc->port_cnt + 1, - &desc->identifier[2]); + if (softc->is_single || port->status & CTL_PORT_STATUS_HA_SHARED) + g = 1; + else + g = 2 + ctsio->io_hdr.nexus.targ_port / softc->port_cnt; + scsi_ulto2b(g, &desc->identifier[2]); desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + sizeof(struct scsi_vpd_id_trgt_port_grp_id)); Modified: stable/10/sys/cam/ctl/ctl_frontend.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.c Fri Nov 27 15:19:36 2015 (r291387) +++ stable/10/sys/cam/ctl/ctl_frontend.c Fri Nov 27 15:26:19 2015 (r291388) @@ -310,6 +310,7 @@ ctl_port_online(struct ctl_port *port) { struct ctl_softc *softc = port->ctl_softc; struct ctl_lun *lun; + const char *value; uint32_t l; if (port->lun_enable != NULL) { @@ -328,6 +329,13 @@ ctl_port_online(struct ctl_port *port) if (port->port_online != NULL) port->port_online(port->onoff_arg); mtx_lock(&softc->ctl_lock); + if (softc->is_single == 0) { + value = ctl_get_opt(&port->options, "ha_shared"); + if (value != NULL && strcmp(value, "on") == 0) + port->status |= CTL_PORT_STATUS_HA_SHARED; + else + port->status &= ~CTL_PORT_STATUS_HA_SHARED; + } port->status |= CTL_PORT_STATUS_ONLINE; STAILQ_FOREACH(lun, &softc->lun_list, links) { if (ctl_lun_map_to_port(port, lun->lun) >= CTL_MAX_LUNS) Modified: stable/10/sys/cam/ctl/ctl_frontend.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend.h Fri Nov 27 15:19:36 2015 (r291387) +++ stable/10/sys/cam/ctl/ctl_frontend.h Fri Nov 27 15:26:19 2015 (r291388) @@ -41,7 +41,8 @@ typedef enum { CTL_PORT_STATUS_NONE = 0x00, - CTL_PORT_STATUS_ONLINE = 0x01 + CTL_PORT_STATUS_ONLINE = 0x01, + CTL_PORT_STATUS_HA_SHARED = 0x02 } ctl_port_status; typedef int (*fe_init_t)(void); Modified: stable/10/sys/cam/ctl/ctl_private.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_private.h Fri Nov 27 15:19:36 2015 (r291387) +++ stable/10/sys/cam/ctl/ctl_private.h Fri Nov 27 15:26:19 2015 (r291388) @@ -356,10 +356,7 @@ struct ctl_devid { uint8_t data[]; }; -/* - * For report target port groups. - */ -#define NUM_TARGET_PORT_GROUPS 2 +#define NUM_HA_SHELVES 2 #define CTL_WRITE_BUFFER_SIZE 262144 From owner-svn-src-stable-10@freebsd.org Fri Nov 27 15:27:45 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 087AFA3AE44; Fri, 27 Nov 2015 15:27:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4CD81AC6; Fri, 27 Nov 2015 15:27:44 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tARFRhvD070181; Fri, 27 Nov 2015 15:27:43 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tARFRhWK070180; Fri, 27 Nov 2015 15:27:43 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511271527.tARFRhWK070180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 27 Nov 2015 15:27: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: r291389 - 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-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2015 15:27:45 -0000 Author: mav Date: Fri Nov 27 15:27:43 2015 New Revision: 291389 URL: https://svnweb.freebsd.org/changeset/base/291389 Log: MFC r290820: Add NULL check to make Coverity happy. 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 Fri Nov 27 15:26:19 2015 (r291388) +++ stable/10/sys/cam/ctl/ctl.c Fri Nov 27 15:27:43 2015 (r291389) @@ -9762,7 +9762,8 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_PORT | SVPD_ID_TYPE_TPORTGRP; desc->length = 4; - if (softc->is_single || port->status & CTL_PORT_STATUS_HA_SHARED) + if (softc->is_single || + (port && port->status & CTL_PORT_STATUS_HA_SHARED)) g = 1; else g = 2 + ctsio->io_hdr.nexus.targ_port / softc->port_cnt; From owner-svn-src-stable-10@freebsd.org Sat Nov 28 02:17:06 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33DB5A3B6FB; Sat, 28 Nov 2015 02:17:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB159119C; Sat, 28 Nov 2015 02:17:05 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tAS2H5oJ058618; Sat, 28 Nov 2015 02:17:05 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAS2H5g9058617; Sat, 28 Nov 2015 02:17:05 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201511280217.tAS2H5g9058617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sat, 28 Nov 2015 02:17:05 +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: r291417 - stable/10/release/tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Nov 2015 02:17:06 -0000 Author: gjb Date: Sat Nov 28 02:17:04 2015 New Revision: 291417 URL: https://svnweb.freebsd.org/changeset/base/291417 Log: MFC r291306: Fix tmpfs(5) '/tmp' mount point. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/arm.subr Directory Properties: stable/10/ (props changed) Modified: stable/10/release/tools/arm.subr ============================================================================== --- stable/10/release/tools/arm.subr Sat Nov 28 01:09:30 2015 (r291416) +++ stable/10/release/tools/arm.subr Sat Nov 28 02:17:04 2015 (r291417) @@ -110,7 +110,7 @@ arm_install_base() { >> ${CHROOTDIR}/${DESTDIR}/etc/fstab echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "tmpfs /tmp tmpfs rw,mode=1777,size=30m 0 0" \ + echo "tmpfs /tmp tmpfs rw,mode=1777,size=30m 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab local hostname From owner-svn-src-stable-10@freebsd.org Sat Nov 28 17:26:48 2015 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 446B6A3BA60; Sat, 28 Nov 2015 17:26:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FEFE1620; Sat, 28 Nov 2015 17:26:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tASHQlc7037586; Sat, 28 Nov 2015 17:26:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tASHQkZZ037582; Sat, 28 Nov 2015 17:26:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511281726.tASHQkZZ037582@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Nov 2015 17:26: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: r291429 - in stable/10: share/examples/ses/srcs sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Nov 2015 17:26:48 -0000 Author: mav Date: Sat Nov 28 17:26:46 2015 New Revision: 291429 URL: https://svnweb.freebsd.org/changeset/base/291429 Log: MFC r291126: Add API to obtain primary enclosure name and ID for /dev/sesX devices. sesX device number may change between reboots, so to properly identify the instance we need more data. Name and ID reported here may mach ones reported by SCSI device, but that is not really required by specs. Sponsored by: iXsystems, Inc. Modified: stable/10/share/examples/ses/srcs/getencstat.c stable/10/sys/cam/scsi/scsi_enc.c stable/10/sys/cam/scsi/scsi_enc.h stable/10/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/examples/ses/srcs/getencstat.c ============================================================================== --- stable/10/share/examples/ses/srcs/getencstat.c Sat Nov 28 15:22:46 2015 (r291428) +++ stable/10/share/examples/ses/srcs/getencstat.c Sat Nov 28 17:26:46 2015 (r291429) @@ -48,12 +48,14 @@ int main(int a, char **v) { + encioc_string_t stri; encioc_element_t *objp; encioc_elm_status_t ob; encioc_elm_desc_t objd; encioc_elm_devnames_t objdn; int fd, nobj, f, i, verbose, quiet, errors; u_char estat; + char str[32]; if (a < 2) { fprintf(stderr, "usage: %s [ -v ] device [ device ... ]\n", *v); @@ -78,6 +80,16 @@ main(int a, char **v) perror(*v); continue; } + if (verbose > 1) { + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCNAME, (caddr_t) &stri) == 0) + printf("%s: Enclosure Name: %s\n", *v, stri.buf); + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCID, (caddr_t) &stri) == 0) + printf("%s: Enclosure ID: %s\n", *v, stri.buf); + } if (ioctl(fd, ENCIOC_GETNELM, (caddr_t) &nobj) < 0) { perror("ENCIOC_GETNELM"); (void) close(fd); Modified: stable/10/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_enc.c Sat Nov 28 15:22:46 2015 (r291428) +++ stable/10/sys/cam/scsi/scsi_enc.c Sat Nov 28 17:26:46 2015 (r291429) @@ -407,6 +407,8 @@ enc_ioctl(struct cdev *dev, u_long cmd, case ENCIOC_GETELMSTAT: case ENCIOC_GETELMDESC: case ENCIOC_GETELMDEVNAMES: + case ENCIOC_GETENCNAME: + case ENCIOC_GETENCID: break; default: if ((flag & FWRITE) == 0) { @@ -461,6 +463,8 @@ enc_ioctl(struct cdev *dev, u_long cmd, case ENCIOC_GETSTRING: case ENCIOC_SETSTRING: + case ENCIOC_GETENCNAME: + case ENCIOC_GETENCID: if (enc->enc_vec.handle_string == NULL) { error = EINVAL; break; Modified: stable/10/sys/cam/scsi/scsi_enc.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_enc.h Sat Nov 28 15:22:46 2015 (r291428) +++ stable/10/sys/cam/scsi/scsi_enc.h Sat Nov 28 17:26:46 2015 (r291429) @@ -46,6 +46,8 @@ #define ENCIOC_GETELMDEVNAMES _IO(ENCIOC, 10) #define ENCIOC_GETSTRING _IO(ENCIOC, 11) #define ENCIOC_SETSTRING _IO(ENCIOC, 12) +#define ENCIOC_GETENCNAME _IO(ENCIOC, 13) +#define ENCIOC_GETENCID _IO(ENCIOC, 14) /* * Platform Independent Definitions for enclosure devices. Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_enc_ses.c Sat Nov 28 15:22:46 2015 (r291428) +++ stable/10/sys/cam/scsi/scsi_enc_ses.c Sat Nov 28 17:26:46 2015 (r291429) @@ -345,8 +345,9 @@ typedef struct ses_cache { const struct ses_cfg_page *cfg_page; /* References into the config page. */ + int ses_nsubencs; const struct ses_enc_desc * const *subencs; - uint8_t ses_ntypes; + int ses_ntypes; const ses_type_t *ses_types; /* Source for all the status pointers */ @@ -1383,11 +1384,12 @@ ses_process_config(enc_softc_t *enc, str * The cast here is not required in C++ but C99 is not so * sophisticated (see C99 6.5.16.1(1)). */ + ses_cache->ses_nsubencs = ses_cfg_page_get_num_subenc(cfg_page); ses_cache->subencs = subencs; buf_subenc = cfg_page->subencs; cur_subenc = subencs; - last_subenc = &subencs[ses_cfg_page_get_num_subenc(cfg_page) - 1]; + last_subenc = &subencs[ses_cache->ses_nsubencs - 1]; ntype = 0; while (cur_subenc <= last_subenc) { @@ -1421,6 +1423,7 @@ ses_process_config(enc_softc_t *enc, str * Type data is const after construction (i.e. when accessed via * our cache object. */ + ses_cache->ses_ntypes = ntype; ses_cache->ses_types = ses_types; cur_buf_type = (const struct ses_elm_type_desc *) @@ -1457,7 +1460,6 @@ ses_process_config(enc_softc_t *enc, str err = ENOMEM; goto out; } - ses_cache->ses_ntypes = (uint8_t)ntype; enc_cache->nelms = nelm; ses_iter_init(enc, enc_cache, &iter); @@ -2712,9 +2714,22 @@ ses_get_elm_devnames(enc_softc_t *enc, e static int ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc) { + ses_softc_t *ses; + enc_cache_t *enc_cache; + ses_cache_t *ses_cache; + const struct ses_enc_desc *enc_desc; int amt, payload, ret; char cdb[6]; + char str[32]; + char vendor[9]; + char product[17]; + char rev[5]; uint8_t *buf; + size_t size, rsize; + + ses = enc->enc_private; + enc_cache = &enc->enc_daemon_cache; + ses_cache = enc_cache->private; /* Implement SES2r20 6.1.6 */ if (sstr->bufsiz > 0xffff) @@ -2739,6 +2754,40 @@ ses_handle_string(enc_softc_t *enc, enci amt = payload; ses_page_cdb(cdb, payload, SesStringIn, CAM_DIR_IN); buf = sstr->buf; + } else if (ioc == ENCIOC_GETENCNAME) { + if (ses_cache->ses_nsubencs < 1) + return (ENODEV); + enc_desc = ses_cache->subencs[0]; + cam_strvis(vendor, enc_desc->vendor_id, + sizeof(enc_desc->vendor_id), sizeof(vendor)); + cam_strvis(product, enc_desc->product_id, + sizeof(enc_desc->product_id), sizeof(product)); + cam_strvis(rev, enc_desc->product_rev, + sizeof(enc_desc->product_rev), sizeof(rev)); + rsize = snprintf(str, sizeof(str), "%s %s %s", + vendor, product, rev) + 1; + if (rsize > sizeof(str)) + rsize = sizeof(str); + copyout(&rsize, &sstr->bufsiz, sizeof(rsize)); + size = rsize; + if (size > sstr->bufsiz) + size = sstr->bufsiz; + copyout(str, sstr->buf, size); + return (size == rsize ? 0 : ENOMEM); + } else if (ioc == ENCIOC_GETENCID) { + if (ses_cache->ses_nsubencs < 1) + return (ENODEV); + enc_desc = ses_cache->subencs[0]; + rsize = snprintf(str, sizeof(str), "%16jx", + scsi_8btou64(enc_desc->logical_id)) + 1; + if (rsize > sizeof(str)) + rsize = sizeof(str); + copyout(&rsize, &sstr->bufsiz, sizeof(rsize)); + size = rsize; + if (size > sstr->bufsiz) + size = sstr->bufsiz; + copyout(str, sstr->buf, size); + return (size == rsize ? 0 : ENOMEM); } else return EINVAL;