Commit Graph

73 Commits

Author SHA1 Message Date
Neels Hofmeyr 446e3c7869 deprecation: use osmo_bts_features_*()
For "reported feature '%s'...", use the short feature name, which better
matches the message.

Change-Id: Ie09506fbf3a1f0e899f9f4c8070e3139fd1d5e9d
2021-04-14 17:40:45 +00:00
Vadim Yanitskiy 2fbdc7c5de abis_nm: cosmetic: use osmo_bts_feature_name()
Change-Id: I15078ac030b0b824a554239b19bc501c624e2a87
2021-04-07 16:41:22 +00:00
Vadim Yanitskiy 23c1c975c0 abis_nm: rework warnings about unknown / not supported features
The reported feature vector may contain new features the BSC is
not aware of.  Report each of them individually as NOTICE.

It's normal when some BTS feature is considered as not supported
by the BSC, but a BTS reports that it is - do not log this.

Change-Id: I2f925bcdb010cb10d074bf7c82619e3ae1f8818b
2021-04-07 16:41:22 +00:00
Vadim Yanitskiy 3991ae5b87 abis_nm: enrich debug messages with contextual info
Change-Id: I68f64e6cae061a49733c4885ba383d2b9b4cfca9
2021-02-20 23:24:09 +01:00
Pau Espin dd6af77e44 abis_nm: Simplify param passing to abis_nm_rx_get_attr_resp()
There's no real need to retrieve the trx before passing it to the
function, we can do that in the function itself and hence also simplify
the function itself.

Related: OS#4870
Change-Id: I7181510c5021ff2712c09ebc6ec8b13fdd8e8dc2
2020-12-04 14:44:43 +01:00
Alexander Couzens d74bb1e3b0 Introduce NM GPRS NSVC FSM
Related: OS#4870
Change-Id: I381472532c2622a8dba7c81ae00ea873c2e58ae1
2020-12-04 14:44:40 +01:00
Pau Espin ee9f02f2df Introduce NM GPRS NSE FSM
Related: OS#4870
Change-Id: I91a5f40324d5373eac885032295690cec97214a6
2020-12-03 18:46:27 +01:00
Pau Espin 64c422858d Store GPRS MOs directly under BTS SiteMgr object
The only real 1-1 relationship between BTS NM objects is the one between
GPRS Cell and BTS (which is actually a BTS cell).
In our current osmo-bts implementation we don't care much since we only
handle 1-cell BTSses, but let's make the data structure organization
more generic.

Implementation notes:
The gsm_bts_sm is moved to its own file, APIs to allocate are added and
the new public object is hooked correctly in the allocation process of
osmo-bsc.

Change-Id: I06461b7784fa2a78de37383406e35beae85fbad8
2020-12-03 16:31:36 +01:00
Pau Espin 0aa489252d ipa: Fix use of null pointer in log macro
Fixes: Coverity CID#214962
Fixes: Coverity CID#214963
Change-Id: Iafea915dbbbfbaa710fb5899cb9be5e507ba384c
2020-10-17 13:56:16 +00:00
Pau Espin 7c02e4cfd5 abis_nm: Log Opstart NACK with error loglevel
Change-Id: I586c3dd3547d35bca3d11f66dfad322e22c09068
2020-10-15 05:55:36 +00:00
Pau Espin 09544ab436 Introduce Radio Channel FSM
Change-Id: Iddc008c5737afb2fddd32c628bc5278056a64d89
2020-10-15 05:55:36 +00:00
Pau Espin 6adeb607d0 Introduce NM BTS FSM
Change-Id: I7756a8ce90b6cc8a502b5665889a7987d7f749cb
2020-10-15 05:55:36 +00:00
Pau Espin 4338de5f51 Introduce NM BTS Site Manager FSM
Change-Id: Ic001ce6ebeff6f51470ef58140b0235f4a30265e
2020-10-15 05:55:36 +00:00
Pau Espin 946d679ca3 abis_nm: Remove duplicated log line
Change-Id: I52ff3c7457ca9985bb4936a6ec48abe0aee07e71
2020-10-02 19:31:43 +02:00
Pau Espin beac3d2c98 abis_nm: Log no state change detected
Change-Id: I15695b18ad7b31c2f9579813b76ecee36cce4ede
2020-10-02 19:31:43 +02:00
Pau Espin d2313548e7 abis_nm: Log Rx Change Administrative State ACK
Change-Id: I165138634b1fdb982197afdac6d2d00a4d1e4074
2020-09-30 12:44:33 +02:00
Alexander Couzens 9a701d7e70 abis_nm: abis_nm_perform_test: fix a potential null deref
gcc 10.2.0 warns msgb can be a deref because nm_msgb_alloc() can fail with null.

Change-Id: I4b0e4cd15046272e026cd74c14cbf2972ef6a070
2020-09-21 18:41:58 +02:00
Pau Espin 1a7e3ccef1 oml: Fix premature Opstart to Radio Carrier
During the A-bis/OML bootstrapping, osmo-bsc sends Opstart to the
Radio Carrier MO twice.  The first Opstart is triggered by the
State Changed Event Report, originated by the Radio Carrier itself.
The second is triggered by Software Activated Report.

According to 3GPP TS 12.21, figure 2, we shall send it only once,
after the "Attribute setting" step.  Therefore, the first Opstart
is premature, and we shall not send it.

Related: SYS#5063, OS#4755
Change-Id: If69393551117266ecb726d8961153560b2b3cc59
2020-09-20 09:56:49 +00:00
Vadim Yanitskiy c221b3b7b6 abis_nm: improve logging message in abis_nm_get_attr()
Change-Id: I10ef08e7d01ed27e05ef30c0bb876c0197a30500
2020-09-17 10:32:21 +00:00
Vadim Yanitskiy d3a7eb16b1 abis_nm: use LOGPFOH()/DEBUGPFOH() in parse_attr_resp_info_unreported()
Change-Id: Ib0c95c6c52122de06fa164f7a5fcb09ec7ad384a
2020-09-17 10:32:21 +00:00
Vadim Yanitskiy f072fbad3e abis_nm: use DEBUGPFOH() in abis_nm_rx_sw_act_req()
Change-Id: Ib148a451edee88350f09895a85a9d1bc03f3ac00
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 1df9f5bba8 abis_nm: use btstype2str() in abis_nm_rcvmsg_manuf()
Change-Id: I6858480fb8343a4862601ef48ff1778c4e4b0275
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy c5849457e0 abis_nm: abis_nm_get_ts(): use LOGPFOH() instead of generic LOGP()
Change-Id: I510506a5b2c9493d3473dd2b0fcb16a90aeb8c21
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 86f5cdd26a abis_nm: LOGPFOH()/DEBUGPFOH(): remove redundant context info
Change-Id: I3531a0da3c64aea8bf4df5ffa1d8768f7e70c87b
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 35f4212e58 abis_nm: fix msgb memleak in _abis_nm_sendmsg()
Change-Id: I8e9c5d32e9bc43c760cb71efb8cab4982a305f0e
2020-09-15 20:42:17 +00:00
Vadim Yanitskiy 5715237911 abis_nm: fix erroneous use of LOGPC() instead of LOGP()
Change-Id: I8b6f791e423d1f7fcdabcaaaab48fc9586c1dc7b
2020-09-15 20:42:17 +00:00
Pau Espin aca53203d1 Move struct gsm_bts_trx: gsm-data.* => bts_trx.*
See rant fro similar recent commit moving stuff to bts.*.

Change-Id: I11758ca3d255d849d77bd068f24bb68bde1f89a5
2020-07-18 21:45:32 +00:00
Pau Espin e2f1c95774 bts: Drop duplicated function to get trx by number
In the big mess of gsm_data we reached a point where we have multiple
functions doing the same thing, most probably because it's hard finding
stuff in there. Let's drop one of them (the one which less callers) and
move it to bts.*, where it belongs.

Change-Id: I9071a0ab250844619280fbe2be63ed99f2c87eb1
2020-07-18 21:45:32 +00:00
Pau Espin 388ed58482 Move struct gsm_bts: gsm_data.* => bts.*
Place all code related to the object into the related file.

Having all the data model in one file made sense in early stage of
development to make progress quickly, but nowadays it hurts more than
helps, due to constantly growing size and more and more bits being
added to the model, gaining in complexity.

Currently, having lots of different objects mixed up in gsm_data.h is a hole
of despair, where nobody can make any sense were to properly put new stuff
in, ending up with functions related to same object in different files
or with wrong prefixes, declarations of non-existing functions, etc.
because people cannot make up their mind on strict relation to objects
in the data model.
Splitting them in files really helps finding code operating on a
specific object and helping with logically splitting in the future.

Change-Id: I00c15f5285b5c1a0109279b7ab192d5467a04ece
2020-07-18 21:45:32 +00:00
Harald Welte 7d69baf66f abis_nm: Avoid various "Unhandled message" errors on BS-11 startup
There are a number of OML messages which are not seen on IP based
BTSs.  Those are perfectly normal and expected on E1 based BTS.

Change-Id: Icd87fc9f3652b21f9d569af2572d080c9ac89e8b
Closes: OS#4665
2020-07-14 22:50:45 +02:00
Pau Espin cce0ae11b6 Avoid selecting channels from administratively locked trx
Found while playing with "rf_locked 1" on a 2TRX setup with channel
allocator descend. After applying the setting, the 1st TRX is still used
to allocate the channels. After this patch is applied, the BSC correctly
allocates channels from TRX0.

Change-Id: I5201d2749363c9cbd0706177bde09117b163cbe3
2020-06-23 14:21:20 +00:00
Vadim Yanitskiy 2190ac9ce5 abis_nm: fix length indicator in Set Channel Attributes
This message may contain optional IEs (HSN, MAIO, ARFCN list),
so we cannot know the final length in advance. Let's set both
msg->{l2h,l3h} pointers and use msgb_l3len() to get the length.

Change-Id: I948ad4b847921324794a6eabd95d5583324da6e4
Related: OS#4545
2020-06-18 11:54:24 +00:00
Vadim Yanitskiy 83e6e613a7 abis_nm: fix ARFCN list encoding in Set Channel Attributes
3GPP TS 12.21 defines coding of 'ARFCN List' attribute as follows:

  +---------------------------+--------------------+
  | Attribute Identifier      | 1st octet          |
  +---------------------------+--------------------+
  | Length                    | 2-3 octets         |
  +---------------------------+--------------------+
  | ARFCN1                    | 4-5 octets         |
  +---------------------------+--------------------+
  | ...                       | ...                |
  +---------------------------+--------------------+
  | ARFCNn                    | (n * 2 - 3) octets |
  +---------------------------+--------------------+

so this is basically TL16V, where L16 is the length of V.

In the Siemens dialect of OML coding rules are different though:

  +---------------------------+--------------------+
  | Attribute Identifier      | 1st octet          |
  +---------------------------+--------------------+
  | ARFCN count               | 2nd octet          |
  +---------------------------+--------------------+
  | ARFCN1                    | 4-5 octets         |
  +---------------------------+--------------------+
  | ...                       | ...                |
  +---------------------------+--------------------+
  | ARFCNn                    | (n * 2 - 2) octets |
  +---------------------------+--------------------+

so this is TCV, where C is the amount of ARFCNs in V.

This change fixes encoding of 'ARFCN List' for other dialects,
in particular encoding of the 'Length' field (1 vs 2 octets).
I verified the results in Wireshark (generic 3GPP TS 12.21
and ip.access dialect), everything looks good.

Change-Id: Iec1826f55459ac8e9355328a1a6bb0949874db60
Related: OS#4545
2020-06-18 11:54:24 +00:00
Vadim Yanitskiy 3a986ba3c9 abis_nm: fix: properly truncate feature vector reported by BTS
The value of the feature vector can not only be greater, but also
shorter than size of the buffer! This would potentially result
in a buffer overrun. Let's fix this.

Change-Id: I65e3228022865ea73de2e4821985df3097b9448b
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy a6050088c5 abis_nm: cosmetic: use sizeof() for printing buffer size
Change-Id: I14be343578a64c1e4ce8ce4d28da9008eb309f3c
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy eda1312605 abis_nm: cosmetic: add curly braces to complex 'if' statements
Change-Id: I74fbb46920c74a194c296feeeb1bb086fcbd572f
2020-06-03 06:52:37 +00:00
Vadim Yanitskiy d3d03070e2 A-bis: fix logging level mismatch in abis_nm_rcvmsg_fom()
Change-Id: If8f76af4d1e0eb2d7b3534e620e2816cdbbe0b7d
2020-05-16 20:13:00 +00:00
Oliver Smith ba0a12233f VTY: add show bts failure report
Save OML failure reports from each BTS. Add a VTY command to display them
conveniently and optionally clear the list.

OsmoBSC> show bts 0 fail-rep
[2020-03-23 14:51:22] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY
[2020-03-23 14:51:19] Type=processing failure, Severity=minor failure, Probable cause=Manufacturer specific values: Software warning, Additional text=test message sent from VTY

Related: OS#1605
Change-Id: I18aa17a721cd5eb1c98926dc2367229c0a50bc78
2020-03-27 09:55:30 +01:00
Oliver Smith cd1df9975c abis_nm: move fail report parsing to extra func
Separate raw input parsing from handling the failure report. A follow-up
patch will use the new parsing function to print saved failure reports
to the VTY.

While at it, put struct tlv_parsed inside struct nm_fail_rep_signal_data
instead of a pointer, so we don't need an additional alloc. Also add
error handling to the abis_nm_tlv_parse() call.

Related: OS#1605
Change-Id: Ia51004faf620aa4d40435d58c70d758c9d0054d8
2020-03-26 14:52:02 +01:00
Oliver Smith 33eca64211 abis_nm.c: rx_fail_evt_rep: fix sd.bts
Use the extra bts pointer instead of mb->trx->bts, which does not point
to an allocated bts.

