svn commit: r321458 - in projects/runtime-coverage: . contrib/netbsd-tests/usr.bin/grep etc etc/mtree lib/clang/libllvm sbin/savecore share/mk sys/conf sys/dev/cxgbe sys/dev/cxgbe/common usr.bin/ar...

Ngie Cooper ngie at FreeBSD.org
Tue Jul 25 03:59:38 UTC 2017


Author: ngie
Date: Tue Jul 25 03:59:35 2017
New Revision: 321458
URL: https://svnweb.freebsd.org/changeset/base/321458

Log:
  MFhead at r321457

Modified:
  projects/runtime-coverage/Makefile
  projects/runtime-coverage/Makefile.inc1
  projects/runtime-coverage/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  projects/runtime-coverage/etc/Makefile
  projects/runtime-coverage/etc/mtree/Makefile
  projects/runtime-coverage/lib/clang/libllvm/Makefile
  projects/runtime-coverage/sbin/savecore/savecore.c
  projects/runtime-coverage/share/mk/bsd.dep.mk
  projects/runtime-coverage/share/mk/bsd.obj.mk
  projects/runtime-coverage/sys/conf/kern.post.mk
  projects/runtime-coverage/sys/dev/cxgbe/common/common.h
  projects/runtime-coverage/sys/dev/cxgbe/t4_main.c
  projects/runtime-coverage/usr.bin/ar/write.c
  projects/runtime-coverage/usr.bin/grep/util.c
Directory Properties:
  projects/runtime-coverage/   (props changed)
  projects/runtime-coverage/contrib/netbsd-tests/   (props changed)

Modified: projects/runtime-coverage/Makefile
==============================================================================
--- projects/runtime-coverage/Makefile	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/Makefile	Tue Jul 25 03:59:35 2017	(r321458)
@@ -158,8 +158,18 @@ META_TGT_WHITELIST+= \
 	toolchains universe world worlds xdev xdev-build
 
 .ORDER: buildworld installworld
+.ORDER: buildworld distrib-dirs
+.ORDER: buildworld distribution
+.ORDER: buildworld distribute
 .ORDER: buildworld distributeworld
 .ORDER: buildworld buildkernel
+.ORDER: distrib-dirs distribute
+.ORDER: distrib-dirs distributeworld
+.ORDER: distrib-dirs installworld
+.ORDER: distribution distribute
+.ORDER: distributeworld distribute
+.ORDER: distributeworld distribution
+.ORDER: installworld distribute
 .ORDER: installworld distribution
 .ORDER: installworld installkernel
 .ORDER: buildkernel installkernel

Modified: projects/runtime-coverage/Makefile.inc1
==============================================================================
--- projects/runtime-coverage/Makefile.inc1	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/Makefile.inc1	Tue Jul 25 03:59:35 2017	(r321458)
@@ -761,6 +761,13 @@ _worldtmp: .PHONY
 	rm -rf ${LIBCOMPATTMP}
 .endif
 .else
+	${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
+	    delete-old delete-old-libs
+.if defined(LIBCOMPAT)
+	${_+_}cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
+	    DESTDIR=${LIBCOMPATTMP} \
+	    delete-old delete-old-libs
+.endif
 	rm -rf ${WORLDTMP}/legacy/usr/include
 .if ${USING_SYSTEM_COMPILER} == "yes"
 .for cc in cc c++
@@ -770,7 +777,6 @@ _worldtmp: .PHONY
 	fi
 .endfor
 .endif	# ${USING_SYSTEM_COMPILER} == "yes"
-.endif	# !defined(NO_CLEAN)
 
 # Our current approach to dependency tracking cannot cope with certain source
 # tree changes, particularly with respect to removing source files and
@@ -813,6 +819,9 @@ _worldtmp: .PHONY
 	    ${OBJTREE}${.CURDIR}/world32/${.CURDIR}/lib/libc/.depend.${f}.*
 .endif
 .endfor
+
+.endif	# !defined(NO_CLEAN)
+
 .for _dir in \
     lib lib/casper usr legacy/bin legacy/usr
 	mkdir -p ${WORLDTMP}/${_dir}

Modified: projects/runtime-coverage/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==============================================================================
--- projects/runtime-coverage/contrib/netbsd-tests/usr.bin/grep/t_grep.sh	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/contrib/netbsd-tests/usr.bin/grep/t_grep.sh	Tue Jul 25 03:59:35 2017	(r321458)
@@ -669,6 +669,24 @@ mmap_eof_not_eol_body()
 	atf_check -s exit:0 -o not-empty \
 	    env MALLOC_CONF="redzone:true" grep --mmap -e " " test2
 }
