From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FF8E606A32C for ; Fri, 4 Dec 2026 19:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=Vcg0i8IP Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C493F40DD1; Fri, 4 Dec 2026 20:28:19 +0100 (CET) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by mails.dpdk.org (Postfix) with ESMTPS id EA90840A6D for ; Fri, 4 Dec 2026 20:28:18 +0100 (CET) Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-cc4be0e5351so703175a12.0 for ; Fri, 04 Dec 2026 11:28:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796412497; x=1797017297; darn=dpdk.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=E/UYxCWta7fpX+lj0zAMx7Ah/2UGMEq1HXMb1sa+B7U=; b=Vcg0i8IPdufHl9U4HxSjq1qf/x41oStI5Ik6TukUVa0ezycTAZhhiqUIJFFd/kHPCo nh8JrLY6k52on2R/6MTqFFtYIgcCGPyteemwwYxtiqGwZwwRkYYnoFSm39CdbQ+go+Yj CM/mOd5hDjb8xUtvSHKLXUGeX5E7IwcgcwgXpcFh/wVKj1Q0t1QTtA7ExE8wJu3Eb38i YB4w8102qtSxvGqqm6jKP0OTyXX8lcZsjZu8K/4J6O9rAYVPQKPsk8w9T0pguGawyi7V 4JGctp4EyBpg7wXaeoT0mlUJO1wsCYDkVpkSM887j8GhBeEniUAzg0JmTDaiMEWIyeG3 XRcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796412497; x=1797017297; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=E/UYxCWta7fpX+lj0zAMx7Ah/2UGMEq1HXMb1sa+B7U=; b=yJ70GB4xmvUYxGMSM3R8jweEMGSWul6QGzIoxWRtUef8fJ2CJP75gt/qEIE7KVZnXr Isd45GXP36nGSsfS6S/Vzsx1bhrQvU6i6bh+KiRemW8qT7HsV/MsTQTYHu+ljeQ8d9dz +9RZ33X9jSPdclUQiCupHzijqdGHCbcoGQj3PdFpEiygEPwjDY5OXPPFjgKOguaHh601 zHDObJxwT1/x+eyd4WHGMk4FbNfc2gNGZLGep5B/RJjSvpXjvgDid8SkW66zb/qwqdmV i46ZL0KqyMtlYik1g30qBUIxNA+VeD8DnpeAEPpxilHaRZdOXBYIc5Ywb89xePK1uhuz Hogw== X-Gm-Message-State: AB4q+uHJwPpe8RKO+wTaa0b+y6gQFbevXTE/zoJSTcSJxy3m3sV+eyJd xX+CAZdDvpbCoGV7mOG84ZXPQOUrftipVLq+nszNf/WiA6S+8jYZUCA/ZKq6LHXRvqg= X-Gm-Gg: AZFdTZfSfvtLqtm711Ts4RSggl7Yx4gLPgQNSTGw51J2/jdMwgwnsw938JeubYqgnkO mjemdCGOe4YhxoVFaa6IxgChHk1eMWpINnkmHk3t+ChXCIOjsp5pLtuTVrHgVwItLr4ogHlCZzF fSgUHQb9nldMgjMsQqjWjS37GYwJT/ED8+DMQhAtTHtrhpWUw9bWmXsVpUzJLs7lyqz0nVLxzR9 roPioR63oschyGtazjK6PALLrS1R4mS4dTCJoRUH3v9wVxc1IB7tpDjfFtIYbCvu+stAFMYS40L 1ZJitaaf8IbbE41ZzvcWVyPUTwXrWcQSu7MbZdRD5wUyOig2PdxQF+814SnfJgx+/ePaX0PqlmP 3GSJ1N+KzO//HhwNsl3Vv0QPlPkXRm1IlEHquq8m4pauNtzVYKFI3qNoqqulYZBeMIHqxKnuIcP U3cobRAdZFzambsYVytSI0BPuiCZ0m2I/V/ZeFhckZhqjJtUOQHh2OHivH0sftbFDdTE/60n8Ye w8+5hCg2bcZZ+3a19Fa5N5pF2LIg/gfoOcXn5yqL3SQR8bNWYgNQR55IU1McyqLa9h8KJrQbQZP dFWnRvrrZmWjG8x1Z1i2cveKSz6keqHwZLmsCRNh/dydIp2rtG44PkgouASsyboTpM/XLBibDaG F2D8BmZcQfG/SWUo= X-Received: by 2002:a17:90b:5688:b0:3b5:b5f3:52fa with SMTP id 98e67ed59e1d1-3b5e061c059mr2698675a91.10.1796412497047; Fri, 04 Dec 2026 11:28:17 -0800 (PST) Received: from phoenix.local (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d486efsm10825601a91.9.2026.12.04.11.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 11:28:16 -0800 (PST) Date: Fri, 4 Dec 2026 11:28:13 -0800 From: Stephen Hemminger To: Scott Mitchell Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com Subject: Re: [PATCH v10 0/8] net/af_packet fixes and Tx features Message-ID: <20261204112813.295ff6c0@phoenix.local> In-Reply-To: <20261204160128.17277-1-scott.k.mitch1@gmail.com> References: <20261203164211.48531-1-scott.k.mitch1@gmail.com> <20261204160128.17277-1-scott.k.mitch1@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Fri, 4 Dec 2026 08:01:20 -0800 Scott Mitchell wrote: > Fixes for af_packet ring handling, then Tx features: non-blocking Tx > and software checksum offload. > > Patches 1-3 are fixes for stable, and 4 tests them. 5-8 are not for > stable. > > v10: > * Frame size must hold a minimum Ethernet frame after the 66 byte Rx > offset (minimum 144), so the maximum Rx length can't wrap; documented > and tested with framesz=64. (Stephen) > * Fixes tags of "fix maximum Rx packet length" corrected. (Stephen) > * "clean up Tx and bulk free mbufs" commit message mentions its tests. > (Stephen) > > v9: > * tp_status helpers cast to (uint32_t __rte_atomic *). (Stephen) > * The invalid ring parameter error prints blocksz, framesz and framecnt > instead of describing the constraints; af_packet.rst documents them, > including the 2GB blocksz limit. (Stephen) > > v8: > * Split as suggested: the memory ordering and frame address fixes are > separate stable patches; the test, ring parameter validation and Tx > cleanup are their own patches. Dropped unrelated changes from the > fixes (counter types, loop form). > * tp_status uses rte_atomic_load/store_explicit with acquire/release > instead of fences, as libpcap and memif do. (Stephen) > * New fix: the maximum Rx packet length and MTU used the Tx frame > offset, so packets up to 34 bytes over the real limit were silently > truncated. > * Invalid ring parameters are rejected at probe, matching what > packet_set_ring() rejects, instead of logged as warnings; the hint > warnings are gone, so configurations the kernel accepts still work. > (Stephen) > * The Tx kick runs on every burst, so a full ring drains on later > bursts once the kernel can send again. The ring full test now checks > this. (Stephen) > * Removed poll() from Tx instead of adding the txpollnotrdy devarg. A > full ring returns a short count, so Tx no longer blocks. (Stephen) > * Checksums are computed in the ring frame after the copy, so the > checksum code does not modify the mbuf. Dropped > rte_net_ip_udptcp_cksum_mbuf() and the tap conversion, and with them > the dependency on "test/cksum: fix EtherType of IPv6 TCP packet". > (Stephen, Morten) IPv6 extension headers are supported; packets with > tunnel offload flags are dropped. > * Tests use ring geometry derived from the page size. > > Scott Mitchell (8): > net/af_packet: fix frame status memory ordering > net/af_packet: fix frame address with unused block tail > net/af_packet: fix maximum Rx packet length > test/af_packet: add frame layout tests > net/af_packet: reject invalid ring parameters at probe > net/af_packet: clean up Tx and bulk free mbufs > net/af_packet: do not block in Tx when the ring is full > net/af_packet: add Tx checksum offload > > app/test/test_pmd_af_packet.c | 1029 +++++++++++++++++++++ > doc/guides/nics/af_packet.rst | 8 +- > doc/guides/nics/features/af_packet.ini | 2 + > doc/guides/rel_notes/release_27_03.rst | 4 + > drivers/net/af_packet/rte_eth_af_packet.c | 245 +++-- > 5 files changed, 1212 insertions(+), 76 deletions(-) > There are still some warnings from AI review. I don't agree with all AI's proposed changes will leave it up to your judgment about best way to address these. Review: [PATCH v10 0/8] net/af_packet fixes and tx features Applied to main (ddb3b0c, 27.03-rc0). All 8 commits build with -Dwerror=true. Tests not run. Series ------ Everything raised on v7 is addressed: - tp_status uses load-acquire/store-release, same as libpcap - the two fixes are separate small patches, tests split out - ring parameters are rejected at probe, warnings gone - sendto() kick is unconditional again; test brings the link back and checks the ring drains - txpollnotrdy devarg dropped, tx just returns short on a full ring - checksums computed in the ring frame; no lib/net API, no tap change, mbuf not touched No errors found. Two warnings: truncated Rx frames (3/8) and the missing fix tags on 7/8. Patch 3/8 --------- The offset is right. For SOCK_RAW with a 14 byte MAC header tpacket_rcv() gives netoff = TPACKET_ALIGN(TPACKET2_HDRLEN + 16) = 80 macoff = netoff - 14 = 66 and for longer MAC headers macoff only gets smaller, so 66 is the worst case. Warning: truncated frames are still delivered as good packets The patch fixes what the driver advertises, but the kernel will still hand over anything larger than the slot with tp_snaplen < tp_len: a GRO aggregate on the underlying interface, or a peer with a larger MTU. Rx takes pkt_len from tp_snaplen and passes the cut-off packet up. Since this patch is about exactly that truncation, drop them here (or in a follow-up with the same Fixes/stable tags): if (unlikely(ppd->tp_snaplen < ppd->tp_len)) { pkt_q->rx_dropped_pkts++; goto release_frame; } placed before the mbuf allocation. Info: stable impact. max_mtu drops by 34 for a given framesz, so a port that was created with framesz 1552..1583 and relied on MTU 1500 now gets a smaller default MTU from rte_eth_dev_configure(), and an explicit mtu=1500 is refused. That is the correct outcome (those ports were truncating full-size frames) but it is a visible change in an LTS update and deserves a line in the commit message. Patch 5/8 --------- The dropped "!blockcount" test is unreachable now: zero blocksz, framesz and framecnt are rejected when the devargs are parsed, and framecnt is a non-zero multiple of frames_per_block. No divide by zero for the same reason. Info: one geometry case still gets through. The mmap length and the tx map offset are computed in 32 bits: mmap(NULL, 2 * req->tp_block_size * req->tp_block_nr, ... tx_queue->map = rx_queue->map + req->tp_block_size * req->tp_block_nr; The kernel limits the frame count, not the byte size, so blocksz * blockcount >= 2 GB is accepted by setsockopt() and then wraps here. Pre-existing, but this is the patch that says probe rejects bad ring parameters: (uint64_t)blocksize * (framecount / frames_per_block) > UINT_MAX / 2 added to the same condition closes it. Patch 7/8 --------- Warning: this is a bug fix but is not tagged as one A tx_burst that sleeps in poll() with no timeout is a bug, and the commit message describes it as one. It needs a Fixes: tag for the commit that added the poll() and Cc: stable@dpdk.org. As ordered it will not backport cleanly, because it sits on top of the 6/8 cleanup. Move it ahead of 6/8, next to the other fixes, so the stable patch is just the removal of the poll() block. Patch 8/8 --------- Checked af_packet_tx_cksum() against the lib/net helpers: every read is bounded by pkt_len before it happens (l4_off + header, then l4_end from the IP length), IPv4 IHL must equal l3_len, UDP zero checksum is handled by rte_ipv4_udptcp_cksum(), and the IPv6 extension header case builds the pseudo-header from the real L4 length and protocol. rte_vlan_insert() bumps l2_len, so the offsets are still right after a tag is inserted. Nothing to change. Info: the driver acts on mbuf checksum flags whether or not the application enabled the offloads in txmode. That is harmless (flags without the offload are an application bug) and saves the per-queue flag v7 had. Fine as is.