From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 25C2F6895 for ; Mon, 19 May 2014 15:56:40 +0200 (CEST) Received: by mail-wi0-f172.google.com with SMTP id hi2so4183345wib.5 for ; Mon, 19 May 2014 06:56:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1I1EZwtYw8tmZezfmO7tiRSxLYUZqjG+BQv1GvJtjaE=; b=EUYae/YCCTzh8yuln8Nz5KyoPYV3gMxfCxV501pWQ+mttpPdOP4iNfY3q0TdyhcaC2 /gTW40798mi+7W+VcaboJx5oIWsxlI0sAzXGTqqe9wXakvMWRh3umJWjiE7PZiruqFMF w+HdifNevYKRuZZoh6l/c7w1qx1T3bm7Y0xB3xDLtUrmXWT+0wCQ3enjSF6CSlFh9K2l L0gJRlF1lWPEc/XtYMGyOAoODoSqz+sFfdMwZwWFbbPjYmU5ByU63TPVJxvMNUvmJJzM g3OwqffDadYHsFLlW6DVB+rlc3B7790w/CQtH8ARxLt9F5tkIQSm2HZqNh8oyWVRKahd Wr2g== X-Gm-Message-State: ALoCoQkMSebsXSUefoSnt+JTdrx7fjrmh3dZf0pK8e9KelRtUQJ6rZ5lubhgEqn21WWfbb7PYL2l X-Received: by 10.180.91.114 with SMTP id cd18mr13294424wib.28.1400507809001; Mon, 19 May 2014 06:56:49 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id t18sm15201828wiv.16.2014.05.19.06.56.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 May 2014 06:56:48 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Mon, 19 May 2014 15:56:14 +0200 Message-Id: <1400507789-18453-3-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com> References: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v2 02/17] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2014 13:56:40 -0000 It seems that RTE_MBUF_SCATTER_GATHER is not the proper name for the feature it provides. "Scatter gather" means that data is stored using several buffers. RTE_MBUF_REFCNT seems to be a better name for that feature as it provides a reference counter for mbufs. The macro RTE_MBUF_SCATTER_GATHER is poisoned to ensure this modification is seen by drivers or applications using it. Signed-off-by: Olivier Matz --- app/test/test_mbuf.c | 16 +++++++------- config/defconfig_i686-default-linuxapp-gcc | 2 +- config/defconfig_i686-default-linuxapp-icc | 2 +- config/defconfig_x86_64-default-bsdapp-gcc | 2 +- config/defconfig_x86_64-default-linuxapp-gcc | 2 +- config/defconfig_x86_64-default-linuxapp-icc | 2 +- doc/doxy-api.conf | 2 +- examples/ipv4_frag/Makefile | 4 ++-- examples/ipv4_multicast/Makefile | 4 ++-- lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 31 +++++++++++++++------------- 11 files changed, 36 insertions(+), 33 deletions(-) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 6ee350d..bfcac05 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -82,7 +82,7 @@ static struct rte_mempool *pktmbuf_pool = NULL; static struct rte_mempool *ctrlmbuf_pool = NULL; -#if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC +#if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC static struct rte_mempool *refcnt_pool = NULL; static struct rte_ring *refcnt_mbuf_ring = NULL; @@ -365,7 +365,7 @@ fail: static int testclone_testupdate_testdetach(void) { -#ifndef RTE_MBUF_SCATTER_GATHER +#ifndef RTE_MBUF_REFCNT return 0; #else struct rte_mbuf *mc = NULL; @@ -406,7 +406,7 @@ fail: if (mc) rte_pktmbuf_free(mc); return -1; -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ } #undef GOTO_FAIL @@ -439,7 +439,7 @@ test_pktmbuf_pool(void) printf("Error pool not empty"); ret = -1; } -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT extra = rte_pktmbuf_clone(m[0], pktmbuf_pool); if(extra != NULL) { printf("Error pool not empty"); @@ -548,11 +548,11 @@ test_pktmbuf_free_segment(void) /* * Stress test for rte_mbuf atomic refcnt. * Implies that: - * RTE_MBUF_SCATTER_GATHER and RTE_MBUF_REFCNT_ATOMIC are both defined. + * RTE_MBUF_REFCNT and RTE_MBUF_REFCNT_ATOMIC are both defined. * For more efficency, recomended to run with RTE_LIBRTE_MBUF_DEBUG defined. */ -#if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC +#if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC static int test_refcnt_slave(__attribute__((unused)) void *arg) @@ -657,7 +657,7 @@ test_refcnt_master(void) static int test_refcnt_mbuf(void) { -#if defined RTE_MBUF_SCATTER_GATHER && defined RTE_MBUF_REFCNT_ATOMIC +#if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC unsigned lnum, master, slave, tref; @@ -808,7 +808,7 @@ test_failing_mbuf_sanity_check(void) return -1; } -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT badbuf = *buf; badbuf.refcnt = 0; if (verify_mbuf_check_panics(&badbuf)) { diff --git a/config/defconfig_i686-default-linuxapp-gcc b/config/defconfig_i686-default-linuxapp-gcc index 14bd3d1..dd0f0d0 100644 --- a/config/defconfig_i686-default-linuxapp-gcc +++ b/config/defconfig_i686-default-linuxapp-gcc @@ -235,7 +235,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # CONFIG_RTE_LIBRTE_MBUF=y CONFIG_RTE_LIBRTE_MBUF_DEBUG=n -CONFIG_RTE_MBUF_SCATTER_GATHER=y +CONFIG_RTE_MBUF_REFCNT=y CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/config/defconfig_i686-default-linuxapp-icc b/config/defconfig_i686-default-linuxapp-icc index ec3386e..ef11051 100644 --- a/config/defconfig_i686-default-linuxapp-icc +++ b/config/defconfig_i686-default-linuxapp-icc @@ -234,7 +234,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # CONFIG_RTE_LIBRTE_MBUF=y CONFIG_RTE_LIBRTE_MBUF_DEBUG=n -CONFIG_RTE_MBUF_SCATTER_GATHER=y +CONFIG_RTE_MBUF_REFCNT=y CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/config/defconfig_x86_64-default-bsdapp-gcc b/config/defconfig_x86_64-default-bsdapp-gcc index d960e1d..f5f2140 100644 --- a/config/defconfig_x86_64-default-bsdapp-gcc +++ b/config/defconfig_x86_64-default-bsdapp-gcc @@ -210,7 +210,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # CONFIG_RTE_LIBRTE_MBUF=y CONFIG_RTE_LIBRTE_MBUF_DEBUG=n -CONFIG_RTE_MBUF_SCATTER_GATHER=y +CONFIG_RTE_MBUF_REFCNT=y CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/config/defconfig_x86_64-default-linuxapp-gcc b/config/defconfig_x86_64-default-linuxapp-gcc index f11ffbf..25a7e1a 100644 --- a/config/defconfig_x86_64-default-linuxapp-gcc +++ b/config/defconfig_x86_64-default-linuxapp-gcc @@ -237,7 +237,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # CONFIG_RTE_LIBRTE_MBUF=y CONFIG_RTE_LIBRTE_MBUF_DEBUG=n -CONFIG_RTE_MBUF_SCATTER_GATHER=y +CONFIG_RTE_MBUF_REFCNT=y CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/config/defconfig_x86_64-default-linuxapp-icc b/config/defconfig_x86_64-default-linuxapp-icc index 4eaca4c..d209874 100644 --- a/config/defconfig_x86_64-default-linuxapp-icc +++ b/config/defconfig_x86_64-default-linuxapp-icc @@ -234,7 +234,7 @@ CONFIG_RTE_LIBRTE_MEMPOOL_DEBUG=n # CONFIG_RTE_LIBRTE_MBUF=y CONFIG_RTE_LIBRTE_MBUF_DEBUG=n -CONFIG_RTE_MBUF_SCATTER_GATHER=y +CONFIG_RTE_MBUF_REFCNT=y CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 diff --git a/doc/doxy-api.conf b/doc/doxy-api.conf index 642f77a..92e48c3 100644 --- a/doc/doxy-api.conf +++ b/doc/doxy-api.conf @@ -49,7 +49,7 @@ FILE_PATTERNS = rte_*.h \ cmdline.h PREDEFINED = __DOXYGEN__ \ __attribute__(x)= \ - RTE_MBUF_SCATTER_GATHER + RTE_MBUF_REFCNT OPTIMIZE_OUTPUT_FOR_C = YES ENABLE_PREPROCESSING = YES diff --git a/examples/ipv4_frag/Makefile b/examples/ipv4_frag/Makefile index 97fa452..b964017 100644 --- a/examples/ipv4_frag/Makefile +++ b/examples/ipv4_frag/Makefile @@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-default-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk -ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) -$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled) +ifneq ($(CONFIG_RTE_MBUF_REFCNT),y) +$(error This application requires RTE_MBUF_REFCNT to be enabled) endif # binary name diff --git a/examples/ipv4_multicast/Makefile b/examples/ipv4_multicast/Makefile index f76f8d8..5a9612d 100644 --- a/examples/ipv4_multicast/Makefile +++ b/examples/ipv4_multicast/Makefile @@ -39,8 +39,8 @@ RTE_TARGET ?= x86_64-default-linuxapp-gcc include $(RTE_SDK)/mk/rte.vars.mk -ifneq ($(CONFIG_RTE_MBUF_SCATTER_GATHER),y) -$(error This application requires RTE_MBUF_SCATTER_GATHER to be enabled) +ifneq ($(CONFIG_RTE_MBUF_REFCNT),y) +$(error This application requires RTE_MBUF_REFCNT to be enabled) endif # binary name diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index a72e9b8..c56206b 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -160,7 +160,7 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, enum rte_mbuf_type t, if (m->buf_addr == NULL) rte_panic("bad virt addr\n"); -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT uint16_t cnt = rte_mbuf_refcnt_read(m); if ((cnt == 0) || (cnt == UINT16_MAX)) rte_panic("bad ref cnt\n"); diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4a9ab41..36328ec 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -67,6 +67,9 @@ extern "C" { #endif +/* deprecated feature, renamed in RTE_MBUF_REFCNT */ +#pragma GCC poison RTE_MBUF_SCATTER_GATHER + /** * A control message buffer. */ @@ -177,7 +180,7 @@ struct rte_mbuf { void *buf_addr; /**< Virtual address of segment buffer. */ phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ uint16_t buf_len; /**< Length of segment buffer. */ -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT /** * 16-bit Reference counter. * It should only be accessed using the following functions: @@ -265,7 +268,7 @@ if (!(exp)) { \ #endif /* RTE_LIBRTE_MBUF_DEBUG */ -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT #ifdef RTE_MBUF_REFCNT_ATOMIC /** @@ -347,14 +350,14 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) rte_prefetch0(m); \ } while (0) -#else /* ! RTE_MBUF_SCATTER_GATHER */ +#else /* ! RTE_MBUF_REFCNT */ /** Mbuf prefetch */ #define RTE_MBUF_PREFETCH_TO_FREE(m) do { } while(0) #define rte_mbuf_refcnt_set(m,v) do { } while(0) -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ /** @@ -393,10 +396,10 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp) if (rte_mempool_get(mp, &mb) < 0) return NULL; m = (struct rte_mbuf *)mb; -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); rte_mbuf_refcnt_set(m, 1); -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ return (m); } @@ -411,9 +414,9 @@ static inline struct rte_mbuf *__rte_mbuf_raw_alloc(struct rte_mempool *mp) static inline void __attribute__((always_inline)) __rte_mbuf_raw_free(struct rte_mbuf *m) { -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ rte_mempool_put(m->pool, m); } @@ -590,7 +593,7 @@ static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp) return (m); } -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT /** * Attach packet mbuf to another packet mbuf. @@ -658,7 +661,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m) m->pkt.data_len = 0; } -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ static inline struct rte_mbuf* __attribute__((always_inline)) @@ -666,7 +669,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0); -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT if (likely (rte_mbuf_refcnt_read(m) == 1) || likely (rte_mbuf_refcnt_update(m, -1) == 0)) { struct rte_mbuf *md = RTE_MBUF_FROM_BADDR(m->buf_addr); @@ -684,7 +687,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) } #endif return(m); -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT } return (NULL); #endif @@ -728,7 +731,7 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m) } } -#ifdef RTE_MBUF_SCATTER_GATHER +#ifdef RTE_MBUF_REFCNT /** * Creates a "clone" of the given packet mbuf. @@ -804,7 +807,7 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v) } while ((m = m->pkt.next) != NULL); } -#endif /* RTE_MBUF_SCATTER_GATHER */ +#endif /* RTE_MBUF_REFCNT */ /** * Get the headroom in a packet mbuf. -- 1.9.2