From nobody Fri Jan 9 22:44:47 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 4dnxg53hfMz6MTky for ; Fri, 09 Jan 2026 22:45:05 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dnxg51ZSLz3gLY for ; Fri, 09 Jan 2026 22:45:05 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-4f1ab2ea5c1so64252071cf.3 for ; Fri, 09 Jan 2026 14:45:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; t=1767998699; x=1768603499; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TbZhPpHO00e2VZDYixAeikV0NAacnXJpHyVSfX8IzOo=; b=lywxXFAugV0QS6XPHh4YT/z56RYmzT2obZqMo8KOEtB7oTUrRwGw0b5lLUK3Y1p+6K 9NgOVkgFvyZl2NaMmeqGeBuqN9kga1Dwrue1t9N0hkKlhHH36Q1/MkxFQqWuAXN1g2OI 2D5Sb5etaBiPt5uQXdOZrELvAuo4tzPZOMqGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767998699; x=1768603499; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TbZhPpHO00e2VZDYixAeikV0NAacnXJpHyVSfX8IzOo=; b=SDN5Wizdgwe11+ON9VvMlPKQmWSrmcN+DvbL8izn0JVdn2kemhSBR+DvhrhQ8lXGjv XQpyVt5PWe4SsXHR2zjCwi/E0USxSPBie9h9A81Wh7ddHolzhvMcRrKTnxXv0yTkGRxl uxrbjBHM0RlSt36sTwD7cw8sG4pMKGJGlCNKHy+N3izBB70b2r68N9PRCUwJC+cZAUKr /SdNAl9bBncPshMKzB2y4QHgQhncF+iyFFEyxHQcTTyVjF+XJ1/QrdecLzAortHWnVSY eCtUlpB1qkITPDqXj5NVSWxVvGVSyGleGdwVGomI83lfDj/eTEmNgLO8bvRIosAzCBA9 KkVA== X-Forwarded-Encrypted: i=1; AJvYcCX7QVRxcjKLgi3rSulSU2tboCclfRJp3acpz8eKsugak6TZlQdLKDVXhR6Gsx5qJBksrQHIo6ncBln1973qqLMyN8/9RA==@freebsd.org X-Gm-Message-State: AOJu0YzPkCcwfSQjSVORhngHLAGLG/u4moYBA6EtUXHFH+tZUXsfBvH/ ximkJ7FkDL8xzvOVJIL7NdXB0V421ytVhpFAIUXlquUW75zg57cMi8pkuXeqGxaq6KkItXZ0qW2 yiK93l9qbL2khgA7Hq8a6Lk9D9m3D5Mk6UMKOruOA X-Gm-Gg: AY/fxX5oft3Ed/Ng5eftINC8QGUHlNfUd4HQMnAQi09tetD7EiwFzJATIudx1FEkZ73 SsxVlVu2vJIYoq2caHYBPsMtpI0zuNhWIz6gBh+rQdxq3OAZMRlgASS+CDcmfiWf3cpf1RiHMqb AjwQuzwCdjC9qTb9rtGuffLLj26gUNP77yyswJZuO66+oPJPgyFSwLgqHwVcb4N+eSoIo74d/vU 09KwWP6cj9EqC0JSFAnQa5DanZcZUsuqtunq43TeH/JqCTG7CUHS6+RbFxITd7IO7U8knjM3DIU lGsCh/F5CIXTvUtB31LFksTbWAcdddE7Zj6nHak3oQfH1hepiKHm7WOVmkcSZlIr5t01 X-Google-Smtp-Source: AGHT+IHXVTLUnNcG4VqRswAfFgmBgZyNwC6z/IsG70WDv+2w6VscxjGcm5TS0XRe07XQKEHOLSojqSNeV6zroagqj3g= X-Received: by 2002:a05:622a:554:b0:4ee:4a3a:bd1c with SMTP id d75a77b69052e-4ffb4a364a4mr140195021cf.63.1767998699488; Fri, 09 Jan 2026 14:44:59 -0800 (PST) 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 References: <696113e6.f233.5c1a099f@gitrepo.freebsd.org> In-Reply-To: <696113e6.f233.5c1a099f@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 9 Jan 2026 15:44:47 -0700 X-Gm-Features: AQt7F2pSMZVS6Ez8QPoi-Z7fUJKJ6F5xmlI-E3lPnRacQ7AfreNPJcdahu7mEyY Message-ID: Subject: Re: git: 31e7dc6b9a00 - main - iflib: remove convoluted custom zeroing code To: Brooks Davis Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dnxg51ZSLz3gLY Can you mark for MFC? On Fri, Jan 9, 2026 at 7:42=E2=80=AFAM Brooks Davis wr= ote: > > The branch main has been updated by brooks: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D31e7dc6b9a000b02353bfc41cb= d897533287cda2 > > 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 zero= ing > code. > > Reviewed by: gallatin, erj > Effort: CHERI upstreaming > Sponsored by: Innovate UK > Fixes: 43d7ee540efe ("iflib: support for transmit side nic K= TLS 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) =3D=3D sizeof(struct if_pkt_info= )); > -CTASSERT(sizeof(struct if_rxd_info_pad) =3D=3D 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 =3D (if_pkt_info_pad_t)pi; > - pi_pad->pkt_val[0] =3D 0; pi_pad->pkt_val[1] =3D 0; pi_pad->pkt_v= al[2] =3D 0; > - pi_pad->pkt_val[3] =3D 0; pi_pad->pkt_val[4] =3D 0; pi_pad->pkt_v= al[5] =3D 0; > -#ifndef __LP64__ > - pi_pad->pkt_val[6] =3D 0; pi_pad->pkt_val[7] =3D 0; pi_pad->pkt_v= al[8] =3D 0; > - pi_pad->pkt_val[9] =3D 0; pi_pad->pkt_val[10] =3D 0; > -#endif > -} > - > -static inline void > -rxd_info_zero(if_rxd_info_t ri) > -{ > - if_rxd_info_pad_t ri_pad; > - int i; > - > - ri_pad =3D (if_rxd_info_pad_t)ri; > - for (i =3D 0; i < RXD_LOOP_BOUND; i +=3D 4) { > - ri_pad->rxd_val[i] =3D 0; > - ri_pad->rxd_val[i + 1] =3D 0; > - ri_pad->rxd_val[i + 2] =3D 0; > - ri_pad->rxd_val[i + 3] =3D 0; > - } > -#ifdef __LP64__ > - ri_pad->rxd_val[RXD_INFO_SIZE - 1] =3D 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 !=3D head) { /* we have new packets to send */ > uint32_t pkt_len =3D 0, seg_idx =3D 0; > int nic_i_start =3D -1, flags =3D 0; > - pkt_info_zero(&pi); > + memset(&pi, 0, sizeof(pi)); > pi.ipi_segs =3D txq->ift_segs; > pi.ipi_qsidx =3D kring->ring_id; > nic_i =3D netmap_idx_k2n(kring, nm_i); > @@ -1261,7 +1206,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int= flags) > nm_i =3D netmap_idx_n2k(kring, nic_i); > MPASS(nm_i =3D=3D kring->nr_hwtail); > for (n =3D 0; avail > 0 && nm_i !=3D hwtail_lim; n++, ava= il--) { > - rxd_info_zero(&ri); > + memset(&ri, 0, sizeof(ri)); > ri.iri_frags =3D rxq->ifr_frags; > ri.iri_qsidx =3D kring->ring_id; > ri.iri_ifp =3D 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 =3D rxq->ifr_id; > ri.iri_cidx =3D *cidxp; > ri.iri_ifp =3D ifp; > @@ -3580,7 +3525,7 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) > } > m_head =3D *m_headp; > > - pkt_info_zero(&pi); > + memset(&pi, 0, sizeof(pi)); > pi.ipi_mflags =3D (m_head->m_flags & (M_VLANTAG | M_BCAST | M_MCA= ST)); > pi.ipi_pidx =3D pidx; > pi.ipi_qsidx =3D 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 =3D 0; > - pkt_info_zero(&pi); > + memset(&pi, 0, sizeof(pi)); > > err =3D iflib_parse_header_partial(&pi, &m, &early_pullup= s); > if (__predict_false(err !=3D 0)) { >