From patchwork Mon Dec 28 16:28:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991489 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE99EC4332D for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3857208B6 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633518AbgL1Q2N (ORCPT ); Mon, 28 Dec 2020 11:28:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633508AbgL1Q2M (ORCPT ); Mon, 28 Dec 2020 11:28:12 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCBFC061793 for ; Mon, 28 Dec 2020 08:27:32 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id d26so11721130wrb.12 for ; Mon, 28 Dec 2020 08:27:32 -0800 (PST) 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=61/IO/ybk77sJ5G1Q4pxAhHWdP2licw/COCpz/eNPLI=; b=ohwfsIY91vM7KCpWo6qaIHvnnIEVW3ex02xQKCE0YWnD2g0f4y4fUHm3Ju3H/T2h7i PD7oGMW+5AHto7R1zbs0rGu3oV3P+f/Gn/RdCocp9jHIn/5OZik2dD6/0S6kC1ha7wHp k2951AzIgZs3f5+QdOH1wgKQsLXb+wWdwIV61arjejbVWnNJgBN2x73sFbCa9lbE8Ihu Z5CPXc3P9aQwZTu5+W5CE2xZ0e/FzaBUM+p8bx6vU/Gj1sAu4ljdElFCm+qkp6P9MqBi 00vy7szTobHGI4ZLvsFrabclDQjqc0tYpM6lPfuL07i62sWZ1OAvOFUByRxMVG4Q1qjK SvCA== 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=61/IO/ybk77sJ5G1Q4pxAhHWdP2licw/COCpz/eNPLI=; b=jTR+Ehp+pyfHVyIObyqTwm8Yz2G+PBs9tEflt3nhXFdNGodWOlr9LJfoBUL4ardWOx zlNe2RztOaW8KzaKOLzMJ1cxCRe6KwzOBKGllwKLCo7+bdi4mddS32WnbF7fHi54m5KV 62DwR++e3TJv2ck/VKed4P/k7r+8oOwQcrdPj32GvnRmI0SOcHW5SLLrR7XSRsGe4NUa brDN8y9hvTwNxV6AkOzmn27q9oDITNMNcXmbiIv3u3CqZOmNgj9qX1cZTZ0n9toPqJBQ o7IqBn/Xooxrr5WtGth65tFqn0+8ORsqaGLs3LV+pYmH+7P5lghz0Puj9r0R2l30eZfR tEtw== X-Gm-Message-State: AOAM53101Z1uF8t7viqsaqlxieyVmQy3CdpKrDbCfGYkw1ITNwz/ZXSe r06FP0AYl6bgttYwCFgH/Mi38A== X-Google-Smtp-Source: ABdhPJwcuusV/T4OoKNxTFSYLQFR6ywxdVgMUTVLSH+Y5KvpI7Rr8Lv3nLWoWccVQy5Vpfe/D7fOpw== X-Received: by 2002:a5d:660b:: with SMTP id n11mr51861229wru.407.1609172851213; Mon, 28 Dec 2020 08:27:31 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:30 -0800 (PST) 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 Subject: [PATCH 01/13] wcn36xx: Return result of set_power_params in suspend Date: Mon, 28 Dec 2020 16:28:27 +0000 Message-Id: <20201228162839.369156-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org wcn36xx_smd_set_power_params() can return an error. For the purposes of entering into suspend we need the suspend() function to trap and report errors up the stack. First step in this process is reporting the existing result code for wcn36xx_smd_set_power_params(). Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 5867bd9c2f64..a863a90232c9 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1091,12 +1091,14 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw, static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) { struct wcn36xx *wcn = hw->priv; + int ret; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); flush_workqueue(wcn->hal_ind_wq); - wcn36xx_smd_set_power_params(wcn, true); - return 0; + ret = wcn36xx_smd_set_power_params(wcn, true); + + return ret; } static int wcn36xx_resume(struct ieee80211_hw *hw) From patchwork Mon Dec 28 16:28:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991485 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0545C433E6 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7ECFC221F0 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633525AbgL1Q2P (ORCPT ); Mon, 28 Dec 2020 11:28:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633520AbgL1Q2N (ORCPT ); Mon, 28 Dec 2020 11:28:13 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D1ABC061796 for ; Mon, 28 Dec 2020 08:27:33 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id r7so11757593wrc.5 for ; Mon, 28 Dec 2020 08:27:33 -0800 (PST) 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=b09nwm7NaeS1J9x71TcNl2allAdNLCiHKyq9pTgIlF8=; b=gMjL3dHhsy2tfSfXubl1Td3kE3jdr+nWcP/IaMuZUtClF/usQU9BEY4wiqWeG/Ip36 sYe+UCnI6Lgbgn4KT2APFWFdAlXD1kRSDlzn8yDEK2Zup5+Ntuvy8jXG1M5K9X8H8MIz ZXhFT1Tk+FfJLbNS/FHsT3Yz45uWXLsPGybv++12wxhooX5lZdY+DcHoEyYqb/4N9YRz Al/Z56dPnS+8jgu9VpZiY6JxiwRTsiujTplUO9jBR6uTdwUJtNAueGpRwkv/IUOGToYh QvogNviebwyhN6q38sWAJFAKw7kzb4teoOCUoj1X06k8WSvnUQbcPoCPjPNxDdH+/3ir Iipw== 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=b09nwm7NaeS1J9x71TcNl2allAdNLCiHKyq9pTgIlF8=; b=qkB4nURcSHmYtvE7J7uI6nZO7utc1dGS+OfzVQo+m+AvQYW5ro5aO7IjBGYcLldoqU DTfBqjgiTWM5xFOC6Cy81eF42bu67PuQ5OTe/9c1152OmrMtslNvTBe9h5OUoKkHsdCT P0z6/mtPMZXsIChCcOkaUWj43m7Cle3UD7/shiwbrbvgvtNshdQZNTLTR6Ygm4ngDIuc Q6QvnRDyyrciixctpZZ59rY7scj4sRwPhl9Yea0Ybsh8DV6Si5+jmaAxlRNJyQro3E6x z/9B+YyiJ18IymeYmHHtuBdB9mT/Nn57a+MwS3GhfRGO67NHIkUysjAUdPEMQy7RCNX0 ILkA== X-Gm-Message-State: AOAM530uoGjnCMQ+CIqhoIplWA0TdBwClUvOodf2z7SiXyRM74sX5iS6 LHBSJHVpsPUJbpLpo2wCnETq/Q== X-Google-Smtp-Source: ABdhPJy8QDFmrdXsSXt4w04PKRJ51IwyamnU+2JXAgBp2L1Q5Vyw5o6JZP9HH5/EinuHWDWZLfdNeQ== X-Received: by 2002:a5d:4641:: with SMTP id j1mr52201878wrs.94.1609172852271; Mon, 28 Dec 2020 08:27:32 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:31 -0800 (PST) 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 Subject: [PATCH 02/13] wcn36xx: Run suspend for the first ieee80211_vif Date: Mon, 28 Dec 2020 16:28:28 +0000 Message-Id: <20201228162839.369156-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org A subsequent set of patches will extend out suspend/resume support in this driver, we cannot set the firmware up for multiple ipv4/ipv6 addresses and as such we can't iterate through a list of ieee80211_vif. This patch constrains the interaction with the firmware to the first ieee80211_vif on the suspend/resume/wowlan path. Signed-off-by: Bryan O'Donoghue Reported-by: kernel test robot --- drivers/net/wireless/ath/wcn36xx/main.c | 43 +++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index a863a90232c9..b90664bdf6ee 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1088,15 +1088,39 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw, #ifdef CONFIG_PM +struct ieee80211_vif *wcn36xx_get_first_vif(struct wcn36xx *wcn) +{ + struct wcn36xx_vif *tmp; + struct ieee80211_vif *vif = NULL; + + list_for_each_entry(tmp, &wcn->vif_list, list) { + vif = wcn36xx_priv_to_vif(tmp); + if (vif) + break; + } + return vif; +} + static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) { struct wcn36xx *wcn = hw->priv; - int ret; + struct ieee80211_vif *vif = NULL; + struct wcn36xx_vif *vif_priv = NULL; + int ret = 0; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); flush_workqueue(wcn->hal_ind_wq); - ret = wcn36xx_smd_set_power_params(wcn, true); + mutex_lock(&wcn->conf_mutex); + vif = wcn36xx_get_first_vif(wcn); + if (vif) { + vif_priv = wcn36xx_vif_to_priv(vif); + if (!vif_priv->sta_assoc) + goto out; + ret = wcn36xx_smd_set_power_params(wcn, true); + } +out: + mutex_unlock(&wcn->conf_mutex); return ret; } @@ -1104,11 +1128,24 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) static int wcn36xx_resume(struct ieee80211_hw *hw) { struct wcn36xx *wcn = hw->priv; + struct ieee80211_vif *vif = NULL; + struct wcn36xx_vif *vif_priv = NULL; wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n"); flush_workqueue(wcn->hal_ind_wq); - wcn36xx_smd_set_power_params(wcn, false); + mutex_lock(&wcn->conf_mutex); + vif = wcn36xx_get_first_vif(wcn); + if (vif) { + vif_priv = wcn36xx_vif_to_priv(vif); + if (!vif_priv->sta_assoc) + goto out; + + wcn36xx_smd_set_power_params(wcn, false); + } +out: + mutex_unlock(&wcn->conf_mutex); + return 0; } From patchwork Mon Dec 28 16:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991487 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6B4CC43381 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95DB9208B6 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633529AbgL1Q2P (ORCPT ); Mon, 28 Dec 2020 11:28:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633524AbgL1Q2P (ORCPT ); Mon, 28 Dec 2020 11:28:15 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84816C061798 for ; Mon, 28 Dec 2020 08:27:34 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id w5so11732681wrm.11 for ; Mon, 28 Dec 2020 08:27:34 -0800 (PST) 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=ltohQzViTXov8BpVEXom7/dF0P1+ZXvRdo3+msQAQjk=; b=TNcq2zx3qOV1ztzjb/fZgvXmN9Yay15r1eWasNdPXf0Gsz2NbNj+WiXlN+qKpkvz4A gyFIz/uM1mjGlhXkEdL5aa2GPbY2gC2ybctZxYxVXj7LMVz7EPvDPJVlOb8N6sDjXSB8 HwAcKjNnqj3A4QL9woyMPy3rS4266mz9Z5ADD01rfvg6yBcANGiqDpqrH9XlGO2dxVGj ia/KG4akeqWRm9Th43EqVJ/Myrk0+QL30isyyojsWEEt7uwctobz8KePxH+9IkjF5g3u HSoGTCI4oDtSZfP1j3wu0i/32QXRURDN4s51n1f/h4PRg/8yulovLR96aeVLY6nneSlg pVgQ== 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=ltohQzViTXov8BpVEXom7/dF0P1+ZXvRdo3+msQAQjk=; b=C0QWL+4faV2UaMuBOuTEYWw6ioPtINC4lXHC5E7vtV4MAHv20hogk/NkcaWQMqKm/N qA9VPXSLXBRWZPtmMcr9MCb62C5rA61FbwlhEsJ6isMhSy2tnIORJGCmEtK+HpWT4dkw zAAllXHAUSEUHzrGxUkjdRWo+xOnh2ZFZe1okYGUFv8XdhTj43bD6QVFVjk1gfIdImCh WOS26uZ032g+WqK6O4I2ah+oVWf6x7B+nXPqi3CwpbmWUpaW8vUZ5n+MIMWPatnD4ZlO cupuV2GLEKuyUe1LFKa11tC16teNtQ9C5UbbuenrusWDsIFNSmnd5P0QOiNvEAqGs2Jq sNFw== X-Gm-Message-State: AOAM530KN8l7PjvmkYdTITsRanMzMEOG4MHLqB3LBaqOX0hy6nG6hRhy qlRCkYhcb037rsU7dqYJnzkkZA== X-Google-Smtp-Source: ABdhPJwQ23aLQC7lqtMKSVQL3gyH7EvlQFy6vLb7SyjyIW7MzaJDLR3X+LDAi4ormhDeaUKrOIaQhQ== X-Received: by 2002:a5d:4f10:: with SMTP id c16mr50826921wru.398.1609172853329; Mon, 28 Dec 2020 08:27:33 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:32 -0800 (PST) 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 Subject: [PATCH 03/13] wcn36xx: Add ipv4 ARP offload support in suspend Date: Mon, 28 Dec 2020 16:28:29 +0000 Message-Id: <20201228162839.369156-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This commit adds ARP offload support. Firmware is capable of responding to ARP requests for a single ipv4 address only. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 10 +++---- drivers/net/wireless/ath/wcn36xx/main.c | 5 +++- drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 +++ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 65ef893f2736..b56c8292fa62 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3465,7 +3465,7 @@ struct wcn36xx_hal_rem_bcn_filter_req { #define WCN36XX_HAL_OFFLOAD_ENABLE 1 #define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2 #define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \ - (HAL_OFFLOAD_ENABLE|HAL_OFFLOAD_BCAST_FILTER_ENABLE) + (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE) struct wcn36xx_hal_ns_offload_params { u8 src_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN]; @@ -3487,10 +3487,10 @@ struct wcn36xx_hal_ns_offload_params { /* slot index for this offload */ u32 slot_index; u8 bss_index; -}; +} __packed; struct wcn36xx_hal_host_offload_req { - u8 offload_Type; + u8 offload_type; /* enable or disable */ u8 enable; @@ -3499,13 +3499,13 @@ struct wcn36xx_hal_host_offload_req { u8 host_ipv4_addr[4]; u8 host_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN]; } u; -}; +} __packed; struct wcn36xx_hal_host_offload_req_msg { struct wcn36xx_hal_msg_header header; struct wcn36xx_hal_host_offload_req host_offload_params; struct wcn36xx_hal_ns_offload_params ns_offload_params; -}; +} __packed; /* Packet Types. */ #define WCN36XX_HAL_KEEP_ALIVE_NULL_PKT 1 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b90664bdf6ee..c463ec7c1568 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1117,11 +1117,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) vif_priv = wcn36xx_vif_to_priv(vif); if (!vif_priv->sta_assoc) goto out; + ret = wcn36xx_smd_arp_offload(wcn, vif, true); + if (ret) + goto out; ret = wcn36xx_smd_set_power_params(wcn, true); } out: mutex_unlock(&wcn->conf_mutex); - return ret; } @@ -1142,6 +1144,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_arp_offload(wcn, vif, false); } 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 5445277dd8de..4589c3d26027 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2757,6 +2757,43 @@ int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, return ret; } +int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_host_offload_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ); + msg_body.host_offload_params.offload_type = + WCN36XX_HAL_IPV4_ARP_REPLY_OFFLOAD; + if (enable) { + msg_body.host_offload_params.enable = + WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE; + memcpy(&msg_body.host_offload_params.u, + &vif->bss_conf.arp_addr_list[0], sizeof(__be32)); + } + msg_body.ns_offload_params.bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -2805,6 +2842,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_8023_MULTICAST_LIST_RSP: case WCN36XX_HAL_START_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: + case WCN36XX_HAL_HOST_OFFLOAD_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index b1d8083d9d9d..1458682ee715 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -146,4 +146,8 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp); + +int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */ From patchwork Mon Dec 28 16:28:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991483 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCE2DC433E9 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC020208D5 for ; Mon, 28 Dec 2020 16:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633532AbgL1Q2Q (ORCPT ); Mon, 28 Dec 2020 11:28:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633524AbgL1Q2Q (ORCPT ); Mon, 28 Dec 2020 11:28:16 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D789C061799 for ; Mon, 28 Dec 2020 08:27:35 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id r7so11757681wrc.5 for ; Mon, 28 Dec 2020 08:27:35 -0800 (PST) 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=T3vbkvpnDfJt+kYGiWTgD3Sze4DdRUv6z46Vf171QE0=; b=HlLRqSVjKEqFUmImV6+YMe8wWB5FdGEKQ5bUlfpiH2xr/VO29pKZhEsb9GumPp18SQ vii9CEasaZOZxGUBMl5M2WnAuw5rIdIuAbiZvAv5ELfnqmLUqx/VSCTINRmdlmBTVVdU Qie9VcxQtU9Tsh+fr6Nljsef9QususTRx8qvdH04KuYbbu9KA+6ElJaP3WA0y3Owxa0s GBMCHIN5EbIxlP9eFgL5B2ilzCvVBIiovlS/Cl7f1ZUKDtarjXAaoRFtUau/3GkSFf08 TE664YOJoYis+6Robyvm2l+n9TB8VCMuXP4tFnDLeK53yvxqYPImxhcMzgZitf4WXHqd Yw6A== 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=T3vbkvpnDfJt+kYGiWTgD3Sze4DdRUv6z46Vf171QE0=; b=iWQPjwpL1l4SY255VRVms/vlS3ITTkoWQf5P4bSNeWLkhsUGSL+GfybAws5xj37sz1 D35nRiycif9Xds/zSPN+2HmCcCo30f3sqOc3eXOMXr1B4ZLCzF6J56hFxEFDCfNTWPXr m1tjAfJWdgxL17KspMlNNF0+bUuKMQtRF0pS5J13x4+c0YL1BZu0qvD6CAgypB5lciVb auREj6WJ8rSBa2F9dhq3f9BqOGQrViD54vlrNy429BBpiYJz6F28eS/awxA+nW2yEcea Uq4BK2+UrBOet6HdBu1m0zry5ErBYkcmU8sYY43QEwbIDrf+h21dO4hadgCrCqlXLznn Pejw== X-Gm-Message-State: AOAM5327fIS2EvaWcwTFbBde3oXUwAqNewZFiNU899jTOcLPTcPiCxRn cpSd0GQETRJ8A2Z46uHYRBVySw== X-Google-Smtp-Source: ABdhPJy2cINhgUKs664Q3NzFhhQX0qID9mrg8c25yPNVK/vanGcAp2Y0yGXs0i9Zv8B4N6i0Vt5GAw== X-Received: by 2002:adf:fd05:: with SMTP id e5mr52106185wrr.225.1609172854451; Mon, 28 Dec 2020 08:27:34 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:33 -0800 (PST) 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 Subject: [PATCH 04/13] wcn36xx: Do not flush indication queue on suspend/resume Date: Mon, 28 Dec 2020 16:28:30 +0000 Message-Id: <20201228162839.369156-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Testing on Android reveals that the flush on both suspend and resume of the firmware indication work-queue can stall indefinitely. Given this code path doesn't appear to have been exercised up until now, removing this flush to unblock this situation. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index c463ec7c1568..745512a6ad83 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1110,7 +1110,6 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); - flush_workqueue(wcn->hal_ind_wq); mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_vif(wcn); if (vif) { @@ -1135,7 +1134,6 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) wcn36xx_dbg(WCN36XX_DBG_MAC, "mac resume\n"); - flush_workqueue(wcn->hal_ind_wq); mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_vif(wcn); if (vif) { From patchwork Mon Dec 28 16:28:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991495 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 090C1C43333 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5E2C2245C for ; Mon, 28 Dec 2020 16:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633582AbgL1Q2y (ORCPT ); Mon, 28 Dec 2020 11:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730745AbgL1Q2w (ORCPT ); Mon, 28 Dec 2020 11:28:52 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2B8C06179A for ; Mon, 28 Dec 2020 08:27:36 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id k10so10718584wmi.3 for ; Mon, 28 Dec 2020 08:27:36 -0800 (PST) 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=iDdF3uI5gFdqmwiYK0tEjCdYV2ecZWcbZfnAQ4bZ1CA=; b=BoOU0ANX8yCDMe4XiOnt9LuvsQDVlam4Q/nxfCF1k7+Kk9LRsqNdl7KfphAdrXbyxO mdcbKdYjgPSSKwP7YjAdulk6A6l0YU3xHTuEnVor96EHNQhq7WtJholEDiR7dy6Lx+zW 1/AIZHqITSqC0H/CGq77GCnY5m3BG0MC8C4wDJq+dWOc9Uk/ansp+rYXm8HDag76Xzvt n0QcJZje5RY6H69oNCZsMYjYwoNMM0VA6gQCwVdSM6+sClQpb/hB2hTCBvUETmpPIYFh fG1Z+mVomRO6KBnR77XWEMIj7iMmiYRwT8Bq/RiOhWNfp7vgXMmpGSWRJJLWlG0MTBDU tqbQ== 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=iDdF3uI5gFdqmwiYK0tEjCdYV2ecZWcbZfnAQ4bZ1CA=; b=ReCOoa9JrytgmY9ckDI82sn8sBNmn1w40+A/3lgPFAECXjd7t9XbZr5hFb4OCeV88x pLPjrAgo4UZutNoTxBdOGlLECzIS/1wOCnKz86H2o04nQ6imgpFrdPGwHeheii5lExqX NJUTP5jDcVmawDNeUN3zD/nACEz0e6iBzhPl2cGqhuRBuc3cHLcx/tpv4ziZncqD1CrZ ZlCAokbOZm13hZ10YQJhuxYqvu1o43b1Q7527xcqcDsmz0O3E9zU8r4OsvGo5mUIYxtg htIqoms1iLgnM6JeSwQ++Zfi94kRyN56ifrBhST1miOYL8nLuX8tDin8RwFdf6lg1DSx RTJg== X-Gm-Message-State: AOAM532KX4rp8J6ku2BguU9VQvNtYmwY2Ji/aYjowRiBhaHO9kSoMSn5 pilUB+Rpv93DLy9B0hK2o40VmcmPThhErIR9 X-Google-Smtp-Source: ABdhPJw5D5Ej7JhrQi629e0UT7yMjRK02J86ESFQviNYbbqTXCkmGxSS7RRNXq3VplFfyHc/VBzGHA== X-Received: by 2002:a7b:cc0f:: with SMTP id f15mr21235738wmh.29.1609172855527; Mon, 28 Dec 2020 08:27:35 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:34 -0800 (PST) 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 Subject: [PATCH 05/13] wcn36xx: Add ipv6 address tracking Date: Mon, 28 Dec 2020 16:28:31 +0000 Message-Id: <20201228162839.369156-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Taking code from iwlwifi this commit adds a standard callback for ipv6_addr_change(). This callback allows wcn36xx to know the set of ipv6 addresses. Something we need to know in order to get wowlan working with ipv6. Signed-off-by: Bryan O'Donoghue Reported-by: kernel test robot --- drivers/net/wireless/ath/wcn36xx/hal.h | 1 + drivers/net/wireless/ath/wcn36xx/main.c | 32 ++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 8 ++++++ 3 files changed, 41 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index b56c8292fa62..90333daed845 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3466,6 +3466,7 @@ struct wcn36xx_hal_rem_bcn_filter_req { #define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2 #define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \ (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE) +#define WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX 0x02 struct wcn36xx_hal_ns_offload_params { u8 src_ipv6_addr[WCN36XX_HAL_IPV6_ADDR_LEN]; diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 745512a6ad83..af59638d696f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "wcn36xx.h" #include "testmode.h" @@ -1215,6 +1216,34 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw, return ret; } +#if IS_ENABLED(CONFIG_IPV6) +void wcn36xx_ipv6_addr_change(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct inet6_dev *idev) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct inet6_ifaddr *ifa; + int idx = 0; + + memset(vif_priv->tentative_addrs, 0, sizeof(vif_priv->tentative_addrs)); + + read_lock_bh(&idev->lock); + list_for_each_entry(ifa, &idev->addr_list, if_list) { + vif_priv->target_ipv6_addrs[idx] = ifa->addr; + if (ifa->flags & IFA_F_TENTATIVE) + __set_bit(idx, vif_priv->tentative_addrs); + idx++; + if (idx >= WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX) + break; + wcn36xx_dbg(WCN36XX_DBG_MAC, "%pI6 %s\n", &ifa->addr, + (ifa->flags & IFA_F_TENTATIVE) ? "tentative" : NULL); + } + read_unlock_bh(&idev->lock); + + vif_priv->num_target_ipv6_addrs = idx; +} +#endif + static const struct ieee80211_ops wcn36xx_ops = { .start = wcn36xx_start, .stop = wcn36xx_stop, @@ -1238,6 +1267,9 @@ static const struct ieee80211_ops wcn36xx_ops = { .sta_add = wcn36xx_sta_add, .sta_remove = wcn36xx_sta_remove, .ampdu_action = wcn36xx_ampdu_action, +#if IS_ENABLED(CONFIG_IPV6) + .ipv6_addr_change = wcn36xx_ipv6_addr_change, +#endif CFG80211_TESTMODE_CMD(wcn36xx_tm_cmd) }; diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 71fa9992b118..5a5114660b18 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -18,6 +18,7 @@ #define _WCN36XX_H_ #include +#include #include #include #include @@ -136,6 +137,13 @@ struct wcn36xx_vif { u8 self_dpu_desc_index; u8 self_ucast_dpu_sign; +#if IS_ENABLED(CONFIG_IPV6) + /* IPv6 addresses for WoWLAN */ + struct in6_addr target_ipv6_addrs[WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX]; + unsigned long tentative_addrs[BITS_TO_LONGS(WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX)]; + int num_target_ipv6_addrs; +#endif + struct list_head sta_list; }; From patchwork Mon Dec 28 16:28:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991493 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EA30C43332 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06CF722583 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633586AbgL1Q2z (ORCPT ); Mon, 28 Dec 2020 11:28:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441819AbgL1Q2w (ORCPT ); Mon, 28 Dec 2020 11:28:52 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1817C06179B for ; Mon, 28 Dec 2020 08:27:37 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id r4so10191624wmh.5 for ; Mon, 28 Dec 2020 08:27:37 -0800 (PST) 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=eY+3wBeOdVNx7S6ZBSAwS1KofM7X7bObYB96unqy4iM=; b=ncQR+r9lZZkIE3sgyoMcN8o702yKXfL9OlBMszw4uGwYyuaT02B/AGYNFVE1czHUDD 2Mgg5Zjc4a1SckslqrBQKnCpn4Y1nYx0apXcyagRp4XEzzQSJ62kryAAb0p9TqwQxFNh i1HChmy7yRkCJDeLYUhbzFTC3lxGLCtumc5ir7lJUhoHmWoDhlalqXPZyV1bZq6XagQg F+xc8+h9UXhXw5pjp6YhMrlvYkNxNEKh1chcNjLjvxqeQ5fM0tULWUNxXlPxfpilTD8l 4x84es3irx4BEbTg20xqpweQfBqKYTdUnTCBtisoVoFTt40kBHIfKzkzz2/KrxObhboA cVew== 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=eY+3wBeOdVNx7S6ZBSAwS1KofM7X7bObYB96unqy4iM=; b=TPdeE/+jJMr6xFJsuRhZoV2cNPoGfK3vm/rdGOap2p+ooyfDrX/stQc/NtxuCwmbKY KG5FnpDLeBXCvYSoaftvqf/tRxJLcckRMy0eNzqa8g+cHOC+0YwGtnLCq+iIOuHlBKkj X5TBRMXi72UP1iCUGqGlZc/nFQt1X/tYf5Sa6hTXmbceSYtb4IZgVsDHGFRF1lTNJBen KSuqvFCTrnTR4wVZc5SdB4psu/r/uulH3HdIw4iJnlnc5VIcowtFDdeaxTj7c/X/iKga cv2b/LG4vG9y2gBuysG3eRvMkRM8nMKEFJRC4LG1tbnzsPgyL7gFQBB7Puuo3LGLNmj0 cQ2g== X-Gm-Message-State: AOAM532tzPbkhz9NvgbNCYf22YXPgMLYCMlNPS4arRMi9LL+mFpuJOtv KjSNIV5uZ8ffLcM+i/rc1eId5A== X-Google-Smtp-Source: ABdhPJzmAZ8qPaSLtY8QMAZ13ERKFhT+1uEl9Smk3L3sWTmKBuWmjLFN8Zv2Kz0uI3i83dsJCboxdw== X-Received: by 2002:a1c:3987:: with SMTP id g129mr20816495wma.86.1609172856720; Mon, 28 Dec 2020 08:27:36 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:36 -0800 (PST) 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 Subject: [PATCH 06/13] wcn36xx: Add ipv6 namespace offload in suspend Date: Mon, 28 Dec 2020 16:28:32 +0000 Message-Id: <20201228162839.369156-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We need to respond to ipv6 namespace lookups when in suspend. This patch adds the necessary changes to issue the appropriate firmware command on suspend and resume to enter/exit firmware offloaded ns lookup. Signed-off-by: Bryan O'Donoghue Reported-by: kernel test robot --- drivers/net/wireless/ath/wcn36xx/hal.h | 3 ++ drivers/net/wireless/ath/wcn36xx/main.c | 4 ++ drivers/net/wireless/ath/wcn36xx/smd.c | 55 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 65 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 90333daed845..3b949b0b3792 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3464,6 +3464,9 @@ struct wcn36xx_hal_rem_bcn_filter_req { #define WCN36XX_HAL_OFFLOAD_DISABLE 0 #define WCN36XX_HAL_OFFLOAD_ENABLE 1 #define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2 +#define WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE 0x4 +#define WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE \ + (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE) #define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \ (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE) #define WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX 0x02 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index af59638d696f..579bb7f4db9c 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1118,6 +1118,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (!vif_priv->sta_assoc) goto out; ret = wcn36xx_smd_arp_offload(wcn, vif, true); + if (ret) + goto out; + ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); @@ -1143,6 +1146,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } out: diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 4589c3d26027..b05f1e1f253a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2794,6 +2794,61 @@ int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_host_offload_req_msg msg_body; + struct wcn36xx_hal_ns_offload_params *ns_params; + struct wcn36xx_hal_host_offload_req *ho_params; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ); + ho_params = &msg_body.host_offload_params; + ns_params = &msg_body.ns_offload_params; + + ho_params->offload_type = WCN36XX_HAL_IPV6_NS_OFFLOAD; + if (enable) { + ho_params->enable = + WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE; + if (vif_priv->num_target_ipv6_addrs) { + memcpy(&ho_params->u, + &vif_priv->target_ipv6_addrs[0].in6_u, + sizeof(struct in6_addr)); + memcpy(&ns_params->target_ipv6_addr1, + &vif_priv->target_ipv6_addrs[0].in6_u, + sizeof(struct in6_addr)); + ns_params->target_ipv6_addr1_valid = 1; + } + if (vif_priv->num_target_ipv6_addrs > 1) { + memcpy(&ns_params->target_ipv6_addr2, + &vif_priv->target_ipv6_addrs[1].in6_u, + sizeof(struct in6_addr)); + ns_params->target_ipv6_addr2_valid = 1; + } + } + memcpy(&ns_params->self_addr, vif->addr, ETH_ALEN); + ns_params->bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + 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 1458682ee715..380ea58b58ec 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -150,4 +150,7 @@ int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */ From patchwork Mon Dec 28 16:28:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991507 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2592DC433E0 for ; Mon, 28 Dec 2020 16:29:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0992208D5 for ; Mon, 28 Dec 2020 16:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633588AbgL1Q3D (ORCPT ); Mon, 28 Dec 2020 11:29:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441820AbgL1Q2x (ORCPT ); Mon, 28 Dec 2020 11:28:53 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2824BC06179C for ; Mon, 28 Dec 2020 08:27:39 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id c133so10722851wme.4 for ; Mon, 28 Dec 2020 08:27:39 -0800 (PST) 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=2379O66VphKJpmO2g82hANsVKjqZJjjcsBFp5fQ4u1I=; b=EVKR8oMhtX0As5WNmh8JN3OWq+S7RHBuBSTyUloI/QRt+WWdJmTIiCnTgFqe22EbSK /BCoL3lZW99W6I9f/AJgaoveCGSHHK8RJr1bvY67hJ0oZ50/ktoK6fOpF30kgQKNPiRi gVwz84mYOeis8CuPen4bhTm2fVb211DfWpVJzmPmeeXQBEjAWOiOxRnuC8EwOmzPqwBJ 3bxFuT+4007KXisS1zsILzcQzcWLmZC9H0sU1Fge2OEJwXJ8TM1EXC9DIkoHj/hHsNYB DNChGbM8kMMfjQ+eGUJJJFFcs2Tlrr3qde0xeVmZbu7TvdfyLWENiqZzM+ZROD6LE4Go garQ== 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=2379O66VphKJpmO2g82hANsVKjqZJjjcsBFp5fQ4u1I=; b=Zl7QN95yTorm/6iQ4bujm6lXiP1pY4cz4qS9SD2GZuIhLLmFQNgvzPpde+wth1wRxr zUl1p20WQypwT12aApTYvu4oiFmAkl/LwyxB7r6dleHIDDRlwunkmu5/JvARV93g4fMU 4KcjL1MqUMAm0eEsiRfFbPEGb3tHaErkqGYY6e4IU9rZw4/i0ou/bIa7KP/aLw4oYiak Y9jkRvwyZqEv1EW2uDO0wzneUKkNY4JIS7aPH9uf1wS6wHa1GowPoE60ayEPIcSGrke7 65NqGaDEWBmjjEN2I6+3DsMz5xXfnqVg7F9B5z02I9IQu2BYDqIb31VECS7Ek2oM20Xz eu7w== X-Gm-Message-State: AOAM533Ff2LuGcc2ZsTksdgtuYGq4ChOPZ68hEiB7jzWGYM5G2i1xLyj dih5xegS308XWydjPrmTo09C3A== X-Google-Smtp-Source: ABdhPJwfxAT34MaGNszfs1MTK8IvsPqekqhgAg+xUQgdam4xQNaddv8WmEcaQ8MaLu7VTals74oQtw== X-Received: by 2002:a7b:c4d5:: with SMTP id g21mr21392477wmk.92.1609172857943; Mon, 28 Dec 2020 08:27:37 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:37 -0800 (PST) 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 Subject: [PATCH 07/13] wcn36xx: Flag WIPHY_WOWLAN_MAGIC_PKT Date: Mon, 28 Dec 2020 16:28:33 +0000 Message-Id: <20201228162839.369156-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Set a flag to indicate magic packet wakeup support on wcn36xx. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 579bb7f4db9c..cfa2e2d20a20 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -173,7 +173,7 @@ static struct ieee80211_supported_band wcn_band_5ghz = { #ifdef CONFIG_PM static const struct wiphy_wowlan_support wowlan_support = { - .flags = WIPHY_WOWLAN_ANY + .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_MAGIC_PKT }; #endif From patchwork Mon Dec 28 16:28:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991503 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 494A6C43219 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 33BBA2245C for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441823AbgL1Q2z (ORCPT ); Mon, 28 Dec 2020 11:28:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633580AbgL1Q2x (ORCPT ); Mon, 28 Dec 2020 11:28:53 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A69AC06179E for ; Mon, 28 Dec 2020 08:27:40 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id a12so11743482wrv.8 for ; Mon, 28 Dec 2020 08:27:40 -0800 (PST) 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=3RYdIFmmEj5YWYc3o4ND5KeefyrBxeCm6bmJ8jzGapI=; b=sBv7gYlC5bwoIjuph34kxZMbuxPUbZIfw1OmJfrwhOXDfPje0X7xRUHPRJjIvxuiMB xVlg9Afvzp+bZiv/4dc/ZYP7vJGyvYlAaSTbcg7qtyf7eqPJDrzF6vI9nz0twKMbBM/g vO0t6SVPa3PhKn1AZQPHDbva4KJs4FpXKKmG9BeQ7kGEmY7GJ4YsaM03ikiKBmeLKiEz +9jL7eml+wdEQ22QDH2AFb9qhncK+oOJ025/6a9x7fknF0AWSsPyTusylh2gYRcXsqhM Y815//TB/Ns3uj15lFr/C86FzicCdc8ZveLsGCGhNyv7tR2xHX2Ak9e+JHmOzlODYVue wujA== 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=3RYdIFmmEj5YWYc3o4ND5KeefyrBxeCm6bmJ8jzGapI=; b=OmmPMzam7JY6X4la5vUaxZehk8JRz5bDmnOkvCy6aYfPY1JJqEkrEEWCB9rXYE5ATi jyqGs3/0mvQmJpWhBHkPJHH5ltLJ3uhD1xmYiUlcxrtNE64lv+k7TLWPt7Q4yxY+frfV NV4dypk7kFibknZS7zNYvokaKADnt1Yc20tKGWOyaQGtECIY2Ky7uiPlq7gyT3s3TLnU WxVMMhUWJAeNk+Zk3VuV/dZrq5KVDiSlPdULevjAboxd2hU1BHinPpSrw3s8aenBQHxI L8z7Zc9MB7+VCmrKuyAhTdO2mnnG78ir6XXqCVVI0F5CfvzUQxRa+/uPA68Dbt9hkFse IBYw== X-Gm-Message-State: AOAM532koj1oEHGOumxasdsPAzd64gczhu79zlMgX/yUtrAbWsEq5jst /kDBZ+6zi42CznNeCzRfDJoLYQ== X-Google-Smtp-Source: ABdhPJzEKfSvAn0mJkWKt0i4wTmIsEAfiJTVP4UZ30DPS45UeJ8LGJt3QSq/zmR9dEv818phzWEMog== X-Received: by 2002:adf:d238:: with SMTP id k24mr15458581wrh.414.1609172859208; Mon, 28 Dec 2020 08:27:39 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:38 -0800 (PST) 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 Subject: [PATCH 08/13] wcn36xx: Add set_rekey_data callback Date: Mon, 28 Dec 2020 16:28:34 +0000 Message-Id: <20201228162839.369156-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This commit adds a callback for Group Temporal Key tracking as provided by the standard WiFi ops structure. We track the key to integrate GTK offloading into the WoWLAN suspend path later on. Code comes from the Intel iwlwifi driver with minimal name changes. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 19 +++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index cfa2e2d20a20..b3388e4a76d2 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1155,6 +1155,24 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) return 0; } +void wcn36xx_set_rekey_data(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct cfg80211_gtk_rekey_data *data) +{ + struct wcn36xx *wcn = hw->priv; + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + + mutex_lock(&wcn->conf_mutex); + + memcpy(vif_priv->rekey_data.kek, data->kek, NL80211_KEK_LEN); + memcpy(vif_priv->rekey_data.kck, data->kck, NL80211_KCK_LEN); + vif_priv->rekey_data.replay_ctr = + cpu_to_le64(be64_to_cpup((__be64 *)data->replay_ctr)); + vif_priv->rekey_data.valid = true; + + mutex_unlock(&wcn->conf_mutex); +} + #endif static int wcn36xx_ampdu_action(struct ieee80211_hw *hw, @@ -1256,6 +1274,7 @@ static const struct ieee80211_ops wcn36xx_ops = { #ifdef CONFIG_PM .suspend = wcn36xx_suspend, .resume = wcn36xx_resume, + .set_rekey_data = wcn36xx_set_rekey_data, #endif .config = wcn36xx_config, .prepare_multicast = wcn36xx_prepare_multicast, diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 5a5114660b18..6121d8a5641a 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -143,6 +143,12 @@ struct wcn36xx_vif { unsigned long tentative_addrs[BITS_TO_LONGS(WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX)]; int num_target_ipv6_addrs; #endif + /* WoWLAN GTK rekey data */ + struct { + u8 kck[NL80211_KCK_LEN], kek[NL80211_KEK_LEN]; + __le64 replay_ctr; + bool valid; + } rekey_data; struct list_head sta_list; }; From patchwork Mon Dec 28 16:28:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991499 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 418A8C432C3 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E62B224D2 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441829AbgL1Q24 (ORCPT ); Mon, 28 Dec 2020 11:28:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633583AbgL1Q2y (ORCPT ); Mon, 28 Dec 2020 11:28:54 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5C4C06179F for ; Mon, 28 Dec 2020 08:27:41 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id v14so10715023wml.1 for ; Mon, 28 Dec 2020 08:27:41 -0800 (PST) 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=6D//l+W7/CZ439o0lMCQJjFN9QzC2gpJYA4w5visRz4=; b=VmVxNNjd896mlU5ueCgdu15CNfm8kvPBCtyjbFXP01LwiiBqXclXGJUDWgRp2WdLDv jRFEda+RODG6Xero3gU9pt9BA6OdwZ0xVpU6yKMUHVf4aOOrJop3+SnlYLrQrGSzT1Jd A3pskoAKOCpnGai634CPnvlhslIeJpZZoDLnZa0UQjp9i/ww2qTuKRXmddAh2WOYe5Q4 Q8hKewjHqQDoREExy4DBaeYrWdXX7XGmqSzY4Dm/BUBWM/ndBnf3MXk7Acq8k32EvE3+ gy6vwizEcYaEbr7Ftu5noh7zrbKtD9tQ/ca/+ubycO1hfcwyq12R+d6qExrvwJeJwTEh p7YQ== 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=6D//l+W7/CZ439o0lMCQJjFN9QzC2gpJYA4w5visRz4=; b=RmsCbMVF74dBvvm19PKMiQYGIP3p7lgHQYSNvakZlZCymgJqHxTRKQtomuRTvraOVb Fw53R94PNU54HBmwemKre4fSMU8hTxOYTSPqNb3ESILHXbkbGwVZvnecadqN5R2ppHpG +1VeqVz15gwD/h3s3xbQnfKjT2PI1FyHWEtcSjUnIG9O12EmCrTjZEQLz6q20S9nCcmz Z+ClhxJHUYROG04Q95xFyn+ckqa3FJfOqlfEDolYtoGtWzcSAlkmTU+rArPofwY+t5ka IrSVtV9+BKrgZB/x981lVnxgdLGXi7ha1l9mzw1i+pmEbjV0NI8p09zb5ejNEdusrp9W jwuA== X-Gm-Message-State: AOAM530jbQXNRqRh7hPObCoton7RD4tWbmmqcAQTq5ZRlj29y4TynhGx s/ZfScv1wyIuW4vE3UZx6g4K7A== X-Google-Smtp-Source: ABdhPJxZEvu1Xy/d/GNFullxhs79oBH7RcIgZVgQyQPpjMKT3vvbfLPtjjwGZdgJJme1QA9FoY4dhA== X-Received: by 2002:a7b:c19a:: with SMTP id y26mr20489509wmi.20.1609172860318; Mon, 28 Dec 2020 08:27:40 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:39 -0800 (PST) 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 Subject: [PATCH 09/13] wcn36xx: Add GTK offload to WoWLAN path Date: Mon, 28 Dec 2020 16:28:35 +0000 Message-Id: <20201228162839.369156-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Using previously set GTK KCK and KEK material this commit adds GTK rekeying to the WoWLAN suspend/resume path. A small error in the packing of the up to now unused command structure is fixed as we go. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 2 +- drivers/net/wireless/ath/wcn36xx/main.c | 4 +++ drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 3b949b0b3792..1f3c2e840232 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4905,7 +4905,7 @@ struct wcn36xx_hal_gtk_offload_req_msg { u64 key_replay_counter; u8 bss_index; -}; +} __packed; struct wcn36xx_hal_gtk_offload_rsp_msg { struct wcn36xx_hal_msg_header header; diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b3388e4a76d2..aa2a416daa7f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1121,6 +1121,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (ret) goto out; ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true); + if (ret) + goto out; + ret = wcn36xx_smd_gtk_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); @@ -1146,6 +1149,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_gtk_offload(wcn, vif, false); wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index b05f1e1f253a..db7988176526 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2849,6 +2849,43 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_GTK_OFFLOAD_REQ); + + if (enable) { + memcpy(&msg_body.kek, vif_priv->rekey_data.kek, NL80211_KEK_LEN); + memcpy(&msg_body.kck, vif_priv->rekey_data.kck, NL80211_KCK_LEN); + msg_body.key_replay_counter = vif_priv->rekey_data.replay_ctr; + msg_body.bss_index = vif_priv->bss_index; + } else { + msg_body.flags = WCN36XX_HAL_GTK_OFFLOAD_FLAGS_DISABLE; + } + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -2898,6 +2935,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_START_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_HOST_OFFLOAD_RSP: + case WCN36XX_HAL_GTK_OFFLOAD_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 380ea58b58ec..dd6710672db8 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -153,4 +153,7 @@ int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */ From patchwork Mon Dec 28 16:28:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991509 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FAC4C433DB for ; Mon, 28 Dec 2020 16:29:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3798208B6 for ; Mon, 28 Dec 2020 16:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633583AbgL1Q3C (ORCPT ); Mon, 28 Dec 2020 11:29:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730745AbgL1Q2y (ORCPT ); Mon, 28 Dec 2020 11:28:54 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1D47C0617A0 for ; Mon, 28 Dec 2020 08:27:42 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id c5so11753578wrp.6 for ; Mon, 28 Dec 2020 08:27:42 -0800 (PST) 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=/3oMZ0XZXTwR2OTVYcKlJpwlfLbWhAGf9POHgc7WDlA=; b=gDY9SHDEwZjqC5Yd9qSLQtJPQfZoC4Dfg1PYZrp9vO7Ru4H2lyZlbeSkIfDarXy6/o PHZj0iSyKYOXRa+0HAuIKFrLubu0fEA+C6OB3hOfX33qLnsMpEYylxlUS6EThMlLALub iA5PLE6qgNwsEsRepf03KcLGzm75TgwLIGr/MGfY9bx9w87l2GUXnSQVTRY0PSv40GkY c42kvOthOu82NX8GmP3hpthn5fLW6nzpNzB8zs/kc12X7RKpjavNP+xOOsVyOfgDNwTa 8fcUsgXO1KzJr993fIbtVjlmrakiIwrUNcG0riDzcbQzG+wnJfrXH3q7CLhUjtaEkTH7 oRJQ== 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=/3oMZ0XZXTwR2OTVYcKlJpwlfLbWhAGf9POHgc7WDlA=; b=XKVaIwvi9NA+2gBSjesgvEf43wIHpNoh4muHTWd2/vJPCUtM97+e8Mosn0foBdZxkV cchfZeYWgnagEOS8J+4Q7N94jCKAw8wkst5lvcjKyQlRWpXKFVOHqk5z2+KYKHsjBfwS ryXijve48vAGGWcKqFkH1/Z6UBoWZsoql8RTQyx5zPKLDjvfCvfoDk8dmuvkk1dkAwZS ndwxrCganG5KXGeAXPXocIwg5GfmXGOEDIqEr6GIFlQDWDHb/AM2M4Ck0S7LoT+7j37k VLeiZPz9LtLdchMKbpiM3m1zUZGI9m9cbTTFJ6fXqde+R5GezxvbmZdM5FjBL3w+u0vx JD+Q== X-Gm-Message-State: AOAM5313kRMis2qQjzikFYKnNJu+o8o2s5MNZQgFskzN2+aNFXpZVau+ U7vNowGpb6FyYDmEcx0DpHDigQ== X-Google-Smtp-Source: ABdhPJx5MmXQ+qEjz4/+IjVySyJMm5lwSTkHa3may8g7KZQLAHq6Rn04e8PzHJZjAgXKHBWdcpc4VQ== X-Received: by 2002:a5d:67c3:: with SMTP id n3mr51447656wrw.297.1609172861427; Mon, 28 Dec 2020 08:27:41 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:40 -0800 (PST) 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 Subject: [PATCH 10/13] wcn36xx: Add GTK offload info to WoWLAN resume Date: Mon, 28 Dec 2020 16:28:36 +0000 Message-Id: <20201228162839.369156-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Having enabled GTK rekey in suspend, we need to extract the replay counter from the firmware on resume and perform a ieee80211_gtk_rekey_notify() so that the STA remains verified from the perspective of the AP. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 4 +- drivers/net/wireless/ath/wcn36xx/main.c | 5 +- drivers/net/wireless/ath/wcn36xx/smd.c | 72 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 1f3c2e840232..455143c4164e 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4919,7 +4919,7 @@ struct wcn36xx_hal_gtk_offload_rsp_msg { struct wcn36xx_hal_gtk_offload_get_info_req_msg { struct wcn36xx_hal_msg_header header; u8 bss_index; -}; +} __packed; struct wcn36xx_hal_gtk_offload_get_info_rsp_msg { struct wcn36xx_hal_msg_header header; @@ -4943,7 +4943,7 @@ struct wcn36xx_hal_gtk_offload_get_info_rsp_msg { u32 igtk_rekey_count; u8 bss_index; -}; +} __packed; struct dhcp_info { /* Indicates the device mode which indicates about the DHCP activity */ diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index aa2a416daa7f..b48a3f0dcc0b 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -173,7 +173,9 @@ static struct ieee80211_supported_band wcn_band_5ghz = { #ifdef CONFIG_PM static const struct wiphy_wowlan_support wowlan_support = { - .flags = WIPHY_WOWLAN_ANY | WIPHY_WOWLAN_MAGIC_PKT + .flags = WIPHY_WOWLAN_ANY | + WIPHY_WOWLAN_MAGIC_PKT | + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY }; #endif @@ -1149,6 +1151,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_gtk_offload_get_info(wcn, vif); wcn36xx_smd_gtk_offload(wcn, vif, false); wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index db7988176526..dd12575f33c3 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2886,6 +2886,77 @@ int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +static int wcn36xx_smd_gtk_offload_get_info_rsp(struct wcn36xx *wcn, + struct ieee80211_vif *vif) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_get_info_rsp_msg *rsp; + __be64 replay_ctr; + + if (wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len)) + return -EIO; + + rsp = (struct wcn36xx_hal_gtk_offload_get_info_rsp_msg *)wcn->hal_buf; + + if (rsp->bss_index != vif_priv->bss_index) { + wcn36xx_err("gtk_offload_info invalid response bss index %d\n", + rsp->bss_index); + return -ENOENT; + } + + replay_ctr = cpu_to_be64(le64_to_cpu(rsp->key_replay_counter)); + if (vif_priv->rekey_data.replay_ctr != rsp->key_replay_counter) { + vif_priv->rekey_data.replay_ctr = rsp->key_replay_counter; + ieee80211_gtk_rekey_notify(vif, vif->bss_conf.bssid, + (void *)&replay_ctr, GFP_KERNEL); + wcn36xx_dbg(WCN36XX_DBG_HAL, + "GTK replay counter increment %llu\n", + rsp->key_replay_counter); + } + + wcn36xx_dbg(WCN36XX_DBG_HAL, + "gtk offload info status %d last_rekey_status %d " + "replay_counter %llu total_rekey_count %d gtk_rekey_count %d " + "igtk_rekey_count %d bss_index %d\n", + rsp->status, rsp->last_rekey_status, + rsp->key_replay_counter, rsp->total_rekey_count, + rsp->gtk_rekey_count, rsp->igtk_rekey_count, + rsp->bss_index); + + return 0; +} + +int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, + struct ieee80211_vif *vif) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_gtk_offload_get_info_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_GTK_OFFLOAD_GETINFO_REQ); + + msg_body.bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending gtk_offload_get_info failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("gtk_offload_get_info failed err=%d\n", ret); + goto out; + } + ret = wcn36xx_smd_gtk_offload_get_info_rsp(wcn, vif); +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -2936,6 +3007,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_HOST_OFFLOAD_RSP: case WCN36XX_HAL_GTK_OFFLOAD_RSP: + case WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index dd6710672db8..b225c805107c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -156,4 +156,7 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, + struct ieee80211_vif *vif); + #endif /* _SMD_H_ */ From patchwork Mon Dec 28 16:28:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991505 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EA57C4360C for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84E8122573 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441838AbgL1Q27 (ORCPT ); Mon, 28 Dec 2020 11:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441824AbgL1Q2z (ORCPT ); Mon, 28 Dec 2020 11:28:55 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02B8C0617A1 for ; Mon, 28 Dec 2020 08:27:43 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id d13so11723790wrc.13 for ; Mon, 28 Dec 2020 08:27:43 -0800 (PST) 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=DaRR0s0yK5BJ7snyCgYM3YYfv91qTFP1bIba/mfbIt0=; b=W68ezXvAn1yxyVAM4VLHizolz0Zwdnfq4KSit0A1itMtMF/iQt5vHWpmasiwR8uOY6 iANb9sWGbtrbzeK/2coyGmKHcgTznst/IFmzz58rglUrK3yrf/o0Unk1N9xqCNiv5K9G dVoRFsdMxtSBEIj5/lIAqGdf68XwohXZr4GkE03yD0sx3+Hpjl9Mf1+88LmEFof3f9A5 Gz0UF/f8vOQTFFO9Hi6Ul2dl5n/YNNa9bB7u66lD2wQ/VEWkiAAqdQpxOE5jPQMiNSDM UfTwZj/9RK4nNR1G8vwEERUulwQ/iXCaVMez0lxLzfkiizSQFW0gdJrSrYnJ/mhZ1RyT 3vlA== 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=DaRR0s0yK5BJ7snyCgYM3YYfv91qTFP1bIba/mfbIt0=; b=KoVtcP9bPRsXfBwQodEXG3y+rIgj5tgIiOeELAIMznTFvORJCeI9FHyiN+zN2Am+lJ NKPxax0cP9ywLhty+Aq1IxopY8UVxnNjfDush5yY1unxXtfxmgFZBQ+wp3wxLtvMEzyK 8mo9JGXDAe8QlwE9JV0fZAO6WjleKxgr3jwVHE3trxh/tLb4NibU6/7ygm+eAp/t3FCU A++Ds2SvPoiGCMScGpDKTAN8TJihwxD17itT75n4M6vi4rGeiSI/PkTxH/kfy5e9prWK tSNTaNaa2QmJhaknmnQzsHjIxX1R1jr9n5WDbEcKLpYBDq9g+5jgB7qShb4289D2i4Vf sWTA== X-Gm-Message-State: AOAM531DlMA8726U1UmBvlDtvTyvBGc8LYmRrqZEai75TQ02hn3YrWoW jrFBYkD3Y/c+DiAvGbiaCkqmwg== X-Google-Smtp-Source: ABdhPJw6O0hyzcV4HP4nSNFNiEFZUrWQz1TIHKXJ+IzbVgMJWa8ne1uINiaBhvEwsqTQBNmz2KqW4g== X-Received: by 2002:adf:ab56:: with SMTP id r22mr40739831wrc.351.1609172862552; Mon, 28 Dec 2020 08:27:42 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:41 -0800 (PST) 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 Subject: [PATCH 11/13] wcn36xx: Do not suspend if scan in progress Date: Mon, 28 Dec 2020 16:28:37 +0000 Message-Id: <20201228162839.369156-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If a scan is in progress do not attempt to enter into suspend. Allow the scan process to quiesce before proceeding. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 5 +++++ drivers/net/wireless/ath/wcn36xx/smd.c | 13 +++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 2 ++ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 + 4 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b48a3f0dcc0b..feb909192c8e 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1113,6 +1113,11 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) wcn36xx_dbg(WCN36XX_DBG_MAC, "mac suspend\n"); + if (wcn36xx_smd_is_scanning(wcn)) { + ret = -EBUSY; + goto out; + } + mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_vif(wcn); if (vif) { diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index dd12575f33c3..378282a93aa0 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -731,6 +731,7 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode, wcn36xx_err("hal_init_scan response failed err=%d\n", ret); goto out; } + wcn->scanning = true; out: mutex_unlock(&wcn->hal_mutex); return ret; @@ -807,6 +808,7 @@ int wcn36xx_smd_finish_scan(struct wcn36xx *wcn, mutex_lock(&wcn->hal_mutex); INIT_HAL_MSG(msg_body, WCN36XX_HAL_FINISH_SCAN_REQ); + wcn->scanning = false; msg_body.mode = mode; msg_body.oper_channel = WCN36XX_HW_CHANNEL(wcn); if (vif_priv->bss_index != WCN36XX_HAL_BSS_INVALID_IDX) { @@ -938,6 +940,17 @@ int wcn36xx_smd_stop_hw_scan(struct wcn36xx *wcn) return ret; } +bool wcn36xx_smd_is_scanning(struct wcn36xx *wcn) +{ + bool scanning; + + mutex_lock(&wcn->hal_mutex); + scanning = wcn->scanning; + mutex_unlock(&wcn->hal_mutex); + + return scanning; +} + static int wcn36xx_smd_switch_channel_rsp(void *buf, size_t len) { struct wcn36xx_hal_switch_channel_rsp_msg *rsp; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index b225c805107c..3488abb201d0 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); +bool wcn36xx_smd_is_scanning(struct wcn36xx *wcn); + #endif /* _SMD_H_ */ diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 6121d8a5641a..36ea768a5203 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -249,6 +249,7 @@ struct wcn36xx { struct ieee80211_vif *sw_scan_vif; struct mutex scan_lock; bool scan_aborted; + bool scanning; /* DXE channels */ struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */ From patchwork Mon Dec 28 16:28:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991497 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F85CC4321A for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B45B22583 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441835AbgL1Q25 (ORCPT ); Mon, 28 Dec 2020 11:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441825AbgL1Q24 (ORCPT ); Mon, 28 Dec 2020 11:28:56 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D522EC0617A2 for ; Mon, 28 Dec 2020 08:27:44 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 3so10199072wmg.4 for ; Mon, 28 Dec 2020 08:27:44 -0800 (PST) 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=2/sf0TvCOSTx5tivsY1tuBdXidg386Du0OJP+4zFzuI=; b=Pj7YzXBBXro5Okt10fjB6pr1awWUU5epPF2T+flMBEuKCBKkDyiw2D46UhDr0UCC14 JKSkJVjCfcpJkkgr9Z+q1o4Oimy+OAk+OA7i1gyRkFgJPVj5vczFKrz6GgdCR8zAEPj1 DToBAE8FSA5yhdibErba20LK17cloNGREz+iDge38L9w6JIbt0AAuBqAVybD9fW2oqTO HHsKQOhn6Uo1zhaEnGZXrrBMfl6cZfHPql61r/aLY8Wsi60Z4/cePcR4ju/H7/J8DeoC azR4Z0hdiRta45ydB8TcOxmWlxtlfOEQHaJHJbplBgzgOsuIgVdWyvgZvdFEEvIFVU0L yShQ== 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=2/sf0TvCOSTx5tivsY1tuBdXidg386Du0OJP+4zFzuI=; b=fb6AefKXomce29w9YskUB9VyvgeQDZtz80Jy3Ixt6FcQEqozliD3+/nLIgqNW5pWjK K01dDvjRTEhEKSU4cBC1mMFG7dYVY0F8FIZTcBwNNtrr3LTZ+9QuS0rnXFdUF5rjmWzy 47Ns0b7/7MzzWPU9LSPSpqiEBeL4qqlgulo24pduqSIG27AXOu7SytPHHvX2aA5/JqsQ 5lUnPto9BCXcnuDhlbHKH+TerCH3E2C85y63+DTiFrI/1YX5mTu1XeYeLlgXHZBcO22Z ARbzAjuESRQubk5BRyOmvalCWfKIePtwan24JzlNrvKEYBdLsl4nqxjZ7s6gbQm1Sy4+ 54yg== X-Gm-Message-State: AOAM533E/AQcnV07PjhhNwQp3Pp+zVrXZe/xvEOrldCwMUB/WcA/7qZt bJf/RuWDQAGFsc9U+/y8NcCmgw== X-Google-Smtp-Source: ABdhPJyAG2ybqZDxZWdKoAVBjVyCgWxzkbRjHLwhR0fzZFMwkRN+y2nfOOXqNDAVhCde2oH1EtIj0Q== X-Received: by 2002:a7b:cd90:: with SMTP id y16mr21524744wmj.115.1609172863690; Mon, 28 Dec 2020 08:27:43 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:43 -0800 (PST) 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 Subject: [PATCH 12/13] wcn36xx: Add Host suspend indication support Date: Mon, 28 Dec 2020 16:28:38 +0000 Message-Id: <20201228162839.369156-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-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 --- 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(+) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index feb909192c8e..ec24b0cc5b8c 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1134,6 +1134,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 378282a93aa0..5450d56d8e1c 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2970,6 +2970,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 3488abb201d0..77efcfa145ec 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -161,4 +161,6 @@ int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, bool wcn36xx_smd_is_scanning(struct wcn36xx *wcn); +int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); + #endif /* _SMD_H_ */ From patchwork Mon Dec 28 16:28:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 11991501 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8138AC43217 for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 519762245C for ; Mon, 28 Dec 2020 16:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441832AbgL1Q25 (ORCPT ); Mon, 28 Dec 2020 11:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441828AbgL1Q24 (ORCPT ); Mon, 28 Dec 2020 11:28:56 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4323C0617A3 for ; Mon, 28 Dec 2020 08:27:45 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id t30so11797840wrb.0 for ; Mon, 28 Dec 2020 08:27:45 -0800 (PST) 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=VFlxfdScJISQHEQPsvwi72V6FodBvi35qoUUckJzFhM=; b=VFpSv9qQLSaccEYxNBJkiNrTDCkfCsp9QuL+zJp0/MY99xqzkBMsvIiyPEX1rx8hC2 jwYgblnt27v0Uz8yJblLwtM8z5QBumNrCBS+K9009X1wJjfqVwVyWQAU789vTbcR6rk2 prU+AzGwMIhXHx3ifpjTFR6zchlHJTAKQcKeGZXzOHAxeVjUa5MIPDJe6FOwNSp4N4du 7FUX6hdhIShN4jZkpMkVlF1u+IfiTgJ6QmnpBUOb+F3pUGMMPv7fRxcWONRBBl2ko7nA LwXrFOv0Qi4clbW3T1r8YlTBGCJCH1T6BJznt4xgLadEC06XFxwP6FzxVF6chhY2SKxK 5yRA== 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=VFlxfdScJISQHEQPsvwi72V6FodBvi35qoUUckJzFhM=; b=Tz9U0pHO10LhbR5w3are7zHIdayZvYBiBy1RD74ZTz2yGiOoumPyUT2yFQLGT8I9TT E8BNrok3V10QDHnjwJvG4hHM4BEr0P1/nQb+kzMK8lREeXuMn9Y/0xakmziYL2yEvUaa LDG4J9GbX08XdSaeQIbxB5Yc6XgcZLYWHF9WwM1kngRrAgnmS3zE1TpVWMY7sQDbR71J 5K0JW5syAUaNWQSAxLS9Hn0mIFO4AA+cSdzvyYF1Gk73A2rHfzuWGNf5V2mtPFAG2jyJ sLzQLFimCSVhaSgG9K/c+HT3DexEXwSihCh0EZB8mgsAz/JPYi4+McfJFcY4IyZumMQ/ WpUw== X-Gm-Message-State: AOAM533AdPfD50suRbn/Ms1jfdGW/8uFijcLPWYAUZ7T4sRtdYSUEpiq rMFBNfn2vRmZ02ETs1uPQ9ubmg== X-Google-Smtp-Source: ABdhPJwepbMFQGxc+PqC1KFidu5n4XlIJb7rTUAPBJ030D5lsSliFNfaUxEvXRUNJf/iwxTfRolwfg== X-Received: by 2002:adf:8184:: with SMTP id 4mr53093783wra.63.1609172864755; Mon, 28 Dec 2020 08:27:44 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:44 -0800 (PST) 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 Subject: [PATCH 13/13] wcn36xx: Add host resume request support Date: Mon, 28 Dec 2020 16:28:39 +0000 Message-Id: <20201228162839.369156-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This commit is the corresponding resume() path request to the firmware when resuming. Unlike the suspend() version which is a unidirectional indication, the resume version is a standard request/response. Once the resume() request completes ipv4 ARP, ipv6 NS and GTK rekey offload stop working and can subsequently be rolled back. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 35 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 2 ++ 3 files changed, 38 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index ec24b0cc5b8c..9a2a6399c8a0 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1158,6 +1158,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) if (!vif_priv->sta_assoc) goto out; + wcn36xx_smd_host_resume(wcn); wcn36xx_smd_set_power_params(wcn, false); wcn36xx_smd_gtk_offload_get_info(wcn, vif); wcn36xx_smd_gtk_offload(wcn, vif, false); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 5450d56d8e1c..83452d7f4634 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2989,6 +2989,40 @@ int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn) return ret; } +int wcn36xx_smd_host_resume(struct wcn36xx *wcn) +{ + struct wcn36xx_hal_wlan_host_resume_req_msg msg_body; + struct wcn36xx_hal_host_resume_rsp_msg *rsp; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_RESUME_REQ); + msg_body.configured_mcst_bcst_filter_setting = 0; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending wlan_host_resume failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("wlan_host_resume err=%d\n", ret); + goto out; + } + + rsp = (struct wcn36xx_hal_host_resume_rsp_msg *)wcn->hal_buf; + if (rsp->status) + wcn36xx_warn("wlan_host_resume status=%d\n", rsp->status); + +out: + mutex_unlock(&wcn->hal_mutex); + + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -3040,6 +3074,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_HOST_OFFLOAD_RSP: case WCN36XX_HAL_GTK_OFFLOAD_RSP: case WCN36XX_HAL_GTK_OFFLOAD_GETINFO_RSP: + case WCN36XX_HAL_HOST_RESUME_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 77efcfa145ec..6dfed8f386d9 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -163,4 +163,6 @@ bool wcn36xx_smd_is_scanning(struct wcn36xx *wcn); int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); +int wcn36xx_smd_host_resume(struct wcn36xx *wcn); + #endif /* _SMD_H_ */