Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_iwm.c
RevisionDateAuthorComments
 1.90  10-Nov-2024  mlelstv Add MBUFTRACE
 1.89  09-Feb-2024  mlelstv branches: 1.89.2;
Fix DMA sync sizes.
Don't panic for inconsistent queue counter, just print an error to console.
 1.88  21-Sep-2023  msaitoh s/ for for / for / in comment.
 1.87  24-Jun-2021  riastradh iwm(4): Disentangle attach.

Don't attach a half-baked interface and then detach it and then
reattach it after mountroot when we can read firmware; just defer
attaching the interface altogether until mountroot.

Likely fixes some panics I've seen every now and then at boot with
iwm(4).
 1.86  16-Jun-2021  riastradh 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.
 1.85  22-May-2020  thorpej branches: 1.85.6;
This driver sleeps during iwm_media_change(), and thus requires an
adaptive mutex for the media lock.
 1.84  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.83  26-Jun-2018  msaitoh branches: 1.83.2; 1.83.10;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.82  08-Jun-2018  knakahara iwm(4) workaround as ifp->if_hwdl can be set only once. Advised nonaka@n.o and ozaki-r@n.o, thanks.

To avoid for iwm(4) to set if_hwdl before loading firmware, use local address
as dummy. See sys/net/if.c::if_set_sadl().
 1.81  08-Jun-2018  knakahara Fix "ifconfig iwm0" failures reported by ryoon@n.o. Advised nonaka@n.o and ozaki-r@n.o, thanks.
 1.80  06-Jun-2018  maya Remove duplicate ;
 1.79  05-Jun-2018  knakahara Fix panic on boot with iwm(4). Advised by nonaka@n.o, thanks.

XXX pullup-8
 1.78  21-Jan-2018  christos branches: 1.78.2;
CID-1427736: Appease coverity using KASSERT
 1.77  10-Jan-2018  mlelstv Match Intel Dual Band Wireless AC 3168. The code already supports it.
 1.76  23-Oct-2017  msaitoh branches: 1.76.2;
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
 1.75  23-Jul-2017  para branches: 1.75.2;
kmem_intr_free kmem_intr_[z]alloced memory

the underlying pools are the same but api-wise those should match
 1.74  09-Jun-2017  nonaka fix typo.

reported by ryo@.
 1.73  01-Jun-2017  chs branches: 1.73.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.72  19-May-2017  nonaka iwm(4): match Wireless 8265 device.
 1.71  14-Mar-2017  nonaka iwm(4): update firmware to maintained core release.

firmware from https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/linux-firmware.git/tree/?id=4b9559fb0565f582a21a4070a81a3b6a7d77610b
 1.70  02-Feb-2017  nonaka wlan interfaces make interrupt routine running on softint context.

see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html

tested device:
* ath at pci: AR5212, AR5424
* athn at pci: AR9287
* ipw at pci: 2100BG
* iwi at pci: 2915ABG
* iwm at pci: 3165, 7260, 8260
* iwn at pci: 4945, 6235
* ral at pci: RT2560
* rtwn at pci: RTL8192CE
 1.69  21-Jan-2017  nonaka PR/51797: initialize hardware completely when receiving a deauth frame from AP.

avoid "iwm0: fatal firmware error".
 1.68  21-Jan-2017  nonaka more block network interrupt.
 1.67  21-Jan-2017  nonaka increase command response timeout value.
 1.66  21-Jan-2017  nonaka include <sys/intr.h> for softint(9).
 1.65  19-Jan-2017  nonaka newstate should be blocked network interrupt, because it called iwm_start.
 1.64  17-Jan-2017  nonaka show NVM channel flags when AB_DEBUG is set.
 1.63  17-Jan-2017  nonaka more acknowledge interrupts from iwn(4).
 1.62  17-Jan-2017  nonaka only bus_dmamap_sync(9) once for ICT region.
 1.61  13-Jan-2017  nonaka branches: 1.61.2;
iwm(4): 3165 works fine with iwlwifi-7265D-17.ucode firmware.

