• Ursula Braun's avatar
    net/smc: fix sender_free computation · b8649efa
    Ursula Braun authored
    In some scenarios a separate consumer cursor update is necessary.
    The decision is made in smc_tx_consumer_cursor_update(). The
    sender_free computation could be wrong:
    
    The rx confirmed cursor is always smaller than or equal to the
    rx producer cursor. The parameters in the smc_curs_diff() call
    have to be exchanged, otherwise sender_free might even be negative.
    
    And if more data arrives local_rx_ctrl.prod might be updated, enabling
    a cursor difference between local_rx_ctrl.prod and rx confirmed cursor
    larger than the RMB size. This case is not covered by smc_curs_diff().
    Thus function smc_curs_diff_large() is introduced here.
    
    If a recvmsg() is processed in parallel, local_tx_ctrl.cons might
    change during smc_cdc_msg_send. Make sure rx_curs_confirmed is updated
    with the actually sent local_tx_ctrl.cons value.
    
    Fixes: e82f2e31 ("net/smc: optimize consumer cursor updates")
    Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b8649efa
smc_tx.c 18.3 KB