From patchwork Mon Dec 4 18:31:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 844363 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="lDcJCNsC"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yrD4W3K77z9ryk for ; Tue, 5 Dec 2017 05:32:11 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbdLDScJ (ORCPT ); Mon, 4 Dec 2017 13:32:09 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:40121 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752289AbdLDScD (ORCPT ); Mon, 4 Dec 2017 13:32:03 -0500 Received: by mail-pf0-f174.google.com with SMTP id v26so9161731pfl.7 for ; Mon, 04 Dec 2017 10:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=opsEzXbB9H4zWXTkzbf98d/yBd1AHkwrFMHcxOekiJE=; b=lDcJCNsC6JSxlGpejX7CpQcC7W2T0FPegm0ZkomgU2YfLnHH8lbnBc//T6tCqeDndM ZOWjHYW8TEDnhNOfnxUc9AuwbrdhHJhKsIxTaunmDCA2Ij7yAV4Xi2Ff+5lz+rFkF6ce YY3K813y/Ou1hDeATkCLVXJRBAaQkwqalsLaIdOgCFAnYcKj4EgUqG1dJef45IaRJHHW y9R1o1ue5ipVpBJbnSpZuUVpUboft/X1huKbwATySM3+UaiPpi+YckjpiOT72fiMvDXQ VziDQunNP24psjgs9YkXXSY44/XQ1UAAS5r3w9T8q5+jqXgYg0okBkhxDAXIxbMlssep XxLQ== 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=opsEzXbB9H4zWXTkzbf98d/yBd1AHkwrFMHcxOekiJE=; b=azaxbTuOU2z5XaRNBN3WTljRRsJEKtf8LA5eihv1MzqComh5hFqktG8dwsBsnhU669 MBxnq5Tq5MIBlhUxKsbQ50uIFrwSJuujbz78Eu96eZEzf+oGNnCLF3bMLni3l3hZEEUz 8GmJTSWtcnAG5S6QiUcQO8F0HlPK/pykZia9474bGUcB57A3Ss7brA6/sTCrEEC8iqiK DuFaQdhDCsFEmlSONgFJaQtVPsRyrefCQvqD++YCLnaA4p0x6Yd2fLsUp06Vk6mS0alV VQ9CjLEAN2DehlEJKnuGAJr1dDeyVxdgUYeJb95grioy5zZq/90c4K2LKlFj3hDNCLzl 7wBQ== X-Gm-Message-State: AJaThX4u51kNj9AlUdtl7dMAi3iGq73igPf9pQsSnji5ahWAD4hdebSk v+J1US204C6r8zXSAEERkh+y23Na X-Google-Smtp-Source: AGs4zMYY4Mv9T1VLKL68wzCW8u5/zRXxRH84rcJl7LJkFpGNFiNtNeHAuOhq+umbC5SdxbPPSrEVxA== X-Received: by 10.99.127.67 with SMTP id p3mr9578005pgn.263.1512412322609; Mon, 04 Dec 2017 10:32:02 -0800 (PST) Received: from localhost.localdomain (c-73-162-13-107.hsd1.ca.comcast.net. [73.162.13.107]) by smtp.gmail.com with ESMTPSA id z2sm3558962pgu.17.2017.12.04.10.32.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Dec 2017 10:32:01 -0800 (PST) From: Tom Herbert To: davem@davemloft.net Cc: netdev@vger.kernel.org, herbert@gondor.apana.org.au, rohit@quantonium.net, Tom Herbert Subject: [PATCH v2 net-next 0/5] rhashtable: New features in walk and bucket Date: Mon, 4 Dec 2017 10:31:40 -0800 Message-Id: <20171204183145.3277-1-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch contains some changes to related rhashtable: - Above allow rhashtable_walk_start to return void - Add a functon to peek at the next entry during a walk - Abstract out function to compute a has for a table - A library function to alloc a spinlocks bucket array - Call the above function for rhashtable locks allocation Tested: Exercised using various operations on an ILA xlat table. v2: - Apply feedback from Herbert. Don't change semantics of resize event reporting and -EAGAIN, just simplify API for callers that ignore those. - Add end_of_table in iter to reliably tell when the iterator has reached to the eno. Tom Herbert (5): rhashtable: Change rhashtable_walk_start to return void rhashtable: Add rhastable_walk_peek rhashtable: abstract out function to get hash spinlock: Add library function to allocate spinlock buckets array rhashtable: Call library function alloc_bucket_locks drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c | 6 +- .../net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 7 +- fs/gfs2/glock.c | 7 +- include/linux/rhashtable.h | 38 +++-- include/linux/spinlock.h | 6 + include/net/sctp/sctp.h | 2 +- lib/Makefile | 2 +- lib/bucket_locks.c | 54 +++++++ lib/rhashtable.c | 160 +++++++++++++-------- lib/test_rhashtable.c | 6 +- net/ipv6/ila/ila_xlat.c | 4 +- net/ipv6/seg6.c | 4 +- net/mac80211/mesh_pathtbl.c | 34 ++--- net/netfilter/nft_set_hash.c | 10 +- net/netlink/af_netlink.c | 5 +- net/netlink/diag.c | 8 +- net/sctp/proc.c | 6 +- net/sctp/socket.c | 19 +-- net/tipc/socket.c | 6 +- 19 files changed, 224 insertions(+), 160 deletions(-) create mode 100644 lib/bucket_locks.c