CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 04:52:53 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
G.C. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.101 src/usr.bin/netstat/if.c:1.102
--- src/usr.bin/netstat/if.c:1.101	Mon Sep  5 02:26:22 2022
+++ src/usr.bin/netstat/if.c	Mon Sep  5 04:52:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.101 2022/09/05 02:26:22 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.102 2022/09/05 04:52:53 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.101 2022/09/05 02:26:22 msaitoh Exp $");
+__RCSID("$NetBSD: if.c,v 1.102 2022/09/05 04:52:53 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -309,25 +309,8 @@ intpr_sysctl(void)
 			n = 5;
 
 		printf("%-*.*s %-5" PRIu64 " ", n, n, name, ifd->ifi_mtu);
-		if (dflag) {
-#if 0
-			char namebuf[1024];
-			int drops;
-
-			/* For sysctl */
-			snprintf(namebuf, sizeof(namebuf),
-			"net.interfaces.%s.sndq.drops", origname);
-			len = sizeof(drops);
-			if (sysctlbyname(namebuf, , , NULL, 0)
-			== -1) {
-warnx("'%s' not found", namebuf);
-dext.ifi_oqdrops = 0;
-			} else
-dext.ifi_oqdrops = drops;
-#else
+		if (dflag)
 			if_data_ext_get(origname, );
-#endif
-		}
 
 		print_addr(ifindex, rti_info[rtax], rti_info, ifd,
 		NULL, dflag ?  : NULL);



CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 04:52:53 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
G.C. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 02:26:22 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
Print oqdrops correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.100 src/usr.bin/netstat/if.c:1.101
--- src/usr.bin/netstat/if.c:1.100	Mon Sep  5 00:18:25 2022
+++ src/usr.bin/netstat/if.c	Mon Sep  5 02:26:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.100 2022/09/05 00:18:25 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.101 2022/09/05 02:26:22 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.100 2022/09/05 00:18:25 msaitoh Exp $");
+__RCSID("$NetBSD: if.c,v 1.101 2022/09/05 02:26:22 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -76,16 +76,21 @@ struct	iftot {
 	u_quad_t ift_ip;		/* input packets */
 	u_quad_t ift_ib;		/* input bytes */
 	u_quad_t ift_ie;		/* input errors */
+	u_quad_t ift_iq;		/* input drops */
 	u_quad_t ift_op;		/* output packets */
 	u_quad_t ift_ob;		/* output bytes */
 	u_quad_t ift_oe;		/* output errors */
+	u_quad_t ift_oq;		/* output drops */
 	u_quad_t ift_co;		/* collisions */
-	u_quad_t ift_dr;		/* drops */
+};
+
+struct if_data_ext {
+	uint64_t ifi_oqdrops;
 };
 
 static void set_lines(void);
 static void print_addr(const int, struct sockaddr *, struct sockaddr **,
-struct if_data *, struct ifnet *);
+struct if_data *, struct ifnet *, struct if_data_ext *);
 static void sidewaysintpr(u_int, u_long);
 
 static void iftot_banner(struct iftot *);
@@ -96,6 +101,7 @@ static void catchalarm(int);
 static void get_rtaddrs(int, struct sockaddr *, struct sockaddr **);
 static void fetchifs(void);
 
+static int if_data_ext_get(const char *, struct if_data_ext *);
 static void intpr_sysctl(void);
 static void intpr_kvm(u_long, void (*)(const char *));
 
@@ -165,6 +171,28 @@ intpr_header(void)
 	}
 }
 
+int
+if_data_ext_get(const char *ifname, struct if_data_ext *dext)
+{
+	char namebuf[1024];
+	size_t len;
+	int drops;
+
+	/* For sysctl */
+	snprintf(namebuf, sizeof(namebuf),
+	"net.interfaces.%s.sndq.drops", ifname);
+	len = sizeof(drops);
+	if (sysctlbyname(namebuf, , , NULL, 0)
+	== -1) {
+		warnx("'%s' not found", namebuf);
+		dext->ifi_oqdrops = 0;
+		return -1;
+	} else
+		dext->ifi_oqdrops = drops;
+
+	return 0;
+}
+
 static void
 intpr_sysctl(void)
 {
@@ -182,6 +210,7 @@ intpr_sysctl(void)
 	size_t len;
 	int did = 1, rtax = 0, n;
 	char name[IFNAMSIZ + 1];	/* + 1 for `*' */
+	char origname[IFNAMSIZ];	/* without `*' */
 	int ifindex = 0;
 
 	if (prog_sysctl(mib, 6, NULL, , NULL, 0) == -1)
@@ -199,6 +228,8 @@ intpr_sysctl(void)
 
 	lim = buf + len;
 	for (next = buf; next < lim; next += rtm->rtm_msglen) {
+		struct if_data_ext dext;
+
 		rtm = (struct rt_msghdr *)next;
 		if (rtm->rtm_version != RTM_VERSION)
 			continue;
@@ -226,11 +257,15 @@ intpr_sysctl(void)
 
 			ifindex = sdl->sdl_index;
 
-			/* mark inactive interfaces with a '*' */
+			/* Keep the original name */
+			strcpy(origname, name);
+
+			/* Mark inactive interfaces with a '*' */
 			cp = strchr(name, '\0');
-			if ((ifm->ifm_flags & IFF_UP) == 0)
+			if ((ifm->ifm_flags & IFF_UP) == 0) {
 *cp++ = '*';
-			*cp = '\0';
+*cp = '\0';
+			}
 
 			if (qflag) {
 total = ifd->ifi_ibytes + ifd->ifi_obytes +
@@ -274,7 +309,28 @@ intpr_sysctl(void)
 			n = 5;
 
 		printf("%-*.*s %-5" PRIu64 " ", n, n, name, ifd->ifi_mtu);
-		print_addr(ifindex, rti_info[rtax], rti_info, ifd, NULL);
+		if (dflag) {
+#if 0
+			char namebuf[1024];
+			int drops;
+
+			/* For sysctl */
+			snprintf(namebuf, sizeof(namebuf),
+			"net.interfaces.%s.sndq.drops", origname);
+			len = sizeof(drops);
+			if (sysctlbyname(namebuf, , , NULL, 0)
+			== -1) {
+warnx("'%s' not found", namebuf);
+dext.ifi_oqdrops = 0;
+			} else
+dext.ifi_oqdrops = drops;
+#else
+			if_data_ext_get(origname, );
+#endif
+		}
+
+		print_addr(ifindex, rti_info[rtax], rti_info, ifd,
+		NULL, dflag ?  : NULL);
 	}
 }
 
@@ -376,7 +432,7 @@ intpr_kvm(u_long ifnetaddr, void (*pfunc
 			sa = (struct sockaddr *)cp;
 			ifname_to_ifdata(s, name, );
 			print_addr(ifnet.if_index, sa, (void *),
-			, );
+			, , NULL);
 		}
 		ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
 	}
@@ -473,8 +529,8 @@ mc4_print(const int ifindex)
 }
 
 static void
