Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3449849imm; Tue, 17 Jul 2018 05:10:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/yx+FN2eqjT9v3+Rqpw8HSpOzf9jXYQu3g9tH0pCmCnTwQo/cVkjyLnW3BtXFmNx3t6db X-Received: by 2002:a17:902:48c8:: with SMTP id u8-v6mr1412136plh.152.1531829431126; Tue, 17 Jul 2018 05:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531829431; cv=none; d=google.com; s=arc-20160816; b=vMXZGwwx2XXxvx2yba3JbVW4b+Azgs31Y/NUWX4VqWqP97SPFyt2cnm+914ijVv4l+ /0yDx92eDNANEybNOZJ/2YegTf7aDnyxW9ZklHD67h7Wyf/FBM6Ek0Vy3fYamaz4yYum dtudelDPBvZsbni4/r4kobKEKHXcCEN83FrFPUJ2wbdTCoFCm1rQcZXWZ4/JFD2sT1vw Wi2HTtif9NhsDtPCioy/KQEUugzfwL01ojG0K1pKHBmcUFXY5f31Qb4oBHw8Ue0ttV2K KxDUriGK1AzBMXcCSMl71X275VcIugnUvBg7s90+DxflMheOyzq28vxAGeQC/2f3LIsI px1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=P4ei7wcuHPDjUrteRiM8PhXW66EJ6HJdOh7Iv3qPZnU=; b=K4SSVy6G8AVIc9tWUZJKGLPfO4jCvE0Lr071s4D92ID6C5lUFXvt9Qz+ksAd5AsnlN CyhPze8hAZv1jd00B/llTgtxePr7RwKnVfMQHeLMwpEK2GMuOESvbjdo9Qft1/rIJtmW EIRd5biQNVS0PMbGebE6tXOaUM4OIAA9PDREfHLMqq2M8W5LwO9rHc+BuEaJVfFq2Edx NBa0dqhlc1ouU3bFp+r9hrJZNspWO10KXqYIUOUq+qci+bYPGpU87awy94Zr524MJdXk OXroAcYtLYsMG35OPCB3DIiOGuRiPitgyEj4Ci8M1mNRcb3Y7om54AHzKJ/DS5kwfvwt 54rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ro5v1AeS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si738754pfh.346.2018.07.17.05.10.16; Tue, 17 Jul 2018 05:10:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ro5v1AeS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731452AbeGQMjG (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.11.0