From e56f701a043ea23bbdd2c512ee1511571bf9a96b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 26 May 2016 12:08:37 +0300 Subject: [PATCH] net: ip: Allow user to select number of network contexts The network context is similar concept as network socket. Depending on application use, the number of contexts can be now tweaked. Default value is now 2, it was 5 earlier. Using the lower number saves 241 bytes of memory. Change-Id: I6e2a9f053c8c63163af6d6175783233f67553ae9 Signed-off-by: Jukka Rissanen --- net/ip/Kconfig | 8 ++++++++ net/ip/net_context.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/net/ip/Kconfig b/net/ip/Kconfig index 8cb4863acb1..c98f8499a2d 100644 --- a/net/ip/Kconfig +++ b/net/ip/Kconfig @@ -71,6 +71,14 @@ config IP_TIMER_STACK_SIZE responsible for handling re-transmissions and periodic network packet sending like IPv6 router solicitations. +config NET_MAX_CONTEXTS + int "How many network context to use" + default 2 + help + The network context is similar concept as network socket. + It defines a network endpoint and number of context depends + on application usage. + choice prompt "Internet Protocol version" depends on NETWORKING diff --git a/net/ip/net_context.c b/net/ip/net_context.c index 82926565f4c..0b00a505333 100644 --- a/net/ip/net_context.c +++ b/net/ip/net_context.c @@ -80,7 +80,9 @@ struct net_context { }; /* Override this in makefile if needed */ -#ifndef NET_MAX_CONTEXT +#if defined(CONFIG_NET_MAX_CONTEXTS) +#define NET_MAX_CONTEXT CONFIG_NET_MAX_CONTEXTS +#else #define NET_MAX_CONTEXT 5 #endif