app/testpmd: update DDP add command parameters
[dpdk.git] / app / test-pmd / config.c
index aa35505..593677e 100644 (file)
@@ -3309,6 +3309,27 @@ open_ddp_package_file(const char *file_path, uint32_t *size)
        return buf;
 }
 
+int
+save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size)
+{
+       FILE *fh = fopen(file_path, "wb");
+
+       if (fh == NULL) {
+               printf("%s: Failed to open %s\n", __func__, file_path);
+               return -1;
+       }
+
+       if (fwrite(buf, 1, size, fh) != size) {
+               fclose(fh);
+               printf("%s: File write operation failed\n", __func__);
+               return -1;
+       }
+
+       fclose(fh);
+
+       return 0;
+}
+
 int
 close_ddp_package_file(uint8_t *buf)
 {