xref: /freebsd/sys/dev/liquidio/lio_rss.h (revision 5a94c2e89f6a4fbdea49d6c3a51b5fe0154d2495)
1 /*
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Cavium, Inc. nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __LIO_RSS_H__
35 #define __LIO_RSS_H__
36 
37 #include <net/rss_config.h>
38 #include <netinet/in_rss.h>
39 
40 #define LIO_RSS_TABLE_SZ	128
41 #define LIO_RSS_KEY_SZ		40
42 
43 struct lio_rss_params {
44 #define LIO_RSS_PARAM_SIZE	16
45 	struct param {
46 #if BYTE_ORDER == LITTLE_ENDIAN
47 		uint64_t	flags:16;
48 		uint64_t	hashinfo:32;
49 		uint64_t	itablesize:16;
50 
51 		uint64_t	hashkeysize:16;
52 		uint64_t	reserved:48;
53 #elif BYTE_ORDER == BIG_ENDIAN
54 		uint64_t	itablesize:16;
55 		uint64_t	hashinfo:32;
56 		uint64_t	flags:16;
57 
58 		uint64_t	reserved:48;
59 		uint64_t	hashkeysize:16;
60 #else
61 #error Undefined BYTE_ORDER
62 #endif
63 	}	param;
64 
65 	uint8_t	itable[LIO_RSS_TABLE_SZ];
66 	uint8_t	key[LIO_RSS_KEY_SZ];
67 
68 };
69 
70 struct lio_rss_params_set {
71 	uint8_t		key[LIO_RSS_KEY_SZ];
72 	uint8_t		fw_itable[LIO_RSS_TABLE_SZ];
73 	uint64_t	hashinfo;
74 
75 };
76 
77 #define LIO_RSS_HASH_IPV4		0x100
78 #define LIO_RSS_HASH_TCP_IPV4		0x200
79 #define LIO_RSS_HASH_IPV6		0x400
80 #define LIO_RSS_HASH_IPV6_EX		0x800
81 #define LIO_RSS_HASH_TCP_IPV6		0x1000
82 #define LIO_RSS_HASH_TCP_IPV6_EX	0x2000
83 
84 #endif	/* __LIO_RSS_H__ */
85