From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1on0072.outbound.protection.outlook.com [157.56.112.72]) by dpdk.org (Postfix) with ESMTP id DDEF06CA1 for ; Tue, 7 Jun 2016 11:06:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RyjTmSzEULElXOHUalhSAEjgLfN+rcWh15P0pzLhPIc=; b=xIhWIn80Zw3ORnR9nL2/8fHaglgw/piG/A/+cWYWi8L8HMR0EaVo1J1cSAS0ziuZThK1hE7zAm4GduwsyIWSZhIR+XMhNqRBWQdBuFLGYKfJV5vlk27/TZMLhy6hS0aUN2fppdNj8PWrG9H9ll3aWpam4uyDfgHtRfdc3sEABgs= Received: from DB5PR0401MB2054.eurprd04.prod.outlook.com (10.166.11.137) by DB5PR0401MB2054.eurprd04.prod.outlook.com (10.166.11.137) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 7 Jun 2016 09:06:49 +0000 Received: from DB5PR0401MB2054.eurprd04.prod.outlook.com ([10.166.11.137]) by DB5PR0401MB2054.eurprd04.prod.outlook.com ([10.166.11.137]) with mapi id 15.01.0511.010; Tue, 7 Jun 2016 09:06:49 +0000 From: Shreyansh Jain To: David Hunt , "dev@dpdk.org" CC: "olivier.matz@6wind.com" , "viktorin@rehivetech.com" , "jerin.jacob@caviumnetworks.com" Thread-Topic: [dpdk-dev] [PATCH v8 1/3] mempool: support external mempool operations Thread-Index: AQHRvaht0RXQVWk8xkWSzpGmKHutFp/dsfMQ Date: Tue, 7 Jun 2016 09:05:51 +0000 Deferred-Delivery: Tue, 7 Jun 2016 08:35:48 +0000 Message-ID: References: <1464874043-67467-1-git-send-email-david.hunt@intel.com> <1464965906-108927-1-git-send-email-david.hunt@intel.com> <1464965906-108927-2-git-send-email-david.hunt@intel.com> In-Reply-To: <1464965906-108927-2-git-send-email-david.hunt@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=shreyansh.jain@nxp.com; x-originating-ip: [192.88.169.1] x-ms-office365-filtering-correlation-id: fdedec39-f3b4-4893-b522-08d38eb30f74 x-microsoft-exchange-diagnostics: 1; DB5PR0401MB2054; 5:JfxhuJrCaeIABEPDU88NEIE6/JLo6VCnK5Cbd7XuCUzCS25qPe0hRx2vu10FTfz6eT8dU8WumYeBDOg9ADw/vwNRHGf2r9Olbpw5ZIE/7RJr4ClPTyLUz8I5kGaGUpjue5Flek6ZSgp4hwD+3NgIjA==; 24:MEtDTH5vBwJDVs8PcQQ7w3/+32MikBeUzErbkEpf/R7ZgII/BKgPH1IU3SRsE5FF+i5KNt4JidxBQMBVmdfzI9PMUZmbpZXACqX31NygqHE=; 7:a+0nIbfHgLketP/NyDDs1sNyJYkKsK0msUflzR90kdd8aIexbDIYmuMZP874IxQdBOUD4TAwnTe+OAGNgqYIKgDIB+/SpzIxcm78blcQakI2eMjplHbWcCH4+6dBCus5tKVHPmw3wP3lFvtoCPWFhbWZSJzHWwOr3Y5rfFuccIZp+bDvLtaB9wfFlHaIvgglJwXorVKWGUZeYuy+/p+zOCSvNMLfeB21PPRUBrDtmQ0= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR0401MB2054; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DB5PR0401MB2054; BCL:0; PCL:0; RULEID:; SRVR:DB5PR0401MB2054; x-forefront-prvs: 09669DB681 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(377454003)(189002)(199003)(13464003)(5001770100001)(66066001)(33656002)(106356001)(106116001)(68736007)(189998001)(3846002)(97736004)(586003)(2501003)(77096005)(6116002)(102836003)(105586002)(10400500002)(2900100001)(2950100001)(87936001)(3280700002)(5004730100002)(76576001)(3660700001)(50986999)(54356999)(76176999)(8936002)(5003600100002)(101416001)(81166006)(4326007)(19580395003)(92566002)(9686002)(5008740100001)(19580405001)(81156014)(122556002)(74316001)(11100500001)(2906002)(5002640100001)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR0401MB2054; H:DB5PR0401MB2054.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2016 09:06:49.6468 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0401MB2054 Subject: Re: [dpdk-dev] [PATCH v8 1/3] mempool: support external mempool operations 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: Tue, 07 Jun 2016 09:06:51 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Hunt > Sent: Friday, June 03, 2016 8:28 PM > To: dev@dpdk.org > Cc: olivier.matz@6wind.com; viktorin@rehivetech.com; > jerin.jacob@caviumnetworks.com; David Hunt > Subject: [dpdk-dev] [PATCH v8 1/3] mempool: support external mempool > operations >=20 [...] > +int > +rte_mempool_ops_register(const struct rte_mempool_ops *h) > +{ > + struct rte_mempool_ops *ops; > + int16_t ops_index; > + > + rte_spinlock_lock(&rte_mempool_ops_table.sl); > + > + if (rte_mempool_ops_table.num_ops >=3D > + RTE_MEMPOOL_MAX_OPS_IDX) { > + rte_spinlock_unlock(&rte_mempool_ops_table.sl); > + RTE_LOG(ERR, MEMPOOL, > + "Maximum number of mempool ops structs exceeded\n"); > + return -ENOSPC; > + } > + > + if (h->put =3D=3D NULL || h->get =3D=3D NULL || h->get_count =3D=3D NUL= L) { > + rte_spinlock_unlock(&rte_mempool_ops_table.sl); > + RTE_LOG(ERR, MEMPOOL, > + "Missing callback while registering mempool ops\n"); > + return -EINVAL; > + } > + > + if (strlen(h->name) >=3D sizeof(ops->name) - 1) { > + RTE_LOG(DEBUG, EAL, "%s(): mempool_ops <%s>: name too long\n", > + __func__, h->name); > + rte_errno =3D EEXIST; > + return NULL; rte_mempool_ops_register has return type 'int'. Above should be 'return rte= _errno;', or probably 'return -EEXIST;' itself. > + } > + > + ops_index =3D rte_mempool_ops_table.num_ops++; > + ops =3D &rte_mempool_ops_table.ops[ops_index]; > + snprintf(ops->name, sizeof(ops->name), "%s", h->name); > + ops->alloc =3D h->alloc; > + ops->put =3D h->put; > + ops->get =3D h->get; > + ops->get_count =3D h->get_count; > + > + rte_spinlock_unlock(&rte_mempool_ops_table.sl); > + > + return ops_index; > +} > + [...] - Shreyansh