From patchwork Mon Dec 28 16:28:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 352759 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp10027833ejs; Mon, 28 Dec 2020 08:27:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyy1MmaLoKE/qsaO2nphJykhxzHyF1k50hR2NUikUpoFQTK88CO3O0m4SGFQj4r/nAJw3+C X-Received: by 2002:a92:ca47:: with SMTP id q7mr43263769ilo.239.1609172864891; Mon, 28 Dec 2020 08:27:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172864; cv=none; d=google.com; s=arc-20160816; b=HETx0tlV7IlqRP4VX5PMt72hom5Z50PJSU4yOb2pm2L8UJPqXH/4/cn7MkWkFRFbxt PU5zg69nxN5ElRd0GoL628AeZPgWVHCcrJqz3glq7JR7LrP8b9SjtyeVT6yrmy01w70F s7UJBxza98FOja/beYSXCg4I+Tbce7RCETx51pAycjv3LFfeoEl1NVKrVSIJFMmkPl/S Fs6TmZGUB4O+zEUfQtFcV+0HAEZ3Sohi7DjMi09j8eyvHKvabHOSo+2G5xd0/WKPhqC9 6205RFKR2s9CddswGPLTEskDPHkq86qnejHm+p3q5fE8082wmKwOySPfxJBiJ7KlQebk aXkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=nwtXo+EnOAt77p/beiq/HCTEXC5gjwLGuRd/ezp0YcM=; b=RwpJ5EUNQCQjwwSS2pXLh8w+moL1yy0MzG1kcn9hWA1g1fm+bgS+yTZuNa89Nl2ADF OPo7eBp6m1d3KyXoOGgIV4zu266uovET+uF82WLp7kl3IjcuDZ9lLj2Cc90+yR59Fvs7 oRS3m0P/WLjtB/F4EVTV3Td6npn3XJtmBFvXsIfS7bgMpUm9Hv8kHRkYlY9evfbI6Lgk 5scuGCEKPDKVY0UEqMAlyrUK0pIJqOhgcUlAzu3WCMbPvFu70RzIGDhf7+8LcPWQPoUr /yC9QtzVnyif+X1KaHxlCTs+EzAfIvM2NgfZPVFrqJJJ0I3QRVZBFG03TPVtp/5KEv4m kTTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=VZ6PCKNk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ncQR+r9l; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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 merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id b8si45161945iow.50.2020.12.28.08.27.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=VZ6PCKNk; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ncQR+r9l; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1231::1 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nwtXo+EnOAt77p/beiq/HCTEXC5gjwLGuRd/ezp0YcM=; b=VZ6PCKNkW5UjU1ZFD48Ojc7iH 5wUuyfmkJJDahDtGTSwYmgo1LH3yryQGASDsUX/uw71HoJuTIBmK7z4IDWjOSDAzidrxvU7Cjn6oK yppp3l1tK2he1z1kCpKrSFnkRESJGtz75SQwEFjMhct/jA+3HZ8xz/yXumVO+s642lH8Rxwbwqeb6 h9iosefRR91QUGdj2fRQAnh2SbO/eFVT05UdPkjwqNjcYo97B+k7xphNLRG6tn0slp8YBl3JyTZb+ r5ktxo+N2VzqmPcr+K7m4RxVbevduUJL+cxpamrrXjaa/Yyd5V2XcgOKNReo3VODMGa5IkrwG864A 2f0302uqw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvMz-0004ZR-6b; Mon, 28 Dec 2020 16:27:41 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvMw-0004WU-7b for wcn36xx@lists.infradead.org; Mon, 28 Dec 2020 16:27:39 +0000 Received: by mail-wm1-x331.google.com with SMTP id v14so10714861wml.1 for ; Mon, 28 Dec 2020 08:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eY+3wBeOdVNx7S6ZBSAwS1KofM7X7bObYB96unqy4iM=; b=ncQR+r9lZZkIE3sgyoMcN8o702yKXfL9OlBMszw4uGwYyuaT02B/AGYNFVE1czHUDD 2Mgg5Zjc4a1SckslqrBQKnCpn4Y1nYx0apXcyagRp4XEzzQSJ62kryAAb0p9TqwQxFNh i1HChmy7yRkCJDeLYUhbzFTC3lxGLCtumc5ir7lJUhoHmWoDhlalqXPZyV1bZq6XagQg F+xc8+h9UXhXw5pjp6YhMrlvYkNxNEKh1chcNjLjvxqeQ5fM0tULWUNxXlPxfpilTD8l 4x84es3irx4BEbTg20xqpweQfBqKYTdUnTCBtisoVoFTt40kBHIfKzkzz2/KrxObhboA cVew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eY+3wBeOdVNx7S6ZBSAwS1KofM7X7bObYB96unqy4iM=; b=h3VFMVcsevweb67kX4ZqZmlB50VTKTreXKRVGYeHpy0uA5poyMxQsDNw7VMIseQfXv S/ARD9K0YVhACIQyRHgJwWL8Q0FLJWeBSHu5uuhUGI+xhqT1PdxPoXuYtXIHTn8MMwji igHSen7pk3HSEJpsF4DzNSL6q3fMTDCiuaOR9BxdrN8F4zCM/4cOVvIhgZVvzgeYRObl yaz/h3VN6RoOzruy0JmWAewkQoShMrFXECYf2ANHZYXME/vKvsKpzPdGpLIrM9kHlXiB 3r1mUoU2bQcz4u/yr+9cmmRMMO9pnl4CE1l+ClLRW8OMwN9cqAgcfhZTO8p0UuaU0TSB RtUg== X-Gm-Message-State: AOAM531A/jUg9i9crO5cHKK+BPkfZedAlLG9UnDgZI0Xwh2spNkcj4nn XaxNanjwkqeCTkvFpYwMMDxoBw== X-Received: by 2002:a1c:3987:: with SMTP id g129mr20816495wma.86.1609172856720; Mon, 28 Dec 2020 08:27:36 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:36 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH 06/13] wcn36xx: Add ipv6 namespace offload in suspend Date: Mon, 28 Dec 2020 16:28:32 +0000 Message-Id: <20201228162839.369156-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201228_112738_307643_DAC8C219 X-CRM114-Status: GOOD ( 14.34 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:331 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.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: wcn36xx@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bryan.odonoghue@linaro.org, shawn.guo@linaro.org, loic.poulain@linaro.org, benl@squareup.com 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 --- drivers/net/wireless/ath/wcn36xx/hal.h | 3 ++ drivers/net/wireless/ath/wcn36xx/main.c | 4 ++ drivers/net/wireless/ath/wcn36xx/smd.c | 55 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 ++ 4 files changed, 65 insertions(+) -- 2.29.2 _______________________________________________ wcn36xx mailing list wcn36xx@lists.infradead.org http://lists.infradead.org/mailman/listinfo/wcn36xx Reported-by: kernel test robot diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 90333daed845..3b949b0b3792 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3464,6 +3464,9 @@ struct wcn36xx_hal_rem_bcn_filter_req { #define WCN36XX_HAL_OFFLOAD_DISABLE 0 #define WCN36XX_HAL_OFFLOAD_ENABLE 1 #define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE 0x2 +#define WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE 0x4 +#define WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE \ + (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE) #define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE \ (WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE) #define WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX 0x02 diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index af59638d696f..579bb7f4db9c 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1118,6 +1118,9 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) if (!vif_priv->sta_assoc) goto out; ret = wcn36xx_smd_arp_offload(wcn, vif, true); + if (ret) + goto out; + ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true); if (ret) goto out; ret = wcn36xx_smd_set_power_params(wcn, true); @@ -1143,6 +1146,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_ipv6_ns_offload(wcn, vif, false); wcn36xx_smd_arp_offload(wcn, vif, false); } out: diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 4589c3d26027..b05f1e1f253a 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2794,6 +2794,61 @@ int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, return ret; } +int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_host_offload_req_msg msg_body; + struct wcn36xx_hal_ns_offload_params *ns_params; + struct wcn36xx_hal_host_offload_req *ho_params; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ); + ho_params = &msg_body.host_offload_params; + ns_params = &msg_body.ns_offload_params; + + ho_params->offload_type = WCN36XX_HAL_IPV6_NS_OFFLOAD; + if (enable) { + ho_params->enable = + WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE; + if (vif_priv->num_target_ipv6_addrs) { + memcpy(&ho_params->u, + &vif_priv->target_ipv6_addrs[0].in6_u, + sizeof(struct in6_addr)); + memcpy(&ns_params->target_ipv6_addr1, + &vif_priv->target_ipv6_addrs[0].in6_u, + sizeof(struct in6_addr)); + ns_params->target_ipv6_addr1_valid = 1; + } + if (vif_priv->num_target_ipv6_addrs > 1) { + memcpy(&ns_params->target_ipv6_addr2, + &vif_priv->target_ipv6_addrs[1].in6_u, + sizeof(struct in6_addr)); + ns_params->target_ipv6_addr2_valid = 1; + } + } + memcpy(&ns_params->self_addr, vif->addr, ETH_ALEN); + ns_params->bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 1458682ee715..380ea58b58ec 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -150,4 +150,7 @@ int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, bool enable); +int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */