From patchwork Tue Jun 19 07:53:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 10473643 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CBD8601D7 for ; Tue, 19 Jun 2018 07:54:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A35E289E0 for ; Tue, 19 Jun 2018 07:54:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EBCD28A4F; Tue, 19 Jun 2018 07:54:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE9B3289E0 for ; Tue, 19 Jun 2018 07:54:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937384AbeFSHyA (ORCPT ); Tue, 19 Jun 2018 03:54:00 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:51686 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937308AbeFSHxy (ORCPT ); Tue, 19 Jun 2018 03:53:54 -0400 Received: by mail-wm0-f51.google.com with SMTP id r15-v6so18215972wmc.1 for ; Tue, 19 Jun 2018 00:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=+lp9mUtFJ2UqNge0g3MZa6dOimlaclZWk6ZbEiqEzYs=; b=W0deUSLHV3/dTTOiRsrkKTuzF/DwYO7UFkAIBNkeegnNbLpK6wAoH38humBXFctczl +xGzajfeVuVEkZ+W054fRDwlRjrijf+cQDHro/Jr07KmhVIG7UMEFPv7vfM5Dejlkdmt 3ffsphfHyqdgr0UaWmx6zlzDzoGBsZLv7bZl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=+lp9mUtFJ2UqNge0g3MZa6dOimlaclZWk6ZbEiqEzYs=; b=m+q5sA1+IhjzOhBZ9qzcJqbihHxlkHwBISxuwwOwRsLJHf1jU6TevW8Ee2BWJ5iDAO jurL8Q/6aXt/FnoT2lgeZUsevqGFO4QGDaNePDl9cwIjdmwDfTbR3MPOEe5BjwtBNkmt ZA+NucGzlibLyUsJoaEG3izkxBnXgWZiuaWE3Kr6ziIjn/iPGVpJM+fyOMed6qllBtKm tOVMf5gsDmAb5XXv2yduB3OAoA0a2jO2Xrqq8C197bhGtx6xfrdGih2lA2ZYdbrC+Ogr wk5STC0ohKGiuWyeF1mbGnSymkL6yom0Ky12bONFdd0IY1525ngbg8lofR29Rt7ancFp w6rg== X-Gm-Message-State: APt69E353xT2jf6i+5p9uNmodJ1wlq0ULk2Mdckik4k6Hmvh85gs9Ikw V/w5H32ZEXDY+jfTyvKStGh82ovz6IU= X-Google-Smtp-Source: ADUXVKJjsGmshzJAtwJpV2p4YVWyZl14dQcsPoWozzHc5ye/IU5mrxrFeJPBwIDLDkKw6n7DZVnqXQ== X-Received: by 2002:a50:fa03:: with SMTP id b3-v6mr13679131edq.26.1529394833209; Tue, 19 Jun 2018 00:53:53 -0700 (PDT) Received: from [10.176.68.125] ([192.19.248.250]) by smtp.gmail.com with ESMTPSA id b9-v6sm6497929edr.29.2018.06.19.00.53.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 00:53:52 -0700 (PDT) Subject: Re: Research + questions on brcmfmac and support for monitor mode To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= References: <986bbf4c-8fa1-4367-db9e-76a209594b81@gmail.com> <66e43eb5-2bc9-2ec3-af48-03248eecb727@gmail.com> <5B1E537F.2080502@broadcom.com> Cc: Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Pieter-Paul Giesberts , "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" , "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" , brcm80211-dev-list@cypress.com, "linux-wireless@vger.kernel.org" From: Arend van Spriel Message-ID: <5B28B68F.8070505@broadcom.com> Date: Tue, 19 Jun 2018 09:53:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 6/19/2018 9:27 AM, Rafał Miłecki wrote: > On Mon, 11 Jun 2018 at 12:48, Arend van Spriel > wrote: >> On 5/30/2018 1:52 PM, Rafał Miłecki wrote: >>> I'm providing extra version info of tested firmware images as requested >>> by Arend in another e-mail thread. >> >> Looking into our firmware repo it there are two flags, ie. WL_MONITOR >> and WL_RADIOTAP. It seems both are set for firmware containing -stamon- >> feature. Your list below confirms that. I still plan to add indication >> for WL_RADIOTAP in the "cap" iovar, but a stamon feature check could be >> used for older firmwares. > > I just checked wl.mk (it's an open source file) and found following line: > WLFILES_SRC_HI += src/wl/sys/wlc_stamon.c > not guarded by any ifeq. wl.mk is used for NIC driver (softmac) so it is not used for fullmac firmware. > It appears wlc_stamon.c is always being compiled in. Are you 100% sure > that wlc_stamon.c depends & uses radiotap? Are you sure it's > impossible to include stamon support without radiotap support? > > I'm asking because we're going to check "sta_monitor" iovar to find > out if radiotap support is included. I'd like to be sure it's 100% > reliable. I have already created a patch for this (see below). I will submit it this week. Regards, Arend #endif /* FWIL_TYPES_H_ */ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index f70fec6..67d7fc7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -207,6 +207,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); struct brcmf_pno_macaddr_le pfn_mac; struct brcmf_gscan_config gscan_cfg; + struct brcmf_stamon_sta_config stamon_cfg; u32 wowl_cap; s32 err; @@ -217,6 +218,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN, "pfn_gscan_cfg", &gscan_cfg, sizeof(gscan_cfg)); + + if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR) || + !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RADIOTAP)) { + ifp->fwil_fwerr = true; + memset(&stamon_cfg, 0, sizeof(stamon_cfg)); + /* iovar requires IOVF_SET_UP so this fails either way */ + err = brcmf_fil_iovar_data_set(ifp, "sta_monitor", &stamon_cfg, + sizeof(stamon_cfg)); + if (err != BRCMF_FW_UNSUPPORTED) { + ifp->drvr->feat_flags |= BRCMF_FEAT_MONITOR; + ifp->drvr->feat_flags |= BRCMF_FEAT_RADIOTAP; + } + ifp->fwil_fwerr = false; + } brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn"); if (drvr->bus_if->wowl_supported) brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl"); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h index 4b29070..e42d296 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h @@ -963,4 +963,36 @@ struct brcmf_gscan_config { struct brcmf_gscan_bucket_config bucket[1]; }; +enum brcmf_stamon_cfg_cmd { + STAMON_CFG_CMD_DEL = 0, + STAMON_CFG_CMD_ADD = 1, + STAMON_CFG_CMD_ENB = 2, + STAMON_CFG_CMD_DSB = 3, + STAMON_CFG_CMD_CNT = 4, + STAMON_CFG_CMD_RSTCNT = 5, + STAMON_CFG_CMD_GET_STATS = 6, + STAMON_CFG_CMD_SET_MONTIME = 7 +}; + +/** + * struct brcmf_stamon_sta_config - configuration data for sta monitor. + * + * @cmd: subcommand for this configuration (see @enum brcmf_stamon_cfg_cmd). + * @mac: mac address of sta for which @cmd is intended. + * @version: version of this configuration structure. + * @length: number of bytes following this field. + * @chanspec: not used ? + * @mon_time: time for which STA's are monitored (ms). + * @offchan_time: timer for which off-channel STA's are monitored. + */ +struct brcmf_stamon_sta_config { + __le32 cmd; + u8 mac[ETH_ALEN]; + __le16 version; + __le16 length; + __le16 chanspec; + __le32 monitor_time; + __le32 offchan_time; +}; +