Re: [PATCH net-next v3 6/8] octeon_ep_vf: add Tx/Rx processing and interrupt support

From: Jakub Kicinski
Date: Fri Jan 05 2024 - 22:30:39 EST


On Fri, 5 Jan 2024 12:38:21 -0800 Shinas Rasheed wrote:
> +static int octep_vf_iq_full_check(struct octep_vf_iq *iq)
> +{
> + if (likely((IQ_INSTR_SPACE(iq)) >
> + OCTEP_VF_WAKE_QUEUE_THRESHOLD))
> + return 0;
> +
> + /* Stop the queue if unable to send */
> + netif_stop_subqueue(iq->netdev, iq->q_no);
> +
> + /* check again and restart the queue, in case NAPI has just freed
> + * enough Tx ring entries.
> + */
> + if (unlikely(IQ_INSTR_SPACE(iq) >
> + OCTEP_VF_WAKE_QUEUE_THRESHOLD)) {
> + netif_start_subqueue(iq->netdev, iq->q_no);
> + iq->stats.restart_cnt++;
> + return 0;
> + }

Please use the macros from netdev_queues.h here as well.
Looks like you may be missing a memory barrier here.

And please call this function after queuing an skb to
make sure NETDEV_TX_BUSY is almost never returned.
See Documentation/networking/driver.rst