From patchwork Tue Jun 1 02:49:09 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: 12290337 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 CB5C8C47083 for ; Tue, 1 Jun 2021 02:47:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A74AF6128A for ; Tue, 1 Jun 2021 02:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbhFACtW (ORCPT ); Mon, 31 May 2021 22:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232268AbhFACtV (ORCPT ); Mon, 31 May 2021 22:49:21 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956F0C061574 for ; Mon, 31 May 2021 19:47:39 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso590016wmc.1 for ; Mon, 31 May 2021 19:47:39 -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=/kuNaO+3BN/9XKW0uTC+mnQ6gznoI5jFyk7Mscc9K1Y=; b=Lo4bik+TZIU7M/QWJWM5fLz+7AXZQdnBL5yFb4HyrbKXHXnK1j8SQPO6Ww6AFOyK5M SQz9EzE2DK0StDXBpy8EjrT+KR/WHy4LxvTkD+HTUP4NcltISAbw6mn/jRBjDyVkrf5U D5AqLZRtV+sPhTEi5FhYQTij1fnwsVagHf6d0yQd9dXzjrpWjuyG+POHeFAiiFerR4oG 7+KMYjjpmLOnMCztYQYN0m4VOnRN53WdQ03I1KnrEKKIl04ck+uBIm6uxVepm81dlP5K 5XleGfmZUBNMPPjoEGHI0SmUefj4k4h/tfLqI0cK0FGi2WqSNFtFsFreRgnIrGqyHH4u VjdQ== 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=/kuNaO+3BN/9XKW0uTC+mnQ6gznoI5jFyk7Mscc9K1Y=; b=RhfcumzAC32U6LX2PKXmowMW+cLXT0lzwANHQCQka2UpdEMTVInmTe1SVbp5dOffj/ RtOLzQ/FtrZJ1g0t4m1i0zjnJ42GjP/Ng5tUXz4w63Xlst+w8RlRJkQQk7KbXB/LK1K7 prIITmS8kNR2F6dOZk05LVi8It1eabTm0afYRjvTPtAxCII3q80G6GH+FpUmrvxhavtb 5vmJUo7eo/jlys5avowkIzsN80y8Ts9FRWHIg1jaMi6RfsCoyVGydfdHJifhYCRxtWFP Cd0Fb0csG6nvZ6b+Vvy1kXu8MOgoLz1oafTUVQdkscYR33/taOL7Oi/w02xtQZ3Ila39 bIuA== X-Gm-Message-State: AOAM530sEyYb8e2N6Qfp+KnYxz0pZO3iA8taXtJHObILt6zAko5kZIEu P2+Rz1jbI81IbGoQmRNJumWOq+Jlj1P49A== X-Google-Smtp-Source: ABdhPJxqW3kadPvq4gucoaiPkMBEvBJynqhRHoEiREItrCoz8TgwMWB3cuXSWg9iNJ4TVVWjVKh63A== X-Received: by 2002:a05:600c:2301:: with SMTP id 1mr1823494wmo.180.1622515658225; Mon, 31 May 2021 19:47:38 -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 e22sm16774014wme.48.2021.05.31.19.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:37 -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 v4 01/12] wcn36xx: Return result of set_power_params in suspend Date: Tue, 1 Jun 2021 03:49:09 +0100 Message-Id: <20210601024920.1424144-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- 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 afb4877eaad8..b361e40697a6 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 Tue Jun 1 02:49:10 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: 12290339 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 3BE2DC47082 for ; Tue, 1 Jun 2021 02:47:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FCCE610A6 for ; Tue, 1 Jun 2021 02:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbhFACtW (ORCPT ); Mon, 31 May 2021 22:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbhFACtV (ORCPT ); Mon, 31 May 2021 22:49:21 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AF99C06174A for ; Mon, 31 May 2021 19:47:40 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id h5-20020a05600c3505b029019f0654f6f1so25271wmq.0 for ; Mon, 31 May 2021 19:47:40 -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=ONbc2ptFm/dZBx8XWwy/A/AaOhsPLbrPaqAnpZ4ZWqg=; b=KPXxiBTA8FxhMKM8KZz+vK8VjkqSPmQiNujL5TY+RPM5AHVzbRSuWPP90/09WzX4I7 ArL14S5OhYZgTICy1tZ5GtDi7CtDmshzwk7yi97HG7w3ZMMSaposNJk70digd9mF8i+f 5KU06iHAWwrKJgQ2SfvqF2YvA8uDs0UzqeE+3CHeEadj6X/t+QhZjhor6hAjoBXwKN9x hBj9kZwg83yfYjMkyYZzjjHVvGomG2mu2Sa3vMAHdwlaqULnEfTZYQs7aVqz+sknz5f/ cuAYC2vUjlxeuk+Ait4jfMO+3nohBq2bYx+aUj5l+rWoxdpUx4/sg26KXcGm3nmHN1rV E/Ag== 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=ONbc2ptFm/dZBx8XWwy/A/AaOhsPLbrPaqAnpZ4ZWqg=; b=jZ5uHG6CLwgVBs4SRXcGUbsdk+g6L5RwTEMluUKzQxjeHXB/IB5+8wfGhkHs4aR+F5 gBrx6AIm4ZkSkKshwRFKuXyq542lpz9cqXUv6E9Z13ZdJwDpyHjfB14NdbvWF1X0O32u 9GPnOfjhUCo7e4JP0RZ3tCpBYBPbcsGpuRIIzbMSl4/c3nDsMcrhO9to0PRGEkND+eN2 IA+0xSxStGMMD0WqJzONs9BZ+DsZq08F84O3+QH6bi+UuTjy0KJtljjavRlJvyEm2X92 43Clw1FW4oJBKzQ6SwQ/K/nDxF601ya73Zkh4LwJ0jMEDPPJ1vwfNrJtJx5aNyvcZxHU xwxw== X-Gm-Message-State: AOAM531EWlZXFhA9xRcuULUp8JWBkfzFzx6f/anTvS08XV25exUfhNKv 4woId3X7emlMoJtWMlPK85S8Iw== X-Google-Smtp-Source: ABdhPJz1iwdZ29q33Rk6VoyX93vJDFbE+I5LkQAYoqvt9Pvbuta/7+dDZD+a+/LRf1yK/iJ/kVtZgQ== X-Received: by 2002:a1c:e343:: with SMTP id a64mr3209594wmh.114.1622515659249; Mon, 31 May 2021 19:47:39 -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 e22sm16774014wme.48.2021.05.31.19.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:38 -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 v4 02/12] wcn36xx: Run suspend for the first ieee80211_vif Date: Tue, 1 Jun 2021 03:49:10 +0100 Message-Id: <20210601024920.1424144-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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. Constrain the interaction with the firmware to the first ieee80211_vif on the suspend/resume/wowlan path. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/main.c | 30 ++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b361e40697a6..6802dce2a02b 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1088,15 +1088,34 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw, #ifdef CONFIG_PM +static struct ieee80211_vif *wcn36xx_get_first_assoc_vif(struct wcn36xx *wcn) +{ + struct wcn36xx_vif *vif_priv = NULL; + struct ieee80211_vif *vif = NULL; + + list_for_each_entry(vif_priv, &wcn->vif_list, list) { + if (vif_priv->sta_assoc) { + vif = wcn36xx_priv_to_vif(vif_priv); + 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; + 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_assoc_vif(wcn); + if (vif) + ret = wcn36xx_smd_set_power_params(wcn, true); + mutex_unlock(&wcn->conf_mutex); return ret; } @@ -1104,11 +1123,16 @@ 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; 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_assoc_vif(wcn); + if (vif) + wcn36xx_smd_set_power_params(wcn, false); + return 0; } From patchwork Tue Jun 1 02:49:11 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: 12290341 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 2A459C4708F for ; Tue, 1 Jun 2021 02:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E0276128A for ; Tue, 1 Jun 2021 02:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232622AbhFACtX (ORCPT ); Mon, 31 May 2021 22:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbhFACtX (ORCPT ); Mon, 31 May 2021 22:49:23 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA20C061574 for ; Mon, 31 May 2021 19:47:41 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id o2-20020a05600c4fc2b029019a0a8f959dso953292wmq.1 for ; Mon, 31 May 2021 19:47:41 -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=KsNT4vuAeu6cKVvNObaXWqMoOE4c0iCL7hd7Q0QF6h0=; b=AnXIbX4LadPjlIYy7pY99/w63HuWjEMTUdrZwlMdb4htPQ2sYy0caaAbR5ZgsPKqYU ALIuFVYl5DUE90fjFKfBW19i5FYje1lWGgGM0+qNUz7w5lhIzHlCVktZ5oqOnJVMmMmD CPll/rKr0BAH+786YChFPZb+TVMuidClFMi/Xo+QF8m8KVllM98JOTtooFVWe9kdo0Kh TNuY7ce+uX4RN/xHOfw98PPLpYzk5NzC9//C14usv/LREeG4gO53F97JM9NtAPIs3XaT 1HRBZesp+oqe+72JbCfzvJUm0t6u7NYMdB0H4bRuPFBHs/r9peHvUhcXEL6rJrucwbfE J9PA== 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=KsNT4vuAeu6cKVvNObaXWqMoOE4c0iCL7hd7Q0QF6h0=; b=Tf9MQpMJo38YjOhKeTzN69STviH1E7szun1Jt7+kjNDBX73arOQVkJAcxKDrQWXd5W zvE90BBVtt9ye4iv27N0GEBU0kycSM72JkYfWMjnC45Ifwplx8Mhhl6xY8sfrafwZkvw ZNhGP3UUt1BQKvDeAQ/IFfcUw5kg7ToZe+fxxD1zXFmecPkXTnVHDHMJcEjuVflRe7d+ k+gwR7bv4BsVP55q9RDAL6ZvfmMDzmhg/9CFoFyQZY6HEbtUaXFqPLEEhwwhQZdK90Eq F+RWwTqiTMFbvUZaTdv58pJxSYdWHS9mV6H0mQbWrw6pgsfumesbofTHh9HX8z9P8va1 Jb4Q== X-Gm-Message-State: AOAM532QLwQLrdMUcEL5limk7GUQwleMfYZJmNmXfHHUp86CGuk1/Kkp 74w1I5ygiEgkbwOnaqUZWmxH2XFvjqiP2Q== X-Google-Smtp-Source: ABdhPJwGsB3MKFYfs+VB0NwxFqSLawreTGSkJkTFak11VlyhOuUBHN+Qg5eO/mcu6Pu23xEhKaDFPw== X-Received: by 2002:a1c:cc12:: with SMTP id h18mr1789554wmb.179.1622515660448; Mon, 31 May 2021 19:47:40 -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 e22sm16774014wme.48.2021.05.31.19.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:40 -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 v4 03/12] wcn36xx: Add ipv4 ARP offload support in suspend Date: Tue, 1 Jun 2021 03:49:11 +0100 Message-Id: <20210601024920.1424144-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add ARP offload support. Firmware is capable of responding to ARP requests for a single ipv4 address only. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/hal.h | 10 +++---- drivers/net/wireless/ath/wcn36xx/main.c | 14 +++++++-- drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 +++ 4 files changed, 58 insertions(+), 8 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 6802dce2a02b..0da123660fa1 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1112,11 +1112,16 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) flush_workqueue(wcn->hal_ind_wq); mutex_lock(&wcn->conf_mutex); + vif = wcn36xx_get_first_assoc_vif(wcn); - if (vif) + if (vif) { + 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; } @@ -1130,8 +1135,11 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) flush_workqueue(wcn->hal_ind_wq); mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_assoc_vif(wcn); - if (vif) + if (vif) { wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_arp_offload(wcn, vif, false); + } + mutex_unlock(&wcn->conf_mutex); return 0; } diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index d0c3a1557e8d..478e363610e1 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2756,6 +2756,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) { @@ -2804,6 +2841,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 462860572e1f..6492a628ea6a 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 Tue Jun 1 02:49:12 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: 12290343 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 9A615C47080 for ; Tue, 1 Jun 2021 02:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E729610A6 for ; Tue, 1 Jun 2021 02:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232633AbhFACtY (ORCPT ); Mon, 31 May 2021 22:49:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232598AbhFACtX (ORCPT ); Mon, 31 May 2021 22:49:23 -0400 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 BE808C06174A for ; Mon, 31 May 2021 19:47:42 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id f20-20020a05600c4e94b0290181f6edda88so553061wmq.2 for ; Mon, 31 May 2021 19:47:42 -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=SquAaKfKT+XFRM7MHN5IY0d9iler2O6E6du+Hc36euc=; b=ZpgO2MP1KriQSIbxmw/bWEOAHcTegnidOVBirFpHKEIP++ugodrKda0zumw8j6B/fG 5x4Rg4oXGbrV6FSE7i8k5NLNelUVoEEiL2Y6IKnz5KZrJ1zFWpXNTeiXY/bOpsrYueNw 738HVPkdnaAStWJUwAl5wX6sjXHuciIZgzwqV/E1JMOmlDby2t3EODjDCrUhFsDUAl1r jNfd6tWrs3hZtpLpWIqvN10DYxwtG1QsrPv+k6rynslpa0q9eMR2vFoRnLl5ddh6jh9D gOUU9gGDZzE/RyuELg4vA+7Mjx9MWBYNdsJihQtV6rBTjZzq52T6FgdP6wlaR+d9qMne kwAQ== 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=SquAaKfKT+XFRM7MHN5IY0d9iler2O6E6du+Hc36euc=; b=I20Dg6wr1nh39aczGW9QOgRM1CFfw72wioeV0cnfSQ9XYgwI9S4SnZRDImGiSocNuP pIJHkUDxY/7+Ni0zPmaox64tS8o8jfIjfllsDm29HgCWByRv/ggelohwT8Jrj0hUIbhF ReXkpOu1eNZsEJ3d86H1Exq3ZeCOlXjSuyeAHSQ1hfHeND3LIMPpp7OxI+W4wVeTJCZm 180EPY1kEUSc2dtplsmrERbjot7YYtn2kQlvx4h0fDvRRPEyC9d32u/Lkp7OLOqRR5v6 4IAxjDPQycX87iszyPeIT/yCjmzlUazN5P0/rfg07/fqQ5zFudPeQfdZKblPUhVhkqhC 3ahA== X-Gm-Message-State: AOAM530kbeIVENfKRlITaMT07dbVq5J6ZwwiArv2r5SzsCwfi1wqgt9K k6YcfhIkoVIfdCSqREbOgq5L3A== X-Google-Smtp-Source: ABdhPJxB3R075BWChky6fbTlEDAPH2ZQr7A0N8IYAVJLCmdEnu5IffQTYRDVK9vIfb77Zl8tBau2OQ== X-Received: by 2002:a05:600c:3592:: with SMTP id p18mr23608352wmq.44.1622515661410; Mon, 31 May 2021 19:47:41 -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 e22sm16774014wme.48.2021.05.31.19.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:41 -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 v4 04/12] wcn36xx: Do not flush indication queue on suspend/resume Date: Tue, 1 Jun 2021 03:49:12 +0100 Message-Id: <20210601024920.1424144-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- 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 0da123660fa1..9731fcbe2e7f 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_assoc_vif(wcn); @@ -1132,7 +1131,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_assoc_vif(wcn); if (vif) { From patchwork Tue Jun 1 02:49:13 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: 12290345 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 B2749C47082 for ; Tue, 1 Jun 2021 02:47:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9939A6128A for ; Tue, 1 Jun 2021 02:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232644AbhFACtZ (ORCPT ); Mon, 31 May 2021 22:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbhFACtY (ORCPT ); Mon, 31 May 2021 22:49:24 -0400 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 BB1B6C061574 for ; Mon, 31 May 2021 19:47:43 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id f17so5759167wmf.2 for ; Mon, 31 May 2021 19:47:43 -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=W+UYnqbXmGpOtA5im0JIGu1QFL9pMS49kWTkIpsAbWs=; b=FmNnnm8lmFjeLCGy1WiL2iD7uc1zwahc9GphBEZf4CtBa+2XLm9uF3QJ6Y58PupRUX cBI8Krv5BRJ1EVRnwJRv1tNS0W2UOSjUlnr9DK2xswpFgRwvl7XXedgSUTpa42T907zZ 5vMjv59Xz6Z4HtmDosWdSSUHBx5ecCKzMALDviJIT/8tRuaDaBiCt7s4fma958cRJCwF VwtmcnewEFEqeS/MJ6wQNyVLSea9VrojUxE7oTu3UcgQqw6iJ72A592TPeCZKHyMlqRM QeVygx6kVWL3t0cc+XETVaniea+94iCeJeyWUixhAn21/GpOFDUOHpmLyrODTGriFQHP 38ng== 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=W+UYnqbXmGpOtA5im0JIGu1QFL9pMS49kWTkIpsAbWs=; b=WQfUUltjLalkMC6G0hJ4ZwcgJ0n4t37yslg/NO5gVIiikBJBbX+W9WoeR8BYZT50wV QzzmIJSTPvuxQKLV1GkvdtWIpwNrpWAIazxmi81xnvOlTsvi6KEReSgT+QXQa7+W8KML eLkW3vUcUUPAlTenpuyojqJpVLDSdTDo/oN5xUC1WsBpmhPvgqrlzRtQG54+Vr7OQvaX YDCPHc0kicnHps/sqJtUNnt2L9xJFKuxqzKt2YbqQAIqmy93LdoaiJLa766Plw77vV5M Tj2MA0UN0WVI2ETri0uM4MSHohqi/FjyOEFh7IXsmt6dGrk8UiYLJpGCVELdlzDXH6QV z1Rw== X-Gm-Message-State: AOAM531R9Kj8YIdFG9SA2Cj8G0IhIJaBg4pVQ51bBgYV/V6V+7QOKxmE YLfZufZD4yBolwUa6jQf8pNj7Q== X-Google-Smtp-Source: ABdhPJyoKYZmbrpwPiToaIzSPbnzBDTt4W5jlTD64Q/bRTV8L85bGuYtjOZnzTHCZ7J6MTVd3DXSLQ== X-Received: by 2002:a7b:c847:: with SMTP id c7mr24117006wml.168.1622515662356; Mon, 31 May 2021 19:47:42 -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 e22sm16774014wme.48.2021.05.31.19.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:41 -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 v4 05/12] wcn36xx: Add ipv6 address tracking Date: Tue, 1 Jun 2021 03:49:13 +0100 Message-Id: <20210601024920.1424144-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- 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 9731fcbe2e7f..240ecdd52f81 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" @@ -1208,6 +1209,34 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw, return ret; } +#if IS_ENABLED(CONFIG_IPV6) +static 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, @@ -1231,6 +1260,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 Tue Jun 1 02:49:14 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: 12290347 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 B5475C47083 for ; Tue, 1 Jun 2021 02:47:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9132A610A6 for ; Tue, 1 Jun 2021 02:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbhFACt1 (ORCPT ); Mon, 31 May 2021 22:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232503AbhFACt0 (ORCPT ); Mon, 31 May 2021 22:49:26 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC08AC061574 for ; Mon, 31 May 2021 19:47:44 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id r13so6696043wmq.1 for ; Mon, 31 May 2021 19:47:44 -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=RACFcUJtiWm8MN8W1vtslkiqbwIBEQgKrtcO2mZsrAw=; b=cOF0m11FkBVDzMfncBsd7LzLkKEZUYeWC0NvZV1RYRg0WgjmDo4aJMmBmHJY3zHyW0 ld2wa+l9G6p7J4O741biGzu8PqhlWj9wF+gZqBl3B8eSlyB7AfcU3MpFugZHRgLKtMbX x1xo2rfup82dWaX+Mj/PpXzd1O2oz6SCursbIKwbRjxgWSzlZx7sZqCX7+E081v33tmM FfyFW7XSsfXnNZJDVwJBb0KARZiGp4vEDTaxMcQa8aCJ/x+DguyGvX6KsuDuK01W0lRT RI5hbNDsVn4dcCr02N4JqoShCzL1R/1ubsWCDK1pEshrA2kbN7uKJohulzzeH7jBhXgN oYGQ== 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=RACFcUJtiWm8MN8W1vtslkiqbwIBEQgKrtcO2mZsrAw=; b=p/dD7OM5/ThoiW1Xiqcg5fqtDUqmdYKJa7arYRFiMkx+R3ZN3JpbCg21RfvNSqd0sk 0fUuNkb4qy4kj4jkOjuEn8bWv5lhPhir7TMC5LYtM5WT/DgTVxdSFtHLH+A/HuMA2io9 wX934E0Jh/IPaytrbOBEzTUYkSA4Em8mP8vBpH59ztDOHm3AkmHqxKsRAwsjVDYNN9mF nE9/CrgWJ7ssABcPlRJB7GabGiCQhSk34SYwABV+C0I3o9xwIRXWWSypu6bb3LG7YHoD lGW5AvI/WUC17JdN694UUChi0K+ojrhuvj9eQMQbJ8g33MFBCot70nnhaCg6wu8grdmP cqTw== X-Gm-Message-State: AOAM530U+umC7W7JOndidB5c7RNOlQ8zHdho3TpLKNqK9OtHwrvKHM7C AaK1+D9CQmQuMDwEeWS2BDo6Qg== X-Google-Smtp-Source: ABdhPJwrNtNWcxeNlCNbjnolL1RZVAE+Rx6voOVfuZGyOsfde3M1UiTtQnR4XeItaiEomwzHDyBUMw== X-Received: by 2002:a05:600c:4f95:: with SMTP id n21mr1836829wmq.74.1622515663462; Mon, 31 May 2021 19:47:43 -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 e22sm16774014wme.48.2021.05.31.19.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:43 -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, kernel test robot Subject: [PATCH v4 06/12] wcn36xx: Add ipv6 namespace offload in suspend Date: Tue, 1 Jun 2021 03:49:14 +0100 Message-Id: <20210601024920.1424144-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/hal.h | 3 ++ drivers/net/wireless/ath/wcn36xx/main.c | 4 ++ drivers/net/wireless/ath/wcn36xx/smd.c | 63 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 73 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 240ecdd52f81..09e22f829682 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1116,6 +1116,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { 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); @@ -1136,6 +1139,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } mutex_unlock(&wcn->conf_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 478e363610e1..4a50e5f8456a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2793,6 +2793,69 @@ int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +#if IS_ENABLED(CONFIG_IPV6) +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; +} +#else +int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + return 0; +} +#endif + 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 6492a628ea6a..e03ab7878432 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 Tue Jun 1 02:49:15 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: 12290349 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 A3AD3C47082 for ; Tue, 1 Jun 2021 02:47:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A064610A6 for ; Tue, 1 Jun 2021 02:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232656AbhFACt1 (ORCPT ); Mon, 31 May 2021 22:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbhFACt0 (ORCPT ); Mon, 31 May 2021 22:49:26 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CADAFC06174A for ; Mon, 31 May 2021 19:47:45 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id f17so5759193wmf.2 for ; Mon, 31 May 2021 19:47:45 -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=EqMw+TK1CU976V2wAL6yPr0zVt+M7GcrRHHt2Qzbk6I=; b=E+9DcNRaXyopiRpXg0r8Us3pzCipide1qA0z4FYbcPo1NUlmx/nn+XnUPevsXGKbgc ZzYWfPj1J9vLm1CMAaW1obVZz0mZHwe6Ns6xhxHNqwPa51Q8t5AG4cGpk/0rb/yckf4w sDtqd3EhsDuhzEe+5QBVXpI8GY+chMpe+DiM0BycUkNpJ0zb6RxlZlwcOBu4FUFEvd14 5XeszdJQhOh/IW/Se2fQkmZKlh7yCMRY+KLJp9uzxy2H+sTlyHHzHQm2CplRkMTHrN9y w+WBh3s5FXb4corndBbAJ+u/B6aUazfR+Z6HNjn+jk0bnH6Embx0wTR6tnJcl/IlNj9c IFEA== 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=EqMw+TK1CU976V2wAL6yPr0zVt+M7GcrRHHt2Qzbk6I=; b=d87AIu8iUEaxuC3wnBnMpqB5rzkdR5ZSAHrZc9CpqdQjMJxnm5ZQi0pWHlKSNYwuV9 JSx7a+b7SB9LXj97g2CmQJ4OSDBRvD2ntOUKPOTV2XcP080eqDmIF3Z5e49Plq7lYApo w4Bx86AwTN0yD8AxATmqkp+ZsaTw/IyceRSXPlhosUZu9dCR7iPNWI5bwXONV7akbQET qGOyTAz7vI9uq2cyyS7HGqO+VoAAzW1eY0n7kzXstkZy9zadkieUhCuv1eds8EVO7va4 ftbw0KEyX+rxRsbGuKgFhEPaA7J1px29D7LaK6+tLDsGByRGXewRXiHTv1EmBuDOt0ay qILA== X-Gm-Message-State: AOAM532av71oywYaiLTFnrsmwMVTCXp8NtOcjBrqK4+864/AQrANdx1H oYRdiKYp1lgba5SAIo0ifTX68PAScwOgig== X-Google-Smtp-Source: ABdhPJzOWbOG0MMSAsBYEtmque+ORp3fWExYBbpmNoqyYP81L8N7fK7qoSNcFn/9uFF9rXbe0nCFuA== X-Received: by 2002:a7b:cb1a:: with SMTP id u26mr1774142wmj.125.1622515664518; Mon, 31 May 2021 19:47:44 -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 e22sm16774014wme.48.2021.05.31.19.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:44 -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 v4 07/12] wcn36xx: Add set_rekey_data callback Date: Tue, 1 Jun 2021 03:49:15 +0100 Message-Id: <20210601024920.1424144-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add 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 Tested-by: Benjamin Li --- 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 09e22f829682..ec32b8b0067d 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1147,6 +1147,24 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) return 0; } +static 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, @@ -1249,6 +1267,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 Tue Jun 1 02:49:16 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: 12290351 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 3087DC47080 for ; Tue, 1 Jun 2021 02:47:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 184A16128A for ; Tue, 1 Jun 2021 02:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232731AbhFACt2 (ORCPT ); Mon, 31 May 2021 22:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232691AbhFACt1 (ORCPT ); Mon, 31 May 2021 22:49:27 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C13DCC061574 for ; Mon, 31 May 2021 19:47:46 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id n5-20020a1c72050000b0290192e1f9a7e1so949770wmc.2 for ; Mon, 31 May 2021 19:47:46 -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=CJNEkd9odSJS4sHsW2fkqbqVW7PMvd2b9q+phGy9YsI=; b=WNY3d5b2XfAqZwc3npFOEnbJiCzmBkCHr8VspurAkD1f0X+3PN/TOYFXREcUnRZjOF 4fkKEKrDvoof6HayMy0qswsVwMk2wpTRVGpA6oAwT+NjUiHKgNg/aRbq5gvKyiHnpZdc zuKLCRuAo9It7Lu3iwL5gIE+yo93XY9ux6l4rQlHhPia89wegVNHjDuJJmpd0uuR+nZQ C/5Eg/RYYlfYD1nFl0ZxCGgsIGyIO8Q3+I4hasav2BfN5TgnVFl+Mm3jn/C2rrbs/6hJ c8CXFvBopJxQ7hwqtcKC6S2GYFy9x4EIsN86p533XH01/S/4HSTV4ptl6zBCnNeItviO /CdA== 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=CJNEkd9odSJS4sHsW2fkqbqVW7PMvd2b9q+phGy9YsI=; b=cW1CzSoglgDHgZTvmIo1TbEVciTjPkv+0EcXdD3LH8wKHZDnQc7/pvv+arw8InBseJ XHl2i9949tIXjW4ENK3diVsJRsEI0vo8EeMT6wHD8bNr3tb0zSXBlR+6byF2Z6lj2xSo mTy8JNq4L8ykbxkv9rhvPeMn5OsC/kJ/w051QDEB/3iNvt435GZK/JltdQ5tBbd52mVn hv91VWbsaLFI7kYLRtXdNHKO5UVqP1XLFE+UwYTEu8TOfzmaAqQ23Yx75QpSt1KVgUzW wDjPCGA0RC1o/fGcn9B132GymXUc+itFIeonyiSYaYTFknCKefs4FwnMJDB2S7EwovFD PcWA== X-Gm-Message-State: AOAM530YXSLQoTngw/3jWQ7h1CTNZz825B7FesvZAWANlqOYWlMVF/Ty bmc6Xk+O8tE6iFA7jddkVnwX6Q== X-Google-Smtp-Source: ABdhPJxnqgRV+c2V7Detzoj1ffaFDil9+1RsoRcSXp30OfVyqegmFM9tav1dYYlRTHFKJS+QvYbVCA== X-Received: by 2002:a7b:c92e:: with SMTP id h14mr3960939wml.51.1622515665432; Mon, 31 May 2021 19:47:45 -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 e22sm16774014wme.48.2021.05.31.19.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:45 -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 v4 08/12] wcn36xx: Add GTK offload to WoWLAN path Date: Tue, 1 Jun 2021 03:49:16 +0100 Message-Id: <20210601024920.1424144-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- 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 ec32b8b0067d..db1528a14757 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1119,6 +1119,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); @@ -1139,6 +1142,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { 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 4a50e5f8456a..f74cb16327d0 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2856,6 +2856,43 @@ int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, } #endif +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) { @@ -2905,6 +2942,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 e03ab7878432..cdf4231efe26 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 Tue Jun 1 02:49:17 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: 12290353 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 0D596C47083 for ; Tue, 1 Jun 2021 02:47:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E46D5610A6 for ; Tue, 1 Jun 2021 02:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232741AbhFACt3 (ORCPT ); Mon, 31 May 2021 22:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232726AbhFACt2 (ORCPT ); Mon, 31 May 2021 22:49:28 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B182AC061574 for ; Mon, 31 May 2021 19:47:47 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso542760wmh.4 for ; Mon, 31 May 2021 19:47:47 -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=SzCu0Os7QusVy/mnoUQrDSZnGR8B3iHYzezmZSLH1gs=; b=PlzwALJjIHlluBvG2dDSGygs7LmpdYu7BlvDDUHP/calXA4fQGs72CrewHwwbuCuPW 5L1+m8H+BdaqqpYx+OM/gHhn0Jfso8WmwpcCE+pJmNuqG2aT4/e16hbG31UAYsK7IH/l +mkP0xRBiLiU5hL7WoKPY1UQAAJscGv5ycxCgqttwVCWl+ErnoZR0DtBStXr9hFrwmBy 4k5wj+GYdgu8XJyX7tgB6EoBeqiYvzhc0pa3Ufl25FGN7CuNKB63+kISLWTnZwWVFFhP Sg5mgfboytDttJcVdDhIptktGxcMQlTbWwHsl4EOs+wj/AgFsXRK9pq5Z5MeItv4dqOC Rh3A== 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=SzCu0Os7QusVy/mnoUQrDSZnGR8B3iHYzezmZSLH1gs=; b=GSRvq332sTLP35PCyqbc4rgPOg10uvDRuNzAgqPxrUeKlh2xH3mfRhQK+AZ2VHZoWz E31HPE02vamFr8eUlrVDwRPlADaSDtL8ePgF4VoUnH8cv1AD/or+5rsoaVMljHdcoZI8 b1O+fm3SSGgAIKP8a6u8It3km7esYuxjXivIAvuJ8NCbCsiWMuj2ORIkg4wzSNPPFTSC maqrzRSQNBmF9muC7hpUxcx2rLZU9dVf7wUc8F859Xjs34DHiOjCSS3imVp/jPQSKoEL txIKk7lScOmX4Ihr0mBRSTG2bUoS0/1LKIIGPjo/VrS2OR9v7Ei955YEyEIdByzqLxi2 PqJA== X-Gm-Message-State: AOAM5332g+vpSPraDV8FSXL0VmQr1Grl+dK4KFDF8YGa1pbB2xyTHCEx SBnumNEP5dXJQJdG5yIOVQgxyA== X-Google-Smtp-Source: ABdhPJyA+0tk5b0OM6OUH07yTbpCS2i9GM7M0zf//r1VT+XwPJbYTAL43V9am2rI2ucY5HCl8cEY+w== X-Received: by 2002:a05:600c:4fd6:: with SMTP id o22mr23680953wmq.83.1622515666386; Mon, 31 May 2021 19:47:46 -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 e22sm16774014wme.48.2021.05.31.19.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:45 -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 v4 09/12] wcn36xx: Add GTK offload info to WoWLAN resume Date: Tue, 1 Jun 2021 03:49:17 +0100 Message-Id: <20210601024920.1424144-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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. In order to enable the SMD command and response we need to pack the existing command/response structures. Given these structures are currently unused, there's no need to backport this as a fix. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/hal.h | 4 +- drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 72 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 78 insertions(+), 2 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 db1528a14757..8e5d8326d551 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1142,6 +1142,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { 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 f74cb16327d0..e249971c4ef7 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2893,6 +2893,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) { @@ -2943,6 +3014,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 cdf4231efe26..90c7faea0ef6 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 Tue Jun 1 02:49:18 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: 12290355 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 40131C4708F for ; Tue, 1 Jun 2021 02:47:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 288A36128A for ; Tue, 1 Jun 2021 02:47:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232769AbhFACta (ORCPT ); Mon, 31 May 2021 22:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232707AbhFACt3 (ORCPT ); Mon, 31 May 2021 22:49:29 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D903C06174A for ; Mon, 31 May 2021 19:47:48 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id f20-20020a05600c4e94b0290181f6edda88so553156wmq.2 for ; Mon, 31 May 2021 19:47:48 -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=m7tgQqGtDFs1RDJ68kf8vBszyeLOJelji2axp1aENbQ=; b=AVGYpXFbDaAJdRho/4pg7qfMPZvEQIPAHvwvnEi9TenBRbEeqp6VWR5NndblkL4gKa nfnh8/BW0w849hdul8AvTOrp+M/PUszANqWRfdCumGrDcvzkwb1EbpkEOmB5GE5iyTC0 +Z+Q0+Le2/9x/35xQWKWH492L95mUhKWJcQ33BJr4842zbpoXK/2RmMtH3tKdZpQVmx5 sM7bbdTH3vvw3F96nJ16YEkN/WQ3yBLPq77OtmK6Mj6xX2WszBmvZLYohqTtHGDl9hig ZpRQM8hWCE7u77SNgWl4Ettg4IOAYyCXFjzZzT8TmPjZFhQuS6HUEZX/byEOCM/wVeDQ dljg== 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=m7tgQqGtDFs1RDJ68kf8vBszyeLOJelji2axp1aENbQ=; b=TlJapx/F4DwQOjXU8qiLEyCUYer0FcSc2rdUKrLIi7X65Wmy76WuttiKJPBe1A+O9v gDBML6IBoLLsr4K0tHUls3nrATswaWEuL1RS0LDSYlW1CsrAT3L1DETqzYzs+TMwW2aq LvcK/opwxVCxBVIrxal7NePT1yUJzgrVg8+odVlYJsAJpRUpz1hCRBisggd2YO/R7MQR lzIr5E7aeQ3TOG+jOA2QTF+iMS6B11xv9tGdquqbmbhSjghkZjXyU7ujoqyLaRRpBmnw jHAbytqU/JNUMRWw4/Yubu6ZBQ77KrbpsVwCUawhHd1OGUHrO68q4XCmGnKEMKU7/GFw eYFw== X-Gm-Message-State: AOAM530Au4VHJGF6hCOxn6OL0QQzS0FQymrBRhJveXY/pSW5PuJYeglu 11a9wPSyITqrKWRDRJh74hnjKA== X-Google-Smtp-Source: ABdhPJxbHh0K32fdM5e3MobSHmSVDv+JdHYCiE9oWAjQDbtrhgFH7VcfRypZ/iBunaJHX42C9cCX/A== X-Received: by 2002:a05:600c:4f15:: with SMTP id l21mr23688001wmq.37.1622515667331; Mon, 31 May 2021 19:47:47 -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 e22sm16774014wme.48.2021.05.31.19.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:46 -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 v4 10/12] wcn36xx: Add Host suspend indication support Date: Tue, 1 Jun 2021 03:49:18 +0100 Message-Id: <20210601024920.1424144-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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(+) 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 e249971c4ef7..302877d23ecf 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2964,6 +2964,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_ */ From patchwork Tue Jun 1 02:49:19 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: 12290357 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 7CAAEC47080 for ; Tue, 1 Jun 2021 02:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60539610A6 for ; Tue, 1 Jun 2021 02:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbhFACtc (ORCPT ); Mon, 31 May 2021 22:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232772AbhFACtb (ORCPT ); Mon, 31 May 2021 22:49:31 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7CAC061574 for ; Mon, 31 May 2021 19:47:49 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id g204so3946768wmf.5 for ; Mon, 31 May 2021 19:47:49 -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=A4tsdVSzTEyTW8xfDSUd84WZI63N7G22QirTh+/x9MM=; b=NaxWwqJ4kuAqQ6YBlZSP/XPMSGMrQNRtKWlcZPWmh88K164CJkr4NkRXJTFDTgxWDZ fUkvRfP4BGU92DNnpZ+TBMDljZnV45prUoiLgz6u62BQ2WcLC0szDk7DP8NdllczN3UU icqEkdVqRx+9BXvXkSSh+5UZSf9O0SFNXPobIBmTtklc0X5AmZF9HzU5Eq2pgPYB8rFu SdAgAiCVvgWQ+1tTFNN2KComT6zEGz/3Xal9dOzLjYs58VvafJF1tRD2h1HJ60pPp4Ck R4wES8IsnCEdFRojN5M0elXlZT0QCaCuq8nziH0R8hHRLBfX4IXMvLKxMTGu8rOoqXFb 3iMA== 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=A4tsdVSzTEyTW8xfDSUd84WZI63N7G22QirTh+/x9MM=; b=HY2bUky7ddZK9L6S4TDcnSOa8LdDPRETxOwJ07jM2ZYE1w772Onm5fFn54JNwGgBxU nNsUH7Hv5DPMj9C66EBB0DTKnSdWNyjAVeWPQtkRkSO8AmWRedyn4g5Xccgpp/3w90Nv U3sLHhUGb8fg0gZd83alB1SMDN+o0p2AvwvYW6wnzicAlf7R+iZZboY4LZFeCr4hTqHZ mnBiSJTnH1+RSLyVYjJjTYO1Ep6iG5QdzL8xpNet0SjRwRUjsw6DvTgwDgr+F278iLiL 9+LFLZ/lruPhZJnEVHXwdXX3Cg8o8Njf8hWANeRVGqucbl0J+cGaBq8mK1g9c39wgMXT dKfQ== X-Gm-Message-State: AOAM531txa9KM/dR7hD3iB2xSoELayWkV3EdvkH8iypA/ZQhxnQEfFHe AD32Os4OXueaw8pj2T44UWu/8Q== X-Google-Smtp-Source: ABdhPJyjeEw76N17TxLbS/43AJZ0eGhDaK5hkqbRcvQFQi7kXNTrXOxgFR+W2Gp/RxL5OSbWrCHXPQ== X-Received: by 2002:a1c:4d13:: with SMTP id o19mr1839389wmh.100.1622515668263; Mon, 31 May 2021 19:47:48 -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 e22sm16774014wme.48.2021.05.31.19.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:47 -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 v4 11/12] wcn36xx: Add host resume request support Date: Tue, 1 Jun 2021 03:49:19 +0100 Message-Id: <20210601024920.1424144-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-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 Tested-by: Benjamin Li --- 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 e4d5e4d597f9..c697b9f3633a 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1144,6 +1144,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) mutex_lock(&wcn->conf_mutex); vif = wcn36xx_get_first_assoc_vif(wcn); if (vif) { + 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 302877d23ecf..de0f630a82be 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2983,6 +2983,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) { @@ -3034,6 +3068,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 2909facdb100..d8bded03945d 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, int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); +int wcn36xx_smd_host_resume(struct wcn36xx *wcn); + #endif /* _SMD_H_ */ From patchwork Tue Jun 1 02:49:20 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: 12290359 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 1D1D9C47082 for ; Tue, 1 Jun 2021 02:47:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00C56610A6 for ; Tue, 1 Jun 2021 02:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbhFACtd (ORCPT ); Mon, 31 May 2021 22:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232635AbhFACtb (ORCPT ); Mon, 31 May 2021 22:49:31 -0400 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 A7E53C06174A for ; Mon, 31 May 2021 19:47:50 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id c3so12565100wrp.8 for ; Mon, 31 May 2021 19:47:50 -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=oAnhL/rLVHOlPObR2Xdk1DvWetZIgbSOpJEsqp74oTI=; b=OA4gCqTbsLsEhcNO2pZR8L33MzGKjL2SwFaNq0vX/cqVDr+/OBPjmYEctfBgnZ+OA8 DZYJOLlF0Do8ORsMYvT9sVktR+SsV328n1nZeajNtvF1+vluI0BHz7qm6W9Cygw96Fmu vZffYz7a4Qta79uwB82EihYFs58ARqmsnM05vlQ1d2PbYhFAXF6IJlBtuOptUln1ftvG jKmfjgHSJl0pAoQn5f/gukCgb49CgiNpDcifKDIHsGheCLcaTvuddOGoycxED49pIoa7 TYbLdgY/q3E38Hw+560ZZYqm3UBzLkZPXj4KhA1msA/tJuMXV0epiXH1OQ3XRnYjtogP KlOA== 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=oAnhL/rLVHOlPObR2Xdk1DvWetZIgbSOpJEsqp74oTI=; b=SHMcc9xc9H6lEYmd9YJgjh86LOeitBkwCBvrD4Umc+rTq05mivDYpPL1iaNgLYtr/7 grXZRdopbAfjqu4J6Jk/ZU4dWNfJNCUMJ+dNbhzfDctDTk0Vj4wuX/rla6Ipcp9iSoqu cNPzX/xNGVZ522rbeY5IgFLd9VUZ0FxYNqYoMzF7gpYGWh2OqFMXeBaiK/NWN2UkBJk6 uP2FpqPfqfxEQnce+ij3LGhGmrTJdh0yMkdRx02YQLEBk/0Gey87gaPUTX00pjbqWK7T q4Fex6tbtk++sOSzbUXJ2a4gR4NN3odsOHoxCavVeHnT4vBFe9MJdUN+lTzDA/VxR7Ud LLqg== X-Gm-Message-State: AOAM531ddzMzxSYKI7qMsFIxJdYbnqr5/ogU7PfLfzn2NMf3O5WFQpDv yeNCphFRQTQEWvOM9XmI0346mA== X-Google-Smtp-Source: ABdhPJzoqDBhSQeVvO/S9RLLUIiLnsnqx7setPoiCnGqYGXOTZkShVx9bRJLmODOARwgaSBoocGc5g== X-Received: by 2002:adf:f805:: with SMTP id s5mr6707222wrp.231.1622515669309; Mon, 31 May 2021 19:47:49 -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 e22sm16774014wme.48.2021.05.31.19.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 19:47:48 -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 v4 12/12] wcn36xx: Enable WOWLAN flags Date: Tue, 1 Jun 2021 03:49:20 +0100 Message-Id: <20210601024920.1424144-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> References: <20210601024920.1424144-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Enable flags for - Magic packet - GTK rekey Previous patches implemented the necessary code to switch these two on. Standalone magic packet absent GTK rekey is pretty useless, so it makes sense to flag both at once. Once done it is possible for wcn36xx firmware to 1. Respond to ipv4 and ipv6 ARP/NS lookup requests 2. Bring the system out of suspend when a magic packet is received. Magic in our case is a simple ipv4 or ipv6 unicast. 3. GTK rekey whilst in suspend Once we wake from suspend the GTK will be updated as necessary Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index c697b9f3633a..3a4e383b3a6c 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 + .flags = WIPHY_WOWLAN_ANY | + WIPHY_WOWLAN_MAGIC_PKT | + WIPHY_WOWLAN_SUPPORTS_GTK_REKEY }; #endif