[PATCH] osmocom-bb[master]: host/trxcon/trx_if.c: get rid of CLCK interface

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:33:10 UTC 2018


Review at  https://gerrit.osmocom.org/6741

host/trxcon/trx_if.c: get rid of CLCK interface

Local clock counter can be corrected using frame number values,
obtained from burst header on DATA interface.

Change-Id: I5a813e3dc1b960831343b8ecb80718291f20e80d
---
M src/host/trxcon/trx_if.c
M src/host/trxcon/trx_if.h
2 files changed, 4 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/41/6741/1

diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index f99a616..961f46c 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -127,59 +127,6 @@
 }
 
 /* ------------------------------------------------------------------------ */
-/* Clock (CLCK) interface handlers                                          */
-/* ------------------------------------------------------------------------ */
-/* Indications on the Master Clock Interface                                */
-/*                                                                          */
-/* The master clock interface is output only (from the radio).              */
-/* Messages are "indications".                                              */
-/*                                                                          */
-/* CLOCK gives the current value of the transceiver clock to be used by the */
-/* core. This message is sent whenever a transmission packet arrives that   */
-/* is too late or too early. The clock value is NOT the current transceiver */
-/* time. It is a time setting the core should use to give better packet     */
-/* arrival times.                                                           */
-/*                                                                          */
-/* IND CLOCK <totalFrames>                                                  */
-/* ------------------------------------------------------------------------ */
-
-static int trx_clck_read_cb(struct osmo_fd *ofd, unsigned int what)
-{
-	struct trx_instance *trx = (struct trx_instance *) ofd->data;
-	char buf[1500];
-	uint32_t fn;
-	int len;
-
-	len = recv(ofd->fd, buf, sizeof(buf) - 1, 0);
-	if (len <= 0)
-		return len;
-
-	/* Terminate received string */
-	buf[len] = '\0';
-
-	if (!!strncmp(buf, "IND CLOCK ", 10)) {
-		LOGP(DTRX, LOGL_ERROR,
-			"Unknown message on CLCK socket: %s\n", buf);
-		return 0;
-	}
-
-	sscanf(buf, "IND CLOCK %u", &fn);
-
-	LOGP(DTRX, LOGL_DEBUG, "Clock indication: fn=%u\n", fn);
-
-	if (fn >= 2715648) {
-		fn %= 2715648;
-		LOGP(DTRX, LOGL_ERROR, "Indicated clock's FN is not wrapping "
-			"correctly, correcting to fn=%u\n", fn);
-	}
-
-	/* Call the clck_ind callback */
-	sched_clck_handle(&trx->sched, fn);
-
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
 /* Control (CTRL) interface handlers                                        */
 /* ------------------------------------------------------------------------ */
 /* Commands on the Per-ARFCN Control Interface                              */
@@ -634,6 +581,10 @@
 	/* Poke scheduler */
 	sched_trx_handle_rx_burst(trx, tn, fn, bits, 148, rssi, toa);
 
+	/* Correct local clock counter */
+	if (fn % 51 == 0)
+		sched_clck_handle(&trx->sched, fn);
+
 	return 0;
 }
 
@@ -695,11 +646,6 @@
 	INIT_LLIST_HEAD(&trx_new->trx_ctrl_list);
 
 	/* Open sockets */
-	rc = trx_udp_open(trx_new, &trx_new->trx_ofd_clck, host,
-		port + 100, port + 0, trx_clck_read_cb);
-	if (rc < 0)
-		goto error;
-
 	rc = trx_udp_open(trx_new, &trx_new->trx_ofd_ctrl, host,
 		port + 101, port + 1, trx_ctrl_read_cb);
 	if (rc < 0)
@@ -756,7 +702,6 @@
 	trx_if_flush_ctrl(trx);
 
 	/* Close sockets */
-	trx_udp_close(&trx->trx_ofd_clck);
 	trx_udp_close(&trx->trx_ofd_ctrl);
 	trx_udp_close(&trx->trx_ofd_data);
 
diff --git a/src/host/trxcon/trx_if.h b/src/host/trxcon/trx_if.h
index 6367f45..7278bc1 100644
--- a/src/host/trxcon/trx_if.h
+++ b/src/host/trxcon/trx_if.h
@@ -19,7 +19,6 @@
 };
 
 struct trx_instance {
-	struct osmo_fd trx_ofd_clck;
 	struct osmo_fd trx_ofd_ctrl;
 	struct osmo_fd trx_ofd_data;
 

-- 
To view, visit https://gerrit.osmocom.org/6741
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a813e3dc1b960831343b8ecb80718291f20e80d
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list