From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0065.outbound.protection.outlook.com [104.47.1.65]) by dpdk.org (Postfix) with ESMTP id 9B31E1B73F for ; Wed, 31 Jan 2018 09:59:01 +0100 (CET) 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=QR+kGLJP1mRDuMiZOxotGVaDdq80ua+QpwUgs7Qh+YA=; b=SmTVrKJjDe2NxNrYaagZclT3djMisEUL63qrivUut6RDxepSSPhV/8iTY9qKlAzkEm0rqR6Ra5Q/wHZ1OyxApPu3A6OKgsyqkub6IOxSrT5cqLVBxv33SNLpooM48xKFeKjFoVO3UKVlq0mv1uesaGae6iELaXx/uNwiXQ0Ztl4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from Tophie.ap.freescale.net (192.88.169.1) by VI1PR0401MB2462.eurprd04.prod.outlook.com (2603:10a6:800:55::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 31 Jan 2018 08:58:55 +0000 From: Shreyansh Jain To: thomas@monjalon.net Cc: dev@dpdk.org, hemant.agrawal@nxp.com, fiona.trahe@intel.com, rosen.xu@intel.com, Shreyansh Jain Date: Wed, 31 Jan 2018 14:43:11 +0530 Message-Id: <20180131091318.7894-4-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180131091318.7894-1-shreyansh.jain@nxp.com> References: <20180130145710.24757-1-shreyansh.jain@nxp.com> <20180131091318.7894-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.169.1] X-ClientProxiedBy: HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) To VI1PR0401MB2462.eurprd04.prod.outlook.com (2603:10a6:800:55::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 036f2b3f-42ee-4202-7a83-08d56888ddca X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0401MB2462; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 3:gPfQ1idcEPkdhP06jCXJsKv8NSMXTmELXJ1lS94Xpg6f0euusH///FLopj31YiKGG2YBYf7G1QRk32Mc1oufsggjF2NCNsWXaWwEvNeFVhk73cBXjxd6ibIcsY6uy8/XTChfeH0J46UpWEkAUQyQ5NudMqEqdooI4YihoYKpHdbxsDlFD1OeAg4PqWiAoZ7VWVC+7PACtYrebaW17+xyypLt0Gvh4btwrRW9Rv1KW4A/8uwJKFHQbf5D5JyZV+vd; 25:QrohXGQsWexOC3/VkSH5DIU3Nah0wwmNoyuTcUshT0a6h4xD9dLk4EoL/6Q9sOmmhFv9LFBe0WuPiLw2OFChArK9YHMvLlpsTUTKik/lo7qSal+8UAaRPweWWb6/kU03mrDCU78tEhsX254kClEuGsST56P0Dua6ywnMlOHIzLoXz662SHHBkDepIdjizQIFuQ3eM7cI7Hv0kg0/z0plJ7lFUVeXdwBzgiBOLnxVkIORCagvmxxVxIE+lIzBogRhYOJAfVtKE+4AsScLbNLEX4cxAHQpAgj0H/ZHQ64ZVdxGBtQc/hbSl8EXCZ235BZUubJ86FgKId4duYNGDm/k2A==; 31:eQm2rWy5v4C4VnCixRXQ+dmLesNmt6YD77By+roKsWYqGRXr/M5dNo+G+CGhDjT9O0XKVvANmSNK07N9VlPOVr0SDuu46VtCTV9fTs9Lj3FVP4dM3+c0tlgpvASRbbuhkZqcfb4GrBwtkKREAdqm0h87s7E7tUXkLkJUEYB2bLcLbDkJCaAxVhtrG11EFFF8bcq9iq85bC5/SPueiVoaXkkuGtDCjS3hofw5f+Do8Lo= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2462: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 20:kfZLgkxrt6OUb9YLb8OKXHBOIGFNUVeYnye0Jx5oDwBtXhii8+J3W1NOnp2IFcu2i0CmE3IlXtptOPv5xCVOpxuK4eAESkj5u74Q2V4YopsVjMGeUSp36APIrkOAcIR6a38XPMTh7p/R+iTbHmxD8vOnNAPTUCl6BheJrW02Fv7Ly53X5jk0QqiX9aXP3CJleiN/HPzYIYbRZeVU7mSY1WD2Hn49T9nhRfAAcqt6PgrXcDxQrkR1H41io03nD24DIHAbfvXIa/7uIpbGZM3EhCfgUaVeLrui+9UevZ5HhXktQAaLFV58EvtAY9tdPkbAM9ausucfgm2a2Sv0pD2XAcDf8IGVikvcS6rJYdAQNWi+894JfYUJGm7K138/BAu87haWMHjyOjqptllQER3uV+PWZiD/AOUtGhPkZDOkugigwAC7XbuAprbWXzC3hQaknzPxDdNKyk9KkwlWFWxgxAhTvjYlAJEwZf4WCbTIfNTIkzGTlUXELDul5WOxBmFg; 4:Qg9jUC3DVk8/loAscSWKVTNnMig9tumS5RXjsJ+r4Dpxag7OTMzmPbg3GJMq4s+tce4hyLZHyY3SZLaIZXJk8sEDXicGSIANGH+e0PAsEzxFju+f4GWKQ0qG8n2bOqCQE9j6KZr4e5m5zp8gwDZGxeFwP0e64wncUUN6hM49QY+MolKinAn57zAKHyowlFZ2uxdyqlJICr7iQNim70pRLHk1U9XqDZAHfh/q7H2/8E/06g5Th2rXgcm/w08/a/NNtB1YY40Rssv1TOEcU/MQvQrsjlWTsHEhML0w8EFZNmabfMJbF1GFr6cLK+DKRMys X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(3231101)(2400082)(944501161)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0401MB2462; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2462; X-Forefront-PRVS: 056929CBB8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(366004)(346002)(39860400002)(199004)(189003)(6486002)(6512007)(50226002)(8676002)(48376002)(4326008)(81156014)(316002)(8936002)(66066001)(6666003)(2950100002)(81166006)(6916009)(53936002)(16526019)(5660300001)(47776003)(186003)(26005)(106356001)(2361001)(97736004)(16586007)(305945005)(478600001)(51416003)(386003)(36756003)(86362001)(105586002)(68736007)(2351001)(76176011)(1076002)(52116002)(2906002)(6506007)(25786009)(3846002)(6116002)(50466002)(59450400001)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2462; H:Tophie.ap.freescale.net; 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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB2462; 23:JuVQXBpOnRNBwYvhQY3hLCipnSDDtz9uoF9wEKC?= =?us-ascii?Q?IXuqRB2XxJ9qgT6xFvuEcQ8l1m0wtyu3yvO4LND3DBBpGghGUiD6EYZFjTg7?= =?us-ascii?Q?xGeBDnsP9JOG15Yg3ZbWap2lBw7Y6KzAZCo0if+vU+K5c5CrFFUqC/zeb5CN?= =?us-ascii?Q?c071HctFX0aP6MuUaPOl1FvX0R4b//Bapl28MbWB1btQ51EKiLichhqsTvWF?= =?us-ascii?Q?URU9FObIVlMhqoN4ZFfCcWVQWQteQhH7iNmLobdyYVs3fAhS1OCyST9Cwrnx?= =?us-ascii?Q?0rtc+Xbv4nrg1b56f1olcmH9DuG65LBWyJx486RYvYMOvoAe1LQtghoD5QeB?= =?us-ascii?Q?df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1PR0401MB2462; 6:whAfThQ21m+anIU9eVuiTM9YBEChTQNsouibaZbALCnSBWd/ykg3Yhy0vxEdQQzvah2EQ7savHWuh7iddQn6dmUTGrChbensJ7cdmHKcodBOqu3YEc1JWTBLg439412U8040qO1i2EjOlSLSNGCFyzlnaS1D+ZvcWSQWNSwrpDHHU7zJTG9RQBESKAey69+3a2c+emz+IXFO0E0ivXbEPQTYmWhPJmszf4Hp203SJcY4w/1AoLLuHhCI8beYW75zXhE7B8X51FNk3lajPC7RTfCrY3YfZv63VXpTR8HftDEqREXnmVBgxBKSxwoAdYgnmJ9m9ryPj7PYix9CmvMeD+cvUZzXrvLEG1m9anAChaQ=; 5:6zdjbRoOVbIHQYGA5USA7idX8AkwBHALLlJFHVil4++uoyIAuNQqeDdX45hRhJLBXaJ3TAqrWAHjsSWXHwX3UDSt2N7GeUPaQzduAyZNmtdlRDbCMrHJwvtWxUOsN18y4f3EN8gjxfyymnLajNPp7xCkLlBK3FgKGaofCi0D53A=; 24:yQXGUuHopWoKiQzYMKHBx/4Pf0gAudP9kF7LdNOXHb+3s7GwKSsItPviZJ4290HQEB/G3GubMmmY+NGYAMEkwGSzTx6Bgm9XfoH07gwLb2c=; 7:AHz4OgDtAs+Q9kAB0ogLc+VavsTLQ4NEObzg4NS5y8K1Wx25Ik/RXy5NwkLdijGzKaYr9xQfDKlkl6v0WXagMRjJ8cLasFMv7jALbd7CI37Dr4XcVB5UvpMVgtXk6hoT+ntUN6xscwf0VLKSwgnlNLAahm3SaAUNEyfdL75hzIC5FCT6rKKp7m6xCxO5f+dlDSTfJ2Pyrx6rbCJfjuj6ZU44l38fy+2CyBACSuHu+kTUOwMO6mP1281qW0/wQqvx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2018 08:58:55.1793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 036f2b3f-42ee-4202-7a83-08d56888ddca X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2462 Subject: [dpdk-dev] [PATCH v4 03/10] 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: , X-List-Received-Date: Wed, 31 Jan 2018 08:59:01 -0000 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 a58abc3ca..3820ff08d 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -362,6 +362,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 3e643691d..fe9cc6722 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -250,6 +250,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 + * @param 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 + * @param 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 * @@ -323,6 +375,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; -- 2.14.1