From 69c5dfb50414f77c66c5de329b6743d3e97880ad Mon Sep 17 00:00:00 2001 From: hselasky Date: Tue, 26 Jan 2016 14:33:20 +0000 Subject: [PATCH] Implement is_vlan_dev() and vlan_dev_vlan_id() for the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies --- .../linuxkpi/common/include/linux/if_vlan.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/if_vlan.h b/sys/compat/linuxkpi/common/include/linux/if_vlan.h index cd65183250d1..59b1c7e0a8c4 100644 --- a/sys/compat/linuxkpi/common/include/linux/if_vlan.h +++ b/sys/compat/linuxkpi/common/include/linux/if_vlan.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,25 @@ #include #include #include +#include #include +#include #define VLAN_N_VID 4096 +static inline int +is_vlan_dev(struct ifnet *ifp) +{ + return (ifp->if_type == IFT_L2VLAN); +} + +static inline uint16_t +vlan_dev_vlan_id(struct ifnet *ifp) +{ + uint16_t vtag; + if (VLAN_TAG(ifp, &vtag) == 0) + return (vtag); + return (0); +} + #endif /* _LINUX_IF_VLAN_H_ */