Re: [PATCH net-next v2 3/4] octeon_ep: implement xmit_more in transmit

From: Jakub Kicinski
Date: Tue Oct 24 2023 - 20:21:59 EST


On Tue, 24 Oct 2023 07:51:18 -0700 Shinas Rasheed wrote:
> iq->host_write_index = wi;
> + if (xmit_more &&
> + (atomic_read(&iq->instr_pending) <
> + (iq->max_count - OCTEP_WAKE_QUEUE_THRESHOLD)) &&
> + iq->fill_cnt < iq->fill_threshold)
> + return NETDEV_TX_OK;

Does this guarantee that a full-sized skb can be accommodated?
If so - consider stopping stopping the queue when the condition
is not true. The recommended way of implementing 'driver flow control'
is to stop the queue once next packet may not fit, and then use
netif_xmit_stopped() when deciding whether we need to flush or we can
trust xmit_more. see
https://www.kernel.org/doc/html/next/networking/driver.html#transmit-path-guidelines

> /* Flush the hw descriptor before writing to doorbell */
> wmb();
> -
> - /* Ring Doorbell to notify the NIC there is a new packet */
> - writel(1, iq->doorbell_reg);
> - iq->stats.instr_posted++;
> + /* Ring Doorbell to notify the NIC of new packets */
> + writel(iq->fill_cnt, iq->doorbell_reg);
> + iq->stats.instr_posted += iq->fill_cnt;
> + iq->fill_cnt = 0;
> return NETDEV_TX_OK;