summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common/l1ctl.c
AgeCommit message (Collapse)AuthorFilesLines
2020-07-31layer23/mobile: implement handling of TCH test loop commandsVadim Yanitskiy1-1/+2
For more information, see 3GPP TS 44.014, sections: - 5.1 "Single-slot TCH loops", and - 8 "Message definitions and contents". This feature has nothing to do with the Mobility Management, so let's handle GSM48_PDISC_TEST messages in the Radio Resources layer implementation (gsm48_mm.c -> gsm48_rr.c). Change-Id: If8efc57c7017aa8ea47b37c472d1bbb1914389ca
2020-05-05mobile: traffic req check: support EFROliver Smith1-7/+0
L1CTL handling code should not be involved in such high level checks, so while at it, move the check into a separate function in gsm48_rr.c and add a length check. gsm48_rr_tx_voice() is the only caller of l1ctl_tx_traffic_req(). Related: SYS#4924 Change-Id: Iba84f5d60ff5b1a2db8fb6af5131e185965df7c9
2020-03-17layer23/l1ctl: fix: do not pass PDCH and CBCH frames to LAPDmVadim Yanitskiy1-0/+10
GPRS (PDCH) and CBCH related frames have nothing to do with LAPDm. The former uses LLC for the user-plane data, while CBCH involves its own segmentation described in 3GPP TS 23.041 and TS 44.012. There is currently no code for handling these kinds of frames, so let's just send them to GSMTAP and release the memory (msgb). Change-Id: I59b4acbe22217f8989f73b79b128a43e8bcdfa2f Related: OS#4439
2020-03-01layer23/l1ctl: fix NULL-pointer dereference reported by ASanVadim Yanitskiy1-1/+8
Some applications (e.g. ccch_scan) may not initialize ms->cellsel.si, some (e.g. mobile) may need some time to initialize it. Let's assume that 'bs_ag_blks_res' is 1 if System Information is not available. Change-Id: Ie695d9700c01ee1e6778950a2f3c8610b69d2143
2019-12-31layer23: Avoid sending downlink AGCH/PCH fill frames over GSMTAPPau Espin Pedrol1-4/+36
Some bits are taken from osmo-bts l1sap.c. Change-Id: Id21e9334b620b8ab3ad404708bfd5358e3555ab6
2019-12-31layer23: Identify AGCH from PCH on tx of GSMTAP downlink messagesPau Espin Pedrol1-1/+46
Some bits are taken from osmo-bts l1sap.c Change-Id: I0adab003a4060c9cef730e0432859659c51bd087
2019-12-31mobile: Send correct ARFCN in UL gsmtapPau Espin Pedrol1-2/+3
Change-Id: I9f677866095413a0efeb8a336ce15a2dbca2228c
2019-12-20layer23: Fix trailing whitespacePau Espin Pedrol1-2/+2
Change-Id: I295f285e5fc3cdc372723f6b4de2415a94d4979a
2018-11-05l1ctl_proto.h: use flexible array member for traffic messagesVadim Yanitskiy1-13/+22
Unlike the DATA messages, traffic frames may have different length. Instead of having fixed payload (i.e. TCH frame) length, let's introduce a flexible array member. This would allow one to calculate the frame length using the MSGB API. Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
2018-10-27layer23/l1ctl.c: fix: use host byte order for TDMA fnVadim Yanitskiy1-1/+1
Change-Id: Iad00eebf03b38b9c4fc2d7ed66697d23a953d8b2
2018-10-27layer23/common: move SIM APDU caching from l1ctl.cVadim Yanitskiy1-16/+0
L1CTL implementation (i.e. l1ctl.c) is not a good place for the SIM specific stuff. Let's move it to the proper place (i.e. sim.c). As a bonus, this change fixes a possible problem of loosing the cached APDUs if two or more L2&3 applications are using a single LAPDm connection. The APDU buffer is dedicated per MS now. Change-Id: I564c610e45aa3b630ca5d1ec6bc1cace0dc9c566
2018-10-03layer23/l1ctl.c: clean up & fix message length checkingVadim Yanitskiy1-21/+44
Almost all handlers for received L1CTL messages are also affected by the bug fixed in I7fe2e00bb45ba07c9bb7438445eededfa09c96f3. In short, they do verify the length of 'msg->l2h' or 'msg->l3h', but not the 'msg->l1h'. Let's fix this, and also add missing checks. Change-Id: I866bb5d97a1cc1b6cb887877bb444b9e3dca977a
2018-10-03layer23/l1ctl.c: avoid confusion between L1CTL / L1 headersVadim Yanitskiy1-7/+7
As we assign the payload following L1CTL header to 'msg->l1h', it makes sense to avoid possible naming confusion. Change-Id: I5d21ca8664b3445f472d3ffde90d0e11805dcb16
2018-10-03layer23/l1ctl.c: fix: verify msg length using l1h, not l2hVadim Yanitskiy1-3/+4
The actual L1CTL header is pointed by 'msg->l1h', not 'l2h'! Since msg->l2h is NULL (because nobody set it), the result of msgb_l2len() would always be bigger than size of L1CTL header, as it is calculated in the following way: return msgb->tail - (uint8_t *)msgb_l2(msgb); So, in case if 'msg->l2h' is NULL, it turns into: return msgb->tail - 0; Change-Id: I7fe2e00bb45ba07c9bb7438445eededfa09c96f3
2018-10-03layer23/l1ctl.c: fix: verify msg length against l1ctl_hdrVadim Yanitskiy1-2/+1
In l1ctl_recv() we actually expect to 'see' the L1CTL header instead of the DL info header. Let's fix this. Change-Id: Ic7d017bef04f3c186565d5dade36959df1019bd8
2018-10-03layer23/l1ctl.c: keep L1 header, drop L1CTL headerVadim Yanitskiy1-16/+5
There is no need to keep the L1CTL header in messages being sent towards the upper layers, but the L1 info header can be used by L2&3 to obtain some information, e.g. TDMA frame number. Change-Id: Id64249f1b7a1c2be578263ba62aa195c452ab7e8
2018-09-21layer23/l1ctl.c: replace printf() calls by LOGPVadim Yanitskiy1-2/+2
Change-Id: I863fb668500b2010dfef7a63217255fd010c06d7
2018-09-21layer23/l1ctl.c: drop redundant printf() callVadim Yanitskiy1-1/+0
Change-Id: I02bc581afb5a76c51fdef50ed40e2669c3eb3f2e
2018-09-07common/l1ctl.c: fix: use signed type for TA in l1ctl_tx_param_req()Vadim Yanitskiy1-1/+1
Despite the correct range of Timing Advance value is [0..63], there is a special feature in OsmocomBB which allows one to simulate the distance between both MS and a BTS by playing with the signal delay. It was discovered that l1ctl_tx_param_req() is using an unsigned 'uint8_t' type for Timing Advance value, while other code and L1CTL protocol is using signed 'int8_t'. This may result in distortion of negative values, so let's fix this! Change-Id: I6ee42b5fa2ca9ebe187f0b933465c49f840a55c2
2018-03-14common/l1ctl.c move TCH bit-ordering to the firmwareVadim Yanitskiy1-39/+0
Previously, TCH frames coming from L1 were reordered to the RTP format. Moreover, the implementation had a few problems: - L1CTL is not the best place for such manipulations; - payloads with other than FR codec were corrupted. Let's use RTP-ordered payloads on the L1CTL interface, performing TCH frame reordering at the firmware. Please note, that actual FR reordering was moved to the firmware as is, without any codec determination. This could be fixed in a separate change. Change-Id: I81ec8ed3c9e72a62b22c1720c299cdc68b733cf1
2018-03-14L1CTL/L1CTL_CRYPTO_REQ: add key length and channel infoVadim Yanitskiy1-2/+6
Previously, the L1CTL_CRYPTO_REQ message contained only a ciphering algorithm and actual Kc key to be used. The key length was calculated manually using the MSGB API. Let's avoid manual calculations here, as it may cause unexpected behavior if the message structure is changed. Also, let's fill the UL header with minimal information about a channel, which is going to be encrypted. Change-Id: I5fab079907c5276322d3ec2b46cab81f10c7ed09
2014-09-06layer23: initialize l2h/l3h pointers in rx_l1_rach_confIgor Almeida1-0/+1
Signed-off-by: Igor Almeida <igor.contato@gmail.com> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-01-12layer23: Send SIM APDUs via GSMTAP, if enabledAndreas Eversberg1-1/+18
2013-01-08fix: Use only single CCCH block to determine path lossAndreas Eversberg1-0/+7
The downlink singalling failure counter DSC is decremented by 4 in case of unsuccessfull decoding of CCCH block and incremented by 1 in case of successfull decoding of CCCH block. The initial and maximum value of 90 requires to check the signal only once per 51 multiframe. If DRX would be supported, only a subset of 51 multiframes are received, so the initial / maximum value of 90 must be reduced accordingly.
2012-11-20Tell L1CTL_FBSB_REQ the expected received signal levelHarald Welte1-1/+2
As Dieter points out, this drastically improves the resiliance to high receive levels on the C155. We cannot blindly assume a received signal level of -85 dBm if the BTS is 2m away and we actually receive -40 dBm. This patch extends the L1CTL_FBSB_REQ data structure in layer 1 with the respective field, as well as the l1ctl_tx_fbsb_req() API function called from the various layer23 apps. "mobile" and "bcch_scan" already did a PM request and thus know the expected signal power. "ccch_scan" and "cbch_sniff" apparently don't do, so the -85 dBm constant is now hardcoded into the host-side source code there, and should probably be fixed in a follow-up patch.
2012-03-29host/l1ctl: Make sure to initialize tn in neigh_pm_reqSylvain Munaut1-1/+3
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-13host/layer23: Removed local copy of LAPDm, using libosmocore instadAndreas Eversberg1-1/+1
Since libosmocore already has LAPDm implementation, we don't need the local copy of LAPDm code anymore. Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28layer23: Add mobile support for sending / receiving voice frame through MNCCAndreas.Eversberg1-6/+124
Support GSM FR codec only so far. Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-28l23/l1ctl: Add default values for audio_modeSylvain Munaut1-0/+3
Theses value should simulate the old behavior Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-17[layer23/mobile] Improvement and fixes of idle mode processAndreas Eversberg1-1/+4
This patch introduces cell re-relection. When camping on a cell, it scanns neighbour cells. If a 'better' cell is found, the cell is selected. If the cell is in a different location area, a location upating is performed under certain conditions. The 'better' cell depends on various informations that are broadcasted on the BCCH of a neihbour cell and of course the RX level. Most operators don't set these informations, so the 'better' cell depend on a better RX level for the same location area, or a much better RX level (6 dBm) at a different location area. There were many issues at the idle mode process that has been fixed. Expecially when moving, the state machines got stuck, so no more cell search was possible, or no further calls / location updating was possible. In order to see the process of cell selection, enter the VTY interface and enable the network monitor: enable monitor network 1 (where '1' is the instance of the MS) In order to see the current state of the processes, enter: show ms
2011-07-17[layer23] Adding neighbour cell measurement to L1CTL interface.Andreas Eversberg1-0/+43
2011-06-24L1CTL is sending PH-DATA.ind, not PH-DATA.req up to LAPDmHarald Welte1-1/+1
2011-06-23further decouple lapdm code from osmocom_ms and l1ctlHarald Welte1-10/+18
we introduce a new primitive layer betwen PH and DL, enabling the use of the LAPDm code in applications that are not based on L1CTL
2011-06-22remove l1ctl data structure form l2_ph_chan_conf()Harald Welte1-1/+1
This brings us one step closer to de-couple LAPDm from L1CTL
2011-06-22remove l1ctl data structure from l2_ph_data_ind()Harald Welte1-5/+2
2011-06-21layer23: make LAPDm code mostly independent of 'struct osmocom_ms'Harald Welte1-4/+4
This is one step in the direction of re-using the lapdm code in osmo-bts.
2011-05-22layer23: update to new GSMTAP API in libosmocore >= 0.3.1Harald Welte1-5/+7
2011-05-15src: use namespace prefix osmo_* for utilsPablo Neira Ayuso1-3/+3
Summary of changes: s/bcd2char/osmo_bcd2char/g s/char2bcd/osmo_char2bcd/g s/hexparse/osmo_hexparse/g s/hexdump/osmo_hexdump/g s/hexdump_nospc/osmo_hexdump_nospc/g s/ubit_dump/osmo_ubit_dump/g s/static_assert/osmo_static_assert/g
2011-05-15src: use namespace prefix osmo_signal*Pablo Neira Ayuso1-9/+9
Summary of changes: s/signal_cbfn/osmo_signal_cbfn/g s/register_signal_handler/osmo_signal_register_handler/g s/unregister_signal_handler/osmo_signal_unregister_handler/g s/dispatch_signal/osmo_signal_dispatch/g
2011-04-26src: use new libosmogsm and include/osmocom/[gsm|core] path to headersPablo Neira Ayuso1-10/+10
This patch changes include paths to get osmocom-bb working with the current libosmocore tree. Among all these renames, you can notice several tweaks that I added on purpose, and that require some explanation, they are: * hexdump() in osmocon.c and osmoload.c has been renamed to avoid clashing with hexdump() defined in libosmocore. * gsmmap now depends on libosmogsm. Actually I had to cleanup Makefile.am because I was experiencing weird linking problems, probably due to a bug in the autotools. With the change included in this patch, I got it compiled and linked here correctly. This patch has been tested with the phone Motorola C123 and the following images files: * firmware/board/compal_e88/hello_world.compalram.bin * firmware/board/compal_e88/layer1.compalram.bin Using the osmocon, bcch_scan and mobile tools. Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-01-27[l1ctl] Adding missing msgb_free()Andreas.Eversberg1-0/+1
When a corrupt frame cannot be delivered, it is dropped. Also it must be freed.
2010-11-13[layer23] msgb_free() must in l1ctl.c must called after reading its headerAndreas.Eversberg1-1/+1
2010-10-30layer23: Use the new rach_req format in l1ctl and update l23 apps to use itAndreas.Eversberg1-5/+5
This removes an old hack Written-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-10-12[layer23] Implementation of signal loss criteria as defined in TS 05.08Andreas.Eversberg1-9/+45
There are two criterions for lossing a signal, idle mode and dedicated mode. A counter counts down when a frame is dropped, and counts up when a valid frame is received on certain channel. The loss criterion is reached, if the counter reaches 0. The values added to / removed from the counter and the limits depend on the process.
2010-10-05[layer23] Increase sync tollerance by increasing freq_err_thresh1Andreas.Eversberg1-1/+1
This is a quick workarround to make synchronizing to a cell more reliable. Without it, just a few cells will sync. When network search is restarted, no more sync happens. By increasing the freq_err_thresh1 to 10000, many cells sync, even after the first network search.
2010-09-28l1ctl: Add initial tch_mode value in DM_EST_REQSylvain Munaut1-2/+4
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-09-26[layer23] Cleanup of various 'printf' debuggingAndreas.Eversberg1-20/+20
2010-09-26[layer23] Added support for changing TCH mode via L1CTL messagesAndreas.Eversberg1-1/+46
2010-09-26[layer23] Adding application generated measurement reportAndreas.Eversberg1-1/+5
The cell provides SYSTEM INFORMATION 5* and 6. These are used to create a list of neighbor cells to monitor. Because there is no neighbor cell monitoring supported by layer1, the list has no valid results yet. Currently the average RX level of received frames are used to generate a new report every second. The report is transmitted to layer1 and used there whenever a measurement report has to be transmitted. The timing advance and the current transmit power (as requested by network), is included with every report.
2010-09-18[layer23] SIM client completionAndreas.Eversberg1-0/+36
The SIM client is now complete. Because it usefull for multiple applications, i moved it to the layer23/src/common directory. The SIM reader works together with mobile process. Fixes were made. Thanx to all for testing, finding bugs, and making it work as it is supposed to do. The current version uses special L1CTL messages to send and receive APDUs. This will change in the future, when BTSAP interface is completed. Please note that this client will not work until the layer1 SIM reader fixes and extensions are committed.