From nobody Fri Jan 16 09:32:28 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dsvlK3r0Cz6P29n; Fri, 16 Jan 2026 09:32:29 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dsvlK39w4z3dQr; Fri, 16 Jan 2026 09:32:29 +0000 (UTC) (envelope-from brooks@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xAf/zfMsgenltoCzBRyNKL9CcppMTh26zoYHlujgDSQ=; b=g595u589N9vkrbrxPX3wqcQbpac40yp/QNwnKoc/PGSbKZwsbzbcw454Lbww/7MWwVgmO/ BnB4xlLxIiskcsaejikUyFbU/Lt48yyPHPsNiKoPgJNL+JcW74BDDEdYtP1SvzAZ7jd+KT KlY1bMu0kasGKHaMfZtv6fL/v5uK/Vz89BXslys9luh1MZQ8YHOCrjM808zbCi9qw1+jF5 QctDo2m1aNYdfvmhB2QwRZk9TbSHKvin3FqyLIM4ZqfTbBpuI43u4yc32La3UKkBrUvWfq 1Hu8cJbG37cnrMaNHcdED//PImte3FSaiX2wTeRDHP+Y3T80haMWQiLpVeiqWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768555949; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xAf/zfMsgenltoCzBRyNKL9CcppMTh26zoYHlujgDSQ=; b=DDe65sFV6iHiPp8XK/Yk+MpPpSQwlC458YhPBcS5hBW6+zNy5olx6SZTMO8FkP0iyKRz49 YJsjfkWOm2v8vaVz22pqCwavXFKJESh7xQZH/vBTuSwHYRYeBvv/0yyNYMpON29Y1zb3yZ +WI7NcMYEgLOsGEVmTLYyW2HY4NHlavS3ApdfuTfIQVHqr6GvJGqZS31IQJAS6BMS5Iw1r yjfgZP+Ya5aVJSOdtWDDhP+N7+6Mi3nPCbEmL/igXxnTlI3qWES/+cFB+IAxKg46MUv0jZ gDIv6f5gqZrAQRH9kMRJuFAhLrk5yPE6kiuBwjeeA++zPKkkvx8BymVEvRUAUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768555949; a=rsa-sha256; cv=none; b=RJAlHOyzi/uc5iaMQTg1t+NUVu27/J3M35k1A1Es9X1g6XlZ0Ar4WD6V8KMsFZAfnp5d3l 2us6+BMYe9c5YP8JYtrBTfxTza1xvlfCQjQH5/UFHLTybdveQYH9xIaqhj68biJ+6l+RcX 1jnW0GZuzOtx7PuPZdAMGJTog1j7SEWVTLUwSr6SkBjc5BnlvthWzAZoFZfxT7AO4y/zdG HZGggzzWvZH8pVfzcDmwpzd43A50O4/wjd5IRlVoCcoKUgaVcGcwCFXy7lCrzApc6seTDM r8GEBAHVf0CzToL0dJMw1viH32EG3Q8o7Dm4i4hB4FdjXBWGMvw0nWxQb3aLdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: brooks/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4dsvlK27TwzwZb; Fri, 16 Jan 2026 09:32:29 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 875963C01A0; Fri, 16 Jan 2026 09:32:28 +0000 (UTC) Date: Fri, 16 Jan 2026 09:32:28 +0000 From: Brooks Davis To: Kevin Bowling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 31e7dc6b9a00 - main - iflib: remove convoluted custom zeroing code Message-ID: References: <696113e6.f233.5c1a099f@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: [Finally catching up on email backlog...] I've gone ahead and merged to 14 and 15. 13 seems not to be getting regular MFC's to iflib and it didn't apply easily trivially so I've punted. This will cause a minor conflict when 43d7ee540efe is MFC'd as I've deleted some defines it touches, but I wanted to leave that for the experts. Thanks, Brooks On Fri, Jan 09, 2026 at 03:44:47PM -0700, Kevin Bowling wrote: > Can you mark for MFC? > > On Fri, Jan 9, 2026 at 7:42???AM Brooks Davis wrote: > > > > The branch main has been updated by brooks: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=31e7dc6b9a000b02353bfc41cbd897533287cda2 > > > > commit 31e7dc6b9a000b02353bfc41cbd897533287cda2 > > Author: Brooks Davis > > AuthorDate: 2026-01-09 14:19:49 +0000 > > Commit: Brooks Davis > > CommitDate: 2026-01-09 14:19:49 +0000 > > > > iflib: remove convoluted custom zeroing code > > > > Replace a collection of aliasing violations and ifdefs with memset > > (which now expands to __builtin_memset and should be quite reliably > > inlined.) The old code is hard to maintain as evidenced by the most > > recent change to if_pkt_info_t updating the defines, but not the zeroing > > code. > > > > Reviewed by: gallatin, erj > > Effort: CHERI upstreaming > > Sponsored by: Innovate UK > > Fixes: 43d7ee540efe ("iflib: support for transmit side nic KTLS offload") > > Differential Revision: https://reviews.freebsd.org/D54605 > > --- > > sys/net/iflib.c | 65 +++++---------------------------------------------------- > > 1 file changed, 5 insertions(+), 60 deletions(-) > > > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > > index fcd847ab6f7a..5c37f199e84c 100644 > > --- a/sys/net/iflib.c > > +++ b/sys/net/iflib.c > > @@ -504,61 +504,6 @@ typedef struct if_rxsd { > > iflib_fl_t ifsd_fl; > > } *if_rxsd_t; > > > > -/* multiple of word size */ > > -#ifdef __LP64__ > > -#define PKT_INFO_SIZE 7 > > -#define RXD_INFO_SIZE 5 > > -#define PKT_TYPE uint64_t > > -#else > > -#define PKT_INFO_SIZE 12 > > -#define RXD_INFO_SIZE 8 > > -#define PKT_TYPE uint32_t > > -#endif > > -#define PKT_LOOP_BOUND ((PKT_INFO_SIZE / 3) * 3) > > -#define RXD_LOOP_BOUND ((RXD_INFO_SIZE / 4) * 4) > > - > > -typedef struct if_pkt_info_pad { > > - PKT_TYPE pkt_val[PKT_INFO_SIZE]; > > -} *if_pkt_info_pad_t; > > -typedef struct if_rxd_info_pad { > > - PKT_TYPE rxd_val[RXD_INFO_SIZE]; > > -} *if_rxd_info_pad_t; > > - > > -CTASSERT(sizeof(struct if_pkt_info_pad) == sizeof(struct if_pkt_info)); > > -CTASSERT(sizeof(struct if_rxd_info_pad) == sizeof(struct if_rxd_info)); > > - > > -static inline void > > -pkt_info_zero(if_pkt_info_t pi) > > -{ > > - if_pkt_info_pad_t pi_pad; > > - > > - pi_pad = (if_pkt_info_pad_t)pi; > > - pi_pad->pkt_val[0] = 0; pi_pad->pkt_val[1] = 0; pi_pad->pkt_val[2] = 0; > > - pi_pad->pkt_val[3] = 0; pi_pad->pkt_val[4] = 0; pi_pad->pkt_val[5] = 0; > > -#ifndef __LP64__ > > - pi_pad->pkt_val[6] = 0; pi_pad->pkt_val[7] = 0; pi_pad->pkt_val[8] = 0; > > - pi_pad->pkt_val[9] = 0; pi_pad->pkt_val[10] = 0; > > -#endif > > -} > > - > > -static inline void > > -rxd_info_zero(if_rxd_info_t ri) > > -{ > > - if_rxd_info_pad_t ri_pad; > > - int i; > > - > > - ri_pad = (if_rxd_info_pad_t)ri; > > - for (i = 0; i < RXD_LOOP_BOUND; i += 4) { > > - ri_pad->rxd_val[i] = 0; > > - ri_pad->rxd_val[i + 1] = 0; > > - ri_pad->rxd_val[i + 2] = 0; > > - ri_pad->rxd_val[i + 3] = 0; > > - } > > -#ifdef __LP64__ > > - ri_pad->rxd_val[RXD_INFO_SIZE - 1] = 0; > > -#endif > > -} > > - > > /* > > * Only allow a single packet to take up most 1/nth of the tx ring > > */ > > @@ -1068,7 +1013,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) > > if (nm_i != head) { /* we have new packets to send */ > > uint32_t pkt_len = 0, seg_idx = 0; > > int nic_i_start = -1, flags = 0; > > - pkt_info_zero(&pi); > > + memset(&pi, 0, sizeof(pi)); > > pi.ipi_segs = txq->ift_segs; > > pi.ipi_qsidx = kring->ring_id; > > nic_i = netmap_idx_k2n(kring, nm_i); > > @@ -1261,7 +1206,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) > > nm_i = netmap_idx_n2k(kring, nic_i); > > MPASS(nm_i == kring->nr_hwtail); > > for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { > > - rxd_info_zero(&ri); > > + memset(&ri, 0, sizeof(ri)); > > ri.iri_frags = rxq->ifr_frags; > > ri.iri_qsidx = kring->ring_id; > > ri.iri_ifp = ctx->ifc_ifp; > > @@ -2998,7 +2943,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) > > /* > > * Reset client set fields to their default values > > */ > > - rxd_info_zero(&ri); > > + memset(&ri, 0, sizeof(ri)); > > ri.iri_qsidx = rxq->ifr_id; > > ri.iri_cidx = *cidxp; > > ri.iri_ifp = ifp; > > @@ -3580,7 +3525,7 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) > > } > > m_head = *m_headp; > > > > - pkt_info_zero(&pi); > > + memset(&pi, 0, sizeof(pi)); > > pi.ipi_mflags = (m_head->m_flags & (M_VLANTAG | M_BCAST | M_MCAST)); > > pi.ipi_pidx = pidx; > > pi.ipi_qsidx = txq->ift_id; > > @@ -4256,7 +4201,7 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) > > if (ctx->isc_txq_select_v2) { > > struct if_pkt_info pi; > > uint64_t early_pullups = 0; > > - pkt_info_zero(&pi); > > + memset(&pi, 0, sizeof(pi)); > > > > err = iflib_parse_header_partial(&pi, &m, &early_pullups); > > if (__predict_false(err != 0)) { > > >