git: f799833f4fce - releng/14.0 - gve: Make LRO work for jumbo packets

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 15 Sep 2023 08:49:02 UTC
The branch releng/14.0 has been updated by markj:

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

commit f799833f4fce5f7f1f472bdcce86c792f6d3c9f3
Author:     Shailend Chand <shailend@google.com>
AuthorDate: 2023-09-07 13:28:26 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-15 08:48:33 +0000

    gve: Make LRO work for jumbo packets
    
    Each Rx descriptor points to a packet buffer of size 2K, which means
    that MTUs greater than 2K see multi-descriptor packets. The TCP-hood of
    such packets was being incorrectly determined by looking for a flag on
    the last descriptor instead of the first descriptor.
    
    Also fixed and progressed the version number.
    
    Approved by:    re (gjb)
    Reviewed by:    markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D41754
    
    (cherry picked from commit 5f62584a9adb7887bae33af617cfa4f43017abf8)
    (cherry picked from commit 04ada3cc2b530a5c170ebefa8c28c5625009d37a)
---
 sys/dev/gve/gve.h      | 1 +
 sys/dev/gve/gve_main.c | 8 ++++----
 sys/dev/gve/gve_rx.c   | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/dev/gve/gve.h b/sys/dev/gve/gve.h
index 61781cddee94..c446199dff2d 100644
--- a/sys/dev/gve/gve.h
+++ b/sys/dev/gve/gve.h
@@ -164,6 +164,7 @@ struct gve_rx_ctx {
 	struct mbuf *mbuf_tail;
 	uint32_t total_size;
 	uint8_t frag_cnt;
+	bool is_tcp;
 	bool drop_pkt;
 };
 
diff --git a/sys/dev/gve/gve_main.c b/sys/dev/gve/gve_main.c
index c3ee6d5c3433..cd7849778bce 100644
--- a/sys/dev/gve/gve_main.c
+++ b/sys/dev/gve/gve_main.c
@@ -31,10 +31,10 @@
 #include "gve.h"
 #include "gve_adminq.h"
 
-#define GVE_DRIVER_VERSION "GVE-FBSD-1.0.0\n"
-#define GVE_VERSION_MAJOR 0
-#define GVE_VERSION_MINOR 9
-#define GVE_VERSION_SUB	0
+#define GVE_DRIVER_VERSION "GVE-FBSD-1.0.1\n"
+#define GVE_VERSION_MAJOR 1
+#define GVE_VERSION_MINOR 0
+#define GVE_VERSION_SUB 1
 
 #define GVE_DEFAULT_RX_COPYBREAK 256
 
diff --git a/sys/dev/gve/gve_rx.c b/sys/dev/gve/gve_rx.c
index f5d8fd7a7b75..9be96cf1ee3a 100644
--- a/sys/dev/gve/gve_rx.c
+++ b/sys/dev/gve/gve_rx.c
@@ -546,6 +546,7 @@ gve_rx(struct gve_priv *priv, struct gve_rx_ring *rx, struct gve_rx_desc *desc,
 
 	if (is_first_frag) {
 		mbuf->m_pkthdr.rcvif = priv->ifp;
+		ctx->is_tcp = desc->flags_seq & GVE_RXF_TCP;
 
 		if (gve_needs_rss(desc->flags_seq)) {
 			gve_set_rss_type(desc->flags_seq, mbuf);
@@ -567,7 +568,7 @@ gve_rx(struct gve_priv *priv, struct gve_rx_ring *rx, struct gve_rx_desc *desc,
 		do_if_input = true;
 
 		if (((if_getcapenable(priv->ifp) & IFCAP_LRO) != 0) &&      /* LRO is enabled */
-		    (desc->flags_seq & GVE_RXF_TCP) &&                      /* pkt is a TCP pkt */
+		    (ctx->is_tcp) &&                      		    /* pkt is a TCP pkt */
 		    ((mbuf->m_pkthdr.csum_flags & CSUM_DATA_VALID) != 0) && /* NIC verified csum */
 		    (rx->lro.lro_cnt != 0) &&                               /* LRO resources exist */
 		    (tcp_lro_rx(&rx->lro, mbuf, 0) == 0))