From 8b761a34190656884409bd61d0b0483ed0f14898 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 20 Jul 2012 21:50:31 +0200 Subject: [PATCH] VTY: Added option to force given CS and ignore the scheme given by BTS --- src/gprs_rlcmac.h | 7 +++- src/pcu_l1_if.cpp | 10 +++--- src/pcu_vty.c | 85 ++++++++++++++++++++++++++++++++++++----------- 3 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index ce278796..42439e2e 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -20,6 +20,7 @@ #ifndef GPRS_RLCMAC_H #define GPRS_RLCMAC_H +#ifdef __cplusplus #include #include #include @@ -28,6 +29,7 @@ extern "C" { #include #include } +#endif /* This special feature will delay assignment of downlink TBF by one second, * in case there is already a TBF. @@ -63,6 +65,7 @@ struct gprs_rlcmac_bts { uint8_t cs3; uint8_t cs4; uint8_t initial_cs; + uint8_t force_cs; /* 0=use from BTS 1=use from VTY */ uint8_t t3142; uint8_t t3169; uint8_t t3191; @@ -79,6 +82,7 @@ struct gprs_rlcmac_bts { extern struct gprs_rlcmac_bts *gprs_rlcmac_bts; +#ifdef __cplusplus /* * TBF instance */ @@ -149,7 +153,7 @@ struct gprs_rlcmac_tbf { uint8_t llc_frame[LLC_MAX_LEN]; /* current DL or UL frame */ uint16_t llc_index; /* current write/read position of frame */ uint16_t llc_length; /* len of current DL LLC_frame, 0 == no frame */ - llist_head llc_queue; /* queued LLC DL data */ + struct llist_head llc_queue; /* queued LLC DL data */ enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state; enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state; @@ -319,5 +323,6 @@ struct gprs_rlcmac_paging *gprs_rlcmac_dequeue_paging( struct msgb *gprs_rlcmac_send_packet_paging_request( struct gprs_rlcmac_pdch *pdch); +#endif #endif // GPRS_RLCMAC_H diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 00030d66..e5fbad98 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -374,10 +374,12 @@ bssgp_failed: bts->n3103 = info_ind->n3103; bts->n3105 = info_ind->n3105; } - if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4) - bts->initial_cs = 1; - else - bts->initial_cs = info_ind->initial_cs; + if (!bts->force_cs) { + if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4) + bts->initial_cs = 1; + else + bts->initial_cs = info_ind->initial_cs; + } for (trx = 0; trx < 8; trx++) { bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 7e8af43b..179080bb 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -1,27 +1,18 @@ /* OsmoBTS VTY interface */ -#include -#include -#include -#include -#include -#include -#include +#include #include - -#include - - +#include #include "pcu_vty.h" - +#include "gprs_rlcmac.h" enum node_type pcu_vty_go_parent(struct vty *vty) { switch (vty->node) { #if 0 case TRX_NODE: - vty->node = BTS_NODE; + vty->node = PCU_NODE; { struct gsm_bts_trx *trx = vty->index; vty->index = trx->bts; @@ -31,29 +22,32 @@ enum node_type pcu_vty_go_parent(struct vty *vty) default: vty->node = CONFIG_NODE; } - return vty->node; + return (enum node_type) vty->node; } int pcu_vty_is_config_node(struct vty *vty, int node) { switch (node) { -#if 0 - case TRX_NODE: - case BTS_NODE: + case PCU_NODE: return 1; -#endif default: return 0; } } +static struct cmd_node pcu_node = { + (enum node_type) PCU_NODE, + "%s(pcu)#", + 1, +}; + gDEFUN(ournode_exit, ournode_exit_cmd, "exit", "Exit current node, go down to provious node") { switch (vty->node) { #if 0 case TRXV_NODE: - vty->node = BTS_NODE; + vty->node = PCU_NODE; { struct gsm_bts_trx *trx = vty->index; vty->index = trx->bts; @@ -80,6 +74,52 @@ gDEFUN(ournode_end, ournode_end_cmd, "end", return CMD_SUCCESS; } +static int config_write_pcu(struct vty *vty) +{ + struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; + + vty_out(vty, "pcu%s", VTY_NEWLINE); + if (bts->force_cs) + vty_out(vty, " cs %d%s", bts->initial_cs, VTY_NEWLINE); +} + +/* per-BTS configuration */ +DEFUN(cfg_pcu, + cfg_pcu_cmd, + "pcu", + "BTS specific configure") +{ + vty->node = PCU_NODE; + + return CMD_SUCCESS; +} + +DEFUN(cfg_pcu_cs, + cfg_pcu_cs_cmd, + "cs <1-4>", + "Set the Coding Scheme to be used, (overrides BTS config)\n") +{ + struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; + uint8_t cs = atoi(argv[0]); + + bts->force_cs = 1; + bts->initial_cs = cs; + + return CMD_SUCCESS; +} + +DEFUN(cfg_pcu_no_cs, + cfg_pcu_no_cs_cmd, + "no cs", + NO_STR "Don't force given Coding Scheme, (use BTS config)\n") +{ + struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts; + + bts->force_cs = 0; + + return CMD_SUCCESS; +} + static const char pcu_copyright[] = "Copyright (C) 2012 by ...\r\n" "License GNU GPL version 2 or later\r\n" @@ -100,5 +140,12 @@ int pcu_vty_init(const struct log_info *cat) logging_vty_add_cmds(cat); + install_node(&pcu_node, config_write_pcu); + install_element(CONFIG_NODE, &cfg_pcu_cmd); + install_default(PCU_NODE); + install_element(PCU_NODE, &cfg_pcu_cs_cmd); + install_element(PCU_NODE, &cfg_pcu_no_cs_cmd); + install_element(PCU_NODE, &ournode_end_cmd); + return 0; }