[PATCH 01/11] wifi: mt76: connac: use is_connac2() to replace is_mt7921() checks

Sean Wang sean.wang at kernel.org
Sat Feb 21 12:19:26 PST 2026


On Fri, Feb 20, 2026 at 2:41 PM Philip Müller <philm at manjaro.org> wrote:
>
> Hi Sean,
>
> this patch needed the following lines additionally to compile cleanly:
>

Hi Philip,

Thanks for the catch I’ll update this in the next version.

Best,
Sean

> drivers/net/wireless/mediatek/mt76/mt792x_core.c
>
> @@ -691,7 +691,7 @@ int mt792x_init_wiphy(struct ieee80211_h
>       ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
>       ieee80211_hw_set(hw, SUPPORTS_ONLY_HE_MULTI_BSSID);
>
> -    if (is_mt7921(&dev->mt76)) {
> +    if (is_connac2(&dev->mt76)) {
>           ieee80211_hw_set(hw, CHANCTX_STA_CSA);
>       }
>
> On 2/19/26 01:39, sean.wang at kernel.org wrote:
> > From: Sean Wang <sean.wang at mediatek.com>
> >
> > Unify all per-chip conditionals under the new is_connac2() helper. This
> > avoids confusion caused by the previous is_mt7921() check, which
> > implicitly covered multiple connac2 chipsets and no longer reflected its
> > actual scope. This is a clean-up only change with no functional impact.
> >
> > Signed-off-by: Sean Wang <sean.wang at mediatek.com>
> > ---
> >   .../net/wireless/mediatek/mt76/mt76_connac.h  |  2 +-
> >   .../wireless/mediatek/mt76/mt76_connac_mac.c  | 16 ++++++------
> >   .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 26 +++++++++----------
> >   .../wireless/mediatek/mt76/mt76_connac_mcu.h  |  2 +-
> >   .../net/wireless/mediatek/mt76/mt792x_core.c  |  2 +-
> >   .../net/wireless/mediatek/mt76/mt792x_dma.c   |  2 +-
> >   6 files changed, 25 insertions(+), 25 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
> > index 813d61bffc2c..02bea67d37c3 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac.h
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac.h
> > @@ -187,7 +187,7 @@ static inline bool is_mt7922(struct mt76_dev *dev)
> >       return mt76_chip(dev) == 0x7922;
> >   }
> >
> > -static inline bool is_mt7921(struct mt76_dev *dev)
> > +static inline bool is_connac2(struct mt76_dev *dev)
> >   {
> >       return mt76_chip(dev) == 0x7961 || is_mt7922(dev) || is_mt7920(dev);
> >   }
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> > index 4ef44514d48d..e76f6e28b7f0 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
> > @@ -173,7 +173,7 @@ void mt76_connac_write_hw_txp(struct mt76_dev *dev,
> >
> >       txp->msdu_id[0] = cpu_to_le16(id | MT_MSDU_ID_VALID);
> >
> > -     if (is_mt7663(dev) || is_mt7921(dev) || is_mt7925(dev))
> > +     if (is_mt7663(dev) || is_connac2(dev) || is_mt7925(dev))
> >               last_mask = MT_TXD_LEN_LAST;
> >       else
> >               last_mask = MT_TXD_LEN_AMSDU_LAST |
> > @@ -217,7 +217,7 @@ mt76_connac_txp_skb_unmap_hw(struct mt76_dev *dev,
> >       u32 last_mask;
> >       int i;
> >
> > -     if (is_mt7663(dev) || is_mt7921(dev) || is_mt7925(dev))
> > +     if (is_mt7663(dev) || is_connac2(dev) || is_mt7925(dev))
> >               last_mask = MT_TXD_LEN_LAST;
> >       else
> >               last_mask = MT_TXD_LEN_MSDU_LAST;
> > @@ -309,7 +309,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,
> >       chandef = mvif->ctx ? &mvif->ctx->def : &mphy->chandef;
> >       band = chandef->chan->band;
> >
> > -     if (is_mt7921(mphy->dev)) {
> > +     if (is_connac2(mphy->dev)) {
> >               rateidx = ffs(conf->basic_rates) - 1;
> >               goto legacy;
> >       }
> > @@ -547,7 +547,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
> >       val = MT_TXD1_LONG_FORMAT |
> >             FIELD_PREP(MT_TXD1_WLAN_IDX, wcid->idx) |
> >             FIELD_PREP(MT_TXD1_OWN_MAC, omac_idx);
> > -     if (!is_mt7921(dev))
> > +     if (!is_connac2(dev))
> >               val |= MT_TXD1_VTA;
> >       if (phy_idx || band_idx)
> >               val |= MT_TXD1_TGID;
> > @@ -556,7 +556,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
> >       txwi[2] = 0;
> >
> >       val = FIELD_PREP(MT_TXD3_REM_TX_COUNT, 15);
> > -     if (!is_mt7921(dev))
> > +     if (!is_connac2(dev))
> >               val |= MT_TXD3_SW_POWER_MGMT;
> >       if (key)
> >               val |= MT_TXD3_PROTECT_FRAME;
> > @@ -598,7 +598,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
> >               txwi[6] |= cpu_to_le32(val);
> >               txwi[3] |= cpu_to_le32(MT_TXD3_BA_DISABLE);
> >
> > -             if (!is_mt7921(dev)) {
> > +             if (!is_connac2(dev)) {
> >                       u8 spe_idx = mt76_connac_spe_idx(mphy->antenna_mask);
> >
> >                       if (!spe_idx)
> > @@ -830,7 +830,7 @@ mt76_connac2_mac_decode_he_mu_radiotap(struct mt76_dev *dev, struct sk_buff *skb
> >       };
> >       struct ieee80211_radiotap_he_mu *he_mu;
> >
> > -     if (is_mt7921(dev)) {
> > +     if (is_connac2(dev)) {
> >               mu_known.flags1 |= HE_BITS(MU_FLAGS1_SIG_B_COMP_KNOWN);
> >               mu_known.flags2 |= HE_BITS(MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN);
> >       }
> > @@ -1046,7 +1046,7 @@ int mt76_connac2_mac_fill_rx_rate(struct mt76_dev *dev,
> >               stbc = FIELD_GET(MT_PRXV_HT_STBC, v0);
> >               gi = FIELD_GET(MT_PRXV_HT_SGI, v0);
> >               *mode = FIELD_GET(MT_PRXV_TX_MODE, v0);
> > -             if (is_mt7921(dev))
> > +             if (is_connac2(dev))
> >                       dcm = !!(idx & MT_PRXV_TX_DCM);
> >               else
> >                       dcm = FIELD_GET(MT_PRXV_DCM, v0);
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > index 3f583e2a1dc1..d7fbf3454bb8 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> > @@ -65,7 +65,7 @@ int mt76_connac_mcu_init_download(struct mt76_dev *dev, u32 addr, u32 len,
> >       int cmd;
> >
> >       if ((!is_connac_v1(dev) && addr == MCU_PATCH_ADDRESS) ||
> > -         (is_mt7921(dev) && addr == 0x900000) ||
> > +         (is_connac2(dev) && addr == 0x900000) ||
> >           (is_mt7925(dev) && (addr == 0x900000 || addr == 0xe0002800)) ||
> >           (is_mt799x(dev) && addr == 0x900000))
> >               cmd = MCU_CMD(PATCH_START_REQ);
> > @@ -402,7 +402,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
> >       switch (vif->type) {
> >       case NL80211_IFTYPE_MESH_POINT:
> >       case NL80211_IFTYPE_AP:
> > -             if (vif->p2p && !is_mt7921(dev))
> > +             if (vif->p2p && !is_connac2(dev))
> >                       conn_type = CONNECTION_P2P_GC;
> >               else
> >                       conn_type = CONNECTION_INFRA_STA;
> > @@ -410,7 +410,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
> >               basic->aid = cpu_to_le16(link_sta->sta->aid);
> >               break;
> >       case NL80211_IFTYPE_STATION:
> > -             if (vif->p2p && !is_mt7921(dev))
> > +             if (vif->p2p && !is_connac2(dev))
> >                       conn_type = CONNECTION_P2P_GO;
> >               else
> >                       conn_type = CONNECTION_INFRA_AP;
> > @@ -874,7 +874,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
> >               struct sta_rec_vht *vht;
> >               int len;
> >
> > -             len = is_mt7921(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
> > +             len = is_connac2(dev) ? sizeof(*vht) : sizeof(*vht) - 4;
> >               tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_VHT, len);
> >               vht = (struct sta_rec_vht *)tlv;
> >               vht->vht_cap = cpu_to_le32(sta->deflink.vht_cap.cap);
> > @@ -885,7 +885,7 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb,
> >       /* starec uapsd */
> >       mt76_connac_mcu_sta_uapsd(skb, vif, sta);
> >
> > -     if (!is_mt7921(dev))
> > +     if (!is_connac2(dev))
> >               return;
> >
> >       if (sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)
> > @@ -1778,7 +1778,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
> >       req->ssid_type_ext = n_ssids ? BIT(0) : 0;
> >       req->ssids_num = n_ssids;
> >
> > -     duration = is_mt7921(phy->dev) ? 0 : MT76_CONNAC_SCAN_CHANNEL_TIME;
> > +     duration = is_connac2(phy->dev) ? 0 : MT76_CONNAC_SCAN_CHANNEL_TIME;
> >       /* increase channel time for passive scan */
> >       if (!sreq->n_ssids)
> >               duration *= 2;
> > @@ -1821,7 +1821,7 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
> >               req->ies_len = cpu_to_le16(sreq->ie_len);
> >       }
> >
> > -     if (is_mt7921(phy->dev))
> > +     if (is_connac2(phy->dev))
> >               req->scan_func |= SCAN_FUNC_SPLIT_SCAN;
> >
> >       memcpy(req->bssid, sreq->bssid, ETH_ALEN);
> > @@ -1897,7 +1897,7 @@ int mt76_connac_mcu_sched_scan_req(struct mt76_phy *phy,
> >               get_random_mask_addr(addr, sreq->mac_addr,
> >                                    sreq->mac_addr_mask);
> >       }
> > -     if (is_mt7921(phy->dev)) {
> > +     if (is_connac2(phy->dev)) {
> >               req->mt7921.bss_idx = mvif->idx;
> >               req->mt7921.delay = cpu_to_le32(sreq->delay);
> >       }
> > @@ -2037,7 +2037,7 @@ mt76_connac_mcu_build_sku(struct mt76_dev *dev, s8 *sku,
> >                         struct mt76_power_limits *limits,
> >                         enum nl80211_band band)
> >   {
> > -     int max_power = is_mt7921(dev) ? 127 : 63;
> > +     int max_power = is_connac2(dev) ? 127 : 63;
> >       int i, offset = sizeof(limits->cck);
> >
> >       memset(sku, max_power, MT_SKU_POWER_LIMIT);
> > @@ -2065,7 +2065,7 @@ mt76_connac_mcu_build_sku(struct mt76_dev *dev, s8 *sku,
> >               offset += 12;
> >       }
> >
> > -     if (!is_mt7921(dev))
> > +     if (!is_connac2(dev))
> >               return;
> >
> >       /* he */
> > @@ -2121,7 +2121,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
> >                                 enum nl80211_band band)
> >   {
> >       struct mt76_dev *dev = phy->dev;
> > -     int sku_len, batch_len = is_mt7921(dev) ? 8 : 16;
> > +     int sku_len, batch_len = is_connac2(dev) ? 8 : 16;
> >       static const u8 chan_list_2ghz[] = {
> >               1, 2,  3,  4,  5,  6,  7,
> >               8, 9, 10, 11, 12, 13, 14
> > @@ -2162,7 +2162,7 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
> >       if (!limits)
> >               return -ENOMEM;
> >
> > -     sku_len = is_mt7921(dev) ? sizeof(sku_tlbv) : sizeof(sku_tlbv) - 92;
> > +     sku_len = is_connac2(dev) ? sizeof(sku_tlbv) : sizeof(sku_tlbv) - 92;
> >       tx_power = 2 * phy->hw->conf.power_level;
> >       if (!tx_power)
> >               tx_power = 127;
> > @@ -3080,7 +3080,7 @@ static u32 mt76_connac2_get_data_mode(struct mt76_dev *dev, u32 info)
> >   {
> >       u32 mode = DL_MODE_NEED_RSP;
> >
> > -     if ((!is_mt7921(dev) && !is_mt7925(dev)) || info == PATCH_SEC_NOT_SUPPORT)
> > +     if ((!is_connac2(dev) && !is_mt7925(dev)) || info == PATCH_SEC_NOT_SUPPORT)
> >               return mode;
> >
> >       switch (FIELD_GET(PATCH_SEC_ENC_TYPE_MASK, info)) {
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> > index f44977f9093d..1ef25385f3c6 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
> > @@ -1866,7 +1866,7 @@ mt76_connac_mcu_gen_dl_mode(struct mt76_dev *dev, u8 feature_set, bool is_wa)
> >
> >       ret |= feature_set & FW_FEATURE_SET_ENCRYPT ?
> >              DL_MODE_ENCRYPT | DL_MODE_RESET_SEC_IV : 0;
> > -     if (is_mt7921(dev) || is_mt7925(dev))
> > +     if (is_connac2(dev) || is_mt7925(dev))
> >               ret |= feature_set & FW_FEATURE_ENCRY_MODE ?
> >                      DL_CONFIG_ENCRY_MODE_SEL : 0;
> >       ret |= FIELD_PREP(DL_MODE_KEY_IDX,
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> > index f318a53e4deb..2142fcc4ae27 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
> > @@ -151,7 +151,7 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend)
> >       cancel_work_sync(&dev->reset_work);
> >       mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
> >
> > -     if (is_mt7921(&dev->mt76)) {
> > +     if (is_connac2(&dev->mt76)) {
> >               mt792x_mutex_acquire(dev);
> >               mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);
> >               mt792x_mutex_release(dev);
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
> > index 1ddec7788b66..34f07bd3097d 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt792x_dma.c
> > @@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(mt792x_poll_rx);
> >
> >   int mt792x_wfsys_reset(struct mt792x_dev *dev)
> >   {
> > -     u32 addr = is_mt7921(&dev->mt76) ? 0x18000140 : 0x7c000140;
> > +     u32 addr = is_connac2(&dev->mt76) ? 0x18000140 : 0x7c000140;
> >
> >       mt76_clear(dev, addr, WFSYS_SW_RST_B);
> >       msleep(50);
>
>
> --
> Best, Philip
>



More information about the Linux-mediatek mailing list