mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	bridge: add br_vlan_get_proto()
This new function allows you to fetch the bridge port vlan protocol. Signed-off-by: wenxu <wenxu@ucloud.cn> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
		
							parent
							
								
									c54c7c6854
								
							
						
					
					
						commit
						31aed46fed
					
				
					 2 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
					@ -89,6 +89,7 @@ static inline bool br_multicast_router(const struct net_device *dev)
 | 
				
			||||||
bool br_vlan_enabled(const struct net_device *dev);
 | 
					bool br_vlan_enabled(const struct net_device *dev);
 | 
				
			||||||
int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid);
 | 
					int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid);
 | 
				
			||||||
int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid);
 | 
					int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid);
 | 
				
			||||||
 | 
					int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto);
 | 
				
			||||||
int br_vlan_get_info(const struct net_device *dev, u16 vid,
 | 
					int br_vlan_get_info(const struct net_device *dev, u16 vid,
 | 
				
			||||||
		     struct bridge_vlan_info *p_vinfo);
 | 
							     struct bridge_vlan_info *p_vinfo);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
| 
						 | 
					@ -102,6 +103,11 @@ static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static inline int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return -EINVAL;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
 | 
					static inline int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -797,6 +797,16 @@ bool br_vlan_enabled(const struct net_device *dev)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL_GPL(br_vlan_enabled);
 | 
					EXPORT_SYMBOL_GPL(br_vlan_enabled);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct net_bridge *br = netdev_priv(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*p_proto = ntohs(br->vlan_proto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					EXPORT_SYMBOL_GPL(br_vlan_get_proto);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
 | 
					int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err = 0;
 | 
						int err = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue