From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by dpdk.org (Postfix) with ESMTP id 40322B377 for ; Mon, 11 Aug 2014 22:42:20 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 11 Aug 2014 13:45:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,844,1400050800"; d="scan'208";a="467575644" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 11 Aug 2014 13:44:53 -0700 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 s7BKiqaA020966; Mon, 11 Aug 2014 21:44:52 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s7BKiqHK017716; Mon, 11 Aug 2014 21:44:52 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s7BKiq7f017712; Mon, 11 Aug 2014 21:44:52 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Mon, 11 Aug 2014 21:44:47 +0100 Message-Id: <1407789890-17355-12-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1407789890-17355-1-git-send-email-bruce.richardson@intel.com> References: <1407789890-17355-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [RFC PATCH 11/14] ixgbe: make mbuf_initializer queue variable global 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, 11 Aug 2014 20:42:21 -0000 On descriptor rearm, the mbuf_initializer variable can be used to do a single-shot write to an mbuf to initialize all variables that can be set. This is currently used only by vector PMD function, but now allow it to be generally used by other RX code paths. Signed-off-by: Bruce Richardson --- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 25 +++++++++++++++++++++++-- lib/librte_pmd_ixgbe/ixgbe_rxtx.h | 9 ++++++--- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 25 +------------------------ 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index f9cc352..fadb9a0 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -90,6 +90,27 @@ ETH_RSS_IPV6_UDP | \ ETH_RSS_IPV6_UDP_EX) +int +ixgbe_set_mbuf_initializer(struct igb_rx_queue *rxq) +{ + static struct rte_mbuf mb_def = { + .buf_len = 0, + .data_len = 0, + + .data_off = RTE_PKTMBUF_HEADROOM, +#ifdef RTE_MBUF_REFCNT + .refcnt = 1, +#endif + .nb_segs = 1, + .port = 0 + }; + + mb_def.buf_len = rxq->mb_pool->elt_size - sizeof(struct rte_mbuf); + mb_def.port = rxq->port_id; + rxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data); + return 0; +} + static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) { @@ -1878,7 +1899,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, PMD_INIT_LOG(INFO, "Using simple tx code path\n"); #ifdef RTE_IXGBE_INC_VECTOR if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && - ixgbe_txq_vec_setup(txq, socket_id) == 0) { + ixgbe_txq_vec_setup(txq) == 0) { PMD_INIT_LOG(INFO, "Vector tx enabled.\n"); dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; } @@ -2169,7 +2190,6 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, if (!ixgbe_rx_vec_condition_check(dev)) { PMD_INIT_LOG(INFO, "Vector rx enabled, please make " "sure RX burst size no less than 32.\n"); - ixgbe_rxq_vec_setup(rxq, socket_id); dev->rx_pkt_burst = ixgbe_recv_pkts_vec; } #endif @@ -2183,6 +2203,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, } dev->data->rx_queues[queue_idx] = rxq; + ixgbe_set_mbuf_initializer(rxq); ixgbe_reset_rx_queue(rxq); return 0; diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h index d9889d9..76db3ca 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h @@ -107,6 +107,7 @@ struct igb_rx_queue { struct igb_rx_entry *sw_ring; /**< address of RX software ring. */ struct rte_mbuf *pkt_first_seg; /**< First segment of current packet. */ struct rte_mbuf *pkt_last_seg; /**< Last segment of current packet. */ + uint64_t mbuf_initializer; /**< value to init mbufs */ uint16_t nb_rx_desc; /**< number of RX descriptors. */ uint16_t rx_tail; /**< current value of RDT register. */ uint16_t nb_rx_hold; /**< number of held free RX desc. */ @@ -118,7 +119,6 @@ struct igb_rx_queue { #ifdef RTE_IXGBE_INC_VECTOR uint16_t rxrearm_nb; /**< the idx we start the re-arming from */ uint16_t rxrearm_start; /**< number of remaining to be re-armed */ - uint64_t mbuf_initializer; /**< value to init mbufs */ #endif uint16_t rx_free_thresh; /**< max free RX desc to hold. */ uint16_t queue_id; /**< RX queue index. */ @@ -226,9 +226,12 @@ struct ixgbe_txq_ops { #ifdef RTE_IXGBE_INC_VECTOR uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); uint16_t ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -int ixgbe_txq_vec_setup(struct igb_tx_queue *txq, unsigned int socket_id); -int ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq, unsigned int socket_id); +int ixgbe_txq_vec_setup(struct igb_tx_queue *txq); int ixgbe_rx_vec_condition_check(struct rte_eth_dev *dev); #endif +int +ixgbe_set_mbuf_initializer(struct igb_rx_queue *rxq); + + #endif diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c index c98356e..39c06e2 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c @@ -45,28 +45,6 @@ #endif -int -ixgbe_rxq_vec_setup(struct igb_rx_queue *rxq, - __rte_unused unsigned int socket_id) -{ - static struct rte_mbuf mb_def = { - .buf_len = 0, - .data_len = 0, - - .data_off = RTE_PKTMBUF_HEADROOM, -#ifdef RTE_MBUF_REFCNT - .refcnt = 1, -#endif - .nb_segs = 1, - .port = 0 - }; - - mb_def.buf_len = rxq->mb_pool->elt_size - sizeof(struct rte_mbuf); - mb_def.port = rxq->port_id; - rxq->mbuf_initializer = *((uint64_t *)&mb_def.rearm_data); - return 0; -} - static inline void ixgbe_rxq_rearm(struct igb_rx_queue *rxq) { @@ -586,8 +564,7 @@ static struct ixgbe_txq_ops vec_txq_ops = { .reset = ixgbe_reset_tx_queue, }; -int ixgbe_txq_vec_setup(struct igb_tx_queue *txq, - unsigned int socket_id __rte_unused) +int ixgbe_txq_vec_setup(struct igb_tx_queue *txq) { if (txq->sw_ring == NULL) return -1; -- 1.9.3