diff mbox

[1/2] net: move is_vlan_dev into public header file (v2)

Message ID 1306261869-7276-2-git-send-email-nhorman@tuxdriver.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Neil Horman May 24, 2011, 6:31 p.m. UTC
Migrate is_vlan_dev() to if_vlan.h so that core networkig can use it

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: davem@davemloft.net
CC: bhutchings@solarflare.com
---
 include/linux/if_vlan.h |    5 +++++
 net/8021q/vlan.h        |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Joe Perches May 24, 2011, 6:36 p.m. UTC | #1
On Tue, 2011-05-24 at 14:31 -0400, Neil Horman wrote:
> Migrate is_vlan_dev() to if_vlan.h so that core networkig can use it
[]
> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
[]
> @@ -110,6 +110,11 @@ static inline void vlan_group_set_device(struct vlan_group *vg,
>  	array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
>  }
>  
> +static inline int is_vlan_dev(struct net_device *dev)
> +{
> +        return dev->priv_flags & IFF_802_1Q_VLAN;
> +}

perhaps:

static bool is_vlan_dev(const struct net_device *dev)
{
	return !!(dev->priv_flags & IFF_802_1Q_VLAN);
}


--
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
Neil Horman May 24, 2011, 7:03 p.m. UTC | #2
On Tue, May 24, 2011 at 11:36:35AM -0700, Joe Perches wrote:
> On Tue, 2011-05-24 at 14:31 -0400, Neil Horman wrote:
> > Migrate is_vlan_dev() to if_vlan.h so that core networkig can use it
> []
> > diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
> []
> > @@ -110,6 +110,11 @@ static inline void vlan_group_set_device(struct vlan_group *vg,
> >  	array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
> >  }
> >  
> > +static inline int is_vlan_dev(struct net_device *dev)
> > +{
> > +        return dev->priv_flags & IFF_802_1Q_VLAN;
> > +}
> 
> perhaps:
> 
> static bool is_vlan_dev(const struct net_device *dev)
> {
> 	return !!(dev->priv_flags & IFF_802_1Q_VLAN);
> }
> 
I migrated this directly out of vlan.h as is.  I suppose we could change it, but
I'm not sure I see a need to do so immediately. All callers of this function
already work with it properly as defined currently (not that they wouldn't
otherwise).

Perhaps we could do a separate patch to fix this up as well as other common test
functions (br_port_exists, is_valid_iface, macvlan_port_exists,
netif_is_bond_slave, etc), all just return the result of a bitwise and
currently)

Neil

--
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
David Miller May 25, 2011, 9:56 p.m. UTC | #3
From: Neil Horman <nhorman@tuxdriver.com>
Date: Tue, 24 May 2011 14:31:08 -0400

> Migrate is_vlan_dev() to if_vlan.h so that core networkig can use it
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Applied.
--
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 290bd8a..dc01681 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -110,6 +110,11 @@  static inline void vlan_group_set_device(struct vlan_group *vg,
 	array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
 }
 
+static inline int is_vlan_dev(struct net_device *dev)
+{
+        return dev->priv_flags & IFF_802_1Q_VLAN;
+}
+
 #define vlan_tx_tag_present(__skb)	((__skb)->vlan_tci & VLAN_TAG_PRESENT)
 #define vlan_tx_tag_get(__skb)		((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
 
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index c3408de..9da07e3 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -118,11 +118,6 @@  extern void vlan_netlink_fini(void);
 
 extern struct rtnl_link_ops vlan_link_ops;
 
-static inline int is_vlan_dev(struct net_device *dev)
-{
-	return dev->priv_flags & IFF_802_1Q_VLAN;
-}
-
 extern int vlan_net_id;
 
 struct proc_dir_entry;