Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1465664pxb; Wed, 12 Jan 2022 15:43:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXDITuzm9t2+WyYhLCDoJpiKhwLjkjLkYwLxTOkvTdhDFWC5mM2r6hOqr6yt6URAI1e4x4 X-Received: by 2002:a17:90b:4d91:: with SMTP id oj17mr11482914pjb.224.1642030981219; Wed, 12 Jan 2022 15:43:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642030981; cv=none; d=google.com; s=arc-20160816; b=eGHKaW+XmsPJaHveHOcvRAKqANYYeTdo4e3wfyxhur/yj8oqtSzq3D27cK8Msh47sY eEcN83+7JrE/oIgaV8i+ob9ZqtF72DTguBFI4JSJX9L5H3iRqQ855DoiQa3txhG5T99a bcxnpPXyHhFZ2y92hgqmlo/RRHxDJ4lmTztNb4qpE1+A+eK8g9heawqrLaLJF+3fMHI5 vCNb8zZsqq8++Gs0yEIu5Ak5YTDJaFLC1cboXHaOInNHqWUzpSXk+BzNj6km8Do23lfE WpL/utOc96iQNHTbewMTrwEz5SVPY+LTm7GSVkcS0F9moGXB4Tbax7DDYCmf5QzLU8ks G6UA== 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; bh=c+enYpsSKb+Domg7xZZn9g+OC7AJoqDCvCxbC2HhJQM=; b=pplQ7GwEWU2doARYbRtC1CDgdPSlon15VEPP8Am2EZxYDtvyAQJTVbtf9tH8Exrxzp 1OPx6nfJUti1ZpQcqW4K+kVAQ27HEpP/aAwgd0DBsMgzMAF6rooC5eFVsiE3EfguAE8O +NmQ/fHpr9qT0MMXHtw+VkOayirZvx5inywlx35hbjWBpnt/1CBwLm19qLkOPtiukYFP 4lKumSGl56n40gfCYOeq6METBF+8EPtiCUA71CPaS8jZQQTWRJbmS6+O1QKmBn90v38s 6QLMAsiz3qE8W2NxlUlfxktRocvk652+HzWAoiOrVq7C6Ci3Hlrif1Qqz/+VkmGUbXu9 oAPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si1028999pgk.532.2022.01.12.15.42.51; Wed, 12 Jan 2022 15:43:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350013AbiALRdT (ORCPT + 71 others); Wed, 12 Jan 2022 12:33:19 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:34129 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239618AbiALRdT (ORCPT ); Wed, 12 Jan 2022 12:33:19 -0500 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id B8EDE20008; Wed, 12 Jan 2022 17:33:15 +0000 (UTC) From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org, "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Michael Hennerich , Harry Morris , Varka Bhadram , Xue Liu , Alan Ott , David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , linux-wireless@vger.kernel.org, Miquel Raynal Subject: [wpan-next v2 01/27] net: mac802154: Split the set channel hook implementation Date: Wed, 12 Jan 2022 18:32:46 +0100 Message-Id: <20220112173312.764660-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220112173312.764660-1-miquel.raynal@bootlin.com> References: <20220112173312.764660-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As it is currently designed, the set_channel() cfg802154 hook implemented in the softMAC is doing a couple of checks before actually performing the channel change. However, as we enhance the support for automatically setting the symbol duration during channel changes, it will also be needed to ensure that the corresponding channel as properly be selected at probe time. In order to verify this, we will need to separate the channel change from the previous checks. These checks are actually here to speed up the process when the user request necessitates no change, so we can safely bypass them. Signed-off-by: Miquel Raynal --- net/mac802154/cfg.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c index fbeebe3bc31d..870e442bbff0 100644 --- a/net/mac802154/cfg.c +++ b/net/mac802154/cfg.c @@ -103,17 +103,13 @@ ieee802154_del_iface(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev) } static int -ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) +ieee802154_change_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) { struct ieee802154_local *local = wpan_phy_priv(wpan_phy); int ret; ASSERT_RTNL(); - if (wpan_phy->current_page == page && - wpan_phy->current_channel == channel) - return 0; - ret = drv_set_channel(local, page, channel); if (!ret) { wpan_phy->current_page = page; @@ -123,6 +119,18 @@ ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) return ret; } +static int +ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) +{ + ASSERT_RTNL(); + + if (wpan_phy->current_page == page && + wpan_phy->current_channel == channel) + return 0; + + return ieee802154_change_channel(wpan_phy, page, channel); +} + static int ieee802154_set_cca_mode(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca) -- 2.27.0