STRUCT MT7601U_DEV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct mt7601u_dev(9) β€” the kernel API manual, but make it cute

okay so this is a page from the Kernel API Manual about struct mt7601u_dev, and bestie it is the adapter structure, like the main character of the whole mt7601u driver. let's get into it 🫢


✨ NAME ✨

struct mt7601u_dev β€” the adapter structure. that's it, that's the vibe. she holds the whole adapter together πŸ’…


🌸 SYNOPSIS 🌸

here's the whole struct, exactly as she lives, no cap, every field in order:

struct mt7601u_dev {
    struct ieee80211_hw *hw;
    struct device *dev;
    unsigned long state;
    struct mutex mutex;
    unsigned long wcid_mask[N_WCIDS / BITS_PER_LONG];
    struct cfg80211_chan_def chandef;
    struct ieee80211_supported_band *sband_2g;
    struct mt7601u_mcu mcu;
    struct delayed_work cal_work;
    struct delayed_work mac_work;
    struct workqueue_struct *stat_wq;
    struct delayed_work stat_work;
    struct mt76_wcid *mon_wcid;
    struct mt76_wcid *wcid[N_WCIDS];
    spinlock_t lock;
    spinlock_t mac_lock;
    const u16 *beacon_offsets;
    u8 macaddr[ETH_ALEN];
    struct mt7601u_eeprom_params *ee;
    struct mutex vendor_req_mutex;
    void *vend_buf;
    struct mutex reg_atomic_mutex;
    struct mutex hw_atomic_mutex;
    u32 rxfilter;
    u32 debugfs_reg;
    u8 out_eps[8];
    u8 in_eps[8];
    u16 out_max_packet;
    u16 in_max_packet;
    spinlock_t tx_lock;
    struct tasklet_struct tx_tasklet;
    struct mt7601u_tx_queue *tx_q;
    struct sk_buff_head tx_skb_done;
    atomic_t avg_ampdu_len;
    spinlock_t rx_lock;
    struct tasklet_struct rx_tasklet;
    struct mt7601u_rx_queue rx_q;
    spinlock_t con_mon_lock;
    u8 ap_bssid[ETH_ALEN];
    s8 bcn_freq_off;
    u8 bcn_phy_mode;
    struct ewma_rssi avg_rssi;
    u8 agc_save;
    struct mt7601u_freq_cal freq_cal;
    bool tssi_read_trig;
    s8 tssi_init;
    s8 tssi_init_hvga;
    s16 tssi_init_hvga_offset_db;
    int prev_pwr_diff;
    enum mt_temp_mode temp_mode;
    int curr_temp;
    int dpd_temp;
    s8 raw_temp;
    bool pll_lock_protect;
    u8 bw;
    bool chan_ext_below;
    u32 rf_pa_mode[2];
    struct mac_stats stats;
};

like, that's a lot of fields and honestly? iconic. she's booked and busy πŸ’€


πŸŽ€ Members πŸŽ€

okay so this is the part where the manpage actually tells you what the locks do, which is lowkey the most important part because locks are literally how we don't corrupt everything. pay attention bestie 🧚

  • mutex β€” ensures exclusive access from mac80211 callbacks. one at a time, please, no shoving πŸ’…
  • lock β€” protects wcid->tx_rate.
  • mac_lock β€” locks out mac80211's tx status and rx paths.
  • vendor_req_mutex β€” protects vend_buf, and ensures atomicity of read/write accesses.
  • reg_atomic_mutex β€” ensures atomicity of indirect register accesses, meaning accesses to RF and BBP. fancy indirect stuff, she's got it handled ✨
  • hw_atomic_mutex β€” ensures exclusive access to HW during critical operations, so that's power management and channel switch. nobody else gets to touch the hardware mid-glow-up πŸ”₯
  • tx_lock β€” protects tx_q and changes of the MT7601U_STATE_*_STATS flags in state. note the * there, it's a whole family of flags, don't @ me πŸ™ˆ
  • rx_lock β€” protects rx_q. symmetric queen 🌸
  • con_mon_lock β€” protects ap_bssid, bcn_*, avg_rssi. yes, all three, she's a multitasker πŸ’–
fr fr bestie: these lock descriptions are the whole point of the page. if you mix up which lock guards what, you get a data race and that's not the vibe check you want πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

go read the actual kernel file, that's where the real lore lives:

./drivers/net/wireless/mediatek/mt7601u/mt7601u.h

iykyk, header files are where the truth is ⭐


and that's the page!! this one came from the source path ./drivers/net/wireless/mediate... (yes it got cut off on the original page, that's just how it renders, no cap) and it's dated October 2026. slay, go forth and guard your locks properly bestie πŸŒˆπŸŽ€βœ¨

πŸ“¦ where this page comes from