src/dpdk/drivers/net/qede/base/ecore_l2.c
static u32 ecore_calc_crc32c(u8 *crc32_packet, u32 crc32_length, u32 crc32_seed)
{
	u32 byte = 0, bit = 0, crc32_result = crc32_seed;
	u8 msb = 0, current_byte = 0;

	if ((crc32_packet == OSAL_NULL) ||
	    (crc32_length == 0) || ((crc32_length % 8) != 0)) {
		return crc32_result;
	}

	for (byte = 0; byte < crc32_length; byte++) {
		current_byte = crc32_packet[byte];
		for (bit = 0; bit < 8; bit++) {
			msb = (u8)(crc32_result >> 31);
			crc32_result = crc32_result << 1;
			if (msb != (0x1 & (current_byte >> bit))) {
				crc32_result = crc32_result ^ CRC32_POLY;
				crc32_result |= 1;
			}
		}
	}

	return crc32_result;
}
/*******************************************************************************
 * Description:
 *         Calculates crc 32 on a buffer
 *         Note: crc32_length MUST be aligned to 8
 * Return:
 ******************************************************************************/
Calculates crc 32 on a buffer
Note: crc32_length MUST be aligned to 8
Return.
Calculates crc 32 on a buffer Note : crc32_length MUST be aligned to 8 Return .
static u32 ecore_calc_crc32c(u8 *crc32_packet, u32 crc32_length, u32 crc32_seed)
{
	u32 byte = 0, bit = 0, crc32_result = crc32_seed;
	u8 msb = 0, current_byte = 0;
	if ((crc32_packet == OSAL_NULL) ||
	    (crc32_length == 0) || ((crc32_length % 8) != 0)) {
		return crc32_result;
	}
	for (byte = 0; byte < crc32_length; byte++) {
		current_byte = crc32_packet[byte];
		for (bit = 0; bit < 8; bit++) {
			msb = (u8)(crc32_result >> 31);
			crc32_result = crc32_result << 1;
			if (msb != (0x1 & (current_byte >> bit))) {
				crc32_result = crc32_result ^ CRC32_POLY;
				crc32_result |= 1;
			}
		}
	}
	return crc32_result;
}
static u32 ecore_calc_crc32c ( u8 * crc32_packet , u32 crc32_length , u32 crc32_seed ) { u32 byte = 0 , bit = 0 , crc32_result = crc32_seed ; u8 msb = 0 , current_byte = 0 ; if ( ( crc32_packet == OSAL_NULL ) || ( crc32_length == 0 ) || ( ( crc32_length % 8 ) != 0 ) ) { return crc32_result ; } for ( byte = 0 ; byte < crc32_length ; byte ++ ) { current_byte = crc32_packet [ byte ] ; for ( bit = 0 ; bit < 8 ; bit ++ ) { msb = ( u8 ) ( crc32_result >> 31 ) ; crc32_result = crc32_result << 1 ; if ( msb != ( 0x1 & ( current_byte >> bit ) ) ) { crc32_result = crc32_result ^ CRC32_POLY ; crc32_result |= 1 ; } } } return crc32_result ; }
Description:
         Calculates crc 32 on a buffer
         Note: crc32_length MUST be aligned to 8
 Return:
Description : Calculates crc 32 on a buffer Note : crc32_length MUST be aligned to 8 Return :