Commit a23b8c8c authored by Richael Zhuang's avatar Richael Zhuang Committed by Ben Walker
Browse files

Update spdk crc32.c with ARM CRC32 intrinsics



Implement spdk_crc32_update() with ARM CRC32 intrinsics.

Change-Id: I6a64122f5dd3b804408cfae61a205e78fd8c4547
Signed-off-by: default avatarRichael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.gerrithub.io/c/440828


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 7d1db86f
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -52,6 +52,32 @@ spdk_crc32_table_init(struct spdk_crc32_table *table, uint32_t polynomial_reflec
	}
}

#ifdef SPDK_HAVE_ARM_CRC

uint32_t
spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t len, uint32_t crc)
{
	size_t count;
	const uint64_t *dword_buf;

	count = len & 7;
	while (count--) {
		crc = __crc32b(crc, *(const uint8_t *)buf);
		buf++;
	}
	dword_buf = (const uint64_t *)buf;

	count = len / 8;
	while (count--) {
		crc = __crc32d(crc, *dword_buf);
		dword_buf++;
	}

	return crc;
}

#else

uint32_t
spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t len, uint32_t crc)
{
@@ -64,3 +90,5 @@ spdk_crc32_update(const struct spdk_crc32_table *table, const void *buf, size_t

	return crc;
}

#endif