ale-leehrtz has uploaded this change for review.
trunkdev: add module parameter permit_clock_master
So far, td_d_sync_tick() unconditionally hits BUG_ON() when a trunkdev
span becomes the DAHDI timing master, as normally the trunkdev must be
slaved to some other clock source to avoid re-entrancy of
_dahdi_receive().
A reference-independent node (SD-RI-PLL, see the related ticket) has no
other clock source: the DAHDI coretimer itself is disciplined from
userspace via DAHDI_SW_CLOCK_SET, based on the fill level of the
E1-over-IP FIFO. In that setup the trunkdev span is the timing master by
design.
Add a module parameter 'permit_clock_master' which allows this. It
defaults to false, so the existing behavior is unchanged.
Related: OS#7116
Change-Id: Iae232de00dde288b0e97ac287705aa5c8afcad4a
---
M drivers/dahdi/trunkdev/trunkdev.c
1 file changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/dahdi-linux refs/changes/35/44235/1
diff --git a/drivers/dahdi/trunkdev/trunkdev.c b/drivers/dahdi/trunkdev/trunkdev.c
index 6518109..f56a78a 100644
--- a/drivers/dahdi/trunkdev/trunkdev.c
+++ b/drivers/dahdi/trunkdev/trunkdev.c
@@ -1,5 +1,6 @@
/* DAHDI Virtual Trunk device driver.
* (C) 2022 by Harald Welte <laforge@osmocom.org>
+ * (C) 2026 by C. Alejandra Carreon-Jimenez <alejandra.carreon@ale-leehrtz.org>
* for Osmocom retronetworking project
*
*/
@@ -41,6 +42,16 @@
#define ALL_RY_ALARMS (DAHDI_ALARM_RED | DAHDI_ALARM_YELLOW | \
DAHDI_ALARM_LFA | DAHDI_ALARM_LMFA)
+/* Permit a trunkdev span to be the DAHDI timing master. Off by default, as
+ * normally the trunkdev must be slaved to some other clock source (see
+ * td_d_sync_tick()). A reference-independent node, where the DAHDI coretimer
+ * is disciplined from userspace via DAHDI_SW_CLOCK_SET, has no other clock
+ * source and needs this. */
+static bool permit_clock_master;
+module_param(permit_clock_master, bool, 0444);
+MODULE_PARM_DESC(permit_clock_master,
+ "Permit a trunkdev span to become DAHDI timing master (default: no)");
+
struct dahdi_trunkdev {
/* pointer to 'file' _if_ somebody has opened us via DAHDI_TRUNKDEV_OPEM */
struct file *file;
@@ -199,8 +210,9 @@
/* we must have some other clock source than this span, due to the way
* how DAHDI works internally: This very sync_tick function is called when the
* master device receives data via _dahdi_receive(). As we are calling
- * _dahdi_receive() via _span_demux_one_frame(), this would lead to re-entrancy */
- BUG_ON(is_master);
+ * _dahdi_receive() via _span_demux_one_frame(), this would lead to re-entrancy.
+ * Exception: reference-independent operation, see permit_clock_master. */
+ BUG_ON(is_master && !permit_clock_master);
/* trigger transmission + reception of E1 frames */
for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
To view, visit change 44235. To unsubscribe, or for help writing mail filters, visit settings.