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 A9E56606A32D for ; Thu, 3 Dec 2026 18:31:25 +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=uHaahlHm Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89B30402E7; Thu, 3 Dec 2026 19:31:24 +0100 (CET) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTPS id 1D659402E5 for ; Thu, 3 Dec 2026 19:31:23 +0100 (CET) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-cdebab6fdb3so87749a12.2 for ; Thu, 03 Dec 2026 10:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796322681; x=1796927481; 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=5D0ZZEfRxswFND0jhCjtDZQbmniRRiQJuG97NEwEROI=; b=uHaahlHmRJObj9UeeGaW/sQ4qbwhiLmDd711ZTjkhB44juLkXFCyY1zgroYlomMrie ZMUo8LVdeHztWLnz62hdUXJtR0ylOZNKmYW5cb+LT2YRCZ/sOqL1tR4KDg8R7H7Iq3py Bg7GHgWKS6LhgkKxeeu3pUILQ6hu0VRqXLF+s5cQRt71RrD0L4QaaArQjzxJzoJtaO+A Y3X/vZZBQEird4gUO15YkiRriGQuRpEHEyAquH+0Ieh6piPVbPWZgZhi9hMHC3mIxQH6 HprGKi9WgvtD2nta9LIDYnNN2ISyUpMM2EqnRA7TFbtEqJkr7K+Wngeyh8xaq50lpGDx IOLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796322681; x=1796927481; 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=5D0ZZEfRxswFND0jhCjtDZQbmniRRiQJuG97NEwEROI=; b=SRHBO/ERV31XCoGkFm+1U760miyJDW1KZEEKr2QpNiWJcodIVWHqtrAXCi9mf0M4wO nkMzrJ7j+u+Ym2GxZ/U8fYewgPCwoi/Zr1dQCSvN+1MJuZ2gLKsCaLEc9n+ER+3vGmYv gdZhChvEfjcwMTgomqLbG5OkHxRbWYOSoPla7cJ3X7LDBqXma9KnL4QoLpjw7tsgHLFf PkvsPxlunYsDAsfQ3v/0wOnV6mE7j+lFDIcbD0JCEy1JEDSz3nxWwMUMxrH7HI+s8Bge zUsMtPNQ4A5NRWwtRfAqF9uZqWzKhXp85Gt6A7YcVk8x9e3a4mgXjnmqYZaHQeXkNAVC XS+Q== X-Gm-Message-State: APuU4Z+hfJSgjWBB5ncpq5uDIURSR7q5NDQ5r6Q/nWtgR59g5v/kRimZ J9EjGuaIiP9aeyQbUiefae3OTNTVI0YVXTxVOW9BdRw3sCOhn77tKceGeaoewbKwRx2aGlDYnVh c6BN9 X-Gm-Gg: AZFdTZeSK+YiVS4F1xA3+sKREp47URrWrZ9zvh+sfg9Nehhwg4eLO/9TofM+9x5Qbkp yS91XxPS/R9b1NCGRENu5VrpXwDjLWWsY0aDkKn1J6BnQ40WOcaiMlxiCy5q33EHp/5rzZ39y35 Gwv30rB9RGVhPJAkVFmKXnNgUlQYitDii8WNWr0gwu2k/0tPx04tnnfAScIfiTSqP2RkS13QhuN d9V+nBTlaUeOQjldZqUDiOf12hr7DcSYUHS0jQU45auxDMUzk/juKm14aoj1/8nuf8mrW6U7omR VqbKhSBAK00rVADKEupqLVmx8FUNGDO92cpuipngV++557/o0Dgc/YID8u/pMTGvrFh7hSQzDPO 5eYBF9E5RRMpSZQe7kBI0UVeSFS29nqGY3YKmqPZEo+ihknr8SZokpzLB0JujFHjk9NSCP0bv6M D/C1QAni1kUyw9psSiTLVnondZYEmx9pVqfO/c7OtE91s+US/3lWGyqWVMN0uyirDk1ykcoOBNZ 4iLFK6Y1ot/zv1nR4ditwpCUZcCwZICIDZCjGHP62DeuvEF5FkXrQbOuU3o2ugt5kKwsW1R06Gg iXJ3yM0FdE3JOQrbhAeqwhT6Atg8YIhxtv6nur+LltIrJzMRm7+ooQPtuBOIyzx68Wmt71Y= X-Received: by 2002:a17:90b:3f10:b0:3ac:af8b:6f3 with SMTP id 98e67ed59e1d1-3b41cb0caa7mr38212275a91.52.1796322681214; Thu, 03 Dec 2026 10:31:21 -0800 (PST) Received: from phoenix.local (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6d0818c1sm24445895a12.30.2026.12.03.10.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 10:31:21 -0800 (PST) Date: Thu, 3 Dec 2026 10:31:18 -0800 From: Stephen Hemminger To: Scott Mitchell Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com Subject: Re: [PATCH v9 0/8] net/af_packet fixes and Tx features Message-ID: <20261203103118.22c14304@phoenix.local> In-Reply-To: <20261203164211.48531-1-scott.k.mitch1@gmail.com> References: <20261202171804.50287-1-scott.k.mitch1@gmail.com> <20261203164211.48531-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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 Thu, 3 Dec 2026 08:42:03 -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. > > 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) AI re-review found some things still left. Review: [PATCH v9 0/8] net/af_packet fixes and Tx features Applied to main (27.03-rc0, ddb3b0c) with git am. Every commit builds with -Dwerror=true (net/af_packet + app/test). Tests not run (need root and a TAP device). Summary ------- The fixes are right: acquire/release on tp_status, the packet_lookup_frame() layout, and the 66 byte Rx offset all match the kernel. One real bug: the larger Rx overhead from 3/8 makes small frame sizes underflow, and 5/8 still accepts them and documents 64 as valid. One wrong Fixes tag. Patch 3/8: net/af_packet: fix maximum Rx packet length ------------------------------------------------------ Error: * ETH_AF_PACKET_RX_FRAME_OVERHEAD is 66, but probe accepts any framesz >= TPACKET2_HDRLEN (52). With framesz=64 or 80: max_rx_pktlen = 64 - 66 -> 0xfffffffe (size_t wrap) max_mtu = 0xfffffffe - 18 -> 65516 (uint16_t) so ethdev lets the application set MTU 65516 and the driver passes it to SIOCSIFMTU. eth_rx_queue_setup() computes the same wrapped data_size, so with scatter enabled the queue is accepted. Checked with the real macros: framesz=64 gives max_rx_pktlen 4294967294, max_mtu 65516. Before this patch the overhead was 32 and 64 did not wrap. Reject frames that cannot hold a minimum Ethernet frame on Rx, in this patch (5/8 can then fold it into its condition): if (framesize < ETH_AF_PACKET_RX_FRAME_OVERHEAD + RTE_ETHER_MIN_LEN) { PMD_LOG(ERR, "%s: framesz %u below minimum %zu", name, framesize, ETH_AF_PACKET_RX_FRAME_OVERHEAD + RTE_ETHER_MIN_LEN); return -1; } That makes the minimum 144 after 16 byte alignment. Fix the "at least 64B" in af_packet.rst (5/8) to match, and add framesz=64 to the bad[] table in test_af_packet_invalid_frame_config(). Warning: * Fixes tag is wrong. The original driver set max_rx_pktlen = ETH_FRAME_LEN; the frame-size based max_rx_pktlen/max_mtu came from 220a5c7b75 (v26.03), and the Rx queue setup check from b5a8868bde. Use: Fixes: b5a8868bde2f ("net/af_packet: guard against buffer overruns in Rx path") Fixes: 220a5c7b75c9 ("net/af_packet: support jumbo frames") Cc stable still applies for the Rx setup part, which is in 25.11. Patch 6/8: net/af_packet: clean up Tx and bulk free mbufs --------------------------------------------------------- Info: * The commit message does not mention the two tests it adds (tx_vlan_oversize, tx_mbuf_accounting). One line will do. * Pre-existing, but it matters more now that 8/8 makes a point of not writing the mbuf: rte_vlan_insert() modifies the application's mbuf, needs headroom, and fails with -EINVAL on clones and shared mbufs, which are then dropped. Every packet is already copied into the ring frame, so the tag can be inserted during the copy instead: copy 12 bytes of MACs, write TPID and TCI, copy the rest, add 4 to tp_len and the offsets used by the checksum code. Fine as a follow-up.