Jacob Erlbeck | 62e96a3 | 2015-06-04 09:42:14 +0200 | [diff] [blame] | 1 | /* pcu_vty_functions.cpp |
| 2 | * |
| 3 | * Copyright (C) 2015 by Sysmocom s.f.m.c. GmbH |
| 4 | * Author: Jacob Erlbeck <jerlbeck@sysmocom.de> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Jacob Erlbeck | 62e96a3 | 2015-06-04 09:42:14 +0200 | [diff] [blame] | 15 | */ |
| 16 | /* OsmoBTS VTY interface */ |
| 17 | |
| 18 | |
| 19 | #include <stdint.h> |
| 20 | #include <stdlib.h> |
| 21 | #include "pcu_vty_functions.h" |
Jacob Erlbeck | f47f68a | 2015-06-04 10:23:24 +0200 | [diff] [blame] | 22 | #include "bts.h" |
Jacob Erlbeck | f47f68a | 2015-06-04 10:23:24 +0200 | [diff] [blame] | 23 | #include "gprs_ms.h" |
| 24 | #include "cxx_linuxlist.h" |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 25 | #include <llc.h> |
| 26 | #include <pcu_l1_if.h> |
| 27 | #include <rlc.h> |
| 28 | #include <tbf.h> |
Pau Espin Pedrol | 9d1cdb1 | 2019-09-25 17:47:02 +0200 | [diff] [blame] | 29 | #include <tbf_ul.h> |
Max | 6dc90b8 | 2018-02-19 17:17:28 +0100 | [diff] [blame] | 30 | #include <pdch.h> |
Jacob Erlbeck | 62e96a3 | 2015-06-04 09:42:14 +0200 | [diff] [blame] | 31 | |
| 32 | extern "C" { |
Max | d2d51ed | 2018-01-25 15:41:28 +0100 | [diff] [blame] | 33 | #include <osmocom/vty/command.h> |
| 34 | #include <osmocom/vty/logging.h> |
| 35 | #include <osmocom/vty/misc.h> |
Max | 1187a77 | 2018-01-26 13:31:42 +0100 | [diff] [blame] | 36 | #include <osmocom/core/linuxlist.h> |
| 37 | #include <osmocom/core/utils.h> |
| 38 | #include <osmocom/vty/vty.h> |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 39 | #include "coding_scheme.h" |
Jacob Erlbeck | 62e96a3 | 2015-06-04 09:42:14 +0200 | [diff] [blame] | 40 | } |
| 41 | |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 42 | static uint32_t tbf_state_flags(const struct gprs_rlcmac_tbf *tbf) |
| 43 | { |
| 44 | const struct gprs_rlcmac_ul_tbf *ul_tbf = tbf_as_ul_tbf_const(tbf); |
| 45 | const struct gprs_rlcmac_dl_tbf *dl_tbf = tbf_as_dl_tbf_const(tbf); |
| 46 | if (ul_tbf) |
| 47 | return ul_tbf->state_fsm.state_flags; |
| 48 | return dl_tbf->state_fsm.state_flags; |
| 49 | } |
| 50 | |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 51 | static void tbf_print_vty_info(struct vty *vty, struct gprs_rlcmac_tbf *tbf) |
Jacob Erlbeck | bf49f04 | 2015-12-28 19:06:09 +0100 | [diff] [blame] | 52 | { |
Pau Espin Pedrol | cc30b05 | 2022-10-27 15:25:55 +0200 | [diff] [blame] | 53 | gprs_rlcmac_ul_tbf *ul_tbf = tbf_as_ul_tbf(tbf); |
| 54 | gprs_rlcmac_dl_tbf *dl_tbf = tbf_as_dl_tbf(tbf); |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 55 | uint32_t state_flags = tbf_state_flags(tbf); |
Pau Espin Pedrol | 345d9ad | 2022-12-12 19:22:44 +0100 | [diff] [blame] | 56 | struct GprsMs *ms = tbf_ms(tbf); |
Pau Espin Pedrol | 9935d0d | 2022-12-13 18:29:25 +0100 | [diff] [blame] | 57 | const struct gprs_rlcmac_pdch *first_common_ts = ms_first_common_ts(ms); |
Jacob Erlbeck | 9f68670 | 2016-01-19 17:10:07 +0100 | [diff] [blame] | 58 | |
Minh-Quang Nguyen | 8d55563 | 2017-11-01 15:00:08 -0400 | [diff] [blame] | 59 | vty_out(vty, "TBF: TFI=%d TLLI=0x%08x (%s) TA=%u DIR=%s IMSI=%s%s", tbf->tfi(), |
Pau Espin Pedrol | 5fc9577 | 2020-09-22 16:15:09 +0200 | [diff] [blame] | 60 | tbf->tlli(), tbf->is_tlli_valid() ? "valid" : "invalid", |
| 61 | tbf->ta(), |
| 62 | tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL", |
| 63 | tbf->imsi(), VTY_NEWLINE); |
Pau Espin Pedrol | 140c97c | 2022-12-13 14:14:32 +0100 | [diff] [blame] | 64 | vty_out(vty, " created=%lu state=%s flags=%08x [CCCH:%u, PACCH:%u] 1st_cTS=%" PRId8 " ctrl_TS=%d MS_CLASS=%d/%d%s", |
Pau Espin Pedrol | 1401512 | 2021-11-05 20:43:10 +0100 | [diff] [blame] | 65 | tbf->created_ts(), tbf->state_name(), |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 66 | state_flags, |
| 67 | state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH), |
| 68 | state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH), |
Pau Espin Pedrol | 9935d0d | 2022-12-13 18:29:25 +0100 | [diff] [blame] | 69 | first_common_ts ? first_common_ts->ts_no : -1, |
Pau Espin Pedrol | e2ed40d | 2022-12-15 17:35:05 +0100 | [diff] [blame] | 70 | tbf->control_ts ? tbf->control_ts->ts_no : -1, |
Pau Espin Pedrol | 5fc9577 | 2020-09-22 16:15:09 +0200 | [diff] [blame] | 71 | tbf->ms_class(), |
Pau Espin Pedrol | 345d9ad | 2022-12-12 19:22:44 +0100 | [diff] [blame] | 72 | ms_egprs_ms_class(ms), |
Pau Espin Pedrol | 5fc9577 | 2020-09-22 16:15:09 +0200 | [diff] [blame] | 73 | VTY_NEWLINE); |
Jacob Erlbeck | bf49f04 | 2015-12-28 19:06:09 +0100 | [diff] [blame] | 74 | vty_out(vty, " TS_alloc="); |
| 75 | for (int i = 0; i < 8; i++) { |
Pau Espin Pedrol | e875769 | 2022-12-12 16:18:05 +0100 | [diff] [blame] | 76 | bool is_ctrl = tbf_is_control_ts(tbf, tbf->pdch[i]); |
Jacob Erlbeck | bf49f04 | 2015-12-28 19:06:09 +0100 | [diff] [blame] | 77 | if (tbf->pdch[i]) |
Jacob Erlbeck | 81a04f7 | 2016-01-28 16:14:58 +0100 | [diff] [blame] | 78 | vty_out(vty, "%d%s ", i, is_ctrl ? "!" : ""); |
Jacob Erlbeck | bf49f04 | 2015-12-28 19:06:09 +0100 | [diff] [blame] | 79 | } |
Mrinal Mishra | d453eaa | 2016-10-26 15:41:56 +0530 | [diff] [blame] | 80 | if (tbf->trx != NULL) |
| 81 | vty_out(vty, " TRX_ID=%d", tbf->trx->trx_no); |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 82 | vty_out(vty, " CS=%s", mcs_name(tbf->current_cs())); |
Jacob Erlbeck | 9f68670 | 2016-01-19 17:10:07 +0100 | [diff] [blame] | 83 | |
| 84 | if (ul_tbf) { |
Pau Espin Pedrol | b3f2397 | 2020-10-23 21:00:23 +0200 | [diff] [blame] | 85 | gprs_rlc_ul_window *win = static_cast<gprs_rlc_ul_window *>(ul_tbf->window()); |
Max | a4f570f | 2017-12-15 11:21:57 +0100 | [diff] [blame] | 86 | vty_out(vty, " WS=%u V(Q)=%d V(R)=%d", |
| 87 | ul_tbf->window_size(), win->v_q(), win->v_r()); |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 88 | vty_out(vty, "%s", VTY_NEWLINE); |
| 89 | vty_out(vty, " TBF Statistics:%s", VTY_NEWLINE); |
Pau Espin Pedrol | 43fc4a8 | 2021-11-05 13:36:49 +0100 | [diff] [blame] | 90 | if (ul_tbf->m_ul_gprs_ctrs) |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 91 | vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_gprs_ctrs); |
Pau Espin Pedrol | 43fc4a8 | 2021-11-05 13:36:49 +0100 | [diff] [blame] | 92 | if (ul_tbf->m_ul_egprs_ctrs) |
sivasankari | da7250a | 2016-12-16 12:57:18 +0530 | [diff] [blame] | 93 | vty_out_rate_ctr_group(vty, " ", ul_tbf->m_ul_egprs_ctrs); |
Jacob Erlbeck | 9f68670 | 2016-01-19 17:10:07 +0100 | [diff] [blame] | 94 | } |
| 95 | if (dl_tbf) { |
Pau Espin Pedrol | b3f2397 | 2020-10-23 21:00:23 +0200 | [diff] [blame] | 96 | gprs_rlc_dl_window *win = static_cast<gprs_rlc_dl_window *>(dl_tbf->window()); |
Max | a4f570f | 2017-12-15 11:21:57 +0100 | [diff] [blame] | 97 | vty_out(vty, " WS=%u V(A)=%d V(S)=%d nBSN=%d%s", |
| 98 | dl_tbf->window_size(), win->v_a(), win->v_s(), win->resend_needed(), |
Jacob Erlbeck | 9f68670 | 2016-01-19 17:10:07 +0100 | [diff] [blame] | 99 | win->window_stalled() ? " STALLED" : ""); |
sivasankari | 5395073 | 2016-12-08 17:15:17 +0530 | [diff] [blame] | 100 | vty_out(vty, "%s", VTY_NEWLINE); |
| 101 | vty_out_rate_ctr_group(vty, " ", tbf->m_ctrs); |
Pau Espin Pedrol | 43fc4a8 | 2021-11-05 13:36:49 +0100 | [diff] [blame] | 102 | if (dl_tbf->m_dl_gprs_ctrs) |
sivasankari | 5395073 | 2016-12-08 17:15:17 +0530 | [diff] [blame] | 103 | vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_gprs_ctrs); |
Pau Espin Pedrol | 43fc4a8 | 2021-11-05 13:36:49 +0100 | [diff] [blame] | 104 | if (dl_tbf->m_dl_egprs_ctrs) |
sivasankari | 5395073 | 2016-12-08 17:15:17 +0530 | [diff] [blame] | 105 | vty_out_rate_ctr_group(vty, " ", dl_tbf->m_dl_egprs_ctrs); |
Jacob Erlbeck | 9f68670 | 2016-01-19 17:10:07 +0100 | [diff] [blame] | 106 | } |
| 107 | vty_out(vty, "%s%s", VTY_NEWLINE, VTY_NEWLINE); |
Jacob Erlbeck | bf49f04 | 2015-12-28 19:06:09 +0100 | [diff] [blame] | 108 | } |
| 109 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 110 | int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts, uint32_t flags) |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 111 | { |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 112 | struct llist_item *iter; |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 113 | const struct gprs_rlcmac_trx *trx; |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 114 | struct gprs_rlcmac_tbf *tbf; |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 115 | const struct gprs_rlcmac_ul_tbf *ul_tbf; |
| 116 | const struct gprs_rlcmac_dl_tbf *dl_tbf; |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 117 | size_t trx_no; |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 118 | |
| 119 | vty_out(vty, "UL TBFs%s", VTY_NEWLINE); |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 120 | for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no++) { |
| 121 | trx = &bts->trx[trx_no]; |
| 122 | llist_for_each_entry(iter, &trx->ul_tbfs, list) { |
| 123 | tbf = (struct gprs_rlcmac_tbf *)iter->entry; |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 124 | ul_tbf = tbf_as_ul_tbf_const(tbf); |
| 125 | if (ul_tbf->state_fsm.state_flags & flags) |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 126 | tbf_print_vty_info(vty, tbf); |
| 127 | } |
Vadim Yanitskiy | cef2f84 | 2019-10-09 21:52:50 +0700 | [diff] [blame] | 128 | } |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 129 | |
| 130 | vty_out(vty, "%sDL TBFs%s", VTY_NEWLINE, VTY_NEWLINE); |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 131 | for (trx_no = 0; trx_no < ARRAY_SIZE(bts->trx); trx_no++) { |
| 132 | trx = &bts->trx[trx_no]; |
| 133 | llist_for_each_entry(iter, &trx->dl_tbfs, list) { |
| 134 | tbf = (struct gprs_rlcmac_tbf *)iter->entry; |
Pau Espin Pedrol | 343c0ee | 2022-11-17 19:55:08 +0100 | [diff] [blame] | 135 | dl_tbf = tbf_as_dl_tbf_const(tbf); |
| 136 | if (dl_tbf->state_fsm.state_flags & flags) |
Pau Espin Pedrol | 1a1557a | 2021-05-13 18:39:36 +0200 | [diff] [blame] | 137 | tbf_print_vty_info(vty, tbf); |
| 138 | } |
Vadim Yanitskiy | cef2f84 | 2019-10-09 21:52:50 +0700 | [diff] [blame] | 139 | } |
Jacob Erlbeck | ed2dbf6 | 2015-12-28 19:15:40 +0100 | [diff] [blame] | 140 | |
| 141 | return CMD_SUCCESS; |
| 142 | } |
| 143 | |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 144 | static int show_ms(struct vty *vty, GprsMs *ms) |
| 145 | { |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 146 | unsigned i; |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 147 | struct llist_item *i_tbf; |
Jacob Erlbeck | 7c72aca | 2016-01-22 17:06:14 +0100 | [diff] [blame] | 148 | uint8_t slots; |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 149 | |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 150 | vty_out(vty, "MS TLLI=%08x, IMSI=%s%s", ms_tlli(ms), ms_imsi(ms), VTY_NEWLINE); |
Pau Espin Pedrol | 4673eb0 | 2023-04-20 17:18:34 +0200 | [diff] [blame] | 151 | if (osmo_timer_pending(&ms->release_timer)) { |
| 152 | struct timeval tv_now, tv_res1, tv_res2; |
| 153 | osmo_gettimeofday(&tv_now, NULL); |
| 154 | timersub(&tv_now, &ms->tv_idle_start, &tv_res1); |
| 155 | osmo_timer_remaining(&ms->release_timer, &tv_now, &tv_res2); |
| 156 | vty_out(vty, " State: IDLE for %lus, release in %lus%s", |
| 157 | tv_res1.tv_sec, tv_res2.tv_sec, VTY_NEWLINE); |
| 158 | } else { |
| 159 | vty_out(vty, " State: ACTIVE%s", VTY_NEWLINE); |
| 160 | } |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 161 | vty_out(vty, " Mode: %s%s", mode_name(ms_mode(ms)), VTY_NEWLINE); |
| 162 | vty_out(vty, " MS class: %d%s", ms_ms_class(ms), VTY_NEWLINE); |
| 163 | vty_out(vty, " EGPRS MS class: %d%s", ms_egprs_ms_class(ms), VTY_NEWLINE); |
Jacob Erlbeck | 7c72aca | 2016-01-22 17:06:14 +0100 | [diff] [blame] | 164 | vty_out(vty, " PACCH: "); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 165 | slots = ms_current_pacch_slots(ms); |
Jacob Erlbeck | 7c72aca | 2016-01-22 17:06:14 +0100 | [diff] [blame] | 166 | for (int i = 0; i < 8; i++) |
| 167 | if (slots & (1 << i)) |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 168 | vty_out(vty, "TS%d ", i); |
Jacob Erlbeck | 7c72aca | 2016-01-22 17:06:14 +0100 | [diff] [blame] | 169 | vty_out(vty, "%s", VTY_NEWLINE); |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 170 | vty_out(vty, " DL LLC queue length: %zd%s", llc_queue_size(ms_llc_queue(ms)), |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 171 | VTY_NEWLINE); |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 172 | vty_out(vty, " DL LLC queue octets: %zd%s", llc_queue_octets(ms_llc_queue(ms)), |
Jacob Erlbeck | 159d4de | 2015-08-21 16:02:11 +0200 | [diff] [blame] | 173 | VTY_NEWLINE); |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 174 | vty_out(vty, " DL Coding Scheme: %s%s", mcs_name(ms_current_cs_dl(ms, ms_mode(ms))), |
| 175 | VTY_NEWLINE); |
| 176 | vty_out(vty, " UL Coding Scheme: %s%s", mcs_name(ms_current_cs_ul(ms)), |
| 177 | VTY_NEWLINE); |
| 178 | vty_out(vty, " Timing advance (TA): %d%s", ms_ta(ms), VTY_NEWLINE); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 179 | if (ms->l1_meas.have_rssi) |
Jacob Erlbeck | e4bcb62 | 2015-06-08 11:26:38 +0200 | [diff] [blame] | 180 | vty_out(vty, " RSSI: %d dBm%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 181 | ms->l1_meas.rssi, VTY_NEWLINE); |
| 182 | if (ms->l1_meas.have_ber) |
Jacob Erlbeck | e4bcb62 | 2015-06-08 11:26:38 +0200 | [diff] [blame] | 183 | vty_out(vty, " Bit error rate: %d %%%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 184 | ms->l1_meas.ber, VTY_NEWLINE); |
| 185 | if (ms->l1_meas.have_link_qual) |
Jacob Erlbeck | e4bcb62 | 2015-06-08 11:26:38 +0200 | [diff] [blame] | 186 | vty_out(vty, " Link quality: %d dB%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 187 | ms->l1_meas.link_qual, VTY_NEWLINE); |
| 188 | if (ms->l1_meas.have_bto) |
Jacob Erlbeck | e4bcb62 | 2015-06-08 11:26:38 +0200 | [diff] [blame] | 189 | vty_out(vty, " Burst timing offset: %d/4 bit%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 190 | ms->l1_meas.bto, VTY_NEWLINE); |
| 191 | if (ms->l1_meas.have_ms_rx_qual) |
Jacob Erlbeck | 04a1086 | 2015-06-12 16:01:56 +0200 | [diff] [blame] | 192 | vty_out(vty, " Downlink NACK rate: %d %%%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 193 | ms_nack_rate_dl(ms), VTY_NEWLINE); |
| 194 | if (ms->l1_meas.have_ms_rx_qual) |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 195 | vty_out(vty, " MS Rx quality: %d %%%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 196 | ms->l1_meas.ms_rx_qual, VTY_NEWLINE); |
| 197 | if (ms->l1_meas.have_ms_c_value) |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 198 | vty_out(vty, " MS C value: %d dB%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 199 | ms->l1_meas.ms_c_value, VTY_NEWLINE); |
| 200 | if (ms->l1_meas.have_ms_sign_var) |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 201 | vty_out(vty, " MS SIGN variance: %d dB%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 202 | ms->l1_meas.ms_sign_var, VTY_NEWLINE); |
| 203 | for (i = 0; i < ARRAY_SIZE(ms->l1_meas.ts); ++i) { |
| 204 | if (ms->l1_meas.ts[i].have_ms_i_level) |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 205 | vty_out(vty, " MS I level (slot %d): %d dB%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 206 | i, ms->l1_meas.ts[i].ms_i_level, VTY_NEWLINE); |
Jacob Erlbeck | 51b1151 | 2015-06-11 16:54:50 +0200 | [diff] [blame] | 207 | } |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 208 | if (ms_ul_tbf(ms)) |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 209 | vty_out(vty, " UL TBF: TFI=%d, state=%s%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 210 | ms_ul_tbf(ms)->tfi(), |
| 211 | ms_ul_tbf(ms)->state_name(), |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 212 | VTY_NEWLINE); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 213 | if (ms_dl_tbf(ms)) { |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 214 | vty_out(vty, " DL TBF: TFI=%d, state=%s%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 215 | ms_dl_tbf(ms)->tfi(), |
| 216 | ms_dl_tbf(ms)->state_name(), |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 217 | VTY_NEWLINE); |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 218 | vty_out(vty, " Current DL Throughput: %d Kbps%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 219 | ms_dl_tbf(ms)->m_bw.dl_throughput, |
sivasankari | 5395073 | 2016-12-08 17:15:17 +0530 | [diff] [blame] | 220 | VTY_NEWLINE); |
| 221 | } |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 222 | |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 223 | llist_for_each_entry(i_tbf, &ms->old_tbfs, list) { |
| 224 | struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)i_tbf->entry; |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 225 | vty_out(vty, " Old %s TBF: TFI=%d, state=%s%s", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 226 | tbf_direction(tbf) == GPRS_RLCMAC_UL_TBF ? |
Pau Espin Pedrol | 51c903e | 2023-04-20 17:52:45 +0200 | [diff] [blame^] | 227 | "UL" : "DL", |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 228 | tbf->tfi(), |
| 229 | tbf->state_name(), |
Jacob Erlbeck | c62216b | 2015-08-21 15:46:16 +0200 | [diff] [blame] | 230 | VTY_NEWLINE); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 231 | } |
Pau Espin Pedrol | bed48cc | 2021-01-11 17:32:18 +0100 | [diff] [blame] | 232 | vty_out_rate_ctr_group(vty, " ", ms->ctrs); |
Jacob Erlbeck | c62216b | 2015-08-21 15:46:16 +0200 | [diff] [blame] | 233 | |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 234 | return CMD_SUCCESS; |
| 235 | } |
| 236 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 237 | int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts) |
Vadim Yanitskiy | afbf189 | 2019-10-09 20:26:47 +0700 | [diff] [blame] | 238 | { |
Pau Espin Pedrol | 54faf02 | 2021-01-14 12:12:43 +0100 | [diff] [blame] | 239 | struct llist_head *tmp; |
Vadim Yanitskiy | afbf189 | 2019-10-09 20:26:47 +0700 | [diff] [blame] | 240 | |
Pau Espin Pedrol | eb0a052 | 2023-04-17 16:33:35 +0200 | [diff] [blame] | 241 | llist_for_each(tmp, &bts->ms_list) { |
| 242 | struct GprsMs *ms_iter = llist_entry(tmp, typeof(*ms_iter), list); |
Pau Espin Pedrol | da971ee | 2020-12-16 15:59:45 +0100 | [diff] [blame] | 243 | show_ms(vty, ms_iter); |
Pau Espin Pedrol | 54faf02 | 2021-01-14 12:12:43 +0100 | [diff] [blame] | 244 | } |
Vadim Yanitskiy | afbf189 | 2019-10-09 20:26:47 +0700 | [diff] [blame] | 245 | |
| 246 | return CMD_SUCCESS; |
| 247 | } |
| 248 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 249 | int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts, |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 250 | uint32_t tlli) |
| 251 | { |
Pau Espin Pedrol | eb0a052 | 2023-04-17 16:33:35 +0200 | [diff] [blame] | 252 | struct GprsMs *ms = bts_get_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI); |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 253 | if (!ms) { |
| 254 | vty_out(vty, "Unknown TLLI %08x.%s", tlli, VTY_NEWLINE); |
| 255 | return CMD_WARNING; |
| 256 | } |
| 257 | |
| 258 | return show_ms(vty, ms); |
| 259 | } |
| 260 | |
Pau Espin Pedrol | 2182e62 | 2021-01-14 16:48:38 +0100 | [diff] [blame] | 261 | int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts, |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 262 | const char *imsi) |
| 263 | { |
Pau Espin Pedrol | eb0a052 | 2023-04-17 16:33:35 +0200 | [diff] [blame] | 264 | struct GprsMs *ms = bts_get_ms_by_imsi(bts, imsi); |
Jacob Erlbeck | 37e896d | 2015-06-05 16:33:33 +0200 | [diff] [blame] | 265 | if (!ms) { |
| 266 | vty_out(vty, "Unknown IMSI '%s'.%s", imsi, VTY_NEWLINE); |
| 267 | return CMD_WARNING; |
| 268 | } |
| 269 | |
| 270 | return show_ms(vty, ms); |
| 271 | } |
Pau Espin Pedrol | a1ac2f0 | 2020-09-22 17:01:31 +0200 | [diff] [blame] | 272 | |
Pau Espin Pedrol | 0ece97d | 2021-01-18 12:53:54 +0100 | [diff] [blame] | 273 | int pcu_vty_show_bts_pdch(struct vty *vty, const struct gprs_rlcmac_bts *bts) |
Pau Espin Pedrol | a1ac2f0 | 2020-09-22 17:01:31 +0200 | [diff] [blame] | 274 | { |
| 275 | unsigned int trx_nr, ts_nr; |
| 276 | |
Pau Espin Pedrol | d1049dc | 2021-01-18 17:14:14 +0100 | [diff] [blame] | 277 | vty_out(vty, "BTS%" PRIu8 " (%s)%s", bts->nr, bts->active ? "active" : "disabled", VTY_NEWLINE); |
Pau Espin Pedrol | 0ece97d | 2021-01-18 12:53:54 +0100 | [diff] [blame] | 278 | for (trx_nr = 0; trx_nr < ARRAY_SIZE(bts->trx); trx_nr++) { |
| 279 | const struct gprs_rlcmac_trx *trx = &bts->trx[trx_nr]; |
Pau Espin Pedrol | a1ac2f0 | 2020-09-22 17:01:31 +0200 | [diff] [blame] | 280 | |
| 281 | for (ts_nr = 0; ts_nr < ARRAY_SIZE(trx->pdch); ts_nr++) { |
| 282 | if (trx->pdch[ts_nr].is_enabled()) |
| 283 | break; |
| 284 | } |
| 285 | if (ts_nr == ARRAY_SIZE(trx->pdch)) |
| 286 | continue; /* no pdch active, skip */ |
| 287 | |
| 288 | vty_out(vty, " TRX%u%s", trx->trx_no, VTY_NEWLINE); |
| 289 | for (ts_nr = 0; ts_nr < ARRAY_SIZE(trx->pdch); ts_nr++) { |
| 290 | const struct gprs_rlcmac_pdch *pdch = &trx->pdch[ts_nr]; |
| 291 | |
| 292 | vty_out(vty, " TS%u: PDCH %s, %u UL TBFs, %u DL TBFs%s", pdch->ts_no, |
| 293 | pdch->is_enabled() ? "enabled" : "disabled", |
| 294 | pdch->num_tbfs(GPRS_RLCMAC_DL_TBF), |
| 295 | pdch->num_tbfs(GPRS_RLCMAC_UL_TBF), VTY_NEWLINE); |
| 296 | } |
| 297 | } |
| 298 | return CMD_SUCCESS; |
| 299 | } |