Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2054901rwe; Fri, 2 Sep 2022 07:55:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Qj/uxN16LIsgE+e6tRzomrL1Ceu2LllabJDhlqyrQrDEpoXdcbd6YvAsGiDryyWEc+L2d X-Received: by 2002:a17:902:8c93:b0:172:bb10:214c with SMTP id t19-20020a1709028c9300b00172bb10214cmr36175608plo.135.1662130510953; Fri, 02 Sep 2022 07:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662130510; cv=none; d=google.com; s=arc-20160816; b=SVOYY7lFNHru4AcAK7qq5E9xh2okq5AccDr/1rOiqAvDF0UR5w9naf/Ugx1+qTRK8G w+xBfczQsFmhyTg+9ZJxlna+mKtCH4UZh8hYOqDr0hIoHqYnt0zUQh4vRuj2cFYiWLBW yuffLTlxzTSYCBybCILC6GILZUAwSFMHjl7CrHB0q97DTWCIBNm8QiJ28lLwDpVYCR4j GVvkimRZtnlY6BcH2bwkXwozBCfMNNfCVrp2iMkG7QJkQl9KPWuET/PV6Da5taE/VN6P 59hKsjVr1/LHHGLrk9Ff3jBDDNbrzCPz8fxMsxIqiwFWh2L5DmdS31K4rz32C6oVrUCJ mM+w== 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=LQITI4s8B3FApvbu+3r828hGRyAymW8FVqoTB6EJHm4=; b=fzWvIw12hEZ9u6dKAuOJvFpQ5ijYOjNTTw3Q3EakZgd2tOj/0FN3pBaw1ZekDlOxX6 imNA+uQdZqi/4qxtw9gMNz13gJgO4f4xpVcxxPPmYm73FfaYVuGdIGRaOMw5yV/ZqaUI w3ib71UxRq0OuwcrSpVeak5ZWuRxu18N4SgHxVusgk90dGygaME5JcI7IFFEBgTIad49 r4e56Ez/9/6AnFKaGNZIO5M/pJyj+Za6IwO4xXTkRjVIuKEPZCSfBvrMQo0ojc7Bprkc paqcgyk70xvutXs3B78PXpdUwyNK/CaJtFHww1fIcjzuV+5xYWTBqsKmvtHJcgyZjwzN fzxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=tPFESsyg; 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=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq13-20020a17090b380d00b001fe2dd0e798si2488382pjb.94.2022.09.02.07.55.02; Fri, 02 Sep 2022 07:55:10 -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=@sipsolutions.net header.s=mail header.b=tPFESsyg; 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=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236508AbiIBOvl (ORCPT + 64 others); Fri, 2 Sep 2022 10:51:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236995AbiIBOvG (ORCPT ); Fri, 2 Sep 2022 10:51:06 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88FDF54CB4 for ; Fri, 2 Sep 2022 07:13:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=LQITI4s8B3FApvbu+3r828hGRyAymW8FVqoTB6EJHm4=; t=1662127991; x=1663337591; b=tPFESsygphgJ4gJGIp+CZydjdeg0Kvu/QFmeAq4/ntEda84 AmrTV6XYiUk6FPsfDMJNi42vGj4Y4SD4utyvEGlFpU+z+Vv9VgvAUOTRf6feKpvm9kcdlHi0/KY9V dceAnAYSsovLT7oTxrG28UZysHYbj0+rm4BKUcoerDMGg4qBARLmbXzBjuRtqgCVfdSN5Kg0zki8d nEw3WhNCAVUOpocgF4iRacBUpHO4cLhSDLG78HdKygMTe/ESEdRU9wGMToUglLusqJKt2+TPR2DLs gPwylSAMGh7sAdJnBOPNt1xd6UOW+p3vrlb6Nu4IYGvpef1ahJcxde81TS27VvnA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1oU7Px-006Ch3-1a; Fri, 02 Sep 2022 16:13:09 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 16/27] wifi: mac80211_hwsim: send NDP for link (de)activation Date: Fri, 2 Sep 2022 16:12:48 +0200 Message-Id: <20220902161143.426a1e56732c.I1755040c1c9adcc60358cb21e03ffee246117547@changeid> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220902141259.377789-1-johannes@sipsolutions.net> References: <20220902141259.377789-1-johannes@sipsolutions.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, 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: Johannes Berg In hwsim we now track when we receive NDP (or other frames carrying a PM bit) to see if a link should be active, but then of course we also need to transmit NDPs to at least set a link to inactive when we deacivate it. Implement that as well as sending an NDP when we activate a link, which allows receiving frames before transmitting any. Signed-off-by: Johannes Berg --- drivers/net/wireless/mac80211_hwsim.c | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index b5bc707d8e4e..18339a56316d 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2966,6 +2966,18 @@ static int mac80211_hwsim_assign_vif_chanctx(struct ieee80211_hw *hw, hwsim_check_magic(vif); hwsim_check_chanctx_magic(ctx); + /* if we activate a link while already associated wake it up */ + if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc) { + struct sk_buff *skb; + + skb = ieee80211_nullfunc_get(hw, vif, link_conf->link_id, true); + if (skb) { + local_bh_disable(); + mac80211_hwsim_tx_frame(hw, skb, ctx->def.chan); + local_bh_enable(); + } + } + return 0; } @@ -2976,6 +2988,22 @@ static void mac80211_hwsim_unassign_vif_chanctx(struct ieee80211_hw *hw, { hwsim_check_magic(vif); hwsim_check_chanctx_magic(ctx); + + /* if we deactivate a link while associated suspend it first */ + if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc) { + struct sk_buff *skb; + + skb = ieee80211_nullfunc_get(hw, vif, link_conf->link_id, true); + if (skb) { + struct ieee80211_hdr *hdr = (void *)skb->data; + + hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); + + local_bh_disable(); + mac80211_hwsim_tx_frame(hw, skb, ctx->def.chan); + local_bh_enable(); + } + } } static const char mac80211_hwsim_gstrings_stats[][ETH_GSTRING_LEN] = { -- 2.37.2