From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7874EA034C; Wed, 21 Sep 2022 07:41:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BE9840697; Wed, 21 Sep 2022 07:41:19 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id D70254014F for ; Wed, 21 Sep 2022 07:41:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663738878; x=1695274878; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=87KNusYAoPaJ2nQCOhFGzmb+gb9faKA6V2i/2TX7S78=; b=DeJd0bu11r1lBaih84wTkCbo3sgaQjVrYfMK7rsWdhv2b0k2YDxzuFMm /IrzIOy4aR0FOcwgWrnpJIFCUMBbmdHWseaSQtsIa4H5EeR4OSdsvG8QW QSLd4FD9CzE9b8LDNDXsReERABCgxhq+t59mhkQDuZm/t3yse7Z+r77b6 HJan3qL/+p0h2hu3IY/bpcdPZA9PmXurVGZCzHqJJChCTX8qoDeHqSFtn z/a/03hEwSyYXoRmoZzwrFpn69w4nNRl4uMXIQGJDQWkgBW1MUxP0OuLw 1PxSprxd4STPDkBSDN7oOvvLq8gBsqSWuEvdY1J1NqsWszJ7SM0Eqes+v A==; X-IronPort-AV: E=McAfee;i="6500,9779,10476"; a="279631522" X-IronPort-AV: E=Sophos;i="5.93,332,1654585200"; d="scan'208";a="279631522" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2022 22:41:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,332,1654585200"; d="scan'208";a="570389843" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga003.jf.intel.com with ESMTP; 20 Sep 2022 22:41:04 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) 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.2375.31; Tue, 20 Sep 2022 22:41:03 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 20 Sep 2022 22:41:03 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 20 Sep 2022 22:41:03 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.177) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 20 Sep 2022 22:41:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ef7UYRIWg/EcsssMIoJNySGR1Ifk3tr7A6k2ATg2RnUuEZ+yXAvuJxWSA5ZV4/b2Z/CXfLitXbX7YeHXh0NYipUl+Gx0CrRM6QiPGH8mDqGiH4g+Y6zUioXw0/Y9gYiJBcAqmKDOzA+qR2uuTzlTA1eXpdP84XcgQHBiu6Hc9+0cdeDD9eaW0R6sgOmBQql0mTJ3A033HMSno8+vsCbiOWLgv4PQMSO7Hy0QorFdQVZd38DECnUCkbmUSmKTMxhLdiguoJt4y2AzaXRsk1APb0aefUPcwunYRCbHvWUcfQgrhtaLsxfYxjp07Jgo0DXWfx3Jgp6lrZkozKj8zx0JaQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jb5vbiotPTfyLuuqMZ/Lq7nJ3YlK34FSr6ILclXDdGc=; b=Ij4QAwE97a5IDpK2za+SuOzGJtwmWNr+z1odh7c98IBP/Wv0lRvYSGCbb7j9/B5p2vA9LcYa40TU9ydgWHWjZWqmFztpN88NOvL9nT34QfZk7rS3/pgXTmPFaI8yY5k7H0cIi6jF91imYmp8bS12J4bMfEqR5p4snx+rTEw2GcPVMQuRiAu51pgj5QWNZc5M4PFxJ6eqiLQAaojYcGNpcuWWu3o1nRnR/3dfsaK+G9kIcVXy3pEJ6524CP0AfDozFLiWt6jOOS69entaaEsvNpmoEKku7+nYkh+dH7cuqvo/X728h5ER88M90aI/q+5eTTozKYoeWo2a0U2519VzCA== 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 Received: from LV2PR11MB5997.namprd11.prod.outlook.com (2603:10b6:408:17f::10) by PH7PR11MB7074.namprd11.prod.outlook.com (2603:10b6:510:20d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Wed, 21 Sep 2022 05:41:00 +0000 Received: from LV2PR11MB5997.namprd11.prod.outlook.com ([fe80::9171:8787:3991:bec0]) by LV2PR11MB5997.namprd11.prod.outlook.com ([fe80::9171:8787:3991:bec0%5]) with mapi id 15.20.5632.018; Wed, 21 Sep 2022 05:41:00 +0000 From: "Xing, Beilei" To: "Guo, Junfeng" , "Zhang, Qi Z" , "Wu, Jingjing" CC: "dev@dpdk.org" , "Wang, Xiao W" , "Li, Xiaoyun" Subject: RE: [PATCH v2 03/14] net/idpf: add support for device initialization Thread-Topic: [PATCH v2 03/14] net/idpf: add support for device initialization Thread-Index: AQHYwRZ4hchplpMPVk2kgBW5sl9RLK3pdgbQ Date: Wed, 21 Sep 2022 05:41:00 +0000 Message-ID: References: <20220803113104.1184059-1-junfeng.guo@intel.com> <20220905105828.3190335-1-junfeng.guo@intel.com> <20220905105828.3190335-4-junfeng.guo@intel.com> In-Reply-To: <20220905105828.3190335-4-junfeng.guo@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR11MB5997:EE_|PH7PR11MB7074:EE_ x-ms-office365-filtering-correlation-id: 2107254d-ea42-469b-9f08-08da9b93dd79 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: K3w2Nzmyk9kr79j7JAJxQUsKqqXbwIaNGsJAsyGIzGwEtpry0L0MAA0G7SlCUvCkWaBtZsLrc80MSP4f7ZHuy14qeyn81cmPukvdp47f25wLF+TohtNvji0oaVR98W3ICMQ1LM6S8xKlPpAZ5YEiLI6HdyfZTgUddPvaBslRB9hz9yKi9RJSdU8TEf2iDsC/iJEtm5wlTA6MXj8pZmbeMyiUFzrH4F6qLIu4ylyHsFMb2TquFkfr0igrs/zjdLtLVb9J6UgxTzkok7iHNfs/9r7Um2aJ+NPMFSOGLsz6IYEVnBOGekmqoNjum7ist2GJJdOXAniItSgjiZxzRtr76BvEOKfvG0YjjN8GRyjwsYOpdzOc2Y82cXTpYq+7KiIzyL+g8wMm7J0t8nJlvWxudkt0DOM7o8fcl/YGIBtULAS0UUHjV31zxCmH8d3d8Zyz3gX1HOrPzuzw+drHv5FFUV9nS/cW3BHdYol/n6pwtU2UW0cAB4m3wFA8aGKaPAjEoVwpZdW1Y6Wt9nYAW0+eQqrKahF8NdMcyo8o+Af0RPKWJCLyWVbObg1SlEL8wql+9bJ4+kpX6JbT+JKjLzWWBg6AA7StwIpMjfLPriIE6d6knfkdF59x9/sAcABj6TyVCI8LloxHvR1JYoiMMJjcPvwXlwUYRUw0uoQ63/odKRU+eBLPP5vfLuQD/0iHYo31S+poEMfWwWxq9Q0mE0HY5iK739jPEEPjHYqN0KeyOdPPyJMNmaY0lT8o8yzqrasH5U2xANRtKvlmf3qg3y+3cQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:LV2PR11MB5997.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(39860400002)(376002)(346002)(136003)(366004)(451199015)(7696005)(41300700001)(55016003)(107886003)(478600001)(26005)(53546011)(6506007)(9686003)(122000001)(71200400001)(33656002)(38100700002)(2906002)(86362001)(186003)(64756008)(66446008)(66946007)(66556008)(8676002)(82960400001)(76116006)(4326008)(38070700005)(66476007)(8936002)(110136005)(5660300002)(316002)(6636002)(52536014)(83380400001)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0xDWXdHdoQRc81Yb+b7xkUVKA93Goc8lOZYZgK5WCHRmeYRqWClHcujGv5uW?= =?us-ascii?Q?O2bqWda4Wh0mSCfrV3Lay6+505idnZk4gLMUfqgtcXDKTDJcRqnL+fLgccNJ?= =?us-ascii?Q?gFQ1fKVuAq4djl0Z/INf/B3FXJc9aQFThxrgImy0GfjV0ZRB8/65z/TchuG5?= =?us-ascii?Q?lzM4QUHEMqQtvkFWG+uSb4UXTA7VhTUNLXd8hAmUfO5UrGoBsMyEBaEloZdU?= =?us-ascii?Q?VyFtdxX4NWshW23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= =?us-ascii?Q?gV5KahJXwV5LOW5sr4HCJ+Cs3w1DPbQMcZtfw6H0bZ32LN5ywaFK/ly4h16j?= =?us-ascii?Q?P4GJn6nG/oM1txFpZZIaXOy0TmnpT60vlXLqUcmNpQ/HQ1yivz3o4cgkTyl8?= =?us-ascii?Q?NDpqu4imvBZSKDDHe8ILt09OAWKFprcJgbZbOcmpqhk0grbFcJw5uz59LORy?= =?us-ascii?Q?pNNAz0+wyfXuo3aNRscywUThtu4cpBuDl2YFY2knqKzMiOCC+jQQWB7NKCcr?= =?us-ascii?Q?6dqgxlG7ART9bweJG8hW1RKfrqQ7SbtvEKfEU3U1yjquTLw+CLMOzZVy8VyT?= =?us-ascii?Q?rKI6IJ+6X4ofE3ceUiIbm0ee/tBf8MrrMmWixlKmDj+xbUOYLN3SQEj1aEqU?= =?us-ascii?Q?rgZJMbMQ2yY2BFBk5iFagwAvyxZNQWZEgHkpPtP0Xxo3sMTk4A2MAnafNA+A?= =?us-ascii?Q?cHwLkjoyv4fNXBvYqMPKUVEcR6YdyaUUuEirh6SP?= 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: LV2PR11MB5997.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2107254d-ea42-469b-9f08-08da9b93dd79 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2022 05:41:00.4266 (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: hNfy/k9W8W9/s4Sxwr48jEmS39s8yfsJy6QDgxIbyQVDTyTgPn6qInmXLEfHM0vSFnNjwHFNjSQxskuZX59Acw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7074 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Guo, Junfeng > Sent: Monday, September 5, 2022 6:58 PM > To: Zhang, Qi Z ; Wu, Jingjing > ; Xing, Beilei > Cc: dev@dpdk.org; Wang, Xiao W ; Guo, Junfeng > ; Li, Xiaoyun > Subject: [PATCH v2 03/14] net/idpf: add support for device initialization >=20 > Support device init and the following dev ops: > - dev_configure > - dev_start > - dev_stop > - dev_close >=20 > Signed-off-by: Beilei Xing > Signed-off-by: Xiaoyun Li > Signed-off-by: Xiao Wang > Signed-off-by: Junfeng Guo > --- > drivers/net/idpf/idpf_ethdev.c | 810 > +++++++++++++++++++++++++++++++++ drivers/net/idpf/idpf_ethdev.h | > 229 ++++++++++ drivers/net/idpf/idpf_vchnl.c | 495 > ++++++++++++++++++++ > drivers/net/idpf/meson.build | 18 + > drivers/net/idpf/version.map | 3 + > drivers/net/meson.build | 1 + > 6 files changed, 1556 insertions(+) > create mode 100644 drivers/net/idpf/idpf_ethdev.c create mode 100644 > drivers/net/idpf/idpf_ethdev.h create mode 100644 > drivers/net/idpf/idpf_vchnl.c create mode 100644 > drivers/net/idpf/meson.build create mode 100644 > drivers/net/idpf/version.map >=20 <...> > +static int > +idpf_adapter_init(struct rte_pci_device *pci_dev, struct idpf_adapter > +*adapter) { > + struct iecm_hw *hw =3D &adapter->hw; > + int ret =3D 0; > + > + hw->hw_addr =3D (void *)pci_dev->mem_resource[0].addr; > + hw->hw_addr_len =3D pci_dev->mem_resource[0].len; > + hw->back =3D adapter; > + hw->vendor_id =3D pci_dev->id.vendor_id; > + hw->device_id =3D pci_dev->id.device_id; > + hw->subsystem_vendor_id =3D pci_dev->id.subsystem_vendor_id; > + > + strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE); > + > + idpf_reset_pf(hw); > + ret =3D idpf_check_pf_reset_done(hw); > + if (ret) { > + PMD_INIT_LOG(ERR, "IDPF is still resetting"); > + goto err; > + } > + > + ret =3D idpf_init_mbx(hw); > + if (ret) { > + PMD_INIT_LOG(ERR, "Failed to init mailbox"); > + goto err; > + } > + > + adapter->mbx_resp =3D rte_zmalloc("idpf_adapter_mbx_resp", > IDPF_DFLT_MBX_BUF_SIZE, 0); > + if (!adapter->mbx_resp) { > + PMD_INIT_LOG(ERR, "Failed to allocate > idpf_adapter_mbx_resp memory"); > + goto err_mbx; > + } > + > + if (idpf_check_api_version(adapter)) { > + PMD_INIT_LOG(ERR, "Failed to check api version"); > + goto err_api; > + } > + > + adapter->caps =3D rte_zmalloc("idpf_caps", > + sizeof(struct virtchnl2_get_capabilities), 0); > + if (!adapter->caps) { > + PMD_INIT_LOG(ERR, "Failed to allocate idpf_caps memory"); > + goto err_api; > + } > + > + if (idpf_get_caps(adapter)) { > + PMD_INIT_LOG(ERR, "Failed to get capabilities"); > + goto err_caps; > + } > + > + adapter->max_vport_nb =3D adapter->caps->max_vports; > + > + adapter->vport_req_info =3D rte_zmalloc("vport_req_info", > + adapter->max_vport_nb * > + sizeof(*adapter->vport_req_info), > + 0); > + if (!adapter->vport_req_info) { > + PMD_INIT_LOG(ERR, "Failed to allocate vport_req_info > memory"); > + goto err_caps; > + } > + > + adapter->vport_recv_info =3D rte_zmalloc("vport_recv_info", > + adapter->max_vport_nb * > + sizeof(*adapter- > >vport_recv_info), > + 0); > + if (!adapter->vport_recv_info) { > + PMD_INIT_LOG(ERR, "Failed to allocate vport_recv_info > memory"); > + goto err_vport_recv_info; > + } > + > + adapter->vports =3D rte_zmalloc("vports", > + adapter->max_vport_nb * > + sizeof(*adapter->vports), > + 0); > + if (!adapter->vports) { > + PMD_INIT_LOG(ERR, "Failed to allocate vports memory"); > + goto err_vports; > + } > + > + adapter->max_rxq_per_msg =3D (IDPF_DFLT_MBX_BUF_SIZE - > + sizeof(struct virtchnl2_config_rx_queues)) / > + sizeof(struct virtchnl2_rxq_info); > + adapter->max_txq_per_msg =3D (IDPF_DFLT_MBX_BUF_SIZE - > + sizeof(struct virtchnl2_config_tx_queues)) / > + sizeof(struct virtchnl2_txq_info); > + > + adapter->cur_vports =3D 0; > + adapter->cur_vport_nb =3D 0; > + adapter->next_vport_idx =3D 0; > + > + return ret; > + > +err_vports: > + rte_free(adapter->vports); > + adapter->vports =3D NULL; Need to free adapter->vport_recv_info here but not adapter->vports. =20 > +err_vport_recv_info: > + rte_free(adapter->vport_req_info); > + adapter->vport_req_info =3D NULL; > +err_caps: > + rte_free(adapter->caps); > + adapter->caps =3D NULL; > +err_api: > + rte_free(adapter->mbx_resp); > + adapter->mbx_resp =3D NULL; > +err_mbx: > + iecm_ctlq_deinit(hw); > +err: > + return -1; > +} > + > +