From patchwork Mon Dec 13 13:51:25 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: 523643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1607EC433F5 for ; Mon, 13 Dec 2021 13:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237916AbhLMNtZ (ORCPT ); Mon, 13 Dec 2021 08:49:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234610AbhLMNtY (ORCPT ); Mon, 13 Dec 2021 08:49:24 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41912C06173F for ; Mon, 13 Dec 2021 05:49:24 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id v11so27121795wrw.10 for ; Mon, 13 Dec 2021 05:49:24 -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=uTYixfrhf6bWN82g0Fi5qU9LAYUUaPAtaNL6sw+Jd4U=; b=UzkP3u7mSRzndezO5s6DIfYjheCQSdCtQU02g3Q5ETtGqScOMlm5VyzNoy9cUiNM6i vaV5b0J+kpEicIiBgpHVFTqJdXYVavg8/2ClSQpUBmZIB8i+3KlSl44I7u/kQLYL1bln wAu0+ith3OH2xkKQ6LINlR35Zv2FdwXYZwJONimN0yVstrcDg8bICGoU9rAb7Nvksh9U R/jBBC2oRQq0LRZ2AMaIXkA0hwT/Or4zWE3msLK/kDhKK+xoScvB22JH16TcbOZmMbpa 5Egll1Rbzgh4TjkHx8186xLo+dmPSFqQapSaty8SQmevV/y4/4rncvu+oif0qof18jy7 2abw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uTYixfrhf6bWN82g0Fi5qU9LAYUUaPAtaNL6sw+Jd4U=; b=odu4xQbw8uFOMOlK+jgTPWMp/CIPI6sDa7fLtz03EyjgGaXNbGyxGdsqxMFoyC2vnU GqU2guTiDahYsDDozqbrMg/HWrqJ+XbP0uuwC0s6Ng8XX3Dwex+fdE6K65pQMuQ8izpt P6Xg9M8rtIeRuyzaDYyCpqg2y2dwUkIvpTRcPGHmIwjgv/gpgapEaDPoakmEVSyRLT9c bUdk6nC4mpOKe0TDVgARgp4P9cyr/7zSzAFUcsoAGpKxxE8G1n9yY0XmIRQxLyEwRWQn YYGPt1QmJWMOTPQFi86tjMpF4qqtNGc+eJZ2GcLokY0Xez5u8TKJztYrJ0Fb/NsP/UrN Sxtg== X-Gm-Message-State: AOAM531UazB7eFG8SjICYfpBUg7JkebTOtaVqGgeTpf8GRa2D4ofeXEv prWzgcsaA1G6I//B7vT6Icq8zQ== X-Google-Smtp-Source: ABdhPJwK6y8wWUO3a3CYfX2jh280i5UfxSv4TZuelqWNn5LWM0hWXZ+LUPFZxc2v+BpnSFWIvbUWOQ== X-Received: by 2002:adf:dcc8:: with SMTP id x8mr16979001wrm.684.1639403362897; Mon, 13 Dec 2021 05:49:22 -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 m9sm7366621wmq.1.2021.12.13.05.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 05:49:22 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: loic.poulain@linaro.org, benl@squareup.com, bryan.odonoghue@linaro.org Subject: [PATCH 1/3] wcn36xx: Fix beacon filter structure definitions Date: Mon, 13 Dec 2021 13:51:25 +0000 Message-Id: <20211213135127.1656258-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> References: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The beacon filter structures need to be packed. Right now its fine because we don't yet use these structures so just pack them without marking it for backporting. Signed-off-by: Bryan O'Donoghue Reviewed-by: Loic Poulain --- drivers/net/wireless/ath/wcn36xx/hal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 9bea2b01f9aab..9bce71592f743 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3469,7 +3469,7 @@ struct beacon_filter_ie { u8 value; u8 bitmask; u8 ref; -}; +} __packed; struct wcn36xx_hal_add_bcn_filter_req_msg { struct wcn36xx_hal_msg_header header; @@ -3480,14 +3480,14 @@ struct wcn36xx_hal_add_bcn_filter_req_msg { u16 ie_num; u8 bss_index; u8 reserved; -}; +} __packed; struct wcn36xx_hal_rem_bcn_filter_req { struct wcn36xx_hal_msg_header header; u8 ie_Count; u8 rem_ie_id[1]; -}; +} __packed; #define WCN36XX_HAL_IPV4_ARP_REPLY_OFFLOAD 0 #define WCN36XX_HAL_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD 1 From patchwork Mon Dec 13 13:51:26 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: 523897 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46B7BC433FE for ; Mon, 13 Dec 2021 13:49:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237945AbhLMNt1 (ORCPT ); Mon, 13 Dec 2021 08:49:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237933AbhLMNtZ (ORCPT ); Mon, 13 Dec 2021 08:49:25 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F44AC061574 for ; Mon, 13 Dec 2021 05:49:25 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id t18so27094905wrg.11 for ; Mon, 13 Dec 2021 05:49:25 -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=HH/24Zvsag5iRgFp5ZNMJb2/h4lApJp4KjXAfpB5th0=; b=xRPXCoCVRYy5uQJ7vpO/MeJlrs/bnkvxiWLaFYiSSGTtmbJT3W+d3JRkPWfuWzJ47g TwJ7lWTUk+RLrh2H8SuVZcxtcsoxCv69SbdtxZhDNUp+kawtFsu4ya52Vb6qGPmHL1JK M51ilv7ZgqGackFR6py2GYoprLD+Ohen3QwEphwaJUEzab56YURCzrN6KOTaHJroQ03Q ANNfAU8eCaLlIKTSF2m5Hiv7Jej7hwxBbuY5jcG4fVmCLecKoXr83b7lJynISX8wsSKw idZsNFibARopsaQhKE6js/Kwlvq2TCZaq+/OA0PUHbim/1SzI0p8H/ihh6nC1pOxQzx5 OfGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HH/24Zvsag5iRgFp5ZNMJb2/h4lApJp4KjXAfpB5th0=; b=774ZPBT1Z97Ga1MoL3NeoMw8qtCX5SVwEuhnyXYsvodhLYy7T9jRbDdg+TE5hvBvwO XMPHEmVTwILJOZnlq2RQkX9zb3Ny6WrVXISWMXO44p7iCOcSD45rN0RfyahRxyUndJ14 9G9gLcmLGvJoEswD0xRcO6y6T79WehX1borlhBMO3wJjbFUsSHWIJoHQid77fC2c+ulh qWdP1iXcbC+AYYymzPtxXWvNZKgSNlY4XVGtBFf3taquen188LQ1o2Z03iWwlmHNbqac OGh3gIH5XPULFYcRVDwu4WZMgmeuWSScEmt4LlLdZmHV+f16I1N24z3AJxj+LdUQsCQk 8/1A== X-Gm-Message-State: AOAM531sVuvb8ed9l7aYj930DI4Yf2nITEPTJMC18MmeXO/CzqevOB50 sKgnevtyLk/P5fEoIIC/YHEBoEdJ8Tq/Bw== X-Google-Smtp-Source: ABdhPJw+xJVA+LsdGvwdw0uxQjprhhYxS7WKkevH1YfIoqTOrxSS9+02z9trfe0GwmlNIN3pEoOqrw== X-Received: by 2002:adf:ef42:: with SMTP id c2mr31400529wrp.528.1639403363901; Mon, 13 Dec 2021 05:49:23 -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 m9sm7366621wmq.1.2021.12.13.05.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 05:49:23 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: loic.poulain@linaro.org, benl@squareup.com, bryan.odonoghue@linaro.org Subject: [PATCH 2/3] wcn36xx: Fix physical location of beacon filter comment Date: Mon, 13 Dec 2021 13:51:26 +0000 Message-Id: <20211213135127.1656258-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> References: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The comment in the header with respect to beacon filtering makes a reference to "the structure above" and "the structure below" which would be informative if the comment appeared in the right place but, it does not. Fix the comment location so that it a least makes sense w/r/t the physical location statements. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 9bce71592f743..e9fec110721b5 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3459,9 +3459,6 @@ struct wcn36xx_hal_missed_beacon_ind_msg { /* Beacon Filtering data structures */ -/* The above structure would be followed by multiple of below mentioned - * structure - */ struct beacon_filter_ie { u8 element_id; u8 check_ie_presence; @@ -3471,6 +3468,10 @@ struct beacon_filter_ie { u8 ref; } __packed; +/* The above structure would be followed by multiple of below mentioned + * structure + */ + struct wcn36xx_hal_add_bcn_filter_req_msg { struct wcn36xx_hal_msg_header header; From patchwork Mon Dec 13 13:51:27 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: 523642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A041C43217 for ; Mon, 13 Dec 2021 13:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237951AbhLMNt2 (ORCPT ); Mon, 13 Dec 2021 08:49:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234610AbhLMNt1 (ORCPT ); Mon, 13 Dec 2021 08:49:27 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8201CC06173F for ; Mon, 13 Dec 2021 05:49:26 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id c6-20020a05600c0ac600b0033c3aedd30aso11604448wmr.5 for ; Mon, 13 Dec 2021 05:49:26 -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=Gsa1pstyv6w1sqIg/mnQZfaPOzABwBdP6qpZqIqI/04=; b=OPHTOBIuWWj1+K8ommhE6DlXjsm8U2Zd2ax59j5cpgyJPniPq2RBftR6/PTRAFkdYq 3Kyusd5lI1Eez9uTk9mZNHOxcvczDhbIMnoqI21IJ2sa7pHoGzkLLV7J/SnQZ8cbJYd0 e5/nYON2xXMQrRTtNor/QeKf5jKLPBD8zb51qowDiLE2iXsQbq1b+Rk23BIfaI1pEFgV 8feKr/YEzRHq69s9R8mNusjMF5kHOMLsNKgZSPGFGjKAYo6bFlaGL6PVjdGSJXZc96B0 0CSsv/1yb/2qVmCPTLWLdHCNWfFl9NNfIlIevjrsUbtfy/DHJ6o5VP8zvi7gvAN9Nbqn YJOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gsa1pstyv6w1sqIg/mnQZfaPOzABwBdP6qpZqIqI/04=; b=jOvZzMm+pDanP+SAKMzXFoxrrylqvsCL+P7MZzEY9+CdtEE9kWOqiByT/JNhfTVDKy 2YV3QEnghcoRfppYaKE+X49cSgBvGD1vQ6XaE/sM/xwCYtrnN30xFupE56RkL+xYy9JH 2U/33+4BbsZJAa73j0PRSAA+ObSuBlplZSWnO00Y0vFEEQAnvrinYU26A2c3TGW0ruWH nl7IURlnKETluIiLobA8RIeEt3bThX21aU5qdb+T6b45vE6R+Rcr7Os0a0zeWYoiIMGT AyvkT10bgEWCf9iNXNoC4T9pgvsrpCudTIQJds7BEfyCgoJsLJG2IVzTrr/Nm0dVQkbR k+AA== X-Gm-Message-State: AOAM531vbyvbuywifJCy9hph1jU7S87WxILvNWqTKVqdyjIaN5yJDQB9 NBBvRIXGp8Po/wbIgRU6N7vFXtyIh2CAjQ== X-Google-Smtp-Source: ABdhPJwGsaRP8zxx8t6TY+AMeeHBOJl6HLm6GfS0I+XVBdspUoDpGyoHGGmkoPNlfEr3mhanhR5K3w== X-Received: by 2002:a1c:7714:: with SMTP id t20mr37604668wmi.139.1639403365114; Mon, 13 Dec 2021 05:49:25 -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 m9sm7366621wmq.1.2021.12.13.05.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 05:49:24 -0800 (PST) From: Bryan O'Donoghue To: kvalo@codeaurora.org, linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: loic.poulain@linaro.org, benl@squareup.com, bryan.odonoghue@linaro.org Subject: [PATCH 3/3] wcn36xx: Implement downstream compliant beacon filtering Date: Mon, 13 Dec 2021 13:51:27 +0000 Message-Id: <20211213135127.1656258-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> References: <20211213135127.1656258-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Downstream facilitates the direct programming of beacon filter tables via SMD commands. The purpose of beacon filters is quote: /* When beacon filtering is enabled, firmware will * analyze the selected beacons received during BMPS, * and monitor any changes in the IEs as listed below. * The format of the table is: * - EID * - Check for IE presence * - Byte offset * - Byte value * - Bit Mask * - Byte reference */ The default downstream firmware filter table looks something like this: tBeaconFilterIe gaBcnFilterTable[12] = { { WLAN_EID_DS_PARAMS, 0u, { 0u, 0u, 0u, 0u } }, { WLAN_EID_ERP_INFO, 0u, { 0u, 0u, 248u, 0u } }, { WLAN_EID_EDCA_PARAM_SET, 0u, { 0u, 0u, 240u, 0u } }, { WLAN_EID_QOS_CAPA, 0u, { 0u, 0u, 240u, 0u } }, { WLAN_EID_CHANNEL_SWITCH, 1u, { 0u, 0u, 0u, 0u } }, { WLAN_EID_QUIET, 1u, { 0u, 0u, 0u, 0u } }, { WLAN_EID_HT_OPERATION, 0u, { 0u, 0u, 0u, 0u } }, { WLAN_EID_HT_OPERATION, 0u, { 1u, 0u, 248u, 0u } }, { WLAN_EID_HT_OPERATION, 0u, { 2u, 0u, 235u, 0u } }, { WLAN_EID_HT_OPERATION, 0u, { 5u, 0u, 253u, 0u } }, { WLAN_EID_PWR_CONSTRAINT, 0u, { 0u, 0u, 0u, 0u } }, { WLAN_EID_OPMODE_NOTIF, 0u, { 0u, 0u, 0u, 0u } } }; Add in an equivalent filter set as present in the downstream Linux driver. For now omit the beacon filter "rem" command as downstream does not have an explicit call to that SMD command. The filter mask should only count when we are inside BMPS anyway. Replicating the downstream ability to program the filter table gives us scope to add and remove elements in future. For now though this patch makes the rote-copy of the downstream Linux beacon filter table, which we can tweak as desired from now on. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 16 ++++ drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 104 ++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 + 4 files changed, 124 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index e9fec110721b5..3351aaf5140df 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3468,6 +3468,22 @@ struct beacon_filter_ie { u8 ref; } __packed; +/* Downstream values for the bitmask field */ +#define WCN36XX_FILTER_CAPABILITY_MASK 0x73cf +#define WCN36XX_FILTER_IE_DS_CHANNEL_MASK 0x00 +#define WCN36XX_FILTER_IE_ERP_FILTER_MASK 0xF8 +#define WCN36XX_FILTER_IE_EDCA_FILTER_MASK 0xF0 +#define WCN36XX_FILTER_IE_QOS_FILTER_MASK 0xF0 +#define WCN36XX_FILTER_IE_CHANNEL_SWITCH_MASK 0x00 +#define WCN36XX_FILTER_IE_HT_BYTE0_FILTER_MASK 0x00 +#define WCN36XX_FILTER_IE_HT_BYTE1_FILTER_MASK 0xF8 +#define WCN36XX_FILTER_IE_HT_BYTE2_FILTER_MASK 0xEB +#define WCN36XX_FILTER_IE_HT_BYTE5_FILTER_MASK 0xFD +#define WCN36XX_FILTER_IE_OPMODE_NOTIF_MASK 0x00 +#define WCN36XX_FILTER_IE_VHTOP_CHWIDTH_MASK 0xFC +#define WCN36XX_FILTER_IE_RSN_MASK 0x00 +#define WCN36XX_FILTER_IE_VENDOR_MASK 0x00 + /* The above structure would be followed by multiple of below mentioned * structure */ diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index f59eb1119da88..a4510f144041f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -934,6 +934,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw, * place where AID is available. */ wcn36xx_smd_config_sta(wcn, vif, sta); + wcn36xx_smd_add_beacon_filter(wcn, vif); wcn36xx_enable_keep_alive_null_packet(wcn, vif); } else { wcn36xx_dbg(WCN36XX_DBG_MAC, diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index b05d10f9f6005..e6ee14adbe0da 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -3193,6 +3193,109 @@ int wcn36xx_smd_host_resume(struct wcn36xx *wcn) return ret; } +#define BEACON_FILTER(eid, presence, offs, val, mask, ref_val) \ + { \ + .element_id = eid, \ + .check_ie_presence = presence, \ + .offset = offs, \ + .value = val, \ + .bitmask = mask, \ + .ref = ref_val, \ + } + +/* Downstream values for the bitmask field */ +#define WCN36XX_FILTER_CAPABILITY_MASK 0x73cf +#define WCN36XX_FILTER_IE_DS_CHANNEL_MASK 0x00 +#define WCN36XX_FILTER_IE_ERP_FILTER_MASK 0xF8 +#define WCN36XX_FILTER_IE_EDCA_FILTER_MASK 0xF0 +#define WCN36XX_FILTER_IE_QOS_FILTER_MASK 0xF0 +#define WCN36XX_FILTER_IE_CHANNEL_SWITCH_MASK 0x00 +#define WCN36XX_FILTER_IE_HT_BYTE0_FILTER_MASK 0x00 +#define WCN36XX_FILTER_IE_HT_BYTE1_FILTER_MASK 0xF8 +#define WCN36XX_FILTER_IE_HT_BYTE2_FILTER_MASK 0xEB +#define WCN36XX_FILTER_IE_HT_BYTE5_FILTER_MASK 0xFD +#define WCN36XX_FILTER_IE_PWR_CONSTRAINT_MASK 0x00 +#define WCN36XX_FILTER_IE_OPMODE_NOTIF_MASK 0x00 +#define WCN36XX_FILTER_IE_VHTOP_CHWIDTH_MASK 0xFC +#define WCN36XX_FILTER_IE_RSN_MASK 0x00 +#define WCN36XX_FILTER_IE_VENDOR_MASK 0x00 + +/* CORE/MAC/src/pe/lim/limSendMessages.c::beaconFilterTable[] */ +static struct beacon_filter_ie bcn_filter_ies[] = { + BEACON_FILTER(WLAN_EID_DS_PARAMS, 0, 0, 0, + WCN36XX_FILTER_IE_DS_CHANNEL_MASK, 0), + BEACON_FILTER(WLAN_EID_ERP_INFO, 0, 0, 0, + WCN36XX_FILTER_IE_ERP_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_EDCA_PARAM_SET, 0, 0, 0, + WCN36XX_FILTER_IE_EDCA_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_QOS_CAPA, 0, 0, 0, + WCN36XX_FILTER_IE_QOS_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_CHANNEL_SWITCH, 1, 0, 0, + WCN36XX_FILTER_IE_CHANNEL_SWITCH_MASK, 0), + BEACON_FILTER(WLAN_EID_HT_OPERATION, 0, 0, 0, + WCN36XX_FILTER_IE_HT_BYTE0_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_HT_OPERATION, 0, 2, 0, + WCN36XX_FILTER_IE_HT_BYTE2_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_HT_OPERATION, 0, 5, 0, + WCN36XX_FILTER_IE_HT_BYTE5_FILTER_MASK, 0), + BEACON_FILTER(WLAN_EID_PWR_CONSTRAINT, 0, 0, 0, + WCN36XX_FILTER_IE_PWR_CONSTRAINT_MASK, 0), + BEACON_FILTER(WLAN_EID_OPMODE_NOTIF, 0, 0, 0, + WCN36XX_FILTER_IE_OPMODE_NOTIF_MASK, 0), + BEACON_FILTER(WLAN_EID_VHT_OPERATION, 0, 0, 0, + WCN36XX_FILTER_IE_VHTOP_CHWIDTH_MASK, 0), + BEACON_FILTER(WLAN_EID_RSN, 1, 0, 0, + WCN36XX_FILTER_IE_RSN_MASK, 0), + BEACON_FILTER(WLAN_EID_VENDOR_SPECIFIC, 1, 0, 0, + WCN36XX_FILTER_IE_VENDOR_MASK, 0), +}; + +int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn, + struct ieee80211_vif *vif) +{ + struct wcn36xx_hal_add_bcn_filter_req_msg msg_body, *body; + struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); + u8 *payload; + size_t payload_size; + int ret; + + if (!get_feat_caps(wcn->fw_feat_caps, BCN_FILTER)) + return -EOPNOTSUPP; + + mutex_lock(&wcn->hal_mutex); + INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_BCN_FILTER_REQ); + + PREPARE_HAL_BUF(wcn->hal_buf, msg_body); + + body = (struct wcn36xx_hal_add_bcn_filter_req_msg *)wcn->hal_buf; + body->capability_info = vif->bss_conf.assoc_capability; + body->capability_mask = WCN36XX_FILTER_CAPABILITY_MASK; + body->beacon_interval = vif->bss_conf.beacon_int; + body->ie_num = ARRAY_SIZE(bcn_filter_ies); + body->bss_index = vif_priv->bss_index; + + payload = ((u8 *)body) + body->header.len; + payload_size = sizeof(bcn_filter_ies); + memcpy(payload, &bcn_filter_ies, payload_size); + + body->header.len += payload_size; + + ret = wcn36xx_smd_send_and_wait(wcn, body->header.len); + if (ret) { + wcn36xx_err("Sending add bcn_filter failed\n"); + goto out; + } + + ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len); + if (ret) { + wcn36xx_err("add bcn filter response 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) { @@ -3248,6 +3351,7 @@ int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev, case WCN36XX_HAL_ENTER_IMPS_RSP: case WCN36XX_HAL_EXIT_IMPS_RSP: case WCN36XX_HAL_UPDATE_CHANNEL_LIST_RSP: + case WCN36XX_HAL_ADD_BCN_FILTER_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 cfde15341a88d..957cfa87fbdea 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -167,4 +167,7 @@ int wcn36xx_smd_host_resume(struct wcn36xx *wcn); int wcn36xx_smd_enter_imps(struct wcn36xx *wcn); int wcn36xx_smd_exit_imps(struct wcn36xx *wcn); +int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn, + struct ieee80211_vif *vif); + #endif /* _SMD_H_ */