aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-09-07 18:34:37 +0200
committerHarald Welte <laforge@gnumonks.org>2011-09-07 21:40:00 +0200
commit4157bcb0671afb79eba093c1a500add008af4359 (patch)
treec72fd2ec3b6594200ae63eb750adb4752c3a17b8
parent0a527c9ee7f3497b49c64d1ba60bc4e4198a1158 (diff)
uRTP: allow vty configuration of batching factorzecke/mgcp-experiments
there's a new "compression batching <1-15>"
-rw-r--r--openbsc/include/openbsc/mgcp.h1
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c2
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c30
3 files changed, 31 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h
index 4bf9403cb..95115fbb0 100644
--- a/openbsc/include/openbsc/mgcp.h
+++ b/openbsc/include/openbsc/mgcp.h
@@ -121,6 +121,7 @@ struct mgcp_trunk_config {
struct mgcp_endpoint *endpoints;
enum { COMPR_NONE, COMPR_BTS, COMPR_NET } compress_dir;
+ unsigned int compress_batch;
};
struct mgcp_config {
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index c11f54d53..6483f982f 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -199,7 +199,7 @@ static int maybe_send_queue(struct mgcp_endpoint *endp,
int rc;
/* Queue up to four messages per endpoint */
- if (++endp->compr_queue_size != 4)
+ if (++endp->compr_queue_size < endp->tcfg->compress_batch)
return 0;
/* Allocate the outgoing data */
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 71c249cce..773500504 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -105,7 +105,9 @@ static int config_write_mgcp(struct vty *vty)
/* Compression */
vty_out(vty, " allow-compression %s%s",
mgcp_compr_name(g_cfg->trunk.compress_dir), VTY_NEWLINE);
-
+ if (g_cfg->trunk.compress_dir != COMPR_NONE)
+ vty_out(vty, " compression batching %u%s",
+ g_cfg->trunk.compress_batch, VTY_NEWLINE);
return CMD_SUCCESS;
}
@@ -405,6 +407,17 @@ DEFUN(cfg_mgcp_compr,
return CMD_SUCCESS;
}
+DEFUN(cfg_mgcp_compr_batch,
+ cfg_mgcp_compr_batch_cmd,
+ "compression batching <1-15>",
+ COMPR_STR)
+{
+ g_cfg->trunk.compress_batch = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
+
DEFUN(cfg_mgcp_trunk, cfg_mgcp_trunk_cmd,
"trunk <1-64>",
"Configure a SS7 trunk\n" "Trunk Nr\n")
@@ -490,6 +503,16 @@ DEFUN(cfg_trunk_compr,
return CMD_SUCCESS;
}
+DEFUN(cfg_trunk_compr_batch,
+ cfg_trunk_compr_batch_cmd,
+ "compression batching <1-4>",
+ COMPR_STR)
+{
+ struct mgcp_trunk_config *trunk = vty->index;
+ trunk->compress_batch = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(loop_endp,
loop_endp_cmd,
"loop-endpoint <0-64> NAME (0|1)",
@@ -660,6 +683,7 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_loop_cmd);
install_element(MGCP_NODE, &cfg_mgcp_number_endp_cmd);
install_element(MGCP_NODE, &cfg_mgcp_compr_cmd);
+ install_element(MGCP_NODE, &cfg_mgcp_compr_batch_cmd);
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);
install_node(&trunk_node, config_write_trunk);
@@ -670,6 +694,7 @@ int mgcp_vty_init(void)
install_element(TRUNK_NODE, &cfg_trunk_payload_name_cmd);
install_element(TRUNK_NODE, &cfg_trunk_loop_cmd);
install_element(TRUNK_NODE, &cfg_trunk_compr_cmd);
+ install_element(TRUNK_NODE, &cfg_trunk_compr_batch_cmd);
return 0;
}
@@ -734,6 +759,9 @@ static int allocate_trunk(struct mgcp_trunk_config *trunk)
}
}
+ /* default batching _if_ compression is enabled */
+ trunk->compress_batch = 4;
+
return 0;
}