Fix mcs_is_valid(): UNKNOWN value is not a valid (M)CS

Also add a few more asserts to make sure a valid CS/MCS is passed in
some placed where we expect (M)CS to be set.

Change-Id: I0a973e10cd9477f72d8bd47a06048414b33ae96a
changes/45/21045/3
Pau Espin 2 years ago
parent b47b137c66
commit f1159c559b
  1. 2
      src/coding_scheme.c
  2. 1
      src/encoding.cpp
  3. 2
      src/rlc.cpp

@ -163,7 +163,7 @@ enum CodingScheme mcs_get_egprs_by_num(unsigned num)
bool mcs_is_valid(enum CodingScheme cs)
{
return UNKNOWN <= cs && cs <= MCS9;
return UNKNOWN < cs && cs <= MCS9;
}
bool mcs_is_compat_kind(enum CodingScheme cs, enum mcs_kind mode)

@ -1692,6 +1692,7 @@ Encoding::AppendResult Encoding::rlc_data_to_dl_append(
LOGP(DRLCMACDL, LOGL_ERROR, "%s data block encoding not implemented\n",
mcs_name(cs));
OSMO_ASSERT(mcs_is_valid(cs));
return AR_NEED_MORE_BLOCKS;
}

@ -350,6 +350,7 @@ static void gprs_rlc_data_header_init(struct gprs_rlc_data_info *rlc,
void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
enum CodingScheme cs, bool with_padding, const unsigned int spb)
{
OSMO_ASSERT(mcs_is_valid(cs));
return gprs_rlc_data_header_init(rlc, cs, with_padding,
num_data_header_bits_DL(mcs_header_type(cs)), spb);
}
@ -357,6 +358,7 @@ void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
enum CodingScheme cs, bool with_padding)
{
OSMO_ASSERT(mcs_is_valid(cs));
/*
* last parameter is sent as 0 since common function used
* for both DL and UL

Loading…
Cancel
Save