[dahdi-commits] dahdi/linux.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Jul 11 14:14:24 CDT 2014


branch "master" has been updated
       via  a951dd5e32619d1e8f576f13e3449ee70a76ee70 (commit)
       via  8210fea5b3a6f59d93fd60eba84990512f0de5fb (commit)
      from  a1ff3cb0c0f3f4e65d734f4a71a090f5484505b4 (commit)

Summary of changes:
 drivers/dahdi/wcte13xp-base.c |   37 +++++++++++++++++++++++++++++++++----
 drivers/dahdi/wcte43x-base.c  |   37 +++++++++++++++++++++++++++++++++----
 2 files changed, 66 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit a951dd5e32619d1e8f576f13e3449ee70a76ee70
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Thu Jul 10 13:40:10 2014 -0500

    wcte43x: Do not reconfigure framer when span lineconfig is not changed.
    
    If dahdi_span_ops.spanconfig is called multiple times in a row (like when
    running dahdi_cfg; dahdi_cfg ) the tx signaling bits would go through a spurious
    state that some far side devices would respond to.
    
    Now, if the dahdi_span_ops.spanconfig callback is called, and the configuration
    matches the existing configuration, we will not touch the framer.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/drivers/dahdi/wcte43x-base.c b/drivers/dahdi/wcte43x-base.c
index ab9ecb0..aebd1df 100644
--- a/drivers/dahdi/wcte43x-base.c
+++ b/drivers/dahdi/wcte43x-base.c
@@ -110,6 +110,7 @@ struct t43x_span {
 	bool debounce;
 	int syncpos;
 	int sync;
+	u32 lineconfig_fingerprint;
 };
 
 struct t43x_clksrc_work {
@@ -2377,6 +2378,30 @@ static void t43x_chan_set_sigcap(struct dahdi_span *span, int x)
 	}
 }
 
+static bool t43x_lineconfig_changed(struct t43x_span *ts,
+				    const struct dahdi_lineconfig *lc)
+{
+	unsigned long flags;
+	bool result;
+	u32 crc = crc32(~0, lc, sizeof(*lc));
+
+	spin_lock_irqsave(&ts->owner->reglock, flags);
+	result = (crc != ts->lineconfig_fingerprint);
+	spin_unlock_irqrestore(&ts->owner->reglock, flags);
+	return result;
+}
+
+static void t43x_save_lineconfig(struct t43x_span *ts,
+				 const struct dahdi_lineconfig *lc)
+{
+	unsigned long flags;
+	u32 crc = crc32(~0, lc, sizeof(*lc));
+
+	spin_lock_irqsave(&ts->owner->reglock, flags);
+	ts->lineconfig_fingerprint = crc;
+	spin_unlock_irqrestore(&ts->owner->reglock, flags);
+}
+
 static int
 t43x_spanconfig(struct file *file, struct dahdi_span *span,
 		 struct dahdi_lineconfig *lc)
@@ -2384,6 +2409,7 @@ t43x_spanconfig(struct file *file, struct dahdi_span *span,
 	struct t43x_span *ts = container_of(span, struct t43x_span, span);
 	struct t43x *wc = ts->owner;
 	int i;
+	int res = 0;
 
 	if (debug)
 		dev_info(&wc->xb.pdev->dev, "%s\n", __func__);
@@ -2420,10 +2446,13 @@ t43x_spanconfig(struct file *file, struct dahdi_span *span,
 		t43x_chan_set_sigcap(span, i);
 
 	/* If already running, apply changes immediately */
-	if (test_bit(DAHDI_FLAGBIT_RUNNING, &span->flags))
-		return t43x_startup(file, span);
-
-	return 0;
+	if (test_bit(DAHDI_FLAGBIT_RUNNING, &span->flags) &&
+	    t43x_lineconfig_changed(ts, lc)) {
+		res = t43x_startup(file, span);
+		if (!res)
+			t43x_save_lineconfig(ts, lc);
+	}
+	return res;
 }
 
 /*

commit 8210fea5b3a6f59d93fd60eba84990512f0de5fb
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Thu Jul 10 13:26:14 2014 -0500

    wcte13xp: Do not reconfigure framer when span lineconfig is not changed.
    
    If dahdi_span_ops.spanconfig is called multiple times in a row (like when
    running dahdi_cfg; dahdi_cfg ) the tx signaling bits would go through a spurious
    state that some far side devices would respond to.
    
    Now, if the dahdi_span_ops.spanconfig callback is called, and the configuration
    matches the existing configuration, we will not touch the framer.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>
    Signed-off-by: Russ Meyerriecks <rmeyerriecks at digium.com>

diff --git a/drivers/dahdi/wcte13xp-base.c b/drivers/dahdi/wcte13xp-base.c
index d5ec958..4fe954a 100644
--- a/drivers/dahdi/wcte13xp-base.c
+++ b/drivers/dahdi/wcte13xp-base.c
@@ -110,6 +110,7 @@ struct t13x {
 	struct vpm450m *vpm;
 	struct mutex lock;
 	struct wcxb xb;
+	u32    lineconfig_fingerprint;
 };
 
 static void te13x_handle_transmit(struct wcxb *xb, void *vfp);
@@ -1675,12 +1676,37 @@ static void t13x_chan_set_sigcap(struct dahdi_span *span, int x)
 	}
 }
 
+static bool t13x_lineconfig_changed(struct t13x *wc,
+				    const struct dahdi_lineconfig *lc)
+{
+	unsigned long flags;
+	bool result;
+	u32 crc = crc32(~0, lc, sizeof(*lc));
+
+	spin_lock_irqsave(&wc->reglock, flags);
+	result = (crc != wc->lineconfig_fingerprint);
+	spin_unlock_irqrestore(&wc->reglock, flags);
+	return result;
+}
+
+static void t13x_save_lineconfig(struct t13x *wc,
+				 const struct dahdi_lineconfig *lc)
+{
+	unsigned long flags;
+	u32 crc = crc32(~0, lc, sizeof(*lc));
+
+	spin_lock_irqsave(&wc->reglock, flags);
+	wc->lineconfig_fingerprint = crc;
+	spin_unlock_irqrestore(&wc->reglock, flags);
+}
+
 static int
 t13x_spanconfig(struct file *file, struct dahdi_span *span,
 		 struct dahdi_lineconfig *lc)
 {
 	struct t13x *wc = container_of(span, struct t13x, span);
 	int i;
+	int res = 0;
 
 	if (file->f_flags & O_NONBLOCK)
 		return -EAGAIN;
@@ -1693,10 +1719,13 @@ t13x_spanconfig(struct file *file, struct dahdi_span *span,
 		t13x_chan_set_sigcap(span, i);
 
 	/* If already running, apply changes immediately */
-	if (test_bit(DAHDI_FLAGBIT_RUNNING, &span->flags))
-		return t13x_startup(file, span);
-
-	return 0;
+	if (test_bit(DAHDI_FLAGBIT_RUNNING, &span->flags) &&
+	    t13x_lineconfig_changed(wc, lc)) {
+		res = t13x_startup(file, span);
+		if (!res)
+			t13x_save_lineconfig(wc, lc);
+	}
+	return res;
 }
 
 /**

-----------------------------------------------------------------------


-- 
dahdi/linux.git



More information about the dahdi-commits mailing list