CVS commit: src/sys/kern
Module Name:src Committed By: mrg Date: Tue Jan 15 07:11:23 UTC 2019 Modified Files: src/sys/kern: init_sysctl.c Log Message: remove kern.panic_now -- crashme panic node replaces it. To generate a diff of this commit: cvs rdiff -u -r1.221 -r1.222 src/sys/kern/init_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.221 src/sys/kern/init_sysctl.c:1.222 --- src/sys/kern/init_sysctl.c:1.221 Wed Dec 5 18:16:51 2018 +++ src/sys/kern/init_sysctl.c Tue Jan 15 07:11:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.221 2018/12/05 18:16:51 christos Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.222 2019/01/15 07:11:23 mrg Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.221 2018/12/05 18:16:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.222 2019/01/15 07:11:23 mrg Exp $"); #include "opt_sysv.h" #include "opt_compat_netbsd.h" @@ -108,9 +108,6 @@ dcopyout(struct lwp *l, const void *kadd return error; } -#ifdef DIAGNOSTIC -static int sysctl_kern_trigger_panic(SYSCTLFN_PROTO); -#endif static int sysctl_kern_maxvnodes(SYSCTLFN_PROTO); static int sysctl_kern_messages(SYSCTLFN_PROTO); static int sysctl_kern_rtc_offset(SYSCTLFN_PROTO); @@ -499,14 +496,6 @@ SYSCTL_SETUP(sysctl_kern_setup, "sysctl SYSCTL_DESCR("Perform a crash dump on system panic"), NULL, 0, &dumponpanic, 0, CTL_KERN, KERN_DUMP_ON_PANIC, CTL_EOL); -#ifdef DIAGNOSTIC - sysctl_createv(clog, 0, NULL, NULL, - CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, "panic_now", - SYSCTL_DESCR("Trigger a panic"), - sysctl_kern_trigger_panic, 0, NULL, 0, - CTL_KERN, CTL_CREATE, CTL_EOL); -#endif sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_INT, "root_partition", @@ -703,27 +692,6 @@ SYSCTL_SETUP(sysctl_debug_setup, "sysctl * */ -#ifdef DIAGNOSTIC -static int -sysctl_kern_trigger_panic(SYSCTLFN_ARGS) -{ - int newtrig, error; - struct sysctlnode node; - - newtrig = 0; - node = *rnode; - node.sysctl_data = &newtrig; - error = sysctl_lookup(SYSCTLFN_CALL(&node)); - if (error || newp == NULL) - return (error); - - if (newtrig != 0) - panic("Panic triggered"); - - return (error); -} -#endif - /* * sysctl helper routine for kern.maxvnodes. Drain vnodes if * new value is lower than desiredvnodes and then calls reinit
CVS commit: src/lib/libc/gen
Module Name:src Committed By: wiz Date: Tue Jan 15 07:01:01 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Use \- for minus. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.30 src/lib/libc/gen/ctype.3:1.31 --- src/lib/libc/gen/ctype.3:1.30 Tue Jan 15 03:43:15 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 07:01:01 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.30 2019/01/15 03:43:15 uwe Exp $ +.\" $NetBSD: ctype.3,v 1.31 2019/01/15 07:01:01 wiz Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -197,7 +197,7 @@ However, this is not an excuse for avoid .Vt unsigned char : if .Dv EOF -coincides with any such value, as it does when it is -1 on platforms +coincides with any such value, as it does when it is \-1 on platforms with signed .Vt char , programs that pass
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Jan 15 05:34:38 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: Fix PR kern/53848. Add missing "ifconfig -w". To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.8 src/tests/net/if_ipsec/t_ipsec.sh:1.9 --- src/tests/net/if_ipsec/t_ipsec.sh:1.8 Tue Jan 15 05:33:42 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Jan 15 05:34:37 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.8 2019/01/15 05:33:42 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.9 2019/01/15 05:34:37 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -99,6 +99,10 @@ setup_router() rump_server_add_iface $sock shmif1 bus1 export RUMP_SERVER=${sock} + + atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 + atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0 + if [ ${lan_mode} = "ipv6" ]; then atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${lan} else @@ -113,10 +117,9 @@ setup_router() atf_check -s exit:0 rump.ifconfig shmif1 inet ${wan} netmask 0xff00 fi atf_check -s exit:0 rump.ifconfig shmif1 up + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig shmif1 - atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0 - atf_check -s exit:0 rump.sysctl -q -w net.inet6.ip6.dad_count=0 unset RUMP_SERVER } @@ -250,6 +253,8 @@ setup_if_ipsec() atf_check -s exit:0 -o ignore rump.route add -inet ${peernet} ${addr} fi + atf_check -s exit:0 rump.ifconfig -w 10 + $DEBUG && rump.ifconfig ipsec0 $DEBUG && rump.route -nL show } @@ -428,6 +433,7 @@ setup_dummy_if_ipsec() else atf_check -s exit:0 rump.ifconfig ipsec1 inet ${addr}/32 ${remote} fi + atf_check -s exit:0 rump.ifconfig -w 10 $DEBUG && rump.ifconfig ipsec1 unset RUMP_SERVER @@ -569,6 +575,7 @@ setup_recursive_if_ipsec() else atf_check -s exit:0 rump.ifconfig ${ipsec} inet ${addr}/32 ${remote} fi + atf_check -s exit:0 rump.ifconfig -w 10 setup_if_ipsec_sa $sock ${src} ${dst} ${inner} ${proto} ${algo} ${dir} export RUMP_SERVER=${sock}
CVS commit: src/tests/net/if_ipsec
Module Name:src Committed By: knakahara Date: Tue Jan 15 05:33:42 UTC 2019 Modified Files: src/tests/net/if_ipsec: t_ipsec.sh Log Message: revert t_ipsec.sh:r1.7 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/net/if_ipsec/t_ipsec.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/net/if_ipsec/t_ipsec.sh diff -u src/tests/net/if_ipsec/t_ipsec.sh:1.7 src/tests/net/if_ipsec/t_ipsec.sh:1.8 --- src/tests/net/if_ipsec/t_ipsec.sh:1.7 Fri Jan 11 08:05:52 2019 +++ src/tests/net/if_ipsec/t_ipsec.sh Tue Jan 15 05:33:42 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_ipsec.sh,v 1.7 2019/01/11 08:05:52 knakahara Exp $ +# $NetBSD: t_ipsec.sh,v 1.8 2019/01/15 05:33:42 knakahara Exp $ # # Copyright (c) 2017 Internet Initiative Japan Inc. # All rights reserved. @@ -62,7 +62,7 @@ ROUTER2_IPSECIP6_RECURSIVE1=fc00:104::1 ROUTER2_IPSECIP6_RECURSIVE2=fc00:204::1 DEBUG=${DEBUG:-false} -TIMEOUT=15 +TIMEOUT=7 atf_test_case ipsecif_create_destroy cleanup ipsecif_create_destroy_head()
CVS commit: [pgoyette-compat] src/sys
Module Name:src Committed By: pgoyette Date: Tue Jan 15 04:10:35 UTC 2019 Modified Files: src/sys/kern [pgoyette-compat]: compat_stub.c src/sys/net [pgoyette-compat]: rtsock.c rtsock_shared.c src/sys/sys [pgoyette-compat]: compat_stub.h Log Message: Add vectors for sctp_{add,delete}_ipaddr() so we can check them in rtsock.c rather than depending on the SCTP kernel compile option. This is similar to what was done previously with NTP. To generate a diff of this commit: cvs rdiff -u -r1.1.2.35 -r1.1.2.36 src/sys/kern/compat_stub.c cvs rdiff -u -r1.238.2.20 -r1.238.2.21 src/sys/net/rtsock.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/net/rtsock_shared.c cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/sys/sys/compat_stub.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/compat_stub.c diff -u src/sys/kern/compat_stub.c:1.1.2.35 src/sys/kern/compat_stub.c:1.1.2.36 --- src/sys/kern/compat_stub.c:1.1.2.35 Sun Jan 13 23:32:21 2019 +++ src/sys/kern/compat_stub.c Tue Jan 15 04:10:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.c,v 1.1.2.35 2019/01/13 23:32:21 pgoyette Exp $ */ +/* $NetBSD: compat_stub.c,v 1.1.2.36 2019/01/15 04:10:34 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -59,6 +59,15 @@ int (*vec_ntp_timestatus)(void) = NULL; void (*vec_ntp_adjtime1)(struct timex *) = NULL; #endif +#ifdef SCTP +void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address; +void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address; +else +void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL; +void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL; +#endif + + /* * usb device_info compatability */ Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.238.2.20 src/sys/net/rtsock.c:1.238.2.21 --- src/sys/net/rtsock.c:1.238.2.20 Tue Jan 15 03:40:35 2019 +++ src/sys/net/rtsock.c Tue Jan 15 04:10:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.238.2.20 2019/01/15 03:40:35 pgoyette Exp $ */ +/* $NetBSD: rtsock.c,v 1.238.2.21 2019/01/15 04:10:34 pgoyette Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,13 +61,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.20 2019/01/15 03:40:35 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.21 2019/01/15 04:10:34 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" #include "opt_mpls.h" #include "opt_compat_netbsd.h" -#include "opt_sctp.h" #include "opt_net_mpsafe.h" #endif @@ -96,11 +95,6 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1 #include -#ifdef SCTP -extern void sctp_add_ip_address(struct ifaddr *); -extern void sctp_delete_ip_address(struct ifaddr *); -#endif - #include #include Index: src/sys/net/rtsock_shared.c diff -u src/sys/net/rtsock_shared.c:1.1.2.2 src/sys/net/rtsock_shared.c:1.1.2.3 --- src/sys/net/rtsock_shared.c:1.1.2.2 Tue Jan 15 03:40:35 2019 +++ src/sys/net/rtsock_shared.c Tue Jan 15 04:10:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock_shared.c,v 1.1.2.2 2019/01/15 03:40:35 pgoyette Exp $ */ +/* $NetBSD: rtsock_shared.c,v 1.1.2.3 2019/01/15 04:10:34 pgoyette Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,13 +61,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.1.2.2 2019/01/15 03:40:35 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.1.2.3 2019/01/15 04:10:34 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" #include "opt_mpls.h" #include "opt_compat_netbsd.h" -#include "opt_sctp.h" #include "opt_net_mpsafe.h" #endif @@ -96,11 +95,6 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_share #include -#ifdef SCTP -extern void sctp_add_ip_address(struct ifaddr *); -extern void sctp_delete_ip_address(struct ifaddr *); -#endif - #include #include @@ -1427,13 +1421,11 @@ COMPATNAME(rt_newaddrmsg)(int cmd, struc KASSERT(ifa != NULL); KASSERT(ifa->ifa_addr != NULL); ifp = ifa->ifa_ifp; -#ifdef SCTP - if (cmd == RTM_ADD) { - sctp_add_ip_address(ifa); - } else if (cmd == RTM_DELETE) { - sctp_delete_ip_address(ifa); + if (cmd == RTM_ADD && vec_sctp_add_ip_address != NULL) { + (*vec_sctp_add_ip_address)(ifa); + } else if (cmd == RTM_DELETE && vec_sctp_delete_ip_address != NULL) { + (*vec_sctp_delete_ip_address)(ifa); } -#endif COMPATCALL(rt_newaddrmsg, (cmd, ifa, error, rt)); if (COMPATNAME(route_info).ri_cb.any_count == 0) Index: src/sys/sys/compat_stub.h diff -u src/sys/sys/compat_stub.h:1.1.2.48 src/sys/sys/compat_stub.h:1.1.2.49 --- src/sys/sys/compat_stub.h:1.1.2.48 Mon Jan 14 13:34:28 2019 +++ src/sys/sys/compat_stub.h Tue Jan 15 04:10:35 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_stub.h,v 1.1.2.48 2019/01/14 13:34:28 pgoyette Exp $ */ +/* $NetBSD: compat_stub.h,v 1.1.2.49 2019/01/15 04:10:35 pgoyette Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation,
CVS commit: [pgoyette-compat] src/doc
Module Name:src Committed By: pgoyette Date: Tue Jan 15 03:44:06 UTC 2019 Modified Files: src/doc [pgoyette-compat]: TODO.compat-module Log Message: Note completion of separating rtsock.c into pieces. To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/doc/TODO.compat-module Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/TODO.compat-module diff -u src/doc/TODO.compat-module:1.1.2.21 src/doc/TODO.compat-module:1.1.2.22 --- src/doc/TODO.compat-module:1.1.2.21 Mon Jan 14 13:35:53 2019 +++ src/doc/TODO.compat-module Tue Jan 15 03:44:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: TODO.compat-module,v 1.1.2.21 2019/01/14 13:35:53 pgoyette Exp $ */ +/* $NetBSD: TODO.compat-module,v 1.1.2.22 2019/01/15 03:44:06 pgoyette Exp $ */ DONE @@ -55,12 +55,10 @@ DONE framework, and split version-specific code from baseline code as needed. -16. While the rtsock_50 situation is still a disaster (rtsock_50.c -#include-s the main rtsock.c code with various COMPAT_50-dependant -macro definitions and redefinitions), the basic functionality -works, and the compat_14 references to rtsock_50 routines seems to -be correct. The rtsock_50.c stuff should still be rewritten at -some future time, but it's not urgent. +16. The rtsock.c code has been split into two separate source files, +one for use -current and one which is shared with COMPAT_50 (the +code is shared, but macros are used to define version-specific +routine names and variable types). TODO - Not required for branch merge
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 15 03:43:15 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Fly, nasal demons, fly away... To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.29 src/lib/libc/gen/ctype.3:1.30 --- src/lib/libc/gen/ctype.3:1.29 Tue Jan 15 03:30:58 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 03:43:15 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.29 2019/01/15 03:30:58 riastradh Exp $ +.\" $NetBSD: ctype.3,v 1.30 2019/01/15 03:43:15 uwe Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -170,8 +170,7 @@ When compiling this program, GCC reports passes .Vt char . At runtime, you may get nonsense answers for some inputs without the -cast \(em if you're lucky and it doesn't crash or make demons come flying -out of your nose: +cast \(em if you're lucky and it doesn't crash: .Bd -literal -offset indent % gcc -Wall -o test test.c test.c: In function 'main':
CVS commit: [pgoyette-compat] src/sys
Module Name:src Committed By: pgoyette Date: Tue Jan 15 03:40:35 UTC 2019 Modified Files: src/sys/compat/common [pgoyette-compat]: rtsock_50.c src/sys/net [pgoyette-compat]: rtsock.c rtsock_shared.c Log Message: Split sys/net/rtsock.c into two pieces, one of which is applicable only to -current and one which is shared between -current and COMPAT_50. To generate a diff of this commit: cvs rdiff -u -r1.6.2.4 -r1.6.2.5 src/sys/compat/common/rtsock_50.c cvs rdiff -u -r1.238.2.19 -r1.238.2.20 src/sys/net/rtsock.c cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/net/rtsock_shared.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/common/rtsock_50.c diff -u src/sys/compat/common/rtsock_50.c:1.6.2.4 src/sys/compat/common/rtsock_50.c:1.6.2.5 --- src/sys/compat/common/rtsock_50.c:1.6.2.4 Mon Jan 14 13:34:27 2019 +++ src/sys/compat/common/rtsock_50.c Tue Jan 15 03:40:35 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock_50.c,v 1.6.2.4 2019/01/14 13:34:27 pgoyette Exp $ */ +/* $NetBSD: rtsock_50.c,v 1.6.2.5 2019/01/15 03:40:35 pgoyette Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,23 +61,18 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6.2.4 2019/01/14 13:34:27 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6.2.5 2019/01/15 03:40:35 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" #endif -/* - * COMPAT_50 and COMPAT_RTSOCK must be defined for rtsock.c regardless of - * the currently enabled options. - */ -#ifndef COMPAT_50 -#define COMPAT_50 -#endif - -#define COMPAT_RTSOCK +#define COMPAT_RTSOCK /* Use the COMPATNAME/COMPATCALL macros and the + * various other compat definitions - see + * sys/net/rtsock_shared.c for details + */ -#include +#include #include void Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.238.2.19 src/sys/net/rtsock.c:1.238.2.20 --- src/sys/net/rtsock.c:1.238.2.19 Mon Jan 14 13:34:28 2019 +++ src/sys/net/rtsock.c Tue Jan 15 03:40:35 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.238.2.19 2019/01/14 13:34:28 pgoyette Exp $ */ +/* $NetBSD: rtsock.c,v 1.238.2.20 2019/01/15 03:40:35 pgoyette Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.19 2019/01/14 13:34:28 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.20 2019/01/15 03:40:35 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -105,91 +105,14 @@ extern void sctp_delete_ip_address(struc #include #ifdef COMPAT_RTSOCK -#define RTM_XVERSION RTM_OVERSION -#define RTM_XNEWADDR RTM_ONEWADDR -#define RTM_XDELADDR RTM_ODELADDR -#define RTM_XCHGADDR RTM_OCHGADDR -#define RT_XADVANCE(a,b) RT_OADVANCE(a,b) -#define RT_XROUNDUP(n) RT_OROUNDUP(n) -#define PF_XROUTE PF_OROUTE -#define rt_xmsghdr rt_msghdr50 -#define if_xmsghdr if_msghdr /* if_msghdr50 is for RTM_OIFINFO */ -#define ifa_xmsghdr ifa_msghdr50 -#define if_xannouncemsghdr if_announcemsghdr50 -#define COMPATNAME(x) compat_50_ ## x -#define DOMAINNAME "oroute" -CTASSERT(sizeof(struct ifa_xmsghdr) == 20); -DOMAIN_DEFINE(compat_50_routedomain); /* forward declare and add to link set */ -#else /* COMPAT_RTSOCK */ -#define RTM_XVERSION RTM_VERSION -#define RTM_XNEWADDR RTM_NEWADDR -#define RTM_XDELADDR RTM_DELADDR -#define RTM_XCHGADDR RTM_CHGADDR -#define RT_XADVANCE(a,b) RT_ADVANCE(a,b) -#define RT_XROUNDUP(n) RT_ROUNDUP(n) -#define PF_XROUTE PF_ROUTE -#define rt_xmsghdr rt_msghdr -#define if_xmsghdr if_msghdr -#define ifa_xmsghdr ifa_msghdr -#define if_xannouncemsghdr if_announcemsghdr -#define COMPATNAME(x) x -#define DOMAINNAME "route" -CTASSERT(sizeof(struct ifa_xmsghdr) == 32); -#ifdef COMPAT_50 -#define COMPATCALL(name, args) rtsock_50_ ## name ## _hook_call args +#undef COMPAT_RTSOCK #endif -DOMAIN_DEFINE(routedomain); /* forward declare and add to link set */ -#undef COMPAT_50 -#endif /* COMPAT_RTSOCK */ -#ifndef COMPATCALL -#define COMPATCALL(name, args) do { } while (/*CONSTCOND*/ 0) -#endif - -#ifdef RTSOCK_DEBUG -#define RT_IN_PRINT(info, b, a) (in_print((b), sizeof(b), \ -&((const struct sockaddr_in *)(info)->rti_info[(a)])->sin_addr), (b)) -#endif /* RTSOCK_DEBUG */ - -struct route_info COMPATNAME(route_info) = { - .ri_dst = { .sa_len = 2, .sa_family = PF_XROUTE, }, - .ri_src = { .sa_len = 2, .sa_family = PF_XROUTE, }, - .ri_maxqlen = IFQ_MAXLEN, -}; - -static void COMPATNAME(route_init)(void); -static int COMPATNAME(route_output)(struct mbuf *, struct socket *); - -static int rt_xaddrs(u_char, const char *, const char *, struct rt_addrinfo *); -static struct mbuf *rt_makeifannouncemsg(struct ifnet *, int, int, -struct rt_addrinfo *); -static int rt_msg2(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *); -static void _rt_setmetrics(int, const struct rt_xmsghdr *, struct rtentry
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Tue Jan 15 03:30:58 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Use the same variable for the locale example. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.28 src/lib/libc/gen/ctype.3:1.29 --- src/lib/libc/gen/ctype.3:1.28 Tue Jan 15 01:23:49 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 03:30:58 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.28 2019/01/15 01:23:49 uwe Exp $ +.\" $NetBSD: ctype.3,v 1.29 2019/01/15 03:30:58 riastradh Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -176,7 +176,7 @@ out of your nose: % gcc -Wall -o test test.c test.c: In function 'main': test.c:12:2: warning: array subscript has type 'char' -% LANG=C ./test $(printf '\e270') +% LC_CTYPE=C ./test $(printf '\e270') -72 5 184 0 % LC_CTYPE=C ./test $(printf '\e377')
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 15 01:23:49 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Don't talk about "the first argument" when there's only one. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.27 src/lib/libc/gen/ctype.3:1.28 --- src/lib/libc/gen/ctype.3:1.27 Tue Jan 15 01:13:49 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 01:23:49 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.27 2019/01/15 01:13:49 uwe Exp $ +.\" $NetBSD: ctype.3,v 1.28 2019/01/15 01:23:49 uwe Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -97,7 +97,7 @@ All described functions, including also conform to .St -p1003.1-2001 . .Sh CAVEATS -The first argument of these functions is of type +The argument of these functions is of type .Vt int , but only a very restricted subset of values are actually valid. The argument must either be the value of the macro
CVS commit: [pgoyette-compat] src/sys/net
Module Name:src Committed By: pgoyette Date: Tue Jan 15 01:16:42 UTC 2019 Added Files: src/sys/net [pgoyette-compat]: rtsock_shared.c Log Message: First pass at extracting the "shared" compat code into its own source file, rather than burying it in sys/net/rtsock.c and conditionalizing various pieces. XXX Not yet used - it will eventually be #include-d by sys/net/rtsock.c XXX and compat/common/rtsock_50.c To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.1 src/sys/net/rtsock_shared.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/net/rtsock_shared.c diff -u /dev/null src/sys/net/rtsock_shared.c:1.1.2.1 --- /dev/null Tue Jan 15 01:16:42 2019 +++ src/sys/net/rtsock_shared.c Tue Jan 15 01:16:42 2019 @@ -0,0 +1,1727 @@ +/* $NetBSD: rtsock_shared.c,v 1.1.2.1 2019/01/15 01:16:42 pgoyette Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * 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. Neither the name of the project nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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. + */ + +/* + * Copyright (c) 1988, 1991, 1993 + * The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.1.2.1 2019/01/15 01:16:42 pgoyette Exp $"); + +#ifdef _KERNEL_OPT +#include "opt_inet.h" +#include "opt_mpls.h" +#include "opt_compat_netbsd.h" +#include "opt_sctp.h" +#include "opt_net_mpsafe.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +#ifdef SCTP +extern void sctp_add_ip_address(struct ifaddr *); +extern void sctp_delete_ip_address(struct ifaddr *); +#endif + +#include +#include + +#ifdef COMPAT_RTSOCK /* These belong in compat/common/rtsock_50.c */ +#define RTM_XVERSION RTM_OVERSION +#define RTM_XNEWA
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 15 01:13:49 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Fix markup pasto. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.26 src/lib/libc/gen/ctype.3:1.27 --- src/lib/libc/gen/ctype.3:1.26 Tue Jan 15 01:11:03 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 01:13:49 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.26 2019/01/15 01:11:03 uwe Exp $ +.\" $NetBSD: ctype.3,v 1.27 2019/01/15 01:13:49 uwe Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -200,7 +200,7 @@ if .Dv EOF coincides with any such value, as it does when it is -1 on platforms with signed -.Dv char , +.Vt char , programs that pass .Vt char will still necessarily confuse the classification and mapping of
CVS commit: [pgoyette-compat] src/sys/modules/compat_50
Module Name:src Committed By: pgoyette Date: Tue Jan 15 01:12:30 UTC 2019 Modified Files: src/sys/modules/compat_50 [pgoyette-compat]: Makefile Log Message: As far as I can tell, neither SCTP not NET_MPSAFE are enabled by default on any architecture, so they should not be enabled by default in any of the modules. To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/modules/compat_50/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/compat_50/Makefile diff -u src/sys/modules/compat_50/Makefile:1.1.2.12 src/sys/modules/compat_50/Makefile:1.1.2.13 --- src/sys/modules/compat_50/Makefile:1.1.2.12 Tue Jan 15 01:07:40 2019 +++ src/sys/modules/compat_50/Makefile Tue Jan 15 01:12:30 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.12 2019/01/15 01:07:40 pgoyette Exp $ +# $NetBSD: Makefile,v 1.1.2.13 2019/01/15 01:12:30 pgoyette Exp $ .include "../Makefile.inc" @@ -13,7 +13,9 @@ SRCS+= kern_50.c kern_time_50.c kern_sel SRCS+= vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c -CPPFLAGS+= -DINET -DINET6 -DSCTP -DNET_MPSAFE +CPPFLAGS+= -DINET -DINET6 +# XXX someday we'll need to add +#CPPFLAGS+= -DSCTP -DNET_MPSAFE SRCS+= rtsock_50.c
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 15 01:11:03 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Remove the extra cast to int in the CAVEATS example. We removed it from EXAMPLES a few releases ago. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.25 src/lib/libc/gen/ctype.3:1.26 --- src/lib/libc/gen/ctype.3:1.25 Tue Jan 15 00:43:32 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 01:11:03 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.25 2019/01/15 00:43:32 uwe Exp $ +.\" $NetBSD: ctype.3,v 1.26 2019/01/15 01:11:03 uwe Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -161,7 +161,7 @@ main(int argc, char **argv) setlocale(LC_ALL, ""); printf("%d %d\en", *argv[1], isprint(*argv[1])); printf("%d %d\en", (int)(unsigned char)*argv[1], - isprint((int)(unsigned char)*argv[1])); + isprint((unsigned char)*argv[1])); return 0; } .Ed @@ -170,19 +170,19 @@ When compiling this program, GCC reports passes .Vt char . At runtime, you may get nonsense answers for some inputs without the -cast -- if you're lucky and it doesn't crash or make demons come flying +cast \(em if you're lucky and it doesn't crash or make demons come flying out of your nose: .Bd -literal -offset indent % gcc -Wall -o test test.c test.c: In function 'main': test.c:12:2: warning: array subscript has type 'char' -% LANG=C ./test "`printf '\e270'`" +% LANG=C ./test $(printf '\e270') -72 5 184 0 -% LC_CTYPE=C ./test "`printf '\e377'`" +% LC_CTYPE=C ./test $(printf '\e377') -1 0 255 0 -% LC_CTYPE=fr_FR.ISO8859-1 ./test "`printf '\e377'`" +% LC_CTYPE=fr_FR.ISO8859-1 ./test $(printf '\e377') -1 0 255 2 .Ed
CVS commit: [pgoyette-compat] src/sys/modules/compat_50
Module Name:src Committed By: pgoyette Date: Tue Jan 15 01:07:40 UTC 2019 Modified Files: src/sys/modules/compat_50 [pgoyette-compat]: Makefile Log Message: Add some #defines for rtsock_50 To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/modules/compat_50/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/modules/compat_50/Makefile diff -u src/sys/modules/compat_50/Makefile:1.1.2.11 src/sys/modules/compat_50/Makefile:1.1.2.12 --- src/sys/modules/compat_50/Makefile:1.1.2.11 Wed Oct 3 22:50:50 2018 +++ src/sys/modules/compat_50/Makefile Tue Jan 15 01:07:40 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.11 2018/10/03 22:50:50 pgoyette Exp $ +# $NetBSD: Makefile,v 1.1.2.12 2019/01/15 01:07:40 pgoyette Exp $ .include "../Makefile.inc" @@ -12,6 +12,9 @@ SRCS+= compat_50_mod.c SRCS+= kern_50.c kern_time_50.c kern_select_50.c SRCS+= vfs_syscalls_50.c uipc_syscalls_50.c uvm_50.c SRCS+= rndpseudo_50.c clockctl_50.c if_spppsubr50.c + +CPPFLAGS+= -DINET -DINET6 -DSCTP -DNET_MPSAFE + SRCS+= rtsock_50.c .PATH: ${S}/fs/puffs
CVS commit: src/lib/libc/gen
Module Name:src Committed By: uwe Date: Tue Jan 15 00:43:32 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Fix typo in macro flag. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.24 src/lib/libc/gen/ctype.3:1.25 --- src/lib/libc/gen/ctype.3:1.24 Tue Jan 15 00:31:19 2019 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 00:43:32 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.24 2019/01/15 00:31:19 riastradh Exp $ +.\" $NetBSD: ctype.3,v 1.25 2019/01/15 00:43:32 uwe Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -147,7 +147,7 @@ inputs of type .Vt char in order to flag code that may pass negative values at runtime that would lead to undefined behavior: -.Bd -literal offset indent +.Bd -literal -offset indent #include #include #include
CVS commit: src/lib/libc/gen
Module Name:src Committed By: riastradh Date: Tue Jan 15 00:31:19 UTC 2019 Modified Files: src/lib/libc/gen: ctype.3 Log Message: Expand on correct and incorrect usage, and on compiler warnings. Give an example program with the warning, and some example nonsense outputs. Also note why glibc's approach doesn't solve the problem. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/ctype.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/ctype.3 diff -u src/lib/libc/gen/ctype.3:1.23 src/lib/libc/gen/ctype.3:1.24 --- src/lib/libc/gen/ctype.3:1.23 Tue Dec 12 14:13:52 2017 +++ src/lib/libc/gen/ctype.3 Tue Jan 15 00:31:19 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: ctype.3,v 1.23 2017/12/12 14:13:52 abhinav Exp $ +.\" $NetBSD: ctype.3,v 1.24 2019/01/15 00:31:19 riastradh Exp $ .\" .\" Copyright (c) 1991 Regents of the University of California. .\" All rights reserved. @@ -30,7 +30,7 @@ .\" .\" @(#)ctype.3 6.5 (Berkeley) 4/19/91 .\" -.Dd December 8, 2017 +.Dd January 15, 2019 .Dt CTYPE 3 .Os .Sh NAME @@ -136,3 +136,73 @@ which will be outside the range of allow (unless it happens to be equal to .Dv EOF , but even that would not give the desired result). +.Pp +Because the bugs may manifest as silent misbehavior or as crashes only +when fed input outside the US-ASCII range, the +.Nx +implementation of the +.Nm +functions is designed to elicit a compiler warning for code that passes +inputs of type +.Vt char +in order to flag code that may pass negative values at runtime that +would lead to undefined behavior: +.Bd -literal offset indent +#include +#include +#include + +int +main(int argc, char **argv) +{ + + if (argc < 2) + return 1; + setlocale(LC_ALL, ""); + printf("%d %d\en", *argv[1], isprint(*argv[1])); + printf("%d %d\en", (int)(unsigned char)*argv[1], + isprint((int)(unsigned char)*argv[1])); + return 0; +} +.Ed +.Pp +When compiling this program, GCC reports a warning for the line that +passes +.Vt char . +At runtime, you may get nonsense answers for some inputs without the +cast -- if you're lucky and it doesn't crash or make demons come flying +out of your nose: +.Bd -literal -offset indent +% gcc -Wall -o test test.c +test.c: In function 'main': +test.c:12:2: warning: array subscript has type 'char' +% LANG=C ./test "`printf '\e270'`" +-72 5 +184 0 +% LC_CTYPE=C ./test "`printf '\e377'`" +-1 0 +255 0 +% LC_CTYPE=fr_FR.ISO8859-1 ./test "`printf '\e377'`" +-1 0 +255 2 +.Ed +.Pp +Some implementations of libc, such as glibc as of 2018, attempt to +avoid the worst of the undefined behavior by defining the functions to +work for all integer inputs representable by either +.Vt unsigned char +or +.Vt char , +and suppress the warning. +However, this is not an excuse for avoiding conversion to +.Vt unsigned char : +if +.Dv EOF +coincides with any such value, as it does when it is -1 on platforms +with signed +.Dv char , +programs that pass +.Vt char +will still necessarily confuse the classification and mapping of +.Dv EOF +with the classification and mapping of some non-EOF inputs.
CVS commit: src/sys/dev
Module Name:src Committed By: jdolecek Date: Mon Jan 14 21:29:56 UTC 2019 Modified Files: src/sys/dev/ic: ahcisatavar.h src/sys/dev/pci: ahcisata_pci.c Log Message: nothing handles AHCI_QUIRK_BADPMPRESET quirk, remove and change all entries using it (ATI SB600/SB700) to instead use AHCI_QUIRK_BADPMP To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/ahcisatavar.h cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/ahcisata_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ahcisatavar.h diff -u src/sys/dev/ic/ahcisatavar.h:1.21 src/sys/dev/ic/ahcisatavar.h:1.22 --- src/sys/dev/ic/ahcisatavar.h:1.21 Fri Dec 7 22:22:12 2018 +++ src/sys/dev/ic/ahcisatavar.h Mon Jan 14 21:29:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisatavar.h,v 1.21 2018/12/07 22:22:12 jdolecek Exp $ */ +/* $NetBSD: ahcisatavar.h,v 1.22 2019/01/14 21:29:56 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -58,7 +58,6 @@ struct ahci_softc { #define AHCI_PCI_QUIRK_FORCE __BIT(0) /* force attach */ #define AHCI_PCI_QUIRK_BAD64 __BIT(1) /* broken 64-bit DMA */ #define AHCI_QUIRK_BADPMP __BIT(2) /* broken PMP support, ignore */ -#define AHCI_QUIRK_BADPMPRESET __BIT(3) /* broken PMP support for reset */ #define AHCI_QUIRK_SKIP_RESET __BIT(4) /* skip drive reset sequence */ uint32_t sc_ahci_cap; /* copy of AHCI_CAP */ Index: src/sys/dev/pci/ahcisata_pci.c diff -u src/sys/dev/pci/ahcisata_pci.c:1.50 src/sys/dev/pci/ahcisata_pci.c:1.51 --- src/sys/dev/pci/ahcisata_pci.c:1.50 Sat Dec 8 15:31:30 2018 +++ src/sys/dev/pci/ahcisata_pci.c Mon Jan 14 21:29:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_pci.c,v 1.50 2018/12/08 15:31:30 jdolecek Exp $ */ +/* $NetBSD: ahcisata_pci.c,v 1.51 2019/01/14 21:29:56 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.50 2018/12/08 15:31:30 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.51 2019/01/14 21:29:56 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_ahcisata_pci.h" @@ -175,17 +175,17 @@ static const struct ahci_pci_quirk ahci_ AHCI_PCI_QUIRK_FORCE }, /* ATI SB600 AHCI 64-bit DMA only works on some boards/BIOSes */ { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SATA_1, - AHCI_PCI_QUIRK_BAD64 | AHCI_QUIRK_BADPMPRESET }, + AHCI_PCI_QUIRK_BAD64 | AHCI_QUIRK_BADPMP }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI, - AHCI_QUIRK_BADPMPRESET }, + AHCI_QUIRK_BADPMP }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID, - AHCI_QUIRK_BADPMPRESET }, + AHCI_QUIRK_BADPMP }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID5, - AHCI_QUIRK_BADPMPRESET }, + AHCI_QUIRK_BADPMP }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI2, - AHCI_QUIRK_BADPMPRESET }, + AHCI_QUIRK_BADPMP }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_STORAGE, - AHCI_QUIRK_BADPMPRESET }, + AHCI_QUIRK_BADPMP }, { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237R_SATA, AHCI_QUIRK_BADPMP }, { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA,
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jdolecek Date: Mon Jan 14 21:09:01 UTC 2019 Modified Files: src/sys/dev/ic: ahcisatareg.h Log Message: fix typo in comment To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/ahcisatareg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ahcisatareg.h diff -u src/sys/dev/ic/ahcisatareg.h:1.14 src/sys/dev/ic/ahcisatareg.h:1.15 --- src/sys/dev/ic/ahcisatareg.h:1.14 Mon Dec 3 20:00:16 2018 +++ src/sys/dev/ic/ahcisatareg.h Mon Jan 14 21:09:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisatareg.h,v 1.14 2018/12/03 20:00:16 jdolecek Exp $ */ +/* $NetBSD: ahcisatareg.h,v 1.15 2019/01/14 21:09:01 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -208,7 +208,7 @@ struct ahci_r_fis { #define AHCI_P_IX_PRCS 0x0040 /* Phy Ready change */ #define AHCI_P_IX_DMPS 0x0080 /* Device Mechanical Presence */ #define AHCI_P_IX_PCS 0x0040 /* port Connect change */ -#define AHCI_P_IX_DPS 0x0020 /* dexcriptor processed */ +#define AHCI_P_IX_DPS 0x0020 /* descriptor processed */ #define AHCI_P_IX_UFS 0x0010 /* Unknown FIS */ #define AHCI_P_IX_SDBS 0x0008 /* Set device bit */ #define AHCI_P_IX_DSS 0x0004 /* DMA setup FIS */
CVS commit: src/sys/kern
Module Name:src Committed By: jdolecek Date: Mon Jan 14 19:21:54 UTC 2019 Modified Files: src/sys/kern: subr_prf.c Log Message: add KASSERT()s to ensure aprint_*_dev() and aprint_*_ifp() is not called with NULL dv or ifp respectively related to PR kern/53789 To generate a diff of this commit: cvs rdiff -u -r1.175 -r1.176 src/sys/kern/subr_prf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_prf.c diff -u src/sys/kern/subr_prf.c:1.175 src/sys/kern/subr_prf.c:1.176 --- src/sys/kern/subr_prf.c:1.175 Mon Jan 7 13:09:48 2019 +++ src/sys/kern/subr_prf.c Mon Jan 14 19:21:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_prf.c,v 1.175 2019/01/07 13:09:48 martin Exp $ */ +/* $NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $ */ /*- * Copyright (c) 1986, 1988, 1991, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.175 2019/01/07 13:09:48 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -808,6 +808,8 @@ aprint_normal_dev(device_t dv, const cha { va_list ap; + KASSERT(dv != NULL); + va_start(ap, fmt); aprint_normal_internal(device_xname(dv), fmt, ap); va_end(ap); @@ -818,6 +820,8 @@ aprint_normal_ifnet(struct ifnet *ifp, c { va_list ap; + KASSERT(ifp != NULL); + va_start(ap, fmt); aprint_normal_internal(ifp->if_xname, fmt, ap); va_end(ap); @@ -885,6 +889,8 @@ aprint_error_dev(device_t dv, const char { va_list ap; + KASSERT(dv != NULL); + va_start(ap, fmt); aprint_error_internal(device_xname(dv), fmt, ap); va_end(ap); @@ -895,6 +901,8 @@ aprint_error_ifnet(struct ifnet *ifp, co { va_list ap; + KASSERT(ifp != NULL); + va_start(ap, fmt); aprint_error_internal(ifp->if_xname, fmt, ap); va_end(ap); @@ -934,6 +942,8 @@ aprint_naive_dev(device_t dv, const char { va_list ap; + KASSERT(dv != NULL); + va_start(ap, fmt); aprint_naive_internal(device_xname(dv), fmt, ap); va_end(ap); @@ -944,6 +954,8 @@ aprint_naive_ifnet(struct ifnet *ifp, co { va_list ap; + KASSERT(ifp != NULL); + va_start(ap, fmt); aprint_naive_internal(ifp->if_xname, fmt, ap); va_end(ap); @@ -988,6 +1000,8 @@ aprint_verbose_dev(device_t dv, const ch { va_list ap; + KASSERT(dv != NULL); + va_start(ap, fmt); aprint_verbose_internal(device_xname(dv), fmt, ap); va_end(ap); @@ -998,6 +1012,8 @@ aprint_verbose_ifnet(struct ifnet *ifp, { va_list ap; + KASSERT(ifp != NULL); + va_start(ap, fmt); aprint_verbose_internal(ifp->if_xname, fmt, ap); va_end(ap); @@ -1036,6 +1052,8 @@ aprint_debug_dev(device_t dv, const char { va_list ap; + KASSERT(dv != NULL); + va_start(ap, fmt); aprint_debug_internal(device_xname(dv), fmt, ap); va_end(ap); @@ -1046,6 +1064,8 @@ aprint_debug_ifnet(struct ifnet *ifp, co { va_list ap; + KASSERT(ifp != NULL); + va_start(ap, fmt); aprint_debug_internal(ifp->if_xname, fmt, ap); va_end(ap);
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: maxv Date: Mon Jan 14 18:54:07 UTC 2019 Modified Files: src/sys/arch/x86/x86: dbregs.c Log Message: Add #ifndef i386, the dbregs are 32bit in this case anyway. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/dbregs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/dbregs.c diff -u src/sys/arch/x86/x86/dbregs.c:1.13 src/sys/arch/x86/x86/dbregs.c:1.14 --- src/sys/arch/x86/x86/dbregs.c:1.13 Sun Jan 13 10:01:07 2019 +++ src/sys/arch/x86/x86/dbregs.c Mon Jan 14 18:54:07 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dbregs.c,v 1.13 2019/01/13 10:01:07 maxv Exp $ */ +/* $NetBSD: dbregs.c,v 1.14 2019/01/14 18:54:07 maxv Exp $ */ /* * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -256,12 +256,14 @@ x86_dbregs_validate(const struct dbreg * return EINVAL; } +#ifndef i386 if (regs->dr[6] & X86_DR6_MBZ) { return EINVAL; } if (regs->dr[7] & X86_DR7_MBZ) { return EINVAL; } +#endif if (regs->dr[7] & X86_DR7_GENERAL_DETECT_ENABLE) { return EINVAL; }
CVS commit: src/sys/netinet6
Module Name:src Committed By: maxv Date: Mon Jan 14 18:51:15 UTC 2019 Modified Files: src/sys/netinet6: ip6_input.c Log Message: Fix bug, should be ip6_protox[]. To generate a diff of this commit: cvs rdiff -u -r1.205 -r1.206 src/sys/netinet6/ip6_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.205 src/sys/netinet6/ip6_input.c:1.206 --- src/sys/netinet6/ip6_input.c:1.205 Thu Nov 15 10:23:56 2018 +++ src/sys/netinet6/ip6_input.c Mon Jan 14 18:51:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.205 2018/11/15 10:23:56 maxv Exp $ */ +/* $NetBSD: ip6_input.c,v 1.206 2019/01/14 18:51:15 maxv Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.205 2018/11/15 10:23:56 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.206 2019/01/14 18:51:15 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -739,7 +739,7 @@ hbhcheck: * header. Note that we do not visit this with * protocols with pcb layer code - like udp/tcp/raw ip. */ - if ((inet6sw[ip_protox[nxt]].pr_flags + if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0) { int error;
CVS commit: src/share/misc
Module Name:src Committed By: sevan Date: Mon Jan 14 17:25:12 UTC 2019 Modified Files: src/share/misc: acronyms.comp Log Message: Storage related acronyms ESDI, ESI, IPI, SES, SMD, SRP To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/acronyms.comp diff -u src/share/misc/acronyms.comp:1.223 src/share/misc/acronyms.comp:1.224 --- src/share/misc/acronyms.comp:1.223 Mon Jan 7 18:48:07 2019 +++ src/share/misc/acronyms.comp Mon Jan 14 17:25:12 2019 @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.223 2019/01/07 18:48:07 sevan Exp $ +$NetBSD: acronyms.comp,v 1.224 2019/01/14 17:25:12 sevan Exp $ 3WHS three-way handshake 8VSB 8-state vestigial side band modulation AA anti-aliasing @@ -480,7 +480,9 @@ ERE extended regular expression ERST error record serialization table ESAN Efficiency Sanitizer ESB enterprise service bus +ESDI enhanced small disk interface ESDRAM enhanced synchronous dynamic random access memory +ESI enclosure services interface ESS electronic switching system ESS extended service set ESSID extended service set identifier @@ -673,6 +675,7 @@ IP intellectual property IPC instructions per cycle IPC interprocess communication IPE integrated programming environment +IPI intelligent peripheral interface IPI interprocessor interrupt IPL Initial Program Load IPL Interrupt Priority Level @@ -1282,6 +1285,7 @@ SDT syntax-directed translation SEA synchronous external abort SEGV segmentation violation SEO search engine optimization +SES scsi enclosure services SFC sequential function chart SFI simple firmware interface SFI software fault isolation @@ -1318,6 +1322,7 @@ SMB Server Message Block SMB system management bus SMBIOS System Management BIOS SMC system management controller +SMD storage module device SMEP supervisor mode execution protection SMF single mode fiber SMI structure of management information @@ -1358,6 +1363,7 @@ SQCIF sub quarter common intermediate fo SQL Structured Query Language SRAM static random access memory SRC sample rate conversion +SRP scsi rdma protocol SS self-snoop SS stack segment SSA static single assignment
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Mon Jan 14 15:56:06 UTC 2019 Modified Files: src/share/man/man9: pmap.9 Log Message: Remove Pp before It, where it has no effect. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/share/man/man9/pmap.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/pmap.9 diff -u src/share/man/man9/pmap.9:1.45 src/share/man/man9/pmap.9:1.46 --- src/share/man/man9/pmap.9:1.45 Sun Jan 13 06:59:15 2019 +++ src/share/man/man9/pmap.9 Mon Jan 14 15:56:06 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: pmap.9,v 1.45 2019/01/13 06:59:15 mrg Exp $ +.\" $NetBSD: pmap.9,v 1.46 2019/01/14 15:56:06 wiz Exp $ .\" .\" Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -581,7 +581,6 @@ mappings immediately in or to use the knowledge of the upcoming .Fn pmap_remove calls to optimize the removals (or to just ignore this call). -.Pp .It void Fn "pmap_protect" "pmap_t pmap" "vaddr_t sva" "vaddr_t eva" \ "vm_prot_t prot" Set the protection of the mappings in the virtual address range @@ -1117,7 +1116,6 @@ The use of .Fn PMAP_PREFER is enabled by defining it as a C pre-processor macro in .In machine/pmap.h . -.Pp .It void Fn "pmap_procwr" "struct proc *p" "vaddr_t va" "vsize_t size" Synchronize CPU instruction caches of the specified range. The address space is designated by
CVS commit: src/share/man/man8
Module Name:src Committed By: wiz Date: Mon Jan 14 15:55:35 UTC 2019 Modified Files: src/share/man/man8: compat_netbsd32.8 Log Message: Fix macro, fix grammar. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/share/man/man8/compat_netbsd32.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/compat_netbsd32.8 diff -u src/share/man/man8/compat_netbsd32.8:1.11 src/share/man/man8/compat_netbsd32.8:1.12 --- src/share/man/man8/compat_netbsd32.8:1.11 Sun Jan 13 04:45:35 2019 +++ src/share/man/man8/compat_netbsd32.8 Mon Jan 14 15:55:35 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: compat_netbsd32.8,v 1.11 2019/01/13 04:45:35 mrg Exp $ +.\" $NetBSD: compat_netbsd32.8,v 1.12 2019/01/14 15:55:35 wiz Exp $ .\" .\" Copyright (c) 2001, 2019 Matthew R. Green .\" All rights reserved. @@ -81,7 +81,7 @@ For a.out compatibility, .Pa /usr/libexec/ld.so from a 32-bit distribution is required to exist, and the a.out shared libraries must be found in -.P /emul/aout +.Pa /emul/aout as normal for a.out compatibility. For 32-bit (64-bit on .Nx Ns Tn /mips64 ) @@ -103,7 +103,7 @@ Note that the kernel handles rewriting t to the above path. .Pp Before -.Nx 5.0 +.Nx 5.0 all of these files needed to be placed under .Pa /emul/netbsd32 . .Pp @@ -121,5 +121,5 @@ is not supported. .Pp Some .Xr ioctl 2 -command are not supported, including +commands are not supported, including .Xr drm 4 .
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 15:00:27 UTC 2019 Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Add multiqueue support, vioif(4) To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.45 src/sys/dev/pci/if_vioif.c:1.46 --- src/sys/dev/pci/if_vioif.c:1.45 Mon Jan 14 14:57:25 2019 +++ src/sys/dev/pci/if_vioif.c Mon Jan 14 15:00:27 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.45 2019/01/14 14:57:25 yamaguchi Exp $ */ +/* $NetBSD: if_vioif.c,v 1.46 2019/01/14 15:00:27 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.45 2019/01/14 14:57:25 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.46 2019/01/14 15:00:27 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v #include #include #include +#include #include #include @@ -59,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v #ifdef NET_MPSAFE #define VIOIF_MPSAFE 1 +#define VIOIF_MULTIQ 1 #endif #ifdef SOFTINT_INTR @@ -71,28 +73,35 @@ __KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v /* Configuration registers */ #define VIRTIO_NET_CONFIG_MAC 0 /* 8bit x 6byte */ #define VIRTIO_NET_CONFIG_STATUS 6 /* 16bit */ +#define VIRTIO_NET_CONFIG_MAX_VQ_PAIRS 8 /* 16bit */ /* Feature bits */ -#define VIRTIO_NET_F_CSUM (1<<0) -#define VIRTIO_NET_F_GUEST_CSUM (1<<1) -#define VIRTIO_NET_F_MAC (1<<5) -#define VIRTIO_NET_F_GSO (1<<6) -#define VIRTIO_NET_F_GUEST_TSO4 (1<<7) -#define VIRTIO_NET_F_GUEST_TSO6 (1<<8) -#define VIRTIO_NET_F_GUEST_ECN (1<<9) -#define VIRTIO_NET_F_GUEST_UFO (1<<10) -#define VIRTIO_NET_F_HOST_TSO4 (1<<11) -#define VIRTIO_NET_F_HOST_TSO6 (1<<12) -#define VIRTIO_NET_F_HOST_ECN (1<<13) -#define VIRTIO_NET_F_HOST_UFO (1<<14) -#define VIRTIO_NET_F_MRG_RXBUF (1<<15) -#define VIRTIO_NET_F_STATUS (1<<16) -#define VIRTIO_NET_F_CTRL_VQ (1<<17) -#define VIRTIO_NET_F_CTRL_RX (1<<18) -#define VIRTIO_NET_F_CTRL_VLAN (1<<19) +#define VIRTIO_NET_F_CSUM __BIT(0) +#define VIRTIO_NET_F_GUEST_CSUM __BIT(1) +#define VIRTIO_NET_F_MAC __BIT(5) +#define VIRTIO_NET_F_GSO __BIT(6) +#define VIRTIO_NET_F_GUEST_TSO4 __BIT(7) +#define VIRTIO_NET_F_GUEST_TSO6 __BIT(8) +#define VIRTIO_NET_F_GUEST_ECN __BIT(9) +#define VIRTIO_NET_F_GUEST_UFO __BIT(10) +#define VIRTIO_NET_F_HOST_TSO4 __BIT(11) +#define VIRTIO_NET_F_HOST_TSO6 __BIT(12) +#define VIRTIO_NET_F_HOST_ECN __BIT(13) +#define VIRTIO_NET_F_HOST_UFO __BIT(14) +#define VIRTIO_NET_F_MRG_RXBUF __BIT(15) +#define VIRTIO_NET_F_STATUS __BIT(16) +#define VIRTIO_NET_F_CTRL_VQ __BIT(17) +#define VIRTIO_NET_F_CTRL_RX __BIT(18) +#define VIRTIO_NET_F_CTRL_VLAN __BIT(19) +#define VIRTIO_NET_F_CTRL_RX_EXTRA __BIT(20) +#define VIRTIO_NET_F_GUEST_ANNOUNCE __BIT(21) +#define VIRTIO_NET_F_MQ __BIT(22) #define VIRTIO_NET_FLAG_BITS \ VIRTIO_COMMON_FLAG_BITS \ + "\x17""MQ" \ + "\x16""GUEST_ANNOUNCE" \ + "\x15""CTRL_RX_EXTRA" \ "\x14""CTRL_VLAN" \ "\x13""CTRL_RX" \ "\x12""CTRL_VQ" \ @@ -152,6 +161,11 @@ struct virtio_net_ctrl_cmd { # define VIRTIO_NET_CTRL_VLAN_ADD 0 # define VIRTIO_NET_CTRL_VLAN_DEL 1 +#define VIRTIO_NET_CTRL_MQ 4 +# define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 +# define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN 1 +# define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX 0x8000 + struct virtio_net_ctrl_status { uint8_t ack; } __packed; @@ -171,6 +185,10 @@ struct virtio_net_ctrl_vlan { uint16_t id; } __packed; +struct virtio_net_ctrl_mq { + uint16_t virtqueue_pairs; +} __packed; + struct vioif_ctrl_cmdspec { bus_dmamap_t dmamap; void *buf; @@ -197,12 +215,15 @@ struct vioif_txqueue { struct virtqueue *txq_vq; bool txq_stopping; bool txq_link_active; + pcq_t *txq_intrq; struct virtio_net_hdr *txq_hdrs; bus_dmamap_t *txq_hdr_dmamaps; struct mbuf **txq_mbufs; bus_dmamap_t *txq_dmamaps; + + void *txq_deferred_transmit; }; struct vioif_rxqueue { @@ -234,30 +255,33 @@ struct vioif_ctrlqueue { struct virtio_net_ctrl_rx *ctrlq_rx; struct virtio_net_ctrl_mac_tbl *ctrlq_mac_tbl_uc; struct virtio_net_ctrl_mac_tbl *ctrlq_mac_tbl_mc; + struct virtio_net_ctrl_mq *ctrlq_mq; bus_dmamap_t ctrlq_cmd_dmamap; bus_dmamap_t ctrlq_status_dmamap; bus_dmamap_t ctrlq_rx_dmamap; bus_dmamap_t ctrlq_tbl_uc_dmamap; bus_dmamap_t ctrlq_tbl_mc_dmamap; + bus_dmamap_t ctrlq_mq_dmamap; }; struct vioif_softc { device_t sc_dev; struct virtio_softc *sc_virtio; - struct virtqueue sc_vq[3]; -#define VQ_RX 0 -#define VQ_TX 1 -#define VQ_CTRL 2 + struct virtqueue *sc_vqs; + + int sc_max_nvq_pairs; + int sc_req_nvq_pairs; + int sc_act_nvq_pairs; uint8_t sc_mac[ETHER_ADDR_LEN];
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 14:57:25 UTC 2019 Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Set IFEF_MPSAFE flag To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.44 src/sys/dev/pci/if_vioif.c:1.45 --- src/sys/dev/pci/if_vioif.c:1.44 Mon Jan 14 14:52:57 2019 +++ src/sys/dev/pci/if_vioif.c Mon Jan 14 14:57:25 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.44 2019/01/14 14:52:57 yamaguchi Exp $ */ +/* $NetBSD: if_vioif.c,v 1.45 2019/01/14 14:57:25 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.44 2019/01/14 14:52:57 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.45 2019/01/14 14:57:25 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -702,6 +702,9 @@ skip: strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; +#ifdef VIOIF_MPSAFE + ifp->if_extflags = IFEF_MPSAFE; +#endif ifp->if_start = vioif_start; ifp->if_ioctl = vioif_ioctl; ifp->if_init = vioif_init;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 14:55:37 UTC 2019 Modified Files: src/sys/dev/pci: virtio.c virtio_pci.c virtiovar.h Log Message: Add multiqueue support, virtio(4) To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/virtio.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/virtio_pci.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/virtiovar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/virtio.c diff -u src/sys/dev/pci/virtio.c:1.36 src/sys/dev/pci/virtio.c:1.37 --- src/sys/dev/pci/virtio.c:1.36 Sun Sep 30 15:44:22 2018 +++ src/sys/dev/pci/virtio.c Mon Jan 14 14:55:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio.c,v 1.36 2018/09/30 15:44:22 jmcneill Exp $ */ +/* $NetBSD: virtio.c,v 1.37 2019/01/14 14:55:37 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.36 2018/09/30 15:44:22 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.37 2019/01/14 14:55:37 yamaguchi Exp $"); #include #include @@ -235,6 +235,54 @@ vq_sync_indirect(struct virtio_softc *sc ops); } +static void +virtio_vq_soft_intr(void *arg) +{ + struct virtqueue *vq = arg; + + KASSERT(vq->vq_intrhand != NULL); + + (vq->vq_intrhand)(vq); +} + +static int +virtio_vq_softint_establish(struct virtio_softc *sc) +{ + struct virtqueue *vq; + int qid; + u_int flags; + + flags = SOFTINT_NET; + if (sc->sc_flags & VIRTIO_F_PCI_INTR_MPSAFE) + flags |= SOFTINT_MPSAFE; + + for (qid = 0; qid < sc->sc_nvqs; qid++) { + vq = &sc->sc_vqs[qid]; + vq->vq_soft_ih = + softint_establish(flags, virtio_vq_soft_intr, vq); + if (vq->vq_soft_ih == NULL) + return -1; + } + + return 0; +} + +static void +virtio_vq_softint_disestablish(struct virtio_softc *sc) +{ + struct virtqueue *vq; + int qid; + + for (qid = 0; qid < sc->sc_nvqs; qid++) { + vq = &sc->sc_vqs[qid]; + if (vq->vq_soft_ih == NULL) + continue; + + softint_disestablish(vq->vq_soft_ih); + vq->vq_soft_ih = NULL; + } +} + /* * Can be used as sc_intrhand. */ @@ -242,6 +290,26 @@ vq_sync_indirect(struct virtio_softc *sc * Scan vq, bus_dmamap_sync for the vqs (not for the payload), * and calls (*vq_done)() if some entries are consumed. */ +static int +virtio_vq_intr_common(struct virtqueue *vq) +{ + struct virtio_softc *sc = vq->vq_owner; + int r = 0; + + if (vq->vq_queued) { + vq->vq_queued = 0; + vq_sync_aring(sc, vq, BUS_DMASYNC_POSTWRITE); + } + vq_sync_uring(sc, vq, BUS_DMASYNC_POSTREAD); + membar_consumer(); + if (vq->vq_used_idx != vq->vq_used->idx) { + if (vq->vq_done) + r |= (vq->vq_done)(vq); + } + + return r; +} + int virtio_vq_intr(struct virtio_softc *sc) { @@ -250,21 +318,19 @@ virtio_vq_intr(struct virtio_softc *sc) for (i = 0; i < sc->sc_nvqs; i++) { vq = &sc->sc_vqs[i]; - if (vq->vq_queued) { - vq->vq_queued = 0; - vq_sync_aring(sc, vq, BUS_DMASYNC_POSTWRITE); - } - vq_sync_uring(sc, vq, BUS_DMASYNC_POSTREAD); - membar_consumer(); - if (vq->vq_used_idx != vq->vq_used->idx) { - if (vq->vq_done) -r |= (vq->vq_done)(vq); - } + r |= virtio_vq_intr_common(vq); } return r; } +static int +virtio_vq_mq_intr(struct virtqueue *vq) +{ + + return virtio_vq_intr_common(vq); +} + /* * Start/stop vq interrupt. No guarantee. */ @@ -409,6 +475,7 @@ virtio_alloc_vq(struct virtio_softc *sc, /* remember addresses and offsets for later use */ vq->vq_owner = sc; + vq->vq_intrhand = virtio_vq_mq_intr; vq->vq_num = vq_size; vq->vq_index = index; vq->vq_desc = vq->vq_vaddr; @@ -844,6 +911,16 @@ virtio_child_attach_start(struct virtio_ aprint_naive("\n"); } +void +virtio_child_attach_set_vqs(struct virtio_softc *sc, +struct virtqueue *vqs, int nvq_pairs) +{ + if (nvq_pairs > 1) + sc->sc_child_mq = true; + + sc->sc_vqs = vqs; +} + int virtio_child_attach_finish(struct virtio_softc *sc) { @@ -868,12 +945,26 @@ virtio_child_attach_finish(struct virtio "failed to establish soft interrupt\n"); goto fail; } + + if (sc->sc_child_mq) { + r = virtio_vq_softint_establish(sc); + aprint_error_dev(sc->sc_dev, + "failed to establish softint interrupt\n"); + goto fail; + } } virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK); return 0; fail: + if (sc->sc_soft_ih) { + softint_disestablish(sc->sc_soft_ih); + sc->sc_soft_ih = NULL; + } + + virtio_vq_softint_disestablish(sc); + virtio_set_status(sc, VIRTIO_CONFIG_DEVICE_STATUS_FAILED); return 1; } Index: src/sys/dev/pci/virtio_pci.c diff -u src/sys/dev/pci/virtio_pci.c:1.5 src/sys/dev/pci/virtio_pci.c:1.6 --- src/sys/dev/pci/virtio_pci.c:1.5 Wed Jun 6 16:11:36 2018 +++ src/sys/dev/pci/virtio_pci.c Mon Jan 14 14:55:37 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio_pci.c,v 1.5 2018/06/06 16:11:36 jakllsch Exp $ */ +/* $NetBSD: virtio_pci.c,v 1.6 2019/01/14 14:55:37 yama
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 14:52:57 UTC 2019 Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Functionize the same code related to ctrl vq in vioif(4) To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.43 src/sys/dev/pci/if_vioif.c:1.44 --- src/sys/dev/pci/if_vioif.c:1.43 Mon Jan 14 14:35:52 2019 +++ src/sys/dev/pci/if_vioif.c Mon Jan 14 14:52:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.43 2019/01/14 14:35:52 yamaguchi Exp $ */ +/* $NetBSD: if_vioif.c,v 1.44 2019/01/14 14:52:57 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.43 2019/01/14 14:35:52 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.44 2019/01/14 14:52:57 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -171,6 +171,11 @@ struct virtio_net_ctrl_vlan { uint16_t id; } __packed; +struct vioif_ctrl_cmdspec { + bus_dmamap_t dmamap; + void *buf; + bus_size_t bufsize; +}; /* * if_vioifvar.h: @@ -222,6 +227,7 @@ struct vioif_ctrlqueue { }ctrlq_inuse; kcondvar_t ctrlq_wait; kmutex_t ctrlq_wait_lock; + struct lwp *ctrlq_owner; struct virtio_net_ctrl_cmd *ctrlq_cmd; struct virtio_net_ctrl_status *ctrlq_status; @@ -1279,33 +1285,96 @@ vioif_tx_drain(struct vioif_softc *sc) * Control vq */ /* issue a VIRTIO_NET_CTRL_RX class command and wait for completion */ -static int -vioif_ctrl_rx(struct vioif_softc *sc, int cmd, bool onoff) +static void +vioif_ctrl_acquire(struct vioif_softc *sc) { - struct virtio_softc *vsc = sc->sc_virtio; struct vioif_ctrlqueue *ctrlq = &sc->sc_ctrlq; - struct virtqueue *vq = ctrlq->ctrlq_vq; - int r, slot; - - if (!sc->sc_has_ctrl) - return ENOTSUP; mutex_enter(&ctrlq->ctrlq_wait_lock); while (ctrlq->ctrlq_inuse != FREE) cv_wait(&ctrlq->ctrlq_wait, &ctrlq->ctrlq_wait_lock); ctrlq->ctrlq_inuse = INUSE; + ctrlq->ctrlq_owner = curlwp; + mutex_exit(&ctrlq->ctrlq_wait_lock); +} + +static void +vioif_ctrl_release(struct vioif_softc *sc) +{ + struct vioif_ctrlqueue *ctrlq = &sc->sc_ctrlq; + + KASSERT(ctrlq->ctrlq_inuse != FREE); + KASSERT(ctrlq->ctrlq_owner == curlwp); + + mutex_enter(&ctrlq->ctrlq_wait_lock); + ctrlq->ctrlq_inuse = FREE; + cv_signal(&ctrlq->ctrlq_wait); mutex_exit(&ctrlq->ctrlq_wait_lock); +} + +static int +vioif_ctrl_load_cmdspec(struct vioif_softc *sc, +struct vioif_ctrl_cmdspec *specs, int nspecs) +{ + struct virtio_softc *vsc = sc->sc_virtio; + int i, r, loaded; + + loaded = 0; + for (i = 0; i < nspecs; i++) { + r = bus_dmamap_load(virtio_dmat(vsc), + specs[i].dmamap, specs[i].buf, specs[i].bufsize, + NULL, BUS_DMA_WRITE|BUS_DMA_NOWAIT); + if (r) { + printf("%s: control command dmamap load failed, " + "error code %d\n", device_xname(sc->sc_dev), r); + goto err; + } + loaded++; + + } + + return r; + +err: + for (i = 0; i < loaded; i++) { + bus_dmamap_unload(virtio_dmat(vsc), specs[i].dmamap); + } + + return r; +} + +static void +vioif_ctrl_unload_cmdspec(struct vioif_softc *sc, +struct vioif_ctrl_cmdspec *specs, int nspecs) +{ + struct virtio_softc *vsc = sc->sc_virtio; + int i; + + for (i = 0; i < nspecs; i++) { + bus_dmamap_unload(virtio_dmat(vsc), specs[i].dmamap); + } +} + +static int +vioif_ctrl_send_command(struct vioif_softc *sc, uint8_t class, uint8_t cmd, +struct vioif_ctrl_cmdspec *specs, int nspecs) +{ + struct vioif_ctrlqueue *ctrlq = &sc->sc_ctrlq; + struct virtqueue *vq = ctrlq->ctrlq_vq; + struct virtio_softc *vsc = sc->sc_virtio; + int i, r, slot; - ctrlq->ctrlq_cmd->class = VIRTIO_NET_CTRL_RX; + ctrlq->ctrlq_cmd->class = class; ctrlq->ctrlq_cmd->command = cmd; - ctrlq->ctrlq_rx->onoff = onoff; bus_dmamap_sync(virtio_dmat(vsc), ctrlq->ctrlq_cmd_dmamap, 0, sizeof(struct virtio_net_ctrl_cmd), BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(virtio_dmat(vsc), ctrlq->ctrlq_rx_dmamap, - 0, sizeof(struct virtio_net_ctrl_rx), - BUS_DMASYNC_PREWRITE); + for (i = 0; i < nspecs; i++) { + bus_dmamap_sync(virtio_dmat(vsc), specs[i].dmamap, +0, specs[i].bufsize, +BUS_DMASYNC_PREWRITE); + } bus_dmamap_sync(virtio_dmat(vsc), ctrlq->ctrlq_status_dmamap, 0, sizeof(struct virtio_net_ctrl_status), BUS_DMASYNC_PREREAD); @@ -1313,11 +1382,13 @@ vioif_ctrl_rx(struct vioif_softc *sc, in r = virtio_enqueue_prep(vsc, vq, &slot); if (r != 0) panic("%s: control vq busy!?", device_xname(sc->sc_dev)); - r = virtio_enqueue_reserve(vsc, vq, slot, 3); + r = virtio_enqueue_reserve(vsc, vq, slot, nspecs + 2); if (r != 0) panic("%s: control vq busy!?", device_xname(sc->sc_dev)); virtio_enqueue(vsc, vq, slot, ctrlq->ctrlq_cmd_dmamap, true); - virtio_enqueue(vs
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 14:35:52 UTC 2019 Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Divide some elements of vioif_softc into txq, rxq, and ctrlq To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.42 src/sys/dev/pci/if_vioif.c:1.43 --- src/sys/dev/pci/if_vioif.c:1.42 Mon Jan 14 14:32:13 2019 +++ src/sys/dev/pci/if_vioif.c Mon Jan 14 14:35:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.42 2019/01/14 14:32:13 yamaguchi Exp $ */ +/* $NetBSD: if_vioif.c,v 1.43 2019/01/14 14:35:52 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.42 2019/01/14 14:32:13 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.43 2019/01/14 14:35:52 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -175,6 +175,67 @@ struct virtio_net_ctrl_vlan { /* * if_vioifvar.h: */ + +/* + * Locking notes: + * + a field in vioif_txqueue is protected by txq_lock (a spin mutex), and + * a filds in vioif_rxqueue is protected by rxq_lock (a spin mutex). + * - more than one lock cannot be held at onece + * + ctrlq_inuse is protected by ctrlq_wait_lock. + * - other fields in vioif_ctrlqueue are protected by ctrlq_inuse + * - txq_lock or rxq_lock cannot be held along with ctrlq_wait_lock + */ + +struct vioif_txqueue { + kmutex_t *txq_lock; /* lock for tx operations */ + + struct virtqueue *txq_vq; + bool txq_stopping; + bool txq_link_active; + + struct virtio_net_hdr *txq_hdrs; + bus_dmamap_t *txq_hdr_dmamaps; + + struct mbuf **txq_mbufs; + bus_dmamap_t *txq_dmamaps; +}; + +struct vioif_rxqueue { + kmutex_t *rxq_lock; /* lock for rx operations */ + + struct virtqueue *rxq_vq; + bool rxq_stopping; + + struct virtio_net_hdr *rxq_hdrs; + bus_dmamap_t *rxq_hdr_dmamaps; + + struct mbuf **rxq_mbufs; + bus_dmamap_t *rxq_dmamaps; + + void *rxq_softint; +}; + +struct vioif_ctrlqueue { + struct virtqueue *ctrlq_vq; + enum { + FREE, INUSE, DONE + }ctrlq_inuse; + kcondvar_t ctrlq_wait; + kmutex_t ctrlq_wait_lock; + + struct virtio_net_ctrl_cmd *ctrlq_cmd; + struct virtio_net_ctrl_status *ctrlq_status; + struct virtio_net_ctrl_rx *ctrlq_rx; + struct virtio_net_ctrl_mac_tbl *ctrlq_mac_tbl_uc; + struct virtio_net_ctrl_mac_tbl *ctrlq_mac_tbl_mc; + + bus_dmamap_t ctrlq_cmd_dmamap; + bus_dmamap_t ctrlq_status_dmamap; + bus_dmamap_t ctrlq_rx_dmamap; + bus_dmamap_t ctrlq_tbl_uc_dmamap; + bus_dmamap_t ctrlq_tbl_mc_dmamap; +}; + struct vioif_softc { device_t sc_dev; @@ -189,55 +250,28 @@ struct vioif_softc { short sc_deferred_init_done; bool sc_link_active; - /* bus_dmamem */ - bus_dma_segment_t sc_hdr_segs[1]; - struct virtio_net_hdr *sc_hdrs; -#define sc_rx_hdrs sc_hdrs - struct virtio_net_hdr *sc_tx_hdrs; - struct virtio_net_ctrl_cmd *sc_ctrl_cmd; - struct virtio_net_ctrl_status *sc_ctrl_status; - struct virtio_net_ctrl_rx *sc_ctrl_rx; - struct virtio_net_ctrl_mac_tbl *sc_ctrl_mac_tbl_uc; - struct virtio_net_ctrl_mac_tbl *sc_ctrl_mac_tbl_mc; - - /* kmem */ - bus_dmamap_t *sc_arrays; -#define sc_rxhdr_dmamaps sc_arrays - bus_dmamap_t *sc_txhdr_dmamaps; - bus_dmamap_t *sc_rx_dmamaps; - bus_dmamap_t *sc_tx_dmamaps; - struct mbuf **sc_rx_mbufs; - struct mbuf **sc_tx_mbufs; - - bus_dmamap_t sc_ctrl_cmd_dmamap; - bus_dmamap_t sc_ctrl_status_dmamap; - bus_dmamap_t sc_ctrl_rx_dmamap; - bus_dmamap_t sc_ctrl_tbl_uc_dmamap; - bus_dmamap_t sc_ctrl_tbl_mc_dmamap; + struct vioif_txqueue sc_txq; + struct vioif_rxqueue sc_rxq; - void *sc_rx_softint; - void *sc_ctl_softint; + bool sc_has_ctrl; + struct vioif_ctrlqueue sc_ctrlq; - enum { - FREE, INUSE, DONE - } sc_ctrl_inuse; - kcondvar_t sc_ctrl_wait; - kmutex_t sc_ctrl_wait_lock; - kmutex_t sc_tx_lock; - kmutex_t sc_rx_lock; - bool sc_stopping; + bus_dma_segment_t sc_hdr_segs[1]; + void *sc_dmamem; + void *sc_kmem; - bool sc_has_ctrl; + void *sc_ctl_softint; }; #define VIRTIO_NET_TX_MAXNSEGS (16) /* XXX */ #define VIRTIO_NET_CTRL_MAC_MAXENTRIES (64) /* XXX */ -#define VIOIF_TX_LOCK(_sc) mutex_enter(&(_sc)->sc_tx_lock) -#define VIOIF_TX_UNLOCK(_sc) mutex_exit(&(_sc)->sc_tx_lock) -#define VIOIF_TX_LOCKED(_sc) mutex_owned(&(_sc)->sc_tx_lock) -#define VIOIF_RX_LOCK(_sc) mutex_enter(&(_sc)->sc_rx_lock) -#define VIOIF_RX_UNLOCK(_sc) mutex_exit(&(_sc)->sc_rx_lock) -#define VIOIF_RX_LOCKED(_sc) mutex_owned(&(_sc)->sc_rx_lock) +#define VIOIF_TXQ_LOCK(_q) mutex_enter((_q)->txq_lock) +#define VIOIF_TXQ_UNLOCK(_q) mutex_exit((_q)->txq_lock) +#define VIOIF_TXQ_LOCKED(_q) mutex_owned((_q)->txq_lock) + +#define VIOIF_RXQ_LOCK(_q) mutex_enter((_q)->rxq_lock) +#define VIOIF_RXQ_UNLOCK(_q) mutex_exit(
CVS commit: src/sys/dev/pci
Module Name:src Committed By: yamaguchi Date: Mon Jan 14 14:32:13 UTC 2019 Modified Files: src/sys/dev/pci: if_vioif.c Log Message: Make macros not depend on vioif_softc To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/if_vioif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vioif.c diff -u src/sys/dev/pci/if_vioif.c:1.41 src/sys/dev/pci/if_vioif.c:1.42 --- src/sys/dev/pci/if_vioif.c:1.41 Tue Jun 26 06:48:01 2018 +++ src/sys/dev/pci/if_vioif.c Mon Jan 14 14:32:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.41 2018/06/26 06:48:01 msaitoh Exp $ */ +/* $NetBSD: if_vioif.c,v 1.42 2019/01/14 14:32:13 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.41 2018/06/26 06:48:01 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.42 2019/01/14 14:32:13 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -357,65 +357,56 @@ vioif_alloc_mems(struct vioif_softc *sc) "error code %d\n", r); goto err_dmamem_alloc; } - sc->sc_hdrs = vaddr; + +#define P(p, p0, p0size) do { p0 = (void *) p; \ + p += p0size; } while (0) memset(vaddr, 0, allocsize); p = (intptr_t) vaddr; - p += sizeof(struct virtio_net_hdr) * rxqsize; -#define P(name,size) do { sc->sc_ ##name = (void*) p; \ - p += size; } while (0) - P(tx_hdrs, sizeof(struct virtio_net_hdr) * txqsize); + + P(p, sc->sc_rx_hdrs, sizeof(sc->sc_rx_hdrs[0]) * rxqsize); + P(p, sc->sc_tx_hdrs, sizeof(sc->sc_tx_hdrs[0]) * txqsize); if (sc->sc_has_ctrl) { - P(ctrl_cmd, sizeof(struct virtio_net_ctrl_cmd)); - P(ctrl_status, sizeof(struct virtio_net_ctrl_status)); - P(ctrl_rx, sizeof(struct virtio_net_ctrl_rx)); - P(ctrl_mac_tbl_uc, sizeof(struct virtio_net_ctrl_mac_tbl)); - P(ctrl_mac_tbl_mc, - (sizeof(struct virtio_net_ctrl_mac_tbl) - + ETHER_ADDR_LEN * VIRTIO_NET_CTRL_MAC_MAXENTRIES)); + P(p, sc->sc_ctrl_cmd, sizeof(*sc->sc_ctrl_cmd)); + P(p, sc->sc_ctrl_status, sizeof(*sc->sc_ctrl_status)); + P(p, sc->sc_ctrl_rx, sizeof(*sc->sc_ctrl_rx)); + P(p, sc->sc_ctrl_mac_tbl_uc, sizeof(*sc->sc_ctrl_mac_tbl_uc) + 0); + P(p, sc->sc_ctrl_mac_tbl_mc, + (sizeof(*sc->sc_ctrl_mac_tbl_mc) + + ETHER_ADDR_LEN * VIRTIO_NET_CTRL_MAC_MAXENTRIES)); } -#undef P allocsize2 = sizeof(bus_dmamap_t) * (rxqsize + txqsize); allocsize2 += sizeof(bus_dmamap_t) * (rxqsize + txqsize); allocsize2 += sizeof(struct mbuf*) * (rxqsize + txqsize); - sc->sc_arrays = kmem_zalloc(allocsize2, KM_SLEEP); - sc->sc_txhdr_dmamaps = sc->sc_arrays + rxqsize; - sc->sc_rx_dmamaps = sc->sc_txhdr_dmamaps + txqsize; - sc->sc_tx_dmamaps = sc->sc_rx_dmamaps + rxqsize; - sc->sc_rx_mbufs = (void*) (sc->sc_tx_dmamaps + txqsize); - sc->sc_tx_mbufs = sc->sc_rx_mbufs + rxqsize; + vaddr = kmem_zalloc(allocsize2, KM_SLEEP); + p = (intptr_t) vaddr; -#define C(map, buf, size, nsegs, rw, usage)\ - do {\ - r = bus_dmamap_create(virtio_dmat(vsc), size, nsegs, size, 0, \ - BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, \ - &sc->sc_ ##map); \ - if (r != 0) { \ - aprint_error_dev(sc->sc_dev, \ - usage " dmamap creation failed, " \ - "error code %d\n", r); \ - goto err_reqs; \ - } \ - } while (0) -#define C_L1(map, buf, size, nsegs, rw, usage)\ - C(map, buf, size, nsegs, rw, usage);\ - do {\ - r = bus_dmamap_load(virtio_dmat(vsc), sc->sc_ ##map, \ -&sc->sc_ ##buf, size, NULL, \ -BUS_DMA_ ##rw | BUS_DMA_NOWAIT); \ - if (r != 0) { \ - aprint_error_dev(sc->sc_dev, \ - usage " dmamap load failed, " \ - "error code %d\n", r); \ - goto err_reqs; \ - } \ + P(p, sc->sc_rxhdr_dmamaps, sizeof(sc->sc_rxhdr_dmamaps[0]) * rxqsize); + P(p, sc->sc_txhdr_dmamaps, sizeof(sc->sc_txhdr_dmamaps[0]) * txqsize); + P(p, sc->sc_rx_dmamaps, sizeof(sc->sc_rx_dmamaps[0]) * rxqsize); + P(p, sc->sc_tx_dmamaps, sizeof(sc->sc_tx_dmamaps[0]) * txqsize); + P(p, sc->sc_rx_mbufs, sizeof(sc->sc_rx_mbufs[0]) * rxqsize); + P(p, sc->sc_tx_mbufs, sizeof(sc->sc_tx_mbufs[0]) * txqsize); +#undef P + +#define C(map, size, nsegs, usage) \ + do { \ + r = bus_dmamap_create(virtio_dmat(vsc), size, nsegs, size, 0, \ + BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, \ + &map); \ + if (r != 0) { \ + aprint_error_dev(sc->sc_dev,\ + "%s dmamap creation failed, " \ + "error code %d\n", usage, r); \ + goto err_reqs; \ + }\ } while (0) -#define C_L2(map, buf, size, nsegs, rw, usage)\ - C(map, buf, size, nsegs, rw, usage);\ +#define C_L(map, buf, size, nsegs, rw, usage)\ + C(map, size, nsegs, usage); \ do {\ - r = bus_dmamap_load(virtio_dmat(vsc), sc->sc_ ##map, \ -sc->sc_ ##buf, size, NULL, \ -BUS_DMA_ ##rw | BUS_DMA_NOWAIT);
CVS commit: [pgoyette-compat] src/doc
Module Name:src Committed By: pgoyette Date: Mon Jan 14 13:35:53 UTC 2019 Modified Files: src/doc [pgoyette-compat]: TODO.compat-module Log Message: Remove recently-added entry concerning routines whose return type had been changed from void to int. This is now handled by the new void-typed hooks. To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/TODO.compat-module Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/TODO.compat-module diff -u src/doc/TODO.compat-module:1.1.2.20 src/doc/TODO.compat-module:1.1.2.21 --- src/doc/TODO.compat-module:1.1.2.20 Mon Jan 14 00:16:32 2019 +++ src/doc/TODO.compat-module Mon Jan 14 13:35:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: TODO.compat-module,v 1.1.2.20 2019/01/14 00:16:32 pgoyette Exp $ */ +/* $NetBSD: TODO.compat-module,v 1.1.2.21 2019/01/14 13:35:53 pgoyette Exp $ */ DONE @@ -104,6 +104,3 @@ TODO - Not required for branch merge are included in every kernel via 'options COMPAT_UTILS' in file sys/conf/std -22. Several hook callback routines have had their return type changed -from "void" to "int" in order to provide a common type in the -hook structure. Ideally, I'd like to revert these back to "void".
CVS commit: [pgoyette-compat] src/sys
Module Name:src Committed By: pgoyette Date: Mon Jan 14 13:34:28 UTC 2019 Modified Files: src/sys/arch/amd64/amd64 [pgoyette-compat]: netbsd32_machdep.c netbsd32_machdep_16.c src/sys/arch/mips/mips [pgoyette-compat]: netbsd32_machdep.c netbsd32_machdep_16.c src/sys/arch/sparc/fpu [pgoyette-compat]: fpu.c src/sys/arch/sparc64/sparc64 [pgoyette-compat]: netbsd32_machdep.c netbsd32_machdep_16.c src/sys/compat/common [pgoyette-compat]: if_43.c rtsock_14.c rtsock_50.c rtsock_70.c sysmon_power_40.c uipc_usrreq_70.c src/sys/compat/net [pgoyette-compat]: if.h route.h src/sys/compat/netbsd32 [pgoyette-compat]: netbsd32.h netbsd32_kern_proc.c netbsd32_module.c src/sys/compat/sys [pgoyette-compat]: socket.h src/sys/dev [pgoyette-compat]: bio.c ccd.c clockctl.c vnd.c src/sys/dev/raidframe [pgoyette-compat]: rf_netbsdkintf.c src/sys/dev/sysmon [pgoyette-compat]: sysmon_power.c src/sys/dev/usb [pgoyette-compat]: ugen.c uhid.c usb.c src/sys/dev/wscons [pgoyette-compat]: wsevent.c src/sys/fs/puffs [pgoyette-compat]: puffs_compat.c puffs_msgif.c puffs_sys.h src/sys/kern [pgoyette-compat]: kern_proc.c kern_rndq.c sys_module.c sysv_ipc.c tty.c tty_ptm.c uipc_usrreq.c vfs_syscalls.c src/sys/net [pgoyette-compat]: if.c if_spppsubr.c route.h rtsock.c src/sys/net80211 [pgoyette-compat]: ieee80211_ioctl.c src/sys/opencrypto [pgoyette-compat]: cryptodev.c src/sys/sys [pgoyette-compat]: compat_stub.h module_hook.h Log Message: Create a variant of the HOOK macros that handles hook routines of type void, and use them where appropriate. To generate a diff of this commit: cvs rdiff -u -r1.115.2.13 -r1.115.2.14 \ src/sys/arch/amd64/amd64/netbsd32_machdep.c cvs rdiff -u -r1.1.2.10 -r1.1.2.11 \ src/sys/arch/amd64/amd64/netbsd32_machdep_16.c cvs rdiff -u -r1.15.2.9 -r1.15.2.10 src/sys/arch/mips/mips/netbsd32_machdep.c cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/mips/netbsd32_machdep_16.c cvs rdiff -u -r1.27.46.2 -r1.27.46.3 src/sys/arch/sparc/fpu/fpu.c cvs rdiff -u -r1.110.14.2 -r1.110.14.3 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep.c cvs rdiff -u -r1.1.2.4 -r1.1.2.5 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep_16.c cvs rdiff -u -r1.14.2.11 -r1.14.2.12 src/sys/compat/common/if_43.c cvs rdiff -u -r1.5.14.5 -r1.5.14.6 src/sys/compat/common/rtsock_14.c cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/compat/common/rtsock_50.c cvs rdiff -u -r1.2.2.3 -r1.2.2.4 src/sys/compat/common/rtsock_70.c cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/compat/common/sysmon_power_40.c cvs rdiff -u -r1.1.20.3 -r1.1.20.4 src/sys/compat/common/uipc_usrreq_70.c cvs rdiff -u -r1.4.14.2 -r1.4.14.3 src/sys/compat/net/if.h cvs rdiff -u -r1.2.14.2 -r1.2.14.3 src/sys/compat/net/route.h cvs rdiff -u -r1.116.2.16 -r1.116.2.17 src/sys/compat/netbsd32/netbsd32.h cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/compat/netbsd32/netbsd32_kern_proc.c cvs rdiff -u -r1.6.2.10 -r1.6.2.11 src/sys/compat/netbsd32/netbsd32_module.c cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/compat/sys/socket.h cvs rdiff -u -r1.13.16.6 -r1.13.16.7 src/sys/dev/bio.c cvs rdiff -u -r1.175.2.9 -r1.175.2.10 src/sys/dev/ccd.c cvs rdiff -u -r1.35.14.9 -r1.35.14.10 src/sys/dev/clockctl.c cvs rdiff -u -r1.263.2.11 -r1.263.2.12 src/sys/dev/vnd.c cvs rdiff -u -r1.356.2.7 -r1.356.2.8 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.58.2.6 -r1.58.2.7 src/sys/dev/sysmon/sysmon_power.c cvs rdiff -u -r1.139.2.7 -r1.139.2.8 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.101.2.6 -r1.101.2.7 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.168.2.8 -r1.168.2.9 src/sys/dev/usb/usb.c cvs rdiff -u -r1.37.2.7 -r1.37.2.8 src/sys/dev/wscons/wsevent.c cvs rdiff -u -r1.4.16.4 -r1.4.16.5 src/sys/fs/puffs/puffs_compat.c cvs rdiff -u -r1.101.10.7 -r1.101.10.8 src/sys/fs/puffs/puffs_msgif.c cvs rdiff -u -r1.90.16.2 -r1.90.16.3 src/sys/fs/puffs/puffs_sys.h cvs rdiff -u -r1.209.2.11 -r1.209.2.12 src/sys/kern/kern_proc.c cvs rdiff -u -r1.89.16.5 -r1.89.16.6 src/sys/kern/kern_rndq.c cvs rdiff -u -r1.23.2.14 -r1.23.2.15 src/sys/kern/sys_module.c cvs rdiff -u -r1.32.16.7 -r1.32.16.8 src/sys/kern/sysv_ipc.c cvs rdiff -u -r1.275.2.6 -r1.275.2.7 src/sys/kern/tty.c cvs rdiff -u -r1.37.16.3 -r1.37.16.4 src/sys/kern/tty_ptm.c cvs rdiff -u -r1.183.2.7 -r1.183.2.8 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.518.2.3 -r1.518.2.4 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.419.2.19 -r1.419.2.20 src/sys/net/if.c cvs rdiff -u -r1.179.2.8 -r1.179.2.9 src/sys/net/if_spppsubr.c cvs rdiff -u -r1.117.2.4 -r1.117.2.5 src/sys/net/route.h cvs rdiff -u -r1.238.2.18 -r1.238.2.19 src/sys/net/rtsock.c cvs rdiff -u -r1.60.16.5 -r1.60.16.6 src/sys/net80211/ieee80211_ioctl.c cvs rdiff -u -r1.98.2.8 -r1.98.2.9 src/sys/opencrypto/cryptodev.c cvs rdiff -u -r1.1.2.47 -r1.1.2.48 src/sys/sys/compat_stub.h cvs rdiff -u
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Mon Jan 14 12:23:53 UTC 2019 Modified Files: src/sys/dev/fdt: fdt_pinctrl.c Log Message: Fix infinite loop like in fdtbus_get_string_index. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_pinctrl.c diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.5 src/sys/dev/fdt/fdt_pinctrl.c:1.6 --- src/sys/dev/fdt/fdt_pinctrl.c:1.5 Sat Jun 30 20:34:43 2018 +++ src/sys/dev/fdt/fdt_pinctrl.c Mon Jan 14 12:23:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $ */ +/* $NetBSD: fdt_pinctrl.c,v 1.6 2019/01/14 12:23:53 mlelstv Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.6 2019/01/14 12:23:53 mlelstv Exp $"); #include #include @@ -125,7 +125,7 @@ fdtbus_pinctrl_set_config(int phandle, c pinctrl_names = fdtbus_get_string(phandle, "pinctrl-names"); for (name = pinctrl_names, index = 0; len > 0; - name += strlen(name) + 1, index++) { + len -= strlen(name) + 1, name += strlen(name) + 1, index++) { if (strcmp(name, cfgname) == 0) return fdtbus_pinctrl_set_config_index(phandle, index); }