1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

cxgbe/t4_tom: Handle VXLAN-encapsulated SYNs correctly.

TCP SYNs in inner traffic will hit hardware listeners when VXLAN/NVGRE
rx parsing is enabled in the chip.  t4_tom should pass on these SYNs to
the kernel and let it deal with them as if they arrived on the non-TOE
path.

Reported by:	Sony at Chelsio
MFC after:	1 week
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2020-11-12 20:02:48 +00:00
parent 2418469b60
commit bdabd00d65
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367624

View File

@ -1003,6 +1003,17 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struct tcpopt *to)
to->to_flags |= TOF_SACKPERM;
}
static bool
encapsulated_syn(struct adapter *sc, const struct cpl_pass_accept_req *cpl)
{
u_int hlen = be32toh(cpl->hdr_len);
if (chip_id(sc) >= CHELSIO_T6)
return (G_T6_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header));
else
return (G_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header));
}
static void
pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m,
struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos)
@ -1194,22 +1205,38 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss,
CTR4(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p", __func__, stid, tid,
lctx);
/*
* Figure out the port the SYN arrived on. We'll look for an exact VI
* match in a bit but in case we don't find any we'll use the main VI as
* the incoming ifnet.
*/
l2info = be16toh(cpl->l2info);
pi = sc->port[G_SYN_INTF(l2info)];
hw_ifp = pi->vi[0].ifp;
m->m_pkthdr.rcvif = hw_ifp;
CURVNET_SET(lctx->vnet); /* before any potential REJECT */
/*
* If VXLAN/NVGRE parsing is enabled then SYNs in the inner traffic will
* also hit the listener. We don't want to offload those.
*/
if (encapsulated_syn(sc, cpl)) {
REJECT_PASS_ACCEPT_REQ(true);
}
/*
* Use the MAC index to lookup the associated VI. If this SYN didn't
* match a perfect MAC filter, punt.
*/
l2info = be16toh(cpl->l2info);
pi = sc->port[G_SYN_INTF(l2info)];
if (!(l2info & F_SYN_XACT_MATCH)) {
REJECT_PASS_ACCEPT_REQ(false);
REJECT_PASS_ACCEPT_REQ(true);
}
for_each_vi(pi, v, vi) {
if (vi->xact_addr_filt == G_SYN_MAC_IDX(l2info))
goto found;
}
REJECT_PASS_ACCEPT_REQ(false);
REJECT_PASS_ACCEPT_REQ(true);
found:
hw_ifp = vi->ifp; /* the cxgbe ifnet */
m->m_pkthdr.rcvif = hw_ifp;