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 A830BA0A02; Fri, 15 Jan 2021 11:17:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C236140EB2; Fri, 15 Jan 2021 11:17:25 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 58F75140EB0 for ; Fri, 15 Jan 2021 11:17:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610705843; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qDMfF3WcMtxqlsjzLckPHqn1/H8lQ7NH23pL2OVrpm0=; b=bxqHcOggrUaVYKO0JiTrXMESLzaiCnXw0R5hfuHXDH3Zl+PlOOePFouGz0zP8lEQjx/QuF 6pqLcXy8xqQJjbpcW8fyjMqrtMz92IQ2dxdpsAAVX6z01/pcVS93uVTdjpxoGgQKG6TX+a sGZA5kjG3YNhFaz6yIk6bBxmr7rZW50= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-6sPYnVSuM6KMqI3qTxAjlg-1; Fri, 15 Jan 2021 05:17:22 -0500 X-MC-Unique: 6sPYnVSuM6KMqI3qTxAjlg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AD3D1081B26; Fri, 15 Jan 2021 10:17:21 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4C8271D55; Fri, 15 Jan 2021 10:17:16 +0000 (UTC) To: "Xia, Chenbo" , "dev@dpdk.org" , "olivier.matz@6wind.com" , "amorenoz@redhat.com" , "david.marchand@redhat.com" References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-30-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: Date: Fri, 15 Jan 2021 11:17:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 29/40] net/virtio: add Virtio-user vring file ops 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 Sender: "dev" On 1/6/21 1:04 PM, Xia, Chenbo wrote: > Hi Maxime, > >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Monday, December 21, 2020 5:14 AM >> To: dev@dpdk.org; Xia, Chenbo ; olivier.matz@6wind.com; >> amorenoz@redhat.com; david.marchand@redhat.com >> Cc: Maxime Coquelin >> Subject: [PATCH 29/40] net/virtio: add Virtio-user vring file ops >> >> This patch introduces new callbacks for setting >> vring files (kick and call). >> >> Signed-off-by: Maxime Coquelin >> --- >> drivers/net/virtio/virtio_user/vhost.h | 2 + >> drivers/net/virtio/virtio_user/vhost_kernel.c | 41 +++++++++++++++-- >> drivers/net/virtio/virtio_user/vhost_user.c | 46 +++++++++++++++++-- >> drivers/net/virtio/virtio_user/vhost_vdpa.c | 18 ++++++-- >> .../net/virtio/virtio_user/virtio_user_dev.c | 4 +- >> 5 files changed, 97 insertions(+), 14 deletions(-) >> >> diff --git a/drivers/net/virtio/virtio_user/vhost.h >> b/drivers/net/virtio/virtio_user/vhost.h >> index 1385c1563b..b296ee215d 100644 >> --- a/drivers/net/virtio/virtio_user/vhost.h >> +++ b/drivers/net/virtio/virtio_user/vhost.h >> @@ -111,6 +111,8 @@ struct virtio_user_backend_ops { >> int (*set_vring_num)(struct virtio_user_dev *dev, struct >> vhost_vring_state *state); >> int (*set_vring_base)(struct virtio_user_dev *dev, struct >> vhost_vring_state *state); >> int (*get_vring_base)(struct virtio_user_dev *dev, struct >> vhost_vring_state *state); >> + int (*set_vring_call)(struct virtio_user_dev *dev, struct >> vhost_vring_file *file); >> + int (*set_vring_kick)(struct virtio_user_dev *dev, struct >> vhost_vring_file *file); >> int (*send_request)(struct virtio_user_dev *dev, >> enum vhost_user_request req, >> void *arg); >> diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c >> b/drivers/net/virtio/virtio_user/vhost_kernel.c >> index 2f1b4840ee..1805aee7f7 100644 >> --- a/drivers/net/virtio/virtio_user/vhost_kernel.c >> +++ b/drivers/net/virtio/virtio_user/vhost_kernel.c >> @@ -259,11 +259,44 @@ vhost_kernel_get_vring_base(struct virtio_user_dev *dev, >> struct vhost_vring_stat >> return vhost_kernel_set_vring(dev, VHOST_GET_VRING_BASE, state); >> } >> >> +static int >> +vhost_kernel_set_vring_file(struct virtio_user_dev *dev, uint64_t req, >> + struct vhost_vring_file *file) >> +{ >> + int ret, fd; >> + uint32_t index = file->index; > > Better use 'unsigned int index' here? It can hardly cause problem but I think it's > better to use the type in struct vhost_vring_file. Fixed. >> + >> + /* Convert from queue index to queue-pair & offset */ >> + fd = dev->vhostfds[file->index / 2]; >> + file->index %= 2; >> + >> + ret = vhost_kernel_ioctl(fd, req, file); >> + if (ret < 0) { >> + PMD_DRV_LOG(ERR, "Failed to set vring file (request %lu)", req); > > Seems David has also noticed: better use PRIu64 here instead of %lu ? Yes. Thanks, Maxime > Thanks, > Chenbo >