aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ms/MsTest.err
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25Make sure GprsMs free() also frees its tbfsPau Espin Pedrol1-4/+4
This fixes TBF objects leaking and ending up alive when the MS object is explicitly freed through talloc_free (and sporadically crashing TbfTest once a timeout for them occur). This mostly affects unit tests, where most of the explicit free() happens. In osmo-pcu, in general, the GprsMs object only gets _free() called when its resource count reaches 0, aka no more TBFs are attached to it. Hence in general GprsMs object is freed() only when no TBFs (to be leaked) are present. However, in the unit tests it's usual that we want to wipe the entire context by eg. feeing the PCU, the BTS or MS object, which should also free the related TBFs. When running osmo-pcu this may only be an issue when the MS object is freed explicitly, which could happen for instance when a BTS is torn down, ie. PCUIF going down, moment at which all GprsMs of that BTS are freed. But in there actually it iterates over PDCHs to free all TBFs, so it's fine. If we iterated over MS, this could have ended up in a crash, like it happened in TbfTest sporadically, but it's not a bit problem if we crash + restart at that time since anyway the BTS is gone ore just getting up around that time. Related: OS#6359 Change-Id: Ibbdec94acb8132be20508d3178d88da44bfaf91d
2023-05-31tbf: Improve TBF name description in logsPau Espin Pedrol1-22/+22
Change format to print the state at the end, to resemble more the same format used by FSMs. Furthermore, by moving it at the end, print it only when "enclousure" is requested, aka when not requested by FSM to update its internal name. The consequence of this logc is that log lines printed from FSM don't end up with the same state string printed twice in different places. While at it, shorten the EGPRS/GPRS indicator to one character, which should be understandable enough since it matches what's usually seen in mobile phones to signal one or another. Change-Id: I86b5f042fae77721b22fc026228677bd56768ba9
2023-04-21ms: Increase log level when scheduling release timerPau Espin Pedrol1-0/+1
Change-Id: Ie470b5b0c7b01d91f4ad693e52afd51860d6da2d
2023-04-21ms: Hold a reference during ms_allocPau Espin Pedrol1-6/+8
Make the caller hold a reference to the MS object just allocated, so that it hs to explicitly unref it and, in turn, if no new references were added during its use, trigger release of the MS object. This is useful to avoid leaking MS object if it was allocated and then no TBF is attached to it because allocation of TBF failed. Related: OS#6002 Change-Id: I2088a7ddd76fe9157b6626ef96ae4315e88779ea
2023-04-20ms: Rewrite MS release lifecyclePau Espin Pedrol1-35/+14
This commit changes lots of stuff in the MS release lifecycle, but there's no really good way to split this into patches which make sense, since all the chaos is intensively entangled. Get rid of the ms_callback complex mess, it is not needed at all. Previous MS release was strange due to the existance of previous ms_callback.idle concept and MS storage: the MS signalled when it went idle (no TBFs attached) and waited for somebody outside to free it, while then arming itself the release timer to release itself if it was not released by whoever. The new lifecycle follows an easier (expected) approach: Whenever all TBFs become detached from the MS and it becomes idle (use_count becomes 0), then it frees its reserved resources (TFI, etc.) and either: * frees itself immediatelly under certain conditions (release timeout configured = 0 or MS garbage with TLLI=GSM_RESERVED_TMSI) * Arms release_timer and frees itself when it triggers. If during release_timer the MS is required again (for instance because a new TBF with TLLI/IMSI of the MS is observed), then a TBF is attached to the MS and it is considered to become active again, hence the release_timer is stopped. OS#6002 Change-Id: Ibe5115bc15bb4d76026918adc1be79469c2f4839
2023-04-20ms: Log detaching tbf log line in proper placePau Espin Pedrol1-12/+12
It is interesting to log that a tbf is being detached *before* it actually happens, so that the reader can see which TBF is being detached. Change-Id: I2008beb9ab8f97f7ea5ed7b45cfb3f23dfe7b27f
2023-04-20ms: Make ms_{attach,detach}_tbf expectancies more robustPau Espin Pedrol1-2/+2
* Make sure that the tbf being attached has already the MS assigned. * Check no re-attaching of alredy attached TBF ever happens. * Document and early skip case where a non-attached TBF detach is attempted. * Avoid recursive call mess to tbf_set_ms(tbf, NULL); during detach. * MsTest needs to be modified since it uses fake TBF objects which use different set of calls than the regular TBFs in osmo-pcu. Since the ul_tbf object is reused, it needs to be assigned ul_tbf->ms again before re-assigning it, as per what happens usually in tbf_set_ms() in osmo-pcu. Change-Id: Ia18fe2de1fb3bf72f530157e5f30de64f2b11e12
2023-04-20ms: Use osmo_use_count to track referencesPau Espin Pedrol1-0/+28
Change-Id: Ib65629224e6bd5683bb9192ba4354e965e8d39ec
2023-04-20ms: store in bts->ms_list during alloc/destroy of ms objectPau Espin Pedrol1-0/+5
With this change the MS no longer is removed from the llist without potentially skipping free() if not idle in bts_ms_idle_cb(). As a result, some unit tests now can free it during bts tear down instead of having them leaked. The tests int MsTest need changes because the tbfs created are fake and cannot be freed using tbf_free(), and hence cannot be detached from MS using regular code paths. Instead first call explicit talloc_free(ms) like other unit tests in the file already do. Change-Id: Id53f8dfb9963366dd4b19a324615bbc83c4f23e7
2023-04-17ms: Drop setting tlli during ms_alloc()Pau Espin Pedrol1-11/+18
Inside osmo-pcu code, the code path is to always call ms_alloc with tlli=GSM_RESERVED_TMSI; a different value is only passed during unit tests. It makes no sense to have unit tests using differnet code paths than ther app itself, since in the app it always desired to go through the ms_set_tlli() and ms_confirm_tlli() which does more stuff. Hence, drop the tlli param in ms_alloc and change the unit tests to use the available APIs used by the application. Change-Id: I730ec911a43b0f4e78faee4eeffb3ca8601564f8
2022-11-03Improve MS loggingPau Espin Pedrol1-32/+32
Use same formatting similar to what's now used in TBF, which is far more easy to grep and follow. This way one can easily follow what happens to a given IMSI, a give TFI, a given TLLI, etc. Change-Id: If9b325764c8fd540d60b6419f32223fd7f5a5898
2022-11-03Improve TBF loggingPau Espin Pedrol1-24/+24
use a format in tbf::name() which is sanitized (osmo_sanitize) and hence can be used both in regular log as well as for its internal FSM ids. Until now, the FSMs contained a small amount of information with different formatting than the regular LOGPTFB(), which made it difficult to grep or follow a TBF through its lifetime looking at logs. The new unified format makes that a lot easier. Extra information is now printed if available, such as IMSI. Furthermore, the TFI is updated to include BTS and TRX, since the TFI is unique within the scope of a TRX. Change-Id: I3ce1f53942a2f881d0adadd6e5643f5cdf6e31da
2021-11-08tbf: Set tfi to initial special valuePau Espin Pedrol1-24/+24
This allows distinguishing when a TBF didn't set the TFI. Useful to identify dummy reject TBFs, etc, and make sure a non-dummy TBF set its TFI properly. Change-Id: Iecf54a24041bd14f4ef5b86e57c3732e1b69d463
2021-10-12tbf_fsm: rename state NULL -> NEWPau Espin Pedrol1-24/+24
This helps distinguishing the case where a TBF is in the initial state and the unexpected case where osmo_fsm_inst_state_name reports "NULL" due to fi pointer being NULL. Change-Id: Ieaabfc9fa0dedb299bcf4541783cf80e366a88c3
2021-03-03gprs_ms: Use standarized logging on more messagesPau Espin Pedrol1-31/+31
Change-Id: If7f471f4932c2347cd857cd59f761a36d9e735d1
2021-03-03ms: clarify delayed MS release process related code and loggingPau Espin Pedrol1-1/+1
Change-Id: Ieaea6ab07b4b2822bcf394f2d0e9298b9f3c5854
2020-11-10TLLI 0x00000000 is a valid TLLI, use 0xffffffff insteadVadim Yanitskiy1-6/+6
The assumption that TLLI 0x00000000 is invalid and can be used as the initializer is wrong. Similar to TMSI, 0x00000000 is a perfectly valid value, while 0xffffffff is reserved - use it. According to 3GPP TS 23.003, section 2.4, a TMSI/P-TMSI with all 32 bits equal to 1 is special and shall not be allocated by the network. The reason is that it must be stored on the SIM, where 'ff'O represents the erased state. According to section 2.6 of the same document, a local/foreign TLLI is derived from P-TMSI, so the same rule applies to TLLI. I manually checked and corrected all occurances of 'tlli' in the code. The test expectations have been adjusted with this command: $ find tests/ -name "*.err" | xargs sed -i "s/0x00000000/0xffffffff/g" so there should be no behavior change. The only exception is the 'TypesTest', where TLLI 0xffffffff is being encoded and expected in the hexdump, so I regenerated the test output. Change-Id: Ie89fab75ecc1d8b5e238d3ff214ea7ac830b68b5 Related: OS#4844
2020-10-24tbf: Set MS during constructor timePau Espin Pedrol1-20/+20
This is another step forward towards a more clear data model where a TBF always has a MS object (which may be lacking some information, and at a later point when more information is found, it may actually be a duplicated MS object and hence one duplicate removed and the TBF moved to the object being kept). This helps for instance in removing duplicated information stored in the TBF which is really per MS, like ms_class, ta, etc. Since there's always a MS object there's no need to keep a duplicate in both classes in case there's no MS object. It can already be seen looking at unit test logging that this kind of data model already provides better information. Some unit test parts were needed to adapt to the new model too. Change-Id: I3cdf4d53e222777d5a2bf4c5aad3a7414105f14c
2019-04-11Add test for MS mode and (M)CS settingsMax1-0/+3
Right now set_mode() on GprsMs behaves in pretty counter-intuitive way: * it's possible to set current DL MCS higher than max value * EGPRS and EGPRS_GMSK have the same max DL MCS * setting EGPRS* mode drops current/max MCS values to unknown Let's capture this in a unit-test before attempting any further modifications. Change-Id: Ibf917f4b49d927a21cbd467775806fa6ea06a6a6
2015-08-24ms: Store references to replaced TBFs in the MS objectJacob Erlbeck1-1/+1
Currently when calling GprsMs::attach_tbf and a TBF of the same direction already exists, the old TBF gets detached from the MS object. Therefore that TBF object loses access to that MS object including for instance TLLI and IMSI. This leads to failing DL TBF reuses, since the downlink assigment cannot be sent on the PACCH later on because that must be sent on the old DL TBF which ms() is NULL and the new DL TBF cannot be retrieved. This commit fixes this bug by changing the GprsMs implementation to keep a list of replaced (old) TBFs. TBFs are only removed when they are being detached explicitely (see tbf_free and set_ms). Addresses: tbf.cpp:741 We have a schedule for downlink assignment at uplink TBF(TFI=1 TLLI=0xf35a680e DIR=UL STATE=RELEASING), but there is no downlink TBF Sponsored-by: On-Waves ehf
2015-06-22ms: Reduce DL CS level if only a few LLC bytes are leftJacob Erlbeck1-0/+2
If just a few bytes are left to send to the MS, it makes sense to reduce the coding scheme level to increase the throughput. This has been shown by Chen and Goodman in their paper "Theoretical Analysis of GPRS Throughput and Delay". See their throughput over C/I measurement graphs (figures 4 and 5 in the paper) for details. This commit implements a simplified CS downgrade feature for the downlink. The coding scheme will be downgraded if there are only a few octets are left to be send over the TBF (see the downgrade-threshold command below) and the NACK rate is not low (the CS will not get degraded on a high quality RF link). As an exception, CS-3 will be degraded to CS-1, since CS-2 does not improve the throughput in general when a few small packets are sent and the signal fades slowly (see Chen/Goodman). The following VTY command is added to the config-pcu node: - cs downgrade-threshold <1-10000> - cs no downgrade-threshold to set the threshold of the number of remaining bytes to be RLC/MAC encoded. The CS will only be reduced, if the number is below the threshold. The 'no' command disables this feature completely. The default value is 200 octets. Sponsored-by: On-Waves ehf
2015-05-28ms: Add timerJacob Erlbeck1-0/+7
Currently the MS object is immediately idle when all TBFs are detached and if no guard is being used. Since the plan is to use the MS objects to pass information from one TBF to the next one even across the gap of some seconds of inactivity, a mechanism is needed to keep the MS objects around for some time. This commit extends the GprsMs class by a timer that keeps the MS objects in non-idle state for some time after all TBFs have been detached. The set_timeout method must be used with a non-zero value to activate this feature. Sponsored-by: On-Waves ehf
2015-05-28ms: Use the IMSI to retrieve the MS objectJacob Erlbeck1-0/+2
This commit extends get_ms() to really compare the IMSI if it has been given. Matching by TLLI has a higher precedence than matching by IMSI. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-27tbf: Always call set_tlli/confirm_tlli in update_msJacob Erlbeck1-2/+4
Currently the m_tlli member in GprsMs is set by the constructor, circumventing the TLLI confirmation mechanism. This commit replaces the get_or_create_ms() method by a create_ms() method which takes the TLLI and the direction (UL or DL) as parameters to select either set_tlli() or confirm_tlli(). The MS object is instantiated with TLLI = 0, and therefore GprsMs::tlli() is extended to return the DL TLLI if both of the other TLLI are not set. Note that create_ms() will not check whether an MS object with a matching TLLI is already stored in the list, so it should only be called after a corresponding get_ms() in general. Sponsored-by: On-Waves ehf
2015-05-21ms: Support new and old TLLIsJacob Erlbeck1-0/+17
According to the specification (GSM 04.08/24.008, 4.7.1.5) after a new P-TMSI has been assigned, the old P-TMSI must be kept basically until it has been used by both sides. Since the TLLI will be derived from the P-TMSI, the old TLLI must also be kept until the new TLLI has been used by both MS and SGSN. This commit modifies the TLLI handling of GprsMs accordingly. set_tlli() is only used with TLLIs derived from MS messages, confirm_tlli() is used with TLLIs derived from messages received from the SGSN. tlli() returns the value set by the MS. check_tlli() matches each of the TLLI used by either MS or SGSN as well as the old TLLI until it has been confirmed. Sponsored-by: On-Waves ehf
2015-05-20ms: Add MS storage classJacob Erlbeck1-0/+8
Currently the MS objects are contained in the TBF objects only. To allow for an extended life time after the TBF objects have been freed and to find them based on TLLI, a container for the MS objects is needed. This commit adds the container class and also adds the corresponding m_list member to GprsMs. Further integration into the PCU code is not yet done. Ticket: #1674 Sponsored-by: On-Waves ehf
2015-05-20ms: Add GprsMs class to hold per-MS informationJacob Erlbeck1-0/+20
Currently only TBF objects are used to handle the data flow between the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI) is copied between successive TBFs. If all TBFs (uplink and downlink) are idle for some time, all information about the MS is discarded in the PCU. This makes the implementation of some features more difficult, e.g. proper TLLI and timing advance handling, connection based CS selection, and proper management of multiple TBF. This commit adds the GprsMs class that is intended to hold information directly related to the MS and to keep references to the active TBFs. The class is not yet integrated with the other PCU code. A GprsMs object container and MS specific fields (TA, CS) will be added in later commits. Note that calling detach_tbf() can possibly delete the MS object depending on the callback implementation. Ticket: #1674 Sponsored-by: On-Waves ehf