Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1315585pxm; Thu, 24 Feb 2022 00:12:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoTr9NQQh5nV/dBeigMhGl/DREmU1uwZDtL7WZG4gbwVk0HAHyb7XgF1kHrcfS0ACPEIqv X-Received: by 2002:a05:6402:438f:b0:412:a96b:a651 with SMTP id o15-20020a056402438f00b00412a96ba651mr1198292edc.40.1645690378353; Thu, 24 Feb 2022 00:12:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645690378; cv=none; d=google.com; s=arc-20160816; b=mJljqXdZ8falUaA/hDSj6kGAXkkaGpDqM48edCjLWSBl7vpAGzgwteiY5KRoVHAukf AIxc0X/e6U6AyUeggoOEBEI6W91sQ6qVpFTfdV19D+iRDT/MHs8zeAcPHubMVQfED81O txitSa6OE4RnAmAInl+zCsR3ABDQFrJJB07aSyMgHaIwah+AL9UdU2gCX0dW4RQ98XoS h0C3NqR1eMqBRSJ/91xViykVU+tbrT7P80lhf5vugUPUoLpAHVYqqwUzQjX6vaggQWhS M/rKx+uraOQfGHZzM1DxjLxWtYlXZeqfAanJL6ZW+nZaXSNjKjnk436XY5tuxyuVPHBO A7Pw== 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:date:cc:to:from:subject:message-id; bh=dfMNihZnXPQ+gSUaZfaUV0L+jSuNOhqezZbt16SWazk=; b=FfbVc/6YzZrcqucbNmrCjRI8EG83BmEl7cElK6ELkIEZkbNUgQ3pIRrR3ecFftkNDu 2RmUFmgWEt/im/jLS8yqHctaCRlWW20BZZwlhxSprk5SGRQ3bXk6cqy9PVy6EZfIRwKe Cdu6Bnhwwec4khyDrayUJhYO2xBHMmE4iNlXvkdiM42e+J4qZMk+KC3PXi06hcJ0qVZc youPg60Ur5d7Jbqrc6GEs0bcdKUAHCb98EcIST8e+mWep1cqB2ms2Lhq++sSkOIZtJ7N W+OOfy11TuUjXOS7edQYGH7mYnZDKTZA6orSq0fHFxsX/AuR5yI3xizmT3trmPqxabNR b88g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd18si1099625edb.592.2022.02.24.00.12.39; Thu, 24 Feb 2022 00:12:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231416AbiBXGyz (ORCPT + 73 others); Thu, 24 Feb 2022 01:54:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbiBXGyz (ORCPT ); Thu, 24 Feb 2022 01:54:55 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6338526A3B5 for ; Wed, 23 Feb 2022 22:54:22 -0800 (PST) X-UUID: c9545d35e70f4c109cf641107a998587-20220224 X-UUID: c9545d35e70f4c109cf641107a998587-20220224 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1523701613; Thu, 24 Feb 2022 14:54:16 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Feb 2022 14:54:15 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 24 Feb 2022 14:54:15 +0800 Message-ID: Subject: Re: [PATCH 1/2] mt76: mt7921: fix up the monitor mode From: Deren Wu To: Lorenzo Bianconi , CC: , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 24 Feb 2022 14:54:15 +0800 In-Reply-To: References: <7dcfc62d67f1f51e6627cc24000393844aa2b649.1645655280.git.objelf@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, 2022-02-24 at 00:04 +0100, Lorenzo Bianconi wrote: > > From: Sean Wang > > > > Properly set up the monitor mode the firmware can support to fix up > > RTS/CTS and beacon frames cannot be captured and forwarded to the > > host. With this patch, RTS/CTS and beacon can show up in host capture. Tested-by: Deren Wu Regards, Deren > > > > Signed-off-by: Sean Wang > > --- > > .../wireless/mediatek/mt76/mt76_connac_mcu.c | 31 > > +++++++++++++++++++ > > .../wireless/mediatek/mt76/mt76_connac_mcu.h | 3 ++ > > .../net/wireless/mediatek/mt76/mt7921/main.c | 23 ++++++++------ > > 3 files changed, 47 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c > > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c > > index 0a646ae51c8d..dded8a7d3efc 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c > > @@ -2784,5 +2784,36 @@ int mt76_connac_mcu_rdd_cmd(struct mt76_dev > > *dev, int cmd, u8 index, > > } > > EXPORT_SYMBOL_GPL(mt76_connac_mcu_rdd_cmd); > > > > +int mt76_connac_mcu_set_sniffer(struct mt76_dev *dev, struct > > ieee80211_vif *vif, > > + bool enable) > > Hi Sean, > > can this fw mcu be used with mt7663 fw? If not I guess we should move > it in > mt7921/mcu.c > > > +{ > > + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; > > + struct { > > + struct { > > + u8 band_idx; > > + u8 pad[3]; > > + } __packed hdr; > > + struct sniffer_enable_tlv { > > + __le16 tag; > > + __le16 len; > > + u8 enable; > > + u8 pad[3]; > > + } __packed enable; > > + } req = { > > nit: alignment. > > Regards, > Lorenzo > > > + .hdr = { > > + .band_idx = mvif->band_idx, > > + }, > > + .enable = { > > + .tag = cpu_to_le16(0), > > + .len = cpu_to_le16(sizeof(struct > > sniffer_enable_tlv)), > > + .enable = enable, > > + }, > > + }; > > + > > + return mt76_mcu_send_msg(dev, MCU_UNI_CMD(SNIFFER), &req, > > sizeof(req), > > + true); > > +} > > +EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_sniffer); > > + > > MODULE_AUTHOR("Lorenzo Bianconi "); > > MODULE_LICENSE("Dual BSD/GPL"); > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h > > b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h > > index 384c3eab1c8a..96ab1a55af17 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h > > +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h > > @@ -993,6 +993,7 @@ enum { > > MCU_UNI_CMD_SUSPEND = 0x05, > > MCU_UNI_CMD_OFFLOAD = 0x06, > > MCU_UNI_CMD_HIF_CTRL = 0x07, > > + MCU_UNI_CMD_SNIFFER = 0x24, > > }; > > > > enum { > > @@ -1653,4 +1654,6 @@ int mt76_connac_mcu_set_pm(struct mt76_dev > > *dev, int band, int enter); > > int mt76_connac_mcu_restart(struct mt76_dev *dev); > > int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 > > index, > > u8 rx_sel, u8 val); > > +int mt76_connac_mcu_set_sniffer(struct mt76_dev *dev, struct > > ieee80211_vif *vif, > > + bool enable); > > #endif /* __MT76_CONNAC_MCU_H */ > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c > > b/drivers/net/wireless/mediatek/mt76/mt7921/main.c > > index b6e836a4fad7..051a573141f4 100644 > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c > > @@ -479,6 +479,16 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, > > struct ieee80211_vif *vif) > > mt7921_mcu_set_beacon_filter(dev, vif, dev->pm.enable); > > } > > > > +static void > > +mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct > > ieee80211_vif *vif) > > +{ > > + struct mt7921_dev *dev = priv; > > + struct ieee80211_hw *hw = mt76_hw(dev); > > + bool enabled = !!(hw->conf.flags & IEEE80211_CONF_MONITOR); > > + > > + mt76_connac_mcu_set_sniffer(&dev->mt76, vif, enabled); > > +} > > + > > void mt7921_set_runtime_pm(struct mt7921_dev *dev) > > { > > struct ieee80211_hw *hw = dev->mphy.hw; > > @@ -516,16 +526,9 @@ static int mt7921_config(struct ieee80211_hw > > *hw, u32 changed) > > } > > > > if (changed & IEEE80211_CONF_CHANGE_MONITOR) { > > - bool enabled = !!(hw->conf.flags & > > IEEE80211_CONF_MONITOR); > > - > > - if (!enabled) > > - phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC; > > - else > > - phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC; > > - > > - mt76_rmw_field(dev, MT_DMA_DCR0(0), > > MT_DMA_DCR0_RXD_G5_EN, > > - enabled); > > - mt76_wr(dev, MT_WF_RFCR(0), phy->rxfilter); > > + ieee80211_iterate_active_interfaces(hw, > > + IEEE80211_IFACE_ITE > > R_RESUME_ALL, > > + mt7921_sniffer_inte > > rface_iter, dev); > > mt7921_set_runtime_pm(dev); > > } > > > > -- > > 2.25.1 > > > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek