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/5656 Clarify RACH-related interfaces * make is_11bit parameter into bool * remove is_single_block() from public interface and mark it as static * move logging outside of if ladder * move side-effects from is_single_block() into separate static functions * simplify UL-TBF allocation in case of 11-bit RACH This immediately makes it obvious that priority is never actually used despite being computed - seems like a leftover from merge of incomplete patch series. Change-Id: If189b7166a29a87ffb17a7a9bc560f674851fd53 Related: OS#1548 --- M src/bts.cpp M src/bts.h 2 files changed, 87 insertions(+), 82 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/56/5656/1 diff --git a/src/bts.cpp b/src/bts.cpp index 4bc792a..3a28ae8 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -615,7 +615,89 @@ return fn; } -int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, +static inline uint16_t mslot_class_from_ra(uint16_t ra, bool is_11bit) +{ + if (is_11bit) + return (ra & 0x3e0) >> 5; + + /* set multislot class to 0 for 8-bit RACH, since we don't know it yet */ + return 0; +} + +static inline uint16_t priority_from_ra(uint16_t ra, bool is_11bit) +{ + if (is_11bit) + return (ra & 0x18) >> 3; + + return 0; +} + +static inline bool is_single_block(bool force_two_phase, uint16_t ra, enum ph_burst_type burst_type, bool is_11bit) +{ + bool sb = false; + + if ((ra & 0xf8) == 0x70) + LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block allocation\n"); + else if (force_two_phase) + LOGP(DRLCMAC, LOGL_DEBUG, + "MS requests single phase access, but we force two phase access [RACH is %s bit]\n", + is_11bit ? "11" : "8"); + + if (!is_11bit && (burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) { + + if ((ra & 0xf8) == 0x70) + sb = true; + else if (force_two_phase) { + LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single " + "phase access, but we force two phase " + "access\n"); + sb = true; + } + + } else if (is_11bit && + ((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) || + (burst_type == GSM_L1_BURST_TYPE_ACCESS_2))) { + + if (!(ra & (1 << 10))) { + if (force_two_phase) { + LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH " + "received. MS requests single phase " + "access but we force two phase " + "access\n"); + sb = true; + } else + sb = false; + } else { + LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH received." + "MS requests single block allocation\n"); + sb = true; + } + + } else if (is_11bit && + (burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) { + LOGP(DRLCMAC, LOGL_ERROR, + "Error: GPRS 11 bit RACH not supported\n"); + + } else if (burst_type == GSM_L1_BURST_TYPE_NONE) { + LOGP(DRLCMAC, LOGL_DEBUG, "pcu has not received burst type " + "from bts \n"); + + if ((ra & 0xf8) == 0x70) { + LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block " + "allocation\n"); + sb = true; + } else if (force_two_phase) { + LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single " + "phase access, but we force two phase " + "access\n"); + sb = true; + } + } + + return sb; +} + +int BTS::rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, bool is_11bit, enum ph_burst_type burst_type) { struct gprs_rlcmac_ul_tbf *tbf = NULL; @@ -626,8 +708,7 @@ int plen; uint8_t usf = 7; uint8_t tsc = 0, ta = qta2ta(qta); - uint16_t ms_class = 0; - uint16_t priority = 0; + uint16_t ms_class = mslot_class_from_ra(ra, is_11bit); bool failure = false; rach_frame(); @@ -642,7 +723,7 @@ "so we provide one: ra=0x%02x Fn=%u qta=%d is_11bit=%d:\n", ra, Fn, qta, is_11bit); - sb = is_single_block(ra, burst_type, is_11bit, &ms_class, &priority); + sb = is_single_block(m_bts.force_two_phase, ra, burst_type, is_11bit); if (sb) { rc = sba()->alloc(&trx_no, &ts_no, &sb_fn, ta); @@ -668,14 +749,7 @@ // Create new TBF /* FIXME: Copy and paste with other routines.. */ - if (is_11bit) { - tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, - ms_class, 1); - } else { - /* set class to 0, since we don't know the multislot - * class yet */ - tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, 0, 1); - } + tbf = tbf_alloc_ul_tbf(&m_bts, NULL, -1, 0, ms_class, 1); if (!tbf) { LOGP(DRLCMAC, LOGL_NOTICE, "No PDCH resource sending " @@ -732,73 +806,6 @@ bitvec_free(immediate_assignment); return rc; -} - -uint8_t BTS::is_single_block(uint16_t ra, enum ph_burst_type burst_type, - uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority) -{ - uint8_t sb = 0, val = 0; - - if (!is_11bit && (burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) { - - if ((ra & 0xf8) == 0x70) { - LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block " - "allocation\n"); - sb = 1; - } else if (m_bts.force_two_phase) { - LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single " - "phase access, but we force two phase " - "access\n"); - sb = 1; - } - - } else if (is_11bit && - ((burst_type == GSM_L1_BURST_TYPE_ACCESS_1) || - (burst_type == GSM_L1_BURST_TYPE_ACCESS_2))) { - - val = !!(ra & (1 << 10)); - - if (!val) { - if (m_bts.force_two_phase) { - LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH " - "received. MS requests single phase " - "access but we force two phase " - "access\n"); - sb = 1; - } else { - sb = 0; - *ms_class = (ra & 0x3e0) >> 5; - *priority = (ra & 0x18) >> 3; - } - - } else { - LOGP(DRLCMAC, LOGL_DEBUG, "EGPRS 11 bit RACH received." - "MS requests single block allocation\n"); - sb = 1; - } - - } else if (is_11bit && - (burst_type == GSM_L1_BURST_TYPE_ACCESS_0)) { - LOGP(DRLCMAC, LOGL_ERROR, - "Error: GPRS 11 bit RACH not supported\n"); - - } else if (burst_type == GSM_L1_BURST_TYPE_NONE) { - LOGP(DRLCMAC, LOGL_DEBUG, "pcu has not received burst type " - "from bts \n"); - - if ((ra & 0xf8) == 0x70) { - LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single block " - "allocation\n"); - sb = 1; - } else if (m_bts.force_two_phase) { - LOGP(DRLCMAC, LOGL_DEBUG, "MS requests single " - "phase access, but we force two phase " - "access\n"); - sb = 1; - } - } - - return sb; } void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi) diff --git a/src/bts.h b/src/bts.h index a32e87d..b1724c9 100644 --- a/src/bts.h +++ b/src/bts.h @@ -368,11 +368,9 @@ int tfi_find_free(enum gprs_rlcmac_tbf_direction dir, uint8_t *_trx, int8_t use_trx); int rcv_imm_ass_cnf(const uint8_t *data, uint32_t fn); - uint8_t is_single_block(uint16_t ra, enum ph_burst_type burst_type, - uint8_t is_11bit, uint16_t *ms_class, uint16_t *priority); uint32_t rfn_to_fn(int32_t rfn); - int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, uint8_t is_11bit, + int rcv_rach(uint16_t ra, uint32_t Fn, int16_t qta, bool is_11bit, enum ph_burst_type burst_type); void snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi); -- To view, visit https://gerrit.osmocom.org/5656 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If189b7166a29a87ffb17a7a9bc560f674851fd53 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>