From patchwork Sat Jun 5 01:11:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 454677 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888705jae; Fri, 4 Jun 2021 18:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLT+m1LVultm0qGUP/sU7b6tx6FDulSMalYMQ8EGes43pBMNmGFnJ9vWUHFwtT6TuwzjiG X-Received: by 2002:a17:906:f88b:: with SMTP id lg11mr6517478ejb.99.1622855418099; Fri, 04 Jun 2021 18:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855418; cv=none; d=google.com; s=arc-20160816; b=LoiQnfVyNIfUXbPe+xSocSBiegIOIurviZ6S0UPj8cBRhVSGTMUnMqGw7fDNxegdqG 2GTGu/xJlvu9BnHSeQUZQbUpLrVxxmcPPxBwoaGWX5Lq0BKZlcf6RLN+48eIA5KzWpGB ZBZ/jaS2P5LfPz8RKlev6WOepX6JEjU6IS/HsSct4RfqkEFrNxofN1GyiuY257uyaIMF OIzNQ6jZbcXahWlxZelU4PbfXjdcDFZ2OHUnNoulVfZKLgjffXwM4JtqdvO/6GXIN/Qe 3cEiOEF5wvwCzt1/RU0AitFiFq9KkfQaRQlEeeMeoyaILe/21OREykbERstmu6pvsqdX b5kg== 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=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=fc7zrV3rrXiWmwmcXIR6SwOIjyXaafYEm+jhPM3UELCF48aKDAx27bv0GV6wlfK2ST M0VQpFWuJE2pddhPpD9xVEW2VSRRWezsVPUQOHaTJdQAVjcytggT429n/0qO9O7Pj5Xq zixFbhMpKdcUzmzQ0y6E9ZDYuqVCsK6p3+IQnbzNBbF0xwMGR3Rl10Wbx/qfI0TCR8KQ Jf4eE0YHmWSzZNuE088w4/E0vZbQbXWUqTZQ2eiJWQArkHjv/4Q8ArQY8hvn/nCKgaXh GzOPcmRchbMTYREJpP0N31PQRjS5cQqgiMcwcDGRyxkLRWcgRGwYv/7y2IqjwcBx5fLN 3yUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=muM5NSaZ; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.17; Fri, 04 Jun 2021 18:10:18 -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=@linaro.org header.s=google header.b=muM5NSaZ; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbhFEBME (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbhFEBMD (ORCPT ); Fri, 4 Jun 2021 21:12:03 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5A45C061768 for ; Fri, 4 Jun 2021 18:10:07 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso8864887wmh.4 for ; Fri, 04 Jun 2021 18:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=muM5NSaZ19qh1PmVORUYJpKyCbYZpNB/w3c7lnc1sydYEOv4ogg6QCeqsTk6oxcCge U9bZcL9+ZzuajP/c7IqfvSQmdeHJ3hYbbyOwkb9yhiXRN+M2o1yzawUB6U1cGffiQ0Oh QqVL4h3of39sx+sZ0liEbjd3sdnouN1ZugxSOgCoGvXfCCtpIny7gP1UE+e6mCZZOLBZ Txy9OVdIcMHRkdKF57vzvJplwkiq6igDWnf++oM7VVWgJmDh5un7NIK2gkV/nVVTV7KI BrWVfxdo53/c3vfowaXlE3m0E2nhGAVwqhoIlX6/zQNY3hJoWmJTH/N7EOI4z+0GgLct ioDw== 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=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=nBiOKmvvTiKPCnZsxtrXvE2Rw/ekhf8cfsF7Oo1AOZoz/Chj4H4DiIRTj6wCrA9zq1 PdEy2jBSiwC+hnRVFBLKq60blPzfcaoP/zq84sWiMYjMEwIkfjo/V92x75ccAVQboG5Z 0CFjHfXAnqvqvPn2zUih2siWcR6L3zdGv753r3Log0PHWb+o3IIKk2e3mUzGiBywOKrv TuTtgA9dCDn3JyjrDZvE1E+UIMQ+HcPY3KzFJHg3iTt8m33Bzkpq5Y030li6AoJyV3jV PHnRIAWRAz0bIjeqjpG9N3c6tkOdFu+dLyYXEg0yxxb8GlaXmdf257MR2YuaP1kOebub /UsA== X-Gm-Message-State: AOAM531v78+cbTvPus+Z/+ANWyKA1Es7a5ob9YlCivnCeOlcXKulkdCR OtjAKq3gDPyjNjBKksyWcH3m+Q== X-Received: by 2002:a05:600c:1c22:: with SMTP id j34mr6146344wms.166.1622855406501; Fri, 04 Jun 2021 18:10:06 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:06 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 10/12] wcn36xx: Add Host suspend indication support Date: Sat, 5 Jun 2021 02:11:38 +0100 Message-Id: <20210605011140.2004643-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to activate ipv4 ARP offload, ipv6 NS offload and firmware GTK offload we need to send a unidirectional indication from host to wcn indicating a transition to suspend. Once done, firmware will respond to ARP broadcasts, ipv6 NS lookups and perform GTK rekeys without waking the host. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/main.c | 3 +++ drivers/net/wireless/ath/wcn36xx/smd.c | 19 +++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 2 ++ 3 files changed, 24 insertions(+) -- 2.30.1 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 8e5d8326d551..e4d5e4d597f9 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1125,6 +1125,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); + if (ret) + goto out; + ret = wcn36xx_smd_wlan_host_suspend_ind(wcn); } out: mutex_unlock(&wcn->conf_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 13200a079bd0..3b4ba6edd17a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2966,6 +2966,25 @@ int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, return ret; } +int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn) +{ + struct wcn36xx_hal_wlan_host_suspend_ind_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_SUSPEND_IND); + msg_body.configured_mcst_bcst_filter_setting = 0; + msg_body.active_session_count = 1; + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, msg_body.header.len); + + mutex_unlock(&wcn->hal_mutex); + + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 90c7faea0ef6..2909facdb100 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -159,4 +159,6 @@ int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, struct ieee80211_vif *vif); +int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); + #endif /* _SMD_H_ */