Re: [PATCH net v3] net: stmmac: fix transmit queue timed out after resume for tso

From: Tao Wang

Date: Sat Jan 17 2026 - 02:59:49 EST


> Rather than using tx_q->tx_skbuff_dma[].last_segment to determine
> whether the first descriptor entry is the only segment, calculate the
> number of descriptor entries used. If there is only one descriptor,
> then the first is also the last, so mark it as such.

This is a good idea. tx_q->tx_skbuff_dma[].last_segment no longer carries
much meaning and can indeed be removed altogether.

> +       is_last_segment = ((tx_q->cur_tx - first_entry) &
> +                          (priv->dma_conf.dma_tx_size - 1)) == 1;

Since tx_q->cur_tx may wrap around and become smaller than first_entry,
the following statement is more concise:
is_last_segment = (tx_q->cur_tx == first_entry);