* [PATCH v2] lib/vhost: add flag for async connection in client mode
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
@ 2024-04-17 9:15 ` Ушков Даниил
2024-04-25 13:47 ` Maxime Coquelin
2024-04-26 8:38 ` [PATCH v3] " Daniil Ushkov
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Ушков Даниил @ 2024-04-17 9:15 UTC (permalink / raw)
To: dev
Cc: Ушков
Даниил,
Maxime Coquelin, Chenbo Xia
This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
which in combination with the flag RTE_VHOST_USER_CLIENT makes
rte_vhost_driver_start connect asynchronously to the vhost server.
Signed-off-by: Ушков Даниил <udav@mts.ru>
---
Fixes:
1. Fix warning about the name in signature.
2. Fix warning about coding style.
P.S.
Is it ok that name is not in ascii?
Sorry, it could be hard to change it now.
lib/vhost/rte_vhost.h | 1 +
lib/vhost/socket.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index db92f05344..b0434c4b8d 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -41,6 +41,7 @@ extern "C" {
#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
#define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
#define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
+#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
/* Features. */
#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 96b3ab5595..c681d53abb 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -45,6 +45,7 @@ struct vhost_user_socket {
bool async_copy;
bool net_compliant_ol_flags;
bool stats_enabled;
+ bool async_connect;
/*
* The "supported_features" indicates the feature bits the
@@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
const char *path = vsocket->path;
struct vhost_user_reconnect *reconn;
- ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
- sizeof(vsocket->un));
- if (ret == 0) {
- vhost_user_add_connection(fd, vsocket);
- return 0;
- }
+ if (!vsocket->async_connect || !vsocket->reconnect) {
+ ret = vhost_user_connect_nonblock(vsocket->path, fd,
+ (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
+ if (ret == 0) {
+ vhost_user_add_connection(fd, vsocket);
+ return 0;
+ }
- VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+ VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
- if (ret == -2 || !vsocket->reconnect) {
- close(fd);
- return -1;
- }
+ if (ret == -2 || !vsocket->reconnect) {
+ close(fd);
+ return -1;
+ }
- VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ }
reconn = malloc(sizeof(*reconn));
if (reconn == NULL) {
VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
@@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
+ vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
if (vsocket->is_vduse)
vsocket->iommu_support = true;
else
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] lib/vhost: add flag for async connection in client mode
2024-04-17 9:15 ` [PATCH v2] " Ушков Даниил
@ 2024-04-25 13:47 ` Maxime Coquelin
2024-04-25 14:04 ` Morten Brørup
0 siblings, 1 reply; 12+ messages in thread
From: Maxime Coquelin @ 2024-04-25 13:47 UTC (permalink / raw)
To: Ушков
Даниил,
dev, Thomas Monjalon
Cc: Chenbo Xia
On 4/17/24 11:15, Ушков Даниил wrote:
> This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
> which in combination with the flag RTE_VHOST_USER_CLIENT makes
> rte_vhost_driver_start connect asynchronously to the vhost server.
>
> Signed-off-by: Ушков Даниил <udav@mts.ru>
> ---
> Fixes:
> 1. Fix warning about the name in signature.
> 2. Fix warning about coding style.
>
> P.S.
> Is it ok that name is not in ascii?
I think it has to be, Thomas do you confirm?
> Sorry, it could be hard to change it now.
>
> lib/vhost/rte_vhost.h | 1 +
> lib/vhost/socket.c | 28 ++++++++++++++++------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index db92f05344..b0434c4b8d 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -41,6 +41,7 @@ extern "C" {
> #define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
> #define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
> #define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
> +#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
>
> /* Features. */
> #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index 96b3ab5595..c681d53abb 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -45,6 +45,7 @@ struct vhost_user_socket {
> bool async_copy;
> bool net_compliant_ol_flags;
> bool stats_enabled;
> + bool async_connect;
>
> /*
> * The "supported_features" indicates the feature bits the
> @@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
> const char *path = vsocket->path;
> struct vhost_user_reconnect *reconn;
>
> - ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
> - sizeof(vsocket->un));
> - if (ret == 0) {
> - vhost_user_add_connection(fd, vsocket);
> - return 0;
> - }
> + if (!vsocket->async_connect || !vsocket->reconnect) {
> + ret = vhost_user_connect_nonblock(vsocket->path, fd,
> + (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
> + if (ret == 0) {
> + vhost_user_add_connection(fd, vsocket);
> + return 0;
> + }
>
> - VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
> + VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
>
> - if (ret == -2 || !vsocket->reconnect) {
> - close(fd);
> - return -1;
> - }
> + if (ret == -2 || !vsocket->reconnect) {
> + close(fd);
> + return -1;
> + }
>
> - VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
> + VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
> + }
> reconn = malloc(sizeof(*reconn));
> if (reconn == NULL) {
> VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
> @@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
> vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
> vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
> + vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
> if (vsocket->is_vduse)
> vsocket->iommu_support = true;
> else
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH v2] lib/vhost: add flag for async connection in client mode
2024-04-25 13:47 ` Maxime Coquelin
@ 2024-04-25 14:04 ` Morten Brørup
2024-04-29 19:43 ` Thomas Monjalon
0 siblings, 1 reply; 12+ messages in thread
From: Morten Brørup @ 2024-04-25 14:04 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Chenbo Xia, Maxime Coquelin,
Ушков
Даниил,
dev, Thomas Monjalon
> From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> Sent: Thursday, 25 April 2024 15.48
>
> On 4/17/24 11:15, Ушков Даниил wrote:
> >
> > Signed-off-by: Ушков Даниил <udav@mts.ru>
> > ---
> > Fixes:
> > 1. Fix warning about the name in signature.
> > 2. Fix warning about coding style.
> >
> > P.S.
> > Is it ok that name is not in ascii?
>
> I think it has to be, Thomas do you confirm?
Stephen, do you know the Linux Kernel requirements regarding contributor sign-off names... perhaps we can seek inspiration there.
Are special letters in the Western European alphabet (such as ö, ø, ñ and ß) allowed?
How about the Cyrillic alphabet, like the name being asked about for this patch?
And how about Chinese and Japanese characters?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] lib/vhost: add flag for async connection in client mode
2024-04-25 14:04 ` Morten Brørup
@ 2024-04-29 19:43 ` Thomas Monjalon
0 siblings, 0 replies; 12+ messages in thread
From: Thomas Monjalon @ 2024-04-29 19:43 UTC (permalink / raw)
To: Stephen Hemminger, Morten Brørup, Maxime Coquelin
Cc: Chenbo Xia,
Ушков
Даниил,
dev
25/04/2024 16:04, Morten Brørup:
> > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
> > Sent: Thursday, 25 April 2024 15.48
> >
> > On 4/17/24 11:15, Ушков Даниил wrote:
> > >
> > > Signed-off-by: Ушков Даниил <udav@mts.ru>
> > > ---
> > > Fixes:
> > > 1. Fix warning about the name in signature.
> > > 2. Fix warning about coding style.
> > >
> > > P.S.
> > > Is it ok that name is not in ascii?
> >
> > I think it has to be, Thomas do you confirm?
In general, names are "converted" to ascii with few accents.
But there is no clear rule, and I don't want to force my alphabet over others.
> Stephen, do you know the Linux Kernel requirements regarding contributor sign-off names... perhaps we can seek inspiration there.
>
> Are special letters in the Western European alphabet (such as ö, ø, ñ and ß) allowed?
>
> How about the Cyrillic alphabet, like the name being asked about for this patch?
>
> And how about Chinese and Japanese characters?
Would be interesting to have more opinions about what is common in tech communities.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3] lib/vhost: add flag for async connection in client mode
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
2024-04-17 9:15 ` [PATCH v2] " Ушков Даниил
@ 2024-04-26 8:38 ` Daniil Ushkov
2024-04-26 8:47 ` [PATCH v4] " Daniil Ushkov
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Daniil Ushkov @ 2024-04-26 8:38 UTC (permalink / raw)
To: dev; +Cc: Daniil Ushkov, Maxime Coquelin, Chenbo Xia
This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
which in combination with the flag RTE_VHOST_USER_CLIENT makes
rte_vhost_driver_start connect asynchronously to the vhost server.
Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
---
Fixes:
* Cyrillic name in Signed-off-by.
Let it be another email address. There will be fewer problems.
lib/vhost/rte_vhost.h | 1 +
lib/vhost/socket.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index db92f05344..b0434c4b8d 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -41,6 +41,7 @@ extern "C" {
#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
#define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
#define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
+#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
/* Features. */
#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 96b3ab5595..c681d53abb 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -45,6 +45,7 @@ struct vhost_user_socket {
bool async_copy;
bool net_compliant_ol_flags;
bool stats_enabled;
+ bool async_connect;
/*
* The "supported_features" indicates the feature bits the
@@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
const char *path = vsocket->path;
struct vhost_user_reconnect *reconn;
- ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
- sizeof(vsocket->un));
- if (ret == 0) {
- vhost_user_add_connection(fd, vsocket);
- return 0;
- }
+ if (!vsocket->async_connect || !vsocket->reconnect) {
+ ret = vhost_user_connect_nonblock(vsocket->path, fd,
+ (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
+ if (ret == 0) {
+ vhost_user_add_connection(fd, vsocket);
+ return 0;
+ }
- VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+ VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
- if (ret == -2 || !vsocket->reconnect) {
- close(fd);
- return -1;
- }
+ if (ret == -2 || !vsocket->reconnect) {
+ close(fd);
+ return -1;
+ }
- VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ }
reconn = malloc(sizeof(*reconn));
if (reconn == NULL) {
VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
@@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
+ vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
if (vsocket->is_vduse)
vsocket->iommu_support = true;
else
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4] lib/vhost: add flag for async connection in client mode
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
2024-04-17 9:15 ` [PATCH v2] " Ушков Даниил
2024-04-26 8:38 ` [PATCH v3] " Daniil Ushkov
@ 2024-04-26 8:47 ` Daniil Ushkov
2024-04-26 21:29 ` [PATCH] " Patrick Robb
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Daniil Ushkov @ 2024-04-26 8:47 UTC (permalink / raw)
To: dev; +Cc: Daniil Ushkov, Maxime Coquelin, Chenbo Xia
This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
which in combination with the flag RTE_VHOST_USER_CLIENT makes
rte_vhost_driver_start connect asynchronously to the vhost server.
Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
---
Fixes:
* Cyrillic name in Signed-off-by.
Let it be another email address. There will be fewer problems.
P.S. Sorry, v3 was sent without subscription.
lib/vhost/rte_vhost.h | 1 +
lib/vhost/socket.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index db92f05344..b0434c4b8d 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -41,6 +41,7 @@ extern "C" {
#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
#define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
#define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
+#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
/* Features. */
#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 96b3ab5595..c681d53abb 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -45,6 +45,7 @@ struct vhost_user_socket {
bool async_copy;
bool net_compliant_ol_flags;
bool stats_enabled;
+ bool async_connect;
/*
* The "supported_features" indicates the feature bits the
@@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
const char *path = vsocket->path;
struct vhost_user_reconnect *reconn;
- ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
- sizeof(vsocket->un));
- if (ret == 0) {
- vhost_user_add_connection(fd, vsocket);
- return 0;
- }
+ if (!vsocket->async_connect || !vsocket->reconnect) {
+ ret = vhost_user_connect_nonblock(vsocket->path, fd,
+ (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
+ if (ret == 0) {
+ vhost_user_add_connection(fd, vsocket);
+ return 0;
+ }
- VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+ VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
- if (ret == -2 || !vsocket->reconnect) {
- close(fd);
- return -1;
- }
+ if (ret == -2 || !vsocket->reconnect) {
+ close(fd);
+ return -1;
+ }
- VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ }
reconn = malloc(sizeof(*reconn));
if (reconn == NULL) {
VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
@@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
+ vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
if (vsocket->is_vduse)
vsocket->iommu_support = true;
else
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] lib/vhost: add flag for async connection in client mode
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
` (2 preceding siblings ...)
2024-04-26 8:47 ` [PATCH v4] " Daniil Ushkov
@ 2024-04-26 21:29 ` Patrick Robb
2024-05-14 9:13 ` [PATCH v5] This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT, which in combination with the flag RTE_VHOST_USER_CLIENT makes rte_vhost_driver_start connect asynchronously to the vhost server Daniil Ushkov
2024-05-14 9:16 ` [PATCH v6] lib/vhost: add flag for async connection in client mode Daniil Ushkov
5 siblings, 0 replies; 12+ messages in thread
From: Patrick Robb @ 2024-04-26 21:29 UTC (permalink / raw)
To: Ушков
Даниил
Cc: dev, Maxime Coquelin, Chenbo Xia
[-- Attachment #1: Type: text/plain, Size: 296 bytes --]
Recheck-request: iol-compile-amd64-testing
The DPDK Community Lab updated to the latest Alpine image yesterday, which
resulted in all Alpine builds failing. The failure is unrelated to your
patch, and this recheck should remove the fail on Patchwork, as we have
disabled Alpine testing for now.
[-- Attachment #2: Type: text/html, Size: 361 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5] This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT, which in combination with the flag RTE_VHOST_USER_CLIENT makes rte_vhost_driver_start connect asynchronously to the vhost server.
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
` (3 preceding siblings ...)
2024-04-26 21:29 ` [PATCH] " Patrick Robb
@ 2024-05-14 9:13 ` Daniil Ushkov
2024-05-14 9:16 ` [PATCH v6] lib/vhost: add flag for async connection in client mode Daniil Ushkov
5 siblings, 0 replies; 12+ messages in thread
From: Daniil Ushkov @ 2024-05-14 9:13 UTC (permalink / raw)
To: dev; +Cc: Daniil Ushkov, Maxime Coquelin, Chenbo Xia
Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
---
Rerun checks.
lib/vhost/rte_vhost.h | 1 +
lib/vhost/socket.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index db92f05344..b0434c4b8d 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -41,6 +41,7 @@ extern "C" {
#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
#define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
#define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
+#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
/* Features. */
#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 96b3ab5595..c681d53abb 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -45,6 +45,7 @@ struct vhost_user_socket {
bool async_copy;
bool net_compliant_ol_flags;
bool stats_enabled;
+ bool async_connect;
/*
* The "supported_features" indicates the feature bits the
@@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
const char *path = vsocket->path;
struct vhost_user_reconnect *reconn;
- ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
- sizeof(vsocket->un));
- if (ret == 0) {
- vhost_user_add_connection(fd, vsocket);
- return 0;
- }
+ if (!vsocket->async_connect || !vsocket->reconnect) {
+ ret = vhost_user_connect_nonblock(vsocket->path, fd,
+ (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
+ if (ret == 0) {
+ vhost_user_add_connection(fd, vsocket);
+ return 0;
+ }
- VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+ VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
- if (ret == -2 || !vsocket->reconnect) {
- close(fd);
- return -1;
- }
+ if (ret == -2 || !vsocket->reconnect) {
+ close(fd);
+ return -1;
+ }
- VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ }
reconn = malloc(sizeof(*reconn));
if (reconn == NULL) {
VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
@@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
+ vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
if (vsocket->is_vduse)
vsocket->iommu_support = true;
else
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v6] lib/vhost: add flag for async connection in client mode
2024-04-17 8:41 [PATCH] lib/vhost: add flag for async connection in client mode Ушков Даниил
` (4 preceding siblings ...)
2024-05-14 9:13 ` [PATCH v5] This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT, which in combination with the flag RTE_VHOST_USER_CLIENT makes rte_vhost_driver_start connect asynchronously to the vhost server Daniil Ushkov
@ 2024-05-14 9:16 ` Daniil Ushkov
2024-06-07 13:59 ` Maxime Coquelin
2024-06-12 8:30 ` Maxime Coquelin
5 siblings, 2 replies; 12+ messages in thread
From: Daniil Ushkov @ 2024-05-14 9:16 UTC (permalink / raw)
To: dev; +Cc: Daniil Ushkov, Maxime Coquelin, Chenbo Xia
This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
which in combination with the flag RTE_VHOST_USER_CLIENT makes
rte_vhost_driver_start connect asynchronously to the vhost server.
Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
---
* Rerun checks.
* Fix commit message.
lib/vhost/rte_vhost.h | 1 +
lib/vhost/socket.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index db92f05344..b0434c4b8d 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -41,6 +41,7 @@ extern "C" {
#define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
#define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
#define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
+#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
/* Features. */
#ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 96b3ab5595..c681d53abb 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -45,6 +45,7 @@ struct vhost_user_socket {
bool async_copy;
bool net_compliant_ol_flags;
bool stats_enabled;
+ bool async_connect;
/*
* The "supported_features" indicates the feature bits the
@@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
const char *path = vsocket->path;
struct vhost_user_reconnect *reconn;
- ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
- sizeof(vsocket->un));
- if (ret == 0) {
- vhost_user_add_connection(fd, vsocket);
- return 0;
- }
+ if (!vsocket->async_connect || !vsocket->reconnect) {
+ ret = vhost_user_connect_nonblock(vsocket->path, fd,
+ (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
+ if (ret == 0) {
+ vhost_user_add_connection(fd, vsocket);
+ return 0;
+ }
- VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+ VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
- if (ret == -2 || !vsocket->reconnect) {
- close(fd);
- return -1;
- }
+ if (ret == -2 || !vsocket->reconnect) {
+ close(fd);
+ return -1;
+ }
- VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
+ }
reconn = malloc(sizeof(*reconn));
if (reconn == NULL) {
VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
@@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
+ vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
if (vsocket->is_vduse)
vsocket->iommu_support = true;
else
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v6] lib/vhost: add flag for async connection in client mode
2024-05-14 9:16 ` [PATCH v6] lib/vhost: add flag for async connection in client mode Daniil Ushkov
@ 2024-06-07 13:59 ` Maxime Coquelin
2024-06-12 8:30 ` Maxime Coquelin
1 sibling, 0 replies; 12+ messages in thread
From: Maxime Coquelin @ 2024-06-07 13:59 UTC (permalink / raw)
To: Daniil Ushkov, dev; +Cc: Chenbo Xia
Hi Daniil,
On 5/14/24 11:16, Daniil Ushkov wrote:
> This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
> which in combination with the flag RTE_VHOST_USER_CLIENT makes
> rte_vhost_driver_start connect asynchronously to the vhost server.
>
> Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
> ---
> * Rerun checks.
> * Fix commit message.
> lib/vhost/rte_vhost.h | 1 +
> lib/vhost/socket.c | 28 ++++++++++++++++------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
> index db92f05344..b0434c4b8d 100644
> --- a/lib/vhost/rte_vhost.h
> +++ b/lib/vhost/rte_vhost.h
> @@ -41,6 +41,7 @@ extern "C" {
> #define RTE_VHOST_USER_ASYNC_COPY (1ULL << 7)
> #define RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS (1ULL << 8)
> #define RTE_VHOST_USER_NET_STATS_ENABLE (1ULL << 9)
> +#define RTE_VHOST_USER_ASYNC_CONNECT (1ULL << 10)
>
> /* Features. */
> #ifndef VIRTIO_NET_F_GUEST_ANNOUNCE
> diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
> index 96b3ab5595..c681d53abb 100644
> --- a/lib/vhost/socket.c
> +++ b/lib/vhost/socket.c
> @@ -45,6 +45,7 @@ struct vhost_user_socket {
> bool async_copy;
> bool net_compliant_ol_flags;
> bool stats_enabled;
> + bool async_connect;
>
> /*
> * The "supported_features" indicates the feature bits the
> @@ -533,21 +534,23 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
> const char *path = vsocket->path;
> struct vhost_user_reconnect *reconn;
>
> - ret = vhost_user_connect_nonblock(vsocket->path, fd, (struct sockaddr *)&vsocket->un,
> - sizeof(vsocket->un));
> - if (ret == 0) {
> - vhost_user_add_connection(fd, vsocket);
> - return 0;
> - }
> + if (!vsocket->async_connect || !vsocket->reconnect) {
> + ret = vhost_user_connect_nonblock(vsocket->path, fd,
> + (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
> + if (ret == 0) {
> + vhost_user_add_connection(fd, vsocket);
> + return 0;
> + }
>
> - VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
> + VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
>
> - if (ret == -2 || !vsocket->reconnect) {
> - close(fd);
> - return -1;
> - }
> + if (ret == -2 || !vsocket->reconnect) {
> + close(fd);
> + return -1;
> + }
>
> - VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
> + VHOST_CONFIG_LOG(path, INFO, "reconnecting...");
> + }
> reconn = malloc(sizeof(*reconn));
> if (reconn == NULL) {
> VHOST_CONFIG_LOG(path, ERR, "failed to allocate memory for reconnect");
> @@ -930,6 +933,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
> vsocket->async_copy = flags & RTE_VHOST_USER_ASYNC_COPY;
> vsocket->net_compliant_ol_flags = flags & RTE_VHOST_USER_NET_COMPLIANT_OL_FLAGS;
> vsocket->stats_enabled = flags & RTE_VHOST_USER_NET_STATS_ENABLE;
> + vsocket->async_connect = flags & RTE_VHOST_USER_ASYNC_CONNECT;
> if (vsocket->is_vduse)
> vsocket->iommu_support = true;
> else
The patch looks good to me:
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v6] lib/vhost: add flag for async connection in client mode
2024-05-14 9:16 ` [PATCH v6] lib/vhost: add flag for async connection in client mode Daniil Ushkov
2024-06-07 13:59 ` Maxime Coquelin
@ 2024-06-12 8:30 ` Maxime Coquelin
1 sibling, 0 replies; 12+ messages in thread
From: Maxime Coquelin @ 2024-06-12 8:30 UTC (permalink / raw)
To: Daniil Ushkov, dev; +Cc: Chenbo Xia
On 5/14/24 11:16, Daniil Ushkov wrote:
> This patch introduces a new flag RTE_VHOST_USER_ASYNC_CONNECT,
> which in combination with the flag RTE_VHOST_USER_CLIENT makes
> rte_vhost_driver_start connect asynchronously to the vhost server.
>
> Signed-off-by: Daniil Ushkov <daniil.ushkov@yandex.ru>
> ---
> * Rerun checks.
> * Fix commit message.
> lib/vhost/rte_vhost.h | 1 +
> lib/vhost/socket.c | 28 ++++++++++++++++------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
Applied to next-virtio/for-next-net.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 12+ messages in thread