git: 32067a7f49a3 - stable/14 - ure: improve transmit checksum offloading
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 26 Apr 2026 08:29:51 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=32067a7f49a37a5b1507794df95799ceecc26ad9
commit 32067a7f49a37a5b1507794df95799ceecc26ad9
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2026-02-08 20:11:18 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2026-04-26 06:28:16 +0000
ure: improve transmit checksum offloading
Apparently, the name of the variable l4off was correct. Providing the
offset to the TCP or UDP header allows the transmit checksum offload to
work for TCP/IPv4, TCP/IPv6, UDP/IPv4, and UDP/IPv6.
Reported by: vishwin
Reviewed by: vishwin
Differential Revision: https://reviews.freebsd.org/D55187
Event: Wiesbaden Hackathon 2026
(cherry picked from commit 7266121ce985a1a895441357c20b0e9d56b4e5f5)
---
sys/dev/usb/net/if_ure.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index e6b101587421..3f399a6650a6 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
+#include "opt_inet6.h"
+
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
@@ -45,6 +47,10 @@
/* needed for checksum offload */
#include <netinet/in.h>
#include <netinet/ip.h>
+#ifdef INET6
+#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
+#endif
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@@ -63,8 +69,6 @@
#include "miibus_if.h"
-#include "opt_inet6.h"
-
#ifdef USB_DEBUG
static int ure_debug = 0;
@@ -2175,7 +2179,6 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
struct ip ip;
struct ether_header *eh;
int flags;
- uint32_t data;
uint32_t reg;
int l3off, l4off;
uint16_t type;
@@ -2210,10 +2213,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
if (flags & CSUM_IP)
reg |= URE_TXPKT_IPV4_CS;
- data = m->m_pkthdr.csum_data;
if (flags & (CSUM_IP_TCP | CSUM_IP_UDP)) {
m_copydata(m, l3off, sizeof ip, (caddr_t)&ip);
- l4off = l3off + (ip.ip_hl << 2) + data;
+ l4off = l3off + (ip.ip_hl << 2);
if (__predict_false(l4off > URE_L4_OFFSET_MAX))
return (1);
@@ -2226,7 +2228,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)
}
#ifdef INET6
else if (flags & (CSUM_IP6_TCP | CSUM_IP6_UDP)) {
- l4off = l3off + data;
+ l4off = ip6_lasthdr(m, l3off, IPPROTO_IPV6, NULL);
+ if (__predict_false(l4off < 0))
+ return (1);
if (__predict_false(l4off > URE_L4_OFFSET_MAX))
return (1);