]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
octeontx2-pf: Fix synchnorization issue in mbox
authorHariprasad Kelam <hkelam@marvell.com>
Wed, 30 Sep 2020 16:09:35 +0000 (21:39 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Oct 2020 09:55:55 +0000 (11:55 +0200)
commitce1dde1980792a4e383ed9be12363a2e8bbe55a5
tree25fdcee678934d80c969566bd12dd51d97a6cfef
parent5cfc870ede16e7c3d5ee0b82b9eb7badcbdf12e7
octeontx2-pf: Fix synchnorization issue in mbox

[ Upstream commit 66a5209b53418111757716d71e52727b782eabd4 ]

Mbox implementation in octeontx2 driver has three states
alloc, send and reset in mbox response. VF allocate and
sends message to PF for processing, PF ACKs them back and
reset the mbox memory. In some case we see synchronization
issue where after msgs_acked is incremented and before
mbox_reset API is called, if current execution is scheduled
out and a different thread is scheduled in which checks for
msgs_acked. Since the new thread sees msgs_acked == msgs_sent
it will try to allocate a new message and to send a new mbox
message to PF.Now if mbox_reset is scheduled in, PF will see
'0' in msgs_send.
This patch fixes the issue by calling mbox_reset before
incrementing msgs_acked flag for last processing message and
checks for valid message size.

Fixes: d424b6c02 ("octeontx2-pf: Enable SRIOV and added VF mbox handling")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/octeontx2/af/mbox.c
drivers/net/ethernet/marvell/octeontx2/af/mbox.h
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c