Commit Graph
1387 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 9029560fad mt76: dma: add skb check for dummy pointer
Introduce skb check for dummy address in mt76_dma_tx_cleanup_idx.
This is a preliminary patch to add support for new chipsets (e.g. 7615)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau c47a5685d0 mt76: dma: introduce skb field in mt76_txwi_cache
Introduce skb field in mt76_txwi_cache. Moreover add txwi_flags
to mt76_driver_ops since new chipsets will release mt76_txwi_cache/skbs
at tx completion instead of dma one.
This is a preliminary patch to add mt7615 support

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 5007326555 mt76: add skb pointer to mt76_tx_info
Pass skb pointer to tx_prepare_skb through mt76_tx_info data structure.
This is a preliminary patch to properly support dma error path for
new chipsets (e.g. 7615)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 3e371ca35c mt76: set txwi_size according to the driver value
Dynamically allocate txwi since new chipsets will use longer txwi
descriptors

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 49d9c1b29f mt76: usb: reduce locking in mt76u_tx_tasklet
Similar to pci counterpart, reduce locking in mt76u_tx_tasklet since
q->head is managed just in mt76u_tx_tasklet and q->queued is updated
holding q->lock

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Ryder LeeandFelix Fietkau 133bffba8b add firmware for MT7615E
Add binary firmware for MT7615E based devices

Signed-off-by: Ryder Lee <[email protected]>
2019-04-25 12:04:34 +02:00
Ryder LeeandFelix Fietkau 355c07904d mt76: use macro for sn and seq_ctrl conversion
Use macro to convert sn and seq_ctrl for better readability.

Signed-off-by: Roy Luo <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:34 +02:00
Ryder LeeandFelix Fietkau edb2a001b6 mt76: add unlikely() for dma_mapping_error() check
In the tx/rx fastpath, the funciton dma_map_single() rarely fails.
This adds unlikely() optimization to this error check conditional.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:34 +02:00
Ryder LeeandFelix Fietkau 334b4cedf2 mt76: add mac80211 driver for MT7615 PCIe-based chipsets
This driver is for a newer generation of MediaTek MT7615 4x4 802.11ac
PCIe-based chipsets, which support wave2 MU-MIMO up to 4 users/group
and also support up to 160MHz bandwidth.

The driver fully supports AP, station and monitor mode.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Roy Luo <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau a7dfcf2e24 mt76: move mac_work in mt76_dev
Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 61311d9b30 mt76: introduce mt76_free_device routine
Move mt76_tx_free in mt76_free_device routine in order to
unmap all txwi descriptors at module unload

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau 7fc5f925ec mt76x2u: remove duplicated entry in mt76x2u_device_table
Remove duplicated entry in mt76x2u_device_table since Alfa AWUS036ACM
and Aukey USB-AC1200 have the same ids

Fixes: 62a25dc56990a ("mt76x2u: Add support for Alfa AWUS036ACM")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:27 +02:00
Stanislaw GruszkaandFelix Fietkau ffddb685a6 mt76x02u: check chip version on probe
Since some USB device IDs are duplicated between mt76x0u, mt7601u
and mt76x2u device, check chip version on probe and return error if
not match the driver.

Don't think this is serious issue, probe most likely will fail at
some other point for wrong device, but we do not have to configure
it if we know is not our device.

Reported-by: Xose Vazquez Perez <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2019-04-25 12:04:20 +02:00
Felix Fietkau b3a29655ae mt76x02: fix crash on device reset
Tasklets must not be reinitialized after being scheduled

Signed-off-by: Felix Fietkau <[email protected]>
2019-04-03 11:12:31 +02:00
Felix Fietkau a11b67348a mt76: fix tx power issues
- tx power is stored in the channels after ieee80211_register_hw, so
  chan->orig_mpwr needs to be updated as well
- for non-TSSI devices, mt76x2e needs to use a different target power value
  from the EEPROM
