Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp409736lqp; Wed, 12 Jun 2024 05:37:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfq7XW+xBD3ob3ewtZTZenqGog+u8tTYJdDxET/Pnfgb/43qllQPmKBgdN0nWLtcWQIADr0/Rqu98Kigs6kp+fJ5vdsBusFI+qbzZvOA== X-Google-Smtp-Source: AGHT+IE6d0MlaLLo8+Bk6V08rVsDQY0cQGrbmlPipexR2ITEIu1s+PVvYE3lgf/bhcISvlWP3VrZ X-Received: by 2002:a17:906:1411:b0:a64:a091:91f2 with SMTP id a640c23a62f3a-a6f47ce77d2mr117095066b.37.1718195842623; Wed, 12 Jun 2024 05:37:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718195842; cv=pass; d=google.com; s=arc-20160816; b=PW4D4LiJVjtsrhHlcNKuRJ8hpDldRhW7i0QI+orB5F3BoaWTHv3cG19RYX8J1dMaNM 0jPf34lFe3W89de3UqZMkgECH4h2kqBNxLLK868toZo8KEBBlJB3CPXrVNyDPJm3rbgK foxiH7v6jglxyK/NfEzzh/F5e8ss1ENi4olhIIUHjZ1NkutqAk3NUFBR7anM6pfIqbtN f7woY3C52+CT1hIu9M+jVhRz1oS3qbLJWsEtOgjDHw0keAGcclZ09SvgU/iwQ2AZQPMy 9FxwRGwDXt74BndIfQ8CkjC52qFsLXeXpoow72jQJMbHkxd0hjREQLYw4ewROs86/t08 yJiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EOLbreBYqsnNHlSNBBbXkwdqpQdnYDVKuJtj5Y5rERY=; fh=0ZKV22Mpi0Z+/zRlCC9GRUAKl0wLMxmYgR1nXO1NAEs=; b=ZLNRFZbS9UsU0b5M7dM2/n1jU5U7tOlm2CctcXJhE8eXrSCdLYoId2i4Jy8APdK2iN 3vbZ9FdZusdidbqfSaMumEJjbOJMfDB/NxwPEhfk6DrFRYD4t0dkjZ8rJjBhIu38o2Rm n8mgaehsEURizSredIGbETvvnpSOVIqdbKCs0ZLUBzU32B8QeQAbg/TZERyi5E+v4Rlg Eav9X0y5W9TYU4ThcMm5/zslYHo4pRepxGuVPUNjRbLwyRg3mLrkzOW3qEcj+Js5OQCG Pfc0RVkSGP6aciqoXHmtpIkvqtRLMF4tIvYQJzas7zBSDnVUmlQa+znAHhfMi5DWu85K Cl0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=dhxnSKI4; 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-8875-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8875-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. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f0e7d807dsi408290666b.524.2024.06.12.05.37.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 05:37:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8875-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=dhxnSKI4; 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-8875-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8875-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 5823A1F2204C for ; Wed, 12 Jun 2024 12:37:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D93C816F0D0; Wed, 12 Jun 2024 12:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="dhxnSKI4" 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 673E516F29C for ; Wed, 12 Jun 2024 12:37:13 +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=1718195834; cv=none; b=nXHVlkyMmH/hBL4B4PBGSb8zGa2hZgKOKjlPTwuFfKGpt6yT23wjoW0dKApECP5r17ZhSgSkKZrKgO4DAovCpWsLfP+PDs/BH/qkub1fZGpkkXtB8bmORfQsjhkPQ/3qT++XcUe49z2oEMPfLanvml17ikaXJxKkTCEWanG83ZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718195834; c=relaxed/simple; bh=pOBzQxoEtjBHcwxTVXjwLyBrE6fXqjQVDD6au7sYBO0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IzQ+YGQobYmMGy3Iqnmlc0oMZyjaDYpCtZo9P4yTPe5a74XIbwFd14F/tNQm+Tv/4V/lY7gl+R6d9FrcCZdSVJBj0it6sClkQIdLIMwPB48GTLPtI2IhQz95H9Ol94P9DDE2H/iDfk1RC22r/heSl3R9gq535z0bfhxLhxbkAjE= 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=dhxnSKI4; 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=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=EOLbreBYqsnNHlSNBBbXkwdqpQdnYDVKuJtj5Y5rERY=; t=1718195833; x=1719405433; b=dhxnSKI4mgEY80wxclb2ymRLEiOxLFLiCgMiLpG1zTHU7J/ tSm2Yx6iIlVJCTFOtK+o+LugRJbTq54lx4QHjgXpqsiKMCH/VRNKbThZjMuKIecMg641oy2vVdnqF TQ1SmnmFWs/AqkD95Hbi5MmCxWYT4a91C44YvwsIUUshl3sJ0UAsxDGGGLUj7n13j9f0Tx60BW9VE UBx4CrzbMizTP7Ws7xd1ntr7TfqHO8ZCaqkICcn7GmdC9i+OpnRJXktIBgLYaMTokaDMcd6s/5IvT zpHz6JOzfuY3Sro83VBqXDY39TC5qZBYHvwVk7/C9lIEYmeHwl0b0hBMG0H9rskg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1sHNDy-0000000AH0b-3HRY; Wed, 12 Jun 2024 14:37:10 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH 1/2] wifi: mac80211: add ieee80211_tdls_sta_link_id() Date: Wed, 12 Jun 2024 14:35:56 +0200 Message-ID: <20240612143707.9f8141ae1725.I343822bbba0ae08dedb2f54a0ce87f2ae5ebeb2b@changeid> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240612123707.38067-4-johannes@sipsolutions.net> References: <20240612123707.38067-4-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Johannes Berg We've open-coded this twice and will need it again, add ieee80211_tdls_sta_link_id() to get the one link ID for a TDLS STA. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/sta_info.h | 6 ++++++ net/mac80211/tx.c | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index bd5e2f7146f6..9195d5a2de0a 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -727,6 +727,12 @@ struct sta_info { struct ieee80211_sta sta; }; +static inline int ieee80211_tdls_sta_link_id(struct sta_info *sta) +{ + /* TDLS STA can only have a single link */ + return sta->sta.valid_links ? __ffs(sta->sta.valid_links) : 0; +} + static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta) { #ifdef CONFIG_MAC80211_MESH diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f861d99e5f05..72a9ba8bc5fd 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2774,8 +2774,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, if (tdls_peer) { /* For TDLS only one link can be valid with peer STA */ - int tdls_link_id = sta->sta.valid_links ? - __ffs(sta->sta.valid_links) : 0; + int tdls_link_id = ieee80211_tdls_sta_link_id(sta); struct ieee80211_link_data *link; /* DA SA BSSID */ @@ -3101,8 +3100,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) case NL80211_IFTYPE_STATION: if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { /* For TDLS only one link can be valid with peer STA */ - int tdls_link_id = sta->sta.valid_links ? - __ffs(sta->sta.valid_links) : 0; + int tdls_link_id = ieee80211_tdls_sta_link_id(sta); struct ieee80211_link_data *link; /* DA SA BSSID */ -- 2.45.2