Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3715622pxu; Sun, 11 Oct 2020 21:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxYpfElXgK/IjOuKBwrkKfzLQOlC4VIe59Z/XhWtMDTetPzM12nGtUwhMWnkJRk4bEj4Qn X-Received: by 2002:a05:6402:b0e:: with SMTP id bm14mr12717137edb.259.1602477819406; Sun, 11 Oct 2020 21:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602477819; cv=none; d=google.com; s=arc-20160816; b=PDQjP1gh+MaRndY4UkrCGiEqgA+lpFE1BMO36n/m8GKSSWl7lpkaXDKURO5LKXDRnI xGHnjKhoEFKhnflv+BwP05QBjIjNHE+Kb+w7BzbCmrQ7yYxXyUarJ9cJ2GIXEveiBWrv qv/22H6nUNSCDJNa8LvR4cBFEOcpDJ/XmcMs+yhCBT9MjPTRZTkfF0J8ZFhA80XoTLeH Hc17BL7b26VqdBXt9kCl15gWAvb3wcpmxCqWnOFXk6taWB3YG9nhpw3HV9O4Mo+J1q/9 TAq8hKr9hLSw5J1nSHmzj+F7poV35C/TpVeRggqSCBkzfXjj3WPqcVuKgKpkFf631W7d Y8Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=yNJUJW5y6kE3RQZKIJlvBAwYPb5xKZVDlMJ3bAbVlyw=; b=Choy57LIYLTFg0RsdCm51xdZUhKaxQ+0wBTjdedjdfjNOzUUVv6LDKqK3rWeeY74sI yBR9PTMiBlVc6q7Ntg3KxgvKh/Eih78oQhtOs2AL+aEeh3ZuXebMvGBQajSBuUKVgAfW RfuK6CqjcdqOrE67XiQ+HcWlBnj7sAODm+Sm8hzMZVLSo1X6n6Kcgkjx66BJ3iYC2PzT tNVnck0XuTP+6DUMZ9jgtqjgpolw+TQQvLEOEyd58/McwZLjX9bg44Sd8myDWLwTCTCH 8k5ucWudJ/UMrlcLSjwyzOxEi3QcjMKVcOkpeMHnd0HU0Oemf7nUgGMR60G9vEdMApwJ BFRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=a5I3j0I8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w21si11888692ejj.377.2020.10.11.21.43.15; Sun, 11 Oct 2020 21:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=a5I3j0I8; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726789AbgJLDf7 (ORCPT + 99 others); Sun, 11 Oct 2020 23:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726134AbgJLDf7 (ORCPT ); Sun, 11 Oct 2020 23:35:59 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881F1C0613CE for ; Sun, 11 Oct 2020 20:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=yNJUJW5y6kE3RQZKIJlvBAwYPb5xKZVDlMJ3bAbVlyw=; b=a5I3j0I8kH5d3o9RzZFVPc4V8W K05HutY/BKARsiX1/idASE9nIIOy24OBx3dsTRQbrxoiDffQsio9bdzP9ltLpYM9Dia+muCSqMTRa vJJp0ifxYlh3gfqTE0OPtpC5uLoBp7kxxBOGLlnGaa4eSWswUngC4iuYTBQAZfZxXaWc=; Received: from p54ae9462.dip0.t-ipconnect.de ([84.174.148.98] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1kRocs-0001eW-5f; Mon, 12 Oct 2020 05:35:54 +0200 Subject: Re: [PATCH v2 08/10] mt76: mt7915: implement testmode rx support To: Shayne Chen Cc: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek References: <20201012032538.21314-1-shayne.chen@mediatek.com> <20201012032538.21314-8-shayne.chen@mediatek.com> From: Felix Fietkau Message-ID: <4333ebf5-3d19-3165-3275-6e6fac09abfa@nbd.name> Date: Mon, 12 Oct 2020 05:35:53 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20201012032538.21314-8-shayne.chen@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-10-12 05:25, Shayne Chen wrote: > Support testmode rx and display rx statistic by parsing RXV packet > type, which is currently only enabled in testmode. > > Reviewed-by: Ryder Lee > Signed-off-by: Shayne Chen > --- > v2: change last_snr to u8 > > .../net/wireless/mediatek/mt76/mt7915/dma.c | 3 + > .../net/wireless/mediatek/mt76/mt7915/mac.c | 37 +++++++ > .../net/wireless/mediatek/mt76/mt7915/mac.h | 5 + > .../net/wireless/mediatek/mt76/mt7915/mcu.h | 1 + > .../wireless/mediatek/mt76/mt7915/mt7915.h | 7 ++ > .../wireless/mediatek/mt76/mt7915/testmode.c | 97 +++++++++++++++++++ > .../wireless/mediatek/mt76/mt7915/testmode.h | 30 ++++++ > 7 files changed, 180 insertions(+) > > --- a/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/testmode.c > @@ -169,12 +209,69 @@ mt7915_tm_set_state(struct mt76_dev *mdev, enum mt76_testmode_state state) > mt7915_tm_set_tx_frames(dev, false); > else if (state == MT76_TM_STATE_TX_FRAMES) > mt7915_tm_set_tx_frames(dev, true); > + else if (prev_state == MT76_TM_STATE_RX_FRAMES) > + mt7915_tm_set_rx_frames(dev, false); > + else if (state == MT76_TM_STATE_RX_FRAMES) > + mt7915_tm_set_rx_frames(dev, true); > else if (prev_state == MT76_TM_STATE_OFF || state == MT76_TM_STATE_OFF) > mt7915_tm_init(dev); > > return 0; > } > > +static int > +mt7915_tm_dump_stats(struct mt76_dev *mdev, struct sk_buff *msg) > +{ > + struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76); > + void *rx, *rssi; > + int i; > + > + rx = nla_nest_start(msg, MT76_TM_STATS_ATTR_LAST_RX); > + if (!rx) > + return -ENOMEM; > + > + if (nla_put_s32(msg, MT76_TM_RX_ATTR_FREQ_OFFSET, dev->test.last_freq_offset)) > + return -ENOMEM; > + > + rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_RCPI); > + if (!rssi) > + return -ENOMEM; > + > + for (i = 0; i < ARRAY_SIZE(dev->test.last_rcpi); i++) > + if (nla_put_u8(msg, i, dev->test.last_rcpi[i])) > + return -ENOMEM; > + > + nla_nest_end(msg, rssi); > + > + rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_IB_RSSI); > + if (!rssi) > + return -ENOMEM; > + > + for (i = 0; i < ARRAY_SIZE(dev->test.last_ib_rssi); i++) > + if (nla_put_s8(msg, i, dev->test.last_ib_rssi[i])) > + return -ENOMEM; > + > + nla_nest_end(msg, rssi); > + > + rssi = nla_nest_start(msg, MT76_TM_RX_ATTR_WB_RSSI); > + if (!rssi) > + return -ENOMEM; > + > + for (i = 0; i < ARRAY_SIZE(dev->test.last_wb_rssi); i++) > + if (nla_put_s8(msg, i, dev->test.last_wb_rssi[i])) > + return -ENOMEM; > + > + nla_nest_end(msg, rssi); > + > + if (nla_put_s32(msg, MT76_TM_RX_ATTR_SNR, dev->test.last_snr)) > + return -ENOMEM; You updated the comment in the header file, but not this part which actually generates the attribute. - Felix