From patchwork Tue Jul 17 12:06:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ahern X-Patchwork-Id: 10529271 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 296F4600D0 for ; Tue, 17 Jul 2018 12:09:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EDFF28EA8 for ; Tue, 17 Jul 2018 12:09:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1359A28EB9; Tue, 17 Jul 2018 12:09:29 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 ADB1028EB2 for ; Tue, 17 Jul 2018 12:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731404AbeGQMjG (ORCPT ); Tue, 17 Jul 2018 08:39:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:60638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731295AbeGQMjG (ORCPT ); Tue, 17 Jul 2018 08:39:06 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FC5B2146E; Tue, 17 Jul 2018 12:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531829205; bh=rwZrS2vy406LKz+0Z1X2BMDXCIoN747644S/zkMBeDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ro5v1AeSX9GMl42sy7SZpnOPP5Omk8SX4Z3V7On3zuJx62HCcHL+hxkak/7MeRRP5 CV2kkt5zsB5RAb9RoRPhgiWYaw3hBVynFK0NhiXwCPWDJ7gdr2HH4hhSM0M1v9oLY/ 9cDdX0Ig10RqqXronSkHOuK0AZ6qAKlJf79YohxA= From: dsahern@kernel.org To: netdev@vger.kernel.org Cc: nikita.leshchenko@oracle.com, roopa@cumulusnetworks.com, stephen@networkplumber.org, idosch@mellanox.com, jiri@mellanox.com, saeedm@mellanox.com, alex.aring@gmail.com, linux-wpan@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org, David Ahern Subject: [PATCH RFC/RFT net-next 02/17] net/neigh: export neigh_find_table Date: Tue, 17 Jul 2018 05:06:36 -0700 Message-Id: <20180717120651.15748-3-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180717120651.15748-1-dsahern@kernel.org> References: <20180717120651.15748-1-dsahern@kernel.org> Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Ahern neighbor code already has an API for access to neighbor caches by address family. Export it for use by networking code. Add the namespace as an input arg and make family a u8 versus an int (all existing callers pass ndm_family which is a u8). Signed-off-by: David Ahern --- include/net/neighbour.h | 2 ++ net/core/neighbour.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 6c1eecd56a4d..5bc4d79b4b3a 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -229,6 +229,8 @@ enum { NEIGH_LINK_TABLE = NEIGH_NR_TABLES /* Pseudo table for neigh_xmit */ }; +struct neigh_table *neigh_find_table(struct net *net, u8 family); + static inline int neigh_parms_family(struct neigh_parms *p) { return p->tbl->family; diff --git a/net/core/neighbour.c b/net/core/neighbour.c index cbe85d8d4cc2..e8630f9de24a 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1625,7 +1625,7 @@ int neigh_table_clear(int index, struct neigh_table *tbl) } EXPORT_SYMBOL(neigh_table_clear); -static struct neigh_table *neigh_find_table(int family) +struct neigh_table *neigh_find_table(struct net *net, u8 family) { struct neigh_table *tbl = NULL; @@ -1643,6 +1643,7 @@ static struct neigh_table *neigh_find_table(int family) return tbl; } +EXPORT_SYMBOL(neigh_find_table); static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) @@ -1672,7 +1673,7 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, } } - tbl = neigh_find_table(ndm->ndm_family); + tbl = neigh_find_table(net, ndm->ndm_family); if (tbl == NULL) return -EAFNOSUPPORT; @@ -1740,7 +1741,7 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, goto out; } - tbl = neigh_find_table(ndm->ndm_family); + tbl = neigh_find_table(net, ndm->ndm_family); if (tbl == NULL) return -EAFNOSUPPORT;