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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/19513 ) Change subject: pcuif_proto: version 10: add frequency hopping parameters ...................................................................... pcuif_proto: version 10: add frequency hopping parameters Change-Id: I04782222b499d0488269544910fbd4ed9929c05d Related: Idf11bc4ba3ff0b00b32f2beab8fd020c67119d05 Related: SYS#4868, OS#4546, OS#4547 --- M include/osmo-bts/pcuif_proto.h M src/common/pcu_sock.c 2 files changed, 99 insertions(+), 5 deletions(-) Approvals: lynxis lazus: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index e88607e..80d4f90 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -5,7 +5,7 @@ #define PCU_SOCK_DEFAULT "/tmp/pcu_bts" -#define PCU_IF_VERSION 0x09 +#define PCU_IF_VERSION 0x0a #define TXT_MAX_LEN 128 /* msg_type */ @@ -112,12 +112,21 @@ uint8_t ts_nr; } __attribute__ ((packed)); +struct gsm_pcu_if_info_trx_ts { + uint8_t tsc; + uint8_t hopping; + uint8_t hsn; + uint8_t maio; + uint8_t ma_bit_len; + uint8_t ma[8]; +} __attribute__ ((packed)); + struct gsm_pcu_if_info_trx { uint16_t arfcn; - uint8_t pdch_mask; /* PDCH channels per TS */ + uint8_t pdch_mask; /* PDCH timeslot mask */ uint8_t spare; - uint8_t tsc[8]; /* TSC per channel */ uint32_t hlayer1; + struct gsm_pcu_if_info_trx_ts ts[8]; } __attribute__ ((packed)); struct gsm_pcu_if_info_ind { diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 9464311..f5ead3b 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -115,6 +115,82 @@ } } +/* As a BTS, we do not (and neither need to) know the Mobile Allocation, because + * in CS domain it's responsibility of the BSC to encode RR messages containing + * this IE. However, a BTS co-located PCU needs to know all hopping parameters, + * including the Mobile Allocation, because it's responsible for encoding of the + * packet resource assignment messages. + * + * This function, similar to generate_ma_for_ts() in osmo-bsc, computes the + * Mobile Allocation bit-mask and populates the given part of INFO.ind with + * the hopping parameters for the given timeslot. */ +static void info_ind_fill_fhp(struct gsm_pcu_if_info_trx_ts *ts_info, + const struct gsm_bts_trx_ts *ts) +{ + const struct gsm_bts *bts = ts->trx->bts; + const struct gsm_bts_trx *trx; + uint8_t ca_buf[1024 / 8] = { 0 }; + uint8_t sa_buf[1024 / 8] = { 0 }; + struct bitvec ca, sa, ma; + unsigned int i; + + ts_info->maio = ts->hopping.maio; + ts_info->hsn = ts->hopping.hsn; + ts_info->hopping = 0x01; + + /* Cell Allocation bit-mask */ + ca = (struct bitvec) { + .data_len = sizeof(ca_buf), + .data = &ca_buf[0], + }; + + llist_for_each_entry(trx, &bts->trx_list, list) { + /* Skip non-provisioned transceivers */ + if (trx->mo.nm_attr == NULL) { + LOGPTRX(trx, DPCU, LOGL_NOTICE, "not (yet) provisioned\n"); + continue; + } + + bitvec_set_bit_pos(&ca, trx->arfcn, ONE); + ts_info->ma_bit_len++; + } + + /* Slot Allocation bit-mask */ + sa = (struct bitvec) { + .data_len = sizeof(sa_buf), + .data = &sa_buf[0], + }; + + for (i = 0; i < ts->hopping.arfcn_num; i++) { + bitvec_set_bit_pos(&sa, ts->hopping.arfcn_list[i], ONE); + if (bitvec_get_bit_pos(&ca, ts->hopping.arfcn_list[i]) != ONE) { + LOGP(DPCU, LOGL_NOTICE, "A transceiver with ARFCN %u " + "is not (yet) provisioned\n", ts->hopping.arfcn_list[i]); + bitvec_set_bit_pos(&ca, ts->hopping.arfcn_list[i], ONE); + ts_info->ma_bit_len++; + } + } + + /* Mobile Allocation bit-mask */ + ma = (struct bitvec) { + .cur_bit = sizeof(ts_info->ma) * 8 - 1, + .data_len = sizeof(ts_info->ma), + .data = &ts_info->ma[0], + }; + + /* Skip ARFCN 0, it goes to the end of MA bit-mask */ + for (i = 1; i < sizeof(ca_buf) * 8; i++) { + if (bitvec_get_bit_pos(&ca, i) != ONE) + continue; + if (bitvec_get_bit_pos(&sa, i) == ONE) + bitvec_set_bit_pos(&ma, ma.cur_bit, ONE); + ma.cur_bit--; + } + + if (bitvec_get_bit_pos(&sa, 0) == ONE) + bitvec_set_bit_pos(&ma, ma.cur_bit, ONE); +} + static void info_ind_fill_trx(struct gsm_pcu_if_info_trx *trx_info, const struct gsm_bts_trx *trx) { @@ -141,10 +217,19 @@ continue; trx_info->pdch_mask |= (1 << tn); - trx_info->tsc[tn] = gsm_ts_tsc(ts); + trx_info->ts[tn].tsc = gsm_ts_tsc(ts); + + if (ts->hopping.enabled) + info_ind_fill_fhp(&trx_info->ts[tn], ts); LOGPTRX(trx, DPCU, LOGL_INFO, "PDCH on ts=%u is available " - "(tsc=%u arfcn=%u)\n", ts->nr, trx_info->tsc[tn], trx->arfcn); + "(tsc=%u ", ts->nr, trx_info->ts[tn].tsc); + if (ts->hopping.enabled) { + LOGPC(DPCU, LOGL_INFO, "hopping=yes hsn=%u maio=%u ma_bit_len=%u)\n", + ts->hopping.hsn, ts->hopping.maio, trx_info->ts[tn].ma_bit_len); + } else { + LOGPC(DPCU, LOGL_INFO, "hopping=no arfcn=%u)\n", trx->arfcn); + } } } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/19513 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I04782222b499d0488269544910fbd4ed9929c05d Gerrit-Change-Number: 19513 Gerrit-PatchSet: 4 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200921/cadbd958/attachment.htm>