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
This commit is contained in:
parent
d78ddab9ff
commit
61e4d2c4ac
|
@ -21,6 +21,8 @@ struct octoi_account {
|
|||
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 */
|
||||
|
|
|
@ -313,6 +313,13 @@ struct e1oip_line *e1oip_line_alloc(struct octoi_peer *peer)
|
|||
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);
|
||||
|
|
|
@ -83,6 +83,8 @@ static inline uint64_t iline_ctr_get_rate_1s(struct e1oip_line *iline, unsigned
|
|||
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);
|
||||
|
|
|
@ -122,6 +122,8 @@ 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);
|
||||
/* reset RIFO/FIFO etc. */
|
||||
e1oip_line_reset(st->peer->iline);
|
||||
iline_ctr_add(st->peer->iline, LINE_CTR_E1oIP_CONNECT_ACCEPT, 1);
|
||||
|
|
|
@ -242,6 +242,7 @@ DEFUN(show_clnt, show_clnt_cmd,
|
|||
llist_for_each_entry(clnt, &g_octoi->clients, list) {
|
||||
struct octoi_sock *sock = clnt->sock;
|
||||
|
||||
octoi_vty_show_one_account(vty, "", clnt->cfg.account);
|
||||
vty_show_octoi_sock(vty, sock);
|
||||
}
|
||||
|
||||
|
@ -278,6 +279,8 @@ void octoi_client_vty_init(void)
|
|||
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);
|
||||
|
|
|
@ -174,6 +174,8 @@ 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);
|
||||
/* reset RIFO/FIFO etc. */
|
||||
e1oip_line_reset(st->peer->iline);
|
||||
iline_ctr_add(st->peer->iline, LINE_CTR_E1oIP_CONNECT_ACCEPT, 1);
|
||||
|
|
|
@ -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"
|
||||
|
@ -63,6 +64,9 @@ static struct octoi_account *_account_create(void *ctx, const char *user_id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ac->batching_factor = DEFAULT_BATCHING_FACTOR;
|
||||
ac->prefill_frame_count = DEFAULT_PREFILL_FRAME_COUNT;
|
||||
|
||||
return ac;
|
||||
}
|
||||
|
||||
|
@ -367,6 +371,35 @@ DEFUN(cfg_account_redir, cfg_account_redir_cmd,
|
|||
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_show_one_account(struct vty *vty, const char *pfx, struct octoi_account *acc)
|
||||
{
|
||||
vty_out(vty, "%sAccount '%s': Mode=%s, Batching=%u, Prefill=%u%s", pfx,
|
||||
acc->user_id, get_value_string(octoi_account_mode_name, acc->mode),
|
||||
acc->batching_factor, acc->prefill_frame_count, VTY_NEWLINE);
|
||||
}
|
||||
|
||||
void octoi_vty_write_one_account(struct vty *vty, const struct octoi_account *acc)
|
||||
{
|
||||
if (!acc)
|
||||
|
@ -375,6 +408,10 @@ void octoi_vty_write_one_account(struct vty *vty, const struct octoi_account *ac
|
|||
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:
|
||||
|
@ -425,6 +462,7 @@ DEFUN(show_server, show_server_cmd,
|
|||
SHOW_STR "Display information about the OCTOI Server\n")
|
||||
{
|
||||
struct octoi_server *srv = g_octoi->server;
|
||||
struct octoi_account *acc;
|
||||
|
||||
if (!srv) {
|
||||
vty_out(vty, "%% No OCTOI server present%s", VTY_NEWLINE);
|
||||
|
@ -433,6 +471,9 @@ DEFUN(show_server, show_server_cmd,
|
|||
|
||||
vty_show_octoi_sock(vty, srv->sock);
|
||||
|
||||
llist_for_each_entry(acc, &srv->cfg.accounts, list)
|
||||
octoi_vty_show_one_account(vty, "", acc);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -446,6 +487,8 @@ void octoi_server_vty_init(void)
|
|||
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);
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
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);
|
||||
|
||||
void octoi_vty_show_one_account(struct vty *vty, const char *pfx, struct octoi_account *acc);
|
||||
void octoi_vty_write_one_account(struct vty *vty, const struct octoi_account *acc);
|
||||
|
||||
void vty_show_octoi_sock(struct vty *vty, struct octoi_sock *sock);
|
||||
|
|
Loading…
Reference in New Issue