[RFC PATCH 4/4] wifi: rtw89: raise RTW89_MAX_INTERFACE_NUM to 3 for P2P-Device concurrency

andres parra <[email protected]>
Newsgroups org.kernel.vger.linux-wireless
Message-ID <[email protected]>
Live-tested last night: a real GO negotiation against an actual TV
succeeded (P2P-GO-NEG-SUCCESS), but forming the actual data connection
failed with P2P-GROUP-FORMATION-FAILURE while the laptop stayed
connected to its normal STA WiFi -- completing the cast needs three
concurrent interfaces (STA + P2P-Device + the new P2P-Client group
link), and RTW89_MAX_INTERFACE_NUM was deliberately left at 2 in the
v1 design.

Traced whether raising this strains the driver's separate,
firmware-capability-tied MCC (Multi-Channel-Concurrent) role limit,
NUM_OF_RTW89_MCC_ROLES (= 2, unrelated to this constant, chan.h:51):
it does not. rtw89_entity_mgnt's active_roles[]/chanctx_tbl[][] arrays
(sized by RTW89_MAX_INTERFACE_NUM) are only populated for links with
chanctx_assigned == true, which is set in exactly one place --
rtw89_chanctx_ops_assign_vif(), the assign_vif_chanctx driver op --
and a P2P-Device vif's remain_on_channel is dispatched straight to the
driver's native ROC op, bypassing assign_vif_chanctx entirely (already
established: this only applies to emulate_chanctx-less drivers, which
this chip is not). So a P2P-Device link's chanctx_assigned stays false
for its whole lifetime and never occupies an MCC-role slot -- in the
real STA+P2P-Device+P2P-Client scenario, only STA and the P2P-Client
link ever get a real chanctx assignment, exactly matching
NUM_OF_RTW89_MCC_ROLES = 2, unchanged and unstrained.

The actual P2P-GROUP-FORMATION-FAILURE originates purely at the
mac80211/cfg80211 layer (ieee80211_check_combinations(), a plain
interface-count check against wiphy->iface_combinations[].max_interfaces,
itself set from this constant) -- this one-line change is the complete
fix for that. rtw89_iface_combs[]'s max_interfaces fields and
rtw89_entity_mgnt's array sizes already reference the macro
symbolically, so both grow automatically with no separate edit.
static_assert(RTW89_MAX_INTERFACE_NUM >= NUM_OF_RTW89_MCC_ROLES) still
holds (3 >= 2). Full research trail in this project's BUILD_LOG.md.

Signed-off-by: andres parra <[email protected]>
---
 core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core.h b/core.h
index 2b21d96..83675f0 100644
--- a/core.h
+++ b/core.h
@@ -6340,7 +6340,7 @@ enum rtw89_entity_mode {
 	RTW89_ENTITY_MODE_UNHANDLED = -ESRCH,
 };
 
-#define RTW89_MAX_INTERFACE_NUM 2
+#define RTW89_MAX_INTERFACE_NUM 3
 
 /* only valid when running with chanctx_ops */
 struct rtw89_entity_mgnt {
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.