Commit Graph

1294 Commits

Author SHA1 Message Date
Andreas Eversberg 8d24b2f395 [mobile] Added missing curly braces, as proposed by Harald 2011-07-17 12:23:59 +02:00
Andreas Eversberg 051dedd235 [layer23] Added special return value for invalid MCC/MNC input
This way an MNC of 000 can be entered.
2011-07-17 12:15:04 +02:00
Andreas Eversberg 9cfc096477 [layer23] Correctly report to restart mobile instance after band change
Mobile instance must be restarted (shutdown / no shutdown) in order to
apply changes to the available ARFCNs.
2011-07-17 12:13:34 +02:00
Andreas Eversberg ff42943fe7 [layer23] Fixes and improvements of system information decoding 2011-07-17 12:12:18 +02:00
Sylvain Munaut 2908849908 fw/apps: Remove manual gain control with keyboard
- It's broken by the use of compute_gain
 - Since there is now an AGC loop, manually setting the register
   as no effect.

If someone needs manual gain control for testing, he'll have to
re-implement a proper AGC override.


Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-07-17 12:05:07 +02:00
Andreas Eversberg 9548ac0a41 [layer23/mobile] Improvement and fixes of idle mode process
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 11:12:15 +02:00
Andreas Eversberg c99e2778f0 [mobile] Corrected output value of PCS power class 2011-07-17 10:58:21 +02:00
Andreas Eversberg 072c2d4641 [mobile] Adding option to hide most default values in config
In order to shrink config output, a new config option "[no] hide-default"
is added. The config is now easier to read, but does not show all available
options, if they are set to default. Newcommers may want to see all
available options in config. Therefore all options are show by default.

To hide default options, enter:

configure terminal
hide-default
end
2011-07-17 10:52:05 +02:00
Andreas Eversberg a33bc87fe7 [mobile] Adding PCS band to list of maximum ARFCNs to scan in one band 2011-07-17 10:23:35 +02:00
Andreas Eversberg cc10636f91 [mobile] Adding security warning, if default IMEI is not changed 2011-07-17 10:18:46 +02:00
Andreas Eversberg af06f00219 [layer23] Adding "neighbour cell" logging category: DNB 2011-07-17 10:03:34 +02:00
Andreas Eversberg 599d922134 [layer23] Detach SIM, if reading fails
This way the mobility management and cell selection process continues as
if no SIM has been inserted.
2011-07-17 09:50:36 +02:00
Andreas Eversberg 74e7535ea2 [layer1] Adding neighbour cell measurement code to layer1.
When listening to BCCH, layer1 may measure the power level of neighbour
cells. A list of neighbour cell frequencies need to be sent to layer1.
After the measurement is done, the results are indicated to layer23.
2011-07-17 09:41:19 +02:00
Andreas Eversberg 87c597abf6 [layer23] Adding neighbour cell measurement to L1CTL interface. 2011-07-17 09:36:49 +02:00
Andreas Eversberg 065b6e35a3 [rf] Adding rffe_set_gain() and rffe_get_gain() to get/set computed gain
rffe_compute_gain() is the new name for rffe_set_gain(). I needed to change
this, to solve the name collision with the rffe_set_gain() function, which
actually sets the absolute gain.

rffe_get_gain() will now read the absolute gain which has been computed by
rffe_compute_gain() or set by rffe_set_gain().
2011-07-17 09:27:35 +02:00
Andreas Eversberg e91dfa950e [layer23] Fixed handling of channel 0 in certain loops
The ARFC counts from 1 to 1023, and then to 0. The index of these loops
count from 1 to 1024. The index 1024 stands for ARFCN 0.

This also reverses commit eb77945e16.
2011-07-17 09:09:32 +02:00
Harald Welte d5c9c73622 tpu_window: Fix int16_t overflow in tpu_window calculation
First we add 55500 to an int16_t, then later we subtract it again.
The bug only didn't become apparent as we wrap twice, once adding
then subtracting.

Discovered by Smatch:
firmware/layer1/tpu_window.c +127 l1s_rx_win_ctrl(24) warn: value 55000 can't fit into 32767 'stop'
2011-07-16 18:01:48 +02:00
Harald Welte c9297d28e0 calypso/uart.c: Fix array bounds checking
Found by Smatch:
calypso/uart.c +433 uart_baudrate(7) error: buffer overflow 'divider' 7 <= 7
2011-07-16 17:48:20 +02:00
Harald Welte 5339425de9 calypso/irq: Fix array bounds checking
Found by Smatch:
calypso/irq.c +200 irq_register_handler(5) error: buffer overflow 'irq_handlers' 32 <= 32
2011-07-16 17:46:54 +02:00
Harald Welte 48db968916 settings.h: IMSI is 15 bytes +1 \0 maximum
If we use a larger field to store the IMSI, we can create overflows when
copying the imsi to other structures that are only 16 bytes in size.

