Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2921335rdb; Tue, 13 Feb 2024 00:57:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURaqkZXrzNb/hBCODIrWTRUyjeqISrc1M3yt7Eo4D0szffogCp7Nw0WhGQVED28nt5fCHLaULTJeW5EweBVO2OWuvQeK4GGTFSgUbIXg== X-Google-Smtp-Source: AGHT+IEktnq3swCnDXJVwHp93w3uIklD3UYiZZD2Wf5OoayxMGdt66BoHri+s4C664Rh2KRbAK9g X-Received: by 2002:a0c:cd09:0:b0:68c:cf33:b150 with SMTP id b9-20020a0ccd09000000b0068ccf33b150mr9060222qvm.45.1707814671211; Tue, 13 Feb 2024 00:57:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707814671; cv=pass; d=google.com; s=arc-20160816; b=w74j+M7ManpBoMSXEd7HjYNXbX/ddjQtq4ryJyQ1Agcldu2a/X5ipx/L3YjdDQWfmS kYKsUMtRuoFljZ5hRbXyxF4MS0DQgPtZtBGm3uW5ZOB3GaAKuagc6xCH0dI2B7Vm0lIS XkFtXETVbnW4Ztxw1rW8MFreGL5jSdSx28tNzQpGLVgERmWsgPY9trW4Rq84m0FLUwXl H7YyZupuFRHxgebmaa2siMkIexIMpdKAvS+qCswj2YBeIuBH7tfv3qAXf2uldRIq8fvk BfnxlJrOYa3oV/So0anlfel8TTEGPrgeALeF85+65sfL2PmE0xvjIaRK0aC+ZOA7a5In O4RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:to :from:subject:message-id:dkim-signature; bh=nN81jSM7WlT8EdAF2L75PKPSulfInXw77goOm51vmxE=; fh=nYjiMJitvmd75XkquTC9lLaUw08J+Y9T+trkM9+KlUY=; b=Hh1KqzUzVj2Rf/AIWRkwsdnWJZzuRX3vjzhyUaJEpdozWIpOtyBPaPp2l20Ahok6is toFc9To11wShhziKptQSZhM3v04k2fTd9ciQEGID2tLaglFSPqtOSLjoSQMfUf8+X+Mr nIZnttEEhLsduswehtLuEbGgOmUA1f3Og2hIYJTkAtJU+k7WdhjlB9zvh0HC6JE2WAIA 8dLuE97uNm6LyAfPGviIJYWHSGR5caWkRSgYrCOApC/e9Op6LqzlJ8JsVi71Wm3udY++ r0aDODncqgjO/wLsWUa37ARxmH1wLtyDDo6wi6DQ4lFH23Mrc7Hsv1ugovSKPnpUNWmT olQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=QnjBuyFA; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-3517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net X-Forwarded-Encrypted: i=2; AJvYcCUcP7ih3Yqx7PvN4R9S8algOrC137hVZo6NzVcC87foWmcFMvpa39b621sQCGkl6GRILJYSVFmY8SEnKfIYo5pJfxf3CjvCpvmT3Su+GQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jn10-20020ad45dea000000b0068d14b3d042si2335722qvb.131.2024.02.13.00.57.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 00:57:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=QnjBuyFA; arc=pass (i=1 spf=pass spfdomain=sipsolutions.net dkim=pass dkdomain=sipsolutions.net dmarc=pass fromdomain=sipsolutions.net); spf=pass (google.com: domain of linux-wireless+bounces-3517-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BC8271C22C18 for ; Tue, 13 Feb 2024 08:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88DB62208B; Tue, 13 Feb 2024 08:57:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="QnjBuyFA" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A28A62261A for ; Tue, 13 Feb 2024 08:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707814641; cv=none; b=myRk06sz0tPXL5aM/f4vej3rzV9x2/bwNT246nfHldUa0UtTRgbh5vmnSaR06Eo5LsRzcYQ7F+J7CoLDZGrx5b3dRMJJbXK2set+jcz2jU1RAc8n50nS/Rsl92WwIEp5tH+daCchI5DmGQkxXVETgxm5xnA9K830tekGwE14iEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707814641; c=relaxed/simple; bh=3Bxove3xW7LPM3vclx9kCej6+g4CP0JS+zwmX4llo4s=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=kN++TKNkicNXTTbbXIl2W25s23qVd5xeYca3HT/j6H65kuTuPlKwpe5GT7nZQ8GiRre6C1Y0C+lbUBqpCKZNEwTZDs56KkwR/6idIQ8maWram/l+Tyyh+F4gHofyGDgscV+le6/FGni5IdmcHi58h8q0qx9T3OWxmkeXNUSexuA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=QnjBuyFA; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:To:From:Subject:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=nN81jSM7WlT8EdAF2L75PKPSulfInXw77goOm51vmxE=; t=1707814639; x=1709024239; b=QnjBuyFAREPd0Fx8jxK4YMQWHDKNbtvSDRf/v/hMlIU5Hm/ RD/G/ZPlZHbobAAeKGAukW3Z1L/1Ufqw4bh2Hox/XcCmZ/LuX4BNNFh5e9hF+Ow/V57eVCkAzssiw sDZbC7qqI3JkOqEWgzc1BWioMU6O4MpuxGIxB4WLsTqi7B8MKL7fFw1/SVSAAum9eodwWpzO48GJJ F7KgOXlU+mHj+0PI1A1ciDOueJdCXigdWFzWxHNIgysnwuLvTyh3yvqr5Ju2uiMArAXLyiABjHGfT gyg6T8k2ArjlDqjoGBODxzbpX2m61q3cnzpyPqL+/y/1zx1W/Ymd/zJuFYrvEKhg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rZobM-00000007YmO-2n2d; Tue, 13 Feb 2024 09:57:16 +0100 Message-ID: <94bd67a6f261d945917067334b633c78be665c6b.camel@sipsolutions.net> Subject: Re: [PATCH 15/15] wifi: cfg80211/mac80211: move puncturing into chandef From: Johannes Berg To: Ping-Ke Shih , "linux-wireless@vger.kernel.org" Date: Tue, 13 Feb 2024 09:57:15 +0100 In-Reply-To: References: <20240129184108.49639-17-johannes@sipsolutions.net> <20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6@changeid> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 (3.50.3-1.fc39) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned Hi PK, Actually, sorry about this part of the patch. Pretty sure I meant to ask you, but then wanted to get things together before everything broke ... > > +++ b/drivers/net/wireless/realtek/rtw89/fw.c > > @@ -2495,8 +2495,11 @@ int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_= dev *rtwdev, > > } > > =20 > > if (vif->bss_conf.eht_support) { > > - h2c->w4 |=3D le32_encode_bits(~vif->bss_conf.eht_puncturing, > > + u16 punct =3D vif->bss_conf.chanreq.oper.punctured; > > + > > + h2c->w4 |=3D le32_encode_bits(~punct, > > CCTLINFO_G7_W4_ACT_SUBCH_CBW); > > + rcu_read_unlock(); >=20 > We don't deference chanctx to reference puncture value. Instead use the > value from vif->bss_conf.chanreq, so I think we don't need RCU locks, rig= ht? Well, clearly the rcu_read_unlock() is wrong since it's not paired with rcu_read_lock(). I don't know how neither I nor the robots noticed that?! The other thing here is that I'm not entirely sure how the driver works, chances are that this was previously a bug, and now is still a bug, unless the driver doesn't really support channel contexts, or any form of concurrency. If you actually have the ability to support two connections (e.g. P2P and BSS client) then theoretically it's possible that you have two EHT connections with compatible puncturing, using the same channel context, but with different bandwidths, e.g. BSS 160 MHz | | | | | C | | | P | P2P | C | | | P | (P) indicates punctured subchannel, (C) indicates control channel In this case, p2p_vif->bss_conf.chanreq.oper.punctured =3D=3D 0x8 whereas bss_vif->bss_conf.chanreq.oper.punctured =3D=3D 0x80. However, you'd really be using the actual channel configuration from the channel context, which matches the BSS vif, so should be puncturing bitmap 0x80. So realistically, what you probably need/want to do is move this whole chunk of code to when the *channel context* changes, i.e. to rtw89_chanctx_ops_change(). You even get the IEEE80211_CHANCTX_CHANGE_PUNCTURING flag when the puncturing changes there. Also need it in rtw89_chanctx_ops_add() of course, and possibly in rtw89_chanctx_ops_remove(). Though it _looks_ like you only support one channel context there, so maybe also only one vif, and it doesn't matter? I'd probably still move it over to the chan.c code though, it really does belong there more as discussed in the commit message of this change. But I didn't want to make those more semantic changes because I don't know what logic your device applies here. And sorry about the locking bug! Not sure how that happened :( johannes