Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Nov 2021 17:54:32 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: dd31400c3c2a - main - Factor out flags preserved during mbuf demote into a separate define.
Message-ID:  <202111041754.1A4HsW5c050145@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=dd31400c3c2aa941d057e78296c193959a6d9ed3

commit dd31400c3c2aa941d057e78296c193959a6d9ed3
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-11-04 17:48:23 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2021-11-04 17:53:49 +0000

    Factor out flags preserved during mbuf demote into a separate define.
    
    This define will later on be used by coming TLS RX hardware offload patches.
    
    No functional change intended.
    
    Reviewed by:    jhb@
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
---
 sys/kern/uipc_mbuf.c | 5 +++--
 sys/sys/mbuf.h       | 6 ++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index e0793a16d76f..0196023bc601 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -278,13 +278,14 @@ m_demote(struct mbuf *m0, int all, int flags)
 {
 	struct mbuf *m;
 
+	flags |= M_DEMOTEFLAGS;
+
 	for (m = all ? m0 : m0->m_next; m != NULL; m = m->m_next) {
 		KASSERT(m->m_nextpkt == NULL, ("%s: m_nextpkt in m %p, m0 %p",
 		    __func__, m, m0));
 		if (m->m_flags & M_PKTHDR)
 			m_demote_pkthdr(m);
-		m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE |
-		    M_EXTPG | flags);
+		m->m_flags &= flags;
 	}
 }
 
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index d0f90805fa78..07a75bd5b47b 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -496,6 +496,12 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff)
     (M_PKTHDR|M_EOR|M_RDONLY|M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_TSTMP| \
      M_TSTMP_HPREC|M_TSTMP_LRO|M_PROTOFLAGS)
 
+/*
+ * Flags preserved during demote.
+ */
+#define	M_DEMOTEFLAGS \
+    (M_EXT | M_RDONLY | M_NOFREE | M_EXTPG)
+
 /*
  * Mbuf flag description for use with printf(9) %b identifier.
  */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111041754.1A4HsW5c050145>