From patchwork Fri Sep 18 17:06:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ahern X-Patchwork-Id: 519491 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2F8FC140281 for ; Sat, 19 Sep 2015 03:07:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b=bdRWZ6Qm; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754315AbbIRRGy (ORCPT ); Fri, 18 Sep 2015 13:06:54 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:36344 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbbIRRGt (ORCPT ); Fri, 18 Sep 2015 13:06:49 -0400 Received: by padhk3 with SMTP id hk3so55836178pad.3 for ; Fri, 18 Sep 2015 10:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b68Y4mHLDPfSL3RmCGzLuCx+GPOqFL3IEZ95lX005Mk=; b=bdRWZ6QmfkDTqSafVS8PazF7qKBFcsXBo81CpA+f1jgiZJW41kaiVm0oXKbNsnYXHZ 3Dg3xGLkBeMyO3jFNeRiQpMcNur6JzSYRgljM8REVyvlai4U/2diPA23I7rRY8XOBDhA 9w33edgSx2A+7iBz98xNWMLeqlCfCrQ53D4v0= 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=b68Y4mHLDPfSL3RmCGzLuCx+GPOqFL3IEZ95lX005Mk=; b=ZOIhSMR+ctRSejNQp+2XV1Mx2i3JUBcsCW2ivQF3tMrNYqggROdtTgw5Df6Rndcotx JdBRR7N0EdOzsTiEydY32hdDn4Z45TUfqM2IQutEWEOrzdEGhAhRZZTbLHDsPeNMPbDk lSlk3S0Njr25Rcbjk4121sTfqYvqJjIsJvBxin8TO3zzOh+w8Gzp9yjTkLTbJpoTg2SM 9Gl5Q7suhjYPOXEpIFcBw02MpyTiwjKSr3M2ol6wkmgUJtPztyOPzIkbrtxZf0Gp/Y/u a41SqJU80LTou7tflLXoMW0stmyVPwnUBBxp0jgMSIF5e36tZ4DvDJpXw59htsVTq8Tu oXxQ== X-Gm-Message-State: ALoCoQm111fA3eOTukKXB9iy7E6sfDw07RgTyWEug0KPxo0zUbp1Nnop/fOjRI0quJs8GCnrycPR X-Received: by 10.68.248.102 with SMTP id yl6mr8529404pbc.66.1442596009274; Fri, 18 Sep 2015 10:06:49 -0700 (PDT) Received: from monster-14.cumulusnetworks.com. ([216.129.126.126]) by smtp.googlemail.com with ESMTPSA id ey17sm10052994pac.26.2015.09.18.10.06.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2015 10:06:48 -0700 (PDT) From: David Ahern To: netdev@vger.kernel.org Cc: shm@cumulusnetworks.com, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, gospo@cumulusnetworks.com, David Ahern Subject: [RFC net-next 09/11] net: Move netif_index_is_l3_master to l3mdev.h Date: Fri, 18 Sep 2015 10:06:23 -0700 Message-Id: <1442595985-7049-10-git-send-email-dsa@cumulusnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442595985-7049-1-git-send-email-dsa@cumulusnetworks.com> References: <1442595985-7049-1-git-send-email-dsa@cumulusnetworks.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change CONFIG dependency to CONFIG_NET_L3_MASTER_DEV as well. Signed-off-by: David Ahern --- include/linux/netdevice.h | 21 --------------------- include/net/l3mdev.h | 24 ++++++++++++++++++++++++ include/net/route.h | 1 + 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 796c65dfa0ff..daffe38b49fc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3839,27 +3839,6 @@ static inline bool netif_is_ovs_master(const struct net_device *dev) return dev->priv_flags & IFF_OPENVSWITCH; } -static inline bool netif_index_is_l3_master(struct net *net, int ifindex) -{ - bool rc = false; - -#if IS_ENABLED(CONFIG_NET_VRF) - struct net_device *dev; - - if (ifindex == 0) - return false; - - rcu_read_lock(); - - dev = dev_get_by_index_rcu(net, ifindex); - if (dev) - rc = netif_is_l3_master(dev); - - rcu_read_unlock(); -#endif - return rc; -} - /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */ static inline void netif_keep_dst(struct net_device *dev) { diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h index 3892637d2f0e..8befd629f8ac 100644 --- a/include/net/l3mdev.h +++ b/include/net/l3mdev.h @@ -84,6 +84,25 @@ static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev, return NULL; } +static inline bool netif_index_is_l3_master(struct net *net, int ifindex) +{ + struct net_device *dev; + bool rc = false; + + if (ifindex == 0) + return false; + + rcu_read_lock(); + + dev = dev_get_by_index_rcu(net, ifindex); + if (dev) + rc = netif_is_l3_master(dev); + + rcu_read_unlock(); + + return rc; +} + #else static inline int l3mdev_master_ifindex_rcu(struct net_device *dev) @@ -123,6 +142,11 @@ static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev, return NULL; } +static inline bool netif_index_is_l3_master(struct net *net, int ifindex) +{ + return false; +} + #endif #endif /* _NET_L3MDEV_H_ */ diff --git a/include/net/route.h b/include/net/route.h index 49c93d8733d3..aef6c9a38fcb 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include