From patchwork Mon Dec 13 15:00: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: 523896 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 E854DC4332F for ; Mon, 13 Dec 2021 14:58:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234016AbhLMO6b (ORCPT ); Mon, 13 Dec 2021 09:58:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbhLMO63 (ORCPT ); Mon, 13 Dec 2021 09:58:29 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD96CC061751 for ; Mon, 13 Dec 2021 06:58:28 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so14264272wme.0 for ; Mon, 13 Dec 2021 06:58: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=uTYixfrhf6bWN82g0Fi5qU9LAYUUaPAtaNL6sw+Jd4U=; b=BwgGHf/a3sgf+58Cy0bbtoeudPI8sMhx6nOqMqjkKkc4w8EFzteQelbbR50X3izWOK I1hxnFCA4TzztzjJcTw7rtiLpfmaa/HS1dWRwdpricIV/eONZrGpEE+b1k5UxkQfv/4q qMstzYPG9mGrTstflGtiZKDrlNRIYQEQEdQKxNKuqaqiw/3SsS5GlYXrCABaBTb1w/UW CwizmLGmsdshF6J8N5vB/KdIug2xxWc3ilFBXZ8javp62C17k5aYchxXg40/NXuRUG5E SkwkJ4hR+jcyGi4WsQ+AAxosAc7f8C86SAsb8+1M1Ur/6D4v6Bat878RMvOb8flSNT9K A5Sw== 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=YhbmQDjaFTeg91l5pgEwyBzrPQvHbZGgL884/alfD8hGqvQkhLc/sc6Hl3jmfklRRs xlw+MIGnM0FAZILDtYd4hE4BNbJoPiCgT79fMZEebBFZhyTY6nrFP4mXio04L59xQKWQ eCvJAnkFZQOdr10KJPmnu7Oh6kGg29tTjH7ic5bLozVFJRggHX38vFfi6Xeem4IFb+iG e47+TRggQZAlbLjW5YGh8qhopBSCZ4/qldKg6enZiw9XbuCy5y+Nc9ZhkeKda9t7pa+i qTVlDv4VekbMdQMiEUPi8FNbrFmbl/9LZfQaTzI02rYea5soQF0auqa2ka1whSx5Fe1N eugQ== X-Gm-Message-State: AOAM5310ZrekW8+DgzKhniH5RUkLlHu30gPV8gkWPCo5nPB6YlnF8aD/ EHjAu6//i7PBB/Q5aXAZAfnuwA== X-Google-Smtp-Source: ABdhPJw/96B3Ift85NKuNZGxjnSUJpD5xNkWxu7JuHeoinuAWV3d3eLRThGTLYs8D3bd5IhvqB6fcQ== X-Received: by 2002:a1c:9dc7:: with SMTP id g190mr37974093wme.130.1639407507252; Mon, 13 Dec 2021 06:58: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 o63sm7570112wme.2.2021.12.13.06.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 06:58: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 v2 1/3] wcn36xx: Fix beacon filter structure definitions Date: Mon, 13 Dec 2021 15:00:29 +0000 Message-Id: <20211213150031.1707955-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213150031.1707955-1-bryan.odonoghue@linaro.org> References: <20211213150031.1707955-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 --- 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 15:00: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: 523640 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 69364C433EF for ; Mon, 13 Dec 2021 14:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbhLMO6c (ORCPT ); Mon, 13 Dec 2021 09:58:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234843AbhLMO6a (ORCPT ); Mon, 13 Dec 2021 09:58:30 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB4C2C061574 for ; Mon, 13 Dec 2021 06:58:29 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id i12so12133098wmq.4 for ; Mon, 13 Dec 2021 06:58: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=qvyeirPUX4XQRediRb57GcwkRYqxHjh9DsXNlBj0/eoPxsD5gg82wXsUoWDXitMLod GXrbDeSgn9Jikh26sUATpUCGnEwRcr0AeJCwtiB1M2MggJb3H3c8bh7Cknk7U50vj5AS DdsfxRYvpkYv62/OoZzavzxUTxStFoUe0IcQ3bmx3CuiNm2JIddYX/wCumihORfetFi1 h4JKFNowqm+e7mvXbdnuywPzIVWbTY2SbuD5n3hCLN90Ub3W0F12QaDXyTGl7fVLIfCW xes1FD/xiZ+M070mU7y7vy/UMkGrvr7Y0tDowxFGpozCIvJLYW/4TgiEZMqTeLBjJUoe dfbQ== 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=RquRIgccPscx5al+tCPDJoGff7tTh4IKQWPindphW76I35F+rTOuaaXkTT89oC3Yvv n39889aAn2IzMxi32jcVHV0zNWugQIzL0POnZ9KL3hg4yw0GmlHQJHcbHZYG1eN2k661 VRxWhLG7wBBUnXB8ERu4hCelt1fybb5fUgH6bFdPfjU1vPSaoc7pF3hri/IYotS/Bfod +JqNBbc3vVZQTra8tnh3XAcF1mLoodaWTnEKBhO4i5lRrebuElUEe7qUN+5/y3hrRS7w YY2NSiR5u5hPBZDLbFgA822qrQjPb6pJR6KcS+HTzSLMlxs3t//OoLOGMxe1lePkVSEo O38w== X-Gm-Message-State: AOAM533DQg1p1xwBbTsJZCEUxyInwAyNR9b8LJSJz/G0aaHZa/mg9dkO G829rzgF+x80LNkBVnIFVgznwQ== X-Google-Smtp-Source: ABdhPJybmMOdGVERUiJd5CSvkcNlhCBESDJtrLKEJIswsWzPi7Cd9e6nPNaKcLkvofvnNnsc8Z1//g== X-Received: by 2002:a05:600c:a55:: with SMTP id c21mr38334485wmq.191.1639407508390; Mon, 13 Dec 2021 06:58: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 o63sm7570112wme.2.2021.12.13.06.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 06:58: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 v2 2/3] wcn36xx: Fix physical location of beacon filter comment Date: Mon, 13 Dec 2021 15:00:30 +0000 Message-Id: <20211213150031.1707955-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213150031.1707955-1-bryan.odonoghue@linaro.org> References: <20211213150031.1707955-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 15:00:31 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: 523895 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 9D729C4167B for ; Mon, 13 Dec 2021 14:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235178AbhLMO6d (ORCPT ); Mon, 13 Dec 2021 09:58:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbhLMO6b (ORCPT ); Mon, 13 Dec 2021 09:58:31 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A03C06173F for ; Mon, 13 Dec 2021 06:58:31 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id v11so27496696wrw.10 for ; Mon, 13 Dec 2021 06:58:31 -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=FJXpcFkVAlZMLinMYTNUPEFUcsG7B0gbrLJgNulZsck=; b=TjDtlScabl5NupLBWx8U6MWarJ0RdccSV2jYetds4uUf7uYdETEewpKpxaSalStgif px8NZJ8ctFE2zFTvvmQaZnBYiT9eLYf6Hs+L3UTM5qD2zDHGjr2y5xu15zBVmZhkfTGW gmOU3jdISCgrLVtxOMabL4sdWcmlqlGh5B4fMn6MgKJi6Y4A/+WRECQw4ETPXDOObLUp u0fOCKsf8ok1EpzqCYYIJsizQxk55M4liCj2aMbO0ryJ9l+gTMwP0L0SRL1VxgyY/reQ +lZwQKRqzHJTWqn9Y6Z8tAe2QHPu6k3gs6u6xePRhpSfK9bOq9qSdp+BI5RcjfkAmH7V NCKA== 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=FJXpcFkVAlZMLinMYTNUPEFUcsG7B0gbrLJgNulZsck=; b=Y9ztVfpgSUR8G9i+Rtl660z6PLEXR5zS/z2IiYrZPogw9DP+1+ynBpWGXcB9NcSUBx Umg/r+xB5l2APKJsqE/yZXWzVp22HAs+hZ797Kay2MVos+Z9xmzVnlU5IzgC3h1MkVEj wsEmNeOD7vvFpmLWz58LMXwiBCDeXRl53aQNVP++Jgi3b/orucBmRfJJz3jpGuRR97Ac WWryeldzGumU8GrD4pkDFyXSyTLvy+/Q4V0iys7h+AkSe3Wf88VjfqEXQS57++HhBm4j CXoRF1QgGfrqQdyp8YfxJ7GV9eYhm3L7q9k2kut8dlVs5qaJ8gi9am0r2yoMrJvsLXze 3foQ== X-Gm-Message-State: AOAM533A2F6WNXW6BjUVxbBEman5W+kt5e0xPX17KoSVBfLYIGcyQ5rN vAIeEY9It5FpBOrRRPNOTp5HEg== X-Google-Smtp-Source: ABdhPJxc+4Y9B6SDYgchGtQ0BLZ3I5PMicTN7TuMH2nbFbK4cf75kbbxi/K86dMF6vEPyzz0HqHegg== X-Received: by 2002:a05:6000:2af:: with SMTP id l15mr17629933wry.640.1639407509549; Mon, 13 Dec 2021 06:58:29 -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 o63sm7570112wme.2.2021.12.13.06.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 06:58:29 -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 v2 3/3] wcn36xx: Implement downstream compliant beacon filtering Date: Mon, 13 Dec 2021 15:00:31 +0000 Message-Id: <20211213150031.1707955-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211213150031.1707955-1-bryan.odonoghue@linaro.org> References: <20211213150031.1707955-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 | 17 +++++ drivers/net/wireless/ath/wcn36xx/main.c | 1 + drivers/net/wireless/ath/wcn36xx/smd.c | 87 +++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 3 + 4 files changed, 108 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..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..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_ */