From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 486A8A0096 for ; Wed, 5 Jun 2019 11:25:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 133641B9B8; Wed, 5 Jun 2019 11:25:28 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3C99F1B9B5 for ; Wed, 5 Jun 2019 11:25:25 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 02:25:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,550,1549958400"; d="scan'208";a="181867330" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2019 02:25:23 -0700 Date: Wed, 5 Jun 2019 17:25:12 +0800 From: Ye Xiaolong To: "Li, Xiaoyun" Cc: "Wu, Jingjing" , "Wiles, Keith" , "Liang, Cunming" , "Maslekar, Omkar" , "dev@dpdk.org" Message-ID: <20190605092512.GA4003@intel.com> References: <20190603084611.40931-1-xiaoyun.li@intel.com> <20190603084611.40931-5-xiaoyun.li@intel.com> <20190604064801.GA94383@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for ntb 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" On 06/05, Li, Xiaoyun wrote: >Hi >> > I noticed that there are two allocations, one for pkts_recv[0] and another for >> > pkts_recv[0]->buf_addr, How about we declare >> > >> > struct rte_rawdev_buf pkts_recv[1]; >> > >> > and allocate memory for its buf_addr >> > >> > pkts_recv[0].buf_addr = malloc(size); >> > >> > then we call >> > >> > rte_rawdev_dequeue_buffers(dev_id, &pkts_recv, 1, (void *)size); >> > >> > After that, we just need to free once. >> > >> > free(pkts_recv[0].buf_addr); >> > > >Double pointer does not represent 2D arrays. Please refer to >https://stackoverflow.com/questions/4470950/why-cant-we-use-double-pointer-to-represent-two-dimensional-arrays > Yes, I agree, but I don't think it is the case here. >It will cause segment fault in enqueue/dequeue. Hmm, have you debug it? Which line caused the segfault? You can refer to test_rawdev_enqdeq function in skeleton_rawdev_test.c, what it does is similar to my suggestion, and you just need one alloc/free. Thanks, Xiaolong > >I will free twice. > >> > >2.17.1 >> > >