Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp755815ybl; Wed, 4 Dec 2019 10:19:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwrXlqysERTNcXPpPynFz0yPrbl5ElQZvnyNDWx4fuquKIYQJ61iY6qsAZp5QGxKBSYKQfQ X-Received: by 2002:aca:5490:: with SMTP id i138mr3940265oib.34.1575483546455; Wed, 04 Dec 2019 10:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483546; cv=none; d=google.com; s=arc-20160816; b=JoOD1txZapPB+lSelKNf8/8B5P0S8+ly4Cuxm+IgrjN9FwIKd1BEJ417eM3HifkLdJ ruKAOB0mGWQL7EF1ivJq616ZJJd4c1U1ljj9ku1GQl2hvWl+v5Pphve5PJJ/502BLle4 aNjcG/YDYBy+8dBpFWdbJatjrtlmUP41uojhPm+1ymZqE/DgA9eqPWHC8MuQhETgjLaI vFSHsnHd7cgnmzYid4w8bp8pknhuNapMHH9HS1YWThfZlH7PDKxG/Ld0NrEzF073wpWE sF9yxv9BTvlVYyRfmCpLVzZEtlczlHJtqbF0DQtIB4WIigwMx8MebAysT7pZjCQqTvvA IvGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gecqF3q9gY35pv6oBkj4NOxTqsXz2017bh1e2BK0J6I=; b=YinAX7TzkugfCdgag3GYlmjnHq4Y3kERihHzN6VPV9zYE/1QM4X7+veS0RxhqJW/E2 kPFzF6PVlNqUBJISHWeMF6/EEpmAy1eRduVnEqqAtp7Kn/3E6ZTFAEeFk2rLGMO7epIi 3CLKVqGHLd/Nst0K65l7QngLIhXzccR8YDILoi4pGYQaaKnXYN+cTrEafrKDQMYgcxr4 Fi43KQEQUInzABAOsY3OCTCH1xrbIJnTDMmDsdv9zKXUqX6QItsTXHBq4dbC5p0VyivH Pe14DTXQQIR1uyeIX4NucV4j0ZgqWeOVQXrEwmz4e0EuN13WlH5MdNH1sBzr4kfxOcwv C5aQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si3836881otm.304.2019.12.04.10.18.53; Wed, 04 Dec 2019 10:19:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731794AbfLDSR7 (ORCPT + 99 others); Wed, 4 Dec 2019 13:17:59 -0500 Received: from nbd.name ([46.4.11.11]:40910 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729411AbfLDSR5 (ORCPT ); Wed, 4 Dec 2019 13:17:57 -0500 Received: from p5dcfb666.dip0.t-ipconnect.de ([93.207.182.102] helo=bertha.datto.lan) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1icZDk-0005Od-Fg; Wed, 04 Dec 2019 19:17:52 +0100 From: John Crispin To: Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, John Crispin Subject: [PATCH V2 1/9] ath11k: add wmi helper for turning STA PS on/off Date: Wed, 4 Dec 2019 19:17:37 +0100 Message-Id: <20191204181745.27297-2-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191204181745.27297-1-john@phrozen.org> References: <20191204181745.27297-1-john@phrozen.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add a WMI call helper to set the powersave mode of a STA interface. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/wmi.c | 30 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index b05642617b78..bf3c246ce883 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1178,6 +1178,36 @@ int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, return ret; } +int ath11k_wmi_pdev_set_ps_mode(struct ath11k *ar, int vdev_id, u32 enable) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_pdev_set_ps_mode_cmd *cmd; + struct sk_buff *skb; + int ret; + + skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_pdev_set_ps_mode_cmd *)skb->data; + cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_STA_POWERSAVE_MODE_CMD) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); + cmd->vdev_id = vdev_id; + cmd->sta_ps_mode = enable; + + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_STA_POWERSAVE_MODE_CMDID); + if (ret) { + ath11k_warn(ar->ab, "failed to send WMI_PDEV_SET_PARAM cmd\n"); + dev_kfree_skb(skb); + } + + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "WMI vdev set psmode %d vdev id %d\n", + enable, vdev_id); + + return ret; +} + int ath11k_wmi_pdev_suspend(struct ath11k *ar, u32 suspend_opt, u32 pdev_id) { diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 4a518d406bc5..9919d8bf297b 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -2827,6 +2827,12 @@ struct wmi_pdev_set_param_cmd { u32 param_value; } __packed; +struct wmi_pdev_set_ps_mode_cmd { + u32 tlv_header; + u32 vdev_id; + u32 sta_ps_mode; +} __packed; + struct wmi_pdev_suspend_cmd { u32 tlv_header; u32 pdev_id; @@ -4682,6 +4688,7 @@ int ath11k_wmi_set_peer_param(struct ath11k *ar, const u8 *peer_addr, u32 vdev_id, u32 param_id, u32 param_val); int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, u32 param_value, u8 pdev_id); +int ath11k_wmi_pdev_set_ps_mode(struct ath11k *ar, int vdev_id, u32 enable); int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab); int ath11k_wmi_cmd_init(struct ath11k_base *ab); int ath11k_wmi_wait_for_service_ready(struct ath11k_base *ab); -- 2.20.1