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

September 2026

  • 1 participants
  • 1894 discussions
[XS] Change in onomondo-eim[master]: esipa_asn1_handler: fix typos
by dexter 18 Sep '26

18 Sep '26
Attention is currently required from: dexter. Hello Jenkins Builder, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/onomondo-eim/+/43654?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: esipa_asn1_handler: fix typos ...................................................................... esipa_asn1_handler: fix typos Related: SYS#8100 Change-Id: I14416250cdb523f5c1a20d3a3e3dbe5cc6c53bcd --- M src/esipa_asn1_handler.erl 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/54/43654/3 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43654?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I14416250cdb523f5c1a20d3a3e3dbe5cc6c53bcd Gerrit-Change-Number: 43654 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[S] Change in onomondo-eim[master]: crypto_utils: log EID and encoded EUM cert instead of decoded cert
by dexter 18 Sep '26

18 Sep '26
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/onomondo-eim/+/43647?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: crypto_utils: log EID and encoded EUM cert instead of decoded cert ...................................................................... crypto_utils: log EID and encoded EUM cert instead of decoded cert When a profile download happens, the eIM automatically tries to check the EUM (and the eUICC certificate). This is done in order to cache the public key of the eUICC certificate. For the check, a the root certificate of the EUM certificate is required. If none is found, an error is logged with the decoded EUM certificate as context. This produces a lot of log lines and the decoded certificate contents are barely readable. Let's instead log the EID of the eUICC and the EUM certificate in its encoded form (hexdump). This is much more compact and still gives eIM operators enough context to track down the problem. Related: SYS#8100 Change-Id: I33c19fee0bec31b4c6b3c8052976625f3213aac1 --- M src/crypto_utils.erl 1 file changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/47/43647/3 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43647?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I33c19fee0bec31b4c6b3c8052976625f3213aac1 Gerrit-Change-Number: 43647 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org>
1 0
0 0
[XS] Change in onomondo-eim[master]: mnesia_db_work: use distinct logic when fetching from rest table
by dexter 18 Sep '26

18 Sep '26
Attention is currently required from: laforge. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43658?usp=email ) Change subject: mnesia_db_work: use distinct logic when fetching from rest table ...................................................................... Patch Set 2: (1 comment) File src/mnesia_db_work.erl: https://gerrit.osmocom.org/c/onomondo-eim/+/43658/comment/377d272c_b367b3a7… : PS1, Line 51: X#rest.facility =/= euicc > somehow the new indentation is off? I also think they look off, but that is what rebar3 fmt -w generates/enforces. -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43658?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I2e42bde0c03155e7b2bcf058b20174b75e8e0d97 Gerrit-Change-Number: 43658 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Fri, 18 Sep 2026 07:41:15 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in onomondo-ipa[master]: cosmetic: fix static, typos and sourcecode formatting
by dexter 18 Sep '26

