From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A84D0A052A;
	Mon, 25 Jan 2021 16:05:01 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 84F0C140F5D;
	Mon, 25 Jan 2021 16:05:01 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [63.128.21.124])
 by mails.dpdk.org (Postfix) with ESMTP id 34989140EFD
 for <dev@dpdk.org>; Mon, 25 Jan 2021 16:05:00 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1611587099;
 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=xsjz3hPYVmGSVKIFI4ODw9z3yqlrwEYl/m9dgH6O868=;
 b=ieS30txXlOC2HxNwbGPIdsqJ8uRZ+mWCjMDRKV3L2GgkEEgXeswqYxqrGXYBERVDgwpKSa
 x1rnZJS1bRAmE8GVp2HsTqqdWg2OJVCxynVi8bmKcUO6K0LJND7oUtNFoS5mTYkhFnIX7c
 GZdLttsugEwvGg2He4RAAVQBOZHEiZw=
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-474-7qHGdbk0OgG-wLTKix1iIg-1; Mon, 25 Jan 2021 10:04:57 -0500
X-MC-Unique: 7qHGdbk0OgG-wLTKix1iIg-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 8151D106B73A;
 Mon, 25 Jan 2021 15:04:56 +0000 (UTC)
Received: from [10.36.110.31] (unknown [10.36.110.31])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 40AA574448;
 Mon, 25 Jan 2021 15:04:15 +0000 (UTC)
To: "Xia, Chenbo" <chenbo.xia@intel.com>, "dev@dpdk.org" <dev@dpdk.org>,
 "olivier.matz@6wind.com" <olivier.matz@6wind.com>,
 "amorenoz@redhat.com" <amorenoz@redhat.com>,
 "david.marchand@redhat.com" <david.marchand@redhat.com>
References: <20210119212507.1043636-1-maxime.coquelin@redhat.com>
 <20210119212507.1043636-44-maxime.coquelin@redhat.com>
 <MN2PR11MB40637346985568AA126750639CA00@MN2PR11MB4063.namprd11.prod.outlook.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <df9aec47-cfde-26dd-b1e6-862bca0b85c8@redhat.com>
Date: Mon, 25 Jan 2021 16:04:14 +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: <MN2PR11MB40637346985568AA126750639CA00@MN2PR11MB4063.namprd11.prod.outlook.com>
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 v2 43/44] net/virtio: improve Vhost-user
 error logging
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>



On 1/22/21 10:11 AM, Xia, Chenbo wrote:
> Hi Maxime,
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Sent: Wednesday, January 20, 2021 5:25 AM
>> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>; olivier.matz@6wind.com;
>> amorenoz@redhat.com; david.marchand@redhat.com
>> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>> Subject: [PATCH v2 43/44] net/virtio: improve Vhost-user error logging
>>
>> This patch improves error logging in vhost_user_read,
>> especially printing errno when recv() fails.
>>
>> Suggested-by: Adrian Moreno <amorenoz@redhat.com>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>>  drivers/net/virtio/virtio_user/vhost_user.c | 29 ++++++++++++---------
>>  1 file changed, 17 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/net/virtio/virtio_user/vhost_user.c
>> b/drivers/net/virtio/virtio_user/vhost_user.c
>> index f046655af6..be91c99cea 100644
>> --- a/drivers/net/virtio/virtio_user/vhost_user.c
>> +++ b/drivers/net/virtio/virtio_user/vhost_user.c
>> @@ -148,38 +148,43 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
>>  	int ret, sz_hdr = VHOST_USER_HDR_SIZE, sz_payload;
>>
>>  	ret = recv(fd, (void *)msg, sz_hdr, 0);
>> -	if (ret < sz_hdr) {
>> +	if (ret < 0) {
>> +		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno));
>> +		return -1;
>> +	} else if (ret < sz_hdr) {
>>  		PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.",
>>  			    ret, sz_hdr);
>> -		goto fail;
>> +		return -1;
>>  	}
>>
>>  	/* validate msg flags */
>>  	if (msg->flags != (valid_flags)) {
>>  		PMD_DRV_LOG(ERR, "Failed to recv msg: flags %x instead of %x.",
>>  			    msg->flags, valid_flags);
>> -		goto fail;
>> +		return -1;
> 
> Since you are here, also add '0x' before '%x' here?

Done.

> Thanks,
> Chenbo

Thanks,
Maxime