On Thu, May 01, 2025 at 12:51:48PM -0400, Brian Vazquez wrote: > On Thu, May 1, 2025 at 11:16 AM Simon Horman <ho...@kernel.org> wrote: > > > > On Mon, Apr 28, 2025 at 07:55:32PM +0000, Brian Vazquez wrote: > > > Add a helper function to correctly handle the lockless > > > synchronization when the sender needs to block. The paradigm is > > > > > > if (no_resources()) { > > > stop_queue(); > > > barrier(); > > > if (!no_resources()) > > > restart_queue(); > > > } > > > > > > netif_subqueue_maybe_stop already handles the paradigm correctly, but > > > the code split the check for resources in three parts, the first one > > > (descriptors) followed the protocol, but the other two (completions and > > > tx_buf) were only doing the first part and so race prone. > > > > > > Luckily netif_subqueue_maybe_stop macro already allows you to use a > > > function to evaluate the start/stop conditions so the fix only requires > > > the right helper function to evaluate all the conditions at once. > > > > > > The patch removes idpf_tx_maybe_stop_common since it's no longer needed > > > and instead adjusts separately the conditions for singleq and splitq. > > > > > > Note that idpf_rx_buf_hw_update doesn't need to check for resources > > > since that will be covered in idpf_tx_splitq_frame. > > > > Should the above read idpf_tx_buf_hw_update() rather than > > idpf_rx_buf_hw_update()? > > Nice catch, that's a typo indeed.
Thanks. I only noticed because on reading the above I was looking at idpf_rx_buf_hw_update(). Which turned out to not be very useful in the context of reviewing this patch. > > If so, I see that this is true when idpf_tx_buf_hw_update() is called from > > idpf_tx_singleq_frame(). But is a check required in the case where > > idpf_rx_buf_hw_update() is called by idpf_tx_singleq_map()? > > No, the check is not required. The call is at the end of > idpf_tx_singleq_map at that point you already checked for resources > and you're about to send the pkt. Thanks for the clarification. In that case this patch looks good to me. (But please do fix the typo.) Reviewed-by: Simon Horman <ho...@kernel.org>