From patchwork Wed Dec 25 09:09:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xiaoyun" X-Patchwork-Id: 64129 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDD40A04F7; Wed, 25 Dec 2019 10:13:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EEC21BF0B; Wed, 25 Dec 2019 10:13:27 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 239E11BE90; Wed, 25 Dec 2019 10:13:24 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Dec 2019 01:13:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,353,1571727600"; d="scan'208";a="367524374" Received: from dpdk-xiaoyun3.sh.intel.com ([10.67.118.162]) by orsmga004.jf.intel.com with ESMTP; 25 Dec 2019 01:13:22 -0800 From: Xiaoyun Li To: jingjing.wu@intel.com, omkar.maslekar@intel.com, dev@dpdk.org Cc: Xiaoyun Li , stable@dpdk.org Date: Wed, 25 Dec 2019 17:09:42 +0800 Message-Id: <20191225090942.20202-1-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/ntb: fix mempool ops setting issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Mempool ops may register in different order when compiling. The default ops index is always zero but the wanted ops is ring_mp_mc. This patch sets best mempool ops before generating mbuf pool to fix this issue. Fixes: 5194299d6ef5 ("examples/ntb: support more functions") Cc: stable@dpdk.org Signed-off-by: Xiaoyun Li --- examples/ntb/ntb_fwd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index c914256dd..17eedcf0b 100644 --- a/examples/ntb/ntb_fwd.c +++ b/examples/ntb/ntb_fwd.c @@ -19,6 +19,7 @@ #include #include #include +#include /* Per-port statistics struct */ struct ntb_port_statistics { @@ -1256,6 +1257,11 @@ ntb_mbuf_pool_create(uint16_t mbuf_seg_size, uint32_t nb_mbuf, if (mp == NULL) return NULL; + if (rte_mempool_set_ops_byname(mp, rte_mbuf_best_mempool_ops(), NULL)) { + printf("error setting mempool handler\n"); + goto fail; + } + memset(&mbp_priv, 0, sizeof(mbp_priv)); mbp_priv.mbuf_data_room_size = mbuf_seg_size; mbp_priv.mbuf_priv_size = 0;