lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2023

  • 1 participants
  • 3642 discussions
[M] Change in osmo-bsc[master]: pcu_sock: handle multiple BTSs with one BSC co-located PCU (in theory)
by laforge 20 Mar '23

20 Mar '23
Attention is currently required from: neels, fixeria, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31618 ) Change subject: pcu_sock: handle multiple BTSs with one BSC co-located PCU (in theory) ...................................................................... Patch Set 13: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31618 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I0b42c2c130106f6ffca2dd08d079e1a7bda41f0b Gerrit-Change-Number: 31618 Gerrit-PatchSet: 13 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 20 Mar 2023 12:52:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: pcu_sock.c: Call osmo_fd_unregister() before closing and changing lis...
by laforge 20 Mar '23

20 Mar '23
Attention is currently required from: pespin, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31982 ) Change subject: pcu_sock.c: Call osmo_fd_unregister() before closing and changing listen_bfd->fd ...................................................................... Patch Set 1: (1 comment) File src/osmo-bsc/pcu_sock.c: https://gerrit.osmocom.org/c/osmo-bsc/+/31982/comment/9b2150d3_5922439f PS1, Line 1015: close(bfd->fd); > Also if possible set bfd->fd to -1. […] Ack -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31982 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I48e0411c4cba9897bc04865d22d8f68ed4fe87a2 Gerrit-Change-Number: 31982 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 20 Mar 2023 12:52:21 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-pcu[master]: doc: add sample config to illustrate how to use an E1 CCU
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31736 ) ( 6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: doc: add sample config to illustrate how to use an E1 CCU ...................................................................... doc: add sample config to illustrate how to use an E1 CCU Let's add an example to illustrate how to use an E1 CCU with OsmoPCU. Change-Id: I1fd0bb6b0c3fe031d5241355c66b01b6ca45b1de Related: OS#5198 --- A doc/examples/osmo-pcu.e1_ccu.cfg 1 file changed, 21 insertions(+), 0 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified Objections: pespin: I would prefer this is not merged as is diff --git a/doc/examples/osmo-pcu.e1_ccu.cfg b/doc/examples/osmo-pcu.e1_ccu.cfg new file mode 100644 index 0000000..01f9b09 --- /dev/null +++ b/doc/examples/osmo-pcu.e1_ccu.cfg @@ -0,0 +1,9 @@ +pcu + flow-control-interval 10 + cs 2 + alloc-algorithm dynamic + gamma 0 +e1_input + e1_line 0 driver dahdi + e1_line 0 port 2 + no e1_line 0 keepalive -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31736 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I1fd0bb6b0c3fe031d5241355c66b01b6ca45b1de Gerrit-Change-Number: 31736 Gerrit-PatchSet: 7 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-pcu[master]: pcu_l1_if: get rid of strange paging group calculation
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31650 ) ( 13 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pcu_l1_if: get rid of strange paging group calculation ...................................................................... pcu_l1_if: get rid of strange paging group calculation The PCU uses a 16 bit integer value as paging group which does in fact not really resamble the paging group. Instead it encodes the last three digits of the IMSI from which the paging group can be calculated. The value is then eventually converted back to Ascii-digits and then sent over the PCU-IF interface. Lets get rid of this weird conversion and use the IMSI directly. Change-Id: I40d7fc14c9591b3de091e425faaf325421c70a0e --- M src/bts.cpp M src/gprs_bssgp_pcu.c M src/gprs_ms.c M src/gprs_ms.h M src/gprs_rlcmac.cpp M src/gprs_rlcmac.h M src/pcu_l1_if.cpp M src/pcu_l1_if.h 8 files changed, 32 insertions(+), 60 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/bts.cpp b/src/bts.cpp index 504ba27..524961d 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1131,7 +1131,7 @@ if (the_pcu->pcu_if_version >= 0x0b) pcu_l1if_tx_pch_dt(bts, immediate_assignment, plen, tbf->imsi(), tbf->tlli()); else - pcu_l1if_tx_pch(bts, immediate_assignment, plen, ms_paging_group(tbf_ms(tbf))); + pcu_l1if_tx_pch(bts, immediate_assignment, plen, tbf->imsi()); } bitvec_free(immediate_assignment); diff --git a/src/gprs_bssgp_pcu.c b/src/gprs_bssgp_pcu.c index f441437..656342e 100644 --- a/src/gprs_bssgp_pcu.c +++ b/src/gprs_bssgp_pcu.c @@ -289,7 +289,6 @@ struct osmo_mobile_identity mi_imsi; struct osmo_mobile_identity paging_mi; struct gprs_rlcmac_bts *bts; - uint16_t pgroup; int rc; rate_ctr_inc(rate_ctr_group_get_ctr(the_pcu->bssgp.ctrs, SGSN_CTR_RX_PAGING_PS)); @@ -304,11 +303,6 @@ LOGP(DBSSGP, LOGL_NOTICE, "Failed to parse IMSI IE (rc=%d)\n", rc); return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg); } - pgroup = imsi2paging_group(mi_imsi.imsi); - if (pgroup > 999) { - LOGP(DBSSGP, LOGL_NOTICE, "Failed to compute IMSI %s paging group\n", mi_imsi.imsi); - return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg); - } if ((rc = get_paging_ps_mi(&paging_mi, tp)) > 0) return bssgp_tx_status((enum gprs_bssgp_cause) rc, NULL, msg); @@ -320,7 +314,7 @@ bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS_ALREADY); continue; } - if (gprs_rlcmac_paging_request(bts, &paging_mi, pgroup) < 0) + if (gprs_rlcmac_paging_request(bts, &paging_mi, mi_imsi.imsi) < 0) continue; bts_pch_timer_start(bts, &paging_mi, mi_imsi.imsi); } diff --git a/src/gprs_ms.c b/src/gprs_ms.c index eb76fa2..7ecaae4 100644 --- a/src/gprs_ms.c +++ b/src/gprs_ms.c @@ -577,18 +577,6 @@ tbf_update_state_fsm_name(dl_tbf_as_tbf(ms->dl_tbf)); } -uint16_t ms_paging_group(struct GprsMs *ms) -{ - uint16_t pgroup; - if (!ms_imsi_is_valid(ms)) - return 0; /* 000 is the special "all paging" group */ - if ((pgroup = imsi2paging_group(ms_imsi(ms))) > 999) { - LOGPMS(ms, DRLCMAC, LOGL_ERROR, "IMSI to paging group failed!\n"); - return 0; - } - return pgroup; -} - void ms_set_ta(struct GprsMs *ms, uint8_t ta_) { if (ta_ == ms->ta) diff --git a/src/gprs_ms.h b/src/gprs_ms.h index 835ff18..9b957ac 100644 --- a/src/gprs_ms.h +++ b/src/gprs_ms.h @@ -131,7 +131,6 @@ void ms_set_tlli(struct GprsMs *ms, uint32_t tlli); bool ms_confirm_tlli(struct GprsMs *ms, uint32_t tlli); void ms_set_imsi(struct GprsMs *ms, const char *imsi); -uint16_t ms_paging_group(struct GprsMs *ms); void ms_update_l1_meas(struct GprsMs *ms, const struct pcu_l1_meas *meas); diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp index 1ea0872..ea7fb9a 100644 --- a/src/gprs_rlcmac.cpp +++ b/src/gprs_rlcmac.cpp @@ -29,7 +29,7 @@ extern void *tall_pcu_ctx; int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, - uint16_t pgroup) + const char *imsi) { if (log_check_level(DRLCMAC, LOGL_NOTICE)) { char str[64]; @@ -44,7 +44,7 @@ return -1; } bts_do_rate_ctr_inc(bts, CTR_PCH_REQUESTS); - pcu_l1if_tx_pch(bts, paging_request, plen, pgroup); + pcu_l1if_tx_pch(bts, paging_request, plen, imsi); bitvec_free(paging_request); return 0; diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h index 22a33b4..43f5095 100644 --- a/src/gprs_rlcmac.h +++ b/src/gprs_rlcmac.h @@ -100,7 +100,7 @@ extern "C" { #endif -int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, uint16_t pgroup); +int gprs_rlcmac_paging_request(struct gprs_rlcmac_bts *bts, const struct osmo_mobile_identity *mi, const char *imsi); #ifdef __cplusplus } #endif diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 6ec806b..84d39cb 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -59,8 +59,6 @@ extern void *tall_pcu_ctx; -#define PAGING_GROUP_LEN 3 - struct e1_ccu_conn_pars { struct llist_head entry; @@ -78,27 +76,6 @@ * when it is needed. */ static LLIST_HEAD(e1_ccu_table); -/* returns [0,999] on success, > 999 on error */ -uint16_t imsi2paging_group(const char* imsi) -{ - uint16_t pgroup = 0; - size_t len; - - len = (imsi != NULL) ? strlen(imsi) : 0; - if (len < PAGING_GROUP_LEN) - return 0xFFFF; - imsi += len - PAGING_GROUP_LEN; - - while (*imsi != '\0') { - if (!isdigit(*imsi)) - return 0xFFFF; - pgroup *= 10; - pgroup += *imsi - '0'; - imsi++; - } - return pgroup; -} - /* * PCU messages */ @@ -286,24 +263,23 @@ pcu_tx_data_req(bts, 0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, sizeof(data)); } -void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, uint16_t pgroup) +#define IMSI_DIGITS_FOR_PAGING 3 +void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi) { - uint8_t data[PAGING_GROUP_LEN + GSM_MACBLOCK_LEN]; - int i; + uint8_t data[IMSI_DIGITS_FOR_PAGING + GSM_MACBLOCK_LEN]; - /* prepend paging group */ - for (i = 0; i < PAGING_GROUP_LEN; i++) { - data[PAGING_GROUP_LEN - 1 - i] = '0' + (char)(pgroup % 10); - pgroup = pgroup / 10; - } - OSMO_ASSERT(pgroup == 0); + /* prepend last three IMSI digits (if present) from which BTS/BSC will calculate the paging group */ + if (imsi && strlen(imsi) >= IMSI_DIGITS_FOR_PAGING) + memcpy(data, imsi + strlen(imsi) - IMSI_DIGITS_FOR_PAGING, IMSI_DIGITS_FOR_PAGING); + else + memset(data, '0', IMSI_DIGITS_FOR_PAGING); /* block provided by upper layer comes without first byte (plen), * prepend it manually: */ - OSMO_ASSERT(sizeof(data) >= PAGING_GROUP_LEN + 1 + block->data_len); + OSMO_ASSERT(sizeof(data) >= IMSI_DIGITS_FOR_PAGING + 1 + block->data_len); data[3] = (plen << 2) | 0x01; - bitvec_pack(block, data + PAGING_GROUP_LEN + 1); + bitvec_pack(block, data + IMSI_DIGITS_FOR_PAGING + 1); if (the_pcu->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH)) gsmtap_send(the_pcu->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, data + 3, GSM_MACBLOCK_LEN); diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index d3d70e4..3865402 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -148,7 +148,7 @@ uint8_t *data, size_t data_len); void pcu_l1if_tx_agch(struct gprs_rlcmac_bts *bts, bitvec *block, int len); -void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, uint16_t pgroup); +void pcu_l1if_tx_pch(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi); void pcu_l1if_tx_pch_dt(struct gprs_rlcmac_bts *bts, bitvec *block, int plen, const char *imsi, uint32_t tlli); #endif @@ -176,7 +176,6 @@ uint8_t len, uint32_t fn, struct pcu_l1_meas *meas); void pcu_rx_block_time(struct gprs_rlcmac_bts *bts, uint16_t arfcn, uint32_t fn, uint8_t ts_no); -uint16_t imsi2paging_group(const char* imsi); struct e1_conn_pars { /* Number of E1 line */ -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31650 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I40d7fc14c9591b3de091e425faaf325421c70a0e Gerrit-Change-Number: 31650 Gerrit-PatchSet: 14 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-pcu[master]: pcu_l1_if: do not copy IMSI when it is NULL
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31737 ) ( 6 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pcu_l1_if: do not copy IMSI when it is NULL ...................................................................... pcu_l1_if: do not copy IMSI when it is NULL The parameter imsi of pcu_l1if_tx_pch_dt() could be NULL. In those cases we should ensure that struct gsm_pcu_if_pch_dt is populated with a zero length string. Related: OS#5198 Change-Id: I9192d50dd78be0a72ffdb9bfb9ed66aef085bcf1 --- M src/pcu_l1_if.cpp 1 file changed, 17 insertions(+), 2 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 84d39cb..bbeb3aa 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -294,10 +294,11 @@ * it is not guaranteed to work with other message types. The prepended TLLI will be used as an identifier in * the confirmation message. */ - struct gsm_pcu_if_pch_dt pch_dt; + struct gsm_pcu_if_pch_dt pch_dt = { 0 }; pch_dt.tlli = tlli; - strcpy(pch_dt.imsi, imsi); + if (imsi) + OSMO_STRLCPY_ARRAY(pch_dt.imsi, imsi); pch_dt.data[0] = (plen << 2) | 0x01; bitvec_pack(block, pch_dt.data + 1); -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31737 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I9192d50dd78be0a72ffdb9bfb9ed66aef085bcf1 Gerrit-Change-Number: 31737 Gerrit-PatchSet: 7 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[XL] Change in osmo-pcu[master]: support for Ericsson RBS E1 CCU
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31176 ) Change subject: support for Ericsson RBS E1 CCU ...................................................................... support for Ericsson RBS E1 CCU Ericsson RBS series BTSs do not have a built in PCU. Rather than having the PCU on board the PCU is co-located to the BSC in those cases. Just like the MGW the PCU would connect to the CCU (Channel Coding Unit) via E1 line. The PCU is connected via an unix domain socket (pcu_sock) to the BSC to receive RACH requests and to control Paging and TBF assignment. This patch adds all the required functionality to run an Ercisson RBS in GPRS/EGPRS mode. It supports 16k I.460 E1 subslots and full 64k E1 timeslots (recommended) Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Related: OS#5198 --- M configure.ac M contrib/jenkins.sh M contrib/osmo-pcu.spec.in M debian/control M debian/rules M src/Makefile.am A src/ericsson-rbs/er_ccu_descr.h A src/ericsson-rbs/er_ccu_if.c A src/ericsson-rbs/er_ccu_if.h A src/ericsson-rbs/er_ccu_l1_if.c M src/gprs_debug.c M src/gprs_debug.h M src/pcu_l1_if.cpp M src/pcu_l1_if.h 14 files changed, 1,169 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/configure.ac b/configure.ac index 31286f4..bad70e3 100644 --- a/configure.ac +++ b/configure.ac @@ -167,6 +167,18 @@ CPPFLAGS=$oldCPPFLAGS fi +AC_MSG_CHECKING([whether to enable direct E1 CCU access for PDCH of Ericsson RBS]) +AC_ARG_ENABLE(er-e1-ccu, + AC_HELP_STRING([--enable-er-e1-ccu], + [enable code for Ericsson RBS E1 CCU [default=no]]), + [enable_er_e1_ccu="$enableval"],[enable_er_e1_ccu="no"]) +AC_MSG_RESULT([$enable_er_e1_ccu]) +AM_CONDITIONAL(ENABLE_ER_E1_CCU, test "x$enable_er_e1_ccu" = "xyes") +AS_IF([test "x$enable_er_e1_ccu" = "xyes"], [ + PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.4.0) + PKG_CHECK_MODULES(LIBOSMOTRAU, libosmotrau >= 1.4.0) +]) + AC_ARG_ENABLE([vty_tests], AC_HELP_STRING([--enable-vty-tests], [Include the VTY tests in make check [default=no]]), diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 7c620b9..e7b9c76 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -55,8 +55,8 @@ cd "$base" elif [ -z "$with_dsp" -o "$with_dsp" = none ]; then - echo "Direct DSP access disabled, sanitizer enabled" - PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize" + echo "Ericsson E1 CCU support enabled, sanitizer enabled" + PCU_CONFIG="$PCU_CONFIG --enable-werror --enable-sanitize --enable-er-e1-ccu" else echo 'Invalid $with_dsp value:' $with_dsp exit 1 @@ -80,6 +80,8 @@ export LD_LIBRARY_PATH="$inst/lib" export PATH="$inst/bin:$PATH" +osmo-build-dep.sh libosmo-abis "" --disable-dahdi + if [ "$WITH_MANUALS" = "1" ]; then PCU_CONFIG="$PCU_CONFIG --enable-manuals" fi diff --git a/contrib/osmo-pcu.spec.in b/contrib/osmo-pcu.spec.in index c2dce52..325a1d0 100644 --- a/contrib/osmo-pcu.spec.in +++ b/contrib/osmo-pcu.spec.in @@ -33,6 +33,8 @@ BuildRequires: pkgconfig(libosmogsm) >= 1.8.0 BuildRequires: pkgconfig(libosmovty) >= 1.8.0 BuildRequires: pkgconfig(libosmoctrl) >= 1.8.0 +BuildRequires: pkgconfig(libosmoabis) >= 1.4.0 +BuildRequires: pkgconfig(libosmotrau) >= 1.4.0 %{?systemd_requires} %description @@ -48,7 +50,8 @@ --enable-shared \ --disable-static \ --docdir=%{_docdir}/%{name} \ - --with-systemdsystemunitdir=%{_unitdir} + --with-systemdsystemunitdir=%{_unitdir} \ + --enable-er-e1-ccu make %{?_smp_mflags} %install diff --git a/debian/control b/debian/control index f1039ce..0784414 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ dh-autoreconf, autotools-dev, pkg-config, + libosmo-abis-dev (>= 1.4.0), libosmocore-dev (>= 1.8.0), osmo-gsm-manuals-dev (>= 1.4.0) Standards-Version: 3.9.8 diff --git a/debian/rules b/debian/rules index 2e4284a..099aae9 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false) override_dh_auto_configure: - dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system --enable-manuals + dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system --enable-manuals --enable-er-e1-ccu # Don't create .pdf.gz files (barely saves space and they can't be opened directly by most pdf readers) override_dh_compress: diff --git a/src/Makefile.am b/src/Makefile.am index 25d58c6..58d3bfa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ # AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS = -I$(top_srcdir)/include $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOGSM_CFLAGS) +AM_CPPFLAGS = -I$(top_srcdir)/include $(STD_DEFINES_AND_INCLUDES) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGB_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOTRAU_CFLAGS) if ENABLE_SYSMODSP AM_CPPFLAGS += -DENABLE_DIRECT_PHY @@ -33,6 +33,10 @@ AM_CPPFLAGS += -DENABLE_DIRECT_PHY endif +if ENABLE_ER_E1_CCU +AM_CPPFLAGS += -DENABLE_DIRECT_PHY +endif + AM_CXXFLAGS = -Wall noinst_LTLIBRARIES = libgprs.la @@ -208,12 +212,26 @@ osmo-bts-oc2g/oc2gbts.c endif +if ENABLE_ER_E1_CCU +AM_CPPFLAGS += -I$(srcdir)/ericsson-rbs + +noinst_HEADERS += \ + ericsson-rbs/er_ccu_if.h \ + ericsson-rbs/er_ccu_descr.h + +osmo_pcu_SOURCES += \ + ericsson-rbs/er_ccu_l1_if.c \ + ericsson-rbs/er_ccu_if.c +endif + osmo_pcu_LDADD = \ libgprs.la \ $(LIBOSMOGB_LIBS) \ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOCTRL_LIBS) \ $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOABIS_LIBS) \ + $(LIBOSMOTRAU_LIBS) \ -lrt \ $(NULL) diff --git a/src/ericsson-rbs/er_ccu_descr.h b/src/ericsson-rbs/er_ccu_descr.h new file mode 100644 index 0000000..0b56cc0 --- /dev/null +++ b/src/ericsson-rbs/er_ccu_descr.h @@ -0,0 +1,49 @@ +#pragma once + +#include <stdint.h> +#include <stdbool.h> +#include <osmocom/abis/e1_input.h> +#include <osmocom/trau/trau_pcu_ericsson.h> + +struct er_ccu_descr; +struct e1_conn_pars; +typedef void (er_ccu_empty) (struct er_ccu_descr *ccu_descr); +typedef void (er_ccu_rx) (struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits); + +struct er_ccu_descr { + + /* E1-line and timeslot (filled in by user) */ + struct e1_conn_pars *e1_conn_pars; + + /* Callback functions (provided by user) */ + er_ccu_empty *er_ccu_empty_cb; + er_ccu_rx *er_ccu_rx_cb; + + /* I.460 Subslot */ + struct { + struct osmo_i460_schan_desc scd; + struct osmo_i460_subchan *schan; + struct osmo_fsm_inst *trau_sync_fi; + bool ccu_connected; + } link; + + /* TRAU Sync state */ + struct { + uint32_t pseq_ccu; /* CCU sequence counter (remote) */ + uint32_t pseq_pcu; /* PCU sequence counter (local) */ + uint32_t last_afn_ul; /* Adjusted frame number, uplink */ + uint32_t last_afn_dl; /* Adjusted frame number, downlink */ + enum time_adj_val tav; /* Last time adjustment value */ + bool ul_frame_err; /* True when last uplink TRAU frame was bad */ + bool ccu_synced; /* True when PCU is in sync with CCU */ + } sync; + + /* PCU related context */ + struct { + uint8_t trx_no; + uint8_t bts_nr; + uint8_t ts; + } pcu; + + +}; diff --git a/src/ericsson-rbs/er_ccu_if.c b/src/ericsson-rbs/er_ccu_if.c new file mode 100644 index 0000000..aa659a3 --- /dev/null +++ b/src/ericsson-rbs/er_ccu_if.c @@ -0,0 +1,416 @@ +/* + * (C) 2022 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Philipp Maier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <er_ccu_if.h> +#include <er_ccu_descr.h> +#include <string.h> +#include <errno.h> + +#include <osmocom/abis/e1_input.h> +#include <osmocom/abis/abis.h> +#include <osmocom/trau/trau_sync.h> +#include <osmocom/trau/trau_pcu_ericsson.h> +#include <bts.h> +#include <gprs_debug.h> +#include <pcu_l1_if.h> + +#define E1_TS_BYTES 160 +#define DEBUG_BITS_MAX 1280 +#define DEBUG_BYTES_MAX 40 + +#define LOGPCCU(ccu_descr, level, tag, fmt, args...) \ + LOGP(DE1, level, "E1TS(%u:%u:%u) %s:" fmt, \ + ccu_descr->e1_conn_pars->e1_nr, ccu_descr->e1_conn_pars->e1_ts, \ + ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL ? 0 : ccu_descr->e1_conn_pars->e1_ts_ss, tag, \ + ## args) + +struct e1_ts_descr { + uint8_t usecount; + bool i460_ts_initialized; + struct osmo_i460_timeslot i460_ts; +}; + +struct e1_line_descr { + struct e1_ts_descr e1_ts[NUM_E1_TS - 1]; +}; + +static struct e1_line_descr e1_lines[32]; +static void *tall_ccu_ctx = NULL; + +static const struct e1inp_line_ops dummy_e1_line_ops = { + .sign_link_up = NULL, + .sign_link_down = NULL, + .sign_link = NULL, +}; + +/* called by trau frame synchronizer: feed received MAC blocks into PCU */ +static void sync_frame_out_cb(void *user_data, const ubit_t *bits, unsigned int num_bits) +{ + struct er_ccu_descr *ccu_descr = user_data; + + if (!bits || num_bits == 0) + return; + + LOGPCCU(ccu_descr, LOGL_DEBUG, "I.460-RX", "receiving %u TRAU frame bits from subslot (synchronized): %s...\n", + num_bits, osmo_ubit_dump(bits, num_bits > DEBUG_BITS_MAX ? DEBUG_BITS_MAX : num_bits)); + + ccu_descr->er_ccu_rx_cb(ccu_descr, bits, num_bits); +} + +/* called by I.460 de-multiplexer: feed output of I.460 demux into TRAU frame sync */ +static void e1_i460_demux_bits_cb(struct osmo_i460_subchan *schan, void *user_data, const ubit_t *bits, + unsigned int num_bits) +{ + struct er_ccu_descr *ccu_descr = user_data; + + LOGPCCU(ccu_descr, LOGL_DEBUG, "I.460-RX", "receiving %u TRAU frame bits from subslot: %s...\n", num_bits, + osmo_ubit_dump(bits, num_bits > DEBUG_BITS_MAX ? DEBUG_BITS_MAX : num_bits)); + + OSMO_ASSERT(ccu_descr->link.trau_sync_fi); + osmo_trau_sync_rx_ubits(ccu_descr->link.trau_sync_fi, bits, num_bits); + +} + +/* called by I.460 de-multiplexer: ensure that sync indications are sent when mux buffer runs empty */ +static void e1_i460_mux_empty_cb(struct osmo_i460_subchan *schan2, void *user_data) +{ + struct er_ccu_descr *ccu_descr = user_data; + + LOGPCCU(ccu_descr, LOGL_DEBUG, "I.460-TX", "demux buffer empty\n"); + ccu_descr->er_ccu_empty_cb(ccu_descr); +} + +/* handle outgoing E1 traffic */ +static void e1_send_ts_frame(struct e1inp_ts *ts) +{ + void *ctx = tall_ccu_ctx; + struct e1_ts_descr *ts_descr; + struct msgb *msg; + uint8_t *ptr; + + /* The line number and ts number that arrives here should be clean. */ + OSMO_ASSERT(ts->line->num < ARRAY_SIZE(e1_lines)); + + ts_descr = &e1_lines[ts->line->num].e1_ts[ts->num]; + + /* Do not send anything in case the E1 timeslot is not ready. */ + if (ts_descr->usecount == 0) + return; + + /* Get E1 frame from I.460 multiplexer */ + msg = msgb_alloc_c(ctx, E1_TS_BYTES, "E1-TX-timeslot-bytes"); + ptr = msgb_put(msg, E1_TS_BYTES); + osmo_i460_mux_out(&ts_descr->i460_ts, ptr, E1_TS_BYTES); + + LOGPITS(ts, DE1, LOGL_DEBUG, "E1-TX: sending %u bytes: %s...\n", + msgb_length(msg), osmo_hexdump_nospc(msgb_data(msg), + msgb_length(msg) > + DEBUG_BYTES_MAX ? DEBUG_BYTES_MAX : msgb_length(msg))); + + /* Hand data over to the E1 stack */ + msgb_enqueue(&ts->raw.tx_queue, msg); +} + +/* Callback function to handle incoming E1 traffic */ +static void e1_recv_cb(struct e1inp_ts *ts, struct msgb *msg) +{ + struct e1_ts_descr *ts_descr; + + if (msg->len != E1_TS_BYTES) { + LOGPITS(ts, DE1, LOGL_ERROR, + "E1-RX: receiving bad, expected length is %u, actual length is %u!\n", + E1_TS_BYTES, msg->len); + msgb_free(msg); + return; + } + + LOGPITS(ts, DE1, LOGL_DEBUG, "E1-RX: receiving %u bytes: %s ...\n", + msg->len, osmo_hexdump_nospc(msg->data, msg->len)); + + /* Note: The line number and ts number that arrives here should be clean. */ + OSMO_ASSERT(ts->line->num < ARRAY_SIZE(e1_lines)); + ts_descr = &e1_lines[ts->line->num].e1_ts[ts->num]; + + /* Hand data over to the I640 demultiplexer. */ + osmo_i460_demux_in(&ts_descr->i460_ts, msg->data, msg->len); + + /* Trigger sending of pending E1 traffic */ + e1_send_ts_frame(ts); + + /* e1inp_rx_ts(), the caller of this callback does not free() msgb. */ + msgb_free(msg); +} + +static struct e1_ts_descr *ts_descr_from_ccu_descr(struct er_ccu_descr *ccu_descr) +{ + /* Make sure E1 line number is valid */ + if (ccu_descr->e1_conn_pars->e1_nr >= ARRAY_SIZE(e1_lines)) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "Invalid E1 line number!\n"); + return NULL; + } + + /* Make sure E1 timeslot number is valid */ + if (ccu_descr->e1_conn_pars->e1_ts < 1 || ccu_descr->e1_conn_pars->e1_ts > NUM_E1_TS - 1) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "Invalid E1 timeslot number!\n"); + return NULL; + } + + /* Timeslots are only initialized once and will stay open after that. */ + return &e1_lines[ccu_descr->e1_conn_pars->e1_nr].e1_ts[ccu_descr->e1_conn_pars->e1_ts]; +} + +/* Configure an I.460 subslot and add it to the CCU descriptor */ +static int add_i460_subslot(void *ctx, struct er_ccu_descr *ccu_descr) +{ + struct e1_ts_descr *ts_descr; + enum osmo_tray_sync_pat_id sync_pattern; + + if (ccu_descr->link.schan) { + /* NOTE: This is a serious error: subslots should be removed when l1if_close_pdch() is called by the + * PCU. This log line points towards a problem with the PDCH management inside the PCU! */ + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "I.460 subslot is already configured -- will not touch it!\n"); + return -EINVAL; + } + + ts_descr = ts_descr_from_ccu_descr(ccu_descr); + if (!ts_descr) + return -EINVAL; + if (ts_descr->usecount == 0) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "E1 timeslot not ready!\n"); + return -EINVAL; + } + + /* Set up I.460 subchannel and connect it to the MUX on the E1 timeslot */ + if (ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL) { + LOGPCCU(ccu_descr, LOGL_INFO, "SETUP", "using 64k subslots\n"); + ccu_descr->link.scd.rate = OSMO_I460_RATE_64k; + ccu_descr->link.scd.demux.num_bits = E1_TS_BYTES * 8; + ccu_descr->link.scd.bit_offset = 0; + sync_pattern = OSMO_TRAU_SYNCP_64_ER_CCU; + } else { + LOGPCCU(ccu_descr, LOGL_INFO, "SETUP", "using 16k subslots\n"); + if (ccu_descr->e1_conn_pars->e1_ts_ss > 3) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "Invalid I.460 subslot number!\n"); + return -EINVAL; + } + ccu_descr->link.scd.rate = OSMO_I460_RATE_16k; + ccu_descr->link.scd.demux.num_bits = E1_TS_BYTES / 4 * 8; + ccu_descr->link.scd.bit_offset = ccu_descr->e1_conn_pars->e1_ts_ss * 2; + sync_pattern = OSMO_TRAU_SYNCP_16_ER_CCU; + } + + ccu_descr->link.scd.demux.out_cb_bits = e1_i460_demux_bits_cb; + ccu_descr->link.scd.demux.out_cb_bytes = NULL; + ccu_descr->link.scd.demux.user_data = ccu_descr; + ccu_descr->link.scd.mux.in_cb_queue_empty = e1_i460_mux_empty_cb; + ccu_descr->link.scd.mux.user_data = ccu_descr; + + LOGPCCU(ccu_descr, LOGL_INFO, "SETUP", "adding I.460 subchannel: bit_offset=%u, num_bits=%zu\n", + ccu_descr->link.scd.bit_offset, ccu_descr->link.scd.demux.num_bits); + ccu_descr->link.schan = osmo_i460_subchan_add(ctx, &ts_descr->i460_ts, &ccu_descr->link.scd); + if (!ccu_descr->link.schan) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "adding I.460 subchannel: failed!\n"); + return -EINVAL; + } + + /* Configure TRAU synchronizer */ + ccu_descr->link.trau_sync_fi = osmo_trau_sync_alloc(tall_ccu_ctx, "trau-sync", sync_frame_out_cb, sync_pattern, ccu_descr); + if (!ccu_descr->link.trau_sync_fi) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "adding I.460 TRAU frame sync: failed!\n"); + return -EINVAL; + } + + /* Ericsson uses a different synchronization pattern for MCS9 TRAU frames */ + if (sync_pattern == OSMO_TRAU_SYNCP_64_ER_CCU) + osmo_trau_sync_set_secondary_pat(ccu_descr->link.trau_sync_fi, OSMO_TRAU_SYNCP_64_ER_CCU_MCS9, 1); + + return 0; +} + +/* Remove an I.460 subslot from the CCU descriptor */ +static void del_i460_subslot(struct er_ccu_descr *ccu_descr) +{ + if (ccu_descr->link.schan) + osmo_i460_subchan_del(ccu_descr->link.schan); + ccu_descr->link.schan = NULL; + if (ccu_descr->link.trau_sync_fi) + osmo_fsm_inst_term(ccu_descr->link.trau_sync_fi, OSMO_FSM_TERM_REGULAR, NULL); + ccu_descr->link.trau_sync_fi = NULL; + + memset(&ccu_descr->link.scd, 0, sizeof(ccu_descr->link.scd)); +} + +/* Configure an E1 timeslot according to the description in the ccu_descr */ +static int open_e1_timeslot(struct er_ccu_descr *ccu_descr) +{ + struct e1inp_line *e1_line; + struct e1_ts_descr *ts_descr; + int rc; + + /* Find timeslot descriptor and check if the timeslot is already open. */ + ts_descr = ts_descr_from_ccu_descr(ccu_descr); + if (!ts_descr) + return -EINVAL; + if (ts_descr->usecount > 0) { + LOGPCCU(ccu_descr, LOGL_DEBUG, "SETUP", "E1 timeslot already open -- using it as it is!\n"); + ts_descr->usecount++; + return 0; + } + + /* Find and set up E1 line */ + e1_line = e1inp_line_find(ccu_descr->e1_conn_pars->e1_nr); + if (!e1_line) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "no such E1 line!\n"); + return -EINVAL; + } + e1inp_line_bind_ops(e1_line, &dummy_e1_line_ops); + + /* Set up E1 timeslot */ + rc = e1inp_ts_config_raw(&e1_line->ts[ccu_descr->e1_conn_pars->e1_ts - 1], e1_line, e1_recv_cb); + if (rc < 0) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "configuration of timeslot failed!\n"); + return -EINVAL; + } + rc = e1inp_line_update(e1_line); + if (rc < 0) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "line update failed!\n"); + return -EINVAL; + } + + /* Make sure the i460 mux is ready */ + if (!ts_descr->i460_ts_initialized) { + osmo_i460_ts_init(&ts_descr->i460_ts); + ts_descr->i460_ts_initialized = true; + } + + ts_descr->usecount++; + OSMO_ASSERT(ts_descr->usecount == 1); + + return 0; +} + +/* Configure an E1 timeslot according to the description in the ccu_descr */ +static int close_e1_timeslot(struct er_ccu_descr *ccu_descr) +{ + struct e1inp_line *e1_line; + struct e1_ts_descr *ts_descr; + int rc; + + /* Find timeslot descriptor and check if the timeslot is still used by another subslot. */ + ts_descr = ts_descr_from_ccu_descr(ccu_descr); + if (!ts_descr) + return -EINVAL; + if (ts_descr->usecount > 1) { + LOGPCCU(ccu_descr, LOGL_DEBUG, "SETUP", + "E1 timeslot still in used by another subslot, leaving it open!\n"); + ts_descr->usecount--; + return 0; + } else if (ts_descr->usecount == 0) { + /* This should not be as it means we close the timeslot too often. */ + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "E1 timeslot already closed, leaving it as it is...\n"); + return -EINVAL; + } + + /* Find E1 line */ + e1_line = e1inp_line_find(ccu_descr->e1_conn_pars->e1_nr); + if (!e1_line) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "no such E1 line!\n"); + return -EINVAL; + } + + /* Release E1 timeslot */ + rc = e1inp_ts_config_none(&e1_line->ts[ccu_descr->e1_conn_pars->e1_ts - 1], e1_line); + if (rc < 0) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "failed to disable E1 timeslot!\n"); + return -EINVAL; + } + rc = e1inp_line_update(e1_line); + if (rc < 0) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "failed to update E1 line!\n"); + return -EINVAL; + } + + ts_descr->usecount--; + OSMO_ASSERT(ts_descr->usecount == 0); + + return 0; +} + +int er_ccu_if_open(struct er_ccu_descr *ccu_descr) +{ + if (ccu_descr->link.ccu_connected) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", + "cannot connect CCU since it is already connected -- ignored!\n"); + return 0; + } + + if (open_e1_timeslot(ccu_descr) < 0) + return -EINVAL; + + if (add_i460_subslot(tall_ccu_ctx, ccu_descr) < 0) + return -EINVAL; + + ccu_descr->link.ccu_connected = true; + LOGPCCU(ccu_descr, LOGL_DEBUG, "SETUP", "CCU connected.\n"); + return 0; +} + +void er_ccu_if_close(struct er_ccu_descr *ccu_descr) +{ + if (!ccu_descr->link.ccu_connected) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", + "cannot disconnect CCU since it is already disconnected -- ignored!\n"); + return; + } + + del_i460_subslot(ccu_descr); + close_e1_timeslot(ccu_descr); + + ccu_descr->link.ccu_connected = false; + LOGPCCU(ccu_descr, LOGL_DEBUG, "SETUP", "CCU disconnected.\n"); +} + +void er_ccu_if_tx(struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits) +{ + struct msgb *msg; + uint8_t *ptr; + + if (!ccu_descr->link.ccu_connected) { + LOGPCCU(ccu_descr, LOGL_ERROR, "SETUP", "cannot TX block, CCU is disconnected -- ignored!\n"); + return; + } + + msg = msgb_alloc_c(tall_ccu_ctx, num_bits, "E1-I.460-PCU-IND-frame"); + ptr = msgb_put(msg, num_bits); + memcpy(ptr, bits, num_bits); + LOGPCCU(ccu_descr, LOGL_DEBUG, "I.460-TX", "sending %u bits: %s...\n", msgb_length(msg), + osmo_ubit_dump(msgb_data(msg), msgb_length(msg) > DEBUG_BITS_MAX ? DEBUG_BITS_MAX : msgb_length(msg))); + osmo_i460_mux_enqueue(ccu_descr->link.schan, msg); +} + +void er_ccu_if_init(void *ctx) +{ + libosmo_abis_init(ctx); + e1inp_vty_init(); + + tall_ccu_ctx = talloc_new(ctx); + memset(e1_lines, 0, sizeof(e1_lines)); +} diff --git a/src/ericsson-rbs/er_ccu_if.h b/src/ericsson-rbs/er_ccu_if.h new file mode 100644 index 0000000..4073530 --- /dev/null +++ b/src/ericsson-rbs/er_ccu_if.h @@ -0,0 +1,10 @@ +#pragma once + +#include <stdint.h> +#include <osmocom/abis/e1_input.h> +#include "er_ccu_descr.h" + +int er_ccu_if_open(struct er_ccu_descr *ccu_descr); +void er_ccu_if_close(struct er_ccu_descr *ccu_descr); +void er_ccu_if_tx(struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits); +void er_ccu_if_init(void *ctx); diff --git a/src/ericsson-rbs/er_ccu_l1_if.c b/src/ericsson-rbs/er_ccu_l1_if.c new file mode 100644 index 0000000..b7dd102 --- /dev/null +++ b/src/ericsson-rbs/er_ccu_l1_if.c @@ -0,0 +1,526 @@ +/* + * (C) 2022 by sysmocom s.f.m.c. GmbH <info(a)sysmocom.de> + * All Rights Reserved + * + * Author: Philipp Maier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#include <er_ccu_descr.h> +#include <er_ccu_if.h> + +#include <string.h> +#include <errno.h> + +#include <osmocom/pcu/pcuif_proto.h> +#include <osmocom/abis/e1_input.h> +#include <osmocom/abis/abis.h> +#include <osmocom/abis/e1_input.h> +#include <osmocom/trau/trau_sync.h> +#include <osmocom/trau/trau_pcu_ericsson.h> +#include <osmocom/gsm/gsm0502.h> +#include <osmocom/core/talloc.h> + +#include <bts.h> +#include <pcu_l1_if.h> +#include <pcu_l1_if_phy.h> + +extern void *tall_pcu_ctx; + +const uint8_t fn_inc_table[4] = { 4, 4, 5, 0 }; +const uint8_t blk_nr_table[4] = { 4, 4, 5, 0 }; + +#define SYNC_CHECK_INTERVAL GSM_TDMA_SUPERFRAME * 8 + +/* Subtrahend to convert Ericsson adjusted (block ending) fn to regular fn (uplink only) */ +#define AFN_SUBTRAHEND 3 + +#define LOGPL1IF(ccu_descr, level, tag, fmt, args...) \ + LOGP(DL1IF, level, "%s: PDCH(trx=%u,ts=%u) E1-line(line=%u,ts=%u,ss=%u) " fmt, \ + tag, ccu_descr->pcu.trx_no, ccu_descr->pcu.ts, \ + ccu_descr->e1_conn_pars->e1_nr, ccu_descr->e1_conn_pars->e1_ts, \ + ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL ? 0 : ccu_descr->e1_conn_pars->e1_ts_ss, \ + ## args) + +/* Calculate GPRS block number from frame number */ +static uint8_t fn_to_block_nr(uint32_t fn) +{ + /* Note: See also 3GPP TS 03.64 6.5.7.2.1, + * Mapping on the multiframe structure */ + + uint8_t rel_fn; + uint8_t super_block; + uint8_t local_block; + + rel_fn = fn % 52; + + /* Warn in case of frames that do not belong to a block */ + if (rel_fn == 12 || rel_fn == 25 || rel_fn == 38 || rel_fn == 51) + LOGP(DL1IF, LOGL_ERROR, "Frame number is referencing invalid block!\n"); + + super_block = (rel_fn / 13); + local_block = rel_fn % 13 / 4; + return super_block * 3 + local_block; +} + +static uint32_t fn_dl_advance(uint32_t fn, uint32_t n_blocks) +{ + uint32_t i; + + uint8_t inc_fn; + + for (i = 0; i < n_blocks; i++) { + inc_fn = fn_inc_table[(fn % 13) / 4]; + fn = GSM_TDMA_FN_SUM(fn, inc_fn); + } + + return fn; +} + +static bool mac_block_is_noise(struct er_gprs_trau_frame *trau_frame) +{ + switch (trau_frame->u.ccu_data_ind.cs_hdr) { + case CS_OR_HDR_CS1: + case CS_OR_HDR_CS2: + case CS_OR_HDR_CS3: + case CS_OR_HDR_CS4: + if (!trau_frame->u.ccu_data_ind.u.gprs.parity_ok) + return true; + break; + case CS_OR_HDR_HDR1: + case CS_OR_HDR_HDR2: + case CS_OR_HDR_HDR3: + if (!trau_frame->u.ccu_data_ind.u.egprs.hdr_good) + return true; + if (!trau_frame->u.ccu_data_ind.u.egprs.data_good[0] + && !trau_frame->u.ccu_data_ind.u.egprs.data_good[1]) + return true; + break; + case CS_OR_HDR_AB: + /* We are not interested in receiving access bursts. */ + return true; + } + + /* No noise, this block is interesting for us. */ + return false; +} + +static void log_data_ind(struct er_ccu_descr *ccu_descr, struct er_gprs_trau_frame *trau_frame, uint32_t afn_ul_comp, + uint32_t afn_dl_comp) +{ + switch (trau_frame->u.ccu_data_ind.cs_hdr) { + case CS_OR_HDR_CS1: + case CS_OR_HDR_CS2: + case CS_OR_HDR_CS3: + case CS_OR_HDR_CS4: + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-DATA-IND", + "tav=%u, dbe=%u, cs_hdr=%u, rx_lev=%u, est_acc_del_dev=%u," + "block_qual=%u, parity_ok=%u, data=%s<==, afn_ul_comp=%u/%u\n", trau_frame->u.ccu_data_ind.tav, + trau_frame->u.ccu_data_ind.dbe, trau_frame->u.ccu_data_ind.cs_hdr, + trau_frame->u.ccu_data_ind.rx_lev, trau_frame->u.ccu_data_ind.est_acc_del_dev, + trau_frame->u.ccu_data_ind.u.gprs.block_qual, trau_frame->u.ccu_data_ind.u.gprs.parity_ok, + osmo_hexdump_nospc(trau_frame->u.ccu_data_ind.data, trau_frame->u.ccu_data_ind.data_len), + afn_ul_comp, afn_ul_comp % 52); + break; + case CS_OR_HDR_HDR1: + case CS_OR_HDR_HDR2: + case CS_OR_HDR_HDR3: + case CS_OR_HDR_AB: + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-DATA-IND", + "tav=%u, dbe=%u, cs_hdr=%u, rx_lev=%u, est_acc_del_dev=%u," + "mean_bep=%u, cv_bep=%u, hdr_good=%u, data_good[0]=%u, data_good[1]=%u, data=%s<==, afn_ul_comp=%u/%u\n", + trau_frame->u.ccu_data_ind.tav, trau_frame->u.ccu_data_ind.dbe, + trau_frame->u.ccu_data_ind.cs_hdr, trau_frame->u.ccu_data_ind.rx_lev, + trau_frame->u.ccu_data_ind.est_acc_del_dev, trau_frame->u.ccu_data_ind.u.egprs.mean_bep, + trau_frame->u.ccu_data_ind.u.egprs.cv_bep, trau_frame->u.ccu_data_ind.u.egprs.hdr_good, + trau_frame->u.ccu_data_ind.u.egprs.data_good[0], + trau_frame->u.ccu_data_ind.u.egprs.data_good[1], + osmo_hexdump_nospc(trau_frame->u.ccu_data_ind.data, trau_frame->u.ccu_data_ind.data_len), + afn_ul_comp, afn_ul_comp % 52); + } +} + +/* Receive block from CCU */ +static void er_ccu_rx_cb(struct er_ccu_descr *ccu_descr, const ubit_t *bits, unsigned int num_bits) +{ + int rc; + struct er_gprs_trau_frame trau_frame; + uint8_t inc_ul; + uint8_t inc_dl; + uint32_t afn_ul; + uint32_t afn_dl; + uint32_t afn_ul_comp; + uint32_t afn_dl_comp; + struct pcu_l1_meas meas = { 0 }; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_pdch *pdch; + + /* Compute the current frame numbers from the last frame number */ + inc_ul = fn_inc_table[(ccu_descr->sync.last_afn_ul % 13) / 4]; + inc_dl = fn_inc_table[(ccu_descr->sync.last_afn_dl % 13) / 4]; + afn_ul = GSM_TDMA_FN_SUM(ccu_descr->sync.last_afn_ul, inc_ul); + afn_dl = GSM_TDMA_FN_SUM(ccu_descr->sync.last_afn_dl, inc_dl); + + /* Compute compensated frame numbers. This will be the framenumbers we + * will use to exchange blocks with the PCU code. The following applies: + * + * 1. The uplink related frame numbers sent by the ericsson CCU refer to the end of a block. This is + * compensated by subtracting three frames. + * 2. The CCU downlink frame number runs one block past the uplink frame number. This needs to be + * compesated as well (+1). + * 3. The difference between the local (PCU) and the returned (CCU) pseq counter value is the number of blocks + * that the PCU must + * shift its downlink alignment in order to compensate the link latency between PCU and CCU. */ + afn_ul_comp = GSM_TDMA_FN_SUB(afn_ul, AFN_SUBTRAHEND); + afn_dl_comp = afn_dl; + afn_dl_comp = fn_dl_advance(afn_dl_comp, GSM_TDMA_FN_DIFF(ccu_descr->sync.pseq_pcu, ccu_descr->sync.pseq_ccu) + 1); + + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-SYNC", + "afn_ul=%u/%u, afn_dl=%u/%u, afn_diff=%u => afn_ul_comp=%u/%u, afn_dl_comp=%u/%u, afn_diff_comp=%u\n", + afn_ul, afn_ul % 52, afn_dl, afn_dl % 52, GSM_TDMA_FN_DIFF(afn_ul, afn_dl), afn_ul_comp, + afn_ul_comp % 52, afn_dl_comp, afn_dl_comp % 52, GSM_TDMA_FN_DIFF(afn_ul_comp, afn_dl_comp)); + + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-SYNC", "pseq_pcu=%u, pseq_ccu=%u, pseq_diff=%u\n", + ccu_descr->sync.pseq_pcu, ccu_descr->sync.pseq_ccu, GSM_TDMA_FN_DIFF(ccu_descr->sync.pseq_pcu, ccu_descr->sync.pseq_ccu)); + + /* Decode indication from CCU */ + if (ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL) + rc = er_gprs_trau_frame_decode_64k(&trau_frame, bits); + else + rc = er_gprs_trau_frame_decode_16k(&trau_frame, bits); + if (rc < 0) { + LOGPL1IF(ccu_descr, LOGL_ERROR, "CCU-XXXX-IND", + "unable to decode uplink TRAU frame, afn_ul_comp=%u/%u\n", afn_ul_comp, afn_ul_comp % 52); + + /* Report to the CCU that there is an issue with uplink TRAU frames, the CCU will then send + * a CCU-SYNC-IND within the next TRAU frame, so we can check if we are still in sync and trigger + * synchronization procedure if necessary. */ + ccu_descr->sync.ul_frame_err = true; + goto skip; + } + + switch (trau_frame.type) { + case ER_GPRS_TRAU_FT_SYNC: + if (trau_frame.u.ccu_sync_ind.pseq != 0x3FFFFF) { + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-SYNC-IND", + "tav=%u, dbe=%u, dfe=%u, pseq=%u, afn_ul=%u, afn_dl=%u\n", + trau_frame.u.ccu_sync_ind.tav, trau_frame.u.ccu_sync_ind.dbe, + trau_frame.u.ccu_sync_ind.dfe, trau_frame.u.ccu_sync_ind.pseq, + trau_frame.u.ccu_sync_ind.afn_ul, trau_frame.u.ccu_sync_ind.afn_dl); + + /* Synchronize the current CCU PSEQ state */ + ccu_descr->sync.pseq_ccu = trau_frame.u.ccu_sync_ind.pseq; + } else { + LOGPL1IF(ccu_descr, LOGL_DEBUG, "CCU-SYNC-IND", + "tav=%u, dbe=%u, dfe=%u, pseq=(none), afn_ul=%u, afn_dl=%u\n", + trau_frame.u.ccu_sync_ind.tav, trau_frame.u.ccu_sync_ind.dbe, + trau_frame.u.ccu_sync_ind.dfe, trau_frame.u.ccu_sync_ind.afn_ul, + trau_frame.u.ccu_sync_ind.afn_dl); + } + + ccu_descr->sync.tav = trau_frame.u.ccu_sync_ind.tav; + + /* Check if we are in sync with the CCU, if not trigger synchronization procedure */ + if (afn_ul != trau_frame.u.ccu_sync_ind.afn_ul || afn_dl != trau_frame.u.ccu_sync_ind.afn_dl) { + if (afn_ul != trau_frame.u.ccu_sync_ind.afn_ul) + LOGPL1IF(ccu_descr, LOGL_NOTICE, "CCU-SYNC-IND", + "afn_ul=%u (computed) != afn_ul=%u (sync-ind) => delta=%u\n", afn_ul, + trau_frame.u.ccu_sync_ind.afn_ul, + GSM_TDMA_FN_DIFF(afn_ul, trau_frame.u.ccu_sync_ind.afn_ul)); + if (afn_dl != trau_frame.u.ccu_sync_ind.afn_dl) + LOGPL1IF(ccu_descr, LOGL_NOTICE, "CCU-SYNC-IND", + "afn_dl=%u (computed) != afn_dl=%u (sync-ind) => delta=%u\n", afn_dl, + trau_frame.u.ccu_sync_ind.afn_dl, + GSM_TDMA_FN_DIFF(afn_dl, trau_frame.u.ccu_sync_ind.afn_dl)); + LOGPL1IF(ccu_descr, LOGL_NOTICE, "CCU-SYNC-IND", + "FN jump detected, lost sync with CCU -- (re)synchronizing...\n"); + ccu_descr->sync.ccu_synced = false; + } else { + LOGPL1IF(ccu_descr, LOGL_NOTICE, "CCU-SYNC-IND", "in sync with CCU\n"); + ccu_descr->sync.ccu_synced = true; + } + + /* Overwrite calculated afn_ul and afn_dl with the actual values from the SYNC indication */ + afn_ul = trau_frame.u.ccu_sync_ind.afn_ul; + afn_dl = trau_frame.u.ccu_sync_ind.afn_dl; + + break; + case ER_GPRS_TRAU_FT_DATA: + + ccu_descr->sync.tav = trau_frame.u.ccu_data_ind.tav; + + /* Ignore all data indications that contain only noise */ + if (mac_block_is_noise(&trau_frame)) + break; + + log_data_ind(ccu_descr, &trau_frame, afn_ul_comp, afn_dl_comp); + + /* Hand received MAC block into PCU */ + bts = gprs_pcu_get_bts_by_nr(the_pcu, ccu_descr->pcu.bts_nr); + if (!bts) + break; + meas.have_rssi = 1; + meas.rssi = rxlev2dbm(trau_frame.u.ccu_data_ind.rx_lev); + meas.have_link_qual = 1; + meas.link_qual = trau_frame.u.ccu_data_ind.u.gprs.block_qual; + pdch = &bts->trx[ccu_descr->pcu.trx_no].pdch[ccu_descr->pcu.ts]; + rc = pcu_rx_data_ind_pdtch(bts, pdch, trau_frame.u.ccu_data_ind.data, + trau_frame.u.ccu_data_ind.data_len, afn_ul_comp, &meas); + break; + default: + LOGPL1IF(ccu_descr, LOGL_ERROR, "CCU-XXXX-IND", "unhandled CCU indication!\n"); + } + +skip: + if (ccu_descr->sync.ccu_synced) { + bts = gprs_pcu_get_bts_by_nr(the_pcu, ccu_descr->pcu.bts_nr); + if (bts) { + /* The PCU timing is locked to the uplink fame number. The downlink frame number is advanced + * into the future so that the line latency is compensated and the frame arrives at the right + * point in time. */ + pdch = &bts->trx[ccu_descr->pcu.trx_no].pdch[ccu_descr->pcu.ts]; + pcu_rx_block_time(bts, pdch->trx->arfcn, afn_ul_comp, ccu_descr->pcu.ts); + rc = pcu_rx_rts_req_pdtch(bts, ccu_descr->pcu.trx_no, ccu_descr->pcu.ts, afn_dl_comp, + fn_to_block_nr(afn_dl_comp)); + } + } + + /* We do not receive sync indications in every cycle. When traffic is transferred we won't get frame numbers + * from the CCU. In this case we must update the last_afn_ul/dl values from the computed frame numbers + * (see above) */ + ccu_descr->sync.last_afn_ul = afn_ul; + ccu_descr->sync.last_afn_dl = afn_dl; + ccu_descr->sync.pseq_pcu++; + ccu_descr->sync.pseq_ccu++; +} + +static void er_ccu_empty_cb(struct er_ccu_descr *ccu_descr) +{ + struct er_gprs_trau_frame trau_frame; + ubit_t trau_frame_encoded[ER_GPRS_TRAU_FRAME_LEN_64K]; + int rc; + + memset(&trau_frame, 0, sizeof(trau_frame)); + trau_frame.u.pcu_sync_ind.pseq = ccu_descr->sync.pseq_pcu; + trau_frame.u.pcu_sync_ind.tav = ccu_descr->sync.tav; + trau_frame.u.pcu_sync_ind.fn_ul = 0x3FFFFF; + trau_frame.u.pcu_sync_ind.fn_dl = 0x3FFFFF; + trau_frame.u.pcu_sync_ind.fn_ss = 0x3FFFFF; + trau_frame.u.pcu_sync_ind.ls = 0x3FFFFF; + trau_frame.u.pcu_sync_ind.ss = 0x3FFFFF; + trau_frame.type = ER_GPRS_TRAU_FT_SYNC; + + if (ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL) + rc = er_gprs_trau_frame_encode_64k(trau_frame_encoded, &trau_frame); + else + rc = er_gprs_trau_frame_encode_16k(trau_frame_encoded, &trau_frame); + if (rc < 0) { + LOGPL1IF(ccu_descr, LOGL_ERROR, "PCU-SYNC-IND", "unable to encode TRAU frame\n"); + return; + } + LOGPL1IF(ccu_descr, LOGL_DEBUG, "PCU-SYNC-IND", "pseq=%u, tav=%u\n", + trau_frame.u.pcu_sync_ind.pseq, trau_frame.u.pcu_sync_ind.tav); + er_ccu_if_tx(ccu_descr, trau_frame_encoded, rc); + + /* Make sure timing adjustment value is reset after use */ + ccu_descr->sync.tav = TIME_ADJ_NONE; +} + +/* use the length of the block to determine the coding scheme */ +static int cs_hdr_from_len(uint8_t len) +{ + switch (len) { + case 23: + return CS_OR_HDR_CS1; + case 34: + return CS_OR_HDR_CS2; + case 40: + return CS_OR_HDR_CS3; + case 54: + return CS_OR_HDR_CS4; + case 27: + case 33: + case 42: + case 49: + return CS_OR_HDR_HDR3; + case 60: + case 78: + return CS_OR_HDR_HDR2; + case 118: + case 142: + case 154: + return CS_OR_HDR_HDR1; + default: + return -EINVAL; + } +} + +/* send packet data request to L1 */ +int l1if_pdch_req(void *obj, uint8_t ts, int is_ptcch, uint32_t fn, + uint16_t arfcn, uint8_t block_nr, uint8_t *data, uint8_t len) +{ + struct er_ccu_descr *ccu_descr = obj; + struct er_gprs_trau_frame trau_frame; + ubit_t trau_frame_encoded[ER_GPRS_TRAU_FRAME_LEN_64K]; + struct gprs_rlcmac_bts *bts; + int rc; + + /* Make sure that the CCU is synchronized and connected. */ + if (!ccu_descr) { + LOGP(DL1IF, LOGL_ERROR, "PCU-DATA-IND: PDCH(ts=%u, arfcn=%u) no CCU context, tossing MAC block...\n", + ts, arfcn); + return -EINVAL; + } + if (!ccu_descr->link.ccu_connected) { + LOGPL1IF(ccu_descr, LOGL_NOTICE, "PCU-DATA-IND", "CCU not connected, tossing MAC block...\n"); + return -EINVAL; + } + if (!ccu_descr->sync.ccu_synced) { + LOGPL1IF(ccu_descr, LOGL_NOTICE, "PCU-DATA-IND", "CCU not synchronized, tossing MAC block...\n"); + return -EINVAL; + } + + /* Hand received MAC block into PCU */ + bts = gprs_pcu_get_bts_by_nr(the_pcu, ccu_descr->pcu.bts_nr); + if (!bts) { + LOGPL1IF(ccu_descr, LOGL_NOTICE, "PCU-DATA-IND", "no BTS, tossing MAC block...\n"); + return -EINVAL; + } + + memset(&trau_frame, 0, sizeof(trau_frame)); + trau_frame.type = ER_GPRS_TRAU_FT_DATA; + + rc = cs_hdr_from_len(len); + if (rc < 0) { + LOGPL1IF(ccu_descr, LOGL_ERROR, "PCU-DATA-IND", + "unable to encode TRAU frame, invalid CS or MCS value set\n"); + return -EINVAL; + } + trau_frame.u.pcu_data_ind.cs_hdr = (enum er_cs_or_hdr)rc; + trau_frame.u.pcu_data_ind.tav = ccu_descr->sync.tav; + trau_frame.u.pcu_data_ind.ul_frame_err = ccu_descr->sync.ul_frame_err; + if (bts->mcs_mask) + trau_frame.u.pcu_data_ind.ul_chan_mode = ER_UL_CHMOD_NB_UNKN; + else + trau_frame.u.pcu_data_ind.ul_chan_mode = ER_UL_CHMOD_NB_GMSK; + OSMO_ASSERT(len < sizeof(trau_frame.u.pcu_data_ind.data)); + memcpy(trau_frame.u.pcu_data_ind.data, data, len); + + /* Regulary ignore one MAC block in uplink. The CCU will then send one CCU-SYNC-IND instead. We use this + * indication to check whether we are still in sync with the CCU. */ + if (fn % SYNC_CHECK_INTERVAL == 0) + trau_frame.u.pcu_data_ind.ul_chan_mode = ER_UL_CHMOD_VOID; + + if (ccu_descr->e1_conn_pars->e1_ts_ss == E1_SUBSLOT_FULL) + rc = er_gprs_trau_frame_encode_64k(trau_frame_encoded, &trau_frame); + else + rc = er_gprs_trau_frame_encode_16k(trau_frame_encoded, &trau_frame); + if (rc < 0) { + LOGPL1IF(ccu_descr, LOGL_ERROR, "PCU-DATA-IND", "unable to encode TRAU frame\n"); + return -EINVAL; + } + LOGPL1IF(ccu_descr, LOGL_DEBUG, "PCU-DATA-IND", + "tav=%u, ul_frame_err=%u, cs_hdr=%u, ul_chan_mode=%u, atten_db=%u, timing_offset=%u," + " data=%s==>, fn=%u/%u (comp)\n", trau_frame.u.pcu_data_ind.tav, + trau_frame.u.pcu_data_ind.ul_frame_err, trau_frame.u.pcu_data_ind.cs_hdr, + trau_frame.u.pcu_data_ind.ul_chan_mode, trau_frame.u.pcu_data_ind.atten_db, + trau_frame.u.pcu_data_ind.timing_offset, osmo_hexdump_nospc(trau_frame.u.pcu_data_ind.data, len), fn, + fn % 52); + er_ccu_if_tx(ccu_descr, trau_frame_encoded, rc); + + /* Make sure timing adjustment value is reset after use */ + ccu_descr->sync.tav = TIME_ADJ_NONE; + ccu_descr->sync.ul_frame_err = false; + + return 0; +} + +void *l1if_open_pdch(uint8_t bts_nr, uint8_t trx_no, uint32_t hlayer1, struct gsmtap_inst *gsmtap) +{ + struct er_ccu_descr *ccu_descr; + + /* Note: We do not have enough information to really open anything at + * this point. We will just create the CCU context. */ + + ccu_descr = talloc_zero(tall_pcu_ctx, struct er_ccu_descr); + OSMO_ASSERT(ccu_descr); + ccu_descr->er_ccu_rx_cb = er_ccu_rx_cb; + ccu_descr->er_ccu_empty_cb = er_ccu_empty_cb; + ccu_descr->pcu.trx_no = trx_no; + ccu_descr->pcu.bts_nr = bts_nr; + + return ccu_descr; +} + +int l1if_close_pdch(void *obj) +{ + struct er_ccu_descr *ccu_descr = obj; + + if (!ccu_descr) { + LOGP(DL1IF, LOGL_ERROR, "PCU-DATA-IND: no CCU context, cannot close unknown PDCH...\n"); + return -EINVAL; + } + + er_ccu_if_close(ccu_descr); + talloc_free(ccu_descr); + return 0; +} + +int l1if_connect_pdch(void *obj, uint8_t ts) +{ + struct er_ccu_descr *ccu_descr = obj; + int rc; + + if (!ccu_descr) { + LOGP(DL1IF, LOGL_ERROR, "SETUP: PDCH(ts=%u) no CCU context, PDCH never opened before?\n", ts); + return -EINVAL; + } + + ccu_descr->pcu.ts = ts; + + rc = pcu_l1if_get_e1_ccu_conn_pars(&ccu_descr->e1_conn_pars, ccu_descr->pcu.bts_nr, ccu_descr->pcu.trx_no, + ccu_descr->pcu.ts); + if (rc < 0) { + LOGPL1IF(ccu_descr, LOGL_ERROR, "SETUP", "cannot find E1 connection parameters for CCU\n"); + return -EINVAL; + } + + rc = er_ccu_if_open(ccu_descr); + if (rc < 0) + return -EINVAL; + + return 0; +} + +int l1if_disconnect_pdch(void *obj, uint8_t ts) +{ + struct er_ccu_descr *ccu_descr = obj; + + if (!ccu_descr) { + LOGP(DL1IF, LOGL_ERROR, "SETUP: PDCH(ts=%u) no CCU context, PDCH never opened before?\n", ts); + return -EINVAL; + } + + er_ccu_if_close(ccu_descr); + + return 0; +} + +int l1if_init(void) +{ + er_ccu_if_init(tall_pcu_ctx); + return 0; +} diff --git a/src/gprs_debug.c b/src/gprs_debug.c index 03ef083..8aeca5b 100644 --- a/src/gprs_debug.c +++ b/src/gprs_debug.c @@ -128,6 +128,13 @@ .loglevel = LOGL_NOTICE, .enabled = 1, }, + [DE1] = { + .name = "DE1", + .color = "\033[1;31m", + .description = "E1 line handling", + .loglevel = LOGL_NOTICE, + .enabled = 1, + }, }; static int filter_fn(const struct log_context *ctx, diff --git a/src/gprs_debug.h b/src/gprs_debug.h index 320c739..db9630c 100644 --- a/src/gprs_debug.h +++ b/src/gprs_debug.h @@ -41,6 +41,7 @@ DPCU, DNACC, DRIM, + DE1, aDebug_LastEntry }; diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index 14cc778..6ec806b 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -61,6 +61,23 @@ #define PAGING_GROUP_LEN 3 +struct e1_ccu_conn_pars { + struct llist_head entry; + + /* Related air interface */ + uint8_t bts_nr; + uint8_t trx_nr; + uint8_t ts_nr; + + /* E1 communication parameter */ + struct e1_conn_pars e1_conn_pars; +}; + +/* List storage to collect E1 connection information that we receive through the pcu_sock. The collected data serves as + * a lookup table so that we can lookup the E1 connection information for each PDCH (trx number and timeslot number) + * when it is needed. */ +static LLIST_HEAD(e1_ccu_table); + /* returns [0,999] on success, > 999 on error */ uint16_t imsi2paging_group(const char* imsi) { @@ -962,6 +979,73 @@ return rc; } +/* Query E1 CCU connection parameters by TS and TRX number */ +int pcu_l1if_get_e1_ccu_conn_pars(struct e1_conn_pars **e1_conn_pars, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) +{ + struct e1_ccu_conn_pars *e1_ccu_conn_pars; + + llist_for_each_entry(e1_ccu_conn_pars, &e1_ccu_table, entry) { + if (e1_ccu_conn_pars->bts_nr == bts_nr && e1_ccu_conn_pars->trx_nr == trx_nr + && e1_ccu_conn_pars->ts_nr == ts_nr) { + *e1_conn_pars = &e1_ccu_conn_pars->e1_conn_pars; + return 0; + } + } + + return -EINVAL; +} + +/* Allocate a new connection parameter struct and store connection parameters */ +static void new_e1_ccu_conn_pars(const struct gsm_pcu_if_e1_ccu_ind *e1_ccu_ind, uint8_t bts_nr) +{ + struct e1_ccu_conn_pars *e1_ccu_conn_pars; + + e1_ccu_conn_pars = talloc_zero(tall_pcu_ctx, struct e1_ccu_conn_pars); + OSMO_ASSERT(e1_ccu_conn_pars); + e1_ccu_conn_pars->bts_nr = bts_nr; + e1_ccu_conn_pars->trx_nr = e1_ccu_ind->trx_nr; + e1_ccu_conn_pars->ts_nr = e1_ccu_ind->ts_nr; + e1_ccu_conn_pars->e1_conn_pars.e1_nr = e1_ccu_ind->e1_nr; + e1_ccu_conn_pars->e1_conn_pars.e1_ts = e1_ccu_ind->e1_ts; + e1_ccu_conn_pars->e1_conn_pars.e1_ts_ss = e1_ccu_ind->e1_ts_ss; + llist_add(&e1_ccu_conn_pars->entry, &e1_ccu_table); +} + +static int pcu_rx_e1_ccu_ind(struct gprs_rlcmac_bts *bts, const struct gsm_pcu_if_e1_ccu_ind *e1_ccu_ind) +{ + struct e1_conn_pars *e1_conn_pars; + uint8_t rate; + uint8_t subslot_nr; + int rc; + + /* only used with log statement below, no technical relevance otherwise. */ + if (e1_ccu_ind->e1_ts_ss > 3) { + rate = 64; + subslot_nr = 0; + } else { + rate = 16; + subslot_nr = e1_ccu_ind->e1_ts_ss; + } + + LOGP(DL1IF, LOGL_NOTICE, + "(ts=%u,trx=%u) new E1 CCU communication parameters for CCU (E1-line:%u, E1-TS:%u, E1-SS:%u, rate:%ukbps)\n", + e1_ccu_ind->ts_nr, e1_ccu_ind->trx_nr, e1_ccu_ind->e1_nr, e1_ccu_ind->e1_ts, + subslot_nr, rate); + + /* Search for an existing entry, when found, update it. */ + rc = pcu_l1if_get_e1_ccu_conn_pars(&e1_conn_pars, bts->nr, e1_ccu_ind->trx_nr, e1_ccu_ind->ts_nr); + if (rc == 0) { + e1_conn_pars->e1_nr = e1_ccu_ind->e1_nr; + e1_conn_pars->e1_ts = e1_ccu_ind->e1_ts; + e1_conn_pars->e1_ts_ss = e1_ccu_ind->e1_ts_ss; + return 0; + } + + /* Create new connection parameter entry */ + new_e1_ccu_conn_pars(e1_ccu_ind, bts->nr); + return 0; +} + static int pcu_rx_time_ind(struct gprs_rlcmac_bts *bts, struct gsm_pcu_if_time_ind *time_ind) { uint8_t fn13 = time_ind->fn % 13; @@ -1194,6 +1278,10 @@ CHECK_IF_MSG_SIZE(pcu_prim_length, pcu_prim->u.info_ind); rc = pcu_rx_info_ind(bts, &pcu_prim->u.info_ind); break; + case PCU_IF_MSG_E1_CCU_IND: + CHECK_IF_MSG_SIZE(pcu_prim_length, pcu_prim->u.e1_ccu_ind); + rc = pcu_rx_e1_ccu_ind(bts, &pcu_prim->u.e1_ccu_ind); + break; case PCU_IF_MSG_TIME_IND: CHECK_IF_MSG_SIZE(pcu_prim_length, pcu_prim->u.time_ind); rc = pcu_rx_time_ind(bts, &pcu_prim->u.time_ind); diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h index 1827d84..d3d70e4 100644 --- a/src/pcu_l1_if.h +++ b/src/pcu_l1_if.h @@ -178,6 +178,17 @@ void pcu_rx_block_time(struct gprs_rlcmac_bts *bts, uint16_t arfcn, uint32_t fn, uint8_t ts_no); uint16_t imsi2paging_group(const char* imsi); +struct e1_conn_pars { + /* Number of E1 line */ + uint8_t e1_nr; + /* Number of E1 timeslot */ + uint8_t e1_ts; + /* Number of I.460 subslot inside E1 timeslot */ + uint8_t e1_ts_ss; +}; + +int pcu_l1if_get_e1_ccu_conn_pars(struct e1_conn_pars **e1_conn_pars, uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr); + #define PCUIF_HDR_SIZE ( sizeof(struct gsm_pcu_if) - sizeof(((struct gsm_pcu_if *)0)->u) ) #ifdef __cplusplus -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Gerrit-Change-Number: 31176 Gerrit-PatchSet: 33 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[XL] Change in osmo-pcu[master]: support for Ericsson RBS E1 CCU
by laforge 20 Mar '23

20 Mar '23
Attention is currently required from: neels, dexter. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/31176 ) Change subject: support for Ericsson RBS E1 CCU ...................................................................... Patch Set 33: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/31176 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: I5c0a76667339ca984a12cbd2052f5d9e5b0f9c4d Gerrit-Change-Number: 31176 Gerrit-PatchSet: 33 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Mon, 20 Mar 2023 12:50:53 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in docker-playground[master]: README: add example: nightlies from different date
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/31984 ) Change subject: README: add example: nightlies from different date ...................................................................... README: add example: nightlies from different date Change-Id: I1b21c90b13a11aa1e51ea337207775c729709676 --- M README.md 1 file changed, 19 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/README.md b/README.md index dd3d992..0e59fe3 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,16 @@ * `NO_DOCKER_IMAGE_BUILD`: when set to `1`, it won't try to update the containers (see "caching" below) +### Using nightly packages from a different date + +Pick a date from [here](https://downloads.osmocom.org/obs-mirror/) and use it: + +``` +$ export OSMOCOM_REPO_PATH="obs-mirror/20230316-061901" +$ cd ttcn3-bsc-test +$ ./jenkins.sh +``` + ### More examples latest (debian): -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/31984 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I1b21c90b13a11aa1e51ea337207775c729709676 Gerrit-Change-Number: 31984 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
[S] Change in docker-playground[master]: README: add example: nightlies from different date
by laforge 20 Mar '23

20 Mar '23
Attention is currently required from: osmith. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/31984 ) Change subject: README: add example: nightlies from different date ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/31984 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I1b21c90b13a11aa1e51ea337207775c729709676 Gerrit-Change-Number: 31984 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Mon, 20 Mar 2023 12:50:10 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in pysim[master]: gitignore: add manuals related files
by laforge 20 Mar '23

20 Mar '23
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/31986 ) Change subject: gitignore: add manuals related files ...................................................................... gitignore: add manuals related files Change-Id: I93a63b33032f93f381b8ef451aecc97d3011ce8c --- M .gitignore 1 file changed, 12 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/.gitignore b/.gitignore index d18402d..8401eb2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ *.pyc .*.swp + +/docs/_* +/docs/generated -- To view, visit https://gerrit.osmocom.org/c/pysim/+/31986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I93a63b33032f93f381b8ef451aecc97d3011ce8c Gerrit-Change-Number: 31986 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • ...
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.