From patchwork Mon Dec 28 16:28:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 352753 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp10027784ejs; Mon, 28 Dec 2020 08:27:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJwycWnUEmEhkyb0B0TWk41SVXgrpt3k6H1fwnyr0DO6KHeRtgaFhVTyVtktg4myKC6OARp4 X-Received: by 2002:a92:d2ce:: with SMTP id w14mr35973580ilg.182.1609172861739; Mon, 28 Dec 2020 08:27:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172861; cv=none; d=google.com; s=arc-20160816; b=Nn+6B7Gb26QSXLzd5zWuw3O2n5R4Q81nJsG1Qdd+c9fZUYfvbfvxvVr2eLnAOGUNXB XBJ1hcyqSmINBZNZGHqwwmaHZyNj3BX0/s7wbFwYNzSbUK6GFObfvanSaB1kWxTvGke4 NVA+lIfo8bFH/K0Bz9VrX0c2MAVFz156GiT05XdHzb7E/mlneCtRve4tTl0E81BeCf+b AE83vyAtXxaHkwThNgGwdt7hoqVeR+3mdNdd46QkmOO1RVdmZ/hjWNSwz6E+1M//6Psg W4eW7Weir4nk02qAzf7Y/OaJEnOqG4aIWUoalzisiQ302+rLhisS+mqLD2DawoHsraVU 1QHQ== 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=n7Az0J5jcfbSONfd55br67CG8vitRKN9kH6XIj6vyMU=; b=euiaigfrUHHjO9PhFXGi8vcjCZKauyz6HOioBS5fzCxkIpY4o/oajrqNXWoHQwA+Jp 29DsSQUxThUrvK9y4MBOqtXayTOjnHowWLOrMSw7LyZCKQJ8ppQImK4lcrUaGVbfjOyK /K1Ps8ajopgDJGnG3yr6GrJZzIsYXABTt7QU9JSq+6Nx3QpY5Hhp2vPpV43mAPvwFPsC fK8gcvm6XM1UEeZYTtzef7Mt2D1aN3J6Nr1khHW8Lg5oOrl7YmG+uiAlhhGgSfpc/ePw dEi/215YOEsy8LNgN1hodObQS83CTFaILo7mqh2q26Twj1Hw8/T0sl4YI/40cVd5bcrZ /+Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=merlin.20170209 header.b=oNVM7lhS; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TNcq2zx3; 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 d21si30799207jak.116.2020.12.28.08.27.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:41 -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=oNVM7lhS; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TNcq2zx3; 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=n7Az0J5jcfbSONfd55br67CG8vitRKN9kH6XIj6vyMU=; b=oNVM7lhS8DfPCzCzp2QZ4jyCh +dPolD1W+PBUfEQ3xtxktEpDrE686GqoQS2NifmaoW7tQ6aHu2OJKBagLdVKY3kL//XXpEpUlRFiy Q/D7ySqfDeu4NdOWsIgzNpmiHnHc+rdTk1pXNW6nj1nuT997Eh0lSDyLqBdhMn45pg5pk6erZK7tF CexXDKvgcrFxDlN6Betcv2810FtIRq6iolcM9eOSiWtkOvQMDkEpnXMBJhSsPe+9FdLGwnCaZuVbS wcXJH1YahS7UStHNBZL2YhBs8CmhBbkHWE0dlg94Isg1bY6ytfTe0epEDVpYb4Nw+RxM4hc40Anam bmbMVUzng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvMv-0004XC-SY; Mon, 28 Dec 2020 16:27:37 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktvMs-0004UN-NT for wcn36xx@lists.infradead.org; Mon, 28 Dec 2020 16:27:36 +0000 Received: by mail-wr1-x42f.google.com with SMTP id i9so11768473wrc.4 for ; Mon, 28 Dec 2020 08:27:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ltohQzViTXov8BpVEXom7/dF0P1+ZXvRdo3+msQAQjk=; b=TNcq2zx3qOV1ztzjb/fZgvXmN9Yay15r1eWasNdPXf0Gsz2NbNj+WiXlN+qKpkvz4A gyFIz/uM1mjGlhXkEdL5aa2GPbY2gC2ybctZxYxVXj7LMVz7EPvDPJVlOb8N6sDjXSB8 HwAcKjNnqj3A4QL9woyMPy3rS4266mz9Z5ADD01rfvg6yBcANGiqDpqrH9XlGO2dxVGj ia/KG4akeqWRm9Th43EqVJ/Myrk0+QL30isyyojsWEEt7uwctobz8KePxH+9IkjF5g3u HSoGTCI4oDtSZfP1j3wu0i/32QXRURDN4s51n1f/h4PRg/8yulovLR96aeVLY6nneSlg pVgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ltohQzViTXov8BpVEXom7/dF0P1+ZXvRdo3+msQAQjk=; b=WSg77MmhagOcMQubE50zc+KJAlan6oK2oFUKfkj1JRpiM7vmi+12Ywg+EqzonxFxrq TVIZRNa6ipGMvNuxuqylm7IM2YRu0QLvv1O3RB508rtpkIAljs4Ujbx+7L3QxMsUJAhc x1vxuntbnVpEPRC3w/RLnD13CvoP36AJr5/oQ3KdtsTfzK3ceGsYZzPIFqL+FWj06cQR OLtWE683oNuD73Xq4v5vaQ5YWSUvAhqlvAXRUAVGUKILcVG3sD5GATBXSUwoQDN6Yq3Y CReB4KOtJPzE4LBTNOY9vUyK3Cm0Drm1mTi9kZPNB9XAak/d9djXSx8khxD49AZyKZPm snVA== X-Gm-Message-State: AOAM531bbUSC8xJO8FKT2h7ffB1dhUgGwq4UiVfCNuF0e9+ErjW3paNA LdL8v1mjGyOGtSOxjZlfNxxFkw== X-Received: by 2002:a5d:4f10:: with SMTP id c16mr50826921wru.398.1609172853329; Mon, 28 Dec 2020 08:27:33 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id w21sm19523379wmi.45.2020.12.28.08.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Dec 2020 08:27:32 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH 03/13] wcn36xx: Add ipv4 ARP offload support in suspend Date: Mon, 28 Dec 2020 16:28:29 +0000 Message-Id: <20201228162839.369156-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228162839.369156-1-bryan.odonoghue@linaro.org> References: <20201228162839.369156-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201228_112735_031788_666A8D01 X-CRM114-Status: GOOD ( 15.36 ) 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 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42f listed in] [list.dnswl.org] -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 This commit adds ARP offload support. Firmware is capable of responding to ARP requests for a single ipv4 address only. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 10 +++---- drivers/net/wireless/ath/wcn36xx/main.c | 5 +++- drivers/net/wireless/ath/wcn36xx/smd.c | 38 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 +++ 4 files changed, 51 insertions(+), 6 deletions(-) -- 2.29.2 _______________________________________________ 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 b90664bdf6ee..c463ec7c1568 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1117,11 +1117,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) vif_priv = wcn36xx_vif_to_priv(vif); if (!vif_priv->sta_assoc) goto out; + ret = wcn36xx_smd_arp_offload(wcn, vif, true); + if (ret) + goto out; ret = wcn36xx_smd_set_power_params(wcn, true); } out: mutex_unlock(&wcn->conf_mutex); - return ret; } @@ -1142,6 +1144,7 @@ static int wcn36xx_resume(struct ieee80211_hw *hw) goto out; wcn36xx_smd_set_power_params(wcn, false); + wcn36xx_smd_arp_offload(wcn, vif, false); } out: mutex_unlock(&wcn->conf_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 5445277dd8de..4589c3d26027 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2757,6 +2757,43 @@ int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, return ret; } +int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable) +{ + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + struct wcn36xx_hal_host_offload_req_msg msg_body; + int ret; + + mutex_lock(&wcn->hal_mutex); + + INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ); + msg_body.host_offload_params.offload_type = + WCN36XX_HAL_IPV4_ARP_REPLY_OFFLOAD; + if (enable) { + msg_body.host_offload_params.enable = + WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE; + memcpy(&msg_body.host_offload_params.u, + &vif->bss_conf.arp_addr_list[0], sizeof(__be32)); + } + msg_body.ns_offload_params.bss_index = vif_priv->bss_index; + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len); + if (ret) { + wcn36xx_err("Sending host_offload_arp failed\n"); + goto out; + } + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("host_offload_arp failed err=%d\n", ret); + goto out; + } +out: + mutex_unlock(&wcn->hal_mutex); + return ret; +} + int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, void *buf, int len, void *priv, u32 addr) { @@ -2805,6 +2842,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_8023_MULTICAST_LIST_RSP: case WCN36XX_HAL_START_SCAN_OFFLOAD_RSP: case WCN36XX_HAL_STOP_SCAN_OFFLOAD_RSP: + case WCN36XX_HAL_HOST_OFFLOAD_RSP: memcpy(wcn->hal_buf, buf, len); wcn->hal_rsp_len = len; complete(&wcn->hal_rsp_compl); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index b1d8083d9d9d..1458682ee715 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -146,4 +146,8 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct wcn36xx_hal_rcv_flt_mc_addr_list_type *fp); + +int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif, + bool enable); + #endif /* _SMD_H_ */