From patchwork Thu Aug 23 13:26:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 179653 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 EC1142C0094 for ; Thu, 23 Aug 2012 23:27:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933948Ab2HWN11 (ORCPT ); Thu, 23 Aug 2012 09:27:27 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:48515 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933002Ab2HWN1T (ORCPT ); Thu, 23 Aug 2012 09:27:19 -0400 Received: by mail-we0-f174.google.com with SMTP id x8so400008wey.19 for ; Thu, 23 Aug 2012 06:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=9LlMDv0vls2C14zbBxhzB5rTulF9yEPgij+/YofhnVU=; b=NcxHuXuikcNcroPf/Hasu+98QMSuqdBDE7IBxWI4trmoOEdrgWbbNQrHPc8UUBe0dI 8GKrabtOJNOH5xfNsVH8awcVwsTRYht+jt8DMH8TlvsEVz9cz8/HDKRyBlx1YAY88QUq moSqglSizI82SYlv9nnqLI8iAHxwvpFNZEvNyguodiWZgizVU3m/wJL8IwuxxqWQPSu8 +hRD4V11cpVtq/VabWhw3IbWpCGMHMgUZSAj5tB/eMj2dgup+idY1mMdLeaS1JOEe1VZ aodLP19+AU03T7AlgJKKjktU1SJz/TEpm//+dzQoBLojxJG63OKXtzU3vQnXivGNh0++ Nvzw== Received: by 10.180.97.135 with SMTP id ea7mr15010648wib.11.1345728439020; Thu, 23 Aug 2012 06:27:19 -0700 (PDT) Received: from localhost (sun-0.pirko.cz. [84.16.102.25]) by mx.google.com with ESMTPS id fr4sm21055362wib.8.2012.08.23.06.27.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Aug 2012 06:27:18 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, brouer@redhat.com, ogerlitz@mellanox.com, Patrick McHardy Subject: [patch net-next 2/3] vlan: add helper which can be called to se it device is used by vlan Date: Thu, 23 Aug 2012 15:26:52 +0200 Message-Id: <1345728413-10298-3-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1345728413-10298-1-git-send-email-jiri@resnulli.us> References: <1345728413-10298-1-git-send-email-jiri@resnulli.us> X-Gm-Message-State: ALoCoQliVU03/fs4rVyKWRdPf1406+sbhhI1n1emNMNYxrbOFZuzCFGS9OoFkze7JwXIkuyOeyZd Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org also, remove unused vlan_info definition from header CC: Patrick McHardy Signed-off-by: Jiri Pirko --- include/linux/if_vlan.h | 9 +++++++-- net/8021q/vlan_core.c | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index a810987..e6ff12d 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -74,8 +74,6 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) /* found in socket.c */ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); -struct vlan_info; - static inline int is_vlan_dev(struct net_device *dev) { return dev->priv_flags & IFF_802_1Q_VLAN; @@ -101,6 +99,8 @@ extern int vlan_vids_add_by_dev(struct net_device *dev, const struct net_device *by_dev); extern void vlan_vids_del_by_dev(struct net_device *dev, const struct net_device *by_dev); + +extern bool vlan_uses_dev(const struct net_device *dev); #else static inline struct net_device * __vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) @@ -151,6 +151,11 @@ static inline void vlan_vids_del_by_dev(struct net_device *dev, const struct net_device *by_dev) { } + +static inline bool vlan_uses_dev(const struct net_device *dev) +{ + return false; +} #endif /** diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index d4babc6..517b940 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -372,3 +372,9 @@ void vlan_vids_del_by_dev(struct net_device *dev, vlan_vid_del(dev, vid_info->vid); } EXPORT_SYMBOL(vlan_vids_del_by_dev); + +bool vlan_uses_dev(const struct net_device *dev) +{ + return rtnl_dereference(dev->vlan_info) ? true : false; +} +EXPORT_SYMBOL(vlan_uses_dev);