-print_addr(const int ifindex, struct sockaddr *sa,
-struct sockaddr **rtinfo, struct if_data *ifd, struct ifnet *ifnet)
+print_addr(const int ifindex, struct sockaddr *sa, struct sockaddr **rtinfo,
+struct if_data *ifd, struct ifnet *ifnet, struct if_data_ext *dext)
 {
 	char hexsep = '.';		/* for hexprint */
 	static const char hexfmt[] = "%02x%c";	

CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 02:26:22 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
Print oqdrops correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:27:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h fpu_extern.h

Log Message:
Clean up fpu_extern.h; only a function public to external is fpu_emulate().

Other functions are private to fpu_*.c and therefore live in fpu_emu.h.

Also, drop needless forward struct declarations.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/fpu/fpu_emu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_extern.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/arch/powerpc/fpu/fpu_emu.h
diff -u src/sys/arch/powerpc/fpu/fpu_emu.h:1.9 src/sys/arch/powerpc/fpu/fpu_emu.h:1.10
--- src/sys/arch/powerpc/fpu/fpu_emu.h:1.9	Sun Sep  4 13:14:57 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.h	Mon Sep  5 00:27:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.h,v 1.9 2022/09/04 13:14:57 rin Exp $ */
+/*	$NetBSD: fpu_emu.h,v 1.10 2022/09/05 00:27:16 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -185,6 +185,8 @@ struct	fpn *fpu_newnan(struct fpemu *);
  */
 int	fpu_shr(struct fpn *, int);
 
+void	fpu_norm(struct fpn *);
+
 void	fpu_explode(struct fpemu *, struct fpn *, int, uint64_t);
 void	fpu_implode(struct fpemu *, struct fpn *, int, uint64_t *);
 

Index: src/sys/arch/powerpc/fpu/fpu_extern.h
diff -u src/sys/arch/powerpc/fpu/fpu_extern.h:1.11 src/sys/arch/powerpc/fpu/fpu_extern.h:1.12
--- src/sys/arch/powerpc/fpu/fpu_extern.h:1.11	Mon Sep  5 00:25:18 2022
+++ src/sys/arch/powerpc/fpu/fpu_extern.h	Mon Sep  5 00:27:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_extern.h,v 1.11 2022/09/05 00:25:18 rin Exp $	*/
+/*	$NetBSD: fpu_extern.h,v 1.12 2022/09/05 00:27:16 rin Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -35,40 +35,10 @@
 #include 
 #include 
 
-struct proc;
-struct fpreg;
 struct trapframe;
-union instr;
-struct fpemu;
-struct fpn;
+struct fpreg;
 
 /* fpu.c */
 bool fpu_emulate(struct trapframe *, struct fpreg *, ksiginfo_t *);
 
-/* fpu_add.c */
-struct fpn *fpu_add(struct fpemu *);
-
-/* fpu_compare.c */
-void fpu_compare(struct fpemu *, int);
-
-/* fpu_div.c */
-struct fpn *fpu_div(struct fpemu *);
-
-/* fpu_explode.c */
-void fpu_explode(struct fpemu *, struct fpn *, int, uint64_t);
-
-/* fpu_implode.c */
-void fpu_implode(struct fpemu *, struct fpn *, int, uint64_t *);
-
-/* fpu_mul.c */
-struct fpn *fpu_mul(struct fpemu *);
-
-/* fpu_sqrt.c */
-struct fpn *fpu_sqrt(struct fpemu *);
-
-/* fpu_subr.c */
-int fpu_shr(struct fpn *, int);
-void fpu_norm(struct fpn *);
-struct fpn *fpu_newnan(struct fpemu *);
-
 #endif /* _POWERPC_FPU_FPU_EXTERN_H_ */



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:27:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h fpu_extern.h

Log Message:
Clean up fpu_extern.h; only a function public to external is fpu_emulate().

Other functions are private to fpu_*.c and therefore live in fpu_emu.h.

Also, drop needless forward struct declarations.

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/fpu/fpu_emu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:25:18 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c fpu_extern.h

Log Message:
static-fy fpu_execute().


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/fpu/fpu_emu.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/fpu/fpu_extern.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/arch/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.53 src/sys/arch/powerpc/fpu/fpu_emu.c:1.54
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.53	Sun Sep  4 13:32:14 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Mon Sep  5 00:25:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.53 2022/09/04 13:32:14 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.54 2022/09/05 00:25:18 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.53 2022/09/04 13:32:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.54 2022/09/05 00:25:18 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -167,6 +167,8 @@ int fpe_debug = 0;
 extern vaddr_t opc_disasm(vaddr_t loc, int opcode);
 #endif
 
+static int fpu_execute(struct trapframe *, struct fpemu *, union instr *);
+
 #ifdef DEBUG
 /*
  * Dump a `fpn' structure.
@@ -288,7 +290,7 @@ success:
  * Note that we do not catch all illegal opcodes, so you can, for instance,
  * multiply two integers this way.
  */
-int
+static int
 fpu_execute(struct trapframe *tf, struct fpemu *fe, union instr *insn)
 {
 	struct fpn *fp;

Index: src/sys/arch/powerpc/fpu/fpu_extern.h
diff -u src/sys/arch/powerpc/fpu/fpu_extern.h:1.10 src/sys/arch/powerpc/fpu/fpu_extern.h:1.11
--- src/sys/arch/powerpc/fpu/fpu_extern.h:1.10	Mon Sep  5 00:24:24 2022
+++ src/sys/arch/powerpc/fpu/fpu_extern.h	Mon Sep  5 00:25:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_extern.h,v 1.10 2022/09/05 00:24:24 rin Exp $	*/
+/*	$NetBSD: fpu_extern.h,v 1.11 2022/09/05 00:25:18 rin Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -44,7 +44,6 @@ struct fpn;
 
 /* fpu.c */
 bool fpu_emulate(struct trapframe *, struct fpreg *, ksiginfo_t *);
-int fpu_execute(struct trapframe *, struct fpemu *, union instr *);
 
 /* fpu_add.c */
 struct fpn *fpu_add(struct fpemu *);



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:25:18 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c fpu_extern.h

Log Message:
static-fy fpu_execute().


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/fpu/fpu_emu.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/fpu/fpu_extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:24:24 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_explode.c fpu_extern.h

Log Message:
static-fy fpu_[ixsd]tof(). NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/fpu/fpu_explode.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/fpu/fpu_extern.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/arch/powerpc/fpu/fpu_explode.c
diff -u src/sys/arch/powerpc/fpu/fpu_explode.c:1.12 src/sys/arch/powerpc/fpu/fpu_explode.c:1.13
--- src/sys/arch/powerpc/fpu/fpu_explode.c:1.12	Fri Sep  2 12:40:49 2022
+++ src/sys/arch/powerpc/fpu/fpu_explode.c	Mon Sep  5 00:24:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_explode.c,v 1.12 2022/09/02 12:40:49 rin Exp $ */
+/*	$NetBSD: fpu_explode.c,v 1.13 2022/09/05 00:24:24 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.12 2022/09/02 12:40:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.13 2022/09/05 00:24:24 rin Exp $");
 
 #include 
 #include 
@@ -60,6 +60,11 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_explode.
 #include 
 #include 
 
+static int fpu_itof(struct fpn *, u_int);
+static int fpu_xtof(struct fpn *, uint64_t);
+static int fpu_stof(struct fpn *, u_int);
+static int fpu_dtof(struct fpn *, u_int, u_int);
+
 /*
  * N.B.: in all of the following, we assume the FP format is
  *
@@ -82,7 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_explode.
 /*
  * int -> fpn.
  */
-int
+static int
 fpu_itof(struct fpn *fp, u_int lo)
 {
 
@@ -106,7 +111,7 @@ fpu_itof(struct fpn *fp, u_int lo)
 /*
  * 64-bit int -> fpn.
  */
-int
+static int
 fpu_xtof(struct fpn *fp, uint64_t i)
 {
 
@@ -165,7 +170,7 @@ fpu_xtof(struct fpn *fp, uint64_t i)
  * We assume a single occupies at most (64-FP_LG) bits in the internal
  * format: i.e., needs at most fp_mant[0] and fp_mant[1].
  */
-int
+static int
 fpu_stof(struct fpn *fp, u_int hi)
 {
 	int exp;
@@ -183,7 +188,7 @@ fpu_stof(struct fpn *fp, u_int hi)
  * 64-bit double -> fpn.
  * We assume this uses at most (96-FP_LG) bits.
  */
-int
+static int
 fpu_dtof(struct fpn *fp, u_int hi, u_int lo)
 {
 	int exp;

Index: src/sys/arch/powerpc/fpu/fpu_extern.h
diff -u src/sys/arch/powerpc/fpu/fpu_extern.h:1.9 src/sys/arch/powerpc/fpu/fpu_extern.h:1.10
--- src/sys/arch/powerpc/fpu/fpu_extern.h:1.9	Fri Sep  2 12:40:49 2022
+++ src/sys/arch/powerpc/fpu/fpu_extern.h	Mon Sep  5 00:24:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_extern.h,v 1.9 2022/09/02 12:40:49 rin Exp $	*/
+/*	$NetBSD: fpu_extern.h,v 1.10 2022/09/05 00:24:24 rin Exp $	*/
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -56,10 +56,6 @@ void fpu_compare(struct fpemu *, int);
 struct fpn *fpu_div(struct fpemu *);
 
 /* fpu_explode.c */
-int fpu_itof(struct fpn *, u_int);
-int fpu_xtof(struct fpn *, uint64_t);
-int fpu_stof(struct fpn *, u_int);
-int fpu_dtof(struct fpn *, u_int, u_int);
 void fpu_explode(struct fpemu *, struct fpn *, int, uint64_t);
 
 /* fpu_implode.c */



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Sep  5 00:24:24 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_explode.c fpu_extern.h

Log Message:
static-fy fpu_[ixsd]tof(). NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/fpu/fpu_explode.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/fpu/fpu_extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 00:18:25 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
Get if_data correctly when kvm is used.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.99 src/usr.bin/netstat/if.c:1.100
--- src/usr.bin/netstat/if.c:1.99	Fri Sep  2 06:25:43 2022
+++ src/usr.bin/netstat/if.c	Mon Sep  5 00:18:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.99 2022/09/02 06:25:43 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.100 2022/09/05 00:18:25 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.99 2022/09/02 06:25:43 msaitoh Exp $");
+__RCSID("$NetBSD: if.c,v 1.100 2022/09/05 00:18:25 msaitoh Exp $");
 #endif
 #endif /* not lint */
 
@@ -287,27 +287,15 @@ union ifaddr_u {
 };
 
 static void
-ifnet_to_ifdata_kvm(const struct ifnet * const ifp, struct if_data * const ifd)
+ifname_to_ifdata(int s, const char *ifname, struct if_data * const ifd)
 {
+	struct ifdatareq ifdr;
 
-	/*
-	 * Interface statistics are no longer kept in struct ifnet,
-	 * and thus an if_data is no longer embedded in struct ifnet.
-	 * We cannot read stats via kvm without chasing per-cpu data,
-	 * and maybe someday we could do that.  But for now, this is
-	 * what we have.
-	 *
-	 * Just copy the fields that do exist.
-	 */
 	memset(ifd, 0, sizeof(*ifd));
-	ifd->ifi_type = ifp->if_type;
-	ifd->ifi_addrlen = ifp->if_addrlen;
-	ifd->ifi_hdrlen = ifp->if_hdrlen;
-	ifd->ifi_link_state = ifp->if_link_state;
-	ifd->ifi_mtu = ifp->if_mtu;
-	ifd->ifi_metric = ifp->if_metric;
-	ifd->ifi_baudrate = ifp->if_baudrate;
-	ifd->ifi_lastchange = ifp->if_lastchange;
+	strlcpy(ifdr.ifdr_name, ifname, sizeof(ifdr.ifdr_name));
+	if (ioctl(s, SIOCGIFDATA, ) != 0)
+		return;
+	memcpy(ifd, _data, sizeof(ifdr.ifdr_data));
 }
 
 static void
@@ -319,6 +307,7 @@ intpr_kvm(u_long ifnetaddr, void (*pfunc
 	u_long ifaddraddr;
 	struct ifnet_head ifhead;	/* TAILQ_HEAD */
 	char name[IFNAMSIZ + 1];	/* + 1 for `*' */
+	int s;
 
 	if (ifnetaddr == 0) {
 		printf("ifnet: symbol not defined\n");
@@ -334,6 +323,9 @@ intpr_kvm(u_long ifnetaddr, void (*pfunc
 		return;
 	ifnetaddr = (u_long)ifhead.tqh_first;
 
+	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+		return;
+
 	intpr_header();
 
 	ifaddraddr = 0;
@@ -382,13 +374,13 @@ intpr_kvm(u_long ifnetaddr, void (*pfunc
 			cp = (CP(ifaddr.ifa.ifa_addr) - CP(ifaddraddr)) +
 			CP();
 			sa = (struct sockaddr *)cp;
-			ifnet_to_ifdata_kvm(, );
+			ifname_to_ifdata(s, name, );
 			print_addr(ifnet.if_index, sa, (void *),
 			, );
 		}
 		ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
 	}
-
+	close(s);
 }
 
 static void
@@ -816,6 +808,7 @@ sidewaysintpr_kvm(unsigned interval, u_l
 	unsigned line;
 	struct iftot *lastif, *sum, *interesting;
 	struct ifnet_head ifhead;	/* TAILQ_HEAD */
+	int s;
 
 	set_lines();
 
@@ -828,6 +821,9 @@ sidewaysintpr_kvm(unsigned interval, u_l
 		return;
 	firstifnet = (u_long)ifhead.tqh_first;
 
+	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+		return;
+
 	lastif = iftot;
 	sum = iftot + MAXIF - 1;
 	total = sum - 1;
@@ -930,7 +926,7 @@ loop:
 			off = 0;
 			continue;
 		}
-		ifnet_to_ifdata_kvm(, );
+		ifname_to_ifdata(s, ip->ift_name, );
 		if (ip == interesting) {
 			if (bflag) {
 char humbuf[HUMBUF_SIZE];



CVS commit: src/usr.bin/netstat

2022-09-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep  5 00:18:25 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
Get if_data correctly when kvm is used.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/usr.bin/netstat/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/net

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 23:34:51 UTC 2022

Modified Files:
src/sys/net: if_loop.c

Log Message:
Fix "MPLS handled this" detection logic in the rump environment.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/net/if_loop.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/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.117 src/sys/net/if_loop.c:1.118
--- src/sys/net/if_loop.c:1.117	Sat Sep  3 02:47:59 2022
+++ src/sys/net/if_loop.c	Sun Sep  4 23:34:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.117 2022/09/03 02:47:59 thorpej Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.118 2022/09/04 23:34:51 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.117 2022/09/03 02:47:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.118 2022/09/04 23:34:51 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -297,16 +297,18 @@ looutput(struct ifnet *ifp, struct mbuf 
 	m_tag_delete_chain(m);
 
 #ifdef MPLS
+	bool is_mpls = false;
 	if (rt != NULL && rt_gettag(rt) != NULL &&
 	rt_gettag(rt)->sa_family == AF_MPLS &&
 	(m->m_flags & (M_MCAST | M_BCAST)) == 0) {
 		union mpls_shim msh;
 		msh.s_addr = MPLS_GETSADDR(rt);
 		if (msh.shim.label != MPLS_LABEL_IMPLNULL) {
+			is_mpls = true;
 			pktq = mpls_pktq;
 		}
 	}
-	if (pktq != mpls_pktq)
+	if (!is_mpls)
 #endif
 	switch (dst->sa_family) {
 



CVS commit: src/sys/net

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 23:34:51 UTC 2022

Modified Files:
src/sys/net: if_loop.c

Log Message:
Fix "MPLS handled this" detection logic in the rump environment.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/net/if_loop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/make

2022-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep  4 22:55:00 UTC 2022

Modified Files:
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: cond-cmp-numeric.exp cond-cmp-numeric.mk
cond-cmp-string.exp cond-op-parentheses.exp cond-op-parentheses.mk
varmod-ifelse.exp

Log Message:
make: add more details to error message for numeric comparison

Before:
String comparison operator must be either == or !=

After:
Comparison with '>=' requires both operands 'no' and '10' to be numeric

Noticed by martin@ in pkgsrc/textproc/py-pygments.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/usr.bin/make/cond.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk \
src/usr.bin/make/unit-tests/cond-op-parentheses.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op-parentheses.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-ifelse.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/cond.c
diff -u src/usr.bin/make/cond.c:1.335 src/usr.bin/make/cond.c:1.336
--- src/usr.bin/make/cond.c:1.335	Fri Sep  2 16:24:31 2022
+++ src/usr.bin/make/cond.c	Sun Sep  4 22:55:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cond.c,v 1.335 2022/09/02 16:24:31 sjg Exp $	*/
+/*	$NetBSD: cond.c,v 1.336 2022/09/04 22:55:00 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*	"@(#)cond.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: cond.c,v 1.335 2022/09/02 16:24:31 sjg Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.336 2022/09/04 22:55:00 rillig Exp $");
 
 /*
  * Conditional expressions conform to this grammar:
@@ -583,7 +583,9 @@ EvalCompareStr(CondParser *par, const ch
 {
 	if (op != EQ && op != NE) {
 		Parse_Error(PARSE_FATAL,
-		"String comparison operator must be either == or !=");
+		"Comparison with '%s' requires both operands "
+		"'%s' and '%s' to be numeric",
+		opname[op], lhs, rhs);
 		par->printedError = true;
 		return TOK_ERROR;
 	}

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.7 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.8
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.7	Thu Mar  3 19:36:35 2022
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.exp	Sun Sep  4 22:55:00 2022
@@ -1,7 +1,7 @@
 CondParser_Eval: !(${:UINF} > 1e100)
-make: "cond-cmp-numeric.mk" line 11: String comparison operator must be either == or !=
+make: "cond-cmp-numeric.mk" line 11: Comparison with '>' requires both operands 'INF' and '1e100' to be numeric
 CondParser_Eval: ${:UNaN} > NaN
-make: "cond-cmp-numeric.mk" line 16: String comparison operator must be either == or !=
+make: "cond-cmp-numeric.mk" line 16: Comparison with '>' requires both operands 'NaN' and 'NaN' to be numeric
 CondParser_Eval: !(${:UNaN} == NaN)
 Comparing "NaN" == "NaN"
 CondParser_Eval: 123 ! 123
@@ -9,7 +9,7 @@ make: "cond-cmp-numeric.mk" line 34: Mal
 CondParser_Eval: ${:U 123} < 124
 Comparing 123.00 < 124.00
 CondParser_Eval: ${:U123 } < 124
-make: "cond-cmp-numeric.mk" line 50: String comparison operator must be either == or !=
+make: "cond-cmp-numeric.mk" line 50: Comparison with '<' requires both operands '123 ' and '124' to be numeric
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1

Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.5 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.6
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.5	Thu Jul 29 06:31:18 2021
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk	Sun Sep  4 22:55:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.5 2021/07/29 06:31:18 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.6 2022/09/04 22:55:00 rillig Exp $
 #
 # Tests for numeric comparisons in .if conditions.
 
@@ -46,7 +46,7 @@
 
 # Trailing spaces are NOT allowed for numbers.
 # See EvalCompare and TryParseNumber.
-# expect+1: String comparison operator must be either == or !=
+# expect+1: Comparison with '<' requires both operands '123 ' and '124' to be numeric
 .if ${:U123 } < 124
 .  error
 .else
Index: src/usr.bin/make/unit-tests/cond-op-parentheses.mk
diff -u src/usr.bin/make/unit-tests/cond-op-parentheses.mk:1.5 src/usr.bin/make/unit-tests/cond-op-parentheses.mk:1.6
--- src/usr.bin/make/unit-tests/cond-op-parentheses.mk:1.5	Sat Jan 22 21:50:41 2022
+++ src/usr.bin/make/unit-tests/cond-op-parentheses.mk	Sun Sep  4 22:55:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-parentheses.mk,v 1.5 2022/01/22 21:50:41 rillig Exp $
+# $NetBSD: cond-op-parentheses.mk,v 1.6 

CVS commit: src/usr.bin/make

2022-09-04 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Sep  4 22:55:00 UTC 2022

Modified Files:
src/usr.bin/make: cond.c
src/usr.bin/make/unit-tests: cond-cmp-numeric.exp cond-cmp-numeric.mk
cond-cmp-string.exp cond-op-parentheses.exp cond-op-parentheses.mk
varmod-ifelse.exp

Log Message:
make: add more details to error message for numeric comparison

Before:
String comparison operator must be either == or !=

After:
Comparison with '>=' requires both operands 'no' and '10' to be numeric

Noticed by martin@ in pkgsrc/textproc/py-pygments.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/usr.bin/make/cond.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk \
src/usr.bin/make/unit-tests/cond-op-parentheses.mk
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-op-parentheses.exp
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/make/unit-tests/varmod-ifelse.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 22:34:58 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_subr.c

Log Message:
Unconditionally include  for KASSERT{,MSG}().
Fix (!DIAGNOSTIC && !DEBUG) build.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_subr.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/powerpc/fpu/fpu_subr.c
diff -u src/sys/arch/powerpc/fpu/fpu_subr.c:1.7 src/sys/arch/powerpc/fpu/fpu_subr.c:1.8
--- src/sys/arch/powerpc/fpu/fpu_subr.c:1.7	Fri Sep  2 12:29:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_subr.c	Sun Sep  4 22:34:58 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_subr.c,v 1.7 2022/09/02 12:29:58 rin Exp $ */
+/*	$NetBSD: fpu_subr.c,v 1.8 2022/09/04 22:34:58 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,12 +45,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.7 2022/09/02 12:29:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.8 2022/09/04 22:34:58 rin Exp $");
 
 #include 
-#if defined(DIAGNOSTIC)||defined(DEBUG)
 #include 
-#endif
 
 #include 
 #include 



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 22:34:58 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_subr.c

Log Message:
Unconditionally include  for KASSERT{,MSG}().
Fix (!DIAGNOSTIC && !DEBUG) build.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev

2022-09-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  4 21:56:38 UTC 2022

Modified Files:
src/sys/dev: vnd.c

Log Message:
revert 1.281
VNDIOCLR requires write access to unconfigure a unit, even when the unit
is read-only.


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.286 src/sys/dev/vnd.c:1.287
--- src/sys/dev/vnd.c:1.286	Tue May 31 14:13:31 2022
+++ src/sys/dev/vnd.c	Sun Sep  4 21:56:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.286 2022/05/31 14:13:31 riastradh Exp $	*/
+/*	$NetBSD: vnd.c,v 1.287 2022/09/04 21:56:38 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.286 2022/05/31 14:13:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.287 2022/09/04 21:56:38 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -364,11 +364,6 @@ vndopen(dev_t dev, int flags, int mode, 
 		goto done;
 	}
 
-	if ((flags & FWRITE) && (sc->sc_flags & VNF_READONLY)) {
-		error = EROFS;
-		goto done;
-	}
-
 	if (sc->sc_flags & VNF_INITED) {
 		if ((sc->sc_dkdev.dk_openmask & ~(1<

CVS commit: src/sys/dev

2022-09-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Sep  4 21:56:38 UTC 2022

Modified Files:
src/sys/dev: vnd.c

Log Message:
revert 1.281
VNDIOCLR requires write access to unconfigure a unit, even when the unit
is read-only.


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/vnd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 21:37:50 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile
Added Files:
src/share/man/man9: pktqueue.9

Log Message:
Document the pktqueue interface.


To generate a diff of this commit:
cvs rdiff -u -r1.2420 -r1.2421 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.464 -r1.465 src/share/man/man9/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man9/pktqueue.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 21:37:50 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: Makefile
Added Files:
src/share/man/man9: pktqueue.9

Log Message:
Document the pktqueue interface.


To generate a diff of this commit:
cvs rdiff -u -r1.2420 -r1.2421 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.464 -r1.465 src/share/man/man9/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man9/pktqueue.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2420 src/distrib/sets/lists/comp/mi:1.2421
--- src/distrib/sets/lists/comp/mi:1.2420	Sun Sep  4 20:06:26 2022
+++ src/distrib/sets/lists/comp/mi	Sun Sep  4 21:37:50 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2420 2022/09/04 20:06:26 thorpej Exp $
+#	$NetBSD: mi,v 1.2421 2022/09/04 21:37:50 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -12246,6 +12246,17 @@
 ./usr/share/man/cat9/pgrp_find.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pgsignal.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/physio.0			comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_barrier.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_create.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_dequeue.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_destroy.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_enqueue.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_flush.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_ifdetach.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_rps_hash.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_set_maxlen.0		comp-sys-catman		.cat
+./usr/share/man/cat9/pktq_sysctl_setup.0	comp-sys-catman		.cat
+./usr/share/man/cat9/pktqueue.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pmap.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/pmap_activate.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/pmap_clear_modify.0	comp-sys-catman		.cat
@@ -12577,6 +12588,7 @@
 ./usr/share/man/cat9/sysctl_needfunc.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/sysctl_notavail.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/sysctl_null.0		comp-sys-catman		.cat
+./usr/share/man/cat9/sysctl_pktq_rps_hash_handler.0 comp-sys-catman	.cat
 ./usr/share/man/cat9/sysctl_query.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/sysctl_teardown.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/sysctl_unlock.0		comp-sys-catman		.cat
@@ -20465,6 +20477,17 @@
 ./usr/share/man/html9/pgrp_find.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pgsignal.html		comp-sys-htmlman	html
 ./usr/share/man/html9/physio.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_barrier.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_create.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_dequeue.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_destroy.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_enqueue.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_flush.html		comp-sys-htmlman	html
+./usr/share/man/html9/pktq_ifdetach.html	comp-sys-htmlman	html
+./usr/share/man/html9/pktq_rps_hash.html	comp-sys-htmlman	html
+./usr/share/man/html9/pktq_set_maxlen.html	comp-sys-htmlman	html
+./usr/share/man/html9/pktq_sysctl_setup.html	comp-sys-htmlman	html
+./usr/share/man/html9/pktqueue.html		comp-sys-htmlman	html
 ./usr/share/man/html9/pmap.html			comp-sys-htmlman	html
 ./usr/share/man/html9/pmap_activate.html	comp-sys-htmlman	html
 ./usr/share/man/html9/pmap_clear_modify.html	comp-sys-htmlman	html
@@ -20777,6 +20800,7 @@
 ./usr/share/man/html9/sysctl_needfunc.html	comp-sys-htmlman	html
 ./usr/share/man/html9/sysctl_notavail.html	comp-sys-htmlman	html
 ./usr/share/man/html9/sysctl_null.html		comp-sys-htmlman	html
+./usr/share/man/html9/sysctl_pktq_rps_hash_handler.html comp-sys-htmlman html
 ./usr/share/man/html9/sysctl_query.html		comp-sys-htmlman	html
 ./usr/share/man/html9/sysctl_teardown.html	comp-sys-htmlman	html
 ./usr/share/man/html9/sysctl_unlock.html	comp-sys-htmlman	html
@@ -28845,6 +28869,17 @@
 ./usr/share/man/man9/pgrp_find.9		comp-sys-man		.man
 ./usr/share/man/man9/pgsignal.9			comp-sys-man		.man
 ./usr/share/man/man9/physio.9			comp-sys-man		.man
+./usr/share/man/man9/pktq_barrier.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_create.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_dequeue.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_destroy.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_enqueue.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_flush.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_ifdetach.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_rps_hash.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_set_maxlen.9		comp-sys-man		.man
+./usr/share/man/man9/pktq_sysctl_setup.9	comp-sys-man		.man

CVS commit: src/distrib/sets/lists/comp

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 20:06:26 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Sort.


To generate a diff of this commit:
cvs rdiff -u -r1.2419 -r1.2420 src/distrib/sets/lists/comp/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/sets/lists/comp

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 20:06:26 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Sort.


To generate a diff of this commit:
cvs rdiff -u -r1.2419 -r1.2420 src/distrib/sets/lists/comp/mi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2419 src/distrib/sets/lists/comp/mi:1.2420
--- src/distrib/sets/lists/comp/mi:1.2419	Sat Sep  3 02:47:59 2022
+++ src/distrib/sets/lists/comp/mi	Sun Sep  4 20:06:26 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2419 2022/09/03 02:47:59 thorpej Exp $
+#	$NetBSD: mi,v 1.2420 2022/09/04 20:06:26 thorpej Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -953,8 +953,8 @@
 ./usr/include/fidocomp-c-include
 ./usr/include/fido.hcomp-c-include
 ./usr/include/fido/bio.h			comp-c-include
-./usr/include/fido/credman.h			comp-c-include
 ./usr/include/fido/config.h			comp-c-include
+./usr/include/fido/credman.h			comp-c-include
 ./usr/include/fido/eddsa.h			comp-c-include
 ./usr/include/fido/err.h			comp-c-include
 ./usr/include/fido/es256.h			comp-c-include
@@ -1434,8 +1434,8 @@
 ./usr/include/g++/ext/new_allocator.h		comp-cxx-include	gcc,cxx,libstdcxx
 ./usr/include/g++/ext/numeric			comp-cxx-include	gcc,cxx,libstdcxx
 ./usr/include/g++/ext/numeric_traits.h		comp-cxx-include	gcc,cxx,libstdcxx
-./usr/include/g++/ext/opt_random.h		comp-obsolete		obsolete,gcc=9
 ./usr/include/g++/ext/opt_random.h		comp-cxx-include	gcc,cxx,libstdcxx,gcc=10
+./usr/include/g++/ext/opt_random.h		comp-obsolete		obsolete,gcc=9
 ./usr/include/g++/ext/pb_ds/assoc_container.hpp		comp-cxx-include	gcc,cxx,libstdcxx
 ./usr/include/g++/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp		comp-cxx-include	gcc,cxx,libstdcxx
 ./usr/include/g++/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp comp-cxx-include	gcc,cxx,libstdcxx
@@ -3631,6 +3631,20 @@
 ./usr/include/zconf.hcomp-c-include
 ./usr/include/zlib.hcomp-c-include
 ./usr/lib	base-sys-usr		compatdir
+./usr/lib/clang/13.0.0/include/sanitizer/allocator_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/asan_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/common_interface_defs.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/coverage_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/lsan_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/msan_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/netbsd_syscall_hooks.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/tsan_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/sanitizer/tsan_interface_atomic.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/xray/xray_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/xray/xray_log_interface.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/include/xray/xray_records.h	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/share/asan_blacklist.txt	comp-cxx-include		llvm
+./usr/lib/clang/13.0.0/share/msan_blacklist.txt	comp-cxx-include		llvm
 ./usr/lib/clang/7.0.0/include/sanitizer/allocator_interface.h	comp-obsolete		obsolete
 ./usr/lib/clang/7.0.0/include/sanitizer/asan_interface.h	comp-obsolete		obsolete
 ./usr/lib/clang/7.0.0/include/sanitizer/common_interface_defs.h	comp-obsolete		obsolete
@@ -3659,20 +3673,6 @@
 ./usr/lib/clang/9.0.0/include/xray/xray_records.h	comp-obsolete	obsolete		llvm
 ./usr/lib/clang/9.0.0/share/asan_blacklist.txt	comp-obsolete	obsolete		llvm
 ./usr/lib/clang/9.0.0/share/msan_blacklist.txt	comp-obsolete	obsolete		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/allocator_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/asan_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/common_interface_defs.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/coverage_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/lsan_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/msan_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/netbsd_syscall_hooks.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/tsan_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/sanitizer/tsan_interface_atomic.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/xray/xray_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/xray/xray_log_interface.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/include/xray/xray_records.h	comp-cxx-include		llvm
-./usr/lib/clang/13.0.0/share/asan_blacklist.txt	comp-cxx-include		llvm

CVS commit: src/sys/net

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 17:34:44 UTC 2022

Modified Files:
src/sys/net: pktqueue.c

Log Message:
In pktq_flush():
- Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that the
  ISR for this pktqueue is not running (addresses a pre-existing XXX).
- Hold the barrier lock around the critical section to ensure that
  implicit pktq_barrier() calls via pktq_ifdetach() are held off during
  the critical section.
- Ensure the critical section completes in minimal time by not freeing
  memory during the critical section; instead, just build a list of the
  packets pulled out of the per-CPU queues and free them after the critical
  section is over.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/net/pktqueue.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/net/pktqueue.c
diff -u src/sys/net/pktqueue.c:1.20 src/sys/net/pktqueue.c:1.21
--- src/sys/net/pktqueue.c:1.20	Fri Sep  2 05:50:36 2022
+++ src/sys/net/pktqueue.c	Sun Sep  4 17:34:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pktqueue.c,v 1.20 2022/09/02 05:50:36 thorpej Exp $	*/
+/*	$NetBSD: pktqueue.c,v 1.21 2022/09/04 17:34:43 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.20 2022/09/02 05:50:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.21 2022/09/04 17:34:43 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -540,7 +540,23 @@ pktq_flush(pktqueue_t *pq)
 {
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci;
-	struct mbuf *m;
+	struct mbuf *m, *m0 = NULL;
+
+	ASSERT_SLEEPABLE();
+
+	/*
+	 * Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that any
+	 * already running handler for this pktqueue is no longer running.
+	 */
+	xc_barrier(XC_HIGHPRI_IPL(IPL_SOFTNET));
+
+	/*
+	 * Acquire the barrier lock.  While the caller ensures that
+	 * no explcit pktq_barrier() calls will be issued, this holds
+	 * off any implicit pktq_barrier() calls that would happen
+	 * as the result of pktq_ifdetach().
+	 */
+	mutex_enter(>pq_lock);
 
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		struct pcq *q;
@@ -550,14 +566,23 @@ pktq_flush(pktqueue_t *pq)
 		kpreempt_enable();
 
 		/*
-		 * XXX This can't be right -- if the softint is running
-		 * then pcq_get isn't safe here.
+		 * Pull the packets off the pcq and chain them into
+		 * a list to be freed later.
 		 */
 		while ((m = pcq_get(q)) != NULL) {
 			pktq_inc_count(pq, PQCNT_DEQUEUE);
-			m_freem(m);
+			m->m_nextpkt = m0;
+			m0 = m;
 		}
 	}
+
+	mutex_exit(>pq_lock);
+
+	/* Free the packets now that the critical section is over. */
+	while ((m = m0) != NULL) {
+		m0 = m->m_nextpkt;
+		m_freem(m);
+	}
 }
 
 static void



CVS commit: src/sys/net

2022-09-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep  4 17:34:44 UTC 2022

Modified Files:
src/sys/net: pktqueue.c

Log Message:
In pktq_flush():
- Run a dummy softint at IPL_SOFTNET on all CPUs to ensure that the
  ISR for this pktqueue is not running (addresses a pre-existing XXX).
- Hold the barrier lock around the critical section to ensure that
  implicit pktq_barrier() calls via pktq_ifdetach() are held off during
  the critical section.
- Ensure the critical section completes in minimal time by not freeing
  memory during the critical section; instead, just build a list of the
  packets pulled out of the per-CPU queues and free them after the critical
  section is over.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/net/pktqueue.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/fdt

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 16:01:25 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Revert previous

kern/56994: wm(4) panic on attach in interrupt_distribute, sometimes


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/fdt/pcihost_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/fdt

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 16:01:25 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Revert previous

kern/56994: wm(4) panic on attach in interrupt_distribute, sometimes


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/fdt/pcihost_fdt.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/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.29 src/sys/arch/arm/fdt/pcihost_fdt.c:1.30
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.29	Sun Sep  4 10:20:33 2022
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Sun Sep  4 16:01:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.30 2022/09/04 16:01:25 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.30 2022/09/04 16:01:25 skrll Exp $");
 
 #include 
 
@@ -600,54 +600,32 @@ pcihost_intr_setattr(void *v, pci_intr_h
 	}
 }
 
-struct pcihost_cookie {
-	pci_intr_handle_t phic_pih;
-	void *phic_ih;
-};
-
-
 static void *
-pcihost_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
+pcihost_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
 int (*callback)(void *), void *arg, const char *xname)
 {
 	struct pcihost_softc *sc = v;
-	const int flags = (pih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
+	const int flags = (ih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
 	const u_int *specifier;
 	int ihandle;
 
-	struct pcihost_cookie * const phic = kmem_alloc(sizeof(*phic), KM_SLEEP);
-	phic->phic_pih = pih;
-	if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0) {
-		phic->phic_ih = arm_pci_msi_intr_establish(>sc_pc, pih, ipl,
-		callback, arg, xname);
-
-		return phic;
-	}
+	if ((ih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
+		return arm_pci_msi_intr_establish(>sc_pc, ih, ipl, callback, arg, xname);
 
-	specifier = pcihost_find_intr(sc, pih & ARM_PCI_INTR_IRQ, );
+	specifier = pcihost_find_intr(sc, ih & ARM_PCI_INTR_IRQ, );
 	if (specifier == NULL)
 		return NULL;
 
-	phic->phic_ih = fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
+	return fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
 	callback, arg, xname);
-
-	return phic;
 }
 
 static void
 pcihost_intr_disestablish(void *v, void *vih)
 {
 	struct pcihost_softc *sc = v;
-	struct pcihost_cookie * const phic = vih;
-	const pci_intr_handle_t pih = phic->phic_pih;
-	void * const ih = phic->phic_ih;
-
-	kmem_free(phic, sizeof(*phic));
-
-	if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
-		return;
 
-	fdtbus_intr_disestablish(sc->sc_phandle, ih);
+	fdtbus_intr_disestablish(sc->sc_phandle, vih);
 }
 
 static int



CVS commit: src/sys/dev/ppbus

2022-09-04 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Sun Sep  4 15:59:08 UTC 2022

Modified Files:
src/sys/dev/ppbus: if_plip.c

Log Message:
Add standard inet headers.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ppbus/if_plip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/ppbus

2022-09-04 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Sun Sep  4 15:59:08 UTC 2022

Modified Files:
src/sys/dev/ppbus: if_plip.c

Log Message:
Add standard inet headers.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.37 src/sys/dev/ppbus/if_plip.c:1.38
--- src/sys/dev/ppbus/if_plip.c:1.37	Fri Sep  2 23:48:10 2022
+++ src/sys/dev/ppbus/if_plip.c	Sun Sep  4 15:59:08 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.37 2022/09/02 23:48:10 thorpej Exp $ */
+/* $NetBSD: if_plip.c,v 1.38 2022/09/04 15:59:08 rjs Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.37 2022/09/02 23:48:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.38 2022/09/04 15:59:08 rjs Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -103,8 +103,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 
 #include 
 
 #ifdef INET
+#include 
+#include 
 #include 
-/* #include  */
+#include 
 #else
 #error Cannot config lp/plip without inet
 #endif



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:32:14 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_div.c fpu_emu.c

Log Message:
Trailing white-space/TAB.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_div.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_div.c
diff -u src/sys/arch/powerpc/fpu/fpu_div.c:1.7 src/sys/arch/powerpc/fpu/fpu_div.c:1.8
--- src/sys/arch/powerpc/fpu/fpu_div.c:1.7	Thu Sep  1 06:10:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_div.c	Sun Sep  4 13:32:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.7 2022/09/01 06:10:58 rin Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.7 2022/09/01 06:10:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -190,7 +190,7 @@ fpu_div(struct fpemu *fe)
 	}
 	/*
 	 * Need to split the following out cause they generate different
-	 * exceptions. 
+	 * exceptions.
 	 */
 	if (ISINF(x)) {
 		if (x->fp_class == y->fp_class) {

Index: src/sys/arch/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.52 src/sys/arch/powerpc/fpu/fpu_emu.c:1.53
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.52	Sun Sep  4 13:18:33 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Sun Sep  4 13:32:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.52 2022/09/04 13:18:33 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.53 2022/09/04 13:32:14 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.52 2022/09/04 13:18:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.53 2022/09/04 13:32:14 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -183,7 +183,7 @@ fpu_dumpfpn(struct fpn *fp)
 	printf("%s %c.%x %x %x %xE%d\n", class[fp->fp_class + 2],
 		fp->fp_sign ? '-' : ' ',
 		fp->fp_mant[0],	fp->fp_mant[1],
-		fp->fp_mant[2], fp->fp_mant[3], 
+		fp->fp_mant[2], fp->fp_mant[3],
 		fp->fp_exp);
 }
 #endif
@@ -376,7 +376,7 @@ fpu_execute(struct trapframe *tf, struct
 size = sizeof(float);
 			}
 			update = (instr.i_x.i_xo & 0x20);
-			
+
 			/* calculate EA of load/store */
 			ra = instr.i_x.i_ra;
 			rb = instr.i_x.i_rb;
@@ -424,7 +424,7 @@ fpu_execute(struct trapframe *tf, struct
 	return (FAULT);
 }
 			} else {
-DPRINTF(FPE_INSN, 
+DPRINTF(FPE_INSN,
 	("fpu_execute: Store DBL at %p\n",
 		(void *)addr));
 if (copyout(>fpreg[rt], (void *)addr, size)) {
@@ -446,7 +446,7 @@ fpu_execute(struct trapframe *tf, struct
 fpu_implode(fe, fp, FTYPE_DBL, (rt));
 			}
 		}
-		if (update) 
+		if (update)
 			tf->tf_fixreg[ra] = addr;
 		/* Complete. */
 		return (0);
@@ -485,11 +485,11 @@ fpu_execute(struct trapframe *tf, struct
 
 			case	OPC63_FRSP:
 /*
- * Convert to single: 
+ * Convert to single:
  *
  * PowerPC uses this to round a double
  * precision value to single precision,
- * but values in registers are always 
+ * but values in registers are always
  * stored in double precision format.
  */
 FPU_EMU_EVCNT_INCR(frsp);



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:32:14 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_div.c fpu_emu.c

Log Message:
Trailing white-space/TAB.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_div.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:18:33 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Simplify; no need to override ``type'' here. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.51 src/sys/arch/powerpc/fpu/fpu_emu.c:1.52
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.51	Sun Sep  4 13:16:47 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Sun Sep  4 13:18:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.51 2022/09/04 13:16:47 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.52 2022/09/04 13:18:33 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.51 2022/09/04 13:16:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.52 2022/09/04 13:18:33 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -624,8 +624,8 @@ fpu_execute(struct trapframe *tf, struct
 			case	OPC63_FCFID:
 FPU_EMU_EVCNT_INCR(fcfid);
 DPRINTF(FPE_INSN, ("fpu_execute: FCFID\n"));
-type = FTYPE_LNG;
-fpu_explode(fe, fp = >fe_f1, type, FR(rb));
+fpu_explode(fe, fp = >fe_f1, FTYPE_LNG,
+FR(rb));
 type = FTYPE_DBL | FTYPE_FPSCR;
 break;
 			default:



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:18:33 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Simplify; no need to override ``type'' here. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:17:33 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Simplify logic to remove needless goto. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/fpu/fpu_implode.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/powerpc/fpu/fpu_implode.c
diff -u src/sys/arch/powerpc/fpu/fpu_implode.c:1.21 src/sys/arch/powerpc/fpu/fpu_implode.c:1.22
--- src/sys/arch/powerpc/fpu/fpu_implode.c:1.21	Sun Sep  4 13:14:57 2022
+++ src/sys/arch/powerpc/fpu/fpu_implode.c	Sun Sep  4 13:17:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_implode.c,v 1.21 2022/09/04 13:14:57 rin Exp $ */
+/*	$NetBSD: fpu_implode.c,v 1.22 2022/09/04 13:17:33 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.21 2022/09/04 13:14:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.22 2022/09/04 13:17:33 rin Exp $");
 
 #include 
 #include 
@@ -451,14 +451,13 @@ fpu_ftod(struct fpemu *fe, struct fpn *f
 	}
 	if (ISINF(fp)) {
 		*cx |= FPRF_SIGN(sign) | FPSCR_FU;
-		sign |= DBL_EXP(DBL_EXP_INFNAN);
-		goto zero;
+		return HI_WORD(sign | DBL_EXP(DBL_EXP_INFNAN));
 	}
 	if (ISZERO(fp)) {
 		*cx |= FPSCR_FE;
 		if (sign)
 			*cx |= FPSCR_C;
-zero:		return HI_WORD(sign);
+		return HI_WORD(sign);
 	}
 
 	if ((exp = fp->fp_exp + DBL_EXP_BIAS) <= 0) {



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:17:33 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Simplify logic to remove needless goto. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/fpu/fpu_implode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:16:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Update FR and FI (and undefined FPRF) for ``round to integer'' insns.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.50 src/sys/arch/powerpc/fpu/fpu_emu.c:1.51
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.50	Sun Sep  4 13:14:57 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Sun Sep  4 13:16:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.50 2022/09/04 13:14:57 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.51 2022/09/04 13:16:47 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.50 2022/09/04 13:14:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.51 2022/09/04 13:16:47 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -506,7 +506,7 @@ fpu_execute(struct trapframe *tf, struct
 FPU_EMU_EVCNT_INCR(fctiw);
 DPRINTF(FPE_INSN, ("fpu_execute: FCTIW\n"));
 fpu_explode(fe, fp = >fe_f1, type, FR(rb));
-type = FTYPE_INT;
+type = FTYPE_INT | FTYPE_FPSCR;
 if (instr.i_x.i_xo == OPC63_FCTIWZ)
 	type |= FTYPE_RD_RZ;
 break;
@@ -617,7 +617,7 @@ fpu_execute(struct trapframe *tf, struct
 FPU_EMU_EVCNT_INCR(fctid);
 DPRINTF(FPE_INSN, ("fpu_execute: FCTID\n"));
 fpu_explode(fe, fp = >fe_f1, type, FR(rb));
-type = FTYPE_LNG;
+type = FTYPE_LNG | FTYPE_FPSCR;
 if (instr.i_x.i_xo == OPC63_FCTIDZ)
 	type |= FTYPE_RD_RZ;
 break;



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:16:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Update FR and FI (and undefined FPRF) for ``round to integer'' insns.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:14:57 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_compare.c fpu_emu.c fpu_emu.h
fpu_implode.c

Log Message:
Fix logic for FI, FR, and FPRF fields of FPSCR.

They are not sticky bits and updated by arithmetic and round
insns at the same time.

Comparison insns update only FPCC sub-field of FPRF.

For other insns, these field are left untouched.

Also, for single-precision insns, exception bits should be set by
the first fpu_implode(), which rounds the value to float.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/fpu/fpu_compare.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/powerpc/fpu/fpu_emu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_emu.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/fpu/fpu_implode.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/powerpc/fpu/fpu_compare.c
diff -u src/sys/arch/powerpc/fpu/fpu_compare.c:1.5 src/sys/arch/powerpc/fpu/fpu_compare.c:1.6
--- src/sys/arch/powerpc/fpu/fpu_compare.c:1.5	Sat Jun 27 03:07:57 2020
+++ src/sys/arch/powerpc/fpu/fpu_compare.c	Sun Sep  4 13:14:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_compare.c,v 1.5 2020/06/27 03:07:57 rin Exp $ */
+/*	$NetBSD: fpu_compare.c,v 1.6 2022/09/04 13:14:57 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_compare.c,v 1.5 2020/06/27 03:07:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_compare.c,v 1.6 2022/09/04 13:14:57 rin Exp $");
 
 #include 
 
@@ -79,6 +79,8 @@ fpu_compare(struct fpemu *fe, int ordere
 	struct fpn *a, *b, *r;
 	int cc;
 
+	fe->fe_fpscr &= ~FPSCR_FPCC;
+
 	a = >fe_f1;
 	b = >fe_f2;
 	r = >fe_f3;

Index: src/sys/arch/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.49 src/sys/arch/powerpc/fpu/fpu_emu.c:1.50
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.49	Sat Sep  3 04:54:47 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Sun Sep  4 13:14:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.49 2022/09/03 04:54:47 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.50 2022/09/04 13:14:57 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.49 2022/09/03 04:54:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.50 2022/09/04 13:14:57 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -297,7 +297,7 @@ fpu_execute(struct trapframe *tf, struct
 	int ra, rb, rc, rt, type, mask, fsr, cx, bf, setcr, cond;
 	u_int bits;
 	struct fpreg *fs;
-	int i, mtfsb1 = 0;
+	int i;
 
 	/* Setup work. */
 	fp = NULL;
@@ -499,7 +499,7 @@ fpu_execute(struct trapframe *tf, struct
 fpu_implode(fe, fp, FTYPE_SNG, (rt));
 fpu_explode(fe, fp = >fe_f1, FTYPE_SNG,
 FR(rt));
-type = FTYPE_DBL | FTYPE_FPRF;
+type = FTYPE_DBL | FTYPE_FPSCR;
 break;
 			case	OPC63_FCTIW:
 			case	OPC63_FCTIWZ:
@@ -526,7 +526,6 @@ fpu_execute(struct trapframe *tf, struct
 			case	OPC63_MTFSB1:
 FPU_EMU_EVCNT_INCR(mtfsb1);
 DPRINTF(FPE_INSN, ("fpu_execute: MTFSB1\n"));
-mtfsb1 = 1;
 fe->fe_cx = (1 << (31 - rt)) &
 ~(FPSCR_FEX | FPSCR_VX);
 break;
@@ -627,7 +626,7 @@ fpu_execute(struct trapframe *tf, struct
 DPRINTF(FPE_INSN, ("fpu_execute: FCFID\n"));
 type = FTYPE_LNG;
 fpu_explode(fe, fp = >fe_f1, type, FR(rb));
-type = FTYPE_DBL | FTYPE_FPRF;
+type = FTYPE_DBL | FTYPE_FPSCR;
 break;
 			default:
 return (NOTFPU);
@@ -763,12 +762,12 @@ fpu_execute(struct trapframe *tf, struct
 
 			/* If the instruction was single precision, round */
 			if (!(instr.i_any.i_opcd & 0x4)) {
-fpu_implode(fe, fp, FTYPE_SNG | FTYPE_FPRF,
+fpu_implode(fe, fp, FTYPE_SNG | FTYPE_FPSCR,
 (rt));
 fpu_explode(fe, fp = >fe_f1, FTYPE_SNG,
 FR(rt));
 			} else
-type |= FTYPE_FPRF;
+type |= FTYPE_FPSCR;
 		}
 	} else {
 		return (NOTFPU);
@@ -785,10 +784,6 @@ fpu_execute(struct trapframe *tf, struct
 	cx = fe->fe_cx;
 	fsr = fe->fe_fpscr & ~(FPSCR_FEX|FPSCR_VX);
 	if (cx != 0) {
-		if (mtfsb1 == 0 && (cx & FPSCR_FPRF) != 0) {
-			/* Need to replace CC */
-			fsr &= ~FPSCR_FPRF;
-		}
 		fsr |= cx;
 		DPRINTF(FPE_INSN, ("fpu_execute: cx %x, fsr %x\n", cx, fsr));
 	}

Index: src/sys/arch/powerpc/fpu/fpu_emu.h
diff -u src/sys/arch/powerpc/fpu/fpu_emu.h:1.8 src/sys/arch/powerpc/fpu/fpu_emu.h:1.9
--- src/sys/arch/powerpc/fpu/fpu_emu.h:1.8	Fri Sep  2 12:40:49 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.h	Sun Sep  4 13:14:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.h,v 1.8 2022/09/02 12:40:49 rin Exp $ */
+/*	$NetBSD: fpu_emu.h,v 1.9 2022/09/04 13:14:57 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -141,8 +141,8 @@ struct fpn {
 #define	FTYPE_SNG	0x02	/* data = 32-bit float */
 #define	FTYPE_DBL	0x04	/* data = 64-bit double */
 #define	FTYPE_RD_RZ	0x08
-#define	

CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 13:14:57 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_compare.c fpu_emu.c fpu_emu.h
fpu_implode.c

Log Message:
Fix logic for FI, FR, and FPRF fields of FPSCR.

They are not sticky bits and updated by arithmetic and round
insns at the same time.

Comparison insns update only FPCC sub-field of FPRF.

For other insns, these field are left untouched.

Also, for single-precision insns, exception bits should be set by
the first fpu_implode(), which rounds the value to float.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/fpu/fpu_compare.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/powerpc/fpu/fpu_emu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_emu.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/fpu/fpu_implode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/xen/xen

2022-09-04 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Sep  4 11:20:33 UTC 2022

Modified Files:
src/sys/arch/xen/xen: xenevt.c

Log Message:
Release mutexes earlier in xenevt_free(), to call *destroy and kmem_free
without holding spin locks. Fixes an occasional deadlock seen when the qemu
backing a HVM domU exits.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/xen/xen/xenevt.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/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.65 src/sys/arch/xen/xen/xenevt.c:1.66
--- src/sys/arch/xen/xen/xenevt.c:1.65	Fri May 27 18:35:38 2022
+++ src/sys/arch/xen/xen/xenevt.c	Sun Sep  4 11:20:33 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.65 2022/05/27 18:35:38 bouyer Exp $  */
+/*  $NetBSD: xenevt.c,v 1.66 2022/09/04 11:20:33 bouyer Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.65 2022/05/27 18:35:38 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.66 2022/09/04 11:20:33 bouyer Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -278,8 +278,7 @@ xenevt_notify(void)
 		d->pending = false;
 		mutex_enter(>lock);
 		if (d->flags & XENEVT_F_FREE) {
-			xenevt_free(d);
-			mutex_exit(_lock);
+			xenevt_free(d); /* releases devevent_lock */
 		} else {
 			mutex_exit(_lock);
 			selnotify(>sel, 0, 1);
@@ -402,7 +401,6 @@ xenevt_free(struct xenevt_d *d)
 			hypervisor_mask_event(i);
 			xen_atomic_clear_bit(>ci->ci_evtmask[0], i);
 			devevent[i] = NULL;
-
 			op.cmd = EVTCHNOP_close;
 			op.u.close.port = i;
 			if ((error = HYPERVISOR_event_channel_op())) {
@@ -412,6 +410,7 @@ xenevt_free(struct xenevt_d *d)
 		}
 	}
 	mutex_exit(>lock);
+	mutex_exit(_lock);
 	seldestroy(>sel);
 	cv_destroy(>cv);
 	mutex_destroy(>lock);
@@ -428,11 +427,11 @@ xenevt_fclose(struct file *fp)
 	if (d->pending) {
 		d->flags |= XENEVT_F_FREE;
 		mutex_exit(>lock);
+		mutex_exit(_lock);
 	} else {
-		xenevt_free(d);
+		xenevt_free(d); /* releases devevent_lock */
 	}
 
-	mutex_exit(_lock);
 	fp->f_data = NULL;
 	return (0);
 }



CVS commit: src/sys/arch/xen/xen

2022-09-04 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Sep  4 11:20:33 UTC 2022

Modified Files:
src/sys/arch/xen/xen: xenevt.c

Log Message:
Release mutexes earlier in xenevt_free(), to call *destroy and kmem_free
without holding spin locks. Fixes an occasional deadlock seen when the qemu
backing a HVM domU exits.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/xen/xen/xenevt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/fdt

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 10:20:33 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
pcihost: Don't call fdtbus_intr_disestablish for MSI/MSI-X interrupts.

This avoids a KASSERT firing when using 'drvctl -d' on a pci device that
uses MSI/MSI-X interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/fdt/pcihost_fdt.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/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.28 src/sys/arch/arm/fdt/pcihost_fdt.c:1.29
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.28	Sat Aug 13 16:01:34 2022
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Sun Sep  4 10:20:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.29 2022/09/04 10:20:33 skrll Exp $");
 
 #include 
 
@@ -600,32 +600,54 @@ pcihost_intr_setattr(void *v, pci_intr_h
 	}
 }
 
+struct pcihost_cookie {
+	pci_intr_handle_t phic_pih;
+	void *phic_ih;
+};
+
+
 static void *
-pcihost_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
+pcihost_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
 int (*callback)(void *), void *arg, const char *xname)
 {
 	struct pcihost_softc *sc = v;
-	const int flags = (ih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
+	const int flags = (pih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
 	const u_int *specifier;
 	int ihandle;
 
-	if ((ih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
-		return arm_pci_msi_intr_establish(>sc_pc, ih, ipl, callback, arg, xname);
+	struct pcihost_cookie * const phic = kmem_alloc(sizeof(*phic), KM_SLEEP);
+	phic->phic_pih = pih;
+	if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0) {
+		phic->phic_ih = arm_pci_msi_intr_establish(>sc_pc, pih, ipl,
+		callback, arg, xname);
+
+		return phic;
+	}
 
-	specifier = pcihost_find_intr(sc, ih & ARM_PCI_INTR_IRQ, );
+	specifier = pcihost_find_intr(sc, pih & ARM_PCI_INTR_IRQ, );
 	if (specifier == NULL)
 		return NULL;
 
-	return fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
+	phic->phic_ih = fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags,
 	callback, arg, xname);
+
+	return phic;
 }
 
 static void
 pcihost_intr_disestablish(void *v, void *vih)
 {
 	struct pcihost_softc *sc = v;
+	struct pcihost_cookie * const phic = vih;
+	const pci_intr_handle_t pih = phic->phic_pih;
+	void * const ih = phic->phic_ih;
+
+	kmem_free(phic, sizeof(*phic));
+
+	if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
+		return;
 
-	fdtbus_intr_disestablish(sc->sc_phandle, vih);
+	fdtbus_intr_disestablish(sc->sc_phandle, ih);
 }
 
 static int



CVS commit: src/sys/arch/arm/fdt

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 10:20:33 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
pcihost: Don't call fdtbus_intr_disestablish for MSI/MSI-X interrupts.

This avoids a KASSERT firing when using 'drvctl -d' on a pci device that
uses MSI/MSI-X interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/fdt/pcihost_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 09:23:07 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Fix debug printf. Unbreak DEBUG build.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/fpu/fpu_implode.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/powerpc/fpu/fpu_implode.c
diff -u src/sys/arch/powerpc/fpu/fpu_implode.c:1.19 src/sys/arch/powerpc/fpu/fpu_implode.c:1.20
--- src/sys/arch/powerpc/fpu/fpu_implode.c:1.19	Sun Sep  4 09:20:55 2022
+++ src/sys/arch/powerpc/fpu/fpu_implode.c	Sun Sep  4 09:23:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_implode.c,v 1.19 2022/09/04 09:20:55 rin Exp $ */
+/*	$NetBSD: fpu_implode.c,v 1.20 2022/09/04 09:23:07 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.19 2022/09/04 09:20:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.20 2022/09/04 09:23:07 rin Exp $");
 
 #include 
 #include 
@@ -537,29 +537,25 @@ fpu_implode(struct fpemu *fe, struct fpn
 	case FTYPE_LNG:
 		/* FPRF is undefined. */
 		*p = fpu_ftox(fe, fp, rn);
-		DPRINTF(FPE_REG, ("fpu_implode: long %x %x\n",
-			space[0], space[1]));
+		DPRINTF(FPE_REG, ("fpu_implode: long %x %x\n", *hi, *lo));
 		break;
 
 	case FTYPE_INT:
 		/* FPRF is undefined. */
 		*hi = 0;
 		*lo = fpu_ftoi(fe, fp, rn);
-		DPRINTF(FPE_REG, ("fpu_implode: int %x\n",
-			space[1]));
+		DPRINTF(FPE_REG, ("fpu_implode: int %x\n", *lo));
 		break;
 
 	case FTYPE_SNG:
 		*hi = fpu_ftos(fe, fp, fprf);
 		*lo = 0;
-		DPRINTF(FPE_REG, ("fpu_implode: single %x\n",
-			space[0]));
+		DPRINTF(FPE_REG, ("fpu_implode: single %x\n", *hi));
 		break;
 
 	case FTYPE_DBL:
 		*p = fpu_ftod(fe, fp, fprf);
-		DPRINTF(FPE_REG, ("fpu_implode: double %x %x\n",
-			space[0], space[1]));
+		DPRINTF(FPE_REG, ("fpu_implode: double %x %x\n", *hi, *lo));
 		break;
 
 	default:



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 09:23:07 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Fix debug printf. Unbreak DEBUG build.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/fpu/fpu_implode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 09:20:55 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Remove extra break.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/fpu/fpu_implode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2022-09-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Sep  4 09:20:55 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_implode.c

Log Message:
Remove extra break.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/fpu/fpu_implode.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/powerpc/fpu/fpu_implode.c
diff -u src/sys/arch/powerpc/fpu/fpu_implode.c:1.18 src/sys/arch/powerpc/fpu/fpu_implode.c:1.19
--- src/sys/arch/powerpc/fpu/fpu_implode.c:1.18	Fri Sep  2 12:48:04 2022
+++ src/sys/arch/powerpc/fpu/fpu_implode.c	Sun Sep  4 09:20:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_implode.c,v 1.18 2022/09/02 12:48:04 rin Exp $ */
+/*	$NetBSD: fpu_implode.c,v 1.19 2022/09/04 09:20:55 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.18 2022/09/02 12:48:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_implode.c,v 1.19 2022/09/04 09:20:55 rin Exp $");
 
 #include 
 #include 
@@ -560,7 +560,7 @@ fpu_implode(struct fpemu *fe, struct fpn
 		*p = fpu_ftod(fe, fp, fprf);
 		DPRINTF(FPE_REG, ("fpu_implode: double %x %x\n",
 			space[0], space[1]));
-		break;		break;
+		break;
 
 	default:
 		panic("fpu_implode: invalid type %d", type);



CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:55:43 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
bge(4): Use BUS_DMA_WAITOK in ring initilization now that it's safe


To generate a diff of this commit:
cvs rdiff -u -r1.386 -r1.387 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.386 src/sys/dev/pci/if_bge.c:1.387
--- src/sys/dev/pci/if_bge.c:1.386	Sun Sep  4 08:50:25 2022
+++ src/sys/dev/pci/if_bge.c	Sun Sep  4 08:55:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.386 2022/09/04 08:50:25 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.387 2022/09/04 08:55:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.386 2022/09/04 08:50:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.387 2022/09/04 08:55:43 skrll Exp $");
 
 #include 
 #include 
@@ -1596,7 +1596,7 @@ bge_init_rx_ring_std(struct bge_softc *s
 
 	for (i = 0; i < BGE_STD_RX_RING_CNT; i++) {
 		error = bus_dmamap_create(sc->bge_dmatag, MCLBYTES, 1,
-		MCLBYTES, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, );
+		MCLBYTES, 0, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW, );
 		if (error)
 			goto uncreate;
 
@@ -1794,7 +1794,7 @@ bge_init_tx_ring(struct bge_softc *sc)
 
 	for (i = 0; i < BGE_TX_RING_CNT; i++) {
 		if (bus_dmamap_create(sc->bge_dmatag, BGE_TXDMA_MAX,
-		BGE_NTXSEG, maxsegsz, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
+		BGE_NTXSEG, maxsegsz, 0, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
 		))
 			return ENOBUFS;
 		if (dmamap == NULL)
@@ -1802,7 +1802,7 @@ bge_init_tx_ring(struct bge_softc *sc)
 		if (sc->bge_dma64) {
 			if (bus_dmamap_create(sc->bge_dmatag32, BGE_TXDMA_MAX,
 			BGE_NTXSEG, maxsegsz, 0,
-			BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
+			BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
 			)) {
 bus_dmamap_destroy(sc->bge_dmatag, dmamap);
 return ENOBUFS;



CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:55:43 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
bge(4): Use BUS_DMA_WAITOK in ring initilization now that it's safe


To generate a diff of this commit:
cvs rdiff -u -r1.386 -r1.387 src/sys/dev/pci/if_bge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:50:26 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c if_bgevar.h

Log Message:
bge(4): fix the MP improvements and improve some more.

- Have two locks sc_core_lock at IPL_NONE and sc_intr_lock at IPL_NET and
  use appropriately.

- Use stopping flags instead of bge_if_flags so that bge_if_flags only
  needs to be protected by the sc_core_lock

- Use ifmedia_init_with_lock and provide the sc_intr_lock. mii operatiions
  are done from the interrupt handler.

- Fixup locking in bge_detach.

- Rename bge_watchdog to bge_watchdog_tick to avoid confusion with the
  if_watchdog method.

- Sprinkle some more asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.385 -r1.386 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/if_bgevar.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/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.385 src/sys/dev/pci/if_bge.c:1.386
--- src/sys/dev/pci/if_bge.c:1.385	Sun Sep  4 08:42:02 2022
+++ src/sys/dev/pci/if_bge.c	Sun Sep  4 08:50:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.385 2022/09/04 08:42:02 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.386 2022/09/04 08:50:25 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.385 2022/09/04 08:42:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.386 2022/09/04 08:50:25 skrll Exp $");
 
 #include 
 #include 
@@ -205,8 +205,8 @@ static int bge_ioctl(struct ifnet *, u_l
 static int bge_init(struct ifnet *);
 static int bge_init_locked(struct ifnet *);
 static void bge_stop(struct ifnet *, int);
-static void bge_stop_locked(struct ifnet *, int);
-static bool bge_watchdog(struct ifnet *);
+static void bge_stop_locked(struct ifnet *, bool);
+static bool bge_watchdog_tick(struct ifnet *);
 static int bge_ifmedia_upd(struct ifnet *);
 static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 static void bge_handle_reset_work(struct work *, void *);
@@ -1260,11 +1260,11 @@ bge_set_thresh(struct ifnet *ifp, int lv
 	 * occasionally cause glitches where Rx-interrupts are not
 	 * honoured for up to 10 seconds. jonat...@netbsd.org, 2003-04-05
 	 */
-	mutex_enter(sc->sc_core_lock);
+	mutex_enter(sc->sc_intr_lock);
 	sc->bge_rx_coal_ticks = bge_rx_threshes[lvl].rx_ticks;
 	sc->bge_rx_max_coal_bds = bge_rx_threshes[lvl].rx_max_bds;
 	sc->bge_pending_rxintr_change = true;
-	mutex_exit(sc->sc_core_lock);
+	mutex_exit(sc->sc_intr_lock);
 }
 
 
@@ -1456,14 +1456,14 @@ bge_jfree(struct mbuf *m, void *buf, siz
 	if (i < 0 || i >= BGE_JSLOTS)
 		panic("bge_jfree: asked to free buffer that we don't manage!");
 
-	mutex_enter(sc->sc_core_lock);
+	mutex_enter(sc->sc_intr_lock);
 	entry = SLIST_FIRST(>bge_jinuse_listhead);
 	if (entry == NULL)
 		panic("bge_jfree: buffer not in use!");
 	entry->slot = i;
 	SLIST_REMOVE_HEAD(>bge_jinuse_listhead, jpool_entries);
 	SLIST_INSERT_HEAD(>bge_jfree_listhead, entry, jpool_entries);
-	mutex_exit(sc->sc_core_lock);
+	mutex_exit(sc->sc_intr_lock);
 
 	if (__predict_true(m != NULL))
 		pool_cache_put(mb_cache, m);
@@ -3297,6 +3297,9 @@ bge_attach(device_t parent, device_t sel
 		return;
 	}
 
+	sc->bge_stopping = false;
+	sc->bge_txrx_stopping = false;
+
 	/* Save various chip information. */
 	sc->bge_chipid = bge_chipid(pa);
 	sc->bge_phy_addr = bge_phy_addr(sc);
@@ -3868,7 +3871,8 @@ bge_attach(device_t parent, device_t sel
 	else
 		sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
 
-	sc->sc_core_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET);
+	sc->sc_core_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
+	sc->sc_intr_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET);
 
 	/* Set up ifnet structure */
 	ifp = >ethercom.ec_if;
@@ -3943,8 +3947,9 @@ bge_attach(device_t parent, device_t sel
 
 		struct ifmedia * const ifm = >bge_ifmedia;
 		sc->ethercom.ec_ifmedia = ifm;
-		ifmedia_init(ifm, IFM_IMASK, bge_ifmedia_upd,
-		bge_ifmedia_sts);
+
+		ifmedia_init_with_lock(ifm, IFM_IMASK,
+		bge_ifmedia_upd, bge_ifmedia_sts, sc->sc_intr_lock);
 		ifmedia_add(ifm, IFM_ETHER | IFM_1000_SX, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_1000_SX | IFM_FDX, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
@@ -3978,8 +3983,8 @@ bge_attach(device_t parent, device_t sel
 		trys = 0;
 		BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
 		sc->ethercom.ec_mii = mii;
-		ifmedia_init(>mii_media, 0, bge_ifmedia_upd,
-			 bge_ifmedia_sts);
+		ifmedia_init_with_lock(>mii_media, 0, bge_ifmedia_upd,
+		bge_ifmedia_sts, sc->sc_intr_lock);
 		mii_flags = MIIF_DOPAUSE;
 		if (sc->bge_flags & BGEF_FIBER_MII)
 			mii_flags |= MIIF_HAVEFIBER;
@@ -4087,8 +4092,13 @@ bge_detach(device_t self, int flags __un
 	struct bge_softc * const sc = device_private(self);
 	struct ifnet * const ifp = >ethercom.ec_if;
 
+	

CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:50:26 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c if_bgevar.h

Log Message:
bge(4): fix the MP improvements and improve some more.

- Have two locks sc_core_lock at IPL_NONE and sc_intr_lock at IPL_NET and
  use appropriately.

- Use stopping flags instead of bge_if_flags so that bge_if_flags only
  needs to be protected by the sc_core_lock

- Use ifmedia_init_with_lock and provide the sc_intr_lock. mii operatiions
  are done from the interrupt handler.

- Fixup locking in bge_detach.

- Rename bge_watchdog to bge_watchdog_tick to avoid confusion with the
  if_watchdog method.

- Sprinkle some more asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.385 -r1.386 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/if_bgevar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:42:02 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
bge(4): use a local variable to make bge_ifmedia initialization pretty.

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.384 -r1.385 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.384 src/sys/dev/pci/if_bge.c:1.385
--- src/sys/dev/pci/if_bge.c:1.384	Sat Aug 27 06:32:53 2022
+++ src/sys/dev/pci/if_bge.c	Sun Sep  4 08:42:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.384 2022/08/27 06:32:53 skrll Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.385 2022/09/04 08:42:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.384 2022/08/27 06:32:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.385 2022/09/04 08:42:02 skrll Exp $");
 
 #include 
 #include 
@@ -3941,14 +3941,14 @@ bge_attach(device_t parent, device_t sel
 		macmode | BGE_PORTMODE_TBI);
 		DELAY(40);
 
-		sc->ethercom.ec_ifmedia = >bge_ifmedia;
-		ifmedia_init(>bge_ifmedia, IFM_IMASK, bge_ifmedia_upd,
+		struct ifmedia * const ifm = >bge_ifmedia;
+		sc->ethercom.ec_ifmedia = ifm;
+		ifmedia_init(ifm, IFM_IMASK, bge_ifmedia_upd,
 		bge_ifmedia_sts);
-		ifmedia_add(>bge_ifmedia, IFM_ETHER |IFM_1000_SX, 0, NULL);
-		ifmedia_add(>bge_ifmedia, IFM_ETHER | IFM_1000_SX |IFM_FDX,
-			0, NULL);
-		ifmedia_add(>bge_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
-		ifmedia_set(>bge_ifmedia, IFM_ETHER | IFM_AUTO);
+		ifmedia_add(ifm, IFM_ETHER | IFM_1000_SX, 0, NULL);
+		ifmedia_add(ifm, IFM_ETHER | IFM_1000_SX | IFM_FDX, 0, NULL);
+		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
+		ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
 		/* Pretend the user requested this setting */
 		sc->bge_ifmedia.ifm_media = sc->bge_ifmedia.ifm_cur->ifm_media;
 	} else {



CVS commit: src/sys/dev/pci

2022-09-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep  4 08:42:02 UTC 2022

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
bge(4): use a local variable to make bge_ifmedia initialization pretty.

NFC


To generate a diff of this commit:
cvs rdiff -u -r1.384 -r1.385 src/sys/dev/pci/if_bge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.