Commit Graph

162 Commits

Author SHA1 Message Date
Shaun Ruffell
e025a651fb dahdi: Check for master in DAHDI_STARTUP / resolves MeetMe regression.
There were a couple of reports that MeetMe conferences were not
working in 2.5.0.1 and that downgrading to 2.4.1.2 resolved the
issue. This could occur if there were no analog spans in a system,
and all the digital spans were out of alarm before DAHDI_STARTUP
ioctl was called by dahdi_cfg. If the spans were *not* out of alarm,
they would be marked master when the span changes it's alarm state.

This would result in a condition where no spans were marked as the
"master" and so the core timer was handling conferencing. The core
timer runs by default at 4ms and most board drivers run at 1ms
intervals, but a channel currently only buffers up 2ms of data when
conferenced. Therefore, 2ms of audio from a board was continuously
dropped from the conference every 4ms by default.

This fixes a regression first introduced in 2.5.0 which was
specifically added in revision r9611 "dahdi: Do not locate new
master in interrupt context."

Internal-reference-ID: DAHDI-894
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Tested-by: Dennis Martinez <dmartinez@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10205 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-23 20:18:36 +00:00
Shaun Ruffell
d4ee448c7e dahdi: Decrease the initial coretimer delay to 4ms from 1 second.
DAHDI currently waits a second before checking if a board driver is
calling dahdi_receive and switching to internal timing. Some versions of
Asterisk (I was looking at 1.4.42 when writing this) only wait 300ms for
a timer to expire when first starting and verifying that DAHDI is
properly configured. This can result in a

"ERROR[27673] asterisk.c: Asterisk has detected a problem with your DAHDI
configuration and will shutdown for your protection. You have options:"

message if asterisk is started soon after loading DAHDI.

This change sets the inital polling interval to the same as that used
during normal coretimer operation, 4ms. The interval will still be
slowed to 1 second if a board driver starts calling dahdi_receive().

DAHDI-892.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10200 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-13 18:28:58 +00:00
Shaun Ruffell
00764f705c dahdi: Drivers that do not support hwec should not report hwec is available.
When attaching software echocans to a channel, if there is a hardware
echocan available always give preference to them.

Revision 9995 "dahdi: Always attach hwec to a channel if available" had
an error where if a driver did not even support an option of hardware
echocan, dahdi-base would take that to mean there always was a hardware
echocan available on the channel.

DAHLIN-246

Reported-by: Michael L. Young
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10070 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-07-21 16:26:31 +00:00
Tzafrir Cohen
b2f71aa2b8 get registration_mutex at free_pseudo
Make sure that the call to dahdi_chan_unreg() in free_pseudo() is
protected by the registration_mutex, like the other calls to that
function.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Oron Peled <oron.peled@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10056 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-07-20 16:50:14 +00:00
Shaun Ruffell
80e9aa8098 dahdi: Add dynamic dahdi parameter hwec_overrides_swec.
If set to true (default) a HWEC, if available on the channel, takes
priority over any software echocan configured in /etc/dahdi/system.conf.
This has historically been the default behavior in all released versions
of DAHDI that support module echocans.

Otherwise, hwec_overrides_swec is set to false, HWEC is chosen only via
the "echocanceller=hwec" directive.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-By: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10036 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-07-12 18:08:14 +00:00
Shaun Ruffell
355ab14d47 dahdi: Always attach hwec to a channel if available.
In previous releases of DAHDI if dahdi_cfg attached a software echocan
to a channel and a hardware echocan was available, the hardware echocan
would be used instead of the software echocan.

Since the 2.4 branch was created a new feature was merged into
dahdi-linux where it was possible to mix software echocan and hardware
echocan on a channel. This required using "hwec" as the echocan in the
/etc/dahdi/system.conf file so that what was specified in the
configuration file is what was actually used.

This has resulted in users upgrading to the trunk of dahdi without
updating their /etc/dahdi/system.conf file and just suddenly not using
any hardware echocans any longer.

The capability to mix software and hardware echocans on a span will be
revisted when running dahdi_cfg on any preexisting configuration files
doesn't just silently turn off hardware echocan.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9995 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-28 21:29:20 +00:00
Shaun Ruffell
a36bd8863e Revert "dahdi: Group dahdi timers into "rates" for improved CPU utilization."
This reverts commit r9891 and is part of two commits to revert all the
timer changes.

Grouping the timer into rates did not allow a timers rate to be changed
after another thread is already blocked on the poll call

The problem that was reported was if a sip call was made to a DAHDI
channel and the sip call was disconnected before answer, the DAHDI
channel would never stop rining.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9991 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-28 15:55:48 +00:00
Shaun Ruffell
6d4a47a6ef Revert "dahdi: If a timer is not configured then we should block indefinitely."
This reverts commit r9937 and is part of two commits to revert all the timer
changes.

Grouping the timer into rates did not allow a timers rate to be changed after
another thread is already blocked on the poll call

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9990 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-28 15:55:44 +00:00
Shaun Ruffell
759f0c07f0 dahdi: Do not allow 'hwec' to be attached to channels that do not have one.
This defines a NULL value for the name of an echocan as invalid. This
will allow dahdi_genconf to probe for the presence of a hardware echocan
on a channel by trying to attach one. If there is not a hardware echocan
available DAHDI_ATTACH_ECHOCAN ioctl will return -EINVAL if 'hwec' was
specified as the name of the echo canceler now.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9943 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:49 +00:00
Shaun Ruffell
93a7adfb9f dahdi: Provide notification when preechocan buffer is created and destroyed.
Not quite ideal, but this seems to be the most straightforward way to
know when someone is trying to monitor the preec stream on a channel.
This callback allows the board driver providing the span an opportunity
to setup the hardware preecho monitoring as needed.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9942 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:44 +00:00
Shaun Ruffell
dd33d6c357 dahdi: Update the dahdi_ec_chunk interface to support preec streams.
dahdi_ec_chunk is the function that saves the received audio and places
a signed linear copy of it in the pre echocanceled buffer on the
channel.  By splitting the input and output of this function into two
parameters, a driver that can provide separate pre and post ec streams
can pass them independently to DAHDI, without worrying about DAHDI
overwriting a stream that may have already been echocanceled by the
hardware.

Previously, the dahdi_ec_chunk interface took a received audio buffer
and overwrote it after canceling the echo.  Now the input and output
from the function are broken up in order to support hardware echocans
that have a different preechocan stream.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9941 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:40 +00:00
Shaun Ruffell
76df5ab26b dahdi: Allow dahdi_span_ops.[chan|span]config and startup to block.
This change ensures that the dahdi_span_ops callbacks are not called
with any spinlocks held, and that the module is pinned in memory, and
also passes the struct file * pointer to the callbacks.

Passing the file pointer to the callbacks allows the board drivers to
check any flags on the file descriptor used to configure the
span/channel. The intent here is to allow dahdi_config to open the
/dev/dahdi/ctl file in a non-blocking mode in case there is a lengthy
processes that needs to happen as part of configuration.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9940 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:34 +00:00
Shaun Ruffell
09eb417ec4 dahdi: Do not release the echocan under lock.
This allows any echocan cleanup to block if necessary. Especially useful
for hardware echocans that may need to wait for hardware to complete the
cleanup process.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9939 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:29 +00:00
Shaun Ruffell
ca9d290af1 dahdi: If a timer is not configured then we should block indefinitely.
Some older Asterisk versions do not handle well the error message when poll is
called on an unconfigured channel. The result would be constant

__ast_read: No/unknown event '0' on timer for 'DAHDI/1-1'?

messages from Asterisk.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9937 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:20 +00:00
Shaun Ruffell
20c8b9b597 dahdi: Make tone zone registration messages debug only.
This duplicates information that is already in the
/etc/dahdi/system.conf file and should normally only be necessary for
the user when debugging problems.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9936 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:15 +00:00
Shaun Ruffell
e8221c04cf dahdi: Propagate shutdown returncode to user space.
This change fixes a condition where 'dahdi_cfg -s' would always return
success regardless of whether a board driver was able to complete the
shutdown. Only impacts board drivers that implemented the shutdown span
callback.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9935 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:10 +00:00
Shaun Ruffell
cb67046067 dahdi: Fix compilation on Linux 2.6.26 w/CONFIG_DAHDI_NET.
The hdlc_stats function was removed from the mainline kernel in commit
198191c4a7ce4daba379608fb38b9bc5a4eedc61 [1] which was first released in
linux 2.6.27.

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=198191c4a7ce4