firmware from http://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/tree/?id=be8a6fcba2e48e00674d1f35e6def56e2268039c
 1.60  10-Jan-2017  nonaka check LAR support in NVM for 8260/4165.
 1.59  10-Jan-2017  nonaka Add apmg_wake_up_wa support from DragonFly BSD.
 1.58  10-Jan-2017  nonaka iwm(4): 8260 works now. 4165 may works too.
 1.57  10-Jan-2017  nonaka set NULL after free.
 1.56  09-Jan-2017  nonaka Apply OpenBSD if_iwm.c rev.1.148.

> While setting up the basic rate bitmask for iwm's firmware, if the AP does
> not specify basic rates for either the CCK or OFDM set, add just the most
> basic rate to that set (1 Mbit/s in case of CCK, 6 Mbit/s in case of OFDM).
> This behaviour matches what code comments seem to imply.

> The previous code would add all possible basic rates in such cases.
> So if all basic rates were CCK only, the code would add all possible OFDM basic
> rates on top. Then the firmware would send some frames at too high rates, e.g.
> RTS frames would be sent at 24Mbit/s which is a bit risky on noisy channels.
 1.55  09-Jan-2017  khorben Do not use the "flags" field uninitialized

A backport if iwm(4) (to netbsd-7) does not build without this change.

LGTM nonaka@
 1.54  09-Jan-2017  nonaka Added enum iwm_tx_pm_timeouts from FreeBSD.
 1.53  09-Jan-2017  nonaka cosmetic.
 1.52  09-Jan-2017  nonaka use correct header size.
 1.51  08-Jan-2017  nonaka fix indent
 1.50  08-Jan-2017  nonaka iwm(4): make interrupt routine running on softint context.

see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html
 1.49  08-Jan-2017  nonaka use pci_intr_establish_xname(9).
 1.48  08-Jan-2017  nonaka twiddle bpf related.
 1.47  08-Jan-2017  nonaka cosmetic
 1.46  04-Jan-2017  nonaka Export some 802.11 IE manipulate functions.
 1.45  18-Dec-2016  nonaka iwm(4): Sync with OpenBSD.

7265 works fine.
7260 and 3160 maybe work.
7265D, 3165 and 8260 not work yet.

if_iwm.c: r1.147.
if_iwmreg.h: r1.19 without r1.16.
if_iwmvar.h: r1.24.

firmware is taken from https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi
- iwlwifi-7260-ucode-16.242414.0.tgz
- iwlwifi-3160-ucode-16.242414.0.tgz
- iwlwifi-7265-ucode-16.242414.0.tgz
- iwlwifi-8000-ucode-16.242414.0.tgz
 1.44  08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.43  23-Sep-2016  maya Fix inverted logic in iwm(4).

The PROT_REQUIRE flag in should be set for data frames above a certain
length, but we were setting it for !data frames above a certain length,
which makes no sense at all.

- taken from all other BSDs (OpenBSD, FreeBSD, DragonflyBSD...)
 1.42  10-Jun-2016  ozaki-r branches: 1.42.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.41  26-May-2016  ozaki-r Use M_GETCTX

No functional change.
 1.40  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.39  06-Nov-2015  nonaka Always use pci_intr_alloc(9)/pci_intr_release(9).
 1.38  14-Oct-2015  ozaki-r Remove leading whitespaces and kind
 1.37  24-Jul-2015  nonaka Use pci_intr_alloc().
 1.36  22-Jul-2015  nonaka iwm(4) can read the firmware image from disk when interface up.
This change is useful for full-disk encryption environment.
 1.35  22-May-2015  nonaka Limit the number of dma segments used for transmitting packets to
IWM_NUM_OF_TBS - 2. We have IWM_NUM_OF_TBS slots, but use two of those
for sending commands to the firmware.

From OpenBSD rev. 1.41.
 1.34  16-May-2015  nonaka should be able to use 5GHz wireless network.
 1.33  15-May-2015  knakahara if_iwm use unified establish API.
 1.32  29-Apr-2015  nonaka Added control debugging output via sysctl.
 1.31  28-Apr-2015  nonaka Use MSI instead of legacy INTx, if available.

