From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 534E4A04B9; Mon, 7 Sep 2020 11:18:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B33581BEE1; Mon, 7 Sep 2020 11:18:19 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 9736229AC for ; Mon, 7 Sep 2020 11:18:17 +0200 (CEST) IronPort-SDR: tuQl4erdFsq/GE3R8P4kItYp9SBAAjykQOsqvKtxq4EDI9W75vrDhbbrL5L0fBcY61y2cRRN8j Mzwtom0NSwnQ== X-IronPort-AV: E=McAfee;i="6000,8403,9736"; a="155475938" X-IronPort-AV: E=Sophos;i="5.76,401,1592895600"; d="scan'208";a="155475938" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2020 02:18:16 -0700 IronPort-SDR: iDH3qmMIwkKbChfC62ZrgdLkJZNbW2KiWLftoh6DvBRnxIF2O3zxi1HXGOvsws0H/JC9Qamwu1 kEx72VbQoaug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,401,1592895600"; d="scan'208";a="448356508" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga004.jf.intel.com with ESMTP; 07 Sep 2020 02:18:16 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 7 Sep 2020 02:18:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 7 Sep 2020 02:18:15 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 7 Sep 2020 02:18:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fh+j+a8I+gBHTdMyHHl2u+0C1IcErueRziw9WOyqTSF/9s6dE8APtRWeZqYupUpP8ZBvxmKfk6p30ZR3qHomEVbCUUzLZFhWE+rHgMFzk2Ek8DS+AfjWql8cRr2nXrl7glmypiUiYhsQytePJBaDnlKVkcwvliDLYev422uHlkvl1J3fkGy2wAdGSfOjDMEzxEbIRayeJp/vzDPCH9cXSuNg4jracqbIqLCq6ZuD38xLihkXmcRLOVvNniFas5bG8OZtnjtxBj8wdHECfz7K8npaJdEJcPeMZp8Kv12C8O/C3K53OY4qhUgRmN+a3T5EbZLuuArDc3wBS6sIc+b8pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HuMfKgIouY+r+qSU7+UMwckLBn6+x5ALBSGXsYjdUK8=; b=JfcaNBXX0UBpauE8T86m1Afd73yFy9iKklM/k0/hsncki1dJF675fKrl8rCCK4a3J7IwQpJd6YnXa9RWFUZkQbBkyZAZjFFthVbdQEppgZ73G39kLT5JMyKSi2PCsLcK44J11iKPdCZ5F71KWqDlOjMKd6LB2QMUlNRhHgFZBVH+m9c9yXwKHav+NoaleCVMh6fTSCqpqsJwCiON0bKIpYPft/5QyVkJyX+fQpxZr+EzMTYsWxn0yNaf9eS8RwnCUL2Sy+NUFhJ1ejrH8h6h8fVa7a9PNhGStX/LHbLSaETC1PaR8YXVIJekYbW/T23jrVxgkRIrx65f8ChRVnbiWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HuMfKgIouY+r+qSU7+UMwckLBn6+x5ALBSGXsYjdUK8=; b=mRf77YMtln1A8wpL8WkeER8E9CfpdxTGeuXDz8L1AFzn7Mh8y64ycz9Au+928+XsPMTsWHE2KO7bNtO/pJWz5Nfh+9cDVdjjknNn7OECjE8wFHCXttsQAnOazSTxp2+hDLNytROd15gNhDTHZtlpud5CwSCXDaa0JzDrIbyI+lE= Received: from DM5PR11MB1753.namprd11.prod.outlook.com (2603:10b6:3:10d::13) by DM6PR11MB4186.namprd11.prod.outlook.com (2603:10b6:5:196::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Mon, 7 Sep 2020 09:18:09 +0000 Received: from DM5PR11MB1753.namprd11.prod.outlook.com ([fe80::ec81:9fa3:310c:982b]) by DM5PR11MB1753.namprd11.prod.outlook.com ([fe80::ec81:9fa3:310c:982b%10]) with mapi id 15.20.3348.019; Mon, 7 Sep 2020 09:18:09 +0000 From: "Li, Xiaoyun" To: "Wu, Jingjing" CC: "dev@dpdk.org" , "Maslekar, Omkar" Thread-Topic: [PATCH v3] raw/ntb: add Icelake support for Intel NTB Thread-Index: AQHWhL2fU7n2mFtPj0qWehTdnWXa76lc2f+AgAAIcnA= Date: Mon, 7 Sep 2020 09:18:09 +0000 Message-ID: References: <20200831045958.5589-1-xiaoyun.li@intel.com> <20200907022112.17640-1-xiaoyun.li@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.38] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e507e107-0fe6-4664-709f-08d8530eeff6 x-ms-traffictypediagnostic: DM6PR11MB4186: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: E8JVbbIR8TGykaPu+Mm0q5hd81OiEcQK+Q+wzlu8mOktt9RQORNpbo08CFJW0q64T7IreiVziH2i8RKi4ndsFN1+SUUna7UEheQb7WOAxI5J+Vz2hyryK//fymZuleNIaTWkDl30YYx0bjryNa1V1MbMPtXQVYiwP7apkwQ6sy8LDzm7C6a6M/OTtgDWjqW1A3tz2c/ExY8TLn6nIK6E7z5QXLWYDFOPz44RGijY4knlJAx5vphmnTpb556Q8QBvTx2M1yP/Rf34i7111qeHV3XkzYa+8427r2ukolwgKXqV6NATWXGsPgHaTQ/AjkUc8AjgB7svVuXulN07wsTK1g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR11MB1753.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(396003)(346002)(376002)(136003)(52536014)(55016002)(64756008)(66476007)(66446008)(66556008)(66946007)(76116006)(5660300002)(26005)(6862004)(186003)(83380400001)(53546011)(6506007)(107886003)(8936002)(316002)(7696005)(4326008)(2906002)(33656002)(8676002)(6636002)(9686003)(54906003)(478600001)(71200400001)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: sdWWrRd96YC6CoknAugsRfLm619KIk4iVY0/u7OwV75herL1ySDIesSE8oDoaP4B1ZtZwwrj1ya7zV88sOvzMvF46AlF7ZeVOQsou6nQEXmdtozLc+Dl9HZ4Sbv2jUxMX/AnmhNa/mgMoN2RIRPa95qPRFTtx8uwDDgUTWDz3J2gl06QVVYcvIB///5cwF9yD8sjbXZT+xLa6eEbbIWaBRxLdYvR1+fvd1RyyeIdcT+EvDBBw2IZeFUZ/OjmS6ahMlSSHkI5QHMrHu0fe1Wy3ivK/W/gPaYNIu4zpzOI1SAwVKV3fMHHyI3QyHpkmob8WytBNzOrf630MrlgESsntD/48qryUo1wAZbN14hdNF2MXeyuoZhreyaV/m/T/mZ6VZmW+UZ304vOs9Q+FMWuvBFc4KwDweCDVUIvB58anPU/GqvHPRPB1TouZJxybe9Le2WgD4FCzEnDmuGr0oLFWrWRNxjj2FJNic1JQVbEKa/Nvg7EDrMTs5Fi6WPZCYUToCkREETmrpplE2Zp1Oz16a2rmsKObQlvslima485tvYeXYRVLZ7F7Hgt5PSmdM37RlkMgmQ92Fdq3G7FV0bHdKoUQ4A64SQOYuRYXjxpxxkMyfYLBBbq/8pNir2LIene8UOY02HcG9F9oeSJoApvzA== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1753.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e507e107-0fe6-4664-709f-08d8530eeff6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2020 09:18:09.1758 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8nwLsnVkh8ZHTxxi92OgYlVRBAfc935eI2dPjf1yrqW742OeF8eFkLMpiFqABSXWyfxDH4eBYdPj9QRmCJKetA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4186 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] raw/ntb: add Icelake support for Intel NTB 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" Hi > -----Original Message----- > From: Wu, Jingjing > Sent: Monday, September 7, 2020 16:35 > To: Li, Xiaoyun > Cc: dev@dpdk.org; Maslekar, Omkar > Subject: RE: [PATCH v3] raw/ntb: add Icelake support for Intel NTB >=20 > > + > > +static int > > +intel_ntb_dev_init(const struct rte_rawdev *dev) { > > + struct ntb_hw *hw =3D dev->dev_private; > > + uint8_t bar; > > + int ret, i; > > + > > + if (hw =3D=3D NULL) { > > + NTB_LOG(ERR, "Invalid device."); > > + return -EINVAL; > > + } > > + > > hw->hw_addr =3D (char *)hw->pci_dev->mem_resource[0].addr; > > > > + if (is_gen3_ntb(hw)) { > > + ret =3D intel_ntb3_check_ppd(hw); > > + } else if (is_gen4_ntb(hw)) { > > + /* PPD is in MMIO but not config space for NTB Gen4 */ > > + ret =3D intel_ntb4_check_ppd(hw); > > + if (ret) > > + return ret; > Above two lines are not necessary. OK. > > + } else { > > + return -ENOTSUP; > > + } > > + > > + if (ret) > > + return ret; > > + > > hw->mw_cnt =3D XEON_MW_COUNT; > > hw->db_cnt =3D XEON_DB_COUNT; > > hw->spad_cnt =3D XEON_SPAD_COUNT; > > @@ -149,15 +219,28 @@ intel_ntb_mw_set_trans(const struct rte_rawdev > > *dev, int mw_idx, > > rte_write64(base, xlat_addr); > > rte_write64(limit, limit_addr); > > > > - /* Setup the external point so that remote can access. */ > > - xlat_off =3D XEON_EMBAR1_OFFSET + 8 * mw_idx; > > - xlat_addr =3D hw->hw_addr + xlat_off; > > - limit_off =3D XEON_EMBAR1XLMT_OFFSET + mw_idx * > > XEON_BAR_INTERVAL_OFFSET; > > - limit_addr =3D hw->hw_addr + limit_off; > > - base =3D rte_read64(xlat_addr); > > - base &=3D ~0xf; > > - limit =3D base + size; > > - rte_write64(limit, limit_addr); > > + if (is_gen3_ntb(hw)) { > > + /* Setup the external point so that remote can access. */ > > + xlat_off =3D XEON_EMBAR1_OFFSET + 8 * mw_idx; > > + xlat_addr =3D hw->hw_addr + xlat_off; > > + limit_off =3D XEON_EMBAR1XLMT_OFFSET + > > + mw_idx * XEON_BAR_INTERVAL_OFFSET; > > + limit_addr =3D hw->hw_addr + limit_off; > > + base =3D rte_read64(xlat_addr); > > + base &=3D ~0xf; > > + limit =3D base + size; > > + rte_write64(limit, limit_addr); > > + } else if (is_gen4_ntb(hw)) { > Can we use a variable in struct to indicate it's gen4 or gen3 after init = instead of > check it every time? What's the difference? It comes from the value in hw->pci_dev->id.device_id= . Checking it in this way is trying to make it easier to extend it for gen2 n= tb in the future. It's not either gen3 or gen4. I don't think it makes sense to have a bool value to indicate it's gen3 or = gen4. >=20 > > + /* Set translate base address index register */ > > + xlat_off =3D XEON_GEN4_IM1XBASEIDX_OFFSET + > > + mw_idx * XEON_GEN4_XBASEIDX_INTERVAL; > > + xlat_addr =3D hw->hw_addr + xlat_off; > > + rte_write16(rte_log2_u64(size), xlat_addr); > > + } else { > > + rte_write64(base, limit_addr); > > + rte_write64(0, xlat_addr); > > + return -ENOTSUP; > > + } > Is the else branch necessary? As if neither gen3 or gen4, the init would = fail. > Would be better to print an ERR instead of just return NO support. I don't think so. Yes. It will fail in init. Returning err is to stop other following actions= like in intel_ntb_vector_bind() since it should be stopped. And I'd like to keep them in one coding style. As to the print, I think tha= t can be upper layer's job to check the value and print err. Choosing ENOTSUP is because that in init, if it's not supported hw, it will= return -ENOTSUP err. > > > > return 0; > > } >=20