[dpdk-dev] [PATCH v2 29/44] net/virtio: add Virtio-user memory tables ops

Maxime Coquelin maxime.coquelin at redhat.com
Mon Jan 25 15:56:42 CET 2021



On 1/22/21 8:34 AM, Xia, Chenbo wrote:
> Hi Maxime,
> 
>> -----Original Message-----
>> From: Maxime Coquelin <maxime.coquelin at redhat.com>
>> Sent: Wednesday, January 20, 2021 5:25 AM
>> To: dev at dpdk.org; Xia, Chenbo <chenbo.xia at intel.com>; olivier.matz at 6wind.com;
>> amorenoz at redhat.com; david.marchand at redhat.com
>> Cc: Maxime Coquelin <maxime.coquelin at redhat.com>
>> Subject: [PATCH v2 29/44] 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 <maxime.coquelin at redhat.com>
>> ---
>>  drivers/net/virtio/virtio_user/vhost.h        |  1 +
>>  drivers/net/virtio/virtio_user/vhost_kernel.c | 60 ++++++-------
>>  drivers/net/virtio/virtio_user/vhost_user.c   | 86 ++++++++++++++-----
>>  drivers/net/virtio/virtio_user/vhost_vdpa.c   |  8 +-
>>  .../net/virtio/virtio_user/virtio_user_dev.c  |  4 +-
>>  5 files changed, 101 insertions(+), 58 deletions(-)
>>
...
>> +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;
>> +	}
>> +
>> +	if (msg->size != sizeof(msg->payload.u64)) {
>> +		PMD_DRV_LOG(ERR, "Unexpected reply-ack payload size (%d)", msg-
>>> size);
> 
> Better to use '%u'?

Done

>> +		return -1;
>> +	}
>> +
>> +	if (msg->payload.u64) {
>> +		PMD_DRV_LOG(ERR, "Slave replied NACK to request type %d", msg-
>>> request);
> 
> Replace '%d' with '(%d)' to align with the above style? :P

Added to make style consistent.

> Thanks,
> Chenbo
> 

Thanks,
Maxime



More information about the dev mailing list