Commit 90c7f385 authored by Alessandro Rubini's avatar Alessandro Rubini

move MAX_LINKS to constants.h, raise to 64

If we run both Ethernet and UDP services in a 18-port switch, we need
36 logical links. Thus, increase the previous limit of 32 to 64,
knowing we have no serious memory constraints in hosted environments.

The definition is moved to <ppsi/constants.h> as implementation-specific.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 83279431
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
CONST_VERBOSITY int pp_diag_verbosity = 0; CONST_VERBOSITY int pp_diag_verbosity = 0;
/* FIXME: make MAX_LINKS and conf_path definable at compile time */ /* FIXME: make conf_path definable at compile time */
#define MAX_LINKS 32
#define CONF_PATH "/etc/ppsi.conf" #define CONF_PATH "/etc/ppsi.conf"
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -45,7 +44,7 @@ int main(int argc, char **argv) ...@@ -45,7 +44,7 @@ int main(int argc, char **argv)
if (!ppg) if (!ppg)
exit(__LINE__); exit(__LINE__);
ppg->max_links = MAX_LINKS; ppg->max_links = PP_MAX_LINKS;
ppg->links = calloc(ppg->max_links, sizeof(struct pp_link)); ppg->links = calloc(ppg->max_links, sizeof(struct pp_link));
f = fopen(CONF_PATH, "r"); f = fopen(CONF_PATH, "r");
......
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
CONST_VERBOSITY int pp_diag_verbosity = 0; CONST_VERBOSITY int pp_diag_verbosity = 0;
/* FIXME: make MAX_LINKS and conf_path definable at compile time */ /* FIXME: make conf_path definable at compile time */
#define MAX_LINKS 32
#define CONF_PATH "/etc/ppsi.conf" #define CONF_PATH "/etc/ppsi.conf"
struct minipc_ch *hal_ch; struct minipc_ch *hal_ch;
...@@ -65,7 +64,7 @@ int main(int argc, char **argv) ...@@ -65,7 +64,7 @@ int main(int argc, char **argv)
if (!ppg) if (!ppg)
exit(__LINE__); exit(__LINE__);
ppg->max_links = MAX_LINKS; ppg->max_links = PP_MAX_LINKS;
ppg->links = calloc(ppg->max_links, sizeof(struct pp_link)); ppg->links = calloc(ppg->max_links, sizeof(struct pp_link));
conf_fd = open(CONF_PATH, O_RDONLY); conf_fd = open(CONF_PATH, O_RDONLY);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define PP_NSEC_PER_SEC (1000*1000*1000) #define PP_NSEC_PER_SEC (1000*1000*1000)
/* implementation specific constants */ /* implementation specific constants */
#define PP_MAX_LINKS 64
#define PP_DEFAULT_INBOUND_LATENCY 0 /* in nsec */ #define PP_DEFAULT_INBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_OUTBOUND_LATENCY 0 /* in nsec */ #define PP_DEFAULT_OUTBOUND_LATENCY 0 /* in nsec */
#define PP_DEFAULT_NO_RESET_CLOCK 0 #define PP_DEFAULT_NO_RESET_CLOCK 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment