vlan(4): Add support for allocating TLS receive tags.
The TLS receive tags are allocated directly from the receiving interface, because mbufs are flowing in the opposite direction and then route change checks are not useful, because they only work for outgoing traffic. Differential revision: https://reviews.freebsd.org/D32356 Sponsored by: NVIDIA Networking
This commit is contained in:
parent
1967e31379
commit
892eded5b8
@ -2204,8 +2204,12 @@ vlan_snd_tag_alloc(struct ifnet *ifp,
|
||||
struct vlan_snd_tag *vst;
|
||||
struct ifvlan *ifv;
|
||||
struct ifnet *parent;
|
||||
struct m_snd_tag *mst;
|
||||
int error;
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
ifv = ifp->if_softc;
|
||||
|
||||
switch (params->hdr.type) {
|
||||
#ifdef RATELIMIT
|
||||
case IF_SND_TAG_TYPE_UNLIMITED:
|
||||
@ -2219,6 +2223,12 @@ vlan_snd_tag_alloc(struct ifnet *ifp,
|
||||
case IF_SND_TAG_TYPE_TLS:
|
||||
sw = &vlan_snd_tag_tls_sw;
|
||||
break;
|
||||
case IF_SND_TAG_TYPE_TLS_RX:
|
||||
sw = NULL;
|
||||
if (params->tls_rx.vlan_id != 0)
|
||||
goto failure;
|
||||
params->tls_rx.vlan_id = ifv->ifv_vid;
|
||||
break;
|
||||
#ifdef RATELIMIT
|
||||
case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
|
||||
sw = &vlan_snd_tag_tls_rl_sw;
|
||||
@ -2226,39 +2236,46 @@ vlan_snd_tag_alloc(struct ifnet *ifp,
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
NET_EPOCH_ENTER(et);
|
||||
ifv = ifp->if_softc;
|
||||
if (ifv->ifv_trunk != NULL)
|
||||
parent = PARENT(ifv);
|
||||
else
|
||||
parent = NULL;
|
||||
if (parent == NULL) {
|
||||
NET_EPOCH_EXIT(et);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
if (parent == NULL)
|
||||
goto failure;
|
||||
if_ref(parent);
|
||||
NET_EPOCH_EXIT(et);
|
||||
|
||||
vst = malloc(sizeof(*vst), M_VLAN, M_NOWAIT);
|
||||
if (vst == NULL) {
|
||||
if_rele(parent);
|
||||
return (ENOMEM);
|
||||
}
|
||||
if (sw != NULL) {
|
||||
vst = malloc(sizeof(*vst), M_VLAN, M_NOWAIT);
|
||||
if (vst == NULL) {
|
||||
if_rele(parent);
|
||||
return (ENOMEM);
|
||||
}
|
||||
} else
|
||||
vst = NULL;
|
||||
|
||||
error = m_snd_tag_alloc(parent, params, &vst->tag);
|
||||
error = m_snd_tag_alloc(parent, params, &mst);
|
||||
if_rele(parent);
|
||||
if (error) {
|
||||
free(vst, M_VLAN);
|
||||
return (error);
|
||||
}
|
||||
|
||||
m_snd_tag_init(&vst->com, ifp, sw);
|
||||
if (sw != NULL) {
|
||||
m_snd_tag_init(&vst->com, ifp, sw);
|
||||
vst->tag = mst;
|
||||
|
||||
*ppmt = &vst->com;
|
||||
} else
|
||||
*ppmt = mst;
|
||||
|
||||
*ppmt = &vst->com;
|
||||
return (0);
|
||||
failure:
|
||||
NET_EPOCH_EXIT(et);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
static struct m_snd_tag *
|
||||
|
Loading…
Reference in New Issue
Block a user