+
+atf_test_case matchall
+matchall_head()
+{
+	atf_set "descr" "Check proper behavior of matching all with an empty string"
+}
+matchall_body()
+{
+	printf "" > test1
+	printf "A" > test2
+	printf "A\nB" > test3
+
+	atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 test3
+	atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 test2
+	atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 test1
+
+	atf_check -s exit:1 grep "" test1
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -709,5 +727,6 @@ atf_init_test_cases()
 	atf_add_test_case badcontext
 	atf_add_test_case mmap
 	atf_add_test_case mmap_eof_not_eol
+	atf_add_test_case matchall
 # End FreeBSD
 }

Modified: projects/runtime-coverage/etc/Makefile
==============================================================================
--- projects/runtime-coverage/etc/Makefile	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/etc/Makefile	Tue Jul 25 03:59:35 2017	(r321458)
@@ -152,20 +152,6 @@ BIN1+= regdomain.xml
 # -rwxr-xr-x root:wheel, for the new cron root:wheel
 BIN2=	netstart pccard_ether rc.suspend rc.resume
 
-MTREE=	BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
-.if ${MK_LIB32} != "no"
-MTREE+=	BSD.lib32.dist
-.endif
-.if ${MK_LIBSOFT} != "no"
-MTREE+=	BSD.libsoft.dist
-.endif
-.if ${MK_TESTS} != "no"
-MTREE+=	BSD.tests.dist
-.endif
-.if ${MK_SENDMAIL} != "no"
-MTREE+=	BSD.sendmail.dist
-.endif
-
 PPPCNF=	ppp.conf
 
 .if ${MK_SENDMAIL} == "no"
