[PATCH net-next v5 1/2] vsock/test: Add macros to identify transports

Luigi Leonardi posted 2 patches 3 months, 1 week ago
[PATCH net-next v5 1/2] vsock/test: Add macros to identify transports
Posted by Luigi Leonardi 3 months, 1 week ago
Add three new macros: TRANSPORTS_G2H, TRANSPORTS_H2G and
TRANSPORTS_LOCAL.
They can be used to identify the type of the transport(s) loaded when
using the `get_transports()` function.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
---
 tools/testing/vsock/util.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/vsock/util.h b/tools/testing/vsock/util.h
index 71895192cc02313bf52784e2f77aa3b0c28a0c94..fdd4649fe2d49f57c93c4aa5dfbb37b710c65918 100644
--- a/tools/testing/vsock/util.h
+++ b/tools/testing/vsock/util.h
@@ -33,6 +33,10 @@ static const char * const transport_ksyms[] = {
 static_assert(ARRAY_SIZE(transport_ksyms) == TRANSPORT_NUM);
 static_assert(BITS_PER_TYPE(int) >= TRANSPORT_NUM);
 
+#define TRANSPORTS_G2H   (TRANSPORT_VIRTIO | TRANSPORT_VMCI | TRANSPORT_HYPERV)
+#define TRANSPORTS_H2G   (TRANSPORT_VHOST | TRANSPORT_VMCI)
+#define TRANSPORTS_LOCAL (TRANSPORT_LOOPBACK)
+
 /* Tests can either run as the client or the server */
 enum test_mode {
 	TEST_MODE_UNSET,

-- 
2.50.0
Re: [PATCH net-next v5 1/2] vsock/test: Add macros to identify transports
Posted by Stefano Garzarella 3 months, 1 week ago
On Mon, Jun 30, 2025 at 06:33:03PM +0200, Luigi Leonardi wrote:
>Add three new macros: TRANSPORTS_G2H, TRANSPORTS_H2G and
>TRANSPORTS_LOCAL.
>They can be used to identify the type of the transport(s) loaded when
>using the `get_transports()` function.
>
>Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
>Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
>---
> tools/testing/vsock/util.h | 4 ++++
> 1 file changed, 4 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/tools/testing/vsock/util.h b/tools/testing/vsock/util.h
>index 71895192cc02313bf52784e2f77aa3b0c28a0c94..fdd4649fe2d49f57c93c4aa5dfbb37b710c65918 100644
>--- a/tools/testing/vsock/util.h
>+++ b/tools/testing/vsock/util.h
>@@ -33,6 +33,10 @@ static const char * const transport_ksyms[] = {
> static_assert(ARRAY_SIZE(transport_ksyms) == TRANSPORT_NUM);
> static_assert(BITS_PER_TYPE(int) >= TRANSPORT_NUM);
>
>+#define TRANSPORTS_G2H   (TRANSPORT_VIRTIO | TRANSPORT_VMCI | TRANSPORT_HYPERV)
>+#define TRANSPORTS_H2G   (TRANSPORT_VHOST | TRANSPORT_VMCI)
>+#define TRANSPORTS_LOCAL (TRANSPORT_LOOPBACK)
>+
> /* Tests can either run as the client or the server */
> enum test_mode {
> 	TEST_MODE_UNSET,
>
>-- 
>2.50.0
>