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 7E63FA0A0F; Mon, 5 Jul 2021 08:35:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6972341148; Mon, 5 Jul 2021 08:35:22 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 5443740141 for ; Mon, 5 Jul 2021 08:35:20 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10035"; a="196214260" X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="196214260" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2021 23:35:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,325,1616482800"; d="scan'208";a="559585076" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 04 Jul 2021 23:35:16 -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.2242.10; Sun, 4 Jul 2021 23:35:16 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) 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.2242.4; Sun, 4 Jul 2021 23:35:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Sun, 4 Jul 2021 23:35:15 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) 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.2242.4; Sun, 4 Jul 2021 23:35:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXFK2WFWYKvm4vGm816nnkvRxaGj7iVtYvyLqE4TsEh1f+JiEj2RG+X8UpK+LmwcIeX8gOvxVDYNyJ73ETGS1UR8sUBlFZ5j+1lT836XRwWG6oMPI238mZvxBzmXii4UCd8uE/2DABxLmzgumvPZvLblOTOTsAWjAyIet3DK9BtBBkipQwKPxdwPtAFyS/WS8pGX9GL7votx7UOSzA7ErDpd0q7JmIBMnmPvT7vRwE/UCV9LzIfsCJ8HrPSg8fuZ87Ubwlu1JHNPUzEjNI9I165rmFVjeDaxcLuU8QMxQC7af7YRg8NDK0Ozh3kEkb2w8CTHRNPEtLvZlWZY7ZrznA== 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=7vbYg8U4+PLUWg4etzBHweh9bhfXR8gYwfoYA9G5HwI=; b=fOw1ghfyMJD4IeOQOGIB2Qlecl7MAaxp+9oaqRcd4ykytY2A1PhzJLKrDbLJmlVF/751LNYlfPXjxcwV/LhiVIMzcAg7jp7qdtyj3IxBYs+VSzO95FsxzM2z4c7bFbIpsOT2Kw5cUkAu023L/TbyhO2XDxGK0B5ozrmDnD6M3WyQTq/4L83sY1f9COQf5D4F27Af2nta9SqfhzKTadeIqWEMx1Bt5JlTdGmikvngcToXuodydVM3GEARDDphA9qttwRC+ZtzgyaNM27O87XGc3TBvYd5WwOlJFfOqSNsotPzaSfOMSSyLgS7SAqm48to0USTmzlsGnWjugAGOp1/6w== 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=7vbYg8U4+PLUWg4etzBHweh9bhfXR8gYwfoYA9G5HwI=; b=Cfgov7mcekEEnKf4ANvmO3sNywnLOH/589Oy9y00SkaVUGF9F8Mfz8cTjCxSvpzV4Pkf94WVi0NT3TZN5lzNSEKlooVdaAcBL4zd1xQrRLA5ba/MomR3uOlOogeE95PSmut8bcJDIybh0f8/P3lPII3BznnPMJ7uCSfWs6+VGg0= Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by BN9PR11MB5290.namprd11.prod.outlook.com (2603:10b6:408:137::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.24; Mon, 5 Jul 2021 06:35:11 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::8807:6661:e425:102]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::8807:6661:e425:102%7]) with mapi id 15.20.4287.033; Mon, 5 Jul 2021 06:35:11 +0000 From: "Wang, Haiyue" To: David Marchand , "dev@dpdk.org" CC: Igor Russkikh , Aaron Conole , Michael Santana , "Richardson, Bruce" , Rasesh Mody , Shahed Shaikh , "Yang, Qiming" , "Zhang, Qi Z" , Heinrich Kuhn , "Devendra Singh Rawat" , Ray Kinsella , "Neil Horman" , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , "Kadam, Pallavi" Thread-Topic: [dpdk-dev] [PATCH v3 2/2] eal: handle compressed firmwares Thread-Index: AQHXbL3RKn320QbtAkSEENioEUd0H6sz7cEA Date: Mon, 5 Jul 2021 06:35:10 +0000 Message-ID: References: <20210602095836.24901-1-david.marchand@redhat.com> <20210629080632.30964-1-david.marchand@redhat.com> <20210629080632.30964-3-david.marchand@redhat.com> In-Reply-To: <20210629080632.30964-3-david.marchand@redhat.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.0.76 authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 502f10a4-035c-45d6-2b84-08d93f7f09f4 x-ms-traffictypediagnostic: BN9PR11MB5290: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kr491WptckwkZc07fZefp4Izz1adgafrrB9b969EdHYk7PFiuTMnwNqJdSvaRUr3KgUucmpL1GHrZkOhj3t+GO3mnYF5XY9xTV4AzU8Xe6aE22RY8caqyUdUsMrxKYobEi6xBH+nbQ1ZGebRBsO1IhEUXAPG7v2rEZ64QfdnOkhSEOwSuzKeOAjLCVZxMk/a61SsgJBNnfuPjGf0wQUN/G3yZiai37Cl5vbskrkWl/oDAufFIzy3+/QucUrbKrZyAgcjH7s601qfqhtkqrPPp/vWWPyVbKOBUKa5iAx0wEHc8DvQRZOo6LPdxtyiZOb/s1qNuMYAyOx2KUx/gcQJ6yqsDigYP61QmF5e5+64yGUQLXWsRlPYrgqJ/DrarSXh5EyKdqUNi/1i0MgLvnkyHq9iqmkfKoXe+E9jrQs0LbOPM4HMgp/TXEb5pqH3EZUWolJw0rreaVWoD6L6v6O4x/ul0Hu4HBAZFs+pyRFDmzj1Ht6l97bMTwTguRcPN36/9ENEyZz8NsruK6Mq8VU+CtAkd51mUj8UIddL4g2LL/lzIM3VIudTxSZYJM5OAhoeYRLYoJ+zY36YaRodvVVimDsQiUpCf2VBuGFcv8Br6SGkDekgm4vUxtCoFi7RWP/oONrTFbGO5xzoY8cR3LWtzA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(39860400002)(346002)(376002)(396003)(107886003)(76116006)(316002)(66946007)(110136005)(54906003)(86362001)(122000001)(4326008)(66556008)(66476007)(64756008)(71200400001)(38100700002)(83380400001)(26005)(2906002)(55016002)(7696005)(5660300002)(9686003)(8676002)(478600001)(66446008)(52536014)(7416002)(53546011)(8936002)(6506007)(186003)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PrlwFPpBu8VvGZYLFTyr/DvZSo0Zn3b5c6hv3JTTD3MUjTLilWVkWZM002jY?= =?us-ascii?Q?GeL8K9aZZeugFNe67VRhHom/5fh50QJpA8d2Fh1yGQ6U6qcoumHyRYK0gjUf?= =?us-ascii?Q?WsQMCQH/nN9NYdI4mMsCm8rmfSEo+iKZeI+CQpONoP+RrxpO5L4QqzBTmO5M?= =?us-ascii?Q?IDSWLnT9CUO78/OPGVqpoPthsYRQ5WbRib3U+6+05a7Fwm5db8M+LzDXTQQy?= =?us-ascii?Q?Tf+YN/J6+dq9kFf9ozv88njt+I20GsarV3Qwtb3M0uqko9JT1Q7R1KHPj0Hd?= =?us-ascii?Q?TRwFIb76EF4cV9wYtqUwhhOKJVJuhWx7gS8qvASiOFoOqJhrXqOhE4m83Rfi?= =?us-ascii?Q?X8T1XLwyt5UCdav4wwoQK2RKGPeADOHYdMkteVeRfkDKRLjUJCFyvU8ywi0x?= =?us-ascii?Q?mnt3QRNqRdI6Kd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/ieT/T?= =?us-ascii?Q?rDI=3D?= 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: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 502f10a4-035c-45d6-2b84-08d93f7f09f4 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2021 06:35:10.8619 (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: T1f5/fciRW35hhF4ydv6ZkBAHZ+I9TAzeEo/6Nd3xwBNJ4sb1JFjKLpxpX6/g2CrKXA+Yrs9FjBf5htmBdcyOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5290 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 2/2] eal: handle compressed firmwares 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 Sender: "dev" > -----Original Message----- > From: dev On Behalf Of David Marchand > Sent: Tuesday, June 29, 2021 16:07 > To: dev@dpdk.org > Cc: Igor Russkikh ; Aaron Conole ; Michael Santana > ; Richardson, Bruce ; Rasesh Mody > ; Shahed Shaikh ; Yang, Qiming <= qiming.yang@intel.com>; Zhang, > Qi Z ; Heinrich Kuhn ;= Devendra Singh Rawat > ; Ray Kinsella ; Neil Horman ; Dmitry > Kozlyuk ; Narcisa Ana Maria Vasile ; Dmitry > Malloy ; Kadam, Pallavi > Subject: [dpdk-dev] [PATCH v3 2/2] eal: handle compressed firmwares >=20 > Introduce an internal firmware loading helper to remove code duplication > in our drivers and handle xz compressed firmwares by calling libarchive. >=20 > This helper tries to look for .xz suffixes so that drivers are not aware > the firmwares have been compressed. >=20 > libarchive is set as an optional dependency: without libarchive, a > runtime warning is emitted so that users know there is a compressed > firmware. >=20 > Windows implementation is left as an empty stub. >=20 > Signed-off-by: David Marchand > Reviewed-by: Igor Russkikh > --- > Changes since v2: > - added a comment on libarchive link dependency, >=20 > Changes since v1: > - used pkg-config for libarchive detection, > - updated doxygen annotations, > - added internal helpers in eal_firmware.c to enhance readability, > - dropped whitespace damage in version.map, >=20 > --- > .github/workflows/build.yml | 1 + > .travis.yml | 1 + > config/meson.build | 10 +++ > drivers/net/bnx2x/bnx2x.c | 35 +++----- > drivers/net/ice/ice_ethdev.c | 60 +++---------- > drivers/net/nfp/nfp_net.c | 57 +++---------- > drivers/net/qede/qede_main.c | 45 ++++------ > lib/eal/include/rte_firmware.h | 32 +++++++ > lib/eal/unix/eal_firmware.c | 149 +++++++++++++++++++++++++++++++++ > lib/eal/unix/meson.build | 1 + > lib/eal/version.map | 1 + > lib/eal/windows/eal.c | 9 ++ > 12 files changed, 259 insertions(+), 142 deletions(-) > create mode 100644 lib/eal/include/rte_firmware.h > create mode 100644 lib/eal/unix/eal_firmware.c >=20 > +int > +rte_firmware_read(const char *name, void **buf, size_t *bufsz) > +{ > + char path[PATH_MAX]; > + int ret; > + > + ret =3D firmware_read(name, buf, bufsz); > + if (ret < 0) { > + snprintf(path, sizeof(path), "%s.xz", name); > + path[PATH_MAX - 1] =3D '\0'; > +#ifndef RTE_HAS_LIBARCHIVE > + if (access(path, F_OK) =3D=3D 0) { > + RTE_LOG(WARNING, EAL, "libarchive not available, %s cannot be decompr= essed\n", > + path); > + } > +#else > + ret =3D firmware_read(path, buf, bufsz); > +#endif > + } > + return ret; > +} Since ice PMD needs to check if the firmware file with different name can b= e accessed by some kind of order, before doing the final firmware selection. Should we= also add the firmware access API for handling this ? bool rte_firmware_access(const char *name) { char path[PATH_MAX]; if (access(name, F_OK) =3D=3D 0) return true; snprintf(path, sizeof(path), "%s.xz", name); path[PATH_MAX - 1] =3D '\0'; if (access(path, F_OK) =3D=3D 0) return true; return false; } > -- > 2.23.0