From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id EA9C98DA5 for ; Tue, 27 Oct 2015 21:57:25 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 27 Oct 2015 13:57:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,206,1444719600"; d="scan'208";a="836492214" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by orsmga002.jf.intel.com with ESMTP; 27 Oct 2015 13:57:16 -0700 Received: from orsmsx156.amr.corp.intel.com (10.22.240.22) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 27 Oct 2015 13:56:50 -0700 Received: from orsmsx102.amr.corp.intel.com ([169.254.1.29]) by ORSMSX156.amr.corp.intel.com ([169.254.8.249]) with mapi id 14.03.0248.002; Tue, 27 Oct 2015 13:56:49 -0700 From: "Polehn, Mike A" To: "dev@dpdk.org" Thread-Topic: [Patch 2/2] i40e simple tx: Larger list size (33 to 128) throughput optimization Thread-Index: AdEQ+byFX0HbjItFQs6JSHTQKDguMg== Date: Tue, 27 Oct 2015 20:56:49 +0000 Message-ID: <745DB4B8861F8E4B9849C970520ABBF14974C218@ORSMSX102.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsIiwiaWQiOiI5NjZkN2MzYS0yMDNmLTRhOWItYTQ2NC02ZDY3YjFkZWViYjYiLCJwcm9wcyI6W3sibiI6IkludGVsRGF0YUNsYXNzaWZpY2F0aW9uIiwidmFscyI6W3sidmFsdWUiOiJDVFBfSUMifV19XX0sIlN1YmplY3RMYWJlbHMiOltdLCJUTUNWZXJzaW9uIjoiMTUuNC4xMC4xOSIsIlRydXN0ZWRMYWJlbEhhc2giOiJIV2s4OUI0UnFKcmtIcXptWWFzT3ZnVzlqSTRvRTRCalZkVUVBWXZQT2pBPSJ9 x-inteldataclassification: CTP_IC x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [dpdk-dev] [Patch 2/2] i40e simple tx: Larger list size (33 to 128) throughput optimization 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: Tue, 27 Oct 2015 20:57:26 -0000 Added packet memory prefetch for faster access to variables inside packet b= uffer needed=20 for the free operation. Signed-off-by: Mike A. Polehn diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 177fb2e..d9bc30a 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1748,7 +1748,8 @@ static inline int __attribute__((always_inline)) i40e_tx_free_bufs(struct i40e_tx_queue *txq) { struct i40e_tx_entry *txep; - uint16_t i; + unsigned i, l, tx_rs_thresh; + struct rte_mbuf *pk, *pk_next; =20 if ((txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz & rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=3D @@ -1757,18 +1758,46 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq) =20 txep =3D &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]); =20 - for (i =3D 0; i < txq->tx_rs_thresh; i++) - rte_prefetch0((txep + i)->mbuf); + /* Prefetch first 2 packets */ + pk =3D txep->mbuf; + rte_prefetch0(pk); + txep->mbuf =3D NULL; + txep++; + tx_rs_thresh =3D txq->tx_rs_thresh; + if (likely(txq->tx_rs_thresh > 1)) { + pk_next =3D txep->mbuf; + rte_prefetch0(pk_next); + txep->mbuf =3D NULL; + txep++; + l =3D tx_rs_thresh - 2; + } else { + pk_next =3D pk; + l =3D tx_rs_thresh - 1; + } =20 if (!(txq->txq_flags & (uint32_t)ETH_TXQ_FLAGS_NOREFCOUNT)) { - for (i =3D 0; i < txq->tx_rs_thresh; ++i, ++txep) { - rte_mempool_put(txep->mbuf->pool, txep->mbuf); - txep->mbuf =3D NULL; + for (i =3D 0; i < tx_rs_thresh; ++i) { + struct rte_mbuf *mbuf =3D pk; + pk =3D pk_next; + if (likely(i < l)) { + pk_next =3D txep->mbuf; + rte_prefetch0(pk_next); + txep->mbuf =3D NULL; + txep++; + } + rte_mempool_put(mbuf->pool, mbuf); } } else { - for (i =3D 0; i < txq->tx_rs_thresh; ++i, ++txep) { - rte_pktmbuf_free_seg(txep->mbuf); - txep->mbuf =3D NULL; + for (i =3D 0; i < tx_rs_thresh; ++i) { + struct rte_mbuf *mbuf =3D pk; + pk =3D pk_next; + if (likely(i < l)) { + pk_next =3D txep->mbuf; + rte_prefetch0(pk_next); + txep->mbuf =3D NULL; + txep++; + } + rte_pktmbuf_free_seg(mbuf); } }