๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21615

Re: [PATCH net-next v2 3/8] ibmveth: Refactor buffer pool management for per-queue MQ RX

#21615
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 08:54
149 lines
12911 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] ibmveth: persistent pool deactivation in
  ibmveth_alloc_queue_buffer_pools()

--

> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -660,6 +660,100 @@ static void ibmveth_rxq_no_skb(struct ibmveth_adapter *adapter,
>  	schedule_work(&adapter->work);
>  }
>  
> +/**
> + * ibmveth_free_queue_buffer_pools - Free buffer pools for a single queue
> + * @adapter: ibmveth adapter structure
> + * @queue: queue index
> + *
> + * Frees every pool on @queue regardless of the active flag;
> + * ibmveth_free_buffer_pool() skips what was never allocated.
> + */
> +static void ibmveth_free_queue_buffer_pools(struct ibmveth_adapter *adapter,
> +					    int queue)
> +{
> +	int i;
> +
> +	for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
> +		ibmveth_free_buffer_pool(adapter,
> +					 &adapter->rx_buff_pool[queue][i]);
> +}
> +
> +/**
> + * ibmveth_alloc_queue_buffer_pools - Allocate buffer pools for a single queue
> + * @adapter: ibmveth adapter structure
> + * @queue: queue index
> + *
> + * Allocates backing storage for each active pool on @queue.
> + *
> + * Return: 0 on success, -ENOMEM on failure
> + */
> +static int ibmveth_alloc_queue_buffer_pools(struct ibmveth_adapter *adapter,
> +					    int queue)
> +{
> +	struct net_device *netdev = adapter->netdev;
> +	int i;
> +
> +	for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++) {
> +		struct ibmveth_buff_pool *bpool =
> +			&adapter->rx_buff_pool[queue][i];
> +
> +		if (!bpool->active)
> +			continue;
> +
> +		if (ibmveth_alloc_buffer_pool(bpool)) {
> +			netdev_err(netdev,
> +				   "queue %d pool %d alloc failed (size=%u count=%u)\n",
> +				   queue, i,
> +				   bpool->buff_size,
> +				   bpool->size);
> +			bpool->active = 0;
> +			/* Undo the pools this queue already allocated; the
> +			 * failed one freed its own partial allocation.
> +			 */
> +			ibmveth_free_queue_buffer_pools(adapter, queue);
> +			return -ENOMEM;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +/**
> + * ibmveth_alloc_buffer_pools - Allocate buffer pools for all queues
> + * @adapter: ibmveth adapter structure
> + *
> + * Return: 0 on success, -ENOMEM on failure
> + */
> +static int
> +ibmveth_alloc_buffer_pools(struct ibmveth_adapter *adapter)
> +{
> +	int q, rc;
> +
> +	for (q = 0; q < adapter->num_rx_queues; q++) {
> +		rc = ibmveth_alloc_queue_buffer_pools(adapter, q);
> +		if (rc) {
> +			while (--q >= 0)
> +				ibmveth_free_queue_buffer_pools(adapter, q);
> +			return rc;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +/**
> + * ibmveth_free_buffer_pools - Free buffer pools for all queues
> + * @adapter: ibmveth adapter structure
> + */
> +static void
> +ibmveth_free_buffer_pools(struct ibmveth_adapter *adapter)
> +{
> +	int q;
> +
> +	for (q = 0; q < adapter->num_rx_queues; q++)
> +		ibmveth_free_queue_buffer_pools(adapter, q);
> +}
> +
>  /**
>   * ibmveth_remove_buffer_from_pool - remove a buffer from a pool
>   * @adapter: adapter instance

[Severity: Medium]
Now that ibmveth_free_queue_buffer_pools() frees every pool on the
queue regardless of the active flag, is there still a reason to clear
bpool->active here?

The active flag is the pool's persistent configuration. It comes from
pool_active[] at probe, is turned on by ibmveth_change_mtu() for large
MTUs and toggled through veth_pool_store(), and ibmveth_close() leaves
it alone so the same pools come back on the next open. Clearing it on
a transient ibmveth_alloc_buffer_pool() failure has two effects. A
later ibmveth_open() quietly skips that pool, and it can succeed
without a pool large enough for mtu + IBMVETH_BUFF_OH.

None of the callers of ibmveth_open() put the flag back.
veth_pool_store() only restores oldactive for the pool it is editing.
The ndo_open path, ibmveth_change_mtu(), ibmveth_set_csum_offload(),
ibmveth_set_tso() and ibmveth_reset() do not touch it at all.

The old single-queue loop did the same thing. With per-queue pools,
though, a failure on one queue also leaves rx_buff_pool[q][i].active
different between queues for the same pool index.

Can this line simply be dropped, since the unwind no longer depends on
it?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123075136.3278-1-mmc%40linux.ibm.com
Technical Details
Message-ID: <179551045236.3135.13521842784287344413@kernel.org>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370123-linux-kernel-netdev=dewy.ru
References: <20261123075136.3278-4-mmc@linux.ibm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370123-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 3/8] ibmveth: Refactor buffer pool management
 for per-queue MQ RX
Date: Tue, 24 Nov 2026 08:54:12 +0000
Organization: Usenet Network
Message-ID: <179551045236.3135.13521842784287344413@kernel.org>
References: <20261123075136.3278-4-mmc@linux.ibm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4093504"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:XXTSdy2AdooDfSsea4dBJLHmSZM= sha256:bqT//3K5m4/RGezyN6xcePWwvUeeo2Ac81IVkkcPEZY=
	sha1:Tj+JE1u6hdy9ArSUbjNYiHwJ35U= sha256:Y020WPStXOZTyzY25Oj91EjhQrbZwhrJtmbzbqsg1EI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 7D86C125DE6; Tue, 24 Nov 2026 11:54:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 115jjBWGLGw2;
	Tue, 24 Nov 2026 11:54:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370123-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 098B8125DE5; Tue, 24 Nov 2026 11:54:26 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 0763136801; Tue, 24 Nov 2026 08:54:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795510455;
	b=Co6+I8rj8O2/Lamnd9KlfOZ3aNjLn1Idoc2eNeZsDElcZeMDWwc44wkrbLHxfNwsueIF
	 779kamKg3hFWG3tpfDEPtlgsAC0uWZtEQU4AL1bPmwiafO+YWSGkYOpYnFq4T9YjeEc+L
	 TTGnGh3b81nX736u7qrDLHWiiIaZ7h/5mmFJDEQoOutSsrFZRi06dvw0I6uBiqY/ci2Bz
	 wZwG7CcBgArN/dMSCLDexraAB6AQAjXtxIJ3hPbLLcfKJ0Pd390pLkUaw83N+DMOpICjD
	 BxrsrZuaCC8nS6SZdls1mj1aUYhKcp/JICuPhEjF1n8O2Xyo6ICB5FzWlZXF79sCvbA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795510455;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=QUDG01uMlxGs3ZoZiYFkDjI4/YMZ+OvwNTGHmN+I410=;
	b=D7nV83bIsTiNVXP2bp8c/jBVZqTj5jKV4msilLdTegTgCOd3UYI7vPonyw7TNL4qtDAw
	 VxCz5rguCSkc/xNnlXckqmnxkoFY2nZszqh5fhjQFAdYclCWAbrF9KkwD4mMKjHAT+BhF
	 P0yYXmm8cYsY41GEDtRjHC26DDJtVwk7Q5PGyzu1ugWnfmtcaOSOY3QtUnfVRRCh0mKb6
	 m4pQTMpD9GgjO5GNXhcygfYYQ0ySSNBwzt+Mvc8SPiy/y/1dJhsNAatcm1NX5BoFsLjw6
	 pqsWypobmGn2jaiBeAPDEz+4+icmnMdigOy0a2ph4C84DCAG0PKHqyKmI3cJ/ILruGw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TfRNVklo;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B77C4606A332;
	Tue, 24 Nov 2026 08:54:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TfRNVklo
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795510454;
	b=o9Yz/9zXxGcCtpNrbPyQJDyQQwYI98Fl4Lfju3QOIF32zl74i78mm0X1E6gQVz22A+LX
	 /ODM5V1DVFwtt/vWCYeNJpHgrsEIriXZFtc6rmNb5ewEEAgXbghlySE/xMhQlVqF7gat1
	 4IuV9g1/3pGKvpNcdqhWWqtsRfUSiI9XNps6125lnnHzYQ3+r1WfjuoMVJ2U0xAn6uHY9
	 fRD3+uyIgVbExflAVVCiY4VHT3dFmbNO2QpZwHWpbbDRySYqBjNOOsrZ0XX0q/LPVLLix
	 LMNsUwFy0du74217yL+uXYzOU0M6XK+YviJCg/busckVyVZLrpgEc6D9nNtD1PaK+Xw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795510454;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=QUDG01uMlxGs3ZoZiYFkDjI4/YMZ+OvwNTGHmN+I410=;
	b=oIHnqTweKuCOHkUBXVzCdaKU/aw0Ggz9hA0Mx98YqsKlB5xEe/BsqklHuKL8ZoqSEGXa
	 SwGIeDwCG/u8XXqwPxSIrocYSIen1seG8nnndRmswE51MfJ6ok27bK4AmiSwdI9ZxzVZa
	 pkpW0jWPdYV5iqVUN11uy1shKWqS9M7OHebj/rXZ/NfBZ5PJ1QXOQne8w1OMRdegZjZSb
	 9nT6jA7Y2jF+lqJM3srYySP60Sqy9w2GfbRoKywuh6J9w+kSXNVSAlHHRj8eF0VHtv7fi
	 mAokV3ariqePtmpfzleGXtXy615EkjjfFtez5rK7ffeVJtt/dnyx20kJKpFgHnTSCoA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TfRNVklo;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3D99606A327
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 08:54:14 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D404E1F000C4;
	Tue, 24 Nov 2026 08:54:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795510454;
	bh=QUDG01uMlxGs3ZoZiYFkDjI4/YMZ+OvwNTGHmN+I410=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=TfRNVkloSLo0i8Z+98n7kJzxtT3DU4Mr/yjjHMNjjq+9oqP/HL+pPpfyqsJIQHQ6Z
	 ZMTlpENxKVbaUwWzBm7UdU9KPEOdEOFpCdy64MKOEL63R+PB1v8LKpOl20RTSbsttg
	 LapyGllfn6YDe/HZqcUKOULGz1qvgKEQgWStvxAw3n8LD989m9vgCs8acIfjPD2JGk
	 /DSXpniTbRZgom+1Op7aeACQFjr0Hc4U6bIlHBNZNfoMdY/AZZpGlu4qG12lJxrXsj
	 keD1Q9MOR2NdtcSBd3vEIlPCpH2QnydEsAus1x0RLFoEg47BYt1eCvgQKPqc9okB56
	 DjuyUBxS1j0KQ==
X-Cc: netdev@vger.kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au,
 npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
 sshegde@linux.ibm.com, nnac123@linux.ibm.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linuxppc-dev@lists.ozlabs.org, horms@kernel.org, davemarq@linux.ibm.com,
 haren@linux.ibm.com, ricklind@linux.ibm.com, bjking1@linux.ibm.com,
 shaik.abdulla1@ibm.com
X-In-Reply-To: <20261123075136.3278-4-mmc@linux.ibm.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list