From patchwork Fri Jun 29 11:40:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10496445 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 490A16022E for ; Fri, 29 Jun 2018 11:41:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37FA629761 for ; Fri, 29 Jun 2018 11:41:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C7012976E; Fri, 29 Jun 2018 11:41:16 +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=-7.9 required=2.0 tests=BAYES_00, 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 BFBEF29761 for ; Fri, 29 Jun 2018 11:41:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936179AbeF2LlO (ORCPT ); Fri, 29 Jun 2018 07:41:14 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55359 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936124AbeF2LlL (ORCPT ); Fri, 29 Jun 2018 07:41:11 -0400 Received: by mail-wm0-f65.google.com with SMTP id v16-v6so1858975wmv.5 for ; Fri, 29 Jun 2018 04:41:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pZ+CYE5pa4rb029yfjxoOnXOT7F2aqQE+Z0Xyh3UjFI=; b=mk4xDWDaoGv/Wzuqc0uCGSMj/b9jhJuFLFgrQHyNlA6BdWaJ3Mr6/TwQGMr7hihPSR K7JX0msZIujuWgDoCbEtUJSj8o/N5N51kCNCmu+Y5yZ0Ti4iTIZ6tSIoKN9nMzG4lwVo D15R/fo7M48SgyVmdyHSYQTiFUxTxQcmVStVXJiWZ+dAhXsi9Xgy633KmhKDeFrLH3u9 RkdI9o/mYevPCtWBFxXzc71Q000wBPo/L1Z3iXdoWn0yjGToqpRFqMZLpL9JCv+BmTTn kqnSSBfkekG6YB27exZiiij7KKKeX5Oi+Eb3I8fGf+J/qdXa1p6/W0WrA5zEO3ylVAQc FmHw== X-Gm-Message-State: APt69E0NAviM5/Cdad7JOhomxsR6FPsAU/NBLMgXEcxzKnsHwWq13cKY F3UnrlxF0itbBK+xiKH7kxkXWw== X-Google-Smtp-Source: AAOMgpe0AOd/0F8OttjtJ9KwzAwWmDXv1YzU9FKPyYUFUHaPq65vxhpUyqj8tVtC0rn+1lDC5Fggeg== X-Received: by 2002:a1c:d543:: with SMTP id m64-v6mr1457561wmg.12.1530272470528; Fri, 29 Jun 2018 04:41:10 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id s3-v6sm10242225wrp.76.2018.06.29.04.41.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 04:41:09 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, kvalo@codeaurora.org Subject: [PATCH v2 4/4] mt76x2: debugfs: add sw pulse statistics to dfs debugfs Date: Fri, 29 Jun 2018 13:40:55 +0200 Message-Id: <1d83422de2b131ed841d65aaf5f5437b5867e581.1530260731.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: 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 Add sw pattern detector statistics to mt76x2 debugfs. Moreover track down number of allocated sequence by the detector Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c | 8 ++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c | 11 ++++++++++- drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c index 3f86e01049f3..74725902e6dc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c @@ -91,12 +91,20 @@ mt76x2_dfs_stat_read(struct seq_file *file, void *data) struct mt76x2_dev *dev = file->private; struct mt76x2_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; + seq_printf(file, "allocated sequences:\t%d\n", + dfs_pd->seq_stats.seq_pool_len); + seq_printf(file, "used sequences:\t\t%d\n", + dfs_pd->seq_stats.seq_len); + seq_puts(file, "\n"); + for (i = 0; i < MT_DFS_NUM_ENGINES; i++) { seq_printf(file, "engine: %d\n", i); seq_printf(file, " hw pattern detected:\t%d\n", dfs_pd->stats[i].hw_pattern); seq_printf(file, " hw pulse discarded:\t%d\n", dfs_pd->stats[i].hw_pulse_discarded); + seq_printf(file, " sw pattern detected:\t%d\n", + dfs_pd->stats[i].sw_pattern); } return 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c index 38c1d5dc47ec..374cc655c11d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c @@ -165,6 +165,9 @@ static void mt76x2_dfs_seq_pool_put(struct mt76x2_dev *dev, struct mt76x2_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; list_add(&seq->head, &dfs_pd->seq_pool); + + dfs_pd->seq_stats.seq_pool_len++; + dfs_pd->seq_stats.seq_len--; } static @@ -180,7 +183,11 @@ struct mt76x2_dfs_sequence *mt76x2_dfs_seq_pool_get(struct mt76x2_dev *dev) struct mt76x2_dfs_sequence, head); list_del(&seq->head); + dfs_pd->seq_stats.seq_pool_len--; } + if (seq) + dfs_pd->seq_stats.seq_len++; + return seq; } @@ -555,8 +562,10 @@ static bool mt76x2_dfs_check_detection(struct mt76x2_dev *dev) return false; list_for_each_entry(seq, &dfs_pd->sequences, head) { - if (seq->count > MT_DFS_SEQUENCE_TH) + if (seq->count > MT_DFS_SEQUENCE_TH) { + dfs_pd->stats[seq->engine].sw_pattern++; return true; + } } return false; } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h index 83d2ff0b7e1f..693f421bf096 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h @@ -109,6 +109,12 @@ struct mt76x2_dfs_sw_detector_params { struct mt76x2_dfs_engine_stats { u32 hw_pattern; u32 hw_pulse_discarded; + u32 sw_pattern; +}; + +struct mt76x2_dfs_seq_stats { + u32 seq_pool_len; + u32 seq_len; }; struct mt76x2_dfs_pattern_detector { @@ -122,6 +128,7 @@ struct mt76x2_dfs_pattern_detector { struct list_head sequences; struct list_head seq_pool; + struct mt76x2_dfs_seq_stats seq_stats; unsigned long last_sw_check; u32 last_event_ts;