Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
	intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-next v2 2/4] ixgbe: add ixgbe_container_is_rx() helper and refine RX adaptive ITR
Date: Tue, 01 Dec 2026 15:37:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-243581@kernel.org> (raw)
In-Reply-To: <20261201152253.54577-3-aleksandr.loktionov@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ixgbe: TX ITR calculation in ixgbe_update_itr() clamps RX
  latency ITR jumps
--

commit 0b92d0742509acbe7f30d36376672231f5627956
Author: Alexander Duyck <alexander.h.duyck@intel.com>

ixgbe: add ixgbe_container_is_rx() helper and refine RX adaptive ITR

This commit introduces ixgbe_container_is_rx() and refines the RX adaptive
ITR latency calculation in ixgbe_update_itr() to target 8x the observed
byte count when 1..23 packets and fewer than 12112 bytes are received.

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 04f12af2cb4ca..9764b34381733 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -2712,6 +2712,12 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
>  	IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIAC, mask);
>  }
>  
> +static bool ixgbe_container_is_rx(struct ixgbe_q_vector *q_vector,
> +				  struct ixgbe_ring_container *rc)
> +{
> +	return &q_vector->rx == rc;
> +}
> +
>  /**
>   * ixgbe_update_itr - update the dynamic ITR value based on statistics
>   * @q_vector: structure containing interrupt and ring information
> @@ -2748,35 +2754,24 @@ static void ixgbe_update_itr(struct ixgbe_q_vector *q_vector,
>  		goto clear_counts;
>  
>  	packets = ring_container->total_packets;
> -
> -	/* We have no packets to actually measure against. This means
> -	 * either one of the other queues on this vector is active or
> -	 * we are a Tx queue doing TSO with too high of an interrupt rate.
> -	 *
> -	 * When this occurs just tick up our delay by the minimum value
> -	 * and hope that this extra delay will prevent us from being called
> -	 * without any work on our queue.
> -	 */
> -	if (!packets) {
> -		itr = (q_vector->itr >> 2) + IXGBE_ITR_ADAPTIVE_MIN_INC;
> -		if (itr > IXGBE_ITR_ADAPTIVE_MAX_USECS)
> -			itr = IXGBE_ITR_ADAPTIVE_MAX_USECS;
> -		itr += ring_container->itr & IXGBE_ITR_ADAPTIVE_LATENCY;
> -		goto clear_counts;
> -	}
> -
>  	bytes = ring_container->total_bytes;
>  
> -	/* If packets are less than 4 or bytes are less than 9000 assume
> -	 * insufficient data to use bulk rate limiting approach. We are
> -	 * likely latency driven.
> -	 */
> -	if (packets < 4 && bytes < 9000) {
> -		itr = IXGBE_ITR_ADAPTIVE_LATENCY;
> -		goto adjust_by_size;
> +	if (ixgbe_container_is_rx(q_vector, ring_container)) {
> +		/* If Rx and there are 1 to 23 packets and bytes are less than
> +		 * 12112 assume insufficient data to use bulk rate limiting
> +		 * approach. Instead we will focus on simply trying to target
> +		 * receiving 8 times as much data in the next interrupt.
> +		 */
> +		if (packets && packets < 24 && bytes < 12112) {
> +			itr = IXGBE_ITR_ADAPTIVE_LATENCY;
> +			avg_wire_size = (bytes + packets * 24) * 2;
> +			avg_wire_size = clamp_t(unsigned int,
> +						avg_wire_size, 2560, 12800);
> +			goto adjust_for_speed;
> +		}
>  	}
>  
> -	/* Between 4 and 48 we can assume that our current interrupt delay
> +	/* Less than 48 packets we can assume that our current interrupt delay
>  	 * is only slightly too low. As such we should increase it by a small
>  	 * fixed amount.
>  	 */
> @@ -2784,6 +2779,20 @@ static void ixgbe_update_itr(struct ixgbe_q_vector *q_vector,
>  		itr = (q_vector->itr >> 2) + IXGBE_ITR_ADAPTIVE_MIN_INC;
>  		if (itr > IXGBE_ITR_ADAPTIVE_MAX_USECS)
>  			itr = IXGBE_ITR_ADAPTIVE_MAX_USECS;
> +
> +		/* If sample size is 0 - 7 we should probably switch
> +		 * to latency mode instead of trying to control
> +		 * things as though we are in bulk.
> +		 *
> +		 * Otherwise if the number of packets is less than 48
> +		 * we should maintain whatever mode we are currently
> +		 * in. The range between 8 and 48 is the cross-over
> +		 * point between latency and bulk traffic.
> +		 */
> +		if (packets < 8)
> +			itr += IXGBE_ITR_ADAPTIVE_LATENCY;
> +		else
> +			itr += ring_container->itr & IXGBE_ITR_ADAPTIVE_LATENCY;
>  		goto clear_counts;
>  	}

[Severity: Medium]
Does q_vector->tx.itr clamp the new RX latency ITR target on combined
TX/RX queue vectors whenever TX has fewer than 48 packets?

ixgbe_set_itr() updates both q_vector->tx and q_vector->rx on every NAPI
poll and then picks the smaller value:

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:ixgbe_set_itr() {
	ixgbe_update_itr(q_vector, &q_vector->tx);
	ixgbe_update_itr(q_vector, &q_vector->rx);

	/* use the smallest value of new ITR delay calculations */
	new_itr = min(q_vector->rx.itr, q_vector->tx.itr);
}

When RX hits the new latency branch, q_vector->rx.itr is set to
IXGBE_ITR_ADAPTIVE_LATENCY | target_delay (up to 50 us at 10G or 84 us at
1G/2.5G).  However, if TX is idle (0 packets) or has fewer than 8 packets
during the same interval, q_vector->tx.itr enters the packets < 48 branch
and is set to IXGBE_ITR_ADAPTIVE_LATENCY | ((q_vector->itr >> 2) + 2).
Because both containers have IXGBE_ITR_ADAPTIVE_LATENCY set,
min(q_vector->rx.itr, q_vector->tx.itr) caps new_itr at
(q_vector->itr >> 2) + 2, preventing RX from jumping directly to the
calculated latency target and limiting it to +2 us steps per interrupt
(and resetting q_vector->tx.itr back to 10 us whenever time_after() fires).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201152253.54577-1-aleksandr.loktionov@intel.com?part=2

  reply	other threads:[~2026-12-01 15:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 15:22 [PATCH iwl-next v2 0/4] ixgbe: adaptive ITR tuning for RX starvation and latency workloads Aleksandr Loktionov
2026-12-01 15:22 ` [PATCH iwl-next v2 1/4] ixgbe: lower IXGBE_ITR_ADAPTIVE_MAX_USECS to prevent RX starvation Aleksandr Loktionov
2026-12-01 15:22 ` [PATCH iwl-next v2 2/4] ixgbe: add ixgbe_container_is_rx() helper and refine RX adaptive ITR Aleksandr Loktionov
2026-12-01 15:37   ` sashiko-bot [this message]
2026-12-01 15:22 ` [PATCH iwl-next v2 3/4] ixgbe: limit ITR decrease in latency mode to prevent ACK overdrive Aleksandr Loktionov
2026-12-01 15:22 ` [PATCH iwl-next v2 4/4] ixgbe: add IXGBE_ITR_ADAPTIVE_MASK_USECS constant Aleksandr Loktionov
  -- strict thread matches above, loose matches on Subject: below --
2026-10-06 14:40 [PATCH iwl-next v2 0/4] ixgbe: adaptive ITR tuning for RX starvation and latency workloads Aleksandr Loktionov
2026-10-06 14:40 ` [PATCH iwl-next v2 2/4] ixgbe: add ixgbe_container_is_rx() helper and refine RX adaptive ITR Aleksandr Loktionov
2026-11-07  3:35   ` Nowlin, Alexander
2026-09-18 13:33 [PATCH iwl-next v2 0/4] ixgbe: adaptive ITR tuning for RX starvation and latency workloads Aleksandr Loktionov
2026-09-18 13:33 ` [PATCH iwl-next v2 2/4] ixgbe: add ixgbe_container_is_rx() helper and refine RX adaptive ITR Aleksandr Loktionov

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=sashiko-outbox-243581@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox