Commit Graph

1368 Commits

Author SHA1 Message Date
Harald Welte 576408b651 VIRT-PHY: cause BTS to terminate in case of recv()/send() on udp socket returns 0
It is important that we reliably terminate the BTS in case any of the
VirtPHY multicast sockets dies for whatever reason.

Change-Id: I5ae3fdd7cc35fdf235550a3b8362020fdd287c13
2017-07-13 21:35:33 +02:00
Harald Welte e3b8279f26 VIRT-PHY: Use IPv4 multicast groups for private / local scope
The addresses in the original code make little sense:
* 224.0.0.1 is "All systems on this subnet" and not routed
  outside the local ethernet segment
* 225.0.0.1 is in a RESERVED range that shouldn't be used

Change-Id: Iba1ae69f3f193a33f1da343c6562f67bd8d3557f
2017-07-13 21:35:33 +02:00
Sebastian Stumpf 6feae225eb VIRT-PHY: Added test option for fast hyperframe repeat.
Frame number will restart at 0 after each superframe (approx. 6.1 sec)
if enabled. Can be enabled by preprocessor define.

Change-Id: If3adf14df5fcd8daf53363c27b3772c42d7122e9
2017-07-13 21:35:33 +02:00
Harald Welte 3cda4ff532 VIRT-PHY: Fix handling of default values for vty configuration
The defaults must be set during bts_model_phy_link_set_defaults()
and can then later be overridden by the vty (from the config file).

They should only be written back to the file if they differ from
the default settings.

Change-Id: I5d7f2c1dc8bc3d11db5c607b664730e4dcd58c96
2017-07-13 21:35:33 +02:00
Sebastian Stumpf 1f45db0ff5 VIRT-PHY: Fixed timeslot in gsmtap-msg on downlink which was always 0.
Timeslot is not encoded in the chan_nr accessible in the channel
description but was taken from there and so it was always 0.

Change-Id: I881a1c61ea47399c9b1385fb220cd587e3593e82
2017-07-13 21:35:33 +02:00
Sebastian Stumpf 81335edae3 VIRT-PHY: Added example configurations for openbsc and osmobts.
Change-Id: I368d4a378e20028603b09825eee766abb9195774
2017-07-13 21:35:33 +02:00
Harald Welte 5eb17e28ac VIRT-PHY: Initial check-in of a new virtual BTS
This patch adds a virtual physical layer designed to simulate the
Um air interface between BTS and MS.  It does so by encapsulating MAC
blocks (Layer 2 PDUs) via GSMTAP and sending them through multicast UDP
streams, both in uplink and in downlink.

The purpose of this is enable testing without any radio hardware or
related licenses.

OsmocomBB has recently received as similar patch-set, adding a virty_phy
executable that can be run on a PC instead of the classic 'layer1'
firmware on a real phone.

Using GSMTAP means that one can use unmodified wireshark to decode the
messages exchanged on the virtual Um layer.

This code was originally started by Harald in January 2016, continued
by Sebastian Stumpf in late 2016 and early 2017, and finally completed
by Harald in July 2017.

Change-Id: I1bf7670975b1e367c1c62983020865a043542622
2017-07-13 19:34:17 +00:00
Max 152c2f489c si2q: do not consider count update as error
The number of SI2quater messages might be updated dynamically by
BSC (via 'bts 0 resend-system-information' command for example). Log it
but do not return error.

Related: OS#2357
Change-Id: I9625be879c672e20543cc40af288828143ffb983
2017-07-11 16:22:29 +00:00
Philipp Maier 9a2187e7b1 octphy: remap frame number in MEAS_IND
The octasic phy stamps the SACCH channel that carries the
measurmenet indication with the frame number of the last
SACCH that falls within the measurement period.

The higher layers expect the frame number to be aligned
to the SACCH channel after, which marks also the beginning
of the next measurement period.

Make the octphy code compatible to the higher layers by
remapping the measurement indication frame number.

Change-Id: I8ecb27c018bf4ad5151878a6ad34026fd0f801a1
2017-07-10 16:14:56 +00:00
Philipp Maier 65db0f5c41 measurement: fix measurment report
The end of the measurement reporting period is not aligned with the
SACCH block where the results are reported. The tables that are
used to detect the end of the measurement period are therefore
wrong. The frame number of the SACCH block must be used and not the
TDMA frame number (modulo 104) of the measurement reporing interval.

The tables are oriented to the frame number of the first SACCH block,
at the beginning of an interval. However, when a SACCH block is received
it will always contain the result of the recently passed measurement
reporting period.

To match the tables, introduce another lookup table to remap each
SACCH block that ends to the matching beginning block number.

Change-Id: I1eef894e6f15b4449fc8926bebb118624efc7924
2017-07-10 15:30:59 +00:00
Philipp Maier 9a280eba48 osmo-bts-sysmo: Include frame number in MEAS IND
l1_if.c does not generate struct osmo_phsap_prim l1sap properly.
The frame number is not included in this struct. This renders the
logic that processes the reported measurements non functional,
since the logic (see measurement.c) is not able to detect the
end of the measurement period. This commit fixes the problem by
adding the missing frame number to the l1sap structure.

Change-Id: I09241d6cc2ff09e71a3d723d90e4468108a27ae1
2017-07-10 13:07:30 +00:00
Harald Welte 7887ce7aea jenkins helpers: some minimal documentation/comments + print errors
We should print meaningful error messages in case a user doesn't have
the required local PATH set up, or doesn't specify a required command
line argument.

Change-Id: I30a2935f93ade69222b1e0c3e212ee10e17c1823
2017-07-10 14:55:25 +02:00
Philipp Maier 6a538a0921 octphy: do not send empty frames to phy
ph_data_req() and ph_tch_req() are generating empty (idle)
frames when no data (msg == NULL) is available. Since the
phy is able to generate idle frames internally, there is
no need to waste Host CPU cycles by doing this in software.

Remove the empty frame generation and exit the function
cleanly.

(Patch by Octasic Inc.)

Change-Id: Ib857b7dab490ad426c48d6a9e5e6fa10ef5a0838
2017-07-10 08:45:41 +00:00
Pau Espin 390742b3ed Use osmo_dump_gsmtime to log fn across different layers
This commit also fixes a missing end of line in the log output of handle_ph_data_ind

Change-Id: I049f58d51333d3590361db5c0105e6899a862af6
2017-07-10 08:44:03 +00:00
Pau Espin f06ba300c4 Move dump_gsmtime to libosmocore as osmo_dump_gsmtime
Internal l1sap dump_gsmtime has been moved to libosmocore as osmo_dump_gsmtime.
Remove use of internal function and replace with the libosmocore version.

Depends on libosmocore Ib5452e2c20f53006c0f6d197fb055728947125d8

Change-Id: Ia2f89965d970ed5bbb8c0d4f591a043e58c4bd66
2017-07-10 08:44:02 +00:00
Pau Espin ffdc05bc4e l1sap.c: fn_ms_adj: Add err logging and always return GSM_RTP_DURATION
After latest changes, l2 expects to receive an event for every TCH
frame, that is, no TCH frame event should be lost on that layer. We
should now then be safe returning always GSM_RTP_DURATION.

The code which used to calculate the variable duration is left there to
assert that indeed we are not longer having this kind of issues.

Change-Id: I9d112c6db142be138e71393e77129e6d069d9973
2017-07-10 08:44:02 +00:00
Pau Espin c2d3f14bfb l1sap.c: Avoid sending RTP frame with empty payload
Depends on libosmo-abis Id6099372b6231c0a4b6ea0716f46f5daee7049e1

Change-Id: Ie9053674aa4f43aac20dbd5c865d70317360abbc
2017-07-10 08:44:01 +00:00
Pau Espin f588b5f91d Allow passing low link quality buffers to upper layers
We want to always call l1if_tch_rx and l1sap_up in order to avoid losing triggering
events on the upper layer.

With this change, the upper layer will increase correctly seq + ts for
RTP. It will then send an RTP packet with only the header and no payload, which is
not correct but at least we avoid drifting the RTP clock. Upcoming patch
in the series solves this issue.

This patch assumes that we are not lossing data events from the physical
layer and that we receive an event every 20ms, even if the MS is not
transmitting due to DTX.

Depends on libosmocore If4ae20c22b881e94585dad710f17b9e37f77bf82

Change-Id: If5df8940fab833eb4e3ed851880b66987d356031
2017-07-10 08:44:00 +00:00
Max 0bd7a19114 Use release helper from libosmocore
Change-Id: Ib8efd2095fcf759276299b516d495219105c1f2b
Related: OS#1861
2017-07-10 08:24:40 +00:00
Pau Espin aa15504097 sysmo: Remove non longer valid -p option from help
The dsp-trace-flags command line argument was removed
in 9684099ae9

Change-Id: I8dbcdc7080ca3f7d7968aeef24422faa75d925fe
2017-07-05 11:29:12 +02:00
Pau Espin 3ae0be0f12 sysmo, litecell15: Make sure all TCH events are triggered
Change-Id: Ie674c7ec40838af36308c6998f227fa452ace4b4
2017-07-04 13:36:53 +00:00
Pau Espin 523ae04e5e Fix annoying trailing whitespace
This whitespace keeps being automatically fixed by editor, polluting my
patches.

Change-Id: If0ba1321ed326c1498e3f60b611bd962f2a9484a
2017-07-04 13:36:52 +00:00
Pau Espin 171d80a8d6 Use L1P instead of L1C for TCH logging and allocation
L1C is for L1-Control primitives, while TCH channels are L1 Data
channels.

Change-Id: I07ea3a7326bfcb62271d58deb0743311f6d97c8b
2017-07-04 13:36:52 +00:00
Philipp Maier 8baa45a8e3 octphy: complete value strings (octphy_cid_vals)
The value string table octphy_cid_vals lacks the strings for
cOCTVC1_MAIN_MSG_APPLICATION_INFO_CID and cOCTVC1_MAIN_MSG_APPLICATION_INFO_CID

(Patch by Octasic Inc.)

Change-Id: I9843137b55534a29938d5c2308244a6950de788f
2017-07-04 13:36:24 +00:00
Philipp Maier 3902e4d9c4 Revert "osmo-bts-sysmo: Include frame number in MEAS IND"
This reverts commit 3f97e4b1fc.

Change-Id: Ib50c813c470bf6ea740fe6667431eaa1a23fdd8d
2017-07-04 11:53:12 +00:00
Harald Welte 9b97d0f683 TRX: permit transmission of all-zero loopback frames
For some reason, osmo-bts-trx attempted to interpret/validate the
contents of the downlink TCH block that it was about to transmit.  If
such checks are made, they should clearly be in the common part above
L1SAP, and not in the bts-model specific part.

Also, having the checks in place didn't allow us to send an all-zero
downlink block, as is required for detection of uplink FER in a loopback
testing setup, e.g. with CMU-300.

Change-Id: I6388de98e4a7e20843a1be88a58bba8d2c9aa0d5
2017-07-02 07:02:29 +00:00
Harald Welte a38d34112f l1sap: Don't enqueue PTCCH blocks for loopback
When we're in loopback testing mode for PDTCH, we must make sure to
avoid adding PTCCH blocks to the queue. Only PDTCH blocks must be
enqueued. For the transmit (downlink) side, we already had the PTCCH
check in place.

Change-Id: I7ef40d9bdf74a99375bc6568ed9483499664bf6f
2017-07-01 07:38:40 +00:00
Harald Welte cc1602f592 TRX: don't free l1h in trx_phy_inst_close()
l1h is allocated in bts_model_phy_instance_set_defaults() and not in
trx_phy_inst_open().  Hence, trx_phy_inst_close() should not free() it!

Change-Id: I0ac4e57a882e5a31143499c1662d8d8e52320938
2017-07-01 07:38:03 +00:00
Harald Welte f2eaba8869 TRX: merge/simplify l1_if and trx_if code
Related code / function structure still dates back to the pre-phy_link
days.  Let's clean this up to make things less convoluted and reduce the
number of non-static symbols needed between code split over two files.

