cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
nts_config.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2016 -- 2021 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
31 #ifndef _NTS_CONFIG_H_
32 #define _NTS_CONFIG_H_
33 
34 #include <stdint.h>
35 #include <math.h>
36 
37 
40 static unsigned long log2ceil(unsigned long val) {
41  return (unsigned long)(ceil(log2((double)val)));
42 }
43 
44 
45 
52 //--------------------------------------------------------------------
53 //-- ETHERNET - MAXIMUM TRANSMISSION UNIT
54 //--------------------------------------------------------------------
55 static const uint16_t MTU = 1500;
56 
57 //--------------------------------------------------------------------
58 //-- ETHERNET - MTU in ZYC2
59 //-- ZYC2_MTU is 1450 bytes (1500-20-8-8-6-6-2) due to the use of
60 //-- VXLAN overlay
61 //-- [OutIpHdr][OutUdpHdr][VxlanHdr][InMacDa][InMacSa][EtherType]
62 //--------------------------------------------------------------------
63 static const uint16_t MTU_ZYC2 = 1450;
64 
65 
66 
73 //------------------------------------------------------------------
74 //-- TCP - MAXIMUM SEGMENT SIZE (modulo 8 for efficiency)
75 //-- FYI: A specific MSS might be advertised by every connection
76 //-- during the 3-way handshake process. For the time being, we
77 //-- assume and use a single ZYC2_MSS value for all connections.
78 //-- This MSS is rounded modulo 8 bytes for better efficiency.
79 //------------------------------------------------------------------
80 static const uint16_t ZYC2_MSS = (MTU_ZYC2-92) & ~0x7; // 1358 & ~0x7 = 1352
81 
82 //------------------------------------------------------------------
83 //-- TCP OFFLOAD ENGINE - CONFIGURATION PARAMETERS
84 //------------------------------------------------------------------
85 static const uint16_t TOE_MAX_SESSIONS = 8; // The number of session you want to support (Max. is 10.000)
86 
87 static const uint16_t TOE_WINDOW_BITS = 16;
88 
89 static const uint32_t TOE_BUFFER_SIZE = (1 << TOE_WINDOW_BITS); // 65536
90 static const uint32_t TOE_RX_BUFFER_SIZE = TOE_BUFFER_SIZE; // 65536
91 static const uint32_t TOE_TX_BUFFER_SIZE = TOE_BUFFER_SIZE; // 65536
92 
93 #define TOE_MEMORY_SIZE 0x80000000 // 2GB
94 #define TOE_MEMORY_BASE 0x00000000 // Base address
95 static const uint16_t TOE_MEMORY_BITS = log2ceil(TOE_MEMORY_SIZE); // 2GB = 2^31
96 
97 static const uint64_t TOE_RX_MEMORY_SIZE = TOE_MEMORY_SIZE >> 1; // 1GB
98 static const uint64_t TOE_TX_MEMORY_SIZE = TOE_MEMORY_SIZE >> 1; // 1GB
99 static const uint64_t TOE_RX_MEMORY_BASE = (TOE_MEMORY_BASE); // 0x00000000 (Base)
100 static const uint64_t TOE_TX_MEMORY_BASE = (TOE_MEMORY_SIZE+TOE_RX_MEMORY_SIZE); // 0x40000000 (Base+1GB)
101 static const uint16_t TOE_RX_MEMORY_BITS = log2ceil(TOE_RX_MEMORY_SIZE); // 1GB = 2^30
102 static const uint16_t TOE_TX_MEMORY_BITS = log2ceil(TOE_TX_MEMORY_SIZE); // 1GB = 2^30
103 
104 static const unsigned TOE_MAX_CONGESTION_WINDOW = (TOE_BUFFER_SIZE - 2048); // 0xF7FF
105 
106 
114 #endif
115 
#define TOE_MEMORY_SIZE
Definition: nts_config.hpp:93
#define TOE_MEMORY_BASE
Definition: nts_config.hpp:94
#define MTU
Definition: udp.hpp:71