crc: crc32 iscsi performance improvement

Change-Id: Ic8c946546345cf92a19dea1bbc5ebaf66c0f98da
Signed-off-by: Chunyang Hui <Chunyang.hui@intel.com>
This commit is contained in:
Chunyang Hui
2017-12-11 11:44:32 +08:00
committed by Greg Tucker
parent e3fad7c45a
commit e7df3fdedc
2 changed files with 36 additions and 3 deletions

View File

@@ -55,6 +55,9 @@ default rel
xor rbx, rbx ;; rbx = crc1 = 0;
xor r10, r10 ;; r10 = crc2 = 0;
cmp len, %%bSize*3*2
jbe %%non_prefetch
%assign i 0
%rep %%bSize/8 - 1
%if i < %%bSize*3/4
@@ -65,6 +68,18 @@ default rel
crc32 r10, qword [bufptmp+i + 2*%%bSize] ;; update crc2
%assign i (i+8)
%endrep
jmp %%next %+ %1
%%non_prefetch:
%assign i 0
%rep %%bSize/8 - 1
crc32 rax, qword [bufptmp+i + 0*%%bSize] ;; update crc0
crc32 rbx, qword [bufptmp+i + 1*%%bSize] ;; update crc1
crc32 r10, qword [bufptmp+i + 2*%%bSize] ;; update crc2
%assign i (i+8)
%endrep
%%next %+ %1:
crc32 rax, qword [bufptmp+i + 0*%%bSize] ;; update crc0
crc32 rbx, qword [bufptmp+i + 1*%%bSize] ;; update crc1
; SKIP ;crc32 r10, [bufptmp+i + 2*%%bSize] ;; update crc2
@@ -652,5 +667,5 @@ DD 0x2f2aa980,0xf24c623b,0x900b4807,0x4d6d83bc
DD 0x54851c7f,0x89e3d7c4,0xeba4fdf8,0x36c23643
;;; func core, ver, snum
slversion crc32_iscsi_00, 00, 03, 0014
slversion crc32_iscsi_00, 00, 04, 0014

View File

@@ -190,9 +190,13 @@ full_block:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
crc_array:
cmp len, 128*24*2
jbe non_prefetch
%assign i 128
%rep 128-1
CONCAT(crc_,i,:)
CONCAT(_crc_,i,:)
crc32 crc_init, qword [block_0 - i*8]
crc32 crc1, qword [block_1 - i*8]
crc32 crc2, qword [block_2 - i*8]
@@ -200,9 +204,23 @@ CONCAT(crc_,i,:)
%if i > 128*8 / 32 ; prefetch next 3KB data
prefetchnta [block_2 + 128*32 - i*32]
%endif
%assign i (i-1)
%endrep
jmp next_
non_prefetch:
%assign i 128
%rep 128-1
CONCAT(crc_,i,:)
crc32 crc_init, qword [block_0 - i*8]
crc32 crc1, qword [block_1 - i*8]
crc32 crc2, qword [block_2 - i*8]
%assign i (i-1)
%endrep
next_:
CONCAT(crc_,i,:)
crc32 crc_init, qword [block_0 - i*8]
crc32 crc1, qword [block_1 - i*8]
@@ -568,5 +586,5 @@ K_table:
dq 0x1a0f717c4, 0x0170076fa
;;; func core, ver, snum
slversion crc32_iscsi_01, 01, 03, 0015
slversion crc32_iscsi_01, 01, 04, 0015