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
|
// portTlbSize = 4
|
||||||
// )
|
// )
|
||||||
),
|
),
|
||||||
// new DBusSimplePlugin(
|
new DBusSimplePlugin(
|
||||||
// catchAddressMisaligned = true,
|
catchAddressMisaligned = true,
|
||||||
// catchAccessFault = 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 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(
|
new StaticMemoryTranslatorPlugin(
|
||||||
ioRange = _(31 downto 28) === 0xF
|
ioRange = _(31 downto 28) === 0xF
|
||||||
),
|
),
|
||||||
|
@ -191,7 +191,8 @@ object TopLevel {
|
||||||
earlyBranch = false,
|
earlyBranch = false,
|
||||||
catchAddressMisaligned = true,
|
catchAddressMisaligned = true,
|
||||||
prediction = DYNAMIC
|
prediction = DYNAMIC
|
||||||
)
|
),
|
||||||
|
new YamlPlugin("cpu0")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ public:
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
|
||||||
/** Returns true on success, or false if there was an error */
|
/** Returns true on success, or false if there was an error */
|
||||||
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
||||||
|
@ -183,6 +184,14 @@ public:
|
||||||
// 1) Internet domain 2) Stream socket 3) Default protocol (TCP in this case) //
|
// 1) Internet domain 2) Stream socket 3) Default protocol (TCP in this case) //
|
||||||
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
assert(serverSocket != -1);
|
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);
|
SetSocketBlockingEnabled(serverSocket,0);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -630,6 +630,7 @@ public:
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
|
||||||
/** Returns true on success, or false if there was an error */
|
/** Returns true on success, or false if there was an error */
|
||||||
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
bool SetSocketBlockingEnabled(int fd, bool blocking)
|
||||||
|
@ -671,7 +672,13 @@ public:
|
||||||
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
serverSocket = socket(PF_INET, SOCK_STREAM, 0);
|
||||||
assert(serverSocket != -1);
|
assert(serverSocket != -1);
|
||||||
SetSocketBlockingEnabled(serverSocket,0);
|
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 ----//
|
//---- Configure settings of the server address struct ----//
|
||||||
// Address family = Internet //
|
// Address family = Internet //
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
IBUS=IBUS_CACHED
|
IBUS=IBUS_CACHED
|
||||||
DBUS=DBUS_CACHED
|
DBUS=DBUS_SIMPLE
|
||||||
TRACE?=no
|
TRACE?=no
|
||||||
TRACE_ACCESS?=no
|
TRACE_ACCESS?=no
|
||||||
TRACE_START=0
|
TRACE_START=0
|
||||||
|
|
Loading…
Reference in a new issue