From: Sean Wang <sean.wang@kernel.org>
To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo@kernel.org>
Cc: chengwei.yu@mediatek.com, yu-ching.liu@mediatek.com,
jenhao.yang@mediatek.com, posh.sun@mediatek.com,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH v2 8/9] wifi: mt76: mt792x: build iface combinations dynamically
Date: Wed, 24 Jun 2026 19:18:33 -0500 [thread overview]
Message-ID: <20260625001834.475094-9-sean.wang@kernel.org> (raw)
In-Reply-To: <20260625001834.475094-1-sean.wang@kernel.org>
From: Sean Wang <sean.wang@mediatek.com>
Move mt792x interface combination selection into a helper and store the
selected table in mt792x device state.
This keeps the existing non-CNM and CNM combinations unchanged while
making later firmware-gated extensions add combinations without touching
the common wiphy setup path.
Co-developed-by: Stella Liu <yu-ching.liu@mediatek.com>
Signed-off-by: Stella Liu <yu-ching.liu@mediatek.com>
Co-developed-by: Jeremy Yu <chengwei.yu@mediatek.com>
Signed-off-by: Jeremy Yu <chengwei.yu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt792x.h | 2 ++
.../net/wireless/mediatek/mt76/mt792x_core.c | 36 ++++++++++++++-----
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 9d5a2adc81f6..73f2333c2970 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -324,6 +324,8 @@ struct mt792x_dev {
struct ieee80211_chanctx_conf *new_ctx;
struct ieee80211_vif *nan_vif;
+ const struct ieee80211_iface_combination *iface_combinations;
+ int n_iface_combinations;
};
static inline struct mt792x_bss_conf *
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index a0db815c27bc..ffe0bcdf1df6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -60,7 +60,7 @@ static const struct ieee80211_iface_limit if_limits_chanctx_scc[] = {
}
};
-static const struct ieee80211_iface_combination if_comb_chanctx[] = {
+static const struct ieee80211_iface_combination if_comb_chanctx_base[] = {
{
.limits = if_limits_chanctx_mcc,
.n_limits = ARRAY_SIZE(if_limits_chanctx_mcc),
@@ -77,6 +77,22 @@ static const struct ieee80211_iface_combination if_comb_chanctx[] = {
}
};
+static int mt792x_setup_iface_combinations(struct mt792x_dev *dev)
+{
+ const bool cnm = !!(dev->fw_features & MT792x_FW_CAP_CNM);
+
+ if (!cnm) {
+ dev->iface_combinations = if_comb;
+ dev->n_iface_combinations = ARRAY_SIZE(if_comb);
+ return 0;
+ }
+
+ dev->iface_combinations = if_comb_chanctx_base;
+ dev->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx_base);
+
+ return 0;
+}
+
void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct sk_buff *skb)
{
@@ -663,6 +679,7 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
struct mt792x_phy *phy = mt792x_hw_phy(hw);
struct mt792x_dev *dev = phy->dev;
struct wiphy *wiphy = hw->wiphy;
+ int err;
hw->queues = 4;
if (dev->has_eht) {
@@ -683,15 +700,17 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
hw->vif_data_size = sizeof(struct mt792x_vif);
hw->chanctx_data_size = sizeof(struct mt792x_chanctx);
- if (dev->fw_features & MT792x_FW_CAP_CNM) {
+ if (dev->fw_features & MT792x_FW_CAP_CNM)
wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb_chanctx;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
- } else {
+ else
wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
- wiphy->iface_combinations = if_comb;
- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
- }
+
+ err = mt792x_setup_iface_combinations(dev);
+ if (err)
+ return err;
+
+ wiphy->iface_combinations = dev->iface_combinations;
+ wiphy->n_iface_combinations = dev->n_iface_combinations;
wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
WIPHY_FLAG_4ADDR_STATION);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
@@ -699,6 +718,7 @@ int mt792x_init_wiphy(struct ieee80211_hw *hw)
BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_DEVICE);
+
wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
wiphy->max_scan_ssids = 4;
wiphy->max_sched_scan_plan_interval =
--
2.43.0
next prev parent reply other threads:[~2026-06-25 0:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 0:18 [PATCH v2 0/9] wifi: mt76: add mt7925 NAN support Sean Wang
2026-06-25 0:18 ` [PATCH v2 1/9] wifi: mt76: mt792x: advertise mgmt frame registration Sean Wang
2026-06-25 0:18 ` [PATCH v2 2/9] wifi: mt76: mt7925: guard BSS capability lookups Sean Wang
2026-06-25 0:18 ` [PATCH v2 3/9] wifi: mt76: connac: add NAN connection type Sean Wang
2026-06-25 0:18 ` [PATCH v2 4/9] wifi: mt76: mt7925: add NAN MCU helpers Sean Wang
2026-06-25 0:18 ` [PATCH v2 5/9] wifi: mt76: mt7925: add NAN MCU handling Sean Wang
2026-06-25 0:18 ` [PATCH v2 6/9] wifi: mt76: add init_wiphy callback Sean Wang
2026-06-25 0:18 ` [PATCH v2 7/9] wifi: mt76: mt7925: wire up NAN operations Sean Wang
2026-06-25 0:18 ` Sean Wang [this message]
2026-06-25 0:18 ` [PATCH v2 9/9] wifi: mt76: mt792x: advertise NAN data support Sean Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625001834.475094-9-sean.wang@kernel.org \
--to=sean.wang@kernel.org \
--cc=chengwei.yu@mediatek.com \
--cc=jenhao.yang@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=posh.sun@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=yu-ching.liu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox