From patchwork Wed Jun 4 16:30:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Willmann X-Patchwork-Id: 356030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ganesha.gnumonks.org (ganesha.gnumonks.org [IPv6:2001:780:45:1d:225:90ff:fe52:c662]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D24DE140094 for ; Thu, 5 Jun 2014 02:31:49 +1000 (EST) Received: from localhost ([127.0.0.1] helo=ganesha.gnumonks.org) by ganesha.gnumonks.org with esmtp (Exim 4.72) (envelope-from ) id 1WsE6E-0004IS-01; Wed, 04 Jun 2014 18:31:38 +0200 Received: from isonoe.totalueberwachung.de ([2a01:198:210:100::1]) by ganesha.gnumonks.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1WsE5y-0004IG-Vn; Wed, 04 Jun 2014 18:31:25 +0200 Received: from adrastea.totalueberwachung.de (24-134-59-157-dynip.superkabel.de [24.134.59.157]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by isonoe.totalueberwachung.de (Postfix) with ESMTPSA id 6A94E60058; Wed, 4 Jun 2014 18:31:22 +0200 (CEST) Received: by adrastea.totalueberwachung.de (Postfix, from userid 1000) id BAAB4220EB; Wed, 4 Jun 2014 18:31:19 +0200 (CEST) From: Daniel Willmann To: OpenBSC Mailing List , Osmocom net ML Subject: [osmo-pcu 1/1] Always exit and don't try to recover Date: Wed, 4 Jun 2014 18:30:59 +0200 Message-Id: <650b5f749cdd4f1fa49db282380a5ca8ebfb9818.1401899459.git.daniel@totalueberwachung.de> X-Mailer: git-send-email 1.8.4.2 X-Spam-Score: -0.0 (/) Cc: Daniel Willmann X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development of the OpenBSC GSM base station controller List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: openbsc-bounces@lists.osmocom.org Errors-To: openbsc-bounces@lists.osmocom.org From: Daniel Willmann The current code tries to recover from dropped connections and resets the pcu state so it can keep running. However, this never worked correctly which is why the -e option is used. This option exits the pcu as soon as the internal state needs to be reset. This patch removes this option and makes this behaviour default. Ticket: SYS#390 Sponsored-by: On-Waves ehf --- src/gprs_bssgp_pcu.cpp | 13 +------------ src/gprs_bssgp_pcu.h | 4 +--- src/openbts_sock.cpp | 4 +++- src/pcu_l1_if.cpp | 4 ++-- src/pcu_main.cpp | 3 +-- src/sysmo_sock.cpp | 8 ++------ 6 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index 133eb97..6c5d72c 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -533,13 +533,8 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts return &the_pcu; } -void gprs_bssgp_destroy_or_exit(void) +void gprs_bssgp_destroy(void) { - if (the_pcu.exit_on_destroy) { - LOGP(DBSSGP, LOGL_NOTICE, "Exiting on BSSGP destruction.\n"); - exit(0); - } - if (!bssgp_nsi) return; @@ -564,12 +559,6 @@ void gprs_bssgp_destroy_or_exit(void) bssgp_nsi = NULL; } -void gprs_bssgp_exit_on_destroy(void) -{ - LOGP(DBSSGP, LOGL_NOTICE, "Going to quit on BSSGP destruction\n"); - the_pcu.exit_on_destroy = 1; -} - struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void) { return the_pcu.bctx; diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h index aedcfc0..32b6728 100644 --- a/src/gprs_bssgp_pcu.h +++ b/src/gprs_bssgp_pcu.h @@ -57,7 +57,6 @@ struct gprs_bssgp_pcu { int bvc_sig_reset; int bvc_reset; int bvc_unblocked; - int exit_on_destroy; /** callbacks below */ @@ -75,8 +74,7 @@ struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts uint16_t nsvci, uint16_t bvci, uint16_t mcc, uint16_t mnc, uint16_t lac, uint16_t rac, uint16_t cell_id); -void gprs_bssgp_exit_on_destroy(void); -void gprs_bssgp_destroy_or_exit(void); +void gprs_bssgp_destroy(void); struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void); diff --git a/src/openbts_sock.cpp b/src/openbts_sock.cpp index a09f834..2d9cae4 100644 --- a/src/openbts_sock.cpp +++ b/src/openbts_sock.cpp @@ -179,8 +179,10 @@ int pcu_l1if_open() void pcu_l1if_close(void) { - gprs_bssgp_destroy_or_exit(); + gprs_bssgp_destroy(); /* FIXME: cleanup l1if */ talloc_free(l1fh->fl1h); + + exit(0); } diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index ce13b96..0cb79eb 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -324,8 +324,8 @@ bssgp_failed: for (ts = 0; ts < 8; ts++) bts->trx[trx].pdch[ts].free_resources(); } - gprs_bssgp_destroy_or_exit(); - return 0; + gprs_bssgp_destroy(); + exit(0); } LOGP(DL1IF, LOGL_INFO, "BTS available\n"); LOGP(DL1IF, LOGL_DEBUG, " mcc=%x\n", info_ind->mcc); diff --git a/src/pcu_main.cpp b/src/pcu_main.cpp index c0dac14..8631ad3 100644 --- a/src/pcu_main.cpp +++ b/src/pcu_main.cpp @@ -56,7 +56,6 @@ static void print_help() "provided by BTS\n" " -r --realtime PRIO Use SCHED_RR with the specified " "priority\n" - " -e --exit Exit the application on disconnect\n" ); } @@ -105,7 +104,7 @@ static void handle_options(int argc, char **argv) rt_prio = atoi(optarg); break; case 'e': - gprs_bssgp_exit_on_destroy(); + fprintf(stderr, "Warning: Option '-e' is deprecated!\n"); break; default: fprintf(stderr, "Unknown option '%c'\n", c); diff --git a/src/sysmo_sock.cpp b/src/sysmo_sock.cpp index 2e2d9d3..951653e 100644 --- a/src/sysmo_sock.cpp +++ b/src/sysmo_sock.cpp @@ -112,12 +112,8 @@ static void pcu_sock_close(struct pcu_sock_state *state, int lost) gprs_rlcmac_tbf::free_all(&bts->trx[trx]); } - gprs_bssgp_destroy_or_exit(); - - if (lost) { - state->timer.cb = pcu_sock_timeout; - osmo_timer_schedule(&state->timer, 5, 0); - } + gprs_bssgp_destroy(); + exit(0); } static int pcu_sock_read(struct osmo_fd *bfd)