[dpdk-dev] [PATCH] lib/table: fix wrong type of nht field

Dumitrescu, Cristian cristian.dumitrescu at intel.com
Tue Jun 21 13:16:46 CEST 2016



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Monday, June 20, 2016 11:14 AM
> To: Jastrzebski, MichalX K <michalx.k.jastrzebski at intel.com>; Kobylinski,
> MichalX <michalx.kobylinski at intel.com>
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] lib/table: fix wrong type of nht field
> 
> 2016-06-20 12:10, Michal Jastrzebski:
> > From: Michal Kobylinski <michalx.kobylinski at intel.com>
> >
> > Change type of nht field from uint32_t to uint8_t and increase max of
> > next hops.
> >
> > Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field")
> 
> Why the type is wrong?

The lpm->nht is simply some raw memory allocated at the end of the table context using the usual pattern:
struct rte_table_lpm {
	... 
	uint8_t nht[0] __rte_cache_aligned;
}

Therefore, when we do: 
	nht_entry = &lpm->nht[i * lpm->entry_size];
in several places, it makes big difference whether nht_entry is declared as uin8_t * (correct) or uint32_t * (incorrect), as the position computed by the latter is 4 times the position computed by the former ;(

Michal K and Michal J,
	I just realized we still need to do a small change to this patch, I will reply to the original mail now. So Thomas, sorry, there is one small change, we'll send new version soon.

Thanks,
Cristian



More information about the dev mailing list