Change-Id: I1f30ae1f547a5c01c516d4a05032193294c25f2d
2017-07-01 07:38:01 +00:00
Harald Welte cdf20fec7c TRX: Rename trx_if_data() -> trx_if_send_burst()
The new name makes it clear what the function actually does: Send burst
data via the trx interface.

Change-Id: I5031541d4ae4244a62a18acf71139db2874927fa
2017-07-01 07:38:01 +00:00
Harald Welte bb71947829 trx_if: Improve error handling
There ware some error conditions that the previous code didn't catch
and/or report, such as unparseable TRX control strings, non-terminated
buffers, ...

Change-Id: I354d0c121880553ce1bd59b7394d52b104b7d6da
2017-07-01 07:38:01 +00:00
Harald Welte c19ab9ed2f TRX: trx_if: Improve code description / comments
Change-Id: I4e19d68782a12e52ba1d3ba2665060275d04866c
2017-07-01 07:38:00 +00:00
Pau Espin 7738f5282f litecell15/tch.c: Clean up use of empty buffer
Make code easier to read and avoid reading first byte of the buffer if size is 0.

Change-Id: Ib9ee967c0f42098b3a0569e9d84f23832eb4f2d5
2017-06-30 08:48:34 +00:00
Pau Espin 0ada527bc0 sysmo/tch.c: Clean up use of empty buffer
Make code easier to read and avoid reading first byte of the buffer if size is 0.

Change-Id: I5ecfc4df5a3fcad3d3ad50bf3dd3db65b694481a
2017-06-30 08:47:57 +00:00
Philipp Maier dd3c7815a5 osmo-bts-litecell15: Fix missing frame number in MEAS IND
The layer 1 interface (l1_if.c) for osmo-bts-litecell15 does not include
the frame number into the measurement indications it forwards
to higher layers. The frame number is required to properly
detect the end of a measurement period.

change process_meas_res() to properly include the frame number into the
l1sap primitive (struct osmo_phsap_prim *l1sap)

Change-Id: Iee9c8f88b05cd5dba9920bb08e079a643e713237
2017-06-29 17:41:01 +02:00
Philipp Maier b7425f3642 osmo-bts-trx: fix missing frame number in MEAS IND
The layer 1 interface (l1_if.c) for osmo-bts-trx does not include
the frame number into the measurement indications it forwards
to higher layers. The frame number is required to properly
detect the end of a measurement period.

Change-Id: Ife3c791ff50e8a866a97b9783ac7ef3ef2402a70
2017-06-29 17:29:56 +02:00
Philipp Maier 8d645dd0e5 Revert "sysmobts: normalize frame number in measurement indication"
This reverts commit 88b2cc30a6.

Change-Id: I30f37a9feef24a45e254377502615d717dba9765
2017-06-29 13:18:11 +00:00
Harald Welte 250d77f8df Add loopback support for PDTCH
This add support for BTS-side lookback of PDTCH channels.

If lchan-loopback is enabled, We take the uplink frames as received in
PH-DATA.ind and put them into the dl_tch_queue for that lchan.  When we
receive PH-RTS.ind, we dequeue frames from that queue and transmit them
in downlink. If no frame is found in queue, we transmit an empty
(all-zero) frame of 23 bytes (CS-1).

Change-Id: Idd07a3f4a88c38398d3e844333c0104e2de23864
2017-06-28 23:43:28 +00:00
Harald Welte 53ce11ab95 TRX: Use timerfd and CLOCK_MONOTONIC for GSM frame timer
using gettimeofday() is not suitable for the GSM frame timer, as it
relies on the normal 'wall clock' system time, which may be adjusted by
ntp, gps or other means at runtime.

Switching to a different clock source means we cannot use
osmo_timer_list anymore, but timerfd integrates just fine with our
libosmocore select() loop handling.

