examples/l3fwd: fix crash with gcc 5
It seems that with gcc >5.x and -O2/-O3 optimization breaks packet
grouping algorithm.
When last packet pointer "lp" and "pnum->u64" buffer points the same
memory buffer, high optimization can cause unpredictable results.
It seems that assignment of precalculated group sizes may interfere
with initialization of new group size when lp points value inside
current group and didn't should be changed.
With gcc >5.x and optimization we cannot be sure which assignment will
be done first, so the group size can be counted incorrectly.
This patch eliminates intersection of assignment of initial group size
(lp[0] = 1) and precalculated group sizes when gptbl[v].idx < 4.
Fixes: 94c54b4158
("examples/l3fwd: rework exact-match")
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
parent
bdf54f7a51
commit
af1694d94b
@ -283,9 +283,9 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
|
||||
|
||||
/* if dest port value has changed. */
|
||||
if (v != GRPMSK) {
|
||||
lp = pnum->u16 + gptbl[v].idx;
|
||||
lp[0] = 1;
|
||||
pnum->u64 = gptbl[v].pnum;
|
||||
pnum->u16[FWDSTEP] = 1;
|
||||
lp = pnum->u16 + gptbl[v].idx;
|
||||
}
|
||||
|
||||
return lp;
|
||||
|
Loading…
Reference in New Issue
Block a user