From patchwork Mon Mar 15 12:09: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: 400405 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3356581jai; Mon, 15 Mar 2021 05:09:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytnNxjSxVNwNEvullu42Q4o577HLQeR/xOonxhxCpVTe68xgvMbLRUn13bQkebWr8CxAj3 X-Received: by 2002:a05:600c:4ba2:: with SMTP id e34mr25717442wmp.121.1615810151546; Mon, 15 Mar 2021 05:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615810151; cv=none; d=google.com; s=arc-20160816; b=f63R0QO8L6I52/hStHYCFdb0s64cOrU/8JGBcG7XF+HEJt4jP7PGamiEvG/lPm8vJ1 VXd4SKy1HIEeFrbr29ecxXvvKGBpjJcXO3ZRL5kmkI9D0W7uZmIpX2PR90No9hPTBAfN HSydUQ/rQY/TIT1plUME6N+hdKMKFVBidRnkhT6jeHnQuYgrx8PMv8DS9zsLjzy1ZTuw UB6CICG+mZ+KhYTzZzmw3vuqBaLm+x9dSZRzMBRE3ljNkLEC6f7uZG1bhzvX/fImIbV/ tsDw0bWKLzwfzs6/Yy2ar8Xv2gtkgSfeay+9/UzDny12ulw3KAt8DqUvy+8E/hvc+v34 xYdQ== 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=hRRlji5EKWlYATK4Q/JjFfGsjamjpBflBNA00LfXmj0=; b=ZD2QO2IczaF6I1/yjr0H4Xv3M4MCVAvDTxZk9XN76Clr5CgvIZqmOg7g6YZPerJfNA 1klfe7mCeylV4JdUD+9uceI4yVSF4wQZXaVfogUqR63jmFLHZ06Ih0G78/ckKUBCtJwh 6zZjb9g/yka5nGeB9G6CLlqFDsysbzyi92OXgt7TX3sFxNONM6p3nGFVK6scQoF8QSDE yTeaU9+qmVHvd4U0z3K4470raX94OFOe5p8QeUjHwdk0zYWOpo4GJ930F2qmAmHwtvc8 lpQiOr3eX1X5jfSOS/PdPmkU7YxgzcEUshWenNhImkbBYODu+UOiXI0DDC+ngCvQtJhE huIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YZqpE03E; 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 g8si9901547wmk.85.2021.03.15.05.09.11; Mon, 15 Mar 2021 05:09: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=YZqpE03E; 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 S231138AbhCOMIj (ORCPT + 2 others); Mon, 15 Mar 2021 08:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbhCOMIP (ORCPT ); Mon, 15 Mar 2021 08:08:15 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C068C061574 for ; Mon, 15 Mar 2021 05:08:15 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id o16so5559958wrn.0 for ; Mon, 15 Mar 2021 05:08:15 -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=hRRlji5EKWlYATK4Q/JjFfGsjamjpBflBNA00LfXmj0=; b=YZqpE03EMFC7BQsTcb0yXpV5B+qYqZpLGqtANWl8+aM8Rx/Hh9UZVdKyRFlqeVjoNp 2xXnd7axQW1Bn6oxYCNvJhGyoasnczo2Rn2XvQBd2Gtce38rGq2HFORgJRA5EwNDL9UZ JyvVCYGEWxPLyiORwTLXzE1uv1NgELeDD/TEKDO2WiEEdYBSEc7ncsuGTeMT3yqdl76T Ulx8aHDYWVEYC/ZzA1gFthpkuw7Lw56DciMjh9scBzh9OkNevW5woIh1fSpwq4Pg0eaX dlxlnP0WgIGU3qkoTBcCvwJXPhflwSfjTixsCXd2mJQKF4cJn6+votTU9DYWA9F2PBxB +KsA== 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=hRRlji5EKWlYATK4Q/JjFfGsjamjpBflBNA00LfXmj0=; b=qehp+XUdZL1Qfu8Gvuih/hneXY6zCH4vVTfcWnSBzleXu7ryhtgS5WhA32UvrxAfXG LIL8gKiphgER8ta2umGYpgmnSlopIG0y9LmUaTmU1wtlVQ6N06GF9BHklb57ANWRWpiN y5TsEUAPJr+9Uq9p0B0Qgd0XJFpJzIFUSQoUWaVCqB3NX2mkIVMxk3zAR24zPmXMNNa/ XaugYEvMXuP5/WWMUeKGxJs3btHoW57h+mRZIM88ZwQbg6Poeewnf1Zo73F7KX9L1sO4 ejrn4mMHLbSUVghxVZqEQMCSfkUqFhiVY6psaI0mf/NJ7esc9jyU33E2XusEgCuUvHba 3xjg== X-Gm-Message-State: AOAM533h8AfsLCj0MJHWac6rO59R6NEkpZ89Tl0V+JJutyZDjRb1KPN0 95ucIwtyKY6bf3tkdiA7/WMgrQ== X-Received: by 2002:adf:ffc8:: with SMTP id x8mr26760500wrs.384.1615810093799; Mon, 15 Mar 2021 05:08:13 -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 c18sm29239891wmk.0.2021.03.15.05.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 05:08:13 -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 v2 05/12] wcn36xx: Add ipv6 address tracking Date: Mon, 15 Mar 2021 12:09:30 +0000 Message-Id: <20210315120937.2512341-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210315120937.2512341-1-bryan.odonoghue@linaro.org> References: <20210315120937.2512341-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 --- 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 029c9952b4fb..93eff6563187 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" @@ -1216,6 +1217,34 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw, return ret; } +#if IS_ENABLED(CONFIG_IPV6) +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, @@ -1239,6 +1268,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; };