From: Gal Pressman <gal@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"Tariq Toukan" <tariqt@nvidia.com>,
Edward Cree <ecree.xilinx@gmail.com>,
Ahmed Zaki <ahmed.zaki@intel.com>, <linux-doc@vger.kernel.org>,
Gal Pressman <gal@nvidia.com>, Nimrod Oren <noren@nvidia.com>
Subject: [PATCH net-next v4 4/5] selftests: drv-net: Introduce a function that checks whether a port is available on remote host
Date: Thu, 20 Feb 2025 13:34:34 +0200 [thread overview]
Message-ID: <20250220113435.417487-5-gal@nvidia.com> (raw)
In-Reply-To: <20250220113435.417487-1-gal@nvidia.com>
Add a function that checks whether a port is available on the remote
host, this will be used downstream to verify that ports that were
allocated locally are also available on the remote side.
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
tools/testing/selftests/net/lib/py/utils.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 5a13f4fd3784..903cc042ed0e 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -123,6 +123,13 @@ def ethtool(args, json=None, ns=None, host=None):
return tool('ethtool', args, json=json, ns=ns, host=host)
+def check_port_available_remote(port, host):
+ """
+ Check if a port is available on remote host.
+ Raise exception if not available.
+ """
+ cmd(f"python3 -c 'import socket; s=socket.socket(socket.AF_INET6, socket.SOCK_STREAM); s.bind((\"\", {port}))'", host=host)
+
def rand_port():
"""
Get a random unprivileged port.
--
2.40.1
next prev parent reply other threads:[~2025-02-20 11:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 11:34 [PATCH net-next v4 0/5] Symmetric OR-XOR RSS hash Gal Pressman
2025-02-20 11:34 ` [PATCH net-next v4 1/5] ethtool: " Gal Pressman
2025-02-21 10:51 ` Bagas Sanjaya
2025-02-23 12:41 ` Gal Pressman
2025-02-20 11:34 ` [PATCH net-next v4 2/5] net/mlx5e: Symmetric OR-XOR RSS hash control Gal Pressman
2025-02-20 11:34 ` [PATCH net-next v4 3/5] selftests: drv-net: Make rand_port() get a port more reliably Gal Pressman
2025-02-20 11:34 ` Gal Pressman [this message]
2025-02-20 11:34 ` [PATCH net-next v4 5/5] selftests: drv-net-hw: Add a test for symmetric RSS hash Gal Pressman
2025-02-21 2:03 ` Jakub Kicinski
2025-02-23 12:43 ` Gal Pressman
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=20250220113435.417487-5-gal@nvidia.com \
--to=gal@nvidia.com \
--cc=ahmed.zaki@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=tariqt@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.