ctrl: Add ms power
This new command allows to control MS power level for a specific logical channel using net.btsN.trxM.tsI.lchanL.ms-power This patch also adds a lchan node to the ctrl interface. Depends: libosmocore.git Ibf2786f668ee7e4f5b6a9ef43f2141cd2d79b4e2 Change-Id: I6f556b66011be6126d6bac31a14101ba37f81cc4
This commit is contained in:
parent
55c4ec2b15
commit
9bd9ba476c
|
@ -12,6 +12,7 @@ struct ctrl_handle *bsc_controlif_setup(struct gsm_network *net, uint16_t port);
|
||||||
int bsc_bts_ctrl_cmds_install(void);
|
int bsc_bts_ctrl_cmds_install(void);
|
||||||
int bsc_bts_trx_ctrl_cmds_install(void);
|
int bsc_bts_trx_ctrl_cmds_install(void);
|
||||||
int bsc_bts_trx_ts_ctrl_cmds_install(void);
|
int bsc_bts_trx_ts_ctrl_cmds_install(void);
|
||||||
|
int bsc_bts_trx_ts_lchan_ctrl_cmds_install(void);
|
||||||
void ctrl_generate_bts_location_state_trap(struct gsm_bts *bts, struct bsc_msc_data *msc);
|
void ctrl_generate_bts_location_state_trap(struct gsm_bts *bts, struct bsc_msc_data *msc);
|
||||||
void osmo_bsc_send_trap(struct ctrl_cmd *cmd, struct bsc_msc_data *msc_data);
|
void osmo_bsc_send_trap(struct ctrl_cmd *cmd, struct bsc_msc_data *msc_data);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ libbsc_la_SOURCES = \
|
||||||
bts_trx.c \
|
bts_trx.c \
|
||||||
bts_trx_ctrl.c \
|
bts_trx_ctrl.c \
|
||||||
bts_trx_ts_ctrl.c \
|
bts_trx_ts_ctrl.c \
|
||||||
|
bts_trx_ts_lchan_ctrl.c \
|
||||||
bts_ericsson_rbs2000.c \
|
bts_ericsson_rbs2000.c \
|
||||||
bts_init.c \
|
bts_init.c \
|
||||||
bts_ipaccess_nanobts.c \
|
bts_ipaccess_nanobts.c \
|
||||||
|
|
|
@ -43,6 +43,7 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
|
||||||
struct gsm_bts *bts = NULL;
|
struct gsm_bts *bts = NULL;
|
||||||
struct gsm_bts_trx *trx = NULL;
|
struct gsm_bts_trx *trx = NULL;
|
||||||
struct gsm_bts_trx_ts *ts = NULL;
|
struct gsm_bts_trx_ts *ts = NULL;
|
||||||
|
struct gsm_lchan *lchan = NULL;
|
||||||
struct bsc_msc_data *msc = NULL;
|
struct bsc_msc_data *msc = NULL;
|
||||||
char *token = vector_slot(vline, *i);
|
char *token = vector_slot(vline, *i);
|
||||||
long num;
|
long num;
|
||||||
|
@ -89,6 +90,20 @@ static int bsc_ctrl_node_lookup(void *data, vector vline, int *node_type,
|
||||||
goto err_missing;
|
goto err_missing;
|
||||||
*node_data = ts;
|
*node_data = ts;
|
||||||
*node_type = CTRL_NODE_TS;
|
*node_type = CTRL_NODE_TS;
|
||||||
|
} else if (!strcmp(token, "lchan")) {
|
||||||
|
if (*node_type != CTRL_NODE_TS || !*node_data)
|
||||||
|
goto err_missing;
|
||||||
|
ts = *node_data;
|
||||||
|
(*i)++;
|
||||||
|
if (!ctrl_parse_get_num(vline, *i, &num))
|
||||||
|
goto err_index;
|
||||||
|
|
||||||
|
if ((num >= 0) && (num < TS_MAX_LCHAN))
|
||||||
|
lchan = &ts->lchan[num];
|
||||||
|
if (!lchan)
|
||||||
|
goto err_missing;
|
||||||
|
*node_data = lchan;
|
||||||
|
*node_type = CTRL_NODE_LCHAN;
|
||||||
} else if (!strcmp(token, "msc")) {
|
} else if (!strcmp(token, "msc")) {
|
||||||
if (*node_type != CTRL_NODE_ROOT || !net)
|
if (*node_type != CTRL_NODE_ROOT || !net)
|
||||||
goto err_missing;
|
goto err_missing;
|
||||||
|
|
|
@ -102,5 +102,7 @@ int bsc_bts_trx_ts_ctrl_cmds_install(void)
|
||||||
rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_add);
|
rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_add);
|
||||||
rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_del);
|
rc |= ctrl_cmd_install(CTRL_NODE_TS, &cmd_ts_hopping_arfcn_del);
|
||||||
|
|
||||||
|
rc |= bsc_bts_trx_ts_lchan_ctrl_cmds_install();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019-2024 by sysmocom s.f.m.c. GmbH
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <osmocom/ctrl/control_cmd.h>
|
||||||
|
|
||||||
|
#include <osmocom/bsc/ctrl.h>
|
||||||
|
#include <osmocom/bsc/bts.h>
|
||||||
|
#include <osmocom/bsc/system_information.h>
|
||||||
|
#include <osmocom/bsc/abis_rsl.h>
|
||||||
|
|
||||||
|
static int verify_lchan_ms_power(struct ctrl_cmd *cmd, const char *value, void *_data)
|
||||||
|
{
|
||||||
|
int ms_power = atoi(cmd->value);
|
||||||
|
|
||||||
|
if (ms_power < 0 || ms_power > 40) {
|
||||||
|
cmd->reply = "Value is out of range";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* power control management: Get lchan's ms power in dBm
|
||||||
|
* format: bts.<0-255>.trx.<0-255>.ts.<0-8>.lchan.<0-8>.ms-power */
|
||||||
|
static int get_lchan_ms_power(struct ctrl_cmd *cmd, void *data)
|
||||||
|
{
|
||||||
|
struct gsm_lchan *lchan = cmd->node;
|
||||||
|
|
||||||
|
cmd->reply = talloc_asprintf(cmd, "%u", ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power));
|
||||||
|
if (!cmd->reply) {
|
||||||
|
cmd->reply = "OOM";
|
||||||
|
return CTRL_CMD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CTRL_CMD_REPLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* power control management: Set lchan's ms power in dBm.
|
||||||
|
* For static ms power control it will change the ms tx power.
|
||||||
|
* For dynamic ms power control it will limit the maximum power level.
|
||||||
|
* format: bts.<0-255>.trx.<0-255>.ts.<0-8>.lchan.<0-8>.ms-power <ms power>
|
||||||
|
* ms power is in range 0..40 */
|
||||||
|
static int set_lchan_ms_power(struct ctrl_cmd *cmd, void *data)
|
||||||
|
{
|
||||||
|
struct gsm_lchan *lchan = cmd->node;
|
||||||
|
|
||||||
|
lchan->ms_power = ms_pwr_ctl_lvl(lchan->ts->trx->bts->band, atoi(cmd->value));
|
||||||
|
rsl_chan_ms_power_ctrl(lchan);
|
||||||
|
cmd->reply = "OK";
|
||||||
|
return CTRL_CMD_REPLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTRL_CMD_DEFINE(lchan_ms_power, "ms-power");
|
||||||
|
|
||||||
|
int bsc_bts_trx_ts_lchan_ctrl_cmds_install(void)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
rc |= ctrl_cmd_install(CTRL_NODE_LCHAN, &cmd_lchan_ms_power);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
Loading…
Reference in New Issue