From patchwork Tue Jan 30 14:57:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 34724 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B20331B697; Tue, 30 Jan 2018 16:25:10 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0070.outbound.protection.outlook.com [104.47.34.70]) by dpdk.org (Postfix) with ESMTP id D01A61B38B for ; Tue, 30 Jan 2018 16:24:50 +0100 (CET) Received: from BN3PR03CA0085.namprd03.prod.outlook.com (10.167.1.173) by BLUPR03MB1411.namprd03.prod.outlook.com (10.163.81.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 30 Jan 2018 15:24:48 +0000 Received: from BL2FFO11FD044.protection.gbl (2a01:111:f400:7c09::150) by BN3PR03CA0085.outlook.office365.com (2a01:111:e400:7a4d::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Tue, 30 Jan 2018 15:24:48 +0000 Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD044.mail.protection.outlook.com (10.173.161.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Tue, 30 Jan 2018 15:24:46 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0UEh7sg023996; Tue, 30 Jan 2018 07:43:19 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Tue, 30 Jan 2018 20:27:02 +0530 Message-ID: <20180130145710.24757-4-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180130145710.24757-1-shreyansh.jain@nxp.com> References: <20180123135910.10755-1-shreyansh.jain@nxp.com> <20180130145710.24757-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131617994879300118; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(6346003)(76176011)(68736007)(81156014)(97736004)(81166006)(8936002)(77096007)(59450400001)(86362001)(26005)(51416003)(106466001)(336011)(8676002)(48376002)(50466002)(105606002)(2906002)(316002)(305945005)(54906003)(53936002)(1076002)(47776003)(50226002)(2351001)(6862004)(4326008)(356003)(16586007)(498600001)(36756003)(104016004)(6666003)(2950100002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1411; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD044; 1:dQAmfdQUTW/RIi770QpMeB3nbIUKBdGd7d6DsQsm6vHIeHiUpFpv6A9eicKTQ+NgOWVbK2q4IbDhUcqxXv9BvNu4oWacS/y3ICfYFjVpCVGld3M6qsRepGL+4RsetFEb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc47da98-2e0c-426b-05ad-08d567f59936 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB1411; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 3:g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2N+4J99dIZcICCLPfisG5CoXPinnFI/bg8MmhxZ94z6/0eqlSli4UrMzbphLM4qJzH+5zdp7YBFPP1/HHfX/vBo/EYV/cUusvZh8uOb3JqyNfPQb+xh9/xMFZD4bHW7/r/6NDz0Z7V/6fNZpeev/04QeZTGfVY+tqiGmBbw6ukvMqMzgLlvIpk4zeuREut+7UMTWJeT8a/gj81PyMMuOeAhXjHn/abk/rOJB7/jdSFicmw4wW9Ki2w7WczJEobCSj/xp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(20161123556025)(201708071742011); SRVR:BLUPR03MB1411; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB1411; X-Forefront-PRVS: 0568F32D91 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1411; 23:txcF+1g7LeTLNAx+Hrfq85CdCwGHsm41kfJVSfXCE?= O+Su/FQzCLeOA+gxGzYhSg6uoL6RHN7xMPXWlQ2/FhyyGfuxCGPyjn9TS6ZMdQTxQpbZ6T5T19Eyag7qkzeEDfeHwFWuildcFJkg1vsjtDqWLRCDmFhdoJX7QTAmoPz7lHyg89BaOsdwoNhL9NE0ULj25CfPVUCdFpeQxRJm+uFfNJgwe1fnjAbrSJhUIoGvYZPqT/8dWA3A/2exTRSZzndRq6j0IWfrzl5deOXN5QbMctj90TMPveJw5yqEV3y/ngHajbg4URIo+niYEn7E902bQSBnxplgY4QnrJdBNDZJ6pcZG3sNVuErUbvEZemqErFssDslNfMS2R22NguYZbblIOW2w0te+WFFnpoQlwOMLssGwH63YsBuChIWY2l0pz5Ih5pXx6c4pN3utCKqDDfgt664omBfNk4Sw38RFB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:hHBA9e1piLs1/LVGufGluR7rvHcI/Dwj6655RHlM5LI458UwiGde8hrvOQ4NIUxXCewSaJaR8WQwjQMYMRqDooILD/C0b4qiS2wZC3EJvIZhcPMwpSvwBJjChloCal7YtN9FEP/VOViCB8UOj40wrZG/6Lqk+BWOJR6CfnK67Rs=; 24:G8lC68eduqWIaiumNLYClRfBMfAojJuwoza1CeaLevrcBaPXZFIKDj3q3dLCYjjWGKl6kkp81Svx8tWuFk6EjeTeeAnyx4H3OgwYEsPb1cY=; 7:EGcKzuGLaWjJGaM/hOIGC/AC4EVyxHb0CQZmbOzdnxCBPRMwwX4NSiOEq8ie4LBiGSZZNixCuzxADW7hLZjZkEV/OxyntMsd8HdZg0XwfnGgRmSIpvlemc4AlAkxdvcJB6fsO5BLbq8p9uxKmVJrXlhMEJ4SUXEqOvUNL8UubZj9Gu+34ZSzaxoj2ss3R61BKgKvC6t/FP5Vb9oOAkTHCgFHebC6deIjOHFWt6vgmGi6IuknE7/Zyl3tENnYBMkc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 15:24:46.6196 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc47da98-2e0c-426b-05ad-08d567f59936 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1411 Subject: [dpdk-dev] [PATCH v3 03/11] rawdev: add buffer stream IO support 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" Introduce handlers for raw buffer enqueue and dequeue. A raw buffer is essentially a void object which is transparently passed via the library onto the driver. Using a context field as argument, any arbitrary meta information can be passed by application to the driver/implementation. This can be any data on which driver needs to define the operation semantics. For example, passing along a queue identifier can suggest the driver the queue context to perform I/O on. Signed-off-by: Shreyansh Jain --- lib/librte_rawdev/rte_rawdev.c | 30 +++++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 58 ++++++++++++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 58 ++++++++++++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 2 ++ 4 files changed, 148 insertions(+) diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index 08dd982a4..a6d937c34 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -203,6 +203,36 @@ rte_rawdev_set_attr(uint16_t dev_id, return (*dev->dev_ops->attr_set)(dev, attr_name, attr_value); } +int __rte_experimental +rte_rawdev_enqueue_buffers(uint16_t dev_id, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct rte_rawdev *dev; + + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->enqueue_bufs, -ENOTSUP); + return (*dev->dev_ops->enqueue_bufs)(dev, buffers, count, context); +} + +int __rte_experimental +rte_rawdev_dequeue_buffers(uint16_t dev_id, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct rte_rawdev *dev; + + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dequeue_bufs, -ENOTSUP); + return (*dev->dev_ops->dequeue_bufs)(dev, buffers, count, context); +} + int __rte_experimental rte_rawdev_dump(uint16_t dev_id, FILE *f) { diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index bfcbe1270..b4f9aee37 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -350,6 +350,64 @@ rte_rawdev_set_attr(uint16_t dev_id, const char *attr_name, const uint64_t attr_value); +/** + * Enqueue a stream of buffers to the device. + * + * Rather than specifying a queue, this API passes along an opaque object + * to the driver implementation. That object can be a queue or any other + * contextual information necessary for the device to enqueue buffers. + * + * @param dev_id + * The identifier of the device to configure. + * @param bufs + * Collection of buffers for enqueueing + * @param count + * Count of buffers to enqueue + * @param context + * Opaque context information. + * @return + * >=0 for buffers enqueued + * !0 for failure. + * Whether partial enqueue is failure or success is defined between app + * and driver implementation. + */ +int __rte_experimental +rte_rawdev_enqueue_buffers(uint16_t dev_id, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + +/** + * Dequeue a stream of buffers from the device. + * + * Rather than specifying a queue, this API passes along an opaque object + * to the driver implementation. That object can be a queue or any other + * contextual information necessary for the device to dequeue buffers. + * + * Application should have allocated enough space to store `count` response + * buffers. + * Releasing buffers dequeued is responsibility of the application. + * + * @param dev_id + * The identifier of the device to configure. + * @param bufs + * Collection of buffers dequeued + * @param count + * Max buffers expected to be dequeued + * @param context + * Opaque context information. + * @return + * >=0 for buffers dequeued + * !0 for failure. + * Whether partial enqueue is failure or success is defined between app + * and driver implementation. + */ +int __rte_experimental +rte_rawdev_dequeue_buffers(uint16_t dev_id, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + #ifdef __cplusplus } #endif diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index aa67c4f39..da891dc4d 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -248,6 +248,58 @@ typedef int (*rawdev_queue_setup_t)(struct rte_rawdev *dev, typedef int (*rawdev_queue_release_t)(struct rte_rawdev *dev, uint16_t queue_id); +/** + * Enqueue an array of raw buffers to the device. + * + * Buffer being used is opaque - it can be obtained from mempool or from + * any other source. Interpretation of buffer is responsibility of driver. + * + * @param dev + * Raw device pointer + * @param bufs + * array of buffers + * @param count + * number of buffers passed + * @context + * an opaque object representing context of the call; for example, an + * application can pass information about the queues on which enqueue needs + * to be done. Or, the enqueue operation might be passed reference to an + * object containing a callback (agreed upon between applicatio and driver). + * + * @return + * >=0 Count of buffers successfully enqueued (0: no buffers enqueued) + * <0 Error count in case of error + */ +typedef int (*rawdev_enqueue_bufs_t)(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + +/** + * Dequeue an array of raw buffers from the device. + * + * @param dev + * Raw device pointer + * @param bufs + * array of buffers + * @param count + * Max buffers expected to be dequeued + * @context + * an opaque object representing context of the call. Based on this object, + * the application and driver can coordinate for dequeue operation involving + * agreed upon semantics. For example, queue information/id on which Dequeue + * needs to be performed. + * @return + * >0, ~0: Count of buffers returned + * <0: Error + * Whether short dequeue is success or failure is decided between app and + * driver. + */ +typedef int (*rawdev_dequeue_bufs_t)(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context); + /** * Dump internal information * @@ -321,6 +373,12 @@ struct rte_rawdev_ops { /**< Release an raw queue. */ rawdev_queue_release_t queue_release; + /**< Enqueue an array of raw buffers to device. */ + rawdev_enqueue_bufs_t enqueue_bufs; + /**< Dequeue an array of raw buffers from device. */ + /** TODO: Callback based enqueue and dequeue support */ + rawdev_dequeue_bufs_t dequeue_bufs; + /* Dump internal information */ rawdev_dump_t dump; diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map index d63476e47..bafe2c5de 100644 --- a/lib/librte_rawdev/rte_rawdev_version.map +++ b/lib/librte_rawdev/rte_rawdev_version.map @@ -4,6 +4,8 @@ EXPERIMENTAL { rte_rawdev_close; rte_rawdev_configure; rte_rawdev_count; + rte_rawdev_dequeue_buffers; + rte_rawdev_enqueue_buffers; rte_rawdev_get_attr; rte_rawdev_get_dev_id; rte_rawdev_info_get;