Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5455821rwd; Sun, 18 Jun 2023 11:51:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7j7qQR59euOxoG+px14jYIMq9IQ4ecjJzaVenTgb7JJm9vPr57NjF1fwdECaaYq4bqtnEm X-Received: by 2002:a17:902:b28c:b0:1b5:2c0b:22d3 with SMTP id u12-20020a170902b28c00b001b52c0b22d3mr6602106plr.14.1687114295620; Sun, 18 Jun 2023 11:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687114295; cv=none; d=google.com; s=arc-20160816; b=xc6EVVVl26Hu4YNMr+lo3zSfWBqF84NgPkzNVXE7DbR9Kv4YfZpzjtB+WFSju3f2KW nY8jtB8jRE27n5+orl27q64T9xNGYDuKgLe3vPwzSDjHMqKX0c0X69SRkYfBlwv0MVrf MYPeTUTbDbf4qvdJWGQhD4w7izZI/BTttyYREoylT9f8ZhNHqSkYwFTRhHUYzP98j0TC nYKgcDMB5roJDyvN/FSNy2Fiu+wmG5VxEjfFvR44Gp8I8Ok/hZxqW8IcwpzHoOTzM2l/ mpexoatVZgEx8GhAXAgLRKZoM8wirR7XzibhQmpACPZskP4x6qWt5T33XfwLfOl8st27 YjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WY0dim2a5E0OpcIhD1Xh1wjIMiJbLG3w8b1d2fLM5FI=; b=l4DkBrHLgi1U6H9NxeSK/ShSXKu7KMIuv8C54QzQLXFYS9Gl22cNx8rAN3WK6XgcMD GFdtYY5N4r0qvD9HnphfsoHNb9SMiMV7elmVyT5laFRYZW22yT5zgT0Ey+Qu0uXgRPsi uo1pyult5Wv9b/uVNEpyduuEcDnYoYYUMC/LPaQeW8+P7wXNA2DQTMCU+nZsXB1XchuK lxVoxagUQxbp/vPosQhY+QfR6ib34Pz0QIQJeeAwH0S1FC8+cqTuwWDfkcCHjIlJq7+Q qw3wvT0AJ4I8Mhi+WIElf+D2gmZNd50lZRz8xOPUoJrQO/C+NgszjhlAyuW8BxWCJ2n0 cMJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I+z93zmN; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a170902db0c00b001b3f77db81dsi7117864plx.514.2023.06.18.11.51.24; Sun, 18 Jun 2023 11:51:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I+z93zmN; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbjFRSuW (ORCPT + 62 others); Sun, 18 Jun 2023 14:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjFRSuV (ORCPT ); Sun, 18 Jun 2023 14:50:21 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79CFC1B9 for ; Sun, 18 Jun 2023 11:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687114218; x=1718650218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1AkDN9h5Mr4xZknSLF6DOl+cao0bGHnkKdns2iZ9N8I=; b=I+z93zmNn9EYaS3H7+Pnz7HHZSyfxyphNWXAQo523VE6/3y8c7nWtAA5 43pjrbuUlPYprhRQB7x1a4LIUJ+WdXiPF+dJ2NMCacQ/QJNwwtENNO92D gbiIpUDfcz+XmG8Bb/5RC1szI2Um3pS61AcLFh1zPG0KMSflJveaIcOue JCV+tw3qohnaAv7Is6035PTgcfHhZ5FuxPC1EBJVjcy6P1YFKHYX0kcsl yiFcbxRfLiDBhRs/0yW3UwDYWxhwFpkImj4Zv2IY56NEtEq7yjBLNDYpz cOo/H+bDFPlHPlFAWsxcAx9XlZg8t0bQ71aPgnEy5gGv6jbvFlsfOJ/ZN Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="339116624" X-IronPort-AV: E=Sophos;i="6.00,253,1681196400"; d="scan'208";a="339116624" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2023 11:50:18 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10745"; a="747233839" X-IronPort-AV: E=Sophos;i="6.00,253,1681196400"; d="scan'208";a="747233839" Received: from aflumen-mobl2.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.251.178.161]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2023 11:50:16 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Gregory Greenman Subject: [PATCH 01/20] wifi: cfg80211: Support changes in AP MLD link state change Date: Sun, 18 Jun 2023 21:49:43 +0300 Message-Id: <20230618214435.d562a43a623e.I9fd75221cb621dd8f0a6922a1674d54dbdb57895@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230618185002.817236-1-gregory.greenman@intel.com> References: <20230618185002.817236-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ilan Peer Add support for the low level driver to indicate about the removal of connection links that were removed by the AP MLD. Propagate this information to user space so it could act accordingly. Signed-off-by: Ilan Peer Signed-off-by: Gregory Greenman --- include/net/cfg80211.h | 14 ++++++++++++ include/uapi/linux/nl80211.h | 3 +++ net/wireless/nl80211.c | 43 ++++++++++++++++++++++++++++++++++++ net/wireless/trace.h | 16 ++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9972de114d73..9eba57d35e98 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -8359,6 +8359,20 @@ void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer, */ void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp); +/** + * cfg80211_cqm_links_state_change_notify - inform CQM of change in AP MLD + * links + * + * @dev: network device + * @removed_links: bitmap of links on which connection was removed due to links + * being removed by the AP MLD. + * + * Caller must acquire wdev_lock, therefore must only be called from sleepable + * driver context! + */ +void cfg80211_cqm_links_state_change_notify(struct net_device *dev, + u16 removed_links); + /** * __cfg80211_radar_event - radar detection event * @wiphy: the wiphy diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 03939bdb0e48..fece687054ef 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -5350,6 +5350,8 @@ enum nl80211_ps_state { * loss event * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the * RSSI threshold event. + * @NL80211_ATTR_CQM_REMOVED_LINKS: bitmap of links on which connection was + * removed due to links being removed by the AP MLD. * @__NL80211_ATTR_CQM_AFTER_LAST: internal * @NL80211_ATTR_CQM_MAX: highest key attribute */ @@ -5364,6 +5366,7 @@ enum nl80211_attr_cqm { NL80211_ATTR_CQM_TXE_INTVL, NL80211_ATTR_CQM_BEACON_LOSS_EVENT, NL80211_ATTR_CQM_RSSI_LEVEL, + NL80211_ATTR_CQM_REMOVED_LINKS, /* keep last */ __NL80211_ATTR_CQM_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7b547aeb52f1..a85256a3e063 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -19108,6 +19108,49 @@ void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp) } EXPORT_SYMBOL(cfg80211_cqm_beacon_loss_notify); +void cfg80211_cqm_links_state_change_notify(struct net_device *dev, + u16 removed_links) +{ + struct wireless_dev *wdev = dev->ieee80211_ptr; + struct sk_buff *msg; + unsigned long removed = removed_links; + u8 link_id; + + ASSERT_WDEV_LOCK(wdev); + + trace_cfg80211_cqm_links_state_change_notify(dev, removed_links); + + if (!removed_links) + return; + + WARN_ON((wdev->valid_links & removed_links) != removed_links); + wdev->valid_links &= ~removed_links; + + for_each_set_bit(link_id, &removed, IEEE80211_MLD_MAX_NUM_LINKS) { + if (!wdev->links[link_id].client.current_bss) + continue; + + cfg80211_unhold_bss(wdev->links[link_id].client.current_bss); + cfg80211_put_bss(wdev->wiphy, + &wdev->links[link_id].client.current_bss->pub); + wdev->links[link_id].client.current_bss = NULL; + } + + msg = cfg80211_prepare_cqm(dev, NULL, GFP_KERNEL); + if (!msg) + return; + + if (nla_put_u16(msg, NL80211_ATTR_CQM_REMOVED_LINKS, removed_links)) + goto nla_put_failure; + + cfg80211_send_cqm(msg, GFP_KERNEL); + return; + + nla_put_failure: + nlmsg_free(msg); +} +EXPORT_SYMBOL(cfg80211_cqm_links_state_change_notify); + static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev, struct net_device *netdev, const u8 *bssid, const u8 *replay_ctr, gfp_t gfp) diff --git a/net/wireless/trace.h b/net/wireless/trace.h index e63990b81249..facea3aba60f 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -3966,6 +3966,22 @@ TRACE_EVENT(rdev_set_hw_timestamp, __entry->enable) ); +TRACE_EVENT(cfg80211_cqm_links_state_change_notify, + TP_PROTO(struct net_device *netdev, + u16 removed_links), + TP_ARGS(netdev, removed_links), + TP_STRUCT__entry( + NETDEV_ENTRY + __field(u16, removed_links) + ), + TP_fast_assign( + NETDEV_ASSIGN; + __entry->removed_links = removed_links; + ), + TP_printk(NETDEV_PR_FMT ", removed_links=0x%x", + NETDEV_PR_ARG, __entry->removed_links) +); + #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- 2.38.1