@@ -254,6 +240,7 @@ distribution:
 	${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
 	${_+_}cd ${.CURDIR}/devd; ${MAKE} install
 	${_+_}cd ${.CURDIR}/gss; ${MAKE} install
+	${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
 	${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install
 .if ${MK_NTP} != "no"
 	${_+_}cd ${.CURDIR}/ntp; ${MAKE} install
@@ -308,8 +295,6 @@ distribution:
 	    rm -f ${DESTDIR}/.cshrc; \
 	    ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
 .endif
-	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-	    ${MTREE} ${DESTDIR}/etc/mtree
 .if ${MK_MAIL} != "no"
 	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
 	    ${ETCMAIL} ${DESTDIR}/etc/mail

Modified: projects/runtime-coverage/etc/mtree/Makefile
==============================================================================
--- projects/runtime-coverage/etc/mtree/Makefile	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/etc/mtree/Makefile	Tue Jul 25 03:59:35 2017	(r321458)
@@ -2,7 +2,9 @@
 
 .include <src.opts.mk>
 
-FILES=	${_BSD.debug.dist} \
+# NOTE: BSD.debug.dist is unconditionally installed for developer ease-of-use.
+FILES=	\
+	BSD.debug.dist \
 	${_BSD.coverage.dist} \
 	BSD.include.dist \
 	BSD.root.dist \
@@ -13,9 +15,6 @@ FILES=	${_BSD.debug.dist} \
 	BSD.usr.dist \
 	BSD.var.dist
 
-.if ${MK_DEBUG_FILES} != "no"
-_BSD.debug.dist=	BSD.debug.dist
-.endif
 .if ${MK_LIB32} != "no"
 _BSD.lib32.dist=	BSD.lib32.dist
 .endif

Modified: projects/runtime-coverage/lib/clang/libllvm/Makefile
==============================================================================
--- projects/runtime-coverage/lib/clang/libllvm/Makefile	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/lib/clang/libllvm/Makefile	Tue Jul 25 03:59:35 2017	(r321458)
@@ -1302,6 +1302,16 @@ llvm-dlltool/Options.inc: ${LLVM_SRCS}/lib/ToolDrivers
 TGHDRS+=	llvm-dlltool/Options.inc
 CFLAGS.DlltoolDriver.cpp+=	-I${.OBJDIR}/llvm-dlltool
 
+beforebuild:
+# 20170724 remove stale Options.inc file, of which there are two different
+# versions after r308421, one for llvm-lib, one for llvm-dlltool
+.for f in Options.inc
+.if exists(${f}) || exists(${f}.d)
+	@echo Removing stale generated ${f} files
+	@rm -f ${f} ${f}.d
+.endif
+.endfor
+
 # Note: some rules are superfluous, not every combination is valid.
 .for arch in \
 	AArch64/AArch64 ARM/ARM Mips/Mips PowerPC/PPC Sparc/Sparc X86/X86

Modified: projects/runtime-coverage/sbin/savecore/savecore.c
==============================================================================
--- projects/runtime-coverage/sbin/savecore/savecore.c	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/sbin/savecore/savecore.c	Tue Jul 25 03:59:35 2017	(r321458)
@@ -101,30 +101,39 @@ static sig_atomic_t got_siginfo;
 static void infohandler(int);
 
 static void
-printheader(xo_handle_t *xo, const struct kerneldumpheader *h, const char *device,
-    int bounds, const int status)
+printheader(xo_handle_t *xo, const struct kerneldumpheader *h,
+    const char *device, int bounds, const int status)
 {
 	uint64_t dumplen;
 	time_t t;
 	const char *stat_str;
 
 	xo_flush_h(xo);
-	xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n", device);
-	xo_emit_h(xo, "{P:  }{Lwc:Architecture}{:architecture/%s}\n", h->architecture);
-	xo_emit_h(xo, "{P:  }{Lwc:Architecture Version}{:architecture_version/%u}\n", dtoh32(h->architectureversion));
+	xo_emit_h(xo, "{Lwc:Dump header from device}{:dump_device/%s}\n",
+	    device);
+	xo_emit_h(xo, "{P:  }{Lwc:Architecture}{:architecture/%s}\n",
+	    h->architecture);
+	xo_emit_h(xo,
+	    "{P:  }{Lwc:Architecture Version}{:architecture_version/%u}\n",
+	    dtoh32(h->architectureversion));
 	dumplen = dtoh64(h->dumplength);
-	xo_emit_h(xo, "{P:  }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n", (long long)dumplen);
-	xo_emit_h(xo, "{P:  }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize));
+	xo_emit_h(xo, "{P:  }{Lwc:Dump Length}{:dump_length_bytes/%lld}\n",
+	    (long long)dumplen);
+	xo_emit_h(xo, "{P:  }{Lwc:Blocksize}{:blocksize/%d}\n",
+	    dtoh32(h->blocksize));
+
 	t = dtoh64(h->dumptime);
 	xo_emit_h(xo, "{P:  }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t));
 	xo_emit_h(xo, "{P:  }{Lwc:Hostname}{:hostname/%s}\n", h->hostname);
 	xo_emit_h(xo, "{P:  }{Lwc:Magic}{:magic/%s}\n", h->magic);
-	xo_emit_h(xo, "{P:  }{Lwc:Version String}{:version_string/%s}", h->versionstring);
-	xo_emit_h(xo, "{P:  }{Lwc:Panic String}{:panic_string/%s}\n", h->panicstring);
+	xo_emit_h(xo, "{P:  }{Lwc:Version String}{:version_string/%s}",
+	    h->versionstring);
+	xo_emit_h(xo, "{P:  }{Lwc:Panic String}{:panic_string/%s}\n",
+	    h->panicstring);
 	xo_emit_h(xo, "{P:  }{Lwc:Dump Parity}{:dump_parity/%u}\n", h->parity);
 	xo_emit_h(xo, "{P:  }{Lwc:Bounds}{:bounds/%d}\n", bounds);
 
-	switch(status) {
+	switch (status) {
 	case STATUS_BAD:
 		stat_str = "bad";
 		break;
@@ -133,13 +142,15 @@ printheader(xo_handle_t *xo, const struct kerneldumphe
 		break;
 	default:
 		stat_str = "unknown";
+		break;
 	}
 	xo_emit_h(xo, "{P:  }{Lwc:Dump Status}{:dump_status/%s}\n", stat_str);
 	xo_flush_h(xo);
 }
 
 static int
-getbounds(void) {
+getbounds(void)
+{
 	FILE *fp;
 	char buf[6];
 	int ret;
@@ -170,7 +181,8 @@ getbounds(void) {
 }
 
 static void
-writebounds(int bounds) {
+writebounds(int bounds)
+{
 	FILE *fp;
 
 	if ((fp = fopen("bounds", "w")) == NULL) {
@@ -397,8 +409,8 @@ DoRegularFile(int fd, bool isencrypted, off_t dumpsize
 				/*
 				 * At this point, we have a partial ordering:
 				 *     nw <= hs <= he <= nr
-				 * If hs > nw, buf[nw..hs] contains non-zero data.
-				 * If he > hs, buf[hs..he] is all zeroes.
+				 * If hs > nw, buf[nw..hs] contains non-zero
+				 * data. If he > hs, buf[hs..he] is all zeroes.
 				 */
 				if (hs > nw)
 					if (fwrite(buf + nw, hs - nw, 1, fp)
@@ -705,7 +717,7 @@ DoFile(const char *savedir, const char *device)
 		goto closefd;
 	}
 
-	oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
+	oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file. */
 	isencrypted = (dumpkeysize > 0);
 	if (compress) {
 		snprintf(corename, sizeof(corename), "%s.%d.gz",
@@ -960,7 +972,8 @@ main(int argc, char **argv)
 	} else if (nsaved == 0) {
 		if (nerr != 0) {
 			if (verbose)
-				syslog(LOG_WARNING, "unsaved dumps found but not saved");
+				syslog(LOG_WARNING,
+				    "unsaved dumps found but not saved");
 			exit(1);
 		} else if (verbose)
 			syslog(LOG_WARNING, "no unsaved dumps found");

Modified: projects/runtime-coverage/share/mk/bsd.dep.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.dep.mk	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/share/mk/bsd.dep.mk	Tue Jul 25 03:59:35 2017	(r321458)
@@ -195,13 +195,11 @@ ${DEPENDFILE}:	.NOMETA
 DEPEND_CFLAGS+=	-MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
 DEPEND_CFLAGS+=	-MT${.TARGET}
 .if !defined(_meta_filemon)
-.if defined(.PARSEDIR)
+.if !empty(DEPEND_CFLAGS)
 # Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
 # as those are the only ones we will include.
 DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:${DEPEND_FILTER}:M${.TARGET:${DEPEND_FILTER}}}" != ""
 CFLAGS+=	${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
-.else
-CFLAGS+=	${DEPEND_CFLAGS}
 .endif
 .for __depend_obj in ${DEPENDFILES_OBJS}
 .if ${MAKE_VERSION} < 20160220
@@ -240,8 +238,12 @@ _meta_obj=	${.OBJDIR:C,/,_,g}_${__obj:C,/,_,g}.meta
 _meta_obj=	${__obj}.meta
 .endif
 _dep_obj=	${DEPENDFILE}.${__obj:${DEPEND_FILTER}}
-.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${_meta_obj})) || \
-    (!defined(_meta_filemon) && !exists(${.OBJDIR}/${_dep_obj}))
+.if defined(_meta_filemon)
+_depfile=	${.OBJDIR}/${_meta_obj}
+.else
+_depfile=	${.OBJDIR}/${_dep_obj}
+.endif
+.if !exists(${_depfile})
 ${__obj}: ${OBJS_DEPEND_GUESS}
 ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
 .elif defined(_meta_filemon)
@@ -252,7 +254,7 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
 # guesses do include headers though since they may not be in SRCS.
 ${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
 ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
-.endif
+.endif	# !exists(${_depfile})
 .endfor
 
 # Always run 'make depend' to generate dependencies early and to avoid the

Modified: projects/runtime-coverage/share/mk/bsd.obj.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.obj.mk	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/share/mk/bsd.obj.mk	Tue Jul 25 03:59:35 2017	(r321458)
@@ -183,9 +183,9 @@ clean:
 .endif
 .ORDER: clean all
 
-cleandir: cleanobj
-
 .include <bsd.subdir.mk>
+
+cleandir: .WAIT cleanobj
 
 .if make(destroy*) && defined(OBJROOT)
 # this (rm -rf objdir) is much faster and more reliable than cleaning.

Modified: projects/runtime-coverage/sys/conf/kern.post.mk
==============================================================================
--- projects/runtime-coverage/sys/conf/kern.post.mk	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/sys/conf/kern.post.mk	Tue Jul 25 03:59:35 2017	(r321458)
@@ -232,13 +232,11 @@ ${DEPENDOBJS}:	.NOMETA
 DEPEND_CFLAGS+=	-MD ${DEPEND_MP} -MF.depend.${.TARGET}
 DEPEND_CFLAGS+=	-MT${.TARGET}
 .if !defined(_meta_filemon)
-.if defined(.PARSEDIR)
+.if !empty(DEPEND_CFLAGS)
 # Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
 # as those are the only ones we will include.
 DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET}}" != ""
 CFLAGS+=	${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
-.else
-CFLAGS+=	${DEPEND_CFLAGS}
 .endif
 .for __depend_obj in ${DEPENDFILES_OBJS}
 .if ${MAKE_VERSION} < 20160220
@@ -259,8 +257,12 @@ beforebuild: kernel-depend
 # For meta+filemon the .meta file is checked for since it is the dependency
 # file used.
 .for __obj in ${DEPENDOBJS:O:u}
-.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
-    (!defined(_meta_filemon) && !exists(${.OBJDIR}/.depend.${__obj}))
+.if defined(_meta_filemon)
+_depfile=	${.OBJDIR}/${__obj}.meta
+.else
+_depfile=	${.OBJDIR}/.depend.${__obj}
+.endif
+.if !exists(${_depfile})
 .if ${SYSTEM_OBJS:M${__obj}}
 ${__obj}: ${OBJS_DEPEND_GUESS}
 .endif
@@ -275,7 +277,7 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
 ${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
 .endif
 ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
-.endif
+.endif	# !exists(${_depfile})
 .endfor
 
 .NOPATH: .depend ${DEPENDFILES_OBJS}

Modified: projects/runtime-coverage/sys/dev/cxgbe/common/common.h
==============================================================================
--- projects/runtime-coverage/sys/dev/cxgbe/common/common.h	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/sys/dev/cxgbe/common/common.h	Tue Jul 25 03:59:35 2017	(r321458)
@@ -501,6 +501,15 @@ static inline unsigned int dack_ticks_to_usec(const st
 	return (ticks << adap->params.tp.dack_re) / core_ticks_per_usec(adap);
 }
 
+static inline u_int ms_to_tcp_ticks(const struct adapter *adap, u_int ms)
+{
+	u_long l;
+
+	l = (u_long)ms * adap->params.vpd.cclk >> adap->params.tp.tre;
+
+	return (l);
+}
+
 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask, u32 val);
 
 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,

Modified: projects/runtime-coverage/sys/dev/cxgbe/t4_main.c
==============================================================================
--- projects/runtime-coverage/sys/dev/cxgbe/t4_main.c	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/sys/dev/cxgbe/t4_main.c	Tue Jul 25 03:59:35 2017	(r321458)
@@ -551,6 +551,8 @@ static int sysctl_tc_params(SYSCTL_HANDLER_ARGS);
 static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS);
 static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS);
 static int sysctl_tp_timer(SYSCTL_HANDLER_ARGS);
+static int sysctl_tp_shift_cnt(SYSCTL_HANDLER_ARGS);
+static int sysctl_tp_backoff(SYSCTL_HANDLER_ARGS);
 #endif
 static uint32_t fconf_iconf_to_mode(uint32_t, uint32_t);
 static uint32_t mode_to_fconf(uint32_t);
@@ -3607,12 +3609,62 @@ static int
 set_params__post_init(struct adapter *sc)
 {
 	uint32_t param, val;
+	int i, v, shift;
+	char s[32];
 
 	/* ask for encapsulated CPLs */
 	param = FW_PARAM_PFVF(CPLFW4MSG_ENCAP);
 	val = 1;
 	(void)t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &param, &val);
 
+	/*
+	 * Override the TOE timers with user provided tunables.  This is not the
+	 * recommended way to change the timers (the firmware config file is) so
+	 * these tunables are not documented.
+	 *
+	 * All the timer tunables are in milliseconds.
+	 */
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_idle", &v)) {
+		t4_set_reg_field(sc, A_TP_KEEP_IDLE,
+		    V_KEEPALIVEIDLE(M_KEEPALIVEIDLE),
+		    V_KEEPALIVEIDLE(ms_to_tcp_ticks(sc, v)));
+	}
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_interval", &v)) {
+		t4_set_reg_field(sc, A_TP_KEEP_INTVL,
+		    V_KEEPALIVEINTVL(M_KEEPALIVEINTVL),
+		    V_KEEPALIVEINTVL(ms_to_tcp_ticks(sc, v)));
+	}
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.keepalive_count", &v)) {
+		v &= M_KEEPALIVEMAXR1;
+		t4_set_reg_field(sc, A_TP_SHIFT_CNT,
+		    V_KEEPALIVEMAXR1(M_KEEPALIVEMAXR1) |
+		    V_KEEPALIVEMAXR2(M_KEEPALIVEMAXR2),
+		    V_KEEPALIVEMAXR1(1) | V_KEEPALIVEMAXR2(v));
+	}
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_min", &v)) {
+		t4_set_reg_field(sc, A_TP_RXT_MIN,
+		    V_RXTMIN(M_RXTMIN), V_RXTMIN(ms_to_tcp_ticks(sc, v)));
+	}
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_max", &v)) {
+		t4_set_reg_field(sc, A_TP_RXT_MAX,
+		    V_RXTMAX(M_RXTMAX), V_RXTMAX(ms_to_tcp_ticks(sc, v)));
+	}
+	if (TUNABLE_INT_FETCH("hw.cxgbe.toe.rexmt_count", &v)) {
+		v &= M_RXTSHIFTMAXR1;
+		t4_set_reg_field(sc, A_TP_SHIFT_CNT,
+		    V_RXTSHIFTMAXR1(M_RXTSHIFTMAXR1) |
+		    V_RXTSHIFTMAXR2(M_RXTSHIFTMAXR2),
+		    V_RXTSHIFTMAXR1(1) | V_RXTSHIFTMAXR2(v));
+	}
+	for (i = 0; i < 16; i++) {
+		snprintf(s, sizeof(s), "hw.cxgbe.toe.rexmt_backoff.%d", i);
+		if (TUNABLE_INT_FETCH(s, &v)) {
+			v &= M_TIMERBACKOFFINDEX0;
+			shift = (i & 3) << 3;
+			t4_set_reg_field(sc, A_TP_TCP_BACKOFF_REG0 + (i & ~3),
+			    M_TIMERBACKOFFINDEX0 << shift, v << shift);
+		}
+	}
 	return (0);
 }
 
@@ -5255,6 +5307,9 @@ t4_sysctls(struct adapter *sc)
 
 #ifdef TCP_OFFLOAD
 	if (is_offload(sc)) {
+		int i;
+		char s[4];
+
 		/*
 		 * dev.t4nex.X.toe.
 		 */
@@ -5301,11 +5356,11 @@ t4_sysctls(struct adapter *sc)
 
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_min",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MIN,
-		    sysctl_tp_timer, "LU", "Retransmit min (us)");
+		    sysctl_tp_timer, "LU", "Minimum retransmit interval (us)");
 
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_max",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_RXT_MAX,
-		    sysctl_tp_timer, "LU", "Retransmit max (us)");
+		    sysctl_tp_timer, "LU", "Maximum retransmit interval (us)");
 
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "persist_min",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_PERS_MIN,
@@ -5317,11 +5372,11 @@ t4_sysctls(struct adapter *sc)
 
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_idle",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_IDLE,
-		    sysctl_tp_timer, "LU", "Keepidle idle timer (us)");
+		    sysctl_tp_timer, "LU", "Keepalive idle timer (us)");
 
