Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1040694ybh; Thu, 16 Jul 2020 01:11:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6MFaAIVhXC5RMRa+QiisG+p5o0f5zkFwSEHGZV51JspC/Vjdg4qaGiUaa+sO3mvSUF22/ X-Received: by 2002:aa7:d692:: with SMTP id d18mr3436423edr.73.1594887107726; Thu, 16 Jul 2020 01:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594887107; cv=none; d=google.com; s=arc-20160816; b=hbpL6/s6GqUoSz8u120Lg2qr9LLSbOpzxZYwdLHXc7aUygre5w8IHBFyVmJUb5TcYh 8MaP9kf5V3upOZWxprS9xIApnd/9grHfBD63rcmm0O1XBUy3Mjv8+XuAq/QmU8Iu/xxt BWW0KIOwaTlE4yT1rxlNpC6XY4KtKXVEFgnvXoEanQ3DRxI24hBPp/Sk6/JxcBNDfaHe boVKIsLpyEhuiUXLCpE3FOE066U8tg7WmDfLTRlqdfM54UGm1QWTeVKZcrxWWq21LzsW 69tt1Ze5TuKWAT1sdvGIpp3Jm0Sk6ko7EGXed9MSAq+K5QPyFIrE1v6/vXef1W+7fctQ 3PoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=+L2ONyaQijNqMbyzSxVRLO1Pc+Tfqc2nXAiP2fBOrgg=; b=Z/cd1RJSZKWD/SSi2SUla0+jbni6PWzRT4JnlIWr+zZMLqV7mr8PWW66vTl5R4MeSU 0ItiebnRrCAdlkGzDxGfd4wNZSjEc7tRB+69KYvYapokleX0xBYGnGjvr8wIDy4lRe1E IvzxFj/YTm6fnnCLrEhpME8FNiyYsjBLXqHVm60yvaDl7z6gTBX5mdGfJnpnw8d9vuks k3F1pQqnW6MERYrglddR5pYt5UoR9PBvzr2H0v0Zoagm4Gtq11O64vbJy9KNJCiks/99 u5N7D3EdGIYKUSxiyRpgSRwdwkfyYg9jRXWVrvbpns9wFccguaD2oD7oOyNFiX3gj6Zv PHpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DduK803f; 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 w6si2741372edx.62.2020.07.16.01.11.24; Thu, 16 Jul 2020 01:11:47 -0700 (PDT) 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=DduK803f; 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 S1726351AbgGPILP (ORCPT + 99 others); Thu, 16 Jul 2020 04:11:15 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42309 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725934AbgGPILO (ORCPT ); Thu, 16 Jul 2020 04:11:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594887073; 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=+L2ONyaQijNqMbyzSxVRLO1Pc+Tfqc2nXAiP2fBOrgg=; b=DduK803fDT0wOPdlRrq+YdW0oIRXDDoJG3PRLEE0gjjGk7N+TggiBFm8yjPvm6BRU9P++G t3geQSNUVsKpSNi2zT3fw01lN48g16CBovpo/fhF2qkvzpZYMjJNIxvFSxCU5E7CYnXwVa HuujtbaducsNFIJn5599trUO78bTCXA= 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-119-8kxbf2VPMoaGa_C4-2-5Cg-1; Thu, 16 Jul 2020 04:11:09 -0400 X-MC-Unique: 8kxbf2VPMoaGa_C4-2-5Cg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F07238015FB; Thu, 16 Jul 2020 08:11:07 +0000 (UTC) Received: from [10.72.12.131] (ovpn-12-131.pek2.redhat.com [10.72.12.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 803B210098A4; Thu, 16 Jul 2020 08:11:02 +0000 (UTC) Subject: Re: [PATCH vhost next 06/10] vdpa: Add means to communicate vq status on get_vq_state To: Eli Cohen , mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: shahafs@mellanox.com, saeedm@mellanox.com, Parav Pandit References: <20200716072327.5359-1-eli@mellanox.com> <20200716072327.5359-7-eli@mellanox.com> From: Jason Wang Message-ID: Date: Thu, 16 Jul 2020 16:11:00 +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: <20200716072327.5359-7-eli@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/7/16 下午3:23, Eli Cohen wrote: > Currently, get_vq_state() is used only to pass the available index value > of a vq. Extend the struct to return status on the VQ to the caller. > For now, define VQ_STATE_NOT_READY. In the future it will be extended to > include other infomration. > > Modify current vdpa driver to update this field. > > Reviewed-by: Parav Pandit > Signed-off-by: Eli Cohen What's the difference between this and get_vq_ready()? Thanks > --- > drivers/vdpa/ifcvf/ifcvf_main.c | 1 + > drivers/vdpa/vdpa_sim/vdpa_sim.c | 1 + > include/linux/vdpa.h | 9 +++++++++ > 3 files changed, 11 insertions(+) > > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c > index 69032ee97824..77e3b3d91167 100644 > --- a/drivers/vdpa/ifcvf/ifcvf_main.c > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c > @@ -240,6 +240,7 @@ static void ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid, > { > struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev); > > + state->state = vf->vring[qid].ready ? 0 : BIT(VQ_STATE_NOT_READY); > state->avail_index = ifcvf_get_vq_state(vf, qid); > } > > diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c > index 599519039f8d..06d974b4bd7b 100644 > --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -434,6 +434,7 @@ static void vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx, > struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; > struct vringh *vrh = &vq->vring; > > + state->state = vq->ready ? 0 : BIT(VQ_STATE_NOT_READY); > state->avail_index = vrh->last_avail_idx; > } > > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 7b088bebffe8..bcefa30a3b2f 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -27,12 +27,21 @@ struct vdpa_notification_area { > resource_size_t size; > }; > > +/** > + * Bitmask describing the status of the vq > + */ > +enum { > + VQ_STATE_NOT_READY = 0, > +}; > + > /** > * vDPA vq_state definition > * @avail_index: available index > + * @state: returned status from get_vq_state > */ > struct vdpa_vq_state { > u16 avail_index; > + u32 state; > }; > > /**