From patchwork Tue Dec 14 13:46:28 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: 12691831 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 880D6C433F5 for ; Tue, 14 Dec 2021 13:44:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234517AbhLNNoa (ORCPT ); Tue, 14 Dec 2021 08:44:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234509AbhLNNo2 (ORCPT ); Tue, 14 Dec 2021 08:44:28 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42819C061748 for ; Tue, 14 Dec 2021 05:44:28 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id p27-20020a05600c1d9b00b0033bf8532855so13795958wms.3 for ; Tue, 14 Dec 2021 05:44:28 -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=iH31IPcSjhrHBMlbPkShOp+GZgBxks+YGO36i19sp8s=; b=oTFQvwJcXHMQj5RirhlFbzNf6Dxs1er3O+vMZmGwr9KSJ/vS3JgWSX7GhPr2CJBCzn 5nlF1Kwuf8A6AUbi2sse6ATGdPlL1n3ufaEFtTruDZ19aKXxsY3APiJ+mIQXRCD3bCw9 45/VNpzMrygI/1i88P9AbwDdqphtv+N8b1TmL5V4uZFpBrn8erITKuWHjlLQe8qWVtaz QnkIs+0IVInJpJmVZmvx/Jy3Kj98Jfs85EXognRpQ5gn8PmnPdylyEEvKmhTVvk/dLee 5/aXWLIbZrE/ov/Fpv6y5kLablLVdXWB1OR3jNYcODp/7tB/DJ0PiFs0e9DLy1SmWINc 5Grg== 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=iH31IPcSjhrHBMlbPkShOp+GZgBxks+YGO36i19sp8s=; b=PIqR3BBy6KOtfcDpcdos5a+nFuVYm3n9BW75JQDa2bf3gx7Z6zQgJHQ5Z+tYvB6Ek3 xFzZArLgBe3q1HU+UJ9oqTP01jMq/9znmkvceoSXajOYB4XPycY/boiIrkVKIDv7Es4/ cTfMkUPXuVu+G2k0xcua3e4plmmflhI4GxUiqd4Cp3e6HsFMZaPa3crmEOgwPxHJ1SVt e94dYh+L2QITegunF+QRWXTHOVGSiNj8aAJmdr8O7iVaUDVOiXbgXhbPLO4VT/00DBVB 4rbH19jlApSpKdXcf53RimSsUU8hAJcUgsDO412EH5jD56a3xFwO6Jhsl+npOdYaVxKq ASbA== X-Gm-Message-State: AOAM533ONTlBxEGPoOV2foI5ueccdAtzOwSh5kDhHWORsbUUP+FNVrqZ k8elHv1wdrjTtUhpQ/IWRe+7wQ== X-Google-Smtp-Source: ABdhPJyg0oekeYgXitdty2AZ5tLSUQRaZ8CoO68o52OvnhAi/kQ1VbtRwCogwdaiHIGakldnTk8WLA== X-Received: by 2002:a05:600c:4ed2:: with SMTP id g18mr7216822wmq.25.1639489466870; Tue, 14 Dec 2021 05:44:26 -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 g19sm2309592wmg.12.2021.12.14.05.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 05:44:26 -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 v3 1/3] wcn36xx: Fix beacon filter structure definitions Date: Tue, 14 Dec 2021 13:46:28 +0000 Message-Id: <20211214134630.2214840-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> References: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Tue Dec 14 13:46:29 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: 12691832 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 E9624C4332F for ; Tue, 14 Dec 2021 13:44:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbhLNNob (ORCPT ); Tue, 14 Dec 2021 08:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234516AbhLNNoa (ORCPT ); Tue, 14 Dec 2021 08:44:30 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72643C061751 for ; Tue, 14 Dec 2021 05:44:29 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso16300459wml.1 for ; Tue, 14 Dec 2021 05:44:29 -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=joJuWOHB6QNJc6rGN0UsdXn4NqozFHY5ZCXl3ueSs7JFFV/aj9YMNuZtQnUYW/ylsL 7QwDNYZiDdH/VlLuWNExhJjDF0yW3soqEHPUEyRcuiI41e7TfZHPRlM+KhHC3ubVZp5j MNB24WvbZvLhKxHJte1mBs3ZBsmclHaUKMu2GOR3g++/xKYSh2Xskayj/W5aWM1pe6c3 cmpie+qNx/of2nxwmrnVuYzbNOyPvKL+UHsIWQ+uBkyZWfmtrDQakuYIueJiTDZwgWPB Fx2uKuQprpeJ7oSwfd533FuUhHjAa6b8jkbMgfvGFNY+BtcyGBVs2agbgaMJr+R7CGqK ww7w== 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=OkdJFCNAbDWcUX/LPMQc+kQEqvniYne0Sy4gEf5/8IEWZ+keVIf4vEBAOo/UeMALiF jdq3gtCT2JDqox5YV+EK9UPeGli3YL++XDeMwBIpq9x6qL4czEZQrR5eoTUw8w3FMzzw fFyWPAXyXqUw9H2h48HbAJMaaBKBuzzURLweRblTLhMqJaq5V9T5WWm1etzxnH5y2G2V PmTsXScCisxCikHvqtQvJRvSnLsWYm7cwI466sVSRloI34VRTfgKy7hF7CCDXueY+3IL 7A85fvNW70lha+fRK7pCF8QNpy9jyBkgb6sjwScJRXJR4wdJuHBLL/XBqCSx45k8xQrw 8aLg== X-Gm-Message-State: AOAM530U5X3HfIsTHBLklDt2Nnz6Jje7yzQ0rcY6zgD4m8jhF0sxDzbT Yr65SyqQS4ssw4VVPPU19RdIzIq6UBeEiw== X-Google-Smtp-Source: ABdhPJy+V9VwSbvuYFankFH6EUOfh9xmf4CwOu6MrSb3RDLxwEmhFnnCvj6cD/CN+JJQuxl19APFJA== X-Received: by 2002:a05:600c:35d3:: with SMTP id r19mr6902162wmq.176.1639489467959; Tue, 14 Dec 2021 05:44:27 -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 g19sm2309592wmg.12.2021.12.14.05.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 05:44:27 -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 v3 2/3] wcn36xx: Fix physical location of beacon filter comment Date: Tue, 14 Dec 2021 13:46:29 +0000 Message-Id: <20211214134630.2214840-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> References: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Reviewed-by: Loic Poulain --- 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 Tue Dec 14 13:46: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: 12691833 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 4B8FFC43219 for ; Tue, 14 Dec 2021 13:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234522AbhLNNoc (ORCPT ); Tue, 14 Dec 2021 08:44:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234520AbhLNNob (ORCPT ); Tue, 14 Dec 2021 08:44:31 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD724C061574 for ; Tue, 14 Dec 2021 05:44:30 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id j9so338670wrc.0 for ; Tue, 14 Dec 2021 05:44:30 -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=mGEAJEXtZGbf3P6h2PQMWH6TzjiJnSEaoubmRK35wQM=; b=xF0MD93P6pSd0+8TSGKeUn/DFLEYvE9JVvZMGywn9Srfj/qa2IszI+KTUKC4D1/FAJ a/Kyea/DgfRlHlKiV2qzRYrsPF5iUrP8NVfDLjAkiOlZsgb04xxMKKOxr9UGVWvekPbt Q4pUuNkreGCH4SKfZGVycPs43gESsHKu0Qv2P111rwrNZfH+PCW5fsluTjsOSduvdKYA J7tNwsDVksZ3iWTEXmwhtLZtlZy65+yndQuD9bnp6qpCaQf+qOH1iTRtlg85zvQ05GCn pOsvGoYWZNIV7JlM7AJoNi/0wJVQ82FrOjaX02L2p0YQkdyfw0rA2ukuRP7fKLM43jVX Pbxg== 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=mGEAJEXtZGbf3P6h2PQMWH6TzjiJnSEaoubmRK35wQM=; b=xzdXVQ2VX6aiRMVhNV/b9WWUMGfHBysX5841vxsMA9ruqEFM5y1cPIQav6nhOsYdF3 NO/bz0DXlkYo3MUhNARGgOlwuONXvtW77TlG5YsqpPXD4X14wAGvpmddw9Yr17+vHJya WT2VNvQ/W9fqthXbUuTABtzRf9l2sFi4mEFF0x4I3ssHHvGKDUGIja3QTr8NR3ZVkAwd WVea8ADBpHC3WtLcEJ9Yk5B6chZBTqepKFmfMMHAOo/aVL7+MLyIAAiTesuvPBw7cYkA 0zQFZ9qS5wxe3ruaSNy3NvEDyd6Jl1ZmeJRf5XolJenlK+5lSmKIw2kHo/NfHFUXKclD o4Eg== X-Gm-Message-State: AOAM530WBNUrOBkbPWzcPIL9pbAm/bjhjfvAPjx2wb7xZ5OcvTCv2a8m FVEVKnr+GVzvdP8U0q5CO+dUHvRTcBPsmQ== X-Google-Smtp-Source: ABdhPJxh8Q6xsiueV6lpI26YRWd3mA02LTC+Hysj2OonmFn2Mi8dIGLQg6YCu/GtI2amXtbHiRWQwQ== X-Received: by 2002:a5d:52c3:: with SMTP id r3mr5981800wrv.115.1639489468946; Tue, 14 Dec 2021 05:44:28 -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 g19sm2309592wmg.12.2021.12.14.05.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 05:44:28 -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 v3 3/3] wcn36xx: Implement downstream compliant beacon filtering Date: Tue, 14 Dec 2021 13:46:30 +0000 Message-Id: <20211214134630.2214840-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> References: <20211214134630.2214840-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Reviewed-by: Loic Poulain --- drivers/net/wireless/ath/wcn36xx/hal.h | 17 +++++ drivers/net/wireless/ath/wcn36xx/main.c | 2 + drivers/net/wireless/ath/wcn36xx/smd.c | 87 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 + 4 files changed, 109 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index e9fec110721b5..a6968f9785d6f 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -3468,6 +3468,23 @@ 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_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 + /* 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..ec355807f5817 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -934,6 +934,8 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw, * place where AID is available. */ wcn36xx_smd_config_sta(wcn, vif, sta); + if (vif->type == NL80211_IFTYPE_STATION) + 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..6791853088d61 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -3193,6 +3193,92 @@ 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, \ + } + +/* 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 +3334,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_ */