IfAPI: Add if_gettype() API and use it for vlan
Sponsored by: Juniper Networks, Inc. Reviewed by: #network, glebius Differential Revision: https://reviews.freebsd.org/D38198
This commit is contained in:
parent
950cc1f44f
commit
113af4fd2b
@ -4809,6 +4809,12 @@ if_setdebugnet_methods(if_t ifp, struct debugnet_methods *m)
|
||||
ifp->if_debugnet_methods = m;
|
||||
}
|
||||
|
||||
int
|
||||
if_gettype(if_t ifp)
|
||||
{
|
||||
return (ifp->if_type);
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
static void
|
||||
if_show_ifnet(struct ifnet *ifp)
|
||||
|
@ -584,6 +584,7 @@ void if_setdescr(if_t ifp, char *descrbuf);
|
||||
char *if_allocdescr(size_t sz, int malloc_flag);
|
||||
void if_freedescr(char *descrbuf);
|
||||
int if_getalloctype(const if_t ifp);
|
||||
int if_gettype(const if_t ifp);
|
||||
int if_setdev(if_t ifp, void *dev);
|
||||
int if_setdrvflagbits(if_t ifp, int if_setflags, int clear_flags);
|
||||
int if_getdrvflags(const if_t ifp);
|
||||
|
@ -143,15 +143,15 @@ struct ether_8021q_tag {
|
||||
} while (0)
|
||||
|
||||
#define VLAN_TRUNKDEV(_ifp) \
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL)
|
||||
(if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL)
|
||||
#define VLAN_TAG(_ifp, _vid) \
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL)
|
||||
(if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_vid)) : EINVAL)
|
||||
#define VLAN_PCP(_ifp, _pcp) \
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL)
|
||||
(if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_pcp_p)((_ifp), (_pcp)) : EINVAL)
|
||||
#define VLAN_COOKIE(_ifp) \
|
||||
((_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL)
|
||||
(if_gettype(_ifp) == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL)
|
||||
#define VLAN_SETCOOKIE(_ifp, _cookie) \
|
||||
((_ifp)->if_type == IFT_L2VLAN ? \
|
||||
(if_gettype(_ifp) == IFT_L2VLAN ? \
|
||||
(*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL)
|
||||
#define VLAN_DEVAT(_ifp, _vid) \
|
||||
((_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_vid)) : NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user