should fix PR/49663.
 1.30  15-Apr-2015  nonaka Register iwm(4) with pmf(9).

Patch from Pierre Pronchery.
 1.29  26-Mar-2015  nonaka branches: 1.29.2;
Not all iwm hardware supports the 5GHz band. Make setting 11a rates
and scanning conditional on the 5GHz support bit in the nvm.

From OpenBSD rev. 1.39. Arranged by me.
 1.28  07-Mar-2015  nonaka Fix radiotap and fixed rates. Radiotap was reporting the wrong rate for
data frames and fixed rates weren't really fixed and were converted into
the wrong hardware rate.

From OpenBSD rev.1.36.
 1.27  07-Mar-2015  khorben Avoid kmem_free(NULL) in iwm_read_firmware()

This code path can be hit if the firmware failed to load, for instance
if the file is not present on the filesystem. In this case
firmware_open() fails, and fw->fw_rawdata never gets allocated in the
first place.
 1.26  04-Mar-2015  nonaka stop the calibration timeout when stopping the interface.

From OpenBSD rev.1.35.
 1.25  04-Mar-2015  nonaka Set/clear the IWM_MAC_FILTER_IN_BEACON flag under conditions that match what
Linux does.

From OpenBSD rev.1.34.
 1.24  03-Mar-2015  nonaka Fix 11a support.

From OpenBSD rev.1.33.
 1.23  03-Mar-2015  nonaka Make setting the MAC context bit for 11g protection when transmitting
OFDM frames conditional on the node via IEEE80211_F_USEPROT.

From OpenBSD rev.1.31.
 1.22  03-Mar-2015  nonaka Don't set CTS to self. Linux stopped setting this back in
dc271ee0d04d12d6bfabacbec803289a7072fbd9 as it is known
to cause problems.

From OpenBSD rev.1.30.
 1.21  03-Mar-2015  nonaka sc_fixed_ridx is initialised to 0 but tested as it it were initialised
to -1. The result of this is tx frames were always sent out at fixed
rate 0 instead of ni_txrate.

Match the iwn behaviour and test ic_fixed_rate for -1 instead.

From OpenBSD rev.1.29.
 1.20  03-Mar-2015  nonaka Correctly set lowest_present_ofdm in iwm_mvm_ack_rates().
From OpenBSD rev.1.28.
 1.19  03-Mar-2015  nonaka init error to 0 in iwm_send_cmd().
From OpenBSD rev.1.27.
 1.18  03-Mar-2015  nonaka match iwn and init txrate at lowest available bit-rate.
From OpenBSD rev.1.26.
 1.17  03-Mar-2015  nonaka workaround for interrupt coalescing bug not needed on 7265.
From OpenBSD if_iwm.c rev.1.25, if_iwmvar.h rev.1.7.
 1.16  02-Mar-2015  nonaka Correctly set lowest_present_ofdm in iwm_mvm_ack_rates().
From OpenBSD rev.1.23.
 1.15  25-Feb-2015  nonaka Display code number of unhandled packet.
 1.14  24-Feb-2015  christos Work around Coverity CIDs 127102{0,1}: Confused by the comparison
nrates > __arraycount(lq->rs_table), coverity erroneously binds nrates
to the range [0..16), whereas it is really bound to [0..15) by
ni->ni_rates.rs_nrates (IEEE80211_RATE_MAXSIZE). We add an explicit comparison
to unconfuse it that will always succeed.
 1.13  24-Feb-2015  nonaka Revert previous change.
 1.12  23-Feb-2015  nonaka CID 1271021: Overrunning array "in->in_ridx" of 15 bytes at byte offset 15 using index "i" (which evaluates to 15).

http://mail-index.netbsd.org/coverity-updates/2015/02/21/msg000115.html
 1.11  20-Feb-2015  nonaka Make the iwm(4) hardware receive filter pass multicast traffic from OpenBSD.
Fixes inet6 autoconf, for example.
 1.10  20-Feb-2015  nonaka Don't return success when hw is not ready.
 1.9  17-Feb-2015  nonaka fix compile failure with IWM_DEBUG on i386.
 1.8  16-Feb-2015  nonaka whitespace
 1.7  16-Feb-2015  nonaka Fix compile failure with clang.
