From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C20F7C43458 for ; Mon, 6 Jul 2026 19:37:09 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gvF3p3W6Kz3brB; Tue, 07 Jul 2026 05:36:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783366614; cv=none; b=SOkhGGBtnUYR9u5laVqiKN6R2CgjiCCqyDUzBsriOpzzTx/9HjV50t+vHswrXtFuvzYjwqkXG7m9lUews4wo1XHUkDvq18Kd+Bkg4hQd3xC+isAVdRKYmO8tvyYl0cbQroBO1nR6OC07ze8DlRf7RpszuXGfO3SvUXGzf/Q3yuzmzC9sPhcpg01ggzkNPdI5gw3C1qrYKc5Tve5DwETLFN/TgkHr5wNfGKX23ac9FLq1Pb8O/5W+V2D0CuZe3UlC5vnaaZ3HRcdYWYlFcW4PQw5Kfmo1K3in1ES8HOSPaz8uZrDbEJq4dkVDmrCspOAh8yJG80AyBT/t/PFCtF28rA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1783366614; c=relaxed/relaxed; bh=vFSLvmk1zUspJRDUJrGMLAht1yNaZ1/rGIU2XnN27k4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=oEo333KXxLBjG4pFa5nwsyxO9ifyulLr1yda9imyJAYcI5MvXKW9FJhfKbt8LmARvDloC2cESUV03Bo9T7DsEuarly2XMBM46KjKYn4J0gF47JCe6D421EUE8ZgwQ0y30Z96WIqDsn0Afqs5JQhGIxpPfDilRs42ON1y/BUeA/TFgGB9N0/JLizg4t/rS/n/RrDDjj8tP2KbdxC0+8V95Fs9x2hFQdwLe1Q7ceVRksGfr1qUE91guGpdRpLnFc156UAT+M405f9mWeGe6IliZ7yk1uWqflsyT4QRyq72iynbApsoeMiDiijZiggZzOoo1gsfm2tV11Kj+wZKz93D6g== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=r+1dhCaO; dkim-atps=neutral; spf=pass (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=mmc@linux.ibm.com; receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=r+1dhCaO; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=mmc@linux.ibm.com; receiver=lists.ozlabs.org) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gvF3n3lB0z3br5 for ; Tue, 07 Jul 2026 05:36:53 +1000 (AEST) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 666FIP1x4069547; Mon, 6 Jul 2026 19:36:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=vFSLvm k1zUspJRDUJrGMLAht1yNaZ1/rGIU2XnN27k4=; b=r+1dhCaOvKsQeAAwqkZNea Uzl5dvAWjGkgtgJmKiUa5aVn8hj+wdjbTvl9/THNvdpu70TCJbkWRa7yDZXwzECa pckjlPhB1JGE8zg81niCw6o+6THGnRkZ4Zy3QR2l/O91GCUSOAct66dqFSiqFUf0 /Xa8Wb00jhbsVYHVi0NExSyGnrv2050ZEDfU2kfnYAGftgA8nwyCIMjRgM0aNDzv xWSovjX2Wr/xo+dAhA9RHZAQhGA8LM8LZ5EAmPCt7X2kQCYJnMiVhHfn4Yp4EWKl 9p8dQwxelVMsc6iDkbU88IoerXU4+/IerNwHacJTVBCfwxT06VuNS6kZrpG8Haog == Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4f6rkdkq40-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jul 2026 19:36:43 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 666JYZfv018719; Mon, 6 Jul 2026 19:36:43 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f7e0h6v1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Jul 2026 19:36:43 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 666JagJs5243474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Jul 2026 19:36:42 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0662F5805A; Mon, 6 Jul 2026 19:36:42 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F1F358051; Mon, 6 Jul 2026 19:36:41 +0000 (GMT) Received: from localhost.localdomain (unknown [9.61.26.177]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Jul 2026 19:36:40 +0000 (GMT) From: Mingming Cao To: netdev@vger.kernel.org Cc: horms@kernel.org, bjking1@linux.ibm.com, haren@linux.ibm.com, ricklind@linux.ibm.com, mmc@linux.ibm.com, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com, mpe@ellerman.id.au, Dave Marquardt Subject: [PATCH net-next v3 06/15] ibmveth: Refactor TX resource allocation in open/close paths Date: Mon, 6 Jul 2026 12:35:54 -0700 Message-Id: <20260706193603.8039-7-mmc@linux.ibm.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20260706193603.8039-1-mmc@linux.ibm.com> References: <20260706193603.8039-1-mmc@linux.ibm.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=M7J97Sws c=1 sm=1 tr=0 ts=6a4c03cc cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=mtsAU2ZvJdVy61tLPkIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA2MDE5NSBTYWx0ZWRfXyw6FXmZydTHW ZZz+lFLd5h3WjiPIiDFIMoTqH2MtwNJcwFkGKDNnXLJ/jtM97Qg1uxSKeaUP9XH31zoI4HCSmhv RgBLWvfifIn6jFJd053slBn4opMkCI+GXN47BiWpiKBeT1huQ/90jIuWRjGaN8IqynXXBIN5lgQ mtxJCwBrQlIhrpPhB/0g8t9WhXj+hrI0BhDGbhQ/iruZzVul0BAlWCzjg/lbWVI11/clw/RSS57 ViQYOvvlzMVjfVhTRCQDMIN6DXBlWmoPg3KMpwpD2St1/rd1jpVD586ys2f7YH7WUNyxIYx5C3x VdFZ0EU0u8T5ie8DnZjqsty8vm1WN/hhQVofhpX1ooL1xj2Q06l1f/EqVB9e7wdD1Kh+DEQuPfz /y2WbhE1rERg89aDdLmd0+8YvxEGsz7Zj4E2Zis3ILupNeeL4MQZi4MWmDfFeEYMvwKyQUSSvVZ 3v8hRPG3iqNw8lT+A1Q== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA2MDE5NSBTYWx0ZWRfX14oJahDFrEST n992p9X8Rp1xUicRfboAr+468Fy4RhMavZoYh6/Xs7znDLwvJYqPkeG1k3kbtFk2TPBAPTNhaEf R1ubFUKtUxNOlIBHr52ZijY21hrOw7s= X-Proofpoint-GUID: Q1VAz4Cau-gPe6BxyL1vYmzME6H1inx2 X-Proofpoint-ORIG-GUID: pY1KCm1Tw-JR-SeAfE-IbZ_mVpunhfGW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-06_02,2026-07-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607060195 Same story as the RX refactor: pull TX LTB alloc out of open/close. ibmveth_alloc_tx_resources() / ibmveth_free_tx_resources() walk real_num_tx_queues so ethtool TX channel changes keep working. Hooked into open/close in the next patch. No MQ RX behaviour change — TX was already multi-queue capable via ethtool -L. This patch only tidies the open/close path ahead of the RX helper wiring in the next patch. Signed-off-by: Mingming Cao Reviewed-by: Dave Marquardt --- drivers/net/ethernet/ibm/ibmveth.c | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index b5ae979c1f82..63b0184c622a 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -1038,6 +1038,49 @@ static int ibmveth_allocate_tx_ltb(struct ibmveth_adapter *adapter, int idx) return 0; } +/** + * ibmveth_alloc_tx_resources - Allocate TX resources for all queues + * @adapter: ibmveth adapter structure + * + * Allocates TX Long Term Buffers (LTBs) for all TX queues. + * + * Return: 0 on success, -ENOMEM on failure + */ +static int __maybe_unused +ibmveth_alloc_tx_resources(struct ibmveth_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + int i; + + for (i = 0; i < netdev->real_num_tx_queues; i++) { + if (ibmveth_allocate_tx_ltb(adapter, i)) + goto err_free_ltbs; + } + + return 0; + +err_free_ltbs: + while (--i >= 0) + ibmveth_free_tx_ltb(adapter, i); + return -ENOMEM; +} + +/** + * ibmveth_free_tx_resources - Free TX resources for all queues + * @adapter: ibmveth adapter structure + * + * Frees TX Long Term Buffers (LTBs) for all TX queues. + */ +static void __maybe_unused +ibmveth_free_tx_resources(struct ibmveth_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + int i; + + for (i = 0; i < netdev->real_num_tx_queues; i++) + ibmveth_free_tx_ltb(adapter, i); +} + static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, union ibmveth_buf_desc rxq_desc, u64 mac_address) -- 2.39.3 (Apple Git-146)