From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0089.outbound.protection.outlook.com [157.56.111.89]) by dpdk.org (Postfix) with ESMTP id 9AF7BAD96 for ; Wed, 8 Jun 2016 02:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=studentuml.onmicrosoft.com; s=selector1-student-uml-edu; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=drynAPDY86HUZcXWrLwkNwiRZIODAHToP4m7zhQcufo=; b=t9MXy2HKRplAupwD6NeATS4xZuWzICzV08L+J7NyAyRp02TRzZiD1VGpW8DeTAIDcIIl7gicXsasXpOCo+VUEhukSqQzjmbDO88WZzu2HQE6tYad3tSv+EEWihKcxmiy9HV0k5I7i+ILnCngWJxcgwTI/qQ8FOfqHioGBZEIicg= Received: from CY1PR0201MB0827.namprd02.prod.outlook.com (10.160.141.28) by CY1PR0201MB0825.namprd02.prod.outlook.com (10.160.141.26) with Microsoft SMTP Server (TLS) id 15.1.506.9; Wed, 8 Jun 2016 00:12:44 +0000 Received: from CY1PR0201MB0827.namprd02.prod.outlook.com ([10.160.141.28]) by CY1PR0201MB0827.namprd02.prod.outlook.com ([10.160.141.28]) with mapi id 15.01.0506.014; Wed, 8 Jun 2016 00:12:44 +0000 From: "Wu, Xiaoban" To: "Wiles, Keith" , "users@dpdk.org" Thread-Topic: [dpdk-users] A question about the function __mempool_get_bulk() of dpdk-16.04 Thread-Index: AQHRwP31t+1kYC5IZEeQKPdLBGYLbJ/elmEAgAAGNbw= Date: Wed, 8 Jun 2016 00:12:44 +0000 Message-ID: References: , <506DDABB-6DFC-4FEB-8A8D-43B7AA2EE251@intel.com> In-Reply-To: <506DDABB-6DFC-4FEB-8A8D-43B7AA2EE251@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Xiaoban_Wu@student.uml.edu; x-originating-ip: [25.164.65.132] x-ms-office365-filtering-correlation-id: 9328ee17-6d1d-4a10-22ea-08d38f319d77 x-microsoft-exchange-diagnostics: 1; CY1PR0201MB0825; 5:/1oDV1Pyp2xLag5L/h9Emy48zBOzpFZS4RttzL+gfzB8ZEoi8L8+/9ZOZf34I+FQLaTjba1mGumjcLcdU+smHUoBcbLiRtP84k3RE/lEdeqpsn+TCCsyZHpnlTel/QLhZoKHwtRFwwwHviWXdR04Sg==; 24:qg1BwJvZi2Dr/qsuuvTNi4tYbmUcgOMTEEdDk3utrbfg1YafAXBRE0CLTGendk6JWmiArkb+xHbMcagHIp9/BCSKC+xWK1seye1LfKrEe9g=; 7:NiXaEOMYJYwo8BAL/VqH48JdxY0wtNHmWAZIioCmrZBo9ouCliCDR1SIexRE/PhpRfy7z2gDOFcFKZVVRYvzWG9CZaooJmzEE8fgWOTbCK0P6N/FrN3b/y6iFv/Pk4n04J/6EkQ2ByktLHBC2KwrXzumfyQwVQ7nGfx1/Wqkv9M2h9guiuVKZiCd0CAJUcvbINcGqxGvIg3A3NkE6Z5akTjbhSFb+J90rUKT7HhBLG4= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB0825; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(192823040165218)(269151656437849)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR0201MB0825; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0201MB0825; x-forefront-prvs: 0967749BC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(24454002)(189002)(199003)(377454003)(2900100001)(122556002)(77096005)(68736007)(2950100001)(107886002)(3846002)(106356001)(106116001)(92566002)(97736004)(89122001)(99286002)(33656002)(105586002)(2501003)(66066001)(3660700001)(8936002)(3280700002)(74316001)(10400500002)(5001770100001)(88552002)(76576001)(8676002)(101416001)(5004730100002)(2906002)(50986999)(19580405001)(76176999)(9686002)(19580395003)(189998001)(11100500001)(5002640100001)(54356999)(6116002)(81156014)(586003)(81166006)(87936001)(102836003)(86362001)(5003600100002)(5008740100001)(75432002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0825; H:CY1PR0201MB0827.namprd02.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: student.uml.edu does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: student.uml.edu X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2016 00:12:44.3153 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4c25b8a6-17f7-46f9-83f0-54734ab81fb1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB0825 Subject: Re: [dpdk-users] A question about the function __mempool_get_bulk() of dpdk-16.04 X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 00:12:48 -0000 Dear Keith, Yes, I see the checking for 0 in the pktgen codes. Maybe it is more clear i= f returns n like the wirte() in linux, but it also means a lot of codes nee= d to be rewritten. As long as it is consistent and we know how to work arou= nd it, it should be fine. Thanks so much for your reply. All the best, Xiaoban ________________________________________ From: Wiles, Keith Sent: Tuesday, June 7, 2016 6:30:24 PM To: Wu, Xiaoban; users@dpdk.org Subject: Re: [dpdk-users] A question about the function __mempool_get_bulk(= ) of dpdk-16.04 On 6/7/16, 3:52 PM, "users on behalf of Wu, Xiaoban" wrote: >Dear DPDK Users, > > >I have been reading the pktgen-3.0.02 source codes with dpdk-16.04. > > >In the pktgen.c, function pktgen_send_pkts(), line 1098, it calls function= wr_pktmbuf_alloc_bulk_noreset(). Then it calls the function rte_mempool_g= et_bulk() which calls the function __mempool_get_bulk(). > > >Since in the function rte_pktmbuf_pool_create(), the "flags" is set to zer= o in default, this leads to that when calling __mempool_get_bulk(), the inp= ut parameter"is_mc=3D=3D1". Hence the function __mempool_get_bulk() will ex= ecute the line 961-992 except that when "ret" is less that 0. I checked out dpdk v16.04 and could not get your line numbers to workout, m= aybe you are on a slightly different version then release 16.04?? > > >My question is why at line 992, this has to return 0? In the line 941, the= comment says that ">=3D0: Success; number of objects supplied." I am conf= used by this comment, since in line 985-990, we can see that the input para= meter "obj_table" is supplied by new values and the number of the new value= s is "n". Does this means that we need to "return n;" instead of "return 0;= "? The statement =93>=3D0 number of objects supplied=94 also confused me some,= but routines rte_ring_mc/sc_dequeue_bulk() returns zero on success when al= l requested objects are return not the number of objects returned. It seems= it would be nice to have the number of objects returned, but as it is alwa= ys =91n=92 it is best to return < 0 on error. The _bulk allocate will not = return a les then =91n=92 objects, this is why the code in pktgen tests for= zero and not something greater then zero. The code in pktgen could test fo= r ret >=3D 0 but the results are the same. > > >Am I missing something here? Thank you so much for your help. > > >All the best, > >Xiaoban >