- fix a rounding error in a few places (need to round up, not down)

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-27 12:54:48 +01:00
Felix Fietkau bf6e72d6df Revert "mt76: mt76x02: store software PN/IV in wcid"
This reverts commit f37ad72f1a.
PN needs to be shared with mac82011 for mgmt frame crypto

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-26 11:35:22 +01:00
Felix Fietkau ae166b09cf Revert "mt76: mt7603: store software PN/IV in wcid"
This reverts commit 2660aa98c4.
PN needs to be shared with mac82011 for mgmt frame crypto

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-26 11:35:18 +01:00
Felix Fietkau 30a256a438 mt76x02: remove extra_tx_headroom (obsoleted by mac8211 skb aligning)
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-25 09:30:05 +01:00
Stanislaw GruszkaandFelix Fietkau 2e89721e62 mt76usb: remove queue variable from rx_tasklet
Since now only mt76u_get_next_rx_entry use queue argument move
it to this function.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 57309c7e94 mt76usb: allocate urb and sg as linear data
Alloc sg table at the end of urb structure. This will increase
cache usage.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 4d4d73a796 mt76usb: remove unneded sg_init_table
We already allocate with GFP_ZERO and sg marker is set later for
both RX and TX.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 42f2899d4d mt76usb: resue mt76u_urb_alloc for tx
Add new rx_urb_alloc routine and reuse common urb_alloc for tx
allocations.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 0904bc4168 mt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc
Get the RX queue inside mt76u_refill_rx. This will allow to reuse
mt76u_urb_alloc for TX allocations.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 4a366bdc0e mt76usb: remove mt76u_buf and use urb directly
Put urb pointer in mt76_queue_entry directly instead of mt76u_buf
structure.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau 3f9b68d0f6 mt76usb: move mt76u_buf->done to queue entry
mt76_queue_entry has alreay one bool variable, adding new one will
not increase it's size. Removing ->done filed from mt76u_buf will
allow to use urb directly in mt76usb code.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:42 +01:00
Stanislaw GruszkaandFelix Fietkau a4eb5db07c mt76usb: remove mt76u_buf redundant fileds
Remove mt76u_buf->{len, buf} fields and operate on corresponding
urb fields directly.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:28 +01:00
Stanislaw GruszkaandFelix Fietkau e9c017190e mt76usb: use usb_dev private data
Setup usb device private data. This allows to remove mt76u_buf->dev
and simplify some routines as no longer we need to get usb device
through usb interface.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:28 +01:00
Stanislaw GruszkaandFelix Fietkau e1bfbeb162 mt76usb: change mt76u_fill_rx_sg arguments
We do not need to pass len and sglen to the function.
Additionally pass gfp to control allocation context.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:28 +01:00
Stanislaw GruszkaandFelix Fietkau 16b2ccf535 mt76: remove rx_page_lock
We can not run mt76u_alloc_buf() concurently, rx_tasklet is stooped
when mt76u_submit_rx_buffers(). We can remove rx_page_lock.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:28 +01:00
Stanislaw GruszkaandFelix Fietkau cf1838d214 mt76usb: change mt76u_submit_buf
Remove unnecessery arguments and change the function name since is
now used only for RX.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2019-03-24 08:24:28 +01:00
Stanislaw GruszkaandFelix Fietkau f720e499fc mt76x02: enable AP mode for USB
Enable AP mode. For now without multi-vif support, this will require
more testing and investigation.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 65e634418c mt76: unify set_tim
All mt76 drivers (now also USB drivers) require empty .set_tim
callback. Add it to common mt76 module and use on all drivers.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau d4c740f071 mt76x02u: add mt76_release_buffered_frames
Create software MT_TXQ_PSD queue for USB and map it to MT_TXQ_VO
since we do not have USB endpoint for PSD. This should make
mt76_release_buffered_frames() work by sending released frames
via MT_TXQ_VO.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 77e56b87bf mt76x02: make beacon slots bigger for USB
Since we sent PS buffered frames via beacon memory we need to make
beacon slots bigger. That imply we will also need to decrease number
of slots as beacon SRAM memory is limited to 8kB.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau e284cc2b6e mt76x02u: implement pre TBTT work for USB
Program beacons data and PS buffered frames on TBTT work for USB.
We do not have MT_TXQ_PSD queue available via USB endpoints. The way
we can send PS broadcast frames in timely manner before PS stations go
sleep again is program them in beacon data area. Hardware do not modify
those frames since TXWI is properly configured. mt76x02_mac_set_beacon()
already handle this and free no longer used frames.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 5ac52890d9 mt76x02: disable HW encryption for group frames
This is required to sent multicast/broadcast frames in USB AP
mode just after beacon.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau dcccc04adc mt76x02u: add sta_ps
Add sta_ps callback but dont set WCID drop sicne registers for USB
can not be accessed from tasklet context.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 41d61908b2 mt76x02: generalize some mmio beaconing functions
Move some TBTT mmio functions to mt76x02_beacon.c and create new ones
in order to be reused by USB pre-TBTT.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 37af803a2f mt76x02u: implement beacon_ops
Add implementation of beacon_ops for USB and exit function to
stop the timer if running when device is removed. Still no
actual work on pre tbtt event.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:22:22 +01:00
Stanislaw GruszkaandFelix Fietkau 6370485deb mt76x02: introduce beacon_ops
Enabling/disableing TBTT and beacon will be diffrent for USB. Introduce
beacon_ops to encapsulate that and implement it for MMIO. USB
implementation is noop for now.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:21:28 +01:00
Stanislaw GruszkaandFelix Fietkau 91ade88519 mt76x02: add hrtimer for pre TBTT for USB
Add timer and work for pre TBTT for USB devices. For now code
doesn't do anyting useful, just add hrtimer which synchronize
with hardware MT_TBTT_TIMER.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:20:43 +01:00
Stanislaw GruszkaandFelix Fietkau f2a18f5a7f mt76x02: introduce mt76x02_beacon.c
Move most of beaconing code into separate file and separate beacon
initialization for USB and MMIO as pre TBTT implementation for USB
will be different.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-24 08:20:43 +01:00
Felix Fietkau 6fc50ea917 mt7603: send BAR after powersave wakeup
Now that the sequence number allocation is fixed, we can finally send a BAR
at powersave wakeup time to refresh the receiver side reorder window

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-23 18:01:28 +01:00
Felix Fietkau 5912e8a1ff mt7603: fix sequence number assignment
If the MT_TXD3_SN_VALID flag is not set in the tx descriptor, the hardware
assigns the sequence number. However, the rest of the code assumes that the
sequence number specified in the 802.11 header gets transmitted.
This was causing issues with the aggregation setup, which worked for the
initial one (where the sequence numbers were still close), but not for
further teardown/re-establishing of sessions.

