CVS commit: src/sys/netipsec

2020-01-30 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Jan 31 06:54:19 UTC 2020

Modified Files:
src/sys/netipsec: ipsecif.c

Log Message:
Fix IPv6 over IPv4 ipsecif(4) uses IPv4 SP wrongly.  Pointed out by ohishi@IIJ.

XXX pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/netipsec/ipsecif.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/netipsec/ipsecif.c
diff -u src/sys/netipsec/ipsecif.c:1.18 src/sys/netipsec/ipsecif.c:1.19
--- src/sys/netipsec/ipsecif.c:1.18	Fri Nov  1 04:28:14 2019
+++ src/sys/netipsec/ipsecif.c	Fri Jan 31 06:54:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsecif.c,v 1.18 2019/11/01 04:28:14 knakahara Exp $  */
+/*	$NetBSD: ipsecif.c,v 1.19 2020/01/31 06:54:19 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.18 2019/11/01 04:28:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.19 2020/01/31 06:54:19 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -380,7 +380,17 @@ ipsecif4_output(struct ipsec_variant *va
 	KASSERT(var->iv_psrc->sa_family == AF_INET);
 	KASSERT(var->iv_pdst->sa_family == AF_INET);
 
-	sp = IV_SP_OUT(var);
+	switch (family) {
+	case AF_INET:
+		sp = IV_SP_OUT(var);
+		break;
+	case AF_INET6:
+		sp = IV_SP_OUT6(var);
+		break;
+	default:
+		m_freem(m);
+		return EAFNOSUPPORT;
+	}
 	KASSERT(sp != NULL);
 	/*
 	 * The SPs in ipsec_variant are prevented from freed by



CVS commit: src/sys/arch/sparc64/doc

2020-01-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 31 06:05:00 UTC 2020

Added Files:
src/sys/arch/sparc64/doc: SunFire_v210.txt

Log Message:
document what I found out about the v210's i2c GPIOs.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/doc/SunFire_v210.txt

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

Added files:

Index: src/sys/arch/sparc64/doc/SunFire_v210.txt
diff -u /dev/null src/sys/arch/sparc64/doc/SunFire_v210.txt:1.1
--- /dev/null	Fri Jan 31 06:05:00 2020
+++ src/sys/arch/sparc64/doc/SunFire_v210.txt	Fri Jan 31 06:05:00 2020
@@ -0,0 +1,47 @@
+This is about the i2c GPIO chips found in the Sun Fire v210, starting at
+/pci/isa@7/i2c@0,320/gpio@0,44
+Input/Output assignments and levels are what the firmware leaves us with -
+all LEDs off except the power one.
+
+All known pin functions were determined by experiment. No idea what the
+undocumented pins do, if anything.
+
+[ 1.00] pcagpio0 at iic0 addr 0x22: PCA9555
+[ 1.00] dir: I-II
+[ 1.00] lvl: X   XXX 
+[ 1.00] dir: -O--
+[ 1.00] lvl:  X  
+  ^
+0x0400 clears when the case is open
+
+[ 1.00] pcagpio1 at iic0 addr 0x23: PCA9555
+[ 1.00] dir: --II
+[ 1.00] lvl:     
+[ 1.00] dir: OO--
+[ 1.00] lvl: XX  
+Bit 0x0002 gets set when bay 1 is empty, I would assume 0x0001 is for bay 0.
+The output bits seem to control the drive bay LEDs
+0x2000 - bay 1, blue LED
+0x1000 - bay 0, blue LED
+0x0800 - bay 1, both LEDs orange
+0x0400 - bay 0, both LEDs orange
+all low active, the remaining outputs don't seem to do anything.
+
+[ 1.00] pcagpio2 at iic0 addr 0x34: PCA9555
+[ 1.00] dir: --II
+[ 1.00] lvl:   X 
+[ 1.00] dir: OO--
+[ 1.00] lvl: XX  
+clearing 0x0300 reset the machine
+probably controls redundant / hot-swappable power supplies on v240.
+
+[ 1.00] pcagpio3 at iic0 addr 0x38: PCA9556
+[ 1.00] dir: 
+[ 1.00] lvl: 
+[ 1.00] dir: 
+[ 1.00] lvl: XXX 
+This controls the front panel LEDs
+0x80 - indicator LED
+0x20 - fault LED
+0x10 - power LED
+all low active, the remaining outputs don't seem to do anything.



CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jan 31 03:30:37 UTC 2020

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

Log Message:
Revert r1.32 because some documents say that the device supports SFP+ SX/LX

I referred the document #332191-024 "Intel Ethernet Controller
X710/XXV710/XL710 Feature Support Matrix"

pointed out by msaitoh@, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.33 src/sys/dev/pci/if_ixl.c:1.34
--- src/sys/dev/pci/if_ixl.c:1.33	Fri Jan 31 02:25:06 2020
+++ src/sys/dev/pci/if_ixl.c	Fri Jan 31 03:30:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.33 2020/01/31 02:25:06 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.34 2020/01/31 03:30:37 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -931,6 +931,8 @@ static const struct ixl_phy_type ixl_phy
 	{ 1ULL << IXL_PHY_TYPE_10GBASE_SFPP_CU,	IFM_10G_TWINAX },
 	{ 1ULL << IXL_PHY_TYPE_40GBASE_SR4,	IFM_40G_SR4 },
 	{ 1ULL << IXL_PHY_TYPE_40GBASE_LR4,	IFM_40G_LR4 },
+	{ 1ULL << IXL_PHY_TYPE_1000BASE_SX,	IFM_1000_SX },
+	{ 1ULL << IXL_PHY_TYPE_1000BASE_LX,	IFM_1000_LX },
 	{ 1ULL << IXL_PHY_TYPE_20GBASE_KR2,	IFM_20G_KR2 },
 	{ 1ULL << IXL_PHY_TYPE_25GBASE_KR,	IFM_25G_KR },
 	{ 1ULL << IXL_PHY_TYPE_25GBASE_CR,	IFM_25G_CR },



CVS commit: src/lib/libpthread

2020-01-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 31 02:37:47 UTC 2020

Modified Files:
src/lib/libpthread: pthread_mutex.c

Log Message:
In the same spirit as the previous pthread_mutex_init change for jemalloc,
make pthread_mutexattr_init do always a full initialization, so that the
attribute that will be used later when we become threaded is properly
initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/lib/libpthread/pthread_mutex.c

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

Modified files:

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.70 src/lib/libpthread/pthread_mutex.c:1.71
--- src/lib/libpthread/pthread_mutex.c:1.70	Wed Jan 29 16:11:24 2020
+++ src/lib/libpthread/pthread_mutex.c	Thu Jan 30 21:37:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.70 2020/01/29 21:11:24 kamil Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.71 2020/01/31 02:37:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_mutex.c,v 1.70 2020/01/29 21:11:24 kamil Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.71 2020/01/31 02:37:46 christos Exp $");
 
 #include 
 #include 
@@ -616,8 +616,10 @@ pthread__mutex_wakeup(pthread_t self, pt
 int
 pthread_mutexattr_init(pthread_mutexattr_t *attr)
 {
+#if 0
 	if (__predict_false(__uselibcstub))
 		return __libc_mutexattr_init_stub(attr);
+#endif
 
 	attr->ptma_magic = _PT_MUTEXATTR_MAGIC;
 	attr->ptma_private = (void *)PTHREAD_MUTEX_DEFAULT;



CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jan 31 02:25:06 UTC 2020

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

Log Message:
Fix missing kpreempt_disabe()


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.32 src/sys/dev/pci/if_ixl.c:1.33
--- src/sys/dev/pci/if_ixl.c:1.32	Fri Jan 31 02:21:17 2020
+++ src/sys/dev/pci/if_ixl.c	Fri Jan 31 02:25:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.32 2020/01/31 02:21:17 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.33 2020/01/31 02:25:06 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -2970,7 +2970,9 @@ ixl_transmit(struct ifnet *ifp, struct m
 		ixl_tx_common_locked(ifp, txr, true);
 		mutex_exit(>txr_lock);
 	} else {
+		kpreempt_disable();
 		softint_schedule(txr->txr_si);
+		kpreempt_enable();
 	}
 
 	return 0;



CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jan 31 02:21:17 UTC 2020

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

Log Message:
Remove unsupported media on ixl(4)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.31 src/sys/dev/pci/if_ixl.c:1.32
--- src/sys/dev/pci/if_ixl.c:1.31	Fri Jan 31 02:16:26 2020
+++ src/sys/dev/pci/if_ixl.c	Fri Jan 31 02:21:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.31 2020/01/31 02:16:26 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.32 2020/01/31 02:21:17 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -931,8 +931,6 @@ static const struct ixl_phy_type ixl_phy
 	{ 1ULL << IXL_PHY_TYPE_10GBASE_SFPP_CU,	IFM_10G_TWINAX },
 	{ 1ULL << IXL_PHY_TYPE_40GBASE_SR4,	IFM_40G_SR4 },
 	{ 1ULL << IXL_PHY_TYPE_40GBASE_LR4,	IFM_40G_LR4 },
-	{ 1ULL << IXL_PHY_TYPE_1000BASE_SX,	IFM_1000_SX },
-	{ 1ULL << IXL_PHY_TYPE_1000BASE_LX,	IFM_1000_LX },
 	{ 1ULL << IXL_PHY_TYPE_20GBASE_KR2,	IFM_20G_KR2 },
 	{ 1ULL << IXL_PHY_TYPE_25GBASE_KR,	IFM_25G_KR },
 	{ 1ULL << IXL_PHY_TYPE_25GBASE_CR,	IFM_25G_CR },



CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jan 31 02:16:26 UTC 2020

Modified Files:
src/sys/dev/pci: if_ixl.c if_ixlvar.h

Log Message:
Add media and flow changes support for ixl(4)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_ixl.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_ixlvar.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.30 src/sys/dev/pci/if_ixl.c:1.31
--- src/sys/dev/pci/if_ixl.c:1.30	Fri Jan 31 02:11:06 2020
+++ src/sys/dev/pci/if_ixl.c	Fri Jan 31 02:16:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.30 2020/01/31 02:11:06 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.31 2020/01/31 02:16:26 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -634,6 +634,13 @@ struct ixl_softc {
 	struct ifmedia		 sc_media;
 	uint64_t		 sc_media_status;
 	uint64_t		 sc_media_active;
+	uint64_t		 sc_phy_types;
+	uint8_t			 sc_phy_abilities;
+	uint8_t			 sc_phy_linkspeed;
+	uint8_t			 sc_phy_fec_cfg;
+	uint16_t		 sc_eee_cap;
+	uint32_t		 sc_eeer_val;
+	uint8_t			 sc_d3_lpan;
 	kmutex_t		 sc_cfg_lock;
 	enum i40e_mac_type	 sc_mac_type;
 	uint32_t		 sc_rss_table_size;
@@ -786,7 +793,9 @@ static int	ixl_lldp_shut(struct ixl_soft
 static int	ixl_get_mac(struct ixl_softc *);
 static int	ixl_get_switch_config(struct ixl_softc *);
 static int	ixl_phy_mask_ints(struct ixl_softc *);
-static int	ixl_get_phy_types(struct ixl_softc *, uint64_t *);
+static int	ixl_get_phy_info(struct ixl_softc *);
+static int	ixl_set_phy_config(struct ixl_softc *, uint8_t, uint8_t, bool);
+static int	ixl_set_phy_autoselect(struct ixl_softc *);
 static int	ixl_restart_an(struct ixl_softc *);
 static int	ixl_hmc(struct ixl_softc *);
 static void	ixl_hmc_free(struct ixl_softc *);
@@ -797,6 +806,8 @@ static void	ixl_get_link_status(void *);
 static int	ixl_get_link_status_poll(struct ixl_softc *);
 static int	ixl_set_link_status(struct ixl_softc *,
 		const struct ixl_aq_desc *);
+static uint64_t	ixl_search_link_speed(uint8_t);
+static uint8_t	ixl_search_baudrate(uint64_t);
 static void	ixl_config_rss(struct ixl_softc *);
 static int	ixl_add_macvlan(struct ixl_softc *, const uint8_t *,
 		uint16_t, uint16_t);
@@ -813,7 +824,7 @@ static int	ixl_match(device_t, cfdata_t,
 static void	ixl_attach(device_t, device_t, void *);
 static int	ixl_detach(device_t, int);
 
-static void	ixl_media_add(struct ixl_softc *, uint64_t);
+static void	ixl_media_add(struct ixl_softc *);
 static int	ixl_media_change(struct ifnet *);
 static void	ixl_media_status(struct ifnet *, struct ifmediareq *);
 static void	ixl_watchdog(struct ifnet *);
@@ -1081,7 +1092,6 @@ ixl_attach(device_t parent, device_t sel
 	struct ifnet *ifp;
 	pcireg_t memtype;
 	uint32_t firstq, port, ari, func;
-	uint64_t phy_types = 0;
 	char xnamebuf[32];
 	int tries, rv;
 
@@ -1280,8 +1290,8 @@ ixl_attach(device_t parent, device_t sel
 		goto free_hmc;
 	}
 
-	if (ixl_get_phy_types(sc, _types) != 0) {
-		/* error printed by ixl_get_phy_abilities */
+	if (ixl_get_phy_info(sc) != 0) {
+		/* error printed by ixl_get_phy_info */
 		goto free_hmc;
 	}
 
@@ -1380,8 +1390,14 @@ ixl_attach(device_t parent, device_t sel
 	ifmedia_init(>sc_media, IFM_IMASK, ixl_media_change,
 	ixl_media_status);
 
-	ixl_media_add(sc, phy_types);
+	ixl_media_add(sc);
 	ifmedia_add(>sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
+	if (ISSET(sc->sc_phy_abilities,
+	(IXL_PHY_ABILITY_PAUSE_TX | IXL_PHY_ABILITY_PAUSE_RX))) {
+		ifmedia_add(>sc_media,
+		IFM_ETHER | IFM_AUTO | IFM_FLOW, 0, NULL);
+	}
+	ifmedia_add(>sc_media, IFM_ETHER | IFM_NONE, 0, NULL);
 	ifmedia_set(>sc_media, IFM_ETHER | IFM_AUTO);
 
 	if_attach(ifp);
@@ -1395,6 +1411,8 @@ ixl_attach(device_t parent, device_t sel
 	ixl_config_other_intr(sc);
 	ixl_enable_other_intr(sc);
 
+	ixl_set_phy_autoselect(sc);
+
 	/* remove default mac filter and replace it so we can see vlans */
 	rv = ixl_remove_macvlan(sc, sc->sc_enaddr, 0, 0);
 	if (rv != ENOENT) {
@@ -1614,21 +1632,41 @@ ixl_vlan_cb(struct ethercom *ec, uint16_
 }
 
 static void
-ixl_media_add(struct ixl_softc *sc, uint64_t phy_types)
+ixl_media_add(struct ixl_softc *sc)
 {
 	struct ifmedia *ifm = >sc_media;
 	const struct ixl_phy_type *itype;
 	unsigned int i;
+	bool flow;
+
+	if (ISSET(sc->sc_phy_abilities,
+	(IXL_PHY_ABILITY_PAUSE_TX | IXL_PHY_ABILITY_PAUSE_RX))) {
+		flow = true;
+	} else {
+		flow = false;
+	}
 
 	for (i = 0; i < __arraycount(ixl_phy_type_map); i++) {
 		itype = _phy_type_map[i];
 
-		if (ISSET(phy_types, itype->phy_type)) {
+		if (ISSET(sc->sc_phy_types, itype->phy_type)) {
 			ifmedia_add(ifm,
 			IFM_ETHER | IFM_FDX | itype->ifm_type, 0, NULL);
 
-			if (itype->ifm_type == IFM_100_TX) {
-ifmedia_add(ifm, IFM_ETHER | itype->ifm_type,
+			if (flow) {
+ifmedia_add(ifm,
+IFM_ETHER | IFM_FDX | IFM_FLOW |
+

CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Jan 31 02:11:06 UTC 2020

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

Log Message:
Fix a wrong return code from ixl_get_phy_types()


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.29 src/sys/dev/pci/if_ixl.c:1.30
--- src/sys/dev/pci/if_ixl.c:1.29	Thu Jan 30 09:53:49 2020
+++ src/sys/dev/pci/if_ixl.c	Fri Jan 31 02:11:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.29 2020/01/30 09:53:49 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.30 2020/01/31 02:11:06 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -4314,7 +4314,7 @@ ixl_get_phy_types(struct ixl_softc *sc, 
 		break;
 	case IXL_AQ_RC_EIO:
 		aprint_error_dev(sc->sc_dev,"unable to query phy types\n");
-		break;
+		goto done;
 	default:
 		aprint_error_dev(sc->sc_dev,
 		"GET PHY ABILITIIES error %u\n", rv);



CVS commit: src/sys/net

2020-01-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jan 31 00:49:18 UTC 2020

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

Log Message:
- Use kmem(9) instead of malloc(9).
- When handling SIOCGIFMEDIA, don't traverse the media list directly;
  refactor that out into a ifmedia_getwords() function.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/net/if_media.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_media.c
diff -u src/sys/net/if_media.c:1.49 src/sys/net/if_media.c:1.50
--- src/sys/net/if_media.c:1.49	Mon Jan 20 19:35:39 2020
+++ src/sys/net/if_media.c	Fri Jan 31 00:49:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.c,v 1.49 2020/01/20 19:35:39 thorpej Exp $	*/
+/*	$NetBSD: if_media.c,v 1.50 2020/01/31 00:49:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,14 +76,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.49 2020/01/20 19:35:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.50 2020/01/31 00:49:18 thorpej Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -106,8 +106,6 @@ int	ifmedia_debug = 0;
 static	void ifmedia_printword(int);
 #endif
 
-MALLOC_DEFINE(M_IFMEDIA, "ifmedia", "interface media state");
-
 /*
  * Initialize if_media struct for a specific interface instance.
  */
@@ -162,7 +160,7 @@ ifmedia_add(struct ifmedia *ifm, int mwo
 	}
 #endif
 
-	entry = malloc(sizeof(*entry), M_IFMEDIA, M_WAITOK);
+	entry = kmem_zalloc(sizeof(*entry), KM_SLEEP);
 	entry->ifm_media = mword;
 	entry->ifm_data = data;
 	entry->ifm_aux = aux;
@@ -235,6 +233,22 @@ ifmedia_set(struct ifmedia *ifm, int tar
 #endif
 }
 
+static int
+ifmedia_getwords(struct ifmedia * const ifm, int *words, int maxwords)
+{
+	struct ifmedia_entry *ep;
+	int nwords = 0;
+
+	TAILQ_FOREACH(ep, >ifm_list, ifm_list) {
+		if (words != NULL && nwords < maxwords) {
+			words[nwords] = ep->ifm_media;
+		}
+		nwords++;
+	}
+
+	return nwords;
+}
+
 /*
  * Device-independent media ioctl support function.
  */
@@ -304,8 +318,7 @@ ifmedia_ioctl_locked(struct ifnet *ifp, 
 	/* Get list of available media and current media on interface. */
 	case SIOCGIFMEDIA:
 	{
-		struct ifmedia_entry *ep;
-		size_t nwords;
+		int nwords1, nwords2;
 
 		if (ifmr->ifm_count < 0)
 			return EINVAL;
@@ -320,31 +333,22 @@ ifmedia_ioctl_locked(struct ifnet *ifp, 
 		 * Count them so we know a-priori how much is the max we'll
 		 * need.
 		 */
-		ep = TAILQ_FIRST(>ifm_list);
-		for (nwords = 0; ep != NULL; ep = TAILQ_NEXT(ep, ifm_list))
-			nwords++;
+		nwords1 = nwords2 = ifmedia_getwords(ifm, NULL, 0);
 
 		if (ifmr->ifm_count != 0) {
-			size_t count;
-			size_t minwords = nwords > (size_t)ifmr->ifm_count
-			? (size_t)ifmr->ifm_count : nwords;
-			int *kptr = malloc(minwords * sizeof(int), M_TEMP,
-			M_WAITOK);
-
-			/* Get the media words from the interface's list. */
-			ep = TAILQ_FIRST(>ifm_list);
-			for (count = 0; ep != NULL && count < minwords;
-			ep = TAILQ_NEXT(ep, ifm_list), count++)
-kptr[count] = ep->ifm_media;
+			int maxwords = MIN(nwords1, ifmr->ifm_count);
+			int *kptr = kmem_zalloc(maxwords * sizeof(int),
+			KM_SLEEP);
 
+			nwords2 = ifmedia_getwords(ifm, kptr, maxwords);
 			error = copyout(kptr, ifmr->ifm_ulist,
-			minwords * sizeof(int));
-			if (error == 0 && ep != NULL)
+			maxwords * sizeof(int));
+			if (error == 0 && nwords2 > nwords1)
 error = E2BIG;	/* oops! */
-			free(kptr, M_TEMP);
+			kmem_free(kptr, maxwords * sizeof(int));
 		}
 		/* Update with the real number */
-		ifmr->ifm_count = nwords;
+		ifmr->ifm_count = nwords2;
 		break;
 	}
 
@@ -420,7 +424,7 @@ ifmedia_delete_instance(struct ifmedia *
 		if (inst == IFM_INST_ANY ||
 		inst == IFM_INST(ife->ifm_media)) {
 			TAILQ_REMOVE(>ifm_list, ife, ifm_list);
-			free(ife, M_IFMEDIA);
+			kmem_free(ife, sizeof(*ife));
 		}
 	}
 	if (inst == IFM_INST_ANY) {



CVS commit: src/share/man/man4/man4.sparc

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Jan 31 00:24:51 UTC 2020

Modified Files:
src/share/man/man4/man4.sparc: audioamd.4

Log Message:
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/man4.sparc/audioamd.4

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

Modified files:

Index: src/share/man/man4/man4.sparc/audioamd.4
diff -u src/share/man/man4/man4.sparc/audioamd.4:1.5 src/share/man/man4/man4.sparc/audioamd.4:1.6
--- src/share/man/man4/man4.sparc/audioamd.4:1.5	Wed Apr 30 13:10:56 2008
+++ src/share/man/man4/man4.sparc/audioamd.4	Fri Jan 31 00:24:51 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: audioamd.4,v 1.5 2008/04/30 13:10:56 martin Exp $
+.\" $NetBSD: audioamd.4,v 1.6 2020/01/31 00:24:51 sevan Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 4, 2000
+.Dd January 31, 2020
 .Dt AUDIOAMD 4 sparc
 .Os
 .Sh NAME
@@ -38,10 +38,10 @@
 .Sh DESCRIPTION
 The
 .Nm
-driver provides support for the baseboard audio found on
-sun4c and sun4m systems.  The baseboard audio driver is based on the
-AMD 79c30 ISDN and audio interface.  The interface is only capable of
-playing and recording 8kHz mu-law audio.
+driver provides support for the baseboard audio found on sun4c and sun4m
+systems.
+The baseboard audio driver is based on the AMD 79c30 ISDN and audio interface.
+The interface is only capable of playing and recording 8kHz mu-law audio.
 .Sh SEE ALSO
 .Xr audio 4 ,
 .Xr sbus 4



CVS commit: src/usr.bin/audio/record

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Jan 31 00:21:53 UTC 2020

Modified Files:
src/usr.bin/audio/record: audiorecord.1

Log Message:
audioamd is in the SPARC port


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/audio/record/audiorecord.1

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/audio/record/audiorecord.1
diff -u src/usr.bin/audio/record/audiorecord.1:1.42 src/usr.bin/audio/record/audiorecord.1:1.43
--- src/usr.bin/audio/record/audiorecord.1:1.42	Tue Mar 18 18:20:44 2014
+++ src/usr.bin/audio/record/audiorecord.1	Fri Jan 31 00:21:53 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audiorecord.1,v 1.42 2014/03/18 18:20:44 riastradh Exp $
+.\"	$NetBSD: audiorecord.1,v 1.43 2020/01/31 00:21:53 sevan Exp $
 .\"
 .\" Copyright (c) 1998, 1999, 2001, 2002, 2010 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 30, 2010
+.Dd January 31, 2020
 .Dt AUDIORECORD 1
 .Os
 .Sh NAME
@@ -186,7 +186,6 @@ the audio device to be used.
 .Xr audioplay 1 ,
 .Xr aria 4 ,
 .Xr audio 4 ,
-.Xr audioamd 4 ,
 .Xr auich 4 ,
 .Xr autri 4 ,
 .Xr auvia 4 ,
@@ -203,6 +202,7 @@ the audio device to be used.
 .Xr guspnp 4 ,
 .Xr neo 4 ,
 .Xr sb 4 ,
+.Xr sparc/audioamd 4 ,
 .Xr sv 4 ,
 .Xr wss 4 ,
 .Xr yds 4 ,



CVS commit: src/usr.bin/asa

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Jan 31 00:15:38 UTC 2020

Modified Files:
src/usr.bin/asa: asa.1

Log Message:
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/asa/asa.1

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/asa/asa.1
diff -u src/usr.bin/asa/asa.1:1.14 src/usr.bin/asa/asa.1:1.15
--- src/usr.bin/asa/asa.1:1.14	Mon Jul  3 21:34:18 2017
+++ src/usr.bin/asa/asa.1	Fri Jan 31 00:15:38 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: asa.1,v 1.14 2017/07/03 21:34:18 wiz Exp $
+.\"	$NetBSD: asa.1,v 1.15 2020/01/31 00:15:38 sevan Exp $
 .\"
 .\" Copyright (c) 1993 Winning Strategies, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 2, 2016
+.Dd January 31, 2020
 .Dt ASA 1
 .Os
 .Sh NAME
@@ -46,7 +46,8 @@ carriage-control characters to line-prin
 and writes them to the standard output.
 .Pp
 The first character of each line is interpreted as a carriage-control
-character.  The following characters are interpreted as follows:
+character.
+The following characters are interpreted as follows:
 .Bl -tag -width ""
 .It 
 Output the rest of the line without change.



CVS commit: src/usr.bin/finger

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jan 30 23:59:59 UTC 2020

Modified Files:
src/usr.bin/finger: finger.1

Log Message:
finish with a full stop


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/finger/finger.1

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/finger/finger.1
diff -u src/usr.bin/finger/finger.1:1.20 src/usr.bin/finger/finger.1:1.21
--- src/usr.bin/finger/finger.1:1.20	Thu Jan 30 23:50:23 2020
+++ src/usr.bin/finger/finger.1	Thu Jan 30 23:59:59 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: finger.1,v 1.20 2020/01/30 23:50:23 sevan Exp $
+.\"	$NetBSD: finger.1,v 1.21 2020/01/30 23:59:59 sevan Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -212,4 +212,4 @@ last login data base
 The
 .Nm
 command appeared in
-.Bx 2.0
+.Bx 2.0 .



CVS commit: src/usr.bin/finger

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jan 30 23:50:23 UTC 2020

Modified Files:
src/usr.bin/finger: finger.1

Log Message:
Drop url which is now invalid, see CSRG archive or mirrors on TUHS.org or
svnweb.FreeBSD.org


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/finger/finger.1

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/finger/finger.1
diff -u src/usr.bin/finger/finger.1:1.19 src/usr.bin/finger/finger.1:1.20
--- src/usr.bin/finger/finger.1:1.19	Thu Dec 22 12:39:40 2016
+++ src/usr.bin/finger/finger.1	Thu Jan 30 23:50:23 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: finger.1,v 1.19 2016/12/22 12:39:40 abhinav Exp $
+.\"	$NetBSD: finger.1,v 1.20 2020/01/30 23:50:23 sevan Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)finger.1	8.3 (Berkeley) 5/5/94
 .\"
-.Dd December 25, 2014
+.Dd January 30, 2020
 .Dt FINGER 1
 .Os
 .Sh NAME
@@ -212,5 +212,4 @@ last login data base
 The
 .Nm
 command appeared in
-.Bx 2.0 :
-.Lk ftp://ftp.tuhs.org.ua/PDP-11/Distributions/ucb/2bsd.tar.gz
+.Bx 2.0



CVS commit: src/share/misc

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jan 30 23:47:45 UTC 2020

Modified Files:
src/share/misc: acronyms

Log Message:
Typo - heads up by Thorsten Glaser


To generate a diff of this commit:
cvs rdiff -u -r1.295 -r1.296 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.295 src/share/misc/acronyms:1.296
--- src/share/misc/acronyms:1.295	Mon Jan 27 10:56:29 2020
+++ src/share/misc/acronyms	Thu Jan 30 23:47:45 2020
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.295 2020/01/27 10:56:29 nia Exp $
+$NetBSD: acronyms,v 1.296 2020/01/30 23:47:45 sevan Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -44,7 +44,7 @@ ATEOTD	at the end of the day
 ATM	at the moment
 ATM	{automated,automatic} teller machine
 ATW	around the world
-AVB	alcohol by volume
+ABV	alcohol by volume
 AVI	automatic vehicle identification
 AWK	Aho, Weinberger, [and] Kernighan
 AWOL	absent without official leave



CVS commit: src/usr.bin/calendar/calendars

2020-01-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jan 30 23:46:21 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Doug Engelbart


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.36 src/usr.bin/calendar/calendars/calendar.birthday:1.37
--- src/usr.bin/calendar/calendars/calendar.birthday:1.36	Wed Jan 22 21:07:56 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Thu Jan 30 23:46:21 2020
@@ -35,6 +35,7 @@
 01/25	Virginia Woolf born, 1882
 01/25	W. Somerset Maugham born, 1874
 01/27	Samuel Gompers born, 1850
+01/30	Douglas Carl Engelbart was born in Portland, Oregon, 1925
 01/30	Franklin Delano Roosevelt born in Hyde Park, New York, 1882
 01/31	Jackie Robinson born, 1919
 02/01	Terence Graham Parry Jones was born in Colwyn Bay, Denbighshire, Wales, 1942
@@ -164,6 +165,7 @@
 06/25	Eric Arthur Blair (a.k.a. George Orwell) born, 1903
 06/27	Helen Keller born, 1880
 07/01	Fernando Jose Corbato was born in Oakland, California, 1926
+07/02	Douglas Carl Engelbart died in Atherton, California, 2013
 07/03	Franz Kafka born, 1883
 07/04	John Adams and Thomas Jefferson die on same day, 1826
 07/04	Nathaniel Hawthorne born in Salem, Massachusetts, 1804



CVS commit: src/external/gpl3/gdb/dist/gdb

2020-01-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 30 20:38:12 UTC 2020

Modified Files:
src/external/gpl3/gdb/dist/gdb: solib.c

Log Message:
Don't implicitly cast away const char * when using correct C++ string.h
implementations. Those have overloaded string operations that preserve
constness.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gdb/dist/gdb/solib.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/solib.c
diff -u src/external/gpl3/gdb/dist/gdb/solib.c:1.8 src/external/gpl3/gdb/dist/gdb/solib.c:1.9
--- src/external/gpl3/gdb/dist/gdb/solib.c:1.8	Fri Nov 22 01:48:50 2019
+++ src/external/gpl3/gdb/dist/gdb/solib.c	Thu Jan 30 20:38:12 2020
@@ -509,7 +509,7 @@ solib_bfd_open (const char *pathname)
   if (!b->compatible (b, bfd_get_arch_info (abfd.get (
 {
   char buf[SO_NAME_MAX_PATH_SIZE];
-  char *slash = strrchr(pathname, '/');
+  const char *slash = strrchr(pathname, '/');
   if (slash)
 {
   struct stat st;



CVS commit: src/lib/libm/src

2020-01-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 30 20:31:50 UTC 2020

Modified Files:
src/lib/libm/src: s_frexp.c

Log Message:
Provide frexpl on non-long-double systems as alias to frexp.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libm/src/s_frexp.c

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

Modified files:

Index: src/lib/libm/src/s_frexp.c
diff -u src/lib/libm/src/s_frexp.c:1.13 src/lib/libm/src/s_frexp.c:1.14
--- src/lib/libm/src/s_frexp.c:1.13	Sun Sep 28 18:54:55 2008
+++ src/lib/libm/src/s_frexp.c	Thu Jan 30 20:31:50 2020
@@ -12,7 +12,7 @@
 
 #include 
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_frexp.c,v 1.13 2008/09/28 18:54:55 christos Exp $");
+__RCSID("$NetBSD: s_frexp.c,v 1.14 2020/01/30 20:31:50 joerg Exp $");
 #endif
 
 /*
@@ -28,6 +28,10 @@ __RCSID("$NetBSD: s_frexp.c,v 1.13 2008/
 #include "math.h"
 #include "math_private.h"
 
+#ifndef __HAVE_LONG_DOUBLE
+__strong_alias(frexpl, frexp)
+#endif
+
 static const double
 two54 =  1.8014398509481984e+16; /* 0x4350, 0x */
 



CVS commit: src/sys/compat/common

2020-01-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 14:07:40 UTC 2020

Modified Files:
src/sys/compat/common: kern_info_43.c

Log Message:
- make sure size is not used uninitialized
- limit size range
- fix type botch for "size"
from maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/common/kern_info_43.c

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

Modified files:

Index: src/sys/compat/common/kern_info_43.c
diff -u src/sys/compat/common/kern_info_43.c:1.38 src/sys/compat/common/kern_info_43.c:1.39
--- src/sys/compat/common/kern_info_43.c:1.38	Thu Jan  2 10:42:26 2020
+++ src/sys/compat/common/kern_info_43.c	Thu Jan 30 09:07:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_info_43.c,v 1.38 2020/01/02 15:42:26 thorpej Exp $	*/
+/*	$NetBSD: kern_info_43.c,v 1.39 2020/01/30 14:07:40 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.38 2020/01/02 15:42:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.39 2020/01/30 14:07:40 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -172,11 +172,19 @@ compat_43_sys_getkerninfo(struct lwp *l,
 		syscallarg(int) arg;
 	} */
 	int error, name[6];
+	int isize;
 	size_t size;
 
-	if (SCARG(uap, size) && (error = copyin((void *)SCARG(uap, size),
-	(void *), sizeof(size
-		return (error);
+	if (!SCARG(uap, size))
+		return EINVAL;
+
+	if ((error = copyin(SCARG(uap, size), , sizeof(isize))) != 0)
+		return error;
+
+	if (isize < 0 || isize > 4096)
+		return EINVAL;
+
+	size = isize;
 
 	switch (SCARG(uap, op) & 0xff00) {
 



CVS commit: src/sys/dev/pci

2020-01-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 14:02:14 UTC 2020

Modified Files:
src/sys/dev/pci: if_lii.c if_mcx.c if_vioif.c
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_lii.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_mcx.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/ixgbe/ix_txrx.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_lii.c
diff -u src/sys/dev/pci/if_lii.c:1.27 src/sys/dev/pci/if_lii.c:1.28
--- src/sys/dev/pci/if_lii.c:1.27	Wed Sep 18 00:09:42 2019
+++ src/sys/dev/pci/if_lii.c	Thu Jan 30 14:02:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lii.c,v 1.27 2019/09/18 00:09:42 msaitoh Exp $	*/
+/*	$NetBSD: if_lii.c,v 1.28 2020/01/30 14:02:14 thorpej Exp $	*/
 
 /*
  *  Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.27 2019/09/18 00:09:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.28 2020/01/30 14:02:14 thorpej Exp $");
 
 
 #include 
@@ -985,13 +985,13 @@ lii_rxintr(struct lii_softc *sc)
 		sc->sc_rxcur = (sc->sc_rxcur + 1) % AT_RXD_NUM;
 		rxp->rxp_update = 0;
 		if (!(rxp->rxp_flags & ATL2_RXF_SUCCESS)) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		size = rxp->rxp_size - ETHER_CRC_LEN;
@@ -999,7 +999,7 @@ lii_rxintr(struct lii_softc *sc)
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
 m_freem(m);
-++ifp->if_ierrors;
+if_statinc(ifp, if_ierrors);
 continue;
 			}
 		}
@@ -1049,9 +1049,9 @@ lii_txintr(struct lii_softc *sc)
 		sc->sc_txd_ack %= AT_TXD_BUFFER_SIZE;
 
 		if (txs->txps_flags & ATL2_TXF_SUCCESS)
-			++ifp->if_opackets;
+			if_statinc(ifp, if_opackets);
 		else
-			++ifp->if_oerrors;
+			if_statinc(ifp, if_oerrors);
 		ifp->if_flags &= ~IFF_OACTIVE;
 	}
 
@@ -1132,7 +1132,7 @@ lii_watchdog(struct ifnet *ifp)
 	struct lii_softc *sc = ifp->if_softc;
 
 	aprint_error_dev(sc->sc_dev, "watchdog timeout\n");
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	lii_init(ifp);
 }
 

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.9 src/sys/dev/pci/if_mcx.c:1.10
--- src/sys/dev/pci/if_mcx.c:1.9	Fri Nov 29 15:17:14 2019
+++ src/sys/dev/pci/if_mcx.c	Thu Jan 30 14:02:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.9 2019/11/29 15:17:14 msaitoh Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.10 2020/01/30 14:02:14 thorpej Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -6438,7 +6438,7 @@ mcx_start(struct ifnet *ifp)
 
 		if (mcx_load_mbuf(sc, ms, m) != 0) {
 			m_freem(m);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		bf = (uint64_t *)sqe;

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.51 src/sys/dev/pci/if_vioif.c:1.52
--- src/sys/dev/pci/if_vioif.c:1.51	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/pci/if_vioif.c	Thu Jan 30 14:02:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.51 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.52 2020/01/30 14:02:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.51 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.52 2020/01/30 14:02:14 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1239,9 +1239,11 @@ vioif_transmit(struct ifnet *ifp, struct
 		return ENOBUFS;
 	}
 
-	ifp->if_obytes += m->m_pkthdr.len;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+	if_statadd_ref(nsr, if_obytes, m->m_pkthdr.len);
 	if (m->m_flags & M_MCAST)
-		ifp->if_omcasts++;
+		if_statinc_ref(nsr, if_omcasts);
+	IF_STAT_PUTREF(ifp);
 
 	if (mutex_tryenter(txq->txq_lock)) {
 		if (!txq->txq_stopping)
@@ -1570,7 +1572,7 @@ vioif_tx_vq_done_locked(struct virtqueue
 		bus_dmamap_unload(virtio_dmat(vsc), txq->txq_dmamaps[slot]);
 		txq->txq_mbufs[slot] = NULL;
 		virtio_dequeue_commit(vsc, vq, slot);
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		m_freem(m);
 	}
 

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.60 src/sys/dev/pci/ixgbe/ix_txrx.c:1.61
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.60	Tue Jan 21 14:55:55 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Jan 30 14:02:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.60 2020/01/21 14:55:55 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.61 2020/01/30 14:02:14 thorpej Exp $ */
 
 /**
 
@@ -540,12 +540,11 @@ retry:
 	++txr->total_packets.ev_count;
 	IXGBE_WRITE_REG(>hw, txr->tail, i);
 
-	/*
-	 *  

CVS commit: src/sys/dev/pci

2020-01-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 13:59:25 UTC 2020

Modified Files:
src/sys/dev/pci: if_age.c if_alc.c if_ale.c

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_ale.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_age.c
diff -u src/sys/dev/pci/if_age.c:1.65 src/sys/dev/pci/if_age.c:1.66
--- src/sys/dev/pci/if_age.c:1.65	Sun Dec  1 08:16:49 2019
+++ src/sys/dev/pci/if_age.c	Thu Jan 30 13:59:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.65 2019/12/01 08:16:49 msaitoh Exp $ */
+/*	$NetBSD: if_age.c,v 1.66 2020/01/30 13:59:24 thorpej Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.65 2019/12/01 08:16:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.66 2020/01/30 13:59:24 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -1079,7 +1079,7 @@ age_watchdog(struct ifnet *ifp)
 	if ((sc->age_flags & AGE_FLAG_LINK) == 0) {
 		printf("%s: watchdog timeout (missed link)\n",
 		device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		age_init(ifp);
 		return;
 	}
@@ -1092,7 +1092,7 @@ age_watchdog(struct ifnet *ifp)
 	}
 
 	printf("%s: watchdog timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	age_init(ifp);
 	age_start(ifp);
 }
@@ -1411,7 +1411,7 @@ age_rxeof(struct age_softc *sc, struct r
 		desc = rxd->rx_desc;
 		/* Add a new receive buffer to the ring. */
 		if (age_newbuf(sc, rxd, 0) != 0) {
-			ifp->if_iqdrops++;
+			if_statinc(ifp, if_iqdrops);
 			/* Reuse Rx buffers. */
 			if (sc->age_cdata.age_rxhead != NULL) {
 m_freem(sc->age_cdata.age_rxhead);
@@ -2033,20 +2033,27 @@ age_stats_update(struct age_softc *sc)
 	stat->tx_mcast_bytes += smb->tx_mcast_bytes;
 
 	/* Update counters in ifnet. */
-	ifp->if_opackets += smb->tx_frames;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 
-	ifp->if_collisions += smb->tx_single_colls +
+	if_statadd_ref(nsr, if_opackets, smb->tx_frames);
+
+	if_statadd_ref(nsr, if_collisions,
+	smb->tx_single_colls +
 	smb->tx_multi_colls + smb->tx_late_colls +
-	smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT;
+	smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT);
 
-	ifp->if_oerrors += smb->tx_excess_colls +
+	if_statadd_ref(nsr, if_oerrors,
+	smb->tx_excess_colls +
 	smb->tx_late_colls + smb->tx_underrun +
-	smb->tx_pkts_truncated;
+	smb->tx_pkts_truncated);
 
-	ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
+	if_statadd_ref(nsr, if_ierrors,
+	smb->rx_crcerrs + smb->rx_lenerrs +
 	smb->rx_runts + smb->rx_pkts_truncated +
 	smb->rx_fifo_oflows + smb->rx_desc_oflows +
-	smb->rx_alignerrs;
+	smb->rx_alignerrs);
+
+	IF_STAT_PUTREF(ifp);
 
 	/* Update done, clear. */
 	smb->updated = 0;

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.46 src/sys/dev/pci/if_alc.c:1.47
--- src/sys/dev/pci/if_alc.c:1.46	Wed Dec 18 13:25:00 2019
+++ src/sys/dev/pci/if_alc.c	Thu Jan 30 13:59:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_alc.c,v 1.46 2019/12/18 13:25:00 msaitoh Exp $	*/
+/*	$NetBSD: if_alc.c,v 1.47 2020/01/30 13:59:24 thorpej Exp $	*/
 /*	$OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $	*/
 /*-
  * Copyright (c) 2009, Pyun YongHyeon 
@@ -2059,13 +2059,13 @@ alc_watchdog(struct ifnet *ifp)
 	if ((sc->alc_flags & ALC_FLAG_LINK) == 0) {
 		printf("%s: watchdog timeout (missed link)\n",
 		device_xname(sc->sc_dev));
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		alc_init_backend(ifp, false);
 		return;
 	}
 
 	printf("%s: watchdog timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	alc_init_backend(ifp, false);
 	alc_start(ifp);
 }
@@ -2267,19 +2267,26 @@ alc_stats_update(struct alc_softc *sc)
 	stat->tx_mcast_bytes += smb->tx_mcast_bytes;
 
 	/* Update counters in ifnet. */
-	ifp->if_opackets += smb->tx_frames;
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 
-	ifp->if_collisions += smb->tx_single_colls +
+	if_statadd_ref(nsr, if_opackets, smb->tx_frames);
+
+	if_statadd_ref(nsr, if_collisions,
+	smb->tx_single_colls +
 	smb->tx_multi_colls * 2 + smb->tx_late_colls +
-	smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT;
+	smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT);
 
-	ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls +
-	smb->tx_underrun + smb->tx_pkts_truncated;
+	if_statadd_ref(nsr, if_oerrors,
+	smb->tx_late_colls + smb->tx_excess_colls +
+	smb->tx_underrun + smb->tx_pkts_truncated);
 
-	ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs +
+	if_statadd_ref(nsr, if_ierrors,
+	 

CVS commit: src/sys/dev/pci

2020-01-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 13:56:48 UTC 2020

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

Log Message:
Adopt .


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/if_bce.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_bce.c
diff -u src/sys/dev/pci/if_bce.c:1.56 src/sys/dev/pci/if_bce.c:1.57
--- src/sys/dev/pci/if_bce.c:1.56	Fri Oct 18 23:08:29 2019
+++ src/sys/dev/pci/if_bce.c	Thu Jan 30 13:56:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bce.c,v 1.56 2019/10/18 23:08:29 msaitoh Exp $	 */
+/* $NetBSD: if_bce.c,v 1.57 2020/01/30 13:56:48 thorpej Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.56 2019/10/18 23:08:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.57 2020/01/30 13:56:48 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -558,7 +558,7 @@ bce_start(struct ifnet *ifp)
 			"dropping...\n");
 			IFQ_DEQUEUE(>if_snd, m0);
 			m_freem(m0);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		} else if (error) {
 			/* short on resources, come back later */
@@ -654,7 +654,7 @@ bce_watchdog(struct ifnet *ifp)
 	struct bce_softc *sc = ifp->if_softc;
 
 	device_printf(sc->bce_dev, "device timeout\n");
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	(void) bce_init(ifp);
 
@@ -702,7 +702,7 @@ bce_intr(void *xsc)
 msg = "transmit fifo underflow";
 			if (intstatus & I_RO) {
 msg = "receive fifo overflow";
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 			}
 			if (intstatus & I_RU)
 msg = "receive descriptor underflow";
@@ -762,7 +762,7 @@ bce_rxintr(struct bce_softc *sc)
 		 */
 		pph = mtod(sc->bce_cdata.bce_rx_chain[i], struct rx_pph *);
 		if (pph->flags & (RXF_NO | RXF_RXER | RXF_CRC | RXF_OV)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			pph->len = 0;
 			pph->flags = 0;
 			continue;
@@ -805,7 +805,7 @@ bce_rxintr(struct bce_softc *sc)
 			m = sc->bce_cdata.bce_rx_chain[i];
 			if (bce_add_rxbuf(sc, i) != 0) {
 		dropit:
-ifp->if_ierrors++;
+if_statinc(ifp, if_ierrors);
 /* continue to use old buffer */
 sc->bce_cdata.bce_rx_chain[i]->m_data -= 30;
 bus_dmamap_sync(sc->bce_dmatag,
@@ -862,7 +862,7 @@ bce_txintr(struct bce_softc *sc)
 		bus_dmamap_unload(sc->bce_dmatag, sc->bce_cdata.bce_tx_map[i]);
 		m_freem(sc->bce_cdata.bce_tx_chain[i]);
 		sc->bce_cdata.bce_tx_chain[i] = NULL;
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 	}
 	sc->bce_txin = curr;
 



CVS commit: src/usr.sbin/postinstall

2020-01-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 30 13:54:05 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
change the autofs file to be user writable.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.13 src/usr.sbin/postinstall/postinstall.in:1.14
--- src/usr.sbin/postinstall/postinstall.in:1.13	Wed Jan 29 20:39:40 2020
+++ src/usr.sbin/postinstall/postinstall.in	Thu Jan 30 08:54:05 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.13 2020/01/30 01:39:40 christos Exp $
+# $NetBSD: postinstall.in,v 1.14 2020/01/30 13:54:05 christos Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1046,12 +1046,12 @@ special_null 
 	failed=$(( ${failed} + $? ))
 	populate_dir "$op" false "${SRC_DIR}/etc" \
 	"${DEST_DIR}/etc" \
-	444 \
+	644 \
 	auto_master
 	failed=$(( ${failed} + $? ))
 	populate_dir "$op" false "${SRC_DIR}/etc/autofs" \
 	"${DEST_DIR}/etc/autofs" \
-	444 \
+	644 \
 	${autofs_files}
 	return ${failed}
 }



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

2020-01-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 30 13:07:18 UTC 2020

Modified Files:
src/sys/arch/arm/xscale: ixp425-fw.README

Log Message:
Update the URL for IPL_ixp400NpeLibrary-2_4.zip.  Note the URL For
IPL_ixp400NpeLibraryWithCrypto-2_4.zip for reference purposes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/xscale/ixp425-fw.README

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/xscale/ixp425-fw.README
diff -u src/sys/arch/arm/xscale/ixp425-fw.README:1.4 src/sys/arch/arm/xscale/ixp425-fw.README:1.5
--- src/sys/arch/arm/xscale/ixp425-fw.README:1.4	Fri Feb 10 23:11:30 2017
+++ src/sys/arch/arm/xscale/ixp425-fw.README	Thu Jan 30 13:07:18 2020
@@ -1,4 +1,4 @@
-$NetBSD: ixp425-fw.README,v 1.4 2017/02/10 23:11:30 tnn Exp $
+$NetBSD: ixp425-fw.README,v 1.5 2020/01/30 13:07:18 thorpej Exp $
 
 IXP425 NPE Microcode
 
@@ -24,7 +24,7 @@ You must grab the NPE microcode from her
 SHA1 (IPL_ixp400NpeLibrary-3_0.zip) = dda6b27265e6db3dfec68361644197c0f311a07b
 
 or the older version which is archived here:
- https://downloads.openwrt.org/sources/IPL_ixp400NpeLibrary-2_4.zip
+ https://mirror2.openwrt.org/sources/IPL_ixp400NpeLibrary-2_4.zip
 
 SHA1 (IPL_ixp400NpeLibrary-2_4.zip) = abf1562e750e16e6f9baf9892a59640f863a693e
 
@@ -32,6 +32,11 @@ Select the "Download (without Crypto)" l
 section. Note that there is no benefit in selecting the "with Cypto"
 microcode at this time since NetBSD does not support it.
 
+For refrence, the "with Crypto" version is available here:
+  https://downloads.openwrt.org/sources/IPL_ixp400NpeLibraryWithCrypto-2_4.zip
+
+SHA1(IPL_ixp400NpeLibraryWithCrypto-2_4.zip)= 48beb80564fbbb7fb7861188cad26e896b5a5afc
+
 Note: At the time of writing (February 2017), the NPE Microcode is at
 version 3.0. However, the last known microcode version to work is 2.4.
 



CVS commit: src/sys/kern

2020-01-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Jan 30 12:36:38 UTC 2020

Modified Files:
src/sys/kern: sys_lwp.c

Log Message:
Update comments


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/sys_lwp.c

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

Modified files:

Index: src/sys/kern/sys_lwp.c
diff -u src/sys/kern/sys_lwp.c:1.74 src/sys/kern/sys_lwp.c:1.75
--- src/sys/kern/sys_lwp.c:1.74	Wed Jan 29 15:47:52 2020
+++ src/sys/kern/sys_lwp.c	Thu Jan 30 12:36:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_lwp.c,v 1.74 2020/01/29 15:47:52 ad Exp $	*/
+/*	$NetBSD: sys_lwp.c,v 1.75 2020/01/30 12:36:38 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.74 2020/01/29 15:47:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.75 2020/01/30 12:36:38 ad Exp $");
 
 #include 
 #include 
@@ -480,15 +480,21 @@ lwp_unpark(const lwpid_t *tp, const u_in
 			continue;
 		}
 
-		/* It may not have parked yet or we may have raced. */
 		lwp_lock(t);
 		if (t->l_syncobj == _park_syncobj) {
-			/* Releases the LWP lock. */
+			/*
+			 * As expected it's parked, so wake it up. 
+			 * lwp_unsleep() will release the LWP lock.
+			 */
 			lwp_unsleep(t, true);
 		} else {
 			/*
-			 * Set the operation pending.  The next call to
-			 * _lwp_park() will return early.
+			 * It hasn't parked yet because the wakeup side won
+			 * the race, or something else has happened to make
+			 * the thread not park.  Why doesn't really matter. 
+			 * Set the operation pending, so that the next call
+			 * to _lwp_park() in the LWP returns early.  If it
+			 * turns out to be a spurious wakeup, no harm done.
 			 */
 			t->l_flag |= LW_UNPARKED;
 			lwp_unlock(t);



CVS commit: src/sys/uvm

2020-01-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Jan 30 12:28:51 UTC 2020

Modified Files:
src/sys/uvm: uvm_pdpolicy_clock.c uvm_pdpolicy_clockpro.c

Log Message:
uvmpdpol_estimatepageable(): Don't take any locks here.  This can be called
from DDB, and in any case the numbers are stale the instant the lock is
dropped, so it just doesn't matter.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/uvm_pdpolicy_clockpro.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/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.31 src/sys/uvm/uvm_pdpolicy_clock.c:1.32
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.31	Tue Jan 21 20:37:06 2020
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Thu Jan 30 12:28:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.32 2020/01/30 12:28:51 ad Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*-
@@ -98,7 +98,7 @@
 #else /* defined(PDSIM) */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.32 2020/01/30 12:28:51 ad Exp $");
 
 #include 
 #include 
@@ -568,14 +568,17 @@ uvmpdpol_estimatepageable(int *active, i
 {
 	struct uvmpdpol_globalstate *s = _state;
 
-	mutex_enter(>lock);
+	/*
+	 * Don't take any locks here.  This can be called from DDB, and in
+	 * any case the numbers are stale the instant the lock is dropped,
+	 * so it just doesn't matter.
+	 */
 	if (active) {
-		*active = pdpol_state.s_active;
+		*active = s->s_active;
 	}
 	if (inactive) {
-		*inactive = pdpol_state.s_inactive;
+		*inactive = s->s_inactive;
 	}
-	mutex_exit(>lock);
 }
 
 #if !defined(PDSIM)

Index: src/sys/uvm/uvm_pdpolicy_clockpro.c
diff -u src/sys/uvm/uvm_pdpolicy_clockpro.c:1.22 src/sys/uvm/uvm_pdpolicy_clockpro.c:1.23
--- src/sys/uvm/uvm_pdpolicy_clockpro.c:1.22	Tue Dec 31 22:42:51 2019
+++ src/sys/uvm/uvm_pdpolicy_clockpro.c	Thu Jan 30 12:28:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clockpro.c,v 1.22 2019/12/31 22:42:51 ad Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clockpro.c,v 1.23 2020/01/30 12:28:51 ad Exp $	*/
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -43,7 +43,7 @@
 #else /* defined(PDSIM) */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.22 2019/12/31 22:42:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.23 2020/01/30 12:28:51 ad Exp $");
 
 #include "opt_ddb.h"
 
@@ -1286,14 +1286,17 @@ uvmpdpol_estimatepageable(int *active, i
 {
 	struct clockpro_state * const s = 
 
-	mutex_enter(>lock);
+	/*
+	 * Don't take any locks here.  This can be called from DDB, and in
+	 * any case the numbers are stale the instant the lock is dropped,
+	 * so it just doesn't matter.
+	 */
 	if (active) {
 		*active = s->s_npages - s->s_ncold;
 	}
 	if (inactive) {
 		*inactive = s->s_ncold;
 	}
-	mutex_exit(>lock);
 }
 
 bool



CVS commit: src/sys/dev/pci

2020-01-30 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Thu Jan 30 09:53:49 UTC 2020

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

Log Message:
Add SIOCSIFMTU support for ixl(4)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_ixl.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_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.28 src/sys/dev/pci/if_ixl.c:1.29
--- src/sys/dev/pci/if_ixl.c:1.28	Mon Jan 27 09:40:43 2020
+++ src/sys/dev/pci/if_ixl.c	Thu Jan 30 09:53:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.28 2020/01/27 09:40:43 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.29 2020/01/30 09:53:49 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -175,10 +175,20 @@ struct ixl_softc; /* defined */
 	I40E_PFINT_ICR0_PE_CRITERR_MASK)
 
 #define IXL_TX_PKT_DESCS		8
+#define IXL_TX_PKT_MAXSIZE		(MCLBYTES * IXL_TX_PKT_DESCS)
 #define IXL_TX_QUEUE_ALIGN		128
 #define IXL_RX_QUEUE_ALIGN		128
 
-#define IXL_HARDMTU			9712 /* 9726 - ETHER_HDR_LEN */
+#define IXL_MCLBYTES			(MCLBYTES - ETHER_ALIGN)
+#define IXL_MTU_ETHERLEN		ETHER_HDR_LEN		\
+	+ ETHER_CRC_LEN
+#if 0
+#define IXL_MAX_MTU			(9728 - IXL_MTU_ETHERLEN)
+#else
+/* (dbuff * 5) - ETHER_HDR_LEN - ETHER_CRC_LEN */
+#define IXL_MAX_MTU			(9600 - IXL_MTU_ETHERLEN)
+#endif
+#define IXL_MIN_MTU			(ETHER_MIN_LEN - ETHER_CRC_LEN)
 
 #define IXL_PCIREG			PCI_MAPREG_START
 
@@ -1356,7 +1366,7 @@ ixl_attach(device_t parent, device_t sel
 	ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
 #endif
 	ether_set_vlan_cb(>sc_ec, ixl_vlan_cb);
-	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
+	sc->sc_ec.ec_capabilities |= ETHERCAP_JUMBO_MTU;
 	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWTAGGING;
 	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_HWFILTER;
 
@@ -1758,9 +1768,24 @@ ixl_ioctl(struct ifnet *ifp, u_long cmd,
 	const struct sockaddr *sa;
 	uint8_t addrhi[ETHER_ADDR_LEN], addrlo[ETHER_ADDR_LEN];
 	int s, error = 0;
-	unsigned int i;
+	unsigned int i, nmtu;
 
 	switch (cmd) {
+	case SIOCSIFMTU:
+		nmtu = ifr->ifr_mtu;
+
+		if (nmtu < IXL_MIN_MTU || nmtu > IXL_MAX_MTU) {
+			error = EINVAL;
+			break;
+		}
+		if (ifp->if_mtu != nmtu) {
+			s = splnet();
+			error = ether_ioctl(ifp, cmd, data);
+			splx(s);
+			if (error == ENETRESET)
+error = ixl_init(ifp);
+		}
+		break;
 	case SIOCADDMULTI:
 		sa = ifreq_getaddr(SIOCADDMULTI, ifr);
 		if (ether_addmulti(sa, >sc_ec) == ENETRESET) {
@@ -2342,8 +2367,8 @@ ixl_txr_alloc(struct ixl_softc *sc, unsi
 	for (i = 0; i < sc->sc_tx_ring_ndescs; i++) {
 		txm = [i];
 
-		if (bus_dmamap_create(sc->sc_dmat,
-		IXL_HARDMTU, IXL_TX_PKT_DESCS, IXL_HARDMTU, 0,
+		if (bus_dmamap_create(sc->sc_dmat, IXL_TX_PKT_MAXSIZE,
+		IXL_TX_PKT_DESCS, IXL_TX_PKT_MAXSIZE, 0,
 		BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW, >txm_map) != 0)
 			goto uncreate;
 
@@ -2908,7 +2933,7 @@ ixl_rxr_alloc(struct ixl_softc *sc, unsi
 		rxm = [i];
 
 		if (bus_dmamap_create(sc->sc_dmat,
-		IXL_HARDMTU, 1, IXL_HARDMTU, 0,
+		IXL_MCLBYTES, 1, IXL_MCLBYTES, 0,
 		BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW, >rxm_map) != 0)
 			goto uncreate;
 
@@ -3016,21 +3041,24 @@ static void
 ixl_rxr_config(struct ixl_softc *sc, struct ixl_rx_ring *rxr)
 {
 	struct ixl_hmc_rxq rxq;
+	struct ifnet *ifp = >sc_ec.ec_if;
+	uint16_t rxmax;
 	void *hmc;
 
 	memset(, 0, sizeof(rxq));
+	rxmax = ifp->if_mtu + IXL_MTU_ETHERLEN;
 
 	rxq.head = htole16(rxr->rxr_cons);
 	rxq.base = htole64(IXL_DMA_DVA(>rxr_mem) / IXL_HMC_RXQ_BASE_UNIT);
 	rxq.qlen = htole16(sc->sc_rx_ring_ndescs);
-	rxq.dbuff = htole16(MCLBYTES / IXL_HMC_RXQ_DBUFF_UNIT);
+	rxq.dbuff = htole16(IXL_MCLBYTES / IXL_HMC_RXQ_DBUFF_UNIT);
 	rxq.hbuff = 0;
 	rxq.dtype = IXL_HMC_RXQ_DTYPE_NOSPLIT;
 	rxq.dsize = IXL_HMC_RXQ_DSIZE_32;
 	rxq.crcstrip = 1;
 	rxq.l2sel = 1;
 	rxq.showiv = 1;
-	rxq.rxmax = htole16(IXL_HARDMTU);
+	rxq.rxmax = htole16(rxmax);
 	rxq.tphrdesc_ena = 0;
 	rxq.tphwdesc_ena = 0;
 	rxq.tphdata_ena = 0;
@@ -3274,7 +3302,7 @@ ixl_rxfill(struct ixl_softc *sc, struct 
 			break;
 		}
 
-		m->m_len = m->m_pkthdr.len = MCLBYTES + ETHER_ALIGN;
+		m->m_len = m->m_pkthdr.len = MCLBYTES;
 		m_adj(m, ETHER_ALIGN);
 
 		map = rxm->rxm_map;