Pointed out by Herbert J. Skuhra.
 1.6  14-Feb-2015  nonaka print error message when fail to load firmware.
 1.5  13-Feb-2015  nonaka iwm(4) works now, but 2.4GHz only.

> iwm0 at pci2 dev 0 function 0: Intel Dual Band Wireless AC 3160 (rev. 0x83)
> iwm0: interrupting at ioapic0 pin 18
> iwm0: hw rev: 0x160, fw ver 25.228 (API ver 9), address XX:XX:XX:XX:XX:XX
> iwm0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
> iwm0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
 1.4  13-Feb-2015  nonaka Make some functions and variables static.
 1.3  13-Feb-2015  nonaka Convert printf() to aprint_*().
 1.2  13-Feb-2015  nonaka Sync with OpenBSD if_iwm.c rev.1.18.
 1.1  07-Feb-2015  pooka Add a driver for Intel Centrino 7260 and similar wireless cards.
Supported devices should more or less match ones supported
by the Linux iwlwifi mvm driver. Sponsored by genua mbh for OpenBSD.

This is probably the world's first Canadian cross device driver: it was
created for OpenBSD by writing and porting a NetBSD driver which was
developed in a rump kernel in Linux userspace.

Note: I don't have access to the hardware anymore, so this version is
not tested and not enabled by default. While I tried to be careful in
adding the NetBSD bits back, it's probable that there's a snafu or two.
Feel free to send private email in case you have the hardware and there
are issues.
 1.29.2.11  28-Aug-2017  skrll Sync with HEAD
 1.29.2.10  05-Feb-2017  skrll Sync with HEAD
 1.29.2.9  05-Oct-2016  skrll Sync with HEAD
 1.29.2.8  09-Jul-2016  skrll Sync with HEAD
 1.29.2.7  29-May-2016  skrll Sync with HEAD
 1.29.2.6  19-Mar-2016  skrll Sync with HEAD
 1.29.2.5  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.29.2.4  22-Sep-2015  skrll Sync with HEAD
 1.29.2.3  06-Jun-2015  skrll Sync with HEAD
 1.29.2.2  06-Apr-2015  skrll Sync with HEAD
 1.29.2.1  26-Mar-2015  skrll file if_iwm.c was added on branch nick-nhusb on 2015-04-06 15:18:10 +0000
 1.42.2.3  20-Mar-2017  pgoyette Sync with HEAD
 1.42.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.42.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.61.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.73.2.3  02-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #456):
