From: Mohan Prasad J <mohan.prasad@microchip.com>
To: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<kuba@kernel.org>, <andrew@lunn.ch>
Cc: <edumazet@google.com>, <pabeni@redhat.com>, <shuah@kernel.org>,
<mohan.prasad@microchip.com>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <horms@kernel.org>,
<brett.creeley@amd.com>, <rosenp@gmail.com>,
<UNGLinuxDriver@microchip.com>, <willemb@google.com>,
<petrm@nvidia.com>
Subject: [PATCH net-next v3 2/3] selftests: nic_link_layer: Add selftest case for speed and duplex states
Date: Thu, 17 Oct 2024 03:20:06 +0530 [thread overview]
Message-ID: <20241016215014.401476-3-mohan.prasad@microchip.com> (raw)
In-Reply-To: <20241016215014.401476-1-mohan.prasad@microchip.com>
Add selftest case for testing the speed and duplex state of
local NIC driver and the partner based on the supported
link modes obtained from the ethtool. Speed and duplex states
are varied and verified using ethtool.
Signed-off-by: Mohan Prasad J <mohan.prasad@microchip.com>
---
.../drivers/net/hw/nic_link_layer.py | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/hw/nic_link_layer.py b/tools/testing/selftests/drivers/net/hw/nic_link_layer.py
index fb046efbe..4548da3d9 100644
--- a/tools/testing/selftests/drivers/net/hw/nic_link_layer.py
+++ b/tools/testing/selftests/drivers/net/hw/nic_link_layer.py
@@ -73,6 +73,27 @@ def test_autonegotiation(cfg, link_config) -> None:
time.sleep(time_delay)
verify_autonegotiation(cfg, state, link_config)
+def test_network_speed(cfg, link_config) -> None:
+ common_link_modes = link_config.common_link_modes
+ if not common_link_modes:
+ KsftSkipEx("No common link modes exist")
+ speeds, duplex_modes = link_config.get_speed_duplex_values(common_link_modes)
+
+ if speeds and duplex_modes and len(speeds) == len(duplex_modes):
+ for idx in range(len(speeds)):
+ speed = speeds[idx]
+ duplex = duplex_modes[idx]
+ if link_config.set_speed_and_duplex(speed, duplex) == False:
+ raise KsftFailEx(f"Unable to set speed and duplex parameters for {cfg.ifname}")
+ time.sleep(time_delay)
+ if link_config.verify_speed_and_duplex(speed, duplex) == False:
+ raise KsftSkipEx(f"Unable to verify speed and duplex states for interface {cfg.ifname}")
+ else:
+ if not speeds or not duplex_modes:
+ KsftSkipEx(f"No supported speeds or duplex modes found for interface {cfg.ifname}")
+ else:
+ KsftSkipEx("Mismatch in the number of speeds and duplex modes")
+
def main() -> None:
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
link_config = LinkConfig(cfg)
--
2.43.0
next prev parent reply other threads:[~2024-10-17 4:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 21:50 [PATCH net-next v3 0/3] selftests: Add selftest for link layer and performance testing Mohan Prasad J
2024-10-16 21:50 ` [PATCH net-next v3 1/3] selftests: nic_link_layer: Add link layer selftest for NIC driver Mohan Prasad J
2024-10-22 10:17 ` Paolo Abeni
2024-10-24 7:26 ` Mohan.Prasad
2024-10-16 21:50 ` Mohan Prasad J [this message]
2024-10-16 21:50 ` [PATCH net-next v3 3/3] selftests: nic_performance: Add selftest for performance of " Mohan Prasad J
2024-10-22 10:40 ` Paolo Abeni
2024-10-24 7:34 ` Mohan.Prasad
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=20241016215014.401476-3-mohan.prasad@microchip.com \
--to=mohan.prasad@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=rosenp@gmail.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/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