From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by dpdk.org (Postfix) with ESMTP id 6D13D9598 for ; Fri, 13 Nov 2015 17:10:03 +0100 (CET) Received: by pasz6 with SMTP id z6so107539633pas.2 for ; Fri, 13 Nov 2015 08:10:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Me5Bw8riJMa6uQBEBoa1jMOcRdTqBWtnYp0s89wnwwg=; b=NGJJG6YkZwRInCH91jCakRwO0JqNYPRP/acuZKtRNzBraxMidM3Mu9oX46C4iHXf/W wQzlVFqE3j3csxLUtHoA7QmDzor+y9xlmELqwr3ZJEAoGd9UVXh7ZezIp8L+zvv5CZ8f SL14e/N375I0J7uMEiUZd/yLvc3qx7KR+OFWuf4TLlzZUtOxSad9vUiYnDq65G6jDonS qv2rXJlabs2E0JD/ruUk9ZGA+mVf2wpgE1vTva5252Cec1Fk6tDRxqLdqOjkhW5fm8Qm djXlgOfK0IIX+mQIm+8jAY6K8q1e2v1C5D7vxvMKns9W/w9lAfV7Fxunc3n+ncErwFgz XZvA== 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; bh=Me5Bw8riJMa6uQBEBoa1jMOcRdTqBWtnYp0s89wnwwg=; b=Unx7ez8dzMk9ReqvFrUkTYKoT7tzg+oDTSvvcOTH8hbRls7+omoK2fD4PClPgm2v3l EWYW7jN93zU4vAd3mUXGoLnq7KFoUfmeYRKbQrfoshRLyvLeTGic3G5ZGMjmMXjXZFw1 75IGyNGpQ1ySip16UkeWxAQFSg0cRocGgZbCkg1/QqoaM/CQZf2I+1eiy5YDRCdgt0py PvjnuHs2+XtWf+SIJwuZfM0dokSnD3Nmjo9+JHiGmi7d6NbWTFkkOwSEVT03JSbF3eer fnTi30lBkUQBAo5BpY2aXQKsGyEcvPl+R2SZFzAnw3mPvxJwKrHoO+N6277dnS7d3QTM ttqA== X-Gm-Message-State: ALoCoQmr/raXEXZ19/l2JH3MYf/yBbAElyEKP/erYsR1wAb+d8bBB2mjVR5MqPI5zZH3rlO485bS X-Received: by 10.68.221.230 with SMTP id qh6mr33051806pbc.32.1447431002771; Fri, 13 Nov 2015 08:10:02 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id kj3sm21207622pbc.59.2015.11.13.08.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Nov 2015 08:10:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Fri, 13 Nov 2015 08:10:13 -0800 Message-Id: <1447431013-23245-1-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH v2 ] ixgbe: speed up transmit 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: Fri, 13 Nov 2015 16:10:03 -0000 From: Stephen Hemminger The freeing of mbuf's in ixgbe is one of the observable hot spots under load. Optimize it by doing bulk free of mbufs using code similar to i40e and fm10k. Drop the no longer needed micro-optimization for the no refcount flag. Signed-off-by: Stephen Hemminger --- v2 - rebase and use variable names consistent with i40e drivers/net/ixgbe/ixgbe_rxtx.c | 32 ++++++++++++++++++++------------ drivers/net/ixgbe/ixgbe_rxtx.h | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 52a263c..0b087c3 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -126,7 +126,8 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq) { struct ixgbe_tx_entry *txep; uint32_t status; - int i; + int i, nb_free = 0; + struct rte_mbuf *m, *free[RTE_IXGBE_TX_MAX_FREE_BUF_SZ]; /* check DD bit on threshold descriptor */ status = txq->tx_ring[txq->tx_next_dd].wb.status; @@ -139,20 +140,27 @@ ixgbe_tx_free_bufs(struct ixgbe_tx_queue *txq) */ txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]); - /* free buffers one at a time */ - if ((txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT) != 0) { - for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) { - txep->mbuf->next = NULL; - rte_mempool_put(txep->mbuf->pool, txep->mbuf); - txep->mbuf = NULL; - } - } else { - for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) { - rte_pktmbuf_free_seg(txep->mbuf); - txep->mbuf = NULL; + for (i = 0; i < txq->tx_rs_thresh; ++i, ++txep) { + /* free buffers one at a time */ + m = __rte_pktmbuf_prefree_seg(txep->mbuf); + txep->mbuf = NULL; + + if (unlikely(m == NULL)) + continue; + + if (nb_free >= RTE_IXGBE_TX_MAX_FREE_BUF_SZ || + (nb_free > 0 && m->pool != free[0]->pool)) { + rte_mempool_put_bulk(free[0]->pool, + (void **)free, nb_free); + nb_free = 0; } + + free[nb_free++] = m; } + if (nb_free > 0) + rte_mempool_put_bulk(free[0]->pool, (void **)free, nb_free); + /* buffers were freed, update counters */ txq->nb_tx_free = (uint16_t)(txq->nb_tx_free + txq->tx_rs_thresh); txq->tx_next_dd = (uint16_t)(txq->tx_next_dd + txq->tx_rs_thresh); diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 475a800..064cbda 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -58,6 +58,7 @@ #define RTE_PMD_IXGBE_TX_MAX_BURST 32 #define RTE_PMD_IXGBE_RX_MAX_BURST 32 +#define RTE_IXGBE_TX_MAX_FREE_BUF_SZ 64 #define RTE_IXGBE_DESCS_PER_LOOP 4 @@ -70,7 +71,6 @@ #ifdef RTE_IXGBE_INC_VECTOR #define RTE_IXGBE_RXQ_REARM_THRESH 32 #define RTE_IXGBE_MAX_RX_BURST RTE_IXGBE_RXQ_REARM_THRESH -#define RTE_IXGBE_TX_MAX_FREE_BUF_SZ 64 #endif #define RX_RING_SZ ((IXGBE_MAX_RING_DESC + RTE_IXGBE_DESCS_PER_LOOP - 1) * \ -- 2.1.4