17f51a0389
Add two new configure options that specify: 1. when to add padding to the openib control header - this *only* happens when the configure option is specified 2. when to use the dr-like checksum as opposed to the memcpy checksum. Not selectable at runtime - to eliminate performance impacts, this is a configure-only option Also removed an unused checksum version from opal/util/crc.h. The new component still needs a little cleanup and some sync with recent ob1 bug fixes. It was created as a separate module to avoid performance hits in ob1 itself, though most of the code is duplicative. The component is only selectable by either specifying it directly, or configuring with the dr-like checksum -and- setting -mca pml_csum_enable_checksum 1. Modify the LANL platform files to take advantage of the new module. This commit was SVN r20846.
180 строки
4.7 KiB
C
180 строки
4.7 KiB
C
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* Copyright (c) 2009 IBM Corporation. All rights reserved.
|
|
* Copyright (c) 2009 Los Alamos National Security, LLC. All rights
|
|
* reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#ifndef _OPAL_CRC_H_
|
|
#define _OPAL_CRC_H_
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define CRC_POLYNOMIAL ((unsigned int)0x04c11db7)
|
|
#define CRC_INITIAL_REGISTER ((unsigned int)0xffffffff)
|
|
|
|
|
|
#define OPAL_CSUM( SRC, LEN ) opal_uicsum( SRC, LEN )
|
|
#define OPAL_CSUM_PARTIAL( SRC, LEN, UI1, UI2 ) \
|
|
opal_uicsum_partial( SRC, LEN, UI1, UI2 )
|
|
#define OPAL_CSUM_BCOPY_PARTIAL( SRC, DST, LEN1, LEN2, UI1, UI2 ) \
|
|
opal_bcopy_uicsum_partial( SRC, DST, LEN1, LEN2, UI1, UI2 )
|
|
#define OPAL_CSUM_ZERO 0
|
|
|
|
|
|
OPAL_DECLSPEC unsigned long
|
|
opal_bcopy_csum_partial(
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t csumlen,
|
|
unsigned long* lastPartialLong,
|
|
size_t* lastPartialLength
|
|
);
|
|
|
|
static inline unsigned long
|
|
opal_bcopy_csum (
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t csumlen
|
|
)
|
|
{
|
|
unsigned long plong = 0;
|
|
size_t plength = 0;
|
|
return opal_bcopy_csum_partial(source, destination, copylen, csumlen, &plong, &plength);
|
|
}
|
|
|
|
OPAL_DECLSPEC unsigned int
|
|
opal_bcopy_uicsum_partial (
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t csumlen,
|
|
unsigned int* lastPartialInt,
|
|
size_t* lastPartialLength
|
|
);
|
|
|
|
static inline unsigned int
|
|
opal_bcopy_uicsum (
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t csumlen
|
|
)
|
|
{
|
|
unsigned int pint = 0;
|
|
size_t plength = 0;
|
|
return opal_bcopy_uicsum_partial(source, destination, copylen, csumlen, &pint, &plength);
|
|
}
|
|
|
|
OPAL_DECLSPEC unsigned long
|
|
opal_csum_partial (
|
|
const void * source,
|
|
size_t csumlen,
|
|
unsigned long* lastPartialLong,
|
|
size_t* lastPartialLength
|
|
);
|
|
|
|
|
|
static inline unsigned long
|
|
opal_csum(const void * source, size_t csumlen)
|
|
{
|
|
unsigned long lastPartialLong = 0;
|
|
size_t lastPartialLength = 0;
|
|
return opal_csum_partial(source, csumlen, &lastPartialLong, &lastPartialLength);
|
|
}
|
|
|
|
static inline uint16_t
|
|
opal_csum16 (const void * source, size_t csumlen)
|
|
{
|
|
unsigned char *src = (unsigned char *) source;
|
|
uint16_t csum = 0;
|
|
size_t i;
|
|
|
|
for(i = 0; i < csumlen; i++) {
|
|
csum += *src++;
|
|
}
|
|
return csum;
|
|
}
|
|
|
|
OPAL_DECLSPEC unsigned int
|
|
opal_uicsum_partial (
|
|
const void * source,
|
|
size_t csumlen,
|
|
unsigned int * lastPartialInt,
|
|
size_t* lastPartialLength
|
|
);
|
|
|
|
static inline unsigned int
|
|
opal_uicsum(const void * source, size_t csumlen)
|
|
{
|
|
unsigned int lastPartialInt = 0;
|
|
size_t lastPartialLength = 0;
|
|
return opal_uicsum_partial(source, csumlen, &lastPartialInt, &lastPartialLength);
|
|
}
|
|
|
|
/*
|
|
* CRC Support
|
|
*/
|
|
|
|
void opal_initialize_crc_table(void);
|
|
|
|
OPAL_DECLSPEC unsigned int
|
|
opal_bcopy_uicrc_partial(
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t crclen,
|
|
unsigned int partial_crc);
|
|
|
|
static inline unsigned int
|
|
opal_bcopy_uicrc(
|
|
const void * source,
|
|
void * destination,
|
|
size_t copylen,
|
|
size_t crclen)
|
|
{
|
|
return opal_bcopy_uicrc_partial(source, destination, copylen, crclen, CRC_INITIAL_REGISTER);
|
|
}
|
|
|
|
OPAL_DECLSPEC unsigned int
|
|
opal_uicrc_partial(
|
|
const void * source,
|
|
size_t crclen,
|
|
unsigned int partial_crc);
|
|
|
|
|
|
static inline unsigned int
|
|
opal_uicrc(const void * source, size_t crclen)
|
|
{
|
|
return opal_uicrc_partial(source, crclen, CRC_INITIAL_REGISTER);
|
|
}
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|