From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0067.outbound.protection.outlook.com [104.47.2.67]) by dpdk.org (Postfix) with ESMTP id EBAAFAE04 for ; Wed, 8 Jun 2016 16:30:07 +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=5qXUftvIy2MVoHwqn2iuLGbRyOQ0Mi2QkwXCpylqm5Q=; b=agAIM2TJ6qiOiDF1Y/qqbwCu8PmXNScAWCTvn8iWDWAHblxzIYaSU2OHvDJtpT8eHR2J7oUSsZ/b+G5QZkmzLV+JZGCE60fb1MmBO6TGbu3yPztcvf2aVMcPscjDdOrkd0vSd37TdqVAnx7Z3uI9gJ/7ms3gSLF+WqGMjqjAfW8= 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; Wed, 8 Jun 2016 14:30:05 +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; Wed, 8 Jun 2016 14:30:05 +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/fp4SA Date: Wed, 8 Jun 2016 14:28:55 +0000 Deferred-Delivery: Wed, 8 Jun 2016 14:27:21 +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: 1dd7e799-1680-4361-52a7-08d38fa962d1 x-microsoft-exchange-diagnostics: 1; DB5PR0401MB2054; 5:ujkGOwmEl2zxCRcHnQOtJh9ViA3E7bRjcMONaoHMyziduK7h97yj3cUzkvrMauf6q/kGQefd2644ClTRRAxUkehsPSA3J1g4obqYwcM6gtyn/9NCcflCt1QkBpPtFlSWNboi+MwsxDdbK7VzO0OyQA==; 24:ghgUMXJZqukKfUQbUf4wtMQ2Fw5psP8xHWexiTRV4h/Hvfv/qQkGqmwaJ2K3uZ0H36m2F91o5mxw6rA1l9Kykew7/1+WHGsL+Uhc5RhydyI=; 7:ITshH42r+hNZGuMNsxECmnj+Jp7mF913Sm8Exnd72XracGV1THJEGE6wCUKSmCpNsbeWDNQbG0vEBlqUJ63nwqNmycQ6MVMcXMmISMgNu9xfrUtuh+s01/VO0ME7akBTNsE8f6mNJqcApyrRCf9ofyP4ZGOrcWjlYErDJwf09Lbcqg6gpionDv9+gpGxWgYvuUbRdFn2NmXAxsiD4ouxxmRaI0uGxFQlSrCfSxBB6xE= 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)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:DB5PR0401MB2054; BCL:0; PCL:0; RULEID:; SRVR:DB5PR0401MB2054; x-forefront-prvs: 0967749BC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(377454003)(13464003)(76176999)(54356999)(50986999)(3660700001)(5003600100002)(3280700002)(5004730100002)(87936001)(8936002)(101416001)(74316001)(11100500001)(2906002)(5002640100001)(86362001)(122556002)(19580405001)(5008740100001)(81156014)(9686002)(19580395003)(81166006)(4326007)(92566002)(76576001)(586003)(68736007)(189998001)(105586002)(66066001)(33656002)(5001770100001)(106356001)(106116001)(77096005)(102836003)(6116002)(2950100001)(2501003)(2900100001)(10400500002)(3846002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR0401MB2054; H:DB5PR0401MB2054.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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: 08 Jun 2016 14:30:05.7939 (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: Wed, 08 Jun 2016 14:30:08 -0000 Hi David, Sorry for multiple mails on a patch. I forgot a trivial comment in previous= mail. > -----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) { I think 'h->alloc' should also be checked here. > + 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; > + } > + > + 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