blob: 8902a949135678c6198c99cfdd3d9afc6c010fbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* Copyright (c) 2017-2018, Linaro Limited
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file
*
* ODP Hash functions
*/
#ifndef ODP_API_SPEC_CHKSUM_H_
#define ODP_API_SPEC_CHKSUM_H_
#include <odp/visibility_begin.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <odp/api/std_types.h>
/** @defgroup odp_chksum ODP CHECKSUM
* ODP checksum functions
* @{
*/
/**
* Ones' complement sum of 16-bit words
*
* Calculates 16-bit ones' complement sum over the data. In case of odd number
* of bytes, calculation uses a zero byte as padding at the end. This algorithm
* may be used as part of e.g. IPv4/UDP/TCP checksum generation and checking.
*
* @param data Pointer to data. Data address must be 16-bit aligned
* in minimum.
* @param data_len Data length in bytes. In case of an odd number, calculation
* includes one byte of padding.
*
* @return Ones' complement sum
*/
uint16_t odp_chksum_ones_comp16(const void *data, uint32_t data_len);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#include <odp/visibility_end.h>
#endif
|