2012-03-05 15:24:57 +00:00
|
|
|
/* gprs_bssgp_pcu.h
|
2012-02-04 22:27:17 +00:00
|
|
|
*
|
2012-03-05 15:24:57 +00:00
|
|
|
* Copyright (C) 2012 Ivan Klyuchnikov
|
2013-08-22 06:40:33 +00:00
|
|
|
* Copyright (C) 2013 by Holger Hans Peter Freyther
|
2012-02-04 22:27:17 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2012-03-05 15:24:57 +00:00
|
|
|
|
|
|
|
#ifndef GPRS_BSSGP_PCU_H
|
|
|
|
#define GPRS_BSSGP_PCU_H
|
|
|
|
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
#ifdef __cplusplus
|
2012-02-04 22:27:17 +00:00
|
|
|
extern "C" {
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
#endif
|
2012-02-04 22:27:17 +00:00
|
|
|
#include <osmocom/core/talloc.h>
|
|
|
|
#include <osmocom/core/rate_ctr.h>
|
2012-05-24 18:25:06 +00:00
|
|
|
#include <osmocom/core/logging.h>
|
2012-06-18 04:21:03 +00:00
|
|
|
#include <osmocom/core/signal.h>
|
2012-02-04 22:27:17 +00:00
|
|
|
#include <osmocom/core/application.h>
|
2020-09-16 19:52:02 +00:00
|
|
|
#include <osmocom/gprs/gprs_ns2.h>
|
2012-06-18 04:21:03 +00:00
|
|
|
#include <osmocom/gprs/gprs_bssgp.h>
|
2012-09-23 03:03:56 +00:00
|
|
|
#include <osmocom/gprs/gprs_bssgp_bss.h>
|
2012-06-18 04:21:03 +00:00
|
|
|
#include <osmocom/gprs/gprs_msgb.h>
|
2012-02-04 22:27:17 +00:00
|
|
|
|
|
|
|
struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei);
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
|
2012-05-24 18:25:06 +00:00
|
|
|
#include <gprs_debug.h>
|
2012-02-04 22:27:17 +00:00
|
|
|
|
2020-03-11 13:04:52 +00:00
|
|
|
#include <time.h>
|
2021-01-18 16:14:14 +00:00
|
|
|
#include <unistd.h>
|
2020-03-11 13:04:52 +00:00
|
|
|
|
2012-09-23 03:03:56 +00:00
|
|
|
#define QOS_PROFILE 4
|
2012-06-04 15:07:25 +00:00
|
|
|
#define BSSGP_HDR_LEN 53
|
2012-03-05 15:24:57 +00:00
|
|
|
#define NS_HDR_LEN 4
|
2012-06-06 21:51:49 +00:00
|
|
|
#define IE_LLC_PDU 14
|
2012-02-04 22:27:17 +00:00
|
|
|
|
2021-07-05 09:11:42 +00:00
|
|
|
enum sgsn_counter_id {
|
|
|
|
SGSN_CTR_RX_PAGING_CS,
|
|
|
|
SGSN_CTR_RX_PAGING_PS,
|
|
|
|
};
|
|
|
|
|
2013-07-28 17:11:20 +00:00
|
|
|
struct gprs_bssgp_pcu {
|
|
|
|
struct bssgp_bvc_ctx *bctx;
|
|
|
|
|
|
|
|
struct gprs_rlcmac_bts *bts;
|
|
|
|
|
|
|
|
struct osmo_timer_list bvc_timer;
|
|
|
|
|
2021-07-05 09:11:42 +00:00
|
|
|
struct rate_ctr_group *ctrs;
|
|
|
|
|
2021-02-22 00:45:17 +00:00
|
|
|
/* state: is the NSVC unblocked? */
|
2013-07-28 17:11:20 +00:00
|
|
|
int nsvc_unblocked;
|
|
|
|
|
2021-02-22 00:45:17 +00:00
|
|
|
/* state: true if bvc signalling needs to be reseted or waiting for reset ack */
|
2013-07-28 17:11:20 +00:00
|
|
|
int bvc_sig_reset;
|
2021-02-22 00:45:17 +00:00
|
|
|
/* state: true if bvc ptp needs to be reseted or waiting for reset ack */
|
2013-07-28 17:11:20 +00:00
|
|
|
int bvc_reset;
|
2021-02-22 00:45:17 +00:00
|
|
|
/* state: true if bvc ptp is unblocked */
|
2013-07-28 17:11:20 +00:00
|
|
|
int bvc_unblocked;
|
2013-08-22 06:40:33 +00:00
|
|
|
|
2015-05-06 12:24:36 +00:00
|
|
|
/* Flow control */
|
2020-03-11 13:04:52 +00:00
|
|
|
struct timespec queue_delay_sum;
|
2015-05-06 12:24:36 +00:00
|
|
|
unsigned queue_delay_count;
|
2015-05-06 13:26:08 +00:00
|
|
|
uint8_t fc_tag;
|
2015-09-07 16:49:00 +00:00
|
|
|
unsigned queue_frames_sent;
|
|
|
|
unsigned queue_bytes_recv;
|
|
|
|
unsigned queue_frames_recv;
|
2015-05-06 12:24:36 +00:00
|
|
|
|
2013-08-22 06:40:33 +00:00
|
|
|
/** callbacks below */
|
|
|
|
|
|
|
|
/* The BSSGP has been unblocked */
|
|
|
|
void (*on_unblock_ack)(struct gprs_bssgp_pcu *pcu);
|
2013-08-22 06:44:04 +00:00
|
|
|
|
|
|
|
/* When BSSGP data arrives. The msgb is not only for reference */
|
|
|
|
void (*on_dl_unit_data)(struct gprs_bssgp_pcu *pcu, struct msgb *msg,
|
|
|
|
struct tlv_parsed *tp);
|
2013-07-28 17:11:20 +00:00
|
|
|
};
|
|
|
|
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
int gprs_gp_send_cb(void *ctx, struct msgb *msg);
|
|
|
|
int gprs_ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx);
|
|
|
|
void gprs_bssgp_update_queue_delay(const struct timespec *tv_recv,
|
|
|
|
const struct timespec *tv_now);
|
|
|
|
void gprs_bssgp_update_frames_sent();
|
|
|
|
void gprs_bssgp_update_bytes_received(unsigned bytes_recv, unsigned frames_recv);
|
|
|
|
|
2020-09-16 19:52:02 +00:00
|
|
|
struct gprs_bssgp_pcu *gprs_bssgp_init(
|
|
|
|
struct gprs_rlcmac_bts *bts,
|
|
|
|
uint16_t nsei, uint16_t bvci,
|
|
|
|
uint16_t mcc, uint16_t mnc, bool mnc_3_digits,
|
2013-07-28 16:55:14 +00:00
|
|
|
uint16_t lac, uint16_t rac, uint16_t cell_id);
|
2012-07-06 06:58:22 +00:00
|
|
|
|
2021-02-16 15:57:15 +00:00
|
|
|
int gprs_ns_update_config(struct gprs_rlcmac_bts *bts, uint16_t nsei,
|
2020-10-12 00:27:22 +00:00
|
|
|
const struct osmo_sockaddr *local,
|
|
|
|
const struct osmo_sockaddr *remote,
|
|
|
|
uint16_t *nsvci, uint16_t valid);
|
2019-05-25 01:10:51 +00:00
|
|
|
|
2020-09-16 19:52:02 +00:00
|
|
|
void gprs_bssgp_destroy(struct gprs_rlcmac_bts *bts);
|
2012-07-06 06:58:22 +00:00
|
|
|
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2015-05-06 12:24:36 +00:00
|
|
|
|
2012-03-05 15:24:57 +00:00
|
|
|
#endif // GPRS_BSSGP_PCU_H
|