lagg(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:
Hans Petter Selasky 2022-05-25 12:38:30 +02:00
parent 1d528f95e8
commit 1967e31379

View File

@ -1836,6 +1836,7 @@ lagg_snd_tag_alloc(struct ifnet *ifp,
struct lagg_snd_tag *lst;
struct lagg_port *lp;
struct ifnet *lp_ifp;
struct m_snd_tag *mst;
int error;
switch (params->hdr.type) {
@ -1851,6 +1852,10 @@ lagg_snd_tag_alloc(struct ifnet *ifp,
case IF_SND_TAG_TYPE_TLS:
sw = &lagg_snd_tag_tls_sw;
break;
case IF_SND_TAG_TYPE_TLS_RX:
/* Return tag from port interface directly. */
sw = NULL;
break;
#ifdef RATELIMIT
case IF_SND_TAG_TYPE_TLS_RATE_LIMIT:
sw = &lagg_snd_tag_tls_rl_sw;
@ -1876,22 +1881,30 @@ lagg_snd_tag_alloc(struct ifnet *ifp,
if_ref(lp_ifp);
NET_EPOCH_EXIT(et);
lst = malloc(sizeof(*lst), M_LAGG, M_NOWAIT);
if (lst == NULL) {
if_rele(lp_ifp);
return (ENOMEM);
}
if (sw != NULL) {
lst = malloc(sizeof(*lst), M_LAGG, M_NOWAIT);
if (lst == NULL) {
if_rele(lp_ifp);
return (ENOMEM);
}
} else
lst = NULL;
error = m_snd_tag_alloc(lp_ifp, params, &lst->tag);
error = m_snd_tag_alloc(lp_ifp, params, &mst);
if_rele(lp_ifp);
if (error) {
free(lst, M_LAGG);
return (error);
}
m_snd_tag_init(&lst->com, ifp, sw);
if (sw != NULL) {
m_snd_tag_init(&lst->com, ifp, sw);
lst->tag = mst;
*ppmt = &lst->com;
} else
*ppmt = mst;
*ppmt = &lst->com;
return (0);
}