Change-Id: I51b19adde14ebb7ef3bb863d45e06243c323e22e
Closes: #2325
2017-06-28 23:43:28 +00:00
Philipp Maier 59d0c2cca6 octphy: remove log output
When handle_ph_data_ind() runs BER and RSSI is logged. Remove
this log output by removing the call to dump_meas_res

(Patch by Octasic Inc.)

Change-Id: I5e755465daa3daec2e2b4f61bc8d779c49196e9a
2017-06-28 13:21:51 +00:00
Philipp Maier 5047fbe3b8 octphy: initalize nmsg only when needed
nmsg is initalized every time the function runs, even when it
is not needed. Move the initalization into the if (msg) body
so that nmsg is only initalized when we really need it.

(Patch by Octasic Inc.)

Change-Id: If51dc50a9f4bdb4aba62c0ae5fbfac552806f0c0
2017-06-28 13:21:51 +00:00
Philipp Maier 521ab50dcc octphy: initalize l1msg and only when needed
l1msg is initalized when the variable is declared. This means
the allocation always runs right on the beginning. Even when
the buffer is not needed at all.

do a prober l1msg initalization only when needed and check the
return code.

(Patch by Octasic Inc.)

Change-Id: Ia71d49b9cc109af53d997a687a7fb1b5ed062d1c
2017-06-28 13:21:51 +00:00
Philipp Maier ae7ece1064 octphy: improve log output
Printing the RX payload size is strictly informative, so the
loglevel LOGL_ERROR is wrong. This commit changes it to
LOGL_DEBUG

(Patch by Octasic Inc.)

Change-Id: I712cdd79cbba93f457705d38871bd8d4b7f4e897
2017-06-28 13:21:51 +00:00
Max 4962ed1811 RSL: receive and send multiple SI2q messages
* change BCCH Info handler to explicitly support multiple SI2quater
  messages sent from BSC
* change SI scheduler to send SI2q in round-robin way

That's resubmission of 340cff51f4 and
186c6bac07 with memory initialization
order change to fix the issue detected by osmo-gsm-tester - see OS#2338.

Change-Id: Ib595733cde108387bc7ee76b1b11ada6a235f13c
Related: OS#1660, OS#2338
2017-06-28 07:56:32 +00:00
Philipp Maier d0846651a3 measurement: improve log output
The code that receives the uplink measurement data from L1 does not
print the number of already received uplink measurements. Since
this is a valuable information when debugging the log output will
now print this information as well.

(Patch by Octasic Inc.)

Change-Id: I79926f25de088571fcc2c14388c72fc968c2d382
2017-06-26 13:48:10 +00:00
Max 620bd83b12 Add missing include for abis.h header file
This fixes compilation warning:
implicit declaration of function ‘abis_bts_rsl_sendmsg’

Change-Id: I956561b2f953c7d380a26442fad84bc8262ea129
2017-06-26 10:54:28 +00:00
Minh-Quang Nguyen 2a4c5fa2b3 LC15: properly handle BS-AG-BLKS-RES as received from BSC
Closes: OS#2014
Change-Id: Icf437e621d1991f6185e31a0953773309e2bf5ac
2017-06-24 12:56:08 +02:00
Harald Welte 4699ebaa26 l1sap: if lchan is in loopback, don't accept incoming RTP
When the lchan is in loopback mode, we loop back all uplink blocks into
downlink blocks.  We do not processs any RTP frames for that lchan
anymore.  Rather, we discard those RTP frames to avoid mixing
looped-back samples with those received from remote.

Change-Id: I29ef4963e9c491c94c413cbc10436a2388c04d9b
2017-06-24 12:56:08 +02:00
Harald Welte 7a6b178fc0 osmo-bts-sysmo/l1_if.c: PH-DATA.ind belongs to L1P, not L1C
L1C is control, while L1P is data primitive.

Change-Id: I5a0ef08df96a67cd25b11eb23c60934011b01c29
2017-06-24 12:56:08 +02:00
Harald Welte 53216b5d1f l1sap.c: Factor out function to limit message queue
Change-Id: I0fe0fc6b17cefdbf6b2d9f30ed08306998d30687
2017-06-24 12:55:11 +02:00