From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B50225179E; Wed, 5 Mar 2025 18:08:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741198100; cv=none; b=Grss57BvHTvRBO5ghVfIZcfUO5pFPsM0/PsqofxICh5ZQWqLmjp3jXdqPIePbWsH2aa5S8qw0M7BO9aHRFQXxnbB05ynqvaVmzNyrJ/SRXMILVHdGwX1zajebZ7/Rko1ZDVd+7GFymiY6rPp7ouMFhn4NAhorm7grfDPxDlovjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741198100; c=relaxed/simple; bh=7puEq7QkPGAsg1F2K2slKdcM83SlK7oyHaKR+BKLsmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W4Y0zVfPoscioYO3W8+5lOj/ImYTdZG3Znmgu1IkH+RNYAppsM43BE8blZtnF33f+0QUsws1CErVxUhOFyWebx6CwrDVZRiLPrx3gGBkfJsRXVgxPmMmO3Cow0hpww2jTYERcHHivoRg6Hn6Ez5kXDkIddlJnEMdX1bzey7pz5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R6dlv/jR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R6dlv/jR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7956C4CED1; Wed, 5 Mar 2025 18:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1741198100; bh=7puEq7QkPGAsg1F2K2slKdcM83SlK7oyHaKR+BKLsmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6dlv/jRWU5x2qFAAy5w0KBll4sqXQcHwGX4Xdr2qrZ8xQzLjZ7Sm5qn5rYaLTuqM zzfNxiawhs5UvNHNqEBlCXpjYlk5MFk7x2tnHx2SFDlL9YVKCKR9ZrCttbjkX5ZvNq uQ17/JTOBBi3Bo9M4cWBcoThLoK1eN8RlWjcGJIU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joe Damato , David Wei , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 064/150] selftests: drv-net: Check if combined-count exists Date: Wed, 5 Mar 2025 18:48:13 +0100 Message-ID: <20250305174506.392627484@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250305174503.801402104@linuxfoundation.org> References: <20250305174503.801402104@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joe Damato [ Upstream commit 1cbddbddee68d17feb6467fc556c144777af91ef ] Some drivers, like tg3, do not set combined-count: $ ethtool -l enp4s0f1 Channel parameters for enp4s0f1: Pre-set maximums: RX: 4 TX: 4 Other: n/a Combined: n/a Current hardware settings: RX: 4 TX: 1 Other: n/a Combined: n/a In the case where combined-count is not set, the ethtool netlink code in the kernel elides the value and the code in the test: netnl.channels_get(...) With a tg3 device, the returned dictionary looks like: {'header': {'dev-index': 3, 'dev-name': 'enp4s0f1'}, 'rx-max': 4, 'rx-count': 4, 'tx-max': 4, 'tx-count': 1} Note that the key 'combined-count' is missing. As a result of this missing key the test raises an exception: # Exception| if channels['combined-count'] == 0: # Exception| ~~~~~~~~^^^^^^^^^^^^^^^^^^ # Exception| KeyError: 'combined-count' Change the test to check if 'combined-count' is a key in the dictionary first and if not assume that this means the driver has separate RX and TX queues. With this change, the test now passes successfully on tg3 and mlx5 (which does have a 'combined-count'). Fixes: 1cf270424218 ("net: selftest: add test for netdev netlink queue-get API") Signed-off-by: Joe Damato Reviewed-by: David Wei Link: https://patch.msgid.link/20250226181957.212189-1-jdamato@fastly.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- tools/testing/selftests/drivers/net/queues.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index 30f29096e27c2..4868b514ae78d 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -40,10 +40,9 @@ def addremove_queues(cfg, nl) -> None: netnl = EthtoolFamily() channels = netnl.channels_get({'header': {'dev-index': cfg.ifindex}}) - if channels['combined-count'] == 0: - rx_type = 'rx' - else: - rx_type = 'combined' + rx_type = 'rx' + if channels.get('combined-count', 0) > 0: + rx_type = 'combined' expected = curr_queues - 1 cmd(f"ethtool -L {cfg.dev['ifname']} {rx_type} {expected}", timeout=10) -- 2.39.5