From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0077.outbound.protection.outlook.com [104.47.38.77]) by dpdk.org (Postfix) with ESMTP id D5480A495 for ; Tue, 23 Jan 2018 15:24:53 +0100 (CET) Received: from BN6PR03CA0067.namprd03.prod.outlook.com (10.173.137.29) by BLUPR03MB1410.namprd03.prod.outlook.com (10.163.81.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 14:24:52 +0000 Received: from BY2FFO11OLC010.protection.gbl (2a01:111:f400:7c0c::159) by BN6PR03CA0067.outlook.office365.com (2603:10b6:404:4c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Tue, 23 Jan 2018 14:24:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=fail action=none header.from=nxp.com; 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 BY2FFO11OLC010.mail.protection.outlook.com (10.1.15.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 14:24:50 +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 w0NDj5Rg022838; Tue, 23 Jan 2018 06:45:24 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 23 Jan 2018 19:29:05 +0530 Message-ID: <20180123135910.10755-6-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180123135910.10755-1-shreyansh.jain@nxp.com> References: <20180102125749.2379-1-shreyansh.jain@nxp.com> <20180123135910.10755-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611910920308853; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39380400002)(376002)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(316002)(104016004)(498600001)(16586007)(105606002)(106466001)(6666003)(2950100002)(54906003)(110136005)(2906002)(5660300001)(50466002)(8936002)(81166006)(50226002)(48376002)(8676002)(4326008)(81156014)(59450400001)(1076002)(356003)(36756003)(47776003)(53936002)(305945005)(86362001)(97736004)(85426001)(77096007)(51416003)(336011)(76176011)(26005)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1410; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC010; 1:hGmWvhtgB4eBxTPVLfZSMilCYj+51b2sjBnup42T+6VFMgKC8i6JrbOYh7dtU/qHoZ7Ns2Md7SewjeVZSfKBLP3vw7rxB7ZOacWzWSV5ygD/W6wC2B7wx0+QCOvN2kBn MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cd8b56a-7742-4d27-8875-08d5626d1114 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB1410; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1410; 3:EpSej9So23bbsvX01xaFLuObOUYuJLwrPmGSTX151yRaXlR0FFXLW8I2svcPE1YqAK70duaPaMWw4+/Izibj5WVd0sky3CYstCCEpCfuE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+CBERej8wwEc9g4k/BjP8SJjym+QAc7QQYtGtz4deqeOQSB0Sx63O4m9K8fT3GBInho+Nfsz1RWEQQsqoStU54/9sBSJzsHrFxAqn99rEa9V1TpdnQSsm7JR986BUuRM8xmO4yg3HF0RkjI41swFgRUFkqhUfThuO6si 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)(3002001)(10201501046)(3231023)(2400081)(944501161)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(20161123561025)(20161123556025)(201708071742011); SRVR:BLUPR03MB1410; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BLUPR03MB1410; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1410; 23:DUxmd59p+fnTFUTV2FryW/xkVB+KagXnC5KIIz888?= =?us-ascii?Q?YeJIAdgyk3sg9MH/VU2LNkkJ82ok5MVt0AL3nN7JQUqgra/fgG9rAvhCg0GX?= =?us-ascii?Q?lqPuFzYZwOE4YGjiNc7EH1/20Fbt3V+QVsSxhj96yYTYNRZSdyHiD9su6XB2?= =?us-ascii?Q?z4SZA3rVc76sL4D4NWbKevDXWqNohHc8LvxA5TIBa+d36shYMwiRFW9PgsUA?= =?us-ascii?Q?wRBqHJrc1zUrzaVbZXEMMwWdVjiINxniSuSq7pwW1HHaWHHwXI36t9SYE92i?= =?us-ascii?Q?gJVspKVyc+4mZm//AOeSQrPDAki2oG4p/8/TWDqKfNB18HNyvgP0XFkn+Ei7?= =?us-ascii?Q?tqBc55jj36DMcLBBVjd5NohHmFckuMZnvFcvo9JVx+Q84tBzTyGbWbIFjx0K?= =?us-ascii?Q?i5eGXdykjM812Cy6tQEcq0WH0mHSBXHjTRVUYHKCj4gTTE7VKI+SR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DhPpI/4wd5aUGe2gBHCLk8sRmcig9aqVkWPztqn/KofV7Y6/4dhZ8DBD19hTJkon7w5eWCHBUHqIvVYhjlw8TTRXru+9tC99He5GwTV8IsvwOJXBrmHSDon11EdaERlwTroFRvclwT5ZQA=; 5:yYqVib2DErZ9P225cjp5LMVkk6X4YRvxOPyrkUme4hK3hOMJbYChP0/gm8di+FpXcXmXwb4XrlVqlfdmZRXSevBE9nCg7jIg1cv4VT0ve4Om6DnU7o/kEW1dw1++SNT3n208573aOXErmYX1XHMUraYvoTOI8LGYNXGLhNxosmI=; 24:DBraQqbr5WJeGajbFvf+BDsZKc9cHAba8Tm/oCkJTAwFyzUfJgZBvc04rPKleAhekPPWNw36yA+Zu9U8lEAc6OIlgDWxhX3m7BTpZHhGmB4=; 7:ydlX7XAXNhSi0IQwu0L0SyhuBHOCopiU3sf9MME+wj5GmkkH0cEfgAffjmWryN29tYxTqAKcg2RBiBY69oKbJUJZ2oAcZkHCWsQ6LDNeQjkokiDIdBj7d/vcDYP+BJwUZDBNqaZUp8vKtyRshER4GTMxIN1rbUVs1vqYc3YxJ6MHvlO2+5De6JcbY5BktB467298lSoKm+WO+VyHMsxqKrPkTmjfFKaJaYefC3v8PtBaVUqm1ztOGBqiwOGJsTJA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 14:24:50.2056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9cd8b56a-7742-4d27-8875-08d5626d1114 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: BLUPR03MB1410 Subject: [dpdk-dev] [PATCH v2 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: Tue, 23 Jan 2018 14:24:54 -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 3a7800a45..c1001b34b 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_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_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_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_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_rawdev_start(uint16_t dev_id) { diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index 221f85856..388a24cf0 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -513,6 +513,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_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_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_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_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 fd94b39c3..a8da39343 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -414,6 +414,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. */ @@ -458,6 +519,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