git: ca73c0e25d7f - stable/13 - Update the TCP LRO code to handle both encrypted and un-encrypted traffic.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 08 Feb 2022 15:13:37 UTC
The branch stable/13 has been updated by hselasky:

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

commit ca73c0e25d7f306b15657267d6d372a2e6b38948
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-02-08 15:08:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-02-08 15:08:50 +0000

    Update the TCP LRO code to handle both encrypted and un-encrypted traffic.
    
    Encrypted and un-encrypted traffic needs to be coalesced separately.
    Split the 16-bit lro_type field in the address information into two
    8-bit fields, and then use the last 8-bit field for flags, which among
    other indicate if the received mbuf is encrypted or un-encrypted.
    
    Differential Revision:  https://reviews.freebsd.org/D31377
    Reviewed by:    gallatin
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit bb5cd80e8b42b31a2229077a7e93ffd3585eeb78)
---
 sys/netinet/tcp_lro.c | 5 ++++-
 sys/netinet/tcp_lro.h | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index bcfb8a809e1b..76083498b70e 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -370,6 +370,9 @@ tcp_lro_parser(struct mbuf *m, struct lro_parser *po, struct lro_parser *pi, boo
 			po->data.vlan_id =
 			    htons(m->m_pkthdr.ether_vtag) & htons(EVL_VLID_MASK);
 		}
+		/* Store decrypted flag, if any. */
+		if (__predict_false(m->m_flags & M_DECRYPTED))
+			po->data.lro_flags |= LRO_FLAG_DECRYPTED;
 	}
 
 	switch (po->data.lro_type) {
@@ -1558,7 +1561,7 @@ do_bpf_strip_and_compress(struct inpcb *inp, struct lro_ctrl *lc,
 	uint32_t *ts_ptr;
 	int32_t n_mbuf;
 	bool other_opts, can_compress;
-	uint16_t lro_type;
+	uint8_t lro_type;
 	uint16_t iptos;
 	int tcp_hdr_offset;
 	int idx;
diff --git a/sys/netinet/tcp_lro.h b/sys/netinet/tcp_lro.h
index 75ab78c7fc6f..3eefd4f0537c 100644
--- a/sys/netinet/tcp_lro.h
+++ b/sys/netinet/tcp_lro.h
@@ -67,12 +67,14 @@ struct inpcb;
 union lro_address {
 	u_long raw[1];
 	struct {
-		uint16_t lro_type;	/* internal */
+		uint8_t lro_type;	/* internal */
 #define	LRO_TYPE_NONE     0
 #define	LRO_TYPE_IPV4_TCP 1
 #define	LRO_TYPE_IPV6_TCP 2
 #define	LRO_TYPE_IPV4_UDP 3
 #define	LRO_TYPE_IPV6_UDP 4
+		uint8_t lro_flags;
+#define	LRO_FLAG_DECRYPTED 1
 		uint16_t vlan_id;	/* VLAN identifier */
 		uint16_t s_port;	/* source TCP/UDP port */
 		uint16_t d_port;	/* destination TCP/UDP port */