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 44469A0096 for ; Tue, 4 Jun 2019 10:57:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E7EAA1BB32; Tue, 4 Jun 2019 10:57:31 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id A9D971B9E7 for ; Tue, 4 Jun 2019 10:57:30 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 01:57:29 -0700 X-ExtLoop1: 1 Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.206]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2019 01:57:28 -0700 Date: Tue, 4 Jun 2019 16:48:41 +0800 From: Ye Xiaolong To: Xiaoyun Li Cc: jingjing.wu@intel.com, keith.wiles@intel.com, cunming.liang@intel.com, omkar.maslekar@intel.com, dev@dpdk.org Message-ID: <20190604084841.GA96452@intel.com> References: <20190603084611.40931-1-xiaoyun.li@intel.com> <20190603084611.40931-5-xiaoyun.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190603084611.40931-5-xiaoyun.li@intel.com> 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/03, Xiaoyun Li wrote: >Enable an example for rawdev ntb. Support interactive mode to send >file on one host and receive file from another host. The command line >would be 'send [filepath]' and 'receive [filepath]'. > >But since the FIFO is not enabled right now, use rte_memcpy as the enqueue >and dequeue functions and only support transmitting file no more than 4M. > >Signed-off-by: Xiaoyun Li [snip] >--- >+ >+int >+main(int argc, char **argv) >+{ >+ int ret, i; >+ >+ signal(SIGINT, signal_handler); >+ signal(SIGTERM, signal_handler); >+ >+ ret = rte_eal_init(argc, argv); >+ if (ret < 0) >+ rte_exit(EXIT_FAILURE, "Error with EAL initialization.\n"); >+ >+ /* Find 1st ntb rawdev. */ >+ for (i = 0; i < RTE_RAWDEV_MAX_DEVS; i++) >+ if (rte_rawdevs[i].driver_name && >+ (strncmp(rte_rawdevs[i].driver_name, "raw_ntb", 7) == 0) && >+ (rte_rawdevs[i].attached == 1)) >+ break; Can replace above code block with rawdev API rte_rawdev_get_dev_id. Thanks, Xiaolong >+ >+ if (i == RTE_RAWDEV_MAX_DEVS) >+ rte_exit(EXIT_FAILURE, "Cannot find any ntb device.\n"); >+ >+ dev_id = i; >+ >+ argc -= ret; >+ argv += ret; >+ >+ ret = parse_args(argc, argv); >+ if (ret < 0) >+ rte_exit(EXIT_FAILURE, "Invalid arguments\n"); >+ >+ rte_rawdev_start(dev_id); >+ >+ if (interactive) { >+ sleep(1); >+ prompt(); >+ } >+ >+ return 0; >+} >-- >2.17.1 >