Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2814445lqp; Mon, 25 Mar 2024 09:56:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzCjk+fC02zLOmjQXJLCnJp2JViOEqCe9GceTK/hTplPofUmOHJoyT7mS3iqwso8fztTjLcF53ENlcmlYa3REGDF4qlwPgoXi1mVJaPg== X-Google-Smtp-Source: AGHT+IEYhF2ECcfWioo9ygqTgL3Fkfc6aY+1OgprF0wMInE6pY2CbdeK2WDaJpCvIREWlT3QK8Vs X-Received: by 2002:a17:906:261b:b0:a47:fa3:aea8 with SMTP id h27-20020a170906261b00b00a470fa3aea8mr4876720ejc.30.1711385806817; Mon, 25 Mar 2024 09:56:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711385806; cv=pass; d=google.com; s=arc-20160816; b=1KMvarKImP9IMM2Ww4HorPGfjllo4Fonh++Yk3+jEexGYWmxL/oUuHvO8m+Ofw1vNO 4va3xtJhZ/BlY9WaqjFQxDC0fxtTaurUT7bq6zir3WHeO5IN4yrAeJIVM9zZnea7m+UH dCIti4pTPszxMlr0vIFa+5V+bZIC6RFWe92onCa2z1GkzCT6JTtcl9V/r+O3d/8kOjF9 7iVHPsSoDuKcXiLe+yBmgKNp3eDwXpfG09z7FJau8Sr7mr75LmA7fzKYxmwkxeYRnd0H OOCIRHJvWtMFL8TnN0uj2eiyx30h7N8ejss560FFKhVYk4Z6QRaRswY8ylkkED8aP1px vmoQ== 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:cc :to:from:subject:message-id:dkim-signature; bh=SVCXwL1iI/bNs8G7d4KaZw3fMBGDP6EFpG9+mgrsaAI=; fh=aWgcr6fXqgeYDN39zmFIxgaOgDj/xc7c+VAT5zhruYA=; b=yuPfrlBRsd6cFacVoDz2XW0rKnGAolYC1zNfGDQNMlEbwOGQSFD2v1n4dvSnSZvrdh vPg7aRZu/fYCeZz0Pth4nxyoXaJG27atshtwQWV8mhZU3XPXhb/APz6HauFG+cacC26E FWuDfJwc5u3nZ/9laJRaB5r7oc9LypzLiqRBGOYczzZvn4Lt/JyMUjH546elSzkuECQ7 UZ7/kDr0WUkuFqL6llhVR5vlGcOueGcGWUgamzclofjOJqt4Pn3iWuTVUtTMUYGEa6Up CI0VyZ4oRzy0ty1+8rQ/u4IdkRU62XjrvfRpIygEj5RvJt3nQHpaZ+yx+GcJJ0ZBoOtZ Ub9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=w1JqQ96V; 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-5206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hu10-20020a170907a08a00b00a48475a0ee1si1392163ejc.547.2024.03.25.09.56.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=w1JqQ96V; 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-5206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5206-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 823521F3E2E1 for ; Mon, 25 Mar 2024 16:56:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44B5E639; Mon, 25 Mar 2024 15:21:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="w1JqQ96V" 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 DE95F7F48F for ; Mon, 25 Mar 2024 15:21:45 +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=1711380108; cv=none; b=AaoahrkoTXqokaheAEkVBvhQK/fFSV8iVEGeMj4nizI2N+sZGRNc98IRfCaGYvrirreAWtKfGTIYYca/WL006StXoX3/6Gvb95FyYP+AbbhcHmmu8834YhwROIWoBPzjFJC+djbKVZ4tIwUCC/akB/RCT+FMmStivQUG6/nanfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711380108; c=relaxed/simple; bh=K5L5k1m/rN3s6wgwiv8+rS9heNJYnXkXYw89D1KeMrs=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=L6rG5CXRVnEjpdkam3nU90/CVHYCqyAgmo/wpohTKSQjH0jrgh6ut2AZ2BSwDYbiaIFaNEUMewGFR9v0T0uiD+lCZhIC7EWJyv/UWw90szfCGjAff5HrwNUiDnxG9d7Ru3O5NgkFAPSVL6+7sXGJAJbcsd3tzc8FoNNsd+HJvlc= 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=w1JqQ96V; 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:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=SVCXwL1iI/bNs8G7d4KaZw3fMBGDP6EFpG9+mgrsaAI=; t=1711380105; x=1712589705; b=w1JqQ96VKGVnwl/6lm+9N47wpkhFqTua+TCfZl//l0n/oni s4HYtMYBgqcF7BdjfnlfMpmLeq1WPPdyROezkuxGh6oZ8+2O/R3LQqLUlgfpVJo5EKhxO45l1GEyj il0PiAkzCVvy5gor32sNIZKkHj7HQLzcagflTwG9Sl962SbqKEb9Xn5jJ8QSCT1ACNos/M3LL7GGa 2WS7QfetH0GXOeVIyEqvOMIu+xsXFRxlejJr+wiTRBdmjUIp6Q4vrQ59eLi0Pn06nsryuSSNPGJsj w9xaP3rvGxpmj7XawLz2r/NvLUt17sjP5w8n7FPadioeyXkQxZb9eiFUozNbgEYA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rom8t-0000000DuBG-0Ddh; Mon, 25 Mar 2024 16:21:43 +0100 Message-ID: <2c8338a29d3c42ebbf1fd5efd348c14471fa5004.camel@sipsolutions.net> Subject: Re: [PATCH] wifi: mac80211: validate link status before deciding on off channel Tx From: Johannes Berg To: Aditya Kumar Singh Cc: linux-wireless@vger.kernel.org, Sriram R Date: Mon, 25 Mar 2024 16:21:42 +0100 In-Reply-To: <20240312154620.242773-1-quic_adisi@quicinc.com> References: <20240312154620.242773-1-quic_adisi@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-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 On Tue, 2024-03-12 at 21:16 +0530, Aditya Kumar Singh wrote: > In such cases, the bss active flag might not provide the exact > status of the MLD links. That's ... true I guess, but then I'm suspicious, why are you sending this patch? Does that mean 'active' is managed incorrectly and actually becomes false when one link is removed, rather than all? Can you fix that too? And if you fix that ... yeah we probably still should have this patch but ... _without_ this: > + /* This is consolidated status of the MLD or non ML bss */ > + if (sdata->bss->active) > + return true; I'd think? > While at it, when source address is same as the link conf's address and > if userspace requested Tx on a specific link, add changes to use the same > link id if the link bss is matching the requested channel. Why not separate that? It's really not related much? > + if (link_id < 0) > + return false; > + > + if (!sdata->vif.valid_links) > + return false; > + > + if (!(sdata->vif.valid_links & BIT(link_id))) > + return false; The second condition seems useless then? But probably better to check *active* links, and then might as well use ieee80211_vif_link_active()? > + link =3D sdata_dereference(sdata->link[link_id], sdata); > + if (!link) > + return false; That might be a WARN_ON()? After all, if links are valid (or active per above) that really should be there? > int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, > struct cfg80211_mgmt_tx_params *params, u64 *cookie) > { > @@ -817,7 +850,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wir= eless_dev *wdev, > case NL80211_IFTYPE_P2P_GO: > if (sdata->vif.type !=3D NL80211_IFTYPE_ADHOC && > !ieee80211_vif_is_mesh(&sdata->vif) && > - !sdata->bss->active) > + !ieee80211_is_link_bss_active(sdata, params->link_id)) > need_offchan =3D true; > =20 > rcu_read_lock(); > @@ -897,8 +930,17 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wi= reless_dev *wdev, > break; > } > =20 > - if (ether_addr_equal(conf->addr, mgmt->sa)) > + if (ether_addr_equal(conf->addr, mgmt->sa)) { > + /* If userspace requested Tx on a specific link > + * use the same link id if the link bss is matching > + * the requested chan. > + */ > + if (sdata->vif.valid_links && > + params->link_id >=3D 0 && params->link_id =3D=3D i && > + params->chan =3D=3D chanctx_conf->def.chan) > + link_id =3D i; > break; > + } > =20 > chanctx_conf =3D NULL; > } >=20 > base-commit: c2b25092864a16c7865e406badedece5cc25fc2b