vlan: allow net.link.vlan.mtag_pcp to be set per vnet
The primary reason for this change is to facilitate testing. MFC after: 1 week
This commit is contained in:
parent
0143a6bb7f
commit
78bc3d5e17
@ -1357,9 +1357,10 @@ SYSCTL_INT(_net_link_vlan, OID_AUTO, soft_pad, CTLFLAG_RW | CTLFLAG_VNET,
|
||||
* per-packet memory allocations and frees. In the future, it would be
|
||||
* preferable to reuse ether_vtag for this, or similar.
|
||||
*/
|
||||
int vlan_mtag_pcp = 0;
|
||||
SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW,
|
||||
&vlan_mtag_pcp, 0,
|
||||
VNET_DEFINE(int, vlan_mtag_pcp) = 0;
|
||||
#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp)
|
||||
SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW | CTLFLAG_VNET,
|
||||
&VNET_NAME(vlan_mtag_pcp), 0,
|
||||
"Retain VLAN PCP information as packets are passed up the stack");
|
||||
|
||||
bool
|
||||
@ -1411,7 +1412,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
|
||||
* knows how to find the VLAN tag to use, so we attach a
|
||||
* packet tag that holds it.
|
||||
*/
|
||||
if (vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q,
|
||||
if (V_vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q,
|
||||
MTAG_8021Q_PCP_OUT, NULL)) != NULL)
|
||||
tag = EVL_MAKETAG(qtag->vid, *(uint8_t *)(mtag + 1), 0);
|
||||
else
|
||||
|
@ -213,7 +213,8 @@ static struct {
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
extern int vlan_mtag_pcp;
|
||||
VNET_DECLARE(int, vlan_mtag_pcp);
|
||||
#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp)
|
||||
|
||||
static const char vlanname[] = "vlan";
|
||||
static MALLOC_DEFINE(M_VLAN, vlanname, "802.1Q Virtual LAN Interface");
|
||||
@ -1430,7 +1431,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
|
||||
return;
|
||||
}
|
||||
|
||||
if (vlan_mtag_pcp) {
|
||||
if (V_vlan_mtag_pcp) {
|
||||
/*
|
||||
* While uncommon, it is possible that we will find a 802.1q
|
||||
* packet encapsulated inside another packet that also had an
|
||||
|
Loading…
Reference in New Issue
Block a user