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 F0501429DB; Mon, 24 Apr 2023 14:15:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89507410D0; Mon, 24 Apr 2023 14:15:23 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B37C740FAE for ; Mon, 24 Apr 2023 14:15:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682338521; x=1713874521; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=d14WPMqQGC3R/ia1bPxAcgdzx4gbXEHnwJQ+YaYKXJk=; b=YahFZbB0jBYwLyvYKqnJeS1+EPdzvA5tDjarxQ2+V8cOEqhfjwpgh3l5 FzT9E2UpoqxY2se1rfJDHUG3GCd7IQccufl/C/Q1UAEtWhOODEDYWyTy4 QHS3YxuKnRFpgZbuJDgSdmlTuPgex8bCu1kSkllC3GiPWZ7gpnuZf/Dr3 zkSot38HJMWZR68PT4Gjq7de1AK6tN3Zd2udMwi2mRuBbpwfkYag+zRsd mIm3bK3yi57tNgOP1/5Jxdl9RQ7uLHrDfBF8tAfQVG7qa2rQd5tD8/swa EQPfQ/XawbGjYrWcv4Wd61zaeZ9PPBHY/APBVwbc/R06uBbG8ADqC10yQ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10689"; a="343920197" X-IronPort-AV: E=Sophos;i="5.99,222,1677571200"; d="scan'208";a="343920197" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 05:15:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10689"; a="757678117" X-IronPort-AV: E=Sophos;i="5.99,222,1677571200"; d="scan'208";a="757678117" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 24 Apr 2023 05:15:20 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.23; Mon, 24 Apr 2023 05:15:20 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 24 Apr 2023 05:15:18 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Mon, 24 Apr 2023 05:15:18 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.102) 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.2507.23; Mon, 24 Apr 2023 05:15:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IzgynmvqEmqR0owNw6t9Bca3qBLY/B7KCrzMQq7SWIxsDfL+YS8S4Ss1OXX+3Y2K21L4qeRvz9nyGt/CvZTTgNp4/wWtLdJQku997Mxm6IjBE0cZYGJp9rcqEyu0DKttRPx/56lMNeF330+14McTZ17qChs56S0eVOcS2tfCbuKo/9J2Q8u9RjSBk4DmcoVkJ4ZbohBU2TNzwdvk4zJxMUWfakCXuue+JNydabMzXv/Ey+cSn93pGR/NjZ3yzAsZKQXoOFCGj1gxJdqtrbEaNCGCSTrHACy5DT7X/HxJUrG3RX1i81XKtp4Pb0xOr0z0UKLVZtR7fjsvVrXyry1oGQ== 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=FpOyHMtHoQDL3UzUQRqmbOJxwmxEMk4Ji50GY4aRpiY=; b=ADpHihlcrMmsBQyXFxuwmL6osNtju8LtFj2LYaEkWWMHOEpoto5EDgJyrUMaWOnSaBNSVAkT9I8hO5OjO3svVOigzLPQ6rQqxB+zgGTczFRyNsZ762ieLzoAVxQPP6yAfkCX9DSM0kQg8c40fSsqW0VJ51BuIQffrsfDRkbYIBDXUaJLXcAiYx6OsCHT7VAhj4INObiTiflu3uZv71Lh4yffH9AY4QOr7+N1eWhLHDZ698GXQkLycr51QK2gi+DcCMDCEJYNtbkQjZile8b6gcXgU2YqFS0rd9BoZWoxTfp+TDDnd8QEy/gFGiI726qsodDFTwfYLBWNG2M4MNkRxw== 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 DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by BL1PR11MB5366.namprd11.prod.outlook.com (2603:10b6:208:31c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Mon, 24 Apr 2023 12:15:16 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e570:d9a7:df1b:1589]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::e570:d9a7:df1b:1589%6]) with mapi id 15.20.6319.033; Mon, 24 Apr 2023 12:15:16 +0000 From: "Zhang, Qi Z" To: "Qiao, Wenjing" , "Wu, Jingjing" , "Xing, Beilei" CC: "dev@dpdk.org" , "Pau, Christopher" Subject: RE: [PATCH v2 11/15] common/idpf: allocate static buffer at initialization Thread-Topic: [PATCH v2 11/15] common/idpf: allocate static buffer at initialization Thread-Index: AQHZdC3ImUSg2F31FEmo0yga41OvCq86Yv7w Date: Mon, 24 Apr 2023 12:15:16 +0000 Message-ID: References: <20230413094502.1714755-2-wenjing.qiao@intel.com> <20230421084043.135503-1-wenjing.qiao@intel.com> <20230421084043.135503-12-wenjing.qiao@intel.com> In-Reply-To: <20230421084043.135503-12-wenjing.qiao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: DM4PR11MB5994:EE_|BL1PR11MB5366:EE_ x-ms-office365-filtering-correlation-id: 8def4d45-5681-4cdf-c347-08db44bd906a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1WQC+pHe+J01o7bLf0yD7CrZCuECse6Vb4Gh1bL5Wf7kxqog3Q6JRuFKuCYn6NUA8ghFDD0wWL7FJ/tk62idldIDSVSOH2cq47csUVR+93E98Wn0JLGpNRKJJZK8VcFHfZjCyyDyHvU+OcWE3uDEkFaumNJ3iOtEl6lsT1qrobw8dCc5JWc47c1nz298SitY/OSxbW3PPUzCmf69Ta45NZcYySpWwieRamGyJxFarjbtLpVL7TRSKq1DaBP+YcRa+bCdfhciNCAxS37CqkOZCKb1j8QE0i+fulubV8/duGeRCj1JexlCJic3TE7U7c1Mv90WHK5EwIF6IQrc5KocTH6GCj4HvLM7fO4QWYEh3bWaYx/hr/020mgcX/jf+M+I7vhPytDc5o6w38YVExXo1aukx3RRzJXuttCZQGWEfRuI+CtPmbgbhd7VqUnk9uADpB58rW0R/a5kiF7mhkYt0HbZyDsnEF6pjB5xzYQkLJhR3dfJMK9eVw2Y9EpNfujL3MK9xGuCUm3xtyy9QZEiUFR73OtaYWT7HVfggNWI9xSIfpjLGn59L5XBPmeH6xopQeDU7bXwvsyJJUK3TZ2SoOljV10IooC5ziDIjiAUtSVz9lmUoV3a/YG95Y9VKo+Q x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(39860400002)(136003)(396003)(451199021)(478600001)(110136005)(54906003)(6636002)(86362001)(107886003)(186003)(53546011)(7696005)(26005)(9686003)(6506007)(55016003)(33656002)(71200400001)(4326008)(64756008)(66446008)(66476007)(66556008)(316002)(82960400001)(83380400001)(66946007)(76116006)(2906002)(38100700002)(122000001)(41300700001)(8676002)(8936002)(38070700005)(5660300002)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TU5YmVtiIz4wZ22HKJHElpp2nt1fqP5iobbVxijaaGDQcboxioxKezj5/sAa?= =?us-ascii?Q?zQu84uDGmf3hvqDDDtSjtLHaK5PTH5HioGZ+U3ZXhBs8cmEIrveM93SQSnRn?= =?us-ascii?Q?ggQhB9yWbRFTIEctre3/67hbGbZhiKXWW92UjCo+YP0eMbtHC9O6GOkfWs23?= =?us-ascii?Q?420hn243HUTei0XNXTeFWwVDD1Wu8vN/aIFMeveu/VEz88RoeZXPDkO7z+QS?= =?us-ascii?Q?CcIH9++qRDrgY2AuK4zU35UmHesdspY4iHS31pwmHAY3Thh3vYsAzyz/VcAr?= =?us-ascii?Q?AfjY8dSjln+WY37I++MM4BZ9P5gb9AQLp2xQDss/53rf8wYo3ijhu5KN/UCY?= =?us-ascii?Q?x3S+f9n+DuzO1HrhD2e1uM2IEg/5jw1ralMHCMpThv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iMCzhTRgjHr57yRlZld5Y1dT4rUjL1M1fpEifi0oGA3rbaYzkc1+?= =?us-ascii?Q?MHBOGdK6T/95N8P23VFdlUcfds18SN+uqM21U+oSckfd+RYjeYNq3XoqcKCE?= =?us-ascii?Q?+iJRiaqvzTtF0r06NwBJkBV3FybqQUV5PYehDoRhFngFunUmP3KWTznGbL/4?= =?us-ascii?Q?FMHd4fylsvRmfaeBn+DJ7H2F8n3kpEn/msSk8UKMraGBwrW14jzr12bntIc/?= =?us-ascii?Q?J0XxaM0rIcfNReztjDMGtVzuaXAU/hsLCBzVWfW99nfnBDgR4uH+ov2ypx7S?= =?us-ascii?Q?d85Tpn2lZXmPEhC/EuMP0B2iZSrCJM9Dc0uWaQwk?= 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: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8def4d45-5681-4cdf-c347-08db44bd906a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2023 12:15:16.5312 (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: wxQz/2Ej3kTGkdEwzl7us/C1LzXtVorKU0hLYXxAelYy0XSxNpRVFp1f3D7Hgo5oA1D1QvukcE6VuVRtatXQCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5366 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: Qiao, Wenjing > Sent: Friday, April 21, 2023 4:41 PM > To: Wu, Jingjing ; Xing, Beilei > ; Zhang, Qi Z > Cc: dev@dpdk.org; Qiao, Wenjing ; Pau, > Christopher > Subject: [PATCH v2 11/15] common/idpf: allocate static buffer at > initialization >=20 > Some OSs don't allow allocating DMA memory at runtime. So create an initi= al > static buffer at initialization to hold this data. Seems this is not for DPDK which should support DMA allocation, do we reall= y need this patch? Btw using global variables in a module can create issues in a multi-device = environment where multiple devices share the same module. We can consider to embedded this struct in idpf_hw. >=20 > Signed-off-by: Christopher Pau > Signed-off-by: Wenjing Qiao > --- > drivers/common/idpf/base/idpf_common.c | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/common/idpf/base/idpf_common.c > b/drivers/common/idpf/base/idpf_common.c > index de82c3458f..f4a5707272 100644 > --- a/drivers/common/idpf/base/idpf_common.c > +++ b/drivers/common/idpf/base/idpf_common.c > @@ -6,6 +6,7 @@ > #include "idpf_prototype.h" > #include "virtchnl.h" >=20 > +struct idpf_dma_mem send_dma_mem =3D { 0 }; >=20 > /** > * idpf_set_mac_type - Sets MAC type > @@ -132,6 +133,15 @@ int idpf_init_hw(struct idpf_hw *hw, struct > idpf_ctlq_size ctlq_size) >=20 > idpf_free(hw, q_info); >=20 > + /* > + * Need an initial static buffer to copy DMA memory to send > + * for drivers that do not allow this allocation at runtime > + */ > + send_dma_mem.va =3D (struct idpf_dma_mem *) > + idpf_alloc_dma_mem(hw, &send_dma_mem, 4096); > + if (!send_dma_mem.va) > + return -ENOMEM; > + > return 0; > } >=20 > @@ -152,7 +162,6 @@ int idpf_send_msg_to_cp(struct idpf_hw *hw, int > v_opcode, > int v_retval, u8 *msg, u16 msglen) > { > struct idpf_ctlq_msg ctlq_msg =3D { 0 }; > - struct idpf_dma_mem dma_mem =3D { 0 }; > int status; >=20 > ctlq_msg.opcode =3D idpf_mbq_opc_send_msg_to_pf; @@ -162,19 > +171,11 @@ int idpf_send_msg_to_cp(struct idpf_hw *hw, int v_opcode, > ctlq_msg.cookie.mbx.chnl_opcode =3D v_opcode; >=20 > if (msglen > 0) { > - dma_mem.va =3D (struct idpf_dma_mem *) > - idpf_alloc_dma_mem(hw, &dma_mem, msglen); > - if (!dma_mem.va) > - return -ENOMEM; > - > - idpf_memcpy(dma_mem.va, msg, msglen, > IDPF_NONDMA_TO_DMA); > - ctlq_msg.ctx.indirect.payload =3D &dma_mem; > + idpf_memcpy(send_dma_mem.va, msg, msglen, > IDPF_NONDMA_TO_DMA); > + ctlq_msg.ctx.indirect.payload =3D &send_dma_mem; > } > status =3D idpf_ctlq_send(hw, hw->asq, 1, &ctlq_msg); >=20 > - if (dma_mem.va) > - idpf_free_dma_mem(hw, &dma_mem); > - > return status; > } >=20 > @@ -262,6 +263,9 @@ int idpf_clean_arq_element(struct idpf_hw *hw, > */ > int idpf_deinit_hw(struct idpf_hw *hw) > { > + if (send_dma_mem.va) > + idpf_free_dma_mem(hw, &send_dma_mem); > + > hw->asq =3D NULL; > hw->arq =3D NULL; >=20 > -- > 2.25.1