Skip to content
shaecodes-wildePublic
forked from openwrt/mt76

About

mt76 fork: fixes injected legacy TX rates on MediaTek MT7920/MT7921/MT7922 PCIe so AirDrop via omdrop-owl works on Linux

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

5,035 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mt76 with an injected-rate fix for AirDrop on MediaTek MT7921/MT7922

A fork of the Linux MediaTek Wi-Fi driver (openwrt/mt76) with one fix: injected Wi-Fi frames on MT7920/MT7921/MT7922 PCIe cards now go out at the rate that was requested. Without this fix, AirDrop between an iPhone and a Linux laptop over omdrop-owl is unreliable on 2.4 GHz and can fail entirely on 5 GHz.

Status: experimental. The fix is not in upstream mt76 or any released kernel yet.

Why this exists

AirDrop on non-Apple hardware relies on injecting raw Wi-Fi frames at a chosen legacy rate. On these MediaTek cards, the PCIe driver loses the requested rate before it builds the hardware descriptor. Every injected unicast frame then goes out at the 1 Mbps CCK default. That is too slow for reliable 2.4 GHz transfers, and in the reported 5 GHz failure, injected unicast never reached the air (omdrop-owl issue 14).

The fix saves the requested rate before TX status bookkeeping overwrites it, then sets only the descriptor's rate field. Everything else the driver normally does, including antenna selection and ACK policy, is unchanged. HT/VHT rates and hardware encapsulation are left alone.

Does it cover my card?

Check with lspci -nnk | grep -A3 -i mediatek. The fix applies to cards using the mt7921e driver:

Chip PCI ID seen in testing Status
MT7922 14c3:7922, 14c3:0616 Works: transfers in both directions, active-monitor and shared modes
MT7921 14c3:7961 Works: independent tester, transfers in both directions in active-monitor mode
MT7920 — Included because it shares the same code path; not tested on hardware
MT7902 — Deliberately excluded

USB (mt7921u) and SDIO (mt7921s) versions are not affected by this change. The hardware results above come from the earlier revisions of the fix. The current revision only widens which chips are enabled and has not yet been confirmed on hardware. The full record is in docs/VALIDATION.md.

Try it

The usual approach is to patch the mt76 source that matches your running kernel and rebuild only mt7921e, leaving every other driver module stock. Don't build this fork's master against a distro kernel: it tracks newer kernel APIs and won't link.

# 1. Fetch the mt76 sources for your kernel version (here 7.2.5; check `uname -r`).
#    For an x.y.0 kernel the tag is vX.Y, e.g. v7.2.
git clone --depth 1 --branch v7.2.5 --filter=blob:none --sparse \
  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-src
cd linux-src
git sparse-checkout set drivers/net/wireless/mediatek/mt76
cd drivers/net/wireless/mediatek/mt76

# 2. Apply the fix.
curl -fsSL https://github.com/shaecodes-wilde/mt76/compare/467ae2e3f190...fix/mt7921-family-driver.diff | patch -p1

# 3. Build only mt7921e against your installed kernel headers.
make -C /lib/modules/$(uname -r)/build M="$PWD/mt7921" \
  CONFIG_MT7921_COMMON= CONFIG_MT7921S= CONFIG_MT7921U= modules

# 4. Swap it in until the next reboot.
sudo rmmod mt7921e
sudo insmod mt7921/mt7921e.ko

To go back to the stock driver, reboot or run sudo rmmod mt7921e && sudo modprobe mt7921e.

Notes:

  • These steps were checked against Linux 7.2.5: the patch applies cleanly and mt7921e.ko builds. If your distro carries its own kernel patches and step 2 fails, use your distro's kernel source package.
  • With Secure Boot enforcing module signatures, an unsigned module is refused. Sign it or use a test machine.
  • This repository provides no installer or DKMS package. Making the module persistent is up to you.
  • The driver fix doesn't configure omdrop-owl. Shared mode needs Wi-Fi on an AirDrop-compatible channel (6, 44, or 149).

For upstream reviewers

The change is confined to mt7921e_tx_prepare_skb() in mt7921/pci_mac.c. Root cause: mt76_tx_status_skb_add() clears status_driver_data, which overlaps info->control.flags, so IEEE80211_TX_CTRL_RATE_INJECT has already been erased when the common TXWI builder checks it.

The clean patch series is on its own branches, based on openwrt/mt76 467ae2e3f190, without this README:

Offline regression testing: a 24-case kernel test module exercises the real PCI/status/TXWI routines. Each unpatched base failed 11 cases and each patched version passed all 24, against openwrt/mt76, Linux 7.2.5 and the maintainer tree at 2e6968e9286f. The expanded 72-case family suite builds but has not been executed yet. Both patches pass checkpatch.

Before mailing, the series needs to be squashed with a revised description, given a verified earliest Fixes: reference (the current tag only covers MT7922) and a human DCO sign-off. The reproducer and source hashes are in the omdrop-owl findings.

License

Same as upstream mt76; see LICENSE.

About

mt76 fork: fixes injected legacy TX rates on MediaTek MT7920/MT7921/MT7922 PCIe so AirDrop via omdrop-owl works on Linux

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages