From 113fb419eca550a187253ac346bf20538bab4b25 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 14 Jan 2021 13:36:02 +0100 Subject: [PATCH] Move ns_dialect field from BTS to PCU Change-Id: Iffb22b776b91f93d6d2a7ccfa47deeecc22c33f0 --- src/bts.cpp | 1 - src/bts.h | 3 --- src/gprs_bssgp_pcu.cpp | 6 +++--- src/gprs_pcu.c | 1 + src/gprs_pcu.h | 1 + src/pcu_vty.c | 8 +++----- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/bts.cpp b/src/bts.cpp index c2b86964..4a9910f1 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -201,7 +201,6 @@ static void bts_init(struct gprs_rlcmac_bts *bts, BTS* bts_obj) bts->n3103 = 4; bts->n3105 = 8; bts->si13_is_set = false; - bts->ns_dialect = NS2_DIALECT_IPACCESS; /* TODO: increase them when CRBB decoding is implemented */ bts->ws_base = 64; diff --git a/src/bts.h b/src/bts.h index 040386eb..29020746 100644 --- a/src/bts.h +++ b/src/bts.h @@ -120,9 +120,6 @@ struct gprs_rlcmac_bts { */ struct BTS *bts; - /* Are we talking Gb with IP-SNS (true) or classic Gb? */ - enum gprs_ns2_dialect ns_dialect; - /* Packet Application Information (3GPP TS 44.060 11.2.47, usually ETWS primary message). We don't need to store * more than one message, because they get sent so rarely. */ struct msgb *app_info; diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index 0db6a51f..89edd2b9 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -984,7 +984,7 @@ static int ns_create_nsvc(struct gprs_rlcmac_bts *bts, bts->nse = gprs_ns2_nse_by_nsei(the_pcu->nsi, nsei); if (!bts->nse) bts->nse = gprs_ns2_create_nse(the_pcu->nsi, nsei, - GPRS_NS2_LL_UDP, bts->ns_dialect); + GPRS_NS2_LL_UDP, the_pcu->vty.ns_dialect); if (!bts->nse) { LOGP(DBSSGP, LOGL_ERROR, "Failed to create NSE\n"); @@ -997,7 +997,7 @@ static int ns_create_nsvc(struct gprs_rlcmac_bts *bts, continue; /* FIXME: for SNS we just use the first successful NS-VC instead of all for the initial connect */ - if (bts->ns_dialect == NS2_DIALECT_SNS) { + if (the_pcu->vty.ns_dialect == NS2_DIALECT_SNS) { rc = gprs_ns2_sns_add_endpoint(bts->nse, &remote[i]); if (!rc) return rc; @@ -1066,7 +1066,7 @@ int gprs_ns_config(struct gprs_rlcmac_bts *bts, uint16_t nsei, gprs_ns2_free_nses(the_pcu->nsi); gprs_ns2_free_binds(the_pcu->nsi); rc = ns_create_nsvc(bts, nsei, local, remote, nsvci, valid); - } else if (bts->ns_dialect == NS2_DIALECT_SNS) { + } else if (the_pcu->vty.ns_dialect == NS2_DIALECT_SNS) { /* SNS: check if the initial nsvc is the same, if not recreate it */ const struct osmo_sockaddr *initial = gprs_ns2_nse_sns_remote(bts->nse); for (unsigned int i = 0; i < PCU_IF_NUM_NSVC; i++) { diff --git a/src/gprs_pcu.c b/src/gprs_pcu.c index cfe88960..01ead33a 100644 --- a/src/gprs_pcu.c +++ b/src/gprs_pcu.c @@ -89,6 +89,7 @@ struct gprs_pcu *gprs_pcu_alloc(void *ctx) pcu->vty.mcs_lqual_ranges[7].high = 24; pcu->vty.mcs_lqual_ranges[8].low = 23; pcu->vty.mcs_lqual_ranges[8].high = 256; + pcu->vty.ns_dialect = NS2_DIALECT_IPACCESS; pcu->T_defs = T_defs_pcu; osmo_tdefs_reset(pcu->T_defs); diff --git a/src/gprs_pcu.h b/src/gprs_pcu.h index 916169e2..ff73cc98 100644 --- a/src/gprs_pcu.h +++ b/src/gprs_pcu.h @@ -88,6 +88,7 @@ struct gprs_pcu { /* Link quality range for each UL (M)CS. Below or above, next/prev (M)CS is selected. */ struct {int16_t low; int16_t high; } cs_lqual_ranges[MAX_GPRS_CS]; struct {int16_t low; int16_t high; } mcs_lqual_ranges[MAX_EDGE_MCS]; + enum gprs_ns2_dialect ns_dialect; /* Are we talking Gb with IP-SNS (true) or classic Gb? */ } vty; struct gsmtap_inst *gsmtap; diff --git a/src/pcu_vty.c b/src/pcu_vty.c index 3abfba79..b0c941d9 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -243,7 +243,7 @@ static int config_write_pcu(struct vty *vty) } } - if (bts->ns_dialect == NS2_DIALECT_SNS) + if (the_pcu->vty.ns_dialect == NS2_DIALECT_SNS) vty_out(vty, " gb-dialect ip-sns%s", VTY_NEWLINE); else vty_out(vty, " gb-dialect classic%s", VTY_NEWLINE); @@ -1067,12 +1067,10 @@ DEFUN_USRATTR(cfg_pcu_gb_dialect, "Classic Gb interface with NS-{RESET,BLOCK,UNBLOCK} and static configuration\n" "Modern Gb interface with IP-SNS (Sub Network Service) and dynamic configuration\n") { - struct gprs_rlcmac_bts *bts = bts_main_data(); - if (!strcmp(argv[0], "ip-sns")) { - bts->ns_dialect = NS2_DIALECT_SNS; + the_pcu->vty.ns_dialect = NS2_DIALECT_SNS; } else { - bts->ns_dialect = NS2_DIALECT_IPACCESS; + the_pcu->vty.ns_dialect = NS2_DIALECT_IPACCESS; } return CMD_SUCCESS;