From patchwork Sat Jun 16 15:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10467983 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 8A3E8600F4 for ; Sat, 16 Jun 2018 15:56:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77BFC28BB0 for ; Sat, 16 Jun 2018 15:56:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C96F28CE9; Sat, 16 Jun 2018 15:56:43 +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=-6.4 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB 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 9879F28CDB for ; Sat, 16 Jun 2018 15:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932655AbeFPP4l (ORCPT ); Sat, 16 Jun 2018 11:56:41 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:46738 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932582AbeFPP4j (ORCPT ); Sat, 16 Jun 2018 11:56:39 -0400 Received: by mail-wr0-f194.google.com with SMTP id v13-v6so12612196wrp.13 for ; Sat, 16 Jun 2018 08:56:39 -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; bh=zzLXcDOuJ/DXEnYVS9dFwwd5x3rRx7TePNfuCHSHZKI=; b=iCQhmeolv6thwtZNgC1E2FyuXdNozHfmgqGrdTLhVOoMhNp7NB7YL6SDw1IA6yq+XD UvBHuIlymEVKoWmZRI3Lkihbi7452J+Migef/8mRzEAyxmpioO3mN3HI9kskPAQzDg4Z mUfARfti91EG/V9YFJrPPiKxEbNoHxOqu4p97c3itTCxvGq8rVmqvJnBYVD8gQo3iFzH UH39zNlqdfC2gv8RHG4eP2ukMuBAc31xSObXFoLILE3n0LHliYPt8FW8n5J9Lzq6Uy/C tp/yndh9uNlAaptoQ7frFRBqRD40ptuF55uV6gaAI7tjYit5uuaYcIH36AqHYJ8pQRa3 NNgQ== X-Gm-Message-State: APt69E3xoOMwMeZjrTwdH5aa3kSEGKM+zNt2sXrzWNGDe97gr+nO2KLP kky/FDLE5nCXALDd5fzH4C5DPbi0UlY= X-Google-Smtp-Source: ADUXVKImAOVQj52vD3PDfCqDfH6i+fT+1TQc/GSCZCrMpwbMKxrjqS42z3rDCELN7Bx8Zy58OrL7gw== X-Received: by 2002:adf:afe3:: with SMTP id y35-v6mr5582712wrd.176.1529164598542; Sat, 16 Jun 2018 08:56:38 -0700 (PDT) Received: from localhost.localdomain ([151.66.6.110]) by smtp.gmail.com with ESMTPSA id j131-v6sm7442153wmg.24.2018.06.16.08.56.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Jun 2018 08:56:37 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH 4/4] mt76x2: debugfs: add sw pulse statistics to dfs debugfs Date: Sat, 16 Jun 2018 17:56:21 +0200 Message-Id: <20180616155621.30539-5-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.1 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 955ea3e692dd..bbe5cf1b6b49 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 0a53a47d8b14..e8894f75a94a 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; } @@ -556,8 +563,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 0ce5b62fb74c..72603ca527ee 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h @@ -105,6 +105,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 { @@ -118,6 +124,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;