This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has uploaded this change for review. ( https://gerrit.osmocom.org/13069 Change subject: MCS: use value_string for conversion ...................................................................... MCS: use value_string for conversion Change-Id: I212ebb892ab162821633974d5a6c7e315d308370 --- M src/coding_scheme.c M src/coding_scheme.h M src/decoding.cpp M src/encoding.cpp M src/gprs_bssgp_pcu.cpp M src/gprs_coding_scheme.cpp M src/gprs_coding_scheme.h M src/gprs_ms.cpp M src/pcu_vty_functions.cpp M src/pdch.cpp M src/tbf_dl.cpp M src/tbf_ul.cpp 12 files changed, 66 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/69/13069/1 diff --git a/src/coding_scheme.c b/src/coding_scheme.c index 91ece40..9310c53 100644 --- a/src/coding_scheme.c +++ b/src/coding_scheme.c @@ -24,6 +24,28 @@ #include "coding_scheme.h" +const struct value_string mcs_names[] = { + { UNKNOWN, "UNKNOWN" }, + { CS1, "CS-1" }, + { CS2, "CS-2" }, + { CS3, "CS-3" }, + { CS4, "CS-4" }, + { MCS1, "MCS-1" }, + { MCS2, "MCS-2" }, + { MCS3, "MCS-3" }, + { MCS4, "MCS-4" }, + { MCS5, "MCS-5" }, + { MCS6, "MCS-6" }, + { MCS7, "MCS-7" }, + { MCS8, "MCS-8" }, + { MCS9, "MCS-9" }, + { 0, NULL } +}; + +const char *mcs_name(enum CodingScheme val) { + return get_value_string(mcs_names, val); +} + static struct { struct { uint8_t data_header_bits; diff --git a/src/coding_scheme.h b/src/coding_scheme.h index b7093d1..12c832b 100644 --- a/src/coding_scheme.h +++ b/src/coding_scheme.h @@ -19,6 +19,8 @@ #pragma once +#include <osmocom/core/utils.h> + enum CodingScheme { UNKNOWN, /* GPRS Coding Schemes: */ @@ -28,6 +30,9 @@ NUM_SCHEMES }; +extern const struct value_string mcs_names[]; +const char *mcs_name(enum CodingScheme val); + enum HeaderType { HEADER_INVALID, HEADER_GPRS_CONTROL, diff --git a/src/decoding.cpp b/src/decoding.cpp index 3410291..1473ff7 100644 --- a/src/decoding.cpp +++ b/src/decoding.cpp @@ -370,7 +370,7 @@ default: LOGP(DRLCMACDL, LOGL_ERROR, "Decoding of uplink %s data blocks not yet supported.\n", - cs.name()); + mcs_name(cs)); return -ENOTSUP; }; diff --git a/src/encoding.cpp b/src/encoding.cpp index 4a57ce3..b9c4dcc 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -1213,7 +1213,7 @@ default: LOGP(DRLCMACDL, LOGL_ERROR, "Encoding of uplink %s data blocks not yet supported.\n", - cs.name()); + mcs_name(cs)); return -ENOTSUP; }; @@ -1602,7 +1602,7 @@ count_payload); LOGP(DRLCMACDL, LOGL_ERROR, "%s data block encoding not implemented\n", - cs.name()); + mcs_name(cs)); return AR_NEED_MORE_BLOCKS; } diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index ae2ab7c..6143531 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -26,7 +26,11 @@ #include <tbf.h> #include <gprs_coding_scheme.h> #include <pdch.h> -#include "coding_scheme.h" + +extern "C" { + #include <osmocom/core/utils.h> + #include "coding_scheme.h" +} #define BSSGP_TIMER_T1 30 /* Guards the (un)blocking procedures */ #define BSSGP_TIMER_T2 30 /* Guards the reset procedure */ @@ -775,7 +779,7 @@ LOGP(DBSSGP, LOGL_DEBUG, "Computed BVC leak rate = %d, num_pdch = %d, cs = %s\n", - leak_rate, num_pdch, max_cs_dl.name()); + leak_rate, num_pdch, mcs_name(max_cs_dl)); }; if (ms_leak_rate == 0) { @@ -799,7 +803,7 @@ LOGP(DBSSGP, LOGL_DEBUG, "Computed MS default leak rate = %d, ms_num_pdch = %d, " "cs = %s\n", - ms_leak_rate, ms_num_pdch, max_cs_dl.name()); + ms_leak_rate, ms_num_pdch, mcs_name(max_cs_dl)); }; /* TODO: Force leak_rate to 0 on buffer bloat */ diff --git a/src/gprs_coding_scheme.cpp b/src/gprs_coding_scheme.cpp index d7934ec..c044023 100644 --- a/src/gprs_coding_scheme.cpp +++ b/src/gprs_coding_scheme.cpp @@ -187,11 +187,6 @@ return mcs_info[m_scheme].optional_padding_bits; } -const char *GprsCodingScheme::name() const -{ - return mcs_info[m_scheme].name; -} - enum HeaderType GprsCodingScheme::headerTypeData() const { return mcs_info[m_scheme].data_hdr; diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h index 8715f16..5fa3419 100644 --- a/src/gprs_coding_scheme.h +++ b/src/gprs_coding_scheme.h @@ -81,7 +81,7 @@ uint8_t spareBitsDL() const; uint8_t maxDataBlockBytes() const; uint8_t optionalPaddingBits() const; - const char *name() const; + enum HeaderType headerTypeData() const; HeaderType headerTypeControl() const; Family family() const; diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp index e31cc87..883b92d 100644 --- a/src/gprs_ms.cpp +++ b/src/gprs_ms.cpp @@ -34,6 +34,7 @@ #include <osmocom/core/utils.h> #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/core/logging.h> + #include "coding_scheme.h" } #define GPRS_CODEL_SLOW_INTERVAL_MS 4000 @@ -527,7 +528,7 @@ LOGP(DRLCMACDL, LOGL_INFO, "MS (IMSI %s): High error rate %d%%, " "reducing CS level to %s\n", - imsi(), error_rate, m_current_cs_dl.name()); + imsi(), error_rate, mcs_name(m_current_cs_dl)); m_last_cs_not_low = now; } } else if (error_rate < bts_data->cs_adj_lower_limit) { @@ -539,7 +540,7 @@ "MS (IMSI %s): Low error rate %d%%, " "increasing DL CS level to %s\n", imsi(), error_rate, - m_current_cs_dl.name()); + mcs_name(m_current_cs_dl)); m_last_cs_not_low = now; } else { LOGP(DRLCMACDL, LOGL_DEBUG, @@ -627,7 +628,7 @@ if (!max_cs_ul) { LOGP(DRLCMACMEAS, LOGL_ERROR, "max_cs_ul cannot be derived (current UL CS: %s)\n", - m_current_cs_ul.name()); + mcs_name(m_current_cs_ul)); return; } @@ -669,7 +670,7 @@ "modifying uplink CS level: %s -> %s\n", imsi(), meas->link_qual, old_link_qual, low, high, - m_current_cs_ul.name(), new_cs_ul.name()); + mcs_name(m_current_cs_ul), mcs_name(new_cs_ul)); m_current_cs_ul = new_cs_ul; } diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index c71959d..47a0559 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -41,6 +41,7 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/core/utils.h> #include <osmocom/vty/vty.h> + #include "coding_scheme.h" } static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf) @@ -70,7 +71,7 @@ } if (tbf->trx != NULL) vty_out(vty, " TRX_ID=%d", tbf->trx->trx_no); - vty_out(vty, " CS=%s", tbf->current_cs().name()); + vty_out(vty, " CS=%s", mcs_name(tbf->current_cs())); if (ul_tbf) { gprs_rlc_ul_window *win = ul_tbf->window(); @@ -127,8 +128,8 @@ vty_out(vty, "MS TLLI=%08x, TA=%d, CS-UL=%s, CS-DL=%s, LLC=%zd, Cl=%d, E-Cl=%d," " TBF-UL=%s, TBF-DL=%s, IMSI=%s%s", ms->tlli(), - ms->ta(), ms->current_cs_ul().name(), - ms->current_cs_dl().name(), + ms->ta(), mcs_name(ms->current_cs_ul()), + mcs_name(ms->current_cs_dl()), ms->llc_queue()->size(), ms->ms_class(), ms->egprs_ms_class(), @@ -148,9 +149,9 @@ vty_out(vty, "MS TLLI=%08x, IMSI=%s%s", ms->tlli(), ms->imsi(), VTY_NEWLINE); vty_out(vty, " Timing advance (TA): %d%s", ms->ta(), VTY_NEWLINE); - vty_out(vty, " Coding scheme uplink: %s%s", ms->current_cs_ul().name(), + vty_out(vty, " Coding scheme uplink: %s%s", mcs_name(ms->current_cs_ul()), VTY_NEWLINE); - vty_out(vty, " Coding scheme downlink: %s%s", ms->current_cs_dl().name(), + vty_out(vty, " Coding scheme downlink: %s%s", mcs_name(ms->current_cs_dl()), VTY_NEWLINE); vty_out(vty, " Mode: %s%s", GprsCodingScheme::modeName(ms->mode()), VTY_NEWLINE); diff --git a/src/pdch.cpp b/src/pdch.cpp index 22a1605..c6c677c 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -43,6 +43,7 @@ #include <osmocom/core/gsmtap.h> #include <osmocom/core/logging.h> #include <osmocom/core/utils.h> + #include "coding_scheme.h" } #include <errno.h> @@ -738,7 +739,7 @@ bts()->rlc_ul_bytes(len); LOGP(DRLCMACUL, LOGL_DEBUG, "Got RLC block, coding scheme: %s, " - "length: %d (%d))\n", cs.name(), len, cs.usedSizeUL()); + "length: %d (%d))\n", mcs_name(cs), len, cs.usedSizeUL()); if (cs.isGprs()) return rcv_block_gprs(data, len, fn, meas, cs); @@ -748,7 +749,7 @@ bts()->decode_error(); LOGP(DRLCMACUL, LOGL_ERROR, "Unsupported coding scheme %s\n", - cs.name()); + mcs_name(cs)); return -EINVAL; } @@ -768,7 +769,7 @@ if (!bts()->bts_data()->egprs_enabled) { LOGP(DRLCMACUL, LOGL_ERROR, "Got %s RLC block but EGPRS is not enabled\n", - cs.name()); + mcs_name(cs)); return -EINVAL; } bts()->send_gsmtap(PCU_GSMTAP_C_UL_DATA_EGPRS, true, trx_no(), ts_no, GSMTAP_CHANNEL_PDTCH, fn, @@ -784,7 +785,7 @@ if (rc < 0) { LOGP(DRLCMACUL, LOGL_ERROR, "Got %s RLC block but header parsing has failed\n", - cs.name()); + mcs_name(cs)); bts()->decode_error(); return rc; } @@ -793,7 +794,7 @@ "Got %s RLC block: " "R=%d, SI=%d, TFI=%d, CPS=%d, RSB=%d, " "rc=%d\n", - cs.name(), + mcs_name(cs), rlc_dec.r, rlc_dec.si, rlc_dec.tfi, rlc_dec.cps, rlc_dec.rsb, rc); diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index bebeb2a..8257689 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -46,6 +46,7 @@ #include <osmocom/core/utils.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/gsm/protocol/gsm_04_08.h> + #include "coding_scheme.h" } #include <errno.h> @@ -429,7 +430,7 @@ new_cs = force_cs ? force_cs : current_cs(); LOGPTBFDL(this, LOGL_DEBUG, "Sending new block at BSN %d, CS=%s\n", - m_window.v_s(), new_cs.name()); + m_window.v_s(), mcs_name(new_cs)); bsn = create_new_bsn(fn, new_cs); } else if (!m_window.window_empty()) { @@ -443,7 +444,7 @@ /* Nothing left to send, create dummy LLC commands */ LOGPTBFDL(this, LOGL_DEBUG, "Sending new dummy block at BSN %d, CS=%s\n", - m_window.v_s(), current_cs().name()); + m_window.v_s(), mcs_name(current_cs())); bsn = create_new_bsn(fn, current_cs()); /* Don't send a second block, so don't set cs_current_trans */ } @@ -624,7 +625,7 @@ } while (ar == Encoding::AR_COMPLETED_SPACE_LEFT); LOGPTBFDL(this, LOGL_DEBUG, "data block (BSN %d, %s): %s\n", - bsn, rlc_data->cs_last.name(), + bsn, mcs_name(rlc_data->cs_last), osmo_hexdump(rlc_data->block, block_data_len)); /* raise send state and set ack state array */ m_window.m_v_b.mark_unacked(bsn); @@ -867,7 +868,7 @@ Encoding::rlc_write_dl_data_header(&rlc, msg_data); LOGPTBFDL(this, LOGL_DEBUG, "msg block (BSN %d, %s%s): %s\n", - index, cs.name(), + index, mcs_name(cs), need_padding ? ", padded" : "", msgb_hexdump(dl_msg)); @@ -1281,7 +1282,7 @@ "FIXME: Software error: hit invalid condition. " "headerType(%d) blockstatus(%d) cs(%s) PLEASE FIX!\n", cs_current_trans.headerTypeData(), - *block_status_dl, cs_init.name()); + *block_status_dl, mcs_name(cs_init)); break; } diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index bc36733..0bf5765 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -43,6 +43,7 @@ #include <osmocom/gprs/gprs_bssgp_bss.h> #include <osmocom/gprs/protocol/gsm_08_18.h> #include <osmocom/gsm/tlv.h> + #include "coding_scheme.h" } #include <errno.h> @@ -212,7 +213,7 @@ LOGPTBFUL(this, LOGL_DEBUG, "Got %s RLC data block: CV=%d, BSN=%d, SPB=%d, PI=%d, E=%d, TI=%d, bitoffs=%d\n", - rlc->cs.name(), + mcs_name(rlc->cs), rdbi->cv, rdbi->bsn, rdbi->spb, rdbi->pi, rdbi->e, rdbi->ti, rlc->data_offs_bits[block_idx]); @@ -278,7 +279,7 @@ bts->decode_error(); LOGPTBFUL(this, LOGL_NOTICE, "Failed to decode TLLI of %s UL DATA TFI=%d.\n", - rlc->cs.name(), rlc->tfi); + mcs_name(rlc->cs), rlc->tfi); m_window.invalidate_bsn(rdbi->bsn); continue; } @@ -479,7 +480,7 @@ LOGPTBFUL(this, LOGL_DEBUG, "Got SPB(%d) cs(%s) data block with BSN (%d), TFI(%d).\n", - rdbi->spb, rlc->cs.name(), rdbi->bsn, rlc->tfi); + rdbi->spb, mcs_name(rlc->cs), rdbi->bsn, rlc->tfi); egprs_rlc_ul_reseg_bsn_state assemble_status = EGPRS_RESEG_INVALID; @@ -517,7 +518,7 @@ default: LOGPTBFUL(this, LOGL_ERROR, "cs(%s) Error in Upgrading to higher MCS\n", - rlc->cs.name()); + mcs_name(rlc->cs)); break; } } -- To view, visit https://gerrit.osmocom.org/13069 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I212ebb892ab162821633974d5a6c7e315d308370 Gerrit-Change-Number: 13069 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msuraev at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190226/8d3ea0ca/attachment.htm>