-		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_intvl",
+		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_interval",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_KEEP_INTVL,
-		    sysctl_tp_timer, "LU", "Keepidle interval (us)");
+		    sysctl_tp_timer, "LU", "Keepalive interval timer (us)");
 
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "initial_srtt",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_INIT_SRTT,
@@ -5330,6 +5385,31 @@ t4_sysctls(struct adapter *sc)
 		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "finwait2_timer",
 		    CTLTYPE_ULONG | CTLFLAG_RD, sc, A_TP_FINWAIT2_TIMER,
 		    sysctl_tp_timer, "LU", "FINWAIT2 timer (us)");
+
+		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "syn_rexmt_count",
+		    CTLTYPE_UINT | CTLFLAG_RD, sc, S_SYNSHIFTMAX,
+		    sysctl_tp_shift_cnt, "IU",
+		    "Number of SYN retransmissions before abort");
+
+		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rexmt_count",
+		    CTLTYPE_UINT | CTLFLAG_RD, sc, S_RXTSHIFTMAXR2,
+		    sysctl_tp_shift_cnt, "IU",
+		    "Number of retransmissions before abort");
+
+		SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "keepalive_count",
+		    CTLTYPE_UINT | CTLFLAG_RD, sc, S_KEEPALIVEMAXR2,
+		    sysctl_tp_shift_cnt, "IU",
+		    "Number of keepalive probes before abort");
+
+		oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "rexmt_backoff",
+		    CTLFLAG_RD, NULL, "TOE retransmit backoffs");
+		children = SYSCTL_CHILDREN(oid);
+		for (i = 0; i < 16; i++) {
+			snprintf(s, sizeof(s), "%u", i);
+			SYSCTL_ADD_PROC(ctx, children, OID_AUTO, s,
+			    CTLTYPE_UINT | CTLFLAG_RD, sc, i, sysctl_tp_backoff,
+			    "IU", "TOE retransmit backoff");
+		}
 	}
 #endif
 }
@@ -8148,6 +8228,40 @@ sysctl_tp_timer(SYSCTL_HANDLER_ARGS)
 		v = tp_tick_us * t4_read_reg(sc, reg);
 
 	return (sysctl_handle_long(oidp, &v, 0, req));
+}
+
+/*
+ * All fields in TP_SHIFT_CNT are 4b and the starting location of the field is
+ * passed to this function.
+ */
+static int
+sysctl_tp_shift_cnt(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter *sc = arg1;
+	int idx = arg2;
+	u_int v;
+
+	MPASS(idx >= 0 && idx <= 24);
+
+	v = (t4_read_reg(sc, A_TP_SHIFT_CNT) >> idx) & 0xf;
+
+	return (sysctl_handle_int(oidp, &v, 0, req));
+}
+
+static int
+sysctl_tp_backoff(SYSCTL_HANDLER_ARGS)
+{
+	struct adapter *sc = arg1;
+	int idx = arg2;
+	u_int shift, v, r;
+
+	MPASS(idx >= 0 && idx < 16);
+
+	r = A_TP_TCP_BACKOFF_REG0 + (idx & ~3);
+	shift = (idx & 3) << 3;
+	v = (t4_read_reg(sc, r) >> shift) & M_TIMERBACKOFFINDEX0;
+
+	return (sysctl_handle_int(oidp, &v, 0, req));
 }
 #endif
 

Modified: projects/runtime-coverage/usr.bin/ar/write.c
==============================================================================
--- projects/runtime-coverage/usr.bin/ar/write.c	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/usr.bin/ar/write.c	Tue Jul 25 03:59:35 2017	(r321458)
@@ -586,10 +586,17 @@ prefault_buffer(const char *buf, size_t s)
 static void
 write_data(struct bsdar *bsdar, struct archive *a, const void *buf, size_t s)
 {
+	ssize_t written;
+
 	prefault_buffer(buf, s);
-	if (archive_write_data(a, buf, s) != (ssize_t)s)
-		bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s",
-		    archive_error_string(a));
+	while (s > 0) {
+		written = archive_write_data(a, buf, s);
+		if (written < 0)
+			bsdar_errc(bsdar, EX_SOFTWARE, 0, "%s",
+			    archive_error_string(a));
+		buf = (const char *)buf + written;
+		s -= written;
+	}
 }
 
 /*

Modified: projects/runtime-coverage/usr.bin/grep/util.c
==============================================================================
--- projects/runtime-coverage/usr.bin/grep/util.c	Tue Jul 25 03:56:42 2017	(r321457)
+++ projects/runtime-coverage/usr.bin/grep/util.c	Tue Jul 25 03:59:35 2017	(r321458)
@@ -259,16 +259,8 @@ procfile(const char *fn)
 		pc.ln.boff = 0;
 		pc.ln.off += pc.ln.len + 1;
 		if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL ||
-		    pc.ln.len == 0) {
-			if (pc.ln.line_no == 0 && matchall)
-				/*
-				 * An empty file with an empty pattern and the
-				 * -w flag does not match
-				 */
-				exit(matchall && wflag ? 1 : 0);
-			else
-				break;
-		}
+		    pc.ln.len == 0)
+			break;
 
 		if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol)
 			--pc.ln.len;


More information about the svn-src-projects mailing list