Build failure of network:osmocom:nightly/osmo-mgw in Debian_8.0/x86_64
Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-mgw/Debian_8.0/x86_64 Package network:osmocom:nightly/osmo-mgw failed to build in Debian_8.0/x86_64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-mgw Last lines of build log: [ 37s] update-alternatives: using /usr/sbin/rmt-tar to provide /usr/sbin/rmt (rmt) in auto mode [ 37s] [102/186] installing coreutils-8.23-4 [ 38s] [103/186] installing libcloog-isl4-0.18.2-1+b2 [ 38s] Processing triggers for libc-bin (2.19-18) ... [ 38s] [104/186] installing libmpc3-1.0.2-1 [ 38s] Processing triggers for libc-bin (2.19-18) ... [ 38s] [105/186] installing libosmonetif4-0.1.1.20180311 [ 38s] Processing triggers for libc-bin (2.19-18) ... [ 38s] [106/186] installing libosmovty4-0.10.2.20180311 [ 38s] Processing triggers for libc-bin (2.19-18) ... [ 38s] [107/186] installing libsystemd0-215-17 [ 39s] Processing triggers for libc-bin (2.19-18) ... [ 39s] [108/186] installing libdevmapper1.02.1-2:1.02.90-2.2 [ 39s] dpkg: libdevmapper1.02.1:amd64: dependency problems, but configuring anyway as you requested: [ 39s] libdevmapper1.02.1:amd64 depends on dmsetup (>= 2:1.02.90-2.2); however: [ 39s] Package dmsetup is not installed. [ 39s] Processing triggers for libc-bin (2.19-18) ... [ 39s] [109/186] installing libglib2.0-0-2.42.1-1 [ 39s] No schema files found: doing nothing. [ 39s] Processing triggers for libc-bin (2.19-18) ... [ 39s] [110/186] installing vim-2:7.4.488-7 [28841s] qemu-system-x86_64: terminating on signal 15 from pid 28662 () [28841s] qemu-system-x86_64: Failed to unlink socket /var/cache/obs/worker/root_8/root.monitor: Permission denied [28841s] ### VM INTERACTION END ### [28841s] No buildstatus set, either the base system is broken (kernel/initrd/udev/glibc/bash/perl) [28841s] or the build host has a kernel or hardware problem... Job seems to be stuck here, killed. (after 28800 seconds of inactivity) -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/)
[PATCH] osmo-ttcn3-hacks[master]: bsc: add TC_ms_rel_ind_does_not_cause_bssmap_reset
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7219 to look at the new patch set (#2). bsc: add TC_ms_rel_ind_does_not_cause_bssmap_reset bsc: add TC_bssmap_clear_does_not_cause_bssmap_reset(), but the same triggered by an MS Rel Ind and a BSSMAP Clear Request sent to the MSC first. This test will only succeed once TC_chan_rel_rll_rel_ind() succeeds, i.e. with below osmo-bsc fix. Related: OS#3041 Depends: I0f8c9c4e6b6850b15c70250fd3f88bdf75f9accf (osmo-bsc) Change-Id: Ie4aa2f01c83b40303fa40ed64dbfce372b7cd96c --- M bsc/BSC_Tests.ttcn 1 file changed, 63 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/19/7219/2 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 3b5c860..972d912 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -1820,6 +1820,68 @@ f_shutdown_helper(); } +/* OS#3041: Open and close N connections in a normal fashion, and expect no + * BSSMAP Reset just because of that. Close connections from the MS side with a + * Release Ind on RSL. */ +testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { + var default d; + var integer i; + var DchanTuple dt; + var BSSAP_N_DATA_ind rx_di; + var RSL_Message rx_rsl; + var integer j; + + f_init(); + + /* Wait for initial BSSMAP Reset to pass */ + f_sleep(4.0); + + d := activate(no_bssmap_reset()); + + /* Setup up a number of connections and RLSD them again from the MSC +* side. In the buggy behavior, the fourth one triggers BSSMAP Reset. +* Let's do it some more times for good measure. */ + for (i := 0; i < 8; i := i+1) { + /* Since we're doing a lot of runs, give each one a fresh +* T_guard from the top. */ + T_guard.start; + + /* Setup a BSSAP connection and clear it right away. This is +* the MSC telling the BSC about a planned release, it's not an +* erratic loss of a connection. */ + dt := f_est_dchan('23'O, 23, '00010203040506'O); + + /* simulate RLL REL IND */ + f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0; + + /* expect Clear Request on MSC side */ + BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; + + /* Instruct BSC to clear channel */ + var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); + BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); + + /* expect BSC to disable the channel */ + rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); + /* respond with CHAN REL ACK */ + f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); + + /* expect Clear Complete from BSC */ + BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); + + /* MSC disconnects as instructed. */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + } + + /* In the buggy behavior, a timeout of 2 seconds happens between above +* trigger (logs "SIGTRAN connection down, reconnecting...") and the +* actual BSSMAP Reset. Wait a bit longer just to make sure. */ + f_sleep(4.0); + + deactivate(d); + f_shutdown_helper(); +} + control { /* CTRL interface testing */ execute( TC_ctrl_msc_connection_status() ); @@ -1896,6 +1958,7 @@ execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); + execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); } } -- To view, visit https://gerrit.osmocom.org/7219 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ie4aa2f01c83b40303fa40ed64dbfce372b7cd96c Gerrit-PatchSet: 2 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[PATCH] osmo-ttcn3-hacks[master]: bsc: add TC_bssap_rlsd_does_not_cause_bssmap_reset
Review at https://gerrit.osmocom.org/7223 bsc: add TC_bssap_rlsd_does_not_cause_bssmap_reset A test with BSSMAP Clear involved would also be a nice addition, but this so far tests a direct RLSD from the MSC. (One way to invoke a typical release situation would be a scenario like in TC_chan_rel_rll_rel_ind(), but that test currently fails; another would be to directly invoke a BSSMAP Clear from the MSC first.) Related: OS#3041 Change-Id: I168cf240383485a5ffbbde377b4f89c5d1f5ab93 --- M bsc/BSC_Tests.ttcn 1 file changed, 48 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/23/7223/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index d8ca374..71d1b51 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -236,6 +236,13 @@ } } +altstep no_bssmap_reset() runs on test_CT { + [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { + setverdict(fail, "unexpected BSSMAP Reset"); + self.stop; + } +} + function f_init_mgcp(charstring id) runs on test_CT { id := id & "-MGCP"; @@ -1697,6 +1704,45 @@ vc_conn.done; } +/* OS#3041: Open and close N connections in a normal fashion, and expect no + * BSSMAP Reset just because of that. */ +testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { + var default d; + var integer i; + var DchanTuple dt; + + f_init(); + + /* Wait for initial BSSMAP Reset to pass */ + f_sleep(4.0); + + d := activate(no_bssmap_reset()); + + /* Setup up a number of connections and RLSD them again from the MSC +* side. In the buggy behavior, the fourth one triggers BSSMAP Reset. +* Let's do it some more times for good measure. */ + for (i := 0; i < 8; i := i+1) { + /* Since we're doing a lot of runs, give each one a fresh +* T_guard from the top. */ + T_guard.start; + + /* Setup a BSSAP connection and clear it right away. This is +* the MSC telling the BSC about a planned release, it's not an +* erratic loss of a connection. */ + dt := f_est_dchan('23'O, 23, '00010203040506'O); + + /* MSC disconnects (RLSD). */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + } + + /* In the buggy behavior, a timeout of 2 seconds happens between above +* trigger (logs "SIGTRAN connection down, reconnecting...") and the +* actual BSSMAP Reset. Wait a bit longer just to make sure. */ + f_sleep(4.0); + + deactivate(d); + f_shutdown_helper(); +} control { /* CTRL interface testing */ @@ -1771,6 +1817,8 @@ execute( TC_err_82_short_msg() ); execute( TC_err_84_unknown_msg() ); execute( TC_ho_int() ); + + execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); } } -- To view, visit https://gerrit.osmocom.org/7223 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I168cf240383485a5ffbbde377b4f89c5d1f5ab93 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
[PATCH] osmo-ttcn3-hacks[master]: bsc: TC_chan_rel_rll_rel_ind: expect full MSC Clear Request
Review at https://gerrit.osmocom.org/7225 bsc: TC_chan_rel_rll_rel_ind: expect full MSC Clear Request This test sends a REL IND from the MS and immediately expects an lchan release. Instead, osmo-bsc patch I0f8c9c4e6b6850b15c70250fd3f88bdf75f9accf decides to signal full BSSMAP Clear Request to the MSC first, so expect that first. Note that this test currently fails, and said osmo-bsc.git patch will make this test pass. Change-Id: I737be141b69a250eb6eb38007f8042981c1a31cf --- M bsc/BSC_Tests.ttcn 1 file changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/25/7225/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index a466d36..3b5c860 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -618,6 +618,7 @@ /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ testcase TC_chan_rel_rll_rel_ind() runs on test_CT { var RSL_Message rx_rsl; + var BSSAP_N_DATA_ind rx_di; var DchanTuple dt; f_init(1); @@ -627,13 +628,26 @@ /* simulate RLL REL IND */ f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0; + /* expect Clear Request on MSC side */ + BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; + + /* Instruct BSC to clear channel */ + var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); + BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); + /* expect BSC to disable the channel */ rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); /* respond with CHAN REL ACK */ f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); - /* expect DISC_IND on MSC side */ - BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)); + /* expect Clear Complete from BSC */ + BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); + + /* release the SCCP connection */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + + /* wait for SCCP emulation to do its job */ + f_sleep(1.0); setverdict(pass); } -- To view, visit https://gerrit.osmocom.org/7225 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I737be141b69a250eb6eb38007f8042981c1a31cf Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
[PATCH] osmo-ttcn3-hacks[master]: bsc: cosmetic: T_guard timeout: add 'self.stop'
Review at https://gerrit.osmocom.org/7222 bsc: cosmetic: T_guard timeout: add 'self.stop' If the T_guard runs out, unless we self.stop, we might run into this potentially confusing follow-up error: 00:23:04.206712 mtc BSC_Tests.ttcn:322 Dynamic test case error: Copying an unbound value of type @RSL_Types.RSL_Message. 00:23:04.206778 mtc BSC_Tests.ttcn:322 setverdict(error): fail -> error Change-Id: I1d373159483bdd9f74e8944e430913e73c289e03 --- M bsc/BSC_Tests.ttcn 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/22/7222/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index dc266ab..d8ca374 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -224,7 +224,10 @@ /* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */ altstep as_Tguard() runs on test_CT { var BSSAP_N_UNITDATA_ind ud_ind; - [] T_guard.timeout { setverdict(fail, "Timeout of T_guard"); } + [] T_guard.timeout { + setverdict(fail, "Timeout of T_guard"); + self.stop; + } /* always respond with RESET ACK to RESET */ [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, -- To view, visit https://gerrit.osmocom.org/7222 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1d373159483bdd9f74e8944e430913e73c289e03 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
[PATCH] osmo-ttcn3-hacks[master]: bsc: add TC_bssmap_clear_does_not_cause_bssmap_reset()
Review at https://gerrit.osmocom.org/7224 bsc: add TC_bssmap_clear_does_not_cause_bssmap_reset() Same as TC_bssmap_rlsd_does_not_cause_bssmap_reset(), but with a proper BSSMAP Clear from the MSC first. Related: OS#3041 Change-Id: If6ca85d7b80a727cbfdabbf07529ced22602734e --- M bsc/BSC_Tests.ttcn 1 file changed, 63 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/24/7224/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index 71d1b51..a466d36 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -46,6 +46,8 @@ import from L3_Templates all; import from GSM_RR_Types all; +import from BSSMAP_Templates all; + const integer NUM_BTS := 3; const float T3101_MAX := 12.0; @@ -1744,6 +1746,66 @@ f_shutdown_helper(); } +/* OS#3041: Open and close N connections in a normal fashion, and expect no + * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from + * the MSC. */ +testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { + var default d; + var integer i; + var DchanTuple dt; + var BSSAP_N_DATA_ind rx_di; + var RSL_Message rx_rsl; + var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; + var BssmapCause cause := enum2int(cause_val); + + f_init(); + + /* Wait for initial BSSMAP Reset to pass */ + f_sleep(4.0); + + d := activate(no_bssmap_reset()); + + /* Setup up a number of connections and RLSD them again from the MSC +* side. In the buggy behavior, the fourth one triggers BSSMAP Reset. +* Let's do it some more times for good measure. */ + for (i := 0; i < 8; i := i+1) { + /* Since we're doing a lot of runs, give each one a fresh +* T_guard from the top. */ + T_guard.start; + + /* Setup a BSSAP connection and clear it right away. This is +* the MSC telling the BSC about a planned release, it's not an +* erratic loss of a connection. */ + dt := f_est_dchan('23'O, 23, '00010203040506'O); + + /* Instruct BSC to clear channel */ + BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); + + /* expect BSC to disable the channel */ + rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); + /* respond with CHAN REL ACK */ + f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); + + /* expect Clear Complete from BSC */ + BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); + + /* MSC disconnects as instructed. */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + + + /* MSC disconnects (RLSD). */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + } + + /* In the buggy behavior, a timeout of 2 seconds happens between above +* trigger (logs "SIGTRAN connection down, reconnecting...") and the +* actual BSSMAP Reset. Wait a bit longer just to make sure. */ + f_sleep(4.0); + + deactivate(d); + f_shutdown_helper(); +} + control { /* CTRL interface testing */ execute( TC_ctrl_msc_connection_status() ); @@ -1819,6 +1881,7 @@ execute( TC_ho_int() ); execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); + execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); } } -- To view, visit https://gerrit.osmocom.org/7224 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If6ca85d7b80a727cbfdabbf07529ced22602734e Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
osmo-bsc[master]: abis_rsl: properly handle RSL Release Ind from MS
Patch Set 1: Code-Review-1 This probably needs some more testing, and the ttcn3 change-id may not be pushed yet, but I'd like to get some feedback in the meantime. -- To view, visit https://gerrit.osmocom.org/7221 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0f8c9c4e6b6850b15c70250fd3f88bdf75f9accf Gerrit-PatchSet: 1 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
[PATCH] osmo-bsc[master]: abis_rsl: properly handle RSL Release Ind from MS
Review at https://gerrit.osmocom.org/7221 abis_rsl: properly handle RSL Release Ind from MS If we receive a Release Ind from the MS, we so far just drop it on the floor, assuming that some other part of the BSC code invoked something that it is already taking care of -- which is of course not the case. If we receive a Release Ind for an lchan that is not in state LCHAN_S_REL_REQ, signal the MSC with a Clear Request which will lead to a graceful teardown of the entire connection. If there should be no conn, immediately invoke the channel release and ignore BSSAP. Related: ttcn3 test TC_chan_rel_rll_rel_ind(), see I737be141b69a250eb6eb38007f8042981c1a31cf (osmo-ttcn3-hacks) Change-Id: I0f8c9c4e6b6850b15c70250fd3f88bdf75f9accf --- M src/libbsc/abis_rsl.c M src/osmo-bsc/osmo_bsc_api.c 2 files changed, 29 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/21/7221/1 diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c index 7400f89..9ec4f2d 100644 --- a/src/libbsc/abis_rsl.c +++ b/src/libbsc/abis_rsl.c @@ -2125,13 +2125,33 @@ int sapi; struct gsm_bts *bts; - /* -* Maybe only one link/SAPI was releasd or the error handling -* was activated. Just return now and let the other code handle -* it. -*/ - if (lchan->state != LCHAN_S_REL_REQ) + if (lchan->state == LCHAN_S_NONE) { + LOGP(DRSL, LOGL_ERROR, "%s Release requested for an unused lchan\n", +gsm_lchan_name(lchan)); return; + } + + if (lchan->state != LCHAN_S_REL_REQ) { + /* The MS asked us to release. */ + struct bsc_api *bsc_api = lchan->ts->trx->bts->network->bsc_api; + if (!bsc_api || !bsc_api->clear_request) { + LOGP(DRSL, LOGL_ERROR, "%s FATAL: no bsc_api to dispatch Clear Request\n", +gsm_lchan_name(lchan)); + return; + } + rsl_lchan_set_state(lchan, LCHAN_S_REL_REQ); + + if (!lchan->conn) { + /* No conn exists, release the lchan right away */ + lchan->state = LCHAN_S_REL_REQ; + rsl_rf_chan_release(lchan, 0, SACCH_NONE); + return; + } + + /* Kick off a BSSAP Clear Request followed by a full teardown via MSC. */ + bsc_api->clear_request(lchan->conn, 0); + return; + } for (sapi = 0; sapi < ARRAY_SIZE(lchan->sapis); ++sapi) { if (lchan->sapis[sapi] == LCHAN_SAPI_UNUSED) diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c index 75dae12..b87711d 100644 --- a/src/osmo-bsc/osmo_bsc_api.c +++ b/src/osmo-bsc/osmo_bsc_api.c @@ -449,6 +449,9 @@ static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause) { struct msgb *resp; + if (!conn) + return 1; + return_when_not_connected_val(conn, 1); LOGP(DMSC, LOGL_INFO, "Tx MSC CLEAR REQUEST\n"); -- To view, visit https://gerrit.osmocom.org/7221 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f8c9c4e6b6850b15c70250fd3f88bdf75f9accf Gerrit-PatchSet: 1 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
[PATCH] osmo-ci[master]: jenkins: add job osmo-gsm-tester_build-trigger-all
Hello Pau Espin Pedrol, Neels Hofmeyr, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7020 to look at the new patch set (#4). jenkins: add job osmo-gsm-tester_build-trigger-all osmo-gsm-tester_build-trigger-all triggers a new build of all osmo-gsm-tester build jobs. Change-Id: I8dcf2a6fa2991cb73b4807f8a10d251f3dca77dd --- A jobs/osmo-gsm-tester-trigger.yml 1 file changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/20/7020/4 diff --git a/jobs/osmo-gsm-tester-trigger.yml b/jobs/osmo-gsm-tester-trigger.yml new file mode 100644 index 000..a5ad683 --- /dev/null +++ b/jobs/osmo-gsm-tester-trigger.yml @@ -0,0 +1,16 @@ +# Only contains osmo-gsm-tester_build-trigger-all +# Manually kick off all osmo-gsm-tester_build-osmo-* builds at once. +- project: +name: osmo-gsm-tester-trigger +jobs: + - 'osmo-gsm-tester_build-trigger-all' + +- job: +name: 'osmo-gsm-tester_build-trigger-all' +description: 'Manually kick off all osmo-gsm-tester_build-osmo-* builds at once.' +project-type: freestyle +node: osmo-gsm-tester-build +publishers: + # hopefully the trigger will support lists in the future + - trigger: + project: 'osmo-gsm-tester_build-osmo-bsc,osmo-gsm-tester_build-osmo-bts,osmo-gsm-tester_build-osmo-ggsn,osmo-gsm-tester_build-osmo-hlr,osmo-gsm-tester_build-osmo-mgw,osmo-gsm-tester_build-osmo-msc,osmo-gsm-tester_build-osmo-pcu,osmo-gsm-tester_build-osmo-sgsn,osmo-gsm-tester_build-osmo-trx,osmo-gsm-tester_build-osmo-nitb,osmo-gsm-tester_build-osmo-stp,osmo-gsm-tester_build-osmo-bts-sysmo,osmo-gsm-tester_build-osmo-pcu-sysmo' -- To view, visit https://gerrit.osmocom.org/7020 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I8dcf2a6fa2991cb73b4807f8a10d251f3dca77dd Gerrit-PatchSet: 4 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol
[PATCH] osmo-ci[master]: jenkins: add job osmo-gsm-tester_gerrit
Hello Pau Espin Pedrol, Neels Hofmeyr, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7022 to look at the new patch set (#6). jenkins: add job osmo-gsm-tester_gerrit The job verifies the gerrit patchset. Change-Id: If661675528059bc8a95d39a6489a5a9381f52677 --- M jobs/osmo-gsm-tester-runner.yml A jobs/osmo-gsm-tester_run-gerrit.sh 2 files changed, 69 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/22/7022/6 diff --git a/jobs/osmo-gsm-tester-runner.yml b/jobs/osmo-gsm-tester-runner.yml index 97fd482..37e1651 100644 --- a/jobs/osmo-gsm-tester-runner.yml +++ b/jobs/osmo-gsm-tester-runner.yml @@ -6,6 +6,22 @@ - rnd jobs: - 'osmo-gsm-tester_run-{stage}' + - 'osmo-gsm-tester_gerrit' + +- scm: +name: osmo-gsm-tester-gerrit +scm: + - git: + url: ssh://jenk...@gerrit.osmocom.org:29418/osmo-gsm-tester + credentials-id: jenkins + branches: +- $GERRIT_BRANCH + wipe-workspace: false + skip-tag: true + basedir: osmo-gsm-tester + clean: +before: true + choosing-strategy: 'gerrit' # The repo must be used seperate to workaround the bug "Can not expand OSMO_GSM_TESTER_BRANCH". # The safe-guard check to not use un-defined variables seems to be broken. @@ -116,3 +132,37 @@ notify-every-unstable-build: true scm: - 'osmo-gsm-tester-repo' + +# gerrit job +- job: +name: 'osmo-gsm-tester_gerrit' +defaults: runner +scm: + - 'osmo-gsm-tester-gerrit' +triggers: + - gerrit: + server-name: 'gerrit.osmocom.org' + trigger-on: +- patchset-created-event: +exclude-no-code-change: true +- draft-published-event + projects: +- project-compare-type: 'PLAIN' + project-pattern: 'osmo-gsm-tester' + branches: +- branch-compare-type: 'ANT' + branch-pattern: '**' +builders: + - shell: | + # make sure no bin artifacts from a previous run remain + rm -f *.tgz *.md5 + - osmo_gsm_copy_artifact_all + - shell: !include-raw: osmo-gsm-tester_run-gerrit.sh +publishers: + - archive: + artifacts: '*-run.tgz, *-bin.tgz' + default-excludes: false + - junit: + results: 'trial-*/last_run/trial-*.xml' + allow-empty-results: true + diff --git a/jobs/osmo-gsm-tester_run-gerrit.sh b/jobs/osmo-gsm-tester_run-gerrit.sh new file mode 100644 index 000..b07207f --- /dev/null +++ b/jobs/osmo-gsm-tester_run-gerrit.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e -x + +# On our hardware, we actually use the example configuration as-is. +export OSMO_GSM_TESTER_CONF="$PWD/osmo-gsm-tester/example" + +# debug: provoke a failure +#export OSMO_GSM_TESTER_OPTS="-s debug -t fail" + +# TMP fix: prod main unit has sierra_2 and _3 instead of _1 and _2 +sed -i "s#/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3#/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.7/1-1.7.3#g" "$OSMO_GSM_TESTER_CONF/resources.conf" +sed -i "s#/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2#/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.7/1-1.7.2#g" "$OSMO_GSM_TESTER_CONF/resources.conf" +sed -i "s#90170009031#90170015252#g" "$OSMO_GSM_TESTER_CONF/resources.conf" +sed -i "s#90170009029#90170015253#g" "$OSMO_GSM_TESTER_CONF/resources.conf" +sed -i "s#80A37E6FDEA931EAC92FFA5F671EFEAD#EBAB63D06C3F546A16C977CB40E57C68#g" "$OSMO_GSM_TESTER_CONF/resources.conf" +sed -i "s#00969E283349D354A8239E877F2E0866#EBD2B5F6CF3374106D0A66C11F922001#g" "$OSMO_GSM_TESTER_CONF/resources.conf" + +export OSMO_GSM_TESTER_OPTS="-s sms:sysmo -s aoip_sms:sysmo -s gprs:sysmo" +./osmo-gsm-tester/contrib/jenkins-make-check-and-run.sh -- To view, visit https://gerrit.osmocom.org/7022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: If661675528059bc8a95d39a6489a5a9381f52677 Gerrit-PatchSet: 6 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: lynxis lazus
[PATCH] osmo-ci[master]: jenkins: add osmo-gsm-tester-build jobs
Hello Pau Espin Pedrol, Neels Hofmeyr, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7019 to look at the new patch set (#4). jenkins: add osmo-gsm-tester-build jobs The build jobs building all osmocom components which will be used by the osmo-gsm-tester. A .tgz archive will be used as artefact which is copied later by the osmo-gsm-tester test run. Change-Id: Ic49c94e9e6639e43f6ae14b868bc826af3ce2085 --- A jobs/osmo-gsm-tester-builder.yml 1 file changed, 99 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/19/7019/4 diff --git a/jobs/osmo-gsm-tester-builder.yml b/jobs/osmo-gsm-tester-builder.yml new file mode 100644 index 000..4ee230e --- /dev/null +++ b/jobs/osmo-gsm-tester-builder.yml @@ -0,0 +1,99 @@ +--- +# All job in here builds the binaries +# which will be used by the runner jobs +# +- project: +name: osmo-gsm-tester-builder + +repo: + - osmo-bsc + - osmo-bts + - osmo-ggsn + - osmo-hlr + - osmo-mgw + - osmo-msc + - osmo-pcu + - osmo-sgsn + - osmo-trx + - osmo-nitb: + reverse-job: master-openbsc + - osmo-stp: + reverse-job: master-libosmo-sccp + - osmo-bts-sysmo: + reverse-job: master-osmo-bts + - osmo-pcu-sysmo: + reverse-job: master-osmo-pcu +reverse-job: 'master-{repo}' + +jobs: + - 'osmo-gsm-tester_build-{repo}' + +- parameter: +name: gsmtester_build_branch +parameters: + - string: + name: "{name}" + default: "" + description: "Default: leave empty. Branch to build from, in the form my/branch or origin/my/branch (do not prepend 'refs/heads/')" + +- job-template: +name: 'osmo-gsm-tester_build-{repo}' +project-type: freestyle +node: osmo-gsm-tester-build +builders: + - shell: | + set -e -x + ./osmo-gsm-tester/contrib/jenkins-build-{repo}.sh +triggers: + - reverse: +jobs: '{reverse-job}' +publishers: + - archive: + artifacts: '*.tgz, *.md5' + only-if-success: 'true' + default-excludes: false +properties: + - build-discarder: + num-to-keep: 20 +parameters: + - string: + name: "OSMO_GSM_TESTER_BRANCH" + default: "origin/master" + description: "Which branch/sha should be used for testing" + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_libosmo-abis + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_libosmocore + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_libosmo-netif + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_libosmo_sccp + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_octphy_2g_headers + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo_bts + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo_mgw + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo-mgw + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo_msc + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo_pcu + - gsmtester_build_branch: + name: OSMO_GSM_TESTER_BUILD_osmo_trx +scm: + - osmo-gsm-tester-repo + +# The repo must be used seperate to workaround the bug "Can not expand OSMO_GSM_TESTER_BRANCH". +# The safe-guard check to not use un-defined variables seems to be broken. +- scm: +name: osmo-gsm-tester-repo +scm: + - git: + url: git://git.osmocom.org/osmo-gsm-tester + branches: +- ${OSMO_GSM_TESTER_BRANCH} + wipe-workspace: false + skip-tag: true + basedir: osmo-gsm-tester -- To view, visit https://gerrit.osmocom.org/7019 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic49c94e9e6639e43f6ae14b868bc826af3ce2085 Gerrit-PatchSet: 4 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: lynxis lazus
[PATCH] osmo-ci[master]: jenkins: add osmo-gsm-tester_run-{prod,rnd}
Hello Pau Espin Pedrol, Neels Hofmeyr, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/7021 to look at the new patch set (#5). jenkins: add osmo-gsm-tester_run-{prod,rnd} Both jobs doing the actual test run on the prod or rnd tester. Change-Id: Ic1c4babc547f48402b0bcfaf38e2734e87e565f0 --- A jobs/osmo-gsm-tester-runner.yml A jobs/osmo-gsm-tester_run-prod.sh A jobs/osmo-gsm-tester_run-rnd.sh 3 files changed, 150 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/21/7021/5 diff --git a/jobs/osmo-gsm-tester-runner.yml b/jobs/osmo-gsm-tester-runner.yml new file mode 100644 index 000..97fd482 --- /dev/null +++ b/jobs/osmo-gsm-tester-runner.yml @@ -0,0 +1,118 @@ +## run jobs +- project: +name: osmo-gsm-testers-runner +stage: + - prod + - rnd +jobs: + - 'osmo-gsm-tester_run-{stage}' + +# The repo must be used seperate to workaround the bug "Can not expand OSMO_GSM_TESTER_BRANCH". +# The safe-guard check to not use un-defined variables seems to be broken. +- scm: +name: osmo-gsm-tester-repo +scm: + - git: + url: git://git.osmocom.org/osmo-gsm-tester + branches: +- ${OSMO_GSM_TESTER_BRANCH} + wipe-workspace: false + skip-tag: true + basedir: osmo-gsm-tester + +- builder: +name: osmo_gsm_copy_artifact +builders: + - copyartifact: + project: '{repo}' + filter: '*.tgz, *.md5' + which-build: last-successful + stable: true + +# all artifact in one place +- builder: +name: osmo_gsm_copy_artifact_all +builders: + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-bsc + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-bts + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-ggsn + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-hlr + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-mgw + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-msc + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-pcu + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-sgsn + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-trx + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-nitb + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-stp + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-bts-sysmo + - osmo_gsm_copy_artifact: + repo: osmo-gsm-tester_build-osmo-pcu-sysmo + +- defaults: +name: runner +description: 'Run an actual GSM hardware test using the binaries from the osmo-gsm-tester_build* jobs' +node: 'osmo-gsm-tester-prod' +project-type: freestyle +properties: + - build-discarder: + num-to-keep: 60 +parameters: + - string: + name: "OSMO_GSM_TESTER_BRANCH" + default: "origin/master" + description: "Which branch/sha should be used for testing" + - string: + name: "OSMO_GSM_TESTER_OPTS" + default: "" + description: "pass additional command line options to osmo-gsm-tester.py, e.g. to select specific suites:scenarios. Default: leave empty." + +- job-template: +name: 'osmo-gsm-tester_run-{stage}' +defaults: runner +node: 'osmo-gsm-tester-{stage}' +triggers: + - timed: "H H/2 * * *" + - pollscm: + cron: "H/5 * * * *" + - reverse: +jobs: +- osmo-gsm-tester_build-osmo-bsc +- osmo-gsm-tester_build-osmo-bts +- osmo-gsm-tester_build-osmo-ggsn +- osmo-gsm-tester_build-osmo-hlr +- osmo-gsm-tester_build-osmo-mgw +- osmo-gsm-tester_build-osmo-msc +- osmo-gsm-tester_build-osmo-pcu +- osmo-gsm-tester_build-osmo-sgsn +- osmo-gsm-tester_build-osmo-trx +- osmo-gsm-tester_build-osmo-nitb +- osmo-gsm-tester_build-osmo-stp +- osmo-gsm-tester_build-osmo-bts-sysmo +- osmo-gsm-tester_build-osmo-pcu-sysmo +builders: + - osmo_gsm_copy_artifact_all + - shell: !include-raw: osmo-gsm-tester_run-{stage}.sh +publishers: + - archive: + artifacts: '*-run.tgz, *-bin.tgz' + default-excludes: false + - junit: + results: 'trial-*/last_run/trial-*.xml' + allow-empty-results: true + - email: + recipients: 'pes...@sysmocom.de' + notify-every-unstable-build: true +scm: + - 'osmo-gsm-tester-repo' diff --git a/jobs/osmo-gsm-tester_run-prod.sh b/jobs/osmo-gsm-tester_run-prod.sh new file mode 100644 index 000..0764096 --- /dev/null +++ b/jobs/osmo-gsm-tester_run-prod.sh @@ -0,0 +1,21 @@
[PATCH] osmo-bsc[master]: sysinfo: Fix regression causing missing L2 Pseudo-Length in ...
Review at https://gerrit.osmocom.org/7220 sysinfo: Fix regression causing missing L2 Pseudo-Length in SI5/SI6 Fixes a regression in the code generating SI5* and SI6 on SACCH, where the L@ pseudo-length is not part of the 'struct' definition we have in gsm_04_08.h and hence has to be encoded manually into the first byte of the SI buffer. We were doing this correctly until April 2017, when the following patch was merged: > commit 6f0e50c8337355eb59033903ede9ab6528890835 > Author: Max> Date: Wed Apr 12 15:30:54 2017 +0200 > > Prepare for extended SI2quater support This patch cacidentially overwrote the l2_plen that was just enoded, as the 'struct' was no longer pointing to 'output' (si_buf+1), but now directly to the start of the si_buf. NOTE: The Wireshark RSL dissector (and more recently also LAPDm) contain a similar bug, so the SACCH will not be decoded correctly after applying this patch. Nevertheless, it's correct. Change-Id: Ie8c907b1317566670aeb68f933ceefd552c17565 Closes: #3059 Related: #2963 --- M src/libbsc/system_information.c 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/20/7220/1 diff --git a/src/libbsc/system_information.c b/src/libbsc/system_information.c index c7c85b0..d99153f 100644 --- a/src/libbsc/system_information.c +++ b/src/libbsc/system_information.c @@ -959,7 +959,7 @@ break; } - si5 = (struct gsm48_system_information_type_5 *) GSM_BTS_SI(bts, t); + si5 = (struct gsm48_system_information_type_5 *) output; /* l2 pseudo length, not part of msg: 18 */ si5->rr_protocol_discriminator = GSM48_PDISC_RR; @@ -995,7 +995,7 @@ break; } - si5b = (struct gsm48_system_information_type_5bis *) GSM_BTS_SI(bts, t); + si5b = (struct gsm48_system_information_type_5bis *) output; /* l2 pseudo length, not part of msg: 18 */ si5b->rr_protocol_discriminator = GSM48_PDISC_RR; @@ -1009,7 +1009,7 @@ if (n) { /* indicate in SI5 and SI5bis: there is an extension */ struct gsm48_system_information_type_5 *si5 = - (struct gsm48_system_information_type_5 *) GSM_BTS_SI(bts, SYSINFO_TYPE_5); + (struct gsm48_system_information_type_5 *) GSM_BTS_SI(bts, SYSINFO_TYPE_5)+1; si5->bcch_frequency_list[0] |= 0x20; si5b->bcch_frequency_list[0] |= 0x20; } else @@ -1039,7 +1039,7 @@ break; } - si5t = (struct gsm48_system_information_type_5ter *) GSM_BTS_SI(bts, t); + si5t = (struct gsm48_system_information_type_5ter *) output; /* l2 pseudo length, not part of msg: 18 */ si5t->rr_protocol_discriminator = GSM48_PDISC_RR; @@ -1077,7 +1077,7 @@ break; } - si6 = (struct gsm48_system_information_type_6 *) GSM_BTS_SI(bts, t); + si6 = (struct gsm48_system_information_type_6 *) output; /* l2 pseudo length, not part of msg: 11 */ si6->rr_protocol_discriminator = GSM48_PDISC_RR; -- To view, visit https://gerrit.osmocom.org/7220 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie8c907b1317566670aeb68f933ceefd552c17565 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Harald Welte
osmo-ci[master]: add ansible playbooks
Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-modems/tasks/main.yml File ansible/roles/gsm-tester-modems/tasks/main.yml: Line 2: # modems > USRP and UHD are not related to modems, it is about SDR based BTSes: the en Ok, I can move them into it's own role. https://gerrit.osmocom.org/#/c/7127/1/ansible/roles/gsm-tester-network/templates/interface.j2 File ansible/roles/gsm-tester-network/templates/interface.j2: Line 2: auto {{ bts_interface }} > oh, so these are the IP addresses given to the various components like osmo public_interface isn't right also. These aren't public ip addresses. The important fact of the interface is: The bts must be connected to this. We also could bind the "component" address to "lo" interface or directly use some 127.0.0.0/8 addresses for them. -- To view, visit https://gerrit.osmocom.org/7127 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7007a4e6c38f73843390ec2b3b91133aff21e36a Gerrit-PatchSet: 1 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes
osmo-ttcn3-hacks[master]: bsc: add test for OS#3041
Patch Set 1: verified this to fail with current master, and to pass when I disable the conn_loss_counter logic in osmo-bsc's a_reset.c with a crude #if 0. -- To view, visit https://gerrit.osmocom.org/7219 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie4aa2f01c83b40303fa40ed64dbfce372b7cd96c Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
[PATCH] osmo-ttcn3-hacks[master]: bsc: add test for OS#3041
Review at https://gerrit.osmocom.org/7219 bsc: add test for OS#3041 Change-Id: Ie4aa2f01c83b40303fa40ed64dbfce372b7cd96c --- M bsc/BSC_Tests.ttcn 1 file changed, 64 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/19/7219/1 diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn index dc266ab..42ab5bf 100644 --- a/bsc/BSC_Tests.ttcn +++ b/bsc/BSC_Tests.ttcn @@ -233,6 +233,13 @@ } } +altstep no_bssmap_reset() runs on test_CT { + [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { + setverdict(fail, "unexpected BSSMAP Reset"); + self.stop; + } +} + function f_init_mgcp(charstring id) runs on test_CT { id := id & "-MGCP"; @@ -1694,6 +1701,61 @@ vc_conn.done; } +/* OS#3041: Open and close N connections in a normal fashion, and expect no + * BSSMAP Reset just because of that. */ +testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { + var default d; + var integer i; + var DchanTuple dt; + + f_init(); + + /* Wait for initial BSSMAP Reset to pass */ + f_sleep(4.0); + + d := activate(no_bssmap_reset()); + + /* Setup up a number of connections and RLSD them again from the MSC +* side. In the buggy behavior, the fourth one triggers BSSMAP Reset. +* Let's do it some more times for good measure. */ + for (i := 0; i < 8; i := i+1) { + /* Setup a BSSAP connection and clear it right away. This is +* the MSC telling the BSC about a planned release, it's not an +* erratic loss of a connection. */ + dt := f_est_dchan('23'O, 23, '00010203040506'O); + + /* TODO for this test: maybe a plain RLSD could be considered +* erratic, in which case this test would have to play out a +* BSSMAP Clear as well. That would pan out something like +* testcase TC_chan_rel_rll_rel_ind(), however, at the time of +* writing that test fails and it makes no sense to import that +* failure here. */ + if (false) { + /* simulate RLL REL IND */ + f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0; + + /* expect BSC to disable the channel */ + f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); + /* respond with CHAN REL ACK */ + f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); + + /* expect DISC_IND on MSC side */ + BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)); + } + + /* MSC disconnects as instructed. */ + BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); + } + + /* In the buggy behavior, a timeout of 2 seconds happens between above +* trigger (logs "SIGTRAN connection down, reconnecting...") and the +* actual BSSMAP Reset. Wait a bit longer just to make sure. */ + f_sleep(4.0); + + deactivate(d); + f_shutdown_helper(); +} + control { /* CTRL interface testing */ @@ -1768,6 +1830,8 @@ execute( TC_err_82_short_msg() ); execute( TC_err_84_unknown_msg() ); execute( TC_ho_int() ); + + execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); } } -- To view, visit https://gerrit.osmocom.org/7219 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie4aa2f01c83b40303fa40ed64dbfce372b7cd96c Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr
osmo-ci[master]: jenkins: add job osmo-gsm-tester_gerrit
Patch Set 5: Just noticed, I didn't use the scm in the gerrit job... -- To view, visit https://gerrit.osmocom.org/7022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If661675528059bc8a95d39a6489a5a9381f52677 Gerrit-PatchSet: 5 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: No
osmo-ci[master]: jenkins: add job osmo-gsm-tester_gerrit
Patch Set 5: (1 comment) https://gerrit.osmocom.org/#/c/7022/5/jobs/osmo-gsm-tester.yml File jobs/osmo-gsm-tester.yml: Line 101: - scm: > Is this adding the gerrit-URL osmo-gsm-tester *over* the git.osmocom.org on @Neels: this just defines a scm, which you can use in an actual job. For that reason, it has a name argument. I agree, jjb has a different writing and reading than a lot other template engines and code. I could move all "runners" (gerrit, rnd, prod) into a new file, if that makes it easier for you to read. -- To view, visit https://gerrit.osmocom.org/7022 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If661675528059bc8a95d39a6489a5a9381f52677 Gerrit-PatchSet: 5 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: lynxis lazusGerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: lynxis lazus Gerrit-HasComments: Yes
osmo-ttcn3-hacks[master]: gitignore final 'make' generated files
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/7200/1/.gitignore File .gitignore: Line 1517: bsc-nat/IPA_Test I think we can simply do a */*Test and */*Tests instead? -- To view, visit https://gerrit.osmocom.org/7200 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If38aea67a45b4e5fe22d5fac301f06239e2265a2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
osmo-ttcn3-hacks[master]: gitignore symlinks
Patch Set 1: (2 comments) https://gerrit.osmocom.org/#/c/7198/1/.gitignore File .gitignore: Line 10: M3UA_CNL113537/src/src those src/src shouldn't be created in the first place. please fix the script generating them, rather than working around with gitignore Line 13: bsc-nat/BSSAP_CodecPort.ttcn as stated before, we have the "../rmlinks.sh" to remove all symlinks, which can be used before "git status". I don't like this manually-maintained list, as it will be outdated by the time it is merged. If you really must have .gitignore in place, I would presume the best idea is to have a script in the repo to re-generate/update it programmatically. -- To view, visit https://gerrit.osmocom.org/7198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f9fe17c20e2dd72b654fb6d919e7ec1289b4f88 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
osmo-ttcn3-hacks[master]: gitignore 'make compile' generated files
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/7199/1/.gitignore File .gitignore: Line 620: bsc-nat/BSC_MS_ConnectionHandler.cc If you want to have gitignore (I'm still not convinced), then the best approach *IMHO* is to exclude all *.cc *.hh files and explicitly white-list those that we have, or simply ignore all outside of library/ -- To view, visit https://gerrit.osmocom.org/7199 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6e4b9b4526d6e0af0f5325e2df97b0ec7c93d9ae Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
osmo-bts[master]: sysinfo: Fix scheduling of downlink SACCH information
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7218 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ica801f9b9c118f00d9e3dc2780b3123e925f59b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-bts[master]: cosmetic: Document some SI scheduling related function API
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7217 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7e61639349deda28846810c4f52dbea78dccda38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[MERGED] osmo-bts[master]: cosmetic: Document some SI scheduling related function API
Harald Welte has submitted this change and it was merged. Change subject: cosmetic: Document some SI scheduling related function API .. cosmetic: Document some SI scheduling related function API Change-Id: I7e61639349deda28846810c4f52dbea78dccda38 --- M src/common/rsl.c M src/common/sysinfo.c 2 files changed, 17 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/rsl.c b/src/common/rsl.c index 47f59d8..669a39b 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -496,7 +496,12 @@ TLVP_VAL(, RSL_IE_SMSCB_MSG)); } -/* 'buf' must be caller-allocated and hold at least len + 2 or sizeof(sysinfo_buf_t) bytes */ +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given output buffer. + * \param[out] buf Output buffer, must be caller-allocated and hold at least len + 2 or sizeof(sysinfo_buf_t) bytes + * \param[out] valid pointer to bit-mask of 'valid' System information types + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix(uint8_t *buf, uint32_t *valid, const uint8_t *current, uint8_t osmo_si, uint16_t len) { /* We have to pre-fix with the two-byte LAPDM UI header */ @@ -514,11 +519,21 @@ memcpy(buf + 2, current, len); } +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given BTS SACCH buffer + * \param[out] bts BTS in whose System Information State we shall store + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix_bts(struct gsm_bts *bts, const uint8_t *current, uint8_t osmo_si, uint16_t len) { lapdm_ui_prefix(GSM_BTS_SI(bts, osmo_si), >si_valid, current, osmo_si, len); } +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given lchan SACCH buffer + * \param[out] lchan Logical Channel in whose System Information State we shall store + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix_lchan(struct gsm_lchan *lchan, const uint8_t *current, uint8_t osmo_si, uint16_t len) { lapdm_ui_prefix(GSM_LCHAN_SI(lchan, osmo_si), >si.valid, current, osmo_si, len); diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 6f7a387..3582027 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -160,6 +160,7 @@ return 1; } +/* obtain the next to-be transmitted dowlink SACCH frame (L2 hdr + L3); returns pointer to lchan->si buffer */ uint8_t *lchan_sacch_get(struct gsm_lchan *lchan) { uint32_t tmp; -- To view, visit https://gerrit.osmocom.org/7217 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7e61639349deda28846810c4f52dbea78dccda38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmo-bts[master]: sysinfo: Fix scheduling of downlink SACCH information
Harald Welte has submitted this change and it was merged. Change subject: sysinfo: Fix scheduling of downlink SACCH information .. sysinfo: Fix scheduling of downlink SACCH information The existing algorithm (present since 2012!) failed to work in the sole case that only *one* SACCH filling type was present. So if you had your BTS configured to only broadcast SI5, but not broadcast SI5ter, SI6 or any other SACCH filling, it would send the SI5 message only once on a newly-established channel, and never again. The old code was working for more-than-one SACCH filling, as well as for no SACCH filling at all. Let's also add a NOTICE message if there is no SACCH filling available at all. This is highly unusual and definitely a noticeable event. Change-Id: Ica801f9b9c118f00d9e3dc2780b3123e925f59b4 Closes: OS#3057 Related: OS#2963 --- M src/common/sysinfo.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 3582027..b5fd061 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -163,13 +163,15 @@ /* obtain the next to-be transmitted dowlink SACCH frame (L2 hdr + L3); returns pointer to lchan->si buffer */ uint8_t *lchan_sacch_get(struct gsm_lchan *lchan) { - uint32_t tmp; + uint32_t tmp, i; - for (tmp = lchan->si.last + 1; tmp != lchan->si.last; tmp = (tmp + 1) % _MAX_SYSINFO_TYPE) { + for (i = 0; i < _MAX_SYSINFO_TYPE; i++) { + tmp = (lchan->si.last + 1 + i) % _MAX_SYSINFO_TYPE; if (!(lchan->si.valid & (1 << tmp))) continue; lchan->si.last = tmp; return GSM_LCHAN_SI(lchan, tmp); } + LOGP(DL1P, LOGL_NOTICE, "%s SACCH no SI available\n", gsm_lchan_name(lchan)); return NULL; } -- To view, visit https://gerrit.osmocom.org/7218 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ica801f9b9c118f00d9e3dc2780b3123e925f59b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
Build failure of network:osmocom:latest/openbsc in Debian_9.0/armv7l
Visit https://build.opensuse.org/package/live_build_log/network:osmocom:latest/openbsc/Debian_9.0/armv7l Package network:osmocom:latest/openbsc failed to build in Debian_9.0/armv7l Check out the package for editing: osc checkout network:osmocom:latest openbsc Last lines of build log: [ 367s] make[5]: *** [check-local] Error 1 [ 367s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 367s] Makefile:586: recipe for target 'check-am' failed [ 367s] make[4]: *** [check-am] Error 2 [ 367s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 367s] Makefile:438: recipe for target 'check-recursive' failed [ 367s] make[3]: *** [check-recursive] Error 1 [ 367s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests' [ 367s] Makefile:520: recipe for target 'check-recursive' failed [ 367s] make[2]: *** [check-recursive] Error 1 [ 367s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 367s] Makefile:811: recipe for target 'check' failed [ 367s] make[1]: *** [check] Error 2 [ 367s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc' [ 367s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2 [ 367s] debian/rules:13: recipe for target 'build' failed [ 367s] make: *** [build] Error 2 [ 367s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 367s] [ 367s] armbuild17 failed "build openbsc_1.0.0.dsc" at Sun Mar 11 03:47:18 UTC 2018. [ 367s] [ 367s] ### VM INTERACTION START ### [ 370s] [ 334.073042] SysRq : Power Off [ 370s] [ 334.074266] reboot: Power down [ 370s] qemu-system-arm: Failed to unlink socket /var/cache/obs/worker/root_1/root.monitor: Permission denied [ 370s] ### VM INTERACTION END ### [ 370s] [ 370s] armbuild17 failed "build openbsc_1.0.0.dsc" at Sun Mar 11 03:47:21 UTC 2018. [ 370s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/)
Build failure of network:osmocom:nightly/osmo-iuh in Debian_9.0/aarch64
Visit https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/osmo-iuh/Debian_9.0/aarch64 Package network:osmocom:nightly/osmo-iuh failed to build in Debian_9.0/aarch64 Check out the package for editing: osc checkout network:osmocom:nightly osmo-iuh Last lines of build log: [ 843s] make[5]: *** [RANAP_GERAN-Classmark.lo] Error 254 [ 843s] make[5]: Leaving directory '/usr/src/packages/BUILD/src/ranap' [ 843s] Makefile:641: recipe for target 'all-recursive' failed [ 843s] make[4]: *** [all-recursive] Error 1 [ 843s] make[4]: Leaving directory '/usr/src/packages/BUILD/src' [ 843s] Makefile:453: recipe for target 'all' failed [ 843s] make[3]: *** [all] Error 2 [ 843s] make[3]: Leaving directory '/usr/src/packages/BUILD/src' [ 843s] Makefile:454: recipe for target 'all-recursive' failed [ 843s] make[2]: *** [all-recursive] Error 1 [ 843s] make[2]: Leaving directory '/usr/src/packages/BUILD' [ 843s] Makefile:378: recipe for target 'all' failed [ 843s] make[1]: *** [all] Error 2 [ 843s] make[1]: Leaving directory '/usr/src/packages/BUILD' [ 843s] dh_auto_build: make -j1 returned exit code 2 [ 843s] debian/rules:9: recipe for target 'build' failed [ 843s] make: *** [build] Error 2 [ 843s] dpkg-buildpackage: error: debian/rules build gave error exit status 2 [ 843s] [ 843s] obs-arm-4 failed "build osmo-iuh_0.2.0.20180311.dsc" at Sun Mar 11 20:42:14 UTC 2018. [ 843s] [ 843s] ### VM INTERACTION START ### [ 846s] [ 811.695551] sysrq: SysRq : Power Off [ 846s] [ 811.698722] reboot: Power down [ 846s] qemu-system-aarch64: Failed to unlink socket /var/cache/obs/worker/root_7/root.monitor: Permission denied [ 847s] ### VM INTERACTION END ### [ 847s] [ 847s] obs-arm-4 failed "build osmo-iuh_0.2.0.20180311.dsc" at Sun Mar 11 20:42:19 UTC 2018. [ 847s] -- Configure notifications at https://build.opensuse.org/user/notifications openSUSE Build Service (https://build.opensuse.org/)
[PATCH] osmo-bts[master]: sysinfo: Fix scheduling of downlink SACCH information
Review at https://gerrit.osmocom.org/7218 sysinfo: Fix scheduling of downlink SACCH information The existing algorithm (present since 2012!) failed to work in the sole case that only *one* SACCH filling type was present. So if you had your BTS configured to only broadcast SI5, but not broadcast SI5ter, SI6 or any other SACCH filling, it would send the SI5 message only once on a newly-established channel, and never again. The old code was working for more-than-one SACCH filling, as well as for no SACCH filling at all. Let's also add a NOTICE message if there is no SACCH filling available at all. This is highly unusual and definitely a noticeable event. Change-Id: Ica801f9b9c118f00d9e3dc2780b3123e925f59b4 Closes: OS#3057 Related: OS#2963 --- M src/common/sysinfo.c 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/18/7218/1 diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 3582027..b5fd061 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -163,13 +163,15 @@ /* obtain the next to-be transmitted dowlink SACCH frame (L2 hdr + L3); returns pointer to lchan->si buffer */ uint8_t *lchan_sacch_get(struct gsm_lchan *lchan) { - uint32_t tmp; + uint32_t tmp, i; - for (tmp = lchan->si.last + 1; tmp != lchan->si.last; tmp = (tmp + 1) % _MAX_SYSINFO_TYPE) { + for (i = 0; i < _MAX_SYSINFO_TYPE; i++) { + tmp = (lchan->si.last + 1 + i) % _MAX_SYSINFO_TYPE; if (!(lchan->si.valid & (1 << tmp))) continue; lchan->si.last = tmp; return GSM_LCHAN_SI(lchan, tmp); } + LOGP(DL1P, LOGL_NOTICE, "%s SACCH no SI available\n", gsm_lchan_name(lchan)); return NULL; } -- To view, visit https://gerrit.osmocom.org/7218 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ica801f9b9c118f00d9e3dc2780b3123e925f59b4 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte
[PATCH] osmo-bts[master]: cosmetic: Document some SI scheduling related function API
Review at https://gerrit.osmocom.org/7217 cosmetic: Document some SI scheduling related function API Change-Id: I7e61639349deda28846810c4f52dbea78dccda38 --- M src/common/rsl.c M src/common/sysinfo.c 2 files changed, 17 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/17/7217/1 diff --git a/src/common/rsl.c b/src/common/rsl.c index 47f59d8..669a39b 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -496,7 +496,12 @@ TLVP_VAL(, RSL_IE_SMSCB_MSG)); } -/* 'buf' must be caller-allocated and hold at least len + 2 or sizeof(sysinfo_buf_t) bytes */ +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given output buffer. + * \param[out] buf Output buffer, must be caller-allocated and hold at least len + 2 or sizeof(sysinfo_buf_t) bytes + * \param[out] valid pointer to bit-mask of 'valid' System information types + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix(uint8_t *buf, uint32_t *valid, const uint8_t *current, uint8_t osmo_si, uint16_t len) { /* We have to pre-fix with the two-byte LAPDM UI header */ @@ -514,11 +519,21 @@ memcpy(buf + 2, current, len); } +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given BTS SACCH buffer + * \param[out] bts BTS in whose System Information State we shall store + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix_bts(struct gsm_bts *bts, const uint8_t *current, uint8_t osmo_si, uint16_t len) { lapdm_ui_prefix(GSM_BTS_SI(bts, osmo_si), >si_valid, current, osmo_si, len); } +/*! Prefix a given SACCH frame with a L2/LAPDm UI header and store it in given lchan SACCH buffer + * \param[out] lchan Logical Channel in whose System Information State we shall store + * \param[in] current input data (L3 without L2/L1 header) + * \param[in] osmo_si Sytstem Infrormation Type (SYSINFO_TYPE_*) + * \param[in] len length of \a current in octets */ static inline void lapdm_ui_prefix_lchan(struct gsm_lchan *lchan, const uint8_t *current, uint8_t osmo_si, uint16_t len) { lapdm_ui_prefix(GSM_LCHAN_SI(lchan, osmo_si), >si.valid, current, osmo_si, len); diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c index 6f7a387..3582027 100644 --- a/src/common/sysinfo.c +++ b/src/common/sysinfo.c @@ -160,6 +160,7 @@ return 1; } +/* obtain the next to-be transmitted dowlink SACCH frame (L2 hdr + L3); returns pointer to lchan->si buffer */ uint8_t *lchan_sacch_get(struct gsm_lchan *lchan) { uint32_t tmp; -- To view, visit https://gerrit.osmocom.org/7217 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7e61639349deda28846810c4f52dbea78dccda38 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_tchf.c: always send traffic indications
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon/sched_lchan_tchf.c: always send traffic indications .. trxcon/sched_lchan_tchf.c: always send traffic indications We shall always send traffic frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I99e134699796c7075299459e96b2f2d462636619 --- M src/host/trxcon/sched_lchan_tchf.c 1 file changed, 29 insertions(+), 17 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c index 25c9b10..80e4d52 100644 --- a/src/host/trxcon/sched_lchan_tchf.c +++ b/src/host/trxcon/sched_lchan_tchf.c @@ -49,8 +49,8 @@ sbit_t *bits, int8_t rssi, int16_t toa256) { const struct trx_lchan_desc *lchan_desc; + int n_errors = -1, n_bits_total, rc; uint8_t rsl_cmode, tch_mode, mode; - int n_errors, n_bits_total, rc; sbit_t *buffer, *offset; uint8_t l2[128], *mask; uint32_t *first_fn; @@ -92,16 +92,6 @@ if (bid != 3) return 0; - /* Check for complete set of bursts */ - if ((*mask & 0xf) != 0xf) { - LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at " - "fn=%u (%u/%u) for %s\n", *first_fn, - (*first_fn) % ts->mf_layout->period, - ts->mf_layout->period, - lchan_desc->name); - return -EINVAL; - } - /** * Get current RSL / TCH modes * @@ -110,6 +100,18 @@ */ rsl_cmode = RSL_CMOD_SPD_SPEECH; tch_mode = lchan->tch_mode; + + /* Check for complete set of bursts */ + if ((*mask & 0xf) != 0xf) { + LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at " + "fn=%u (%u/%u) for %s\n", *first_fn, + (*first_fn) % ts->mf_layout->period, + ts->mf_layout->period, + lchan_desc->name); + + /* Send BFI */ + goto bfi; + } mode = rsl_cmode != RSL_CMOD_SPD_SPEECH ? GSM48_CMODE_SPEECH_V1 : tch_mode; @@ -144,25 +146,35 @@ LOGP(DSCHD, LOGL_ERROR, "Received bad TCH frame ending at " "fn=%u for %s\n", fn, lchan_desc->name); - l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + /* Send BFI */ + goto bfi; } else if (rc == GSM_MACBLOCK_LEN) { /* FACCH received, forward it to the higher layers */ sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, n_errors, false, false); /* Send BFI instead of stolen TCH frame */ - l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + goto bfi; } else { /* A good TCH frame received */ l2_len = rc; } /* Send a traffic frame to the higher layers */ - if (l2_len > 0) - sched_send_dt_ind(trx, ts, lchan, l2, l2_len, - n_errors, rc < 4, true); + return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, false, true); - return 0; +bfi: + /* Bad frame indication */ + l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + + /* Didn't try to decode */ + if (n_errors < 0) + n_errors = 116 * 4; + + /* Send a BFI frame to the higher layers */ + return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, true, true); } int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, -- To view, visit https://gerrit.osmocom.org/7216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I99e134699796c7075299459e96b2f2d462636619 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_xcch.c: always send data indications
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon/sched_lchan_xcch.c: always send data indications .. trxcon/sched_lchan_xcch.c: always send data indications We shall always send data frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092 --- M src/host/trxcon/sched_lchan_xcch.c 1 file changed, 9 insertions(+), 6 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c index f351674..04c9f4e 100644 --- a/src/host/trxcon/sched_lchan_xcch.c +++ b/src/host/trxcon/sched_lchan_xcch.c @@ -94,8 +94,6 @@ (*first_fn) % ts->mf_layout->period, ts->mf_layout->period, lchan_desc->name); - - return -1; } /* Attempt to decode */ @@ -106,13 +104,18 @@ (*first_fn) % ts->mf_layout->period, ts->mf_layout->period, lchan_desc->name); + + /** +* We should anyway send dummy frame for +* proper measurement reporting... +*/ + return sched_send_dt_ind(trx, ts, lchan, NULL, 0, + n_errors, true, false); } /* Send a L2 frame to the higher layers */ - sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, - n_errors, rc != 0, false); - - return 0; + return sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, false, false); } int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts, -- To view, visit https://gerrit.osmocom.org/7215 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC confirmation API
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon: clean up DATA / TRAFFIC confirmation API .. trxcon: clean up DATA / TRAFFIC confirmation API - change 'l1ctl_tx_data_conf' symbol to 'l1ctl_tx_dt_conf' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA confirmation type; Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl.h M src/host/trxcon/sched_lchan_common.c 3 files changed, 12 insertions(+), 16 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 0bcd5d9..3702e8a 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -231,19 +231,19 @@ return l1ctl_link_send(l1l, msg); } -int l1ctl_tx_data_conf(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type) + +/** + * Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF. + */ +int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, + struct l1ctl_info_dl *data, bool traffic) { struct l1ctl_info_dl *dl; struct msgb *msg; size_t len; - if (msg_type != L1CTL_DATA_CONF && msg_type != L1CTL_TRAFFIC_CONF) { - LOGP(DL1D, LOGL_ERROR, "Incorrect confirmation type\n"); - return -EINVAL; - } - - msg = l1ctl_alloc_msg(msg_type); + msg = l1ctl_alloc_msg(traffic ? + L1CTL_TRAFFIC_CONF : L1CTL_DATA_CONF); if (msg == NULL) return -ENOMEM; diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h index 91a7f0f..290a0f5 100644 --- a/src/host/trxcon/l1ctl.h +++ b/src/host/trxcon/l1ctl.h @@ -20,6 +20,6 @@ int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, uint8_t msg_type); -int l1ctl_tx_data_conf(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type); +int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, + struct l1ctl_info_dl *data, bool traffic); int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn); diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 52c9a21..d946e57 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -129,7 +129,6 @@ { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl *data; - uint8_t conf_type; /* Allocate memory */ data = talloc_zero(ts, struct l1ctl_info_dl); @@ -145,11 +144,8 @@ data->band_arfcn = htons(trx->band_arfcn); data->frame_nr = htonl(fn); - /* Choose a confirmation type */ - conf_type = l2_len == GSM_MACBLOCK_LEN ? - L1CTL_DATA_CONF : L1CTL_TRAFFIC_CONF; - - l1ctl_tx_data_conf(trx->l1l, data, conf_type); + l1ctl_tx_dt_conf(trx->l1l, data, + l2_len != GSM_MACBLOCK_LEN); talloc_free(data); return 0; -- To view, visit https://gerrit.osmocom.org/7211 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC indication API
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon: clean up DATA / TRAFFIC indication API .. trxcon: clean up DATA / TRAFFIC indication API - change 'l1ctl_tx_data_ind' symbol to 'l1ctl_tx_dt_ind' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA indication type; - pass L2 payload and its length separately from the Downlink info header. Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl.h M src/host/trxcon/sched_lchan_common.c 3 files changed, 23 insertions(+), 27 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 3702e8a..3de0cf6 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -183,29 +183,30 @@ return l1ctl_link_send(l1l, msg); } -int l1ctl_tx_data_ind(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type) +/** + * Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND. + */ +int l1ctl_tx_dt_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, + uint8_t *l2, size_t l2_len, bool traffic) { struct l1ctl_info_dl *dl; struct msgb *msg; - size_t len; + uint8_t *msg_l2; - if (msg_type != L1CTL_DATA_IND && msg_type != L1CTL_TRAFFIC_IND) { - LOGP(DL1D, LOGL_ERROR, "Incorrect indication type\n"); - return -EINVAL; - } - - msg = l1ctl_alloc_msg(msg_type); + msg = l1ctl_alloc_msg(traffic ? + L1CTL_TRAFFIC_IND : L1CTL_DATA_IND); if (msg == NULL) return -ENOMEM; - /* We store the payload as a flexible array member */ - len = sizeof(struct l1ctl_info_dl); - len += msg_type == L1CTL_DATA_IND ? 23 : TRAFFIC_DATA_LEN; - dl = (struct l1ctl_info_dl *) msgb_put(msg, len); + /* Copy DL header */ + dl = (struct l1ctl_info_dl *) msgb_put(msg, sizeof(*dl)); + memcpy(dl, data, sizeof(*dl)); - /* Copy header and data from source message */ - memcpy(dl, data, len); + /* Copy the L2 payload if preset */ + if (l2 && l2_len > 0) { + msg_l2 = (uint8_t *) msgb_put(msg, l2_len); + memcpy(msg_l2, l2, l2_len); + } /* Put message to upper layers */ return l1ctl_link_send(l1l, msg); diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h index 290a0f5..ca8c0be 100644 --- a/src/host/trxcon/l1ctl.h +++ b/src/host/trxcon/l1ctl.h @@ -18,8 +18,8 @@ int l1ctl_tx_reset_conf(struct l1ctl_link *l1l, uint8_t type); int l1ctl_tx_reset_ind(struct l1ctl_link *l1l, uint8_t type); -int l1ctl_tx_data_ind(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type); +int l1ctl_tx_dt_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, + uint8_t *l2, size_t l2_len, bool traffic); int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, bool traffic); int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn); diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index d946e57..13c8764 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -90,7 +90,7 @@ struct l1ctl_info_dl *data; /* Allocate memory */ - data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl) + l2_len); + data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl)); if (data == NULL) return -ENOMEM; @@ -108,17 +108,12 @@ /* FIXME: set proper values */ data->snr = 0; - if (dec_failed) { - /* Mark frame as broken */ - data->fire_crc = 2; - } else { - /* Fill in the payload */ - memcpy(data->payload, l2, l2_len); - } + /* Mark frame as broken if so */ + data->fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_data_ind(trx->l1l, data, l2_len == GSM_MACBLOCK_LEN ? - L1CTL_DATA_IND : L1CTL_TRAFFIC_IND); + l1ctl_tx_dt_ind(trx->l1l, data, l2, l2_len, + l2_len != GSM_MACBLOCK_LEN); talloc_free(data); return 0; -- To view, visit https://gerrit.osmocom.org/7212 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon/scheduler: enforce lchan handlers to set message type
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon/scheduler: enforce lchan handlers to set message type .. trxcon/scheduler: enforce lchan handlers to set message type Since this change, each lchan handler shall manually indicate a type of both message indications and confirmations. Change-Id: I02e0b87d61c127d2f6f5b9532909af78332bf707 --- M src/host/trxcon/sched_lchan_common.c M src/host/trxcon/sched_lchan_tchf.c M src/host/trxcon/sched_lchan_xcch.c M src/host/trxcon/sched_trx.h 4 files changed, 18 insertions(+), 21 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 1858619..47b0162 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -82,9 +82,9 @@ }, }; -int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts, +int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, - bool dec_failed, int bit_error_count) + int bit_error_count, bool dec_failed, bool traffic) { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl dl_hdr; @@ -107,14 +107,13 @@ dl_hdr.fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, - l2_len != GSM_MACBLOCK_LEN); + l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, traffic); return 0; } -int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts, - struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len) +int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts, + struct trx_lchan_state *lchan, uint32_t fn, bool traffic) { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl dl_hdr; @@ -131,8 +130,7 @@ dl_hdr.band_arfcn = htons(trx->band_arfcn); dl_hdr.frame_nr = htonl(fn); - l1ctl_tx_dt_conf(trx->l1l, _hdr, - l2_len != GSM_MACBLOCK_LEN); + l1ctl_tx_dt_conf(trx->l1l, _hdr, traffic); return 0; } diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c index b023126..25c9b10 100644 --- a/src/host/trxcon/sched_lchan_tchf.c +++ b/src/host/trxcon/sched_lchan_tchf.c @@ -147,8 +147,8 @@ l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); } else if (rc == GSM_MACBLOCK_LEN) { /* FACCH received, forward it to the higher layers */ - sched_send_data_ind(trx, ts, lchan, - l2, GSM_MACBLOCK_LEN, false, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, false, false); /* Send BFI instead of stolen TCH frame */ l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); @@ -159,8 +159,8 @@ /* Send a traffic frame to the higher layers */ if (l2_len > 0) - sched_send_data_ind(trx, ts, lchan, - l2, l2_len, false, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, rc < 4, true); return 0; } @@ -273,8 +273,7 @@ /* If we have sent the last (4/4) burst */ if (*mask == 0x0f) { /* Confirm data / traffic sending */ - sched_send_data_conf(trx, ts, lchan, fn, - lchan->prim->payload_len); + sched_send_dt_conf(trx, ts, lchan, fn, PRIM_IS_TCH(lchan->prim)); /* Forget processed primitive */ sched_prim_drop(lchan); diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c index b2cbd22..f351674 100644 --- a/src/host/trxcon/sched_lchan_xcch.c +++ b/src/host/trxcon/sched_lchan_xcch.c @@ -109,8 +109,8 @@ } /* Send a L2 frame to the higher layers */ - sched_send_data_ind(trx, ts, lchan, - l2, GSM_MACBLOCK_LEN, rc != 0, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, rc != 0, false); return 0; } @@ -190,7 +190,7 @@ *mask = 0x00; /* Confirm data sending */ - sched_send_data_conf(trx, ts, lchan, fn, GSM_MACBLOCK_LEN); + sched_send_dt_conf(trx, ts, lchan, fn, false); } return 0; diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index d9e0c8e..80b8dd2 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -312,8 +312,8 @@ extern const uint8_t sched_nb_training_bits[8][26]; size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode); -int sched_send_data_ind(struct trx_instance
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_common.c: use static memory allocation
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon/sched_lchan_common.c: use static memory allocation .. trxcon/sched_lchan_common.c: use static memory allocation There is no need to allocate the DL header for each new message. Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd --- M src/host/trxcon/sched_lchan_common.c 1 file changed, 20 insertions(+), 29 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 13c8764..1858619 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -87,34 +87,28 @@ bool dec_failed, int bit_error_count) { const struct trx_lchan_desc *lchan_desc; - struct l1ctl_info_dl *data; - - /* Allocate memory */ - data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl)); - if (data == NULL) - return -ENOMEM; + struct l1ctl_info_dl dl_hdr; /* Set up pointers */ lchan_desc = _lchan_desc[lchan->type]; /* Fill in known downlink info */ - data->chan_nr = lchan_desc->chan_nr | ts->index; - data->link_id = lchan_desc->link_id; - data->band_arfcn = htons(trx->band_arfcn); - data->frame_nr = htonl(lchan->rx_first_fn); - data->rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num); - data->num_biterr = bit_error_count; + dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index; + dl_hdr.link_id = lchan_desc->link_id; + dl_hdr.band_arfcn = htons(trx->band_arfcn); + dl_hdr.frame_nr = htonl(lchan->rx_first_fn); + dl_hdr.rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num); + dl_hdr.num_biterr = bit_error_count; /* FIXME: set proper values */ - data->snr = 0; + dl_hdr.snr = 0; /* Mark frame as broken if so */ - data->fire_crc = dec_failed ? 2 : 0; + dl_hdr.fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_dt_ind(trx->l1l, data, l2, l2_len, + l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, l2_len != GSM_MACBLOCK_LEN); - talloc_free(data); return 0; } @@ -123,25 +117,22 @@ struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len) { const struct trx_lchan_desc *lchan_desc; - struct l1ctl_info_dl *data; - - /* Allocate memory */ - data = talloc_zero(ts, struct l1ctl_info_dl); - if (data == NULL) - return -ENOMEM; + struct l1ctl_info_dl dl_hdr; /* Set up pointers */ lchan_desc = _lchan_desc[lchan->type]; - /* Fill in known downlink info */ - data->chan_nr = lchan_desc->chan_nr | ts->index; - data->link_id = lchan_desc->link_id; - data->band_arfcn = htons(trx->band_arfcn); - data->frame_nr = htonl(fn); + /* Zero-initialize DL header, because we don't set all fields */ + memset(_hdr, 0x00, sizeof(struct l1ctl_info_dl)); - l1ctl_tx_dt_conf(trx->l1l, data, + /* Fill in known downlink info */ + dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index; + dl_hdr.link_id = lchan_desc->link_id; + dl_hdr.band_arfcn = htons(trx->band_arfcn); + dl_hdr.frame_nr = htonl(fn); + + l1ctl_tx_dt_conf(trx->l1l, _hdr, l2_len != GSM_MACBLOCK_LEN); - talloc_free(data); return 0; } -- To view, visit https://gerrit.osmocom.org/7213 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers
Vadim Yanitskiy has submitted this change and it was merged. Change subject: trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers .. trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers Both functions are almost identical, and the only difference is the message type they set. Let's combine them into a single function and introduce a 'traffic' flag, which can be used to define a message type. Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7 --- M src/host/trxcon/l1ctl.c 1 file changed, 17 insertions(+), 45 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index f138b88..0bcd5d9 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -606,25 +606,35 @@ return 0; } -static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg) +/** + * Handles both L1CTL_DATA_REQ and L1CTL_TRAFFIC_REQ. + */ +static int l1ctl_rx_dt_req(struct l1ctl_link *l1l, + struct msgb *msg, bool traffic) { struct l1ctl_info_ul *ul; struct trx_ts_prim *prim; uint8_t chan_nr, link_id; + size_t payload_len; int rc; /* Extract UL frame header */ ul = (struct l1ctl_info_ul *) msg->l1h; + /* Calculate the payload len */ + msg->l2h = ul->payload; + payload_len = msgb_l2len(msg); + /* Obtain channel description */ chan_nr = ul->chan_nr; link_id = ul->link_id & 0x40; - LOGP(DL1D, LOGL_DEBUG, "Recv Data Req (chan_nr=0x%02x, " - "link_id=0x%02x)\n", chan_nr, link_id); + LOGP(DL1D, LOGL_DEBUG, "Recv %s Req (chan_nr=0x%02x, " + "link_id=0x%02x, len=%zu)\n", traffic ? "TRAFFIC" : "DATA", + chan_nr, link_id, payload_len); /* Init a new primitive */ - rc = sched_prim_init(l1l->trx, , 23, + rc = sched_prim_init(l1l->trx, , payload_len, chan_nr, link_id); if (rc) goto exit; @@ -637,45 +647,7 @@ } /* Fill in the payload */ - memcpy(prim->payload, ul->payload, 23); - -exit: - msgb_free(msg); - return rc; -} - -static int l1ctl_rx_traffic_req(struct l1ctl_link *l1l, struct msgb *msg) -{ - struct l1ctl_info_ul *ul; - struct trx_ts_prim *prim; - uint8_t chan_nr, link_id; - int rc; - - /* Extract UL frame header */ - ul = (struct l1ctl_info_ul *) msg->l1h; - - /* Obtain channel description */ - chan_nr = ul->chan_nr; - link_id = ul->link_id & 0x40; - - LOGP(DL1D, LOGL_DEBUG, "Recv Traffic Req (chan_nr=0x%02x, " - "link_id=0x%02x)\n", chan_nr, link_id); - - /* Init a new primitive */ - rc = sched_prim_init(l1l->trx, , TRAFFIC_DATA_LEN, - chan_nr, link_id); - if (rc) - goto exit; - - /* Push this primitive to transmit queue */ - rc = sched_prim_push(l1l->trx, prim, chan_nr); - if (rc) { - talloc_free(prim); - goto exit; - } - - /* Fill in the payload */ - memcpy(prim->payload, ul->payload, TRAFFIC_DATA_LEN); + memcpy(prim->payload, ul->payload, payload_len); exit: msgb_free(msg); @@ -811,9 +783,9 @@ case L1CTL_DM_REL_REQ: return l1ctl_rx_dm_rel_req(l1l, msg); case L1CTL_DATA_REQ: - return l1ctl_rx_data_req(l1l, msg); + return l1ctl_rx_dt_req(l1l, msg, false); case L1CTL_TRAFFIC_REQ: - return l1ctl_rx_traffic_req(l1l, msg); + return l1ctl_rx_dt_req(l1l, msg, true); case L1CTL_PARAM_REQ: return l1ctl_rx_param_req(l1l, msg); case L1CTL_TCH_MODE_REQ: -- To view, visit https://gerrit.osmocom.org/7210 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy
[MERGED] osmocom-bb[fixeria/trx]: trxcon: clarify L1CTL message length field
Harald Welte has submitted this change and it was merged. Change subject: trxcon: clarify L1CTL message length field .. trxcon: clarify L1CTL message length field Each L1CTL message gets its own length pushed in front before sending. This isn't specified in the 'l1ctl_proto.h', but assumed in the code. Let's clarify this. Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl_link.c M src/host/trxcon/l1ctl_link.h 3 files changed, 19 insertions(+), 5 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 58b8a4f..f138b88 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -49,8 +49,14 @@ static struct msgb *l1ctl_alloc_msg(uint8_t msg_type) { struct l1ctl_hdr *l1h; - struct msgb *msg = msgb_alloc_headroom(256, 4, "l1ctl_tx_msg"); + struct msgb *msg; + /** +* Each L1CTL message gets its own length pushed in front +* before sending. This is why we need this small headroom. +*/ + msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_MSG_LEN_FIELD, + L1CTL_MSG_LEN_FIELD, "l1ctl_tx_msg"); if (!msg) { LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n"); return NULL; diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index a7277ea..0fa3efe 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -84,8 +84,8 @@ } /* Attempt to read from socket */ - rc = read(bfd->fd, , sizeof(len)); - if (rc < sizeof(len)) { + rc = read(bfd->fd, , L1CTL_MSG_LEN_FIELD); + if (rc < L1CTL_MSG_LEN_FIELD) { LOGP(DL1D, LOGL_NOTICE, "L1CTL has lost connection\n"); msgb_free(msg); if (rc >= 0) @@ -198,8 +198,8 @@ LOGP(DL1D, LOGL_INFO, "Message L1 header != Message Data\n"); /* Prepend 16-bit length before sending */ - len = (uint16_t *) msgb_push(msg, sizeof(*len)); - *len = htons(msg->len - sizeof(*len)); + len = (uint16_t *) msgb_push(msg, L1CTL_MSG_LEN_FIELD); + *len = htons(msg->len - L1CTL_MSG_LEN_FIELD); if (osmo_wqueue_enqueue(>wq, msg) != 0) { LOGP(DL1D, LOGL_ERROR, "Failed to enqueue msg!\n"); diff --git a/src/host/trxcon/l1ctl_link.h b/src/host/trxcon/l1ctl_link.h index f9d91f1..01103dc 100644 --- a/src/host/trxcon/l1ctl_link.h +++ b/src/host/trxcon/l1ctl_link.h @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include @@ -9,6 +11,12 @@ #define L1CTL_LENGTH 256 #define L1CTL_HEADROOM 32 +/** + * Each L1CTL message gets its own length pushed + * as two bytes in front before sending. + */ +#define L1CTL_MSG_LEN_FIELD 2 + /* Forward declaration to avoid mutual include */ struct trx_instance; -- To view, visit https://gerrit.osmocom.org/7208 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmocom-bb[fixeria/trx]: trxcon: use meaningful names for L1CTL messages
Harald Welte has submitted this change and it was merged. Change subject: trxcon: use meaningful names for L1CTL messages .. trxcon: use meaningful names for L1CTL messages There are two types of L1CTL messages: received and to be transmitted. Let's use proper names to indicate this. Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl_link.c 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index dd75af9..58b8a4f 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -49,7 +49,7 @@ static struct msgb *l1ctl_alloc_msg(uint8_t msg_type) { struct l1ctl_hdr *l1h; - struct msgb *msg = msgb_alloc_headroom(256, 4, "osmo_l1"); + struct msgb *msg = msgb_alloc_headroom(256, 4, "l1ctl_tx_msg"); if (!msg) { LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n"); diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index 596a9d1..a7277ea 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -77,7 +77,7 @@ /* Allocate a new msg */ msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, - L1CTL_HEADROOM, "L1CTL"); + L1CTL_HEADROOM, "l1ctl_rx_msg"); if (!msg) { LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); return -ENOMEM; -- To view, visit https://gerrit.osmocom.org/7207 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
osmocom-bb[fixeria/trx]: trxcon: clarify L1CTL message length field
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7208 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/l1ctl_link.c: allocate msgb after its length is read
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7209 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[MERGED] osmocom-bb[fixeria/trx]: trxcon/l1ctl_link.c: allocate msgb after its length is read
Harald Welte has submitted this change and it was merged. Change subject: trxcon/l1ctl_link.c: allocate msgb after its length is read .. trxcon/l1ctl_link.c: allocate msgb after its length is read Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061 --- M src/host/trxcon/l1ctl_link.c 1 file changed, 8 insertions(+), 10 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index 0fa3efe..20cb70c 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -75,19 +75,10 @@ uint16_t len; int rc; - /* Allocate a new msg */ - msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, - L1CTL_HEADROOM, "l1ctl_rx_msg"); - if (!msg) { - LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); - return -ENOMEM; - } - /* Attempt to read from socket */ rc = read(bfd->fd, , L1CTL_MSG_LEN_FIELD); if (rc < L1CTL_MSG_LEN_FIELD) { LOGP(DL1D, LOGL_NOTICE, "L1CTL has lost connection\n"); - msgb_free(msg); if (rc >= 0) rc = -EIO; l1ctl_link_close_conn(l1l); @@ -98,10 +89,17 @@ len = ntohs(len); if (len > L1CTL_LENGTH) { LOGP(DL1D, LOGL_ERROR, "Length is too big: %u\n", len); - msgb_free(msg); return -EINVAL; } + /* Allocate a new msg */ + msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, + L1CTL_HEADROOM, "l1ctl_rx_msg"); + if (!msg) { + LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); + return -ENOMEM; + } + msg->l1h = msgb_put(msg, len); rc = read(bfd->fd, msg->l1h, msgb_l1len(msg)); if (rc != len) { -- To view, visit https://gerrit.osmocom.org/7209 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
osmocom-bb[fixeria/trx]: trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7210 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC confirmation API
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7211 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC indication API
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7212 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_lchan_common.c: use static memory allocation
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7213 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/scheduler: enforce lchan handlers to set message type
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7214 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I02e0b87d61c127d2f6f5b9532909af78332bf707 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_lchan_xcch.c: always send data indications
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7215 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_lchan_tchf.c: always send traffic indications
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I99e134699796c7075299459e96b2f2d462636619 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon: use meaningful names for L1CTL messages
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7207 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[MERGED] osmo-ci[master]: osmocom-latest-packages.sh: Catch latest tags outside master...
Harald Welte has submitted this change and it was merged. Change subject: osmocom-latest-packages.sh: Catch latest tags outside master branch .. osmocom-latest-packages.sh: Catch latest tags outside master branch Some projects, like osmo-trx, may have tags created in a non-master branch. Let's catch those too. Tested with several osmocom repositories. The ones showing different behaviour are osmo-trx (expected) and other repositories which have wrong or no tags and are anyway not used since there's no OBS build for them. Old cmdline is left of ==, new is right: artwork: ( == ) asn1c: ( == ) docker-playground: (debian-jessie-buildslave-0.1.0 == ) layer1-api: (superfemto_v3.8.1 == ) libasn1c: (0.9.28 == 0.9.28) libgtpnl: (1.1.0 == 1.1.0) libosmo-abis: (0.4.0 == 0.4.0) libosmocore: (0.10.2 == 0.10.2) libosmo-netif: (0.1.1 == 0.1.1) libosmo-sccp: (0.8.1 == 0.8.1) libsmpp34: (1.12.0 == 1.12.0) meta-telephony: ( == ) mncc-python: ( == ) octphy-2g-headers: (OCTSDR-OPENBSC-02.09.00-B1121 == ) openbsc: (1.0.0 == 1.0.0) osmo-bsc: (1.1.2 == 1.1.2) osmo-bts: (0.7.0 == 0.7.0) osmo-ci: ( == ) osmocom-bb: (osmocon_v0.0.0 == ) osmo-ggsn: (1.1.0 == 1.1.0) osmo-gsm-manuals: ( == v1) osmo-gsm-tester: ( == 0.1) osmo-gsm-tester-conf: ( == ) osmo-gsm-tester-sysmocom: ( == ) osmo-hlr: (0.1.0 == 0.1.0) osmo-iuh: (0.2.0 == 0.2.0) osmo-mgw: (1.2.0 == 1.2.0) osmo-msc: (1.1.2 == 1.1.2) osmo-pcu: (0.4.0 == 0.4.0) osmo-python-tests: ( == ) osmo-sgsn: (1.2.0 == 1.2.0) osmo-sip-connector: (1.1.0 == 1.1.0) osmo-trx: (0.2.0 == 0.3.0) pysim: ( == ) python-smpplib: ( == ) Change-Id: I3b521a194f0ae9fdfa358423e66f30c1316c23e8 --- M scripts/osmocom-latest-packages.sh 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved; Verified diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh index 8fe074c..4783185 100755 --- a/scripts/osmocom-latest-packages.sh +++ b/scripts/osmocom-latest-packages.sh @@ -32,7 +32,7 @@ [ -d "$1" ] || git clone "git://git.osmocom.org/$1" cd "$1" git fetch - VER=$(git describe --abbrev=0 --tags --match "*.*.*" origin/master) + VER=$(git tag -l --sort=v:refname | grep "^[0-9]*.[0-9]*.[0-9]*$" | tail -n 1) git checkout -f -B "$VER" "refs/tags/$VER" gbp buildpackage -d -S -uc -us "--git-export-dir=$output" "--git-debian-branch=$VER" -- To view, visit https://gerrit.osmocom.org/7145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3b521a194f0ae9fdfa358423e66f30c1316c23e8 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Harald Welte
[MERGED] osmocom-bb[fixeria/trx]: trxcon/scheduler: introduce a new CBTX lchan flag
Harald Welte has submitted this change and it was merged. Change subject: trxcon/scheduler: introduce a new CBTX lchan flag .. trxcon/scheduler: introduce a new CBTX lchan flag This new flag is intended to indicate that continuous burst transmission is assumed on particular logical channel. In other words, if a logical channel has this flag, but there is nothing to transmit in a TX buffer, then either a dummy LAPDm frame or a silence frame shall be sent. Change-Id: I25fcf9eeb787ffe5378d92532439e67d7d42fa65 --- M src/host/trxcon/sched_lchan_desc.c M src/host/trxcon/sched_trx.h 2 files changed, 32 insertions(+), 30 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_lchan_desc.c b/src/host/trxcon/sched_lchan_desc.c index e0617a5..e94a208 100644 --- a/src/host/trxcon/sched_lchan_desc.c +++ b/src/host/trxcon/sched_lchan_desc.c @@ -109,181 +109,181 @@ { TRXC_TCHF, "TCH/F", 0x08, LID_DEDIC, - 8 * GSM_BURST_PL_LEN, 0x00, + 8 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_tchf_fn, tx_tchf_fn, }, { TRXC_TCHH_0,"TCH/H(0)", 0x10, LID_DEDIC, - 6 * GSM_BURST_PL_LEN, 0x00, + 6 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_tchh_fn, tx_tchh_fn, }, { TRXC_TCHH_1,"TCH/H(1)", 0x18, LID_DEDIC, - 6 * GSM_BURST_PL_LEN, 0x00, + 6 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_tchh_fn, tx_tchh_fn, }, { TRXC_SDCCH4_0, "SDCCH/4(0)", 0x20, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH4_1, "SDCCH/4(1)", 0x28, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH4_2, "SDCCH/4(2)", 0x30, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH4_3, "SDCCH/4(3)", 0x38, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_0, "SDCCH/8(0)", 0x40, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_1, "SDCCH/8(1)", 0x48, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_2, "SDCCH/8(2)", 0x50, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_3, "SDCCH/8(3)", 0x58, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_4, "SDCCH/8(4)", 0x60, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_5, "SDCCH/8(5)", 0x68, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_6, "SDCCH/8(6)", 0x70, LID_DEDIC, - 4 * GSM_BURST_PL_LEN, 0x00, + 4 * GSM_BURST_PL_LEN, TRX_CH_FLAG_CBTX, rx_data_fn, tx_data_fn, }, { TRXC_SDCCH8_7,
[MERGED] osmocom-bb[fixeria/trx]: trxcon/configure.ac: add --enable-sanitize option
Harald Welte has submitted this change and it was merged. Change subject: trxcon/configure.ac: add --enable-sanitize option .. trxcon/configure.ac: add --enable-sanitize option Change-Id: I099de726f9d67213c56d996039b4207f80a727c6 --- M src/host/trxcon/configure.ac 1 file changed, 11 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/configure.ac b/src/host/trxcon/configure.ac index a94859b..1f24260 100644 --- a/src/host/trxcon/configure.ac +++ b/src/host/trxcon/configure.ac @@ -18,6 +18,17 @@ dnl checks for header files AC_HEADER_STDC +AC_ARG_ENABLE(sanitize, + [AS_HELP_STRING( + [--enable-sanitize], + [Compile with address sanitizer enabled], + )], [sanitize=$enableval], [sanitize="no"]) +if test x"$sanitize" = x"yes" +then + CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" + CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" +fi + dnl Checks for typedefs, structures and compiler characteristics AC_OUTPUT( -- To view, visit https://gerrit.osmocom.org/7201 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I099de726f9d67213c56d996039b4207f80a727c6 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_trx.c: fix: omit inactive logical channels
Harald Welte has submitted this change and it was merged. Change subject: trxcon/sched_trx.c: fix: omit inactive logical channels .. trxcon/sched_trx.c: fix: omit inactive logical channels The sched_frame_clck_cb() is responsible for UL burst transmission. Iterating over each timeslot, it chooses a proper lchan handler according to a current frame number and a multiframe layout in use, takes a L2 UL frame from a TX buffer, and finally calls the chosen handler in order to to encode and transmit a taken frame. A handler should be called only for activated logical channels... but for some long time, there was a bug, so each lchan was processed, including inactive ones. It's time to fix this. Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9 --- M src/host/trxcon/sched_trx.c 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index 1197f2c..8c859de 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -86,6 +86,10 @@ if (lchan == NULL) continue; + /* Omit inactive lchans */ + if (!lchan->active) + continue; + /** * If we aren't processing any primitive yet, * attempt to obtain a new one from queue -- To view, visit https://gerrit.osmocom.org/7203 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_trx.c: fix: properly deallocate lchans
Harald Welte has submitted this change and it was merged. Change subject: trxcon/sched_trx.c: fix: properly deallocate lchans .. trxcon/sched_trx.c: fix: properly deallocate lchans The llist_for_each_entry_safe() should be used instead of the llist_for_each_entry(), because it's safe against removal of llist entry. Found using Valgrind's memcheck tool. Change-Id: I65234971ec152df038c5388da537a503060c215b --- M src/host/trxcon/sched_trx.c 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index 9ae5a8f..1197f2c 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -185,7 +185,7 @@ void sched_trx_del_ts(struct trx_instance *trx, int tn) { - struct trx_lchan_state *lchan; + struct trx_lchan_state *lchan, *lchan_next; struct trx_ts *ts; /* Find ts in list */ @@ -199,8 +199,10 @@ sched_trx_deactivate_all_lchans(ts); /* Free channel states */ - llist_for_each_entry(lchan, >lchans, list) + llist_for_each_entry_safe(lchan, lchan_next, >lchans, list) { + llist_del(>list); talloc_free(lchan); + } /* Flush queue primitives for TX */ sched_prim_flush_queue(>tx_prims); -- To view, visit https://gerrit.osmocom.org/7202 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I65234971ec152df038c5388da537a503060c215b Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
[MERGED] osmocom-bb[fixeria/trx]: trxcon/sched_trx.h: clarify lchan flags meaning
Harald Welte has submitted this change and it was merged. Change subject: trxcon/sched_trx.h: clarify lchan flags meaning .. trxcon/sched_trx.h: clarify lchan flags meaning Change-Id: I51b663dd16e46a4523488c3d3000922a7c3640d1 --- M src/host/trxcon/sched_trx.h 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index 856566c..78f458d 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -17,11 +17,13 @@ #define GPRS_BURST_LEN GSM_BURST_LEN #define EDGE_BURST_LEN 444 +/* Is a channel related to PDCH (GPRS) */ #define TRX_CH_FLAG_PDCH (1 << 0) +/* Should a channel be activated automatically */ #define TRX_CH_FLAG_AUTO (1 << 1) -#define TRX_TS_COUNT 8 #define MAX_A5_KEY_LEN (128 / 8) +#define TRX_TS_COUNT 8 /* Forward declaration to avoid mutual include */ struct trx_lchan_state; -- To view, visit https://gerrit.osmocom.org/7204 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I51b663dd16e46a4523488c3d3000922a7c3640d1 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder
osmocom-bb[fixeria/trx]: trxcon/scheduler: introduce a new CBTX lchan flag
Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7205 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I25fcf9eeb787ffe5378d92532439e67d7d42fa65 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_trx.h: clarify lchan flags meaning
Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7204 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I51b663dd16e46a4523488c3d3000922a7c3640d1 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/scheduler: transmit dummy frames on CBTX lchans
Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7206 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie590990f2274ea476678f6b2079f90eeadab6501 Gerrit-PatchSet: 3 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_trx.c: fix: omit inactive logical channels
Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7203 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/sched_trx.c: fix: properly deallocate lchans
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7202 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I65234971ec152df038c5388da537a503060c215b Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmocom-bb[fixeria/trx]: trxcon/configure.ac: add --enable-sanitize option
Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7201 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I099de726f9d67213c56d996039b4207f80a727c6 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[MERGED] osmo-bts[master]: implement support for 3-digit MNC with leading zeros
Harald Welte has submitted this change and it was merged. Change subject: implement support for 3-digit MNC with leading zeros .. implement support for 3-digit MNC with leading zeros Record the mnc_3_digits flag from SI and pass on via the PCU interface. Instead of changing to e.g. osmo_plmn_id, add the flag separately, and instead of bool use a uint8_t, to not raise any struct packing issues and clarify the flag's size beyond any doubt. Bump the PCU interface version to 9. This is one part of the three identical pcuif_proto.h patches: - I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts) - I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu) - I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc) Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore) Change-Id: I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 --- M include/osmo-bts/gsm_data.h M include/osmo-bts/pcuif_proto.h M src/common/pcu_sock.c 3 files changed, 11 insertions(+), 13 deletions(-) Approvals: Neels Hofmeyr: Verified Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h index 10c9d04..1652104 100644 --- a/include/osmo-bts/gsm_data.h +++ b/include/osmo-bts/gsm_data.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ struct gsm_network { struct llist_head bts_list; unsigned int num_bts; - uint16_t mcc, mnc; + struct osmo_plmn_id plmn; struct pcu_sock_state *pcu_state; }; diff --git a/include/osmo-bts/pcuif_proto.h b/include/osmo-bts/pcuif_proto.h index 00b7bd5..b06077c 100644 --- a/include/osmo-bts/pcuif_proto.h +++ b/include/osmo-bts/pcuif_proto.h @@ -5,7 +5,7 @@ #define PCU_SOCK_DEFAULT "/tmp/pcu_bts" -#define PCU_IF_VERSION 0x08 +#define PCU_IF_VERSION 0x09 #define TXT_MAX_LEN128 /* msg_type */ @@ -122,7 +122,9 @@ struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */ uint8_t bsic; /* RAI */ - uint16_tmcc, mnc, lac, rac; + uint16_tmcc, mnc; + uint8_t mnc_3_digits; + uint16_tlac, rac; /* NSE */ uint16_tnsei; uint8_t nse_timer[7]; diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c index 0f4c053..949a5fa 100644 --- a/src/common/pcu_sock.c +++ b/src/common/pcu_sock.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -143,8 +144,9 @@ info_ind->flags |= PCU_IF_FLAG_SYSMO; /* RAI */ - info_ind->mcc = net->mcc; - info_ind->mnc = net->mnc; + info_ind->mcc = net->plmn.mcc; + info_ind->mnc = net->plmn.mnc; + info_ind->mnc_3_digits = net->plmn.mnc_3_digits; info_ind->lac = bts->location_area_code; info_ind->rac = bts->gprs.rac; @@ -254,14 +256,7 @@ break; si3 = (struct gsm48_system_information_type_3 *) bts->si_buf[SYSINFO_TYPE_3]; - net->mcc = ((si3->lai.digits[0] & 0x0f) << 8) - | (si3->lai.digits[0] & 0xf0) - | (si3->lai.digits[1] & 0x0f); - net->mnc = ((si3->lai.digits[2] & 0x0f) << 8) - | (si3->lai.digits[2] & 0xf0) - | ((si3->lai.digits[1] & 0xf0) >> 4); - if ((net->mnc & 0x00f) == 0x00f) - net->mnc >>= 4; + osmo_plmn_from_bcd(si3->lai.digits, >plmn); bts->location_area_code = ntohs(si3->lai.lac); bts->cell_identity = si3->cell_identity; avail_lai = 1; -- To view, visit https://gerrit.osmocom.org/6665 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[MERGED] osmo-bsc[master]: pcu_if: implement support for 3-digit MNC
Harald Welte has submitted this change and it was merged. Change subject: pcu_if: implement support for 3-digit MNC .. pcu_if: implement support for 3-digit MNC Add the mnc_3_digits member to the info_ind. Instead of changing to e.g. osmo_plmn_id, add the flag separately, and instead of bool use a uint8_t, to not raise any struct packing issues and clarify the flag's size beyond any doubt. Bump the PCU interface version to 9. This is one part of the three identical pcuif_proto.h patches: - I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 (osmo-bts) - I787fed84a7b613158a5618dd5cffafe4e4927234 (osmo-pcu) - I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 (osmo-bsc) Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore) Change-Id: I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 --- M include/osmocom/bsc/pcuif_proto.h M src/libbsc/pcu_sock.c 2 files changed, 5 insertions(+), 3 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/bsc/pcuif_proto.h b/include/osmocom/bsc/pcuif_proto.h index ced783e..b9f61b6 100644 --- a/include/osmocom/bsc/pcuif_proto.h +++ b/include/osmocom/bsc/pcuif_proto.h @@ -3,7 +3,7 @@ #include -#define PCU_IF_VERSION 0x08 +#define PCU_IF_VERSION 0x09 #define TXT_MAX_LEN128 /* msg_type */ @@ -120,7 +120,9 @@ struct gsm_pcu_if_info_trx trx[8]; /* TRX infos per BTS */ uint8_t bsic; /* RAI */ - uint16_tmcc, mnc, lac, rac; + uint16_tmcc, mnc; + uint8_t mnc_3_digits; + uint16_tlac, rac; /* NSE */ uint16_tnsei; uint8_t nse_timer[7]; diff --git a/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c index 85af598..caec40d 100644 --- a/src/libbsc/pcu_sock.c +++ b/src/libbsc/pcu_sock.c @@ -154,7 +154,7 @@ /* RAI */ info_ind->mcc = bts->network->plmn.mcc; info_ind->mnc = bts->network->plmn.mnc; - /* TODO: plmn.mnc_3_digits */ + info_ind->mnc_3_digits = bts->network->plmn.mnc_3_digits; info_ind->lac = bts->location_area_code; info_ind->rac = bts->gprs.rac; -- To view, visit https://gerrit.osmocom.org/6669 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
osmo-bsc[master]: pcu_if: implement support for 3-digit MNC
Patch Set 8: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6669 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 Gerrit-PatchSet: 8 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
osmo-pcu[master]: implement support for 3-digit MNC with leading zeros
Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/ To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I787fed84a7b613158a5618dd5cffafe4e4927234 Gerrit-PatchSet: 3 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
osmo-bts[master]: implement support for 3-digit MNC with leading zeros
Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6665 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I49cd762c3c9d7ee6a82451bdf3ffa2a060767947 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
[MERGED] osmo-msc[master]: cosmetic: vlr_auth_fsm: clarify decision on UMTS AKA or GSM AKA
Harald Welte has submitted this change and it was merged. Change subject: cosmetic: vlr_auth_fsm: clarify decision on UMTS AKA or GSM AKA .. cosmetic: vlr_auth_fsm: clarify decision on UMTS AKA or GSM AKA The code deciding on whether UMTS AKA is used was cascaded and convoluted. By flattening the decisions, they become easier to read and possibly catch more weird corner cases / log information more clearly. - First decide what AKA the RES length reflects. - Then decide whether all prerequisites for UMTS AKA are satisfied. - Finally, on UTRAN, turn down the auth if we don't have UMTS AKA, and neatly log all of the potential causes. One corner case that should never occur is that the UMTS AKA RES length is actually the same length as the GSM AKA SRES. If this nevertheless occurs, log this as an error, though not turning down authentication because of it. (The effect is that we would favor UMTS AKA when it has a res_len == sizeof(sres) and would not succeed to GSM AKA. At least the log will tell us why, now.) Adjust an expected test output, trivial logging difference. Change-Id: I43f7f301ea85e518bac91f707391a53182e54fab --- M src/libvlr/vlr_auth_fsm.c M tests/msc_vlr/msc_vlr_test_gsm_authen.err M tests/msc_vlr/msc_vlr_test_umts_authen.err 3 files changed, 48 insertions(+), 25 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c index 51e22c9..0d0df11 100644 --- a/src/libvlr/vlr_auth_fsm.c +++ b/src/libvlr/vlr_auth_fsm.c @@ -136,34 +136,57 @@ struct gsm_auth_tuple *at = vsub->last_tuple; struct osmo_auth_vector *vec = >vec; bool check_umts; + bool res_is_umts_aka; OSMO_ASSERT(at); LOGVSUBP(LOGL_DEBUG, vsub, "received res: %s\n", osmo_hexdump(res, res_len)); /* RES must be present and at least 32bit */ - if (!res || res_len < sizeof(vec->sres)) { - LOGVSUBP(LOGL_NOTICE, vsub, "AUTH RES missing or too short " -"(%u)\n", res_len); + if (!res || !res_len) { + LOGVSUBP(LOGL_NOTICE, vsub, "AUTH SRES/RES missing\n"); goto out_false; } - check_umts = false; - if (is_r99 && (vec->auth_types & OSMO_AUTH_TYPE_UMTS)) { - check_umts = true; - /* We have a R99 capable UE and have a UMTS AKA capable USIM. -* However, the ME may still choose to only perform GSM AKA, as -* long as the bearer is GERAN */ - if (res_len != vec->res_len) { - if (is_utran) { - LOGVSUBP(LOGL_NOTICE, vsub, -"AUTH via UTRAN but " -"res_len(%u) != vec->res_len(%u)\n", -res_len, vec->res_len); - goto out_false; - } - check_umts = false; - } + /* We're deciding the UMTS AKA-ness of the response by the RES size. So let's make sure we can't +* mix them up by size. On UTRAN, we expect full length RES always, no way to mix up there. */ + if (!is_utran && vec->res_len == sizeof(vec->sres)) + LOGVSUBP(LOGL_ERROR, vsub, "Unforeseen situation: UMTS AKA's RES length" +" equals the size of SRES: %u -- this code wants to differentiate" +" the two by their size, which won't work properly now.\n", vec->res_len); + + /* RES must be either vec->res_len (UMTS AKA) or sizeof(sres) (GSM AKA) */ + if (res_len == vec->res_len) + res_is_umts_aka = true; + else if (res_len == sizeof(vec->sres)) + res_is_umts_aka = false; + else { + if (is_utran) + LOGVSUBP(LOGL_NOTICE, vsub, "AUTH RES has invalid length: %u." +" Expected %u (UMTS AKA)\n", +res_len, vec->res_len); + else + LOGVSUBP(LOGL_NOTICE, vsub, "AUTH SRES/RES has invalid length: %u." +" Expected either %zu (GSM AKA) or %u (UMTS AKA)\n", +res_len, sizeof(vec->sres), vec->res_len); + goto out_false; + } + + check_umts = (is_r99 + && (vec->auth_types & OSMO_AUTH_TYPE_UMTS) + && res_is_umts_aka); + + /* Even on an R99 capable MS with a UMTS AKA capable USIM, +* the MS may still choose to only perform GSM AKA, as +* long as the bearer is GERAN -- never on UTRAN: */ + if (is_utran && !check_umts) { + LOGVSUBP(LOGL_ERROR, vsub, +"AUTH via UTRAN, cannot allow GSM AKA" +
[MERGED] osmo-msc[master]: gsm48_rx_mm_auth_resp(): pass is_r99 from classmark, not res...
Harald Welte has submitted this change and it was merged. Change subject: gsm48_rx_mm_auth_resp(): pass is_r99 from classmark, not response size .. gsm48_rx_mm_auth_resp(): pass is_r99 from classmark, not response size Do not interpret the SRES/RES length returned in the auth response as the R99 capability bit, instead determine it from the actual Classmark information associated with the conn. This fixes the is_r99 flag passed in to vlr_subscr_rx_auth_resp(), which ends up in the struct vlr_auth_resp_par dispatched to the auth_fi and influences the authentication acceptance. Though the effect of a wrongly-set-to-false R99 flag is not harmful in this code path, let's not get this confused. Change-Id: Ib7f7d89a8b9455d2c022d53d74328fa7488577f4 --- M src/libmsc/gsm_04_08.c 1 file changed, 8 insertions(+), 10 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index ceef2d8..4564f8e 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -952,7 +952,7 @@ uint8_t res[16]; uint8_t res_len; int rc; - bool is_r99; + bool is_umts; if (!conn->vsub) { LOGP(DMM, LOGL_ERROR, @@ -961,30 +961,28 @@ return -EINVAL; } - if (msgb_l3len(msg) > - sizeof(struct gsm48_hdr) + sizeof(struct gsm48_auth_resp)) { + is_umts = (msgb_l3len(msg) > sizeof(struct gsm48_hdr) + sizeof(struct gsm48_auth_resp)); + + if (is_umts) rc = parse_umts_auth_resp(res, _len, conn, msg); - is_r99 = true; - } else { + else rc = parse_gsm_auth_resp(res, _len, conn, msg); - is_r99 = false; - } if (rc) { LOGP(DMM, LOGL_ERROR, "%s: MM AUTHENTICATION RESPONSE: invalid: parsing %s AKA Auth Response" " failed with rc=%d; dispatching zero length SRES/RES to trigger failure\n", -vlr_subscr_name(conn->vsub), is_r99 ? "UMTS" : "GSM", rc); +vlr_subscr_name(conn->vsub), is_umts ? "UMTS" : "GSM", rc); memset(res, 0, sizeof(res)); res_len = 0; } DEBUGP(DMM, "%s: MM %s AUTHENTICATION RESPONSE (%s = %s)\n", vlr_subscr_name(conn->vsub), - is_r99 ? "R99" : "GSM", is_r99 ? "res" : "sres", + is_umts ? "R99" : "GSM", is_umts ? "res" : "sres", osmo_hexdump_nospc(res, res_len)); - return vlr_subscr_rx_auth_resp(conn->vsub, is_r99, + return vlr_subscr_rx_auth_resp(conn->vsub, classmark_is_r99(>classmark), conn->via_ran == RAN_UTRAN_IU, res, res_len); } -- To view, visit https://gerrit.osmocom.org/7189 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib7f7d89a8b9455d2c022d53d74328fa7488577f4 Gerrit-PatchSet: 4 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr
[MERGED] osmo-msc[master]: cosmetic: vlr_auth_fsm: log RAN and size along with SRES/RES
Harald Welte has submitted this change and it was merged. Change subject: cosmetic: vlr_auth_fsm: log RAN and size along with SRES/RES .. cosmetic: vlr_auth_fsm: log RAN and size along with SRES/RES Change-Id: Ib0f9f573ffac2302fbd3ee28f48ccd8fce5fe286 --- M src/libvlr/vlr_auth_fsm.c M tests/msc_vlr/msc_vlr_test_authen_reuse.err M tests/msc_vlr/msc_vlr_test_call.err M tests/msc_vlr/msc_vlr_test_gsm_authen.err M tests/msc_vlr/msc_vlr_test_gsm_ciph.err M tests/msc_vlr/msc_vlr_test_hlr_reject.err M tests/msc_vlr/msc_vlr_test_ms_timeout.err M tests/msc_vlr/msc_vlr_test_umts_authen.err 8 files changed, 70 insertions(+), 68 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c index 0d0df11..224bc9f 100644 --- a/src/libvlr/vlr_auth_fsm.c +++ b/src/libvlr/vlr_auth_fsm.c @@ -139,8 +139,10 @@ bool res_is_umts_aka; OSMO_ASSERT(at); - LOGVSUBP(LOGL_DEBUG, vsub, "received res: %s\n", -osmo_hexdump(res, res_len)); + LOGVSUBP(LOGL_DEBUG, vsub, "AUTH on %s received %s: %s (%u bytes)\n", +is_utran ? "UTRAN" : "GERAN", +is_utran ? "RES" : "SRES/RES", +osmo_hexdump_nospc(res, res_len), res_len); /* RES must be present and at least 32bit */ if (!res || !res_len) { diff --git a/tests/msc_vlr/msc_vlr_test_authen_reuse.err b/tests/msc_vlr/msc_vlr_test_authen_reuse.err index 843e0d5..df91789 100644 --- a/tests/msc_vlr/msc_vlr_test_authen_reuse.err +++ b/tests/msc_vlr/msc_vlr_test_authen_reuse.err @@ -52,7 +52,7 @@ DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) DMM IMSI:90170010650: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP -DVLR SUBSCR(IMSI:90170010650) received res: e2 29 c1 9e 79 1f 2e 41 +DVLR SUBSCR(IMSI:90170010650) AUTH on GERAN received SRES/RES: e229c19e791f2e41 (8 bytes) DVLR SUBSCR(IMSI:90170010650) AUTH established UMTS security context DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Authentication terminating with result VLR_AUTH_RES_PASSED DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: state_chg to VLR_SUB_AS_AUTHENTICATED @@ -219,7 +219,7 @@ DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP -DVLR SUBSCR(MSISDN:42342) received res: e2 29 c1 9e 79 1f 2e 41 +DVLR SUBSCR(MSISDN:42342) AUTH on GERAN received SRES/RES: e229c19e791f2e41 (8 bytes) DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Authentication terminating with result VLR_AUTH_RES_PASSED DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: state_chg to VLR_SUB_AS_AUTHENTICATED @@ -340,7 +340,7 @@ DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = 7db47cf7f81e4dc7) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP -DVLR SUBSCR(MSISDN:42342) received res: 7d b4 7c f7 f8 1e 4d c7 +DVLR SUBSCR(MSISDN:42342) AUTH on GERAN received SRES/RES: 7db47cf7f81e4dc7 (8 bytes) DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Authentication terminating with result VLR_AUTH_RES_PASSED DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: state_chg to VLR_SUB_AS_AUTHENTICATED @@ -480,7 +480,7 @@ DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) DMM IMSI:90170010650: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP -DVLR SUBSCR(IMSI:90170010650) received res: e2 29 c1 9e 79 1f 2e 41 +DVLR SUBSCR(IMSI:90170010650) AUTH on UTRAN received RES: e229c19e791f2e41 (8 bytes) DVLR SUBSCR(IMSI:90170010650) AUTH established UMTS security context DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Authentication terminating with result VLR_AUTH_RES_PASSED DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: state_chg to VLR_SUB_AS_AUTHENTICATED @@ -659,7 +659,7 @@ DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP -DVLR SUBSCR(MSISDN:42342) received res: e2 29 c1 9e 79 1f 2e 41 +DVLR SUBSCR(MSISDN:42342) AUTH on UTRAN received RES: e229c19e791f2e41 (8
[MERGED] osmo-msc[master]: vlr auth: gracefully reject malformed auth response
Harald Welte has submitted this change and it was merged. Change subject: vlr auth: gracefully reject malformed auth response .. vlr auth: gracefully reject malformed auth response Instead of just closing down the conn hard, actually feed invalid auth response data to vlr_subscr_rc_auth_resp() in order to trigger all the actions we want to see with a failed authentication: - a GSUP signal that the auth failed, - a LU reject. Verify this in new test_wrong_sres_length() in msc_vlr_test_gsm_authen.c. Note that in gsm48_rx_mm_auth_resp(), the is_r99 flag is falsely derived from the RES length, which upcoming commit Ib7f7d89a8b9455d2c022d53d74328fa7488577f4 will fix. Change-Id: I4179a290069ac61d0662de4ec7ca3edb76988899 --- M src/libmsc/gsm_04_08.c M tests/msc_vlr/msc_vlr_test_gsm_authen.c M tests/msc_vlr/msc_vlr_test_gsm_authen.err 3 files changed, 179 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index f87a4c6..ceef2d8 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -971,8 +971,12 @@ } if (rc) { - msc_subscr_conn_close(conn, GSM_CAUSE_AUTH_FAILED); - return -EINVAL; + LOGP(DMM, LOGL_ERROR, +"%s: MM AUTHENTICATION RESPONSE: invalid: parsing %s AKA Auth Response" +" failed with rc=%d; dispatching zero length SRES/RES to trigger failure\n", +vlr_subscr_name(conn->vsub), is_r99 ? "UMTS" : "GSM", rc); + memset(res, 0, sizeof(res)); + res_len = 0; } DEBUGP(DMM, "%s: MM %s AUTHENTICATION RESPONSE (%s = %s)\n", diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.c b/tests/msc_vlr/msc_vlr_test_gsm_authen.c index 9c09aa4..b0db12d 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_authen.c +++ b/tests/msc_vlr/msc_vlr_test_gsm_authen.c @@ -914,11 +914,70 @@ comment_end(); } +static void test_wrong_sres_length() +{ + comment_start(); + fake_time_start(); + + net->authentication_required = true; + + btw("Location Update request causes a GSUP Send Auth Info request to HLR"); + lu_result_sent = RES_NONE; + gsup_expect_tx("0801080971004026f0"); + ms_sends_msg("05080200816800013008991007006402"); + OSMO_ASSERT(gsup_tx_confirmed); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS"); + auth_request_sent = false; + auth_request_expect_rand = "585df1ae287f6e273dce07090d61320b"; + auth_request_expect_autn = NULL; + /* Based on a Ki of 000102030405060708090a0b0c0d0e0f */ + gsup_rx("0a" + /* imsi */ + "0108" "0971004026f0" + /* 5 auth vectors... */ + /* TLTL rand */ + "0322" "2010" "585df1ae287f6e273dce07090d61320b" + /* TL sres TL kc */ + "2104" "2d8b2c3e" "2208" "61855fb81fc2a800" + "0322" "2010" "12aca96fb4ffdea5c985cbafa9b6e18b" + "2104" "20bde240" "2208" "07fa7502e07e1c00" + "0322" "2010" "e7c03ba7cf0e2fde82b2dc4d63077d42" + "2104" "a29514ae" "2208" "e2b234f807886400" + "0322" "2010" "fa8f20b781b5881329d4fea26b1a3c51" + "2104" "5afc8d72" "2208" "2392f14f709ae000" + "0322" "2010" "0fd4cc8dbe8715d1f439e304edfd68dc" + "2104" "bc8d1c5b" "2208" "da7cdd6bfe2d7000", + NULL); + VERBOSE_ASSERT(auth_request_sent, == true, "%d"); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("If the HLR were to send a GSUP _UPDATE_LOCATION_RESULT we'd still reject"); + gsup_rx("0601080971004026f0", NULL); + EXPECT_ACCEPTED(false); + + thwart_rx_non_initial_requests(); + + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("MS sends Authen Response with too short SRES data, auth is thwarted."); + gsup_expect_tx("0b01080971004026f0"); /* OSMO_GSUP_MSGT_AUTH_FAIL_REPORT */ + expect_bssap_clear(); + ms_sends_msg("05542d8b2c"); + VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); + + EXPECT_CONN_COUNT(0); + clear_vlr(); + comment_end(); +} + msc_vlr_test_func_t msc_vlr_tests[] = { test_gsm_authen, test_gsm_authen_tmsi, test_gsm_authen_imei, test_gsm_authen_tmsi_imei, test_gsm_milenage_authen, + test_wrong_sres_length, NULL }; diff --git a/tests/msc_vlr/msc_vlr_test_gsm_authen.err b/tests/msc_vlr/msc_vlr_test_gsm_authen.err index a46a838..a454e2f 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_authen.err +++
[MERGED] osmo-msc[master]: msc_vlr_tests: add test_a5_3_not_supported
Harald Welte has submitted this change and it was merged. Change subject: msc_vlr_tests: add test_a5_3_not_supported .. msc_vlr_tests: add test_a5_3_not_supported See also change-id I72a1dbb30e0a39dbf4b81c7e378d5607b62e10d3 in osmo-ttcn3-hacks.git, which adds a similar test to the MSC_Tests.ttcn suite. Writing this test helped me fix the issue faster, why not keep it now that it's there. Related: OS#2947 Change-Id: Iba56556207cf6e79e6531b0e7dd3eaec28fb5eaa --- M tests/msc_vlr/msc_vlr_test_gsm_ciph.c M tests/msc_vlr/msc_vlr_test_gsm_ciph.err 2 files changed, 152 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c index 57284a3..d8ea6ba 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.c +++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.c @@ -1044,6 +1044,59 @@ comment_end(); } +static void test_a5_3_not_supported() +{ + comment_start(); + + /* implicit: net->authentication_required = true; */ + net->a5_encryption_mask = (1 << 3); /* A5/3 */ + + btw("Location Update request causes a GSUP Send Auth Info request to HLR"); + lu_result_sent = RES_NONE; + gsup_expect_tx("0801080971004026f0"); + ms_sends_msg("05080200816800013008991007006402"); + OSMO_ASSERT(gsup_tx_confirmed); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS"); + /* Based on a Ki of 000102030405060708090a0b0c0d0e0f */ + auth_request_sent = false; + auth_request_expect_rand = "585df1ae287f6e273dce07090d61320b"; + auth_request_expect_autn = NULL; + gsup_rx("0a" + /* imsi */ + "0108" "0971004026f0" + /* 5 auth vectors... */ + /* TLTL rand */ + "0322" "2010" "585df1ae287f6e273dce07090d61320b" + /* TL sres TL kc */ + "2104" "2d8b2c3e" "2208" "61855fb81fc2a800" + "0322" "2010" "12aca96fb4ffdea5c985cbafa9b6e18b" + "2104" "20bde240" "2208" "07fa7502e07e1c00" + "0322" "2010" "e7c03ba7cf0e2fde82b2dc4d63077d42" + "2104" "a29514ae" "2208" "e2b234f807886400" + "0322" "2010" "fa8f20b781b5881329d4fea26b1a3c51" + "2104" "5afc8d72" "2208" "2392f14f709ae000" + "0322" "2010" "0fd4cc8dbe8715d1f439e304edfd68dc" + "2104" "bc8d1c5b" "2208" "da7cdd6bfe2d7000", + NULL); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + VERBOSE_ASSERT(auth_request_sent, == true, "%d"); + + BTW("MS sends Authen Response, VLR accepts and wants to send Ciphering Mode Command to MS" + " -- alas, no matching cipher can be found, abort and release"); + cipher_mode_cmd_sent = false; + expect_bssap_clear(); + ms_sends_msg("05542d8b2c3e"); + OSMO_ASSERT(!cipher_mode_cmd_sent); + VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); + + EXPECT_CONN_COUNT(0); + clear_vlr(); + comment_end(); +} + + msc_vlr_test_func_t msc_vlr_tests[] = { test_ciph, test_ciph_tmsi, @@ -1051,5 +1104,6 @@ test_ciph_imeisv, test_ciph_tmsi_imei, test_gsm_ciph_in_umts_env, + test_a5_3_not_supported, NULL }; diff --git a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err index c2bb606..1428c36 100644 --- a/tests/msc_vlr/msc_vlr_test_gsm_ciph.err +++ b/tests/msc_vlr/msc_vlr_test_gsm_ciph.err @@ -2184,6 +2184,104 @@ full talloc report on 'msgb' (total 0 bytes in 1 blocks) talloc_total_blocks(tall_bsc_ctx) == 7 += test_a5_3_not_supported +- Location Update request causes a GSUP Send Auth Info request to HLR + MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_LOC_UPD_REQUEST + new conn +DREF unknown: MSC conn use + compl_l3 == 1 (0x1) +DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8) +DREF unknown: MSC conn use + fsm == 2 (0x5) +DMM Subscr_Conn(90170004620){SUBSCR_CONN_S_INIT}: Allocated +DMM Subscr_Conn(90170004620){SUBSCR_CONN_S_INIT}: Received Event SUBSCR_CONN_E_START +DMM Subscr_Conn(90170004620){SUBSCR_CONN_S_INIT}: state_chg to SUBSCR_CONN_S_NEW +DMM LOCATION UPDATING REQUEST: MI(IMSI)=90170004620 type=IMSI ATTACH +DMM LU/new-LAC: 1/23 +DVLR vlr_lu_fsm(90170004620){VLR_ULA_S_IDLE}: Allocated +DVLR vlr_lu_fsm(90170004620){VLR_ULA_S_IDLE}: is child of Subscr_Conn(90170004620) +DVLR vlr_lu_fsm(90170004620){VLR_ULA_S_IDLE}: rev=GSM net=GERAN Auth+Ciph +DVLR vlr_lu_fsm(90170004620){VLR_ULA_S_IDLE}: Received Event VLR_ULA_E_UPDATE_LA +DREF VLR subscr unknown usage increases to: 1 +DVLR set IMSI on
[MERGED] osmo-msc[master]: msc_vlr_test_umts_authen: test response with only SRES half ...
Harald Welte has submitted this change and it was merged. Change subject: msc_vlr_test_umts_authen: test response with only SRES half of RES .. msc_vlr_test_umts_authen: test response with only SRES half of RES Change-Id: I0e9099625bd9d3de3db5ee29fbf81b2d8a30071d --- M tests/msc_vlr/msc_vlr_test_umts_authen.c M tests/msc_vlr/msc_vlr_test_umts_authen.err 2 files changed, 294 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/msc_vlr/msc_vlr_test_umts_authen.c b/tests/msc_vlr/msc_vlr_test_umts_authen.c index 861a615..b5a55fc 100644 --- a/tests/msc_vlr/msc_vlr_test_umts_authen.c +++ b/tests/msc_vlr/msc_vlr_test_umts_authen.c @@ -770,6 +770,110 @@ comment_end(); } +static void _test_umts_authen_only_sres(enum ran_type via_ran) +{ + net->authentication_required = true; + net->vlr->cfg.assign_tmsi = true; + rx_from_ran = via_ran; + + btw("Location Update request causes a GSUP Send Auth Info request to HLR"); + lu_result_sent = RES_NONE; + gsup_expect_tx("080108" "0971000156f0"); + ms_sends_msg("0508" /* MM LU */ +"7" /* ciph key seq: no key available */ +"0" /* LU type: normal */ +"ff" "" /* LAI, LAC */ +"57" /* classmark 1: R99, early classmark, no power lvl */ +"08991007106005" /* IMSI */ +"3303575886" /* classmark 2 */ +); + OSMO_ASSERT(gsup_tx_confirmed); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS"); + /* based on auc_3g: +* K = 'EB215756028D60E3275E613320AEC880', +* OPC = 'FB2A3D1B360F599ABAB99DB8669F8308' +* SQN = 0 +*/ + auth_request_sent = false; + auth_request_expect_rand = "39fa2f4e3d523d8619a73b4f65c3e14d"; + auth_request_expect_autn = "8704f5ba55f3d2ee44b22c8ea919"; + gsup_rx("0a" + /* imsi */ + "0108" "0971000156f0" + /* 5 auth vectors... */ + /* TLTL rand */ + "0362" "2010" "39fa2f4e3d523d8619a73b4f65c3e14d" + /* TL sres TL kc */ + "2104" "9b36efdf" "2208" "059a4f668f6fbe39" + /* TL 3G IK */ + "2310" "27497388b6cb044648f396aa155b95ef" + /* TL 3G CK */ + "2410" "f64735036e5871319c679f4742a75ea1" + /* TL AUTN */ + "2510" "8704f5ba55f3d2ee44b22c8ea919" + /* TL RES */ + "2708" "e229c19e791f2e41" + /* TLTL rand */ + "0362" "2010" "c187a53a5e6b9d573cac7c74451fd46d" + "2104" "85aa3130" "2208" "d3d50a000bf04f6e" + "2310" "1159ec926a50e98c034a6b7d7c9f418d" + "2410" "df3a03d9ca5335641efc8e36d76cd20b" + "2510" "1843a645b98d5b2d666af46c45d9" + "2708" "7db47cf7f81e4dc7" + "0362" "2010" "efa9c29a9742148d5c9070348716e1bb" + "2104" "69d5f9fb" "2208" "3df176f0c29f1a3d" + "2310" "eb50e770ddcc3060101d2f43b6c2b884" + "2410" "76542abce5ff9345b0e8947f4c6e019c" + "2510" "f9375e6d41e196e7fe4ff1c27e39" + "2708" "706f996719ba609c" + "0362" "2010" "f023d5a3b24726e0631b64b3840f8253" + "2104" "d570c03f" "2208" "ec011be8919883d6" + "2310" "c4e58af4ba43f3bcd904e16984f086d7" + "2410" "0593f65e752e5cb7f473862bda05aa0a" + "2510" "541ff1f07727c5ea00d658bc7e9a" + "2708" "3fd26072eaa2a04d" + "0362" "2010" "2f8f90c780d6a9c0c53da7ac57b6707e" + "2104" "b072446f220823f39f9f425ad6e6" + "2310" "65af0527fda95b0dc5ae4aa515cdf32f" + "2410" "537c3b35a3b13b08d08eeb28098f45cc" + "2510" "4bf4e564f7539bc796706bc65744" + "2708" "0edb0eadbea94ac2", + NULL); + VERBOSE_ASSERT(auth_request_sent, == true, "%d"); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + if (via_ran == RAN_GERAN_A) + btw("MS sends Authen Response of wrong RES size, VLR thwarts:" + " GERAN reports an SRES mismatch"); + else + btw("MS sends Authen Response of wrong RES size, VLR thwarts:" + " UTRAN disallows GSM AKA altogether"); + gsup_expect_tx("0b01080971000156f0"); /*
[MERGED] osmo-msc[master]: cosmetic: gsm48_rx_mm_auth_resp(): log 'UMTS AUTH', not 'R99...
Harald Welte has submitted this change and it was merged. Change subject: cosmetic: gsm48_rx_mm_auth_resp(): log 'UMTS AUTH', not 'R99 AUTH' .. cosmetic: gsm48_rx_mm_auth_resp(): log 'UMTS AUTH', not 'R99 AUTH' Change-Id: Iba43c685cbe238d96175267e9cc954b2f2f3e7fc --- M src/libmsc/gsm_04_08.c M tests/msc_vlr/msc_vlr_test_authen_reuse.err M tests/msc_vlr/msc_vlr_test_call.err M tests/msc_vlr/msc_vlr_test_umts_authen.err 4 files changed, 31 insertions(+), 31 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index 4564f8e..08f1517 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -979,7 +979,7 @@ DEBUGP(DMM, "%s: MM %s AUTHENTICATION RESPONSE (%s = %s)\n", vlr_subscr_name(conn->vsub), - is_umts ? "R99" : "GSM", is_umts ? "res" : "sres", + is_umts ? "UMTS" : "GSM", is_umts ? "res" : "sres", osmo_hexdump_nospc(res, res_len)); return vlr_subscr_rx_auth_resp(conn->vsub, classmark_is_r99(>classmark), diff --git a/tests/msc_vlr/msc_vlr_test_authen_reuse.err b/tests/msc_vlr/msc_vlr_test_authen_reuse.err index 269cd35..843e0d5 100644 --- a/tests/msc_vlr/msc_vlr_test_authen_reuse.err +++ b/tests/msc_vlr/msc_vlr_test_authen_reuse.err @@ -50,7 +50,7 @@ MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_AUTH_RESP DREF IMSI:90170010650: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM IMSI:90170010650: MM R99 AUTHENTICATION RESPONSE (res = e229c19e791f2e41) +DMM IMSI:90170010650: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(IMSI:90170010650) received res: e2 29 c1 9e 79 1f 2e 41 DVLR SUBSCR(IMSI:90170010650) AUTH established UMTS security context @@ -217,7 +217,7 @@ MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_AUTH_RESP DREF MSISDN:42342: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM MSISDN:42342: MM R99 AUTHENTICATION RESPONSE (res = e229c19e791f2e41) +DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(MSISDN:42342) received res: e2 29 c1 9e 79 1f 2e 41 DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context @@ -338,7 +338,7 @@ MSC <--RAN_GERAN_A-- MS: GSM48_MT_MM_AUTH_RESP DREF MSISDN:42342: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM MSISDN:42342: MM R99 AUTHENTICATION RESPONSE (res = 7db47cf7f81e4dc7) +DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = 7db47cf7f81e4dc7) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(MSISDN:42342) received res: 7d b4 7c f7 f8 1e 4d c7 DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context @@ -478,7 +478,7 @@ MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_AUTH_RESP DREF IMSI:90170010650: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM IMSI:90170010650: MM R99 AUTHENTICATION RESPONSE (res = e229c19e791f2e41) +DMM IMSI:90170010650: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(IMSI:90170010650) received res: e2 29 c1 9e 79 1f 2e 41 DVLR SUBSCR(IMSI:90170010650) AUTH established UMTS security context @@ -657,7 +657,7 @@ MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_AUTH_RESP DREF MSISDN:42342: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM MSISDN:42342: MM R99 AUTHENTICATION RESPONSE (res = e229c19e791f2e41) +DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = e229c19e791f2e41) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(MSISDN:42342) received res: e2 29 c1 9e 79 1f 2e 41 DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context @@ -788,7 +788,7 @@ MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_AUTH_RESP DREF MSISDN:42342: MSC conn use + dtap == 2 (0x6) DRLL Dispatching 04.08 message GSM48_MT_MM_AUTH_RESP (0x5:0x14) -DMM MSISDN:42342: MM R99 AUTHENTICATION RESPONSE (res = 7db47cf7f81e4dc7) +DMM MSISDN:42342: MM UMTS AUTHENTICATION RESPONSE (res = 7db47cf7f81e4dc7) DVLR VLR_Authenticate(90170010650){VLR_SUB_AS_WAIT_RESP}: Received Event VLR_AUTH_E_MS_AUTH_RESP DVLR SUBSCR(MSISDN:42342) received res: 7d b4 7c f7 f8 1e 4d c7 DVLR SUBSCR(MSISDN:42342) AUTH established UMTS security context @@ -938,7 +938,7 @@ MSC <--RAN_GERAN_A-- MS:
[MERGED] osmo-msc[master]: msc_vlr_test_umts_authen: test response with too long RES
Harald Welte has submitted this change and it was merged. Change subject: msc_vlr_test_umts_authen: test response with too long RES .. msc_vlr_test_umts_authen: test response with too long RES Change-Id: Ie5473f06fc2d04c6a9f343da5764ec95b292a5f9 --- M tests/msc_vlr/msc_vlr_test_umts_authen.c M tests/msc_vlr/msc_vlr_test_umts_authen.err 2 files changed, 289 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/msc_vlr/msc_vlr_test_umts_authen.c b/tests/msc_vlr/msc_vlr_test_umts_authen.c index 66eacd7..861a615 100644 --- a/tests/msc_vlr/msc_vlr_test_umts_authen.c +++ b/tests/msc_vlr/msc_vlr_test_umts_authen.c @@ -671,6 +671,105 @@ comment_end(); } +static void _test_umts_authen_too_long_res(enum ran_type via_ran) +{ + net->authentication_required = true; + net->vlr->cfg.assign_tmsi = true; + rx_from_ran = via_ran; + + btw("Location Update request causes a GSUP Send Auth Info request to HLR"); + lu_result_sent = RES_NONE; + gsup_expect_tx("080108" "0971000156f0"); + ms_sends_msg("0508" /* MM LU */ +"7" /* ciph key seq: no key available */ +"0" /* LU type: normal */ +"ff" "" /* LAI, LAC */ +"57" /* classmark 1: R99, early classmark, no power lvl */ +"08991007106005" /* IMSI */ +"3303575886" /* classmark 2 */ +); + OSMO_ASSERT(gsup_tx_confirmed); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS"); + /* based on auc_3g: +* K = 'EB215756028D60E3275E613320AEC880', +* OPC = 'FB2A3D1B360F599ABAB99DB8669F8308' +* SQN = 0 +*/ + auth_request_sent = false; + auth_request_expect_rand = "39fa2f4e3d523d8619a73b4f65c3e14d"; + auth_request_expect_autn = "8704f5ba55f3d2ee44b22c8ea919"; + gsup_rx("0a" + /* imsi */ + "0108" "0971000156f0" + /* 5 auth vectors... */ + /* TLTL rand */ + "0362" "2010" "39fa2f4e3d523d8619a73b4f65c3e14d" + /* TL sres TL kc */ + "2104" "9b36efdf" "2208" "059a4f668f6fbe39" + /* TL 3G IK */ + "2310" "27497388b6cb044648f396aa155b95ef" + /* TL 3G CK */ + "2410" "f64735036e5871319c679f4742a75ea1" + /* TL AUTN */ + "2510" "8704f5ba55f3d2ee44b22c8ea919" + /* TL RES */ + "2708" "e229c19e791f2e41" + /* TLTL rand */ + "0362" "2010" "c187a53a5e6b9d573cac7c74451fd46d" + "2104" "85aa3130" "2208" "d3d50a000bf04f6e" + "2310" "1159ec926a50e98c034a6b7d7c9f418d" + "2410" "df3a03d9ca5335641efc8e36d76cd20b" + "2510" "1843a645b98d5b2d666af46c45d9" + "2708" "7db47cf7f81e4dc7" + "0362" "2010" "efa9c29a9742148d5c9070348716e1bb" + "2104" "69d5f9fb" "2208" "3df176f0c29f1a3d" + "2310" "eb50e770ddcc3060101d2f43b6c2b884" + "2410" "76542abce5ff9345b0e8947f4c6e019c" + "2510" "f9375e6d41e196e7fe4ff1c27e39" + "2708" "706f996719ba609c" + "0362" "2010" "f023d5a3b24726e0631b64b3840f8253" + "2104" "d570c03f" "2208" "ec011be8919883d6" + "2310" "c4e58af4ba43f3bcd904e16984f086d7" + "2410" "0593f65e752e5cb7f473862bda05aa0a" + "2510" "541ff1f07727c5ea00d658bc7e9a" + "2708" "3fd26072eaa2a04d" + "0362" "2010" "2f8f90c780d6a9c0c53da7ac57b6707e" + "2104" "b072446f220823f39f9f425ad6e6" + "2310" "65af0527fda95b0dc5ae4aa515cdf32f" + "2410" "537c3b35a3b13b08d08eeb28098f45cc" + "2510" "4bf4e564f7539bc796706bc65744" + "2708" "0edb0eadbea94ac2", + NULL); + VERBOSE_ASSERT(auth_request_sent, == true, "%d"); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("MS sends Authen Response of wrong RES size, VLR thwarts"); + gsup_expect_tx("0b01080971000156f0"); /* OSMO_GSUP_MSGT_AUTH_FAIL_REPORT */ + expect_release_clear(via_ran); + ms_sends_msg("0554" "e229c19e" "2105" "791f2e4123" /* added one byte */); + VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); + ASSERT_RELEASE_CLEAR(via_ran); + + EXPECT_CONN_COUNT(0);
osmo-msc[master]: msc_vlr_tests: add test_a5_3_not_supported
Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7058 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iba56556207cf6e79e6531b0e7dd3eaec28fb5eaa Gerrit-PatchSet: 3 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
[MERGED] osmo-msc[master]: msc_vlr_test_umts_authen: test response with too short RES
Harald Welte has submitted this change and it was merged. Change subject: msc_vlr_test_umts_authen: test response with too short RES .. msc_vlr_test_umts_authen: test response with too short RES Change-Id: Ia1bc57b3dc1f3c3c654ba2d907b16ba925cd03e8 --- M tests/msc_vlr/msc_vlr_test_umts_authen.c M tests/msc_vlr/msc_vlr_test_umts_authen.err 2 files changed, 290 insertions(+), 0 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/msc_vlr/msc_vlr_test_umts_authen.c b/tests/msc_vlr/msc_vlr_test_umts_authen.c index e6dc445..66eacd7 100644 --- a/tests/msc_vlr/msc_vlr_test_umts_authen.c +++ b/tests/msc_vlr/msc_vlr_test_umts_authen.c @@ -572,10 +572,112 @@ comment_end(); } +static void _test_umts_authen_too_short_res(enum ran_type via_ran) +{ + net->authentication_required = true; + net->vlr->cfg.assign_tmsi = true; + rx_from_ran = via_ran; + + btw("Location Update request causes a GSUP Send Auth Info request to HLR"); + lu_result_sent = RES_NONE; + gsup_expect_tx("080108" "0971000156f0"); + ms_sends_msg("0508" /* MM LU */ +"7" /* ciph key seq: no key available */ +"0" /* LU type: normal */ +"ff" "" /* LAI, LAC */ +"57" /* classmark 1: R99, early classmark, no power lvl */ +"08991007106005" /* IMSI */ +"3303575886" /* classmark 2 */ +); + OSMO_ASSERT(gsup_tx_confirmed); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("from HLR, rx _SEND_AUTH_INFO_RESULT; VLR sends Auth Req to MS"); + /* based on auc_3g: +* K = 'EB215756028D60E3275E613320AEC880', +* OPC = 'FB2A3D1B360F599ABAB99DB8669F8308' +* SQN = 0 +*/ + auth_request_sent = false; + auth_request_expect_rand = "39fa2f4e3d523d8619a73b4f65c3e14d"; + auth_request_expect_autn = "8704f5ba55f3d2ee44b22c8ea919"; + gsup_rx("0a" + /* imsi */ + "0108" "0971000156f0" + /* 5 auth vectors... */ + /* TLTL rand */ + "0362" "2010" "39fa2f4e3d523d8619a73b4f65c3e14d" + /* TL sres TL kc */ + "2104" "9b36efdf" "2208" "059a4f668f6fbe39" + /* TL 3G IK */ + "2310" "27497388b6cb044648f396aa155b95ef" + /* TL 3G CK */ + "2410" "f64735036e5871319c679f4742a75ea1" + /* TL AUTN */ + "2510" "8704f5ba55f3d2ee44b22c8ea919" + /* TL RES */ + "2708" "e229c19e791f2e41" + /* TLTL rand */ + "0362" "2010" "c187a53a5e6b9d573cac7c74451fd46d" + "2104" "85aa3130" "2208" "d3d50a000bf04f6e" + "2310" "1159ec926a50e98c034a6b7d7c9f418d" + "2410" "df3a03d9ca5335641efc8e36d76cd20b" + "2510" "1843a645b98d5b2d666af46c45d9" + "2708" "7db47cf7f81e4dc7" + "0362" "2010" "efa9c29a9742148d5c9070348716e1bb" + "2104" "69d5f9fb" "2208" "3df176f0c29f1a3d" + "2310" "eb50e770ddcc3060101d2f43b6c2b884" + "2410" "76542abce5ff9345b0e8947f4c6e019c" + "2510" "f9375e6d41e196e7fe4ff1c27e39" + "2708" "706f996719ba609c" + "0362" "2010" "f023d5a3b24726e0631b64b3840f8253" + "2104" "d570c03f" "2208" "ec011be8919883d6" + "2310" "c4e58af4ba43f3bcd904e16984f086d7" + "2410" "0593f65e752e5cb7f473862bda05aa0a" + "2510" "541ff1f07727c5ea00d658bc7e9a" + "2708" "3fd26072eaa2a04d" + "0362" "2010" "2f8f90c780d6a9c0c53da7ac57b6707e" + "2104" "b072446f220823f39f9f425ad6e6" + "2310" "65af0527fda95b0dc5ae4aa515cdf32f" + "2410" "537c3b35a3b13b08d08eeb28098f45cc" + "2510" "4bf4e564f7539bc796706bc65744" + "2708" "0edb0eadbea94ac2", + NULL); + VERBOSE_ASSERT(auth_request_sent, == true, "%d"); + VERBOSE_ASSERT(lu_result_sent, == RES_NONE, "%d"); + + btw("MS sends Authen Response of wrong RES size, VLR thwarts"); + gsup_expect_tx("0b01080971000156f0"); /* OSMO_GSUP_MSGT_AUTH_FAIL_REPORT */ + expect_release_clear(via_ran); + ms_sends_msg("0554" "e229c19e" "2103" "791f2e" /* nipped one byte */); + VERBOSE_ASSERT(lu_result_sent, == RES_REJECT, "%d"); + ASSERT_RELEASE_CLEAR(via_ran); + + EXPECT_CONN_COUNT(0);
osmo-msc[master]: msc_vlr_test_umts_authen: test response with too short RES
Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7190 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia1bc57b3dc1f3c3c654ba2d907b16ba925cd03e8 Gerrit-PatchSet: 4 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
osmo-msc[master]: vlr auth: gracefully reject malformed auth response
Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/7188 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4179a290069ac61d0662de4ec7ca3edb76988899 Gerrit-PatchSet: 4 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
osmo-ci[master]: osmocom-latest-packages.sh: Catch latest tags outside master...
Patch Set 1: Code-Review+2 Verified+1 -- To view, visit https://gerrit.osmocom.org/7145 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3b521a194f0ae9fdfa358423e66f30c1316c23e8 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Owner: Pau Espin PedrolGerrit-Reviewer: Harald Welte Gerrit-HasComments: No
osmo-ttcn3-hacks[master]: gitignore final 'make' generated files
Patch Set 1: Code-Review-1 -- To view, visit https://gerrit.osmocom.org/7200 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If38aea67a45b4e5fe22d5fac301f06239e2265a2 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-ttcn3-hacks[master]: gitignore 'make compile' generated files
Patch Set 1: Code-Review-1 -- To view, visit https://gerrit.osmocom.org/7199 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6e4b9b4526d6e0af0f5325e2df97b0ec7c93d9ae Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-ttcn3-hacks[master]: gitignore symlinks
Patch Set 1: Code-Review-1 -- To view, visit https://gerrit.osmocom.org/7198 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f9fe17c20e2dd72b654fb6d919e7ec1289b4f88 Gerrit-PatchSet: 1 Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_tchf.c: always send traffic indications
Review at https://gerrit.osmocom.org/7216 trxcon/sched_lchan_tchf.c: always send traffic indications We shall always send traffic frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I99e134699796c7075299459e96b2f2d462636619 --- M src/host/trxcon/sched_lchan_tchf.c 1 file changed, 29 insertions(+), 17 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/16/7216/1 diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c index 25c9b10..80e4d52 100644 --- a/src/host/trxcon/sched_lchan_tchf.c +++ b/src/host/trxcon/sched_lchan_tchf.c @@ -49,8 +49,8 @@ sbit_t *bits, int8_t rssi, int16_t toa256) { const struct trx_lchan_desc *lchan_desc; + int n_errors = -1, n_bits_total, rc; uint8_t rsl_cmode, tch_mode, mode; - int n_errors, n_bits_total, rc; sbit_t *buffer, *offset; uint8_t l2[128], *mask; uint32_t *first_fn; @@ -92,16 +92,6 @@ if (bid != 3) return 0; - /* Check for complete set of bursts */ - if ((*mask & 0xf) != 0xf) { - LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at " - "fn=%u (%u/%u) for %s\n", *first_fn, - (*first_fn) % ts->mf_layout->period, - ts->mf_layout->period, - lchan_desc->name); - return -EINVAL; - } - /** * Get current RSL / TCH modes * @@ -110,6 +100,18 @@ */ rsl_cmode = RSL_CMOD_SPD_SPEECH; tch_mode = lchan->tch_mode; + + /* Check for complete set of bursts */ + if ((*mask & 0xf) != 0xf) { + LOGP(DSCHD, LOGL_ERROR, "Received incomplete traffic frame at " + "fn=%u (%u/%u) for %s\n", *first_fn, + (*first_fn) % ts->mf_layout->period, + ts->mf_layout->period, + lchan_desc->name); + + /* Send BFI */ + goto bfi; + } mode = rsl_cmode != RSL_CMOD_SPD_SPEECH ? GSM48_CMODE_SPEECH_V1 : tch_mode; @@ -144,25 +146,35 @@ LOGP(DSCHD, LOGL_ERROR, "Received bad TCH frame ending at " "fn=%u for %s\n", fn, lchan_desc->name); - l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + /* Send BFI */ + goto bfi; } else if (rc == GSM_MACBLOCK_LEN) { /* FACCH received, forward it to the higher layers */ sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, n_errors, false, false); /* Send BFI instead of stolen TCH frame */ - l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + goto bfi; } else { /* A good TCH frame received */ l2_len = rc; } /* Send a traffic frame to the higher layers */ - if (l2_len > 0) - sched_send_dt_ind(trx, ts, lchan, l2, l2_len, - n_errors, rc < 4, true); + return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, false, true); - return 0; +bfi: + /* Bad frame indication */ + l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); + + /* Didn't try to decode */ + if (n_errors < 0) + n_errors = 116 * 4; + + /* Send a BFI frame to the higher layers */ + return sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, true, true); } int tx_tchf_fn(struct trx_instance *trx, struct trx_ts *ts, -- To view, visit https://gerrit.osmocom.org/7216 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I99e134699796c7075299459e96b2f2d462636619 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_common.c: use static memory allocation
Review at https://gerrit.osmocom.org/7213 trxcon/sched_lchan_common.c: use static memory allocation There is no need to allocate the DL header for each new message. Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd --- M src/host/trxcon/sched_lchan_common.c 1 file changed, 20 insertions(+), 29 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/13/7213/1 diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 13c8764..1858619 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -87,34 +87,28 @@ bool dec_failed, int bit_error_count) { const struct trx_lchan_desc *lchan_desc; - struct l1ctl_info_dl *data; - - /* Allocate memory */ - data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl)); - if (data == NULL) - return -ENOMEM; + struct l1ctl_info_dl dl_hdr; /* Set up pointers */ lchan_desc = _lchan_desc[lchan->type]; /* Fill in known downlink info */ - data->chan_nr = lchan_desc->chan_nr | ts->index; - data->link_id = lchan_desc->link_id; - data->band_arfcn = htons(trx->band_arfcn); - data->frame_nr = htonl(lchan->rx_first_fn); - data->rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num); - data->num_biterr = bit_error_count; + dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index; + dl_hdr.link_id = lchan_desc->link_id; + dl_hdr.band_arfcn = htons(trx->band_arfcn); + dl_hdr.frame_nr = htonl(lchan->rx_first_fn); + dl_hdr.rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num); + dl_hdr.num_biterr = bit_error_count; /* FIXME: set proper values */ - data->snr = 0; + dl_hdr.snr = 0; /* Mark frame as broken if so */ - data->fire_crc = dec_failed ? 2 : 0; + dl_hdr.fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_dt_ind(trx->l1l, data, l2, l2_len, + l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, l2_len != GSM_MACBLOCK_LEN); - talloc_free(data); return 0; } @@ -123,25 +117,22 @@ struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len) { const struct trx_lchan_desc *lchan_desc; - struct l1ctl_info_dl *data; - - /* Allocate memory */ - data = talloc_zero(ts, struct l1ctl_info_dl); - if (data == NULL) - return -ENOMEM; + struct l1ctl_info_dl dl_hdr; /* Set up pointers */ lchan_desc = _lchan_desc[lchan->type]; - /* Fill in known downlink info */ - data->chan_nr = lchan_desc->chan_nr | ts->index; - data->link_id = lchan_desc->link_id; - data->band_arfcn = htons(trx->band_arfcn); - data->frame_nr = htonl(fn); + /* Zero-initialize DL header, because we don't set all fields */ + memset(_hdr, 0x00, sizeof(struct l1ctl_info_dl)); - l1ctl_tx_dt_conf(trx->l1l, data, + /* Fill in known downlink info */ + dl_hdr.chan_nr = lchan_desc->chan_nr | ts->index; + dl_hdr.link_id = lchan_desc->link_id; + dl_hdr.band_arfcn = htons(trx->band_arfcn); + dl_hdr.frame_nr = htonl(fn); + + l1ctl_tx_dt_conf(trx->l1l, _hdr, l2_len != GSM_MACBLOCK_LEN); - talloc_free(data); return 0; } -- To view, visit https://gerrit.osmocom.org/7213 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id7ad815c6b403f5c3d15fc02022397188f1d87fd Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/scheduler: enforce lchan handlers to set message type
Review at https://gerrit.osmocom.org/7214 trxcon/scheduler: enforce lchan handlers to set message type Since this change, each lchan handler shall manually indicate a type of both message indications and confirmations. Change-Id: I02e0b87d61c127d2f6f5b9532909af78332bf707 --- M src/host/trxcon/sched_lchan_common.c M src/host/trxcon/sched_lchan_tchf.c M src/host/trxcon/sched_lchan_xcch.c M src/host/trxcon/sched_trx.h 4 files changed, 18 insertions(+), 21 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/14/7214/1 diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 1858619..47b0162 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -82,9 +82,9 @@ }, }; -int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts, +int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, - bool dec_failed, int bit_error_count) + int bit_error_count, bool dec_failed, bool traffic) { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl dl_hdr; @@ -107,14 +107,13 @@ dl_hdr.fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, - l2_len != GSM_MACBLOCK_LEN); + l1ctl_tx_dt_ind(trx->l1l, _hdr, l2, l2_len, traffic); return 0; } -int sched_send_data_conf(struct trx_instance *trx, struct trx_ts *ts, - struct trx_lchan_state *lchan, uint32_t fn, size_t l2_len) +int sched_send_dt_conf(struct trx_instance *trx, struct trx_ts *ts, + struct trx_lchan_state *lchan, uint32_t fn, bool traffic) { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl dl_hdr; @@ -131,8 +130,7 @@ dl_hdr.band_arfcn = htons(trx->band_arfcn); dl_hdr.frame_nr = htonl(fn); - l1ctl_tx_dt_conf(trx->l1l, _hdr, - l2_len != GSM_MACBLOCK_LEN); + l1ctl_tx_dt_conf(trx->l1l, _hdr, traffic); return 0; } diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c index b023126..25c9b10 100644 --- a/src/host/trxcon/sched_lchan_tchf.c +++ b/src/host/trxcon/sched_lchan_tchf.c @@ -147,8 +147,8 @@ l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); } else if (rc == GSM_MACBLOCK_LEN) { /* FACCH received, forward it to the higher layers */ - sched_send_data_ind(trx, ts, lchan, - l2, GSM_MACBLOCK_LEN, false, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, false, false); /* Send BFI instead of stolen TCH frame */ l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode); @@ -159,8 +159,8 @@ /* Send a traffic frame to the higher layers */ if (l2_len > 0) - sched_send_data_ind(trx, ts, lchan, - l2, l2_len, false, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, l2_len, + n_errors, rc < 4, true); return 0; } @@ -273,8 +273,7 @@ /* If we have sent the last (4/4) burst */ if (*mask == 0x0f) { /* Confirm data / traffic sending */ - sched_send_data_conf(trx, ts, lchan, fn, - lchan->prim->payload_len); + sched_send_dt_conf(trx, ts, lchan, fn, PRIM_IS_TCH(lchan->prim)); /* Forget processed primitive */ sched_prim_drop(lchan); diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c index b2cbd22..f351674 100644 --- a/src/host/trxcon/sched_lchan_xcch.c +++ b/src/host/trxcon/sched_lchan_xcch.c @@ -109,8 +109,8 @@ } /* Send a L2 frame to the higher layers */ - sched_send_data_ind(trx, ts, lchan, - l2, GSM_MACBLOCK_LEN, rc != 0, n_errors); + sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, rc != 0, false); return 0; } @@ -190,7 +190,7 @@ *mask = 0x00; /* Confirm data sending */ - sched_send_data_conf(trx, ts, lchan, fn, GSM_MACBLOCK_LEN); + sched_send_dt_conf(trx, ts, lchan, fn, false); } return 0; diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h index 856566c..e9c0e6d 100644 --- a/src/host/trxcon/sched_trx.h +++ b/src/host/trxcon/sched_trx.h @@ -296,8 +296,8 @@ extern const uint8_t sched_nb_training_bits[8][26]; size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode); -int sched_send_data_ind(struct trx_instance *trx, struct trx_ts *ts, +int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts, struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len, - bool
[PATCH] osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC confirmation API
Review at https://gerrit.osmocom.org/7211 trxcon: clean up DATA / TRAFFIC confirmation API - change 'l1ctl_tx_data_conf' symbol to 'l1ctl_tx_dt_conf' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA confirmation type; Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl.h M src/host/trxcon/sched_lchan_common.c 3 files changed, 12 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/11/7211/1 diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 0bcd5d9..3702e8a 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -231,19 +231,19 @@ return l1ctl_link_send(l1l, msg); } -int l1ctl_tx_data_conf(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type) + +/** + * Handles both L1CTL_DATA_CONF and L1CTL_TRAFFIC_CONF. + */ +int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, + struct l1ctl_info_dl *data, bool traffic) { struct l1ctl_info_dl *dl; struct msgb *msg; size_t len; - if (msg_type != L1CTL_DATA_CONF && msg_type != L1CTL_TRAFFIC_CONF) { - LOGP(DL1D, LOGL_ERROR, "Incorrect confirmation type\n"); - return -EINVAL; - } - - msg = l1ctl_alloc_msg(msg_type); + msg = l1ctl_alloc_msg(traffic ? + L1CTL_TRAFFIC_CONF : L1CTL_DATA_CONF); if (msg == NULL) return -ENOMEM; diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h index 91a7f0f..290a0f5 100644 --- a/src/host/trxcon/l1ctl.h +++ b/src/host/trxcon/l1ctl.h @@ -20,6 +20,6 @@ int l1ctl_tx_data_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, uint8_t msg_type); -int l1ctl_tx_data_conf(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type); +int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, + struct l1ctl_info_dl *data, bool traffic); int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn); diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index 52c9a21..d946e57 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -129,7 +129,6 @@ { const struct trx_lchan_desc *lchan_desc; struct l1ctl_info_dl *data; - uint8_t conf_type; /* Allocate memory */ data = talloc_zero(ts, struct l1ctl_info_dl); @@ -145,11 +144,8 @@ data->band_arfcn = htons(trx->band_arfcn); data->frame_nr = htonl(fn); - /* Choose a confirmation type */ - conf_type = l2_len == GSM_MACBLOCK_LEN ? - L1CTL_DATA_CONF : L1CTL_TRAFFIC_CONF; - - l1ctl_tx_data_conf(trx->l1l, data, conf_type); + l1ctl_tx_dt_conf(trx->l1l, data, + l2_len != GSM_MACBLOCK_LEN); talloc_free(data); return 0; -- To view, visit https://gerrit.osmocom.org/7211 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iedd569086a264dc7d8740abea5c6e5ca21e299f6 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon: clean up DATA / TRAFFIC indication API
Review at https://gerrit.osmocom.org/7212 trxcon: clean up DATA / TRAFFIC indication API - change 'l1ctl_tx_data_ind' symbol to 'l1ctl_tx_dt_ind' in order to indicate that it's used for both DATA and TRAFFIC; - introduce a 'traffic' flag, which is used to define either TRAFFIC or DATA indication type; - pass L2 payload and its length separately from the Downlink info header. Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl.h M src/host/trxcon/sched_lchan_common.c 3 files changed, 23 insertions(+), 27 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/12/7212/1 diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 3702e8a..3de0cf6 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -183,29 +183,30 @@ return l1ctl_link_send(l1l, msg); } -int l1ctl_tx_data_ind(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type) +/** + * Handles both L1CTL_DATA_IND and L1CTL_TRAFFIC_IND. + */ +int l1ctl_tx_dt_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, + uint8_t *l2, size_t l2_len, bool traffic) { struct l1ctl_info_dl *dl; struct msgb *msg; - size_t len; + uint8_t *msg_l2; - if (msg_type != L1CTL_DATA_IND && msg_type != L1CTL_TRAFFIC_IND) { - LOGP(DL1D, LOGL_ERROR, "Incorrect indication type\n"); - return -EINVAL; - } - - msg = l1ctl_alloc_msg(msg_type); + msg = l1ctl_alloc_msg(traffic ? + L1CTL_TRAFFIC_IND : L1CTL_DATA_IND); if (msg == NULL) return -ENOMEM; - /* We store the payload as a flexible array member */ - len = sizeof(struct l1ctl_info_dl); - len += msg_type == L1CTL_DATA_IND ? 23 : TRAFFIC_DATA_LEN; - dl = (struct l1ctl_info_dl *) msgb_put(msg, len); + /* Copy DL header */ + dl = (struct l1ctl_info_dl *) msgb_put(msg, sizeof(*dl)); + memcpy(dl, data, sizeof(*dl)); - /* Copy header and data from source message */ - memcpy(dl, data, len); + /* Copy the L2 payload if preset */ + if (l2 && l2_len > 0) { + msg_l2 = (uint8_t *) msgb_put(msg, l2_len); + memcpy(msg_l2, l2, l2_len); + } /* Put message to upper layers */ return l1ctl_link_send(l1l, msg); diff --git a/src/host/trxcon/l1ctl.h b/src/host/trxcon/l1ctl.h index 290a0f5..ca8c0be 100644 --- a/src/host/trxcon/l1ctl.h +++ b/src/host/trxcon/l1ctl.h @@ -18,8 +18,8 @@ int l1ctl_tx_reset_conf(struct l1ctl_link *l1l, uint8_t type); int l1ctl_tx_reset_ind(struct l1ctl_link *l1l, uint8_t type); -int l1ctl_tx_data_ind(struct l1ctl_link *l1l, - struct l1ctl_info_dl *data, uint8_t msg_type); +int l1ctl_tx_dt_ind(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, + uint8_t *l2, size_t l2_len, bool traffic); int l1ctl_tx_dt_conf(struct l1ctl_link *l1l, struct l1ctl_info_dl *data, bool traffic); int l1ctl_tx_rach_conf(struct l1ctl_link *l1l, uint32_t fn); diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c index d946e57..13c8764 100644 --- a/src/host/trxcon/sched_lchan_common.c +++ b/src/host/trxcon/sched_lchan_common.c @@ -90,7 +90,7 @@ struct l1ctl_info_dl *data; /* Allocate memory */ - data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl) + l2_len); + data = talloc_zero_size(ts, sizeof(struct l1ctl_info_dl)); if (data == NULL) return -ENOMEM; @@ -108,17 +108,12 @@ /* FIXME: set proper values */ data->snr = 0; - if (dec_failed) { - /* Mark frame as broken */ - data->fire_crc = 2; - } else { - /* Fill in the payload */ - memcpy(data->payload, l2, l2_len); - } + /* Mark frame as broken if so */ + data->fire_crc = dec_failed ? 2 : 0; /* Put a packet to higher layers */ - l1ctl_tx_data_ind(trx->l1l, data, l2_len == GSM_MACBLOCK_LEN ? - L1CTL_DATA_IND : L1CTL_TRAFFIC_IND); + l1ctl_tx_dt_ind(trx->l1l, data, l2, l2_len, + l2_len != GSM_MACBLOCK_LEN); talloc_free(data); return 0; -- To view, visit https://gerrit.osmocom.org/7212 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9fe65ee9b2d772576b86b7bc85d53518530d1579 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon: use meaningful names for L1CTL messages
Review at https://gerrit.osmocom.org/7207 trxcon: use meaningful names for L1CTL messages There are two types of L1CTL messages: received and to be transmitted. Let's use proper names to indicate this. Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl_link.c 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/07/7207/1 diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index dd75af9..58b8a4f 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -49,7 +49,7 @@ static struct msgb *l1ctl_alloc_msg(uint8_t msg_type) { struct l1ctl_hdr *l1h; - struct msgb *msg = msgb_alloc_headroom(256, 4, "osmo_l1"); + struct msgb *msg = msgb_alloc_headroom(256, 4, "l1ctl_tx_msg"); if (!msg) { LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n"); diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index 596a9d1..a7277ea 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -77,7 +77,7 @@ /* Allocate a new msg */ msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, - L1CTL_HEADROOM, "L1CTL"); + L1CTL_HEADROOM, "l1ctl_rx_msg"); if (!msg) { LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); return -ENOMEM; -- To view, visit https://gerrit.osmocom.org/7207 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c17687579282fa389bca35dc7edbc3582e55701 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/sched_lchan_xcch.c: always send data indications
Review at https://gerrit.osmocom.org/7215 trxcon/sched_lchan_xcch.c: always send data indications We shall always send data frame indications, even if received frame is incomplete or decoding was failed. This is required for proper Measurement Reporting. Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092 --- M src/host/trxcon/sched_lchan_xcch.c 1 file changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/15/7215/1 diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c index f351674..04c9f4e 100644 --- a/src/host/trxcon/sched_lchan_xcch.c +++ b/src/host/trxcon/sched_lchan_xcch.c @@ -94,8 +94,6 @@ (*first_fn) % ts->mf_layout->period, ts->mf_layout->period, lchan_desc->name); - - return -1; } /* Attempt to decode */ @@ -106,13 +104,18 @@ (*first_fn) % ts->mf_layout->period, ts->mf_layout->period, lchan_desc->name); + + /** +* We should anyway send dummy frame for +* proper measurement reporting... +*/ + return sched_send_dt_ind(trx, ts, lchan, NULL, 0, + n_errors, true, false); } /* Send a L2 frame to the higher layers */ - sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, - n_errors, rc != 0, false); - - return 0; + return sched_send_dt_ind(trx, ts, lchan, l2, GSM_MACBLOCK_LEN, + n_errors, false, false); } int tx_data_fn(struct trx_instance *trx, struct trx_ts *ts, -- To view, visit https://gerrit.osmocom.org/7215 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7beee7e797f488d04c3b59bee9501ce823717092 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers
Review at https://gerrit.osmocom.org/7210 trxcon/l1ctl.c: combine both DATA and TRAFFIC REQ handlers Both functions are almost identical, and the only difference is the message type they set. Let's combine them into a single function and introduce a 'traffic' flag, which can be used to define a message type. Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7 --- M src/host/trxcon/l1ctl.c 1 file changed, 17 insertions(+), 45 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/10/7210/1 diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index f138b88..0bcd5d9 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -606,25 +606,35 @@ return 0; } -static int l1ctl_rx_data_req(struct l1ctl_link *l1l, struct msgb *msg) +/** + * Handles both L1CTL_DATA_REQ and L1CTL_TRAFFIC_REQ. + */ +static int l1ctl_rx_dt_req(struct l1ctl_link *l1l, + struct msgb *msg, bool traffic) { struct l1ctl_info_ul *ul; struct trx_ts_prim *prim; uint8_t chan_nr, link_id; + size_t payload_len; int rc; /* Extract UL frame header */ ul = (struct l1ctl_info_ul *) msg->l1h; + /* Calculate the payload len */ + msg->l2h = ul->payload; + payload_len = msgb_l2len(msg); + /* Obtain channel description */ chan_nr = ul->chan_nr; link_id = ul->link_id & 0x40; - LOGP(DL1D, LOGL_DEBUG, "Recv Data Req (chan_nr=0x%02x, " - "link_id=0x%02x)\n", chan_nr, link_id); + LOGP(DL1D, LOGL_DEBUG, "Recv %s Req (chan_nr=0x%02x, " + "link_id=0x%02x, len=%zu)\n", traffic ? "TRAFFIC" : "DATA", + chan_nr, link_id, payload_len); /* Init a new primitive */ - rc = sched_prim_init(l1l->trx, , 23, + rc = sched_prim_init(l1l->trx, , payload_len, chan_nr, link_id); if (rc) goto exit; @@ -637,45 +647,7 @@ } /* Fill in the payload */ - memcpy(prim->payload, ul->payload, 23); - -exit: - msgb_free(msg); - return rc; -} - -static int l1ctl_rx_traffic_req(struct l1ctl_link *l1l, struct msgb *msg) -{ - struct l1ctl_info_ul *ul; - struct trx_ts_prim *prim; - uint8_t chan_nr, link_id; - int rc; - - /* Extract UL frame header */ - ul = (struct l1ctl_info_ul *) msg->l1h; - - /* Obtain channel description */ - chan_nr = ul->chan_nr; - link_id = ul->link_id & 0x40; - - LOGP(DL1D, LOGL_DEBUG, "Recv Traffic Req (chan_nr=0x%02x, " - "link_id=0x%02x)\n", chan_nr, link_id); - - /* Init a new primitive */ - rc = sched_prim_init(l1l->trx, , TRAFFIC_DATA_LEN, - chan_nr, link_id); - if (rc) - goto exit; - - /* Push this primitive to transmit queue */ - rc = sched_prim_push(l1l->trx, prim, chan_nr); - if (rc) { - talloc_free(prim); - goto exit; - } - - /* Fill in the payload */ - memcpy(prim->payload, ul->payload, TRAFFIC_DATA_LEN); + memcpy(prim->payload, ul->payload, payload_len); exit: msgb_free(msg); @@ -811,9 +783,9 @@ case L1CTL_DM_REL_REQ: return l1ctl_rx_dm_rel_req(l1l, msg); case L1CTL_DATA_REQ: - return l1ctl_rx_data_req(l1l, msg); + return l1ctl_rx_dt_req(l1l, msg, false); case L1CTL_TRAFFIC_REQ: - return l1ctl_rx_traffic_req(l1l, msg); + return l1ctl_rx_dt_req(l1l, msg, true); case L1CTL_PARAM_REQ: return l1ctl_rx_param_req(l1l, msg); case L1CTL_TCH_MODE_REQ: -- To view, visit https://gerrit.osmocom.org/7210 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I288f5d7b6cd242c4793973dcb3d2b1b6925d61a7 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/l1ctl_link.c: allocate msgb after its length is read
Review at https://gerrit.osmocom.org/7209 trxcon/l1ctl_link.c: allocate msgb after its length is read Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061 --- M src/host/trxcon/l1ctl_link.c 1 file changed, 8 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/09/7209/1 diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index 0fa3efe..20cb70c 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -75,19 +75,10 @@ uint16_t len; int rc; - /* Allocate a new msg */ - msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, - L1CTL_HEADROOM, "l1ctl_rx_msg"); - if (!msg) { - LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); - return -ENOMEM; - } - /* Attempt to read from socket */ rc = read(bfd->fd, , L1CTL_MSG_LEN_FIELD); if (rc < L1CTL_MSG_LEN_FIELD) { LOGP(DL1D, LOGL_NOTICE, "L1CTL has lost connection\n"); - msgb_free(msg); if (rc >= 0) rc = -EIO; l1ctl_link_close_conn(l1l); @@ -98,10 +89,17 @@ len = ntohs(len); if (len > L1CTL_LENGTH) { LOGP(DL1D, LOGL_ERROR, "Length is too big: %u\n", len); - msgb_free(msg); return -EINVAL; } + /* Allocate a new msg */ + msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM, + L1CTL_HEADROOM, "l1ctl_rx_msg"); + if (!msg) { + LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n"); + return -ENOMEM; + } + msg->l1h = msgb_put(msg, len); rc = read(bfd->fd, msg->l1h, msgb_l1len(msg)); if (rc != len) { -- To view, visit https://gerrit.osmocom.org/7209 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b941c5ed91097c4ed2d859634bbe89f44546061 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon: clarify L1CTL message length field
Review at https://gerrit.osmocom.org/7208 trxcon: clarify L1CTL message length field Each L1CTL message gets its own length pushed in front before sending. This isn't specified in the 'l1ctl_proto.h', but assumed in the code. Let's clarify this. Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122 --- M src/host/trxcon/l1ctl.c M src/host/trxcon/l1ctl_link.c M src/host/trxcon/l1ctl_link.h 3 files changed, 19 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/08/7208/1 diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index 58b8a4f..f138b88 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -49,8 +49,14 @@ static struct msgb *l1ctl_alloc_msg(uint8_t msg_type) { struct l1ctl_hdr *l1h; - struct msgb *msg = msgb_alloc_headroom(256, 4, "l1ctl_tx_msg"); + struct msgb *msg; + /** +* Each L1CTL message gets its own length pushed in front +* before sending. This is why we need this small headroom. +*/ + msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_MSG_LEN_FIELD, + L1CTL_MSG_LEN_FIELD, "l1ctl_tx_msg"); if (!msg) { LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n"); return NULL; diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c index a7277ea..0fa3efe 100644 --- a/src/host/trxcon/l1ctl_link.c +++ b/src/host/trxcon/l1ctl_link.c @@ -84,8 +84,8 @@ } /* Attempt to read from socket */ - rc = read(bfd->fd, , sizeof(len)); - if (rc < sizeof(len)) { + rc = read(bfd->fd, , L1CTL_MSG_LEN_FIELD); + if (rc < L1CTL_MSG_LEN_FIELD) { LOGP(DL1D, LOGL_NOTICE, "L1CTL has lost connection\n"); msgb_free(msg); if (rc >= 0) @@ -198,8 +198,8 @@ LOGP(DL1D, LOGL_INFO, "Message L1 header != Message Data\n"); /* Prepend 16-bit length before sending */ - len = (uint16_t *) msgb_push(msg, sizeof(*len)); - *len = htons(msg->len - sizeof(*len)); + len = (uint16_t *) msgb_push(msg, L1CTL_MSG_LEN_FIELD); + *len = htons(msg->len - L1CTL_MSG_LEN_FIELD); if (osmo_wqueue_enqueue(>wq, msg) != 0) { LOGP(DL1D, LOGL_ERROR, "Failed to enqueue msg!\n"); diff --git a/src/host/trxcon/l1ctl_link.h b/src/host/trxcon/l1ctl_link.h index f9d91f1..01103dc 100644 --- a/src/host/trxcon/l1ctl_link.h +++ b/src/host/trxcon/l1ctl_link.h @@ -1,5 +1,7 @@ #pragma once +#include + #include #include #include @@ -9,6 +11,12 @@ #define L1CTL_LENGTH 256 #define L1CTL_HEADROOM 32 +/** + * Each L1CTL message gets its own length pushed + * as two bytes in front before sending. + */ +#define L1CTL_MSG_LEN_FIELD 2 + /* Forward declaration to avoid mutual include */ struct trx_instance; -- To view, visit https://gerrit.osmocom.org/7208 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I118d00613aeaf5ff0bad1188fa5f7450d4ca8122 Gerrit-PatchSet: 1 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim Yanitskiy
[PATCH] osmocom-bb[fixeria/trx]: trxcon/scheduler: transmit dummy frames on CBTX lchans
trxcon/scheduler: transmit dummy frames on CBTX lchans If at the moment of transmission there are no frames in TX buffer, then either a dummy LAPDm frame (0x01, 0x03, 0x01, 0x2b ...) or a silence frame (depending on a codec in use) shall be transmitted. This is required for proper measurements on the BTS side. Change-Id: Ie590990f2274ea476678f6b2079f90eeadab6501 --- M src/host/trxcon/sched_prim.c M src/host/trxcon/sched_trx.c M src/host/trxcon/sched_trx.h M src/host/trxcon/trxcon.c 4 files changed, 118 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/06/7206/3 diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c index fb5f0a0..c17fb2a 100644 --- a/src/host/trxcon/sched_prim.c +++ b/src/host/trxcon/sched_prim.c @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include "scheduler.h" #include "sched_trx.h" @@ -227,6 +229,93 @@ } /** + * Assigns a dummy primitive to a lchan depending on its type. + * Could be used when there is nothing to transmit, but + * CBTX (Continuous Burst Transmission) is assumed. + * + * @param lchan lchan to assign a primitive + * @return zero in case of success, otherwise a error code + */ +int sched_prim_dummy(struct trx_lchan_state *lchan) +{ + enum trx_lchan_type chan = lchan->type; + uint8_t tch_mode = lchan->tch_mode; + struct trx_ts_prim *prim; + uint8_t prim_buffer[40]; + size_t prim_len = 0; + int i; + + /** +* TS 144.006, section 8.4.2.3 "Fill frames" +* A fill frame is a UI command frame for SAPI 0, P=0 +* and with an information field of 0 octet length. +*/ + static const uint8_t lapdm_fill_frame[] = { + 0x01, 0x03, 0x01, + /* Pending part is to be randomized */ + }; + + /* Make sure that there is no existing primitive */ + OSMO_ASSERT(lchan->prim == NULL); + + /** +* Determine what actually should be generated: +* TCH in GSM48_CMODE_SIGN: LAPDm fill frame; +* TCH in other modes: silence frame; +* other channels: LAPDm fill frame. +*/ + if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) { + /** +* Silence frame indication +* HACK: use actual rsl_cmode! +*/ + prim_len = sched_bad_frame_ind(prim_buffer, + RSL_CMOD_SPD_SPEECH, tch_mode); + } else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) { + /* FIXME: should we do anything for CSD? */ + return 0; + } else { + /** +* TS 144.006, section 8.1.2.3 "Fill frames" +* A fill frame is a UI command frame for SAPI 0, P=0 +* and with an information field of 0 octet length. +*/ + memcpy(prim_buffer, lapdm_fill_frame, 3); + + /* Randomize pending unused bytes */ + for (i = 3; i < GSM_MACBLOCK_LEN; i++) + prim_buffer[i] = (uint8_t) rand(); + + /* Define a prim length */ + prim_len = GSM_MACBLOCK_LEN; + } + + /* Nothing to allocate / assign */ + if (!prim_len) + return 0; + + /* Allocate a new primitive */ + prim = talloc_zero_size(lchan, sizeof(struct trx_ts_prim) + prim_len); + if (prim == NULL) + return -ENOMEM; + + /* Init primitive header */ + prim->payload_len = prim_len; + prim->chan = lchan->type; + + /* Fill in the payload */ + memcpy(prim->payload, prim_buffer, prim_len); + + /* Assign the current prim */ + lchan->prim = prim; + + LOGP(DSCHD, LOGL_DEBUG, "Transmitting a dummy / silence frame " + "on lchan=%s\n", trx_lchan_desc[chan].name); + + return 0; +} + +/** * Flushes a queue of primitives * * @param list list of prims going to be flushed diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index 8c859de..168c4ef 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -97,6 +97,19 @@ if (lchan->prim == NULL) lchan->prim = sched_prim_dequeue(>tx_prims, chan); + /* TODO: report TX buffers health to the higher layers */ + + /* If CBTX (Continuous Burst Transmission) is assumed */ + if (trx_lchan_desc[chan].flags & TRX_CH_FLAG_CBTX) { + /** +* Probably, a TX buffer is empty. Nevertheless, +* we shall continuously transmit anything on +* CBTX channels. +*/ + if (lchan->prim == NULL) + sched_prim_dummy(lchan); + } + /* If there
[PATCH] osmocom-bb[fixeria/trx]: trxcon/sched_trx.c: fix: omit inactive logical channels
trxcon/sched_trx.c: fix: omit inactive logical channels The sched_frame_clck_cb() is responsible for UL burst transmission. Iterating over each timeslot, it chooses a proper lchan handler according to a current frame number and a multiframe layout in use, takes a L2 UL frame from a TX buffer, and finally calls the chosen handler in order to to encode and transmit a taken frame. A handler should be called only for activated logical channels... but for some long time, there was a bug, so each lchan was processed, including inactive ones. It's time to fix this. Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9 --- M src/host/trxcon/sched_trx.c 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/03/7203/2 diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index 1197f2c..8c859de 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -86,6 +86,10 @@ if (lchan == NULL) continue; + /* Omit inactive lchans */ + if (!lchan->active) + continue; + /** * If we aren't processing any primitive yet, * attempt to obtain a new one from queue -- To view, visit https://gerrit.osmocom.org/7203 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I33e3ecc14be3ae64dfd02789c7f0970c945582c9 Gerrit-PatchSet: 2 Gerrit-Project: osmocom-bb Gerrit-Branch: fixeria/trx Gerrit-Owner: Vadim YanitskiyGerrit-Reviewer: Jenkins Builder
[PATCH] osmocom-bb[fixeria/trx]: trxcon/scheduler: transmit dummy frames on CBTX lchans
trxcon/scheduler: transmit dummy frames on CBTX lchans If at the moment of transmission there are no frames in TX buffer, then either a dummy LAPDm frame (0x01, 0x03, 0x01, 0x2b ...) or a silence frame (depending on a codec in use) shall be transmitted. This is required for proper measurements on the BTS side. Change-Id: Ie590990f2274ea476678f6b2079f90eeadab6501 --- M src/host/trxcon/sched_prim.c M src/host/trxcon/sched_trx.c M src/host/trxcon/sched_trx.h M src/host/trxcon/trxcon.c 4 files changed, 118 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/06/7206/2 diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c index fb5f0a0..f04 100644 --- a/src/host/trxcon/sched_prim.c +++ b/src/host/trxcon/sched_prim.c @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include "scheduler.h" #include "sched_trx.h" @@ -227,6 +229,93 @@ } /** + * Assigns a dummy primitive to a lchan depending on its type. + * Could be used when there is nothing to transmit, but + * CBTX (Continuous Burst Transmission) is assumed. + * + * @param lchan lchan to assing a primitive + * @return zero in case of success, otherwise a error code + */ +int sched_prim_dummy(struct trx_lchan_state *lchan) +{ + enum trx_lchan_type chan = lchan->type; + uint8_t tch_mode = lchan->tch_mode; + struct trx_ts_prim *prim; + uint8_t prim_buffer[40]; + size_t prim_len = 0; + int i; + + /** +* TS 144.006, section 8.4.2.3 "Fill frames" +* A fill frame is a UI command frame for SAPI 0, P=0 +* and with an information field of 0 octet length. +*/ + static const uint8_t lapdm_fill_frame[] = { + 0x01, 0x03, 0x01, + /* Pending part is to be randomized */ + }; + + /* Make sure that there is no existing primitive */ + OSMO_ASSERT(lchan->prim == NULL); + + /** +* Determine what actually should be generated: +* TCH in GSM48_CMODE_SIGN: LAPDm fill frame; +* TCH in other modes: silence frame; +* other channels: LAPDm fill frame. +*/ + if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) { + /** +* Silence frame indication +* HACK: use actual rsl_cmode! +*/ + prim_len = sched_bad_frame_ind(prim_buffer, + RSL_CMOD_SPD_SPEECH, tch_mode); + } else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) { + /* FIXME: should we do anything for CSD? */ + return 0; + } else { + /** +* TS 144.006, section 8.1.2.3 "Fill frames" +* A fill frame is a UI command frame for SAPI 0, P=0 +* and with an information field of 0 octet length. +*/ + memcpy(prim_buffer, lapdm_fill_frame, 3); + + /* Randomize pending unused bytes */ + for (i = 3; i < GSM_MACBLOCK_LEN; i++) + prim_buffer[i] = (uint8_t) rand(); + + /* Define a prim length */ + prim_len = GSM_MACBLOCK_LEN; + } + + /* Nothing to allocate / assign */ + if (!prim_len) + return 0; + + /* Allocate a new primitive */ + prim = talloc_zero_size(lchan, sizeof(struct trx_ts_prim) + prim_len); + if (prim == NULL) + return -ENOMEM; + + /* Init primitive header */ + prim->payload_len = prim_len; + prim->chan = lchan->type; + + /* Fill in the payload */ + memcpy(prim->payload, prim_buffer, prim_len); + + /* Assign the current prim */ + lchan->prim = prim; + + LOGP(DSCH, LOGL_DEBUG, "Transmitting a dummy / silence frame " + "on lchan=%s\n", trx_lchan_desc[chan].name); + + return 0; +} + +/** * Flushes a queue of primitives * * @param list list of prims going to be flushed diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c index 8c859de..168c4ef 100644 --- a/src/host/trxcon/sched_trx.c +++ b/src/host/trxcon/sched_trx.c @@ -97,6 +97,19 @@ if (lchan->prim == NULL) lchan->prim = sched_prim_dequeue(>tx_prims, chan); + /* TODO: report TX buffers health to the higher layers */ + + /* If CBTX (Continuous Burst Transmission) is assumed */ + if (trx_lchan_desc[chan].flags & TRX_CH_FLAG_CBTX) { + /** +* Probably, a TX buffer is empty. Nevertheless, +* we shall continuously transmit anything on +* CBTX channels. +*/ + if (lchan->prim == NULL) + sched_prim_dummy(lchan); + } + /* If there