diff --git a/1001-update-requirements-of-qat-and-udma.patch b/1001-update-requirements-of-qat-and-udma.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f394c08c12556ad879520e7919704bca9588b55 --- /dev/null +++ b/1001-update-requirements-of-qat-and-udma.patch @@ -0,0 +1,76 @@ +From 3ad384b91e039d7238edd16f89d74f607446f4b6 Mon Sep 17 00:00:00 2001 +Message-Id: <3ad384b91e039d7238edd16f89d74f607446f4b6.1694771883.git.llfl@linux.alibaba.com> +From: "Kun(llfl)" +Date: Wed, 10 May 2023 16:28:10 +0800 +Subject: [PATCH 1001/1005] update requirements of qat and udma + +Signed-off-by: Kun(llfl) +--- + configure.ac | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 571184f..9159727 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -143,7 +143,6 @@ AS_IF([test ! -z "${ICP_ROOT}"], + -I${ICP_ROOT}/quickassist/include/dc/ \ + -I${ICP_ROOT}/quickassist/utilities/libusdm_drv/ \ + -I${ICP_ROOT}/quickassist/lookaside/access_layer/include/ " +- LDFLAGS+=" -Wl,-rpath,${ICP_ROOT}/build/ -L${ICP_ROOT}/build/ " + ] + ) + AC_SUBST(ICP_INCLUDE_CFLAGS) +@@ -159,7 +158,7 @@ AS_IF([test ! -z "${ICP_ROOT}"], + [ADF_CFLAGS="-DADF_PCI_API" + AC_SUBST(ADF_CFLAGS)], + [ +- AC_CHECK_LIB(qat_s, icp_sal_userIsQatAvailable, ++ AC_CHECK_LIB(qat, icp_sal_userIsQatAvailable, + [SAL_CFLAGS="-DSAL_DEV_API" + AC_SUBST(SAL_CFLAGS)], + [AC_MSG_ERROR([icp_sal_userIsQatAvailable/icp_adf_get_numDevices not found])] +@@ -168,7 +167,7 @@ AS_IF([test ! -z "${ICP_ROOT}"], + ) + + #check for usdm lib +- AC_CHECK_LIB(usdm_drv_s, qaeMemAllocNUMA, , ++ AC_CHECK_LIB(udma, qaeMemAllocNUMA, , + [AC_MSG_ERROR([qaeMemAllocNUMA not found])]) + ], + [ +@@ -186,12 +185,12 @@ AS_IF([test ! -z "${ICP_ROOT}"], + ] + ) + +- AC_CHECK_LIB(qat, cpaDcCompressData2, , ++ AC_CHECK_LIB(qat_s, cpaDcCompressData2, , + [ AC_MSG_ERROR([cpaDcCompressData2 not found])], +- [-lusdm -lcrypto]) ++ [-ludma -lcrypto]) + + #check for icp_adf_get_numDevices/icp_sal_userIsQatAvailable +- AC_CHECK_LIB(qat, icp_adf_get_numDevices, ++ AC_CHECK_LIB(qat_s, icp_adf_get_numDevices, + [ADF_CFLAGS="-DADF_PCI_API" + AC_SUBST(ADF_CFLAGS)], + [ +@@ -199,13 +198,13 @@ AS_IF([test ! -z "${ICP_ROOT}"], + [SAL_CFLAGS="-DSAL_DEV_API" + AC_SUBST(SAL_CFLAGS)], + [AC_MSG_ERROR([icp_sal_userIsQatAvailable/icp_adf_get_numDevices not found])], +- [-lusdm -lcrypto] ++ [-ludma -lcrypto] + ) + ] + ) + + #check for usdm lib +- AC_CHECK_LIB(usdm, qaeMemAllocNUMA,, ++ AC_CHECK_LIB(udma, qaeMemAllocNUMA,, + [AC_MSG_ERROR([qaeMemAllocNUMA not found])]) + ]) + +-- +2.39.0 + diff --git a/1002-QATZIP-change-configure.patch b/1002-QATZIP-change-configure.patch new file mode 100644 index 0000000000000000000000000000000000000000..39fc824408501ecd85ef685bc7befb4b3e04c5ed --- /dev/null +++ b/1002-QATZIP-change-configure.patch @@ -0,0 +1,34 @@ +From c2f1c8f6334d15acaa458bd5a2951cd5e2a0e628 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +References: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +From: Xingrui Yi +Date: Mon, 17 Jul 2023 10:54:35 +0800 +Subject: [PATCH 1002/1005] QATZIP: change configure + +change configure for envoy build + +Signed-off-by: Xingrui Yi +--- + configure.ac | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index eb7b78e..cd1a466 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -178,11 +178,6 @@ AS_IF([test ! -z "${ICP_ROOT}"], + [qat/cpa.h qat/cpa_dc.h qat/qae_mem.h qat/icp_sal_poll.h qat/icp_sal_user.h], + [ + AC_DEFINE([HAVE_QAT_HEADERS], [], [QAT header files in include/qat subdirectory]) +- ], +- [AC_MSG_ERROR([qat header files not found])], +- [#ifdef HAVE_QAT_CPA_H +- # include +- #endif + ] + ) + +-- +2.39.0 + diff --git a/1003-qaeMemAllocNUMA-change-to-4096-align.patch b/1003-qaeMemAllocNUMA-change-to-4096-align.patch new file mode 100644 index 0000000000000000000000000000000000000000..8f1ad60ae86477c17f65f0e526b3ed05e0eac400 --- /dev/null +++ b/1003-qaeMemAllocNUMA-change-to-4096-align.patch @@ -0,0 +1,31 @@ +From 66f0134a3ba9bcb830447d39da7a76ce4d2bb53c Mon Sep 17 00:00:00 2001 +Message-Id: <66f0134a3ba9bcb830447d39da7a76ce4d2bb53c.1694057114.git.llfl@linux.alibaba.com> +In-Reply-To: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +References: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +From: Xingrui Yi +Date: Fri, 25 Aug 2023 12:08:58 +0800 +Subject: [PATCH 1003/1005] qaeMemAllocNUMA: change to 4096 align + +change 64 to 4096 + +Signed-off-by: Xingrui Yi +--- + src/qatzip_mem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qatzip_mem.c b/src/qatzip_mem.c +index 61a36fe..c889088 100755 +--- a/src/qatzip_mem.c ++++ b/src/qatzip_mem.c +@@ -193,7 +193,7 @@ void *qzMalloc(size_t sz, int numa, int pinned) + } + } + +- g_a = qaeMemAllocNUMA(sz, numa, 64); ++ g_a = qaeMemAllocNUMA(sz, numa, 4096); + if (NULL == g_a) { + if (0 == pinned) { + QZ_DEBUG("regular malloc\n"); +-- +2.39.0 + diff --git a/1004-qzmem-remove-use-udma-instead.patch b/1004-qzmem-remove-use-udma-instead.patch new file mode 100644 index 0000000000000000000000000000000000000000..d75f76c72f0d530daf7511d2f8c54159ffa3f91e --- /dev/null +++ b/1004-qzmem-remove-use-udma-instead.patch @@ -0,0 +1,244 @@ +From ceb5922111985bc43868035be5ac82626d50d078 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +References: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +From: Xingrui Yi +Date: Fri, 25 Aug 2023 16:16:12 +0800 +Subject: [PATCH 1004/1005] qzmem remove use udma instead + +Signed-off-by: Xingrui Yi +--- + src/qatzip_mem.c | 109 ++++++++++++++++++++++++++++++----------------- + 1 file changed, 69 insertions(+), 40 deletions(-) + +diff --git a/src/qatzip_mem.c b/src/qatzip_mem.c +index c889088..f8ce1dc 100755 +--- a/src/qatzip_mem.c ++++ b/src/qatzip_mem.c +@@ -52,13 +52,12 @@ + #include "qatzip_internal.h" + #include "qatzip_page_table.h" + +- + #define __STDC_WANT_LIB_EXT1__ 1 + #include + + static QzPageTable_T g_qz_page_table = {{{0}}}; +-static pthread_mutex_t g_qz_table_lock = PTHREAD_MUTEX_INITIALIZER; +-static atomic_int g_table_init = 0; ++// static pthread_mutex_t g_qz_table_lock = PTHREAD_MUTEX_INITIALIZER; ++// static atomic_int g_table_init = 0; + static __thread unsigned char *g_a; + extern processData_T g_process; + +@@ -68,7 +67,8 @@ void *doUserMemset(void *const ptr, unsigned char filler, + unsigned int lim = 0; + volatile unsigned char *volatile dstPtr = ptr; + +- while (lim < count) { ++ while (lim < count) ++ { + dstPtr[lim++] = filler; + } + return (void *)dstPtr; +@@ -80,20 +80,22 @@ void *doUserMemset(void *const ptr, unsigned char filler, + * */ + void *qzMemSet(void *ptr, unsigned char filler, unsigned int count) + { +- if (ptr == NULL) { ++ if (ptr == NULL) ++ { + QZ_ERROR("Invaild input memory pointer!"); + return NULL; + } + #ifdef __STDC_LIB_EXT1__ + errno_t result = memset_s( +- ptr, sizeof(ptr), filler, count) /* Supported on C11 standard */ +- if (result != 0) { ++ ptr, sizeof(ptr), filler, count) /* Supported on C11 standard */ ++ if (result != 0) ++ { + QZ_ERROR("memset failed by the reason of %d", result); + } + return ptr; + #else + return doUserMemset( +- ptr, filler, count); /* Platform-independent secure memset */ ++ ptr, filler, count); /* Platform-independent secure memset */ + #endif /* __STDC_LIB_EXT1__ */ + } + +@@ -105,13 +107,16 @@ int qzMemFindAddr(unsigned char *a) + b = (al & PAGE_MASK); + + rc = (PINNED == loadAddr(&g_qz_page_table, +- (void *)b)) ? PINNED_MEM : COMMON_MEM; +- if (0 != rc) { ++ (void *)b)) ++ ? PINNED_MEM ++ : COMMON_MEM; ++ if (0 != rc) ++ { + QZ_DEBUG("Find 0x%lx in page table\n", b); + } + return rc; + } +- ++/* + static void qzMemUnRegAddr(unsigned char *a) + { + return; +@@ -122,13 +127,14 @@ static int qzMemRegAddr(unsigned char *a, size_t sz) + int rc; + unsigned long al, b; + +- if (0 != pthread_mutex_lock(&g_qz_table_lock)) { ++ if (0 != pthread_mutex_lock(&g_qz_table_lock)) ++ { + return -1; + } + +- /*addr already registered*/ + if ((1 == qzMemFindAddr(a)) && +- (1 == qzMemFindAddr(a + sz - 1))) { ++ (1 == qzMemFindAddr(a + sz - 1))) ++ { + pthread_mutex_unlock(&g_qz_table_lock); + return 0; + } +@@ -145,23 +151,29 @@ static int qzMemRegAddr(unsigned char *a, size_t sz) + + return rc; + } +- ++*/ + void qzMemDestory(void) + { +- if (0 == g_table_init) { ++ /* ++ if (0 == g_table_init) ++ { + return; + } + +- if (0 != pthread_mutex_lock(&g_qz_table_lock)) { ++ if (0 != pthread_mutex_lock(&g_qz_table_lock)) ++ { + return; + } + + freePageTable(&g_qz_page_table); + g_table_init = 0; + +- if (0 != pthread_mutex_unlock(&g_qz_table_lock)) { ++ if (0 != pthread_mutex_unlock(&g_qz_table_lock)) ++ { + return; + } ++ */ ++ return; + } + + void *qzMalloc(size_t sz, int numa, int pinned) +@@ -169,59 +181,76 @@ void *qzMalloc(size_t sz, int numa, int pinned) + int status; + QzSession_T temp_sess; + qzMemSet(&temp_sess, 0, sizeof(QzSession_T)); +- +- if (0 == g_table_init) { +- if (0 != pthread_mutex_lock(&g_qz_table_lock)) { +- return NULL; +- } +- ++ /* + if (0 == g_table_init) { +- qzMemSet(&g_qz_page_table, 0, sizeof(QzPageTable_T)); +- g_table_init = 1; +- } ++ if (0 != pthread_mutex_lock(&g_qz_table_lock)) { ++ return NULL; ++ } + +- if (0 != pthread_mutex_unlock(&g_qz_table_lock)) { +- return NULL; +- } +- } ++ if (0 == g_table_init) { ++ qzMemSet(&g_qz_page_table, 0, sizeof(QzPageTable_T)); ++ g_table_init = 1; ++ } + +- if (1 == pinned && QZ_NONE == g_process.qz_init_status) { ++ if (0 != pthread_mutex_unlock(&g_qz_table_lock)) { ++ return NULL; ++ } ++ } ++ */ ++ if (1 == pinned && QZ_NONE == g_process.qz_init_status) ++ { + status = qzInit(&temp_sess, 1); +- if (QZ_INIT_FAIL(status)) { ++ if (QZ_INIT_FAIL(status)) ++ { + QZ_ERROR("QAT init failed with error: %d\n", status); + return NULL; + } + } + + g_a = qaeMemAllocNUMA(sz, numa, 4096); +- if (NULL == g_a) { +- if (0 == pinned) { ++ /* ++ if (NULL == g_a) ++ { ++ if (0 == pinned) ++ { + QZ_DEBUG("regular malloc\n"); + g_a = malloc(sz); + } +- } else { +- if (0 != qzMemRegAddr(g_a, sz)) { ++ } ++ ++ else ++ { ++ if (0 != qzMemRegAddr(g_a, sz)) ++ { + qaeMemFreeNUMA((void **)&g_a); + return NULL; + } + } ++ */ + + return g_a; + } + + void qzFree(void *m) + { +- if (NULL == m) { ++ if (NULL == m) ++ { + return; + } + + QZ_DEBUG("\t\tfreeing 0x%lx\n", (unsigned long)m); +- if (1 == qzMemFindAddr(m)) { ++ qaeMemFreeNUMA((void **)&m); ++ /* ++ if (1 == qzMemFindAddr(m)) ++ { + qaeMemFreeNUMA((void **)&m); + qzMemUnRegAddr(m); +- } else { ++ } ++ else ++ { + free(m); + } ++ */ + + m = NULL; + } +-- +2.39.0 + diff --git a/1005-remove-g_strm_buff_list.patch b/1005-remove-g_strm_buff_list.patch new file mode 100644 index 0000000000000000000000000000000000000000..c507e8a3e603c8b4a932fbe6957030c409db4fd1 --- /dev/null +++ b/1005-remove-g_strm_buff_list.patch @@ -0,0 +1,437 @@ +From 4e2e093d3fce300aecfff7ba6d1cf83c9d59494c Mon Sep 17 00:00:00 2001 +Message-Id: <4e2e093d3fce300aecfff7ba6d1cf83c9d59494c.1694057114.git.llfl@linux.alibaba.com> +In-Reply-To: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +References: <973b63c405e887af4bde081e2ba9f50d55b57134.1694057114.git.llfl@linux.alibaba.com> +From: "Kun(llfl)" +Date: Sat, 2 Sep 2023 17:28:54 +0800 +Subject: [PATCH 1005/1005] remove g_strm_buff_list + +Signed-off-by: Kun(llfl) +--- + src/qatzip_stream.c | 397 +++++++++++++++++++++----------------------- + 1 file changed, 188 insertions(+), 209 deletions(-) + +diff --git a/src/qatzip_stream.c b/src/qatzip_stream.c +index 4d52987..f0a759f 100644 +--- a/src/qatzip_stream.c ++++ b/src/qatzip_stream.c +@@ -53,228 +53,207 @@ + #include + #include + +-#define STREAM_BUFF_LIST_SZ 8 +- +-typedef struct StreamBuffNode_S { +- void *buffer; +- size_t size; +- int pinned; +- struct StreamBuffNode_S *next; +- struct StreamBuffNode_S *prev; +-} StreamBuffNode_T; +- +-typedef struct StreamBuffNodeList_S { +- StreamBuffNode_T *head; +- StreamBuffNode_T *tail; +- unsigned int size; +- pthread_mutex_t mutex; +-} StreamBuffNodeList_T; +- +-StreamBuffNodeList_T g_strm_buff_list_free = { +- .head = NULL, +- .tail = NULL, +- .size = 0, +- .mutex = PTHREAD_MUTEX_INITIALIZER +-}; +- +-StreamBuffNodeList_T g_strm_buff_list_used = { +- .head = NULL, +- .tail = NULL, +- .size = 0, +- .mutex = PTHREAD_MUTEX_INITIALIZER +-}; +- +-static inline int addNodeToList(StreamBuffNode_T *node, +- StreamBuffNodeList_T *buff_list) +-{ +- buff_list->size += 1; +- node->next = NULL; +- if (NULL == buff_list->tail) { +- buff_list->head = node; +- node->prev = NULL; +- } else { +- node->prev = buff_list->tail; +- buff_list->tail->next = node; +- } +- buff_list->tail = node; +- +- return SUCCESS; +-} +- +-static inline int removeNodeFromList(StreamBuffNode_T *node, +- StreamBuffNodeList_T *buff_list) +-{ +- buff_list->size -= 1; +- if (NULL != node->prev) { +- node->prev->next = node->next; +- if (NULL != node->next) { +- node->next->prev = node->prev; +- } else { +- buff_list->tail = node->prev; +- } +- } else { +- if (NULL != node->next) { +- node->next->prev = NULL; +- buff_list->head = node->next; +- } else { +- buff_list->head = NULL; +- buff_list->tail = NULL; +- } +- } +- +- return SUCCESS; +-} ++// #define STREAM_BUFF_LIST_SZ 8 ++ ++// typedef struct StreamBuffNode_S { ++// void *buffer; ++// size_t size; ++// int pinned; ++// struct StreamBuffNode_S *next; ++// struct StreamBuffNode_S *prev; ++// } StreamBuffNode_T; ++ ++// typedef struct StreamBuffNodeList_S { ++// StreamBuffNode_T *head; ++// StreamBuffNode_T *tail; ++// unsigned int size; ++// pthread_mutex_t mutex; ++// } StreamBuffNodeList_T; ++ ++// StreamBuffNodeList_T g_strm_buff_list_free = { ++// .head = NULL, ++// .tail = NULL, ++// .size = 0, ++// .mutex = PTHREAD_MUTEX_INITIALIZER ++// }; ++ ++// StreamBuffNodeList_T g_strm_buff_list_used = { ++// .head = NULL, ++// .tail = NULL, ++// .size = 0, ++// .mutex = PTHREAD_MUTEX_INITIALIZER ++// }; ++ ++// static inline int addNodeToList(StreamBuffNode_T *node, ++// StreamBuffNodeList_T *buff_list) ++// { ++// buff_list->size += 1; ++// node->next = NULL; ++// if (NULL == buff_list->tail) { ++// buff_list->head = node; ++// node->prev = NULL; ++// } else { ++// node->prev = buff_list->tail; ++// buff_list->tail->next = node; ++// } ++// buff_list->tail = node; ++ ++// return SUCCESS; ++// } ++ ++// static inline int removeNodeFromList(StreamBuffNode_T *node, ++// StreamBuffNodeList_T *buff_list) ++// { ++// buff_list->size -= 1; ++// if (NULL != node->prev) { ++// node->prev->next = node->next; ++// if (NULL != node->next) { ++// node->next->prev = node->prev; ++// } else { ++// buff_list->tail = node->prev; ++// } ++// } else { ++// if (NULL != node->next) { ++// node->next->prev = NULL; ++// buff_list->head = node->next; ++// } else { ++// buff_list->head = NULL; ++// buff_list->tail = NULL; ++// } ++// } ++ ++// return SUCCESS; ++// } + + void streamBufferCleanup() + { +- StreamBuffNode_T *node; +- StreamBuffNode_T *next; +- +- if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_used.mutex))) { +- QZ_ERROR("Failed to get Mutex Lock.\n"); +- return; +- } +- +- node = g_strm_buff_list_used.head; +- while (node != NULL) { +- next = node->next; +- removeNodeFromList(node, &g_strm_buff_list_used); +- qzFree(node->buffer); +- free(node); +- node = next; +- } +- +- if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_used.mutex))) { +- QZ_ERROR("Failed to release Mutex Lock.\n"); +- return; +- } +- +- if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_free.mutex))) { +- QZ_ERROR("Failed to get Mutex Lock.\n"); +- return; +- } +- +- node = g_strm_buff_list_free.head; +- while (node != NULL) { +- next = node->next; +- removeNodeFromList(node, &g_strm_buff_list_free); +- qzFree(node->buffer); +- free(node); +- node = next; +- } +- +- if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { +- QZ_ERROR("Failed to release Mutex Lock.\n"); +- return; +- } ++ return; ++ // StreamBuffNode_T *node; ++ // StreamBuffNode_T *next; ++ ++ // if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_used.mutex))) { ++ // QZ_ERROR("Failed to get Mutex Lock.\n"); ++ // return; ++ // } ++ ++ // node = g_strm_buff_list_used.head; ++ // while (node != NULL) { ++ // next = node->next; ++ // removeNodeFromList(node, &g_strm_buff_list_used); ++ // qzFree(node->buffer); ++ // free(node); ++ // node = next; ++ // } ++ ++ // if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_used.mutex))) { ++ // QZ_ERROR("Failed to release Mutex Lock.\n"); ++ // return; ++ // } ++ ++ // if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_free.mutex))) { ++ // QZ_ERROR("Failed to get Mutex Lock.\n"); ++ // return; ++ // } ++ ++ // node = g_strm_buff_list_free.head; ++ // while (node != NULL) { ++ // next = node->next; ++ // removeNodeFromList(node, &g_strm_buff_list_free); ++ // qzFree(node->buffer); ++ // free(node); ++ // node = next; ++ // } ++ ++ // if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { ++ // QZ_ERROR("Failed to release Mutex Lock.\n"); ++ // return; ++ // } + } + +-static void *getNodeBuffFromFreeList(size_t sz, int pinned) +-{ +- assert(!pthread_mutex_lock(&g_strm_buff_list_free.mutex)); +- assert(!pthread_mutex_lock(&g_strm_buff_list_used.mutex)); +- +- void *retval = NULL; +- StreamBuffNode_T *node; +- +- for (node = g_strm_buff_list_free.head; node != NULL; node = node->next) { +- if (pinned == node->pinned && sz <= node->size) { +- if (!removeNodeFromList(node, &g_strm_buff_list_free)) { +- retval = NULL; +- goto done; +- } +- if (!addNodeToList(node, &g_strm_buff_list_used)) { +- retval = NULL; +- goto done; +- } +- +- retval = node->buffer; +- goto done; +- } +- } +- +-done: +- assert(!pthread_mutex_unlock(&g_strm_buff_list_used.mutex)); +- assert(!pthread_mutex_unlock(&g_strm_buff_list_free.mutex)); +- return retval; +-} +- +-static void allocSomeNodesForFreeList(size_t sz, int numa, int pinned) +-{ +- StreamBuffNode_T *node; +- int i; +- for (i = 0; i < STREAM_BUFF_LIST_SZ; ++i) { +- node = malloc(sizeof(StreamBuffNode_T)); +- if (NULL == node) { +- break; +- } +- +- node->buffer = qzMalloc(sz, numa, pinned); +- if (NULL == node->buffer) { +- free(node); +- break; +- } +- node->pinned = pinned; +- node->size = sz; +- +- if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_free.mutex))) { +- QZ_ERROR("Failed to get Mutex Lock.\n"); +- free(node); +- return; +- } +- +- if (!addNodeToList(node, &g_strm_buff_list_free)) { +- free(node); +- if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { +- QZ_ERROR("Failed to release Mutex Lock.\n"); +- return; +- } +- } +- +- if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { +- QZ_ERROR("Failed to release Mutex Lock.\n"); +- free(node); +- return; +- } +- } +-} ++// static void *getNodeBuffFromFreeList(size_t sz, int pinned) ++// { ++// assert(!pthread_mutex_lock(&g_strm_buff_list_free.mutex)); ++// assert(!pthread_mutex_lock(&g_strm_buff_list_used.mutex)); ++ ++// void *retval = NULL; ++// StreamBuffNode_T *node; ++ ++// for (node = g_strm_buff_list_free.head; node != NULL; node = node->next) { ++// if (pinned == node->pinned && sz <= node->size) { ++// if (!removeNodeFromList(node, &g_strm_buff_list_free)) { ++// retval = NULL; ++// goto done; ++// } ++// if (!addNodeToList(node, &g_strm_buff_list_used)) { ++// retval = NULL; ++// goto done; ++// } ++ ++// retval = node->buffer; ++// goto done; ++// } ++// } ++ ++// done: ++// assert(!pthread_mutex_unlock(&g_strm_buff_list_used.mutex)); ++// assert(!pthread_mutex_unlock(&g_strm_buff_list_free.mutex)); ++// return retval; ++// } ++ ++// static void allocSomeNodesForFreeList(size_t sz, int numa, int pinned) ++// { ++// StreamBuffNode_T *node; ++// int i; ++// for (i = 0; i < STREAM_BUFF_LIST_SZ; ++i) { ++// node = malloc(sizeof(StreamBuffNode_T)); ++// if (NULL == node) { ++// break; ++// } ++ ++// node->buffer = qzMalloc(sz, numa, pinned); ++// if (NULL == node->buffer) { ++// free(node); ++// break; ++// } ++// node->pinned = pinned; ++// node->size = sz; ++ ++// if (unlikely(0 != pthread_mutex_lock(&g_strm_buff_list_free.mutex))) { ++// QZ_ERROR("Failed to get Mutex Lock.\n"); ++// free(node); ++// return; ++// } ++ ++// if (!addNodeToList(node, &g_strm_buff_list_free)) { ++// free(node); ++// if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { ++// QZ_ERROR("Failed to release Mutex Lock.\n"); ++// return; ++// } ++// } ++ ++// if (unlikely(0 != pthread_mutex_unlock(&g_strm_buff_list_free.mutex))) { ++// QZ_ERROR("Failed to release Mutex Lock.\n"); ++// free(node); ++// return; ++// } ++// } ++// } + + static void *streamBufferAlloc(size_t sz, int numa, int pinned) + { +- StreamBuffNode_T *node = getNodeBuffFromFreeList(sz, pinned); +- if (NULL == node) { //try to add some nodes to free list +- allocSomeNodesForFreeList(sz, numa, pinned); +- node = getNodeBuffFromFreeList(sz, pinned); ++ void *buffer; ++ buffer = qzMalloc(sz, numa, pinned); ++ if (NULL == buffer) { ++ QZ_ERROR("Failed to alloc buffer.\n"); ++ return NULL; + } +- return node; ++ return buffer; + } + + static void streamBufferFree(void *addr) + { +- StreamBuffNode_T *node; +- +- assert(!pthread_mutex_lock(&g_strm_buff_list_free.mutex)); +- assert(!pthread_mutex_lock(&g_strm_buff_list_used.mutex)); +- for (node = g_strm_buff_list_used.head; node != NULL; node = node->next) { +- if (addr == node->buffer) { +- if (removeNodeFromList(node, &g_strm_buff_list_used) == FAILURE) { +- QZ_ERROR("Fail to remove Node for streamBufferFree"); +- goto done; +- } +- if (STREAM_BUFF_LIST_SZ <= g_strm_buff_list_free.size) { +- qzFree(node->buffer); +- free(node); +- } else { +- addNodeToList(node, &g_strm_buff_list_free); +- } +- addr = NULL; +- goto done; +- } +- } +- +-done: +- assert(!pthread_mutex_unlock(&g_strm_buff_list_used.mutex)); +- assert(!pthread_mutex_unlock(&g_strm_buff_list_free.mutex)); ++ qzFree(addr); + } + + int initStream(QzSession_T *sess, QzStream_T *strm) +-- +2.39.0 + diff --git a/qatzip.spec b/qatzip.spec index eb04ee483735936356aaceab31d3c9f5fd566ef2..194688767238ff5300f91f70623d3cfaed560dc4 100644 --- a/qatzip.spec +++ b/qatzip.spec @@ -4,31 +4,43 @@ %global libqatzip_soversion 3 Name: qatzip -Version: 1.0.9 +Version: 1.1.2 Release: %{anolis_release}%{?dist} Summary: Intel QuickAssist Technology (QAT) QATzip Library License: BSD URL: https://github.com/intel/%{githubname} Source0: https://github.com/intel/%{githubname}/archive/v%{version}.tar.gz -BuildRequires: gcc >= 4.8.5 -BuildRequires: zlib-devel >= 1.2.7 -BuildRequires: qatlib-devel >= 22.07.0 -BuildRequires: autoconf automake libtool make lz4-devel +Patch1000: 1001-update-requirements-of-qat-and-udma.patch +Patch1001: 1002-QATZIP-change-configure.patch +Patch1002: 1003-qaeMemAllocNUMA-change-to-4096-align.patch +Patch1003: 1004-qzmem-remove-use-udma-instead.patch +Patch1004: 1005-remove-g_strm_buff_list.patch + +BuildRequires: gcc >= 4.8.5 autoconf automake libtool make openssl-devel +BuildRequires: zlib-devel >= 1.2.7 lz4-devel udma-devel intel-QAT20-devel + # The purpose of the package is to support hardware that only exists on x86_64 platforms -# https://bugzilla.redhat.com/show_bug.cgi?id=1987280 ExclusiveArch: x86_64 %description -QATzip is a user space library which builds on top of the Intel -QuickAssist Technology user space library, to provide extended -accelerated compression and decompression services by offloading the -actual compression and decompression request(s) to the Intel Chipset -Series. QATzip produces data using the standard gzip* format -(RFC1952) with extended headers. The data can be decompressed with a -compliant gzip* implementation. QATzip is designed to take full -advantage of the performance provided by Intel QuickAssist -Technology. +Intel QATzip is a software library designed to provide hardware-assisted +compression and decompression acceleration for data processing applications. +It works in conjunction with Intel QuickAssist Technology (QAT) hardware, +which is a specialized hardware accelerator for cryptographic and compression +workloads. QATzip supports a variety of compression algorithms, including GZIP, +DEFLATE, and LZ77. These algorithms can be used to reduce the size of data, +improve network and storage efficiency, and increase data transfer rates. +The library provides an API that enables developers to integrate the compression +and decompression features into their applications easily. QATzip is often used +in cloud computing, big data, and network applications that require fast data +processing, low latency, and efficient data transfer. For example, it can be used +to compress data before sending it over a network, reducing the bandwidth required +and improving the response time. It can also be used to compress data before storing +it, reducing the storage requirements and improving the retrieval time. In summary, +Intel QATzip is a powerful software library that provides hardware-accelerated +compression and decompression capabilities to improve the performance, efficiency, +and throughput of data processing applications. %package libs Summary: Libraries for the qatzip package @@ -37,6 +49,14 @@ Summary: Libraries for the qatzip package This package contains libraries for applications to use the QATzip APIs. +%package static +Summary: Provides the static lib for the qatzip package +Requires: %{name} = %{version}-%{release} + +%description static +This package contains libraries for applications to use +the QATzip APIs. + %package devel Summary: Development components for the libqatzip package Requires: %{name}-libs = %{version}-%{release} @@ -59,24 +79,17 @@ The %{name}-doc package contains documentation files for %{name}. %build %set_build_flags -autoreconf -vif -./configure \ - --bindir=%{_bindir} \ - --libdir=%{_libdir} \ - --includedir=%{_includedir} \ - --mandir=%{_mandir} \ - --prefix=%{_prefix} \ +autoreconf -ivf +export ICP_ROOT=%{_includedir}/qat +%configure \ --enable-symbol %make_build %install %make_install -rm %{buildroot}/%{_libdir}/libqatzip.a -rm %{buildroot}/%{_libdir}/libqatzip.la rm -vf %{buildroot}%{_mandir}/*.pdf -# Check section is not available for these functional and performance tests require special hardware. %files %license LICENSE* @@ -87,14 +100,28 @@ rm -vf %{buildroot}%{_mandir}/*.pdf %license LICENSE* %{_libdir}/libqatzip.so.%{libqatzip_soversion}* +%files static +%{_libdir}/libqatzip.a +/usr/lib64/libqatzip.la + + %files devel -%doc docs/QATzip-man.pdf %{_includedir}/qatzip.h %{_libdir}/libqatzip.so +%{_libdir}/pkgconfig/qatzip.pc +%doc docs/QATzip-man.pdf %files doc -%doc docs/QATzip-man.pdf README.md +%doc docs/QATzip-man.pdf +%doc README.md %changelog +* Thu Sep 07 2023 Kun(llfl) - 1.1.2-1 +- update version to 1.1.2 +- change qatzip to use udma + +* Mon Apr 10 2023 Xuchun Shang - 1.0.9-2 +- Update some defination + * Thu Oct 13 2022 happy_orange - 1.0.9-1 -- Init package from upstream +- Init pacakge from upstream diff --git a/v1.0.9.tar.gz b/v1.0.9.tar.gz deleted file mode 100644 index a9eed9fd197f83787876fc46cf906e621ab260fb..0000000000000000000000000000000000000000 Binary files a/v1.0.9.tar.gz and /dev/null differ diff --git a/v1.1.2.tar.gz b/v1.1.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..82ebda3b1bcf616445f0c95b752fff9ae97ae369 Binary files /dev/null and b/v1.1.2.tar.gz differ