On Wed, Dec 29, 2021 at 01:36:06PM +0100, Karsten Graul wrote: >On 28/12/2021 10:03, Dust Li wrote: >> We found smc_llc_send_link_delete_all() sometimes wait >> for 2s timeout when testing with RDMA link up/down. >> It is possible when a smc_link is in ACTIVATING state, >> the underlaying QP is still in RESET or RTR state, which >> cannot send any messages out. > >I see your point, but why do you needed to introduce a new wrapper instead of >extending the existing smc_link_usable() wrapper? >With that and without any comments the reader of the code does not know why there are >2 different functions and what is the reason for having two of them. Sorry for that, I should add some comments for those wrappers to better explain that. The reason we need two wrappers here is because the QP state for the client side is not turned into RTS directly, but seperated into two stages. In the middle on RTR to RTS, we still need smc_link_usable(). For example: For the client side in first contact, the QP is still in RTR before it receives the LLC_CONFIRM message. So for functions like smc_llc_wait() or smc_llc_event_handler(), we can't use smc_link_sendable(), or we can't even receive LLC_CONFIRM message anymore. So the meaning for those 2 wrappers should be: smc_link_usable(): the link is ready to receive RDMA messages smc_link_sendable(): the link is ready to send RDMA messages For those places that need to send any CDC or LLC message, should go for smc_link_sendable(), otherwise, use smc_link_usable() instead. I saw David has already applied this to net, should I send another patch to add some comments ?