[dpdk-dev] [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation
Bruce Richardson
bruce.richardson at intel.com
Mon Jul 1 17:55:52 CEST 2019
Some device drivers want to allocate their own private memory, and should
be allowed to do so. Therefore skip memory allocation and associated error
checks if zero-length private memory is requested.
While adjusting the code for new indent level, fix incorrect error
message.
Cc: Shreyansh Jain <shreyansh.jain at nxp.com>
Cc: Hemant Agrawal <hemant.agrawal at nxp.com>
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/librte_rawdev/rte_rawdev.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
index 15de2d413..b6f1e1c77 100644
--- a/lib/librte_rawdev/rte_rawdev.c
+++ b/lib/librte_rawdev/rte_rawdev.c
@@ -496,16 +496,17 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id)
rawdev = &rte_rawdevs[dev_id];
- rawdev->dev_private = rte_zmalloc_socket("rawdev private",
+ if (dev_priv_size > 0) {
+ rawdev->dev_private = rte_zmalloc_socket("rawdev private",
dev_priv_size,
RTE_CACHE_LINE_SIZE,
socket_id);
- if (!rawdev->dev_private) {
- RTE_RDEV_ERR("Unable to allocate memory to Skeleton dev");
- return NULL;
+ if (!rawdev->dev_private) {
+ RTE_RDEV_ERR("Unable to allocate memory for rawdev");
+ return NULL;
+ }
}
-
rawdev->dev_id = dev_id;
rawdev->socket_id = socket_id;
rawdev->started = 0;
--
2.21.0
More information about the dev
mailing list