git: 2a2dd4bd435d - stable/13 - tcp: make network epoch expectations of LRO explicit

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 22 Feb 2022 22:38:09 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=2a2dd4bd435d2ad29e89f0be75d849dc910f66f3

commit 2a2dd4bd435d2ad29e89f0be75d849dc910f66f3
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-08-25 15:09:25 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2022-02-22 22:37:44 +0000

    tcp: make network epoch expectations of LRO explicit
    
    Reviewed by:            gallatin, hselasky
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D31648
    
    (cherry picked from commit dc6ab77d66f892566de926274e6a58a637975510)
---
 sys/netinet/tcp_lro.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index cfc84707abd2..d53391454062 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -574,6 +574,7 @@ tcp_lro_flush_inactive(struct lro_ctrl *lc, const struct timeval *timeout)
 	uint64_t now, tov;
 	struct bintime bt;
 
+	NET_EPOCH_ASSERT();
 	if (LIST_EMPTY(&lc->lro_active))
 		return;
 
@@ -1172,8 +1173,6 @@ tcp_lro_lookup(struct ifnet *ifp, struct lro_parser *pa)
 {
 	struct inpcb *inp;
 
-	NET_EPOCH_ASSERT();
-
 	switch (pa->data.lro_type) {
 #ifdef INET6
 	case LRO_TYPE_IPV6_TCP:
@@ -1363,7 +1362,10 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le)
 	/* Only optimise if there are multiple packets waiting. */
 #ifdef TCPHPTS
 	int error;
+#endif
 
+	NET_EPOCH_ASSERT();
+#ifdef TCPHPTS
 	CURVNET_SET(lc->ifp->if_vnet);
 	error = tcp_lro_flush_tcphpts(lc, le);
 	CURVNET_RESTORE();
@@ -1474,6 +1476,7 @@ tcp_lro_flush_all(struct lro_ctrl *lc)
 	uint64_t nseq;
 	unsigned x;
 
+	NET_EPOCH_ASSERT();
 	/* check if no mbufs to flush */
 	if (lc->lro_mbuf_count == 0)
 		goto done;
@@ -1894,6 +1897,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
 void
 tcp_lro_queue_mbuf(struct lro_ctrl *lc, struct mbuf *mb)
 {
+	NET_EPOCH_ASSERT();
 	/* sanity checks */
 	if (__predict_false(lc->ifp == NULL || lc->lro_mbuf_data == NULL ||
 	    lc->lro_mbuf_max == 0)) {