<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi David,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I get unix compilation failure when backporting this patch to 23.11 LTS, the EAL_LOG macro is not backported to 23.11 LTS, any suggestion?<br>
<br>
Regards,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Xueming</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" dir="ltr" style="color: inherit;"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> David Marchand <david.marchand@redhat.com><br>
<b>Sent:</b> Monday, May 13, 2024 7:12 PM<br>
<b>To:</b> dev@dpdk.org <dev@dpdk.org><br>
<b>Cc:</b> Yu Jiang <yux.jiang@intel.com>; Bruce Richardson <bruce.richardson@intel.com>; stable@dpdk.org <stable@dpdk.org><br>
<b>Subject:</b> [PATCH v2] eal/unix: support ZSTD compression for firmware</span>
<div> </div>
</div>
<div class="elementToProof" style="font-size: 11pt;">Ubuntu 24.04 started to compress firmware files with ZSTD compression.<br>
<br>
Bugzilla ID: 1437<br>
Cc: stable@dpdk.org<br>
<br>
Signed-off-by: David Marchand <david.marchand@redhat.com><br>
---<br>
Chances since v1:<br>
- fixed link issue when libarchive is not available,<br>
- Cc'd stable@dpdk.org,<br>
<br>
---<br>
lib/eal/unix/eal_firmware.c | 24 ++++++++++++++++++------<br>
1 file changed, 18 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/lib/eal/unix/eal_firmware.c b/lib/eal/unix/eal_firmware.c<br>
index 1d47e879c8..31de027598 100644<br>
--- a/lib/eal/unix/eal_firmware.c<br>
+++ b/lib/eal/unix/eal_firmware.c<br>
@@ -16,6 +16,8 @@<br>
#include "eal_firmware.h"<br>
#include "eal_private.h"<br>
<br>
+static const char * const compression_algorithms[] = { "xz", "zst" };<br>
+<br>
#ifdef RTE_HAS_LIBARCHIVE<br>
<br>
struct firmware_read_ctx {<br>
@@ -37,7 +39,11 @@ firmware_open(struct firmware_read_ctx *ctx, const char *name, size_t blocksize)<br>
<br>
err = archive_read_support_filter_xz(ctx->a);<br>
if (err != ARCHIVE_OK && err != ARCHIVE_WARN)<br>
- goto error;<br>
+ EAL_LOG(DEBUG, "could not initialise libarchive for xz compression");<br>
+<br>
+ err = archive_read_support_filter_zstd(ctx->a);<br>
+ if (err != ARCHIVE_OK && err != ARCHIVE_WARN)<br>
+ EAL_LOG(DEBUG, "could not initialise libarchive for zstd compression");<br>
<br>
if (archive_read_open_filename(ctx->a, name, blocksize) != ARCHIVE_OK)<br>
goto error;<br>
@@ -148,16 +154,22 @@ rte_firmware_read(const char *name, void **buf, size_t *bufsz)<br>
<br>
ret = firmware_read(name, buf, bufsz);<br>
if (ret < 0) {<br>
- snprintf(path, sizeof(path), "%s.xz", name);<br>
- path[PATH_MAX - 1] = '\0';<br>
+ unsigned int i;<br>
+<br>
+ for (i = 0; i < RTE_DIM(compression_algorithms); i++) {<br>
+ snprintf(path, sizeof(path), "%s.%s", name,<br>
+ compression_algorithms[i]);<br>
+ path[PATH_MAX - 1] = '\0';<br>
+ if (access(path, F_OK) != 0)<br>
+ continue;<br>
#ifndef RTE_HAS_LIBARCHIVE<br>
- if (access(path, F_OK) == 0) {<br>
EAL_LOG(WARNING, "libarchive not linked, %s cannot be decompressed",<br>
path);<br>
- }<br>
#else<br>
- ret = firmware_read(path, buf, bufsz);<br>
+ ret = firmware_read(path, buf, bufsz);<br>
#endif<br>
+ break;<br>
+ }<br>
}<br>
return ret;<br>
}<br>
--<br>
2.44.0<br>
<br>
</div>
</body>
</html>