VTY: Added option to force given CS and ignore the scheme given by BTS

This commit is contained in:
Andreas Eversberg 2012-07-20 21:50:31 +02:00
parent 3b7461c1b3
commit 8b761a3419
3 changed files with 78 additions and 24 deletions

View File

@ -20,6 +20,7 @@
#ifndef GPRS_RLCMAC_H #ifndef GPRS_RLCMAC_H
#define GPRS_RLCMAC_H #define GPRS_RLCMAC_H
#ifdef __cplusplus
#include <bitvector.h> #include <bitvector.h>
#include <gsm_rlcmac.h> #include <gsm_rlcmac.h>
#include <gsm_timer.h> #include <gsm_timer.h>
@ -28,6 +29,7 @@ extern "C" {
#include <osmocom/core/linuxlist.h> #include <osmocom/core/linuxlist.h>
#include <osmocom/core/timer.h> #include <osmocom/core/timer.h>
} }
#endif
/* This special feature will delay assignment of downlink TBF by one second, /* This special feature will delay assignment of downlink TBF by one second,
* in case there is already a TBF. * in case there is already a TBF.
@ -63,6 +65,7 @@ struct gprs_rlcmac_bts {
uint8_t cs3; uint8_t cs3;
uint8_t cs4; uint8_t cs4;
uint8_t initial_cs; uint8_t initial_cs;
uint8_t force_cs; /* 0=use from BTS 1=use from VTY */
uint8_t t3142; uint8_t t3142;
uint8_t t3169; uint8_t t3169;
uint8_t t3191; uint8_t t3191;
@ -79,6 +82,7 @@ struct gprs_rlcmac_bts {
extern struct gprs_rlcmac_bts *gprs_rlcmac_bts; extern struct gprs_rlcmac_bts *gprs_rlcmac_bts;
#ifdef __cplusplus
/* /*
* TBF instance * TBF instance
*/ */
@ -149,7 +153,7 @@ struct gprs_rlcmac_tbf {
uint8_t llc_frame[LLC_MAX_LEN]; /* current DL or UL frame */ 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_index; /* current write/read position of frame */
uint16_t llc_length; /* len of current DL LLC_frame, 0 == no 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_dl_ass_state dl_ass_state;
enum gprs_rlcmac_tbf_ul_ass_state ul_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 msgb *gprs_rlcmac_send_packet_paging_request(
struct gprs_rlcmac_pdch *pdch); struct gprs_rlcmac_pdch *pdch);
#endif
#endif // GPRS_RLCMAC_H #endif // GPRS_RLCMAC_H

View File

@ -374,10 +374,12 @@ bssgp_failed:
bts->n3103 = info_ind->n3103; bts->n3103 = info_ind->n3103;
bts->n3105 = info_ind->n3105; bts->n3105 = info_ind->n3105;
} }
if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4) if (!bts->force_cs) {
bts->initial_cs = 1; if (info_ind->initial_cs < 1 || info_ind->initial_cs > 4)
else bts->initial_cs = 1;
bts->initial_cs = info_ind->initial_cs; else
bts->initial_cs = info_ind->initial_cs;
}
for (trx = 0; trx < 8; trx++) { for (trx = 0; trx < 8; trx++) {
bts->trx[trx].arfcn = info_ind->trx[trx].arfcn; bts->trx[trx].arfcn = info_ind->trx[trx].arfcn;

View File

@ -1,27 +1,18 @@
/* OsmoBTS VTY interface */ /* OsmoBTS VTY interface */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <osmocom/core/talloc.h> #include <stdint.h>
#include <osmocom/gsm/abis_nm.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/command.h>
#include <osmocom/vty/logging.h> #include <osmocom/vty/logging.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/trau/osmo_ortp.h>
#include "pcu_vty.h" #include "pcu_vty.h"
#include "gprs_rlcmac.h"
enum node_type pcu_vty_go_parent(struct vty *vty) enum node_type pcu_vty_go_parent(struct vty *vty)
{ {
switch (vty->node) { switch (vty->node) {
#if 0 #if 0
case TRX_NODE: case TRX_NODE:
vty->node = BTS_NODE; vty->node = PCU_NODE;
{ {
struct gsm_bts_trx *trx = vty->index; struct gsm_bts_trx *trx = vty->index;
vty->index = trx->bts; vty->index = trx->bts;
@ -31,29 +22,32 @@ enum node_type pcu_vty_go_parent(struct vty *vty)
default: default:
vty->node = CONFIG_NODE; vty->node = CONFIG_NODE;
} }
return vty->node; return (enum node_type) vty->node;
} }
int pcu_vty_is_config_node(struct vty *vty, int node) int pcu_vty_is_config_node(struct vty *vty, int node)
{ {
switch (node) { switch (node) {
#if 0 case PCU_NODE:
case TRX_NODE:
case BTS_NODE:
return 1; return 1;
#endif
default: default:
return 0; return 0;
} }
} }
static struct cmd_node pcu_node = {
(enum node_type) PCU_NODE,
"%s(pcu)#",
1,
};
gDEFUN(ournode_exit, ournode_exit_cmd, "exit", gDEFUN(ournode_exit, ournode_exit_cmd, "exit",
"Exit current node, go down to provious node") "Exit current node, go down to provious node")
{ {
switch (vty->node) { switch (vty->node) {
#if 0 #if 0
case TRXV_NODE: case TRXV_NODE:
vty->node = BTS_NODE; vty->node = PCU_NODE;
{ {
struct gsm_bts_trx *trx = vty->index; struct gsm_bts_trx *trx = vty->index;
vty->index = trx->bts; vty->index = trx->bts;
@ -80,6 +74,52 @@ gDEFUN(ournode_end, ournode_end_cmd, "end",
return CMD_SUCCESS; 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[] = static const char pcu_copyright[] =
"Copyright (C) 2012 by ...\r\n" "Copyright (C) 2012 by ...\r\n"
"License GNU GPL version 2 or later\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); 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; return 0;
} }