From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>,
"Andrew Rybchenko" <andrew.rybchenko@oktetlabs.ru>,
"Akhil Goyal" <gakhil@marvell.com>,
"Fan Zhang" <fanzhang.oss@gmail.com>
Subject: Re: [PATCH v12 01/10] mbuf: replace term sanity check
Date: Mon, 11 Aug 2025 08:20:08 -0700 [thread overview]
Message-ID: <20250811082008.62686282@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FE20@smartserver.smartshare.dk>
On Mon, 11 Aug 2025 11:55:31 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Thursday, 3 April 2025 01.23
> >
> > Replace rte_mbuf_sanity_check() with rte_mbuf_verify()
> > to match the similar macro RTE_VERIFY() in rte_debug.h
> >
> > The term sanity check is on the Tier 2 list of words
> > that should be replaced.
> >
> > For this release keep old API functions but mark them
> > as deprecated.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > ---
> > app/test/test_cryptodev.c | 2 +-
> > app/test/test_mbuf.c | 28 +++++-----
> > doc/guides/prog_guide/mbuf_lib.rst | 4 +-
> > doc/guides/rel_notes/deprecation.rst | 3 ++
> > lib/mbuf/rte_mbuf.c | 23 +++++---
> > lib/mbuf/rte_mbuf.h | 79 +++++++++++++++-------------
> > lib/mbuf/version.map | 1 +
> > 7 files changed, 79 insertions(+), 61 deletions(-)
> >
> > diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
> > index 31a4905a97..d5f3843daf 100644
> > --- a/app/test/test_cryptodev.c
> > +++ b/app/test/test_cryptodev.c
> > @@ -264,7 +264,7 @@ create_mbuf_from_heap(int pkt_len, uint8_t pattern)
> > m->port = RTE_MBUF_PORT_INVALID;
> > m->buf_len = MBUF_SIZE - sizeof(struct rte_mbuf) - RTE_PKTMBUF_HEADROOM;
> > rte_pktmbuf_reset_headroom(m);
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > m->buf_addr = (char *)m + sizeof(struct rte_mbuf) +
> > RTE_PKTMBUF_HEADROOM;
> >
> > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> > index 17be977f31..3fbb5dea8b 100644
> > --- a/app/test/test_mbuf.c
> > +++ b/app/test/test_mbuf.c
> > @@ -262,8 +262,8 @@ test_one_pktmbuf(struct rte_mempool *pktmbuf_pool)
> > GOTO_FAIL("Buffer should be continuous");
> > memset(hdr, 0x55, MBUF_TEST_HDR2_LEN);
> >
> > - rte_mbuf_sanity_check(m, 1);
> > - rte_mbuf_sanity_check(m, 0);
> > + rte_mbuf_verify(m, 1);
> > + rte_mbuf_verify(m, 0);
> > rte_pktmbuf_dump(stdout, m, 0);
> >
> > /* this prepend should fail */
> > @@ -1162,7 +1162,7 @@ test_refcnt_mbuf(void)
> >
> > #ifdef RTE_EXEC_ENV_WINDOWS
> > static int
> > -test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
> > +test_failing_mbuf_verify(struct rte_mempool *pktmbuf_pool)
> > {
> > RTE_SET_USED(pktmbuf_pool);
> > return TEST_SKIPPED;
> > @@ -1181,12 +1181,12 @@ mbuf_check_pass(struct rte_mbuf *buf)
> > }
> >
> > static int
> > -test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
> > +test_failing_mbuf_verify(struct rte_mempool *pktmbuf_pool)
> > {
> > struct rte_mbuf *buf;
> > struct rte_mbuf badbuf;
> >
> > - printf("Checking rte_mbuf_sanity_check for failure conditions\n");
> > + printf("Checking rte_mbuf_verify for failure conditions\n");
> >
> > /* get a good mbuf to use to make copies */
> > buf = rte_pktmbuf_alloc(pktmbuf_pool);
> > @@ -1708,7 +1708,7 @@ test_mbuf_validate_tx_offload(const char *test_name,
> > GOTO_FAIL("%s: mbuf allocation failed!\n", __func__);
> > if (rte_pktmbuf_pkt_len(m) != 0)
> > GOTO_FAIL("%s: Bad packet length\n", __func__);
> > - rte_mbuf_sanity_check(m, 0);
> > + rte_mbuf_verify(m, 0);
> > m->ol_flags = ol_flags;
> > m->tso_segsz = segsize;
> > ret = rte_validate_tx_offload(m);
> > @@ -1915,7 +1915,7 @@ test_pktmbuf_read(struct rte_mempool *pktmbuf_pool)
> > GOTO_FAIL("%s: mbuf allocation failed!\n", __func__);
> > if (rte_pktmbuf_pkt_len(m) != 0)
> > GOTO_FAIL("%s: Bad packet length\n", __func__);
> > - rte_mbuf_sanity_check(m, 0);
> > + rte_mbuf_verify(m, 0);
> >
> > data = rte_pktmbuf_append(m, MBUF_TEST_DATA_LEN2);
> > if (data == NULL)
> > @@ -1964,7 +1964,7 @@ test_pktmbuf_read_from_offset(struct rte_mempool
> > *pktmbuf_pool)
> >
> > if (rte_pktmbuf_pkt_len(m) != 0)
> > GOTO_FAIL("%s: Bad packet length\n", __func__);
> > - rte_mbuf_sanity_check(m, 0);
> > + rte_mbuf_verify(m, 0);
> >
> > /* prepend an ethernet header */
> > hdr = (struct ether_hdr *)rte_pktmbuf_prepend(m, hdr_len);
> > @@ -2109,7 +2109,7 @@ create_packet(struct rte_mempool *pktmbuf_pool,
> > GOTO_FAIL("%s: mbuf allocation failed!\n", __func__);
> > if (rte_pktmbuf_pkt_len(pkt_seg) != 0)
> > GOTO_FAIL("%s: Bad packet length\n", __func__);
> > - rte_mbuf_sanity_check(pkt_seg, 0);
> > + rte_mbuf_verify(pkt_seg, 0);
> > /* Add header only for the first segment */
> > if (test_data->flags == MBUF_HEADER && seg == 0) {
> > hdr_len = sizeof(struct rte_ether_hdr);
> > @@ -2321,7 +2321,7 @@ test_pktmbuf_ext_shinfo_init_helper(struct rte_mempool
> > *pktmbuf_pool)
> > GOTO_FAIL("%s: mbuf allocation failed!\n", __func__);
> > if (rte_pktmbuf_pkt_len(m) != 0)
> > GOTO_FAIL("%s: Bad packet length\n", __func__);
> > - rte_mbuf_sanity_check(m, 0);
> > + rte_mbuf_verify(m, 0);
> >
> > ext_buf_addr = rte_malloc("External buffer", buf_len,
> > RTE_CACHE_LINE_SIZE);
> > @@ -2482,8 +2482,8 @@ test_pktmbuf_ext_pinned_buffer(struct rte_mempool
> > *std_pool)
> > GOTO_FAIL("%s: test_pktmbuf_copy(pinned) failed\n",
> > __func__);
> >
> > - if (test_failing_mbuf_sanity_check(pinned_pool) < 0)
> > - GOTO_FAIL("%s: test_failing_mbuf_sanity_check(pinned)"
> > + if (test_failing_mbuf_verify(pinned_pool) < 0)
> > + GOTO_FAIL("%s: test_failing_mbuf_verify(pinned)"
> > " failed\n", __func__);
> >
> > if (test_mbuf_linearize_check(pinned_pool) < 0)
> > @@ -2857,8 +2857,8 @@ test_mbuf(void)
> > goto err;
> > }
> >
> > - if (test_failing_mbuf_sanity_check(pktmbuf_pool) < 0) {
> > - printf("test_failing_mbuf_sanity_check() failed\n");
> > + if (test_failing_mbuf_verify(pktmbuf_pool) < 0) {
> > + printf("test_failing_mbuf_verify() failed\n");
> > goto err;
> > }
> >
> > diff --git a/doc/guides/prog_guide/mbuf_lib.rst
> > b/doc/guides/prog_guide/mbuf_lib.rst
> > index 4ad2a21f3f..6c96931f8c 100644
> > --- a/doc/guides/prog_guide/mbuf_lib.rst
> > +++ b/doc/guides/prog_guide/mbuf_lib.rst
> > @@ -266,8 +266,8 @@ can be found in several of the sample applications, for
> > example, the IPv4 Multic
> > Debug
> > -----
> >
> > -In debug mode, the functions of the mbuf library perform sanity checks before
> > any operation (such as, buffer corruption,
> > -bad type, and so on).
> > +In debug mode, the functions of the mbuf library perform consistency checks
> > +before any operation (such as, buffer corruption, bad type, and so on).
> >
> > Use Cases
> > ---------
> > diff --git a/doc/guides/rel_notes/deprecation.rst
> > b/doc/guides/rel_notes/deprecation.rst
> > index 36489f6e68..10bb08a634 100644
> > --- a/doc/guides/rel_notes/deprecation.rst
> > +++ b/doc/guides/rel_notes/deprecation.rst
> > @@ -142,3 +142,6 @@ Deprecation Notices
> > * bus/vmbus: Starting DPDK 25.11, all the vmbus API defined in
> > ``drivers/bus/vmbus/rte_bus_vmbus.h`` will become internal to DPDK.
> > Those API functions are used internally by DPDK core and netvsc PMD.
> > +
> > +* mbuf: The function ``rte_mbuf_sanity_check`` is deprecated.
> > + Use the new function ``rte_mbuf_verify`` instead.
> > diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
> > index 559d5ad8a7..fc5d4ba29d 100644
> > --- a/lib/mbuf/rte_mbuf.c
> > +++ b/lib/mbuf/rte_mbuf.c
> > @@ -367,9 +367,9 @@ rte_pktmbuf_pool_create_extbuf(const char *name, unsigned
> > int n,
> > return mp;
> > }
> >
> > -/* do some sanity checks on a mbuf: panic if it fails */
> > +/* do some checks on a mbuf: panic if it fails */
> > void
> > -rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
> > +rte_mbuf_verify(const struct rte_mbuf *m, int is_header)
> > {
> > const char *reason;
> >
> > @@ -377,6 +377,13 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int
> > is_header)
> > rte_panic("%s\n", reason);
> > }
> >
> > +/* For ABI compatibility, to be removed in next release */
> > +void
> > +rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
> > +{
> > + rte_mbuf_verify(m, is_header);
> > +}
> > +
> > int rte_mbuf_check(const struct rte_mbuf *m, int is_header,
> > const char **reason)
> > {
> > @@ -496,7 +503,7 @@ void rte_pktmbuf_free_bulk(struct rte_mbuf **mbufs,
> > unsigned int count)
> > if (unlikely(m == NULL))
> > continue;
> >
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > do {
> > m_next = m->next;
> > @@ -546,7 +553,7 @@ rte_pktmbuf_clone(struct rte_mbuf *md, struct rte_mempool
> > *mp)
> > return NULL;
> > }
> >
> > - __rte_mbuf_sanity_check(mc, 1);
> > + __rte_mbuf_verify(mc, 1);
> > return mc;
> > }
> >
> > @@ -596,7 +603,7 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct
> > rte_mempool *mp,
> > struct rte_mbuf *mc, *m_last, **prev;
> >
> > /* garbage in check */
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > /* check for request to copy at offset past end of mbuf */
> > if (unlikely(off >= m->pkt_len))
> > @@ -660,7 +667,7 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct
> > rte_mempool *mp,
> > }
> >
> > /* garbage out check */
> > - __rte_mbuf_sanity_check(mc, 1);
> > + __rte_mbuf_verify(mc, 1);
> > return mc;
> > }
> >
> > @@ -671,7 +678,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m,
> > unsigned dump_len)
> > unsigned int len;
> > unsigned int nb_segs;
> >
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > fprintf(f, "dump mbuf at %p, iova=%#" PRIx64 ", buf_len=%u\n", m,
> > rte_mbuf_iova_get(m),
> > m->buf_len);
> > @@ -689,7 +696,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m,
> > unsigned dump_len)
> > nb_segs = m->nb_segs;
> >
> > while (m && nb_segs != 0) {
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(m, 0);
> >
> > fprintf(f, " segment at %p, data=%p, len=%u, off=%u,
> > refcnt=%u\n",
> > m, rte_pktmbuf_mtod(m, void *),
> > diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
> > index 06ab7502a5..53a837e4d5 100644
> > --- a/lib/mbuf/rte_mbuf.h
> > +++ b/lib/mbuf/rte_mbuf.h
> > @@ -339,16 +339,20 @@ rte_pktmbuf_priv_flags(struct rte_mempool *mp)
> >
> > #ifdef RTE_LIBRTE_MBUF_DEBUG
> >
> > -/** check mbuf type in debug mode */
> > -#define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)
> > +/** do mbuf type in debug mode */
> > +#define __rte_mbuf_verify(m, is_h) rte_mbuf_verify(m, is_h)
> >
> > #else /* RTE_LIBRTE_MBUF_DEBUG */
> >
> > -/** check mbuf type in debug mode */
> > -#define __rte_mbuf_sanity_check(m, is_h) do { } while (0)
> > +/** ignore mbuf checks if not in debug mode */
> > +#define __rte_mbuf_verify(m, is_h) do { } while (0)
> >
> > #endif /* RTE_LIBRTE_MBUF_DEBUG */
> >
> > +/* deprecated version of the macro */
> > +#define __rte_mbuf_sanity_check(m, is_h)
> > RTE_DEPRECATED(__rte_mbuf_sanity_check) \
> > + __rte_mbuf_verify(m, is_h)
> > +
> > #ifdef RTE_MBUF_REFCNT_ATOMIC
> >
> > /**
> > @@ -514,10 +518,9 @@ rte_mbuf_ext_refcnt_update(struct
> > rte_mbuf_ext_shared_info *shinfo,
> >
> >
> > /**
> > - * Sanity checks on an mbuf.
> > + * Check that the mbuf is valid and panic if corrupted.
> > *
> > - * Check the consistency of the given mbuf. The function will cause a
> > - * panic if corruption is detected.
> > + * Acts assertion that mbuf is consistent. If not it calls rte_panic().
> > *
> > * @param m
> > * The mbuf to be checked.
> > @@ -526,13 +529,17 @@ rte_mbuf_ext_refcnt_update(struct
> > rte_mbuf_ext_shared_info *shinfo,
> > * of a packet (in this case, some fields like nb_segs are not checked)
> > */
> > void
> > +rte_mbuf_verify(const struct rte_mbuf *m, int is_header);
> > +
> > +__rte_deprecated
> > +void
> > rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);
> >
> > /**
> > - * Sanity checks on a mbuf.
> > + * Do consistency checks on a mbuf.
> > *
> > - * Almost like rte_mbuf_sanity_check(), but this function gives the reason
> > - * if corruption is detected rather than panic.
> > + * Check the consistency of the given mbuf and if not valid
> > + * return the reason.
> > *
> > * @param m
> > * The mbuf to be checked.
> > @@ -551,7 +558,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int
> > is_header,
> > const char **reason);
> >
> > /**
> > - * Sanity checks on a reinitialized mbuf in debug mode.
> > + * Do checks on a reinitialized mbuf in debug mode.
> > *
> > * Check the consistency of the given reinitialized mbuf.
> > * The function will cause a panic if corruption is detected.
> > @@ -563,7 +570,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int
> > is_header,
> > * The mbuf to be checked.
> > */
> > static __rte_always_inline void
> > -__rte_mbuf_raw_sanity_check(__rte_unused const struct rte_mbuf *m)
> > +__rte_mbuf_raw_verify(__rte_unused const struct rte_mbuf *m)
> > {
> > RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1);
> > RTE_ASSERT(m->next == NULL);
> > @@ -572,11 +579,11 @@ __rte_mbuf_raw_sanity_check(__rte_unused const struct
> > rte_mbuf *m)
> > RTE_ASSERT(!RTE_MBUF_HAS_EXTBUF(m) ||
> > (RTE_MBUF_HAS_PINNED_EXTBUF(m) &&
> > rte_mbuf_ext_refcnt_read(m->shinfo) == 1));
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(m, 0);
> > }
> >
> > /** For backwards compatibility. */
> > -#define MBUF_RAW_ALLOC_CHECK(m) __rte_mbuf_raw_sanity_check(m)
> > +#define MBUF_RAW_ALLOC_CHECK(m) __rte_mbuf_raw_verify(m)
> >
> > /**
> > * Allocate an uninitialized mbuf from mempool *mp*.
> > @@ -606,7 +613,7 @@ static inline struct rte_mbuf *rte_mbuf_raw_alloc(struct
> > rte_mempool *mp)
> >
> > if (rte_mempool_get(mp, &ret.ptr) < 0)
> > return NULL;
> > - __rte_mbuf_raw_sanity_check(ret.m);
> > + __rte_mbuf_raw_verify(ret.m);
> > return ret.m;
> > }
> >
> > @@ -644,7 +651,7 @@ rte_mbuf_raw_alloc_bulk(struct rte_mempool *mp, struct
> > rte_mbuf **mbufs, unsigne
> > int rc = rte_mempool_get_bulk(mp, (void **)mbufs, count);
> > if (likely(rc == 0))
> > for (unsigned int idx = 0; idx < count; idx++)
> > - __rte_mbuf_raw_sanity_check(mbufs[idx]);
> > + __rte_mbuf_raw_verify(mbufs[idx]);
> > return rc;
> > }
> >
> > @@ -665,7 +672,7 @@ rte_mbuf_raw_alloc_bulk(struct rte_mempool *mp, struct
> > rte_mbuf **mbufs, unsigne
> > static __rte_always_inline void
> > rte_mbuf_raw_free(struct rte_mbuf *m)
> > {
> > - __rte_mbuf_raw_sanity_check(m);
> > + __rte_mbuf_raw_verify(m);
> > rte_mempool_put(m->pool, m);
> > }
> >
> > @@ -700,7 +707,7 @@ rte_mbuf_raw_free_bulk(struct rte_mempool *mp, struct
> > rte_mbuf **mbufs, unsigned
> > const struct rte_mbuf *m = mbufs[idx];
> > RTE_ASSERT(m != NULL);
> > RTE_ASSERT(m->pool == mp);
> > - __rte_mbuf_raw_sanity_check(m);
> > + __rte_mbuf_raw_verify(m);
> > }
> >
> > rte_mempool_put_bulk(mp, (void **)mbufs, count);
> > @@ -965,7 +972,7 @@ static inline void rte_pktmbuf_reset(struct rte_mbuf *m)
> > rte_pktmbuf_reset_headroom(m);
> >
> > m->data_len = 0;
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> > }
> >
> > /**
> > @@ -1021,22 +1028,22 @@ static inline int rte_pktmbuf_alloc_bulk(struct
> > rte_mempool *pool,
> > switch (count % 4) {
> > case 0:
> > while (idx != count) {
> > - __rte_mbuf_raw_sanity_check(mbufs[idx]);
> > + __rte_mbuf_raw_verify(mbufs[idx]);
> > rte_pktmbuf_reset(mbufs[idx]);
> > idx++;
> > /* fall-through */
> > case 3:
> > - __rte_mbuf_raw_sanity_check(mbufs[idx]);
> > + __rte_mbuf_raw_verify(mbufs[idx]);
> > rte_pktmbuf_reset(mbufs[idx]);
> > idx++;
> > /* fall-through */
> > case 2:
> > - __rte_mbuf_raw_sanity_check(mbufs[idx]);
> > + __rte_mbuf_raw_verify(mbufs[idx]);
> > rte_pktmbuf_reset(mbufs[idx]);
> > idx++;
> > /* fall-through */
> > case 1:
> > - __rte_mbuf_raw_sanity_check(mbufs[idx]);
> > + __rte_mbuf_raw_verify(mbufs[idx]);
> > rte_pktmbuf_reset(mbufs[idx]);
> > idx++;
> > /* fall-through */
> > @@ -1267,8 +1274,8 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf
> > *mi, struct rte_mbuf *m)
> > mi->pkt_len = mi->data_len;
> > mi->nb_segs = 1;
> >
> > - __rte_mbuf_sanity_check(mi, 1);
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(mi, 1);
> > + __rte_mbuf_verify(m, 0);
> > }
> >
> > /**
> > @@ -1423,7 +1430,7 @@ static inline int
> > __rte_pktmbuf_pinned_extbuf_decref(struct rte_mbuf *m)
> > static __rte_always_inline struct rte_mbuf *
> > rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
> > {
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(m, 0);
> >
> > if (likely(rte_mbuf_refcnt_read(m) == 1)) {
> >
> > @@ -1494,7 +1501,7 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m)
> > struct rte_mbuf *m_next;
> >
> > if (m != NULL)
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > while (m != NULL) {
> > m_next = m->next;
> > @@ -1575,7 +1582,7 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct
> > rte_mempool *mp,
> > */
> > static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v)
> > {
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > do {
> > rte_mbuf_refcnt_update(m, v);
> > @@ -1592,7 +1599,7 @@ static inline void rte_pktmbuf_refcnt_update(struct
> > rte_mbuf *m, int16_t v)
> > */
> > static inline uint16_t rte_pktmbuf_headroom(const struct rte_mbuf *m)
> > {
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(m, 0);
> > return m->data_off;
> > }
> >
> > @@ -1606,7 +1613,7 @@ static inline uint16_t rte_pktmbuf_headroom(const struct
> > rte_mbuf *m)
> > */
> > static inline uint16_t rte_pktmbuf_tailroom(const struct rte_mbuf *m)
> > {
> > - __rte_mbuf_sanity_check(m, 0);
> > + __rte_mbuf_verify(m, 0);
> > return (uint16_t)(m->buf_len - rte_pktmbuf_headroom(m) -
> > m->data_len);
> > }
> > @@ -1621,7 +1628,7 @@ static inline uint16_t rte_pktmbuf_tailroom(const struct
> > rte_mbuf *m)
> > */
> > static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)
> > {
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> > while (m->next != NULL)
> > m = m->next;
> > return m;
> > @@ -1665,7 +1672,7 @@ static inline struct rte_mbuf
> > *rte_pktmbuf_lastseg(struct rte_mbuf *m)
> > static inline char *rte_pktmbuf_prepend(struct rte_mbuf *m,
> > uint16_t len)
> > {
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > if (unlikely(len > rte_pktmbuf_headroom(m)))
> > return NULL;
> > @@ -1700,7 +1707,7 @@ static inline char *rte_pktmbuf_append(struct rte_mbuf
> > *m, uint16_t len)
> > void *tail;
> > struct rte_mbuf *m_last;
> >
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > m_last = rte_pktmbuf_lastseg(m);
> > if (unlikely(len > rte_pktmbuf_tailroom(m_last)))
> > @@ -1728,7 +1735,7 @@ static inline char *rte_pktmbuf_append(struct rte_mbuf
> > *m, uint16_t len)
> > */
> > static inline char *rte_pktmbuf_adj(struct rte_mbuf *m, uint16_t len)
> > {
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > if (unlikely(len > m->data_len))
> > return NULL;
> > @@ -1760,7 +1767,7 @@ static inline int rte_pktmbuf_trim(struct rte_mbuf *m,
> > uint16_t len)
> > {
> > struct rte_mbuf *m_last;
> >
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> >
> > m_last = rte_pktmbuf_lastseg(m);
> > if (unlikely(len > m_last->data_len))
> > @@ -1782,7 +1789,7 @@ static inline int rte_pktmbuf_trim(struct rte_mbuf *m,
> > uint16_t len)
> > */
> > static inline int rte_pktmbuf_is_contiguous(const struct rte_mbuf *m)
> > {
> > - __rte_mbuf_sanity_check(m, 1);
> > + __rte_mbuf_verify(m, 1);
> > return m->nb_segs == 1;
> > }
> >
> > diff --git a/lib/mbuf/version.map b/lib/mbuf/version.map
> > index 76f1832924..2950f24caa 100644
> > --- a/lib/mbuf/version.map
> > +++ b/lib/mbuf/version.map
> > @@ -31,6 +31,7 @@ DPDK_25 {
> > rte_mbuf_set_platform_mempool_ops;
> > rte_mbuf_set_user_mempool_ops;
> > rte_mbuf_user_mempool_ops;
> > + rte_mbuf_verify;
> > rte_pktmbuf_clone;
> > rte_pktmbuf_copy;
> > rte_pktmbuf_dump;
> > --
> > 2.47.2
>
> Stephen,
>
> I have submitted another patch [1], where __rte_mbuf_raw_sanity_check()'s successor takes one more parameter, so I had to give it a new name __rte_mbuf_raw_sanity_check_mp() for API compatibility. And then I added:
> +/** For backwards compatibility. */
> +#define __rte_mbuf_raw_sanity_check(m) __rte_mbuf_raw_sanity_check_mp(m, NULL)
>
> If you proceed with your patch, __rte_mbuf_raw_sanity_check() will be renamed to __rte_mbuf_raw_verify(), and __rte_mbuf_raw_sanity_check() disappears.
> Would it make sense to change your patch, so __rte_mbuf_raw_verify() replaces __rte_mbuf_raw_sanity_check_mp() instead of __rte_mbuf_raw_sanity_check()? If your patch changes the API anyway, adding an extra parameter to the function should be acceptable.
>
> [1]: https://patchwork.dpdk.org/project/dpdk/patch/20250722093431.555214-1-mb@smartsharesystems.com/
Sure will go back and rebase old patches in a few weeks.
next prev parent reply other threads:[~2025-08-11 15:20 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 23:33 [PATCH v10 00/20] Remove use of noninclusive term sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 01/20] mbuf: replace term sanity check Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 02/20] eal: replace use of sanity check in comments and messages Stephen Hemminger
2024-06-06 5:38 ` Morten Brørup
2024-05-29 23:33 ` [PATCH v10 03/20] test: replace use word sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 04/20] examples: remove term sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 05/20] lib: replace use of sanity check in comments and messages Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 06/20] doc/eventdev_pipeline: remove sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 07/20] net/ring: replace use of sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 08/20] net/fm10k, net/ixgbe: remove word sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 09/20] net/mlx[45]: " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 10/20] net/sfc: remove term "sanity check" Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 11/20] net/ark: replace use of term sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 12/20] net/bnxt: " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 13/20] net/bnx2x: remove reference to sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 14/20] net/nfp: replace use of term sanity Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 15/20] net/txgbe: replace " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 16/20] net/cxgbe: remove use of " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 17/20] cnxk: replace " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 18/20] event/opdl: remove " Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 19/20] crypto/bcmfs: replace term sanity check Stephen Hemminger
2024-05-29 23:33 ` [PATCH v10 20/20] drivers: remove use of " Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 0/7] Remove usage of wording " Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 1/7] mbuf: replace term " Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 2/7] eal: replace use of sanity check in comments and messages Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 3/7] test: replace use word sanity Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 4/7] examples: remove term sanity Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 5/7] lib: replace use of sanity check in comments and messages Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 6/7] doc: remove sanity Stephen Hemminger
2024-08-01 15:46 ` [PATCH v11 7/7] drivers: remove use of term sanity check Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 00/10] replace " Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 01/10] mbuf: replace " Stephen Hemminger
2025-08-11 9:55 ` Morten Brørup
2025-08-11 15:20 ` Stephen Hemminger [this message]
2025-04-02 23:23 ` [PATCH v12 02/10] net/avp: replace use of rte_mbuf_sanity_check Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 03/10] net/sfc: " Stephen Hemminger
2025-04-04 7:37 ` Andrew Rybchenko
2025-04-02 23:23 ` [PATCH v12 04/10] examples: remove term sanity Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 05/10] eal: replace use of sanity check in comments and messages Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 06/10] test: replace use word sanity Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 07/10] dts: replace use of sanity check in comment Stephen Hemminger
2025-04-03 1:21 ` Patrick Robb
2025-04-03 9:44 ` Luca Vizzarro
2025-04-02 23:23 ` [PATCH v12 08/10] doc: remove sanity Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 09/10] lib: replace use of sanity check in comments and Stephen Hemminger
2025-04-02 23:23 ` [PATCH v12 10/10] drivers: remove use of term sanity check Stephen Hemminger
2025-04-04 7:39 ` Andrew Rybchenko
2025-04-03 18:59 ` [PATCH v12 00/10] replace " Patrick Robb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811082008.62686282@hermes.local \
--to=stephen@networkplumber.org \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=gakhil@marvell.com \
--cc=mb@smartsharesystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).