Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2504355rdb; Mon, 5 Feb 2024 08:30:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRBWaHNVmnrB215QjrSwL+bvFeOe+7D+t3rE7dNOtPmc50j3bYo0DRX3vqMEuZXy2H+PGN X-Received: by 2002:a05:6a21:918b:b0:19c:916d:8758 with SMTP id tp11-20020a056a21918b00b0019c916d8758mr9270512pzb.53.1707150629407; Mon, 05 Feb 2024 08:30:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707150629; cv=pass; d=google.com; s=arc-20160816; b=nY3QrwiIz5H1U/cWIME0T9JkMmbkE+2DH3kkk/GdIqwBzbjVvm4yXC3oV7WUgvMLYy x6mgJWWAct6J6mzaEw/mvYUetDntDEyEM3SX0LePDw5sYSkh2FU2h4anENHyGPGdav6h rYEtKqRrGDOSxh6rEeA8tQ1xJt3mrd7/fui7dKeY+h+XsKaFhR8URBTa/D6BKYJLkpLC Ow+VGbjN6i1P1FeuqggIbhXJ0JMPRRxjRrE3q0av8jZtu1yo4+3SiwOPyOZYSNL0THDD GhVaSIlOqdDmAR6xBwTxDLD6SD1nK79OesyoDE9RZHVTW0KcJdxDju72YGDajpc12OVq 4QJA== 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=mPyYGkOMG8zH9WPqOf1YI01PveuxX3SCP1+Bgft9bp4=; fh=x7yQoCm3m81y/D868oAn3wsXKwf48R1/u+JAbwXXJxE=; b=lXGDYCAB0cwjILVB6HZllMoHHu0Irb/y8yk9kMlIrJeA3kP1kUTO3IO6gMIws7B0uK kwuHdoohzNvHd3nSCn63IubGMPh6zNxa9L+l0tox0TVStWDIaVtLcztN8GpQoiL/aUKz KWfsPY5EjkLeM0TiFzx0njz1CAvY794yikYPwr6umJtY8w0D6Rg16wyAZ154o4/YfjU8 Wi9BL6hxwmYUvipOGgJVtMwWfAxuCrKUV3nmEmbLYfMAt8f3in62en/sv6sciWFbXnwN UrDXc6R3AF7zkCJgewUV3nCOG4CMPAatQ5JckkE7uAiH+mEGnx4+/s9S3///1wz6SbqF Y5KA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aFPl4PE3; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-3136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCUX5Tt/qBfAHhILNAX15bxIlWPay8MSIDZ3elLNl8B7tljCuK7+W+lpXv6T9nNUwXXKPLFlbgjYvrOkIGcFiI63YRlZoLTUEuG60Uj2CA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c11-20020aa78c0b000000b006e03e559408si25965pfd.266.2024.02.05.08.30.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 08:30:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=aFPl4PE3; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-3136-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 976E028437D for ; Mon, 5 Feb 2024 16:30:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7EF7A3BB3B; Mon, 5 Feb 2024 16:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="aFPl4PE3" X-Original-To: linux-wireless@vger.kernel.org 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 CD0F526AF1 for ; Mon, 5 Feb 2024 16:30: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=1707150620; cv=none; b=e9SLjzVeaNyw12jIaEYV+O3/C4PMx7udBZj87vfY21a728wsrz/z5wCA48AYg6P5eXvw21D5XLm9KlCOMMLVa22qcDEfw34NoxuYMIek/R4h1wvtv+YJbEP0RvdilcRacIdDt7ERqrgICfhoXgRQ26gNfX3e65SWEl3PFAOS5iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707150620; c=relaxed/simple; bh=5owV8Clu0+p7o1yuq9OY1bZkPBAgic0T33FXwGE4HBg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Cc36KpAJjhcsNW8WcrUNjAblHCeqgRyifyPBDVWUlJhfwh8mAqd37sRldco6m/MGYP6pR7/0eofPAVfWcufa8Hp6vI/zUiCpc1dxDJdLIBGT7Pokn3AKaR2O3A671B5bPq8BLcGj/pLTGWQiRa7DhOoW132YdvxKlvL7/QP4zT0= 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=aFPl4PE3; 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 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 415Cmdpn009759; Mon, 5 Feb 2024 16:30:15 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=mPyYGkOMG8zH9WPqOf1YI01PveuxX3SCP1+Bgft9bp4=; b=aF Pl4PE3IGnFeoN+yKTxpZDBITLcKQNb+VbA65LK5DeU/ktr35q02d/oRBHcbmcrfL micvfCPRJSKJtFJKkjfZW1Z8Q7ZE/1+2x8uX/zdNUW+UWYVmmptlW2/Z5NTIhNBl 2xHVR1dLLaL+sekG4K1p7zyB9aBPr40P93x9XUP8j9oOI/uzBFiPgd/d/nx73C6l x//gLqcynlnn1WlaGTzwMc7sa2cWgGUDTo5cKXkdxEX2SP8UFF4H1ld9344+vSKL tNx8SMHYGwuuD+BJqUtGNOG1uCw/9/OgtqUBcJJszdnxSN9Vmys9qYRZUhjG1ABV 3R6l7i7eaVh2JFu4VN+Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w2s07scsq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 16:30:14 +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 415GUE5j016404 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 5 Feb 2024 16:30:14 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; Mon, 5 Feb 2024 08:30:12 -0800 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH v2 2/3] wifi: mac80211: add link id argument for sta_flush() function Date: Mon, 5 Feb 2024 21:59:51 +0530 Message-ID: <20240205162952.1697646-3-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240205162952.1697646-1-quic_adisi@quicinc.com> References: <20240205162952.1697646-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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-ORIG-GUID: NX4IoFB7j8M0S67jIdjcb2h4FPKt8nyc X-Proofpoint-GUID: NX4IoFB7j8M0S67jIdjcb2h4FPKt8nyc 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-02-05_10,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402050125 Whenever sta_flush() function is invoked, all STAs present in that interface are flushed. In case of MLO, it is desireable to only flush such STAs who are at least using a given link id as one of its active links. Add support for this by making change in the __sta_info_flush API argument to accept a link ID. And then, only if the STA is using the given link as one of its active links, it would be flushed. 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 | 21 ++++++++++++++------- net/mac80211/sta_info.h | 14 +++++++++++--- 8 files changed, 33 insertions(+), 18 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 2830ddac45b2..5035c2bdf348 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; @@ -2096,7 +2096,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 df314222c2c9..64932eb60cc8 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 cc9a8eaffa6b..6df0e342a1be 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 4391d8dd634b..da5fdd6f5c85 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1566,7 +1566,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; @@ -1580,12 +1581,18 @@ 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 && + !(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, -- 2.25.1