Module Name: src Committed By: riastradh Date: Wed Jun 16 00:21:20 UTC 2021
Modified Files: src/share/man/man4: usbnet.4 src/sys/arch/arm/broadcom: bcm53xx_eth.c src/sys/arch/powerpc/booke/dev: pq3etsec.c src/sys/arch/usermode/dev: if_veth.c src/sys/dev/hyperv: if_hvn.c src/sys/dev/ic: an.c athn.c atw.c bwfm.c bwi.c dwc_gmac.c malo.c rt2560.c rt2661.c rt2860.c rtw.c wi.c src/sys/dev/pci: if_aq.c if_iavf.c if_ipw.c if_iwi.c if_iwm.c if_iwn.c if_ixl.c if_rtwn.c if_wm.c if_wpi.c src/sys/dev/pci/ixgbe: ixgbe.c ixv.c src/sys/dev/pcmcia: if_malo_pcmcia.c src/sys/dev/scsipi: if_se.c src/sys/dev/usb: if_umb.c usbnet.c src/sys/net: if_arcsubr.c if_bridge.c if_faith.c if_gif.c if_l2tp.c if_loop.c if_mpls.c if_pppoe.c if_srt.c if_stf.c if_tap.c if_vlan.c if_wg.c src/sys/net/lagg: if_lagg.c src/sys/netinet: ip_carp.c src/sys/rump/net/lib/libshmif: if_shmem.c src/sys/rump/net/lib/libvirtif: if_virt.c Log Message: if_attach and if_initialize cannot fail, don't test return value These were originally made failable back in 2017 when if_initialize allocated a softint in every interface for link state changes, so that it could fail gracefully instead of panicking: https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html However, this spawned many seldom- or never-tested error branches, which are risky to have around. And that softint in every interface has since been replaced by a single global workqueue, because link state changes require thread context but not low latency or high throughput: https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html So there is no longer any reason for if_initialize to fail. (The subroutine if_stats_init can't fail because percpu_alloc can't fail either.) There is a snag: the softint_establish in if_percpuq_create could fail, potentially leading to bad consequences later on trying to use the softint. This change doesn't introduce any new bugs because of the snag -- if_percpuq_attach was already broken. However, the snag can be better addressed without spawning error branches, either by using a single softint or making softints less scarce. (Separate commit will change the signatures of if_attach and if_initialize to return void, scheduled to ride whatever is the next convenient kernel bump.) Patch and testing on amd64 and evbmips64-eb by maya@; commit message soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man4/usbnet.4 cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/broadcom/bcm53xx_eth.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/booke/dev/pq3etsec.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/dev/if_veth.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/hyperv/if_hvn.c cvs rdiff -u -r1.74 -r1.75 src/sys/dev/ic/an.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/athn.c cvs rdiff -u -r1.170 -r1.171 src/sys/dev/ic/atw.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/bwfm.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/bwi.c cvs rdiff -u -r1.73 -r1.74 src/sys/dev/ic/dwc_gmac.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/malo.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/rt2560.c cvs rdiff -u -r1.43 -r1.44 src/sys/dev/ic/rt2661.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/rt2860.c cvs rdiff -u -r1.135 -r1.136 src/sys/dev/ic/rtw.c cvs rdiff -u -r1.255 -r1.256 src/sys/dev/ic/wi.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_aq.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_iavf.c cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/if_ipw.c cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/if_iwi.c cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/if_iwm.c cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/if_iwn.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/if_ixl.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_rtwn.c cvs rdiff -u -r1.704 -r1.705 src/sys/dev/pci/if_wm.c cvs rdiff -u -r1.90 -r1.91 src/sys/dev/pci/if_wpi.c cvs rdiff -u -r1.283 -r1.284 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.161 -r1.162 src/sys/dev/pci/ixgbe/ixv.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pcmcia/if_malo_pcmcia.c cvs rdiff -u -r1.112 -r1.113 src/sys/dev/scsipi/if_se.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/if_umb.c cvs rdiff -u -r1.41 -r1.42 src/sys/dev/usb/usbnet.c cvs rdiff -u -r1.82 -r1.83 src/sys/net/if_arcsubr.c cvs rdiff -u -r1.179 -r1.180 src/sys/net/if_bridge.c cvs rdiff -u -r1.61 -r1.62 src/sys/net/if_faith.c cvs rdiff -u -r1.154 -r1.155 src/sys/net/if_gif.c cvs rdiff -u -r1.46 -r1.47 src/sys/net/if_l2tp.c cvs rdiff -u -r1.112 -r1.113 src/sys/net/if_loop.c cvs rdiff -u -r1.36 -r1.37 src/sys/net/if_mpls.c cvs rdiff -u -r1.176 -r1.177 src/sys/net/if_pppoe.c cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_srt.c cvs rdiff -u -r1.107 -r1.108 src/sys/net/if_stf.c cvs rdiff -u -r1.121 -r1.122 src/sys/net/if_tap.c cvs rdiff -u -r1.153 -r1.154 src/sys/net/if_vlan.c cvs rdiff -u -r1.63 -r1.64 src/sys/net/if_wg.c cvs rdiff -u -r1.4 -r1.5 src/sys/net/lagg/if_lagg.c cvs rdiff -u -r1.114 -r1.115 src/sys/netinet/ip_carp.c cvs rdiff -u -r1.81 -r1.82 src/sys/rump/net/lib/libshmif/if_shmem.c cvs rdiff -u -r1.58 -r1.59 src/sys/rump/net/lib/libvirtif/if_virt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.