Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/athn.c
RevisionDateAuthorComments
 1.26  18-Mar-2022  riastradh net80211: Use getticks(), not hardclock_ticks.

Less extern in .c this way too.
 1.25  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.24  15-Nov-2020  mlelstv branches: 1.24.4;
Don't unlock without having taken the lock.
 1.23  29-Jan-2020  thorpej branches: 1.23.6;
Adopt <net/if_stats.h>.
 1.22  25-Jul-2019  msaitoh branches: 1.22.4;
Avoid undefined behavior. Found by KUBSan. Some of errors are still remaining.
 1.21  28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.20  28-May-2019  msaitoh Modify to use athn_set_multi().
 1.19  24-May-2019  msaitoh KNF. No functional change.
 1.18  26-Jun-2018  msaitoh branches: 1.18.2;
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.17  23-Oct-2017  msaitoh branches: 1.17.2;
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
 1.16  11-Apr-2017  jmcneill branches: 1.16.4;
Disable interrupts before returning from isr, and re-enable them when the
soft interrupt handler returns. Fixes an interrupt storm on Tegra K1.
ok christos@
 1.15  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.14  21-Jan-2017  skrll Pull across from nick-nhusb.

Some locking fixing, MPification and an attach fix
 1.13  26-May-2016  ozaki-r branches: 1.13.2; 1.13.4;
Use M_GETCTX

No functional change.
 1.12  17-Nov-2015  jakllsch Revert changes of athn.c r1.8.

- aprint_normal is correct for the attach message
- KNF adjustments in code we sync with upstream are a nuisance
- aprint_error{,_dev}() is inappropriate for use in runtime code
 1.11  22-Sep-2015  joerg Avoid left-shift of negative values.
 1.10  24-Jul-2014  riz branches: 1.10.4;
Fix last change (pa_calib_ticks should be sc_pa_calib_ticks).
 1.9  24-Jul-2014  christos sync with OpenBSD
 1.8  23-Feb-2014  christos branches: 1.8.2; 1.8.4;
use aprint.
 1.7  17-Oct-2013  christos - remove unused variables
- move variables inside ifdef sections
- ifdef notdef unused code
- use __USE for debugging variables
 1.6  24-Jun-2013  martin branches: 1.6.2;
Stopgap for PR kern/47957: when reinitializing the chip in if_timeout,
avoid pmf operations as we are called from softint context.

This is not a 100% solution, since we still may end up panicing if
initialization fails.

Instead of hacking around it on a per driver level, wouldn't it be better
to have a single global workqueue and dispatch the if_slowtimo() calls
via that?
 1.5  10-Apr-2013  christos branches: 1.5.4;
sort prototypes.
 1.4  06-Apr-2013  martin Fix return type and value of athn_resume (true for success, not 0 for no
error).
Avoid endless recursion in athn_init when the device had been suspended
via pmf_device_recursive_resume -> athn_resume -> athn_init.
Avoid touching the hardware when the device is not fully powered up yet.
 1.3  06-Apr-2013  martin Debounce the "wlan button pressed" event via pmf PMFE_RADIO_OFF so we
can run the pmf stuff in thread context.
 1.2  05-Apr-2013  martin Cleanup attach message slightly
 1.1  30-Mar-2013  christos This is the initial port of OpenBSD's athn(4) driver. It supports
quite a few Atheros 802.11n devices. See the athn(4) manpage for a
list.

This port has only been tested with a TP-LINK TL-WN722N USB adapter
which has an AR9271 chipset (VENDOR: 0x0cf3, PRODUCT: 0x9271). The
BSS, Monitor, and HostAP modes all seem to work on that adapter,
though the later has not been tested much.

The driver also supports PCI and CardBUS devices, but those interfaces
are completely untested and probably won't work at this point.

If someone can provide me with other adapters that should be
supported, particularly PCI or CardBUS adapters, or tell me where I
can get one cheaply, I would be happy to try to get the driver working
on those devices as well.
 1.5.4.4  03-Dec-2017  jdolecek update from HEAD
 1.5.4.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.4.2  23-Jun-2013  tls resync from head
 1.5.4.1  10-Apr-2013  tls file athn.c was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.6.2.1  18-May-2014  rmind sync with head
 1.8.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.4.1  23-Feb-2014  yamt file athn.c was added on branch yamt-pagecache on 2014-05-22 11:40:22 +0000
 1.8.2.1  10-Aug-2014  tls Rebase.
 1.10.4.5  28-Aug-2017  skrll Sync with HEAD
 1.10.4.4  05-Feb-2017  skrll Sync with HEAD
 1.10.4.3  28-Dec-2016  skrll Various improvements

- override the method before calling athn_attach -> if_attach -> interface
announce
- locking fixes for htc/wmi
- some MPificaton
 1.10.4.2  29-May-2016  skrll Sync with HEAD
 1.10.4.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.13.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.13.2.2  26-Apr-2017  pgoyette Sync with HEAD
 1.13.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.16.4.1  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.17.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.18.2.4  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.2.3  08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.2.2  10-Jun-2019  christos Sync with HEAD
 1.18.2.1  12-Jul-2018  phil State save. New kernel config for this brach only. TESTWIFI does
produce a kernel. It is not working. athn files not compiling yet
and commented out of the TESTWIFI kernel, which only has urtwn 802.11
driver enabled. ieee80211_alq.c and ieee80211_ddb.c not compiling yet.
 1.22.4.1  29-Feb-2020  ad Sync with head.
 1.23.6.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.24.4.1  17-Jun-2021  thorpej Sync w/ HEAD.

RSS XML Feed