From nobody Mon Mar 06 17:52:50 2023 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 4PVmPt6xlsz3wBHg; Mon, 6 Mar 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PVmPt6QKxz46yf; Mon, 6 Mar 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678125170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=63VbjKxUyKs8cebX0xALe8pp77T3/ASCkbS+CFFN7lw=; b=WwC7iaFfPBTun2GkRMlMERQ8WcoZlA6y0wnIA7H/UGlLj/S8wP0cQfMj8L/vTcP4+2YLtV LvLIuFAdf82tSZtrLCMlWSGBAfRPhrvASbnUovOmYq9YaO1AMFKU7c9DunByufElIa341M /uqVpj9fq26BdKvKWRBrrWhCccJgKlp068ejhJVnarPahaZs0zNtqfLkfD12UPKNzjZYCX XO7sUp0FBo4ac5nmRvO1esJS+4s0I2xu4X9cRlg+PJeJT7wSRrTilghZHFcdE+qsOHwTwY dr0wFenGdbmKHeY9FT3OGX/7iIigrBqYQiQvE8a/VBMYnttWfzMoUwqSVMlmXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678125170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=63VbjKxUyKs8cebX0xALe8pp77T3/ASCkbS+CFFN7lw=; b=Nv4lps1LQ+JX03a3b7cctf4d0maYbLmTRR0S94CBgUCTDrVwtR0vrfQj905YXEidxKtKbv 2bSJAKBWSRlnV2pPxAphhG7ZylMQn0cmmZ8w6QuhS7WfV8ggwkPZkq7cYXonD0yvN3ec4/ 8+F390pLxU+Zw67pj47BnMv4Fd5X0a8ZBOksRg8kBfLuD1t+Tklo8GuWJO8sUFAdSoQUAJ JMgrtuLtrA20KTWpjoqvRIVlMLS9YY/Zlzt7IlLiDRikuQv5DMS0YHHOf5fqeZ2g2wm+uo Zaxs9B5m3lWAfIJ5CLe8JVoFccmVsVQeNS0EbaJR7p7Sr8/141YsLLt2PYpsDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678125170; a=rsa-sha256; cv=none; b=hNC+EzXihzXTL2Ngp22AfAK/K9Tsz+RV7xmLRBkKQ7c3posnJSYq6HyFgVlFEadc4Y9Tjc qfWRbP33ikUlm4aBrdwSh+/AzXYdzxMibv7DhXMn54RpwbUTnp2+aZ+z5PRW+2Pi9sNdkG VgQuxA23AHPpQ/4G4rt8+1hEZ1ZIlFxsosvE1D/aHMQZIAoDc/j6YUyPSJLVIbaZn7MiO9 vzXPe4c8pJ9GK4SS3u0CPhcRr4x/VQKeLhTQGGeodlzQySGQ8FFJViAqiVI9pdOqsnSsTF E3M/xZt18PBmDhrTvVLEfYq2olLt+E6oR51kcAHVFc1ps3SgJvlxukBaRWEV0A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PVmPt5SsMz1BCm; Mon, 6 Mar 2023 17:52:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 326HqoTD053185; Mon, 6 Mar 2023 17:52:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 326Hqoq4053184; Mon, 6 Mar 2023 17:52:50 GMT (envelope-from git) Date: Mon, 6 Mar 2023 17:52:50 GMT Message-Id: <202303061752.326Hqoq4053184@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 48227d1c6db8 - main - epair: Avoid loading m_flags into a short 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48227d1c6db8fceaceebbf8578612302d64ca170 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=48227d1c6db8fceaceebbf8578612302d64ca170 commit 48227d1c6db8fceaceebbf8578612302d64ca170 Author: Mark Johnston AuthorDate: 2023-03-06 14:39:17 +0000 Commit: Mark Johnston CommitDate: 2023-03-06 17:39:11 +0000 epair: Avoid loading m_flags into a short The m_flags field of struct mbuf is 24 bits wide and so gets truncated in a couple of places in the epair code. Instead of preserving the entire flag set, just remember whether M_BCAST or M_MCAST is set. MFC after: 1 week Sponsored by: Klara, Inc. --- sys/net/if_epair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 81538c0cb157..3fa4c47a0bca 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -239,7 +239,7 @@ epair_menq(struct mbuf *m, struct epair_softc *osc) struct ifnet *ifp, *oifp; int len, ret; int ridx; - short mflags; + bool mcast; /* * I know this looks weird. We pass the "other sc" as we need that one @@ -252,7 +252,7 @@ epair_menq(struct mbuf *m, struct epair_softc *osc) /* Save values as once the mbuf is queued, it's not ours anymore. */ len = m->m_pkthdr.len; - mflags = m->m_flags; + mcast = (m->m_flags & (M_BCAST | M_MCAST)) != 0; struct epair_queue *q = epair_select_queue(osc, m); @@ -273,7 +273,7 @@ epair_menq(struct mbuf *m, struct epair_softc *osc) * the logic another time. */ if_inc_counter(ifp, IFCOUNTER_OBYTES, len); - if (mflags & (M_BCAST|M_MCAST)) + if (mcast) if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); /* Someone else received the packet. */ if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1); @@ -325,7 +325,7 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m) struct ifnet *oifp; #ifdef ALTQ int len; - short mflags; + bool mcast; #endif if (m == NULL) @@ -366,7 +366,7 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m) #ifdef ALTQ len = m->m_pkthdr.len; - mflags = m->m_flags; + mcast = (m->m_flags & (M_BCAST | M_MCAST)) != 0; int error = 0; /* Support ALTQ via the classic if_start() path. */ @@ -378,7 +378,7 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m) IF_UNLOCK(&ifp->if_snd); if (!error) { if_inc_counter(ifp, IFCOUNTER_OBYTES, len); - if (mflags & (M_BCAST|M_MCAST)) + if (mcast) if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); epair_start(ifp); }