From patchwork Thu Jan 25 12:58:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13530771 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 7B77C4F215 for ; Thu, 25 Jan 2024 12:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706187560; cv=none; b=nuEySmwxpOGpBZ/gIlCovn5ufJAnZHdbx2ZkK8fTxB2dApv8Jv5AL7ws6ZHvC7arSzyUPRJqA3MKJNoa22MHzoy92W8syMV90BHUBRP3PDo+q5h0WZ3YXRB8YyMkf2PBC6MTt3T2N5fByLDcf7VzrdjCc1/Lacb1uryf23HEv4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706187560; c=relaxed/simple; bh=CX1Z8vyt8Dwp9d/arCAs2A95N1FqDmr00jUuaGvSHWw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZtJyTuGyGEx/ZwqDIHSFzOI0+2aD7KUe031BiQriNvWPEC4HDgNhY2Mtlnx3AygzTQ/XJcnu+IbNS3MpVYq4yBG9ESqI7byCx2IjJgZcW7YPbSVNmoKGOShWbivG6Qd76hp3xce/77cJ7kMumpIA8eKLXMd6NGgmeCzi6QYxPBc= 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=pnRZ5NOg; arc=none smtp.client-ip=205.220.168.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="pnRZ5NOg" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40PAGiEd014447; Thu, 25 Jan 2024 12:59:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=yY64m2zGyYpm4mZlHSNZnr4CUh3saOCQuSNayIdDn/c=; b=pn RZ5NOgm0cYH7Adux3Tk+dvKTs4NrOUrJoQnoVEBw0GpScq+h2fZD/ltp/9hs2KMR YAExWVWfYpLQaqBmOuMM0ZCYFZ8Fy/wLO8z21CbGjdE/VlCXyqDzEj2lVzJ77MDF Ui3oSwy5Ug7KWUPFPOKmR2inD6PPfUw+Pg8fJs+/fWp8lBwxw5inNNRd4nOXeehZ 7PNTs8G5eVpxtaXxewaHw+m3TnR7cBg+87sCM+dQY+E5IXz7pq6UHvR0P5cU/PCI ztSseyarFr0C7YsgEBdGAQEYF2pozuGNB7eeuuqQL0gUA0PuDjPFGjvaK9pOhYaa hcH/IPY6MGmaauWqdMyA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vumyngm65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:14 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40PCxDYN020153 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:13 GMT Received: from cdcwlex322514-lin.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.1118.40; Thu, 25 Jan 2024 04:59:11 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 1/3] wifi: cfg80211: add support for link id attribute in NL80211_CMD_DEL_STATION Date: Thu, 25 Jan 2024 18:28:49 +0530 Message-ID: <20240125125855.827619-2-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240125125855.827619-1-quic_adisi@quicinc.com> References: <20240125125855.827619-1-quic_adisi@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: SL2P8EBtB1O4chVbX8i5v0kLJEz7ysh0 X-Proofpoint-ORIG-GUID: SL2P8EBtB1O4chVbX8i5v0kLJEz7ysh0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_08,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401250090 Currently whenever NL80211_CMD_DEL_STATION command is called without any MAC address, all stations present on that interface are flushed. However with MLO there is a need to flush the stations from a particular link in the interface, and not from all the links associated with the MLD interface. For example - 2 GHz and 5 GHz are part of an AP MLD. When 2 GHz BSS is brought up, it sends flush command on the interface (MLD). Then eventually 5 GHZ links comes up and that also sends the command on the same interface. Now by the time 5 GHz link comes up, if any station gets connected to 2 GHz link, it would be flushed while 5 GHz link is started which is wrong. Hence, add an option to pass link ID as well in the command so that if link ID is passed, station using that passed link ID alone would be deleted and others will not be removed. A subsequent patch would add logic to delete only the station using the passed link ID. Signed-off-by: Aditya Kumar Singh --- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 3 ++- net/wireless/nl80211.c | 18 +++++++++++++++++- net/wireless/trace.h | 7 +++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index cf79656ce09c..2e194638717d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1766,11 +1766,14 @@ struct station_parameters { * @subtype: Management frame subtype to use for indicating removal * (10 = Disassociation, 12 = Deauthentication) * @reason_code: Reason code for the Disassociation/Deauthentication frame + * @link_id: Link ID on which station should be connected at least in order + * to delete its entry. Valid only during MLO. */ struct station_del_parameters { const u8 *mac; u8 subtype; u16 reason_code; + int link_id; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 1ccdcae24372..4197d7097591 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -438,7 +438,8 @@ * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type * of disconnection indication should be sent to the station * (Deauthentication or Disassociation frame and reason code for that - * frame). + * frame). %NL80211_ATTR_MLO_LINK_ID can be used optionally to remove + * stations connected and using at least that link. * * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to * destination %NL80211_ATTR_MAC on the interface identified by diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 60877b532993..a99537828978 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7627,14 +7627,16 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; + struct wireless_dev *wdev = dev->ieee80211_ptr; struct station_del_parameters params; + int link_id = nl80211_link_id_or_invalid(info->attrs); memset(¶ms, 0, sizeof(params)); if (info->attrs[NL80211_ATTR_MAC]) params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]); - switch (dev->ieee80211_ptr->iftype) { + switch (wdev->iftype) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_MESH_POINT: @@ -7675,6 +7677,17 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) params.reason_code = WLAN_REASON_PREV_AUTH_NOT_VALID; } + /* Link ID not expected in case of non-ML operation */ + if (!wdev->valid_links && link_id != -1) + return -EINVAL; + + /* If given, a valid link ID should be passed during MLO */ + if (wdev->valid_links && link_id >= 0 && + !(wdev->valid_links & BIT(link_id))) + return -EINVAL; + + params.link_id = link_id; + return rdev_del_station(rdev, dev, ¶ms); } @@ -16827,6 +16840,9 @@ static const struct genl_small_ops nl80211_small_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = nl80211_del_station, .flags = GENL_UNS_ADMIN_PERM, + /* cannot use NL80211_FLAG_MLO_VALID_LINK_ID, depends on + * MAC address + */ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), }, { diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 1f374c8a17a5..838107186b91 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -859,6 +859,7 @@ DECLARE_EVENT_CLASS(station_del, MAC_ENTRY(sta_mac) __field(u8, subtype) __field(u16, reason_code) + __field(int, link_id) ), TP_fast_assign( WIPHY_ASSIGN; @@ -866,11 +867,13 @@ DECLARE_EVENT_CLASS(station_del, MAC_ASSIGN(sta_mac, params->mac); __entry->subtype = params->subtype; __entry->reason_code = params->reason_code; + __entry->link_id = params->link_id; ), TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: %pM" - ", subtype: %u, reason_code: %u", + ", subtype: %u, reason_code: %u, link_id: %d", WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sta_mac, - __entry->subtype, __entry->reason_code) + __entry->subtype, __entry->reason_code, + __entry->link_id) ); DEFINE_EVENT(station_del, rdev_del_station, From patchwork Thu Jan 25 12:58:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13530772 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 0F56D1EF1F for ; Thu, 25 Jan 2024 12:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706187561; cv=none; b=Si7sTBxW0XJQc6UDZy7lpJ1NhoDQoZpsz46Sbo0EYjA5sEP4H2HIjwDoesZl1t2nLvF1KmNlCCAkf5Xre3nIwcEwby+csURox51Fh6y9yzRUXCihzfDaxkw8xxm6jMIAAlKfv5QLUm5j34EqOHp9v/IBTwaUxCMMTsC4P2J1zxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706187561; c=relaxed/simple; bh=RtlJfHsC3Su9CsQ71bolPpcSjW1SO8ot5nMC5MzrvLg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TtTjflyXvnCYl1ZKLNQyQp+OJDzKXjxArV/irmLwCTEelDZPY42WkOQYwyjF2b4kvy6Ga3t1i5ImmgSqomWRmdYM02ajeuD1kk58yYnwVZDicpTObWsuE4pp+9qceJBA9X5Ad8bODCGL6X6l3ns/0Od+IFFY3+jVerNbDZ5b6ko= 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=ja4OAlUY; arc=none smtp.client-ip=205.220.168.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="ja4OAlUY" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40P9QGYK007655; Thu, 25 Jan 2024 12:59:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=KXo70UbS7aFCecYwXCGmD+K7xoNIqP9IA6EUA7HMEoM=; b=ja 4OAlUYx390kE4xTRaBsgtSOxu30BSjfEd6zkYhOPRMF2Zaq8vBO7cbSPAb/et2Xk Lc5x+dS+LxBW9WGVni3M9f2JmPGCjd9W63HJsXn+QqXBGMxdKr7Y++vY6ukCaPdc SsGZn1Pef6zadtiPqQxOgfPPvitVprBIAB95MsmHxy4BnlCWj6FmzS0IQlRVf/uD bk1J7H99l4j0Ttmg1ernOhJtRzLP2o7pwnPzhV7IwuPKbK1fhFhbaHNvuYatim4A t/r6P0PCwocjOFFHYY3VgxOsYjwqcVtClg6nVKjBgqOofbuhK7BEM7lbJv41Jz7q Sp1M/g0jtxctRk5RDAcw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vumyngm6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:16 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40PCxF8T016141 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:15 GMT Received: from cdcwlex322514-lin.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.1118.40; Thu, 25 Jan 2024 04:59:13 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 2/3] wifi: mac80211: add link id argument for sta_flush() function Date: Thu, 25 Jan 2024 18:28:50 +0530 Message-ID: <20240125125855.827619-3-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240125125855.827619-1-quic_adisi@quicinc.com> References: <20240125125855.827619-1-quic_adisi@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: XHc6J3bLi5hDHNmn0oUZmEZqjiyT6h1I X-Proofpoint-ORIG-GUID: XHc6J3bLi5hDHNmn0oUZmEZqjiyT6h1I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_08,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=920 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401250090 Whenever sta_flush() function is invoked, all sta present in that interface is flushed. However, there is a requirement in case of MLO that only flush those sta who are using a given link id. This is not possible currently. Hence add the support for the same. Passing link id is done currently via cfg80211 op - del_station. A subsequent patch would also use this during stopping AP. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 4 ++-- net/mac80211/ibss.c | 4 ++-- net/mac80211/iface.c | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 2 +- net/mac80211/ocb.c | 2 +- net/mac80211/sta_info.c | 20 +++++++++++++------- net/mac80211/sta_info.h | 14 +++++++++++--- 8 files changed, 32 insertions(+), 18 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 489dd97f5172..26a8ea553401 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1618,7 +1618,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, link_conf->ema_ap = false; link_conf->bssid_indicator = 0; - __sta_info_flush(sdata, true); + __sta_info_flush(sdata, true, -1); ieee80211_free_keys(sdata, true); link_conf->enable_beacon = false; @@ -2093,7 +2093,7 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, if (params->mac) return sta_info_destroy_addr_bss(sdata, params->mac); - sta_info_flush(sdata); + sta_info_flush(sdata, params->link_id); return 0; } diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 8f2b445a5ec3..e4c55760f90c 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -237,7 +237,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, drv_reset_tsf(local, sdata); if (!ether_addr_equal(ifibss->bssid, bssid)) - sta_info_flush(sdata); + sta_info_flush(sdata, -1); /* if merging, indicate to driver that we leave the old IBSS */ if (sdata->vif.cfg.ibss_joined) { @@ -682,7 +682,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata) ifibss->state = IEEE80211_IBSS_MLME_SEARCH; - sta_info_flush(sdata); + sta_info_flush(sdata, -1); spin_lock_bh(&ifibss->incomplete_lock); while (!list_empty(&ifibss->incomplete_stations)) { diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index e4e7c0b38cb6..97728bb51f9b 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -511,7 +511,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do * would have removed them, but in other modes there shouldn't * be any stations. */ - flushed = sta_info_flush(sdata); + flushed = sta_info_flush(sdata, -1); WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP_VLAN && flushed > 0); /* don't count this interface for allmulti while it is down */ diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index fccbcde3359a..16b5af8ee859 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -1234,7 +1234,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) netif_carrier_off(sdata->dev); /* flush STAs and mpaths on this iface */ - sta_info_flush(sdata); + sta_info_flush(sdata, -1); ieee80211_free_keys(sdata, true); mesh_path_flush_by_iface(sdata); diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 073105deb424..b3f2de3b1669 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -2991,7 +2991,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, sdata->vif.cfg.ssid_len = 0; /* remove AP and TDLS peers */ - sta_info_flush(sdata); + sta_info_flush(sdata, -1); /* finally reset all BSS / config parameters */ if (!ieee80211_vif_is_mld(&sdata->vif)) diff --git a/net/mac80211/ocb.c b/net/mac80211/ocb.c index 449af4e1cca4..7d06166f63bb 100644 --- a/net/mac80211/ocb.c +++ b/net/mac80211/ocb.c @@ -207,7 +207,7 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata) lockdep_assert_wiphy(sdata->local->hw.wiphy); ifocb->joined = false; - sta_info_flush(sdata); + sta_info_flush(sdata, -1); spin_lock_bh(&ifocb->incomplete_lock); while (!list_empty(&ifocb->incomplete_stations)) { diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index bf1adcd96b41..6c9aa8db3c62 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1561,7 +1561,8 @@ void sta_info_stop(struct ieee80211_local *local) } -int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans) +int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans, + int link_id) { struct ieee80211_local *local = sdata->local; struct sta_info *sta, *tmp; @@ -1575,12 +1576,17 @@ int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans) WARN_ON(vlans && !sdata->bss); list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { - if (sdata == sta->sdata || - (vlans && sdata->bss == sta->sdata->bss)) { - if (!WARN_ON(__sta_info_destroy_part1(sta))) - list_add(&sta->free_list, &free_list); - ret++; - } + if (sdata != sta->sdata && + (!vlans || sdata->bss != sta->sdata->bss)) + continue; + + if (link_id >= 0 && !(sta->sta.valid_links & BIT(link_id))) + continue; + + if (!WARN_ON(__sta_info_destroy_part1(sta))) + list_add(&sta->free_list, &free_list); + + ret++; } if (!list_empty(&free_list)) { diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 5ef1554f991f..f03731a5bbee 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -886,8 +886,12 @@ void sta_info_stop(struct ieee80211_local *local); * * @sdata: sdata to remove all stations from * @vlans: if the given interface is an AP interface, also flush VLANs + * @link_id: if given (>=0), all those STA entries using @link_id only + * will be removed. If -1 is passed, all STA entries will be + * removed. */ -int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); +int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans, + int link_id); /** * sta_info_flush - flush matching STA entries from the STA table @@ -895,10 +899,14 @@ int __sta_info_flush(struct ieee80211_sub_if_data *sdata, bool vlans); * Returns the number of removed STA entries. * * @sdata: sdata to remove all stations from + * @link_id: if given (>=0), all those STA entries using @link_id only + * will be removed. If -1 is passed, all STA entries will be + * removed. */ -static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata) +static inline int sta_info_flush(struct ieee80211_sub_if_data *sdata, + int link_id) { - return __sta_info_flush(sdata, false); + return __sta_info_flush(sdata, false, link_id); } void sta_set_rate_info_tx(struct sta_info *sta, From patchwork Thu Jan 25 12:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 13530775 X-Patchwork-Delegate: johannes@sipsolutions.net 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 C68914F88E for ; Thu, 25 Jan 2024 12:59:27 +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=1706187569; cv=none; b=THCfic7q5Np5okvXuLbD/T/ZmydrIAQS8O36N1gTy53Ie9fHyezQdd4A1c9K0DF9Jqk80fM3AHxIODkwVKLWT3OWr4MOMDQNtOfR+rp0jbrA0e1KYvdA4wfe0WnWL3Cnw+wGLwnZFQqRcBUWd8ND9pQ/CR9qMc9QfPJQD9SIS7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706187569; c=relaxed/simple; bh=fveO+5H+lk3A8NyX42BprP3X6Ea6DGTHOvOCQQlrhu0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NERaS/pM2j9PdHIE/ep44uZbp0BZnut3E8SEELhWh8cvgalKml79Fd6f0pkMJX320L5Wbryf9UqgWv1jlfbnBKzwl7R4Hk6k7FH05lMz4DK5CnylmzQJSDAhDAhy6lF9hJ6rnudmVd213qfqT+tUdqhTHVt+RQEaZ5qxG0dipzw= 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=naZp3i8E; 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="naZp3i8E" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40P9dtPo031568; Thu, 25 Jan 2024 12:59:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=zDRhT/J+FtOUydChngJeg+g/jsUa70xFEFEH5O2dOfs=; b=na Zp3i8ESilCi8E+LMwL+hLktR2dVVVMgJ64DNRdaG6tTiCnlOm4yNwE1DC8lPokPZ eZVPtTVKYMCa7JpQk5JDlVoWJjjfWYOD/086Ls3vgypjOeW0IrCEVPu7wqdCjWUp 0uDruUASef4NMu+df++vd5qRWXTSXJlYzztmxugJI/zTbVhXowCww55cwAhR2FFw 3p0wHXwibzeWNxNwrVlzniuieRg+fBIOHIftiNyarNFwIiIQvgurTMSo23rBiLFd PTKi6LjRO4M6kQhfA4FTfLmYRzj5XUbRJeHS0yF7VX1w6Ux8LtZP8sRT03TI3mLx x7eA9qBzdRVlROzwiOtQ== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vun6w0ma2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:18 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40PCxHXc009104 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jan 2024 12:59:17 GMT Received: from cdcwlex322514-lin.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.1118.40; Thu, 25 Jan 2024 04:59:15 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH 3/3] wifi: mac80211: remove only own link stations during stop_ap Date: Thu, 25 Jan 2024 18:28:51 +0530 Message-ID: <20240125125855.827619-4-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240125125855.827619-1-quic_adisi@quicinc.com> References: <20240125125855.827619-1-quic_adisi@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: 9rnTnLTvEzNHeqmgRdRaUXS-SKaT9uFt X-Proofpoint-ORIG-GUID: 9rnTnLTvEzNHeqmgRdRaUXS-SKaT9uFt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-25_07,2024-01-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=856 lowpriorityscore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401190000 definitions=main-2401250089 Currently, whenever AP link is brought down via ieee80211_stop_ap() function, all stations connected to the sdata are flushed. However, in case of MLO there is a requirement to flush only stations connected to that link and not all. For instance - Consider 2 GHz and 5 GHz are AP MLD. Now due to some reason 5 GHz link of this AP is going down (link removal or any other case). All stations connected, even legacy stations connected to 2 GHz link AP would also be flushed. Flushing of other link stations is wrong. Fix this issue by passing self link ID to sta_flush() function. This would then only remove the stations which are still using the passed link ID as their link sta. Other stations will not be affected. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 26a8ea553401..968ceadd88a7 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1618,7 +1618,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, link_conf->ema_ap = false; link_conf->bssid_indicator = 0; - __sta_info_flush(sdata, true, -1); + __sta_info_flush(sdata, true, link_id); ieee80211_free_keys(sdata, true); link_conf->enable_beacon = false;