Skip to content

Renesas : Improve LWIP speed #7683

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

Merged
merged 2 commits into from
Sep 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions features/lwipstack/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@

#define LWIP_RAM_HEAP_POINTER lwip_ram_heap

// Number of simultaneously queued TCP segments.
#ifdef MBED_CONF_LWIP_MEMP_NUM_TCP_SEG
Copy link
Contributor

Choose a reason for hiding this comment

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

Why #ifdef

If we use Mbed compilation, these values always come from mbed_lib.json

Copy link
Contributor Author

@TomoYamanaka TomoYamanaka Aug 3, 2018

Choose a reason for hiding this comment

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

I think that there is no setting process in mbed_lib.json. However I'd like to set the customized value when coming from the mbed_lib.json and set the default value when not coming. Thus, I added #ifdef process to this file as with other elements.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is consistent with other settings - basically not setting it in the JSON lets lwIP do its own default, which sometimes is not a simple constant we could express in the JSON.

Or could we - I guess you could define something as "5 * TCP_MSS". Maybe we could put all lwIP's defaults in as explicit JSON? I think it was only really those derived values that put us off doing that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kjbracey-arm
Thank you for your comments, and may I ask you a bit?
What does "5 * TCP_MSS" indicate? is it related with the value of "tcp-snd-buf" and "tcp-wnd" ?
If so, I defined them as "8 * TCP_MSS"(is customize value for RZ/A1) in json file.

#define MEMP_NUM_TCP_SEG MBED_CONF_LWIP_MEMP_NUM_TCP_SEG
#endif

// TCP Maximum segment size.
#ifdef MBED_CONF_LWIP_TCP_MSS
#define TCP_MSS MBED_CONF_LWIP_TCP_MSS
#endif

// TCP sender buffer space (bytes).
#ifdef MBED_CONF_LWIP_TCP_SND_BUF
#define TCP_SND_BUF MBED_CONF_LWIP_TCP_SND_BUF
#endif

// TCP sender buffer space (bytes).
#ifdef MBED_CONF_LWIP_TCP_WND
#define TCP_WND MBED_CONF_LWIP_TCP_WND
#endif

// Number of pool pbufs.
// Each requires 684 bytes of RAM (if MSS=536 and PBUF_POOL_BUFSIZE defaulting to be based on MSS)
#ifdef MBED_CONF_LWIP_PBUF_POOL_SIZE
Expand Down
21 changes: 21 additions & 0 deletions features/lwipstack/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@
"help": "Maximum number of open UDPSocket instances allowed, including one used internally for DNS. Each requires 84 bytes of pre-allocated RAM",
"value": 4
},
"memp-num-tcp-seg": {
"help": "Number of simultaneously queued TCP segments. Current default (used if null here) is set to 16 in opt.h, unless overridden by target Ethernet drivers.",
"value": null
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could use default values here, instead of null to get rid of #ifdef in lwipopts.h

Copy link
Contributor Author

@TomoYamanaka TomoYamanaka Aug 3, 2018

Choose a reason for hiding this comment

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

I'd like to use the customized value(32) not default value(16) against this element for speeding up of RZ/A1. Thus by setting this element as null and overriding the value for RZ/A1 at following process, the other boards excepting RZ/A1 use default value and RZ/A1 use customized value.

},
"tcp-mss": {
"help": "TCP Maximum segment size. Current default (used if null here) is set to 536 in opt.h, unless overridden by target Ethernet drivers.",
"value": null
},
"tcp-snd-buf": {
"help": "TCP sender buffer space (bytes). Current default (used if null here) is set to (2 * TCP_MSS) in opt.h, unless overridden by target Ethernet drivers.",
"value": null
},
"tcp-wnd": {
"help": "TCP sender buffer space (bytes). Current default (used if null here) is set to (4 * TCP_MSS) in opt.h, unless overridden by target Ethernet drivers.",
"value": null
},
"pbuf-pool-size": {
"help": "Number of pbufs in pool - usually used for received packets, so this determines how much data can be buffered between reception and the application reading. If a driver uses PBUF_RAM for reception, less pool may be needed. Current default (used if null here) is set to 5 in lwipopts.h, unless overridden by target Ethernet drivers.",
"value": null
Expand Down Expand Up @@ -132,6 +148,11 @@
"tcpip-thread-stacksize": 1328,
"default-thread-stacksize": 640,
"ppp-thread-stacksize": 896,
"memp-num-tcp-seg": 32,
"tcp-mss": 1440,
"tcp-snd-buf": "(8 * TCP_MSS)",
"tcp-wnd": "(TCP_MSS * 8)",
"pbuf-pool-size": 16,
"mem-size": 51200
}
}
Expand Down