From 3c7dc6ed50e8baa05a8aea26c72319530e747317 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 29 Nov 2009 19:07:28 +0100 Subject: New complete measurement result/report handling This patch extends struct gsm_meas_rep into a complete structure containing all information from both uplink and downlink measurement results/reports. This is a first step to provide this complete measurement data as a C structure into a to-be-implemented handover decision algorithm. --- openbsc/include/openbsc/gsm_04_08.h | 28 +++------------------ openbsc/include/openbsc/meas_rep.h | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 openbsc/include/openbsc/meas_rep.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index b7c8a2662..cd85dff8f 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -1,6 +1,8 @@ #ifndef _GSM_04_08_H #define _GSM_04_08_H +#include + /* GSM TS 04.08 definitions */ struct gsm_lchan; @@ -618,30 +620,6 @@ enum gsm48_reject_value { GSM48_REJECT_MSC_TMP_NOT_REACHABLE = 16, }; - -/* extracted from a L3 measurement report IE */ -struct gsm_meas_rep_cell { - u_int8_t rxlev; - u_int8_t bcch_freq; /* fixme: translate to ARFCN */ - u_int8_t bsic; -}; - -struct gsm_meas_rep { - unsigned int flags; - u_int8_t rxlev_full; - u_int8_t rxqual_full; - u_int8_t rxlev_sub; - u_int8_t rxqual_sub; - int num_cell; - struct gsm_meas_rep_cell cell[6]; -}; -#define MEAS_REP_F_DTX 0x01 -#define MEAS_REP_F_VALID 0x02 -#define MEAS_REP_F_BA1 0x04 - -void gsm48_parse_meas_rep(struct gsm_meas_rep *rep, const u_int8_t *data, - int len); - enum chreq_type { CHREQ_T_EMERG_CALL, CHREQ_T_CALL_REEST_TCH_F, @@ -782,5 +760,7 @@ int gsm48_handle_paging_resp(struct msgb *msg, struct gsm_subscriber *subscr); int gsm48_lchan_modify(struct gsm_lchan *lchan, u_int8_t lchan_mode); int gsm48_rx_rr_modif_ack(struct msgb *msg); +int gsm48_parse_meas_rep(struct gsm_meas_rep *rep, struct msgb *msg); + #endif diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h new file mode 100644 index 000000000..0c2bdabde --- /dev/null +++ b/openbsc/include/openbsc/meas_rep.h @@ -0,0 +1,50 @@ +#ifndef _MEAS_REP_H +#define _MEAS_REP_H + +/* extracted from a L3 measurement report IE */ +struct gsm_meas_rep_cell { + u_int8_t rxlev; + u_int8_t bcch_freq; /* FIXME: translate to ARFCN */ + u_int8_t bsic; +}; + +/* RX Level and RX Quality */ +struct gsm_rx_lev_qual { + u_int8_t rx_lev; + u_int8_t rx_qual; +}; + +/* unidirectional measumrement report */ +struct gsm_meas_rep_unidir { + struct gsm_rx_lev_qual full; + struct gsm_rx_lev_qual sub; +}; + +#define MEAS_REP_F_UL_DTX 0x01 +#define MEAS_REP_F_DL_VALID 0x02 +#define MEAS_REP_F_BA1 0x04 +#define MEAS_REP_F_DL_DTX 0x08 +#define MEAS_REP_F_MS_TO 0x10 +#define MEAS_REP_F_MS_L1 0x20 +#define MEAS_REP_F_FPC 0x40 + +/* parsed uplink and downlink measurement result */ +struct gsm_meas_rep { + u_int8_t nr; + unsigned int flags; + + struct gsm_meas_rep_unidir ul; + struct gsm_meas_rep_unidir dl; + + u_int8_t bs_power; + u_int8_t ms_timing_offset; + struct { + int8_t pwr; /* MS power in dBm */ + u_int8_t ta; /* MS timing advance */ + } ms_l1; + + int num_cell; + struct gsm_meas_rep_cell cell[6]; +}; + +#endif /* _MEAS_REP_H */ -- cgit v1.2.3 From 8c83af65c1902811d8e9823153af09cc59f4d9f6 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 29 Nov 2009 20:02:53 +0100 Subject: [handover] Implement 04.08 HANDOVER COMMAND This is needed by a yet-to-be-implemented handover algorithm, after it has allocated a new lchan for the MS. Also missing: handling the actual HANDOVER COMPLETE / FAIL messages in response. --- openbsc/include/openbsc/gsm_04_08.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index cd85dff8f..359aa1b39 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -90,6 +90,22 @@ struct gsm48_ass_cmd { u_int8_t data[0]; } __attribute__((packed)); +/* Chapter 10.5.2.2 */ +struct gsm48_cell_desc { + u_int8_t bcc:3, + ncc:3, + arfcn_hi:2; + u_int8_t arfcn_lo; +} __attribute__((packed)); + +/* Chapter 9.1.15 */ +struct gsm48_ho_cmd { + struct gsm48_cell_desc cell_desc; + struct gsm48_chan_desc chan_desc; + u_int8_t ho_ref; + u_int8_t power_command; + u_int8_t data[0]; +} __attribute__((packed)); /* Chapter 9.1.18 */ struct gsm48_imm_ass { -- cgit v1.2.3 From d011e8b958f3d5a09d1c66852292974d9dc52786 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 29 Nov 2009 22:45:52 +0100 Subject: [handover] Introduce new handover related LCHAN signals This introduces the signals S_LCHAN_ACTIVATE_{ACK,NACK} and S_LCAN_HANDOVER_{FAIL,COMPL,DETECT} as well as code that actually issues those signals. The signals are relevant for a yet-to-be-written handover control logic. --- openbsc/include/openbsc/signal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index fee9d5bfd..fbd61ae9e 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -78,6 +78,11 @@ enum signal_lchan { * signal handler. */ S_LCHAN_UNEXPECTED_RELEASE, + S_LCHAN_ACTIVATE_ACK, /* 08.58 Channel Activate ACK */ + S_LCHAN_ACTIVATE_NACK, /* 08.58 Channel Activate NACK */ + S_LCHAN_HANDOVER_COMPL, /* 04.08 Handover Completed */ + S_LCHAN_HANDOVER_FAIL, /* 04.08 Handover Failed */ + S_LCHAN_HANDOVER_DETECT, /* 08.58 Handover Detect */ }; /* SS_SUBSCR signals */ -- cgit v1.2.3 From 798418a068fcc95f8f5bcad5ba923ab065d7fa86 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 29 Nov 2009 22:56:14 +0100 Subject: [handover] Implement handover control logic Code to implement handover control logic. A yet-to-be-implemented handover algorithm will call bsc_handover_start(old_lchan, new_bts) to start the handover process. --- openbsc/include/openbsc/gsm_04_08.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 359aa1b39..4a5cebf46 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -757,6 +757,8 @@ int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); int gsm48_send_rr_app_info(struct gsm_lchan *lchan, u_int8_t apdu_id, u_int8_t apdu_len, const u_int8_t *apdu); int gsm48_send_rr_ass_cmd(struct gsm_lchan *lchan, u_int8_t power_class); +int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, + struct gsm_lchan *new_lchan, u_int8_t power_command); int bsc_upqueue(struct gsm_network *net); -- cgit v1.2.3 From dbb1d883594ba8796acbc7831d4ad042c7070d12 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 30 Nov 2009 19:16:47 +0100 Subject: [handover] export measurement reports via signal This patch introduces the S_LCHAN_MEAS_REP signal which is used to export measurement reports as input to the yet-to-be-written handover algorithm. --- openbsc/include/openbsc/meas_rep.h | 2 ++ openbsc/include/openbsc/signal.h | 1 + 2 files changed, 3 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h index 0c2bdabde..b1ad2daa8 100644 --- a/openbsc/include/openbsc/meas_rep.h +++ b/openbsc/include/openbsc/meas_rep.h @@ -30,6 +30,8 @@ struct gsm_meas_rep_unidir { /* parsed uplink and downlink measurement result */ struct gsm_meas_rep { + struct gsm_lchan *lchan; + u_int8_t nr; unsigned int flags; diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index fbd61ae9e..5156fcb79 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -83,6 +83,7 @@ enum signal_lchan { S_LCHAN_HANDOVER_COMPL, /* 04.08 Handover Completed */ S_LCHAN_HANDOVER_FAIL, /* 04.08 Handover Failed */ S_LCHAN_HANDOVER_DETECT, /* 08.58 Handover Detect */ + S_LCHAN_MEAS_REP, /* 08.58 Measurement Report */ }; /* SS_SUBSCR signals */ -- cgit v1.2.3 From b84ddfc22f60ed42c0c0ee5367c42a56157a7c75 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 1 Dec 2009 17:36:54 +0530 Subject: Assign default values for T3101 and T3113 Without those default values, old config files will no longer work after commit 23975e718fd456ff8be7effbb915903f1bc173be --- openbsc/include/openbsc/gsm_data.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 638b03506..b4a8ef550 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -407,6 +407,9 @@ enum gsm_auth_policy { GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke authorization */ }; +#define GSM_T3101_DEFAULT 10 +#define GSM_T3113_DEFAULT 60 + struct gsm_network { /* global parameters */ u_int16_t country_code; -- cgit v1.2.3 From 3961fcc0313f1d87ab64806638e416f2603e7345 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 30 Nov 2009 19:37:18 +0100 Subject: Introduce new S_GLOBAL_SHUTDOWN signal This is used to notify various parts of OpenBSC that we're shutting down. --- openbsc/include/openbsc/signal.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 5156fcb79..d59bb9726 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -40,6 +40,7 @@ enum signal_subsystems { SS_LCHAN, SS_SUBSCR, SS_SCALL, + SS_GLOBAL, }; /* SS_PAGING signals */ @@ -99,6 +100,10 @@ enum signal_scall { S_SCALL_DETACHED, }; +enum signal_global { + S_GLOBAL_SHUTDOWN, +}; + typedef int signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data); -- cgit v1.2.3 From a43f789a0a124c322146280ab00935b75f505617 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 1 Dec 2009 18:04:30 +0530 Subject: Replace template-based SYSTEM INFORMATION with real implementation Before this commit, OpenBSC used templates for the SYSTEM INFO 1, 2, 3, 4, 5 and 6 messages. Those templates were patched in various places to reflect the network config like ARFCN. Now, we actually generate those SI messages ourselves, using values from the configuration file, and even calculating neighbor cell lists. All bts'es that you have configured in OpenBSC will end up in the neighbor cell list - which should be more than sufficient for the current small-single-site networks. --- openbsc/include/openbsc/bitvec.h | 59 +++++++++++++ openbsc/include/openbsc/gsm_04_08.h | 23 +++-- openbsc/include/openbsc/gsm_data.h | 11 ++- openbsc/include/openbsc/rest_octets.h | 122 +++++++++++++++++++++++++++ openbsc/include/openbsc/system_information.h | 6 ++ 5 files changed, 214 insertions(+), 7 deletions(-) create mode 100644 openbsc/include/openbsc/bitvec.h create mode 100644 openbsc/include/openbsc/rest_octets.h create mode 100644 openbsc/include/openbsc/system_information.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bitvec.h b/openbsc/include/openbsc/bitvec.h new file mode 100644 index 000000000..80ed4ad0a --- /dev/null +++ b/openbsc/include/openbsc/bitvec.h @@ -0,0 +1,59 @@ +#ifndef _BITVEC_H +#define _BITVEC_H + +/* bit vector utility routines */ + +/* (C) 2009 by Harald Welte + * + * All Rights Reserved + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + + +/* In GSM mac blocks, every bit can be 0 or 1, or L or H. L/H are + * defined relative to the 0x2b padding pattern */ +enum bit_value { + ZERO = 0, + ONE = 1, + L = 2, + H = 3, +}; + +struct bitvec { + unsigned int cur_bit; /* curser to the next unused bit */ + unsigned int data_len; /* length of data array in bytes */ + u_int8_t *data; /* pointer to data array */ +}; + +/* Set a bit at given position */ +int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, + enum bit_value bit); + +/* Set the next bit in the vector */ +int bitvec_set_bit(struct bitvec *bv, enum bit_value bit); + +/* Set multiple bits at the current position */ +int bitvec_set_bits(struct bitvec *bv, enum bit_value *bits, int count); + +/* Add an unsigned integer (of length count bits) to current position */ +int bitvec_set_uint(struct bitvec *bv, unsigned int in, int count); + + +/* Pad the bit vector up to a certain bit position */ +int bitvec_spare_padding(struct bitvec *bv, unsigned int up_to_bit); + +#endif /* _BITVEC_H */ diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 4a5cebf46..a3b77a8ab 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -187,6 +187,13 @@ struct gsm48_control_channel_descr { u_int8_t t3212; } __attribute__ ((packed)); +struct gsm48_cell_options { + u_int8_t radio_link_timeout:4, + dtx:2, + pwrc:1, + spare:1; +} __attribute__ ((packed)); + /* Section 9.2.9 CM service request */ struct gsm48_service_request { u_int8_t cm_service_type : 4, @@ -203,7 +210,7 @@ struct gsm48_system_information_type_1 { struct gsm48_system_information_type_header header; u_int8_t cell_channel_description[16]; struct gsm48_rach_control rach_control; - u_int8_t s1_reset; + u_int8_t rest_octets[0]; /* NCH position on the CCCH */ } __attribute__ ((packed)); /* Section 9.1.32 System information Type 2 */ @@ -220,10 +227,10 @@ struct gsm48_system_information_type_3 { u_int16_t cell_identity; struct gsm48_loc_area_id lai; struct gsm48_control_channel_descr control_channel_desc; - u_int8_t cell_options; + struct gsm48_cell_options cell_options; struct gsm48_cell_sel_par cell_sel_par; struct gsm48_rach_control rach_control; - u_int8_t s3_reset_octets[4]; + u_int8_t rest_octets[0]; } __attribute__ ((packed)); /* Section 9.1.36 System information Type 4 */ @@ -253,9 +260,15 @@ struct gsm48_system_information_type_6 { u_int8_t system_information; u_int16_t cell_identity; struct gsm48_loc_area_id lai; - u_int8_t cell_options; + struct gsm48_cell_options cell_options; u_int8_t ncc_permitted; - u_int8_t si_6_reset[0]; + u_int8_t rest_octets[0]; +} __attribute__ ((packed)); + +/* Section 9.1.43a System Information type 13 */ +struct gsm48_system_information_type_13 { + struct gsm48_system_information_type_header header; + u_int8_t rest_octets[0]; } __attribute__ ((packed)); /* Section 9.2.12 IMSI Detach Indication */ diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index b4a8ef550..fcd623fe6 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -356,8 +356,6 @@ struct gsm_bts { /* number of this BTS on given E1 link */ u_int8_t bts_nr; - struct gsm48_control_channel_descr chan_desc; - /* paging state and control */ struct gsm_bts_paging_state paging; @@ -368,6 +366,15 @@ struct gsm_bts { struct gsm_nm_state nm_state; } site_mgr; + /* parameters from which we build SYSTEM INFORMATION */ + struct { + struct gsm48_rach_control rach_control; + u_int8_t ncc_permitted; + struct gsm48_cell_sel_par cell_sel_par; + struct gsm48_cell_options cell_options; + struct gsm48_control_channel_descr chan_desc; + } si_common; + /* ip.accesss Unit ID's have Site/BTS/TRX layout */ union { struct { diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h new file mode 100644 index 000000000..4e72c0f87 --- /dev/null +++ b/openbsc/include/openbsc/rest_octets.h @@ -0,0 +1,122 @@ +#ifndef _REST_OCTETS_H +#define _REST_OCTETS_H + +#include +#include + +/* generate SI1 rest octets */ +int rest_octets_si1(u_int8_t *data, u_int8_t *nch_pos); + +struct gsm48_si_selection_params { + u_int16_t penalty_time:5, + temp_offs:3, + cell_resel_off:6, + cbq:1, + present:1; +}; + +struct gsm48_si_power_offset { + u_int8_t power_offset:2, + present:1; +}; + +struct gsm48_si3_gprs_ind { + u_int8_t si13_position:1, + ra_colour:3, + present:1; +}; + +struct gsm48_lsa_params { + u_int32_t prio_thr:3, + lsa_offset:3, + mcc:12, + mnc:12; + unsigned int present; +}; + +struct gsm48_si_ro_info { + struct gsm48_si_selection_params selection_params; + struct gsm48_si_power_offset power_offset; + u_int8_t si2ter_indicator; + u_int8_t early_cm_ctrl; + struct { + u_int8_t where:3, + present:1; + } scheduling; + struct gsm48_si3_gprs_ind gprs_ind; + + /* SI 4 specific */ + struct gsm48_lsa_params lsa_params; + u_int16_t cell_id; + u_int8_t break_ind; /* do we have SI7 + SI8 ? */ +}; + + +/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */ +int rest_octets_si3(u_int8_t *data, const struct gsm48_si_ro_info *si3); + +/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */ +int rest_octets_si4(u_int8_t *data, const struct gsm48_si_ro_info *si4); + +enum pbcch_carrier_type { + PBCCH_BCCH, + PBCCH_ARFCN, + PBCCH_MAIO +}; + +/* TS 03.60 Chapter 6.3.3.1: Network Mode of Operation */ +enum gprs_nmo { + GPRS_NMO_I = 0, /* CS pagin on GPRS paging or traffic channel */ + GPRS_NMO_II = 1, /* all paging on CCCH */ + GPRS_NMO_III = 2, /* no paging coordination */ +}; + +struct gprs_cell_options { + enum gprs_nmo nmo; + /* T3168: wait for packet uplink assignment message */ + u_int32_t t3168; /* in milliseconds */ + /* T3192: wait for release of the TBF after reception of the final block */ + u_int32_t t3192; /* in milliseconds */ + u_int32_t drx_timer_max;/* in seconds */ + u_int32_t bs_cv_max; +}; + +/* TS 04.60 Table 12.9.2 */ +struct gprs_power_ctrl_pars { + u_int8_t alpha; + u_int8_t t_avg_w; + u_int8_t t_avg_t; + u_int8_t pc_meas_chan; + u_int8_t n_avg_i; +}; + +struct gsm48_si13_info { + struct gprs_cell_options cell_opts; + struct gprs_power_ctrl_pars pwr_ctrl_pars; + u_int8_t bcch_change_mark; + u_int8_t si_change_field; + u_int8_t pbcch_present; + + union { + struct { + u_int8_t rac; + u_int8_t spgc_ccch_sup; + u_int8_t net_ctrl_ord; + u_int8_t prio_acc_thr; + } no_pbcch; + struct { + u_int8_t psi1_rep_per; + u_int8_t pb; + u_int8_t tsc; + u_int8_t tn; + enum pbcch_carrier_type carrier_type; + u_int16_t arfcn; + u_int8_t maio; + } pbcch; + }; +}; + +/* Generate SI13 Rest Octests (Chapter 10.5.2.37b) */ +int rest_octets_si13(u_int8_t *data, const struct gsm48_si13_info *si13); + +#endif /* _REST_OCTETS_H */ diff --git a/openbsc/include/openbsc/system_information.h b/openbsc/include/openbsc/system_information.h new file mode 100644 index 000000000..982a9ac63 --- /dev/null +++ b/openbsc/include/openbsc/system_information.h @@ -0,0 +1,6 @@ +#ifndef _SYSTEM_INFO_H +#define _SYSTEM_INFO_H + +int gsm_generate_si(u_int8_t *output, struct gsm_bts *bts, int type); + +#endif -- cgit v1.2.3 From 2c828991352f94c1be7d860d0d151f719c1ecc6f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 2 Dec 2009 01:56:49 +0530 Subject: move RTP socket information from timeslot to lchan With ip.access, in case of TCH/H, we have one RTP stream for each half-slot (lchan), not just one per on-air timeslot. This is quite different from a classic BTS where the TRAU frames of the two TCH/H channels would be part of the same 16k sub-slot in a E1 timeslot. --- openbsc/include/openbsc/gsm_data.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index fcd623fe6..bd7b79b27 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -185,6 +185,14 @@ struct gsm_lchan { /* use count. how many users use this channel */ unsigned int use_count; + + struct { + u_int32_t bound_ip; + u_int16_t bound_port; + u_int8_t rtp_payload2; + u_int16_t conn_id; + struct rtp_socket *rtp_socket; + } abis_ip; }; struct gsm_e1_subslot { @@ -212,13 +220,6 @@ struct gsm_bts_trx_ts { /* To which E1 subslot are we connected */ struct gsm_e1_subslot e1_link; - struct { - u_int32_t bound_ip; - u_int16_t bound_port; - u_int8_t rtp_payload2; - u_int16_t conn_id; - struct rtp_socket *rtp_socket; - } abis_ip; struct gsm_lchan lchan[TS_MAX_LCHAN]; }; -- cgit v1.2.3 From 7fc57adf16f2099fd5ce02784625567e28f5217b Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 6 Dec 2009 04:29:26 +0100 Subject: Fix make distcheck by adding the new headers... --- openbsc/include/openbsc/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 8bb64eb91..161a9a66e 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -4,4 +4,5 @@ noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \ subchan_demux.h trau_frame.h e1_input.h trau_mux.h signal.h \ gsm_utils.h ipaccess.h rs232.h openbscdefines.h rtp_proxy.h \ bsc_rll.h mncc.h talloc.h transaction.h ussd.h gsm_04_80.h \ - silent_call.h mgcp.h + silent_call.h mgcp.h meas_rep.h bitvec.h rest_octets.h \ + system_information.h -- cgit v1.2.3 From 1085c097e3abc7b76f71e33c01f0e2f87c031e74 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 18 Nov 2009 20:33:19 +0100 Subject: location updating reject cause now specified on VTY rather than command line argument --- openbsc/include/openbsc/gsm_04_08.h | 1 - openbsc/include/openbsc/gsm_data.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index a3b77a8ab..01afe05b0 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -748,7 +748,6 @@ struct gsm_trans; /* config options controlling the behaviour of the lower leves */ void gsm0408_allow_everyone(int allow); -void gsm0408_set_reject_cause(int cause); int gsm0408_rcvmsg(struct msgb *msg, u_int8_t link_id); void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc, diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index bd7b79b27..7184a85a5 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -425,6 +425,7 @@ struct gsm_network { char *name_long; char *name_short; enum gsm_auth_policy auth_policy; + enum gsm48_reject_value reject_cause; int a5_encryption; int neci; -- cgit v1.2.3 From 24766091d8e389b5e5f55124ef00e73c160ed5da Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 9 Dec 2009 19:18:32 +0100 Subject: mark lchan2chan_nr() using a 'const' parameter which fixes some compile warnings at some callers. --- openbsc/include/openbsc/abis_rsl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index a911be355..b76d0facc 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -547,7 +547,7 @@ unsigned int get_paging_group(u_int64_t imsi, unsigned int bs_cc_chans, int n_pag_blocks); unsigned int n_pag_blocks(int bs_ccch_sdcch_comb, unsigned int bs_ag_blks_res); u_int64_t str_to_imsi(const char *imsi_str); -u_int8_t lchan2chan_nr(struct gsm_lchan *lchan); +u_int8_t lchan2chan_nr(const struct gsm_lchan *lchan); int rsl_release_request(struct gsm_lchan *lchan, u_int8_t link_id); /* to be provided by external code */ -- cgit v1.2.3 From 4bb4738d217596582a689169d12fdd6eb1ed8785 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Dec 2009 15:37:54 +0100 Subject: utility functions to convert RXLEV into dBm and vice versa --- openbsc/include/openbsc/gsm_utils.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_utils.h b/openbsc/include/openbsc/gsm_utils.h index 1bd1bc55a..5809221a3 100644 --- a/openbsc/include/openbsc/gsm_utils.h +++ b/openbsc/include/openbsc/gsm_utils.h @@ -33,5 +33,9 @@ int gsm_7bit_encode(u_int8_t *result, const char *data); int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm); int ms_pwr_dbm(enum gsm_band band, u_int8_t lvl); +/* According to TS 08.05 Chapter 8.1.4 */ +int rxlev2dbm(u_int8_t rxlev); +u_int8_t dbm2rxlev(int dbm); + void generate_backtrace(); #endif -- cgit v1.2.3 From 09b7e7fa43c74d35e8ea935f3096993e3360f33a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 12 Dec 2009 21:36:53 +0100 Subject: Gracefully reject non-speech calls As we currently really only deal with voice/speech calls and don't support FAX and DATA (CSD) calls, we now gracefully reject them. --- openbsc/include/openbsc/mncc.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h index 68d76abf8..766c09f1d 100644 --- a/openbsc/include/openbsc/mncc.h +++ b/openbsc/include/openbsc/mncc.h @@ -162,6 +162,14 @@ struct gsm_mncc_cccap { int pcp; }; +enum { + GSM_MNCC_BCAP_SPEECH = 0, + GSM_MNCC_BCAP_UNR_DIG = 1, + GSM_MNCC_BCAP_AUDIO = 2, + GSM_MNCC_BCAP_FAX_G3 = 3, + GSM_MNCC_BCAP_OTHER_ITC = 5, + GSM_MNCC_BCAP_RESERVED = 7, +}; struct gsm_mncc { /* context based information */ -- cgit v1.2.3 From eab84a112c3ef8c35835a2ba23fa978fff4d218b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 13 Dec 2009 10:53:12 +0100 Subject: [RRLP] make RRLP mode configurable from config file We now support different RRLP modes (including "none" to disable RRLP), you can configure it via "rrlp mode" in the "network" section of openbsc.cfg. --- openbsc/include/openbsc/gsm_data.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 7184a85a5..57665386d 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -38,6 +38,13 @@ enum gsm_chan_t { GSM_LCHAN_UNKNOWN, }; +/* RRLP mode of operation */ +enum rrlp_mode { + RRLP_MODE_NONE, + RRLP_MODE_MS_BASED, + RRLP_MODE_MS_PREF, + RRLP_MODE_ASS_PREF, +}; /* Channel Request reason */ enum gsm_chreq_reason_t { @@ -449,6 +456,11 @@ struct gsm_network { int T3117; int T3119; int T3141; + + /* Radio Resource Location Protocol (TS 04.31) */ + struct { + enum rrlp_mode mode; + } rrlp; }; #define SMS_HDR_SIZE 128 @@ -533,6 +545,9 @@ static inline int is_siemens_bts(struct gsm_bts *bts) enum gsm_auth_policy gsm_auth_policy_parse(const char *arg); const char *gsm_auth_policy_name(enum gsm_auth_policy policy); +enum rrlp_mode rrlp_mode_parse(const char *arg); +const char *rrlp_mode_name(enum rrlp_mode mode); + void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); #endif -- cgit v1.2.3 From 7659de1bcbd22f48c41f76ea9e41dc71c9ed1cee Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 13 Dec 2009 12:39:18 +0100 Subject: introduce new signal every time we get a mobile identity --- openbsc/include/openbsc/signal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index d59bb9726..10fcddda3 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -91,6 +91,7 @@ enum signal_lchan { enum signal_subscr { S_SUBSCR_ATTACHED, S_SUBSCR_DETACHED, + S_SUBSCR_IDENTITY, /* we've received some identity information */ }; /* SS_SCALL signals */ -- cgit v1.2.3 From 648b6ce083e3826b5df912de61214961f4950321 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 09:00:24 +0100 Subject: Add VTY setting for whether or not to sending MM INFO --- openbsc/include/openbsc/gsm_data.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 57665386d..9bddd7aad 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -435,6 +435,7 @@ struct gsm_network { enum gsm48_reject_value reject_cause; int a5_encryption; int neci; + int send_mm_info; /* layer 4 */ int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg); -- cgit v1.2.3 From d57f163bd4040cddf59cb145affba2c2d2570c42 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 22:04:31 +0100 Subject: bitvec updates and code simplification * introduce a new bitvec_get_bit_pos() function to determine the bit value at a given position inside a bit vector * make sure bitvec_{get,set}_bit_pos() share code as possible --- openbsc/include/openbsc/bitvec.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bitvec.h b/openbsc/include/openbsc/bitvec.h index 80ed4ad0a..a365e2a2d 100644 --- a/openbsc/include/openbsc/bitvec.h +++ b/openbsc/include/openbsc/bitvec.h @@ -39,6 +39,9 @@ struct bitvec { u_int8_t *data; /* pointer to data array */ }; +/* check if the bit is 0 or 1 for a given position inside a bitvec */ +enum bit_value bitvec_get_bit_pos(struct bitvec *bv, unsigned int bitnr); + /* Set a bit at given position */ int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, enum bit_value bit); -- cgit v1.2.3 From 6c40def716b757a1aa683d9414b2320d3fc20c8a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 22:07:14 +0100 Subject: system_information: use bitvec to generate frequency lists We use a 1024-bit-sized bitvec to generate the BA and neighbor frequency list. This bitvec is still generated from the list of all BTS's inside the BSC, but this patch is the first step to generalize this, i.e. generate arbitrary neighbor lists. --- openbsc/include/openbsc/gsm_data.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 9bddd7aad..52c6a030b 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -60,6 +60,7 @@ enum gsm_chreq_reason_t { #include #include #include +#include #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -381,6 +382,13 @@ struct gsm_bts { struct gsm48_cell_sel_par cell_sel_par; struct gsm48_cell_options cell_options; struct gsm48_control_channel_descr chan_desc; + struct bitvec neigh_list; + struct bitvec cell_alloc; + struct { + /* bitmask large enough for all possible ARFCN's */ + u_int8_t neigh_list[1024/8]; + u_int8_t cell_alloc[1024/8]; + } data; } si_common; /* ip.accesss Unit ID's have Site/BTS/TRX layout */ -- cgit v1.2.3 From 7f73a1ac58d6b9f2f8ec793123bf0ee3038fb3a4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 22:23:27 +0100 Subject: bitvec: Introduce bitvec_get_nth_set_bit() function This is particularly important for determining the ARFCN for cells reported in 04.08 MEAS REP. --- openbsc/include/openbsc/bitvec.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/bitvec.h b/openbsc/include/openbsc/bitvec.h index a365e2a2d..b35aebf16 100644 --- a/openbsc/include/openbsc/bitvec.h +++ b/openbsc/include/openbsc/bitvec.h @@ -42,6 +42,9 @@ struct bitvec { /* check if the bit is 0 or 1 for a given position inside a bitvec */ enum bit_value bitvec_get_bit_pos(struct bitvec *bv, unsigned int bitnr); +/* get the Nth set bit inside the bit vector */ +unsigned int bitvec_get_nth_set_bit(struct bitvec *bv, unsigned int n); + /* Set a bit at given position */ int bitvec_set_bit_pos(struct bitvec *bv, unsigned int bitnum, enum bit_value bit); -- cgit v1.2.3 From f1dae1924a80e614982513707b4ee568d2126e1b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 22:24:28 +0100 Subject: 04.08 MEAS REP: Convert relative cell number to ARFCN Since we are keeping a bitvec of the neighbor cells, we can now use bitvec_get_nth_set_bit() to determine the ARFCN for each reported cell in the 04.08 MEASUREMENT REPORT. --- openbsc/include/openbsc/meas_rep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h index b1ad2daa8..d44c9b766 100644 --- a/openbsc/include/openbsc/meas_rep.h +++ b/openbsc/include/openbsc/meas_rep.h @@ -4,8 +4,8 @@ /* extracted from a L3 measurement report IE */ struct gsm_meas_rep_cell { u_int8_t rxlev; - u_int8_t bcch_freq; /* FIXME: translate to ARFCN */ u_int8_t bsic; + u_int16_t arfcn; }; /* RX Level and RX Quality */ -- cgit v1.2.3 From 84874c9005fd568d423f6fde9caedd36dc5bff57 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 14 Dec 2009 22:33:02 +0100 Subject: Implement gsm_bts_neighbor() function to determine neighbor BTS We will need this for the actual handover algorithm implementation, as we will only know the current BTS and the BCCH ARFCN of the strongest cell in the measurement reports. Using this new function, we can resolve the matching gsm_bts. --- openbsc/include/openbsc/gsm_data.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 52c6a030b..33ec328fc 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -501,6 +501,10 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type, struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); + +/* Get reference to a neighbor cell on a given BCCH ARFCN */ +struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, u_int16_t arfcn); + struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num); const char *gsm_pchan_name(enum gsm_phys_chan_config c); -- cgit v1.2.3 From 0b12103965c824b0dae1ae10df00d87d4ef1ec7b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 15 Dec 2009 00:21:31 +0100 Subject: add BSIC parameter to gsm_bts_neighbor() When looking for the gsm_bts of a neighbor cell, use BSIC and ARFCN tuple rather than just ARFCN for better identification purpose. --- openbsc/include/openbsc/gsm_data.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 33ec328fc..012481a5f 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -503,7 +503,8 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts); struct gsm_bts *gsm_bts_num(struct gsm_network *net, int num); /* Get reference to a neighbor cell on a given BCCH ARFCN */ -struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, u_int16_t arfcn); +struct gsm_bts *gsm_bts_neighbor(const struct gsm_bts *bts, + u_int16_t arfcn, u_int8_t bsic); struct gsm_bts_trx *gsm_bts_trx_num(struct gsm_bts *bts, int num); -- cgit v1.2.3 From d12b0fdf51b76f906d5ee5f5b7f266fe791eb800 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 15 Dec 2009 21:36:05 +0100 Subject: introduce cache of 6 last recently received measurement reports for each lchan --- openbsc/include/openbsc/gsm_data.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 012481a5f..b21f8aa05 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -194,6 +194,10 @@ struct gsm_lchan { /* use count. how many users use this channel */ unsigned int use_count; + /* cache of last measurement reports on this lchan */ + struct gsm_meas_rep meas_rep[6]; + int meas_rep_idx; + struct { u_int32_t bound_ip; u_int16_t bound_port; @@ -564,4 +568,6 @@ const char *rrlp_mode_name(enum rrlp_mode mode); void gsm_trx_lock_rf(struct gsm_bts_trx *trx, int locked); +struct gsm_meas_rep *lchan_next_meas_rep(struct gsm_lchan *lchan); + #endif -- cgit v1.2.3 From 7f2d25b0956f0e9fb6cdf0056d9371a00cc239e4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 15 Dec 2009 21:36:59 +0100 Subject: mroe comments on meas_rep data structures --- openbsc/include/openbsc/meas_rep.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h index d44c9b766..c36352e2a 100644 --- a/openbsc/include/openbsc/meas_rep.h +++ b/openbsc/include/openbsc/meas_rep.h @@ -30,11 +30,15 @@ struct gsm_meas_rep_unidir { /* parsed uplink and downlink measurement result */ struct gsm_meas_rep { + /* back-pointer to the logical channel */ struct gsm_lchan *lchan; + /* number of the measurement report */ u_int8_t nr; + /* flags, see MEAS_REP_F_* */ unsigned int flags; + /* uplink and downlink rxlev, rxqual; full and sub */ struct gsm_meas_rep_unidir ul; struct gsm_meas_rep_unidir dl; @@ -45,6 +49,7 @@ struct gsm_meas_rep { u_int8_t ta; /* MS timing advance */ } ms_l1; + /* neighbor measurement reports for up to 6 cells */ int num_cell; struct gsm_meas_rep_cell cell[6]; }; -- cgit v1.2.3 From 88a412ac80e182fc8a1fa470f846783d79ab7d52 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 16 Dec 2009 17:32:37 +0100 Subject: ip.access: Keep OML/RSL up/down state per-bts for multi-BTS setups --- openbsc/include/openbsc/gsm_data.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index b21f8aa05..f9b0b6340 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -400,6 +400,7 @@ struct gsm_bts { struct { u_int16_t site_id; u_int16_t bts_id; + u_int32_t flags; } ip_access; struct { struct { -- cgit v1.2.3 From 7a7a0d54289114e6a49087a555b7a4f1e6cb3016 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 00:25:18 +0100 Subject: make handover reference a function call argument --- openbsc/include/openbsc/gsm_04_08.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_04_08.h b/openbsc/include/openbsc/gsm_04_08.h index 01afe05b0..b8671554e 100644 --- a/openbsc/include/openbsc/gsm_04_08.h +++ b/openbsc/include/openbsc/gsm_04_08.h @@ -769,8 +769,8 @@ int gsm48_send_rr_ciph_mode(struct gsm_lchan *lchan, int want_imeisv); int gsm48_send_rr_app_info(struct gsm_lchan *lchan, u_int8_t apdu_id, u_int8_t apdu_len, const u_int8_t *apdu); int gsm48_send_rr_ass_cmd(struct gsm_lchan *lchan, u_int8_t power_class); -int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, - struct gsm_lchan *new_lchan, u_int8_t power_command); +int gsm48_send_ho_cmd(struct gsm_lchan *old_lchan, struct gsm_lchan *new_lchan, + u_int8_t power_command, u_int8_t ho_ref); int bsc_upqueue(struct gsm_network *net); -- cgit v1.2.3 From 8d77b9540a907fb36afbb324df549c9261e1ca02 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 00:31:10 +0100 Subject: [handover] first functional handover implementation With this commit, we can successfully hand over a channel from one cell to another cell. We implement asynchronous intra-BSC (but inter-BTS) handover. Changes: * introduce new DHO log category * extend rsl_chan_activate_lchan() with argument for HO reference * introduce actual minimal handover decision making in handover_decision.c * various fixes to bsc_handover_start() in handover_logic.c --- openbsc/include/openbsc/abis_rsl.h | 2 +- openbsc/include/openbsc/debug.h | 2 ++ openbsc/include/openbsc/handover.h | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 openbsc/include/openbsc/handover.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index b76d0facc..6d0ab6182 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -497,7 +497,7 @@ int rsl_chan_activate(struct gsm_bts_trx *trx, u_int8_t chan_nr, u_int8_t bs_power, u_int8_t ms_power, u_int8_t ta); int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type, - u_int8_t ta); + u_int8_t ta, u_int8_t ho_ref); int rsl_chan_mode_modify_req(struct gsm_lchan *ts); int rsl_encryption_cmd(struct msgb *msg); int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len, diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index 447c3584f..c1098a53c 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -25,6 +25,8 @@ #define DMGCP 0x40000 +#define DHO 0x80000 + #ifdef DEBUG #define DEBUGP(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 0, fmt, ## args) #define DEBUGPC(ss, fmt, args...) debugp(ss, __FILE__, __LINE__, 1, fmt, ## args) diff --git a/openbsc/include/openbsc/handover.h b/openbsc/include/openbsc/handover.h new file mode 100644 index 000000000..8ab1b0642 --- /dev/null +++ b/openbsc/include/openbsc/handover.h @@ -0,0 +1,8 @@ +#ifndef _HANDOVER_H +#define _HANDOVER_H +/* Hand over the specified logical channel to the specified new BTS. + * This is the main entry point for the actual handover algorithm, + * after it has decided it wants to initiate HO to a specific BTS */ +int bsc_handover_start(struct gsm_lchan *old_lchan, struct gsm_bts *bts); + +#endif /* _HANDOVER_H */ -- cgit v1.2.3 From cc9beb53663c9660c7e7a225256a9e71d3c9165e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 17:13:28 +0100 Subject: introduce trans_lchan_change() to update transaction about lchan change --- openbsc/include/openbsc/transaction.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h index 961a64923..6314f987f 100644 --- a/openbsc/include/openbsc/transaction.h +++ b/openbsc/include/openbsc/transaction.h @@ -65,4 +65,9 @@ void trans_free(struct gsm_trans *trans); int trans_assign_trans_id(struct gsm_subscriber *subscr, u_int8_t protocol, u_int8_t ti_flag); + +/* update all transactions to use a different LCHAN, e.g. + * after handover has succeeded */ +int trans_lchan_change(struct gsm_lchan *lchan_old, + struct gsm_lchan *lchan_new); #endif -- cgit v1.2.3 From b1d4c8ed9d2b4ecb76355d71a152c22934c48504 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 23:10:46 +0100 Subject: logging: introduce log levels at caller site This introduces a new LOGP() macro together with LOGL_* definition to support multiple log levels (severities) throughout the codebase. Please note that the actual logging system does not use them yet, in this patch we simply introduce the new macros at the caller site. --- openbsc/include/openbsc/debug.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/debug.h b/openbsc/include/openbsc/debug.h index c1098a53c..fc387cec3 100644 --- a/openbsc/include/openbsc/debug.h +++ b/openbsc/include/openbsc/debug.h @@ -44,4 +44,15 @@ void debug_use_color(int use_color); void debug_timestamp(int enable); extern unsigned int debug_mask; +/* new logging interface */ +#define LOGP(ss, level, fmt, args...) debugp(ss, __FILE__, __LINE__, 0, fmt, ##args) +#define LOGPC(ss, level, fmt, args...) debugp(ss, __FILE__, __LINE__, 1, fmt, ##args) + +/* different levels */ +#define LOGL_DEBUG 1 /* debugging information */ +#define LOGL_INFO 3 +#define LOGL_NOTICE 5 /* abnormal/unexpected condition */ +#define LOGL_ERROR 7 /* error condition, requires user action */ +#define LOGL_FATAL 8 /* fatal, program aborted */ + #endif /* _DEBUG_H */ -- cgit v1.2.3 From fa5aad789b794f3d24f97351b6ab85775b601c0e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 17 Dec 2009 23:13:38 +0100 Subject: add handover.h file to Makefile.am to make distcheck happy --- openbsc/include/openbsc/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am index 161a9a66e..27c88b770 100644 --- a/openbsc/include/openbsc/Makefile.am +++ b/openbsc/include/openbsc/Makefile.am @@ -5,4 +5,4 @@ noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \ gsm_utils.h ipaccess.h rs232.h openbscdefines.h rtp_proxy.h \ bsc_rll.h mncc.h talloc.h transaction.h ussd.h gsm_04_80.h \ silent_call.h mgcp.h meas_rep.h bitvec.h rest_octets.h \ - system_information.h + system_information.h handover.h -- cgit v1.2.3 From 3b104996946b66e6956da2d299557a1486dc26ed Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 18 Dec 2009 14:50:57 +0100 Subject: remove call_handling.h, a reminescent of old days --- openbsc/include/openbsc/call_handling.h | 64 --------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 openbsc/include/openbsc/call_handling.h (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/call_handling.h b/openbsc/include/openbsc/call_handling.h deleted file mode 100644 index 02027889e..000000000 --- a/openbsc/include/openbsc/call_handling.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (C) 2008 by Holger Hans Peter Freyther - * (C) 2008 by Stefan Schmidt - * All Rights Reserved - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef _CALL_HANDLING_H -#define _CALL_HANDLING_H - -#include "linuxlist.h" -#include "gsm_subscriber.h" -#include "timer.h" - -/* - * State transitions to be seen from the outside - */ -#define CALL_STATE_NULL 0 -#define CALL_STATE_SETUP 1 -#define CALL_STATE_PROCEED 2 -#define CALL_STATE_ALERT 3 -#define CALL_STATE_CONNECT 4 -#define CALL_STATE_ACTIVE 5 -#define CALL_STATE_RELEASE 6 - -struct call_data { - struct llist_head entry; - void (*state_change_cb)(int oldstate, int newstate, int event, void *data); - void *data; - char *destination_number; - - /* Internal */ - int state; - char tmsi[GSM_TMSI_LENGTH]; - struct timer_list t30x; /* to be added for... */ -}; - - -int call_initiate(struct call_data *call, char *tmsi); -void call_abort(struct call_data *call); - -/** - * Get notified about new incoming calls. The call_data is owned - * and managed by the internal call handling. - */ -void call_set_callback(void (*cb)(struct call_data *call, void *data), void* data); -void call_proceed(struct call_data *call_data); -void call_connect(struct call_data *call_data); - -#endif /* _CALL_HANDLING_H */ -- cgit v1.2.3 From 5e3d91bff71a9c456069bbf4a459b66a32f9656e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Dec 2009 16:42:06 +0100 Subject: ip.access: Keep a full copy of local and remote IP/PORT in lchan Keeping all parameters for each RTP connection in the abis_ip member of lchan will help us with actual TCH handover later on. --- openbsc/include/openbsc/abis_rsl.h | 3 +-- openbsc/include/openbsc/gsm_data.h | 5 ++++- openbsc/include/openbsc/signal.h | 1 + openbsc/include/openbsc/tlv.h | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index 6d0ab6182..f0a5619ad 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -537,8 +537,7 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); /* ip.access specfic RSL extensions */ int rsl_ipacc_crcx(struct gsm_lchan *lchan); int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, - u_int16_t port, u_int16_t conn_id, - u_int8_t rtp_payload2); + u_int16_t port, u_int8_t rtp_payload2); int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan); int abis_rsl_rcvmsg(struct msgb *msg); diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index f9b0b6340..67465e460 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -200,9 +200,12 @@ struct gsm_lchan { struct { u_int32_t bound_ip; + u_int32_t connect_ip; u_int16_t bound_port; - u_int8_t rtp_payload2; + u_int16_t connect_port; u_int16_t conn_id; + u_int8_t rtp_payload2; + u_int8_t speech_mode; struct rtp_socket *rtp_socket; } abis_ip; }; diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 10fcddda3..8c815f89e 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -59,6 +59,7 @@ enum signal_sms { /* SS_ABISIP signals */ enum signal_abisip { S_ABISIP_CRCX_ACK, + S_ABISIP_MDCX_ACK, S_ABISIP_DLCX_IND, }; diff --git a/openbsc/include/openbsc/tlv.h b/openbsc/include/openbsc/tlv.h index 0cf4388d8..e970ce468 100644 --- a/openbsc/include/openbsc/tlv.h +++ b/openbsc/include/openbsc/tlv.h @@ -119,6 +119,7 @@ static inline u_int8_t *tv_put(u_int8_t *buf, u_int8_t tag, return buf; } +/* 'val' is still in host byte order! */ static inline u_int8_t *tv16_put(u_int8_t *buf, u_int8_t tag, u_int16_t val) { -- cgit v1.2.3 From bc814501e8a28f72e16a4662250af01aaa2a1489 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Dec 2009 21:41:52 +0100 Subject: [handover] add VTY parameter to enable/disable handover --- openbsc/include/openbsc/gsm_data.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 67465e460..f4e4d2172 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -452,6 +452,9 @@ struct gsm_network { int a5_encryption; int neci; int send_mm_info; + struct { + int active; + } handover; /* layer 4 */ int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg); -- cgit v1.2.3 From da7ab74298b9fdb5eb27d6575e8a15683b69889f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Dec 2009 22:23:05 +0100 Subject: RTP-enable MNCC API for LCR + ip.access Instead of passing TRAU frames down the MNCC API to the call control application like MNCC, we now decode the TRAU frame into the actual codec frame. We do the same with the RTP packets in case of ip.access and thus have a unified format of passing codec data from the BTS to an application, independent of the BTS type. This is only implemented for V1 full-rate at the moment, and needs to be fixed. --- openbsc/include/openbsc/mncc.h | 4 ++-- openbsc/include/openbsc/rtp_proxy.h | 16 +++++++++++++++- openbsc/include/openbsc/transaction.h | 3 +++ openbsc/include/openbsc/trau_mux.h | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h index 766c09f1d..16fa05365 100644 --- a/openbsc/include/openbsc/mncc.h +++ b/openbsc/include/openbsc/mncc.h @@ -87,7 +87,7 @@ struct gsm_call { #define MNCC_FRAME_DROP 0x0202 #define MNCC_LCHAN_MODIFY 0x0203 -#define GSM_TRAU_FRAME 0x0300 +#define GSM_TCHF_FRAME 0x0300 #define GSM_MAX_FACILITY 128 #define GSM_MAX_SSVERSION 128 @@ -207,7 +207,7 @@ struct gsm_mncc { unsigned char lchan_mode; }; -struct gsm_trau_frame { +struct gsm_data_frame { u_int32_t msg_type; u_int32_t callref; unsigned char data[0]; diff --git a/openbsc/include/openbsc/rtp_proxy.h b/openbsc/include/openbsc/rtp_proxy.h index e9fc157cf..a3e45964c 100644 --- a/openbsc/include/openbsc/rtp_proxy.h +++ b/openbsc/include/openbsc/rtp_proxy.h @@ -34,6 +34,11 @@ enum rtp_rx_action { RTP_RECV_UPSTREAM, }; +enum rtp_tx_action { + RTP_SEND_NONE, + RTP_SEND_DOWNSTREAM, +}; + struct rtp_sub_socket { struct sockaddr_in sin_local; struct sockaddr_in sin_remote; @@ -56,15 +61,24 @@ struct rtp_socket { struct rtp_socket *other_sock; } proxy; struct { - void (*recv_cb)(struct msgb *msg); + struct gsm_network *net; + u_int32_t callref; } receive; }; + enum rtp_tx_action tx_action; + struct { + u_int16_t sequence; + u_int32_t timestamp; + u_int32_t ssrc; + } transmit; }; struct rtp_socket *rtp_socket_create(void); int rtp_socket_bind(struct rtp_socket *rs, u_int32_t ip); int rtp_socket_connect(struct rtp_socket *rs, u_int32_t ip, u_int16_t port); int rtp_socket_proxy(struct rtp_socket *this, struct rtp_socket *other); +int rtp_socket_upstream(struct rtp_socket *this, struct gsm_network *net, u_int32_t callref); int rtp_socket_free(struct rtp_socket *rs); +int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame); #endif /* _RTP_PROXY_H */ diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h index 6314f987f..cf9410082 100644 --- a/openbsc/include/openbsc/transaction.h +++ b/openbsc/include/openbsc/transaction.h @@ -26,6 +26,9 @@ struct gsm_trans { /* reference from MNCC or other application */ u_int32_t callref; + /* if traffic channel receive was requested */ + int tch_recv; + union { struct { diff --git a/openbsc/include/openbsc/trau_mux.h b/openbsc/include/openbsc/trau_mux.h index 90535add4..8deb708de 100644 --- a/openbsc/include/openbsc/trau_mux.h +++ b/openbsc/include/openbsc/trau_mux.h @@ -46,4 +46,4 @@ int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, int trau_recv_lchan(struct gsm_lchan *lchan, u_int32_t callref); /* send trau from application */ -int trau_send_lchan(struct gsm_lchan *lchan, struct decoded_trau_frame *tf); +int trau_send_frame(struct gsm_lchan *lchan, struct gsm_data_frame *frame); -- cgit v1.2.3 From aca8f158bccfc129a9eae234339a2b9c96d6f230 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 19 Dec 2009 23:06:41 +0100 Subject: Add RTP support for EFR This is just the minimal support to receive and send EFR codec RTP frames. We are missing the code to convert TRAU frames in EFR format! --- openbsc/include/openbsc/mncc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h index 16fa05365..fbf3cab1f 100644 --- a/openbsc/include/openbsc/mncc.h +++ b/openbsc/include/openbsc/mncc.h @@ -88,6 +88,7 @@ struct gsm_call { #define MNCC_LCHAN_MODIFY 0x0203 #define GSM_TCHF_FRAME 0x0300 +#define GSM_TCHF_FRAME_EFR 0x0301 #define GSM_MAX_FACILITY 128 #define GSM_MAX_SSVERSION 128 -- cgit v1.2.3 From 392736d38bf9dae29800bde630c9ceee8a3914f3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 20 Dec 2009 13:16:14 +0100 Subject: RTP Proxy: Fix RTP sequence number and timestamp in case of dropped frames During handover, we will not send RTP frames for quite some time. However, the way the rtp_send code is structured, it will increment the timestamp with a fixed amount every time we send a frame, independent how much wallclock time has actually passed. This code is a hack to update the sequence number and timestamp in case it seems to be wrong. It makes handover much more reliable. --- openbsc/include/openbsc/rtp_proxy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/rtp_proxy.h b/openbsc/include/openbsc/rtp_proxy.h index a3e45964c..d128e4f23 100644 --- a/openbsc/include/openbsc/rtp_proxy.h +++ b/openbsc/include/openbsc/rtp_proxy.h @@ -70,6 +70,7 @@ struct rtp_socket { u_int16_t sequence; u_int32_t timestamp; u_int32_t ssrc; + struct timeval last_tv; } transmit; }; -- cgit v1.2.3 From f88c8a02fc35fbcc8b85e3b51733f1a20ceadf13 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 20 Dec 2009 13:48:15 +0100 Subject: remove hand full of 'extern ipacc_rtp_direct' definitions and instead declare it in gsm_data.h --- openbsc/include/openbsc/gsm_data.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index f4e4d2172..f3ec9eb2b 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -542,6 +542,7 @@ char *gsm_band_name(enum gsm_band band); enum gsm_band gsm_band_parse(const char *mhz); extern void *tall_bsc_ctx; +extern int ipacc_rtp_direct; static inline int is_ipaccess_bts(struct gsm_bts *bts) { -- cgit v1.2.3 From a72273e176cf19a4d1352736a71698445d79b8fd Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 20 Dec 2009 16:51:09 +0100 Subject: rename ipacc_connect_proxy_bind() to rsl_ipacc_mdcx_to_rtpsock() Our RTP sockets are no longer just for the proxy mode, so having "proxy" in the function name is really misleading. --- openbsc/include/openbsc/abis_rsl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/abis_rsl.h b/openbsc/include/openbsc/abis_rsl.h index f0a5619ad..797b2f349 100644 --- a/openbsc/include/openbsc/abis_rsl.h +++ b/openbsc/include/openbsc/abis_rsl.h @@ -538,6 +538,7 @@ int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci); int rsl_ipacc_crcx(struct gsm_lchan *lchan); int rsl_ipacc_mdcx(struct gsm_lchan *lchan, u_int32_t ip, u_int16_t port, u_int8_t rtp_payload2); +int rsl_ipacc_mdcx_to_rtpsock(struct gsm_lchan *lchan); int rsl_ipacc_pdch_activate(struct gsm_lchan *lchan); int abis_rsl_rcvmsg(struct msgb *msg); -- cgit v1.2.3 From 38fe2a67e1a376e4370ddfed2f75687075cc9e6b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 09:26:17 +0100 Subject: meas_rep: utility function for processing of measurement reports This provides two functions: get_meas_rep_avg() to obtain the sliding window average of one particular field, and meas_rep_n_out_of_m_be() to check if at least N out of M measurments are >= BE. --- openbsc/include/openbsc/meas_rep.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/meas_rep.h b/openbsc/include/openbsc/meas_rep.h index c36352e2a..fd5fced43 100644 --- a/openbsc/include/openbsc/meas_rep.h +++ b/openbsc/include/openbsc/meas_rep.h @@ -1,11 +1,14 @@ #ifndef _MEAS_REP_H #define _MEAS_REP_H +#define MRC_F_PROCESSED 0x0001 + /* extracted from a L3 measurement report IE */ struct gsm_meas_rep_cell { u_int8_t rxlev; u_int8_t bsic; u_int16_t arfcn; + unsigned int flags; }; /* RX Level and RX Quality */ @@ -54,4 +57,28 @@ struct gsm_meas_rep { struct gsm_meas_rep_cell cell[6]; }; +enum meas_rep_field { + MEAS_REP_DL_RXLEV_FULL, + MEAS_REP_DL_RXLEV_SUB, + MEAS_REP_DL_RXQUAL_FULL, + MEAS_REP_DL_RXQUAL_SUB, + MEAS_REP_UL_RXLEV_FULL, + MEAS_REP_UL_RXLEV_SUB, + MEAS_REP_UL_RXQUAL_FULL, + MEAS_REP_UL_RXQUAL_SUB, +}; + +/* obtain an average over the last 'num' fields in the meas reps */ +int get_meas_rep_avg(const struct gsm_lchan *lchan, + enum meas_rep_field field, unsigned int num); + +/* Check if N out of M last values for FIELD are >= bd */ +int meas_rep_n_out_of_m_be(const struct gsm_lchan *lchan, + enum meas_rep_field field, + unsigned int n, unsigned int m, int be); + +unsigned int calc_initial_idx(unsigned int array_size, + unsigned int meas_rep_idx, + unsigned int num_values); + #endif /* _MEAS_REP_H */ -- cgit v1.2.3 From b8bfc567b7b8c705c1a2ec7654ce7184ab6c295f Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 13:27:11 +0100 Subject: RSL: keep track if a channel is active or not This allows us to block packets that we have received after the channel is no longer being used. This is visible during handover, where we still receive a measurement report after the MS has switched to the new channel. This leftover measurement report then attempts to trigger another handover, which si bogus and will fail - and thus only consumes resources. With the new LCHAN_S_ACTIVE state, we can check for this when processing the measurement report. --- openbsc/include/openbsc/gsm_data.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index f3ec9eb2b..d19f38bc1 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -151,6 +151,13 @@ struct gsm_loc_updating_operation { #define LCHAN_SAPI_MS 1 #define LCHAN_SAPI_NET 2 +/* state of a logical channel */ +enum gsm_lchan_state { + LCHAN_S_NONE, /* channel is not active */ + LCHAN_S_ACTIVE, /* channel is active and operational */ + LCHAN_S_INACTIVE, /* channel is set inactive */ +}; + struct gsm_lchan { /* The TS that we're part of */ struct gsm_bts_trx_ts *ts; @@ -162,6 +169,8 @@ struct gsm_lchan { enum rsl_cmod_spd rsl_cmode; /* If TCH, traffic channel mode */ enum gsm48_chan_mode tch_mode; + /* State */ + enum gsm_lchan_state state; /* Power levels for MS and BTS */ u_int8_t bs_power; u_int8_t ms_power; -- cgit v1.2.3 From f7c28b099f928cc6fb48fc9cc072656d8c3bb902 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 13:30:17 +0100 Subject: [handover] Real handover algorithm This implements the handover algorithm (and associated parameters) as described in Chapter 8 of the book "Performance Enhancements in a Frequency |Hopping GSM Network" by Thomas Toftegard Nielsen and Jeroen Wigard. The parameters such as averaging windows are configured in struct gsm_network. We keep some state to trakc up to 10 neighbors as they are being reported from the MS. This has so far only been tested in a network with two BTS that have each other as neighbor. Networks with morge neighbors might encounter bugs. --- openbsc/include/openbsc/gsm_data.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index d19f38bc1..876955824 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -143,6 +143,20 @@ struct gsm_loc_updating_operation { unsigned int waiting_for_imei : 1; }; +/* Maximum number of neighbor cells whose average we track */ +#define MAX_NEIGH_MEAS 10 +/* Maximum size of the averaging window for neighbor cells */ +#define MAX_WIN_NEIGH_AVG 10 + +/* processed neighbor measurements for one cell */ +struct neigh_meas_proc { + u_int16_t arfcn; + u_int8_t bsic; + u_int8_t rxlev[MAX_WIN_NEIGH_AVG]; + unsigned int rxlev_cnt; + u_int8_t last_seen_nr; +}; + #define MAX_A5_KEY_LEN (128/8) #define RSL_ENC_ALG_A5(x) (x+1) @@ -207,6 +221,9 @@ struct gsm_lchan { struct gsm_meas_rep meas_rep[6]; int meas_rep_idx; + /* table of neighbor cell measurements */ + struct neigh_meas_proc neigh_meas[MAX_NEIGH_MEAS]; + struct { u_int32_t bound_ip; u_int32_t connect_ip; @@ -463,6 +480,19 @@ struct gsm_network { int send_mm_info; struct { int active; + /* Window RXLEV averaging */ + unsigned int win_rxlev_avg; /* number of SACCH frames */ + /* Window RXQUAL averaging */ + unsigned int win_rxqual_avg; /* number of SACCH frames */ + /* Window RXLEV neighbouring cells averaging */ + unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */ + + /* how often should we check for power budget HO */ + unsigned int pwr_interval; /* SACCH frames */ + /* how much better does a neighbor cell have to be ? */ + unsigned int pwr_hysteresis; /* dBm */ + /* maximum distacne before we try a handover */ + unsigned int max_distance; /* TA values */ } handover; /* layer 4 */ -- cgit v1.2.3 From 713550120cb9231de49090c01abb6e867a93137d Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 21 Dec 2009 23:08:18 +0100 Subject: remove duplicate flag for cell barring it's sufficient if we keep the state of cell barring in one place --- openbsc/include/openbsc/gsm_data.h | 1 - 1 file changed, 1 deletion(-) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 876955824..9d2549ca1 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -381,7 +381,6 @@ struct gsm_bts { /* should the channel allocator allocate channels from high TRX to TRX0, * rather than starting from TRX0 and go upwards? */ int chan_alloc_reverse; - int cell_barred; /* maximum Tx power that the MS is permitted to use in this cell */ int ms_max_power; -- cgit v1.2.3 From 24ff6ee0a343d46823771b9a86e867780eb2099b Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 22 Dec 2009 00:41:05 +0100 Subject: keep some internal statistics inside OpenBSC the statistics will give us some idea about the network load and performance. --- openbsc/include/openbsc/gsm_data.h | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'openbsc/include') diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h index 9d2549ca1..74e193832 100644 --- a/openbsc/include/openbsc/gsm_data.h +++ b/openbsc/include/openbsc/gsm_data.h @@ -457,6 +457,49 @@ struct gsm_bts { struct llist_head trx_list; }; +/* Some statistics of our network */ +struct gsmnet_stats { + struct { + unsigned long total; + unsigned long no_channel; + } chreq; + struct { + unsigned long attempted; + unsigned long no_channel; /* no channel available */ + unsigned long timeout; /* T3103 timeout */ + unsigned long completed; /* HO COMPL received */ + unsigned long failed; /* HO FAIL received */ + } handover; + struct { + unsigned long attach; + unsigned long normal; + unsigned long periodic; + unsigned long detach; + } loc_upd_type; + struct { + unsigned long reject; + unsigned long accept; + } loc_upd_resp; + struct { + unsigned long attempted; + unsigned long detached; + unsigned long completed; + unsigned long expired; + } paging; + struct { + unsigned long submitted; /* MO SMS submissions */ + unsigned long no_receiver; + unsigned long delivered; /* MT SMS deliveries */ + unsigned long rp_err_mem; + unsigned long rp_err_other; + } sms; + struct { + unsigned long dialled; /* total number of dialled calls */ + unsigned long alerted; /* we alerted the other end */ + unsigned long connected;/* how many calls were accepted */ + } call; +}; + enum gsm_auth_policy { GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */ GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized in DB */ @@ -494,6 +537,8 @@ struct gsm_network { unsigned int max_distance; /* TA values */ } handover; + struct gsmnet_stats stats; + /* layer 4 */ int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg); struct llist_head upqueue; -- cgit v1.2.3