diff mbox

[net-next,2/3] vlan: add helper which can be called to se it device is used by vlan

Message ID 1345728413-10298-3-git-send-email-jiri@resnulli.us
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Pirko Aug. 23, 2012, 1:26 p.m. UTC
also, remove unused vlan_info definition from header

CC: Patrick McHardy <kaber@trash.net>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 include/linux/if_vlan.h | 9 +++++++--
 net/8021q/vlan_core.c   | 6 ++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

Comments

Or Gerlitz Aug. 23, 2012, 1:33 p.m. UTC | #1
On 23/08/2012 16:26, Jiri Pirko wrote:
> also, remove unused vlan_info definition from header

just a typo in the subject line, you probably wanted to say "see" and 
not "se"?

Or.

>
> CC: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>   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);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko Aug. 23, 2012, 1:42 p.m. UTC | #2
Thu, Aug 23, 2012 at 03:33:06PM CEST, ogerlitz@mellanox.com wrote:
>On 23/08/2012 16:26, Jiri Pirko wrote:
>>also, remove unused vlan_info definition from header
>
>just a typo in the subject line, you probably wanted to say "see" and
>not "se"?

Yes. I need some coffe :(

>
>Or.
>
>>
>>CC: Patrick McHardy <kaber@trash.net>
>>Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>>---
>>  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);
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);