aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2023-08-14 00:17:18 +0200
committerHarald Welte <laforge@osmocom.org>2023-08-14 07:54:10 +0200
commitb7c963f209a81951126042d02194960c9082545d (patch)
tree63f6f234710827ab33c4a8f63e4fca488506e402 /src
parentf07d38a6eb3d6cd999221a0b16a45fa7149c33b5 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/octoi/e1oip.c19
-rw-r--r--src/octoi/e1oip.h3
-rw-r--r--src/octoi/octoi_clnt_fsm.c2
-rw-r--r--src/octoi/octoi_clnt_vty.c2
-rw-r--r--src/octoi/octoi_srv_fsm.c2
-rw-r--r--src/octoi/octoi_srv_vty.c24
-rw-r--r--src/octoi/octoi_vty.h2
7 files changed, 44 insertions, 10 deletions
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 @@ static void fifo_threshold_cb(struct frame_fifo *fifo, unsigned int frames, void
}
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 @@ struct e1oip_line *e1oip_line_alloc(struct octoi_peer *peer)
}
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 e1oip_line {
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 @@ struct e1oip_line *e1oip_line_alloc(struct octoi_peer *peer);
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 @@ static void clnt_st_accepted_onenter(struct osmo_fsm_inst *fi, uint32_t prev_sta
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 @@ void octoi_client_vty_init(void)
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 @@ static void srv_st_accepted_onenter(struct osmo_fsm_inst *fi, uint32_t prev_stat
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 @@ gDEFUN(cfg_account_batching_factor, cfg_account_batching_factor_cmd,
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 @@ void octoi_vty_write_one_account(struct vty *vty, const struct octoi_account *ac
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 @@ void octoi_server_vty_init(void)
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_mode_cmd;
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;