From patchwork Wed Jun 12 12:35:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 13694902 X-Patchwork-Delegate: johannes@sipsolutions.net 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="dhxnSKI4" 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 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 */