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 89225A0A02; Fri, 15 Jan 2021 10:57:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04B3E140E81; Fri, 15 Jan 2021 10:57:23 +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 1D43A140E7E for ; Fri, 15 Jan 2021 10:57:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610704640; 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=J/1U77nfjFoekToEjsZtVueG3hvciRIEPTH7WRx+wLE=; b=SWM5nMzPi2Ed0v9zq5OpCdhko5i1kc7H/plEIVpBbmw8KQfWCHwFXtsGGBNRLOFrIoDIl+ vytedyf934yJmc2NKtGyA5pVk1w+VKQ54KyiWhIHlArXZyBz2G+zNLveU1Pc1u0R5CpDQB b9ZoRmyVRcFN3z5wttvAGslqrG+3Fgg= 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-473-sNrrllm2NhO8NjS5x97x_g-1; Fri, 15 Jan 2021 04:57:19 -0500 X-MC-Unique: sNrrllm2NhO8NjS5x97x_g-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 D498F8066E0; Fri, 15 Jan 2021 09:57:17 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC80071D60; Fri, 15 Jan 2021 09:57:11 +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-28-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <9c6f13a5-6148-f236-40bd-5ff0f826d88f@redhat.com> Date: Fri, 15 Jan 2021 10:57:10 +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 27/40] net/virtio: add Virtio-user memory tables 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 12:57 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 27/40] net/virtio: add Virtio-user memory tables ops >> >> This patch implements a dedicated callback for >> preparing and sending memory table to the backends. >> >> Signed-off-by: Maxime Coquelin >> --- > > > >> >> +static int >> +vhost_user_check_reply_ack(struct virtio_user_dev *dev, struct vhost_user_msg >> *msg) >> +{ >> + enum vhost_user_request req = msg->request; >> + int ret; >> + >> + if (!(msg->flags & VHOST_USER_NEED_REPLY_MASK)) >> + return 0; >> + >> + ret = vhost_user_read(dev->vhostfd, msg); >> + if (ret < 0) { >> + PMD_DRV_LOG(ERR, "Failed to read reply-ack"); >> + return -1; >> + } >> + >> + if (req != msg->request) { >> + PMD_DRV_LOG(ERR, "Unexpected reply-ack request type (%d)", msg- >>> request); >> + return -1; >> + } > > I think it's better to keep the size check: msg.size should equal sizeof(msg.payload.u64). > >> + >> + return msg->payload.u64 ? -1 : 0; > > I think it's better to add a log after checking payload's value. Looking back to > vhost_user_set_memory_table, there's no way for user or developer to know what has > failed (vhost_user_write fails or NACK). Maybe it's also better to add error log in > or outside vhost_user_write :) Indeed, we are lacking logs here, I added both a log when slave replies NACK and when sendmsg fails. Thanks, Maxime > Thanks, > Chenbo >