Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3399993lqp; Tue, 26 Mar 2024 08:12:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUm8l1ZXHK9YQsRr2rvoKnQD9+PNqKc/uWyA7vlNVZuv1DZZcWal39Sm2EriiPAqLCQhA+8WMr5gBY0q6Ncn9PViFGmQmPwQ2dqNz+tYA== X-Google-Smtp-Source: AGHT+IEbk2yVz0TEIxdesJpzhlADRAq3nvLiKmx9uHk5ycViILqdmv8JKGSQFgjYSm+zwHFbiMAP X-Received: by 2002:a05:6214:27ca:b0:696:7fc8:b841 with SMTP id ge10-20020a05621427ca00b006967fc8b841mr2492276qvb.16.1711465939746; Tue, 26 Mar 2024 08:12:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711465939; cv=pass; d=google.com; s=arc-20160816; b=HWiAsrhddvhlMlUfLXPQqlEYXP+Mt3Md2liwdsbzIq7aHHTcqukikNcQPGnsVJq/os SDzDsPNcTNdXck9hRxhwTSvnajkStVPz1GI2PIQeDK82bbg9Lm+qUoHxwWVFkkqSv3Pg JAyjiswmyfxf34ApLra7BejTclTREvyGECKbOKBuBRnAUj8vTrsY9DlXVyKPXRADbUfP j6O6XA2qQKi8RMjyIEBRHeo+hpXcIfobyaoZJoHQk1VBYiHl3Ktnz8Ln8MPkJOfILU59 71veXAbMWov1ttEXHowd2P4aL3suJf5zOcqsJo0lereOYdQgFQ5XvLQnD/ypWo6o9Rhq kiHA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=7V62MmxtQJHzpRfLGaN+zHLQHB69JVeWoL7+4Iq8Nng=; fh=dRNDPLKj1q8SUpbayxqGVeYxeS9at2WOrn0wPVmYJGA=; b=vq22nLFVMQNfE03tJ9kXfgLAvHCTuoLiqFC88p8ISnbxIiHdpaNOl700L2VvvgchXk FKbS+HzWQcSnUv6LHFJPR4HzkcvvJa8nFlw2GcfPtCkop6fnNEabnLyyTQlhFERZoMFt II+w296c3enKwvggRWwA2x/hz+wf3QZjaJuG89BjhI5aFkWwJfkqAmAnu4lewJysw5ti Q7HUJj5DtLRsoRrnRh3k7qtczk6zNgbKPQm0BO0HIrXjWkjYtRHCFsR2VQhE/avFmSlh +e3iO13H66Hg15MEg4A4M5qfPrfm0KGjuGpcwEDk+aQ8/DSuDrYjr6YjPq3nrdcpofJK vmZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IuM8ujOZ; 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-5282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5282-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b9-20020a05622a020900b0043120072704si656302qtx.789.2024.03.26.08.12.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 08:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IuM8ujOZ; 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-5282-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5282-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 351C21C2B5B9 for ; Tue, 26 Mar 2024 15:12:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18B0E13C808; Tue, 26 Mar 2024 15:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="IuM8ujOZ" X-Original-To: linux-wireless@vger.kernel.org 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 439C11CAA5 for ; Tue, 26 Mar 2024 15:12:03 +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=1711465926; cv=none; b=emlD4jE9regzv4mHWg2Aeld4Qq5p5qUy/8whLkaRzDgsxK+4rp5kAqtFI+AzdDorYK0KhHNhK1jToDMxYidmzpJE5FiC2E8tltP6xDg4zGoS9FBdsZxC2XgiWdLCjQisUHariQm3hyPGgQEGE1VjzesWOqGpxtk8sHR/JEyk+u8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711465926; c=relaxed/simple; bh=oUYxYMT0Zs/nsS7aXBXWrnvqJfOonW7UjFZX6e3LKi4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PmUGFIvgEOhRX0x+ZNu/y1Ev6bg78/Ze+KheHenLd8AlPnj5VzKPB/y23PdpbhRA73qGNqt3L3jeGRW4claLY1RiKWDIIw/krqUVKJrsxj1krCSykN6o1WXhpWTbRIZvV/HnNE6n+DiGvYsRiAetZL9g/HqJHHbsTSJzWD1WCE8= 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=IuM8ujOZ; 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 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42Q672tJ005665; Tue, 26 Mar 2024 15:11:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=7V62Mmx tQJHzpRfLGaN+zHLQHB69JVeWoL7+4Iq8Nng=; b=IuM8ujOZYtJBZ8FsgNNIbjl x7HgcAKbY6v5zg4icCZILxLHd+mky0yft4VC5XgVbSVy+iZlExgZ6nMFxW43kNkP +t6ORfXdC9vIEb1pimltBZL7OL0kcXNDKQctjMX8SrZPa6WcUGevhxtiARkeAV0Q zjSTO0JnQTtLY3zRp1GSzQ+APwaTfUn0oJRVYHAK7NXZ6Y0cT+t6Hdgc+UZXGb2e XEMo3GUYATbEYuR/7m1Rzu+8ltHaD4AYeN5WufnfVXIc5JDUG/7CvhoxqVn8P1k2 nZsmqXqLiD/lk8N0r71EfTgC6Bqeic7vVdU4s9zZbHwi+IZYOm//7ddSB0YlpxA= = Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x3rt81jdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 15:11:59 +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 42QFBwqw003890 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Mar 2024 15:11:58 GMT Received: from hu-adisi-blr.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; Tue, 26 Mar 2024 08:11:56 -0700 From: Aditya Kumar Singh To: CC: , Aditya Kumar Singh Subject: [PATCH] wifi: mac80211: handle sdata->u.ap.active flag with MLO Date: Tue, 26 Mar 2024 20:41:41 +0530 Message-ID: <20240326151141.3824454-1-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 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-GUID: bfh-ZyHYP7AzFD7rcB0g4XmyOWpK3xrG X-Proofpoint-ORIG-GUID: bfh-ZyHYP7AzFD7rcB0g4XmyOWpK3xrG 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-03-26_06,2024-03-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 mlxscore=0 clxscore=1015 spamscore=0 mlxlogscore=935 phishscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2403260107 Currently whenever link AP beacon is assigned, sdata->u.ap.active flag is set and whenever it is brought down, the flag is reset. However, with MLO, all the links of the same MLD would use the same sdata. Hence there is no need to set/reset for each link up/down. Also, resetting it when only one of the links went down is not desirable. Add changes to set the active flag only when first link is assigned beacon. Similarly, add changes to reset that flag only when last link is brought down. Signed-off-by: Aditya Kumar Singh --- net/mac80211/cfg.c | 62 +++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index f03452dc716d..ca0a3e6ba0fb 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1092,6 +1092,30 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst, return offset; } +static u8 ieee80211_num_beaconing_links(struct ieee80211_sub_if_data *sdata) +{ + struct ieee80211_link_data *link; + u8 link_id, num = 0; + + if (sdata->vif.type != NL80211_IFTYPE_AP && + sdata->vif.type != NL80211_IFTYPE_P2P_GO) + return num; + + if (!sdata->vif.valid_links) + return num; + + for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { + link = sdata_dereference(sdata->link[link_id], sdata); + if (!link) + continue; + + if (sdata_dereference(link->u.ap.beacon, sdata)) + num++; + } + + return num; +} + static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, struct ieee80211_link_data *link, @@ -1232,7 +1256,9 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, } rcu_assign_pointer(link->u.ap.beacon, new); - sdata->u.ap.active = true; + + if (ieee80211_num_beaconing_links(sdata) <= 1) + sdata->u.ap.active = true; if (old) kfree_rcu(old, rcu_head); @@ -1241,30 +1267,6 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, return 0; } -static u8 ieee80211_num_beaconing_links(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_link_data *link; - u8 link_id, num = 0; - - if (sdata->vif.type != NL80211_IFTYPE_AP && - sdata->vif.type != NL80211_IFTYPE_P2P_GO) - return num; - - if (!sdata->vif.valid_links) - return num; - - for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { - link = sdata_dereference(sdata->link[link_id], sdata); - if (!link) - continue; - - if (sdata_dereference(link->u.ap.beacon, sdata)) - num++; - } - - return num; -} - static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *params) { @@ -1486,7 +1488,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, if (old) kfree_rcu(old, rcu_head); RCU_INIT_POINTER(link->u.ap.beacon, NULL); - sdata->u.ap.active = false; + + if (!ieee80211_num_beaconing_links(sdata)) + sdata->u.ap.active = false; + goto error; } @@ -1619,11 +1624,12 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) netif_carrier_off(vlan->dev); - if (ieee80211_num_beaconing_links(sdata) <= 1) + if (ieee80211_num_beaconing_links(sdata) <= 1) { netif_carrier_off(dev); + sdata->u.ap.active = false; + } /* remove beacon and probe response */ - sdata->u.ap.active = false; RCU_INIT_POINTER(link->u.ap.beacon, NULL); RCU_INIT_POINTER(link->u.ap.probe_resp, NULL); RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL); base-commit: d69aef8084cc72df7b0f2583096d9b037c647ec8 -- 2.25.1