> >> +struct l3fwd_event_resources { > >> + uint8_t sched_type; > >> + uint8_t enabled; > >> + uint8_t nb_args; > >> + char **args; > >> +}; > >> + > >> +static inline struct l3fwd_event_resources * > >> +l3fwd_get_eventdev_rsrc(void) > >> +{ > >> + static const char name[RTE_MEMZONE_NAMESIZE] = > >"l3fwd_event_rsrc"; > >> + const struct rte_memzone *mz; > >> + > >> + mz = rte_memzone_lookup(name); > >> + > >> + if (mz != NULL) > >> + return mz->addr; > >> + > >> + mz = rte_memzone_reserve(name, sizeof(struct > >l3fwd_event_resources), > >> + 0, 0); > >> + if (mz != NULL) { > >> + memset(mz->addr, 0, sizeof(struct > >l3fwd_event_resources)); > >> + return mz->addr; > >> + } > >> + > >> + rte_exit(EXIT_FAILURE, "Unable to allocate memory for > >eventdev cfg\n"); > >> + > >> + return NULL; > >> +} > > > >Does this function really need to be inline? > >It wouldn't be fast anyway. > >Another question - do you really need memzone here? > >Wouldn't just rte_malloc() be enough? > > Will remove inline in next version. > rte_malloc would call for a global variable which I'm > trying to avoid.
If you plan to move that function into .c file, you don't need a global var. it could be static local one. > I don't think there is any harm in using > named memzone. I don't see any harm, though malloc+var will be faster I think. Though up to you - no strong opinion here.