mirror of
https://github.com/SpinalHDL/VexRiscv.git
synced 2025-01-03 03:43:39 -05:00
Improve TCP sockets latency
This commit is contained in:
parent
9b9d9e2582
commit
cbc770deb3
4 changed files with 41 additions and 24 deletions
|
@ -129,28 +129,28 @@ object TopLevel {
|
|||
// portTlbSize = 4
|
||||
// )
|
||||
),
|
||||
// new DBusSimplePlugin(
|
||||
// catchAddressMisaligned = true,
|
||||
// catchAccessFault = true
|
||||
// ),
|
||||
new DBusCachedPlugin(
|
||||
config = new DataCacheConfig(
|
||||
cacheSize = 4096,
|
||||
bytePerLine = 32,
|
||||
wayCount = 1,
|
||||
addressWidth = 32,
|
||||
cpuDataWidth = 32,
|
||||
memDataWidth = 32,
|
||||
catchAccessError = true,
|
||||
catchIllegal = true,
|
||||
catchUnaligned = true,
|
||||
catchMemoryTranslationMiss = true
|
||||
),
|
||||
memoryTranslatorPortConfig = null
|
||||
// memoryTranslatorPortConfig = MemoryTranslatorPortConfig(
|
||||
// portTlbSize = 6
|
||||
// )
|
||||
new DBusSimplePlugin(
|
||||
catchAddressMisaligned = true,
|
||||
catchAccessFault = true
|
||||
),
|
||||
// new DBusCachedPlugin(
|
||||
// config = new DataCacheConfig(
|
||||
// cacheSize = 4096,
|
||||
// bytePerLine = 32,
|
||||
// wayCount = 1,
|
||||
// addressWidth = 32,
|
||||
// cpuDataWidth = 32,
|
||||
// memDataWidth = 32,
|
||||
// catchAccessError = true,
|
||||
// catchIllegal = true,
|
||||
// catchUnaligned = true,
|
||||
// catchMemoryTranslationMiss = true
|
||||
// ),
|
||||
// memoryTranslatorPortConfig = null
|
||||
//// memoryTranslatorPortConfig = MemoryTranslatorPortConfig(
|
||||
//// portTlbSize = 6
|
||||
//// )
|
||||
// ),
|
||||
new StaticMemoryTranslatorPlugin(
|
||||
ioRange = _(31 downto 28) === 0xF
|
||||
),
|
||||
|
@ -191,7 +191,8 @@ object TopLevel {
|
|||
earlyBranch = false,
|
||||
catchAddressMisaligned = true,
|
||||
prediction = DYNAMIC
|
||||
)
|
||||
),
|
||||
new YamlPlugin("cpu0")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ public:
|
|||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
/** Returns true on success, or false if there was an error */
|
||||
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
||||
|
@ -183,6 +184,14 @@ public:
|
|||
// 1) Internet domain 2) Stream socket 3) Default protocol (TCP in this case) //
|
||||
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
||||
assert(serverSocket != -1);
|
||||
int flag = 1;
|
||||
setsockopt( serverSocket, /* socket affected */
|
||||
IPPROTO_TCP, /* set option at TCP level */
|
||||
TCP_NODELAY, /* name of option */
|
||||
(char *) &flag, /* the cast is historical
|
||||
cruft */
|
||||
sizeof(int)); /* length of option value */
|
||||
|
||||
SetSocketBlockingEnabled(serverSocket,0);
|
||||
|
||||
|
||||
|
|
|
@ -630,6 +630,7 @@ public:
|
|||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
/** Returns true on success, or false if there was an error */
|
||||
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
||||
|
@ -671,7 +672,13 @@ public:
|
|||
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
||||
assert(serverSocket != -1);
|
||||
SetSocketBlockingEnabled(serverSocket,0);
|
||||
|
||||
int flag = 1;
|
||||
int result = setsockopt(serverSocket, /* socket affected */
|
||||
IPPROTO_TCP, /* set option at TCP level */
|
||||
TCP_NODELAY, /* name of option */
|
||||
(char *) &flag, /* the cast is historical
|
||||
cruft */
|
||||
sizeof(int)); /* length of option value */
|
||||
|
||||
//---- Configure settings of the server address struct ----//
|
||||
// Address family = Internet //
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
IBUS=IBUS_CACHED
|
||||
DBUS=DBUS_CACHED
|
||||
DBUS=DBUS_SIMPLE
|
||||
TRACE?=no
|
||||
TRACE_ACCESS?=no
|
||||
TRACE_START=0
|
||||
|
|
Loading…
Reference in a new issue