From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 64F75A0471 for ; Tue, 18 Jun 2019 18:07:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62FC01C20C; Tue, 18 Jun 2019 18:07:45 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id CB6641C0D4 for ; Tue, 18 Jun 2019 18:07:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2019 09:07:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,389,1557212400"; d="scan'208";a="334899767" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga005.jf.intel.com with ESMTP; 18 Jun 2019 09:07:37 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Jun 2019 09:07:37 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Jun 2019 09:07:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.83]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.72]) with mapi id 14.03.0439.000; Wed, 19 Jun 2019 00:07:34 +0800 From: "Wu, Jingjing" To: "Li, Xiaoyun" , "Wiles, Keith" , "Liang, Cunming" , "Maslekar, Omkar" CC: "dev@dpdk.org" Thread-Topic: [PATCH v6 3/6] raw/ntb: add handshake process Thread-Index: AQHVJXs16ed8fpCGIEmHtqO6i+ddZaahjR1g Date: Tue, 18 Jun 2019 16:07:34 +0000 Message-ID: <9BB6961774997848B5B42BEC655768F81145FE7B@SHSMSX103.ccr.corp.intel.com> References: <20190614021940.78631-1-xiaoyun.li@intel.com> <20190618021055.12709-1-xiaoyun.li@intel.com> <20190618021055.12709-4-xiaoyun.li@intel.com> In-Reply-To: <20190618021055.12709-4-xiaoyun.li@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTExNmQyYWItMTUyMS00ZmQ1LWJlNzctMjI4NDQ2ZTgzNzE2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoidlZ1cHVBUkppUEt0RGdva1NleW5rU2VFNTlpTVhTM0wrQ1dQSGo0TVR5aEVkSEVlZHQyZkdVTnBHSTk4TDhQbiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v6 3/6] raw/ntb: add handshake process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Li, Xiaoyun > Sent: Tuesday, June 18, 2019 10:11 AM > To: Wu, Jingjing ; Wiles, Keith ; Liang, > Cunming ; Maslekar, Omkar > Cc: dev@dpdk.org; Li, Xiaoyun > Subject: [PATCH v6 3/6] raw/ntb: add handshake process >=20 > Add handshake process using doorbell so that two hosts can > communicate to start and stop. >=20 > Signed-off-by: Xiaoyun Li > --- > drivers/raw/ntb_rawdev/ntb_rawdev.c | 336 +++++++++++++++++++++++++++- > 1 file changed, 335 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/raw/ntb_rawdev/ntb_rawdev.c > b/drivers/raw/ntb_rawdev/ntb_rawdev.c > index a03decd55..d9088e825 100644 > --- a/drivers/raw/ntb_rawdev/ntb_rawdev.c > +++ b/drivers/raw/ntb_rawdev/ntb_rawdev.c > @@ -28,6 +28,183 @@ static const struct rte_pci_id pci_id_ntb_map[] =3D { > { .vendor_id =3D 0, /* sentinel */ }, > }; >=20 > +static int > +ntb_set_mw(struct rte_rawdev *dev, int mw_idx, uint64_t mw_size) > +{ > + struct ntb_hw *hw =3D dev->dev_private; > + char mw_name[RTE_MEMZONE_NAMESIZE]; > + const struct rte_memzone *mz; > + int ret =3D 0; > + > + if (hw->ntb_ops->mw_set_trans =3D=3D NULL) { > + NTB_LOG(ERR, "Not supported to set mw."); > + return -ENOTSUP; > + } > + > + snprintf(mw_name, sizeof(mw_name), "ntb_%d_mw_%d", > + dev->dev_id, mw_idx); > + > + mz =3D rte_memzone_lookup(mw_name); > + if (mz) > + return 0; > + > + /** > + * Hardware requires that mapped memory base address should be > + * aligned with EMBARSZ and needs continuous memzone. > + */ > + mz =3D rte_memzone_reserve_aligned(mw_name, mw_size, dev->socket_id, > + RTE_MEMZONE_IOVA_CONTIG, hw->mw_size[mw_idx]); If the memzone is reserved inside of driver, how is the buffer be mapped wi= thout copy when enqueuer/dequeuer as the buffer might not be in the memzone= ? How about to design the dev_config to set the mw to be a memzone (might add= ress + size) which can be created by application instead of created interna= lly? [.....] > +static void > +ntb_dev_intr_handler(void *param) > +{ > + struct rte_rawdev *dev =3D (struct rte_rawdev *)param; > + struct ntb_hw *hw =3D dev->dev_private; > + uint32_t mw_size_h, mw_size_l; > + uint64_t db_bits =3D 0; > + int i =3D 0; > + > + if (hw->ntb_ops->db_read =3D=3D NULL || > + hw->ntb_ops->db_clear =3D=3D NULL || > + hw->ntb_ops->peer_db_set =3D=3D NULL) { > + NTB_LOG(ERR, "Doorbell is not supported."); > + return; > + } > + > + db_bits =3D (*hw->ntb_ops->db_read)(dev); > + if (!db_bits) > + NTB_LOG(ERR, "No doorbells"); > + Is the db_bits a common setting between different kind of NTB? [......] >=20 > @@ -356,7 +608,9 @@ static int > ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) > { > struct ntb_hw *hw =3D dev->dev_private; > - int ret; > + struct rte_intr_handle *intr_handle; > + uint32_t val; > + int ret, i; >=20 > hw->pci_dev =3D pci_dev; > hw->peer_dev_up =3D 0; > @@ -387,6 +641,86 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_d= evice > *pci_dev) > if (ret) > return ret; >=20 > + /* Init doorbell. */ > + hw->db_valid_mask =3D ((uint64_t)1 << hw->db_cnt) - 1; Use RTE_LEN2MASK instead? Thanks Jingjing