From patchwork Wed Sep 4 03:09:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veerendranath Jakkam X-Patchwork-Id: 825610 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 6844D4317B for ; Wed, 4 Sep 2024 03:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419385; cv=none; b=rJW/82hw0ih2+G7504F39kO2+VWoiPaVv/fY9c/Nh3nmVZFW7i8KsCs/WtPD8rTc2NxE45mLdfuVXhi1HD5bOKU/yKu8bcAv0S6HjkICSPIqOeHwDrTg+mFlBprUvEfF71gNxtpb5mpGIhIQW4oZmoeWIXN7Jvg4i92Fb6c4Cko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419385; c=relaxed/simple; bh=iSt0RWEQKxe1mf7QTrt4Wm3UZuORK4qyyHmrZQKodwQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cvkGJ/AguFXDHcPA2qJOBIzejkT1pPBNPKyiW9Or8ProkZ9rKOWJH7IQYevAGpdqN5USuUpt634xJlkLXvZRe8wvyolihvgcPJG8po2VZrFohP3697YAnfJlfLzlk7kr0XMPK0wV2lweD7zmI1CqCoG6vhR9YwX3zWiSFICTtII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=pWCndNqr; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="pWCndNqr" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 483MVCqx032362; Wed, 4 Sep 2024 03:09:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= PwwxI+3roeI/0Z2Edm1fe0eDnycl7rcQIRBWymTV+M4=; b=pWCndNqrpY3IPojM iuEVCRjsmMIL0p7XIwAuBPIK8WMLPYrwtTmc19BhMGuVkvqmI4D3Z6ZFzff0xyFC PB59wrfORbwgnYhF/cF5z255ss/RXfYYhK36WmUDorFSx/VmzTavSmHh+SmNEhS0 s7NJog/R8dv8zMbmcIKCpoA2T31LALxC8AhsMw7OzW/hgiFXzcpMIS9vUXtACZ0+ UvuFNdg9T++x96yV5+wOrY2OZUWWqegUw/QHS3zjXyEzHGg4IPTS4eqHSmUz9A82 bzGcj0FJlldCgHsGsGEz9/AIQh/3g+RwBKFqeDhiQeVuvrO2ex4oGvYj/64KZ1b2 BC7IBg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41drqe3msf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 03:09:38 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 48439bqT004619 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Sep 2024 03:09:37 GMT Received: from hu-vjakkam-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 3 Sep 2024 20:09:35 -0700 From: Veerendranath Jakkam To: CC: , Subject: [PATCH v2 1/3] wifi: cfg80211: make BSS source types public Date: Wed, 4 Sep 2024 08:39:15 +0530 Message-ID: <20240904030917.3602369-2-quic_vjakkam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> References: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: HpbgjJZgsghNNcSY0maNV8HkYdtSq8Zc X-Proofpoint-ORIG-GUID: HpbgjJZgsghNNcSY0maNV8HkYdtSq8Zc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-04_01,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 spamscore=0 mlxlogscore=708 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2409040021 Define public enum with BSS source types in core.h. Upcoming patches need this to store BSS source type in struct cfg80211_internal_bss. Signed-off-by: Veerendranath Jakkam --- net/wireless/core.h | 6 ++++++ net/wireless/scan.c | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/wireless/core.h b/net/wireless/core.h index 41c8c0e3ba2e..eace1800f5de 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -170,6 +170,12 @@ static inline int for_each_rdev_check_rtnl(void) if (for_each_rdev_check_rtnl()) {} else \ list_for_each_entry(rdev, &cfg80211_rdev_list, list) +enum bss_source_type { + BSS_SOURCE_DIRECT = 0, + BSS_SOURCE_MBSSID, + BSS_SOURCE_STA_PROFILE, +}; + struct cfg80211_internal_bss { struct list_head list; struct list_head hidden_list; diff --git a/net/wireless/scan.c b/net/wireless/scan.c index d99319d82205..38541eba386c 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -2149,11 +2149,7 @@ struct cfg80211_inform_single_bss_data { const u8 *ie; size_t ielen; - enum { - BSS_SOURCE_DIRECT = 0, - BSS_SOURCE_MBSSID, - BSS_SOURCE_STA_PROFILE, - } bss_source; + enum bss_source_type bss_source; /* Set if reporting bss_source != BSS_SOURCE_DIRECT */ struct cfg80211_bss *source_bss; u8 max_bssid_indicator; From patchwork Wed Sep 4 03:09:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veerendranath Jakkam X-Patchwork-Id: 826274 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 E1ED14A15 for ; Wed, 4 Sep 2024 03:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419386; cv=none; b=j/sK/UHlHruaslciVHNe5lCkcniR2P1FBvwy1Fm9o7I/vW5yn/+mubWTCLhtsNHfSauYTXHzpFOUHLXsxZ9wKEDkNVQGTTL2fPwlAZcLCcqZ8Sg3N1rC6Uur+n8JTvqwFdZXWK4fDRKEEHNpH8dhwPnKU6mjH1hePvCO+b5lDck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419386; c=relaxed/simple; bh=tLcINo1KPGcFLv6SnWBACwWKl480mQ5Hr6BLft03E8I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f7OOId7mAh0h5ZjO6z0MWKZ5aA3prWfraV4yapmzykWb8hEmKE54FSUKgzY/wAnESYxopuOZm7aqLKc26AAMPKZFlCuUvM1HJ2lAJppJNWCEx+VUo28/5PDDTiYLIZyapMJxUYguyZ4BWCf9VUdMu0LLo4FsnbLEXDumvj31heI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=ZSYt13Ad; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ZSYt13Ad" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 483LabEu013131; Wed, 4 Sep 2024 03:09:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= oDM3xnrMoyVJa9F912W2DjnglyjxMPXZzVh2mK//z+M=; b=ZSYt13Ad+Yo5KZrs 2RaPIR6f/pBf4SX5IOX7TpVS+3lm2pVE0w9UfKEkvp7GMQo8kzMm8TqCWSsL+Jag UAUe9TM9oOwBCYb6Yzwb4d4Aa5QwpwKYRFnq7Pnnim3wYZbLzxxJgi/tMMqfdriP oUsTTQVa3RXVARoUBkw4OQ4tcWWeGLkgL1+Uxm8tPsl+25FSyPOkVC/DY9VnvckZ Jjqq1+EM4n/Cjnqr2jRKQtwDWCpfHlXnLFW9kU0ITMWbwf0+EE0mj4a1OsL3P6sV 4B/OkTrnYnzsGP676STDZCyCVJptCp8Ch116sxgEpBTNQoqkv7d6eKxe5pa5M4U0 raIczw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41btrxsc03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 03:09:40 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 48439deF006076 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Sep 2024 03:09:39 GMT Received: from hu-vjakkam-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 3 Sep 2024 20:09:37 -0700 From: Veerendranath Jakkam To: CC: , Subject: [PATCH v2 2/3] wifi: cfg80211: skip indicating signal for per-STA profile BSSs Date: Wed, 4 Sep 2024 08:39:16 +0530 Message-ID: <20240904030917.3602369-3-quic_vjakkam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> References: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: tPVOaBrLf5CVJdG1_7PfEbNC4GEL8RNV X-Proofpoint-ORIG-GUID: tPVOaBrLf5CVJdG1_7PfEbNC4GEL8RNV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-04_01,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 clxscore=1015 suspectscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2409040021 Currently signal of the BSS entry generated from the per-STA profile indicated as zero, but userspace may consider it as high signal strength since 0 dBm is a valid RSSI value. To avoid this don't report the signal to userspace when the BSS entry created from a per-STA profile. Signed-off-by: Veerendranath Jakkam --- net/wireless/core.h | 2 ++ net/wireless/nl80211.c | 26 +++++++++++++++----------- net/wireless/scan.c | 2 ++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/net/wireless/core.h b/net/wireless/core.h index eace1800f5de..3b3e3cd7027a 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -197,6 +197,8 @@ struct cfg80211_internal_bss { */ u8 parent_bssid[ETH_ALEN] __aligned(2); + enum bss_source_type bss_source; + /* must be last because of priv member */ struct cfg80211_bss pub; }; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b368e23847dd..3a11a1a74a54 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10507,17 +10507,21 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, NL80211_BSS_CHAIN_SIGNAL)) goto nla_put_failure; - switch (rdev->wiphy.signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: - if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, res->signal)) - goto nla_put_failure; - break; - case CFG80211_SIGNAL_TYPE_UNSPEC: - if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal)) - goto nla_put_failure; - break; - default: - break; + if (intbss->bss_source != BSS_SOURCE_STA_PROFILE) { + switch (rdev->wiphy.signal_type) { + case CFG80211_SIGNAL_TYPE_MBM: + if (nla_put_u32(msg, NL80211_BSS_SIGNAL_MBM, + res->signal)) + goto nla_put_failure; + break; + case CFG80211_SIGNAL_TYPE_UNSPEC: + if (nla_put_u8(msg, NL80211_BSS_SIGNAL_UNSPEC, + res->signal)) + goto nla_put_failure; + break; + default: + break; + } } switch (wdev->iftype) { diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 38541eba386c..f280e0371d6d 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1910,6 +1910,7 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, known->pub.bssid_index = new->pub.bssid_index; known->pub.use_for &= new->pub.use_for; known->pub.cannot_use_reasons = new->pub.cannot_use_reasons; + known->bss_source = new->bss_source; return true; } @@ -2264,6 +2265,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy, IEEE80211_MAX_CHAINS); tmp.pub.use_for = data->use_for; tmp.pub.cannot_use_reasons = data->cannot_use_reasons; + tmp.bss_source = data->bss_source; switch (data->bss_source) { case BSS_SOURCE_MBSSID: From patchwork Wed Sep 4 03:09:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veerendranath Jakkam X-Patchwork-Id: 825609 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 0303D4A15 for ; Wed, 4 Sep 2024 03:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419389; cv=none; b=OLufq+Df2ae83imWn/1IDP17n7Q3I9/iyd3coIuz8l/A+3ZtQjb+h1wwhPcwxsMFLKJVliEYs0MhqzInymuNWpTGRkDUfVOLzPWgjo76zDHWk/OnkbN5njPRANTg8nLWKKEv72VgGXKyQf7HlF0aYPpiznKkXoGkYATWykyUJ9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725419389; c=relaxed/simple; bh=Bpo5D8yhuLErGxWhefw7Sc0AT7QkNNnQFUukAcP5Vpk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kxnx6sxo7uH/dPVF6gQ3uis3+P092rauyamQncnzyH+U3mcpr5cWlOxHTUP7D13NucyzX19xENt+3OPLAqyC/Joset5dD1SMejEWqEcExJiTB0siWw6oAYg6fT1qepclIxGB+ucG8hwFKfZP9BGDLhQyBpTqBBGff22fePTcqV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=SFnkLdHI; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="SFnkLdHI" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 483LhYcd004948; Wed, 4 Sep 2024 03:09:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Qd6COx69rMLSUclMxr1gfz7ZXh3Ifr6P/JR/0vr7sm0=; b=SFnkLdHIQHtzBc14 9fWOcfABEi/6zt9pzbsYG1n7S0OVQjMwmAqbibgQalvVohk1rBpLRdLVmNBt4mQy yqy37utnXuSDaMsLR2AH/cizCCLoLWms/yrWVq3rT8fT3mZzHC9SyKRg4I45x1DN d6A684+SfjQi4+S8dAwVMmmyg7akU6fwBMkzIsAZQlGnr8rOlxqDaFEJ9pYUEZqH brupjt6Q3djgdwPmAWmZJa6LKIm1Bl2UB8AfYvGbWTJ9YFEp7WmHJyp6gDkiQxP4 gqmv6/9/aZ5GlKfFG6jMCPVT67UTGi/n1WhgfA0b/0tzLNY62lG7b1JDgUC9540q haUe8g== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41drqe3msm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 04 Sep 2024 03:09:42 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 48439fQo030156 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 4 Sep 2024 03:09:41 GMT Received: from hu-vjakkam-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 3 Sep 2024 20:09:39 -0700 From: Veerendranath Jakkam To: CC: , Subject: [PATCH v2 3/3] wifi: cfg80211: avoid overriding direct/MBSSID BSS with per-STA profile BSS Date: Wed, 4 Sep 2024 08:39:17 +0530 Message-ID: <20240904030917.3602369-4-quic_vjakkam@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> References: <20240904030917.3602369-1-quic_vjakkam@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: N3ZKrQmPcJSjmxPa8zCZAVltD7elxxxp X-Proofpoint-ORIG-GUID: N3ZKrQmPcJSjmxPa8zCZAVltD7elxxxp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-04_01,2024-09-03_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 spamscore=0 mlxlogscore=714 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2409040021 Avoid overriding BSS information generated from MBSSID or direct source with BSS information generated from per-STA profile source to avoid losing actual signal strength and information elements such as RNR and Basic ML elements. Signed-off-by: Veerendranath Jakkam --- net/wireless/scan.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index f280e0371d6d..eab12dc67a51 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -2905,6 +2905,9 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy, struct element *reporter_rnr = NULL; struct ieee80211_multi_link_elem *ml_elem; struct cfg80211_mle *mle; + const struct element *ssid_elem; + const u8 *ssid = NULL; + size_t ssid_len = 0; u16 control; u8 ml_common_len; u8 *new_ie = NULL; @@ -2959,6 +2962,13 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy, bss_change_count, gfp); + ssid_elem = cfg80211_find_elem(WLAN_EID_SSID, tx_data->ie, + tx_data->ielen); + if (ssid_elem) { + ssid = ssid_elem->data; + ssid_len = ssid_elem->datalen; + } + for (i = 0; i < ARRAY_SIZE(mle->sta_prof) && mle->sta_prof[i]; i++) { const struct ieee80211_neighbor_ap_info *ap_info; enum nl80211_band band; @@ -3040,6 +3050,23 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy, freq = ieee80211_channel_to_freq_khz(ap_info->channel, band); data.channel = ieee80211_get_channel_khz(wiphy, freq); + /* Skip if BSS entry generated from MBSSID or DIRECT source + * frame data available already. + */ + bss = cfg80211_get_bss(wiphy, data.channel, data.bssid, ssid, + ssid_len, IEEE80211_BSS_TYPE_ANY, + IEEE80211_PRIVACY_ANY); + if (bss) { + struct cfg80211_internal_bss *ibss = bss_from_pub(bss); + + if (data.capability == bss->capability && + ibss->bss_source != BSS_SOURCE_STA_PROFILE) { + cfg80211_put_bss(wiphy, bss); + continue; + } + cfg80211_put_bss(wiphy, bss); + } + if (use_for == NL80211_BSS_USE_FOR_MLD_LINK && !(wiphy->flags & WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY)) { use_for = 0;