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.orgReview at https://gerrit.osmocom.org/5336 window: move encoding into functions * move window size encoding and writing into separate functions * introduce necessary TBF wrappers to avoid direct m_window access This is part of preparation work to move to separate UL/DL windows. Related: OS#1759 Change-Id: I60184d5049bc7d7b119df5a9eb82d1c4b788c840 --- M src/encoding.cpp M src/encoding.h M src/tbf.h 3 files changed, 33 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/36/5336/1 diff --git a/src/encoding.cpp b/src/encoding.cpp index 6742efd..3e86222 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -60,6 +60,21 @@ } } +/* 3GPP TS 44.060 Table 12.5.2.1 */ +static inline uint16_t enc_ws(uint16_t ws) +{ + return (ws - 64) / 32; +} + +static inline void write_ws(bitvec *dest, unsigned int *write_index, uint16_t ws) +{ + dest->cur_bit = *write_index; + + bitvec_set_u64(dest, enc_ws(ws), 5, false); + + *write_index += 5; +} + /* 3GPP TS 44.060 § 12.12: { 0 | 1 < TIMING_ADVANCE_VALUE : bit (6) > } { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > @@ -114,9 +129,8 @@ // bitvec_write_field(dest, &wp,,0xb,4); if (tbf->is_egprs_enabled()) { /* see GMS 44.018, 10.5.2.16 */ - unsigned int ws_enc = (tbf->m_window.ws() - 64) / 32; bitvec_write_field(dest, &wp, 1, 1); // "H" - bitvec_write_field(dest, &wp, ws_enc, 5); // EGPRS Window Size + write_ws(dest, &wp, tbf->ws()); // EGPRS Window Size bitvec_write_field(dest, &wp, 0x0, 2); // LINK_QUALITY_MEASUREMENT_MODE bitvec_write_field(dest, &wp, 0, 1); // BEP_PERIOD2 not present } @@ -178,7 +192,6 @@ uint8_t alpha, uint8_t gamma, int8_t ta_idx, enum ph_burst_type burst_type, uint16_t ra) { - unsigned int ws_enc = 0; uint8_t extended_ra = 0; extended_ra = (ra & 0x1F); @@ -208,9 +221,6 @@ bitvec_write_field(dest, &wp, 0, 1); } else { - - ws_enc = (tbf->m_window.ws() - 64) / 32; - bitvec_write_field(dest, &wp, 1, 1); /* single block alloc */ bitvec_write_field(dest, &wp, tbf->tfi(), 5);/* TFI assignment */ bitvec_write_field(dest, &wp, 0, 1); /* polling bit */ @@ -224,7 +234,7 @@ bitvec_write_field(dest, &wp, tbf->tlli(), 1); bitvec_write_field(dest, &wp, 0, 1); /* BEP period present */ bitvec_write_field(dest, &wp, 0, 1); /* resegmentation */ - bitvec_write_field(dest, &wp, ws_enc, 5);/* egprs window_size */ + write_ws(dest, &wp, tbf->ws());/* egprs window_size */ if (alpha) { bitvec_write_field(dest, &wp, 0x1, 1); /* ALPHA =yes */ @@ -450,7 +460,6 @@ bitvec_write_field(dest, &wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING write_ta_ie(dest, wp,tbf->ta(), ta_idx, ta_ts); } else { /* EPGRS */ - unsigned int ws_enc = (tbf->m_window.ws() - 64) / 32; bitvec_write_field(dest, &wp,0x1,1); // Message escape bitvec_write_field(dest, &wp,0x0,2); // EGPRS message contents bitvec_write_field(dest, &wp,0x0,1); // No CONTENTION_RESOLUTION_TLLI @@ -458,7 +467,7 @@ bitvec_write_field(dest, &wp,tbf->current_cs().to_num()-1, 4); // EGPRS Modulation and Coding IE /* 0: no RESEGMENT, 1: Segmentation*/ bitvec_write_field(dest, &wp, 0x1, 1); - bitvec_write_field(dest, &wp,ws_enc,5); // EGPRS Window Size + write_ws(dest, &wp, tbf->ws()); // EGPRS Window Size bitvec_write_field(dest, &wp,0x0,1); // No Access Technologies Request bitvec_write_field(dest, &wp,0x0,1); // No ARAC RETRANSMISSION REQUEST bitvec_write_field(dest, &wp,0x1,1); // TLLI_BLOCK_CHANNEL_CODING @@ -509,7 +518,7 @@ /* generate downlink assignment */ void Encoding::write_packet_downlink_assignment(RlcMacDownlink_t * block, bool old_tfi_is_valid, uint8_t old_tfi, uint8_t old_downlink, - struct gprs_rlcmac_tbf *tbf, uint8_t poll, uint8_t rrbp, + struct gprs_rlcmac_dl_tbf *tbf, uint8_t poll, uint8_t rrbp, uint8_t alpha, uint8_t gamma, int8_t ta_idx, uint8_t ta_ts, bool use_egprs) { @@ -518,7 +527,6 @@ PDA_AdditionsR99_t *pda_r99; uint8_t tn; - unsigned int ws_enc; block->PAYLOAD_TYPE = 0x1; // RLC/MAC control block that does not include the optional octets of the RLC/MAC control header block->RRBP = rrbp; // 0: N+13 @@ -591,12 +599,10 @@ return; } - ws_enc = (tbf->window()->ws() - 64) / 32; - block->u.Packet_Downlink_Assignment.Exist_AdditionsR99 = 0x1; // AdditionsR99 = on pda_r99 = &block->u.Packet_Downlink_Assignment.AdditionsR99; pda_r99->Exist_EGPRS_Params = 1; - pda_r99->EGPRS_WindowSize = ws_enc; /* see TS 44.060, table 12.5.2.1 */ + pda_r99->EGPRS_WindowSize = enc_ws(tbf->ws()); /* see TS 44.060, table 12.5.2.1 */ pda_r99->LINK_QUALITY_MEASUREMENT_MODE = 0x0; /* no meas, see TS 44.060, table 11.2.7.2 */ pda_r99->Exist_BEP_PERIOD2 = 0; /* No extra EGPRS BEP PERIOD */ pda_r99->Exist_Packet_Extended_Timing_Advance = 0; diff --git a/src/encoding.h b/src/encoding.h index 6164b89..54cb057 100644 --- a/src/encoding.h +++ b/src/encoding.h @@ -68,7 +68,7 @@ static void write_packet_downlink_assignment(RlcMacDownlink_t * block, bool old_tfi_is_valid, uint8_t old_tfi, uint8_t old_downlink, - struct gprs_rlcmac_tbf *tbf, uint8_t poll, uint8_t rrbp, + struct gprs_rlcmac_dl_tbf *tbf, uint8_t poll, uint8_t rrbp, uint8_t alpha, uint8_t gamma, int8_t ta_idx, uint8_t ta_ts, bool use_egprs); diff --git a/src/tbf.h b/src/tbf.h index 558bd21..3b48238 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -441,7 +441,7 @@ bool keep_open(unsigned fn) const; int release(); int abort(); - + uint16_t ws() const; void egprs_calc_window_size(); void update_coding_scheme_counter_dl(const GprsCodingScheme cs); @@ -539,7 +539,7 @@ uint8_t *data, const uint8_t block_idx); void egprs_calc_ulwindow_size(); - + uint16_t ws() const; void update_coding_scheme_counter_ul(const GprsCodingScheme cs); /* Please note that all variables here will be reset when changing @@ -576,6 +576,16 @@ ((int)GPRS_RLCMAC_UL_TBF - (int)dir + (int)GPRS_RLCMAC_DL_TBF); } +inline uint16_t gprs_rlcmac_ul_tbf::ws() const +{ + return m_window.ws(); +} + +inline uint16_t gprs_rlcmac_dl_tbf::ws() const +{ + return m_window.ws(); +} + inline void gprs_rlcmac_ul_tbf::enable_egprs() { m_window.set_sns(RLC_EGPRS_SNS); -- To view, visit https://gerrit.osmocom.org/5336 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I60184d5049bc7d7b119df5a9eb82d1c4b788c840 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>