Compare commits

..

1 Commits

Author SHA1 Message Date
Vladislav Dronov
b3c2a6f09e Update to qat-zstd-plugin 1.0.0 @ 1e8b930c
NUMA node aware mem allocations and other Code optimizations
Bug Fixes and Static analysis Fixes (OpenScanhub and Latest Coverity)
Support ZSTD v1.5.7 and README refactor
Spec file updates for RPM Packaging

[skip changelog]

Resolves: RHEL-72903

Signed-off-by: Vladislav Dronov <vdronov@redhat.com>
2026-01-27 17:53:11 +01:00
11 changed files with 103 additions and 131 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/qat-zstd-plugin-0.2.0.tar.gz
/qat-zstd-plugin-*.tar.gz

View File

@ -1 +0,0 @@
902e29b525f2bc950e6feed73a68cd9753912134 SOURCES/qat-zstd-plugin-0.2.0.tar.gz

View File

@ -1,46 +0,0 @@
--- a/src/Makefile 2024-10-09 18:14:19.453675299 +0300
+++ b/src/Makefile 2024-10-09 18:25:13.601675269 +0300
@@ -79,18 +79,27 @@
QATFLAGS += -O3
endif
+VERSION_MAJOR=0
+VERSION_MINOR=2
+VERSION_PATCH=0
+VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
+
qatseqprod.o: qatseqprod.c
$(CC) -c $(CFLAGS) $(QATFLAGS) $(DEBUGFLAGS) $^ -o $@
lib: qatseqprod.o
$(AR) rc libqatseqprod.a $^
- $(CC) -shared $^ $(LDFLAGS) -o libqatseqprod.so
+ $(CC) -shared $^ $(LDFLAGS) -Wl,-soname,libqatseqprod.so.$(VERSION_MAJOR) -o libqatseqprod.so.$(VERSION)
+ ln -sf libqatseqprod.so.$(VERSION) libqatseqprod.so.$(VERSION_MAJOR)
+ ln -sf libqatseqprod.so.$(VERSION_MAJOR) libqatseqprod.so
.PHONY: install
install: lib
[ -e $(DESTDIR)$(LIBDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
[ -e $(DESTDIR)$(INCLUDEDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
- $(INSTALL_PROGRAM) libqatseqprod.so $(DESTDIR)$(LIBDIR)
+ $(INSTALL_PROGRAM) libqatseqprod.so.$(VERSION) $(DESTDIR)$(LIBDIR)
+ ln -sf libqatseqprod.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libqatseqprod.so.$(VERSION_MAJOR)
+ ln -sf libqatseqprod.so.$(VERSION_MAJOR) $(DESTDIR)$(LIBDIR)/libqatseqprod.so
$(INSTALL_DATA) libqatseqprod.a $(DESTDIR)$(LIBDIR)
$(INSTALL_DATA) qatseqprod.h $(DESTDIR)$(INCLUDEDIR)
@echo qatseqprod library successfully installed
@@ -98,10 +107,12 @@
.PHONY: uninstall
uninstall:
$(RM) $(LIBDIR)/libqatseqprod.a
+ $(RM) $(LIBDIR)/libqatseqprod.so.$(VERSION)
+ $(RM) $(LIBDIR)/libqatseqprod.so.$(VERSION_MAJOR)
$(RM) $(LIBDIR)/libqatseqprod.so
$(RM) $(INCLUDEDIR)/qatseqprod.h
@echo qatseqprod library successfully uninstalled
clean:
$(RM) *.o
- $(RM) libqatseqprod.a libqatseqprod.so
+ $(RM) libqatseqprod.a libqatseqprod.so libqatseqprod.so.$(VERSION) libqatseqprod.so.$(VERSION_MAJOR)

View File

@ -1,48 +0,0 @@
--- a/test/Makefile
+++ b/test/Makefile
@@ -34,24 +34,12 @@
# #######################################################################
LIB = ../src
-LDFLAGS = $(LIB)/libqatseqprod.a -I$(LIB)
+LDFLAGS = -L$(LIB) -I$(LIB)
ifneq ($(ICP_ROOT), )
LDFLAGS += -lqat_s -lusdm_drv_s -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build
else
- LDFLAGS += -lqat -lusdm
-endif
-
-ifdef ZSTDLIB
-LDFLAGS += $(ZSTDLIB)/libzstd.a
-else
-ZSTDLIB := $(shell find /usr /lib /local -name 'libzstd.a' 2>/dev/null | head -n 1)
-ZSTDLIB ?= /usr/local/lib/libzstd.a
-ifneq ("$(wildcard $(ZSTDLIB))","")
- LDFLAGS += $(ZSTDLIB)
-else
- $(error libzstd.a not found, please install libzstd or specify the path manually)
-endif
+ LDFLAGS += -lzstd -lqatseqprod -lqat -lusdm
endif
default: test benchmark
--- a/test/test.c
+++ b/test/test.c
@@ -44,9 +44,6 @@
#include "qatseqprod.h"
-#ifndef ZSTD_STATIC_LINKING_ONLY
-#define ZSTD_STATIC_LINKING_ONLY
-#endif
#include "zstd.h"
#include "zstd_errors.h"
@@ -143,4 +140,4 @@
free(dstBuffer);
free(decompBuffer);
return 0;
-}
\ No newline at end of file
+}

View File

@ -1,15 +1,7 @@
## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 3;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
# SPDX-License-Identifier: MIT
Name: qat-zstd-plugin
Version: 0.2.0
Version: 1.0.0
Release: %autorelease
Summary: Intel QuickAssist Technology ZSTD Plugin
@ -17,14 +9,14 @@ License: BSD-3-Clause
URL: https://github.com/intel/QAT-ZSTD-Plugin
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: lib-version.patch
Patch1: test.patch
Patch2: rh-makefile.patch
Patch0: test.patch
Patch1: rh-makefile.patch
BuildRequires: automake
BuildRequires: gcc
BuildRequires: libzstd-devel
BuildRequires: qatlib-devel
BuildRequires: numactl-devel
# Upstream only supports x86_64
ExclusiveArch: x86_64
@ -69,7 +61,7 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./test/test README.md
%files
%license LICENSE
%{_libdir}/libqatseqprod.so.0
%{_libdir}/libqatseqprod.so.1
%{_libdir}/libqatseqprod.so.%{version}
%files devel
@ -81,7 +73,4 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./test/test README.md
%{_libdir}/libqatseqprod.a
%changelog
## START: Generated by rpmautospec
* Tue Oct 29 2024 Vladis Dronov <vdronov@redhat.com> - 0.2.0-1
- Initial commit on c9s (RHEL-46072)
## END: Generated by rpmautospec
%autochangelog

View File

@ -1,16 +1,20 @@
--- a/src/Makefile 2024-10-30 22:20:03.296178391 +0100
+++ b/src/Makefile 2024-10-30 22:21:43.915301707 +0100
@@ -52,11 +52,11 @@ ifneq ($(ICP_ROOT), )
@@ -53,7 +53,7 @@ ifneq ($(ICP_ROOT), )
-I$(ICP_ROOT)/quickassist/include/dc \
-I$(ICP_ROOT)/quickassist/lookaside/access_layer/include \
-I$(ICP_ROOT)/quickassist/utilities/libusdm_drv
- LDFLAGS = -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build -lqat_s \
+ LDFLAGS += -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build -lqat_s \
-lusdm_drv_s
-lusdm_drv_s -lnuma
else
QATFLAGS = -DINTREE
- LDFLAGS = -lqat -lusdm
+ LDFLAGS += -lqat -lusdm
# In-tree - look for headers in standard locations
@@ -63,7 +63,7 @@ else
else
$(error QAT headers not found in Standard path, Please install QATLib development package or set ICP_ROOT for out-of-tree driver)
endif
- LDFLAGS = -lqat -lusdm -lnuma
+ LDFLAGS += -lqat -lusdm -lnuma
endif
ifdef ZSTDLIB
@ -24,15 +28,4 @@
+LDFLAGS += -L$(LIB) -I$(LIB)
ifneq ($(ICP_ROOT), )
LDFLAGS += -lqat_s -lusdm_drv_s -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build
--- a/src/Makefile 2024-10-30 22:20:03.296178391 +0100
+++ b/src/Makefile 2024-10-30 22:21:43.915301707 +0100
@@ -76,7 +76,7 @@ DEBUGFLAGS += -DDEBUGLEVEL=$(DEBUGLEVEL)
ifneq ($(DEBUGLEVEL), 0)
QATFLAGS += -g -O0
else
- QATFLAGS += -O3
+ QATFLAGS += -g -O2
endif
VERSION_MAJOR=0
LDFLAGS += -lqat_s -lusdm_drv_s -lnuma -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (qat-zstd-plugin-1.0.0.tar.gz) = 6ee92f0631d4b66f250db7b55a84f2c6fe37ca70d72ad30c6d7559034ac74f24511963ebd877dfd323e9f66bccf3f311ba215167cb60338f4181cf060fb81286

62
test.patch Normal file
View File

@ -0,0 +1,62 @@
--- a/test/Makefile
+++ b/test/Makefile
@@ -34,42 +34,27 @@
# #######################################################################
LIB = ../src
-LDFLAGS = $(LIB)/libqatseqprod.a -I$(LIB)
+LDFLAGS = -L$(LIB) -I$(LIB)
ifneq ($(ICP_ROOT), )
LDFLAGS += -lqat_s -lusdm_drv_s -lnuma -Wl,-rpath,$(ICP_ROOT)/build -L$(ICP_ROOT)/build
else
- LDFLAGS += -lqat -lusdm -lnuma
-endif
-
-ifdef ZSTDLIB
-CFLAGS += -I$(ZSTDLIB)
-LDFLAGS += $(ZSTDLIB)/libzstd.a
-else
-ZSTDLIB := $(shell find /usr /lib /local -name 'libzstd.a' 2>/dev/null | head -n 1| xargs dirname)
-LDFLAGS += $(ZSTDLIB)/libzstd.a
+ LDFLAGS += -lzstd -lqatseqprod -lqat -lusdm
endif
default: test benchmark
all: test benchmark
-check_zstdlib:
- @echo checking zstd static libaray '$(ZSTDLIB)/libzstd.a'
- @if [ ! -e $(ZSTDLIB)/libzstd.a ]; then \
- echo libzstd.a is not found, please install libzstd or specify the path manually; \
- exit 1; \
- fi
-
-test: test.c check_zstdlib
+test: test.c
$(Q)$(MAKE) -C $(LIB)
$(CC) $< $(CFLAGS) $(LDFLAGS) -o $@
-benchmark: benchmark.c check_zstdlib
+benchmark: benchmark.c
$(Q)$(MAKE) -C $(LIB)
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@ -lpthread
clean:
$(Q)$(MAKE) -C $(LIB) $@
$(RM) test benchmark
-.PHONY: clean check_zstdlib
+.PHONY: clean
--- a/test/test.c
+++ b/test/test.c
@@ -44,9 +44,6 @@
#include "qatseqprod.h"
-#ifndef ZSTD_STATIC_LINKING_ONLY
-#define ZSTD_STATIC_LINKING_ONLY
-#endif
#include "zstd.h"
#include "zstd_errors.h"

7
tests/README Normal file
View File

@ -0,0 +1,7 @@
A test should be configured as BaseOS CI test (not an OSCI one), as it require
an x86_64 machine with QAT_4XXX (or later) hardware, so it should be run in Beaker.
see: https://one.redhat.com/rhel-development-guide/#proc_enable-gating_assembly_enabling-gating
and: https://docs.engineering.redhat.com/display/RTT/Onboarding+gating+tests
and: https://docs.engineering.redhat.com/pages/viewpage.action?pageId=53110084
and: https://docs.engineering.redhat.com/display/RTT/Creating+and+Updating+beaker+test

5
tests/nulltest.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# There is a test binary and %check rpm target for testing
echo QAT-ZSTD-Plugin nulltest is PASS
exit 0

10
tests/tests.yml Normal file
View File

@ -0,0 +1,10 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
tests:
- nulltest:
dir: .
run: nulltest.sh