From patchwork Fri Mar 19 16:15:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 404810 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1511071jai; Fri, 19 Mar 2021 09:14:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCbwxTFGlL3jiv+qEf/UuWAQ+dtHjgMDA8pmQOA9EktNEMsqjI4dIvq2Frl0rah/WscK2f X-Received: by 2002:a1c:22c2:: with SMTP id i185mr4391460wmi.99.1616170442366; Fri, 19 Mar 2021 09:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616170442; cv=none; d=google.com; s=arc-20160816; b=dhRUhSGnAykjqYjxaiOqf6+z6PTJyEdPimYBH3swoUPC+gtBZ4E59iBhEtx9p2R3R1 zhxuz0hdhj26fFXrgar+Q1VJ2Q89wDn5O08flA8i+VaXIX4fGwO2fB9WqCFnWGSDc5bi L0pKOaaZHdZi3FuPnv5c3TbYWmA++MeFJtdvFXlwjHJa2vVMIWM2XMlIC6OltLhKrrG8 xFvkV1zhAf5XDNRWbl8CEQJUWWIR9unaIHqi4i8bWyose8pXTOqmE4FFVX6UcgA1r4bq 0+bcU8zHTs+ojNsUc+MXSds+8O6dHpzfaLuuzyi3Kg1FhsnYjX5UUWWUTBlNcDlsrpZy q6Fw== 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=Uc9yR4U+SsfQ2cG78qNkRSLZXJR44TKlwJox0BbAwVo=; b=Yf+0WZIBzUzteoA6JFNVPBXjfA6Yw0lXRTpuOSXQXbeWkBfR1yzUND9thA9YZ2i0Xt 5jyeHpIymidcTsqF5tjGnlPyxduUM7jtZ8ZhGZ+pBl3bF78DunW//XHJHSxHVB/EzP8k kL2L6SLl5djkfyKgmGtNrj2/8gi9wiLjQIgll5yXnnVHEYMxESeFPsuifO5YUWgssERF HZ/7MdcrcF9pQbY3EgtZVCrAOmJkBN3HGrDlmOenFmUyF5CNwWPmejwpp82U5Da/6dqF YBQnYT0RL6vj0v8k3PfCJAdHsvGYLVfymEuNUgFkjPvvPTiVFB7wIMN1Ms4y6lomq0pT Voog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=WGO2D7rh; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TZNWcdmY; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 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 desiato.infradead.org (desiato.infradead.org. [2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by mx.google.com with ESMTPS id y23si6670990wmq.106.2021.03.19.09.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:14:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 as permitted sender) client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=desiato.20200630 header.b=WGO2D7rh; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TZNWcdmY; spf=pass (google.com: best guess record for domain of wcn36xx-bounces+patch=linaro.org@lists.infradead.org designates 2001:8b0:10b:1:d65d:64ff:fe57:4e05 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=desiato.20200630; 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=Uc9yR4U+SsfQ2cG78qNkRSLZXJR44TKlwJox0BbAwVo=; b=WGO2D7rhYFKzMGTr34o3/mpGh oQ1IKEMeZOThz4PWU+oOzyuvBX2xyYVtzAejjU/TXeDwifnuVyM0WQAzNDJivUUZpIvpgOYPl2rRC KEq3Y1ST0ILPtDsKhnfVbgpV8NVk+o3pnBF83K8nfkEzRHFqxA3a68BVQhzRoKoMF1/fpmLrjDqgq jnR/l0ujXbDl9AAKwoqglXBPrZeM8iUtVxZAmzmVEqTK/yTIl0rW0LmCT1MQwlx0vHgVUV3Z7FYjE Rij/wM3/fvK1hecsJDeLXejEkiPcjxDk+zL89I9XhF9Rl1DqC3IPJyGAMlUhr2NjKsmoTKgI5y05x xG07R25Gg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNHlB-007fqY-Ls; Fri, 19 Mar 2021 16:14:01 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNHl5-007fnV-6T for wcn36xx@lists.infradead.org; Fri, 19 Mar 2021 16:13:58 +0000 Received: by mail-wr1-x429.google.com with SMTP id b9so9675007wrt.8 for ; Fri, 19 Mar 2021 09:13:54 -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=GoM6r0aQNFv6P86Jh2bARDY3W042U1bUTvbdF/AjcU4=; b=TZNWcdmYEv08+34PvPBQAY7RzSTbI+8VlO6tgYiQz/firqfWoC21Sr1exlbRXbSMC1 PT5xvNUQA69BcdlOL1JicFDS+93OlwUn74W7uMf1l/LsQaOjpDfJe3rYvagvJLLiP34+ JELybyx8i332BlJkWIXi2f3xhzFWEFnfWGd4LiTqzeQpG6+jS3YdhE/f05KGgUuEJrei AK0tLBW8atzVt5Q49A2Kb6dZ0XnWIfITlEceMKVD5BbiyqrlWR07EoeflUWdjj3l6Xoh ubSWr54dVqjqzqBx4iXLm1nGUKotsVz98pd+AsJtB0hX0oHnf+Cd6j6B1PoF9zDWPo85 CIww== 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=GoM6r0aQNFv6P86Jh2bARDY3W042U1bUTvbdF/AjcU4=; b=nZUTx5NGek4qVjiJwN7dZ6HQBlSuUSJGzxtZhab6wJRPKU8yvgc6roSOqCi3xc6Z1P DlQ7U/16m1f8F5t1KqhRxVjUSzd0S68ELmNvOB40/ujkdOry/9KAHI5GGawaRxTd+PR4 kPgKrXwHLD8tvadQbulceUCZnfIdTxithXbMng+xyoq8X5XHAxk8OLOfuvv/A8F8KpWR x/nMh37Xlgd0fJD0qrogCM8GNvREc7mYBTHrpERYfO7G+u4RRc4FfZ8RuvVjeU2RUK5/ kA2vmU4xwLmggG56T7RbJ4Clxwfzs5mmm8YZCI6E71Q+2iBzjPwAwnwMhZeJvJ1M7ZBl PRoQ== X-Gm-Message-State: AOAM532o5zbCxt0ntvAYMYQT53Fwj+DAz0mz2cmNcGw0eMChS/oWRv2M A0u2myOZHS9xXbGueJnqSC+jfd/anhFBtWWX X-Received: by 2002:a5d:6406:: with SMTP id z6mr5360069wru.264.1616170434676; Fri, 19 Mar 2021 09:13:54 -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 h8sm8432495wrt.94.2021.03.19.09.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 09:13:54 -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 v3 03/12] wcn36xx: Add ipv4 ARP offload support in suspend Date: Fri, 19 Mar 2021 16:15:11 +0000 Message-Id: <20210319161520.3590510-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210319161520.3590510-1-bryan.odonoghue@linaro.org> References: <20210319161520.3590510-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-20210319_161355_346643_BECA28FC X-CRM114-Status: GOOD ( 16.10 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: Add ARP offload support. Firmware is capable of responding to ARP requests for a single ipv4 address only. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 10 +++---- drivers/net/wireless/ath/wcn36xx/main.c | 5 +++- drivers/net/wireless/ath/wcn36xx/s [...] 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 [2a00:1450:4864:20:0:0:0:429 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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's 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 Add ARP offload support. Firmware is capable of responding to ARP requests for a single ipv4 address only. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 10 +++---- drivers/net/wireless/ath/wcn36xx/main.c | 5 +++- drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 +++ 4 files changed, 51 insertions(+), 6 deletions(-) -- 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 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 c0c1ea18864f..f95103706100 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1117,11 +1117,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) vif_priv = wcn36xx_vif_to_priv(vif); if (!vif_priv->sta_assoc) goto out; + ret = wcn36xx_smd_arp_offload(wcn, vif, true); + if (ret) + goto out; ret = wcn36xx_smd_set_power_params(wcn, true); } out: mutex_unlock(&wcn->conf_mutex); - return ret; } @@ -1142,6 +1144,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_arp_offload(wcn, vif, false); } out: mutex_unlock(&wcn->conf_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 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_ */