(closes issue #19354)
Reported by: biohumanoid

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9934 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:01:05 +00:00
Shaun Ruffell
86519d1211 Remove unused variables.
gcc-4.6 now warns about variables that are set but never used. Clean up
unused variables everywhere except the oct612x subdirectory.

The oct612x should go in a separate patch in case that needs to be
pulled out into a separate project again.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9929 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-06-02 20:00:36 +00:00
Shaun Ruffell
9c1880d31a dahdi: Enable DTMF A,B,C, and D digits.
This appears to be an old regression from zaptel r4063 [1] that would
prevent DAHDI from generating the A,B,C, and D digits due to
unintentional drop through on a case statement.

[1] http://svn.asterisk.org/view/zaptel?view=revision&revision=4063

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9912 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-25 14:22:39 +00:00
Kinsey Moore
fcd4db20d1 dahdi: Bug fix for enabling buffer events
Introduced in rev 9905, this bug could cause buffer events to become
disabled if the kernel was unable to access userland data.


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9907 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-15 18:42:16 +00:00
Kinsey Moore
e591241187 dahdi: Add capability to generate events on buffer underruns and overruns
Add BUFFEVENTS and individual buffer event channel flags so that DAHDI can
notify userspace processes when it is dropping data.  This can be useful when
trouble shooting fax problems since DAHDI currently silently discards data
becasuse of scheduling latency.  With this change, Asterisk could log an event
as opposed to just leaving it up to the tone detectors to figure out there was
some unexpected phase shift.

Acked-by: Shaun Ruffell <sruffell@digium.com>
(original patch by Matt Fredrickson)


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9905 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-15 16:16:19 +00:00
Shaun Ruffell
3ae1b03082 dahdi: Group dahdi timers into "rates" for improved CPU utilization.
Most of the timers added to the kernel will be configured to fire at the
same rate. This allows one "wake_up" from interrupt context to wake up
all the waiters.  On one test system, I saw about a ~10% improvement in
CPU utilization when 10,000 timers were opened.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9891 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-04 16:26:05 +00:00
Shaun Ruffell
f8af2b7a5c dahdi: Add in-hardirq versions of the dahdi_receive/transmit/ec_span.
Since cli/sti are expensive instructions, if the board drivers are
calling receive/transmit/ec_span from interrupt context all local
interrupts do not need to be disabled. The board drivers all still use
the normal dahdi_receive and dahdi_transmit. _dahdi_receive and
_dahdi_transmit are the "in-hardirq" versions of those functions.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9884 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-04 16:25:23 +00:00
Shaun Ruffell
6d3a7e6f71 dahdi: Do not enable interrupts before processing entire span.
Fixes regression introduced in r9603 where if a channel was "dacs" with
another interrupts would be reenabled prematurely.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9878 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-04 16:24:39 +00:00
Tzafrir Cohen
1c42df4cd1 core timer: don't hang when the clock goes back.
If the clock shifts back, don't hang in a loop of running
process_masterspan from the timer interrupt forever.

Fixes a regression of r9407.

(closes issue #19035)
Reported by: tzafrir

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

After talking with Tzafrir on IRC, I combined the check if your far ahead
with the check if you're behind and added a '\n' at the end of the
existing "detected time shift" message.  That is why this patch is
different than what is posted on issue #19035.

Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Michael Spiceland <mspiceland@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9876 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-04-04 16:24:26 +00:00
Shaun Ruffell
d43e2d3ade dahdi: Do not rebuild dahdi-base.c when only updating the version.
This moves the version string into dahdi-version.c that is then linked into
dahdi-base.c and dahdi-sysfs.c.  This speeds builds on slow computers since
dahdi-base.c and dahdi-sysfs.c does not need to be rebuilt if only the version
string is changing.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9777 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-02-28 14:19:09 +00:00
Oron Peled
0f25d96af3 replace old proc interface by modern seq_file
Switch to using the newer seq_file interface for procfs. Fixes a
race when you read the "file" while its size increases (e.g. the span
enters an alarm state).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

(closes issue #18760)
Patches:
      0001-DAHDI-linux-trunk-replace-old-proc-interface-by-mode.patch uploaded by tzafrir (license 46)

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9770 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-02-20 23:13:20 +00:00
Shaun Ruffell
4389604ffd dahdi: Analog spans do not have to be marked RUNNING to become master.
Fixes a regression introduced in r9611. Analog spans would never become
the master since the SPANSTART ioctl is not typically called on them,
and therefore they were never marked RUNNING.  The result could be audio
problems.

I'm marking this as related to issue 13205 since it's generally all
related to how should the drivers select which span is the master.  I
also mark as related to issue 16165 because the problems experienced are
a result of the same fundamental issue.

(issue #13205)(issue #16165)

Reported-and-Tested-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9729 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-02-02 19:28:40 +00:00
Jaco Kroon
e7d9a67f72 dahdi: Experimentally remove dependency on the Big Kernel Lock.
With the release of Linux 2.6.37, the Big Kernel Lock is now a compile
time option.  This change adds a mutex around the one place in the code
that we already knew was dependent on the lock_kernel/unlock_kernel
calls for serialization and drops the other calls to
lock_kernel/unlock_kernel if CONFIG_BKL is not defined.

This is *mostly* the dahdi-no-bkl.patch with a few minor whitespace
changes, the global_dialparmslock made static, and a warning added to
let people know they are running an experimental configuration.

(issue #18604)
Reported by: jkroon
Patches:
      dahdi-no-bkl.patch uploaded by jkroon (license 714)

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9721 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-31 15:53:31 +00:00
Shaun Ruffell
8b68d2dd1b dahdi: Constify the data parameter to __buf_push.
Just clarifying a parameter that is never updated.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9644 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-18 20:25:35 +00:00
Shaun Ruffell
3cee9adfbb dahdi: Trivial. Move process_masterspan description.
Move the description of the master span processing to above the
process_masterspan function.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9643 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-18 20:25:31 +00:00
Shaun Ruffell
f2b7303161 dahdi: Fix recent regression with native bridging.
This fixes a regression introduced in r9603.  That commit removed
DAHDI_CONF_DIGITALMON handling (which is used to natively bridge two
channels that cannot be crossed in the board driver / hardware) since I
mistakenly thought that it was only part of the DACS handling.  The
symptom of the regression is muted audio when Asterisk tries to natively
bridge two channels.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9642 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-18 20:25:26 +00:00
Shaun Ruffell
4fea8415d6 dahdi: Permit open pseudo channels before spans are registered.
Move pseudo channel numbers up into a high range so that their presence
does not interfere with assigning channel numbers for the channels
implemented on spans. Otherwise, if a pseudo channel was opened up
before an expected span was registered, all the channel numbers in the
newly registered span would be bumped up one. This does limit the number
of real channels that a single system may have registered to 32K (but in
dahdi-linux 2.4.0 and below you were limited to 1024 channels anyway,
both real and pseudo).

Also, the string name of the Pseudo channel is now based off the
number of Pseudo channels and not the total number of channels.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9637 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-17 17:17:52 +00:00
Tzafrir Cohen
69f3c96690 Refactor SysFS code to dahdi-sysfs.c
* Refactor SysFS and device-related code to drivers/dahdi/dahdi-sysfs.c .
* Move common headers to drivers/dahdi/dahdi.h .

This commit merely moves existing code and should have no functional
change.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9628 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-16 14:18:18 +00:00
Tzafrir Cohen
adb849e064 cleaner error handling in dahdi_register
* Better error handling in dahdi_register.
* Fail registration if fails creating proc entry for span.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9626 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-10 21:42:49 +00:00
Tzafrir Cohen
52cc07ecb1 span_sysfs_{create,remove}
* Separate out device generation in dahdi_[un]register to separate
  functions.
* As we don't keep anywhere the information of whether or not
* there's
  an existing device node for a channel, I abuse an unused flag:
  DAHDI_FLAGBIT_DEVFILE (25), to mark if the channel has a sysfs node.

DAHDI_FLAGBIT_DEVFILE is expected to be replaced later on with a proper
pointer to the device (or embedding of the device). I prefer a simple
flag for now as it does not break ABI.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9625 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-10 21:42:00 +00:00
Tzafrir Cohen
98aa2844c1 Pass error val from dahdi_register_echocan_factory
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9624 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-10 21:36:41 +00:00
Tzafrir Cohen
244dd928e5 separate device init functions
Separate out device initialization and removal functions:
dahdi_sysfs_init() and dahdi_sysfs_exit(). A safer way of
generating the main device files.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9623 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-10 21:30:54 +00:00
Shaun Ruffell
d5520c533a dahdi: Do not call dahdi_check_conf under lock.
dahdi_check_conf() acqurires the locks as needed when scanning the
channels and should not be called under any spinlocks.

Fixes a regression that Tzafrir reported in #asterisk-dev that he could
trigger via "asterisk -rx 'channel originate Local/600@demo
Application Meetme 3000,d'"

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9621 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-06 21:34:10 +00:00
Shaun Ruffell
68c0c37691 dahdi: Ensure we have room to keep all span channels contiguous.
This fixes a regression from r9609 that Tzafrir reported.  If you
register multiple spans, then remove the first span and try to register
a new span with more channels then the old span, you could end up with
multiple channels with the same number.

This change ensures that spans are ordered and that channels on a span
are always contiguous and ordered in relation to the spans.

In previous released versions of DAHDI (2.4.0 and below) this condition
would result in spans that may not have contiguous blocks of channels.
So it fixes both a recent regression and improves the behavior.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9617 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-05 15:52:10 +00:00
Shaun Ruffell
a45f853395 dahdi: Move the default tone lengths into include/dahdi/dahdi_config.h
The default tone lengths are compile time options and they were in
digits.h to make it easy for users to patch.  Most of these settings are
potentially overridden from user space via the DAHDI_SET_DIALPARAMS
ioctl currently regardless of these settings.

In r9597 I moved digits.h directly into dahdi-base.c since I thought it
was broken out for sharing between compilation units as opposed to
ease patching.

I also changed the units of the default options to ms instead of in
samples.  This way if the sampling frequency changes the user will not
need to update the defaults.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
asterisk-dev-reference: 4D236FD7.30707@digium.com

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9616 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-05 15:52:03 +00:00
Tzafrir Cohen
d4c047f5d9 dahdi: Also use constant for DAHDI_TRANSCODE
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9614 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 21:17:17 +00:00
Shaun Ruffell
588d311c62 dahdi: Break the dahdi_ctl_ioctl handlers into separate functions.
This is a cleanup as part of simplifying reference counting for the
spans.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9612 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:28 +00:00
Shaun Ruffell
9f790b7859 dahdi: Do not locate new master in interrupt context.
When a span goes into alarm it will look for a potential new master
span.  For dynamic spans that are running their processing in the
sync_tick callback, the chan_lock will already be held.  Therefore,
push the locating of a new master out to the global workqueue.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9611 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:24 +00:00
Shaun Ruffell
e5cbedbf37 dahdi: Add module parameter to limit number of pseudo channels.
Since there isn't a fixed array to hold all the channels, and also limit
the total number of channels that can be created, we'll add a module
parameter to allow the system administrator to specify the maximum
number of pseudo channels.  This is to prevent a potentially
non-privledged process from consuming too much CPU (since all pseudos
are checked each "tick" for conferencing) and kernel memory.

By default the number of pseudo channels is limited to 512.  Change the
default limit with:

]# modprobe dahdi max_pseudo_channels=<new limit>

or at runtime with:

]# echo <new limit> > /sys/module/dahdi/parameters/max_psuedo_channels

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9610 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:19 +00:00
Shaun Ruffell
579ea560ef dahdi: Remove 'chans' array from reg/unreg. Now completely removed.
Remove the remaining locations the 'chans' array was referenced but keep
the observable behavior the same.  Namely, channels are numbered in
registration order.  Only now it's possible to renumber channels easily
since their number is not also their implied location in the 'chans'
array.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9609 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:15 +00:00
Shaun Ruffell
b3aa15a793 dahdi: Remove three maxchans/DAHDI_MAX_CHANNELS references.
In dahdi_chec_conf, dahdi_chan_unreg, and dahdi_ioctl_confdiag maxchans
and DAHDI_MAX_CHANNELS was used to scan through all the channels.  Since
the channels are stored on the list of spans and list of pseudo
channels, we can directly iterate through those lists.  This also paves
the way for removing the arbitrary limit on the number of channels in
the driver.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9608 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:11 +00:00
Shaun Ruffell
6f8b5cefe5 dahdi: Drop 'chans' reference in chan_from_num.
Part of getting rid of global chans array.  We need to search the list
of spans and the list of pseudo channels.  While this is slower than a
direct index into a 'chans' array, the places where this function is
called are not in the 'hot' path but instead part of channel
configuration and conferencing setup.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9607 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:06 +00:00
Shaun Ruffell
4533614fb6 dahdi: Group all conditions for skipping channel receive together.
Streamlines the function a bit by grouping the three conditions that
would cause the channel receive to be completely skipped.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9606 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:28:02 +00:00
Shaun Ruffell
5002e537c3 dahdi: Move the slave channel processing into separate functions.
IMO this improves readability of dahdi_receive and dahdi_transmit, and
the compiler can decide if it is better to inline this in with the
caller or break it out into a separate function.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9605 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:58 +00:00