Related: OS#1605
Change-Id: Ie61512f5690763fa380bdf0e7fb4763dbda019d2
2020-03-23 13:49:05 +01:00
Harald Welte 35d07b7698 Introduce nm_fail_rep_signal_data for "SS_NM, S_NM_FAIL_REP" signal
Let's not just pass around the raw msgb, but also all other metadata,
such as the decoded parts of the TS 12.21 message.

As there's no current consumer of that signal, this creates no
compatibility issues.

Change-Id: I5d4d9d422b4e23348ffbe69c6e87a31d5574f90d
2020-01-06 10:28:18 +00:00
Vadim Yanitskiy a1d175ab66 abis_nm.c: fix RSL connection timeout for trx->nr > 0
After sending of NM_MT_IPACC_RSL_CONNECT message, we start a timer,
and stop it on receipt of NM_MT_IPACC_RSL_CONNECT_{ACK,NACK}. When
running a multi-trx setup, one can see the following warnings:

  DRSL NOTICE abis_nm.c:2852 (bts=0,trx=1) RSL connection request timed out
  DRSL NOTICE abis_nm.c:2852 (bts=0,trx=2) RSL connection request timed out

even despite NM_MT_IPACC_RSL_CONNECT is actually being acknowledged.

The problem is in abis_nm_rx_ipacc(): we cannot just use sign_link->trx,
because the message itself was received over the OML link, so this
pointer always gives us C0/TRX0. Instead, we must find a TRX by its
number from the FOH header using gsm_bts_trx_by_nr().

Change-Id: Ib4b9a198da11c88a51cfa78ffb7e7235a6365ef4
2019-12-02 08:46:10 +00:00
Vadim Yanitskiy 26adddf1bf abis_nm.c: replace magic numbers with NM_CHANC_* constants
Change-Id: I60b20d617bd8710a95977e41ae32a431af4402a9
2019-11-19 18:35:20 +00:00
Vadim Yanitskiy 7f4360bc83 abis_nm.c: fix error message in verify_chan_comb()
Change-Id: Ic72753d821c3ab72cda79be71aed1704beefe983
2019-11-19 18:35:20 +00:00
Martin Hauke a29affda98 Fix some typos
Fix typos and common misspellings in code comments and in the manual.

Change-Id: I46fc9d424620c77ae9ccf78b58081bd303386d7c
2019-11-13 22:10:41 +01:00
Vadim Yanitskiy 60b6fdb20c abis_nm.c: use LOGP() macro instead of LOGPC()
The LOGPC() is usually used for continuation when printing complex
logging messages (e.g. where using format string is not enough).
In this case, nothing is being printed before calling LOGPC(), so
the logging messages appear without the meta info (time-stamp,
level, category, etc.), for example:

  BTS 0 reported connected PCU version 0.7.0.1-2585-dirty

Change-Id: I868633ad3e50f2cb3ebfb2c566d16c4710f17563
2019-08-23 17:47:44 +02:00
Harald Welte afe987f848 logging: introduce LOG_BTS and LOG_TRX and use it everywhere
It's quite ugly to have manual "bts=%d" printf-statements all over
the BSC code.  Let's change this to use shared logging helper functions
all over the place, whenever we need to log something related to one
BTS or one TRX.

This can also help us as the first step to later add alternative logging
of BTS identities, e.g. by printing the Cell Global Identifier or
LAC+CI, or even a human-readable/vty-defined 'name' of the BTS, rather
than its numeric bts number.  With this change in place, we can
introduce such changes at a single location in the code.

Change-Id: I4a7814d164384eecfb6913c31802cf2faead6e6c
2019-07-16 04:00:19 +00:00
Harald Welte 052ab5ed3f rx_fail_evt_rep(): Don't recycle variable
the 'p_val' variable should represent he 'probabl cause value' and
nothing else.  Let's use other local variables for other things.

Change-Id: Ie79279fc1d42cd57e7478820493b250fe38c2f4f
2019-05-26 09:30:00 +00:00
Vadim Yanitskiy ac88f5a5c9 abis_nm.c: fix broken logging in abis_nm_rx_ipacc()
Change-Id: I65ff2968523a90607bafd44e6f4f3d3e29ff73ef
2019-04-04 21:18:06 +07:00
Vadim Yanitskiy a8a1b148dc abis_nm.c: use msgb_lv_put() to put abis_nm_ipa_magic
Change-Id: I1ce97fc28a608894c8dfa3bbc55032e66bc44e5b
2019-04-04 20:50:01 +07:00