From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0055.outbound.protection.outlook.com [104.47.42.55]) by dpdk.org (Postfix) with ESMTP id DAE3F1B38B for ; Tue, 30 Jan 2018 16:24:49 +0100 (CET) Received: from BN6PR03CA0082.namprd03.prod.outlook.com (10.164.122.148) by BY2PR03MB473.namprd03.prod.outlook.com (10.141.141.143) 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 BN1AFFO11FD041.protection.gbl (2a01:111:f400:7c10::168) by BN6PR03CA0082.outlook.office365.com (2603:10b6:405:6f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.464.11 via Frontend Transport; Tue, 30 Jan 2018 15:24:47 +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 BN1AFFO11FD041.mail.protection.outlook.com (10.58.52.252) 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:47 +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 w0UEh7si023996; Tue, 30 Jan 2018 07:43:26 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Tue, 30 Jan 2018 20:27:04 +0530 Message-ID: <20180130145710.24757-6-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: 131617994882269127; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(396003)(346002)(39380400002)(376002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(48376002)(76176011)(106466001)(2351001)(51416003)(36756003)(305945005)(86362001)(356003)(8676002)(81166006)(1076002)(4326008)(81156014)(336011)(105606002)(54906003)(6862004)(2906002)(16586007)(5660300001)(316002)(50466002)(47776003)(498600001)(68736007)(97736004)(59450400001)(104016004)(77096007)(85426001)(8936002)(50226002)(53936002)(26005)(2950100002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB473; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD041; 1:XJbq4XMREI5dP/FcwzoFpAs56dgbdVzc15V+MsSHLWaLvFg8GHMwqzf71WAmFBwFbtP+TxMFko7kVEcRrQedExMQ2sFm6jiOvwNYBevuzak+aZZ6A9TfEebI0uWvz+yA MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cd2b6110-b630-47cd-bfc7-08d567f59978 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BY2PR03MB473; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB473; 3:b/R4w/+Cf4dNPWcwfJyASkmMFh8QuVkU2ueKTvyQ6POoybiOOw1sOg3IuUjvd67nmRxJtg4w2dR4C4uB4ItWGsAwPOWhMWUEW5wli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P+epVVEKWdh2A0mzL/t14KGmskUGXt92Ltxm6uf8rUiuwyyB03uZBF8evZQXiG/54/iyaasjsFX2T/yd/SO1M984Ny77woL7LxW3GZI9kfec5aL41r64Zyc2tofXKaDVM9oRo1Du6CaVLs7v2ka9d9bIJwDrtNd67lKPtlsyXGF X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231101)(944501161)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(20161123559100)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(201708071742011); SRVR:BY2PR03MB473; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB473; X-Forefront-PRVS: 0568F32D91 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR03MB473; 23:mHmEYi9PzjTGw002BrmUXva7za0kQ++btvWZK6RtqR?= =?us-ascii?Q?707PM0Aa0JByXFRjh594QnIxMMMB6NVjG0hfdKkSTAmKUu059Wh4UF7QAuer?= =?us-ascii?Q?h5ZXm5vYEylsbkY92FB6lrSeEOoxvKc41XuPkCfC8taGnBULM2ccoS74JVSc?= =?us-ascii?Q?/OVp/QOQSytNrqGO4+KzBKtZ3eWwZJSytqrPD3S9rBJAMWpxqB6H/QZNU0fo?= =?us-ascii?Q?uIjtX9pi2pewLWd35z182rI9Hmg26fmvIWHeW3+85SdDvyaGxNkBaAgjYq0L?= =?us-ascii?Q?jwjL733VX5dN6p0p5ajURBA0z8z7mdBWbTuGFOCqc8ZQewLY/1MBn3icEp7h?= =?us-ascii?Q?H8HOP5EyJoLQobt2w0ivblsCD7tkie5yDiBLquAz61/aMF5tFcuZl1QjtBQg?= =?us-ascii?Q?kyDIUtwVTH10F5UyD+kPi2pX4xwaZv+Yz30h1lTD/QuiY2hL3HbrnTMl5xmA?= =?us-ascii?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DMrxsxNX144Hh1/Cu+EzZNPfwl5lTappLA66F/xK2p+kCCOEplONdk8zZjdj9kBDV2k19COM+qQtWEU0K+pXpKjQAqkOTOAkAolJZtEJ69wzFtUDBiTwk45iqBCyLA9FPQ4cGVSVYlO9TYjhrugYYaqRg8=; 5:jiyRidQB/ltbO2O1VqFkOJgGilc+aVN6Oprmn9VWW3IHv1yh1R63wJoLOu+qX/DwspkCNqbn6pL+JpiyiU6MrDMy5yed85LRMmrTx83L/9E0Jpy+roznHw58ezpVffPX4b7GNDKVygON4diLcl+kFFffjC9OaKG6gGiQwRnZguo=; 24:FA4ZIK80V/phTyTYuBLDPaZaxQZUS+8mmcHKuZRAgg0YZ6A+zoweieUvd5JhtXqi6qIPI1dDfBVQg2xBk6h8sKP1I07iuQjjOmPs15mgLY4=; 7:8odGcPUVMaXrAFc/ldvvfoocnnPmNHtTALnpPjtVB11H3lfV8P5JAVvdtcNZjKLqXurJOU0IXWgryvo3ZwjXoCq2uaTxldtuKB9AzC6RqIAQqH2GFv/AKKJjxdHa8YkUmRzPICoYSn32P/BnDpNZOboB9kSOATqBapN1ouIZf+8zcrHc2UbjM697acMzvboX6i5QYic7xK3EmDl0ulSPvoqoLq1aDpU/ERlYUeQbqr6OHIOj7V0EI2p2BZh1LUrF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 15:24:47.0725 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd2b6110-b630-47cd-bfc7-08d567f59978 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: BY2PR03MB473 Subject: [dpdk-dev] [PATCH v3 05/11] 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, 30 Jan 2018 15:24:50 -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 8e3d72273..8eab3974f 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_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 2ef380988..f74bf171a 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