net: mvpp2: prs: Don't override the sign bit in SRAM parser shift
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Thu, 20 Jun 2019 09:42:45 +0000 (11:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:14 +0000 (09:14 +0200)
commit0024b12b776c2d0939670fb5c6a81416c09f601c
tree56ba75368bde8f8940e86937858b7129d3ed43ee
parent05592b9b7f256ee36936a9012c6fcb51850468d8
net: mvpp2: prs: Don't override the sign bit in SRAM parser shift

[ Upstream commit 8ec3ede559956f8ad58db7b57d25ac724bab69e9 ]

The Header Parser allows identifying various fields in the packet
headers, used for various kind of filtering and classification
steps.

This is a re-entrant process, where the offset in the packet header
depends on the previous lookup results. This offset is represented in
the SRAM results of the TCAM, as a shift to be operated.

This shift can be negative in some cases, such as in IPv6 parsing.

This commit prevents overriding the sign bit when setting the shift
value, which could cause instabilities when parsing IPv6 flows.

Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit")
Suggested-by: Alan Winkowski <walan@marvell.com>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/mvpp2/mvpp2_prs.c