From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id ACF55B4CA for ; Wed, 18 Feb 2015 12:03:10 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 18 Feb 2015 03:03:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,512,1418112000"; d="scan'208";a="529172653" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 18 Feb 2015 02:54:28 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t1IB34vV022804 for ; Wed, 18 Feb 2015 11:03:04 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t1IB34pT004243 for ; Wed, 18 Feb 2015 11:03:04 GMT Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t1IB34lC004236 for dev@dpdk.org; Wed, 18 Feb 2015 11:03:04 GMT From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Wed, 18 Feb 2015 11:03:03 +0000 Message-Id: <1424257383-4177-3-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1424257383-4177-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1424102913-18944-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1424257383-4177-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v2 2/2] Remove RTE_MBUF_REFCNT references 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: Wed, 18 Feb 2015 11:03:17 -0000 This patch removes all references to RTE_MBUF_REFCNT, setting the refcnt field in the mbuf struct permanently. Signed-off-by: Sergio Gonzalez Monroy Acked-by: Olivier Matz --- app/test/test_link_bonding.c | 15 --------------- app/test/test_mbuf.c | 17 ++++------------- config/common_bsdapp | 1 - config/common_linuxapp | 1 - examples/Makefile | 4 ++-- examples/ip_fragmentation/Makefile | 4 ---- examples/ip_pipeline/Makefile | 3 --- examples/ip_pipeline/main.c | 5 ----- examples/ipv4_multicast/Makefile | 4 ---- examples/vhost/main.c | 13 ------------- lib/librte_ip_frag/Makefile | 4 ---- lib/librte_ip_frag/rte_ip_frag.h | 4 ---- lib/librte_mbuf/rte_mbuf.c | 2 -- lib/librte_mbuf/rte_mbuf.h | 30 ------------------------------ lib/librte_pmd_bond/Makefile | 4 ---- lib/librte_pmd_bond/rte_eth_bond.h | 2 -- lib/librte_pmd_bond/rte_eth_bond_args.c | 2 -- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 10 ---------- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 8 -------- lib/librte_port/Makefile | 4 ---- 20 files changed, 6 insertions(+), 131 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 579ebbf..54895ab 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -708,9 +708,7 @@ test_set_bonding_mode(void) int bonding_modes[] = { BONDING_MODE_ROUND_ROBIN, BONDING_MODE_ACTIVE_BACKUP, BONDING_MODE_BALANCE, -#ifdef RTE_MBUF_REFCNT BONDING_MODE_BROADCAST -#endif }; /* Test supported link bonding modes */ @@ -1425,7 +1423,6 @@ test_roundrobin_tx_burst(void) return remove_slaves_and_stop_bonded_device(); } -#ifdef RTE_MBUF_REFCNT static int verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val) { @@ -1439,8 +1436,6 @@ verify_mbufs_ref_count(struct rte_mbuf **mbufs, int nb_mbufs, int val) } return 0; } -#endif - static void free_mbufs(struct rte_mbuf **mbufs, int nb_mbufs) @@ -1545,12 +1540,10 @@ test_roundrobin_tx_burst_slave_tx_fail(void) (unsigned int)port_stats.opackets, slave_expected_tx_count); } -#ifdef RTE_MBUF_REFCNT /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); -#endif free_mbufs(&pkt_burst[tx_count], TEST_RR_SLAVE_TX_FAIL_PACKETS_COUNT); /* Clean up and remove slaves from bonded device */ @@ -3056,12 +3049,10 @@ test_balance_tx_burst_slave_tx_fail(void) (unsigned int)port_stats.opackets, TEST_BAL_SLAVE_TX_FAIL_BURST_SIZE_2); -#ifdef RTE_MBUF_REFCNT /* Verify that all mbufs have a ref value of zero */ TEST_ASSERT_SUCCESS(verify_mbufs_ref_count(&pkts_burst_1[tx_count_1], TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT, 1), "mbufs refcnts not as expected"); -#endif free_mbufs(&pkts_burst_1[tx_count_1], TEST_BAL_SLAVE_TX_FAIL_PACKETS_COUNT); @@ -3472,9 +3463,6 @@ test_balance_verify_slave_link_status_change_behaviour(void) return remove_slaves_and_stop_bonded_device(); } -#ifdef RTE_MBUF_REFCNT -/** Broadcast Mode Tests */ - static int test_broadcast_tx_burst(void) { @@ -4001,7 +3989,6 @@ test_broadcast_verify_slave_link_status_change_behaviour(void) /* Clean up and remove slaves from bonded device */ return remove_slaves_and_stop_bonded_device(); } -#endif static int test_reconfigure_bonded_device(void) @@ -4592,14 +4579,12 @@ static struct unit_test_suite link_bonding_test_suite = { TEST_CASE(test_tlb_verify_mac_assignment), TEST_CASE(test_tlb_verify_promiscuous_enable_disable), TEST_CASE(test_tlb_verify_slave_link_status_change_failover), -#ifdef RTE_MBUF_REFCNT TEST_CASE(test_broadcast_tx_burst), TEST_CASE(test_broadcast_tx_burst_slave_tx_fail), TEST_CASE(test_broadcast_rx_burst), TEST_CASE(test_broadcast_verify_promiscuous_enable_disable), TEST_CASE(test_broadcast_verify_mac_assignment), TEST_CASE(test_broadcast_verify_slave_link_status_change_behaviour), -#endif TEST_CASE(test_reconfigure_bonded_device), TEST_CASE(test_close_bonded_device), diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index e86ba22..9de6dea 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -81,7 +81,7 @@ static struct rte_mempool *pktmbuf_pool = NULL; -#if defined RTE_MBUF_REFCNT && defined RTE_MBUF_REFCNT_ATOMIC +#ifdef RTE_MBUF_REFCNT_ATOMIC static struct rte_mempool *refcnt_pool = NULL; static struct rte_ring *refcnt_mbuf_ring = NULL; @@ -322,9 +322,6 @@ fail: static int testclone_testupdate_testdetach(void) { -#ifndef RTE_MBUF_REFCNT - return 0; -#else struct rte_mbuf *mc = NULL; struct rte_mbuf *clone = NULL; @@ -363,7 +360,6 @@ fail: if (mc) rte_pktmbuf_free(mc); return -1; -#endif /* RTE_MBUF_REFCNT */ } #undef GOTO_FAIL @@ -396,13 +392,11 @@ test_pktmbuf_pool(void) printf("Error pool not empty"); ret = -1; } -#ifdef RTE_MBUF_REFCNT extra = rte_pktmbuf_clone(m[0], pktmbuf_pool); if(extra != NULL) { printf("Error pool not empty"); ret = -1; } -#endif /* free them */ for (i=0; ibuf_addr == NULL) rte_panic("bad virt addr\n"); -#ifdef RTE_MBUF_REFCNT uint16_t cnt = rte_mbuf_refcnt_read(m); if ((cnt == 0) || (cnt == UINT16_MAX)) rte_panic("bad ref cnt\n"); -#endif /* nothing to check for sub-segments */ if (is_header == 0) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 1e5aa1f..6a3acfb 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -220,11 +220,8 @@ struct rte_mbuf { * config option. */ union { -#ifdef RTE_MBUF_REFCNT rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ uint16_t refcnt; /**< Non-atomically accessed refcnt */ -#endif - uint16_t refcnt_reserved; /**< Do not use this field */ }; uint8_t nb_segs; /**< Number of segments. */ uint8_t port; /**< Input port. */ @@ -354,7 +351,6 @@ if (!(exp)) { \ #endif /* RTE_LIBRTE_MBUF_DEBUG */ -#ifdef RTE_MBUF_REFCNT #ifdef RTE_MBUF_REFCNT_ATOMIC /** @@ -436,15 +432,6 @@ rte_mbuf_refcnt_set(struct rte_mbuf *m, uint16_t new_value) rte_prefetch0(m); \ } while (0) -#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_REFCNT */ - /** * Sanity checks on an mbuf. @@ -479,10 +466,8 @@ 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_REFCNT RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); rte_mbuf_refcnt_set(m, 1); -#endif /* RTE_MBUF_REFCNT */ return (m); } @@ -497,9 +482,7 @@ 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_REFCNT RTE_MBUF_ASSERT(rte_mbuf_refcnt_read(m) == 0); -#endif /* RTE_MBUF_REFCNT */ rte_mempool_put(m->pool, m); } @@ -674,8 +657,6 @@ static inline struct rte_mbuf *rte_pktmbuf_alloc(struct rte_mempool *mp) return (m); } -#ifdef RTE_MBUF_REFCNT - /** * Attach packet mbuf to another packet mbuf. * After attachment we refer the mbuf we attached as 'indirect', @@ -749,15 +730,11 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m) m->ol_flags = 0; } -#endif /* RTE_MBUF_REFCNT */ - - static inline struct rte_mbuf* __attribute__((always_inline)) __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, 0); -#ifdef RTE_MBUF_REFCNT if (likely (rte_mbuf_refcnt_read(m) == 1) || likely (rte_mbuf_refcnt_update(m, -1) == 0)) { @@ -773,12 +750,9 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m) if (rte_mbuf_refcnt_update(md, -1) == 0) __rte_mbuf_raw_free(md); } -#endif return(m); -#ifdef RTE_MBUF_REFCNT } return (NULL); -#endif } /** @@ -821,8 +795,6 @@ static inline void rte_pktmbuf_free(struct rte_mbuf *m) } } -#ifdef RTE_MBUF_REFCNT - /** * Creates a "clone" of the given packet mbuf. * @@ -897,8 +869,6 @@ static inline void rte_pktmbuf_refcnt_update(struct rte_mbuf *m, int16_t v) } while ((m = m->next) != NULL); } -#endif /* RTE_MBUF_REFCNT */ - /** * Get the headroom in a packet mbuf. * diff --git a/lib/librte_pmd_bond/Makefile b/lib/librte_pmd_bond/Makefile index d6c81a8..e9d94e1 100644 --- a/lib/librte_pmd_bond/Makefile +++ b/lib/librte_pmd_bond/Makefile @@ -51,10 +51,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_pmd.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_args.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_8023ad.c -ifeq ($(CONFIG_RTE_MBUF_REFCNT),n) -$(info WARNING: Link Bonding Broadcast mode is disabled because it needs MBUF_REFCNT.) -endif - # # Export include files # diff --git a/lib/librte_pmd_bond/rte_eth_bond.h b/lib/librte_pmd_bond/rte_eth_bond.h index 7177983..99568d4 100644 --- a/lib/librte_pmd_bond/rte_eth_bond.h +++ b/lib/librte_pmd_bond/rte_eth_bond.h @@ -71,12 +71,10 @@ extern "C" { * slaves using one of three available transmit policies - l2, l2+3 or l3+4. * See BALANCE_XMIT_POLICY macros definitions for further details on transmit * policies. */ -#ifdef RTE_MBUF_REFCNT #define BONDING_MODE_BROADCAST (3) /**< Broadcast (Mode 3). * In this mode all transmitted packets will be transmitted on all available * active slaves of the bonded. */ -#endif #define BONDING_MODE_8023AD (4) /**< 802.3AD (Mode 4). * diff --git a/lib/librte_pmd_bond/rte_eth_bond_args.c b/lib/librte_pmd_bond/rte_eth_bond_args.c index ca4de38..ae76bc6 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_args.c +++ b/lib/librte_pmd_bond/rte_eth_bond_args.c @@ -170,9 +170,7 @@ bond_ethdev_parse_slave_mode_kvarg(const char *key __rte_unused, case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_ACTIVE_BACKUP: case BONDING_MODE_BALANCE: -#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST: -#endif case BONDING_MODE_8023AD: case BONDING_MODE_ADAPTIVE_TRANSMIT_LOAD_BALANCING: return 0; diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c index 09b0f30..b90bf48 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c @@ -681,7 +681,6 @@ bond_ethdev_tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, return num_tx_total; } -#ifdef RTE_MBUF_REFCNT static uint16_t bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) @@ -741,7 +740,6 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, return max_nb_of_tx_pkts; } -#endif void link_properties_set(struct rte_eth_dev *bonded_eth_dev, @@ -839,9 +837,7 @@ mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev) switch (internals->mode) { case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: -#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST: -#endif for (i = 0; i < internals->slave_count; i++) { if (mac_address_set(&rte_eth_devices[internals->slaves[i].port_id], bonded_eth_dev->data->mac_addrs)) { @@ -901,12 +897,10 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int mode) eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance; eth_dev->rx_pkt_burst = bond_ethdev_rx_burst; break; -#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST: eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast; eth_dev->rx_pkt_burst = bond_ethdev_rx_burst; break; -#endif case BONDING_MODE_8023AD: if (bond_mode_8023ad_enable(eth_dev) != 0) return -1; @@ -1410,9 +1404,7 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev) /* Promiscuous mode is propagated to all slaves */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: -#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST: -#endif for (i = 0; i < internals->slave_count; i++) rte_eth_promiscuous_enable(internals->slaves[i].port_id); break; @@ -1439,9 +1431,7 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev) /* Promiscuous mode is propagated to all slaves */ case BONDING_MODE_ROUND_ROBIN: case BONDING_MODE_BALANCE: -#ifdef RTE_MBUF_REFCNT case BONDING_MODE_BROADCAST: -#endif for (i = 0; i < internals->slave_count; i++) rte_eth_promiscuous_disable(internals->slaves[i].port_id); break; diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c index b54cb19..8c95bd3 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c @@ -540,20 +540,12 @@ ixgbe_tx_free_bufs(struct igb_tx_queue *txq) */ txep = &((struct igb_tx_entry_v *)txq->sw_ring)[txq->tx_next_dd - (n - 1)]; -#ifdef RTE_MBUF_REFCNT m = __rte_pktmbuf_prefree_seg(txep[0].mbuf); -#else - m = txep[0].mbuf; -#endif if (likely(m != NULL)) { free[0] = m; nb_free = 1; for (i = 1; i < n; i++) { -#ifdef RTE_MBUF_REFCNT m = __rte_pktmbuf_prefree_seg(txep[i].mbuf); -#else - m = txep[i].mbuf; -#endif if (likely(m != NULL)) { if (likely(m->pool == free[0]->pool)) free[nb_free++] = m; diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile index 0e38452..de960fc 100644 --- a/lib/librte_port/Makefile +++ b/lib/librte_port/Makefile @@ -49,9 +49,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ring.c ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y) -ifeq ($(CONFIG_RTE_MBUF_REFCNT),y) SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_frag.c -endif SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_ras.c endif SRCS-$(CONFIG_RTE_LIBRTE_PORT) += rte_port_sched.c @@ -62,9 +60,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port.h SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ethdev.h SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ring.h ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y) -ifeq ($(CONFIG_RTE_MBUF_REFCNT),y) SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_frag.h -endif SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_ras.h endif SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_sched.h -- 1.9.3