sys/arch/arm/sunxi/sunxi_emac.c: 1.9
sys/dev/ic/dwc_gmac.c: 1.43-1.44
sys/dev/pci/if_iwm.c: 1.75
sys/dev/pci/if_wm.c: 1.543
sys/dev/pci/ixgbe/ixgbe.c: 1.112
sys/dev/pci/ixgbe/ixv.c: 1.74
sys/kern/sys_socket.c: 1.75
sys/net/agr/if_agr.c: 1.43
sys/net/bpf.c: 1.219
sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416
sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257
sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146
sys/net/if_etherip.c: 1.40
sys/net/if_ethersubr.c: 1.243, 1.246
sys/net/if_faith.c: 1.57
sys/net/if_gif.c: 1.132
sys/net/if_l2tp.c: 1.15, 1.17
sys/net/if_loop.c: 1.98-1.101
sys/net/if_media.c: 1.35
sys/net/if_pppoe.c: 1.131-1.132
sys/net/if_spppsubr.c: 1.176-1.177
sys/net/if_tun.c: 1.142
sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121
sys/net/npf/npf_ifaddr.c: 1.3
sys/net/npf/npf_os.c: 1.8-1.9
sys/net/rtsock.c: 1.230
sys/netcan/if_canloop.c: 1.3-1.5
sys/netinet/if_arp.c: 1.255
sys/netinet/igmp.c: 1.65
sys/netinet/in.c: 1.210-1.211
sys/netinet/in_pcb.c: 1.180
sys/netinet/ip_carp.c: 1.92, 1.94
sys/netinet/ip_flow.c: 1.81
sys/netinet/ip_input.c: 1.362
sys/netinet/ip_mroute.c: 1.147
sys/netinet/ip_output.c: 1.283, 1.285, 1.287
sys/netinet6/frag6.c: 1.61
sys/netinet6/in6.c: 1.251, 1.255
sys/netinet6/in6_pcb.c: 1.162
sys/netinet6/ip6_flow.c: 1.35
sys/netinet6/ip6_input.c: 1.183
sys/netinet6/ip6_output.c: 1.196
sys/netinet6/mld6.c: 1.90
sys/netinet6/nd6.c: 1.239-1.240
sys/netinet6/nd6_nbr.c: 1.139
sys/netinet6/nd6_rtr.c: 1.136
sys/netipsec/ipsec_output.c: 1.65
sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10
kmem_intr_free kmem_intr_[z]alloced memory
the underlying pools are the same but api-wise those should match
Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.
No functional change
Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE
If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.
This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.
Proposed on tech-kern@ and tech-net@
Ensure to hold if_ioctl_lock when calling if_flags_set
Fix locking against myself on ifpromisc
vlan_unconfig_locked could be called with holding if_ioctl_lock.
Ensure to not turn on IFF_RUNNING of an interface until its initialization completes
And ensure to turn off it before destruction as per IFF_RUNNING's description
"resource allocated". (The description is a bit doubtful though, I believe the
change is still proper.)
Ensure to hold if_ioctl_lock on if_up and if_down
One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.
Make if_link_queue MP-safe if IFEF_MPSAFE
if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.
Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.
Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
Ensure to call if_addr_init with holding if_ioctl_lock
Get rid of outdated comments
Fix build of kernels without ether
By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.
PR kern/52790
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK
IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).
Wrap if_ioctl_lock with IFNET_* macros (NFC)
Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...
Reorder some destruction routines in if_detach
- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
pr_purgeif (otherwise destruction procedures can be tricky)
Ensure to call if_mcast_op with holding IFNET_LOCK
Note that CARP doesn't deal with IFNET_LOCK yet.
Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held
Describe which lock is used to protect each member variable of struct ifnet
Requested by skrll@
Write a guideline for converting an interface to IFEF_MPSAFE
Requested by skrll@
Note that IFNET_LOCK must not be held in softint
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.
 1.73.2.2  10-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
Return if bah_attach_subr() failed.
If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
If error occured in bcmeth_ccb_attach(), free resources and return.
If error occured in pq3etsec_attach(), free resources and return.
If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
If if_initialize() failed in the attach function, free resources and return.
If if_attach() failed in the attach function, free resources and return.
- If if_initialize() failed in the attach function, free resources and return.
- KNF
- If if_attach() failed in the attach function, free resources and return.
- KNF
Fix compile error.
Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice
 1.73.2.1  10-Jun-2017  snj Pull up following revision(s) (requested by nonaka in ticket #21):
sys/dev/pci/if_iwm.c: revision 1.74
fix typo.
reported by ryo@.
 1.75.2.3  26-Jul-2017  snj Pull up following revision(s) (requested by nonaka in ticket #1459):
sys/dev/pci/if_iwm.c: revision 1.72
iwm(4): match Wireless 8265 device.
 1.75.2.2  25-Jul-2017  snj Apply patch (requested by nonaka in ticket #1413):
iwm(4): Add a driver for Intel Wireless 726x, 316x, 826x and 416x series.
Ported from OpenBSD.
 1.75.2.1  23-Jul-2017  snj file if_iwm.c was added on branch netbsd-7 on 2017-07-25 19:43:03 +0000
 1.76.2.2  03-Dec-2017  jdolecek update from HEAD
 1.76.2.1  23-Oct-2017  jdolecek file if_iwm.c was added on branch tls-maxphys on 2017-12-03 11:37:07 +0000
 1.78.2.2  28-Jul-2018  pgoyette Sync with HEAD
 1.78.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.83.10.1  29-Feb-2020  ad Sync with head.
 1.83.2.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.85.6.2  01-Aug-2021  thorpej Sync with HEAD.
 1.85.6.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.89.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed