From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D2E08156 for ; Thu, 28 Nov 2013 11:46:01 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 28 Nov 2013 02:43:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,790,1378882800"; d="scan'208";a="443627456" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 28 Nov 2013 02:47:00 -0800 Received: from irsmsx151.ger.corp.intel.com (163.33.192.59) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 28 Nov 2013 10:46:59 +0000 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.66]) by IRSMSX151.ger.corp.intel.com ([169.254.4.126]) with mapi id 14.03.0123.003; Thu, 28 Nov 2013 10:46:58 +0000 From: "Richardson, Bruce" To: Tetsuya.Mukawa , "dev@dpdk.org" Thread-Topic: [dpdk-dev] How to know corresponding device from port number Thread-Index: AQHO6pCJMQM0WY5u70qJVbeTGrIi6Jo3UHkwgAD/nICAAiZu0A== Date: Thu, 28 Nov 2013 10:46:58 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B01A9781D3@IRSMSX103.ger.corp.intel.com> References: <529474D5.80306@igel.co.jp> <59AF69C657FD0841A61C55336867B5B01A9778E3@IRSMSX103.ger.corp.intel.com> <52954F27.3040706@igel.co.jp> In-Reply-To: <52954F27.3040706@igel.co.jp> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] How to know corresponding device from port number 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: Thu, 28 Nov 2013 10:46:03 -0000 > If someone wants to implement forwarding application that receives > packets from ETH_A and send those to ETH_B. > Also above application is split to 3 processes like following. > [ETH_A]-->Process_A --> [Ring_A] --> Process_B --> [Ring_B] --> Process_C= -- > > [ETH_B] (All 3 processes are implemented using PMD) >=20 > At present, to implement Process_B might be difficult or tricky because r= ing > can't be distinguished. >=20 > I guess all virtual eth device like ring and pcap should have MAC address= . > And It should be possible to specify MAC address from command line. > If so, DPDK application can distinguish all ports using MAC address even = if > port corresponds virtual eth device. [BR] Actually, the way the ring pmd is implemented is designed to take acco= unt of this multi-process scenario in a slightly different way.=20 Firstly, the ethernet device numbers used are always per-process, which is = why in the multiprocess case, we still do a load of the ethernet drivers an= d a pci probe on initialization of secondary processes. Any ring PMDs creat= ed by passing EAL parameters to a process are therefore local to that proce= ss alone. To use the ring-based PMD to exchange packets between two process= es, the APIs of the ring PMD should be used directly by the app, instead of= via the EAL commandline. The rings should be directly created in the app, = e.g. in process A, using rte_ring_create(), and then, if you need a PMD int= erface to the ring, you call the rte_eth_from_rings() API. Then in process = B, you use rte_ring_lookup() to get the pointer to the ring(s) you wish to = use, and again call rte_eth_from_ring() to similarly wrap that into an eth_= dev structure. (Now, it's also worth noting that you may pay a very small performance pena= lty for not using the ring APIs directly, since the ring enqueue and dequeu= e functions are direct function calls that often can be inlined by the comp= iler. Using the rings through an eth_dev API gives you API consistency, but= it means that the ring enqueue and dequeue is done via function pointers, = which means the calls cannot be inlined directly.)