• Hariprasad Kelam's avatar
    octeontx2-pf: Fix synchnorization issue in mbox · 66a5209b
    Hariprasad Kelam authored
    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: d424b6c0 ("octeontx2-pf: Enable SRIOV and added VF mbox handling")
    Signed-off-by: default avatarHariprasad Kelam <hkelam@marvell.com>
    Signed-off-by: default avatarGeetha sowjanya <gakula@marvell.com>
    Signed-off-by: default avatarSunil Goutham <sgoutham@marvell.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    66a5209b
mbox.h 25.4 KB