Re: [net-next v7 07/10] net: bnxt: Implement software USO
From: Joe Damato
Date: Thu Apr 02 2026 - 12:48:23 EST
On Wed, Apr 01, 2026 at 05:35:14PM -0700, Eric Dumazet wrote:
> On Wed, Apr 1, 2026 at 4:38 PM Joe Damato <joe@xxxxxxx> wrote:
> >
[...]
> > + /* Zero the csum fields so tso_build_hdr will propagate zeroes into
> > + * every segment header. HW csum offload will recompute from scratch.
> > + */
>
> We might need a call to skb_cow_head(skb, 0) before changing ->check
> (or anything in skb->head)
>
> Alternative would be to perform the clears after each tso_build_hdr()
> and leave skb->head untouched.
Thanks for the careful review; I appreciate your time and energy.
I'll remove the existing clears you pointed and perform the clear after each
tso_build_hdr() as you suggested with something like:
@@ -103,6 +96,7 @@ netdev_tx_t bnxt_sw_udp_gso_xmit(struct bnxt *bp,
unsigned int offset;
dma_addr_t dma_addr;
struct tx_bd *txbd;
+ struct udphdr *uh;
void *this_hdr;
int bd_count;
__le32 csum;
@@ -116,6 +110,17 @@ netdev_tx_t bnxt_sw_udp_gso_xmit(struct bnxt *bp,
tso_build_hdr(skb, this_hdr, &tso, seg_payload, last);
+ /* Zero stale csum fields copied from the original skb;
+ * HW offload recomputes from scratch.
+ */
+ uh = this_hdr + skb_transport_offset(skb);
+ uh->check = 0;
+ if (!tso.ipv6) {
+ struct iphdr *iph = this_hdr + skb_network_offset(skb);
+
+ iph->check = 0;
+ }