source: lib/hash_toeplitz.h @ d31b952

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since d31b952 was ee6e802, checked in by Shane Alcock <salcock@…>, 5 years ago

Updated copyright blurb on all source files

In some cases, this meant adding copyright blurbs to files that
had never had them before.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *
3 * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4 * All rights reserved.
5 *
6 * This file is part of libtrace.
7 *
8 * This code has been developed by the University of Waikato WAND
9 * research group. For further information please see http://www.wand.net.nz/
10 *
11 * libtrace is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * libtrace is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 *
24 *
25 */
26
27/**
28 * toeplitz hashing - see microsoft rss code
29 */
30#include <stdint.h>
31#include <stddef.h>
32#include <libtrace.h>
33
34#ifndef HASH_TOEPLITZ_H
35#define HASH_TOEPLITZ_H
36
37/**
38 * The default expected to be used.
39 */ 
40typedef struct toeplitz_conf {
41        unsigned int hash_ipv4 : 1;
42        unsigned int hash_tcp_ipv4 : 1;
43        unsigned int hash_ipv6 : 1;
44        unsigned int hash_tcp_ipv6 : 1;
45        unsigned int hash_ipv6_ex : 1;
46        unsigned int hash_tcp_ipv6_ex : 1;
47        /* These UDP ones are Intel extensions */
48        unsigned int x_hash_udp_ipv4 : 1;
49        unsigned int x_hash_udp_ipv6 : 1;
50        unsigned int x_hash_udp_ipv6_ex : 1;
51        uint8_t key[40];
52        uint32_t key_cache[320];
53} toeplitz_conf_t;
54
55void toeplitz_hash_expand_key(toeplitz_conf_t *conf);
56uint32_t toeplitz_hash(const toeplitz_conf_t *tc, const uint8_t *data, size_t offset, size_t n, uint32_t result);
57uint32_t toeplitz_first_hash(const toeplitz_conf_t *tc, const uint8_t *data, size_t n);
58void toeplitz_init_config(toeplitz_conf_t *conf, bool bidirectional);
59uint64_t toeplitz_hash_packet(const libtrace_packet_t * pkt, const toeplitz_conf_t *cnf);
60void toeplitz_create_bikey(uint8_t *key);
61void toeplitz_create_unikey(uint8_t *key);
62
63
64/* IPv4 Only (Input[8] = @12-15, @16-19) src dst */
65
66// Using char any way in the hope this structure will auto allign
67#pragma pack(push)  /* push current alignment to stack */
68#pragma pack(1)     /* set alignment to 1 byte boundary */
69typedef struct ipv4_toeplitz_only {
70        uint8_t src[4];
71        uint8_t dest[4];
72} toeplitz_ipv4_only_t;
73#pragma pack(pop)   /* restore original alignment from stack */
74
75#endif
Note: See TracBrowser for help on using the repository browser.