From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Daniil Ushkov <daniil.ushkov@yandex.ru>, dev@dpdk.org
Cc: Chenbo Xia <chenbox@nvidia.com>
Subject: Re: [PATCH v6] lib/vhost: add flag for async connection in client mode
Date: Fri, 7 Jun 2024 15:59:01 +0200 [thread overview]
Message-ID: <e6d238a5-b49a-4770-8fd0-962724c6c3ee@redhat.com> (raw)
In-Reply-To: <20240514091630.443051-1-daniil.ushkov@yandex.ru>
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
next prev parent reply other threads:[~2024-06-07 13:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 8:41 [PATCH] " Ушков Даниил
2024-04-17 9:15 ` [PATCH v2] " Ушков Даниил
2024-04-25 13:47 ` Maxime Coquelin
2024-04-25 14:04 ` Morten Brørup
2024-04-29 19:43 ` Thomas Monjalon
2024-04-26 8:38 ` [PATCH v3] " Daniil Ushkov
2024-04-26 8:47 ` [PATCH v4] " Daniil Ushkov
2024-04-26 21:29 ` [PATCH] " 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
2024-06-07 13:59 ` Maxime Coquelin [this message]
2024-06-12 8:30 ` Maxime Coquelin
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=e6d238a5-b49a-4770-8fd0-962724c6c3ee@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbox@nvidia.com \
--cc=daniil.ushkov@yandex.ru \
--cc=dev@dpdk.org \
/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;
as well as URLs for NNTP newsgroup(s).