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