mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
Compare commits
7 commits
729a866121
...
cb12003d57
Author | SHA1 | Date | |
---|---|---|---|
|
cb12003d57 | ||
|
dbe88c18c9 | ||
|
295a97bf4c | ||
|
e363a0b0b6 | ||
|
ff978b1ce3 | ||
|
1a5368962b | ||
|
1f750d9237 |
4 changed files with 31 additions and 14 deletions
|
@ -2,15 +2,28 @@
|
|||
|
||||
#define TCP_SRTT_ALPHA 0.9
|
||||
|
||||
// Transmission Time Out to prevent network slugglish performance
|
||||
#define TCP_RTO_BETA 2
|
||||
#define TCP_RTO_MIN 0.2
|
||||
#define TCP_RTO_MAX 10
|
||||
#define TCP_RTO_MIN JIFFY_FREQ/5 // (linux TCP.H) should be using system timer/clock instead hardcoded
|
||||
#define TCP_RTO_MAX 120*JIFFY_FREQ // JIFFY_FREZ = Hz. Hz is software clock ticks
|
||||
|
||||
#define TCP_WINDOW_SIZE 8192
|
||||
#define TCP_MAX_WINDOW 32676 // Beyond this number, use window_scale(not implemented). 8192 is recommended/default.
|
||||
U16 WINDOW_SIZE; // Initiate window size in CTPCPacketAllocate{} ?? Need more study
|
||||
U16 RECEIVE_WINDOW; // gets host window size. It is not static.
|
||||
U16 SEND_WINDOW; // gets receive window size from host, then adjust accordingly.
|
||||
|
||||
U32 RECEIVE_BUFFER; // is 32 too much? receive_buffer holds TCP data that has not yet been processed
|
||||
|
||||
#define TCP_MSS 536 // Max Segment Size default
|
||||
#define TCP_MIN_MSS 88 // Min Segment Size
|
||||
|
||||
#define TCP_TIMEOUT 5000
|
||||
#define TCP_INIT_TIMEOUT 1*JIFFY_FREQ // TODO... Init RTO Value. Not sure if this is needed.
|
||||
#define TCP_TIMEOUT 20*JIFFY_FREQ // Roughly a minute based on software clock
|
||||
#define TCP_KEEPALIVE 120*JIFFY_FREQ // TODO... 1 hour
|
||||
|
||||
#define TCP_MAX_INCREASEACK 16 //TODO... At Initial start up, it's generally slow. This accelerates the process.
|
||||
#define TCP_MAX_DELAYACK JIFFY_FREQ/5 //TODO... Delay max time ack
|
||||
#define TCP_MIN_DELAYACK JIFFY_FREQ/25 //TODO... Delay min time ack
|
||||
|
||||
#define TCP_STATE_CLOSED 0
|
||||
#define TCP_STATE_LISTEN 1
|
||||
|
@ -24,7 +37,7 @@
|
|||
#define TCP_STATE_LAST_ACK 9
|
||||
#define TCP_STATE_TIME_WAIT 10
|
||||
|
||||
// TCP header flags. Test with Bt(), e.g. Bt(&flags, TCPf_RST)
|
||||
// TCP header flags. Order of Operation matters. Test with Bt(), e.g. Bt(&flags, TCPf_RST)
|
||||
#define TCPf_FIN 0
|
||||
#define TCPf_SYN 1
|
||||
#define TCPf_RST 2
|
||||
|
@ -39,6 +52,8 @@
|
|||
#define TCPF_ACK (1 << TCPf_ACK)
|
||||
//#define TCPF_URG (1 << TCPf_URG) // most stacks don't implement URGENT.
|
||||
|
||||
// U32 TCP_MAX_DELAYACK(CSocket *Socket); // TODO
|
||||
|
||||
|
||||
class CTCPAckQueue:CQueue
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ I64 TCPPacketAllocate(U8 **frame_out,
|
|||
header->ack_num = EndianU32(ack_num);
|
||||
header->data_offset = (sizeof(CTCPHeader) / 4) << 4; // ???
|
||||
header->flags = flags;
|
||||
header->window_size = EndianU16(TCP_WINDOW_SIZE / 2);// TODO: What is window size supposed to be ?
|
||||
header->window_size = EndianU16(WINDOW_SIZE);// Window Size allocation data. Adjusted based on receive window.
|
||||
header->checksum = 0;
|
||||
header->urgent_pointer = 0;
|
||||
|
||||
|
@ -647,8 +647,8 @@ CTCPSocket TCPSocket(U16 domain=AF_UNSPEC)
|
|||
QueueInit(accept_queue); // init pending connection queue
|
||||
tcp_socket->accept_queue = accept_queue;
|
||||
|
||||
tcp_socket->receive_buffer_size = TCP_WINDOW_SIZE;
|
||||
tcp_socket->receive_buffer = CAlloc(TCP_WINDOW_SIZE);
|
||||
tcp_socket->receive_buffer_size = RECEIVE_BUFFER;
|
||||
tcp_socket->receive_buffer = CAlloc(RECEIVE_BUFFER);
|
||||
|
||||
tcp_socket->max_segment_size = TCP_MSS;
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ I64 TCPSocketConnect(CTCPSocket *tcp_socket, CSocketAddressStorage *address)
|
|||
}
|
||||
|
||||
tcp_socket->connection_time = tS;
|
||||
tcp_socket->receive_window = TCP_WINDOW_SIZE;
|
||||
tcp_socket->receive_window = RECEIVE_WINDOW;
|
||||
|
||||
tcp_socket->state = TCP_STATE_SYN_SENT;
|
||||
TCPSendFlags(tcp_socket, TCPF_SYN);
|
||||
|
@ -1165,7 +1165,7 @@ CTCPSocket *TCPSocketAccept(CTCPSocket *tcp_socket)
|
|||
|
||||
new_socket->next_recv_seq_num = ++pending->segment_seq_num;
|
||||
new_socket->connection_time = tS;
|
||||
new_socket->receive_window = TCP_WINDOW_SIZE;
|
||||
new_socket->receive_window = RECEIVE_WINDOW;
|
||||
new_socket->timeout = tcp_socket->timeout;
|
||||
|
||||
temp_addr = &tcp_socket->source_address;
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
#define FCS_LENGTH 4
|
||||
|
||||
/* Ethernet Frame Size.
|
||||
Linux uses 1544, OSDev and Shrine use 1548. Based on IEEE 802.3as, max frame size was agreed upon as 2000 bytes. */
|
||||
#define ETHERNET_FRAME_SIZE 2000
|
||||
Based on IEEE 802.3 layer 1 Ethernet Max Frame is 1542 according to wiki. 72-1530 frame octet + 12 IPG octet
|
||||
Default: 1538 | Vlan: 1542 | Jumbo: 9038 | JumboVlan: 9042 */
|
||||
#define ETHERNET_FRAME_SIZE 1542
|
||||
|
||||
// Max PayLoad standard: 1500 | Jumbo: 9000 for Gignet (fiber)
|
||||
#define ETHERNET_v2_MTU 1500
|
||||
|
||||
#define HTYPE_ETHERNET 1
|
||||
|
|
Loading…
Reference in a new issue