Detected by Smatch:
src/host/layer23/src/mobile/subscriber.c +195 gsm_subscr_testcard(39) error: strcpy() 'set->test_imsi' too large for 'subscr->imsi' (20 vs 16)
2011-07-16 17:41:02 +02:00
Harald Welte eb77945e16 sysinfo.h: ARFCN can be 0..1024, so we need an array of 1025 entries
Detected by Smatch:
src/host/layer23/src/mobile/gsm48_rr.c +1658 gsm48_new_sysinfo(23) warn: buffer overflow 's->freq' 1024 <= 1024
2011-07-16 17:38:19 +02:00
Harald Welte cd4da1d350 gsm48_rr: Don't overflow array boundary
Detected by Smatch:
src/host/layer23/src/mobile/gsm48_rr.c +3021 gsm48_rr_render_ma(89) warn: buffer overflow 'cd->freq_seq_lv' 10 <= 10
src/host/layer23/src/mobile/gsm48_rr.c +3023 gsm48_rr_render_ma(91) error: buffer overflow 'cd->freq_seq_lv' 10 <= 10
2011-07-16 17:37:34 +02:00
Harald Welte b631c289c3 osmocon: if we ignore a return value, we don't need to assign it to a variable 2011-07-16 17:34:07 +02:00
Harald Welte 1520fad932 osmocon: get rid of some Smash warnings 2011-07-16 14:52:18 +02:00
Holger Hans Peter Freyther 58a1b81425 misc: Fix crash in cell_log due missing l1_prim_cb
Commit 3538c38835 introduced the
l1_prim_cb but the init of the misc apps were not updated, make
it us the generic callback that should restore the previous behavior
2011-07-16 09:33:35 +02:00
Harald Welte d6663ad996 lapdm: fix use-after-free
We cannot msgb_free() the msgb and then later reference msg->l2h!
2011-06-27 08:41:32 +02:00
Sylvain Munaut 6fb598d31e Merge commit '2a68c7c8cd2eca65c58c0898d0e1716e9d4c3ecd' 2011-06-26 11:43:51 +02:00
Andreas Eversberg 2a68c7c8cd gsm/utils: Adding conversion of "mobile power class" to dBm
Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-26 11:41:48 +02:00
Andreas Eversberg bd3629e4e6 fw/l1a: Add a message to safely count the length of a txqueue
(that is by locking)

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:46:24 +02:00
Sylvain Munaut 402634a0cf fw/sercomm: Additional locking needed in drv_pull
Credits to Andreas Eversberg for finding this bug after countless
hours of debug and providing initial patch :)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:42:38 +02:00
Sylvain Munaut 301eb4753a fw/sercomm: Fix up the locking using an 'abstraction' layer
Not _that_ abstract but a long is enough to store a ptr if need
be :p

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:38:20 +02:00
Sylvain Munaut 5907bfd39a fw/comm/msgb: Protect allocation routine with proper locking
Credits to Andreas Eversberg for finding this bug after countless
hours of debug :)

Written-by: Andreas Eversberg <jolly@eversberg.eu>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:29:09 +02:00
Sylvain Munaut fc16cbb578 fw/comm/msgb: Really panic (i.e. lockup) if we run out of msgb
Ideally we should only panic in interrupt context. In user
context, we could wait ...

We could also return NULL and let the calling code deal with it
but it's not ready for that yet.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:29:06 +02:00
Sylvain Munaut 6eba3fe6a5 fw/comm: Remove useless include from msgb.c
Left over from the backlight debug code

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-06-25 22:28:57 +02:00
Sylvain Munaut 9be610aaba Merge commit '620f7ab35034f78f894319e027a151568c331eea' 2011-06-25 22:26:49 +02:00
Harald Welte 620f7ab350 sysinfo: add EXTENDED MEASUREMENT ORDER / MEASUREMENT INFO to SI types
those two are used in the RSL SACCH FILLING messages and delivered
like SI5 / SI6.
2011-06-25 21:39:18 +02:00
Harald Welte 3d73227b61 RSL: Fix typo 2011-06-25 21:39:01 +02:00
Harald Welte 4a8fb6111b lapdm: properly set the msg->l3h to the contents of the RSL L3_INFO IE 2011-06-25 18:32:08 +02:00
Harald Welte 7506e29c61 lapdm: introduce a new lapdm_phsap_dequeue_prim()
This function can be called by a TDMA-driven L1 which will never actually want
to receive unsolicited/asynchronous PH-DATA.req primitives, but who will simply
directly poll the LAPDm transmit queue by calling the abovementioned function
2011-06-24 22:05:46 +02:00
Harald Welte 50c035c309 lapdm: Don't try to send data using a PH-RACH.req, use PH-DATA.req 2011-06-24 15:57:59 +02:00
Harald Welte 619038bc9d lapdm: some more error reporting in case strange primitives arrive from L1 2011-06-24 15:28:02 +02:00
Harald Welte a9da9b730d L1CTL is sending PH-DATA.ind, not PH-DATA.req up to LAPDm 2011-06-24 15:26:59 +02:00
Harald Welte ec71711ebf introduce LAPDM entity flags for PH-EMPTY_FRAME.req and pollling
polling means that we never try to proactively generate a PH-DATA.req
unless there was a PH-RTS.ind first.
2011-06-24 13:56:48 +02:00
Harald Welte 04190eabd3 lapdm: Introduce LAPDM_MODE_{BTS,MS} to run on both sides
We also introduce some related functions like
	lapdm_{entity,channel}_set_mode()
	lapdm_{entity,channel}_reset()

This is all in preparation for the Osmo-BTS Work.
2011-06-24 12:23:17 +02:00
Harald Welte 68d03b86f4 lapdm: implement RSL CHAN RQD generation from PH-RA.ind 2011-06-24 00:42:01 +02:00
Harald Welte bee8a01b8d lapdm: use msgb_tlv_put instead of manual equivalent 2011-06-24 00:13:17 +02:00
Harald Welte 88f5d463d2 fix some spillage from recent conversion 2011-06-24 00:04:50 +02:00
Harald Welte 3008f31074 lapdm: remove dependency to osmocom_data.h 2011-06-24 00:04:37 +02:00
Harald Welte e4ea01041e lapdm: remove get_rsl_name() and use libosmogsm:gsm_rsl_name() instead 2011-06-23 23:57:34 +02:00
Harald Welte 3538c38835 further decouple lapdm code from osmocom_ms and l1ctl
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-23 23:55:20 +02:00