laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/28066 )


Change subject: e1oip: Make batching-factor and prefill-frame-count configurable
......................................................................

e1oip: Make batching-factor and prefill-frame-count configurable

This adds VTY commands at the 'account' level to configure those
settings.  They will only become active on the next [re]connect
of the line.

Change-Id: Ic455ef0ef82867db512e2ffdff24d9dd42d47eeb
---
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, 50 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/66/28066/1

diff --git a/include/osmocom/octoi/octoi.h b/include/osmocom/octoi/octoi.h
index e7ebcaa..c9fa3d5 100644
--- a/include/osmocom/octoi/octoi.h
+++ b/include/osmocom/octoi/octoi.h
@@ -21,6 +21,8 @@
        struct llist_head list;                         /* member in 
octoi_server.cfg.accounts */
        char *user_id;                                  /* user ID (IMSI) */
        enum octoi_account_mode mode;
+       uint8_t batching_factor;                        /* E1 frames per UDP 
packet (Tx) */
+       uint32_t prefill_frame_count;                   /* FIFO prefill/preseed 
count (Rx) */
        union {
                struct {
                        char *usb_serial;               /* USB serial string 
(ASCII) of icE1usb */
diff --git a/src/octoi/e1oip.c b/src/octoi/e1oip.c
index a577a92..c4bf054 100644
--- a/src/octoi/e1oip.c
+++ b/src/octoi/e1oip.c
@@ -313,6 +313,13 @@
        return iline;
 }

+void e1oip_line_configure(struct e1oip_line *iline, uint8_t batching_factor,
+                         uint32_t prefill_frame_count)
+{
+       iline->cfg.batching_factor = batching_factor;
+       iline->cfg.prefill_frame_count = prefill_frame_count;
+}
+
 void e1oip_line_reset(struct e1oip_line *iline)
 {
        frame_fifo_init(&iline->e1o.fifo, iline->cfg.batching_factor, 
fifo_threshold_cb, iline);
diff --git a/src/octoi/e1oip.h b/src/octoi/e1oip.h
index 2c88346..ccdebd5 100644
--- a/src/octoi/e1oip.h
+++ b/src/octoi/e1oip.h
@@ -83,6 +83,8 @@
 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);
 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 c4117d2..2ec5c8c 100644
--- a/src/octoi/octoi_clnt_fsm.c
+++ b/src/octoi/octoi_clnt_fsm.c
@@ -122,6 +122,8 @@
 {
        struct clnt_state *st = fi->priv;

+       e1oip_line_configure(st->peer->iline, st->acc->batching_factor,
+                            st->acc->prefill_frame_count);
        /* 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 756cc9a..26724ce 100644
--- a/src/octoi/octoi_clnt_vty.c
+++ b/src/octoi/octoi_clnt_vty.c
@@ -278,6 +278,8 @@
        install_element(OCTOI_CLNT_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd);
        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_prefill_frame_count_cmd);

        install_node(&clnt_node, config_write_octoi_clnt);
        install_element(CONFIG_NODE, &cfg_client_cmd);
diff --git a/src/octoi/octoi_srv_fsm.c b/src/octoi/octoi_srv_fsm.c
index 1af3805..469436e 100644
--- a/src/octoi/octoi_srv_fsm.c
+++ b/src/octoi/octoi_srv_fsm.c
@@ -174,6 +174,8 @@
 {
        struct srv_state *st = fi->priv;

+       e1oip_line_configure(st->peer->iline, st->acc->batching_factor,
+                            st->acc->prefill_frame_count);
        /* 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 f616af5..2719e6b 100644
--- a/src/octoi/octoi_srv_vty.c
+++ b/src/octoi/octoi_srv_vty.c
@@ -34,6 +34,7 @@
 #include <osmocom/vty/stats.h>
 #include <osmocom/vty/misc.h>

+#include "e1oip.h"
 #include "octoi.h"
 #include "octoi_sock.h"
 #include "octoi_fsm.h"
@@ -88,6 +89,8 @@
        clnt->cfg.account = ac;

        ac->mode = ACCOUNT_MODE_ICE1USB;
+       ac->batching_factor = DEFAULT_BATCHING_FACTOR;
+       ac->prefill_frame_count = DEFAULT_PREFILL_FRAME_COUNT;

        return ac;
 }
@@ -367,6 +370,28 @@
        return CMD_SUCCESS;
 }

+gDEFUN(cfg_account_batching_factor, cfg_account_batching_factor_cmd,
+       "batching-factor <1-256>",
+       "E1oIP batching factor (E1 frames per Tx UDP packet)\n"
+       "E1oIP batching factor (E1 frames per Tx UDP packet)\n")
+{
+       struct octoi_account *acc = vty->index;
+
+       acc->batching_factor = atoi(argv[0]);
+       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"
+       "Number of E1 frames to pre-fill/pre-seed in Rx RIFO\n")
+{
+       struct octoi_account *acc = vty->index;
+
+       acc->prefill_frame_count = atoi(argv[0]);
+       return CMD_SUCCESS;
+}
+
 void octoi_vty_write_one_account(struct vty *vty, const struct octoi_account 
*acc)
 {
        if (!acc)
@@ -375,6 +400,10 @@
        vty_out(vty, " account %s%s", acc->user_id, VTY_NEWLINE);
        vty_out(vty, "  mode %s%s", get_value_string(octoi_account_mode_name, 
acc->mode),
                VTY_NEWLINE);
+       if (acc->batching_factor != DEFAULT_BATCHING_FACTOR)
+               vty_out(vty, "  batching-factor %u%s", acc->batching_factor, 
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);

        switch (acc->mode) {
        case ACCOUNT_MODE_NONE:
@@ -446,6 +475,8 @@
        install_element(OCTOI_ACCOUNT_NODE, &cfg_account_ice1_serno_cmd);
        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_prefill_frame_count_cmd);

        install_node(&srv_node, config_write_octoi_srv);
        install_element(CONFIG_NODE, &cfg_server_cmd);
diff --git a/src/octoi/octoi_vty.h b/src/octoi/octoi_vty.h
index 6f18802..4678c82 100644
--- a/src/octoi/octoi_vty.h
+++ b/src/octoi/octoi_vty.h
@@ -7,6 +7,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_prefill_frame_count_cmd;

 struct octoi_account *octoi_client_account_create(struct octoi_client *clnt, 
const char *user_id);


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/28066
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: Ic455ef0ef82867db512e2ffdff24d9dd42d47eeb
Gerrit-Change-Number: 28066
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-MessageType: newchange

Reply via email to