[Pkg-voip-commits] r10378 - in /dahdi-linux/trunk/debian: changelog patches/fix-xpp-PRI-panic patches/series

tzafrir at alioth.debian.org tzafrir at alioth.debian.org
Tue Dec 31 21:42:33 UTC 2013


Author: tzafrir
Date: Tue Dec 31 21:42:32 2013
New Revision: 10378

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=10378
Log:
Patch fix-xpp-PRI-panic: fix a pending xpp issue.

Added:
    dahdi-linux/trunk/debian/patches/fix-xpp-PRI-panic
Modified:
    dahdi-linux/trunk/debian/changelog
    dahdi-linux/trunk/debian/patches/series

Modified: dahdi-linux/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/changelog?rev=10378&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/changelog	(original)
+++ dahdi-linux/trunk/debian/changelog	Tue Dec 31 21:42:32 2013
@@ -5,6 +5,7 @@
     - patch hotplug_mod_params: change default of module parameters.
   * Multiarch support. 
   * udev rules moved to package dahdi (in source package dahdi-tools).
+  * Patch fix-xpp-PRI-panic: fix a pending xpp issue.
 
  -- Tzafrir Cohen <tzafrir at debian.org>  Wed, 02 Oct 2013 20:57:50 +0300
 

Added: dahdi-linux/trunk/debian/patches/fix-xpp-PRI-panic
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/fix-xpp-PRI-panic?rev=10378&op=file
==============================================================================
--- dahdi-linux/trunk/debian/patches/fix-xpp-PRI-panic	(added)
+++ dahdi-linux/trunk/debian/patches/fix-xpp-PRI-panic	Tue Dec 31 21:42:32 2013
@@ -0,0 +1,174 @@
+From 09c0e2925f222316aae36d84b669dfc6a89ef17a Mon Sep 17 00:00:00 2001
+From: Oron Peled <oron.peled at xorcom.com>
+Date: Sun, 29 Dec 2013 13:43:14 -0500
+Subject: xpp: PRI panic fix:
+
+Fixes the xpp driver to handle changes of channels count in the span
+due to usage of the span-type attribute (span-types.conf) before the
+span is assigned.
+
+Patch is likely to get included upstream soon.
+---
+ drivers/dahdi/xpp/card_pri.c  |   14 ++++++++---
+ drivers/dahdi/xpp/xpp_dahdi.c |   52 +++++++++++++++++++++++++++--------------
+ drivers/dahdi/xpp/xpp_dahdi.h |    3 ++-
+ 3 files changed, 48 insertions(+), 21 deletions(-)
+
+diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c
+index 3630565..c586115 100644
+--- a/drivers/dahdi/xpp/card_pri.c
++++ b/drivers/dahdi/xpp/card_pri.c
+@@ -611,7 +611,7 @@ static int set_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
+ 	}
+ 	priv->pri_protocol = set_proto;
+ 	priv->is_cas = -1;
+-	phonedev->channels = pri_num_channels(set_proto);
++	phonedev_alloc_channels(xpd, pri_num_channels(set_proto));
+ 	phonedev->offhook_state = BITMASK(phonedev->channels);
+ 	CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
+ 	priv->deflaw = deflaw;
+@@ -1082,6 +1082,7 @@ static int pri_set_spantype(struct dahdi_span *span, enum spantypes spantype)
+ 	struct phonedev *phonedev = container_of(span, struct phonedev, span);
+ 	xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
+ 	enum pri_protocol set_proto = PRI_PROTO_0;
++	int ret;
+ 
+ 	XPD_INFO(xpd, "%s: %s\n", __func__, dahdi_spantype2str(spantype));
+ 	switch (spantype) {
+@@ -1099,7 +1100,13 @@ static int pri_set_spantype(struct dahdi_span *span, enum spantypes spantype)
+ 			__func__, dahdi_spantype2str(spantype));
+ 		return -EINVAL;
+ 	}
+-	return set_pri_proto(xpd, set_proto);
++	ret = set_pri_proto(xpd, set_proto);
++	if (ret < 0) {
++		XPD_ERR(xpd, "%s: set_pri_proto failed\n", __func__);
++		return ret;
++	}
++	dahdi_init_span(span);
++	return 0;
+ }
+ 
+ static int PRI_card_open(xpd_t *xpd, lineno_t pos)
+@@ -1929,7 +1936,8 @@ static void PRI_card_pcm_tospan(xpd_t *xpd, xpacket_t *pack)
+ 				dchan_state(xpd, 0);
+ 		}
+ 		if (IS_SET(physical_mask, i)) {
+-			r = XPD_CHAN(xpd, logical_chan)->readchunk;
++			struct dahdi_chan *chan = XPD_CHAN(xpd, logical_chan);
++			r = chan->readchunk;
+ 			// memset((u_char *)r, 0x5A, DAHDI_CHUNKSIZE);  // DEBUG
+ 			memcpy((u_char *)r, pcm, DAHDI_CHUNKSIZE);
+ 			pcm += DAHDI_CHUNKSIZE;
+diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c
+index ffcd6dd..9a5caba 100644
+--- a/drivers/dahdi/xpp/xpp_dahdi.c
++++ b/drivers/dahdi/xpp/xpp_dahdi.c
+@@ -458,29 +458,27 @@ static void phonedev_cleanup(xpd_t *xpd)
+ 	unsigned int x;
+ 
+ 	for (x = 0; x < phonedev->channels; x++) {
+-		if (phonedev->chans[x])
++		if (phonedev->chans[x]) {
+ 			KZFREE(phonedev->chans[x]);
+-		if (phonedev->ec[x])
++			phonedev->chans[x] = NULL;
++		}
++		if (phonedev->ec[x]) {
+ 			KZFREE(phonedev->ec[x]);
++			phonedev->ec[x] = NULL;
++		}
+ 	}
++	phonedev->channels = 0;
+ }
+ 
+-__must_check static int phonedev_init(xpd_t *xpd,
+-				      const xproto_table_t *proto_table,
+-				      int channels, xpp_line_t no_pcm)
++int phonedev_alloc_channels(xpd_t *xpd, int channels)
+ {
+ 	struct phonedev *phonedev = &PHONEDEV(xpd);
++	int old_channels = phonedev->channels;
+ 	unsigned int x;
+ 
+-	spin_lock_init(&phonedev->lock_recompute_pcm);
++	XPD_NOTICE(xpd, "Reallocating channels: %d -> %d\n", old_channels, channels);
++	phonedev_cleanup(xpd);
+ 	phonedev->channels = channels;
+-	phonedev->no_pcm = no_pcm;
+-	phonedev->offhook_state = 0x0;	/* ONHOOK */
+-	phonedev->phoneops = proto_table->phoneops;
+-	phonedev->digital_outputs = 0;
+-	phonedev->digital_inputs = 0;
+-	atomic_set(&phonedev->dahdi_registered, 0);
+-	atomic_set(&phonedev->open_counter, 0);
+ 	for (x = 0; x < phonedev->channels; x++) {
+ 		if (!
+ 		    (phonedev->chans[x] =
+@@ -501,6 +499,29 @@ err:
+ 	phonedev_cleanup(xpd);
+ 	return -ENOMEM;
+ }
++EXPORT_SYMBOL(phonedev_alloc_channels);
++
++__must_check static int phonedev_init(xpd_t *xpd,
++				      const xproto_table_t *proto_table,
++				      int channels, xpp_line_t no_pcm)
++{
++	struct phonedev *phonedev = &PHONEDEV(xpd);
++
++	spin_lock_init(&phonedev->lock_recompute_pcm);
++	phonedev->no_pcm = no_pcm;
++	phonedev->offhook_state = 0x0;	/* ONHOOK */
++	phonedev->phoneops = proto_table->phoneops;
++	phonedev->digital_outputs = 0;
++	phonedev->digital_inputs = 0;
++	atomic_set(&phonedev->dahdi_registered, 0);
++	atomic_set(&phonedev->open_counter, 0);
++	if (phonedev_alloc_channels(xpd, channels) < 0)
++		goto err;
++	return 0;
++err:
++	return -ENOMEM;
++}
++
+ 
+ /*
+  * xpd_alloc - Allocator for new XPD's
+@@ -1025,12 +1046,9 @@ EXPORT_SYMBOL(xpd_set_spanname);
+ static void xpd_init_span(xpd_t *xpd, unsigned offset, int cn)
+ {
+ 	struct dahdi_span *span;
+-	int i;
+ 
+ 	memset(&PHONEDEV(xpd).span, 0, sizeof(struct dahdi_span));
+-	for (i = 0; i < cn; i++)
+-		memset(XPD_CHAN(xpd, i), 0, sizeof(struct dahdi_chan));
+-
++	phonedev_alloc_channels(xpd, cn);
+ 	span = &PHONEDEV(xpd).span;
+ 	span->deflaw = DAHDI_LAW_MULAW;	/* card_* drivers may override */
+ 	span->channels = cn;
+diff --git a/drivers/dahdi/xpp/xpp_dahdi.h b/drivers/dahdi/xpp/xpp_dahdi.h
+index ab7df50..14d816e 100644
+--- a/drivers/dahdi/xpp/xpp_dahdi.h
++++ b/drivers/dahdi/xpp/xpp_dahdi.h
+@@ -38,6 +38,7 @@ xpd_t *xpd_alloc(xbus_t *xbus, int unit, int subunit, int subtype, int subunits,
+ 		 int channels);
+ void xpd_free(xpd_t *xpd);
+ void xpd_remove(xpd_t *xpd);
++int phonedev_alloc_channels(xpd_t *xpd, int channels);
+ void update_xpd_status(xpd_t *xpd, int alarm_flag);
+ const char *xpp_echocan_name(const struct dahdi_chan *chan);
+ int xpp_echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+@@ -64,6 +65,6 @@ void notify_rxsig(xpd_t *xpd, int pos, enum dahdi_rxsig rxsig);
+ extern struct proc_dir_entry *xpp_proc_toplevel;
+ #endif
+ 
+-#define	SPAN_REGISTERED(xpd)	atomic_read(&PHONEDEV(xpd).dahdi_registered)
++#define	SPAN_REGISTERED(xpd)	(atomic_read(&PHONEDEV(xpd).dahdi_registered) && test_bit(DAHDI_FLAGBIT_REGISTERED, &PHONEDEV(xpd).span.flags))
+ 
+ #endif /* XPP_DAHDI_H */
+-- 
+1.7.10.4
+

Modified: dahdi-linux/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/series?rev=10378&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/patches/series	(original)
+++ dahdi-linux/trunk/debian/patches/series	Tue Dec 31 21:42:32 2013
@@ -6,3 +6,4 @@
 tor2-request_firmware
 pciradio-request_firmware
 hotplug_mod_params
+fix-xpp-PRI-panic




More information about the Pkg-voip-commits mailing list