aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2021-09-14 11:16:42 +0200
committerneels <nhofmeyr@sysmocom.de>2021-09-15 18:05:20 +0000
commitaa4d99fd8b11f922a2bc9828b427affa8e25560c (patch)
tree0812be8711f211d35733ba74577f169b83e64dca
parent12a73bd3c3bc5534e73aad47cad473a5fc3c62c8 (diff)
fixup comments for 'rf_states' CTRL commandHEADmaster
Completely describe the 'rf_states' string elements (in one place), and fix the missing <rsl_status> item in bsc_ctrl_commands.c comments. Related: SYS#5542 Change-Id: Ifc3610c344b3e270111e2f6c5155a6fb90d8f2ac
-rw-r--r--src/osmo-bsc/bsc_ctrl_commands.c8
-rw-r--r--src/osmo-bsc/bsc_rf_ctrl.c24
2 files changed, 24 insertions, 8 deletions
diff --git a/src/osmo-bsc/bsc_ctrl_commands.c b/src/osmo-bsc/bsc_ctrl_commands.c
index c7547b0ff..a94baae25 100644
--- a/src/osmo-bsc/bsc_ctrl_commands.c
+++ b/src/osmo-bsc/bsc_ctrl_commands.c
@@ -420,8 +420,9 @@ static int get_bts_rf_state(struct ctrl_cmd *cmd, void *data)
}
CTRL_CMD_DEFINE_RO(bts_rf_state, "rf_state");
-/* Return a list of the states of each TRX for a given BTS:
- * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>;<bts_nr>,<trx_nr>,...
+/* Return a list of the states of each TRX for a given BTS.
+ * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;<bts_nr>,<trx_nr>,...;...;
+ * For details on the string, see bsc_rf_states_c();
*/
static int get_bts_rf_states(struct ctrl_cmd *cmd, void *data)
{
@@ -443,7 +444,8 @@ static int get_bts_rf_states(struct ctrl_cmd *cmd, void *data)
CTRL_CMD_DEFINE_RO(bts_rf_states, "rf_states");
/* Return a list of the states of each TRX for all BTS:
- * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>;<bts_nr>,<trx_nr>,...
+ * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;<bts_nr>,<trx_nr>,...;...;
+ * For details on the string, see bsc_rf_states_c();
*/
static int get_net_rf_states(struct ctrl_cmd *cmd, void *data)
{
diff --git a/src/osmo-bsc/bsc_rf_ctrl.c b/src/osmo-bsc/bsc_rf_ctrl.c
index 7040da473..749d2eb49 100644
--- a/src/osmo-bsc/bsc_rf_ctrl.c
+++ b/src/osmo-bsc/bsc_rf_ctrl.c
@@ -139,8 +139,7 @@ enum osmo_bsc_rf_adminstate osmo_bsc_rf_get_adminstate_by_trx(struct gsm_bts_trx
}
/* Return a string listing the state of the given TRX.
- * The string has the form:
- * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;
+ * For details, see bsc_rf_states_c().
*/
static int bsc_rf_state_of_trx_buf(char *buf, size_t buflen, struct gsm_bts_trx *trx)
{
@@ -154,6 +153,9 @@ static int bsc_rf_state_of_trx_buf(char *buf, size_t buflen, struct gsm_bts_trx
return sb.chars_needed;
}
+/* Same as bsc_rf_states_of_bts_c() but return result in a fixed-size buffer.
+ * For details, see bsc_rf_states_c().
+ * Return the amount of characters that would be written to the buffer if it is large enough, like snprintf(). */
static int bsc_rf_states_of_bts_buf(char *buf, size_t buflen, struct gsm_bts *bts)
{
struct gsm_bts_trx *trx;
@@ -166,8 +168,8 @@ static int bsc_rf_states_of_bts_buf(char *buf, size_t buflen, struct gsm_bts *bt
}
/* Return a string listing the states of each TRX for the given BTS.
- * The string has the form:
- * <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;<bts_nr>,<trx_nr>,...;...;
+ * For details, see bsc_rf_states_c().
+ *
* \param ctx Talloc context to allocate the returned string from.
* \param bts BTS of which to list the TRX states.
* \return talloc allocated string.
@@ -177,6 +179,9 @@ char *bsc_rf_states_of_bts_c(void *ctx, struct gsm_bts *bts)
OSMO_NAME_C_IMPL(ctx, 256, "ERROR", bsc_rf_states_of_bts_buf, bts);
}
+/* Same as bsc_rf_states_c() but return result in a fixed-size buffer.
+ * For details, see bsc_rf_states_c().
+ * Return the amount of characters that would be written to the buffer if it is large enough, like snprintf(). */
static int bsc_rf_states_buf(char *buf, size_t buflen)
{
struct gsm_bts *bts;
@@ -191,8 +196,17 @@ static int bsc_rf_states_buf(char *buf, size_t buflen)
/* Return a string listing the states of all TRX of all BTS.
* The string has the form:
* <bts_nr>,<trx_nr>,<opstate>,<adminstate>,<rf_policy>,<rsl_status>;<bts_nr>,<trx_nr>,...;...;
+ * (always terminates in a semicolon).
+ *
+ * Meaning of the elements:
+ * - bts_nr: 0..255 -- BTS index.
+ * - trx_nr: 0..255 -- TRX index.
+ * - opstate: inoperational|operational -- whether RF is active.
+ * - adminstate: unlocked|locked -- whether the TRX is configured as RF-locked.
+ * - rf_policy: off|on|grace|unknown -- which state RF should be in according to user rf_lock requests.
+ * - rsl_status: rsl-up|rsl-down -- 'rsl-up' if an RSL link to the TRX is currently present.
+ *
* \param ctx Talloc context to allocate the returned string from.
- * \param bts BTS of which to list the TRX states, or NULL to list all TRX of all BTS.
* \return talloc allocated string.
*/
char *bsc_rf_states_c(void *ctx)