Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
a520b49
Documentation
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fmc
fpga
fsi
gpio
gpu
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
ide
idle
iio
infiniband
input
iommu
ipack
irqchip
isdn
leds
lguest
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
mtd
net
appletalk
arcnet
bonding
caif
can
cris
dsa
ethernet
fddi
fjes
hamradio
hippi
hyperv
ieee802154
ipvlan
irda
phy
plip
ppp
slip
team
usb
vmxnet3
wan
wimax
wireless
admtek
ath
ar5523
ath10k
ath5k
ath6kl
ath9k
carl9170
wcn36xx
wil6210
Kconfig
Makefile
boot_loader.h
cfg80211.c
debug.c
debugfs.c
ethtool.c
fw.c
fw.h
fw_inc.c
interrupt.c
main.c
netdev.c
p2p.c
pcie_bus.c
pm.c
pmc.c
pmc.h
rx_reorder.c
trace.c
trace.h
txrx.c
txrx.h
wil6210.h
wil_crash_dump.c
wil_platform.c
wil_platform.h
wmi.c
wmi.h
Kconfig
Makefile
ath.h
debug.c
dfs_pattern_detector.c
dfs_pattern_detector.h
dfs_pri_detector.c
dfs_pri_detector.h
hw.c
key.c
main.c
reg.h
regd.c
regd.h
regd_common.h
spectral_common.h
trace.c
trace.h
atmel
broadcom
cisco
intel
intersil
marvell
mediatek
ralink
realtek
rsi
st
ti
zydas
Kconfig
Makefile
mac80211_hwsim.c
mac80211_hwsim.h
ray_cs.c
ray_cs.h
rayctl.h
rndis_wlan.c
wl3501.h
wl3501_cs.c
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c
macsec.c
macvlan.c
macvtap.c
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
tun.c
veth.c
virtio_net.c
vrf.c
vsockmon.c
vxlan.c
xen-netfront.c
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
oprofile
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sfi
sh
sn
soc
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
uio
usb
uwb
vfio
vhost
video
virt
virtio
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
net
/
wireless
/
ath
/
wil6210
/
netdev.c
Copy path
Blame
Blame
Latest commit
History
History
234 lines (181 loc) · 5.38 KB
Breadcrumbs
linux
/
drivers
/
net
/
wireless
/
ath
/
wil6210
/
netdev.c
Top
File metadata and controls
Code
Blame
234 lines (181 loc) · 5.38 KB
Raw
/* * Copyright (c) 2012-2017 Qualcomm Atheros, Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <linux/etherdevice.h> #include "wil6210.h" #include "txrx.h" static int wil_open(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); wil_dbg_misc(wil, "open\n"); if (debug_fw || test_bit(WMI_FW_CAPABILITY_WMI_ONLY, wil->fw_capabilities)) { wil_err(wil, "while in debug_fw or wmi_only mode\n"); return -EINVAL; } return wil_up(wil); } static int wil_stop(struct net_device *ndev) { struct wil6210_priv *wil = ndev_to_wil(ndev); wil_dbg_misc(wil, "stop\n"); return wil_down(wil); } static const struct net_device_ops wil_netdev_ops = { .ndo_open = wil_open, .ndo_stop = wil_stop, .ndo_start_xmit = wil_start_xmit, .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, }; static int wil6210_netdev_poll_rx(struct napi_struct *napi, int budget) { struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, napi_rx); int quota = budget; int done; wil_rx_handle(wil, "a); done = budget - quota; if (done < budget) { napi_complete_done(napi, done); wil6210_unmask_irq_rx(wil); wil_dbg_txrx(wil, "NAPI RX complete\n"); } wil_dbg_txrx(wil, "NAPI RX poll(%d) done %d\n", budget, done); return done; } static int wil6210_netdev_poll_tx(struct napi_struct *napi, int budget) { struct wil6210_priv *wil = container_of(napi, struct wil6210_priv, napi_tx); int tx_done = 0; uint i; /* always process ALL Tx complete, regardless budget - it is fast */ for (i = 0; i < WIL6210_MAX_TX_RINGS; i++) { struct vring *vring = &wil->vring_tx[i]; struct vring_tx_data *txdata = &wil->vring_tx_data[i]; if (!vring->va || !txdata->enabled) continue; tx_done += wil_tx_complete(wil, i); } if (tx_done < budget) { napi_complete(napi); wil6210_unmask_irq_tx(wil); wil_dbg_txrx(wil, "NAPI TX complete\n"); } wil_dbg_txrx(wil, "NAPI TX poll(%d) done %d\n", budget, tx_done); return min(tx_done, budget); } static void wil_dev_setup(struct net_device *dev) { ether_setup(dev); dev->max_mtu = mtu_max; dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT; } void *wil_if_alloc(struct device *dev) { struct net_device *ndev; struct wireless_dev *wdev; struct wil6210_priv *wil; struct ieee80211_channel *ch; int rc = 0; wdev = wil_cfg80211_init(dev); if (IS_ERR(wdev)) { dev_err(dev, "wil_cfg80211_init failed\n"); return wdev; } wil = wdev_to_wil(wdev); wil->wdev = wdev; wil->radio_wdev = wdev; wil_dbg_misc(wil, "if_alloc\n"); rc = wil_priv_init(wil); if (rc) { dev_err(dev, "wil_priv_init failed\n"); goto out_wdev; } wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */ /* default monitor channel */ ch = wdev->wiphy->bands[NL80211_BAND_60GHZ]->channels; cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT); ndev = alloc_netdev(0, "wlan%d", NET_NAME_UNKNOWN, wil_dev_setup); if (!ndev) { dev_err(dev, "alloc_netdev_mqs failed\n"); rc = -ENOMEM; goto out_priv; } ndev->netdev_ops = &wil_netdev_ops; wil_set_ethtoolops(ndev); ndev->ieee80211_ptr = wdev; ndev->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXHASH; ndev->features |= ndev->hw_features; SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); wdev->netdev = ndev; return wil; out_priv: wil_priv_deinit(wil); out_wdev: wil_wdev_free(wil); return ERR_PTR(rc); } void wil_if_free(struct wil6210_priv *wil) { struct net_device *ndev = wil_to_ndev(wil); wil_dbg_misc(wil, "if_free\n"); if (!ndev) return; wil_priv_deinit(wil); wil_to_ndev(wil) = NULL; free_netdev(ndev); wil_wdev_free(wil); } int wil_if_add(struct wil6210_priv *wil) { struct wireless_dev *wdev = wil_to_wdev(wil); struct wiphy *wiphy = wdev->wiphy; struct net_device *ndev = wil_to_ndev(wil); int rc; wil_dbg_misc(wil, "entered"); strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version)); rc = wiphy_register(wiphy); if (rc < 0) { wil_err(wil, "failed to register wiphy, err %d\n", rc); return rc; } netif_napi_add(ndev, &wil->napi_rx, wil6210_netdev_poll_rx, WIL6210_NAPI_BUDGET); netif_tx_napi_add(ndev, &wil->napi_tx, wil6210_netdev_poll_tx, WIL6210_NAPI_BUDGET); wil_update_net_queues_bh(wil, NULL, true); rc = register_netdev(ndev); if (rc < 0) { dev_err(&ndev->dev, "Failed to register netdev: %d\n", rc); goto out_wiphy; } return 0; out_wiphy: wiphy_unregister(wdev->wiphy); return rc; } void wil_if_remove(struct wil6210_priv *wil) { struct net_device *ndev = wil_to_ndev(wil); struct wireless_dev *wdev = wil_to_wdev(wil); wil_dbg_misc(wil, "if_remove\n"); unregister_netdev(ndev); wiphy_unregister(wdev->wiphy); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
You can’t perform that action at this time.