From patchwork Wed Oct 28 14:24:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsuchiya Yuto X-Patchwork-Id: 1389782 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PgW57MjB; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM7yq1rwMz9sSC for ; Thu, 29 Oct 2020 13:03:47 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgJ2CDp (ORCPT ); Wed, 28 Oct 2020 22:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbgJ1VsD (ORCPT ); Wed, 28 Oct 2020 17:48:03 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF23C0613D1; Wed, 28 Oct 2020 14:48:03 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id x1so1090952oic.13; Wed, 28 Oct 2020 14:48:03 -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=3zaGVF/vRB8F3ZfUMCb7b4cb/WN/x096ZDL+SPEx+Nc=; b=PgW57MjBfkv/pDJis6/z8OJ5FjZvPRloQO8Q8OaNappYffXSAsSfkcDzRsKG+GbBTv ITudr4QvE9TXbsG2R9Dyja7yX4JRx6RIdXGED3Xf7DHv/y+o3CtpwDlNgxnRLibWgTnl x/Qqhog2QHiU4BHKhuO0fjTSJDHPbz4JWsGR8MVcOzityq3d63V9dZhHtx1g4UZbFB1t yqPcJvJ83EEABZohcwrrSJO3DdAzlXHS76U344l1XT0RgDeRa8GNVZ4po7UiG3+3qecD fzR0ApV2PmWz3PVQueHSCMMBpv6LcAeDjqExX4zkJNIa/ou7auEea+splwDD8DeQK6d7 GFpA== 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=3zaGVF/vRB8F3ZfUMCb7b4cb/WN/x096ZDL+SPEx+Nc=; b=gvaD/qOFg2/Ln3dq1K4jSJLzbdix5R3z3YKhkCu4jXE4BLBQLPHrXtLjE8zrUEfUKQ Tc2EJ/6gHsVQf2UdQQBTqMbxKrYMh2eSNyzOPk1+ZeQgjBRUqxkiTVxNSJyxuLCjKuYs 1p8GJGCNnS7EjxEUoZHOgRnHRcM9gwGlWSq/DAC7jsouMU85MZb2/rx2xoUc8WE3SFdL gyqDmpQ02eOX9ojWtz7FGDNAF89ckegQ1h7x1AaWF3uRCKHL+zxYSdYeCHdPwDrnu/6Z RwmADQgtOpVaEawipsAxjEe1FiHuIe0AkPDyZb9kg/NAnVVmnVX+q+AbGWmmOWpXVEhx yjaA== X-Gm-Message-State: AOAM533W/IEV3KQQE7+vhyvX4LybrtdJM6Kz6rGpuIZjZYtTVKhn/G5A ezzuEf4R6KhFlyHOrBgkIBMdsOqJETdRuyK6 X-Google-Smtp-Source: ABdhPJy4xaFFSb67eIdsE6yHQCjXYR1ulDiZ6JWAFabC/3uwCf7CfY4vHIFnetkjx6OwdcANGFeH+w== X-Received: by 2002:a17:90a:e604:: with SMTP id j4mr6796905pjy.204.1603895135618; Wed, 28 Oct 2020 07:25:35 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 07:25:35 -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 1/3] mwifiex: disable ps_mode explicitly by default instead Date: Wed, 28 Oct 2020 23:24:31 +0900 Message-Id: <20201028142433.18501-2-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Microsoft Surface devices (PCIe-88W8897), the ps_mode causes connection unstable, especially with 5GHz APs. Then, it eventually causes fw crash. This commit disables ps_mode by default instead of enabling it. Required code is extracted from mwifiex_drv_set_power(). Signed-off-by: Tsuchiya Yuto --- drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c index d3a968ef21ef9..9b7b52fbc9c45 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c @@ -2333,14 +2333,19 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init) return -1; if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) { - /* Enable IEEE PS by default */ - priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_PSP; + /* Disable IEEE PS by default */ + priv->adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM; ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH, - EN_AUTO_PS, BITMAP_STA_PS, NULL, + DIS_AUTO_PS, BITMAP_STA_PS, NULL, true); if (ret) return -1; + ret = mwifiex_send_cmd(priv, + HostCmd_CMD_802_11_PS_MODE_ENH, + GET_PS, 0, NULL, false); + if (ret) + return -1; } if (drcs) { From patchwork Wed Oct 28 14:24:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsuchiya Yuto X-Patchwork-Id: 1389481 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AmUwQcAt; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM2TH1t0pz9sSP for ; Thu, 29 Oct 2020 08:56:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728604AbgJ1V4R (ORCPT ); Wed, 28 Oct 2020 17:56:17 -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-Google-Smtp-Source: ABdhPJxMerd/WVMTl6OAD0Q/nuNJbG+xVQtf6jhUUfBHNGjpniJCbD9kmKMHF4xtAw9wKqE6f/hbuQ== 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 Precedence: bulk List-ID: X-Mailing-List: netdev@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); } From patchwork Wed Oct 28 14:24:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsuchiya Yuto X-Patchwork-Id: 1389583 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=UyEMln7+; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CM3rV36FCz9sPB for ; Thu, 29 Oct 2020 09:58:02 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389881AbgJ1W6B (ORCPT ); Wed, 28 Oct 2020 18:58:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733138AbgJ1W5R (ORCPT ); Wed, 28 Oct 2020 18:57:17 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 535B0C0613CF; Wed, 28 Oct 2020 15:57:17 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id p15so1339581ioh.0; Wed, 28 Oct 2020 15:57:17 -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=v8SmUy1p8YFPt0UuYt7UcwX4doZKfjAz+2UPXr9oenc=; b=UyEMln7+TFZqUXYaJ1spAOCY0uQKOp53Dkb2khpfw1DKzygHWHJ97MKLUBiXUuELz4 Q96DqRl6E0+uw4xkFIebm9e7KX3iNQnaikMFa8rIk1hNtzZl0V2vuEhx8ZTqAqOhcErh gcsEkAb55AW4F3xggiBENAbzL9kOCKYcSxw0fMoqwquEBK5JOpUX6pxewhMp1wn2HVBZ XtIwm7QZPMtwEd5ihshnGyyY8zzgTwdFnPE8adIi1Rym3JP9nchLdeCHP71WqOu+yE+j bsxnLphIqQfuer8EOqDB34acdxGK3ZBTQ6P1r/Gj8RASKtyXgwPrEgc9dwcgb+uX/f4v cF7Q== 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=v8SmUy1p8YFPt0UuYt7UcwX4doZKfjAz+2UPXr9oenc=; b=LgVLIbBdVeUbGjLrRjCGMamSYLIRcUEBB1VeRiJtRgZZcyEIYb+TLib9mjDCa5R2C3 yvFhg4Xbsg282hsrRz/pdbaAb3ScnIMKxqL9FA/4bJn4U3yEr0W5P+G6sRyHjqCSHawO SkoDXlgcub+97xMtBV1S73KT42R+5sKE6LrxDpo4sg18dXWEdG/zFelsHleb0wuzSg7R q0LzC1KncYlAsaWcSCbccLPbDAAFnq/A68hxSTnqkGHhGPPf0RtVj3rjp0l0H6B0qlqV Pdkg6ZnVvtQk5VWpLd67X6IeYQIX/HD6Of+xG1ITIt/gx0drtu0VvZWNsemmF0OXU/UH 8fSw== X-Gm-Message-State: AOAM5328tIkQdG9PNtuvYev6yrthrC0toa7Km97eo42mhsQaJsLHjUvn dHZ49lCgPtDYmnnWztER+e4XSVfszwB37RQC X-Google-Smtp-Source: ABdhPJxpWUdzBg5lguJKB9YOMXhmiOL2/FWHw9iEIGsS7ko1RmdRk47qvSzHoNGJPAbc8KWnaI9IoQ== X-Received: by 2002:a65:4905:: with SMTP id p5mr6260513pgs.299.1603895167499; Wed, 28 Oct 2020 07:26:07 -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.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 07:26:07 -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 3/3] mwifiex: print message when changing ps_mode Date: Wed, 28 Oct 2020 23:24:33 +0900 Message-Id: <20201028142433.18501-4-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Users may want to know the ps_mode state change (e.g., diagnosing connection issues). This commit adds the print when changing ps_mode. Signed-off-by: Tsuchiya Yuto --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 943bc1e8ceaee..a2eb8df8d3854 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -451,6 +451,13 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy, return -EPERM; } + if (ps_mode) + mwifiex_dbg(priv->adapter, MSG, + "Enabling ps_mode, disable if unstable.\n"); + else + mwifiex_dbg(priv->adapter, MSG, + "Disabling ps_mode.\n"); + return mwifiex_drv_set_power(priv, &ps_mode); }