All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Joshua Hay <joshua.a.hay@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
	"Madhu Chittim" <madhu.chittim@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH net 4/5] idpf: stop Tx if there are insufficient buffer resources
Date: Fri, 27 Jun 2025 15:17:41 +0200	[thread overview]
Message-ID: <4e88f5dd-05ab-4465-83c9-9c4d4ebcf3d6@intel.com> (raw)
In-Reply-To: <20250625161156.338777-5-joshua.a.hay@intel.com>

From: Joshua Hay <joshua.a.hay@intel.com>
Date: Wed, 25 Jun 2025 09:11:55 -0700

> The Tx refillq logic will cause packets to be silently dropped if there
> are not enough buffer resources available to send a packet in flow
> scheduling mode. Instead, determine how many buffers are needed along
> with number of descriptors. Make sure there are enough of both resources
> to send the packet, and stop the queue if not.
> 
> Fixes: 7292af042bcf ("idpf: fix a race in txq wakeup")
> Signed-off-by: Joshua Hay <joshua.a.hay@intel.com>
> Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
> ---
>  .../ethernet/intel/idpf/idpf_singleq_txrx.c   |  4 +-
>  drivers/net/ethernet/intel/idpf/idpf_txrx.c   | 51 +++++++++++++------
>  drivers/net/ethernet/intel/idpf/idpf_txrx.h   |  9 +++-
>  3 files changed, 44 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
> index 4c1d7235a073..d8216bb13019 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_singleq_txrx.c
> @@ -361,12 +361,12 @@ netdev_tx_t idpf_tx_singleq_frame(struct sk_buff *skb,
>  				  struct idpf_tx_queue *tx_q)
>  {
>  	struct idpf_tx_offload_params offload = { };
> +	unsigned int count, buf_count;

u32

>  	struct idpf_tx_buf *first;
>  	int csum, tso, needed;
> -	unsigned int count;
>  	__be16 protocol;
>  
> -	count = idpf_tx_desc_count_required(tx_q, skb);
> +	count = idpf_tx_res_count_required(tx_q, skb, &buf_count);
>  	if (unlikely(!count))
>  		return idpf_tx_drop_skb(tx_q, skb);

[...]

>  static int idpf_tx_maybe_stop_splitq(struct idpf_tx_queue *tx_q,
> -				     unsigned int descs_needed)
> +				     unsigned int descs_needed,
> +				     unsigned int bufs_needed)

Same (and everywhere else).

>  {
> +	/* Since we have multiple resources to check for splitq, our
> +	 * start,stop_thrs becomes a boolean check instead of a count
> +	 * threshold.
> +	 */
>  	if (netif_subqueue_maybe_stop(tx_q->netdev, tx_q->idx,
> -				      idpf_txq_has_room(tx_q, descs_needed),
> +				      idpf_txq_has_room(tx_q, descs_needed,
> +							bufs_needed),
>  				      1, 1))
>  		return 0;

[...]

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> index a79a6a89c5e3..2d4846793f5a 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
> @@ -116,6 +116,10 @@ do {								\
>  #define IDPF_DESC_UNUSED(txq)     \
>  	((((txq)->next_to_clean > (txq)->next_to_use) ? 0 : (txq)->desc_count) + \
>  	(txq)->next_to_clean - (txq)->next_to_use - 1)
> +#define IDPF_BUFS_UNUSED(refillq)      \
> +	((((refillq)->next_to_use > (refillq)->next_to_clean) ? \
> +	  0 : (refillq)->desc_count) + \
> +	 (refillq)->next_to_use - (refillq)->next_to_clean)

Just make a static inline.

>  
>  #define IDPF_TX_BUF_RSV_UNUSED(txq)	((txq)->stash->buf_stack.top)
>  #define IDPF_TX_BUF_RSV_LOW(txq)	(IDPF_TX_BUF_RSV_UNUSED(txq) < \

Thanks,
Olek

  reply	other threads:[~2025-06-27 13:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 16:11 [Intel-wired-lan] [PATCH net 0/5] idpf: replace Tx flow scheduling buffer ring with buffer pool Joshua Hay
2025-06-25 16:11 ` [Intel-wired-lan] [PATCH net 1/5] idpf: add support for Tx refillqs in flow scheduling mode Joshua Hay
2025-06-27 13:13   ` Alexander Lobakin
2025-06-25 16:11 ` [Intel-wired-lan] [PATCH net 2/5] idpf: improve when to set RE bit logic Joshua Hay
2025-06-25 16:11 ` [Intel-wired-lan] [PATCH net 3/5] idpf: replace flow scheduling buffer ring with buffer pool Joshua Hay
2025-06-27 13:10   ` Alexander Lobakin
2025-06-30 16:11     ` Hay, Joshua A
2025-06-30 16:11       ` Hay, Joshua A
2025-06-25 16:11 ` [Intel-wired-lan] [PATCH net 4/5] idpf: stop Tx if there are insufficient buffer resources Joshua Hay
2025-06-27 13:17   ` Alexander Lobakin [this message]
2025-06-25 16:11 ` [Intel-wired-lan] [PATCH net 5/5] idpf: remove obsolete stashing code Joshua Hay
2026-01-12  9:56   ` Loktionov, Aleksandr
2026-01-12  9:56     ` Loktionov, Aleksandr
2025-06-25 22:32 ` [Intel-wired-lan] [PATCH net 0/5] idpf: replace Tx flow scheduling buffer ring with buffer pool Paul Menzel
2025-06-30 16:08   ` Hay, Joshua A
2025-06-30 16:08     ` Hay, Joshua A
2025-06-30 16:22     ` Paul Menzel
2025-07-03 20:21       ` Hay, Joshua A
2025-07-03 20:21         ` Hay, Joshua A
2025-07-07 14:43       ` Brian Vazquez
2025-07-11 21:14         ` Paul Menzel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e88f5dd-05ab-4465-83c9-9c4d4ebcf3d6@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=joshua.a.hay@intel.com \
    --cc=madhu.chittim@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.