checksum: use u64 types

pull/3680/head
Victor Julien 8 years ago
parent 02ba360903
commit bf905bcbca

@ -67,23 +67,26 @@ int ReCalculateChecksum(Packet *p)
* \retval 1 yes, offloading in place
* \retval 0 no, no offloading used
*/
int ChecksumAutoModeCheck(uint32_t thread_count,
unsigned int iface_count, unsigned int iface_fail)
int ChecksumAutoModeCheck(uint64_t thread_count,
uint64_t iface_count, uint64_t iface_fail)
{
if (thread_count == CHECKSUM_SAMPLE_COUNT) {
if (iface_fail != 0) {
if ((iface_count / iface_fail) < CHECKSUM_INVALID_RATIO) {
SCLogInfo("More than 1/%dth of packets have an invalid "
"checksum, assuming checksum offloading is used (%u/%u)",
"checksum, assuming checksum offloading is used "
"(%"PRIu64"/%"PRIu64")",
CHECKSUM_INVALID_RATIO, iface_fail, iface_count);
return 1;
} else {
SCLogInfo("Less than 1/%dth of packets have an invalid "
"checksum, assuming checksum offloading is NOT used (%u/%u)",
CHECKSUM_INVALID_RATIO, iface_fail, iface_count);
"checksum, assuming checksum offloading is NOT used "
"(%"PRIu64"/%"PRIu64")", CHECKSUM_INVALID_RATIO,
iface_fail, iface_count);
}
} else {
SCLogInfo("No packets with invalid checksum, assuming checksum offloading is NOT used");
SCLogInfo("No packets with invalid checksum, assuming "
"checksum offloading is NOT used");
}
}
return 0;

@ -25,12 +25,12 @@
#define __UTIL_CHECKSUM_H__
int ReCalculateChecksum(Packet *p);
int ChecksumAutoModeCheck(uint32_t thread_count,
unsigned int iface_count, unsigned int iface_fail);
int ChecksumAutoModeCheck(uint64_t thread_count,
uint64_t iface_count, uint64_t iface_fail);
/* constant linked with detection of interface with
* invalid checksums */
#define CHECKSUM_SAMPLE_COUNT 1000
#define CHECKSUM_SAMPLE_COUNT 1000ULL
#define CHECKSUM_INVALID_RATIO 10
#endif

Loading…
Cancel
Save