Re: [dpdk-dev] [PATCH v2 2/5] devargs: refactor scratch buffer storage
From: Thomas Monjalon <hidden>
Date: 2021-03-18 09:15:08
18/01/2021 16:16, Xueming Li:
quoted hunk ↗ jump to hunk
In current design, legacy parser rte_devargs_parse() saved scratch buffer to devargs.args while new parser rte_devargs_layers_parse() saved to devargs.data. Code using devargs had to know the difference and cleaned up memory accordingly - error prone. This patch unifies data the dedicate scratch buffer, introduces rte_devargs_free() function to wrap the memory memory clean up. Signed-off-by: Xueming Li <redacted> ------ a/lib/librte_eal/include/rte_devargs.h +++ b/lib/librte_eal/include/rte_devargs.h@@ -60,16 +60,16 @@ struct rte_devargs { /** Name of the device. */ char name[RTE_DEV_NAME_MAX_LEN]; RTE_STD_C11 - union { - /** Arguments string as given by user or "" for no argument. */ - char *args; + union { /**< driver-related part of device string. */ + const char *args; /**< legacy name. */ const char *drv_str; }; struct rte_bus *bus; /**< bus handle. */ struct rte_class *cls; /**< class handle. */ const char *bus_str; /**< bus-related part of device string. */ const char *cls_str; /**< class-related part of device string. */ - const char *data; /**< Device string storage. */ + char *data; /**< Scratch buffer. */ + const char *src; /**< Arguments given by user. */
Adding a field changes the size of the struct, which is an ABI break. We need to plan this change for DPDK 21.11. Let's think what can be done in the meantime.