Additionally, the overwrite of the TID sequence number in WTBL2 was resetting
the hardware assigned sequence numbers, causing them to drift further apart.

Fix this by using the software assigned sequence numbers

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-23 17:58:06 +01:00
Felix Fietkau 60e508ed14 mt76: use readl/writel instead of ioread32/iowrite32
readl/writel is faster because it gets rid of unnecessary extra checks

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-23 15:24:58 +01:00
Felix Fietkau c9402eb0f0 mt76: use napi polling for tx cleanup
This allows tx scheduling and tx cleanup to run concurrently

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 14:05:08 +01:00
Felix Fietkau deacb8fa8a mt76: fix using mac80211 tx skb header padding
If the 802.11 frame has no payload, skip the padding.
Also add missing code to mt76x02u

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 14:02:57 +01:00
Felix Fietkau 3a7e6bbac3 mt76: fix potential deadlock on cancelling workqueues
mutex->lock must not be held while cancelling workqueues, because it is held
by the workqueue items themselves

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 13:29:47 +01:00
Felix Fietkau 7e9e9ad734 mt76: mt7603: add missing initialization for dev->ps_lock
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 13:29:47 +01:00
Felix Fietkau 4d8c7e8284 mt76: mt76x02: send no-skb tx status without holding the status lock
Simplifies locking and reduces lock contention

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-22 13:29:47 +01:00