From patchwork Sat Jun 29 22:58:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 2804041 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57B54BF4A1 for ; Sat, 29 Jun 2013 22:59:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AB9420105 for ; Sat, 29 Jun 2013 22:59:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FD7D20104 for ; Sat, 29 Jun 2013 22:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751871Ab3F2W7Q (ORCPT ); Sat, 29 Jun 2013 18:59:16 -0400 Received: from mail.candelatech.com ([208.74.158.172]:47094 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751330Ab3F2W7Q (ORCPT ); Sat, 29 Jun 2013 18:59:16 -0400 Received: from fs3.candelatech.com (firewall.candelatech.com [70.89.124.249]) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id r5TMx89c025446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 29 Jun 2013 15:59:08 -0700 From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: Ben Greear Subject: [WT PATCH 1/6] mac80211: Add debugfs file to show station-hash counts. Date: Sat, 29 Jun 2013 15:58:53 -0700 Message-Id: <1372546738-25827-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 1.7.3.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear Helps debug bad hash spreads, like when you have lots of station interfaces all connected to the same AP. Signed-off-by: Ben Greear --- net/mac80211/debugfs.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index b0e32d6..2bbe377 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -175,8 +175,44 @@ static ssize_t queues_read(struct file *file, char __user *user_buf, return simple_read_from_buffer(user_buf, count, ppos, buf, res); } +static ssize_t sta_hash_read(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct ieee80211_local *local = file->private_data; + int mxln = STA_HASH_SIZE * 10; + char *buf = kzalloc(mxln, GFP_KERNEL); + int q, res = 0; + struct sta_info *sta; + + if (!buf) + return 0; + + mutex_lock(&local->sta_mtx); + for (q = 0; q < STA_HASH_SIZE; q++) { + int cnt = 0; + sta = local->sta_hash[q]; + while (sta) { + cnt++; + sta = sta->hnext; + } + if (cnt) { + res += sprintf(buf + res, "%i: %i\n", q, cnt); + if (res >= (STA_HASH_SIZE * 10)) { + res = STA_HASH_SIZE * 10; + break; + } + } + } + mutex_unlock(&local->sta_mtx); + + q = simple_read_from_buffer(user_buf, count, ppos, buf, res); + kfree(buf); + return q; +} + DEBUGFS_READONLY_FILE_OPS(hwflags); DEBUGFS_READONLY_FILE_OPS(queues); +DEBUGFS_READONLY_FILE_OPS(sta_hash); /* statistics stuff */ @@ -245,6 +281,7 @@ void debugfs_hw_add(struct ieee80211_local *local) DEBUGFS_ADD(total_ps_buffered); DEBUGFS_ADD(wep_iv); DEBUGFS_ADD(queues); + DEBUGFS_ADD(sta_hash); #ifdef CONFIG_PM DEBUGFS_ADD_MODE(reset, 0200); #endif