18 Sep '26
dexter has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-ipa/+/43439?usp=email ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: cosmetic: fix static, typos and sourcecode formatting ...................................................................... cosmetic: fix static, typos and sourcecode formatting This patch fixes a few minor cosmetic issues: - Ensure that all function that can be declared as static are declared as static - Fix typos - Fix sourcecode formatting Related: SYS#8101 Change-Id: I3b3fa7dc6e2e541cccff6579b4424157e8233fa8 --- M src/ipa/libipa/es10b_euicc_mem_rst.c M src/ipa/libipa/es10b_get_eim_cfg_data.c M src/ipa/libipa/es10b_immediate_enable.c M src/ipa/libipa/es10b_load_euicc_pkg.c M src/ipa/libipa/es10b_retr_notif_from_lst.c M src/ipa/libipa/es10c_get_prfle_info.c M src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c M src/ipa/libipa/ipad.c M src/ipa/libipa/proc_eim_pkg_retr.c M src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c 10 files changed, 59 insertions(+), 50 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified jolly: Looks good to me, but someone else must approve diff --git a/src/ipa/libipa/es10b_euicc_mem_rst.c b/src/ipa/libipa/es10b_euicc_mem_rst.c index 1e90adb..179f89a 100644 --- a/src/ipa/libipa/es10b_euicc_mem_rst.c +++ b/src/ipa/libipa/es10b_euicc_mem_rst.c @@ -131,7 +131,7 @@ return rc; } -int euicc_mem_rst(struct ipa_context *ctx, const struct ipa_es10b_euicc_mem_rst *req) +static int euicc_mem_rst(struct ipa_context *ctx, const struct ipa_es10b_euicc_mem_rst *req) { struct ipa_buf *es10b_req = NULL; struct ipa_buf *es10b_res = NULL; @@ -180,7 +180,7 @@ return rc; } -int euicc_mem_rst_emu(struct ipa_context *ctx, const struct ipa_es10b_euicc_mem_rst *req) +static int euicc_mem_rst_emu(struct ipa_context *ctx, const struct ipa_es10b_euicc_mem_rst *req) { struct ipa_buf *es10b_req = NULL; struct ipa_buf *es10b_res = NULL; diff --git a/src/ipa/libipa/es10b_get_eim_cfg_data.c b/src/ipa/libipa/es10b_get_eim_cfg_data.c index 6e2f32b..9a34392 100644 --- a/src/ipa/libipa/es10b_get_eim_cfg_data.c +++ b/src/ipa/libipa/es10b_get_eim_cfg_data.c @@ -23,7 +23,7 @@ #include "es10x.h" #include "es10b_get_eim_cfg_data.h" -void convert_get_eim_cfg_data(struct ipa_es10b_eim_cfg_data *res) +static void convert_get_eim_cfg_data(struct ipa_es10b_eim_cfg_data *res) { unsigned int i; asn_enc_rval_t rc; diff --git a/src/ipa/libipa/es10b_immediate_enable.c b/src/ipa/libipa/es10b_immediate_enable.c index 922e015..9847fc0 100644 --- a/src/ipa/libipa/es10b_immediate_enable.c +++ b/src/ipa/libipa/es10b_immediate_enable.c @@ -57,7 +57,7 @@ return rc; } -int immediate_enable(struct ipa_context *ctx, bool refresh_flag) +static int immediate_enable(struct ipa_context *ctx, bool refresh_flag) { struct ipa_buf *es10b_req = NULL; struct ipa_buf *es10b_res = NULL; @@ -87,7 +87,7 @@ return rc; } -int immediate_enable_emu(struct ipa_context *ctx, bool refresh_flag) +static int immediate_enable_emu(struct ipa_context *ctx, bool refresh_flag) { struct ipa_es10c_enable_prfle_req enable_prfle_req = { 0 }; struct ipa_es10c_enable_prfle_res *enable_prfle_res = NULL; diff --git a/src/ipa/libipa/es10b_load_euicc_pkg.c b/src/ipa/libipa/es10b_load_euicc_pkg.c index 3bc0747..1989a59 100644 --- a/src/ipa/libipa/es10b_load_euicc_pkg.c +++ b/src/ipa/libipa/es10b_load_euicc_pkg.c @@ -71,7 +71,7 @@ return 0; } -struct ipa_es10b_load_euicc_pkg_res *load_euicc_pkg(struct ipa_context *ctx, +static struct ipa_es10b_load_euicc_pkg_res *load_euicc_pkg(struct ipa_context *ctx, const struct ipa_es10b_load_euicc_pkg_req *req) { struct ipa_buf *es10b_req = NULL; @@ -105,7 +105,7 @@ return NULL; } -struct EuiccResultData *iot_emo_do_enable_psmo(struct ipa_context *ctx, const struct Psmo__enable *enable_psmo) +static struct EuiccResultData *iot_emu_do_enable_psmo(struct ipa_context *ctx, const struct Psmo__enable *enable_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10c_enable_prfle_req enable_prfle_req = { 0 }; @@ -129,7 +129,8 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_disable_psmo(struct ipa_context *ctx, const struct Psmo__disable *disable_psmo) +static struct EuiccResultData *iot_emu_do_disable_psmo(struct ipa_context *ctx, + const struct Psmo__disable *disable_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10c_disable_prfle_req disable_prfle_req = { 0 }; @@ -153,7 +154,7 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_delete_psmo(struct ipa_context *ctx, const struct Psmo__delete *delete_psmo) +static struct EuiccResultData *iot_emu_do_delete_psmo(struct ipa_context *ctx, const struct Psmo__delete *delete_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10c_delete_prfle_req delete_prfle_req = { 0 }; @@ -175,8 +176,9 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_listProfileInfo_psmo(struct ipa_context *ctx, - const struct ProfileInfoListRequest *listProfileInfo_psmo) +static struct EuiccResultData *iot_emu_do_listProfileInfo_psmo(struct ipa_context *ctx, + const struct ProfileInfoListRequest + *listProfileInfo_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10c_get_prfle_info_req get_prfle_info_req = { 0 }; @@ -207,7 +209,7 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_getRAT_psmo(struct ipa_context *ctx, const struct Psmo__getRAT *getRAT_psmo) +static struct EuiccResultData *iot_emu_do_getRAT_psmo(struct ipa_context *ctx, const struct Psmo__getRAT *getRAT_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10b_get_rat_res *get_rat_res = NULL; @@ -234,8 +236,9 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_configureImmediateEnable_psmo(struct ipa_context *ctx, const struct Psmo__configureImmediateEnable - *configureImmediateEnable_psmo) +static struct EuiccResultData *iot_emu_do_configureImmediateEnable_psmo(struct ipa_context *ctx, + const struct Psmo__configureImmediateEnable + *configureImmediateEnable_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); @@ -266,8 +269,9 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_setFallbackAttribute_psmo(struct ipa_context *ctx, - const struct Psmo__setFallbackAttribute *setFallbackAttribute_psmo) +static struct EuiccResultData *iot_emu_do_setFallbackAttribute_psmo(struct ipa_context *ctx, + const struct Psmo__setFallbackAttribute + *setFallbackAttribute_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); @@ -280,8 +284,9 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_unsetFallbackAttribute_psmo(struct ipa_context *ctx, - const struct Psmo__unsetFallbackAttribute *unsetFallbackAttribute_psmo) +static struct EuiccResultData *iot_emu_do_unsetFallbackAttribute_psmo(struct ipa_context *ctx, + const struct Psmo__unsetFallbackAttribute + *unsetFallbackAttribute_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); @@ -294,8 +299,9 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_setDefaultDpAddress_psmo(struct ipa_context *ctx, - const SGP32_SetDefaultDpAddressRequest_t *setDefaultDpAddress_psmo) +static struct EuiccResultData *iot_emu_do_setDefaultDpAddress_psmo(struct ipa_context *ctx, + const SGP32_SetDefaultDpAddressRequest_t + *setDefaultDpAddress_psmo) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); int rc; @@ -313,7 +319,8 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_addEim_eco(struct ipa_context *ctx, const struct EimConfigurationData *addEim_eco) +static struct EuiccResultData *iot_emu_do_addEim_eco(struct ipa_context *ctx, + const struct EimConfigurationData *addEim_eco) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL; @@ -389,7 +396,8 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_deleteEim_eco(struct ipa_context *ctx, const struct Eco__deleteEim *deleteEim_eco) +static struct EuiccResultData *iot_emu_do_deleteEim_eco(struct ipa_context *ctx, + const struct Eco__deleteEim *deleteEim_eco) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL; @@ -448,8 +456,8 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_updateEim_eco(struct ipa_context *ctx, - const struct EimConfigurationData *updateEim_eco) +static struct EuiccResultData *iot_emu_do_updateEim_eco(struct ipa_context *ctx, + const struct EimConfigurationData *updateEim_eco) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL; @@ -538,7 +546,7 @@ return euicc_result_data; } -struct EuiccResultData *iot_emo_do_listEim_eco(struct ipa_context *ctx, const struct Eco__listEim *listEim_eco) +static struct EuiccResultData *iot_emu_do_listEim_eco(struct ipa_context *ctx, const struct Eco__listEim *listEim_eco) { struct EuiccResultData *euicc_result_data = IPA_ALLOC_ZERO(struct EuiccResultData); struct ipa_es10b_eim_cfg_data *eim_cfg_data = NULL; @@ -584,8 +592,8 @@ return euicc_result_data; } -struct ipa_es10b_load_euicc_pkg_res *load_euicc_pkg_iot_emu(struct ipa_context *ctx, - const struct ipa_es10b_load_euicc_pkg_req *req) +static struct ipa_es10b_load_euicc_pkg_res *load_euicc_pkg_iot_emu(struct ipa_context *ctx, + const struct ipa_es10b_load_euicc_pkg_req *req) { struct ipa_es10b_load_euicc_pkg_res *res = NULL; struct EuiccPackageResult *asn = NULL; @@ -621,7 +629,7 @@ ipa_buf_assign(&euicc_sign_epr, euiccSignEPR_dummy, sizeof(euiccSignEPR_dummy)); IPA_COPY_IPA_BUF_TO_ASN(&asn->choice.euiccPackageResultSigned.euiccSignEPR, &euicc_sign_epr); - /* Go through the list of PSMOs and ECOs and execute the corresponding iot_emo_do... functions */ + /* Go through the list of PSMOs and ECOs and execute the corresponding iot_emu_do... functions */ switch (req->req.euiccPackageSigned.euiccPackage.present) { case EuiccPackage_PR_psmoList: for (i = 0; i < req->req.euiccPackageSigned.euiccPackage.choice.psmoList.list.count; i++) { @@ -629,32 +637,32 @@ psmo_result = NULL; switch (psmo->present) { case Psmo_PR_enable: - psmo_result = iot_emo_do_enable_psmo(ctx, &psmo->choice.enable); + psmo_result = iot_emu_do_enable_psmo(ctx, &psmo->choice.enable); break; case Psmo_PR_disable: - psmo_result = iot_emo_do_disable_psmo(ctx, &psmo->choice.disable); + psmo_result = iot_emu_do_disable_psmo(ctx, &psmo->choice.disable); break; case Psmo_PR_delete: - psmo_result = iot_emo_do_delete_psmo(ctx, &psmo->choice.Delete); + psmo_result = iot_emu_do_delete_psmo(ctx, &psmo->choice.Delete); break; case Psmo_PR_listProfileInfo: - psmo_result = iot_emo_do_listProfileInfo_psmo(ctx, &psmo->choice.listProfileInfo); + psmo_result = iot_emu_do_listProfileInfo_psmo(ctx, &psmo->choice.listProfileInfo); break; case Psmo_PR_getRAT: - psmo_result = iot_emo_do_getRAT_psmo(ctx, &psmo->choice.getRAT); + psmo_result = iot_emu_do_getRAT_psmo(ctx, &psmo->choice.getRAT); break; case Psmo_PR_configureImmediateEnable: psmo_result = - iot_emo_do_configureImmediateEnable_psmo(ctx, &psmo->choice.configureImmediateEnable); + iot_emu_do_configureImmediateEnable_psmo(ctx, &psmo->choice.configureImmediateEnable); break; case Psmo_PR_setFallbackAttribute: - psmo_result = iot_emo_do_setFallbackAttribute_psmo(ctx, &psmo->choice.setFallbackAttribute); + psmo_result = iot_emu_do_setFallbackAttribute_psmo(ctx, &psmo->choice.setFallbackAttribute); break; case Psmo_PR_unsetFallbackAttribute: - psmo_result = iot_emo_do_unsetFallbackAttribute_psmo(ctx, &psmo->choice.unsetFallbackAttribute); + psmo_result = iot_emu_do_unsetFallbackAttribute_psmo(ctx, &psmo->choice.unsetFallbackAttribute); break; case Psmo_PR_setDefaultDpAddress: - psmo_result = iot_emo_do_setDefaultDpAddress_psmo(ctx, &psmo->choice.setDefaultDpAddress); + psmo_result = iot_emu_do_setDefaultDpAddress_psmo(ctx, &psmo->choice.setDefaultDpAddress); break; default: IPA_LOGP_ES10X("LoadEuiccPackage", LERROR, "ignoring invalid or unsupported PSMO!\n"); @@ -671,16 +679,16 @@ eco_result = NULL; switch (eco->present) { case Eco_PR_addEim: - eco_result = iot_emo_do_addEim_eco(ctx, &eco->choice.addEim); + eco_result = iot_emu_do_addEim_eco(ctx, &eco->choice.addEim); break; case Eco_PR_deleteEim: - eco_result = iot_emo_do_deleteEim_eco(ctx, &eco->choice.deleteEim); + eco_result = iot_emu_do_deleteEim_eco(ctx, &eco->choice.deleteEim); break; case Eco_PR_updateEim: - eco_result = iot_emo_do_updateEim_eco(ctx, &eco->choice.updateEim); + eco_result = iot_emu_do_updateEim_eco(ctx, &eco->choice.updateEim); break; case Eco_PR_listEim: - eco_result = iot_emo_do_listEim_eco(ctx, &eco->choice.listEim); + eco_result = iot_emu_do_listEim_eco(ctx, &eco->choice.listEim); break; default: IPA_LOGP_ES10X("LoadEuiccPackage", LERROR, "ignoring invalid or unsupported eCO!\n"); diff --git a/src/ipa/libipa/es10b_retr_notif_from_lst.c b/src/ipa/libipa/es10b_retr_notif_from_lst.c index 608a8db..52773ca 100644 --- a/src/ipa/libipa/es10b_retr_notif_from_lst.c +++ b/src/ipa/libipa/es10b_retr_notif_from_lst.c @@ -24,8 +24,8 @@ #include "es10b_retr_notif_from_lst.h" /* Convert a notificationList (RetrieveNotificationsListResponse) from RSP to SGP32 format. */ -void convert_notification_list(PendingNotificationList_t *lst_out, - const struct RetrieveNotificationsListResponse__notificationList *lst_in) +static void convert_notification_list(PendingNotificationList_t *lst_out, + const struct RetrieveNotificationsListResponse__notificationList *lst_in) { unsigned int i; struct PendingNotification *pending_notif_item; @@ -73,7 +73,7 @@ } /*! Free a converted notificationList (RetrieveNotificationsListResponse). */ -void free_converted_notification_list(PendingNotificationList_t *lst) +static void free_converted_notification_list(PendingNotificationList_t *lst) { int i; if (!lst) diff --git a/src/ipa/libipa/es10c_get_prfle_info.c b/src/ipa/libipa/es10c_get_prfle_info.c index 9c82505..6005101 100644 --- a/src/ipa/libipa/es10c_get_prfle_info.c +++ b/src/ipa/libipa/es10c_get_prfle_info.c @@ -105,7 +105,7 @@ return sgp32_res; } -struct ipa_es10c_get_prfle_info_req *conv_get_prfle_info_req(const struct ipa_es10c_get_prfle_info_req *req) +static struct ipa_es10c_get_prfle_info_req *conv_get_prfle_info_req(const struct ipa_es10c_get_prfle_info_req *req) { uint8_t default_tags[] = { 0x5A, 0x4F, 0x9F, 0x70, 0x91, 0x92, 0x95, 0x9F, 0x7B, 0x9F, 0x26, 0x9F, 0x67 }; struct ipa_es10c_get_prfle_info_req *conv_req = IPA_ALLOC_ZERO(struct ipa_es10c_get_prfle_info_req); @@ -157,7 +157,7 @@ return conv_req; } -void conv_get_prfle_info_req_free(struct ipa_es10c_get_prfle_info_req *req) +static void conv_get_prfle_info_req_free(struct ipa_es10c_get_prfle_info_req *req) { if (!req) return; diff --git a/src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c b/src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c index 96af767..d0914b2 100644 --- a/src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c +++ b/src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c @@ -67,7 +67,7 @@ return enc; } -struct ipa_esipa_prvde_eim_pkg_rslt_res *dec_prvde_eim_pkg_rslt_res(const struct ipa_buf *msg_to_ipa_encoded) +static struct ipa_esipa_prvde_eim_pkg_rslt_res *dec_prvde_eim_pkg_rslt_res(const struct ipa_buf *msg_to_ipa_encoded) { struct EsipaMessageFromEimToIpa *msg_to_ipa = NULL; struct ipa_esipa_prvde_eim_pkg_rslt_res *res = NULL; diff --git a/src/ipa/libipa/ipad.c b/src/ipa/libipa/ipad.c index 0a590ec..1b15e56 100644 --- a/src/ipa/libipa/ipad.c +++ b/src/ipa/libipa/ipad.c @@ -88,7 +88,7 @@ return nvstate_bin; } -struct ipa_buf *nvstate_deserialize_ipa_buf(uint8_t ** nvstate_data, size_t *nvstate_data_len) +static struct ipa_buf *nvstate_deserialize_ipa_buf(uint8_t **nvstate_data, size_t *nvstate_data_len) { struct ipa_buf *buf; diff --git a/src/ipa/libipa/proc_eim_pkg_retr.c b/src/ipa/libipa/proc_eim_pkg_retr.c index ebe8e91..e5b3422 100644 --- a/src/ipa/libipa/proc_eim_pkg_retr.c +++ b/src/ipa/libipa/proc_eim_pkg_retr.c @@ -62,7 +62,7 @@ } /* Relay package contents to suitable handler procedure */ -int eim_pkg_exec(struct ipa_context *ctx, const struct ipa_esipa_get_eim_pkg_res *get_eim_pkg_res) +static int eim_pkg_exec(struct ipa_context *ctx, const struct ipa_esipa_get_eim_pkg_res *get_eim_pkg_res) { struct ipa_buf *allowed_ca_pkid = NULL; bool indirect_profile_download = false; diff --git a/src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c b/src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c index f8f072b..d942bc7 100644 --- a/src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c +++ b/src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c @@ -159,7 +159,8 @@ * \param[inout] ctx pointer to ipa_context. * \param[in] euicc_package_request pointer to struct that holds the EuiccPackageRequest. * \returns struct with intermediate result on success, NULL on failure. */ -struct ipa_proc_eucc_pkg_dwnld_exec_res *ipa_proc_eucc_pkg_dwnld_exec(struct ipa_context *ctx, const struct EuiccPackageRequest +struct ipa_proc_eucc_pkg_dwnld_exec_res *ipa_proc_eucc_pkg_dwnld_exec(struct ipa_context *ctx, + const struct EuiccPackageRequest *euicc_package_request) { struct ipa_es10b_load_euicc_pkg_req load_euicc_pkg_req = { 0 }; -- To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43439?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: onomondo-ipa Gerrit-Branch: master Gerrit-Change-Id: I3b3fa7dc6e2e541cccff6579b4424157e8233fa8 Gerrit-Change-Number: 43439 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in onomondo-ipa[master]: cosmetic: fix static, typos and sourcecode formatting
by dexter 18 Sep '26

18 Sep '26
Attention is currently required from: dexter. Hello Jenkins Builder, jolly, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43439?usp=email to look at the new patch set (#5). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: cosmetic: fix static, typos and sourcecode formatting ...................................................................... cosmetic: fix static, typos and sourcecode formatting This patch fixes a few minor cosmetic issues: - Ensure that all function that can be declared as static are declared as static - Fix typos - Fix sourcecode formatting Related: SYS#8101 Change-Id: I3b3fa7dc6e2e541cccff6579b4424157e8233fa8 --- M src/ipa/libipa/es10b_euicc_mem_rst.c M src/ipa/libipa/es10b_get_eim_cfg_data.c M src/ipa/libipa/es10b_immediate_enable.c M src/ipa/libipa/es10b_load_euicc_pkg.c M src/ipa/libipa/es10b_retr_notif_from_lst.c M src/ipa/libipa/es10c_get_prfle_info.c M src/ipa/libipa/esipa_prvde_eim_pkg_rslt.c M src/ipa/libipa/ipad.c M src/ipa/libipa/proc_eim_pkg_retr.c M src/ipa/libipa/proc_euicc_pkg_dwnld_exec.c 10 files changed, 59 insertions(+), 50 deletions(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-ipa refs/changes/39/43439/5 -- To view, visit https://gerrit.osmocom.org/c/onomondo-ipa/+/43439?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: onomondo-ipa Gerrit-Branch: master Gerrit-Change-Id: I3b3fa7dc6e2e541cccff6579b4424157e8233fa8 Gerrit-Change-Number: 43439 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[XS] Change in osmo-trx[master]: Transceiver52M: use lround() for TRXD toa/ci rounding
by fixeria 17 Sep '26

17 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43161?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transceiver52M: use lround() for TRXD toa/ci rounding ...................................................................... Transceiver52M: use lround() for TRXD toa/ci rounding trxd_fill_v0_specific() and trxd_fill_v1_specific() rounded bi->toa and bi->ci to the nearest integer using the "+ 0.5, then truncate" idiom. That only rounds correctly for non-negative inputs: for negative values (toa can be negative for an early burst, ci can be negative under poor C/I conditions) it biases towards zero instead of rounding to nearest, e.g. -1.3 + 0.5 = -0.8, truncated to 0 instead of the correct -1. Use lround() instead, which rounds-half-away-from-zero correctly for both signs. Change-Id: I0c52f1b91070e4750a8a0ffbccb222454e694c3b Related: OS#5283 --- M Transceiver52M/proto_trxd.c 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/Transceiver52M/proto_trxd.c b/Transceiver52M/proto_trxd.c index e5a889d..638f7f3 100644 --- a/Transceiver52M/proto_trxd.c +++ b/Transceiver52M/proto_trxd.c @@ -38,7 +38,7 @@ int toa_int; /* in 1/256 symbols, round to closest integer */ - toa_int = (int) (bi->toa * 256.0 + 0.5); + toa_int = (int) lround(bi->toa * 256.0); v0->rssi = bi->rssi; osmo_store16be(toa_int, &v0->toa); } @@ -48,7 +48,7 @@ int16_t ci_int_cB; /* deciBels->centiBels, round to closest integer */ - ci_int_cB = (int16_t)((bi->ci * 10) + 0.5); + ci_int_cB = (int16_t) lround(bi->ci * 10.0); v1->idle = !!bi->idle; v1->modulation = (bi->modulation == MODULATION_GMSK) ? -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43161?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I0c52f1b91070e4750a8a0ffbccb222454e694c3b Gerrit-Change-Number: 43161 Gerrit-PatchSet: 9 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(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-Reviewer: tnt <tnt(a)246tNt.com>
1 0
0 0
[XS] Change in osmo-trx[master]: Transceiver52M: use lround() for TRXD rssi rounding
by fixeria 17 Sep '26

17 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43162?usp=email ) ( 4 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transceiver52M: use lround() for TRXD rssi rounding ...................................................................... Transceiver52M: use lround() for TRXD rssi rounding trxd_fill_v0_specific() assigned bi->rssi to v0->rssi via a bare narrowing double->uint8_t cast, silently truncating towards zero instead of rounding to nearest. Use lround(), consistent with the toa/ci rounding fixed in the preceding commit. Change-Id: Ibdfe9f1b84c797bd7a50b4ee3f395c2af0ee88fd Related: OS#5283 --- M Transceiver52M/proto_trxd.c 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/proto_trxd.c b/Transceiver52M/proto_trxd.c index 638f7f3..418daa6 100644 --- a/Transceiver52M/proto_trxd.c +++ b/Transceiver52M/proto_trxd.c @@ -39,7 +39,7 @@ /* in 1/256 symbols, round to closest integer */ toa_int = (int) lround(bi->toa * 256.0); - v0->rssi = bi->rssi; + v0->rssi = (uint8_t) lround(bi->rssi); osmo_store16be(toa_int, &v0->toa); } -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43162?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ibdfe9f1b84c797bd7a50b4ee3f395c2af0ee88fd Gerrit-Change-Number: 43162 Gerrit-PatchSet: 9 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(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-Reviewer: tnt <tnt(a)246tNt.com>
1 0
0 0
[L] Change in osmo-trx[master]: Transceiver52M: migrate to libosmo-trx
by fixeria 17 Sep '26

17 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43115?usp=email ) ( 9 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transceiver52M: migrate to libosmo-trx ...................................................................... Transceiver52M: migrate to libosmo-trx Replace the local TRXC/TRXD implementation with libosmo-trx's shared osmo_trxc_msg/osmo_trxd_burst_{ind,req} API, including SETSLOT parsing via osmo_trxc_setslot_parse()/_build(). Take a chance to fix SETSLOT to always send a response, distinguishing bogus input from unsupported VAMOS channel combinations. Only the TRXC/TRXD build/parse API is used here, not the osmo_trx_ep endpoint API: osmo-trx runs its socket I/O on dedicated threads that don't drive osmo_select_main(), which osmo_trx_ep depends on. Change-Id: I458ec85c56e2101d073c8c35f11c147191c4ea0c Related: OS#5283 --- M Transceiver52M/Makefile.am M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h D Transceiver52M/proto_trxd.c D Transceiver52M/proto_trxd.h M Transceiver52M/sigProcLib.cpp M Transceiver52M/sigProcLib.h 7 files changed, 308 insertions(+), 496 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am index 74152b3..4cf5f9c 100644 --- a/Transceiver52M/Makefile.am +++ b/Transceiver52M/Makefile.am @@ -23,9 +23,28 @@ SUBDIRS = arch device -AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/arch/common -I${srcdir}/device/common -AM_CXXFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOVTY_CFLAGS) -AM_CFLAGS = -lpthread $(LIBOSMOCORE_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOVTY_CFLAGS) +AM_CPPFLAGS = \ + -Wall \ + $(STD_DEFINES_AND_INCLUDES) \ + -I${srcdir}/arch/common \ + -I${srcdir}/device/common \ + -I$(top_srcdir)/libosmo-trx/include \ + -I$(top_builddir)/libosmo-trx/include \ + $(NULL) + +AM_CXXFLAGS = \ + -lpthread \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(NULL) + +AM_CFLAGS = \ + -lpthread \ + $(LIBOSMOCORE_CFLAGS) \ + $(LIBOSMOCTRL_CFLAGS) \ + $(LIBOSMOVTY_CFLAGS) \ + $(NULL) noinst_LTLIBRARIES = libtransceiver_common.la @@ -37,7 +56,6 @@ sigProcLib.cpp \ signalVector.cpp \ Transceiver.cpp \ - proto_trxd.c \ grgsm_vitac/grgsm_vitac.cpp \ grgsm_vitac/viterbi_detector.cc @@ -67,8 +85,7 @@ sigProcLib.h \ signalVector.h \ Transceiver.h \ - Resampler.h \ - proto_trxd.h + Resampler.h if ENABLE_MULTI_ARFCN noinst_HEADERS += \ @@ -79,7 +96,8 @@ endif COMMON_LDADD = \ - libtransceiver_common.la \ + $(builddir)/libtransceiver_common.la \ + $(top_builddir)/libosmo-trx/src/libosmo-trx.la \ $(ARCH_LA) \ $(GSM_LA) \ $(COMMON_LA) \ diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 46d06db..9dc26a4 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -25,6 +25,7 @@ #include <stdio.h> #include <netinet/in.h> +#include <algorithm> // std::transform #include <iomanip> // std::setprecision #include <fstream> #include "Transceiver.h" @@ -33,12 +34,14 @@ extern "C" { #include "osmo_signal.h" -#include "proto_trxd.h" #include <osmocom/core/utils.h> #include <osmocom/core/socket.h> #include <osmocom/core/bits.h> +#include <osmocom/core/msgb.h> #include <osmocom/vty/cpu_sched_vty.h> +#include <osmocom/trx/trxc.h> +#include <osmocom/trx/trxd.h> } #ifdef HAVE_CONFIG_H @@ -142,7 +145,8 @@ mRxServiceLoopThreads(mChans), mRxLowerLoopThread(nullptr), mTxLowerLoopThread(nullptr), mTxPriorityQueueServiceLoopThreads(mChans), mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface), mOn(false),mForceClockInterface(false), mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), - mMaxExpectedDelayNB(0), mWriteBurstToDiskMask(0), mVersionTRXD(mChans), mStates(mChans) + mMaxExpectedDelayNB(0), mWriteBurstToDiskMask(0), mVersionTRXD(mChans), mStates(mChans), + mBurstIndMsg(mChans) { txFullScale = mRadioInterface->fullScaleInputValue(); rxFullScale = mRadioInterface->fullScaleOutputValue(); @@ -151,6 +155,11 @@ for (size_t j = 0; j < ARRAY_SIZE(mHandover[i]); j++) mHandover[i][j] = false; } + + for (size_t i = 0; i < mChans; i++) { + mBurstIndMsg[i] = msgb_alloc(OSMO_TRXD_MSG_BUF_SIZE, "trxd_burst_ind"); + OSMO_ASSERT(mBurstIndMsg[i] != NULL); + } } Transceiver::~Transceiver() @@ -166,6 +175,7 @@ mTxPriorityQueues[i].clear(); if (mDataSockets[i] >= 0) close(mDataSockets[i]); + msgb_free(mBurstIndMsg[i]); } } @@ -655,6 +665,29 @@ }; #endif +/* Convert a soft bit in rxBurst's native -1..+1 range (+1.0 = confident '1') + * into the sbit_t domain (-127..127) used by struct osmo_trxd_burst_ind. */ +static inline sbit_t float_soft_bit_to_sbit(float x) +{ + /* The input is not guaranteed to be within the range of [-1, +1] + * (amplitude estimation error, noise), so clamp on both ends. */ + if (x > 1.0f) + x = 1.0f; + else if (x < -1.0f) + x = -1.0f; + + /* x in [-1, +1] maps exactly onto sbit_t's [-127, +127] */ + return (sbit_t) lround(-127.0 * x); +} + +/* Convert a diversity-averaged burst energy sample into the dBm-domain RSSI. */ +static inline int8_t energy_to_rssi_dbm(float energy, double rxFullScale, double rssi_offset) +{ + double energy_dbfs = 20.0 * log10(rxFullScale / energy); + double rssi_dbm = -(energy_dbfs + rssi_offset); + return (int8_t) lround(rssi_dbm); +} + /* * Pull bursts from the FIFO and handle according to the slot * and burst correlation type. Equalzation is currently disabled. @@ -662,7 +695,7 @@ * -ENOENT: timeslot is off (fn and tn in bi are filled), * -EIO: read error */ -int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi) +int Transceiver::pullRadioVector(size_t chan, struct osmo_trxd_burst_ind *bi) { int rc; struct estim_burst_params ebp; @@ -691,17 +724,12 @@ CorrType type = expectedCorrType(burstTime, chan); /* Initialize struct bi */ - bi->nbits = 0; + memset(bi, 0, sizeof(*bi)); + bi->flags = OSMO_TRXD_F_MOD_TYPE | OSMO_TRXD_F_TS_INFO | OSMO_TRXD_F_CI_CB; bi->fn = burstTime.FN(); bi->tn = burstTime.TN(); - bi->rssi = 0.0; - bi->toa = 0.0; - bi->noise = 0.0; - bi->idle = false; - bi->modulation = MODULATION_GMSK; - bi->tss = 0; /* TODO: we only support tss 0 right now */ - bi->tsc = 0; - bi->ci = 0.0; + bi->mod = OSMO_TRXD_MOD_T_GMSK; + bi->tsc_set = 0; /* TODO: we only support tsc_set 0 right now */ /* Debug: dump bursts to disk */ /* bits 0-7 - chan 0 timeslots @@ -748,8 +776,7 @@ } rssi_offset = rssiOffset(chan); - bi->rssi = 20.0 * log10(rxFullScale / avg) + rssi_offset; - bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssi_offset; + bi->rssi = energy_to_rssi_dbm(avg, rxFullScale, rssi_offset); if (type == IDLE) goto ret_idle; @@ -786,21 +813,21 @@ rxBurst = demodAnyBurst(*shvec_ptr, (CorrType)rc, cfg->rx_sps, &ebp); } - bi->toa = ebp.toa; + bi->toa256 = (int16_t) lround(ebp.toa * 256.0); bi->tsc = ebp.tsc; - bi->ci = ebp.ci; + bi->ci_cb = (int16_t) lround(ebp.ci * 10.0); /* EDGE demodulator returns 444 (gSlotLen * 3) bits */ if (rxBurst->size() == EDGE_BURST_NBITS) { - bi->modulation = MODULATION_8PSK; - bi->nbits = EDGE_BURST_NBITS; + bi->mod = OSMO_TRXD_MOD_T_8PSK; + bi->burst_len = EDGE_BURST_NBITS; } else { /* size() here is actually gSlotLen + 8, due to guard periods */ - bi->modulation = MODULATION_GMSK; - bi->nbits = gSlotLen; + bi->mod = OSMO_TRXD_MOD_T_GMSK; + bi->burst_len = gSlotLen; } - // Convert -1..+1 soft bits to 0..1 soft bits - vectorSlicer(bi->rx_burst, rxBurst->begin(), bi->nbits); + std::transform(rxBurst->begin(), rxBurst->begin() + bi->burst_len, + bi->burst, float_soft_bit_to_sbit); delete rxBurst; delete radio_burst; @@ -809,7 +836,8 @@ ret_idle: if (ctr_changed) dispatch_trx_rate_ctr_change(state, chan); - bi->idle = true; + bi->flags |= OSMO_TRXD_F_NOPE_IND; + bi->burst_len = 0; delete radio_burst; return 0; } @@ -820,36 +848,6 @@ mTxPriorityQueues[i].clear(); } - -/** - * Matches a buffer with a command. - * @param buf a buffer to look command in - * @param cmd a command to look in buffer - * @param params pointer to arguments, or NULL - * @return true if command matches, otherwise false - */ -static bool match_cmd(const char *buf, - const char *cmd, const char **params) -{ - size_t cmd_len = strlen(cmd); - - /* Check a command itself */ - if (strncmp(buf, cmd, cmd_len)) - return false; - - /* A command has arguments */ - if (params != NULL) { - /* Make sure there is a space */ - if (buf[cmd_len] != ' ') - return false; - - /* Update external pointer */ - *params = buf + cmd_len + 1; - } - - return true; -} - void Transceiver::ctrl_sock_send(ctrl_msg& m, int chan) { ctrl_sock_state& s = mCtrlSockets[chan]; @@ -896,17 +894,15 @@ int Transceiver::ctrl_sock_handle_rx(int chan) { + struct osmo_trxc_msg cmd, rsp; ctrl_msg cmd_received; ctrl_msg cmd_to_send; - char *buffer = cmd_received.data; - char *response = cmd_to_send.data; - const size_t response_size = sizeof(cmd_to_send.data); - const char *command, *params; int msgLen; + int rc; ctrl_sock_state& s = mCtrlSockets[chan]; /* Attempt to read from control socket */ - msgLen = read(s.conn_bfd.fd, buffer, sizeof(cmd_received.data)-1); + msgLen = read(s.conn_bfd.fd, cmd_received.data, sizeof(cmd_received.data) - 1); if (msgLen < 0 && errno == EAGAIN) return 0; /* Try again later */ if (msgLen <= 0) { @@ -914,184 +910,196 @@ return -EIO; } - - /* Zero-terminate received string */ - buffer[msgLen] = '\0'; - - /* Verify a command signature */ - if (strncmp(buffer, "CMD ", 4)) { + rc = osmo_trxc_msg_parse(&cmd, cmd_received.data, msgLen); + if (rc < 0 || cmd.type != OSMO_TRXC_MT_CMD) { LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus message on control interface"; return -EIO; } - /* Set command pointer */ - command = buffer + 4; - LOGCHAN(chan, DTRXCTRL, INFO) << "command is '" << command << "'"; + memset(&rsp, 0, sizeof(rsp)); + rsp.type = OSMO_TRXC_MT_RSP; + rsp.status = 1; /* default: NACK, cleared to 0 on the success path of each verb below */ + snprintf(rsp.cmd, sizeof(rsp.cmd), "%s", cmd.cmd); - if (match_cmd(command, "POWEROFF", NULL)) { + LOGCHAN(chan, DTRXCTRL, INFO) << "command is '" << osmo_trxc_msg_name(&cmd) << "'"; + + if (!strcmp(cmd.cmd, "POWEROFF")) { stop(); - snprintf(response, response_size, "RSP POWEROFF 0"); - } else if (match_cmd(command, "POWERON", NULL)) { - if (!start()) { - snprintf(response, response_size, "RSP POWERON 1"); - } else { - snprintf(response, response_size, "RSP POWERON 0"); + rsp.status = 0; + } else if (!strcmp(cmd.cmd, "POWERON")) { + if (start()) { + rsp.status = 0; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) mHandover[i][j] = false; } } - } else if (match_cmd(command, "HANDOVER", &params)) { + } else if (!strcmp(cmd.cmd, "HANDOVER")) { unsigned ts = 0, ss = 0; - sscanf(params, "%u %u", &ts, &ss); - if (ts > 7 || ss > 7) { - snprintf(response, response_size, "RSP HANDOVER 1 %u %u", ts, ss); - } else { + if (osmo_trxc_msg_params_scan(&cmd, "%u %u", &ts, &ss) == 2 && ts <= 7 && ss <= 7) { mHandover[ts][ss] = true; - snprintf(response, response_size, "RSP HANDOVER 0 %u %u", ts, ss); + rsp.status = 0; } - } else if (match_cmd(command, "NOHANDOVER", &params)) { + snprintf(rsp.params, sizeof(rsp.params), "%u %u", ts, ss); + } else if (!strcmp(cmd.cmd, "NOHANDOVER")) { unsigned ts = 0, ss = 0; - sscanf(params, "%u %u", &ts, &ss); - if (ts > 7 || ss > 7) { - snprintf(response, response_size, "RSP NOHANDOVER 1 %u %u", ts, ss); - } else { + if (osmo_trxc_msg_params_scan(&cmd, "%u %u", &ts, &ss) == 2 && ts <= 7 && ss <= 7) { mHandover[ts][ss] = false; - snprintf(response, response_size, "RSP NOHANDOVER 0 %u %u", ts, ss); + rsp.status = 0; } - } else if (match_cmd(command, "SETMAXDLY", &params)) { + snprintf(rsp.params, sizeof(rsp.params), "%u %u", ts, ss); + } else if (!strcmp(cmd.cmd, "SETMAXDLY")) { //set expected maximum time-of-arrival for Access Bursts - int maxDelay; - sscanf(params, "%d", &maxDelay); - mMaxExpectedDelayAB = maxDelay; // 1 GSM symbol is approx. 1 km - snprintf(response, response_size, "RSP SETMAXDLY 0 %d", maxDelay); - } else if (match_cmd(command, "SETMAXDLYNB", &params)) { + int maxDelay = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &maxDelay) == 1) { + mMaxExpectedDelayAB = maxDelay; // 1 GSM symbol is approx. 1 km + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", maxDelay); + } else if (!strcmp(cmd.cmd, "SETMAXDLYNB")) { //set expected maximum time-of-arrival for Normal Bursts - int maxDelay; - sscanf(params, "%d", &maxDelay); - mMaxExpectedDelayNB = maxDelay; // 1 GSM symbol is approx. 1 km - snprintf(response, response_size, "RSP SETMAXDLYNB 0 %d", maxDelay); - } else if (match_cmd(command, "SETRXGAIN", &params)) { - int newGain; - sscanf(params, "%d", &newGain); - newGain = mRadioInterface->setRxGain(newGain, chan); - snprintf(response, response_size, "RSP SETRXGAIN 0 %d", newGain); - } else if (match_cmd(command, "NOISELEV", NULL)) { + int maxDelay = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &maxDelay) == 1) { + mMaxExpectedDelayNB = maxDelay; // 1 GSM symbol is approx. 1 km + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", maxDelay); + } else if (!strcmp(cmd.cmd, "SETRXGAIN")) { + int newGain = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &newGain) == 1) { + newGain = mRadioInterface->setRxGain(newGain, chan); + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", newGain); + } else if (!strcmp(cmd.cmd, "NOISELEV")) { if (mOn) { float lev = mStates[chan].mNoiseLev; - snprintf(response, response_size, "RSP NOISELEV 0 %d", + rsp.status = 0; + snprintf(rsp.params, sizeof(rsp.params), "%d", (int) round(20.0 * log10(rxFullScale / lev))); - } - else { - snprintf(response, response_size, "RSP NOISELEV 1 0"); - } - } else if (match_cmd(command, "SETPOWER", &params)) { - int power; - sscanf(params, "%d", &power); - power = mRadioInterface->setPowerAttenuation(power, chan); - mStates[chan].mPower = power; - snprintf(response, response_size, "RSP SETPOWER 0 %d", power); - } else if (match_cmd(command, "ADJPOWER", &params)) { - int power, step; - sscanf(params, "%d", &step); - power = mStates[chan].mPower + step; - power = mRadioInterface->setPowerAttenuation(power, chan); - mStates[chan].mPower = power; - snprintf(response, response_size, "RSP ADJPOWER 0 %d", power); - } else if (match_cmd(command, "NOMTXPOWER", NULL)) { - int power = mRadioInterface->getNominalTxPower(chan); - snprintf(response, response_size, "RSP NOMTXPOWER 0 %d", power); - } else if (match_cmd(command, "RXTUNE", &params)) { - // tune receiver - int freqKhz; - sscanf(params, "%d", &freqKhz); - mRxFreq = (freqKhz + cfg->freq_offset_khz) * 1e3; - if (!mRadioInterface->tuneRx(mRxFreq, chan)) { - LOGCHAN(chan, DTRXCTRL, FATAL) << "RX failed to tune"; - snprintf(response, response_size, "RSP RXTUNE 1 %d", freqKhz); - } - else - snprintf(response, response_size, "RSP RXTUNE 0 %d", freqKhz); - } else if (match_cmd(command, "TXTUNE", &params)) { - // tune txmtr - int freqKhz; - sscanf(params, "%d", &freqKhz); - mTxFreq = (freqKhz + cfg->freq_offset_khz) * 1e3; - if (!mRadioInterface->tuneTx(mTxFreq, chan)) { - LOGCHAN(chan, DTRXCTRL, FATAL) << "TX failed to tune"; - snprintf(response, response_size, "RSP TXTUNE 1 %d", freqKhz); - } - else - snprintf(response, response_size, "RSP TXTUNE 0 %d", freqKhz); - } else if (match_cmd(command, "SETTSC", &params)) { - // set TSC - unsigned TSC; - sscanf(params, "%u", &TSC); - if (TSC > 7) { - snprintf(response, response_size, "RSP SETTSC 1 %d", TSC); } else { + snprintf(rsp.params, sizeof(rsp.params), "0"); + } + } else if (!strcmp(cmd.cmd, "SETPOWER")) { + int power = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &power) == 1) { + power = mRadioInterface->setPowerAttenuation(power, chan); + mStates[chan].mPower = power; + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", power); + } else if (!strcmp(cmd.cmd, "ADJPOWER")) { + int power = mStates[chan].mPower, step; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &step) == 1) { + power = mStates[chan].mPower + step; + power = mRadioInterface->setPowerAttenuation(power, chan); + mStates[chan].mPower = power; + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", power); + } else if (!strcmp(cmd.cmd, "NOMTXPOWER")) { + int power = mRadioInterface->getNominalTxPower(chan); + rsp.status = 0; + snprintf(rsp.params, sizeof(rsp.params), "%d", power); + } else if (!strcmp(cmd.cmd, "RXTUNE")) { + // tune receiver + int freqKhz = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &freqKhz) == 1) { + mRxFreq = (freqKhz + cfg->freq_offset_khz) * 1e3; + if (!mRadioInterface->tuneRx(mRxFreq, chan)) + LOGCHAN(chan, DTRXCTRL, FATAL) << "RX failed to tune"; + else + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", freqKhz); + } else if (!strcmp(cmd.cmd, "TXTUNE")) { + // tune txmtr + int freqKhz = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &freqKhz) == 1) { + mTxFreq = (freqKhz + cfg->freq_offset_khz) * 1e3; + if (!mRadioInterface->tuneTx(mTxFreq, chan)) + LOGCHAN(chan, DTRXCTRL, FATAL) << "TX failed to tune"; + else + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", freqKhz); + } else if (!strcmp(cmd.cmd, "SETTSC")) { + // set TSC + unsigned TSC = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%u", &TSC) == 1 && TSC <= 7) { LOGC(DTRXCTRL, NOTICE) << "Changing TSC from " << mTSC << " to " << TSC; mTSC = TSC; - snprintf(response, response_size, "RSP SETTSC 0 %d", TSC); + rsp.status = 0; } - } else if (match_cmd(command, "SETSLOT", &params)) { + snprintf(rsp.params, sizeof(rsp.params), "%u", TSC); + } else if (!strcmp(cmd.cmd, "SETSLOT")) { // set slot type - int corrCode; - int timeslot; - sscanf(params, "%d %d", &timeslot, &corrCode); - if ((timeslot < 0) || (timeslot > 7)) { + struct osmo_trxc_setslot ss; + if (osmo_trxc_setslot_parse(&ss, &cmd) < 0) { LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus message on control interface"; - snprintf(response, response_size, "RSP SETSLOT 1 %d %d", timeslot, corrCode); - return 0; + } else if (ss.vamos) { + LOGCHAN(chan, DTRXCTRL, NOTICE) << "VAMOS channel combinations are not supported"; + } else { + mStates[chan].chanType[ss.tn] = (ChannelCombination) ss.chan_comb; + setModulus(ss.tn, chan); + rsp.status = 0; } - mStates[chan].chanType[timeslot] = (ChannelCombination) corrCode; - setModulus(timeslot, chan); - snprintf(response, response_size, "RSP SETSLOT 0 %d %d", timeslot, corrCode); - } else if (match_cmd(command, "SETFORMAT", &params)) { + snprintf(rsp.params, sizeof(rsp.params), "%s", cmd.params); + } else if (!strcmp(cmd.cmd, "SETFORMAT")) { // set TRXD protocol version - unsigned version_recv; - sscanf(params, "%u", &version_recv); + unsigned version_recv = 0; + osmo_trxc_msg_params_scan(&cmd, "%u", &version_recv); LOGCHAN(chan, DTRXCTRL, INFO) << "BTS requests TRXD version switch: " << version_recv; if (version_recv > TRX_DATA_FORMAT_VER) { LOGCHAN(chan, DTRXCTRL, INFO) << "rejecting TRXD version " << version_recv << " in favor of " << TRX_DATA_FORMAT_VER; - snprintf(response, response_size, "RSP SETFORMAT %u %u", TRX_DATA_FORMAT_VER, version_recv); + rsp.status = TRX_DATA_FORMAT_VER; } else { LOGCHAN(chan, DTRXCTRL, NOTICE) << "switching to TRXD version " << version_recv; mVersionTRXD[chan] = version_recv; - snprintf(response, response_size, "RSP SETFORMAT %u %u", version_recv, version_recv); + rsp.status = version_recv; } - } else if (match_cmd(command, "RFMUTE", &params)) { + snprintf(rsp.params, sizeof(rsp.params), "%u", version_recv); + } else if (!strcmp(cmd.cmd, "RFMUTE")) { // (Un)mute RF TX and RX - unsigned mute; - sscanf(params, "%u", &mute); - mStates[chan].mMuted = mute ? true : false; - snprintf(response, response_size, "RSP RFMUTE 0 %u", mute); - } else if (match_cmd(command, "_SETBURSTTODISKMASK", &params)) { + unsigned mute = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%u", &mute) == 1) { + mStates[chan].mMuted = mute ? true : false; + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%u", mute); + } else if (!strcmp(cmd.cmd, "_SETBURSTTODISKMASK")) { // debug command! may change or disappear without notice // set a mask which bursts to dump to disk - int mask; - sscanf(params, "%d", &mask); - mWriteBurstToDiskMask = mask; - snprintf(response, response_size, "RSP _SETBURSTTODISKMASK 0 %d", mask); + int mask = 0; + if (osmo_trxc_msg_params_scan(&cmd, "%d", &mask) == 1) { + mWriteBurstToDiskMask = mask; + rsp.status = 0; + } + snprintf(rsp.params, sizeof(rsp.params), "%d", mask); } else { - LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus command " << command << " on control interface."; - snprintf(response, response_size, "RSP ERR 1"); + LOGCHAN(chan, DTRXCTRL, NOTICE) << "bogus command " << cmd.cmd << " on control interface."; + snprintf(rsp.cmd, sizeof(rsp.cmd), "%s", OSMO_TRXC_CMD_ERR); } - LOGCHAN(chan, DTRXCTRL, INFO) << "response is '" << response << "'"; - transceiver->ctrl_sock_send(cmd_to_send, chan); + LOGCHAN(chan, DTRXCTRL, INFO) << "response is '" << osmo_trxc_msg_name(&rsp) << "'"; + + rc = osmo_trxc_msg_build(cmd_to_send.data, sizeof(cmd_to_send.data), &rsp); + if (rc < 0) { + LOGCHAN(chan, DTRXCTRL, ERROR) << "failed to build response (rc=" << rc << ")"; + return -EIO; + } + ctrl_sock_send(cmd_to_send, chan); return 0; } bool Transceiver::driveTxPriorityQueue(size_t chan) { + char buffer[OSMO_TRXD_MSG_BUF_SIZE]; int msgLen; - int burstLen; - struct trxd_hdr_v01_dl *dl; - char buffer[sizeof(*dl) + EDGE_BURST_NBITS]; - uint32_t fn; - uint8_t tn; + struct osmo_trxd_parse_state st; + struct osmo_trxd_burst_req br; + int rc; // check data socket msgLen = read(mDataSockets[chan], buffer, sizeof(buffer)); @@ -1100,48 +1108,37 @@ return false; } - switch (msgLen) { - case sizeof(*dl) + gSlotLen: /* GSM burst */ - burstLen = gSlotLen; - break; - case sizeof(*dl) + EDGE_BURST_NBITS: /* EDGE burst */ - if (cfg->tx_sps != 4) { - LOGCHAN(chan, DTRXDDL, ERROR) << "EDGE burst received but SPS is set to " << cfg->tx_sps; - return false; - } - burstLen = EDGE_BURST_NBITS; - break; - default: - LOGCHAN(chan, DTRXDDL, ERROR) << "badly formatted packet on GSM->TRX interface (len="<< msgLen << ")"; - return false; - } - - dl = (struct trxd_hdr_v01_dl *) buffer; - - /* Convert TDMA FN to the host endianness */ - fn = osmo_load32be(&dl->common.fn); - tn = dl->common.tn; - - /* Make sure we support the received header format */ - switch (dl->common.version) { - case 0: - /* Version 1 has the same format */ - case 1: - break; - default: - LOGCHAN(chan, DTRXDDL, ERROR) << "Rx TRXD message with unknown header version " << unsigned(dl->common.version); + osmo_trxd_parse_state_init(&st); + rc = osmo_trxd_burst_req_parse(&st, &br, (const uint8_t *) buffer, msgLen); + if (rc < 0) { + LOGCHAN(chan, DTRXDDL, ERROR) << "failed to parse BURST.req (rc=" << rc << ")"; return false; } - LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message (hdr_ver=" << unsigned(dl->common.version) - << "): fn=" << fn << ", tn=" << unsigned(tn) << ", burst_len=" << burstLen; + switch (br.burst_len) { + case gSlotLen: /* GSM burst */ + break; + case EDGE_BURST_NBITS: /* EDGE burst */ + if (cfg->tx_sps != 4) { + LOGCHAN(chan, DTRXDDL, ERROR) << "EDGE burst received but SPS is set to " << cfg->tx_sps; + return false; + } + break; + default: + LOGCHAN(chan, DTRXDDL, ERROR) << "badly formatted packet on GSM->TRX interface (burst_len=" + << br.burst_len << ")"; + return false; + } + + LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message: fn=" << br.fn << ", tn=" << unsigned(br.tn) + << ", burst_len=" << br.burst_len; TransceiverState *state = &mStates[chan]; - GSM::Time currTime = GSM::Time(fn, tn); + GSM::Time currTime = GSM::Time(br.fn, br.tn); /* Verify proper FN order in DL stream */ - if (state->first_dl_fn_rcv[tn]) { - int32_t delta = GSM::FNDelta(currTime.FN(), state->last_dl_time_rcv[tn].FN()); + if (state->first_dl_fn_rcv[br.tn]) { + int32_t delta = GSM::FNDelta(currTime.FN(), state->last_dl_time_rcv[br.tn].FN()); if (delta == 1) { /* usual expected scenario, continue code flow */ } else if (delta == 0) { @@ -1151,7 +1148,7 @@ return true; } else if (delta < 0) { LOGCHAN(chan, DTRXDDL, INFO) << "Rx TRXD msg with previous FN " << currTime - << " vs last " << state->last_dl_time_rcv[tn]; + << " vs last " << state->last_dl_time_rcv[br.tn]; state->ctrs.tx_trxd_fn_outoforder++; dispatch_trx_rate_ctr_change(state, chan); /* Allow adding radio vector below, since it gets sorted in the queue */ @@ -1161,25 +1158,25 @@ * setups. Also, osmo-trx supports optionally filling empty bursts on * its own. In that case bts-trx is not obliged to submit all bursts. */ LOGCHAN(chan, DTRXDDL, INFO) << "Rx TRXD msg with future FN " << currTime - << " vs last " << state->last_dl_time_rcv[tn] + << " vs last " << state->last_dl_time_rcv[br.tn] << ", " << delta - 1 << " FN lost"; state->ctrs.tx_trxd_fn_skipped += delta - 1; dispatch_trx_rate_ctr_change(state, chan); } if (delta > 0) - state->last_dl_time_rcv[tn] = currTime; + state->last_dl_time_rcv[br.tn] = currTime; } else { /* Initial check, simply store state */ - state->first_dl_fn_rcv[tn] = true; - state->last_dl_time_rcv[tn] = currTime; + state->first_dl_fn_rcv[br.tn] = true; + state->last_dl_time_rcv[br.tn] = currTime; } - BitVector newBurst(burstLen); + BitVector newBurst(br.burst_len); BitVector::iterator itr = newBurst.begin(); - uint8_t *bufferItr = dl->soft_bits; + const ubit_t *bufferItr = br.burst; while (itr < newBurst.end()) *itr++ = *bufferItr++; - addRadioVector(chan, newBurst, dl->tx_att, currTime); + addRadioVector(chan, newBurst, br.att, currTime); return true; } @@ -1203,32 +1200,36 @@ return true; } -void Transceiver::logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi) +void Transceiver::logRxBurst(size_t chan, const struct osmo_trxd_burst_ind *bi) { std::ostringstream os; - for (size_t i=0; i < bi->nbits; i++) { - if (bi->rx_burst[i] > 0.5) os << "1"; - else if (bi->rx_burst[i] > 0.25) os << "|"; - else if (bi->rx_burst[i] > 0.0) os << "'"; + for (size_t i = 0; i < bi->burst_len; i++) { + /* sbit_t polarity: <0 confident '1', 127 confident '0' (see float_soft_bit_to_sbit()) */ + if (bi->burst[i] < 0) os << "1"; + else if (bi->burst[i] < 64) os << "|"; + else if (bi->burst[i] < 127) os << "'"; else os << "-"; } double rssi_offset = rssiOffset(chan); + double noise_dbfs = 20.0 * log10(rxFullScale / mStates[chan].mNoiseLev) + rssi_offset; + double rssi_dbfs = -bi->rssi - rssi_offset; LOGCHAN(chan, DTRXDUL, DEBUG) << std::fixed << std::right << " time: " << unsigned(bi->tn) << ":" << bi->fn - << " RSSI: " << std::setw(5) << std::setprecision(1) << (bi->rssi - rssi_offset) - << "dBFS/" << std::setw(6) << -bi->rssi << "dBm" - << " noise: " << std::setw(5) << std::setprecision(1) << (bi->noise - rssi_offset) - << "dBFS/" << std::setw(6) << -bi->noise << "dBm" - << " TOA: " << std::setw(5) << std::setprecision(2) << bi->toa - << " C/I: " << std::setw(5) << std::setprecision(2) << bi->ci << "dB" + << " RSSI: " << std::setw(5) << std::setprecision(1) << rssi_dbfs + << "dBFS/" << std::setw(6) << int(bi->rssi) << "dBm" + << " noise: " << std::setw(5) << std::setprecision(1) << (noise_dbfs - rssi_offset) + << "dBFS/" << std::setw(6) << -noise_dbfs << "dBm" + << " TOA: " << std::setw(5) << std::setprecision(2) << (bi->toa256 / 256.0) + << " C/I: " << std::setw(5) << std::setprecision(2) << (bi->ci_cb / 10.0) << "dB" << " bits: " << os; } bool Transceiver::driveReceiveFIFO(size_t chan) { - struct trx_ul_burst_ind bi; + struct osmo_trxd_burst_ind bi; + struct msgb *msg; int rc; if ((rc = pullRadioVector(chan, &bi)) < 0) { @@ -1239,17 +1240,26 @@ return false; /* other errors: we want to stop the process */ } - if (!bi.idle && log_check_level(DTRXDUL, LOGL_DEBUG)) + if (!(bi.flags & OSMO_TRXD_F_NOPE_IND) && log_check_level(DTRXDUL, LOGL_DEBUG)) logRxBurst(chan, &bi); - switch (mVersionTRXD[chan]) { - case 0: - return trxd_send_burst_ind_v0(chan, mDataSockets[chan], &bi); - case 1: - return trxd_send_burst_ind_v1(chan, mDataSockets[chan], &bi); - default: - OSMO_ASSERT(false); + msg = mBurstIndMsg[chan]; + rc = osmo_trxd_burst_ind_build(msg, mVersionTRXD[chan], &bi); + if (rc < 0) { + LOGCHAN(chan, DTRXDUL, ERROR) << "failed to build BURST.ind (rc=" << rc << ")"; + msgb_trim(msg, 0); + return false; } + osmo_trxd_build_fin(msg, mVersionTRXD[chan]); + + rc = write(mDataSockets[chan], msgb_data(msg), msgb_length(msg)); + msgb_trim(msg, 0); + if (rc < 0) { + LOGCHAN(chan, DTRXDUL, NOTICE) << "mDataSockets write(" << mDataSockets[chan] << ") failed: " << rc; + return false; + } + + return true; } void Transceiver::driveTxFIFO() @@ -1310,16 +1320,22 @@ bool Transceiver::writeClockInterface() { - int msgLen; char command[50]; + int rc; // FIXME -- This should be adaptive. - sprintf(command,"IND CLOCK %llu",(unsigned long long) (mTransmitDeadlineClock.FN()+2)); + uint32_t fn = mTransmitDeadlineClock.FN() + 2; + + rc = osmo_trxc_clock_ind_build(command, sizeof(command), fn); + if (rc < 0) { + LOGC(DTRXCLK, ERROR) << "failed to build IND CLOCK " << fn; + return false; + } LOGC(DTRXCLK, INFO) << "sending " << command; - msgLen = write(mClockSocket, command, strlen(command) + 1); - if (msgLen <= 0) { - LOGC(DTRXCLK, ERROR) << "mClockSocket write(" << mClockSocket << ") failed: " << msgLen; + rc = write(mClockSocket, command, strlen(command) + 1); + if (rc <= 0) { + LOGC(DTRXCLK, ERROR) << "mClockSocket write(" << mClockSocket << ") failed: " << rc; return false; } diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index babe420..53b887e 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -34,6 +34,8 @@ extern "C" { #include <osmocom/core/signal.h> #include <osmocom/core/select.h> +#include <osmocom/trx/trxc.h> +#include <osmocom/trx/trxd.h> #include "config_defs.h" } @@ -41,6 +43,9 @@ extern Transceiver *transceiver; +/* The latest TRXD header format version advertised/accepted by this TRX implementation */ +#define TRX_DATA_FORMAT_VER 1 + /** Channel descriptor for transceiver object and channel number pair */ struct TrxChanThParams { Transceiver *trx; @@ -150,7 +155,7 @@ private: size_t mChans; struct ctrl_msg { - char data[101]; + char data[OSMO_TRXC_MSG_BUF_SIZE]; ctrl_msg() {}; }; @@ -202,7 +207,7 @@ void pushRadioVector(GSM::Time &nowTime); /** Pull and demodulate a burst from the receive FIFO */ - int pullRadioVector(size_t chan, struct trx_ul_burst_ind *ind); + int pullRadioVector(size_t chan, struct osmo_trxd_burst_ind *ind); /** Set modulus for specific timeslot */ void setModulus(size_t timeslot, size_t chan); @@ -233,6 +238,11 @@ std::vector<unsigned> mVersionTRXD; ///< Format version to use for TRXD protocol communication, per channel std::vector<TransceiverState> mStates; + /* Per-channel BURST.ind scratch buffer (driveReceiveFIFO()): allocated + * once in the constructor, then reused (trimmed, not freed) for every + * burst to avoid an alloc/free pair on the Rx hot path. */ + std::vector<struct msgb *> mBurstIndMsg; + /** Start and stop I/O threads through the control socket API */ bool start(); void stop(); @@ -264,7 +274,7 @@ double rssiOffset(size_t chan); void reset(); - void logRxBurst(size_t chan, const struct trx_ul_burst_ind *bi); + void logRxBurst(size_t chan, const struct osmo_trxd_burst_ind *bi); }; void *RxUpperLoopAdapter(TrxChanThParams *params); diff --git a/Transceiver52M/proto_trxd.c b/Transceiver52M/proto_trxd.c deleted file mode 100644 index 418daa6..0000000 --- a/Transceiver52M/proto_trxd.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2019 sysmocom - s.f.m.c. GmbH - * All Rights Reserved - * - * SPDX-License-Identifier: AGPL-3.0+ - * - * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> - * - * 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/>. - * See the COPYING file in the main directory for details. - */ - -#include "proto_trxd.h" - -#include <osmocom/core/bits.h> - -static void trxd_fill_common(struct trxd_hdr_common *common, const struct trx_ul_burst_ind *bi, uint8_t version) -{ - common->version = version & 0b1111; - common->reserved = 0; - common->tn = bi->tn; - osmo_store32be(bi->fn, &common->fn); -} - -static void trxd_fill_v0_specific(struct trxd_hdr_v0_specific *v0, const struct trx_ul_burst_ind *bi) -{ - int toa_int; - - /* in 1/256 symbols, round to closest integer */ - toa_int = (int) lround(bi->toa * 256.0); - v0->rssi = (uint8_t) lround(bi->rssi); - osmo_store16be(toa_int, &v0->toa); -} - -static void trxd_fill_v1_specific(struct trxd_hdr_v1_specific *v1, const struct trx_ul_burst_ind *bi) -{ - int16_t ci_int_cB; - - /* deciBels->centiBels, round to closest integer */ - ci_int_cB = (int16_t) lround(bi->ci * 10.0); - - v1->idle = !!bi->idle; - v1->modulation = (bi->modulation == MODULATION_GMSK) ? - TRXD_MODULATION_GMSK(bi->tss) : - TRXD_MODULATION_8PSK(bi->tss); - v1->tsc = bi->tsc; - osmo_store16be(ci_int_cB, &v1->ci); -} - -static void trxd_fill_burst_normalized255(uint8_t* soft_bits, const struct trx_ul_burst_ind *bi) -{ - unsigned i; - for (i = 0; i < bi->nbits; i++) - soft_bits[i] = (uint8_t) round(bi->rx_burst[i] * 255.0); -} - -bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *bi) { - int rc; - - /* v0 doesn't support idle frames, they are simply dropped, not sent */ - if (bi->idle) - return true; - - /* +2: Historically (OpenBTS times), two extra non-used bytes are sent appended to each burst */ - char buf[sizeof(struct trxd_hdr_v0) + bi->nbits + 2]; - struct trxd_hdr_v0* pkt = (struct trxd_hdr_v0*)buf; - - trxd_fill_common(&pkt->common, bi, 0); - trxd_fill_v0_specific(&pkt->v0, bi); - trxd_fill_burst_normalized255(&pkt->soft_bits[0], bi); - - /* +1: Historical reason. There's an uninitizalied byte in there: pkt->soft_bits[bi->nbits] */ - pkt->soft_bits[bi->nbits + 1] = '\0'; - - rc = write(fd, buf, sizeof(struct trxd_hdr_v0) + bi->nbits + 2); - if (rc <= 0) { - CLOGCHAN(chan, DMAIN, LOGL_NOTICE, "mDataSockets write(%d) failed: %d\n", fd, rc); - return false; - } - return true; -} - -bool trxd_send_burst_ind_v1(size_t chan, int fd, const struct trx_ul_burst_ind *bi) { - int rc; - size_t buf_len; - - buf_len = sizeof(struct trxd_hdr_v1); - if (!bi->idle) - buf_len += bi->nbits; - char buf[buf_len]; - - struct trxd_hdr_v1* pkt = (struct trxd_hdr_v1*)buf; - trxd_fill_common(&pkt->common, bi, 1); - trxd_fill_v0_specific(&pkt->v0, bi); - trxd_fill_v1_specific(&pkt->v1, bi); - - if (!bi->idle) - trxd_fill_burst_normalized255(&pkt->soft_bits[0], bi); - - rc = write(fd, buf, buf_len); - if (rc <= 0) { - CLOGCHAN(chan, DMAIN, LOGL_NOTICE, "mDataSockets write(%d) failed: %d\n", fd, rc); - return false; - } - return true; -} diff --git a/Transceiver52M/proto_trxd.h b/Transceiver52M/proto_trxd.h deleted file mode 100644 index c250a74..0000000 --- a/Transceiver52M/proto_trxd.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include <stdint.h> -#include <stdbool.h> -#include <unistd.h> -#include <math.h> - -#include <osmocom/core/endian.h> - -#include "debug.h" - -#define MAX_RX_BURST_BUF_SIZE 444 /* 444 = EDGE_BURST_NBITS */ - -enum Modulation { - MODULATION_GMSK, - MODULATION_8PSK, -/* Not supported yet: - MODULATION_AQPSK, - MODULATION_16QAM, - MODULATION_32QAM -*/ -}; - -struct trx_ul_burst_ind { - float rx_burst[MAX_RX_BURST_BUF_SIZE]; /* soft bits normalized 0..1 */ - unsigned nbits; // number of symbols per slot in rxBurst, not counting guard periods - uint32_t fn; // TDMA frame number - uint8_t tn; // TDMA time-slot number - double rssi; // in dBFS - double toa; // in symbols - double noise; // noise level in dBFS - bool idle; // true if no valid burst is included - enum Modulation modulation; // modulation type - uint8_t tss; // training sequence set - uint8_t tsc; // training sequence code - float ci; // Carrier-to-Interference ratio, in dB -}; - -bool trxd_send_burst_ind_v0(size_t chan, int fd, const struct trx_ul_burst_ind *bi); -bool trxd_send_burst_ind_v1(size_t chan, int fd, const struct trx_ul_burst_ind *bi); - -/* The latest supported TRXD header format version */ -#define TRX_DATA_FORMAT_VER 1 - -struct trxd_hdr_common { -#if OSMO_IS_LITTLE_ENDIAN - uint8_t tn:3, - reserved:1, - version:4; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t version:4, reserved:1, tn:3; -#endif - uint32_t fn; /* big endian */ -} __attribute__ ((packed)); - -struct trxd_hdr_v0_specific { - uint8_t rssi; - uint16_t toa; /* big endian */ -} __attribute__ ((packed)); - -struct trxd_hdr_v0 { - struct trxd_hdr_common common; - struct trxd_hdr_v0_specific v0; - uint8_t soft_bits[0]; -} __attribute__ ((packed)); - -/* Downlink burst (BTS->TRX), v0 anf v1 use same format */ -struct trxd_hdr_v01_dl { - struct trxd_hdr_common common; - uint8_t tx_att; /* Tx Attentuation */ - uint8_t soft_bits[0]; -} __attribute__ ((packed)); - - -#define TRXD_MODULATION_GMSK(ts_set) (0b0000 | (ts_set & 0b0011)) -#define TRXD_MODULATION_8PSK(ts_set) (0b0100 | (ts_set & 0b0001)) -#define TRXD_MODULATION_AQPSK(ts_set) (0b0110 | (ts_set & 0b0001)) -#define TRXD_MODULATION_16QAM(ts_set) (0b1000 | (ts_set & 0b0001)) -#define TRXD_MODULATION_32QAM(ts_set) (0b1010 | (ts_set & 0b0001)) - -struct trxd_hdr_v1_specific { -#if OSMO_IS_LITTLE_ENDIAN - uint8_t tsc:3, - modulation:4, - idle:1; -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t idle:1, modulation:4, tsc:3; -#endif - int16_t ci; /* big endian, in centiBels */ -} __attribute__ ((packed)); - -struct trxd_hdr_v1 { - struct trxd_hdr_common common; - struct trxd_hdr_v0_specific v0; - struct trxd_hdr_v1_specific v1; - uint8_t soft_bits[0]; -} __attribute__ ((packed)); diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp index 5fac365..c3483d7 100644 --- a/Transceiver52M/sigProcLib.cpp +++ b/Transceiver52M/sigProcLib.cpp @@ -542,19 +542,6 @@ return pulse; } -/* Convert -1..+1 soft bits to 0..1 soft bits */ -void vectorSlicer(float *dest, const float *src, size_t len) -{ - size_t i; - for (i = 0; i < len; i++) { - dest[i] = 0.5 * (src[i] + 1.0f); - if (dest[i] > 1.0) - dest[i] = 1.0; - else if (dest[i] < 0.0) - dest[i] = 0.0; - } -} - static signalVector *rotateBurst(const BitVector &wBurst, int guardPeriodLength, int sps) { diff --git a/Transceiver52M/sigProcLib.h b/Transceiver52M/sigProcLib.h index 39c8ddd..97da08e 100644 --- a/Transceiver52M/sigProcLib.h +++ b/Transceiver52M/sigProcLib.h @@ -59,9 +59,6 @@ /** Destroy the signal processing library */ void sigProcLibDestroy(void); -/** Operate soft slicer on a soft-bit vector */ -void vectorSlicer(float *dest, const float *src, size_t len); - /** GMSK modulate a GSM burst of bits */ signalVector *modulateBurst(const BitVector &wBurst, int guardPeriodLength, -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43115?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I458ec85c56e2101d073c8c35f11c147191c4ea0c Gerrit-Change-Number: 43115 Gerrit-PatchSet: 11 Gerrit-Owner: fixeria <vyanitskiy(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-CC: Hoernchen <ewild(a)sysmocom.de> Gerrit-CC: tnt <tnt(a)246tNt.com>
1 0
0 0
[M] Change in osmo-trx[master]: Transceiver52M: implement TRXDv2 support
by fixeria 17 Sep '26

17 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43116?usp=email ) ( 9 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transceiver52M: implement TRXDv2 support ...................................................................... Transceiver52M: implement TRXDv2 support TRXDv2 was proposed and implemented in osmo-bts a while ago, but osmo-trx was still stuck at TRXDv1. This patch implements TRXDv2 and UL/DL burst batching using libosmo-trx API. DL: driveTxPriorityQueue() now loops over osmo_trxd_burst_req_parse() to handle datagrams potentially containing multiple batched BURST.req, dispatching each via the new handleBurstReq(). UL: accumulate BURST.ind PDUs for the same FN into one msgb per channel and flush as a single datagram once the next frame's PDU arrives or the channel stops; TRXDv0/v1 channels keep sending one PDU per datagram via sendBurstInd(). Batching is unconditional for now; making it configurable is left as a follow-up. Change-Id: Ie6a33e3980b3ca4ab05a3d4221d5a8ba0132233d Related: OS#5283 --- M Transceiver52M/Transceiver.cpp M Transceiver52M/Transceiver.h 2 files changed, 173 insertions(+), 56 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 9dc26a4..9405650 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -57,6 +57,13 @@ /* Number of running values use in noise average */ #define NOISE_CNT 20 +/* Worst-case size of a batched TRXDv2 datagram (either direction): up to 8 + * timeslots per frame, each sized as generously as a lone PDU + * (OSMO_TRXD_MSG_BUF_SIZE already covers header + max burst payload for one + * PDU; PDUs after the first omit the 4-byte FN, so this is a safe + * over-estimate, not a tight bound). */ +#define TRX_TRXD_BATCH_BUF_SIZE (8 * OSMO_TRXD_MSG_BUF_SIZE) + static void dispatch_trx_rate_ctr_change(TransceiverState *state, unsigned int chan) { thread_enable_cancel(false); @@ -146,7 +153,7 @@ mTxPriorityQueueServiceLoopThreads(mChans), mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface), mOn(false),mForceClockInterface(false), mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0), mWriteBurstToDiskMask(0), mVersionTRXD(mChans), mStates(mChans), - mBurstIndMsg(mChans) + mBurstIndMsg(mChans), mBurstIndBatchFn(mChans) { txFullScale = mRadioInterface->fullScaleInputValue(); rxFullScale = mRadioInterface->fullScaleOutputValue(); @@ -156,8 +163,10 @@ mHandover[i][j] = false; } + /* Sized for the batched (TRXDv2) case, the larger of the two users of + * this buffer; also plenty for the single-PDU (TRXDv0/v1) case. */ for (size_t i = 0; i < mChans; i++) { - mBurstIndMsg[i] = msgb_alloc(OSMO_TRXD_MSG_BUF_SIZE, "trxd_burst_ind"); + mBurstIndMsg[i] = msgb_alloc(TRX_TRXD_BATCH_BUF_SIZE, "trxd_burst_ind"); OSMO_ASSERT(mBurstIndMsg[i] != NULL); } } @@ -374,6 +383,9 @@ delete mRxServiceLoopThreads[i]; delete mTxPriorityQueueServiceLoopThreads[i]; + /* Rx thread is joined, so no concurrent access to the batch anymore */ + flushBurstIndBatch(i); + mTxPriorityQueues[i].clear(); } @@ -1093,29 +1105,9 @@ return 0; } -bool Transceiver::driveTxPriorityQueue(size_t chan) +bool Transceiver::handleBurstReq(size_t chan, const struct osmo_trxd_burst_req *br) { - char buffer[OSMO_TRXD_MSG_BUF_SIZE]; - int msgLen; - struct osmo_trxd_parse_state st; - struct osmo_trxd_burst_req br; - int rc; - - // check data socket - msgLen = read(mDataSockets[chan], buffer, sizeof(buffer)); - if (msgLen <= 0) { - LOGCHAN(chan, DTRXDDL, NOTICE) << "mDataSockets read(" << mDataSockets[chan] << ") failed: " << msgLen; - return false; - } - - osmo_trxd_parse_state_init(&st); - rc = osmo_trxd_burst_req_parse(&st, &br, (const uint8_t *) buffer, msgLen); - if (rc < 0) { - LOGCHAN(chan, DTRXDDL, ERROR) << "failed to parse BURST.req (rc=" << rc << ")"; - return false; - } - - switch (br.burst_len) { + switch (br->burst_len) { case gSlotLen: /* GSM burst */ break; case EDGE_BURST_NBITS: /* EDGE burst */ @@ -1126,19 +1118,19 @@ break; default: LOGCHAN(chan, DTRXDDL, ERROR) << "badly formatted packet on GSM->TRX interface (burst_len=" - << br.burst_len << ")"; + << br->burst_len << ")"; return false; } - LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message: fn=" << br.fn << ", tn=" << unsigned(br.tn) - << ", burst_len=" << br.burst_len; + LOGCHAN(chan, DTRXDDL, DEBUG) << "Rx TRXD message: fn=" << br->fn << ", tn=" << unsigned(br->tn) + << ", burst_len=" << br->burst_len; TransceiverState *state = &mStates[chan]; - GSM::Time currTime = GSM::Time(br.fn, br.tn); + GSM::Time currTime = GSM::Time(br->fn, br->tn); /* Verify proper FN order in DL stream */ - if (state->first_dl_fn_rcv[br.tn]) { - int32_t delta = GSM::FNDelta(currTime.FN(), state->last_dl_time_rcv[br.tn].FN()); + if (state->first_dl_fn_rcv[br->tn]) { + int32_t delta = GSM::FNDelta(currTime.FN(), state->last_dl_time_rcv[br->tn].FN()); if (delta == 1) { /* usual expected scenario, continue code flow */ } else if (delta == 0) { @@ -1148,7 +1140,7 @@ return true; } else if (delta < 0) { LOGCHAN(chan, DTRXDDL, INFO) << "Rx TRXD msg with previous FN " << currTime - << " vs last " << state->last_dl_time_rcv[br.tn]; + << " vs last " << state->last_dl_time_rcv[br->tn]; state->ctrs.tx_trxd_fn_outoforder++; dispatch_trx_rate_ctr_change(state, chan); /* Allow adding radio vector below, since it gets sorted in the queue */ @@ -1158,25 +1150,69 @@ * setups. Also, osmo-trx supports optionally filling empty bursts on * its own. In that case bts-trx is not obliged to submit all bursts. */ LOGCHAN(chan, DTRXDDL, INFO) << "Rx TRXD msg with future FN " << currTime - << " vs last " << state->last_dl_time_rcv[br.tn] + << " vs last " << state->last_dl_time_rcv[br->tn] << ", " << delta - 1 << " FN lost"; state->ctrs.tx_trxd_fn_skipped += delta - 1; dispatch_trx_rate_ctr_change(state, chan); } if (delta > 0) - state->last_dl_time_rcv[br.tn] = currTime; + state->last_dl_time_rcv[br->tn] = currTime; } else { /* Initial check, simply store state */ - state->first_dl_fn_rcv[br.tn] = true; - state->last_dl_time_rcv[br.tn] = currTime; + state->first_dl_fn_rcv[br->tn] = true; + state->last_dl_time_rcv[br->tn] = currTime; } - BitVector newBurst(br.burst_len); + BitVector newBurst(br->burst_len); BitVector::iterator itr = newBurst.begin(); - const ubit_t *bufferItr = br.burst; + const ubit_t *bufferItr = br->burst; while (itr < newBurst.end()) *itr++ = *bufferItr++; - addRadioVector(chan, newBurst, br.att, currTime); + addRadioVector(chan, newBurst, br->att, currTime); + + return true; +} + +bool Transceiver::driveTxPriorityQueue(size_t chan) +{ + char buffer[TRX_TRXD_BATCH_BUF_SIZE]; + int msgLen; + struct osmo_trxd_parse_state st; + struct osmo_trxd_burst_req br; + const uint8_t *pos; + size_t remain; + int rc; + + // check data socket + msgLen = read(mDataSockets[chan], buffer, sizeof(buffer)); + if (msgLen <= 0) { + LOGCHAN(chan, DTRXDDL, NOTICE) << "mDataSockets read(" << mDataSockets[chan] << ") failed: " << msgLen; + return false; + } + + /* Normally a single PDU per datagram (TRXDv0/v1, or unbatched TRXDv2), + * but the BTS side may also send us a TRXDv2 batch (multiple PDUs for + * the same FN, one per timeslot): keep parsing while BATCH.ind is set. */ + osmo_trxd_parse_state_init(&st); + pos = (const uint8_t *) buffer; + remain = (size_t) msgLen; + + do { + rc = osmo_trxd_burst_req_parse(&st, &br, pos, remain); + /* rc == 0 shouldn't happen (a parsed PDU is never empty), but treat it + * as an error too: rc <= 0 here would leave pos/remain stuck, spinning + * this loop forever on a re-parse of the exact same input. */ + if (rc <= 0) { + LOGCHAN(chan, DTRXDDL, ERROR) << "failed to parse BURST.req (rc=" << rc << ")"; + return false; + } + + if (!handleBurstReq(chan, &br)) + return false; + + pos += rc; + remain -= rc; + } while (br.flags & OSMO_TRXD_F_BATCH_IND); return true; } @@ -1226,25 +1262,14 @@ << " bits: " << os; } -bool Transceiver::driveReceiveFIFO(size_t chan) + +bool Transceiver::sendBurstInd(size_t chan, const struct osmo_trxd_burst_ind *bi) { - struct osmo_trxd_burst_ind bi; struct msgb *msg; int rc; - if ((rc = pullRadioVector(chan, &bi)) < 0) { - if (rc == -ENOENT) { /* timeslot off, continue processing */ - LOGCHAN(chan, DTRXDUL, DEBUG) << unsigned(bi.tn) << ":" << bi.fn << " timeslot is off"; - return true; - } - return false; /* other errors: we want to stop the process */ - } - - if (!(bi.flags & OSMO_TRXD_F_NOPE_IND) && log_check_level(DTRXDUL, LOGL_DEBUG)) - logRxBurst(chan, &bi); - msg = mBurstIndMsg[chan]; - rc = osmo_trxd_burst_ind_build(msg, mVersionTRXD[chan], &bi); + rc = osmo_trxd_burst_ind_build(msg, mVersionTRXD[chan], bi); if (rc < 0) { LOGCHAN(chan, DTRXDUL, ERROR) << "failed to build BURST.ind (rc=" << rc << ")"; msgb_trim(msg, 0); @@ -1262,6 +1287,74 @@ return true; } +bool Transceiver::flushBurstIndBatch(size_t chan) +{ + struct msgb *msg = mBurstIndMsg[chan]; + int rc; + + if (msgb_length(msg) == 0) + return true; /* nothing accumulated */ + + osmo_trxd_build_fin(msg, mVersionTRXD[chan]); + + rc = write(mDataSockets[chan], msgb_data(msg), msgb_length(msg)); + msgb_trim(msg, 0); + if (rc < 0) { + LOGCHAN(chan, DTRXDUL, NOTICE) << "mDataSockets write(" << mDataSockets[chan] << ") failed: " << rc; + return false; + } + + return true; +} + +bool Transceiver::queueBurstIndBatched(size_t chan, const struct osmo_trxd_burst_ind *bi) +{ + struct msgb *msg = mBurstIndMsg[chan]; + int rc; + + if (msgb_length(msg) > 0 && mBurstIndBatchFn[chan] != bi->fn) { + /* previous frame's batch is complete (a PDU for a new FN showed up) */ + if (!flushBurstIndBatch(chan)) + return false; + } + + if (msgb_length(msg) == 0) + mBurstIndBatchFn[chan] = bi->fn; + + rc = osmo_trxd_burst_ind_build(msg, mVersionTRXD[chan], bi); + if (rc < 0) { + LOGCHAN(chan, DTRXDUL, ERROR) << "failed to build batched BURST.ind (rc=" << rc << ")"; + msgb_trim(msg, 0); + return false; + } + + return true; +} + +bool Transceiver::driveReceiveFIFO(size_t chan) +{ + struct osmo_trxd_burst_ind bi; + int rc; + + if ((rc = pullRadioVector(chan, &bi)) < 0) { + if (rc == -ENOENT) { /* timeslot off, continue processing */ + LOGCHAN(chan, DTRXDUL, DEBUG) << unsigned(bi.tn) << ":" << bi.fn << " timeslot is off"; + return true; + } + return false; /* other errors: we want to stop the process */ + } + + if (!(bi.flags & OSMO_TRXD_F_NOPE_IND) && log_check_level(DTRXDUL, LOGL_DEBUG)) + logRxBurst(chan, &bi); + + /* TODO: make batching configurable via VTY, so it can be disabled even + * when TRXDv2 is negotiated (e.g. to trade datagram count for latency) */ + if (mVersionTRXD[chan] < 2) + return sendBurstInd(chan, &bi); + + return queueBurstIndBatched(chan, &bi); +} + void Transceiver::driveTxFIFO() { diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 53b887e..5c10855 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -44,7 +44,7 @@ extern Transceiver *transceiver; /* The latest TRXD header format version advertised/accepted by this TRX implementation */ -#define TRX_DATA_FORMAT_VER 1 +#define TRX_DATA_FORMAT_VER 2 /** Channel descriptor for transceiver object and channel number pair */ struct TrxChanThParams { @@ -209,6 +209,19 @@ /** Pull and demodulate a burst from the receive FIFO */ int pullRadioVector(size_t chan, struct osmo_trxd_burst_ind *ind); + /** Send one BURST.ind PDU as its own datagram (TRXDv0/v1) */ + bool sendBurstInd(size_t chan, const struct osmo_trxd_burst_ind *bi); + + /** Append one BURST.ind PDU to the per-channel TRXDv2 batch, flushing the + * previous frame's batch first if this PDU belongs to a new frame */ + bool queueBurstIndBatched(size_t chan, const struct osmo_trxd_burst_ind *bi); + + /** Write out and reset the accumulated TRXDv2 batch for a channel, if any */ + bool flushBurstIndBatch(size_t chan); + + /** Handle one parsed BURST.req PDU (one out of a batch, or a lone one) */ + bool handleBurstReq(size_t chan, const struct osmo_trxd_burst_req *br); + /** Set modulus for specific timeslot */ void setModulus(size_t timeslot, size_t chan); @@ -238,10 +251,21 @@ std::vector<unsigned> mVersionTRXD; ///< Format version to use for TRXD protocol communication, per channel std::vector<TransceiverState> mStates; - /* Per-channel BURST.ind scratch buffer (driveReceiveFIFO()): allocated - * once in the constructor, then reused (trimmed, not freed) for every - * burst to avoid an alloc/free pair on the Rx hot path. */ + /* Per-channel BURST.ind Tx scratch buffer (sendBurstInd(), + * queueBurstIndBatched()/flushBurstIndBatch()): allocated once in the + * constructor, then reused (trimmed, not freed) for every burst to avoid + * an alloc/free pair on the Rx hot path. + * + * Doubles as the TRXDv2 uplink PDU batching accumulator (see + * osmo-gsm-manuals trx_if.adoc, combination "b"): all BURST.ind PDUs for + * one TDMA frame on a given channel are accumulated into a single + * datagram, flushed once the next frame's PDU arrives (i.e. keyed off a + * change in FN, not off tn==7, since not every timeslot is necessarily + * active). Batching across channels (TRXN) is not supported. A channel + * only ever exercises one of the two usages, decided once by the + * negotiated TRXD version (mVersionTRXD), so the two never conflict. */ std::vector<struct msgb *> mBurstIndMsg; + std::vector<uint32_t> mBurstIndBatchFn; /** Start and stop I/O threads through the control socket API */ bool start(); -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43116?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: Ie6a33e3980b3ca4ab05a3d4221d5a8ba0132233d Gerrit-Change-Number: 43116 Gerrit-PatchSet: 11 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
[S] Change in osmo-trx[master]: Transceiver52M: make TRXDv2 burst batching configurable
by fixeria 17 Sep '26

17 Sep '26
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/43117?usp=email ) ( 9 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transceiver52M: make TRXDv2 burst batching configurable ...................................................................... Transceiver52M: make TRXDv2 burst batching configurable Add a "trxd-pdu-batch (disable|enable)" VTY command under the TRX node (default: enable) to allow disabling per-frame BURST.ind batching even when TRXDv2 is negotiated, e.g. to trade datagram count for latency. Change-Id: I2f58f87d85de5254bae6d7a606dffcd0ad4069d5 Related: OS#5283 --- M CommonLibs/config_defs.h M CommonLibs/trx_vty.c M Transceiver52M/Transceiver.cpp 3 files changed, 21 insertions(+), 3 deletions(-) Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve diff --git a/CommonLibs/config_defs.h b/CommonLibs/config_defs.h index 3b21fcb..5a83688 100644 --- a/CommonLibs/config_defs.h +++ b/CommonLibs/config_defs.h @@ -69,4 +69,5 @@ } overrides; bool use_va; bool usrp1_singledb; + bool trxd_batch; /* Batch BURST.ind PDUs per TDMA frame when TRXDv2 is negotiated? */ }; diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c index 47ac90b..783d5b2 100644 --- a/CommonLibs/trx_vty.c +++ b/CommonLibs/trx_vty.c @@ -645,6 +645,19 @@ return CMD_SUCCESS; } +DEFUN(cfg_trxd_pdu_batch, cfg_trxd_pdu_batch_cmd, + "trxd-pdu-batch (disable|enable)", + "BURST.ind PDU batching (TRXDv2 and higher, default=enable)\n" + "Send one BURST.ind datagram per burst\n" + "Batch all BURST.ind PDUs of a TDMA frame into one datagram\n") +{ + struct trx_ctx *trx = trx_from_vty(vty); + + trx->cfg.trxd_batch = (strcmp(argv[0], "enable") == 0); + + return CMD_SUCCESS; +} + DEFUN(cfg_chan_rx_path, cfg_chan_rx_path_cmd, "rx-path NAME", "Set the Rx Path\n" @@ -742,6 +755,8 @@ vty_out(vty, " viterbi-eq %s%s", trx->cfg.use_va ? "enable" : "disable", VTY_NEWLINE); if (trx->cfg.usrp1_singledb) vty_out(vty, " usrp1-singledb %s%s", trx->cfg.usrp1_singledb ? "enable" : "disable", VTY_NEWLINE); + if (!trx->cfg.trxd_batch) + vty_out(vty, " trxd-pdu-batch disable%s", VTY_NEWLINE); trx_rate_ctr_threshold_write_config(vty, " "); for (i = 0; i < trx->cfg.num_chans; i++) { @@ -781,6 +796,7 @@ trx->cfg.sched_rr ? "Enabled" : "Disabled", VTY_NEWLINE); vty_out(vty, " Stack size per Thread in BYTE (0 = OS default): %u%s", trx->cfg.stack_size, VTY_NEWLINE); vty_out(vty, " Single daughterboard (for USRP1): %s%s", trx->cfg.usrp1_singledb ? "Enabled" : "Disabled", VTY_NEWLINE); + vty_out(vty, " TRXDv2 BURST.ind batching: %s%s", trx->cfg.trxd_batch ? "Enabled" : "Disabled", VTY_NEWLINE); vty_out(vty, " Channels: %u%s", trx->cfg.num_chans, VTY_NEWLINE); for (i = 0; i < trx->cfg.num_chans; i++) { chan = &trx->cfg.chans[i]; @@ -854,6 +870,7 @@ trx->cfg.filler = FILLER_ZERO; trx->cfg.rssi_offset = 0.0f; trx->cfg.dev_args = talloc_strdup(trx, ""); + trx->cfg.trxd_batch = true; return trx; } @@ -894,6 +911,7 @@ install_element(TRX_NODE, &cfg_no_ctr_error_threshold_cmd); install_element(TRX_NODE, &cfg_stack_size_cmd); install_element(TRX_NODE, &cfg_usrp1_singledb_cmd); + install_element(TRX_NODE, &cfg_trxd_pdu_batch_cmd); install_element(TRX_NODE, &cfg_chan_cmd); install_element(TRX_NODE, &cfg_ul_fn_offset_cmd); diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 9405650..865b122 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -1347,9 +1347,8 @@ if (!(bi.flags & OSMO_TRXD_F_NOPE_IND) && log_check_level(DTRXDUL, LOGL_DEBUG)) logRxBurst(chan, &bi); - /* TODO: make batching configurable via VTY, so it can be disabled even - * when TRXDv2 is negotiated (e.g. to trade datagram count for latency) */ - if (mVersionTRXD[chan] < 2) + /* batching is a TRXDv2 feature, and can also be disabled via VTY */ + if (mVersionTRXD[chan] < 2 || !cfg->trxd_batch) return sendBurstInd(chan, &bi); return queueBurstIndBatched(chan, &bi); -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/43117?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I2f58f87d85de5254bae6d7a606dffcd0ad4069d5 Gerrit-Change-Number: 43117 Gerrit-PatchSet: 11 Gerrit-Owner: fixeria <vyanitskiy(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>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • ...
  • 190
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.