]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/lib/librte_net/rte_net_crc.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_net / rte_net_crc.h
CommitLineData
11fdf7f2
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
3 */
4
5#ifndef _RTE_NET_CRC_H_
6#define _RTE_NET_CRC_H_
7
8#include <stdint.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
11fdf7f2
TL
14/** CRC types */
15enum rte_net_crc_type {
16 RTE_NET_CRC16_CCITT = 0,
17 RTE_NET_CRC32_ETH,
18 RTE_NET_CRC_REQS
19};
20
21/** CRC compute algorithm */
22enum rte_net_crc_alg {
23 RTE_NET_CRC_SCALAR = 0,
24 RTE_NET_CRC_SSE42,
25 RTE_NET_CRC_NEON,
26};
27
28/**
29 * This API set the CRC computation algorithm (i.e. scalar version,
30 * x86 64-bit sse4.2 intrinsic version, etc.) and internal data
31 * structure.
32 *
33 * @param alg
34 * This parameter is used to select the CRC implementation version.
35 * - RTE_NET_CRC_SCALAR
36 * - RTE_NET_CRC_SSE42 (Use 64-bit SSE4.2 intrinsic)
37 * - RTE_NET_CRC_NEON (Use ARM Neon intrinsic)
38 */
39void
40rte_net_crc_set_alg(enum rte_net_crc_alg alg);
41
42/**
43 * CRC compute API
44 *
45 * @param data
46 * Pointer to the packet data for CRC computation
47 * @param data_len
48 * Data length for CRC computation
49 * @param type
50 * CRC type (enum rte_net_crc_type)
51 *
52 * @return
53 * CRC value
54 */
55uint32_t
56rte_net_crc_calc(const void *data,
57 uint32_t data_len,
58 enum rte_net_crc_type type);
59
60#ifdef __cplusplus
61}
62#endif
63
64
65#endif /* _RTE_NET_CRC_H_ */