source: lib/hash_toeplitz.h @ 733c8b4

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 733c8b4 was 5ba34eb, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Remove inlines for BSD support

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * toeplitz hashing - see microsoft rss code
3 */
4#include <stdint.h>
5#include <stddef.h>
6#include <libtrace.h>
7
8#ifndef HASH_TOEPLITZ_H
9#define HASH_TOEPLITZ_H
10
11/**
12 * The default expected to be used.
13 */ 
14typedef struct toeplitz_conf {
15        unsigned int hash_ipv4 : 1;
16        unsigned int hash_tcp_ipv4 : 1;
17        unsigned int hash_ipv6 : 1;
18        unsigned int hash_tcp_ipv6 : 1;
19        unsigned int hash_ipv6_ex : 1;
20        unsigned int hash_tcp_ipv6_ex : 1;
21        /* These UDP ones are Intel extensions */
22        unsigned int x_hash_udp_ipv4 : 1;
23        unsigned int x_hash_udp_ipv6 : 1;
24        unsigned int x_hash_udp_ipv6_ex : 1;
25        uint8_t key[40];
26        uint32_t key_cache[320];
27} toeplitz_conf_t;
28
29void toeplitz_hash_expand_key(toeplitz_conf_t *conf);
30uint32_t toeplitz_hash(const toeplitz_conf_t *tc, const uint8_t *data, size_t offset, size_t n, uint32_t result);
31uint32_t toeplitz_first_hash(const toeplitz_conf_t *tc, const uint8_t *data, size_t n);
32void toeplitz_init_config(toeplitz_conf_t *conf, bool bidirectional);
33uint64_t toeplitz_hash_packet(const libtrace_packet_t * pkt, const toeplitz_conf_t *cnf);
34void toeplitz_create_bikey(uint8_t *key);
35void toeplitz_create_unikey(uint8_t *key);
36
37
38/* IPv4 Only (Input[8] = @12-15, @16-19) src dst */
39
40// Using char any way in the hope this structure will auto allign
41#pragma pack(push)  /* push current alignment to stack */
42#pragma pack(1)     /* set alignment to 1 byte boundary */
43typedef struct ipv4_toeplitz_only {
44        uint8_t src[4];
45        uint8_t dest[4];
46} toeplitz_ipv4_only_t;
47#pragma pack(pop)   /* restore original alignment from stack */
48
49#endif
Note: See TracBrowser for help on using the repository browser.