From patchwork Mon Feb 29 01:03:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 8448231 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 521D89F2F0 for ; Mon, 29 Feb 2016 01:04:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5AF232027D for ; Mon, 29 Feb 2016 01:04:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AC8220272 for ; Mon, 29 Feb 2016 01:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbcB2BEL (ORCPT ); Sun, 28 Feb 2016 20:04:11 -0500 Received: from mail-qg0-f65.google.com ([209.85.192.65]:32782 "EHLO mail-qg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbcB2BEI (ORCPT ); Sun, 28 Feb 2016 20:04:08 -0500 Received: by mail-qg0-f65.google.com with SMTP id y89so9652817qge.0 for ; Sun, 28 Feb 2016 17:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobcopeland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SK8FHqIoEXPNZEf70+ejbI+CPNwDzvHWOmTEfWbsUzo=; b=J7wbcbgpP7jKbW/yvD3MvratdYfXlQUh/1DrWFxLPpQpD0m33Trc/3HUoyV4y06Os4 Cl2TVIifeuFDrEX6JdADA6Ta4i4u4JaZxGqQ5SXPvt9AN+QQGYpLol/8ByMNqO7NoH2b aYEf244TirMhiLgcmfZHJdrfJqqatOf0bZdSMnm342dNHBYQvaYnkbctdpXMW7WaNWHF GESnR5WrX+0KGFF60E0d21jF+neQjwtfFzFfe0RkICR/+tzdbP5TEMhEE8nRYrBZwffq qPYOZVDAhJUR4MK4Hk+xQNWlMPrUzmCYEBLyEVJTohku/nPi+W7RFnmjsA0k9linISct CPaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SK8FHqIoEXPNZEf70+ejbI+CPNwDzvHWOmTEfWbsUzo=; b=LhpO7URJ2wrUcSdGqfNDqk1H1EXdbNsliROip59Z+VpqveKEJYrdPjT+9ax1rDFWyQ cCtjDDp37jSx3FvHfEy1vUhUHp7g5KjUUFHLGVNu0yQ0No6mYqEygyUgv7YC/f8cGUvF vToKmzEIXnVzpbPjBBWNXvZsZHSXf8vU/b46tuZ+BAqO6QPlxWfSegAlZgKoTscUC4xr LdUb3jj9EcvpRI1aHayeyL1JkBCsSxlS/4/xAxrENehifVpVJz1VHN8zZIN90W5oAGP6 oalW/DMoqsryWPYPSwete9m37DGphsfOhrdTOAnEEBQZkUnF/uJxD/TG5EWz3xEdRc5o b/tw== X-Gm-Message-State: AD7BkJItKBOjQHJIX618NWzZWYAgiArQclIMunoWOUj04Ly2csLP7HwnMn4fs5j3tu++IA== X-Received: by 10.140.155.196 with SMTP id b187mr16959976qhb.14.1456707847399; Sun, 28 Feb 2016 17:04:07 -0800 (PST) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by smtp.gmail.com with ESMTPSA id q64sm9980669qkh.47.2016.02.28.17.04.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Feb 2016 17:04:06 -0800 (PST) Received: from glass.lan ([192.168.1.51] helo=glass) by hash with esmtp (Exim 4.84) (envelope-from ) id 1aaCFj-0005qG-Gw; Sun, 28 Feb 2016 20:03:59 -0500 Received: from bob by glass with local (Exim 4.86) (envelope-from ) id 1aaCFp-00054n-2E; Sun, 28 Feb 2016 20:04:05 -0500 From: Bob Copeland To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Bob Copeland Subject: [PATCH 2/4] mac80211: mesh: don't hash sdata in mpath tables Date: Sun, 28 Feb 2016 20:03:57 -0500 Message-Id: <1456707839-19469-2-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1456707839-19469-1-git-send-email-me@bobcopeland.com> References: <1456707839-19469-1-git-send-email-me@bobcopeland.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Now that the sdata pointer is the same for all entries of a path table, hashing it is pointless, so hash only the address. Signed-off-by: Bob Copeland --- net/mac80211/mesh_pathtbl.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 0508b37b0471..fc3cc350df8c 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -177,12 +177,10 @@ errcopy: return -ENOMEM; } -static u32 mesh_table_hash(const u8 *addr, struct ieee80211_sub_if_data *sdata, - struct mesh_table *tbl) +static u32 mesh_table_hash(const u8 *addr, struct mesh_table *tbl) { - /* Use last four bytes of hw addr and interface index as hash index */ - return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, - tbl->hash_rnd) & tbl->hash_mask; + /* Use last four bytes of hw addr as hash index */ + return jhash_1word(*(u32 *)(addr+2), tbl->hash_rnd) & tbl->hash_mask; } @@ -331,7 +329,7 @@ static struct mesh_path *mpath_lookup(struct mesh_table *tbl, const u8 *dst, struct hlist_head *bucket; struct mpath_node *node; - bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)]; + bucket = &tbl->hash_buckets[mesh_table_hash(dst, tbl)]; hlist_for_each_entry_rcu(node, bucket, list) { mpath = node->mpath; if (ether_addr_equal(dst, mpath->dst)) { @@ -538,7 +536,7 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata, read_lock_bh(&sdata->u.mesh.pathtbl_resize_lock); tbl = resize_dereference_mesh_paths(sdata); - hash_idx = mesh_table_hash(dst, sdata, tbl); + hash_idx = mesh_table_hash(dst, tbl); bucket = &tbl->hash_buckets[hash_idx]; spin_lock(&tbl->hashwlock[hash_idx]); @@ -687,7 +685,7 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata, tbl = resize_dereference_mpp_paths(sdata); - hash_idx = mesh_table_hash(dst, sdata, tbl); + hash_idx = mesh_table_hash(dst, tbl); bucket = &tbl->hash_buckets[hash_idx]; spin_lock(&tbl->hashwlock[hash_idx]); @@ -905,7 +903,7 @@ static int table_path_del(struct mesh_table __rcu *rcu_tbl, int err = 0; tbl = resize_dereference_paths(sdata, rcu_tbl); - hash_idx = mesh_table_hash(addr, sdata, tbl); + hash_idx = mesh_table_hash(addr, tbl); bucket = &tbl->hash_buckets[hash_idx]; spin_lock(&tbl->hashwlock[hash_idx]); @@ -1107,7 +1105,7 @@ static int mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl) node = hlist_entry(p, struct mpath_node, list); mpath = node->mpath; new_node->mpath = mpath; - hash_idx = mesh_table_hash(mpath->dst, mpath->sdata, newtbl); + hash_idx = mesh_table_hash(mpath->dst, newtbl); hlist_add_head(&new_node->list, &newtbl->hash_buckets[hash_idx]); return 0;