laforge has uploaded this change for review.
octoi: Add force-send-all-ts mode
This new mode (can be enabled per account) will force the E1OIP
protocol to always send all timeslots, i.e. not do any of the
suppression of timeslots that do not exhibit any change to the
previous E1 frame.
Change-Id: I6d17d3829b2c1c62e701a1d8c021d93d93593613
---
M include/osmocom/octoi/octoi.h
M src/octoi/e1oip.c
M src/octoi/e1oip.h
M src/octoi/octoi_clnt_fsm.c
M src/octoi/octoi_clnt_vty.c
M src/octoi/octoi_srv_fsm.c
M src/octoi/octoi_srv_vty.c
M src/octoi/octoi_vty.h
8 files changed, 59 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/49/34149/1
diff --git a/include/osmocom/octoi/octoi.h b/include/osmocom/octoi/octoi.h
index fddee41..645af3f 100644
--- a/include/osmocom/octoi/octoi.h
+++ b/include/osmocom/octoi/octoi.h
@@ -22,6 +22,7 @@
char *user_id; /* user ID (IMSI) */
enum octoi_account_mode mode;
uint8_t batching_factor; /* E1 frames per UDP packet (Tx) */
+ bool force_send_all_ts; /* force transmission of all timeslots */
uint32_t prefill_frame_count; /* FIFO prefill/preseed count (Rx) */
union {
struct {
diff --git a/src/octoi/e1oip.c b/src/octoi/e1oip.c
index c4bf054..85dd165 100644
--- a/src/octoi/e1oip.c
+++ b/src/octoi/e1oip.c
@@ -119,12 +119,16 @@
}
iline_stat_set(iline, LINE_STAT_E1oIP_E1O_FIFO, frame_fifo_frames(&iline->e1o.fifo));
- /* then compute the ts_mask */
- for (i = 0, ref_frame = iline->e1o.last_frame; i < n_frames; i++, ref_frame = buf[i-1]) {
- /* FIXME: what to do about TS0? */
- for (unsigned int j = 1; j < BYTES_PER_FRAME; j++) {
- if (buf[i][j] != ref_frame[j])
- ts_mask |= (1U << j);
+ if (iline->cfg.force_send_all_ts) {
+ ts_mask = 0xfffffffe;
+ } else {
+ /* then compute the ts_mask */
+ for (i = 0, ref_frame = iline->e1o.last_frame; i < n_frames; i++, ref_frame = buf[i-1]) {
+ /* FIXME: what to do about TS0? */
+ for (unsigned int j = 1; j < BYTES_PER_FRAME; j++) {
+ if (buf[i][j] != ref_frame[j])
+ ts_mask |= (1U << j);
+ }
}
}
eith->ts_mask = htonl(ts_mask);
@@ -314,10 +318,11 @@
}
void e1oip_line_configure(struct e1oip_line *iline, uint8_t batching_factor,
- uint32_t prefill_frame_count)
+ uint32_t prefill_frame_count, bool force_send_all_ts)
{
iline->cfg.batching_factor = batching_factor;
iline->cfg.prefill_frame_count = prefill_frame_count;
+ iline->cfg.force_send_all_ts = force_send_all_ts;
}
void e1oip_line_reset(struct e1oip_line *iline)
diff --git a/src/octoi/e1oip.h b/src/octoi/e1oip.h
index ccdebd5..9357d48 100644
--- a/src/octoi/e1oip.h
+++ b/src/octoi/e1oip.h
@@ -53,6 +53,7 @@
struct {
uint8_t batching_factor;
uint32_t prefill_frame_count;
+ bool force_send_all_ts;
} cfg;
/* E1 originated side (E1->IP) */
@@ -84,7 +85,7 @@
void e1oip_line_set_name(struct e1oip_line *line, const char *name);
void e1oip_line_reset(struct e1oip_line *iline);
void e1oip_line_configure(struct e1oip_line *iline, uint8_t batching_factor,
- uint32_t prefill_frame_count);
+ uint32_t prefill_frame_count, bool force_send_all_ts);
void e1oip_line_destroy(struct e1oip_line *iline);
int e1oip_rcvmsg_tdm_data(struct e1oip_line *iline, struct msgb *msg);
diff --git a/src/octoi/octoi_clnt_fsm.c b/src/octoi/octoi_clnt_fsm.c
index 2ec5c8c..2bfc8f9 100644
--- a/src/octoi/octoi_clnt_fsm.c
+++ b/src/octoi/octoi_clnt_fsm.c
@@ -123,7 +123,7 @@
struct clnt_state *st = fi->priv;
e1oip_line_configure(st->peer->iline, st->acc->batching_factor,
- st->acc->prefill_frame_count);
+ st->acc->prefill_frame_count, st->acc->force_send_all_ts);
/* reset RIFO/FIFO etc. */
e1oip_line_reset(st->peer->iline);
iline_ctr_add(st->peer->iline, LINE_CTR_E1oIP_CONNECT_ACCEPT, 1);
diff --git a/src/octoi/octoi_clnt_vty.c b/src/octoi/octoi_clnt_vty.c
index c7c2482..54ed60f 100644
--- a/src/octoi/octoi_clnt_vty.c
+++ b/src/octoi/octoi_clnt_vty.c
@@ -280,6 +280,8 @@
install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_line_cmd);
install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_mode_cmd);
install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_batching_factor_cmd);
+ install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd);
+ install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd);
install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd);
#ifdef HAVE_DAHDI_TRUNKDEV
install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd);
diff --git a/src/octoi/octoi_srv_fsm.c b/src/octoi/octoi_srv_fsm.c
index ed9e8f9..b6914b7 100644
--- a/src/octoi/octoi_srv_fsm.c
+++ b/src/octoi/octoi_srv_fsm.c
@@ -176,7 +176,7 @@
struct srv_state *st = fi->priv;
e1oip_line_configure(st->peer->iline, st->acc->batching_factor,
- st->acc->prefill_frame_count);
+ st->acc->prefill_frame_count, st->acc->force_send_all_ts);
/* reset RIFO/FIFO etc. */
e1oip_line_reset(st->peer->iline);
iline_ctr_add(st->peer->iline, LINE_CTR_E1oIP_CONNECT_ACCEPT, 1);
diff --git a/src/octoi/octoi_srv_vty.c b/src/octoi/octoi_srv_vty.c
index 67c4eb6..4fc4e47 100644
--- a/src/octoi/octoi_srv_vty.c
+++ b/src/octoi/octoi_srv_vty.c
@@ -391,6 +391,26 @@
return CMD_SUCCESS;
}
+gDEFUN(cfg_account_force_all_ts, cfg_account_force_all_ts_cmd,
+ "force-all-ts",
+ "Force transmission of all TS all the time\n")
+{
+ struct octoi_account *acc = vty->index;
+
+ acc->force_send_all_ts = true;
+ return CMD_SUCCESS;
+}
+
+gDEFUN(cfg_account_no_force_all_ts, cfg_account_no_force_all_ts_cmd,
+ "no force-all-ts",
+ NO_STR "Don't force transmission of all TS all the time\n")
+{
+ struct octoi_account *acc = vty->index;
+
+ acc->force_send_all_ts = false;
+ return CMD_SUCCESS;
+}
+
gDEFUN(cfg_account_prefill_frame_count, cfg_account_prefill_frame_count_cmd,
"prefill-frame-count <0-8000>",
"Number of E1 frames to pre-fill/pre-seed in Rx RIFO\n"
@@ -455,6 +475,8 @@
VTY_NEWLINE);
if (acc->batching_factor != DEFAULT_BATCHING_FACTOR)
vty_out(vty, " batching-factor %u%s", acc->batching_factor, VTY_NEWLINE);
+ if (acc->force_send_all_ts)
+ vty_out(vty, " force-all-ts%s", VTY_NEWLINE);
if (acc->prefill_frame_count != DEFAULT_PREFILL_FRAME_COUNT)
vty_out(vty, " prefill-frame-count %u%s", acc->prefill_frame_count, VTY_NEWLINE);
@@ -538,6 +560,8 @@
install_element(OCTOI_ACCOUNT_NODE, &cfg_account_ice1_line_cmd);
install_element(OCTOI_ACCOUNT_NODE, &cfg_account_redir_cmd);
install_element(OCTOI_ACCOUNT_NODE, &cfg_account_batching_factor_cmd);
+ install_element(OCTOI_ACCOUNT_NODE, &cfg_account_force_all_ts_cmd);
+ install_element(OCTOI_ACCOUNT_NODE, &cfg_account_no_force_all_ts_cmd);
install_element(OCTOI_ACCOUNT_NODE, &cfg_account_prefill_frame_count_cmd);
#ifdef HAVE_DAHDI_TRUNKDEV
install_element(OCTOI_ACCOUNT_NODE, &cfg_account_trunkdev_name_cmd);
diff --git a/src/octoi/octoi_vty.h b/src/octoi/octoi_vty.h
index 33188e4..55fa7fe 100644
--- a/src/octoi/octoi_vty.h
+++ b/src/octoi/octoi_vty.h
@@ -8,6 +8,8 @@
extern struct cmd_element cfg_account_ice1_serno_cmd;
extern struct cmd_element cfg_account_ice1_line_cmd;
extern struct cmd_element cfg_account_batching_factor_cmd;
+extern struct cmd_element cfg_account_force_all_ts_cmd;
+extern struct cmd_element cfg_account_no_force_all_ts_cmd;
extern struct cmd_element cfg_account_prefill_frame_count_cmd;
extern struct cmd_element cfg_account_trunkdev_name_cmd;
extern struct cmd_element cfg_account_trunkdev_line_cmd;
To view, visit change 34149. To unsubscribe, or for help writing mail filters, visit settings.