From: bluhm Date: Fri, 10 Nov 2023 15:51:19 +0000 (+0000) Subject: Make ifq and ifiq interface MP safe. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cf96265bb25b08cea5a0b5654925448396fd9df0;p=openbsd Make ifq and ifiq interface MP safe. Rename ifq_set_maxlen() to ifq_init_maxlen(). This function neither uses WRITE_ONCE() nor a mutex and is called before the ifq mutex is initialized. The new name expresses that it should be used only during interface attach when there is no concurrency. Protect ifq_len(), ifq_empty(), ifiq_len(), and ifiq_empty() with READ_ONCE(). They can be used without lock as they only read a single integer. OK dlg@ --- diff --git a/sys/arch/armv7/omap/if_cpsw.c b/sys/arch/armv7/omap/if_cpsw.c index 0951ec8d4d5..a0e6c7a43ce 100644 --- a/sys/arch/armv7/omap/if_cpsw.c +++ b/sys/arch/armv7/omap/if_cpsw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cpsw.c,v 1.52 2021/10/24 17:52:27 mpi Exp $ */ +/* $OpenBSD: if_cpsw.c,v 1.53 2023/11/10 15:51:19 bluhm Exp $ */ /* $NetBSD: if_cpsw.c,v 1.3 2013/04/17 14:36:34 bouyer Exp $ */ /* @@ -444,7 +444,7 @@ cpsw_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = cpsw_start; ifp->if_ioctl = cpsw_ioctl; ifp->if_watchdog = cpsw_watchdog; - ifq_set_maxlen(&ifp->if_snd, CPSW_NTXDESCS - 1); + ifq_init_maxlen(&ifp->if_snd, CPSW_NTXDESCS - 1); memcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); cpsw_stop(ifp); diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c index 8f8cb61b1fc..1baeb870958 100644 --- a/sys/arch/armv7/sunxi/sxie.c +++ b/sys/arch/armv7/sunxi/sxie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxie.c,v 1.33 2021/10/24 17:52:28 mpi Exp $ */ +/* $OpenBSD: sxie.c,v 1.34 2023/11/10 15:51:19 bluhm Exp $ */ /* * Copyright (c) 2012-2013 Patrick Wildt * Copyright (c) 2013 Artturi Alm @@ -262,7 +262,7 @@ sxie_attach(struct device *parent, struct device *self, void *aux) ifp->if_watchdog = sxie_watchdog; ifp->if_capabilities = IFCAP_VLAN_MTU; /* XXX status check in recv? */ - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* Initialize MII/media info. */ mii = &sc->sc_mii; diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index da88f8ede64..9172358e31c 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.84 2022/12/28 01:39:21 yasuoka Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.85 2023/11/10 15:51:19 bluhm Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -313,7 +313,7 @@ cnmac_attach(struct device *parent, struct device *self, void *aux) ifp->if_qstart = cnmac_start; ifp->if_watchdog = cnmac_watchdog; ifp->if_hardmtu = CNMAC_MAX_MTU; - ifq_set_maxlen(&ifp->if_snd, max(GATHER_QUEUE_SIZE, IFQ_MAXLEN)); + ifq_init_maxlen(&ifp->if_snd, max(GATHER_QUEUE_SIZE, IFQ_MAXLEN)); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4 | IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6; diff --git a/sys/dev/fdt/if_dwge.c b/sys/dev/fdt/if_dwge.c index 4ec1331d5a8..7a619712a51 100644 --- a/sys/dev/fdt/if_dwge.c +++ b/sys/dev/fdt/if_dwge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwge.c,v 1.19 2023/08/15 08:27:30 miod Exp $ */ +/* $OpenBSD: if_dwge.c,v 1.20 2023/11/10 15:51:19 bluhm Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017 Patrick Wildt @@ -512,7 +512,7 @@ dwge_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = dwge_ioctl; ifp->if_qstart = dwge_start; ifp->if_watchdog = dwge_watchdog; - ifq_set_maxlen(&ifp->if_snd, DWGE_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, DWGE_NTXDESC - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/fdt/if_dwxe.c b/sys/dev/fdt/if_dwxe.c index 6f3e1af051a..609bb31d0d4 100644 --- a/sys/dev/fdt/if_dwxe.c +++ b/sys/dev/fdt/if_dwxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwxe.c,v 1.22 2023/08/15 08:27:30 miod Exp $ */ +/* $OpenBSD: if_dwxe.c,v 1.23 2023/11/10 15:51:19 bluhm Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * Copyright (c) 2017 Patrick Wildt @@ -422,7 +422,7 @@ dwxe_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = dwxe_ioctl; ifp->if_qstart = dwxe_start; ifp->if_watchdog = dwxe_watchdog; - ifq_set_maxlen(&ifp->if_snd, DWXE_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, DWXE_NTXDESC - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/fdt/if_mvneta.c b/sys/dev/fdt/if_mvneta.c index dbf9261c505..c602de56a45 100644 --- a/sys/dev/fdt/if_mvneta.c +++ b/sys/dev/fdt/if_mvneta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mvneta.c,v 1.30 2023/04/13 02:19:05 jsg Exp $ */ +/* $OpenBSD: if_mvneta.c,v 1.31 2023/11/10 15:51:19 bluhm Exp $ */ /* $NetBSD: if_mvneta.c,v 1.41 2015/04/15 10:15:40 hsuenaga Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi @@ -720,7 +720,7 @@ mvneta_attach(struct device *parent, struct device *self, void *aux) ifp->if_capabilities &= ~IFCAP_CSUM_TCPv4; #endif - ifq_set_maxlen(&ifp->if_snd, max(MVNETA_TX_RING_CNT - 1, IFQ_MAXLEN)); + ifq_init_maxlen(&ifp->if_snd, max(MVNETA_TX_RING_CNT - 1, IFQ_MAXLEN)); strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, sizeof(ifp->if_xname)); /* diff --git a/sys/dev/fdt/if_mvpp.c b/sys/dev/fdt/if_mvpp.c index d5add3245c3..c2881861baa 100644 --- a/sys/dev/fdt/if_mvpp.c +++ b/sys/dev/fdt/if_mvpp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mvpp.c,v 1.50 2023/04/08 05:38:25 jsg Exp $ */ +/* $OpenBSD: if_mvpp.c,v 1.51 2023/11/10 15:51:19 bluhm Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017, 2020 Patrick Wildt @@ -1466,7 +1466,7 @@ mvpp2_port_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = mvpp2_ioctl; ifp->if_start = mvpp2_start; ifp->if_watchdog = mvpp2_watchdog; - ifq_set_maxlen(&ifp->if_snd, MVPP2_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, MVPP2_NTXDESC - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c index 6025fa4bce3..76e4b75ba67 100644 --- a/sys/dev/ic/acx.c +++ b/sys/dev/ic/acx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acx.c,v 1.127 2022/04/21 21:03:02 stsp Exp $ */ +/* $OpenBSD: acx.c,v 1.128 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2006 Jonathan Gray @@ -284,7 +284,7 @@ acx_attach(struct acx_softc *sc) ifp->if_watchdog = acx_watchdog; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* Set channels */ for (i = 1; i <= 14; ++i) { diff --git a/sys/dev/ic/aic6915.c b/sys/dev/ic/aic6915.c index 048067e8191..eb8104d3930 100644 --- a/sys/dev/ic/aic6915.c +++ b/sys/dev/ic/aic6915.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6915.c,v 1.24 2022/01/09 05:42:38 jsg Exp $ */ +/* $OpenBSD: aic6915.c,v 1.25 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: aic6915.c,v 1.15 2005/12/24 20:27:29 perry Exp $ */ /*- @@ -289,7 +289,7 @@ sf_attach(struct sf_softc *sc) ifp->if_ioctl = sf_ioctl; ifp->if_start = sf_start; ifp->if_watchdog = sf_watchdog; - ifq_set_maxlen(&ifp->if_snd, SF_NTXDESC_MASK); + ifq_init_maxlen(&ifp->if_snd, SF_NTXDESC_MASK); /* * Attach the interface. diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 49113c59ab3..8a991f09c1e 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.124 2023/03/26 08:45:27 jsg Exp $ */ +/* $OpenBSD: ath.c,v 1.125 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -347,7 +347,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) ifp->if_start = ath_start; ifp->if_watchdog = ath_watchdog; ifp->if_ioctl = ath_ioctl; - ifq_set_maxlen(&ifp->if_snd, ATH_TXBUF * ATH_TXDESC); + ifq_init_maxlen(&ifp->if_snd, ATH_TXBUF * ATH_TXDESC); ic->ic_softc = sc; ic->ic_newassoc = ath_newassoc; diff --git a/sys/dev/ic/bcmgenet.c b/sys/dev/ic/bcmgenet.c index c755caf6348..9054c57bac3 100644 --- a/sys/dev/ic/bcmgenet.c +++ b/sys/dev/ic/bcmgenet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcmgenet.c,v 1.6 2022/05/02 06:30:45 anton Exp $ */ +/* $OpenBSD: bcmgenet.c,v 1.7 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: bcmgenet.c,v 1.3 2020/02/27 17:30:07 jmcneill Exp $ */ /*- @@ -984,7 +984,7 @@ genet_attach(struct genet_softc *sc) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = genet_start; ifp->if_ioctl = genet_ioctl; - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* 802.1Q VLAN-sized frames are supported */ ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 3389a33b286..b97f31e0204 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.133 2022/04/21 21:03:02 stsp Exp $ */ +/* $OpenBSD: bwi.c,v 1.134 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -789,7 +789,7 @@ bwi_attach(struct bwi_softc *sc) ifp->if_watchdog = bwi_watchdog; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* Get locale */ sc->sc_locale = __SHIFTOUT(bwi_read_sprom(sc, BWI_SPROM_CARD_INFO), diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 67dfc69d354..46fb14693d2 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.155 2022/02/22 01:15:01 guenther Exp $ */ +/* $OpenBSD: dc.c,v 1.156 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1697,7 +1697,7 @@ hasmac: ifp->if_ioctl = dc_ioctl; ifp->if_start = dc_start; ifp->if_watchdog = dc_watchdog; - ifq_set_maxlen(&ifp->if_snd, DC_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, DC_TX_LIST_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/dwqe.c b/sys/dev/ic/dwqe.c index 33d7ab55043..f853fcc109f 100644 --- a/sys/dev/ic/dwqe.c +++ b/sys/dev/ic/dwqe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwqe.c,v 1.14 2023/10/11 12:52:00 stsp Exp $ */ +/* $OpenBSD: dwqe.c,v 1.15 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2008, 2019 Mark Kettenis * Copyright (c) 2017, 2022 Patrick Wildt @@ -117,7 +117,7 @@ dwqe_attach(struct dwqe_softc *sc) ifp->if_ioctl = dwqe_ioctl; ifp->if_qstart = dwqe_start; ifp->if_watchdog = dwqe_watchdog; - ifq_set_maxlen(&ifp->if_snd, DWQE_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, DWQE_NTXDESC - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index e24264d0aa1..33134a2bde6 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3.c,v 1.100 2023/09/11 08:41:26 mvs Exp $ */ +/* $OpenBSD: elink3.c,v 1.101 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */ /* @@ -333,7 +333,7 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; /* 64 packets are around 100ms on 10Mbps */ - ifq_set_maxlen(&ifp->if_snd, 64); + ifq_init_maxlen(&ifp->if_snd, 64); if_attach(ifp); ether_ifattach(ifp); diff --git a/sys/dev/ic/fxp.c b/sys/dev/ic/fxp.c index 349b17f7168..d2001c0b679 100644 --- a/sys/dev/ic/fxp.c +++ b/sys/dev/ic/fxp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fxp.c,v 1.132 2020/07/10 13:26:37 patrick Exp $ */ +/* $OpenBSD: fxp.c,v 1.133 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* @@ -429,7 +429,7 @@ fxp_attach(struct fxp_softc *sc, const char *intrstr) ifp->if_ioctl = fxp_ioctl; ifp->if_start = fxp_start; ifp->if_watchdog = fxp_watchdog; - ifq_set_maxlen(&ifp->if_snd, FXP_NTXCB - 1); + ifq_init_maxlen(&ifp->if_snd, FXP_NTXCB - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index 42bdeb9cb68..b0a4adf478d 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.127 2022/07/12 22:08:17 bluhm Exp $ */ +/* $OpenBSD: gem.c,v 1.128 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -222,7 +222,7 @@ gem_config(struct gem_softc *sc) ifp->if_qstart = gem_start; ifp->if_ioctl = gem_ioctl; ifp->if_watchdog = gem_watchdog; - ifq_set_maxlen(&ifp->if_snd, GEM_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, GEM_NTXDESC - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index ef922c00648..9131d0ab906 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.124 2023/04/11 00:45:08 jsg Exp $ */ +/* $OpenBSD: malo.c,v 1.125 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -347,7 +347,7 @@ malo_attach(struct malo_softc *sc) ifp->if_watchdog = malo_watchdog; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* set supported rates */ ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b; diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index 0888a2e8911..7dd6b675f36 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.103 2022/04/21 21:03:02 stsp Exp $ */ +/* $OpenBSD: pgt.c,v 1.104 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2006 Claudio Jeker @@ -1877,7 +1877,7 @@ pgt_net_attach(struct pgt_softc *sc) ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, IFQ_MAXLEN); /* * Set channels diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 653ec082274..70b4794020e 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.215 2022/11/17 01:30:57 dlg Exp $ */ +/* $OpenBSD: re.c,v 1.216 2023/11/10 15:51:20 bluhm Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1016,7 +1016,7 @@ re_attach(struct rl_softc *sc, const char *intrstr) ifp->if_qstart = re_start; ifp->if_watchdog = re_watchdog; ifp->if_hardmtu = sc->rl_max_mtu; - ifq_set_maxlen(&ifp->if_snd, sc->rl_ldata.rl_tx_desc_cnt); + ifq_init_maxlen(&ifp->if_snd, sc->rl_ldata.rl_tx_desc_cnt); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index 4b5b9afd85f..c74885afe1f 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170.c,v 1.30 2022/01/09 05:42:42 jsg Exp $ */ +/* $OpenBSD: smc83c170.c,v 1.31 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */ /*- @@ -278,7 +278,7 @@ epic_attach(struct epic_softc *sc, const char *intrstr) ifp->if_ioctl = epic_ioctl; ifp->if_start = epic_start; ifp->if_watchdog = epic_watchdog; - ifq_set_maxlen(&ifp->if_snd, EPIC_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, EPIC_NTXDESC - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/ti.c b/sys/dev/ic/ti.c index 61c9b493745..c1cc0df7d05 100644 --- a/sys/dev/ic/ti.c +++ b/sys/dev/ic/ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ti.c,v 1.29 2022/01/09 05:42:42 jsg Exp $ */ +/* $OpenBSD: ti.c,v 1.30 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1443,7 +1443,7 @@ ti_attach(struct ti_softc *sc) ifp->if_start = ti_start; ifp->if_watchdog = ti_watchdog; ifp->if_hardmtu = TI_JUMBO_FRAMELEN - ETHER_HDR_LEN; - ifq_set_maxlen(&ifp->if_snd, TI_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, TI_TX_RING_CNT - 1); bcopy(sc->sc_dv.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index 087c6521a2d..22129f48261 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.138 2022/02/22 01:15:01 guenther Exp $ */ +/* $OpenBSD: xl.c,v 1.139 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2461,7 +2461,7 @@ xl_attach(struct xl_softc *sc) ifp->if_start = xl_start; ifp->if_watchdog = xl_watchdog; ifp->if_baudrate = 10000000; - ifq_set_maxlen(&ifp->if_snd, XL_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, XL_TX_LIST_CNT - 1); memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_age.c b/sys/dev/pci/if_age.c index f035023bf54..15e93515a39 100644 --- a/sys/dev/pci/if_age.c +++ b/sys/dev/pci/if_age.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_age.c,v 1.38 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_age.c,v 1.39 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon @@ -220,7 +220,7 @@ age_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = age_ioctl; ifp->if_start = age_start; ifp->if_watchdog = age_watchdog; - ifq_set_maxlen(&ifp->if_snd, AGE_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, AGE_TX_RING_CNT - 1); bcopy(sc->age_eaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index ae30a981042..86bff590e9b 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alc.c,v 1.56 2022/05/19 00:52:37 kevlo Exp $ */ +/* $OpenBSD: if_alc.c,v 1.57 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon * All rights reserved. @@ -1383,7 +1383,7 @@ alc_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = alc_ioctl; ifp->if_start = alc_start; ifp->if_watchdog = alc_watchdog; - ifq_set_maxlen(&ifp->if_snd, ALC_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, ALC_TX_RING_CNT - 1); bcopy(sc->alc_eaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c index c1998c8bd30..51979420f39 100644 --- a/sys/dev/pci/if_ale.c +++ b/sys/dev/pci/if_ale.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ale.c,v 1.49 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_ale.c,v 1.50 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon * All rights reserved. @@ -499,7 +499,7 @@ ale_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = ale_ioctl; ifp->if_start = ale_start; ifp->if_watchdog = ale_watchdog; - ifq_set_maxlen(&ifp->if_snd, ALE_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, ALE_TX_RING_CNT - 1); bcopy(sc->ale_eaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_aq_pci.c b/sys/dev/pci/if_aq_pci.c index cb2bcc92c85..6896270ac42 100644 --- a/sys/dev/pci/if_aq_pci.c +++ b/sys/dev/pci/if_aq_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aq_pci.c,v 1.25 2023/10/01 09:03:14 kettenis Exp $ */ +/* $OpenBSD: if_aq_pci.c,v 1.26 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: if_aq.c,v 1.27 2021/06/16 00:21:18 riastradh Exp $ */ /* @@ -1365,7 +1365,7 @@ aq_attach(struct device *parent, struct device *self, void *aux) #if NVLAN > 0 ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif - ifq_set_maxlen(&ifp->if_snd, AQ_TXD_NUM); + ifq_init_maxlen(&ifp->if_snd, AQ_TXD_NUM); ifmedia_init(&sc->sc_media, IFM_IMASK, aq_ifmedia_change, aq_ifmedia_status); diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index d8fa5c8e11e..8dc020150c7 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.401 2023/07/04 10:22:39 jmatthew Exp $ */ +/* $OpenBSD: if_bge.c,v 1.402 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -3061,7 +3061,7 @@ bge_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = bge_ioctl; ifp->if_qstart = bge_start; ifp->if_watchdog = bge_watchdog; - ifq_set_maxlen(&ifp->if_snd, BGE_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, BGE_TX_RING_CNT - 1); DPRINTFN(5, ("bcopy\n")); bcopy(sc->bge_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index ffc84023caf..c2eff8bd701 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.132 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.133 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -877,7 +877,7 @@ bnx_attachhook(struct device *self) ifp->if_watchdog = bnx_watchdog; ifp->if_hardmtu = BNX_MAX_JUMBO_ETHER_MTU_VLAN - sizeof(struct ether_header); - ifq_set_maxlen(&ifp->if_snd, USABLE_TX_BD - 1); + ifq_init_maxlen(&ifp->if_snd, USABLE_TX_BD - 1); bcopy(sc->eaddr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); bcopy(sc->bnx_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_bnxt.c b/sys/dev/pci/if_bnxt.c index 4eb58b16c12..6e9c5b616f8 100644 --- a/sys/dev/pci/if_bnxt.c +++ b/sys/dev/pci/if_bnxt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnxt.c,v 1.38 2023/03/22 17:01:07 denis Exp $ */ +/* $OpenBSD: if_bnxt.c,v 1.39 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Broadcom NetXtreme-C/E network driver. * @@ -645,7 +645,7 @@ bnxt_attach(struct device *parent, struct device *self, void *aux) #if NVLAN > 0 ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif - ifq_set_maxlen(&ifp->if_snd, 1024); /* ? */ + ifq_init_maxlen(&ifp->if_snd, 1024); /* ? */ ifmedia_init(&sc->sc_media, IFM_IMASK, bnxt_media_change, bnxt_media_status); diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 3de0a376fc4..09ac37cd980 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.54 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_cas.c,v 1.55 2023/11/10 15:51:20 bluhm Exp $ */ /* * @@ -493,7 +493,7 @@ cas_config(struct cas_softc *sc) ifp->if_start = cas_start; ifp->if_ioctl = cas_ioctl; ifp->if_watchdog = cas_watchdog; - ifq_set_maxlen(&ifp->if_snd, CAS_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, CAS_NTXDESC - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index e29b12e0bce..fbe46ae6a20 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.366 2023/09/05 13:06:42 naddy Exp $ */ +/* $OpenBSD: if_em.c,v 1.367 2023/11/10 15:51:20 bluhm Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include @@ -1963,7 +1963,7 @@ em_setup_interface(struct em_softc *sc) ifp->if_watchdog = em_watchdog; ifp->if_hardmtu = sc->hw.max_frame_size - ETHER_HDR_LEN - ETHER_CRC_LEN; - ifq_set_maxlen(&ifp->if_snd, sc->sc_tx_slots - 1); + ifq_init_maxlen(&ifp->if_snd, sc->sc_tx_slots - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index df844edba7a..63f5915fcf4 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.42 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_et.c,v 1.43 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -245,7 +245,7 @@ et_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; ifp->if_watchdog = et_watchdog; - ifq_set_maxlen(&ifp->if_snd, ET_TX_NDESC); + ifq_init_maxlen(&ifp->if_snd, ET_TX_NDESC); strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c index d65769d787b..eff312b6a70 100644 --- a/sys/dev/pci/if_iavf.c +++ b/sys/dev/pci/if_iavf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iavf.c,v 1.11 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_iavf.c,v 1.12 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -890,7 +890,7 @@ iavf_attach(struct device *parent, struct device *self, void *aux) if (ifp->if_hardmtu == 0) ifp->if_hardmtu = IAVF_HARDMTU; strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, sc->sc_tx_ring_ndescs); + ifq_init_maxlen(&ifp->if_snd, sc->sc_tx_ring_ndescs); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; #if 0 diff --git a/sys/dev/pci/if_igc.c b/sys/dev/pci/if_igc.c index db84e23bb68..c39121a279b 100644 --- a/sys/dev/pci/if_igc.c +++ b/sys/dev/pci/if_igc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $ */ +/* $OpenBSD: if_igc.c,v 1.14 2023/11/10 15:51:20 bluhm Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause * @@ -786,7 +786,7 @@ igc_setup_interface(struct igc_softc *sc) ifp->if_watchdog = igc_watchdog; ifp->if_hardmtu = sc->hw.mac.max_frame_size - ETHER_HDR_LEN - ETHER_CRC_LEN; - ifq_set_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); + ifq_init_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 157a5da0ac8..9b838f49e34 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.205 2023/10/20 07:31:12 jan Exp $ */ +/* $OpenBSD: if_ix.c,v 1.206 2023/11/10 15:51:20 bluhm Exp $ */ /****************************************************************************** @@ -1918,7 +1918,7 @@ ixgbe_setup_interface(struct ix_softc *sc) ifp->if_watchdog = ixgbe_watchdog; ifp->if_hardmtu = IXGBE_MAX_FRAME_SIZE - ETHER_HDR_LEN - ETHER_CRC_LEN; - ifq_set_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); + ifq_init_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 8ed13cf2f45..5432dab9c5d 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.75 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.76 2023/11/10 15:51:20 bluhm Exp $ */ #include @@ -1011,7 +1011,7 @@ ixgb_setup_interface(struct ixgb_softc *sc) ifp->if_watchdog = ixgb_watchdog; ifp->if_hardmtu = IXGB_MAX_JUMBO_FRAME_SIZE - ETHER_HDR_LEN - ETHER_CRC_LEN; - ifq_set_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); + ifq_init_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c index 0f8b6d8b74e..fb378235106 100644 --- a/sys/dev/pci/if_ixl.c +++ b/sys/dev/pci/if_ixl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ixl.c,v 1.92 2023/10/20 13:21:15 jan Exp $ */ +/* $OpenBSD: if_ixl.c,v 1.93 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -1967,7 +1967,7 @@ ixl_attach(struct device *parent, struct device *self, void *aux) ifp->if_watchdog = ixl_watchdog; ifp->if_hardmtu = IXL_HARDMTU; strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, sc->sc_tx_ring_ndescs); + ifq_init_maxlen(&ifp->if_snd, sc->sc_tx_ring_ndescs); ifp->if_capabilities = IFCAP_VLAN_HWTAGGING; ifp->if_capabilities |= IFCAP_CSUM_IPv4 | diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c index 5cab59e9d36..08c08c8858b 100644 --- a/sys/dev/pci/if_jme.c +++ b/sys/dev/pci/if_jme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_jme.c,v 1.56 2022/03/11 18:00:45 mpi Exp $ */ +/* $OpenBSD: if_jme.c,v 1.57 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon * All rights reserved. @@ -662,7 +662,7 @@ jme_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = jme_ioctl; ifp->if_start = jme_start; ifp->if_watchdog = jme_watchdog; - ifq_set_maxlen(&ifp->if_snd, JME_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, JME_TX_RING_CNT - 1); strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 | diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index a7c82fd78e5..4a08513dfc4 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.79 2022/10/09 02:32:02 kevlo Exp $ */ +/* $OpenBSD: if_lge.c,v 1.80 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -499,7 +499,7 @@ lge_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = lge_start; ifp->if_watchdog = lge_watchdog; ifp->if_hardmtu = LGE_JUMBO_MTU; - ifq_set_maxlen(&ifp->if_snd, LGE_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, LGE_TX_LIST_CNT - 1); DPRINTFN(5, ("bcopy\n")); bcopy(sc->sc_dv.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index 1f07679285c..9108423827d 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.110 2023/09/18 06:47:21 jmatthew Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.111 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2017 David Gwynne @@ -2930,7 +2930,7 @@ mcx_attach(struct device *parent, struct device *self, void *aux) #if NVLAN > 0 ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; #endif - ifq_set_maxlen(&ifp->if_snd, 1024); + ifq_init_maxlen(&ifp->if_snd, 1024); ifmedia_init(&sc->sc_media, IFM_IMASK, mcx_media_change, mcx_media_status); diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index a32f431db6c..88d9e3d2ac3 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.142 2022/03/11 18:00:46 mpi Exp $ */ +/* $OpenBSD: if_msk.c,v 1.143 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -1068,7 +1068,7 @@ msk_attach(struct device *parent, struct device *self, void *aux) if (sc->sk_type != SK_YUKON_FE && sc->sk_type != SK_YUKON_FE_P) ifp->if_hardmtu = SK_JUMBO_MTU; - ifq_set_maxlen(&ifp->if_snd, MSK_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, MSK_TX_RING_CNT - 1); bcopy(sc_if->sk_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c index a4084487d32..b13d445186d 100644 --- a/sys/dev/pci/if_myx.c +++ b/sys/dev/pci/if_myx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_myx.c,v 1.118 2023/07/14 07:07:08 claudio Exp $ */ +/* $OpenBSD: if_myx.c,v 1.119 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2007 Reyk Floeter @@ -532,7 +532,7 @@ myx_attachhook(struct device *self) ifp->if_watchdog = myx_watchdog; ifp->if_hardmtu = MYX_RXBIG_SIZE; strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, 1); + ifq_init_maxlen(&ifp->if_snd, 1); ifp->if_capabilities = IFCAP_VLAN_MTU; #if 0 @@ -1088,7 +1088,7 @@ myx_up(struct myx_softc *sc) sc->sc_tx_ring_count = r / sizeof(struct myx_tx_desc); sc->sc_tx_nsegs = min(16, sc->sc_tx_ring_count / 4); /* magic */ sc->sc_tx_count = 0; - ifq_set_maxlen(&ifp->if_snd, sc->sc_tx_ring_count - 1); + ifq_init_maxlen(&ifp->if_snd, sc->sc_tx_ring_count - 1); /* Allocate Interrupt Queue */ diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index 660fdf70878..ffe34c5e293 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.124 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.125 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini @@ -320,7 +320,7 @@ nfe_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = nfe_ioctl; ifp->if_start = nfe_start; ifp->if_watchdog = nfe_watchdog; - ifq_set_maxlen(&ifp->if_snd, NFE_IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, NFE_IFQ_MAXLEN); strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_ngbe.c b/sys/dev/pci/if_ngbe.c index 25f07ffe3f2..1cec2c33f3d 100644 --- a/sys/dev/pci/if_ngbe.c +++ b/sys/dev/pci/if_ngbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ngbe.c,v 1.1 2023/03/31 08:19:41 kevlo Exp $ */ +/* $OpenBSD: if_ngbe.c,v 1.2 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2015-2017 Beijing WangXun Technology Co., Ltd. @@ -1024,7 +1024,7 @@ ngbe_setup_interface(struct ngbe_softc *sc) ifp->if_watchdog = ngbe_watchdog; ifp->if_hardmtu = NGBE_MAX_JUMBO_FRAME_SIZE - ETHER_HDR_LEN - ETHER_CRC_LEN; - ifq_set_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); + ifq_init_maxlen(&ifp->if_snd, sc->num_tx_desc - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index 2ea84b9e54f..4971b174624 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.97 2022/10/09 02:32:02 kevlo Exp $ */ +/* $OpenBSD: if_nge.c,v 1.98 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -792,7 +792,7 @@ nge_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = nge_start; ifp->if_watchdog = nge_watchdog; ifp->if_hardmtu = NGE_JUMBO_MTU; - ifq_set_maxlen(&ifp->if_snd, NGE_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, NGE_TX_LIST_CNT - 1); DPRINTFN(5, ("%s: bcopy\n", sc->sc_dv.dv_xname)); bcopy(sc->sc_dv.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index b18938360a5..30dc8fd8015 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.79 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.80 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -919,7 +919,7 @@ nxe_attach(struct device *parent, struct device *self, void *aux) ifp->if_watchdog = nxe_watchdog; ifp->if_hardmtu = MCLBYTES - ETHER_HDR_LEN - ETHER_CRC_LEN; strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, 512); /* XXX */ + ifq_init_maxlen(&ifp->if_snd, 512); /* XXX */ ifmedia_init(&sc->sc_media, 0, nxe_media_change, nxe_media_status); ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_AUTO, 0, NULL); diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c index 2a01f022d94..1e2710c4a87 100644 --- a/sys/dev/pci/if_oce.c +++ b/sys/dev/pci/if_oce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_oce.c,v 1.107 2023/04/28 10:18:58 bluhm Exp $ */ +/* $OpenBSD: if_oce.c,v 1.108 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2012 Mike Belopuhov @@ -823,7 +823,7 @@ oce_attach_ifp(struct oce_softc *sc) ifp->if_watchdog = oce_watchdog; ifp->if_hardmtu = OCE_MAX_MTU; ifp->if_softc = sc; - ifq_set_maxlen(&ifp->if_snd, sc->sc_tx_ring_size - 1); + ifq_init_maxlen(&ifp->if_snd, sc->sc_tx_ring_size - 1); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index f5661f45ef9..28e98b037ff 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.48 2022/07/10 21:13:41 bluhm Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.49 2023/11/10 15:51:20 bluhm Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -769,7 +769,7 @@ pcn_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = pcn_ioctl; ifp->if_start = pcn_start; ifp->if_watchdog = pcn_watchdog; - ifq_set_maxlen(&ifp->if_snd, PCN_NTXDESC -1); + ifq_init_maxlen(&ifp->if_snd, PCN_NTXDESC -1); /* Attach the interface. */ if_attach(ifp); diff --git a/sys/dev/pci/if_rge.c b/sys/dev/pci/if_rge.c index 51f316de3d5..2ef59a7a4cc 100644 --- a/sys/dev/pci/if_rge.c +++ b/sys/dev/pci/if_rge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rge.c,v 1.21 2022/12/21 02:31:09 kevlo Exp $ */ +/* $OpenBSD: if_rge.c,v 1.22 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 2019, 2020 Kevin Lo @@ -288,7 +288,7 @@ rge_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = rge_ioctl; ifp->if_qstart = rge_start; ifp->if_watchdog = rge_watchdog; - ifq_set_maxlen(&ifp->if_snd, RGE_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, RGE_TX_LIST_CNT - 1); ifp->if_hardmtu = RGE_JUMBO_MTU; ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 | diff --git a/sys/dev/pci/if_se.c b/sys/dev/pci/if_se.c index 250292b04e5..7ad0bcc2370 100644 --- a/sys/dev/pci/if_se.c +++ b/sys/dev/pci/if_se.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_se.c,v 1.23 2022/01/09 05:42:54 jsg Exp $ */ +/* $OpenBSD: if_se.c,v 1.24 2023/11/10 15:51:20 bluhm Exp $ */ /*- * Copyright (c) 2009, 2010 Christopher Zimmermann @@ -690,7 +690,7 @@ se_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = se_ioctl; ifp->if_start = se_start; ifp->if_watchdog = se_watchdog; - ifq_set_maxlen(&ifp->if_snd, SE_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, SE_TX_RING_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 985eb0f3ec0..7c658f71e7c 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.142 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_sis.c,v 1.143 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -1184,7 +1184,7 @@ sis_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = sis_ioctl; ifp->if_start = sis_start; ifp->if_watchdog = sis_watchdog; - ifq_set_maxlen(&ifp->if_snd, SIS_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, SIS_TX_LIST_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_hardmtu = 1518; /* determined experimentally on DP83815 */ diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 898576a5a2a..dd8a69085f7 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.194 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_sk.c,v 1.195 2023/11/10 15:51:20 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -998,7 +998,7 @@ sk_attach(struct device *parent, struct device *self, void *aux) ifp->if_start = sk_start; ifp->if_watchdog = sk_watchdog; ifp->if_hardmtu = SK_JUMBO_MTU; - ifq_set_maxlen(&ifp->if_snd, SK_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, SK_TX_RING_CNT - 1); bcopy(sc_if->sk_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index d1407e5e904..fbbb82593f3 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.69 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_ste.c,v 1.70 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -899,7 +899,7 @@ ste_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = ste_ioctl; ifp->if_start = ste_start; ifp->if_watchdog = ste_watchdog; - ifq_set_maxlen(&ifp->if_snd, STE_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, STE_TX_LIST_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 06d0379d459..773bdd85c0c 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stge.c,v 1.72 2022/03/11 18:00:48 mpi Exp $ */ +/* $OpenBSD: if_stge.c,v 1.73 2023/11/10 15:51:24 bluhm Exp $ */ /* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */ /*- @@ -361,7 +361,7 @@ stge_attach(struct device *parent, struct device *self, void *aux) #ifdef STGE_JUMBO ifp->if_hardmtu = STGE_JUMBO_MTU; #endif - ifq_set_maxlen(&ifp->if_snd, STGE_NTXDESC - 1); + ifq_init_maxlen(&ifp->if_snd, STGE_NTXDESC - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c index e07be120ec3..57e114057ba 100644 --- a/sys/dev/pci/if_tht.c +++ b/sys/dev/pci/if_tht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tht.c,v 1.146 2022/08/29 06:08:04 jsg Exp $ */ +/* $OpenBSD: if_tht.c,v 1.147 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2007 David Gwynne @@ -781,7 +781,7 @@ tht_attach(struct device *parent, struct device *self, void *aux) ifp->if_watchdog = tht_watchdog; ifp->if_hardmtu = MCLBYTES - ETHER_HDR_LEN - ETHER_CRC_LEN; /* XXX */ strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, 400); + ifq_init_maxlen(&ifp->if_snd, 400); ifmedia_init(&sc->sc_media, 0, tht_media_change, tht_media_status); ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_AUTO, 0, NULL); diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index bea6f1ba0e6..895550ca3b7 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.77 2023/04/11 00:45:08 jsg Exp $ */ +/* $OpenBSD: if_tl.c,v 1.78 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1962,7 +1962,7 @@ tl_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = tl_ioctl; ifp->if_start = tl_start; ifp->if_watchdog = tl_watchdog; - ifq_set_maxlen(&ifp->if_snd, TL_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, TL_TX_LIST_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 6d2199cc26b..a1fdd7e6960 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.129 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_txp.c,v 1.130 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2001 @@ -213,7 +213,7 @@ txp_attachhook(struct device *self) ifp->if_start = txp_start; ifp->if_watchdog = txp_watchdog; ifp->if_baudrate = IF_Mbps(10); - ifq_set_maxlen(&ifp->if_snd, TX_ENTRIES); + ifq_init_maxlen(&ifp->if_snd, TX_ENTRIES); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); txp_capabilities(sc); diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index e04c40eea99..f4d5cf204c0 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.76 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_vge.c,v 1.77 2023/11/10 15:51:24 bluhm Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -777,7 +777,7 @@ vge_attach(struct device *parent, struct device *self, void *aux) #ifdef VGE_JUMBO ifp->if_hardmtu = VGE_JUMBO_MTU; #endif - ifq_set_maxlen(&ifp->if_snd, VGE_IFQ_MAXLEN); + ifq_init_maxlen(&ifp->if_snd, VGE_IFQ_MAXLEN); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index 8a5f9d31d50..68198af6daa 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.104 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_vic.c,v 1.105 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2006 Reyk Floeter @@ -480,7 +480,7 @@ vic_attach(struct device *parent, struct device *self, void *aux) ifp->if_watchdog = vic_watchdog; ifp->if_hardmtu = VIC_JUMBO_MTU; strlcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ); - ifq_set_maxlen(&ifp->if_snd, sc->sc_ntxbuf - 1); + ifq_init_maxlen(&ifp->if_snd, sc->sc_ntxbuf - 1); ifp->if_capabilities = IFCAP_VLAN_MTU; diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c index 1fb963428e5..30e5b124d09 100644 --- a/sys/dev/pci/if_vmx.c +++ b/sys/dev/pci/if_vmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vmx.c,v 1.78 2023/07/30 04:27:01 dlg Exp $ */ +/* $OpenBSD: if_vmx.c,v 1.79 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2013 Tsubai Masanari @@ -407,7 +407,7 @@ vmxnet3_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_ds->upt_features & UPT1_F_VLAN) ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING; - ifq_set_maxlen(&ifp->if_snd, NTXDESC); + ifq_init_maxlen(&ifp->if_snd, NTXDESC); ifmedia_init(&sc->sc_media, IFM_IMASK, vmxnet3_media_change, vmxnet3_media_status); diff --git a/sys/dev/pci/if_vte.c b/sys/dev/pci/if_vte.c index 0db92d449d8..73c255598f2 100644 --- a/sys/dev/pci/if_vte.c +++ b/sys/dev/pci/if_vte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vte.c,v 1.26 2022/04/19 03:25:46 kevlo Exp $ */ +/* $OpenBSD: if_vte.c,v 1.27 2023/11/10 15:51:24 bluhm Exp $ */ /*- * Copyright (c) 2010, Pyun YongHyeon * All rights reserved. @@ -329,7 +329,7 @@ vte_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = vte_ioctl; ifp->if_start = vte_start; ifp->if_watchdog = vte_watchdog; - ifq_set_maxlen(&ifp->if_snd, VTE_TX_RING_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, VTE_TX_RING_CNT - 1); bcopy(sc->vte_eaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index f97a229f322..a8cc5d19d9c 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.74 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_wb.c,v 1.75 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 1997, 1998 @@ -758,7 +758,7 @@ wb_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = wb_ioctl; ifp->if_start = wb_start; ifp->if_watchdog = wb_watchdog; - ifq_set_maxlen(&ifp->if_snd, WB_TX_LIST_CNT - 1); + ifq_init_maxlen(&ifp->if_snd, WB_TX_LIST_CNT - 1); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index ed8cb9955aa..67c4f4ac44b 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.82 2022/03/11 18:00:50 mpi Exp $ */ +/* $OpenBSD: if_xge.c,v 1.83 2023/11/10 15:51:24 bluhm Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -679,7 +679,7 @@ xge_attach(struct device *parent, struct device *self, void *aux) ifp->if_ioctl = xge_ioctl; ifp->if_start = xge_start; ifp->if_hardmtu = XGE_MAX_MTU; - ifq_set_maxlen(&ifp->if_snd, NTXDESCS - 1); + ifq_init_maxlen(&ifp->if_snd, NTXDESCS - 1); ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_CSUM_IPv4 | IFCAP_CSUM_TCPv4 | IFCAP_CSUM_UDPv4; diff --git a/sys/dev/pv/if_hvn.c b/sys/dev/pv/if_hvn.c index c6c21daaa94..5254093c54c 100644 --- a/sys/dev/pv/if_hvn.c +++ b/sys/dev/pv/if_hvn.c @@ -279,7 +279,7 @@ hvn_attach(struct device *parent, struct device *self, void *aux) #endif } - ifq_set_maxlen(&ifp->if_snd, HVN_TX_DESC - 1); + ifq_init_maxlen(&ifp->if_snd, HVN_TX_DESC - 1); ifmedia_init(&sc->sc_media, IFM_IMASK, hvn_media_change, hvn_media_status); diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index 28df941e061..7b895238427 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.25 2023/07/28 16:54:48 dv Exp $ */ +/* $OpenBSD: if_vio.c,v 1.26 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -592,7 +592,7 @@ vio_attach(struct device *parent, struct device *self, void *aux) ifp->if_capabilities = IFCAP_VLAN_MTU; if (virtio_has_feature(vsc, VIRTIO_NET_F_CSUM)) ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4; - ifq_set_maxlen(&ifp->if_snd, vsc->sc_vqs[1].vq_num - 1); + ifq_init_maxlen(&ifp->if_snd, vsc->sc_vqs[1].vq_num - 1); ifmedia_init(&sc->sc_media, 0, vio_media_change, vio_media_status); ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); diff --git a/sys/dev/pv/if_xnf.c b/sys/dev/pv/if_xnf.c index 9661e02c327..b8aa9bb2178 100644 --- a/sys/dev/pv/if_xnf.c +++ b/sys/dev/pv/if_xnf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xnf.c,v 1.68 2022/03/23 13:03:36 jsg Exp $ */ +/* $OpenBSD: if_xnf.c,v 1.69 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2015, 2016 Mike Belopuhov @@ -315,7 +315,7 @@ xnf_attach(struct device *parent, struct device *self, void *aux) if (sc->sc_caps & XNF_CAP_CSUM6) ifp->if_capabilities |= IFCAP_CSUM_TCPv6 | IFCAP_CSUM_UDPv6; - ifq_set_maxlen(&ifp->if_snd, XNF_TX_DESC - 1); + ifq_init_maxlen(&ifp->if_snd, XNF_TX_DESC - 1); ifmedia_init(&sc->sc_media, IFM_IMASK, xnf_media_change, xnf_media_status); diff --git a/sys/net/if.c b/sys/net/if.c index 351a600e8ba..3c2266133a9 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.709 2023/10/27 20:56:47 jan Exp $ */ +/* $OpenBSD: if.c,v 1.710 2023/11/10 15:51:24 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -592,7 +592,7 @@ if_attach_queues(struct ifnet *ifp, unsigned int nqs) for (i = 1; i < nqs; i++) { ifq = malloc(sizeof(*ifq), M_DEVBUF, M_WAITOK|M_ZERO); - ifq_set_maxlen(ifq, ifp->if_snd.ifq_maxlen); + ifq_init_maxlen(ifq, ifp->if_snd.ifq_maxlen); ifq_init(ifq, ifp, i); map[i] = ifq; } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 7254ee7b93d..fb0efa59247 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.191 2022/01/02 22:36:03 jsg Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.192 2023/11/10 15:51:24 bluhm Exp $ */ /* * Synchronous PPP link level subroutines. * @@ -713,7 +713,7 @@ sppp_attach(struct ifnet *ifp) sp->pp_if.if_type = IFT_PPP; sp->pp_if.if_output = sppp_output; sp->pp_if.if_rtrequest = sppp_rtrequest; - ifq_set_maxlen(&sp->pp_if.if_snd, 50); + ifq_init_maxlen(&sp->pp_if.if_snd, 50); mq_init(&sp->pp_cpq, 50, IPL_NET); sp->pp_loopcnt = 0; sp->pp_alivecnt = 0; diff --git a/sys/net/ifq.c b/sys/net/ifq.c index fb8dea2c1cf..7da7b81e239 100644 --- a/sys/net/ifq.c +++ b/sys/net/ifq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.c,v 1.52 2023/10/08 07:44:52 claudio Exp $ */ +/* $OpenBSD: ifq.c,v 1.53 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -287,7 +287,7 @@ ifq_init(struct ifqueue *ifq, struct ifnet *ifp, unsigned int idx) task_set(&ifq->ifq_restart, ifq_restart_task, ifq); if (ifq->ifq_maxlen == 0) - ifq_set_maxlen(ifq, IFQ_MAXLEN); + ifq_init_maxlen(ifq, IFQ_MAXLEN); ifq->ifq_idx = idx; @@ -529,6 +529,13 @@ ifq_hdatalen(struct ifqueue *ifq) return (len); } +void +ifq_init_maxlen(struct ifqueue *ifq, unsigned int maxlen) +{ + /* this is not MP safe, use only during attach */ + ifq->ifq_maxlen = maxlen; +} + unsigned int ifq_purge(struct ifqueue *ifq) { diff --git a/sys/net/ifq.h b/sys/net/ifq.h index ac06de454a5..e7ee259e3ab 100644 --- a/sys/net/ifq.h +++ b/sys/net/ifq.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ifq.h,v 1.40 2023/10/08 07:44:52 claudio Exp $ */ +/* $OpenBSD: ifq.h,v 1.41 2023/11/10 15:51:24 bluhm Exp $ */ /* * Copyright (c) 2015 David Gwynne @@ -435,6 +435,7 @@ void ifq_deq_commit(struct ifqueue *, struct mbuf *); void ifq_deq_rollback(struct ifqueue *, struct mbuf *); struct mbuf *ifq_dequeue(struct ifqueue *); int ifq_hdatalen(struct ifqueue *); +void ifq_init_maxlen(struct ifqueue *, unsigned int); void ifq_mfreem(struct ifqueue *, struct mbuf *); void ifq_mfreeml(struct ifqueue *, struct mbuf_list *); unsigned int ifq_purge(struct ifqueue *); @@ -448,9 +449,8 @@ int ifq_deq_sleep(struct ifqueue *, struct mbuf **, int, int, const char *, volatile unsigned int *, volatile unsigned int *); -#define ifq_len(_ifq) ((_ifq)->ifq_len) -#define ifq_empty(_ifq) (ifq_len(_ifq) == 0) -#define ifq_set_maxlen(_ifq, _l) ((_ifq)->ifq_maxlen = (_l)) +#define ifq_len(_ifq) READ_ONCE((_ifq)->ifq_len) +#define ifq_empty(_ifq) (ifq_len(_ifq) == 0) static inline int ifq_is_priq(struct ifqueue *ifq) @@ -490,8 +490,8 @@ int ifiq_input(struct ifiqueue *, struct mbuf_list *); int ifiq_enqueue(struct ifiqueue *, struct mbuf *); void ifiq_add_data(struct ifiqueue *, struct if_data *); -#define ifiq_len(_ifiq) ml_len(&(_ifiq)->ifiq_ml) -#define ifiq_empty(_ifiq) ml_empty(&(_ifiq)->ifiq_ml) +#define ifiq_len(_ifiq) READ_ONCE(ml_len(&(_ifiq)->ifiq_ml)) +#define ifiq_empty(_ifiq) (ifiq_len(_ifiq) == 0) #endif /* _KERNEL */