[dpdk-dev] [PATCH v3 02/16] mbuf: add Rx timestamp flag and helpers

Thomas Monjalon thomas at monjalon.net
Tue Nov 3 10:59:18 CET 2020


03/11/2020 10:33, Olivier Matz:
> On Tue, Nov 03, 2020 at 01:13:53AM +0100, Thomas Monjalon wrote:
> > +static int
> > +rte_mbuf_dyn_timestamp_register(int *field_offset, uint64_t *flag,
> > +		const char *direction, const char *flag_name)
> > +{
> > +	static const struct rte_mbuf_dynfield field_desc = {
> > +		.name = RTE_MBUF_DYNFIELD_TIMESTAMP_NAME,
> > +		.size = sizeof(rte_mbuf_timestamp_t),
> > +		.align = __alignof__(rte_mbuf_timestamp_t),
> > +	};
> > +	struct rte_mbuf_dynflag flag_desc;
> > +	int offset;
> > +
> > +	offset = rte_mbuf_dynfield_register(&field_desc);
> > +	if (offset < 0) {
> > +		RTE_LOG(ERR, MBUF,
> > +			"Failed to register mbuf field for timestamp\n");
> > +		return -1;
> > +	}
> > +	if (field_offset != NULL)
> > +		*field_offset = offset;
> > +
> > +	strlcpy(flag_desc.name, flag_name, sizeof flag_desc.name);
> 
> The rest of the flag_desc structure is not initialized to 0 (the "flags"
> field).
> 
> I suggest to do it at declaration:
> 
> 	struct rte_mbuf_dynflag flag_desc = { 0 };

Yes I forgot, thanks for catching.





More information about the dev mailing list