Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp701940pxx; Wed, 28 Oct 2020 14:59:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWxI2WDdyypU1v2OWdk0kKqv+dP9LK59AhPU9KaW+fvcnxLhNK7IMMWQ4sCFXQnCx9qhox X-Received: by 2002:a50:e442:: with SMTP id e2mr1067448edm.186.1603922356916; Wed, 28 Oct 2020 14:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603922356; cv=none; d=google.com; s=arc-20160816; b=ID5QQ0I2zAVUS7pvOr+904kt3gkkkUBhRMZCsOdW6c86Rat8zWNo9vfdWjNEbeS8KX h2ngY2C+vFi5wGK09Wb1kiJaxy3IkUsdnjZCP/9QFYXcplKtJ9QiYhusjFqcpj/IpWwW gtvEMYkLJD5EyyRTi3Pc5oob1cHSHAhvACmUFG2Tb+fNabfXE1kgQKkESyQoyystkItK t9DWCHCLxX+MxV02/YUnBlC46w25gNxyJug9ykj7K5BNUhnp8AnWMp4k0vnUP6E8XQmb HurzztQl5BoG1sKYdFxzhI7OpDOGuoR1bFUacpo6oLH/WyCvQirwFUvnfE1UI4BgqqqR sfiQ== 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=zHdXxs/T9mZg7pnTabmXNYI1gYHQQJ61N4sTHUvcPUk=; b=W8jrcwQdqFV00wVroHbgYTogsIlF4pvSIv4SBd3MTYzMLXN06O3KsfbVW3ldAtuHDd NbaNgv6Xp7CoHl/0BXWDXbm45TYA14OBLCq1V8xgzjICUzsaTs8v0NlNMzZiylVRPDRS BbvpcO4Kgi4dWmmaHBNkYNoEJB040p8mq1rqXgw2ilMNBNGpknbgZd42nZtkrEpq9AIE THWBNmJCQ1F3E5yopK+ZNYZMC4F09Tp8Si7ptTYxlY4qMEXy2ZIGdIjzru3EFHFJhA2h 6nFUFuJYFJ4wFcbPYpnYzTTQ2R49zy9eTok54IU4EBRaDndvYtHKrF5nJ+rRR47yGrnI /U2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AmUwQcAt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si83186ejb.408.2020.10.28.14.58.52; Wed, 28 Oct 2020 14:59:16 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AmUwQcAt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728585AbgJ1V4N (ORCPT + 99 others); Wed, 28 Oct 2020 17:56:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgJ1V4M (ORCPT ); Wed, 28 Oct 2020 17:56:12 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D59C0613CF; Wed, 28 Oct 2020 14:56:12 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id j7so1120239oie.12; Wed, 28 Oct 2020 14:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zHdXxs/T9mZg7pnTabmXNYI1gYHQQJ61N4sTHUvcPUk=; b=AmUwQcAt1VAGU+7CByHjC1Oes4GGfSweQWXlDbr/CgxxRlilrbYYTenjwbPYHyWEgz LHKkymEHL2DocTPL4lE4s+GQ7MnwLW2fbZ8VVqpdXOb7lw036dXA7nGpYVbCDuH1Drc8 mjDgmgjwN2ET48i7VDJG6QiYUGQHvkY1SH2nnqru/vudIvjqa93+hzscx+Nvsh2a9CrY 13a7Xjp8UBlCNG7rx9Cjx3h9wI5LXEOHlShiduPrll7YHkterXWu9qvJ04eUO2hO0u1j WpgOuzLuGL0Elokp1fJyngH94yqobI2Te7x3nMzibwjr9jD5Kj2aRA3flo0MUczTmrDn Y11Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zHdXxs/T9mZg7pnTabmXNYI1gYHQQJ61N4sTHUvcPUk=; b=KTvV7+WpGvbXzWL9absHP6KSMhSNGXtW6DCLg1fGi+7QG5+RN7YCVQr2wN4L1N40xI psj+vHeeJayz6NwfRF9O7laKVtxJg/f+z002BH2WBRLRyscuIRvQyJ8XlZjUBQC7Oo4h i/x4wdG5GY7lHd7eNsRtsXKdJhPTmK6yRFESSuD8iOjXiWVC7DZtv6C7lZdXHVLAAtwR EMRm3/Uowu2mlBoPVh9zxcEVD5uHlvMUbYPwGGNPqqgu9c4PPumrmknfD5gdfMgMtUqX D0MnEAJuNBJzglaTKDdzzriL+XrWSoua0qq6bmdltILYEtAGd3Zj2u3rk37eixsdGc2N q9dw== X-Gm-Message-State: AOAM531RV6PY+mE4hT/JWY2WFDyRbM2P3XGsHAJJnkonp4mCJVbqiY8P bEGB6AHtjT7rXhtDa6ddRgoI02VUKCWh5dYb X-Received: by 2002:a17:90a:5303:: with SMTP id x3mr2781024pjh.188.1603895158254; Wed, 28 Oct 2020 07:25:58 -0700 (PDT) Received: from k5-sbwpb.flets-east.jp (i60-35-254-237.s41.a020.ap.plala.or.jp. [60.35.254.237]) by smtp.gmail.com with ESMTPSA id 194sm6227192pfz.182.2020.10.28.07.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 07:25:57 -0700 (PDT) From: Tsuchiya Yuto To: Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maximilian Luz , Andy Shevchenko , verdre@v0yd.nl, Tsuchiya Yuto Subject: [PATCH 2/3] mwifiex: add allow_ps_mode module parameter Date: Wed, 28 Oct 2020 23:24:32 +0900 Message-Id: <20201028142433.18501-3-kitakar@gmail.com> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201028142433.18501-1-kitakar@gmail.com> References: <20201028142433.18501-1-kitakar@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org To make the ps_mode (power_save) control easier, this commit adds a new module parameter allow_ps_mode and set it false (disallowed) by default. When this parameter is set to false, changing the power_save mode will be disallowed like the following: $ sudo iw dev mlan0 set power_save on command failed: Operation not permitted (-1) Signed-off-by: Tsuchiya Yuto --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index a6b9dc6700b14..943bc1e8ceaee 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -25,6 +25,11 @@ static char *reg_alpha2; module_param(reg_alpha2, charp, 0); +static bool allow_ps_mode; +module_param(allow_ps_mode, bool, 0644); +MODULE_PARM_DESC(allow_ps_mode, + "allow WiFi power management to be enabled. (default: disallowed)"); + static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = { { .max = MWIFIEX_MAX_BSS_NUM, @@ -435,6 +440,17 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy, ps_mode = enabled; + /* Allow ps_mode to be enabled only when allow_ps_mode is true */ + if (ps_mode && !allow_ps_mode) { + mwifiex_dbg(priv->adapter, MSG, + "Enabling ps_mode disallowed by modparam\n"); + + /* Return -EPERM to inform userspace tools that setting + * power_save to be enabled is not permitted. + */ + return -EPERM; + } + return mwifiex_drv_set_power(priv, &ps_mode); } -- 2.29.1