From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 47AC441C4B; Thu, 9 Feb 2023 09:50:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 317DF40DF8; Thu, 9 Feb 2023 09:50:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5AFFF4067B for ; Thu, 9 Feb 2023 09:50:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675932608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RvviHqhtzODBjBoKTZ0hztFdgoLJPbQbSxsQl5kYNKY=; b=UtgbTn35HWIf5wLECf2yJoIYbnkuZwRm/LInuqsiHnJ7i67o7TZlOdlaRVCnmH3pdGP88Q Pa1QNaRAV8ZM7hm62UPB9+RBQhPeRevi9P/GBWv9Pe17dGO4RwuBjZiVrWczHtU3v8WmpE HUXjl80DTNaKRVi5guw0aZMmE88Movk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-240-S1_fKNByMCW20-Zq0SvBqQ-1; Thu, 09 Feb 2023 03:50:05 -0500 X-MC-Unique: S1_fKNByMCW20-Zq0SvBqQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F69829ABA12; Thu, 9 Feb 2023 08:50:05 +0000 (UTC) Received: from [10.39.208.26] (unknown [10.39.208.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DC90C06228; Thu, 9 Feb 2023 08:50:03 +0000 (UTC) Message-ID: <26448036-a23d-5460-02e8-408a95535b53@redhat.com> Date: Thu, 9 Feb 2023 09:50:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v2 18/21] net/virtio-user: add new callback to enable control queue To: Eugenio Perez Martin Cc: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com, stephen@networkplumber.org References: <20230207151747.245808-1-maxime.coquelin@redhat.com> <20230207151747.245808-19-maxime.coquelin@redhat.com> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2/7/23 19:10, Eugenio Perez Martin wrote: > On Tue, Feb 7, 2023 at 4:18 PM Maxime Coquelin > wrote: >> >> This patch introduces a new callback that is to be called >> when the backend supports control virtqueue. >> >> Implementation for Vhost-vDPA backend is added in this patch. >> >> Signed-off-by: Maxime Coquelin >> Reviewed-by: Chenbo Xia > > Small nitpick but as previous one it is ok to leave as it is now. > > Acked-by: Eugenio PĂ©rez > >> --- >> drivers/net/virtio/virtio_user/vhost.h | 1 + >> drivers/net/virtio/virtio_user/vhost_vdpa.c | 15 +++++++++++++++ >> drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 +++ >> 3 files changed, 19 insertions(+) >> >> diff --git a/drivers/net/virtio/virtio_user/vhost.h b/drivers/net/virtio/virtio_user/vhost.h >> index dfbf6be033..f817cab77a 100644 >> --- a/drivers/net/virtio/virtio_user/vhost.h >> +++ b/drivers/net/virtio/virtio_user/vhost.h >> @@ -82,6 +82,7 @@ struct virtio_user_backend_ops { >> int (*get_config)(struct virtio_user_dev *dev, uint8_t *data, uint32_t off, uint32_t len); >> int (*set_config)(struct virtio_user_dev *dev, const uint8_t *data, uint32_t off, >> uint32_t len); >> + int (*cvq_enable)(struct virtio_user_dev *dev, int enable); >> int (*enable_qp)(struct virtio_user_dev *dev, uint16_t pair_idx, int enable); >> int (*dma_map)(struct virtio_user_dev *dev, void *addr, uint64_t iova, size_t len); >> int (*dma_unmap)(struct virtio_user_dev *dev, void *addr, uint64_t iova, size_t len); >> diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c >> index a0897f8dd1..3fd13d9fac 100644 >> --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c >> +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c >> @@ -564,6 +564,20 @@ vhost_vdpa_destroy(struct virtio_user_dev *dev) >> return 0; >> } >> >> +static int >> +vhost_vdpa_cvq_enable(struct virtio_user_dev *dev, int enable) >> +{ >> + struct vhost_vring_state state = { >> + .index = dev->max_queue_pairs * 2, >> + .num = enable, >> + }; >> + >> + if (vhost_vdpa_set_vring_enable(dev, &state)) >> + return -1; >> + >> + return 0; > > Any reason for not to "return vhost_vdpa_set_vring_enable(dev, &state));"? No reason, I guess I didn't refactor when modifying the code. Will simplify it in next revision. Thanks, Maxime > Thanks! > >> +} >> + >> static int >> vhost_vdpa_enable_queue_pair(struct virtio_user_dev *dev, >> uint16_t pair_idx, >> @@ -629,6 +643,7 @@ struct virtio_user_backend_ops virtio_ops_vdpa = { >> .set_status = vhost_vdpa_set_status, >> .get_config = vhost_vdpa_get_config, >> .set_config = vhost_vdpa_set_config, >> + .cvq_enable = vhost_vdpa_cvq_enable, >> .enable_qp = vhost_vdpa_enable_queue_pair, >> .dma_map = vhost_vdpa_dma_map_batch, >> .dma_unmap = vhost_vdpa_dma_unmap_batch, >> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c >> index 1a5386a3f6..b0d603ee12 100644 >> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c >> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c >> @@ -767,6 +767,9 @@ virtio_user_handle_mq(struct virtio_user_dev *dev, uint16_t q_pairs) >> for (i = q_pairs; i < dev->max_queue_pairs; ++i) >> ret |= dev->ops->enable_qp(dev, i, 0); >> >> + if (dev->scvq) >> + ret |= dev->ops->cvq_enable(dev, 1); >> + >> dev->queue_pairs = q_pairs; >> >> return ret; >> -- >> 2.39.1 >> >