From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0053.outbound.protection.outlook.com [104.47.1.53]) by dpdk.org (Postfix) with ESMTP id C0D231B748 for ; Wed, 31 Jan 2018 09:59:12 +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=lvNMetzDmbzsP3ypmtBYW09Bp7mueHSgGMCTMX5Sw8k=; b=AIBbihfNBaSS8yHn0MXTcuqlelRszGvBvifcJFDew5u9GW881JAHew90r5kmhgCxQzSpiWgMFqJMK74SDmEA+qPchWjdw/hj2DdL7+uVKZcidE4gKwGXuokRYo/Vws2pNg8AiZZgc80YCYEQRkwBQoKW3FaL5FeshZsGbm8jeiA= 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:59:05 +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:13 +0530 Message-Id: <20180131091318.7894-6-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: 5caeb705-d88e-4b2a-0b36-08d56888e42e 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:v8gpD7a3czVhw1L/p6ZbVjqEBium2XEKOa4nrEdrYLhi0KSOd/6D72J9S4zW5+2xEGnh4r2+4OWV81HayB3Ga7rnb95B0k64LiWC15Vpm6N9SIcgoxv4hC2/16tYOMyM2TSj8FIyfgiglPAx5rpKHGXFUTp4AI2yTprOKiCxH0SahT4xh2qyMHmuYz0Wk3nwPTaXeY5ik7sIEZdEGqOj8dt3r2gAjGcMy8bnZ5ro715WXw3G2PTY1R0bHeO5nRvu; 25:XceqBL/Z9gyB+ZCD+mXqIRu7cFcGkmTulBakXPZ+6I2jSXd8eyJ7m7p4NmZW2tJQs5qsTC30WI0uZwQPdb5EekA1nQqBukC+Nz70Tl4Xi3+/EieNBR0bbEdYMzZVzEJ2Lgv871PVkIqicSvYW8tqRJh5nE/u+w68FzR3sJpHlz7TTTqplTq5M98FmPdA2+vTNDXUvnQRpE4rH4h+5beq9tOb2KSTW1iYoYfmnLwZE0tQzsUj0Um2D0z2u/5EZZXZu9NurkrQfcN+X9Rm0r3JNDWz5KIDOcsxAd0y4na0tH37WN7f6EezpTymRn8s/n2morYm6+hRa0Kks6nUxfzMcw==; 31:/thsOV9Run0jN/HMItEZR40lR+b5/cynEx9aKNUa0OmbnoRyZRBlA+S5I+C+4ibjqmcJ9MwpHdlX24nfJ6tbVMbB+2nmsF1ew/B9KlhheNPWoYfgmymmf1Cuk2VaTncq3kq9SzwvICZlIiFCFBqhXzKsir1EwJ0R9EJjjEJqFHrhUqDwQubOVNcPQg2sBoesL5DuY8WePi9H8yF7oiNP+aHp9sy8V+WwoyWzdlQCN3Q= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2462: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 20:emrycgADFJRMbFO1drMjxNQjfW02t8mYUDVc00SX8me25Wf3iAL1sMeTcPttLp9GxpuLJ0xNShyjpn5AsQkFCHFwOCEqNEzDbooF/xMTm62t/N3T/KFRlTn6ADtvH0/rXH12mbnOzgDT2KZZhJPBfmJslN3OG7GYfWi4/tz4dnPSEZ6OA7lGS72Fl09RWDmmYjcDIlDqnDauRdEW0gqjEtgPqPZjPpO8qv+jrbbQAskL/cPh6kIyD4KYeQ4HkIcg5d6wKZkWlOpYPyrEzd9FubLO+1ZJr4PWORUZna1D2K1DB76+p4DqFdvfbWyp68sAv0u9lst8FL8Sg98zjWrMDEpXL00LjQYeCG5FIpsXpslbx1iw/S2E1MQk28CXcawW3/vPRg7PE/QUVNHSQmoiXSDnoqxyGm7E+uc7BWITuYdsv0+n0t4SzSlg5jO4YZqGnzGlWCRlSlp7VvGn5kv+K1QFt4umLwez+C+9x+P9idNLur9UI65kmlhC6/us0TMp; 4:at2s3sUaqjs03yf/kAyEfP5YHNPJ1Of3lCYKEywWVVSOGpVb5I80YgwpyxhUlUj2TPt07Mk76+xAuqifEjmo3eqvUryb798H8h1xyNH+mmznz5XvyFQrDwHxFxDI4YAU2mPscWwPQKacy7RxKcbWUyd4vpx6pkQFOt9ZBp9DnK3S96Nt/dWIfaVQP/bBA8bJ6sp4U/mx9xtlfHBUkuBKDxAqzJ3Pa9AjyW5xihYLkFiUwiB+LkuIPki11W/DoxXKHsbzH7566UyMRE5Pu6fbhqJCB+2vRhu/StGV0LMnq2LZscOfh7hNypOuRBdplmbb 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)(575784001)(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:84Y4KvVjjKn5K+fowFdSQuOAUCz5oxHYnkeUAak?= =?us-ascii?Q?PbGOuApi/G//trTDERe5+kjdIx7U0b5q2gLSAID4CtRiB2rkUPz3ZvuyMIfg?= =?us-ascii?Q?ACLOajkn3qNL2m6QPpO5sEEtn++79BI3GtKFix3FPxoSEc11cAiLEnav2LUc?= =?us-ascii?Q?iGkYpJbw2KnhQWwdamrdwGzsG/i/tWY2kXmiF4Kj0+QyEJjDYwStQT1ijprt?= =?us-ascii?Q?R/xeFjndiPcJbOmIleAwtYDkSwpFIis+ONU/3ZXsU9bjRnWZPYI9LupFaMdp?= =?us-ascii?Q?lKl/GZAtbJTu1gvFHldhtVoHNsYq8bA6h4D/+4b6NVub7cnUWK9aJ0/QZ3Mp?= =?us-ascii?Q?5BWhhhb9XbREIUFOvIR5UW2fb/KTNXM6YsPujzJDtpqhC4tUgjPPliXb0qv+?= =?us-ascii?Q?ZA39b6f19VoYXoiBIj7+lIv+caHPT39zToJvWf0RgbB3p5QdMBex2mTVDHDt?= =?us-ascii?Q?GS846hARrFlydIl7j6a51H7QVQUD3ispBxrAHg6+C1cPUdGPPtbi3rKGeF97?= =?us-ascii?Q?6u+lyx07ny3DYJNCE84EG2XN94ke5fEeCkVQz2tvde4g5MYqygG1czmpJuzJ?= =?us-ascii?Q?k3b7iwAKMy6ZhEbeOBWRvL9jpnqF1LTLMmz/harNA1qIxoziSWOgFWIzGZki?= =?us-ascii?Q?+RKBEsucexPUXJkIY/SLsaQe70Bu2dlSZdLdWNGyh0gBzraVwp+r5NQUjIbH?= =?us-ascii?Q?ncp2oByumf4SahiDdIc9ejXl2P7Bc522g5qvxCv7+R5G1uDU2R0btHK/YS+k?= =?us-ascii?Q?iEpE/OoGE67Qv//YnYLrRiIvTxlNULptpfdt28SqlZj1TAuy2o4UAUxVfXYi?= =?us-ascii?Q?07sL82pOJGeQz8Hj5yku3ULmNd8urccEdoaYqVEawBYdb4XTVBwe+NullkRq?= =?us-ascii?Q?9YROicSLTEPuGOdSsWpZD/dwYVVsm3GArHGsDKtfTvlkBttzG1LroZ6VbrWB?= =?us-ascii?Q?JT/5VEJonJPPFyETooJMU4eauXFR6vxPFdI+UcFYghz1LG45cROv1J6rzoe/?= =?us-ascii?Q?X8Obs0ItnhIpFRkHZVUdnBuete3gPbLqHPZkmEgpEBSiOTOIrCFFsgllOSLG?= =?us-ascii?Q?90ZL8izVcwcLODQUbZ8jMAPm9qUSzjP57bcHV/5u+Sp8lmWpHTyGAyo/auO0?= =?us-ascii?Q?81FMVd01EJEtZNiUb/0YKQoH4YZ3wVP0XgY6ZOJZD5+lr7+eLhH1sDJtpIYk?= =?us-ascii?Q?mF48EE3KcixOpwZnpmGQqxs01X0veY2ihtf2x?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 6:wCq/n8m5zgR6xF4Vcx2Jd42zs3FzEZorbPKCrpfTkRr7nRnyaVWz0rFo0w274l80KpEzrfikEJfncAY/7XgvaoGbwYVB0uYVhn+dGxQnR+sRr2Xmh2QA8pYM9mT9ymLi11+LcYC7v/dwYNEsm4sHfh4/TJErzQtpyWttV/vI/9fWuVFTeihPua41cX4qzh+cKocWQIuGEb8mCAT5jiMBhhlS2ZzUSlIrlItFCdkq3xHO5NOAeIa+SOZ6rr5swJQP3N4BUHKgBrIkBG5B23bftU+5XvGXXHkTqNvg2heeV3Yo8aFeMpAWQtRNEQqUIHQsfIsE7GEz4aznnL0Qlphhe6/kz8iEQkbKFtaUY4s7kOg=; 5:drIHKbIzOVZ8eC9nGDtG3hYmTWhMeQ07/BZpWFmpkq929ZWxzGvf0M35BEnf8EblAP/sS3o9sjxEse7H/IZQUj8iYrP5WI/gZdPqXu1c0YphwnsezhH9mDrT4aDpnfnx984YO79lAq6RFr1POAXbzK5DGRRVD20CxlyT+8kD8CI=; 24:8q+gB0R24odz0C9xgjScX3iYHVFlBfWHCBtjJFA3ddFm3MuSrKIGdd8tyRAsrGKVP/CGUzSP7QeXLudI6uxsptgSbsFDkJKe9oLSjC/pxR0=; 7:+7iZ1xC0wO4qV0stnI/3ESi6n6eEL3OIojEPpFTj2rNtBdF6UUzTnDD+6oE/JCs5QxPtZIxPxoQJE+GuyLdk7jtwnH+H4hA5jAjE4lDQKXy4xkCSwZRe7dXtGyaBJYe3winItTM4w+VoIEizhB/VdFkJyRZtQswGHeVJWKw8SEKIfmu0dmjYgZH6FN/S04yIatD+8XYihYXpIi+uH6FxO73BfO/GeFnt8VAW+DEo57mNLMDZBL9xy0cVo8ZochUZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2018 08:59:05.6637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5caeb705-d88e-4b2a-0b36-08d56888e42e 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 05/10] rawdev: support for firmware management 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:13 -0000 Some generic operations for firmware management can loading, unloading, starting, stopping and querying firmware of a device. This patch adds support for such generic operations. Signed-off-by: Shreyansh Jain --- lib/librte_rawdev/rte_rawdev.c | 43 ++++++++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 64 +++++++++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 70 ++++++++++++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 4 ++ 4 files changed, 181 insertions(+) diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index d6c284554..b52293c47 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -320,6 +320,49 @@ rte_rawdev_xstats_reset(uint16_t dev_id, return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids); } +int __rte_experimental +rte_rawdev_firmware_status_get(uint16_t dev_id, rte_rawdev_obj_t status_info) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_status_get, -ENOTSUP); + return (*dev->dev_ops->firmware_status_get)(dev, status_info); +} + +int __rte_experimental +rte_rawdev_firmware_version_get(uint16_t dev_id, rte_rawdev_obj_t version_info) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_version_get, -ENOTSUP); + return (*dev->dev_ops->firmware_version_get)(dev, version_info); +} + +int __rte_experimental +rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + if (!firmware_image) + return -EINVAL; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP); + return (*dev->dev_ops->firmware_load)(dev, firmware_image); +} + +int __rte_experimental +rte_rawdev_firmware_unload(uint16_t dev_id) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->firmware_load, -ENOTSUP); + return (*dev->dev_ops->firmware_unload)(dev); +} + int __rte_experimental rte_rawdev_start(uint16_t dev_id) { diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index 28bf9e0ff..389b009d7 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -525,6 +525,70 @@ rte_rawdev_xstats_reset(uint16_t dev_id, const uint32_t ids[], uint32_t nb_ids); +/** + * Get Firmware status of the device.. + * Returns a memory allocated by driver/implementation containing status + * information block. It is responsibility of caller to release the buffer. + * + * @param dev_id + * Raw device identifier + * @param status_info + * Pointer to status information area. Caller is responsible for releasing + * the memory associated. + * @return + * 0 for success, + * !0 for failure, `status_info` argument state is undefined + */ +int __rte_experimental +rte_rawdev_firmware_status_get(uint16_t dev_id, + rte_rawdev_obj_t status_info); + +/** + * Get Firmware version of the device. + * Returns a memory allocated by driver/implementation containing version + * information block. It is responsibility of caller to release the buffer. + * + * @param dev_id + * Raw device identifier + * @param version_info + * Pointer to version information area. Caller is responsible for releasing + * the memory associated. + * @return + * 0 for success, + * !0 for failure, `version_info` argument state is undefined + */ +int __rte_experimental +rte_rawdev_firmware_version_get(uint16_t dev_id, + rte_rawdev_obj_t version_info); + +/** + * Load firmware on the device. + * TODO: In future, methods like directly flashing from file too can be + * supported. + * + * @param dev_id + * Raw device identifier + * @param firmware_image + * Pointer to buffer containing image binary data + * @return + * 0 for successful load + * !0 for failure to load the provided image, or image incorrect. + */ +int __rte_experimental +rte_rawdev_firmware_load(uint16_t dev_id, rte_rawdev_obj_t firmware_image); + +/** + * Unload firmware from the device. + * + * @param dev_id + * Raw device identifiers + * @return + * 0 for successful Unload + * !0 for failure in unloading + */ +int __rte_experimental +rte_rawdev_firmware_unload(uint16_t dev_id); + #ifdef __cplusplus } #endif diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index abc7c15c5..41b3a3b5f 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -416,6 +416,67 @@ typedef int (*rawdev_xstats_get_names_t)(const struct rte_rawdev *dev, typedef uint64_t (*rawdev_xstats_get_by_name_t)(const struct rte_rawdev *dev, const char *name, unsigned int *id); + +/** + * Get firmware/device-stack status. + * Implementation to allocate buffer for returning information. + * + * @param dev + * Raw device pointer + * @param status + * void block containing device specific status information + * @return + * 0 for success, + * !0 for failure, with undefined value in `status_info` + */ +typedef int (*rawdev_firmware_status_get_t)(struct rte_rawdev *dev, + rte_rawdev_obj_t status_info); + +/** + * Get firmware version information + * + * @param dev + * Raw device pointer + * @param version_info + * void pointer to version information returned by device + * @return + * 0 for success, + * !0 for failure, with undefined value in `version_info` + */ +typedef int (*rawdev_firmware_version_get_t)(struct rte_rawdev *dev, + rte_rawdev_obj_t version_info); + +/** + * Load firwmare from a buffer (DMA'able) + * + * @param dev + * Raw device pointer + * @param firmware_file + * file pointer to firmware area + * @return + * >0, ~0: for successful load + * <0: for failure + * + * @see Application may use 'firmware_version_get` for ascertaining successful + * load + */ +typedef int (*rawdev_firmware_load_t)(struct rte_rawdev *dev, + rte_rawdev_obj_t firmware_buf); + +/** + * Unload firwmare + * + * @param dev + * Raw device pointer + * @return + * >0, ~0 for successful unloading + * <0 for failure in unloading + * + * Note: Application can use the `firmware_status_get` or + * `firmware_version_get` to get result of unload. + */ +typedef int (*rawdev_firmware_unload_t)(struct rte_rawdev *dev); + /** Rawdevice operations function pointer table */ struct rte_rawdev_ops { /**< Get device info. */ @@ -460,6 +521,15 @@ struct rte_rawdev_ops { rawdev_xstats_get_by_name_t xstats_get_by_name; /**< Reset the statistics values in xstats. */ rawdev_xstats_reset_t xstats_reset; + + /**< Obtainer firmware status */ + rawdev_firmware_status_get_t firmware_status_get; + /**< Obtain firmware version information */ + rawdev_firmware_version_get_t firmware_version_get; + /**< Load firmware */ + rawdev_firmware_load_t firmware_load; + /**< Unload firmware */ + rawdev_firmware_unload_t firmware_unload; }; /** diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map index 469b78d81..8de9abdc4 100644 --- a/lib/librte_rawdev/rte_rawdev_version.map +++ b/lib/librte_rawdev/rte_rawdev_version.map @@ -6,6 +6,10 @@ EXPERIMENTAL { rte_rawdev_count; rte_rawdev_dequeue_buffers; rte_rawdev_enqueue_buffers; + rte_rawdev_firmware_load; + rte_rawdev_firmware_status_get; + rte_rawdev_firmware_unload; + rte_rawdev_firmware_version_get; rte_rawdev_get_attr; rte_rawdev_get_dev_id; rte_rawdev_info_get; -- 2.14.1