From patchwork Sat Jun 5 01:11:29 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: 454679 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889545jae; Fri, 4 Jun 2021 18:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOHsEHo2pnQyb9CGp2bXC3HZZk0LU7RVFY7zobWcqOLZix8ghRa1GNYEwSQHH4LJOcUEx3 X-Received: by 2002:a17:907:693:: with SMTP id wn19mr7094053ejb.74.1622855470044; Fri, 04 Jun 2021 18:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855470; cv=none; d=google.com; s=arc-20160816; b=OkeayyyrxoycqmPxmnX+Pt6T4T/G3KE4Z3jRvCGaQDSnMk4dHMKwawAvMP3J/2JzXW ipK3spNqb/+kZ+QMmdZrRtvlcnzR9mFABK108oVHxma7jfJDbsiQxdDk4cizl5hNbuDN pQHIPwqhTSaSNlS6qZ+FrnzgYCsKdp++pRuGkDdk7KN/E388fs4QsDuXyBoQO0TtoTpQ q/kiLJSiozBgpUMhLFB6jZ2hH2BN68Sh4dg7ar0VaOtAFFNDSBJYCBXQ8s9PFkV/kBML Th+RClvlplDC2vee5fc+wqAIVbnCcBZdHYVgvT1WjL+xEpdL0EsnASrnF6hNMHTB7ACw tAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/kuNaO+3BN/9XKW0uTC+mnQ6gznoI5jFyk7Mscc9K1Y=; b=ws8wgFapJsABVTVG351+KtbS0U5vAyxF4D/4GdJZnaswT/z65F3fTiqZoyg1LtQfaT k7CPNx2+O7Bm7qUliQS2zYX/FKxlR2CLPQ0vF3MPUPPXrPiMpSKM0tP4iQ42khC+UVNf JJCoZWe8B6Z/D86WOhWNyAIfRJw7nFI1mR3J/oSfpqSnws48q4HkmonbvpX8jeoiET2o z2RRHwMLis+u4ALb0U/Mq/Y93QN+dndXUb1phFg1EeQ+/iD0Ny+sUYlfUlJ239GoXAoS 3J8VziyJRfMfarmHjxMYATyPwmrFF1Uo+qUdFUGNhAN2d4iKed0ac7MaB+g4HKovZHKe IW3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xVXoCTJK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.09; Fri, 04 Jun 2021 18:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xVXoCTJK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbhFEBMz (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:55 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:33677 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbhFEBMz (ORCPT ); Fri, 4 Jun 2021 21:12:55 -0400 Received: by mail-wr1-f54.google.com with SMTP id a20so10994698wrc.0 for ; Fri, 04 Jun 2021 18:10:58 -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=xVXoCTJKppd+snLF02kWT+xu9IsA8qBQXdLxL8E3FnP4qeDoY+psq2KBy33A5FHbBF NGEqCXTSI2uiqznDJi0A6Qi5FCQ+xbpVyPiyVkuyLkAhCgRuGm5w8OkYTz8WB+LWv2ug qsXOgAxnHf/yvC5kG6CP0BEPdQCUqtj+VKc091936hCRaQY24swbPc3g9x+ZXXGAtlUF LmvqK+T4e6upLtJHwJM7x+4T4hh8Lb110VHEYeua2DWtgsXJ3w40BDgJSgfKGyfVCq8C ggzEYWVtXLhFTNeJ7xcVzWDEzAglhkpbB36wTY3qAqWhJoHWQ4lfS3xLFL6UWPJBaKiX iRoQ== 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=tBYN9AeYhzwDVEgvsfWLLQ5Q7kyKd1WzywIUPL0S29LchJWcCMabp8+K/TZDbDfOm6 Xfre62kapcmWAn+SsP4g70qRZk0FuMszlvNXz49skT+5PEUt+ZuWJpi6Xyb2XAF12yQ+ nDHDE2GXBYrvmKdjMsC3IysMFGPqalwXLx8QqdspSZLA9QuHCbGxZzEeJ8ER2YOEUk+l 3Dj8fQPZ69v8Veo0NjTZTqtDKxponJ/6jxF+WPX0UVG/RJq/pn0hebPtpyIdaqRqVfzj 8rtde4StfV1s7amMx7U0TLq2nbJEnyKvr94caxXoshlFwGXcfw2zwR/DksjUcnnQ9SjJ EkWQ== X-Gm-Message-State: AOAM531MwVSqMidcPx46+9UJPdhTEELT4hiXFmkBkG4eAyTeVxMpDm5d /rVCL7x8LPcdmkRNpNLpF5UijQ== X-Received: by 2002:a5d:4c4b:: with SMTP id n11mr6476211wrt.269.1622855397717; Fri, 04 Jun 2021 18:09:57 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:09:57 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 01/12] wcn36xx: Return result of set_power_params in suspend Date: Sat, 5 Jun 2021 02:11:29 +0100 Message-Id: <20210605011140.2004643-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(-) -- 2.30.1 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 Sat Jun 5 01:11:30 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: 454680 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889565jae; Fri, 4 Jun 2021 18:11:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGhlitmbXzfoswplAOVGIAtROSSAeN5wm6CRak95qwjfm+yZsgD9wxnZcrCKjfurvwgWn/ X-Received: by 2002:a05:6402:138c:: with SMTP id b12mr7752427edv.268.1622855471136; Fri, 04 Jun 2021 18:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855471; cv=none; d=google.com; s=arc-20160816; b=ierNnWxyeT+atSq4/kdbG6npxTAc1TEiBousgQsQaG1aonMC6J6jyhYIsXvixaw263 BRzr0ZZyEAu6yYiaNv4lL01yCEBT+OAc27CRQeSX9acBD2rdJu9gonSnccp3NnagnPKk U/qjWvkpTzLn/GbwTVtq8O5307paIVOvhGL8i4YtQEOBG1CW17Dh5CHTqT0BwiJBne/Q /6Se0MkcrE8G4SkCsRy2ItAzw4HczHwrr2ayoMVuDkMU3/ShfgyuYtlUQVn8W3WWPevA dXrKsJ+s3R6jODhjJ4EWaMVGxF4DMNgmBMJ/3rkOaTr9eQY2aFEY7KrxUb7vzN6o5IQY U/xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=iKgefo2duBFu0uEGrnWEvZkjvqXeXHYIbYqDBVVtlm3aF6VCHsQn2DVCo0oj2EfaPZ YjGY/UE8l7h80wd7PPMl+nS6tKqVLm3PpDTpTt0E1kM6OLxkRHKmCNE/h9pFpEtIebIU 2kNxrPRZ/LRoTE8WfXhAcwvtwPJetwuQje+abJWypsmk+6Xn3J2AnOJtuT0R3ObFsWK3 f7OYZUJ0TCzzoR0r5NyZ0JZAkIsNUr2ow/gyVJiIyzm0dXnPCwu64imfzF1xvxdzn9dj 82THepbygfxu2jApwB97w6HLwapSjqyY+bnNqag79nSKmrN1id0uys2j76BHAEzFrrxS 7cCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NF/cwqZ6"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.10; Fri, 04 Jun 2021 18:11:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NF/cwqZ6"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231229AbhFEBM4 (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:56 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:35480 "EHLO mail-wr1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbhFEBM4 (ORCPT ); Fri, 4 Jun 2021 21:12:56 -0400 Received: by mail-wr1-f41.google.com with SMTP id m18so10946281wrv.2 for ; Fri, 04 Jun 2021 18:10:59 -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=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=NF/cwqZ6Ubzo4pV7cu65rgWcEdGWB5wymDbcsQuIkGi1LgTpPDlHB6xbU2iNhV5xlV kvM/jq/ftKX/i/VyuGuabC1wuhZUgS5Lpa38uAeYJidXWACYL2od97F+9rwlE/MA/kLf F9TJGKTKDLaeTSm7bAGeNnTdMKcJL92sDZ6Ch1d+IchWYXj6DAnTISWsWOYOF3YhK74z EBXf3JD5MidAa65Ox9hz81o3F/mWNueCDzKbz/znvGghjOwNrVURbm7d1mu9AxVKBLdB kAlC/elIkXNVcIr9kAlvm3np71E+O1FDnY7ZmR6ESSeBjIvAuQXGkZg7iZeLKbOIYQj4 zR/A== 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=BDB2CUDPDaolV/e1QpwHthEeMSH5hthfQ21cne8mw4A=; b=pyXiB9kn+7b6X9NARdLPMIeNkUmE63yOtokGkuQ1vgYHZzxKEUYzFczWGoEYV7eDkX 715JGorRXgw8YfiG3WBdMag6+UwpoDZEagZDspUgqmmeBW/ymBKIKKDLbaSjqJMPxZJo D0tHu5BrnWvKZ9dD5qPhKQzSCEfv5KviOsRc7BHb9yyOgOB1uN0rpRxCxqu91wkaFAHx kecxyB7cMb2pgksyJA8wjWQRjLXmEmY5X+j7FYen398ELiMeRbW9mk5rkttzeDavpxeR 2+MBDdnvJksrTMOU4fcoWX5r6v60E5zNXnPJyoR1Bq98aW2+7dokTdjmAGntywKRDs3A HdCQ== X-Gm-Message-State: AOAM531ps9nLFCyEetcFWbwYVbMbmu+AhtAkaZhCw6au/i3OE21CImps rYhLp31QHJ2mvBAVhLw1B2Ctbg== X-Received: by 2002:adf:f346:: with SMTP id e6mr6183011wrp.179.1622855398651; Fri, 04 Jun 2021 18:09:58 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:09:58 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 02/12] wcn36xx: Run suspend for the first ieee80211_vif Date: Sat, 5 Jun 2021 02:11:30 +0100 Message-Id: <20210605011140.2004643-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 | 31 ++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) -- 2.30.1 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index b361e40697a6..9a97a288a96f 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,17 @@ 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); + mutex_unlock(&wcn->conf_mutex); + return 0; } From patchwork Sat Jun 5 01:11:31 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: 454676 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888699jae; Fri, 4 Jun 2021 18:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwte39FnPrPbNo9M19e1ydAztXkYXvtWcUVGlgv93R9pDRxZxemSPz10vh0MjLwWlFCo/CD X-Received: by 2002:a17:907:9612:: with SMTP id gb18mr7001675ejc.408.1622855417526; Fri, 04 Jun 2021 18:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855417; cv=none; d=google.com; s=arc-20160816; b=DO8sopVh3UcgqZj1hUd7nb7mCFwnpbJ1ZIilU5w/t4h7JVRxKS7Gb8CRix7zF7O5K8 mHBbh0NUL0kZq3TGARk3uwqESVvOsGg6w71TnfTl+CgzbRWs/nk1SlIj+n6/294tG4C2 kZayTS1kDcdYvn8ox2GUk+UvFSGKDqInI6hy3FPVlojmW/eVjbTXquepAr1kpscKaMki 8AOhO1hIR3D331o9cu3B/JEzcoKXCbor7IL70WZRS5ugS2mgjbgFqOZW7IqJsKnqsJcC E4wyg6tzdooRxHsv4o0jvkvL1wASW/2KmmDR9whX8pG8yzZWABHaVIBvN9NDrkZVXAiL FECw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8AUXLUY8VCW5F1ufkPQ70OsRXxkMZiVh0Lvonqi0Vbc=; b=WMBZv0ZveL+yGmUmdyVdR5rMoVFxZcBo4PBNj5/MzxPrgcaDfTkYlqPQTh6lRPgLQR TEe/JtE8caq7PxHE5RS/jcOoB0X1lyBpDRX7G9LxFTve3FJmOJ6qP2gPGULh6Ypn3guS yi/6FVamRAK9At/TL6Vd3om7emRk68EYdqOatnFv/D8KHE78Qs3amKwvzE7tHo3wo3eH YbUjaMkuniLwTT2i2ZyvM56c8LXy0yPCNCGWOWMjQBmTWOEqlPVbYF1sgAEdxe0g0/Vd A6PXLn2Bsg+5DyWms6X3v3nMJ1aU4UDoShxJLu26VR6evPP2Sb7YgnkrOWlEupgeGJHD hzcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jNWI1SB8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.17; Fri, 04 Jun 2021 18:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jNWI1SB8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbhFEBMD (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbhFEBMC (ORCPT ); Fri, 4 Jun 2021 21:12:02 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011C2C061766 for ; Fri, 4 Jun 2021 18:10:01 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id t16-20020a05600c1990b02901a0d45ff03aso5317833wmq.2 for ; Fri, 04 Jun 2021 18:10:00 -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=8AUXLUY8VCW5F1ufkPQ70OsRXxkMZiVh0Lvonqi0Vbc=; b=jNWI1SB8NOYZ/KxhewKOxtAg75E+RbTDUlZnXKWs6H3/LGdUWe7uwNZo4IO51KVjPe HLrl7fDqODipp8jKrgoNcPCuW3Ks6qFwtQT2Fa4gHyokNIjTDoejLVSQhY2T1i3qDr3z baTgiSsAwF0zICXsgZuh9ZRdeMeguDb4c1t+KDIPgELmzJKDHRwp7KwdNVmyKajHChu6 VgDJe4p87kpD6jcqTid2suoab6nxjb6m/lyfWkfRAaIuKwaouJWHdGm4gq8Y7XVgQbtZ 2UZCu8rkpt7DV0isI4dxpaF2owlJ49cd9lEAj1oSZz3FhsFGrXsGdiZR+crZmLUFreUG UCaQ== 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=8AUXLUY8VCW5F1ufkPQ70OsRXxkMZiVh0Lvonqi0Vbc=; b=NI8Lkc++t2rT1pQElC40lGpesC0AOeWMtZivRjxOXr0+NP1Xp2L4PRUbavZJqFCRu3 g49568Ly6VoEtr7sDD2VuW2A9JhrnxFTnJV6Jf6dq6jyA1S+kHxQovN4lr9Qrdx0vNFM 1iRc27KV86KshDxmcc+NjUvozAPdjX7VQULE0IIwPzCfNrb0d1qpXjCGyKYcpw1Ts2+m yUbq69gIymr7CmwZEii5rW3rj7OAFEm7QQVjzbwnuTfiviKDH/NYkH/iMCKEQzXyXID6 Ih6oZ60vZv8W3dvXtwSolIhupkD0FvlIEA+K5zCK1VWHQUTAsynJb6ZbznbIPGUN9QOB i2Og== X-Gm-Message-State: AOAM533P5sv29iJ7udDv1kKORYNTXpUjBnPRYN2xYiKIjqcX7N14CrGK BZTiP7dQ6Uyg2tHGuD1Gk2cv6YKMVgQemHyI X-Received: by 2002:a05:600c:154f:: with SMTP id f15mr219831wmg.116.1622855399582; Fri, 04 Jun 2021 18:09:59 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:09:59 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 03/12] wcn36xx: Add ipv4 ARP offload support in suspend Date: Sat, 5 Jun 2021 02:11:31 +0100 Message-Id: <20210605011140.2004643-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 | 13 +++++++-- drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 +++ 4 files changed, 57 insertions(+), 8 deletions(-) -- 2.30.1 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 9a97a288a96f..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,10 @@ 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 Sat Jun 5 01:11:32 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: 454675 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888687jae; Fri, 4 Jun 2021 18:10:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5b3mQBks99sl5S/HdJXKlFxlkkbFx97NZWGjDNk4ru1oIg7dew7E2cswb7U25zTxV4j+j X-Received: by 2002:a17:906:22c8:: with SMTP id q8mr6716281eja.12.1622855417030; Fri, 04 Jun 2021 18:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855417; cv=none; d=google.com; s=arc-20160816; b=tRDmm5EHnCFcDXqCA8BKVWxKm2sGMC2mQgjzrwhKR5YtEBJaqhSnJDrhHoWXrtcAvQ cRBtRO4v1tXSgYI2I9+fmpDTpxqa7bwUyA3WS2m+fRmbWfrSerZWxw2dcseUvyPBRgn6 npE0aVmJyqwIT2GMOiVnFs88zBRLAy4fZrST6ntoWeJE7V/iYLYGDijNgZHkO9CsPFk6 RK3KuLfNn/dzIS1n9Wa4P0xPuIbI1lTi4esVf4rnR0/eIH8rpNH2P3pMWhWJOx93vQ5n CfGnGiDTF61SbiuVbWS2sIT9qo5gBBNAZA3ZFQpNWhkDPOkFPQUsUcbSSu6FYEqzhorL 2S2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SquAaKfKT+XFRM7MHN5IY0d9iler2O6E6du+Hc36euc=; b=YlJO/Ox0dkM0BWqQ5pFT+FnqGsI28P8ms/YHyxSvPDSHy2cEcdouWLqTlC6QhDn5DK tZC2yRBAxYYPfSEeNkZfbTevq9RvwDFtokvs7MB76gvmJKuxt7Mvnq6G6SlEVQyk3Uyl fQnnfHlPOd2pyXMvx2ybggCFc8RymqUmLMX/GYpxUmZurm3DsU3Xce+4u3zLuTtb3M38 I1J8F5lSoexTUSRpSxBiTQd5YdE84h7FVhBSggIpD8Mgv/WjVLPA/iVrzI2Q4tBB/U7M bvNfdkiIIzYPWtX+P18V6qS+jgQOY+bG4zHD1kkqVu7B7c09C5wuwhPKwJOyX79ssoSO vkCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mba+tniF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.16; Fri, 04 Jun 2021 18:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mba+tniF; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231260AbhFEBMD (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbhFEBMC (ORCPT ); Fri, 4 Jun 2021 21:12:02 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDDCCC061767 for ; Fri, 4 Jun 2021 18:10:01 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id u7so5499142wrs.10 for ; Fri, 04 Jun 2021 18:10:01 -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=mba+tniFLtfhiwBsWBMsKt77/WW2VOYAGlXLXJOM8SgywJ/Y2xbqYwVxuxPg2typnA p+us60xXcK6NDg5YK39MelHe/B8dXJe2IUIFIZnYgOXnJ8LWl9fMmazkdT4jdx/E7P7D D8dDl9RSR8jCQiWhEQqzN6yEqZ7F05l/9uI1Ttj4n9WXg/g0lpmzF9q3YEtU+AoNyV2B 6K/PO2tIINTEcYmBK4+ckVqSlW9kml7PM2l+vnHb+BC0eme1DCR88Z5SgxtDy2+nF9Dl HYkS7i2WAtuB0e9TZVh7kxVPtrH1rIgL7aKg0rXr079oLxIz3xnHvUzT2IgokVAt4WLt S+yg== 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=AlzX6XsgsVzXDdwW4JdZHFXFru5WnMkzyuTwSL4+pNwg91sTMug59DXWh6v7WddXKc L+Ktji2cJoa3JsX8Iv2sJzGotflKb0ZKU7c3Z2Gab8DKI2Bo7t35Z238q8I31STmI4em VzoiQ0gmFc4FehFosmOOK21kl1w42tyWzhCmkvno930X+At9DRppwMdsY2xDxGhqdKIv HwkdTI79yFXt++c4SJF6yrvSdcLaq9Arh9JGDcKElTQMkxGAEhlNfudiWW348LzZaofY YWQ2YSFYGCPuQ33dFl4n+1oGBCjCJ+WFxU+KD8tgB3yyPro8tf/t4yJrMD3aFbw3gZgV pjmA== X-Gm-Message-State: AOAM532pZJjL78pbWjEu68kt5Ohb2AjC+derXwEH3NkkrvjbRkJAsSId yJKZdUMOksYBoZriLlnz3M9FaA== X-Received: by 2002:a5d:4a4e:: with SMTP id v14mr6294245wrs.74.1622855400566; Fri, 04 Jun 2021 18:10:00 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:00 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 04/12] wcn36xx: Do not flush indication queue on suspend/resume Date: Sat, 5 Jun 2021 02:11:32 +0100 Message-Id: <20210605011140.2004643-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(-) -- 2.30.1 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 Sat Jun 5 01:11:33 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: 454681 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889592jae; Fri, 4 Jun 2021 18:11:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5TB/M23TshJYobdDUBF5JhylSoCKS39TznCw+H4UQPPh8uW5Z5NEERdjYoOEkS5j0kn2m X-Received: by 2002:a17:906:fc4:: with SMTP id c4mr7312323ejk.111.1622855472731; Fri, 04 Jun 2021 18:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855472; cv=none; d=google.com; s=arc-20160816; b=y7loVq9+amdYCnqXMb6P/7Pjc1inu/k74CdaKB35M4E8KxFr6X42y9+4F/mIKseuBv sPUEvLVnrrU+Xjfd+WSXmsIAMebQFtzuyBTasoqymv4JkmXt35DyI8cUcYOEPBfoqO7w uqBpJ99J/K4hY8QX3sT2pyim2LJBn7U1L6SUCs1wytJCaVIRc6D5kWuPBCTfpKXEw+lf rQTr6q09JMFAxeg1CI3+PdDcgYXzHLFN8OR+GK1MWN+tvSfHf5APsVLJAyWnzmiyzvwO n5nmcFGArJAy9VpH1af09w+y9Jld0SKroB1TOXr0Zj1ARw8wPkIx0CUUGdHiW5dGDE8E V9eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W+UYnqbXmGpOtA5im0JIGu1QFL9pMS49kWTkIpsAbWs=; b=gUVCwXuPvoUWTj6kwVMlWRIKR+oXtTYgxwj8r+Aekx2OzIm1soFMmvvddp39uWs9rD DKvIdEulyVR6sZfNMonVYYSoD5b3fOfqybXoaoshzgw92yWGy+XVL/HJq97GHgRmkV8m L7r+bMqN7SkaukxyK/BCcilapTBi+V11mNDTYW4vd3dp+lq51f3SkGXHT9cl9cyf7t1K A4aM40SFx6AyJPk7X+OjyPSlbnR7nNK92B/XZchLO5S7QH70U0GbLiJABiJ7HNYji1xG Z9dHSLFDFQ/4MHMFeBdEO2uRTYNvQsfpi7RgbgRIS6FB4NiVjZkWjersWiP2bC3CMYCz /LUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUgZ2Vpj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.12; Fri, 04 Jun 2021 18:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUgZ2Vpj; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231346AbhFEBM6 (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:58 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]:38813 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbhFEBM6 (ORCPT ); Fri, 4 Jun 2021 21:12:58 -0400 Received: by mail-wr1-f52.google.com with SMTP id c9so2258361wrt.5 for ; Fri, 04 Jun 2021 18:11:01 -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=lUgZ2Vpj2Brda+FbmjtFIEK/xDixQFlAhPTT+q79g6THgG9XmVW2JvzXvkUAjpWhjV 8W7eyaN6HEt4dtnlnrLUL8vJlXMtjRFjRakC3TKCKcZjK5guSNSswUtOsDPWHPwd69dc 3sG+tARr6tN8MIsscUStJes5VOawpg0OGClJqU5W4TSwyHsaZdryF6f3KS74rqcR3aPJ /vIwebWqstWuYFRCsp3PXbqjGf3jFLLvSpvxWwA4t/xrD66QNUycNMr1cOtbKakRGutp ilJ9nQ+j5ImIWfZ832+ns3RBenKi5kX8tYew0yaDAodHM6cl+qRy3QxRlDdWmfBH0XEs YIGg== 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=gqJfd8gwrNccR7mL0IdaTplO8y/5w1j40wT0KotlfcFpMfc8AW6O1AjsD4jL/G3ern wUcAHLIKfQgMVtRIy3M+CbxQtXKGD//vdw1ftD+ELzFE4/L39eAItwL9YCImhB/uh9+n 8iu7fhK4qEYd3BezpmBayZjuQiWEuvmVYuRInMTyFII8Q0QjrQrhnGuxmmkgbJeujYp6 w65gz+Ilg37+Wtq4mO5AN5UiW86hAp5ckhDlKQ2/gbaraVoz3wWnZ/KNyniva3o8qQP/ HV80EKvBCeALlSBtCMxZ7h8QK556pqOZbLkXkKVezpztz8S0x+CdEVfVoeJNSO0cmzlc Gneg== X-Gm-Message-State: AOAM533zbGjrhJVRR9N0MRkKj+fcgINAW8KC4ZB8qJ7DZRjfNsuW9d2g 0nQPFzzHpBkhSlCUsLQYFHkCCA== X-Received: by 2002:a5d:58c8:: with SMTP id o8mr6192780wrf.299.1622855401481; Fri, 04 Jun 2021 18:10:01 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:01 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 05/12] wcn36xx: Add ipv6 address tracking Date: Sat, 5 Jun 2021 02:11:33 +0100 Message-Id: <20210605011140.2004643-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(+) -- 2.30.1 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 Sat Jun 5 01:11:34 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: 454682 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889611jae; Fri, 4 Jun 2021 18:11:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyvYRRVQ66zOH6qEUBm8d/pOY+H3nIooBIpA8XWM2W+XbFylwyy7JU0unJMjPMX8iwj3W1 X-Received: by 2002:a17:906:2749:: with SMTP id a9mr7029661ejd.498.1622855474008; Fri, 04 Jun 2021 18:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855474; cv=none; d=google.com; s=arc-20160816; b=cdH6IAE8QzvP8Z4UMVT/VI0ekkxEBVc8MbV2XHTB4ayD0ZqUEYp4QjevXn9Qr7KP5R yrzp7uG7ApcsS4yr4H1vu/+ZFpAlPgL4UOpB83Muci06tGhI3Y0uVD3q4PxP1sXlz+pN p7hFhRdskBLaJbh+a4KVZOjkdNVoAbVgzSF4n3cUxCrEqJ8fGgRENBuELA06Bbpykr9A tgOTh6msIMyPsuIxTs79npG6QcwA/kb4CQm0jzJ6o2sS/WwE7LeCHJYTnB7y1WEwaLPo BvlwZ+N21SJ7cqB/f4l0BDE2ew47pl5kXA0CmafeR16x8dEuYYTkaJe4UuZr08HA17kC /5/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature; bh=4+t30aEWcaSqxpRqUEZT2htGCB/RS7GAQR5xlUo/uGo=; b=hFmyP2mI5vE2hMerDHUc/3TwcGFKKl4Y4F4lJYqio4QIcoVxeeIg9qoMzzcwxzY76a dokvcBFK2l2bGZBshrP2crzj+PYH60U5thuNlrRfkG/Orp9UbQTwzaWqgJG86M6kptfJ fkdce2zBbAMODQzr3jCMXYrqe/BpKPn/ElyhkvOl+k85wBKIG96cHB962YxXrnApPn05 Th8Gp+6Abj2LIJgpYvrYoIkCRCoPmPvrBHjlPEp0zhOYYx1flr6YyTbCyAw/VegzAqPB GwJJ+wNMwe4ftvjsG3SEGKcSIxdlafUK5P47ci1gEgXBgiKIoQI7kIdgkyEirVnuVqFj AWxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=tnZ3KWZj; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VVBPibY0; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id h11si5976400ede.61.2021.06.04.18.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:11:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20210309 header.b=tnZ3KWZj; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VVBPibY0; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="wcn36xx-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4+t30aEWcaSqxpRqUEZT2htGCB/RS7GAQR5xlUo/uGo=; b=tnZ3KWZjAEM1Ch hvCbL9zXTVj7H6QAwJGALGu0UnrHMsHR5MyRq7DUBJnpp6/vR3sfM4k7Rhr8eEcU8sIP4UrGZIDRk OjhbytE9fmKNjkULyCxocqhDWXLKNkZTfBFcH5PIzZvPvzWfD7TwyBYdnwlU6bARa99vaa8t+JoZy nG3Hr5LnYaF27fsrMb09/R0zElJT/+iOmXs7Ux3TTdxR77yFtCMigBfWBMLU1XXW4yDO6yOh7/5XW jxfvM650KPnQEluIak+Lj4mSDY0uYYX8yZQGpP7opyf9/ZBwFgHjzpc4HRO4frnnD0RRYAOnO94Hk /A+MyLmyvErUSmCssCoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpKqD-00FiGP-Ei; Sat, 05 Jun 2021 01:11:09 +0000 Received: from mail-wm1-f53.google.com ([209.85.128.53]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpKq7-00FiEO-UJ for wcn36xx@lists.infradead.org; Sat, 05 Jun 2021 01:11:07 +0000 Received: by mail-wm1-f53.google.com with SMTP id b145-20020a1c80970000b029019c8c824054so8860488wmd.5 for ; Fri, 04 Jun 2021 18:11:03 -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=VVBPibY0VhWaIFTNwwa5jHTezboy23MIPNUV6gEhkBnDfXi25NaqGiTI7qUoEKWDYo VTCmClBkLyF1wXZZNjVAFHau3cFOUe62ROeBy+qGGKYv6/ZWP/OUs4i2Bx/EQRoOTpZj xqCxUO9APkM0FOrS3raCmlHft/m6w46wyx5AoogYXdCICJ9rxOk466j4010CBkPUntFO 9myonH5uxOPr8ns2cVodw83sKOFA0m62GTdKkV+R/8/OKGUPUENKwVpkPSrK/M3aksWs 9JYVWWQxuzp0M299CFnr/udh53VEX23HsgeeK2+O4+NtFb59ShTvxHCTdoiSF0HufYj5 K+pQ== 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=dM7cq1IeYfNSSoitUrhM2DJA4JhTB0/XQPr7iISRbXcQed6+HApPwEypHBysToBMxc MyFCpJyRCHbERX7iM/fNUD8YOYMeDPjCfuASIhMSO8nm8Ezwo2RdcNF22dWmBuIBc/Vc wkhD2g89uI2UPuCOuttWlaGKY7HVVaF2ALovDh9lzxopuJwTmU006C1g2dxYx8D8K2mw gKoKP5LrzGrEUee2fylP3HFIBJOeSNurg3DzU0SYscXnNfE0HM/zH/OqVZnxZk2Vbpti fuPwj6EccZtHKRkNHQo8J476fcaHrxHa9oT974rlN46U2HBqp8N2hFxcWAwn3TSzI/AV +PXA== X-Gm-Message-State: AOAM530heBRRrcUAZ7V1raYorUvCmpVPidMICkNThaBv8tedUbxbjpoZ NQ4AVUAdXfP0jHrjTWIOK2KQLg== X-Received: by 2002:a7b:c056:: with SMTP id u22mr5916338wmc.181.1622855402451; Fri, 04 Jun 2021 18:10:02 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:02 -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 v6 06/12] wcn36xx: Add ipv6 namespace offload in suspend Date: Sat, 5 Jun 2021 02:11:34 +0100 Message-Id: <20210605011140.2004643-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210604_181104_002296_BFFAFEA6 X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.53 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.53 listed in wl.mailspike.net] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "wcn36xx" Errors-To: wcn36xx-bounces+patch=linaro.org@lists.infradead.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(+) -- 2.30.1 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx 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 Sat Jun 5 01:11:35 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: 454673 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888592jae; Fri, 4 Jun 2021 18:10:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzp9EeLL+rWv7TfxCMqfKO9CZqBOg7ZTZDOQaydT78cm2nG5/LRiONIZRQ8dtTDcytRstWP X-Received: by 2002:a17:906:f88b:: with SMTP id lg11mr6516955ejb.99.1622855407262; Fri, 04 Jun 2021 18:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855407; cv=none; d=google.com; s=arc-20160816; b=RwpKwUBzov3X81IQIUy66gOjhPNj7R5/5aoeztmoeKRpUrzvJPFlu1g96slewmmF4A i3w+B6xKl0mTYjRaIu0WSaJpf5nZoNRYhRUff2yrrqBDa0lXyi2t613zG9dlefY4lAQC PVii+3fyh5Q2XuD4P6ffLqWhdyagMvRKSXFQftRi+g4arzf5sGwofjh98F4n2SCPi1q9 4gerSkW8qj7Crdui452gyiSOIxpH5BCAUACtNzr/VmNu38/XBHppT2AKkBVHRTqpM7Ov JiyFlLWLjfBYBk/l88VOo9TqnGNGOD3uWUPRvMF4k19bID9NsqDZ9LUjdhvLx4SlsDhw NMlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EqMw+TK1CU976V2wAL6yPr0zVt+M7GcrRHHt2Qzbk6I=; b=rK6RUYH65ntYuvmGH6dIJ2yZS5toeoRgzvvMXawpIP90GVxKUvX4Era+h9eVTf24I9 nIVOuudAINvaxG7RvfWLyRvBA4vqV79jYd8z2r/2rWIXiCQdeN2l1RHJ/VqNMwIJjFcY NKJER9rpLGtvuPNqdOK5+GY4wW96decR7CX9cOoYwIf+2DwZwny6cyi1XS9SrOo1MrcP mU+1RWEmvChROlt1NU4s8HzvnUu1MTSCKhahN97ieHL4AU2jmOe4HnS7ZtM1r/VjObO4 jH6bl7Hqe0DDIic/La7erXY1JN3VIHBBXPYBhLSJzJP3+1qwFdXufvxQp5+k7pZF/fZG IDEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJQ6imj8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.06; Fri, 04 Jun 2021 18:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJQ6imj8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230527AbhFEBLw (ORCPT + 2 others); Fri, 4 Jun 2021 21:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230188AbhFEBLw (ORCPT ); Fri, 4 Jun 2021 21:11:52 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D531AC061768 for ; Fri, 4 Jun 2021 18:10:04 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id h8so10916329wrz.8 for ; Fri, 04 Jun 2021 18:10:04 -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=jJQ6imj825D6p03IkWy1xIMM3GXOxVh+LjUX8KR9CO9GGi2ozPBa/Wo4wDaG2VeSeB 8qZCDStNYdeWpaInRoPPG9fljd5k86AZdizYg0MLslUdzTfytlPrWSPKwyT5PxJDAkls dulGbJleJKi5IzImHBzSHBdw73nNNPo+y0e0PbAG9EbHeQUW9oT36cwIc6t8DMLwcFih 7UBNfhvIoTtrAA/9urfT5uATHztICVVXCiR9sSr6VO/f9Mqjs2XYUGtK+5NkdboWUySd yCyncoIcRHeCrKr6g6+KOMsh/GPr/rCl1Sqhomp/uCInaxbK3W7tojV7JFEwkbuQlbn0 s2Aw== 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=Ws9v+w+QKt6D52AAThYIgxvK3v5I/f/6pQmGhBjmknk9Ed7eVUMuN04mQQuO6WlKUO zO7+rStlKdEMosCReEEikb+BNwoOqxphmY/gO+ZLzL/u3i3+JYSEheamfocJZFboocYo 8LeW76EkctsbRv1r/vUsrjufvSRHgSDyckORDABKjfZiauSa27V6uOOw9V8dIAvgIPAU olxiHXELAzpUyi4ho/ZzSIEPW6VXTOhWVwMqGci44O37JiN8x0569uA052W/R6Rl8XdF OA5CrHNEjOy5JAL4g2f7exUaMAkctJMxk/SISLN81nLoiZiUUSkKJB+PKUb1Ict8FNvz BuFg== X-Gm-Message-State: AOAM531y/8AtavB9UIUPujFdwvqFV52a/eLH9tu+mj8/tL6fJQ8pe/ES wkO5Rl0SsELNtZy/pK8Tt6e7MtlD0vbQoYYO X-Received: by 2002:a5d:540b:: with SMTP id g11mr6550369wrv.390.1622855403483; Fri, 04 Jun 2021 18:10:03 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:03 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 07/12] wcn36xx: Add set_rekey_data callback Date: Sat, 5 Jun 2021 02:11:35 +0100 Message-Id: <20210605011140.2004643-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(+) -- 2.30.1 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 Sat Jun 5 01:11:36 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: 454683 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889664jae; Fri, 4 Jun 2021 18:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1GML6bZxnKpeobx3Ka/054mahD1m1dJmogbaLQTraN9EmjFLBWkFZNo1CYnnVDcRjzHJr X-Received: by 2002:a50:eb08:: with SMTP id y8mr7826158edp.89.1622855478203; Fri, 04 Jun 2021 18:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855478; cv=none; d=google.com; s=arc-20160816; b=dKkPUUaRibUyIueiA1Se5izwIRbU66Ptl53HzKK2ECVQp8mgOrjYiQwVEgYSDDTCUP f3lR2z7bihxv1ygZls+gwgJUGFxLAAFo0W7Qk1AnsZ6Xg6Y7y/pi3w0v810lVsmPMofb VbBKbcpwMOGLvBXumzhFa3PbsipRcaZKj/+yZQI/3jBH70jebQo6G6tUVGEFeNVzX2+v 4Z80NbbORjjigWCVck2fuOXMtlw3+aIJIa/7Zf8sY9PnUyqiFfGP9HzVvoym5qyYSK7p pU1H8p2yCEyFw7nkM4aO3SDPkCMBNyOaurhy3Ca4cGhXl0B00IwAuIOv9N3ZOTulhdVk /03Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mLMm42vbhhJfEr1YusZj6a9pUhQGgeXnCkgivBEicng=; b=Xcq5qdh961l30Hwon/2ZkLF+pBJVG9Sr+Oz1BqajBLr78hrimCUfI/S76BaRNWSMbm 65BSy2fvcJlB/yC/1KexL2bZzJt0EoTr1nS2uspbLbAYF2OmR9eSYzDGis/7+/HQwZHB TwM7I+OHX+53FRjl+J5znutLfzzbzzWICMFNWg1lze2xr6ZQ5Ue950SNjVGG/H9PX6UI 3IvHP+ssf/tYut7zLwv8ziW5W4/WgSLcI07RQqovyJUZWTwVOW7UrJ7dT3kRYtWMJqAa BWGA2Cm/V1Fm/nQprs6qJvpULwi/4AsAvnLAtBcsM4t7m47DXSsBuc4rTXOgtoaaFYjX 7ABA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rQLK9H+M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.18; Fri, 04 Jun 2021 18:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rQLK9H+M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231365AbhFEBNE (ORCPT + 2 others); Fri, 4 Jun 2021 21:13:04 -0400 Received: from mail-wm1-f53.google.com ([209.85.128.53]:33677 "EHLO mail-wm1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbhFEBND (ORCPT ); Fri, 4 Jun 2021 21:13:03 -0400 Received: by mail-wm1-f53.google.com with SMTP id s70-20020a1ca9490000b02901a589651424so1757854wme.0 for ; Fri, 04 Jun 2021 18:11:04 -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=mLMm42vbhhJfEr1YusZj6a9pUhQGgeXnCkgivBEicng=; b=rQLK9H+MJ59HObzhdh/xwfHDLupQCkerOaBa/97GTHRZ4U16+mlKcTtr7pswOVoUTP HP+f7PFaxK0Y3aOFT8d3QdNX4nIm9JUM67stAmns7eMymnZ4/eLE8y9L8T2JBkttDpJ5 ULZ6APjys2oDppHTN6/QyGelT1997u4RHm04lo2+xQjF06DYIHTvnGQ3jEtpieKPlSNQ RAK30jI+fyyOMXLPy5nt7Q3bmTMmNSdpl1ndsMB1IbSdImJUjt7JgMxDXKj/57WtBSX+ sb+XH44V1lW8KOhF6u8HuLLq334vmv8dq8iVUrLeKU/AvGQVxFih1Um7VRNkUFcioFW8 FGAQ== 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=mLMm42vbhhJfEr1YusZj6a9pUhQGgeXnCkgivBEicng=; b=h2FBeIX6/4P2laJWtFSRKNJJqiWYUGRNUzTTB+m3e/X/xzVvLfaoxKHaMu7DxO+4NL LdQM3P/CZHxJHsVVcFk5iF/pT3sBjp2wt0SJJzyOPKwd5UQp9110+XwSoB/fAgSn31QT tBmLs1sdfc4FSAd8/F8Rz4Bv+ittePxzRas7oVqepFn06rbQYBOAtz3h9UQBEU3bpjJS 4kC9iJ2Upjj0Cl1pEa9xgW8bh2a3v8CzVTbUp53ktQob40IjYgaiLRh+aKN+3oAG0HCD RbQM1hcaz9GrBoeCPOWZf5gnQ0WN7nxuLEF1p+sTB0IC7BgaDDMi8Khf4tcLDU/Qk1cO qyCA== X-Gm-Message-State: AOAM533ddb/3oUjCQm/+gFVCq1tnX/rDgm+lLqJtA5nQx16RdUofLwID lZpz7jhSWPlMbwO49XZ5eYVG6g== X-Received: by 2002:a1c:d5:: with SMTP id 204mr5896682wma.144.1622855404466; Fri, 04 Jun 2021 18:10:04 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:04 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 08/12] wcn36xx: Add GTK offload to WoWLAN path Date: Sat, 5 Jun 2021 02:11:36 +0100 Message-Id: <20210605011140.2004643-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 | 39 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 47 insertions(+), 1 deletion(-) -- 2.30.1 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..4063888e3f03 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2856,6 +2856,44 @@ 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 = + le64_to_cpu(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 +2943,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 Sat Jun 5 01:11:37 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: 454674 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888611jae; Fri, 4 Jun 2021 18:10:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRMJeZElVv3u0B0tNgQNcmwZeJ2mGIWY53OFv2t0wCN7VQxzTY+4TPt88uBqm07bqJhZML X-Received: by 2002:a17:906:260e:: with SMTP id h14mr7114822ejc.356.1622855408865; Fri, 04 Jun 2021 18:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855408; cv=none; d=google.com; s=arc-20160816; b=dd/1Ugq8TB4dlGLUVrZNvzwkEFTRfNQIK3E177uU/0CunvSwRPbXQNhduNRHy79M0p aX4GI2L51RwwMYRenD9GhhG3UnhrgrHFIKGAzEPbhRdtszOXtQK/rRCRb0gDyTY3zmcG a3u81mx2uKc1dD/DkJR9lBxrbVVQmXN5XzZjLAklhFg5LNBOkr1Xl8Knxh9sKBj1i7T9 hfK7xBu8VSSIm7GdL8GKyj1KWhHKDSLyyxHMkfbMSxD8vJkmV8pBzxTvdDadyMRtiVxo doSxFiHNSWgzsqMq09AtJ63wE49y99XL+RmyYY2EuEZOM/q7oe2WePg5AFCjNbJ1gpd7 2UDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3H89zHbM2SYQrgk6HivojJohFqBPkR9Ued+JHm1aSQs=; b=g0WCH5lWebsVGK5apMfq6Eyg7wENNWDr3RnKq3AbmCQ5tyQEo2z7mgFYwS8h/Cx0kv TRLbt+quYzz/dyZpmzaZ92pYu83HbqP63pi0V5Un/gqP/CThROZnKgaF4P/LsIZitfUD KbGfn27H67C+5XzcjgS/JQI/rwywvWmhCDPVpba6BktiY/K9zyMDrKY2vpItxpiT372L Km/8tUcMxkiK7NQ56U95R3qqxBbM8hhX4MMq79sazVtoM25zUAhgsaWmqwHpk7naamZM EJcotYyP7JU4gLr03P3qRPfd7cThnp/Kem9jBrwg37Ao6vBCgpcBUralFJLThkmdMyF6 bTGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ar/zezf8"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.08; Fri, 04 Jun 2021 18:10:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ar/zezf8"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbhFEBLy (ORCPT + 2 others); Fri, 4 Jun 2021 21:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230414AbhFEBLy (ORCPT ); Fri, 4 Jun 2021 21:11:54 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2CFC061787 for ; Fri, 4 Jun 2021 18:10:06 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id u7so5499273wrs.10 for ; Fri, 04 Jun 2021 18:10:06 -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=3H89zHbM2SYQrgk6HivojJohFqBPkR9Ued+JHm1aSQs=; b=ar/zezf8L4tPxxkRA8M5o5FVE+yZ6BINTRcAGDXDY39dj83DVU0/BwOpl3rp6sZcoH bGz0bzx/B7hS8qsmn9wivRFbPIWt250mtv2Vkv6VHMKWzcGUjoncvZA0UL7wYmpxcnWQ VRzI5HPyH0u23QVI3FmO6l5BxsDU5mbWN7E9fM/cVhYB3U/hNMa3Y5nuUo6PTDgyUbZI TOGLhnlAb587NQUdoCE8AQSgiG0WaKPHML2w/zX62F92bFC6rHU5ridMXqoaZgyRwJEa YRkfhjR2XY8OLIgnxHjkcSQcBG8JcFm9r42WQZycQqUGfNIWW9BPfUzi7DgIPKZFJ90L LteQ== 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=3H89zHbM2SYQrgk6HivojJohFqBPkR9Ued+JHm1aSQs=; b=j2pxSXDLJ+wHRhIboezFTJmMX99sIJ7YeH3PXznMQZ7zsoXVOqA/5qT2W2G2EeGh31 B/Q8MDQXZUuAMYOlZbrLtvRRo+kTfvkXAKYZcHqRSi3m3yU1TZ9EdnLsict0Lc7Hp6DY sVV/jNfy3xkLvcOJQI14qKkIT/36vBhxojkglK4eelfD2dE8dEFRwlb9Gsq4hTMwXrgj 7gC4/rsA9ZGlVFZAfqm2faKhTqQASy8I7XvAlR/nisdecJKHBGwgazbJrE2M7zvrEQex +ixpjiclhs98EDnT0vYnaC69SgmxuPTXX+M3NJ40sUhFBKBPUPLPaGFOqtsHZUyV5iVR 08ng== X-Gm-Message-State: AOAM5336IRcDYBaAyjVSEF418jTo3m+LUS7O/xzcDjbJO8RPWx94Sxgn ULPznXBAkEp+zFdUXcGyhUVCfA== X-Received: by 2002:a5d:4a4b:: with SMTP id v11mr6394321wrs.246.1622855405481; Fri, 04 Jun 2021 18:10:05 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:05 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 09/12] wcn36xx: Add GTK offload info to WoWLAN resume Date: Sat, 5 Jun 2021 02:11:37 +0100 Message-Id: <20210605011140.2004643-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 | 73 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 + 4 files changed, 79 insertions(+), 2 deletions(-) -- 2.30.1 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 4063888e3f03..13200a079bd0 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2894,6 +2894,78 @@ 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; + } + + if (vif_priv->rekey_data.replay_ctr != cpu_to_le64(rsp->key_replay_counter)) { + replay_ctr = cpu_to_be64(rsp->key_replay_counter); + vif_priv->rekey_data.replay_ctr = + cpu_to_le64(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) { @@ -2944,6 +3016,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 Sat Jun 5 01:11:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 454677 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp888705jae; Fri, 4 Jun 2021 18:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLT+m1LVultm0qGUP/sU7b6tx6FDulSMalYMQ8EGes43pBMNmGFnJ9vWUHFwtT6TuwzjiG X-Received: by 2002:a17:906:f88b:: with SMTP id lg11mr6517478ejb.99.1622855418099; Fri, 04 Jun 2021 18:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855418; cv=none; d=google.com; s=arc-20160816; b=LoiQnfVyNIfUXbPe+xSocSBiegIOIurviZ6S0UPj8cBRhVSGTMUnMqGw7fDNxegdqG 2GTGu/xJlvu9BnHSeQUZQbUpLrVxxmcPPxBwoaGWX5Lq0BKZlcf6RLN+48eIA5KzWpGB ZBZ/jaS2P5LfPz8RKlev6WOepX6JEjU6IS/HsSct4RfqkEFrNxofN1GyiuY257uyaIMF OIzNQ6jZbcXahWlxZelU4PbfXjdcDFZ2OHUnNoulVfZKLgjffXwM4JtqdvO/6GXIN/Qe 3cEiOEF5wvwCzt1/RU0AitFiFq9KkfQaRQlEeeMeoyaILe/21OREykbERstmu6pvsqdX b5kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=fc7zrV3rrXiWmwmcXIR6SwOIjyXaafYEm+jhPM3UELCF48aKDAx27bv0GV6wlfK2ST M0VQpFWuJE2pddhPpD9xVEW2VSRRWezsVPUQOHaTJdQAVjcytggT429n/0qO9O7Pj5Xq zixFbhMpKdcUzmzQ0y6E9ZDYuqVCsK6p3+IQnbzNBbF0xwMGR3Rl10Wbx/qfI0TCR8KQ Jf4eE0YHmWSzZNuE088w4/E0vZbQbXWUqTZQ2eiJWQArkHjv/4Q8ArQY8hvn/nCKgaXh GzOPcmRchbMTYREJpP0N31PQRjS5cQqgiMcwcDGRyxkLRWcgRGwYv/7y2IqjwcBx5fLN 3yUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=muM5NSaZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.10.17; Fri, 04 Jun 2021 18:10:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=muM5NSaZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbhFEBME (ORCPT + 2 others); Fri, 4 Jun 2021 21:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbhFEBMD (ORCPT ); Fri, 4 Jun 2021 21:12:03 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5A45C061768 for ; Fri, 4 Jun 2021 18:10:07 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso8864887wmh.4 for ; Fri, 04 Jun 2021 18:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=muM5NSaZ19qh1PmVORUYJpKyCbYZpNB/w3c7lnc1sydYEOv4ogg6QCeqsTk6oxcCge U9bZcL9+ZzuajP/c7IqfvSQmdeHJ3hYbbyOwkb9yhiXRN+M2o1yzawUB6U1cGffiQ0Oh QqVL4h3of39sx+sZ0liEbjd3sdnouN1ZugxSOgCoGvXfCCtpIny7gP1UE+e6mCZZOLBZ Txy9OVdIcMHRkdKF57vzvJplwkiq6igDWnf++oM7VVWgJmDh5un7NIK2gkV/nVVTV7KI BrWVfxdo53/c3vfowaXlE3m0E2nhGAVwqhoIlX6/zQNY3hJoWmJTH/N7EOI4z+0GgLct ioDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OlPZ3vyEaLsC8b0Zd0Yph8pyULLvASpROqZxo2IdTyk=; b=nBiOKmvvTiKPCnZsxtrXvE2Rw/ekhf8cfsF7Oo1AOZoz/Chj4H4DiIRTj6wCrA9zq1 PdEy2jBSiwC+hnRVFBLKq60blPzfcaoP/zq84sWiMYjMEwIkfjo/V92x75ccAVQboG5Z 0CFjHfXAnqvqvPn2zUih2siWcR6L3zdGv753r3Log0PHWb+o3IIKk2e3mUzGiBywOKrv TuTtgA9dCDn3JyjrDZvE1E+UIMQ+HcPY3KzFJHg3iTt8m33Bzkpq5Y030li6AoJyV3jV PHnRIAWRAz0bIjeqjpG9N3c6tkOdFu+dLyYXEg0yxxb8GlaXmdf257MR2YuaP1kOebub /UsA== X-Gm-Message-State: AOAM531v78+cbTvPus+Z/+ANWyKA1Es7a5ob9YlCivnCeOlcXKulkdCR OtjAKq3gDPyjNjBKksyWcH3m+Q== X-Received: by 2002:a05:600c:1c22:: with SMTP id j34mr6146344wms.166.1622855406501; Fri, 04 Jun 2021 18:10:06 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:06 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 10/12] wcn36xx: Add Host suspend indication support Date: Sat, 5 Jun 2021 02:11:38 +0100 Message-Id: <20210605011140.2004643-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to activate ipv4 ARP offload, ipv6 NS offload and firmware GTK offload we need to send a unidirectional indication from host to wcn indicating a transition to suspend. Once done, firmware will respond to ARP broadcasts, ipv6 NS lookups and perform GTK rekeys without waking the host. Signed-off-by: Bryan O'Donoghue Tested-by: Benjamin Li --- drivers/net/wireless/ath/wcn36xx/main.c | 3 +++ drivers/net/wireless/ath/wcn36xx/smd.c | 19 +++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 2 ++ 3 files changed, 24 insertions(+) -- 2.30.1 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index 8e5d8326d551..e4d5e4d597f9 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1125,6 +1125,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); + if (ret) + goto out; + ret = wcn36xx_smd_wlan_host_suspend_ind(wcn); } out: mutex_unlock(&wcn->conf_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 13200a079bd0..3b4ba6edd17a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2966,6 +2966,25 @@ int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, return ret; } +int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn) +{ + struct wcn36xx_hal_wlan_host_suspend_ind_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_SUSPEND_IND); + msg_body.configured_mcst_bcst_filter_setting = 0; + msg_body.active_session_count = 1; + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = rpmsg_send(wcn->smd_channel, wcn->hal_buf, msg_body.header.len); + + mutex_unlock(&wcn->hal_mutex); + + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 90c7faea0ef6..2909facdb100 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -159,4 +159,6 @@ int wcn36xx_smd_gtk_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, int wcn36xx_smd_gtk_offload_get_info(struct wcn36xx *wcn, struct ieee80211_vif *vif); +int wcn36xx_smd_wlan_host_suspend_ind(struct wcn36xx *wcn); + #endif /* _SMD_H_ */ From patchwork Sat Jun 5 01:11:39 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: 454684 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889675jae; Fri, 4 Jun 2021 18:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqS1AyolnoC7B8HevACTJ35yD9L0HYKppt+0/+FDNVckSzD2gSyR0zl2G1unG2tHwWlF7o X-Received: by 2002:a17:906:fc4:: with SMTP id c4mr7312638ejk.111.1622855478732; Fri, 04 Jun 2021 18:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855478; cv=none; d=google.com; s=arc-20160816; b=Jm8Ugf81/XwX0ToNGwu6JAX0ZPAJePvTMtgjAEO/OrG6oOpybgaWETLItXMd5L5hHn Yz9hrX3JbGWDmiBD3lW5avBIU/W2Q8NPbn6/fzejTtqhBVVOISCiMG6gLP4C9Pz8WNy8 opebEZfXLFuHCgu27yEv23ljafWfMp4kqVQs6IMEerUoKU71KO6QLvgvccHJRj+iytVU B5sYoeSohE0LL+TTH2B9s/nc9jm7aDjyOHrDN/pP8CgMnOyw+3t9eqwMyapHidMpfYlG 5Uix4Y5qFPGBMoXFpAT1M8FlW6q2Z5kdkVX6ShgZcRkUN0W7o8v5wcnq/ezbQahYb5D/ rACw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Db0vrZDo7WsFlYNOBTLREku88rzLX5quvNYh++ykS44=; b=orYjQbh8Jyh8Ey/XuXfGOlPNb7BPIlV70iU2/Y889IM2AVqr3xq9Qq0YbuxHajazvP SAiVI7LreEr3I58XnpqrPerqjqzu9mVz8JiyT+HLA0VOH5iJrckM35Z24v079MjPwtEL cWxwHcTm2Dr8FLPmZaE9is/oD7M4rZyaLki7deONe2ae8c0NoptQpz5QaRJdjf11IANK 7Pxt84GfXQqnOISO21eL5DgKEZYK1kjo8Mtd5MswJohxwkHhzyHalLl2sDhW2A7vPM10 is5QEbV8Ya3hw2faltW21NQhkzk/yN4ihFJ8xaZw3jmx9bKLGZ5G4gOzvghqTDoC1iSc U8Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I1ThK3qb; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.18; Fri, 04 Jun 2021 18:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I1ThK3qb; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbhFEBNE (ORCPT + 2 others); Fri, 4 Jun 2021 21:13:04 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:45876 "EHLO mail-wm1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231356AbhFEBND (ORCPT ); Fri, 4 Jun 2021 21:13:03 -0400 Received: by mail-wm1-f49.google.com with SMTP id v206-20020a1cded70000b02901a586d3fa23so2234727wmg.4 for ; Fri, 04 Jun 2021 18:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Db0vrZDo7WsFlYNOBTLREku88rzLX5quvNYh++ykS44=; b=I1ThK3qbyRFc/NyNPS+zUxjP4cKXawg9XklKB3egJx9UYINBE8ypU4zDWmrazw7toe lI7Ktk3sYa1hx1aHhndNFbKzW19PeG7F+nZHeAUzlBevI2XzbUYye2N8W0LEDJ7Ls/2w l1ybYBypXsyJ0FHxKRCjxtqpMCYyAahPpwkRNDem1DvlPBrOrTj5WQAsad7jg7jIWFZs DudsZuXKZ/acgRPoVF28KjG8iNFqW+WlREZC8mzlGunNPsarwbXt3v5KiwDA0iU/ojEP MBnvVFz/tpSwvzE8s8utxLDomyewTTGaPQiGwXE4u2O8o8kplqcZKJjsFvtjnml8KQr7 trdg== 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=Db0vrZDo7WsFlYNOBTLREku88rzLX5quvNYh++ykS44=; b=rB7aRDLPGJQXPBGY1Nw3PE1FWQLNS7XAnhQyMBH9oQSeay2+id/RoPFh65VijM8H2V B6Aezejx+pPdtxYHEYWrukdzTk6OUYbxHDwybDLh6PPYhjLU90jhg6C6sfeMa7y1Xejd 27slNxbCDlNJEL2B+yZ0Vbg3JflWdmLSMBb78jIc0pS3ozMBtR7tbIzHMRsNGK2+egK/ lN7l3+xCsMeKRcOgOdK1rn4zMOmVn7vNZrFKguRlhLsIsru517IuqzScCHV2PrjNANmR 1fkpEWkpuaHpv0DBaMiX5/1GzRHUe4V/hETyfrSYA9DLlcknOGToyHi0M1UOunekbqkQ TaPQ== X-Gm-Message-State: AOAM530k+tJcSoW3tIpVfVlyN+b39yS7aeHBmvZpLYT/QWvTxLye0Isa iiCh8c4SICjYWwofIw0HK3tnbg== X-Received: by 2002:a05:600c:2194:: with SMTP id e20mr5788339wme.173.1622855407378; Fri, 04 Jun 2021 18:10:07 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:07 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 11/12] wcn36xx: Add host resume request support Date: Sat, 5 Jun 2021 02:11:39 +0100 Message-Id: <20210605011140.2004643-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(+) -- 2.30.1 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 3b4ba6edd17a..cf8e52cbdd9b 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2985,6 +2985,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) { @@ -3036,6 +3070,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 Sat Jun 5 01:11:40 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: 454685 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp889749jae; Fri, 4 Jun 2021 18:11:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCV6E653F+PAIZT7TSi+PDsp/YbWGl4nkc2/d7gN/T9D1mD5xM7Pv9CZR67seBeXuLlT8I X-Received: by 2002:aa7:c844:: with SMTP id g4mr7780678edt.257.1622855484643; Fri, 04 Jun 2021 18:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622855484; cv=none; d=google.com; s=arc-20160816; b=efYB8gABKGSIbog4TBdsj25MMMH24SalmVItFFUFiXMuMCrkY1PhU+nyUrFRPnmdoB EhInjsRW4cZbtHj+mEvjZDz8bWDeBxsBC+5sBKmEGkM04lWIa98ArXhiSShFDnj6llcp lPbfNFTKiRvfn2xjzvkVFDdIQbUfRc7iyOAFhe+BMNxynY8xPL/E0kMtgZLAiqxpV0ei QtBIawZzdgk2zuRvlCsMcCg9Ym1kEmlF5G7Jbjjma8GzVNOb7JrJVKqQjUyiYYCumihd 8gP/jFfn5Bny3OyDh9n8DZc801Fevvu+bDL+UBJy7BwkSm1sxNYCZLLJcXje8DAsarHa QpbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oAnhL/rLVHOlPObR2Xdk1DvWetZIgbSOpJEsqp74oTI=; b=IO1wCCSFXoEUrbUX+SU8wgJRGpFX9k5+2WdwIFh9rlEmnHL0rUQkv/NW4V4u+QGXul Qo8dekHuAaAFSaZ1klfHxONmbC9ovXpiVwK78Um5QdcvxStcbgZlWva1MYzSon6cfCET /68aYfJQOEz2hdZe7XN9MDq546szGx8ws/jI5e7sd6RvxJGNEeskH0HHD2qkWrcwJcfK lhHIETKWOjPaULX/p3eLX114RHMrJblx3FBJvOSK8I5Omw5ywZ0KzUKkHphr4qYolXiI tXXOii4oyXsDfH2k4DjTSPaLqROGFLFYj31ylJbQqwgX3Fr9JtINFpqWWD6Fpf9YntOK ljhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GrHfUEWK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd18si5855665edb.445.2021.06.04.18.11.24; Fri, 04 Jun 2021 18:11:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GrHfUEWK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231411AbhFEBNK (ORCPT + 2 others); Fri, 4 Jun 2021 21:13:10 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:34350 "EHLO mail-wr1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbhFEBNK (ORCPT ); Fri, 4 Jun 2021 21:13:10 -0400 Received: by mail-wr1-f53.google.com with SMTP id q5so10967759wrm.1 for ; Fri, 04 Jun 2021 18:11:08 -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=GrHfUEWKjurl1ciAfg2VIP28dimAf7b7ofB33I17yzchXsa9ImRgc+F7SZyhcv7wIP fSnN/gjO9vjBV5/47XBSoai+YiIkMw7XLwtsLr9xHyFnnWuvktZCAIwj6UFxzLkU1g6V MsfCw1GkQi1k2GOth14jRaayjiS9BfS8D8a5uFjj1QcnEp3CkFAj1nKskH3nCc6kDvqT 8b89DplyNeKLLXQHQuhDUcCXwm3pMz25CHl0RHSVzbHGWSNxDnwfh5ZfRI8jvOiGIQTN w7N7mDuJWvau4qcBKg5O+kcBDGlIL6pk8WqxjIL8ug7DeX8URxhGiHfcYsRq3sp3nK+3 Ouyw== 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=TY7PB/LAOjJmSlSIqDh7OBQ+DUteXKXI8IJwwTVpcq9lUWm49avnsMBFyaw6eXK0pN PwvPd4DxYdnIHV+CSKSRa5ekz2C9PmywszwIld7cebtxiWPSD6HOIkMfQ8sxR6g42aF/ ymM0Wbtx+8kkdBQa9Odw7x48xd9HLHKQVwQTMXvk+E3CSJUzQLFAcULkMdtTRRJL0sqG xnLDS272jGKK7U/vhDrz8HJwAAH5ahACrwOHTmFD4cKcF1evZafy9O8BFMkq9a65WOmy BohAa7n4QkgMbNd0LIzR2T66J8iliEOCw8zL3eH4kdFDYJBVwnV6A7NEyg+KAP0qVuGA aoGw== X-Gm-Message-State: AOAM5301W5nR+3S8f/TlFov6zWdG8LeAsm4ZNIAGM50FrVcpLKL5gWQD Rbo6miHPm4MpAnjgMNnlPH/jw68X4nsdp0z5 X-Received: by 2002:a5d:474d:: with SMTP id o13mr6156029wrs.176.1622855408301; Fri, 04 Jun 2021 18:10:08 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id u8sm9594941wmq.29.2021.06.04.18.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 18:10:07 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, benl@squareup.com, loic.poulain@linaro.org, bjorn.andersson@linaro.org Subject: [PATCH v6 12/12] wcn36xx: Enable WOWLAN flags Date: Sat, 5 Jun 2021 02:11:40 +0100 Message-Id: <20210605011140.2004643-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> References: <20210605011140.2004643-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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(-) -- 2.30.1 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