Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 2026 17:16:07 +0100 (CET)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        Michael Tuexen <tuexen@FreeBSD.org>
Cc:        dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 7266121ce985 - main - ure: improve transmit checksum offloading
Message-ID:  <1315337813.3441.1770653767432@localhost>
In-Reply-To: <6988ef21.3e6ef.54b19aac@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Thanks,

I noticed this last week and was still investigating when I saw this commit. TCP/IPv6 works fine now.

ure0 on uhub1
ure0: <Realtek USB 10/100/1G/2.5G LAN, class 0/0, rev 3.20/31.04, addr 1> on usbus1
ue0: <USB Ethernet> on ure0

This is plugged into a Raspberry Pi 5.

Thanks.

Ronald.

 
Van: Michael Tuexen <tuexen@FreeBSD.org>
Datum: zondag, 8 februari 2026 21:16
Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Onderwerp: git: 7266121ce985 - main - ure: improve transmit checksum offloading
> 
> The branch main has been updated by tuexen:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=7266121ce985a1a895441357c20b0e9d56b4e5f5
> 
> commit 7266121ce985a1a895441357c20b0e9d56b4e5f5
> Author:     Michael Tuexen <tuexen@FreeBSD.org>
> AuthorDate: 2026-02-08 20:11:18 +0000
> Commit:     Michael Tuexen <tuexen@FreeBSD.org>
> CommitDate: 2026-02-08 20:16:20 +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
>     MFC after:              1 week
>     Differential Revision:  https://reviews.freebsd.org/D55187
> ---
>  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 3dea88eb10f1..92160fe9b1d2 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/param.h>
>  #include <sys/systm.h>
>  #include <sys/bus.h>
> @@ -44,6 +46,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>
> @@ -62,8 +68,6 @@
>  
>  #include "miibus_if.h"
>  
> -#include "opt_inet6.h"
> -
>  #ifdef USB_DEBUG
>  static int ure_debug = 0;
>  
> @@ -2179,7 +2183,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;
> @@ -2214,10 +2217,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);
>  
> @@ -2230,7 +2232,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);
>  
>  
> 
> 
> 

 
[-- Attachment #2 --]
<html><head></head><body>Thanks,<br>
<br>
I noticed this last week and was still investigating when I saw this commit. TCP/IPv6 works fine now.<br>
<br>
ure0 on uhub1<br>
ure0: &lt;Realtek USB 10/100/1G/2.5G LAN, class 0/0, rev 3.20/31.04, addr 1&gt; on usbus1<br>
ue0: &lt;USB Ethernet&gt; on ure0<br>
<br>
This is plugged into a Raspberry Pi 5.<br>
<br>
Thanks.<br>
<br>
Ronald.<br>
<br>
&nbsp;
<p><strong>Van:</strong> Michael Tuexen &lt;tuexen@FreeBSD.org&gt;<br>
<strong>Datum:</strong> zondag, 8 februari 2026 21:16<br>
<strong>Aan:</strong> src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org<br>
<strong>Onderwerp:</strong> git: 7266121ce985 - main - ure: improve transmit checksum offloading</p>

<blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left: #000000 2px solid; margin-right: 0px">
<div class="MessageRFC822Viewer" id="P">
<div class="TextPlainViewer" id="P.P">The branch main has been updated by tuexen:<br>
<br>
URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=7266121ce985a1a895441357c20b0e9d56b4e5f5">https://cgit.FreeBSD.org/src/commit/?id=7266121ce985a1a895441357c20b0e9d56b4e5f5</a><br>;
<br>
commit 7266121ce985a1a895441357c20b0e9d56b4e5f5<br>
Author: &nbsp;&nbsp;&nbsp;&nbsp;Michael Tuexen &lt;tuexen@FreeBSD.org&gt;<br>
AuthorDate: 2026-02-08 20:11:18 +0000<br>
Commit: &nbsp;&nbsp;&nbsp;&nbsp;Michael Tuexen &lt;tuexen@FreeBSD.org&gt;<br>
CommitDate: 2026-02-08 20:16:20 +0000<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;ure: improve transmit checksum offloading<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Apparently, the name of the variable l4off was correct. Providing the<br>
&nbsp;&nbsp;&nbsp;&nbsp;offset to the TCP or UDP header allows the transmit checksum offload to<br>
&nbsp;&nbsp;&nbsp;&nbsp;work for TCP/IPv4, TCP/IPv6, UDP/IPv4, and UDP/IPv6.<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Reported by: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vishwin<br>
&nbsp;&nbsp;&nbsp;&nbsp;Reviewed by: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vishwin<br>
&nbsp;&nbsp;&nbsp;&nbsp;MFC after: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 week<br>
&nbsp;&nbsp;&nbsp;&nbsp;Differential Revision: &nbsp;<a href="https://reviews.freebsd.org/D55187">https://reviews.freebsd.org/D55187</a><br>;
---<br>
&nbsp;sys/dev/usb/net/if_ure.c | 16 ++++++++++------<br>
&nbsp;1 file changed, 10 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c<br>
index 3dea88eb10f1..92160fe9b1d2 100644<br>
--- a/sys/dev/usb/net/if_ure.c<br>
+++ b/sys/dev/usb/net/if_ure.c<br>
@@ -24,6 +24,8 @@<br>
&nbsp;&nbsp;* SUCH DAMAGE.<br>
&nbsp;&nbsp;*/<br>
&nbsp;<br>
+#include "opt_inet6.h"<br>
+<br>
&nbsp;#include &lt;sys/param.h&gt;<br>
&nbsp;#include &lt;sys/systm.h&gt;<br>
&nbsp;#include &lt;sys/bus.h&gt;<br>
@@ -44,6 +46,10 @@<br>
&nbsp;/* needed for checksum offload */<br>
&nbsp;#include &lt;netinet/in.h&gt;<br>
&nbsp;#include &lt;netinet/ip.h&gt;<br>
+#ifdef INET6<br>
+#include &lt;netinet/ip6.h&gt;<br>
+#include &lt;netinet6/ip6_var.h&gt;<br>
+#endif<br>
&nbsp;<br>
&nbsp;#include &lt;dev/mii/mii.h&gt;<br>
&nbsp;#include &lt;dev/mii/miivar.h&gt;<br>
@@ -62,8 +68,6 @@<br>
&nbsp;<br>
&nbsp;#include "miibus_if.h"<br>
&nbsp;<br>
-#include "opt_inet6.h"<br>
-<br>
&nbsp;#ifdef USB_DEBUG<br>
&nbsp;static int ure_debug = 0;<br>
&nbsp;<br>
@@ -2179,7 +2183,6 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;struct ip ip;<br>
&nbsp;&nbsp;&nbsp;&nbsp;struct ether_header *eh;<br>
&nbsp;&nbsp;&nbsp;&nbsp;int flags;<br>
- &nbsp;&nbsp;uint32_t data;<br>
&nbsp;&nbsp;&nbsp;&nbsp;uint32_t reg;<br>
&nbsp;&nbsp;&nbsp;&nbsp;int l3off, l4off;<br>
&nbsp;&nbsp;&nbsp;&nbsp;uint16_t type;<br>
@@ -2214,10 +2217,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (flags &amp; CSUM_IP)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg |= URE_TXPKT_IPV4_CS;<br>
&nbsp;<br>
- &nbsp;&nbsp;data = m-&gt;m_pkthdr.csum_data;<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (flags &amp; (CSUM_IP_TCP | CSUM_IP_UDP)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_copydata(m, l3off, sizeof ip, (caddr_t)&amp;ip);<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l4off = l3off + (ip.ip_hl &lt;&lt; 2) + data;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l4off = l3off + (ip.ip_hl &lt;&lt; 2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (__predict_false(l4off &gt; URE_L4_OFFSET_MAX))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (1);<br>
&nbsp;<br>
@@ -2230,7 +2232,9 @@ ure_txcsum(struct mbuf *m, int caps, uint32_t *regout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;#ifdef INET6<br>
&nbsp;&nbsp;&nbsp;&nbsp;else if (flags &amp; (CSUM_IP6_TCP | CSUM_IP6_UDP)) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l4off = l3off + data;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l4off = ip6_lasthdr(m, l3off, IPPROTO_IPV6, NULL);<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (__predict_false(l4off &lt; 0))<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (__predict_false(l4off &gt; URE_L4_OFFSET_MAX))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (1);<br>
&nbsp;<br>
&nbsp;</div>

<hr></div>
</blockquote>
<br>
&nbsp;</body></html>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1315337813.3441.1770653767432>