From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CA544963CE for ; Wed, 29 Jul 2026 16:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785342787; cv=none; b=FxUPwmadebqYexoSEUSyd7Qahh1OdezBwd3laEyXUSbJ3ItmFM4HHR3bbnKP4KLwx8HEikE18m405jhisruYwKNIniu7J0sePaFg9aaBkHXH5qCVsL/QACREHcf2bYMq2y/5TcDyeXLOXbxufSBPjLZiqe6ev2tVySHe7nChoJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785342787; c=relaxed/simple; bh=/4XUSjwFIMzU/ofJvehDBkb4qTc5c53Yt9jPhCQa1Zc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jxlNsyiTjC3omz7PrL+A8RZEc0uwm6hNv/Wd/9AL0/7vJIiVoTIxpf/3Bvu2HAuxUT/5+9aAKZ2nDwUMS5nR74Jqsg+6k9pX8W7MhIw0+gNYRZAwyT/ydJi8qeDOE5hVqfzcOOkKIpfCut4H3uCH1Ti2BASe5ChyxacsQzTmQDI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Qgn5PVBQ; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qgn5PVBQ" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-382ef647e20so1181394a91.1 for ; Wed, 29 Jul 2026 09:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785342785; x=1785947585; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=fArv74sVKQZ0CBDPXzKJ26kTPH49bXsdYCIt+szposY=; b=Qgn5PVBQ8pu96bgenzbkcQs1VTplQN7+cQWi6I0EwLy8YNPqig6KVtHIOrb131Ic9B P1fFR8BgQBd8DsgbWH/sE5qBo3srTeyDrpbA5u4aZkbcIjygSLrFM5wxW1NNkFgQhgvT myw79vus+8Ccc+neTEKYopYkA4HVrf+hiEBfxoaKAeHiET7YiQ64oQNDPC5rOKjPx6SR O6frWIcYJWbfFxQtWKyK2tIslhVEvbvuxRuosYkS1WzmHVzLm2wayrSx6R09i3BtDBjw /3jSInR8+HtvlJh++OVgB7Yl7K0QbUm1aHWXZu0f0utZaT+Qv0TjvszsuPeSzAMvSjqR Ib5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785342785; x=1785947585; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=fArv74sVKQZ0CBDPXzKJ26kTPH49bXsdYCIt+szposY=; b=kdEOuLL+VuVq0R+cB2Em627lNzMh0YgXfVXH12ZCh1uAFRyl1kovH03uKnFW0f8enc Bq6LC8Gq/TDCsmbkJs+SAO2ux8pgWuHJDS1yVa1djBQYdaElA1oTNiavyNIPhZomgnov yBVPCzTheKgaZAv/y6k32ce4DQ+WlIEPjbcxnP7dIOMInWQ4DrIsLMcpjE9KTufV8b7T 9JbtelOWp0veylBmpE4QIEEdMJ2abdqnh4Des9rZaTlJhcQzAfqyLwH7p3qU442aU1U6 54GQPqhQnMABV3PeXw9a0k86VbTIejNolaDcjmQTASQitb68s/LIXKRFZS6RFMj83KM0 hZzw== X-Forwarded-Encrypted: i=1; AHgh+Rov7tJZUNG680Hx61H4RZ8UIdV4cOcapX0cK+wjp05+kkZ3zcYsexaN7UlAlyw3gwTp5W4SL6itLmndBQ0=@vger.kernel.org X-Gm-Message-State: AOJu0YwuhMhPEpcBCEBi3nccodUaPLMmEsb1mimVf4B4q6yEQtNEacnV B18vy2NLhTDP9LENSbFjR7FVEIAPqacSkx/Z91+IjwK3FVNtMEgh5xQL X-Gm-Gg: AR+sD10mMPWRpLswuh4gjYgqv3YjnCNXnceWtH7ouLux1z6for2P8reoqjfii42bCgK 5IdbRXI63vveC2zK/R40kycydckqfR+gouyMeGeb9B9lfOX+8DLwG5LCR4KHCOxUCK2NXgH67Cm Bz2SorCuMu6cQizqmLYWx6dEqeZxfs4tuOuwlwFMqkiM2yw3+HtgnrYBsmTfS1QcsbntqkCt5cs NHhdbHox+Q4gr0osuSRSHCuxA+l+7GHMrEMRMmOC5CnrqiFW8MaSPqY7CmNozPdQO6W6KbuNAxr xnT3+CJylRt8UzFGFY/9TYP9Eh1Lt2KZB47ict59I0exjoe0iseQlm/372KPBrjlNewPQryd6qQ S/r+LuvV7BSb78c+wK2b+b6ztsigfwKtrg8aMHwPn6mcVJfRYV9XG/5EMs6lk51BuS7njkbqV1d QRmGaeWhqQXMBTYVa+p+sSD2jFxIXBSJzPFNKotV24uaIh85GfDWW//65Y/q95aTyamBEQS2d7Z 9wmL3dFug== X-Received: by 2002:a17:90b:4ad0:b0:38e:11ba:992e with SMTP id 98e67ed59e1d1-38f6a544ac8mr6261749a91.35.1785342785061; Wed, 29 Jul 2026 09:33:05 -0700 (PDT) Received: from devvm29614.prn0.facebook.com ([2a03:2880:ff:4f::]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38f7f12bcbcsm1672033a91.6.2026.07.29.09.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 09:33:04 -0700 (PDT) Date: Wed, 29 Jul 2026 09:33:02 -0700 From: Bobby Eshleman To: Tariq Toukan Cc: Saeed Mahameed , Mark Bloch , Leon Romanovsky , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dragos Tatulea , Mina Almasry , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Bobby Eshleman Subject: Re: [PATCH net] net/mlx5e: fix BQL reset on SQ re-activation Message-ID: References: <20260728-mlx5-bql-v1-1-99a0ab77ede7@meta.com> <756e9c86-38f3-4a94-833f-afb0559397a3@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <756e9c86-38f3-4a94-833f-afb0559397a3@nvidia.com> On Wed, Jul 29, 2026 at 03:32:56PM +0300, Tariq Toukan wrote: > > > On 29/07/2026 0:47, Bobby Eshleman wrote: > > From: Bobby Eshleman > > > > mlx5e_queue_start() deactivates and re-activates all channels but closes > > only the queue being restarted. mlx5e_activate_txqsq() then > > unconditionally calls netdev_tx_reset_queue(), zeroing the BQL counters > > of channels that kept their in-flight TX WQEs. The next completion then > > over-charges and trips the BUG_ON() in dql_completed(): > > > > kernel BUG at lib/dynamic_queue_limits.c:99! > > RIP: 0010:dql_completed+0x23d/0x280 > > Call Trace: > > > > mlx5e_poll_tx_cq+0x668/0xa60 > > mlx5e_napi_poll+0x5b/0x7b0 > > net_rx_action+0x15a/0x580 > > > > Reset BQL only when the SQ has no bytes in flight (sq->cc == sq->pc). > > > > In the case that reset is skipped, the outstanding WQEs will eventually > > complete and rebalance the dql. The dql->limit is carried across the > > reset. > > > > Fixes: b2588ea40ec9 ("net/mlx5e: Implement queue mgmt ops and single channel swap") > > Signed-off-by: Bobby Eshleman > > --- > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- > > drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 3 ++- > > 2 files changed, 5 insertions(+), 2 deletions(-) > > > > Thanks for your patch. > > Overall the fix LGTM, just one comment below. > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > index 4a8351f95b27..44834890a409 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > @@ -1940,7 +1940,9 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) > > { > > sq->txq = netdev_get_tx_queue(sq->netdev, sq->txq_ix); > > set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > > - netdev_tx_reset_queue(sq->txq); > > + /* Reset BQL only when the SQ has no bytes in flight. */ > > + if (sq->cc == sq->pc) > > + netdev_tx_reset_queue(sq->txq); > > netif_tx_start_queue(sq->txq); > > netif_queue_set_napi(sq->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, sq->cq.napi); > > } > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c > > index 0b5e600e4a6a..d0ad1b8d6988 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c > > @@ -909,7 +909,8 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq) > > sq->cc = sqcc; > > /* Do not update BQL for TXQs that got replaced by new active ones, as > > - * netdev_tx_reset_queue() is called for them in mlx5e_activate_txqsq(). > > + * netdev_tx_reset_queue() is called for them in mlx5e_activate_txqsq() > > + * if the queue has zero in-flight WQEs. > > */ > > Please drop this hunk. In this path the replacement SQ is always freshly > created, so cc == pc == 0 and the reset always happens - the qualifier > invites the reader to worry about a case that cannot occur here. The > original wording is accurate as-is. Ah makes sense, thanks. Will re-send with the change! Best, Bobby > > > if (sq == sq->priv->txq2sq[sq->txq_ix]) > > netdev_tx_completed_queue(sq->txq, npkts, nbytes); > > > > --- > > base-commit: b515dc54795ef370be3cb396e7c12ad91686b6d1 > > change-id: 20260728-mlx5-bql-84e02a5a46c8 > > > > Best regards, >