6767extern void isal_deflate_hash_lvl0 (uint16_t * , uint32_t , uint32_t , uint8_t * , uint32_t );
6868extern void isal_deflate_hash_lvl1 (uint16_t * , uint32_t , uint32_t , uint8_t * , uint32_t );
6969extern void isal_deflate_hash_lvl2 (uint16_t * , uint32_t , uint32_t , uint8_t * , uint32_t );
70+ extern void isal_deflate_hash_lvl3 (uint16_t * , uint32_t , uint32_t , uint8_t * , uint32_t );
7071extern const uint8_t gzip_hdr [];
7172extern const uint32_t gzip_hdr_bytes ;
7273extern const uint32_t gzip_trl_bytes ;
@@ -95,6 +96,7 @@ void isal_deflate_finish(struct isal_zstream *stream);
9596void isal_deflate_icf_body (struct isal_zstream * stream );
9697void isal_deflate_icf_finish_lvl1 (struct isal_zstream * stream );
9798void isal_deflate_icf_finish_lvl2 (struct isal_zstream * stream );
99+ void isal_deflate_icf_finish_lvl3 (struct isal_zstream * stream );
98100/*****************************************************************/
99101
100102/* Forward declarations */
@@ -253,6 +255,11 @@ static int check_level_req(struct isal_zstream *stream)
253255 return ISAL_INVALID_LEVEL_BUF ;
254256
255257 switch (stream -> level ) {
258+ case 3 :
259+ if (stream -> level_buf_size < ISAL_DEF_LVL3_MIN )
260+ return ISAL_INVALID_LEVEL ;
261+ break ;
262+
256263 case 2 :
257264 if (stream -> level_buf_size < ISAL_DEF_LVL2_MIN )
258265 return ISAL_INVALID_LEVEL ;
@@ -276,6 +283,14 @@ static int init_hash8k_buf(struct isal_zstream *stream)
276283 return sizeof (struct level_buf ) - MAX_LVL_BUF_SIZE + sizeof (level_buf -> hash8k );
277284}
278285
286+ static int init_hash_hist_buf (struct isal_zstream * stream )
287+ {
288+ struct isal_zstate * state = & stream -> internal_state ;
289+ struct level_buf * level_buf = (struct level_buf * )stream -> level_buf ;
290+ state -> has_level_buf_init = 1 ;
291+ return sizeof (struct level_buf ) - MAX_LVL_BUF_SIZE + sizeof (level_buf -> hash_hist );
292+ }
293+
279294static int init_hash_map_buf (struct isal_zstream * stream )
280295{
281296 struct isal_zstate * state = & stream -> internal_state ;
@@ -294,8 +309,10 @@ static int init_hash_map_buf(struct isal_zstream *stream)
294309static int init_lvlX_buf (struct isal_zstream * stream )
295310{
296311 switch (stream -> level ) {
297- case 2 :
312+ case 3 :
298313 return init_hash_map_buf (stream );
314+ case 2 :
315+ return init_hash_hist_buf (stream );
299316 default :
300317 return init_hash8k_buf (stream );
301318 }
@@ -339,8 +356,10 @@ static int are_buffers_empty(struct isal_zstream *stream)
339356{
340357
341358 switch (stream -> level ) {
342- case 2 :
359+ case 3 :
343360 return are_buffers_empty_hash_map (stream );
361+ case 2 :
362+ return are_buffers_empty_hashX (stream );
344363 default :
345364 return are_buffers_empty_hashX (stream );
346365 }
@@ -455,6 +474,9 @@ static void isal_deflate_pass(struct isal_zstream *stream)
455474static void isal_deflate_icf_finish (struct isal_zstream * stream )
456475{
457476 switch (stream -> level ) {
477+ case 3 :
478+ isal_deflate_icf_finish_lvl3 (stream );
479+ break ;
458480 case 2 :
459481 isal_deflate_icf_finish_lvl2 (stream );
460482 break ;
@@ -855,6 +877,11 @@ static inline void reset_match_history(struct isal_zstream *stream)
855877 int i = 0 ;
856878
857879 switch (stream -> level ) {
880+ case 3 :
881+ hash_table = level_buf -> lvl3 .hash_table ;
882+ hash_table_size = sizeof (level_buf -> lvl3 .hash_table );
883+ break ;
884+
858885 case 2 :
859886 hash_table = level_buf -> lvl2 .hash_table ;
860887 hash_table_size = sizeof (level_buf -> lvl2 .hash_table );
@@ -992,14 +1019,22 @@ void isal_deflate_hash(struct isal_zstream *stream, uint8_t * dict, uint32_t dic
9921019 * dictionary must set at least 1 element in the history */
9931020 struct level_buf * level_buf = (struct level_buf * )stream -> level_buf ;
9941021 switch (stream -> level ) {
1022+ case 3 :
1023+ memset (level_buf -> lvl3 .hash_table , -1 , sizeof (level_buf -> lvl3 .hash_table ));
1024+ isal_deflate_hash_lvl3 (level_buf -> lvl3 .hash_table , LVL3_HASH_MASK ,
1025+ stream -> total_in , dict , dict_len );
1026+ break ;
1027+
9951028 case 2 :
9961029 memset (level_buf -> lvl2 .hash_table , -1 , sizeof (level_buf -> lvl2 .hash_table ));
9971030 isal_deflate_hash_lvl2 (level_buf -> lvl2 .hash_table , LVL2_HASH_MASK ,
9981031 stream -> total_in , dict , dict_len );
1032+ break ;
9991033 case 1 :
10001034 memset (level_buf -> lvl1 .hash_table , -1 , sizeof (level_buf -> lvl1 .hash_table ));
10011035 isal_deflate_hash_lvl1 (level_buf -> lvl1 .hash_table , LVL1_HASH_MASK ,
10021036 stream -> total_in , dict , dict_len );
1037+ break ;
10031038 default :
10041039 memset (stream -> internal_state .head , -1 , sizeof (stream -> internal_state .head ));
10051040 isal_deflate_hash_lvl0 (stream -> internal_state .head , LVL0_HASH_MASK ,
0 commit comments