Change in osmo-bts[master]: phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Sep 21 16:56:21 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25529 )


Change subject: phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx
......................................................................

phy_link: Introduce bts_model_phy_link_close() and use it in bts-trx

This step is required while turning off the BTS without killing the
process. Right now only osmo-bts-trx supports this feature, so this
function is only available and used by osmo-bts-trx.
Later on, when the feature is support more generally, we can move call
to this function to common place like bts_shutdown_fsm or alike.

Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
---
M doc/manuals/chapters/architecture.adoc
M include/osmo-bts/phy_link.h
M src/osmo-bts-trx/trx_if.c
M src/osmo-bts-trx/trx_provision_fsm.c
4 files changed, 24 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/29/25529/1

diff --git a/doc/manuals/chapters/architecture.adoc b/doc/manuals/chapters/architecture.adoc
index a0e66cd..30eab7a 100644
--- a/doc/manuals/chapters/architecture.adoc
+++ b/doc/manuals/chapters/architecture.adoc
@@ -88,6 +88,7 @@
 | common | abis_open() | Start of the A-bis connection to BSC
 | common | phy_links_open() | Iterate over list of configured PHY links
 | bts-specific | bts_model_phy_link_open() | Open each of the configured PHY links
+| bts-specific | bts_model_phy_link_close() | Close each of the configured PHY links
 | common | write_pid_file() | Generate the pid file
 | common | osmo_daemonize() | Fork as daemon in background (if configured)
 | common | bts_main() | Run main loop until global variable quit >= 2
diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index 78fe6b9..ac38c28 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -174,6 +174,7 @@
 }
 
 int bts_model_phy_link_open(struct phy_link *plink);
+int bts_model_phy_link_close(struct phy_link *plink);
 
 #define LOGPPHL(plink, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_link_name(plink), ##args)
 #define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " fmt, phy_instance_name(pinst), ##args)
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 29a3663..b0965de 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -1340,6 +1340,25 @@
 	return -1;
 }
 
+/*! close the PHY link using TRX protocol */
+int bts_model_phy_link_close(struct phy_link *plink)
+{
+	bool clock_stopped = false;
+	struct phy_instance *pinst;
+	llist_for_each_entry(pinst, &plink->instances, list) {
+		if (!clock_stopped) {
+			clock_stopped = true;
+			trx_sched_clock_stopped(pinst->trx->bts);
+		}
+		if (pinst->u.osmotrx.hdl) {
+			trx_if_close(pinst->u.osmotrx.hdl);
+		}
+	}
+	trx_udp_close(&plink->u.osmotrx.trx_ofd_clk);
+	phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
+	return 0;
+}
+
 /*! determine if the TRX for given handle is powered up */
 int trx_if_powered(struct trx_l1h *l1h)
 {
diff --git a/src/osmo-bts-trx/trx_provision_fsm.c b/src/osmo-bts-trx/trx_provision_fsm.c
index 6041073..7f42b47 100644
--- a/src/osmo-bts-trx/trx_provision_fsm.c
+++ b/src/osmo-bts-trx/trx_provision_fsm.c
@@ -592,14 +592,13 @@
 	case TRX_PROV_EV_POWEROFF_CNF:
 		rc = (uint16_t)(intptr_t)data;
 		if (plink->state != PHY_LINK_SHUTDOWN) {
-			trx_sched_clock_stopped(pinst->trx->bts);
-			phy_link_state_set(plink, PHY_LINK_SHUTDOWN);
+			bts_model_phy_link_close(plink);
 
 			/* Notify TRX close on all TRX associated with this phy */
 			llist_for_each_entry(pinst, &plink->instances, list) {
 				bts_model_trx_close_cb(pinst->trx, rc);
 			}
-			trx_prov_fsm_state_chg(fi, TRX_PROV_ST_OPEN_POWEROFF);
+			trx_prov_fsm_state_chg(fi, TRX_PROV_ST_CLOSED);
 		}
 		break;
 	default:
@@ -661,7 +660,7 @@
 		.in_event_mask =
 			X(TRX_PROV_EV_POWEROFF_CNF),
 		.out_state_mask =
-			X(TRX_PROV_ST_OPEN_POWEROFF),
+			X(TRX_PROV_ST_CLOSED),
 		.name = "OPEN_WAIT_POWEROFF_CNF",
 		.action = st_open_wait_poweroff_cnf,
 	},

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25529
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I3253112700a31b85db82dc7ccadec8542bac745e
Gerrit-Change-Number: 25529
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210921/10d3edee/attachment.htm>


More information about the gerrit-log mailing list