Change in ...osmo-trx[master]: Rename and move STOP signal from Transceiver to main

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 6 19:44:04 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-trx/+/14366 )

Change subject: Rename and move STOP signal from Transceiver to main
......................................................................

Rename and move STOP signal from Transceiver to main

The callback actually belongs there, since it's the code/thread in main the one
actually in charge of stopping everything. It simplifies current code,
and more important, allows for new clients of this signal to use it.
This callback will also be used in forthcoming commits by code
controlling rate_ctr thresholds to stop the process if the VTY
configured threshold is used.

Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
---
M CommonLibs/osmo_signal.h
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
M Transceiver52M/osmo-trx.cpp
4 files changed, 9 insertions(+), 24 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/CommonLibs/osmo_signal.h b/CommonLibs/osmo_signal.h
index 7299171..6ee1bf9 100644
--- a/CommonLibs/osmo_signal.h
+++ b/CommonLibs/osmo_signal.h
@@ -26,13 +26,13 @@
 
 /* Signalling subsystems */
 enum signal_subsystems {
-	SS_TRANSC,
+	SS_MAIN,
 	SS_DEVICE,
 };
 
-/* SS_TRANSC signals */
-enum SS_TRANSC {
-	S_TRANSC_STOP_REQUIRED, /* Transceiver fatal error, it should be stopped */
+/* SS_MAIN signals */
+enum SS_MAIN {
+	S_MAIN_STOP_REQUIRED, /* TRX fatal error, it should be stopped */
 };
 
 /* SS_DEVICE signals */
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 54b9ddd..9c55d02 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -119,7 +119,7 @@
   : mBasePort(wBasePort), mLocalAddr(TRXAddress), mRemoteAddr(GSMcoreAddress),
     mClockSocket(TRXAddress, wBasePort, GSMcoreAddress, wBasePort + 100),
     mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
-    rssiOffset(wRssiOffset), sig_cbfn(NULL),
+    rssiOffset(wRssiOffset),
     mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false), mForceClockInterface(false),
     mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0),
     mWriteBurstToDiskMask(0)
@@ -225,17 +225,6 @@
   return true;
 }
 
-void Transceiver::setSignalHandler(osmo_signal_cbfn cbfn)
-{
-  if (this->sig_cbfn)
-    osmo_signal_unregister_handler(SS_TRANSC, this->sig_cbfn, NULL);
-
-  if (cbfn) {
-    this->sig_cbfn = cbfn;
-    osmo_signal_register_handler(SS_TRANSC, this->sig_cbfn, NULL);
-  }
-}
-
 /*
  * Start the transceiver
  *
@@ -910,7 +899,7 @@
     usleep(100000);
   } else if (rc < 0) {
     LOG(FATAL) << "radio Interface receive failed, requesting stop.";
-    osmo_signal_dispatch(SS_TRANSC, S_TRANSC_STOP_REQUIRED, this);
+    osmo_signal_dispatch(SS_MAIN, S_MAIN_STOP_REQUIRED, NULL);
   } else if (mForceClockInterface || mTransmitDeadlineClock > mLastClockUpdateTime + GSM::Time(216,0)) {
     mForceClockInterface = false;
     writeClockInterface();
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 432e3b4..4614efe 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -130,8 +130,6 @@
   /** accessor for number of channels */
   size_t numChans() const { return mChans; };
 
-  void setSignalHandler(osmo_signal_cbfn cbfn);
-
   /** Codes for channel combinations */
   typedef enum {
     FILL,               ///< Channel is transmitted, but unused
@@ -181,8 +179,6 @@
 
   double rssiOffset;                      ///< RSSI to dBm conversion offset
 
-  osmo_signal_cbfn *sig_cbfn;              ///< Registered Signal Handler to announce events.
-
   /** modulate and add a burst to the transmit queue */
   void addRadioVector(size_t chan, BitVector &bits,
                       int RSSI, GSM::Time &wTime);
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index a79c26e..05489bd 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -123,7 +123,7 @@
 		     void *handler_data, void *signal_data)
 {
 	switch (signal) {
-	case S_TRANSC_STOP_REQUIRED:
+	case S_MAIN_STOP_REQUIRED:
 		gshutdown = true;
                 break;
 	default:
@@ -152,8 +152,6 @@
 		return -1;
 	}
 
-        transceiver->setSignalHandler(transc_sig_cb);
-
 	for (size_t i = 0; i < trx->cfg.num_chans; i++) {
 		fifo = radio->receiveFIFO(i);
 		if (fifo && transceiver->receiveFIFO(fifo, i))
@@ -627,6 +625,7 @@
 			return EXIT_FAILURE;
 	}
 
+	osmo_signal_register_handler(SS_MAIN, transc_sig_cb, NULL);
 	trx_rate_ctr_init(tall_trx_ctx, g_trx_ctx);
 
 	srandom(time(NULL));
@@ -641,5 +640,6 @@
 
 	osmo_fd_unregister(&signal_ofd);
 	osmo_fd_close(&signal_ofd);
+	osmo_signal_unregister_handler(SS_MAIN, transc_sig_cb, NULL);
 	return 0;
 }

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

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
Gerrit-Change-Number: 14366
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190606/56349f86/attachment.html>


More information about the gerrit-log mailing list