Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3218779pxu; Sun, 29 Nov 2020 19:32:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm7UkGnngNneQ/l/3ISEUbYChKFEwYfBfxAzUty9tFohvfBrdYqFcfWBEP7LXqdmOWYh4v X-Received: by 2002:a17:906:26cc:: with SMTP id u12mr570008ejc.295.1606707152240; Sun, 29 Nov 2020 19:32:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606707152; cv=none; d=google.com; s=arc-20160816; b=qGO7sQY9C7TUa3XOrnh9TG9t3pwQ2CJxhevo7ICIh5WSzbhxr9kUlRYTQUsW6lRM+7 EoN2G9fTIEksEymnSwA3hmsnDv1bmutUnHgGzg1dFWr8+u905zTlo0cCTAkgC1O+OyBu nf7tUNu+aOqpVrlDJDZMkeJZWKI4JsaciXVdZSbtjbkifPp2BOQPPZeChI8py7/HAFE+ YATk3r9C3Ing2HTTrIF21ROrmtuFXjRIF5eS3IEq8ezQvlt7TZb23kxeq4rW48UoC730 weoRaqsjGFGc/3Wthm8wqrFlsZTkEeah7dEtg6x+WxP14bwa0wp0+anOd/V961VETQk6 3j8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GKKzsrpUozh4PU7wUtMTDjDRAex2JbMT/+19r/pxuBo=; b=ZDamA1oyyEunCpPm5ADACcZWG1Ys6jS4tGhFedmdWg2Uo/KySTsqGTYOIHG2woGmOF WvNCfRtd8z8SbrlyFvMFeapQwzUaEn1sirBM63LkBPhuk3dSHTO4nDGYJiwVg69JutuT h8R+av8BxyKYoPeBuQ+YN1QDkYLFad/rPOJT2uS+YJ6mALtonh6sdNCcEjX1rYNyGqz0 TwjaKf/K2BQEfvr2NbC1vtWscIpOi/F9Wuli6LulA2IdOJiUKofvUpaLYEqw+8V8J1m/ 0l0Blks0267IwnCFQY8UvzqFFpL+OhbgxpqCRYHCzzrG2AifYFLfW5u+wp0szYX3WYEN aN/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BonLHe66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh5si10032334ejb.488.2020.11.29.19.32.10; Sun, 29 Nov 2020 19:32:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BonLHe66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbgK3Dat (ORCPT + 99 others); Sun, 29 Nov 2020 22:30:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59133 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbgK3Dat (ORCPT ); Sun, 29 Nov 2020 22:30:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606706962; 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=GKKzsrpUozh4PU7wUtMTDjDRAex2JbMT/+19r/pxuBo=; b=BonLHe66ETxoq2YCtw80sAiN+ZcpxQigDEcbiGNWM2idGfOwkaxx50qV65WtTKK+d48XGs aHvtBCEy+XQKNnHJ+Oiui+eq/HxGuSnocgL8aQ2vYG53uGB6xTfYXFBsthez2xqnfMTZe1 LoZ+3S134o5pBQx6ggzSQbIoOL1ogEQ= 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-578-iJ9iWcX4P0e550Bf4Qwlzw-1; Sun, 29 Nov 2020 22:29:19 -0500 X-MC-Unique: iJ9iWcX4P0e550Bf4Qwlzw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB158802B47; Mon, 30 Nov 2020 03:29:17 +0000 (UTC) Received: from [10.72.13.173] (ovpn-13-173.pek2.redhat.com [10.72.13.173]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6259F60C5F; Mon, 30 Nov 2020 03:29:09 +0000 (UTC) Subject: Re: [PATCH v2 16/17] vdpa_sim: split vdpasim_virtqueue's iov field in out_iov and in_iov To: Stefano Garzarella , virtualization@lists.linux-foundation.org Cc: Stefan Hajnoczi , linux-kernel@vger.kernel.org, Laurent Vivier , Max Gurtovoy , "Michael S. Tsirkin" , Eli Cohen References: <20201126144950.92850-1-sgarzare@redhat.com> <20201126144950.92850-17-sgarzare@redhat.com> From: Jason Wang Message-ID: <5c01a00d-e7a9-2513-7e9f-39fc620c17c0@redhat.com> Date: Mon, 30 Nov 2020 11:29:08 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201126144950.92850-17-sgarzare@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/11/26 下午10:49, Stefano Garzarella wrote: > vringh_getdesc_iotlb() manages 2 iovs for writable and readable > descriptors. This is very useful for the block device, where for > each request we have both types of descriptor. > > Let's split the vdpasim_virtqueue's iov field in out_iov and > in_iov to use them with vringh_getdesc_iotlb(). > > We are using VIRTIO terminology for "out" (readable by the device) > and "in" (writable by the device) descriptors. > > Signed-off-by: Stefano Garzarella > --- > v2: > - used VIRTIO terminology [Stefan] > --- Acked-by: Jason Wang > drivers/vdpa/vdpa_sim/vdpa_sim.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c > index f5f41f20ee0b..f8ee261ef4ae 100644 > --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -33,7 +33,8 @@ u8 macaddr_buf[ETH_ALEN]; > > struct vdpasim_virtqueue { > struct vringh vring; > - struct vringh_kiov iov; > + struct vringh_kiov in_iov; > + struct vringh_kiov out_iov; > unsigned short head; > bool ready; > u64 desc_addr; > @@ -197,12 +198,12 @@ static void vdpasim_net_work(struct work_struct *work) > > while (true) { > total_write = 0; > - err = vringh_getdesc_iotlb(&txq->vring, &txq->iov, NULL, > + err = vringh_getdesc_iotlb(&txq->vring, &txq->out_iov, NULL, > &txq->head, GFP_ATOMIC); > if (err <= 0) > break; > > - err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->iov, > + err = vringh_getdesc_iotlb(&rxq->vring, NULL, &rxq->in_iov, > &rxq->head, GFP_ATOMIC); > if (err <= 0) { > vringh_complete_iotlb(&txq->vring, txq->head, 0); > @@ -210,13 +211,13 @@ static void vdpasim_net_work(struct work_struct *work) > } > > while (true) { > - read = vringh_iov_pull_iotlb(&txq->vring, &txq->iov, > + read = vringh_iov_pull_iotlb(&txq->vring, &txq->out_iov, > vdpasim->buffer, > PAGE_SIZE); > if (read <= 0) > break; > > - write = vringh_iov_push_iotlb(&rxq->vring, &rxq->iov, > + write = vringh_iov_push_iotlb(&rxq->vring, &rxq->in_iov, > vdpasim->buffer, read); > if (write <= 0) > break;