1325618Ssbruno/*
2325618Ssbruno *   BSD LICENSE
3325618Ssbruno *
4325618Ssbruno *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5325618Ssbruno *   All rights reserved.
6325618Ssbruno *
7325618Ssbruno *   Redistribution and use in source and binary forms, with or without
8325618Ssbruno *   modification, are permitted provided that the following conditions
9325618Ssbruno *   are met:
10325618Ssbruno *
11325618Ssbruno *     * Redistributions of source code must retain the above copyright
12325618Ssbruno *       notice, this list of conditions and the following disclaimer.
13325618Ssbruno *     * Redistributions in binary form must reproduce the above copyright
14325618Ssbruno *       notice, this list of conditions and the following disclaimer in
15325618Ssbruno *       the documentation and/or other materials provided with the
16325618Ssbruno *       distribution.
17325618Ssbruno *     * Neither the name of Cavium, Inc. nor the names of its
18325618Ssbruno *       contributors may be used to endorse or promote products derived
19325618Ssbruno *       from this software without specific prior written permission.
20325618Ssbruno *
21325618Ssbruno *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22325618Ssbruno *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23325618Ssbruno *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24325618Ssbruno *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25325618Ssbruno *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26325618Ssbruno *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27325618Ssbruno *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28325618Ssbruno *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29325618Ssbruno *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30325618Ssbruno *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31325618Ssbruno *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32325618Ssbruno */
33325618Ssbruno/*$FreeBSD: stable/11/sys/dev/liquidio/lio_rss.h 325618 2017-11-09 19:52:56Z sbruno $*/
34325618Ssbruno
35325618Ssbruno#ifndef __LIO_RSS_H__
36325618Ssbruno#define __LIO_RSS_H__
37325618Ssbruno
38325618Ssbruno#ifdef RSS
39325618Ssbruno
40325618Ssbruno#include <net/rss_config.h>
41325618Ssbruno#include <netinet/in_rss.h>
42325618Ssbruno
43325618Ssbruno#define LIO_RSS_TABLE_SZ	128
44325618Ssbruno#define LIO_RSS_KEY_SZ		40
45325618Ssbruno
46325618Ssbrunostruct lio_rss_params {
47325618Ssbruno#define LIO_RSS_PARAM_SIZE	16
48325618Ssbruno	struct param {
49325618Ssbruno#if BYTE_ORDER == LITTLE_ENDIAN
50325618Ssbruno		uint64_t	flags:16;
51325618Ssbruno		uint64_t	hashinfo:32;
52325618Ssbruno		uint64_t	itablesize:16;
53325618Ssbruno
54325618Ssbruno		uint64_t	hashkeysize:16;
55325618Ssbruno		uint64_t	reserved:48;
56325618Ssbruno#elif BYTE_ORDER == BIG_ENDIAN
57325618Ssbruno		uint64_t	itablesize:16;
58325618Ssbruno		uint64_t	hashinfo:32;
59325618Ssbruno		uint64_t	flags:16;
60325618Ssbruno
61325618Ssbruno		uint64_t	reserved:48;
62325618Ssbruno		uint64_t	hashkeysize:16;
63325618Ssbruno#else
64325618Ssbruno#error Undefined BYTE_ORDER
65325618Ssbruno#endif
66325618Ssbruno	}	param;
67325618Ssbruno
68325618Ssbruno	uint8_t	itable[LIO_RSS_TABLE_SZ];
69325618Ssbruno	uint8_t	key[LIO_RSS_KEY_SZ];
70325618Ssbruno
71325618Ssbruno};
72325618Ssbruno
73325618Ssbrunostruct lio_rss_params_set {
74325618Ssbruno	uint8_t		key[LIO_RSS_KEY_SZ];
75325618Ssbruno	uint8_t		fw_itable[LIO_RSS_TABLE_SZ];
76325618Ssbruno	uint64_t	hashinfo;
77325618Ssbruno
78325618Ssbruno};
79325618Ssbruno
80325618Ssbruno#endif	/* RSS */
81325618Ssbruno
82325618Ssbruno#define LIO_RSS_HASH_IPV4		0x100
83325618Ssbruno#define LIO_RSS_HASH_TCP_IPV4		0x200
84325618Ssbruno#define LIO_RSS_HASH_IPV6		0x400
85325618Ssbruno#define LIO_RSS_HASH_IPV6_EX		0x800
86325618Ssbruno#define LIO_RSS_HASH_TCP_IPV6		0x1000
87325618Ssbruno#define LIO_RSS_HASH_TCP_IPV6_EX	0x2000
88325618Ssbruno
89325618Ssbruno#endif	/* __LIO_RSS_H__ */
90