net: Allow user to tweak IP fibers stack sizes from Kconfig

User is able to tweak the stack sizes of RX, TX and timer
fibers. These fibers are responsible for receival, transmission
and re-transmission of IP network packets.

Change-Id: I43238180e628ed47f431ece0bc6dfcdfb035325f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2016-02-11 10:44:52 +02:00 committed by Gerrit Code Review
commit 5ae183a403
2 changed files with 43 additions and 6 deletions

View file

@ -46,6 +46,31 @@ config IP_BUF_TX_SIZE
Each network buffer will contain one sent IPv6 or IPv4 packet.
Each buffer will occupy 1280 bytes of memory.
config IP_RX_STACK_SIZE
int "RX fiber stack size"
default 1024
help
Set the RX fiber stack size in bytes. The RX fiber is waiting
network packets from lower level bearers. It will then run the
packet through IP stack which validates the packet and passes
it eventually to application.
config IP_TX_STACK_SIZE
int "TX fiber stack size"
default 1024
help
Set the TX fiber stack size in bytes. The TX fiber is waiting
data from application. It will then validate the data and push
it to network driver to be sent out.
config IP_TIMER_STACK_SIZE
int "Timer fiber stack size"
default 1536
help
Set the timer fiber stack size in bytes. The timer fiber is
responsible for handling re-transmissions and periodic network
packet sending like IPv6 router solicitations.
choice
prompt "Internet Protocol version"
depends on NETWORKING

View file

@ -68,9 +68,18 @@ void net_context_set_receiver_registered(struct net_context *context);
* FIXME: stack size needs fine-tuning
*/
#define STACKSIZE_UNIT 1024
static char __noinit __stack rx_fiber_stack[STACKSIZE_UNIT * 1];
static char __noinit __stack tx_fiber_stack[STACKSIZE_UNIT * 1];
static char __noinit __stack timer_fiber_stack[STACKSIZE_UNIT * 3 / 2];
#ifndef CONFIG_IP_RX_STACK_SIZE
#define CONFIG_IP_RX_STACK_SIZE (STACKSIZE_UNIT * 1)
#endif
#ifndef CONFIG_IP_TX_STACK_SIZE
#define CONFIG_IP_TX_STACK_SIZE (STACKSIZE_UNIT * 1)
#endif
#ifndef CONFIG_IP_TIMER_STACK_SIZE
#define CONFIG_IP_TIMER_STACK_SIZE (STACKSIZE_UNIT * 3 / 2)
#endif
static char __noinit __stack rx_fiber_stack[CONFIG_IP_RX_STACK_SIZE];
static char __noinit __stack tx_fiber_stack[CONFIG_IP_TX_STACK_SIZE];
static char __noinit __stack timer_fiber_stack[CONFIG_IP_TIMER_STACK_SIZE];
static struct net_dev {
/* Queue for incoming packets from driver */
@ -574,7 +583,8 @@ static int check_and_send_packet(struct net_buf *buf)
static void net_tx_fiber(void)
{
NET_DBG("Starting TX fiber\n");
NET_DBG("Starting TX fiber (stack %d bytes)\n",
sizeof(tx_fiber_stack));
while (1) {
struct net_buf *buf;
@ -621,7 +631,8 @@ static void net_rx_fiber(void)
{
struct net_buf *buf;
NET_DBG("Starting RX fiber\n");
NET_DBG("Starting RX fiber (stack %d bytes)\n",
sizeof(rx_fiber_stack));
while (1) {
buf = nano_fifo_get(&netdev.rx_queue, TICKS_UNLIMITED);
@ -653,7 +664,8 @@ static void net_timer_fiber(void)
{
clock_time_t next_wakeup;
NET_DBG("Starting net timer fiber\n");
NET_DBG("Starting net timer fiber (stack %d bytes)\n",
sizeof(timer_fiber_stack));
while (1) {
/* Run various timers */