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 3F732A00C4;
	Tue, 26 Apr 2022 11:56:50 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id DA23740C35;
	Tue, 26 Apr 2022 11:56:49 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by mails.dpdk.org (Postfix) with ESMTP id 134E140691
 for <dev@dpdk.org>; Tue, 26 Apr 2022 11:56:47 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1650967008; x=1682503008;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=rwKnlBDrdlqD2YSZ25Q+KyghJ/8Rxy2AfaUi6sLovf8=;
 b=Hs0g+hKTvoIZRdJ4xDLtzhe0fpLvBc7HLik6qVOMwvnhEzk5v8JsoaLD
 zw1G7Igu3D54mU0Dx3JcLRt/mD9I/un1Zzsg3Xb+8NCY6RNLKEkjlpvup
 +NLWcgpIt9hcppYZRk9bT1CTpZErTVXw8kJCCE6RQc7htteEQDfRNgJfF
 GGkZf4yTloa3oDR/39ytBc+futyK3d3C2pV9PIL81JNX3CP6XiabCOcwZ
 AVKrFhrX8s1PeVBr++7zeKuPYlhoCT2hPbBh1GI0T0mQ/dgtA5Iu4FzN6
 rC/JoRLzGuThpz2ru4SNsSJUShgo0DyWtDpVQJkaqYvC2+qh53pjAulxH Q==;
X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="265691477"
X-IronPort-AV: E=Sophos;i="5.90,290,1643702400"; d="scan'208";a="265691477"
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 26 Apr 2022 02:56:47 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.90,290,1643702400"; d="scan'208";a="678525052"
Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85])
 by orsmga004.jf.intel.com with ESMTP; 26 Apr 2022 02:56:45 -0700
Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by
 fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2308.27; Tue, 26 Apr 2022 02:56:44 -0700
Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by
 fmsmsx604.amr.corp.intel.com ([10.18.126.84]) with mapi id 15.01.2308.027;
 Tue, 26 Apr 2022 02:56:44 -0700
From: "Pei, Andy" <andy.pei@intel.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>, "Cao, Gang"
 <gang.cao@intel.com>, "Liu, Changpeng" <changpeng.liu@intel.com>
Subject: RE: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device
Thread-Topic: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device
Thread-Index: AQHYVWD45fSFrFWmnkuemacxYKjQO60AnCYQgAFgp6A=
Date: Tue, 26 Apr 2022 09:56:44 +0000
Message-ID: <9ce9790d6ec34ef5a2d9ec824aa70bb6@intel.com>
References: <1643093258-47258-2-git-send-email-andy.pei@intel.com>
 <1650530034-59744-1-git-send-email-andy.pei@intel.com>
 <1650530034-59744-6-git-send-email-andy.pei@intel.com>
 <SN6PR11MB3504E71E6D5C747270099C7D9CF89@SN6PR11MB3504.namprd11.prod.outlook.com>
In-Reply-To: <SN6PR11MB3504E71E6D5C747270099C7D9CF89@SN6PR11MB3504.namprd11.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.6.401.20
dlp-reaction: no-action
x-originating-ip: [10.239.127.36]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
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

Hi Chenbo,

Thanks for your reply.
My reply is inline.

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, April 25, 2022 8:58 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device
>=20
> Hi Andy,
>=20
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Thursday, April 21, 2022 4:34 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > <changpeng.liu@intel.com>
> > Subject: [PATCH v6 05/16] vdpa/ifc: add vDPA interrupt for blk device
> >
> > For the block device type, we have to relay the commands on all
> > queues.
>=20
> It's a bit short... although I can understand, please add some background=
 on
> current implementation for others to easily understand.
>=20
Sure, I will send a new patch set to address this.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> >  drivers/vdpa/ifc/ifcvf_vdpa.c | 46
> > ++++++++++++++++++++++++++++++++------
> > -----
> >  1 file changed, 35 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index 8ee041f..8d104b7 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -370,24 +370,48 @@ struct rte_vdpa_dev_info {
> >  	irq_set->index =3D VFIO_PCI_MSIX_IRQ_INDEX;
> >  	irq_set->start =3D 0;
> >  	fd_ptr =3D (int *)&irq_set->data;
> > +	/* The first interrupt is for the configure space change
> > notification */
> >  	fd_ptr[RTE_INTR_VEC_ZERO_OFFSET] =3D
> >  		rte_intr_fd_get(internal->pdev->intr_handle);
> >
> >  	for (i =3D 0; i < nr_vring; i++)
> >  		internal->intr_fd[i] =3D -1;
> >
> > -	for (i =3D 0; i < nr_vring; i++) {
> > -		rte_vhost_get_vhost_vring(internal->vid, i, &vring);
> > -		fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd;
> > -		if ((i & 1) =3D=3D 0 && m_rx =3D=3D true) {
> > -			fd =3D eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
> > -			if (fd < 0) {
> > -				DRV_LOG(ERR, "can't setup eventfd: %s",
> > -					strerror(errno));
> > -				return -1;
> > +	if (internal->device_type =3D=3D IFCVF_NET) {
> > +		for (i =3D 0; i < nr_vring; i++) {
> > +			rte_vhost_get_vhost_vring(internal->vid, i, &vring);
> > +			fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd;
> > +			if ((i & 1) =3D=3D 0 && m_rx =3D=3D true) {
> > +				/* For the net we only need to relay rx queue,
> > +				 * which will change the mem of VM.
> > +				 */
> > +				fd =3D eventfd(0, EFD_NONBLOCK |
> EFD_CLOEXEC);
> > +				if (fd < 0) {
> > +					DRV_LOG(ERR, "can't setup
> eventfd: %s",
> > +						strerror(errno));
> > +					return -1;
> > +				}
> > +				internal->intr_fd[i] =3D fd;
> > +				fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd;
> > +			}
> > +		}
> > +	} else if (internal->device_type =3D=3D IFCVF_BLK) {
> > +		for (i =3D 0; i < nr_vring; i++) {
> > +			rte_vhost_get_vhost_vring(internal->vid, i, &vring);
> > +			fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D vring.callfd;
> > +			if (m_rx =3D=3D true) {
> > +				/* For the blk we need to relay all the read
> cmd
> > +				 * of each queue
> > +				 */
> > +				fd =3D eventfd(0, EFD_NONBLOCK |
> EFD_CLOEXEC);
> > +				if (fd < 0) {
> > +					DRV_LOG(ERR, "can't setup
> eventfd: %s",
> > +						strerror(errno));
> > +					return -1;
> > +				}
> > +				internal->intr_fd[i] =3D fd;
> > +				fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd;
>=20
> Many duplicated code here for blk and net. What if we use this condition =
to
> know creating eventfd or not:
>=20
> if (m_rx =3D=3D true && (is_blk_dev || (i & 1) =3D=3D 0)) {
> 	/* create eventfd and save now */
> }
>=20
Sure, I will send a new patch set to address this.
> Thanks,
> Chenbo
>=20
> >  			}
> > -			internal->intr_fd[i] =3D fd;
> > -			fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] =3D fd;
> >  		}
> >  	}
> >
> > --
> > 1.8.3.1
>=20