Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lwip echoserver #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Lwip echoserver #25

wants to merge 4 commits into from

Conversation

lucypa
Copy link

@lucypa lucypa commented Mar 18, 2022

This is a simple 2 component echo server with a driver in one address space and the network stack and echo server in the other. This has been benchmarked and tested on the imx8mm-evk and Haswell3 systems.
Corresponding PRs are:

Test with: seL4/global-components#33, seL4/projects_libs#15, seL4/util_libs#126

@axel-h
Copy link
Member

axel-h commented Mar 18, 2022

I've added the "Test with:" in the description, so the github CI run will use these PRs.

find_package(projects_libs REQUIRED)

set(CAmkESCPP ON CACHE BOOL "" FORCE)
if("${KernelArch}" STREQUAL "x86")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just use the boolean flags

Suggested change
if("${KernelArch}" STREQUAL "x86")
if(KernelArchARM)
...
elseif(KernelArchX86)
...

set(cpp_define -DKernelArchX86)
elseif("${KernelArch}" STREQUAL "arm")
set(cpp_define -DKernelArchArm)
endif()
Copy link
Member

@axel-h axel-h Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's give it a clear error message here for anything else and avoid potentially undefined default behavior

else()
    message(FATAL_ERROR "Unsupported architecture: '${KernelArch}'.")
endif()

LIBS
${libs}
LD_FLAGS
-Wl,--section-start=.note.gnu.build-id=0x400920
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It this just a copy paste from somewhere? Maybe add a comment about this, that this is just optional to set a specific build ID. The kernel is using -Wl,--build-id=none" # Ensure reproducible builds here.

#define TX_BUFS 510
#define RX_BUFS 510

/* Size used for ethernet buffers */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PLease add the note again that this is the next 2^n for the 1500 byte MTU. I assume that this buffer size is independent of the buffer size that ius set it the other PRs, might be good to mention this in the comment also, so it's clear there are not pitfalls in here.

/* Maximum connected TCP clients */
#define MAX_TCP_CLIENTS 5

/* Size of initial TCP socket reads */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note why exactly this value is chosen? Is it random or related to TCP headers?

/* Size of initial TCP socket reads */
#define TCP_READ_SIZE 1400

/* Max size of UDP socket reads */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, is it random or related to UDP headers?

#define DMA_ALLOC_SIZE (DMA_RING_ALLOC_SIZE + BUF_SIZE * (TX_BUFS + RX_BUFS))


/* Heap size */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment how the heap is used, so there is a rough explanation what influcenses this?

attribute int cnode_size_bits = 12;
attribute int simple_untyped20_pool = 2;
attribute int promiscuous_mode = 1;
attribute int heap_size = 0x10000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here what drives this heap size?

emits FDT resource;
}

component LWIPServer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, is there a way to have one common generic CAmkES file with the server that includes the platform specific driver files? So this can be extended to other platforms easily without copy/pasting common things?


# This application only works on hardware at the moment, not simulation
# set(SIMULATION OFF CACHE BOOL "" FORCE)
if("${KernelArch}" STREQUAL "x86")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if("${KernelArch}" STREQUAL "x86")
if(KernelArchX86)

set(KernelIOMMU ON CACHE BOOL "" FORCE)
endif()

set(cpp_define -DKernelArchArm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be set only for KernelArchARM - if this must be set at all?


static ps_io_ops_t *ops;

static int peer_id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsigned int?

#include <echo/tuning_params.h>

component LWIPServer {
include "lwipserver.h";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this include? It causes a lot of compiler errors and removing it seems to fix them.

@kent-mcleod
Copy link
Member

I was able to successfully test this with imx8mm, but not able to yet with x86_64. Are there any special configuration options required for x86_64?

@lucypa lucypa force-pushed the lwip_echoserver branch from 20c75d4 to 68b8225 Compare April 4, 2022 02:10
@lucypa
Copy link
Author

lucypa commented Apr 4, 2022

@kent-mcleod Yes sorry i was missing one patch. It should work now with normal configurations with KernelExportPMCUser on.

@@ -35,7 +34,7 @@ DeclareCAmkESComponent(
LIBS
${libs}
LD_FLAGS
-Wl,--section-start=.note.gnu.build-id=0x400920
-Wl,--section-start=.note.gnu.build-id=0x400920 #Ensure reproducible build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does 0x400920 have an meaning actually or could this be simply "1" also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants