Commit Graph

295 Commits

Author SHA1 Message Date
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
Shaun Ruffell
766d0755fd dahdi: Save pointer to monitored channel in struct dahdi_chan.
When we're in monitor mode, we can save a pointer to the channel we are
monitoring directly instead of dereferencing the 'chans' array each
time.

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@9604 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:53 +00:00
Shaun Ruffell
88345e505a dahdi: When DACS is enabled, hold a pointer directly to the crossed channel.
This both removes the need to reference the 'chans'
__dahdi_process_putaudio_chunk and __dahdi_process_getaudio_chunk, and
allows the dahdi_receive / dahdi_transmit logic to be streamlined.  DACS
channels can no longer be echocanceled if crossed.  However, if a
channel was DACSed with dahi_cfg it couldn't have been echocanceled
anyway since the echo cancelers are disabled on the channel by default.

This change was originally contained in a patch kpfleming had floating
around. I split it up and merged it.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9603 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:49 +00:00
Shaun Ruffell
7c49f372c2 dahdi: Only check for NOSTDTXRX once in dahdi_receive.
There is no need to check the flag on the master channel when processing all
the slave channels.  Originally part of a patch kpfleming had floating around.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9602 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:44 +00:00
Shaun Ruffell
9d4a2fad78 dahdi: Trivial formatting change in dahdi_receive.
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@9601 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:40 +00:00
Shaun Ruffell
8053657761 dahdi: Change dahdi_chan.nextslave from index to a pointer.
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@9600 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:36 +00:00
Shaun Ruffell
c380e4d91e dahdi: Use 'dacs_chan' convenience pointer in dahdi_ioctl_chanconfig.
Eliminates the need to look for the channel number twice.

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@9599 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:31 +00:00
Shaun Ruffell
800c356cf3 dahdi: Remove arbitrary limit on number of spans in the kernel.
Spans are no longer added to a static array, but they are chained
together in a list.  DAHDI_MAX_SPANS, while no longer used in the
kernel, is still in include/dahdi/user.h since dahdi tools is currently
using it.

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@9598 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:27 +00:00
Shaun Ruffell
7a6d71f35c dahdi: Move the contents of digits.h directly into dahdi-base.c
Clarify that these definitions are not / no longer used outside
dahdi-base.c.

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@9597 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:23 +00:00
Shaun Ruffell
89d96a16b5 dahdi: Cleanup formatting in dahdi_ioctl_set_dialparams().
Mainly I wanted to document that the global_dialparams is protected by
the BKL so that it can be closely checked when lock_kernel is removed
from DAHDI.

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@9596 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:18 +00:00
Shaun Ruffell
a6b2fb1891 dahdi: Move DAHDI_SET_DIALPARAMS code into 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@9595 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:14 +00:00
Shaun Ruffell
daf96e677d dahdi: Change reference counting for tone zones.
This change primarily is a memory reduction.  Most users only ever have
a single tone zone loaded so we can save some mostly unused pointers by
using a list instead of an array.  Since we also have a pointer to the
dahdi_zone in struct dahdi_chan, we also don't need to store the integer
that is an index into that array.  This saves 4 bytes for every channel
allocated in the system. Finally, we don't need a separate default_zone
member since we're on a list, we can define the first element on
the list to always be the default zone.

Additionally, all reference counted structures in the drivers should
standardize on kref as much as possible for simplicity.

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@9594 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:10 +00:00
Shaun Ruffell
215d530887 dahdi: Introduce dahdi_kasprintf for pre 2.6.12 kernels.
kasprintf will be used in upcoming changes and it's not supported on
RHEL4 kernels. This change essentially backports it.

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@9593 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:05 +00:00
Shaun Ruffell
0dc5fd0ffb dahdi: Add error if CONFIG_BKL is not defined
Might help when someone wonders why they are now getting errors about
"lock_kernel" being undefined.

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@9592 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:27:01 +00:00
Shaun Ruffell
781b51aa3a dahdi: trivial. Remove unneccessary comment.
Not only should you not reach that line, it's impossible for you to
reach that line.

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@9591 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:56 +00:00
Shaun Ruffell
41c09ac4b4 dahdi: Minor fix for alloc/free of 'struct ecfactory'
Do not allocate the structure with GFP_KERNEL under the lock in
dahdi_echocan_factory_register and closes a leak in
dahdi_echocan_factory_unregister.

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@9590 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:52 +00:00
Shaun Ruffell
42ba6fab28 dahdi: Convert ecfactory_list_lock from rwlock to spinlock.
rwlocks are slowly being deprecated because they typically do not
provide the performance increase expected.  Most of the
ecfactory_list_lock acquiring is during setup and not in the hot path
anyway, so we can just use the simpler spinlock semantics without the
overhead of a semaphore or mutex.

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@9589 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:47 +00:00
Shaun Ruffell
3ba232691d dahdi: Use a spinlock instead of a rwlock for 'zone_lock'
rwlocks are deprecated and there aren't that many places where read_lock
was called on the lock anyway.

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@9588 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:43 +00:00
Shaun Ruffell
4763b89d5a dahdi, xpp: dahdi_span_ops.sync_tick should return void.
Since the return value is not defined/used just return void.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9587 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:39 +00:00
Shaun Ruffell
c6ae6d6cec dahdi: Trivial move of sync_tick callback to inline function.
This is a trivial cleanup to primarily to remove the #ifdef test out of
process_masterspan.

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@9586 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:34 +00:00
Shaun Ruffell
2f3b2a4f62 'dahdi_copy_string()' -> 'strlcpy()'
There is already a safe string copying function in all the kernels DAHDI
currently supports.

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@9585 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:29 +00:00
Shaun Ruffell
25a8bb1abe "struct pci_device_id[]" -> "DEFINE_PCI_DEVICE_TABLE"
2.6.25 added the DEFINE_PCI_DEVICE_TABLE macro to make sure that the
pci_device_id tables are put into the correct section in the binary.
Convert all the places where the tables were defined to use them.

This is linux-2.6 commit where the change went in along with the
rationale:  90a1ba0c5e39eeea278f263c28ae02166c5911c8

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@9584 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:24 +00:00
Shaun Ruffell
fdaa2d3f49 dahdi: Take a reference count on module when operating on spans directly.
Normally, spans are accessed via channels, which increment the reference
count on the supporting module as part of the open call.  When operating
on spans by number we are susceptible to a module_unload while we are
accessing the span.

Renames find_span to span_find_and_get to indicate that we're both
finding the span by number and increasing the reference count on the
span.  Spans themselves don't currently have reference counts, but we
can increment the reference count on the module that owns the spans.
This will prevent the module that has the span from unloading in the
middle of a span_config call, which in the case of the wcte12xp can take
awhile since the VPM firmware is loading.

Hopefully in the near future the spans themselves will be reference
counted directly.

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@9583 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:19 +00:00
Shaun Ruffell
c168f838ac dahdi: Add the span onto the list as the very last thing
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@9582 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:14 +00:00
Shaun Ruffell
c050ca9065 dahdi: Allow spans to advertise if they can provide any timing.
Some spans, specifically dynamic local spans, should never be the timing
master since they are dependent on some other timing source driving
them.

The bit in 'struct dahdi_span' is named cannot provide timing so that by
default the other drivers will set it to 0.

This is loosely related to issue #13205 but doesn't address any of the
other elements of that issue about how to allow the user to configure
what the master span order of succession is.

(issue #13205)
Reported by: biohumanoid

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@9581 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:08 +00:00
Shaun Ruffell
28f559e2ac dahdi_dynamic: Do not depend on BKL for serialization of dspan creation.
Also makes it safe to unregister a dynamic driver when there aren't any
open channels on the dynamic 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@9580 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:26:04 +00:00
Shaun Ruffell
e0d94d5ca4 dahdi_dynamic: Pass the dahdi_dynamic to create/destroy functions.
This allows the pvt member to be set under lock without holding the lock
through the call to create destroy.

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@9578 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:56 +00:00
Shaun Ruffell
b68be9abb5 dahdi_dynamic: Do not enable tasklets by default for dynamic_spans.
Running in tasklets does not work well when dahdi doesn't have a span that is
acting as the master.  In this case, process_masterspan is being called in
system timer that may not be running at 1ms intervals.  The end result is that
the dynamic_run function isn't called for every chunk processed, and there is
data loss.

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@9577 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:51 +00:00
Shaun Ruffell
e3bf2fe45d dahdi_dynamic: Use dahdi_span_ops.sync_tick for driving dynamic spans.
Dynamic spans that are unable to provide their own timing, like dahdi
local spans, typically derived their timing source from
dahdi_dynamic_ioctl(0,0) call in process_masterspan.

This change uses the sync_tick member of dahdi_span_ops instead so that
dynamic operations do not happen on a span until it is fully registered.
Also removes the check for dahdi_dynamic_ioctl in process masterspan for
those users that never load a dynamic span.

This was originally suggested in a comment on:
(issue #13205)

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@9576 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:45 +00:00
Shaun Ruffell
8c709f9aa0 dahdi_dynamic: Remove tests for KERNEL_VERSION < 2.6.9
2.6.9 is the earliest kernel version currently supported by DAHDI.

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@9575 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:41 +00:00
Shaun Ruffell
cee7f745e5 dahdi_dynamic: constify the address parameter to create.
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@9574 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:36 +00:00
Shaun Ruffell
8212485969 dahdi_dynamic: dynamic drivers should not reference count themselves.
Move the try_module_get/module_put calls from the various dynamic
drivers into the "core" dahdi_dynamic.c file itself.  This way, a
reference count can always be held while calling through the function
pointers.  This is enabled by adding an .owner field to 'struct
dahdi_dynamic_driver'.

Dynamic spans are also unique in dahdi in that they require a "dahdi_cfg
-s" to stop them and release the references on the modules.  This is
counterintuitive. This change makes sure they are reference counted just
like other spans and on driver unload, if there aren't any open handles
from userspace, they will take care of unwinding themselves.

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@9573 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:32 +00:00
Shaun Ruffell
1aacc92326 dahdi_dynamic: "dahdi_dynamic_[un]register()" -> "dahdi_dynamic_[un]register_driver()"
Clarify that we're registering / unregistering 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@9572 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:27 +00:00
Shaun Ruffell
53fef32a61 dahdi_dynamic: Replace usecount and dead members with 'struct kref'
dahdi_dynamic can be converted to use kernel idiomatic reference
counting since DAHDI only supports 2.6.9+ kernels now.

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@9571 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:23 +00:00
Shaun Ruffell
7251a7e35a dahdi_dynamic_[loc|eth|ethmf]: Remove unused return value from transmit callback.
The return value from the transmit callback function was not used
anywhere, and is now removed.

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@9570 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:18 +00:00
Shaun Ruffell
c7ae773800 dahdi_dynamic: Use const pointers for dahdi_dynamic_driver strings.
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@9569 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:13 +00:00
Shaun Ruffell
47ec64f9b0 dahdi_dynamic: kmalloc/memset -> kzalloc
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@9568 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:09 +00:00
Shaun Ruffell
5583487c45 dahdi_dynamic: Trivial removal of 'zaptel' references.
Replaces all the 'z' references to 'd' as appropriate and cleans up any
formatting problems that popped up as a result.  The intent here is to
reduce confusion in the future as someone may wonder what the 'Z's refer
to.

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@9567 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:05 +00:00
Shaun Ruffell
56a6e402ae dahdi_dynamic_loc: Do not call dahdi_dynamic_receive on peers before reg.
It's possible for dahdi_dynamic_loc spans to be "peered" before the
dahdi_span is fully register.  Do not call dahdi_dynamic_receive on any
peers before they are fully registered.

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@9566 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:25:00 +00:00
Shaun Ruffell
08eb1a560d dahdi_dynamic_loc: Reduce indentation level in 'dahdi_dynamic_local_create()'
This is a trivial formatting change in order to not introduce any warnings.

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@9565 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:24:56 +00:00
Shaun Ruffell
42b9a95b34 dahdi_dynamic_loc: Use a standard kernel linked list.
The memory saved by using a singly linked list does not, in my opinion,
outweigh the benefit of using the standard kernel macros.

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@9564 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:24:52 +00:00
Shaun Ruffell
3163002ad0 dahdi_dynamic_loc: kmalloc/memset -> kzalloc
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@9563 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:24:48 +00:00
Shaun Ruffell
29b0b48096 dahdi_dynamic_loc: Remove references to 'zaptel'
Hopefully will eliminate any questions about what the 'z's are supposed
to represent.

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@9562 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 18:24:43 +00:00
Shaun Ruffell
cf2c6ce98b Update copyright on changed files since 2011-01-01.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9560 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 14:55:24 +00:00
Shaun Ruffell
b44ab5ab44 wcte12xp: Remove GpakHpi.h file from drivers/dahdi/wcte12xp
This file is now in drivers/dahdi/voicebus folder.  This file should
have been removed when the Gpak API was moved out of the individual
board drivers.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9559 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 14:55:22 +00:00
Shaun Ruffell
8c790d07a8 wct4xxp: Hold the reglock longer when checking error counters.
This is a very slight performance improvement. Eliminating the need to
save the IRQ flags is probably more of a boost than grabbing and
releasing the reglock.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9558 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 14:55:19 +00:00
Shaun Ruffell
a6c9b88c66 Trivial removal of duplicate #includes
Mostly linux/errno.h was included more than once.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9557 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 14:55:15 +00:00
Shaun Ruffell
a35b0b21da wcb4xxp: HDLC packets do not pass over D-channel.
dahdi/wcb4xxp driver used with Digium Wildcard B410 quad-BRI PCI card
unable to communicate with another ISDN device (ISDN phone, another port
of B410). It appears that B-channels are capable to transport data, but
D-channel is not.

Debug output added into the driver shows that packets are transmitted to
the D-channel, but no packets are received. Further investigation shows
that no interrupts received from Rx FIFO associated with D-channel,
although packets are delivered to the FIFO. I've found that problem is
in improper usage of chan->chanpos while indexing the fifo index
(bspan->fifos): chanpos starts from 1 and fifos starts from 0.
Therefore, garbage read instead of fifo number.

(closes issue #14834)
Reported by: vvv
Patches:
      dahdi-linux-complete-2.2.0-rc1.patch uploaded by vvv (license 741)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9555 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 13:06:54 +00:00
Shaun Ruffell
8870b8e1fb wcte12xp, wctdm24xxp: Do not call pci_set_drvdata after device initialization.
Instead of using pci_set_drvdata embed the 'struct voicebus_operations'
directly in the context so we can use container_of to find the context.

This resolves a problem where the 'remove_one' callback gets an invalid
pointer to 'struct t1' if the VPMADT032 is in the middle of a reload
when the module is unloading.  DAHDI-783.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9554 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 13:03:49 +00:00
Tzafrir Cohen
5759e5a6a6 constants for ctl, transcode, timer, channel, pseudo
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@9552 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-01-03 10:49:22 +00:00
Shaun Ruffell
e26a4d25c8 dahdi: Cleanup in the dahdi_chan_poll function.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerreicks <rmeyerreicks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9550 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-21 16:09:31 +00:00
Shaun Ruffell
9496527004 dahdi: Initialize chan->waitq once at registration time.
This is instead of initializing the waitq each time the channel is
opened or closed.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9549 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-21 16:09:27 +00:00
Shaun Ruffell
2765186d03 dahdi: Use a single wait_queue_t for dahdi channels.
Since we've now switched to wait_event_interruptible calls, we have a
condition that we can check when we're awoken.  This allows us to
combine the separate wait queues into a single queue.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9548 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-21 16:09:22 +00:00
Shaun Ruffell
74fff81da4 dahdi: Remove interruptible_sleep_on() calls for WINK/FLASH.
Makes it a little more clear what it is we're really waiting for.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9547 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-21 16:09:17 +00:00
Shaun Ruffell
492315c255 wcb4xxp: Remove unused syncpos member.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9545 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-20 19:49:05 +00:00
Shaun Ruffell
34400ad07c wcte12xp, wctdm24xxp: Use more descriptive symbols for the bus setup.
This is a cleanup patch to make it a little easier to see what the bits
mean.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9543 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 18:54:53 +00:00
Shaun Ruffell
4de462c3e0 wctdm24xxp, wcte12xp: Disable PCI read-line multiple command.
There are some platforms where the read-line multiple transaction causes
packets to be dropped in the voicebus pipeline.  The only observable
behavior is that packets just go "missing" in the pipeline.  This also
only appears to affect PCI cards.

A typical 'symptom' of this problem is you may see IRQ misses increasing
without any corresponding "bumps" in latency in the kernel message log.
Normally, IRQ misses are correlated to latency bumps since that is an
indication that the host was not able to service the card interrupt in a
timely fashion. DAHDI-510 DAHDI-774

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9542 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 18:54:49 +00:00
Shaun Ruffell
1d9cbea469 wcb4xxp: Remove redundant dev member from 'struct wcb4xxp'
The 'pdev' member already contained a pointer to what 'dev' was pointing
to.  Also ensure most of the changed lines are under 80 characters.
There are two lines that are were too deeply nested to do anything
sensible.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9540 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:35 +00:00
Shaun Ruffell
eba7fe3ca4 wct4xxp: Close a memory leak in the VPM450 error path.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9539 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:31 +00:00
Shaun Ruffell
b7cf1d9c02 vpmadt032: Convert ifacelock from rwlock to plain spinlock.
rwlock is slower than normal spinlocks and this lock is rarely contended
for.  Also noticed that the vpmadt032_module_init function is now (was
already) redundant since all the elements initialized in it were already
initialized.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9538 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:25 +00:00
Shaun Ruffell
9292e6f0ad wctc4xxp: Make the "mode" module parameter read-only in sysfs.
The mode module parameter is only acted on during module initialization.
We shouldn't allow anyone to change it after the driver is already
loaded.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9537 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:21 +00:00
Shaun Ruffell
0c3cbc2c32 wcte12xp: Unregister the span before any additional cleanup.
Span registration is the last step in during initialization and it
should be the first on unregistration.  I also was hit by this when
looking at adding other members to the span and made the assumption that
the span was in a consistent state during unregistration.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9536 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:16 +00:00
Shaun Ruffell
5b6fba6e4b wctdm24xxp, wcte12xp: Lock interrupts when recovering from an underrun.
This reduces the chance that another interrupt will interfere with the
recovery process.  Otherwise it is possible that the hardware advances
past the position that we think it is currently at.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9535 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:12 +00:00
Shaun Ruffell
cf3e4bd757 wctdm24xxp, wcte12xp: Add more descriptive message on a failed reset.
Reading 0xffffffff from the registers is a different error than just not
coming out of reset.  Add a little extra debugging information.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9534 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-15 17:53:07 +00:00
Shaun Ruffell
3203aaf84c dahdi: Do not dereference chan->span for pseudo channels.
Fixes a regression introduced in r9510 which saves a pointer to the ops
member of a channel's span before checking if the channel is a pseudo.
Psuedo channels do not have spans.

(issue #18463)
(issue #18422)
Reported by: alecdavis

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9530 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-13 14:57:12 +00:00
Kinsey Moore
60c4681ec8 dahdi_echocan_hpec: Update the HPEC wrapper to use the new name interface
I apparently forgot all about HPEC when updating the echocans for the change
in the factory and echocan ops structures related to echocan naming.  The HPEC
wrapper should now be up to date with the rest of DAHDI.

Signed-off-by: Kinsey Moore <kmoore@digium.com>


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9526 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 21:52:34 +00:00
Kinsey Moore
7a7d4000a0 dahdi-base, dahdi_echocan_*, wcb4xxp, wct4xxp, wctdm24xxp, wcte12xp, kernel: Allow name of EC factory to vary based on channel
Changed the echocan factory name to a function (get_name) called to get the
name.  This allows a factory to return a different name when being called in
reference to a channel such as in the case of hardware echo cancellers.  To
further accommodate this change for HWEC, a new echocan_name function was
added to the span ops struct and is used in hwec_factory in dahdi-base for
all cards that support hardware echo cancellation.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9524 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 20:19:26 +00:00
Kinsey Moore
fd01eef199 dahdi-base, kernel, dahdi_echocan_*, wcb4xxp, wct4xxp, wctdm24xxp, wcte12xp: Remove name field from echocan ops
This field was redundant and was only used in places where the factory's name could be used.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9523 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 20:19:21 +00:00
Kinsey Moore
06eac5b1d2 dahdi-base: Alarms may not be the last item on the line, so don't strip the trailing space
Signed-off-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9522 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 20:19:18 +00:00
Kinsey Moore
fbee540bf5 dahdi-base: Remove old method of invoking HWEC
Remove the code that allowed hardware echo cancellation to automatically
override software cancellation and prevented SWEC from working at all on a
card if HWEC was installed.  All EC now uses the standard modular EC interface.
Additionally, the "SWEC" identifier on channel lines in /proc/dahdi has been
changed to "ECTYPE" to avoid confusion.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9521 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 20:19:16 +00:00
Kinsey Moore
6140d43665 dahdi-base: Allow HWEC to use the modular echocan interface
This change adds an echocan factory to dahdi-base that will allow hardware
echo cancellation to use the same interface as the current software echo
cancellers.  The additions in this commit will not have any effect until the
current HWEC mechanism is removed.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9520 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-09 20:19:13 +00:00
Russ Meyerriecks
6e25ac61db dahdi: Fixed loopup/loopdown signals
The loopup/loopdown T1 maintenance feature in the single through quad-span
drivers now function properly, according to AT&T TR54016, by sending a
full rate pattern down the line. T1.403 ESF/Data Link patterns are not
supported currently.

Also grouped all the maint reset register clears under a single irq lock
to crank the performance up past 11.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9516 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-08 22:11:58 +00:00
Russ Meyerriecks
bbdcb0c7ba dahdi: Removing loopstop maint function
DAHDI_MAINT_LOOPSTOP is being removed due to the redundancy with
DAHDI_MAINT_NONE. Also removing some timing logic, as amount of time a
loopup or loopdown signal is held on the line, is now defined in
userspace with dahdi_maint.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9515 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-08 22:11:53 +00:00
Russ Meyerriecks
5ee55a6147 dahdi: Clean up an unused waitqueue
The dahdi_span->maintq wait queue was very old and not being used so it
has been removed.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-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@9514 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-08 22:11:46 +00:00
Shaun Ruffell
51bff0d802 wcte12xp: Use interruptible waits to decrease impact on load average.
The wcte12xp does all the checking for alarm in a user space workqueue.
Most of this time is spent sleeping waiting for reads from the framer to
complete.  Tasks in uninterruptible sleeps are added to running tasks
for the purposes of calculating load average. This change makes the
sleeps interruptible so as to not affect the load average as much.

For example, the following command will load and configure the driver and
then print the load average every 10 seconds.

]# modprobe wcte12xp && dahdi_cfg && ((x=12)); while [[ $x -gt 0 ]]; do cat
/proc/loadavg; sleep 10; let x=$x-1; done

With this change:
0.29 0.10 0.02 1/101 29945
0.24 0.10 0.02 1/101 29967
0.20 0.09 0.02 1/101 30019
0.17 0.09 0.02 1/101 30041
0.15 0.09 0.02 1/101 30062
0.12 0.08 0.02 1/101 30085
0.10 0.08 0.02 1/101 30107
0.09 0.08 0.02 1/101 30129
0.07 0.08 0.02 1/101 30151
0.14 0.09 0.02 1/101 30173
0.12 0.09 0.02 1/101 30195
0.10 0.08 0.02 1/101 30217
(and I've seen it get down to 0.0)

Before this change:
0.57 0.22 0.07 1/101 31920
0.48 0.21 0.07 1/101 31942
0.48 0.22 0.07 1/101 31964
0.48 0.23 0.08 1/101 31986
0.41 0.22 0.07 1/101 32008
0.42 0.23 0.08 1/101 32030
0.43 0.24 0.08 1/101 32054
0.45 0.25 0.09 1/101 32076
0.45 0.25 0.09 1/101 32098
0.46 0.26 0.10 1/101 32120
0.47 0.27 0.10 1/101 32172
0.39 0.26 0.10 1/101 32194

(closes issue #18142)
Reported by: foxfire
Tested by: foxfire

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9512 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-08 01:56:56 +00:00
Shaun Ruffell
f7925643de dahdi: Prevent unloadable module on failed open.
If chan->span->ops->open() fails then the reference count of the module
implementing the board driver will not be decremented.  The result is a
module that would always be "in use" and unloadable.

This change makes sure to release that reference when open failed.

(closes issue #18422)
Reported by: avarvit

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Angelos Varvitsiotis <avarvit@admin.grnet.gr>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9510 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-07 14:20:38 +00:00
Tzafrir Cohen
87d376ba19 xpd_pri: Remove pointless hooksig span op
If the span reports that it supports hooksig, DAHDI may fail to use RBS.
So remove a call to that stub function.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9506 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-07 11:00:07 +00:00
Tzafrir Cohen
1b79cc7562 xpd_pri: ignore DAHDI_VMWI and DAHDIVMWI_CONFIG
This fixes an annoying, though harmless issue: if Asterisk decides to send
voicemail messages to a channel (CAS, configured as FXS), We can't do
anything useful with them. So ignore them to avoid scary-looking messages
(from report_bad_ioctl()).

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9505 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-07 10:59:37 +00:00
Shaun Ruffell
2175ea1293 wctdm24xxp, wcte12xp: Close a few potential resource assignment leaks.
There were some routes through the failure paths in __voicebus_init() where a
registered memory region was not subsequently released.  This change closes
those paths.

The result would be on subsequent loads of the driver after hitting the
failure condition you would see "IO Registers are in use by another module."
in dmesg.

request_mem_region/release_mem_region should most likely be converted to
devm_request_region and devm_release_region introduced in 2.6.20
(commit 9ac7849e35f705830f7b016ff272b0ff1f7ff759) which was introduced for
reasons just such as this.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9503 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-02 22:42:56 +00:00
Shaun Ruffell
102a2f0982 wctdm24xxp: Replace interruptible_sleep_on() with msleep when delaying.
There were several cases where interruptible_sleep_on() was being used
as a ms timer, since the assumption is that the board will interrupt at
even 1ms intervals.  We can replace these cases with msleep directly to
clarify that we're just waiting.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9501 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-12-01 16:59:20 +00:00
Shaun Ruffell
75c33ce64e dahdi: A little cleanup in the dahdi_ioctl_iomux function.
The primary change is to make clear that the wait result is not ever to
be returned by the function.  There are also edits to remove some
comments that were expressed clearly in the source already and ensure
that the iomux member of 'struct dahdi_chan' is only accessed under the
chan->lock.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Sean Bright <sean.bright@gmail.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9497 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-25 00:07:10 +00:00
Sean Bright
f406bba4c6 dahdi: dahdi_ioctl_iomux should return 0 on success.
This fixes a regression introduced in revision r9466.  Before this patch
one might see "I/O MUX failed: Success" messages on the Asterisk console
since the return from ioctl was > 0.

Signed-off-by: Sean Bright <sean.bright@gmail.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9496 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-25 00:07:05 +00:00
Russ Meyerriecks
08d3ff5671 dahdi: Fixup prior dahdi_mirror patch
Reworking tsearle's patch to fit with coding guidelines and make
process_masterspan a bit easier to read.

(closes issue #16831)
Reported by: tsearle
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9494 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-19 17:34:42 +00:00
Russ Meyerriecks
494472ee1a dahdi: Stops junk data from overwriting the dahdi_mirror pseudo chans
(issue #16831)
Reported by: tsearle
Patches:
      dahdi_mirror2.patch uploaded by tsearle (license 373)
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9493 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-19 17:34:36 +00:00
Russ Meyerriecks
712704c237 dahdi: Moved the channel mirroring interface behind a build flag
It can now be enabled by un-commenting the CONFIG_DAHDI_MIRROR define in
include/dahdi/dahdi_config.h
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9492 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-19 17:34:31 +00:00
Russ Meyerriecks
9090c6fcd2 dahdi: adding ss7 pcap support to dahdi.
Adding the patch from the issue with various fixups to fit style and
checkpatch

(issue #16831)
Reported by: tsearle
Patches:
      driver_v2.patch uploaded by tsearle (license 373)
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9491 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-19 17:34:25 +00:00
Shaun Ruffell
06136006df dahdi: In dahdi_unregister() 'new_master' should not be static.
The first place new_master is referenced after the definition is to
assign it to the value of the current master.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9489 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-19 14:07:29 +00:00
Russ Meyerriecks
1e2923566d dahdi-base: Add debug option to log RBS bit changes
Logs the RBS bits to dmesg, for troubleshooting, for all drivers that call
dahdi_rbsbits(). Added the DEBUG_RBS bit in the debug module parameter
bitfield.

(issue #18025)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9487 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-18 17:15:07 +00:00
Shaun Ruffell
8c24b0fd8f wctdm24xxp: 'wait_just_a_bit()' -> 'msleep()'
If we're waiting for tens or hundreds of milliseconds we will just go to
sleep instead of spinning.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9471 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:41:02 +00:00
Shaun Ruffell
c674c147fd wctdm24xxp: Remove unused 'usecount' member.
'usecount' was removed in revision 6926 but parts were accidentally
merged back in revision 8123 as part of the Hx8 merge.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9470 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:58 +00:00
Shaun Ruffell
4deae0c8ea wctdm24xxp: Replace 'schluffen()' with 'interruptible_sleep_on()'
'schluffen()' essentially duplicates the functionality of the standard
Linux 'interruptible_sleep_on()' function.

There may still be some race conditions that can be closed here, but
most of the command queue processing is sloted for conversion to
something more like in the single span driver in order to reduce the
time in interrupt context spent scanning for commands to the modules.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9469 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:53 +00:00
Shaun Ruffell
3de1002cb5 dahdi: Constify the dahdi_txlevelnames and return of dahdi_lboname().
Also moves the dahdi_txlevelnames array into the dahdi_lboname function,
which is the only place it it used.

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@9468 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:49 +00:00
Shaun Ruffell
a170389509 dahdi: Close race between checking IOMUX condition and sleeping.
wake_up_interruptible() will change the state of waiting tasks back to
TASK_RUNNING, therefore, we want to ensure we set TASK_INTERRUPTIBLE
before checking the conditions that we're going to sleep on.

In practice, this closes a small window were the caller may be put to
sleep when the condition is true, and have to wait for another event to
come in order to wake from the sleep.

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@9467 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:44 +00:00
Shaun Ruffell
649fa2f43d dahdi: Move the DAHDI_IOMUX ioctl handler into a separate function.
Just a cleanup patch that moves code into a standalone function.  Real
change to follow.

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@9466 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:40 +00:00
Shaun Ruffell
a782b4de71 dahdi: 'schluffen()' -> 'interruptible_sleep_on()' or 'wait_event_interruptible()'
'interruptible_sleep_on()' is the Linux equivalent of 'tsleep()'.  When
we're sleeping for a condition, we can also just use
wait_event_interruptible to close a potential race where the condition
goes true between the time we checked it and when we go to sleep waiting
on the event.

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@9465 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:35 +00:00
Shaun Ruffell
37097411ea Remove mutex emulation
Using semaphores as mutexes was removed from the kernel in 4882720b267b.
Just use straight semaphores now.  'DECLARE_MUTEX()' -> 'DEFINE_SEMAPHORE()'
and 'init_MUTEX()' -> 'sema_init()'.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9464 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:29 +00:00
Shaun Ruffell
3f9cb05bae dahdi: Remove DAHDI_CONFLINK functionality.
Conference links do not appear to be in use anymore and they are now
removed.  I could not find any references to this ioctl in the asterisk
repository, or zaptel user space tools.

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@9463 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-11-04 16:40:23 +00:00
Russ Meyerriecks
1b51530c19 Minor logging text change
Renamed the NMF workaround message to the more informational
crc4-multiframe (mis)alignment message.

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9461 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-25 20:01:54 +00:00
Shaun Ruffell
3db405486e dahdi: Eliminate NULL dereference when bridging channels.
When using conference mode DAHDI_CONF_DIGITALMON ensure conf_chan is
set.  Otherwise we dereference a NULL 'conf_chan'.

Fixes regression introduced in revision 9381

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9457 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-25 18:26:27 +00:00
Shaun Ruffell
cba1734e18 wctdm24xxp: Detect FXS modules based on the 3210 SLIC.
Fixes a regression introduced in revision 5916 where FXS modules based
on the 3210 were not properly detected.

(closes issue #18184)
Reported by: bsexton
Patches:
      dahdi-fxo-detect.diff uploaded by bsexton (license 1133)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9456 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-25 18:26:17 +00:00
Tzafrir Cohen
d9cdda31aa wcb4xxp: Support beroNet BN4S0e PCI Express card
Add extra PCI IDs to support "beroNet BN4S0e PCI Express 4x S0 Karte".

Origin: http://bugs.debian.org/600839


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9451 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 17:52:47 +00:00
Kinsey Moore
27899f256c dahdi-base: Fixed null pointer dereference in dahdi_check_conf
Fixes regression from rev 9366


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9449 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 16:20:30 +00:00
Shaun Ruffell
92e2a646eb dahdi: Remove CONFIG_OLD_HDLC_API since that is kernel 2.4 specific.
DAHDI does not support any kernels older than 2.6.9.  No need
to keep the old HDLC interface support around.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9447 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:28 +00:00
Shaun Ruffell
15182a4a18 wctdm24xxp, wcte12xp: Remove unused 'whichframe' parameter.
'cmd_dequeue_vpmadt032' in the wctdm24xxp and wcte12xp drivers no longer
care about which frame they are on.  The command will be packed into the
eframe specified by "writechunk".

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9446 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:26 +00:00
Shaun Ruffell
53d674dc21 dahdi: Drop some 'zt' prefixes on chan.
'zt' is a carry over from the Zaptel days.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9445 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:23 +00:00
Shaun Ruffell
aa5c973611 dahdi: Atomically set/test if channel has associated network device.
Push all tests for the DAHDI_FLAGBIT_NETDEV flag behind a
'dahdi_have_netdev' function so if CONFIG_DAHDI_NET is not defined the
compiler can just remove all the flag tests.  Also, makes sure that the
bit is checked / set atomically.

(closes issue #9379)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9444 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:16 +00:00
Shaun Ruffell
072ccc9b69 dahdi_echocan_oslec: Call olsec_hpf_tx if CONFIG_DAHDI_PROCESS_ECHOCAN_TX is defined.
It can be necessary to have low frequency filter for tx signal of DAHDI.
Otherwise, low-frequency signal from IP can reach a leased line, and
return back with nonlinear distortions. This will break an echo
canceler.

(closes issue #13562)
Reported by: biohumanoid
Patches:
      dahdi_echocan_oslec.c.patch uploaded by biohumanoid (license 459)

I slightly modified the above patch in order to use echocan_process_tx
as the interface.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9443 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:11 +00:00
Shaun Ruffell
2ba1b4c201 dahdi: Add compile time DAHDI_ECHOCAN_PROCESS_TX option.
Add optional interface to allow software echo cans to process the
transmitted samples.  Can be used for things like DC removal.

I used the following patches uploaded by biohumanoid but changed the
name of 'echocan_hpf_tx' to 'echoan_process_tx and put the changes
behind a compile time option.

(issue #13562)
Reported by: biohumanoid
Patches:
      kernel.h.patch uploaded by biohumanoid (license 459)
      dahdi-base.c.#2.patch uploaded by biohumanoid (license 459)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9442 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:06 +00:00
Shaun Ruffell
5b08a20526 wctdm24xxp: Leave FXO (DAA) always in full-wave ring detect mode.
In zaptel commit 4096 [1], all the debouncing of ring signals were moved
into software as opposed to using the ring validation circuit in DAA.
That commit failed to remove the initial check and set of the ring
validation circuit.

[1] http://svn.digium.com/view/zaptel?view=revision&revision=4096

(closes issue #16894)
Reported by: rde42

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9441 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:23:02 +00:00
Shaun Ruffell
141a61d64e wctc4xxp: Space required after ','.
Trivial formatting change.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9440 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:59 +00:00
Shaun Ruffell
9dc983cc0d wctc4xxp: Remove trailing whitespace.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9439 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:57 +00:00
Shaun Ruffell
615c6b6800 wctc4xxp: Cannot print the encoder/decoder channels before we know them.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9438 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:54 +00:00
Shaun Ruffell
8d29ecb783 wctc4xxp: 'WARN_ON(1)' -> 'dev_info(...' on channel creation failure.
If the DSP ever finds it's way into a bad state it can be possible for a
timeslot to get 'wedged'.  All attempts to create a channel in a wedged
timeslot will fail and the WARN_ON macro can quickly fill the logs.

This change adds some more debugging information (which timeslot is wedged)
along with the result code from the DSP and puts it all behind a
printk_ratelimit.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9437 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:52 +00:00
Shaun Ruffell
b4170d8f40 wctc4xxp: Drop 'DTE_PRINTK' macro in favor of standard 'dev_xxx'
Just use the standard way to print messages associated with a particular
device. Also dropped the "Attached to device at" message since that
information is now printed on every print.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9436 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:49 +00:00
Shaun Ruffell
8ac8b90bd4 wctc4xxp: Remove 'service_dte' function and a few inline keywords.
'service_dte' was only called in one place and is only two lines.  I do
not think it is adding much anymore. Also, let compiler should decide if
'service_rx_ring' and 'service_tx_ring' should be inlined.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9435 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:47 +00:00
Shaun Ruffell
8897a79f5b dahdi: '-o' -> '--no-same-owner' in drivers/dahdi/firmware/Makefile
It appears that in Centos 4, the version of tar doesn't like the -o
flag, but will honor the --no-same-owner flag.

(closes issue #16063)
Reported by: tzafrir

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9434 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:42 +00:00
Shaun Ruffell
f5f0958381 dahdi: dahdi_chan_unreg was not cleaning up conferenced channels properly.
'is_monitor_mode()' and DAHDI_CONF_DIGITALMON were mutally exclusive.
Fixes recent regression introduced in revision 9367.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9433 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:39 +00:00
Shaun Ruffell
a8b1e2b662 vpmadt032: Honor the CONFIG_DAHDI_NO_ECHOCAN_DISABLE flag.
Setting this configuration option would not have had any impact when a
hardware echo canceler was in use.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9432 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-20 12:22:35 +00:00
Tzafrir Cohen
53b658db1b xpp: Fixes init error for PRI devices with < 4 ports
Fixes a regression singce r8873: if pri_protocol is not explicitly set
(in /etc/dahdi/xpp.conf) and the device has (licences for) less than 4
"PRI" (E1/T1) ports, the initialization script will attempt to read from
a non-existing SysFS file, and bail out, resulting in a the device
failing to initialize.

For those non-existing ports we can just skip that part of the
initialization. So we just skip it.

Work around: explicitly set pri_protocol to E1 or T1, as needed.

Xorcom Rev: 8047. Ticket: 1334.


git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9430 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-18 14:50:03 +00:00
Shaun Ruffell
c4ae51ffae dahdi: 'if (chan)' -> 'if (!chan)' in dahdi_ioctl_getgains.
Fixes a typo recently introduced that was preventing asterisk from
setting the swgains on a channel.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9423 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-10-04 17:20:47 +00:00
Kinsey Moore
408787c77b dahdi: Anonymous member in dahdi_echocan_events union.
Make explicit what part of the union is being accessed.

(closes issue #15908)
Reported by: ys
Patches:
      dahdi-dahdi_echocan_events.diff uploaded by ys (license 281)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9421 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-29 22:00:22 +00:00
Kinsey Moore
b0185d1e84 dahdi: Fix 'void *' pointer arithmetic warnings.
(closes issue #15927)
Reported by: Max Khon
Patches:
      dahdi_echocan2.diff uploaded by Max Khon (license 884)
      void2.diff uploaded by Max Khon (license 884)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9420 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-29 21:32:55 +00:00
Shaun Ruffell
3400734174 wcb4xxp: Spelling 'LOOKBACK_SUPPORTED' -> 'LOOPBACK_SUPPORTED'
(closes issue #16658)
Reported by: kurtlidl
Patches:
      base.c.diff uploaded by kurtlidl (license 962)

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9416 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-27 15:57:13 +00:00
Shaun Ruffell
1c462653e7 dahdi: Remove bigzaplock by converting chan_lock to spinlock_t.
The bigzaplock was used to prevent changes to all the channels during
masterspan processing while conference parameters were changing.  The
master span processing also took a global lock out on the chan_lock to
prevent new channels from being registered or unregistered during
processing.  Instead of grabbing both those locks, just changing the
semantics of chan_lock to those of bigzaplock seems to fit the bill and
removes another lock from the driver (and saves ~10 ns on a 2.40 GHz
Xeon in prcocess_masterspan)

chan_lock is a candidate for conversion to RCU but usage in conferencing
(bigzaplock type usage) needs to be audited carefully before conversion.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9414 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:45:07 +00:00
Shaun Ruffell
c3ae5634d7 dahdi: process_timers is already called with interrupts disabled.
Very slight performance increase when timertest is running in the
background.  Measured at ~10 ns improvement over 10K samples.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9413 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:45:03 +00:00
Shaun Ruffell
87336d22fc dahdi: Rename 'zaptimer' -> 'dahdi_timer'
DAHDI is not Zaptel anymore.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9412 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:44:59 +00:00
Shaun Ruffell
283235686d Move test for DEFINE_SPINLOCK into include/dahdi/kernel.h
The check for DEFINE_SPINLOCK was spread throughout the source tree. If
not defined we can just define it in inlucde/dahdi/kernel.h.  Now
include/dahdi/kernel.h is the only place that references
SPIN_LOCK_UNLOCKED (which breaks lockdep checking if DEFINE_SPINLOCK is
otherwise defined in the kernel).

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9411 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:44:53 +00:00
Shaun Ruffell
41825e7c32 dahdi: Remove remaining #if 0 locations from dahdi-base.
Dead code elimination.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9410 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:44:49 +00:00
Shaun Ruffell
731b5868d4 dahdi: Allow core DAHDI software timing to work when DAHDI_CHUNKSIZE > 8.
When no hardware spans are configured DAHDI will use a kernel timer in order
provide timing for conferences. This is what dahdi_dummy historically was used
for. When kernel timers are used to provide timing DAHDI can both potentially
slow the rate at which time timer runs and also needs to account for how many
milliseconds of audio are processed for each 'tick' of process_masterspan.

The result is that if you are only using DAHDI for app_meetme, you can change
DAHDI_CHUNKSIZE to 40 (5ms) or 80 (10ms) bytes to reduce overhead since user
space is dealing with chunks of 20ms by default anyway.

NOTE: If you set this, you may still need to comment out the board drivers in
drivers/dahdi/Kbuild since they all do not support operating with a
DAHDI_CHUNKSIZE != 8 currently.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9407 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:44:37 +00:00
Shaun Ruffell
d08cdac785 dahdi: Only disable/enable interrupts once when iterating through channels.
dahdi_receive, dahdi_transmit, and dahdi_ec_span are mostly called from
interrupt context anyway, so we can save a few cycles by not saving and
restoring the interrupt flags for every channel.

On one 2.40GHz Xeon test machine, for a span with 24 channels w/o echocan
enabled with ~10000 samples:

Function        Avg Before   Avg After
======================================
dahdi_receive   2.109 us     1.547 us
dahdi_transmit  3.203 us     2.766 us
dahdi_ec_span   0.416 us     0.454 us

NOTE: The time went up slightly on dahdi_ec_span since I did not have
software echocan enabled and this change calls local_irq_save regardless
in dahdi_ec_span.  The slight increase in processing time in this case
is overshadowed by the savings in dahdi_receive and dahdi_transmit. If
echocan was enabled on all the channels there would be a time savings
in that dahdi_ec_span too.

When dahdi_receive/dahdi_transmit are called every millisecond (when
DAHDI_CHUNKSIZE == 8) this saves ~0.1% CPU time for each span.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Review: https://reviewboard.asterisk.org/r/940/

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9406 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-24 22:44:30 +00:00
Shaun Ruffell
6d602c96b9 dahdi_dynamic: Update copyright.
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@9403 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-23 21:38:57 +00:00
Shaun Ruffell
5618e9e812 wcte12xp, wctdm24xxp: Convert vbb cache from kmem_cache to dma_pool.
The voicebus interface constantly uses the same buffers for moving data
to/from the card.  A fixed pool has less overhead in this case than
constantly mapping/unmapping the kmem_cache_alloced buffers.

Saves about ~2.608 us for each run of vb_isr on a 2.40 GHz Xeon test
machine.

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@9402 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-23 21:38:52 +00:00
Shaun Ruffell
9038e0a2cd wcte12xp, wctdm24xxp: Remove comment about converting from IO space.
This change was made in revision 8176.

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@9401 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-23 21:38:48 +00:00
Shaun Ruffell
6d1e5996af wct4xxp: Drop usage of 'volatile' qualifier.
The registers on the device are already accessed with readl/writel and
the readchunk and writechunk are mapped into coherent DMA region.  The
contents of those buffers should not be changing in the middle of any
transmit/receive prep 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@9400 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-23 21:38:43 +00:00
Shaun Ruffell
7852d30cb5 wct4xxp: Add debug option to log detected RBS bit changes.
Normally you can see RBS bit states in dahdi_tool, but you might also
want them logged to dmesg for troubleshooting.

(issue #18025)

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@9399 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-23 21:38:37 +00:00
Shaun Ruffell
1cfc5180c8 wcte12xp, wctdm24xxp: Do not rely on polling main memory.
The voicebus library by default configures the PCI interface to poll the
descriptor ring for available buffers.  There are some platforms like
the Intel SG3420P motherboard where this does not appear to be
sufficient.  Writing to the transmit demand poll register resolves this
problem on these troublesome platforms. DAHDI-700 DAHDI-702.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9397 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-21 19:26:22 +00:00
Shaun Ruffell
b45e166253 wctdm24xxp: Add optional FXO digital loopback if DEBUG is defined.
This module parameter will allow patgen/pattest to be used only on FXO
ports. *ALL* FXO ports will be placed in digital loopback mode when
set.

The current intent is for this to be removed as an optional module
parameter when there is a channel by channel representation in sysfs.
Otherwise, a new IOCTL would have to be defined and a tool written in
order to support this. DAHDI-696.

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9391 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-21 15:36:34 +00:00
Shaun Ruffell
67fdba958c dahdi: Channels can have their own file_operations structure.
If we know that an open file is associated with a channel (pseudo or
real) we can just update the file->f_ops pointer so that we can short
circuit some of the checks in read/write/poll. Trades sizeof(file_operations)
bytes for less function call overhead in the "hot" path.

On a 2.4 GHz Xeon, saves around 150 ns on each read / write.

Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9386 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:44 +00:00
Shaun Ruffell
851203c182 dahdi: Remove redundant 'gainalloc' member from struct dahdi_chan.
I want to add some new members to dahdi_chan, but I don't want to
increase the overall size any more than necessary.

Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9385 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:40 +00:00
Shaun Ruffell
08cfbeb03e dahdi: Change iteration through pseudo/real chans in process_masterspan.
Since we have the pseudo channels on their own list, we don't need to
step through the chans array when we just want to find the pseudo
channels. Likewise, all the real channels will have be on a span.  Also
removes references to the global chans array in process_masterspan.

Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9384 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:36 +00:00
Shaun Ruffell
a017f39fc4 dahdi: Keep psuedo channels on pseudo_chan_list.
Since pseudo channels are without spans and we would like to use the
span list to enumerate through all the channels, keeping the psuedo
channels on their own list is required.  I believe this is a more
natural choice than making a dummy spans for pseudos since pseudo
channels should *really* just be an implementation detail that the user
shouldn't care about.

Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9383 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:32 +00:00
Shaun Ruffell
4bdc2afebf dahdi: Define psuedo channels as being without a span.
Therefore we can use the fact that the span pointer on the channel is
NULL to identify them.

Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9382 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:27 +00:00
Shaun Ruffell
a03f6a2eb3 dahdi: Reduce 'chans' references in dahdi_ctl_ioctl.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9381 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:23 +00:00
Shaun Ruffell
4ae563309a dahdi: 'user_data' is extraneous in dahdi_ctl_ioctl.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9380 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:19 +00:00
Shaun Ruffell
0be6a86f5c dahdi: Remove unused unit from dahdi_common_ioctl.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9379 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:15 +00:00
Shaun Ruffell
71b3fbaa9d dahdi: Move DAHDI_SPANSTAT ioctl handlers into separate functions.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9378 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:11 +00:00
Shaun Ruffell
6b8751fb8b dahdi: Remove unit parameter from dahdi_chanandpsuedo_ioctl.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9377 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:07 +00:00
Shaun Ruffell
e16c7479e7 dahdi: Remove unit parameter to dahdi_prechan_ioctl
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9376 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:34:03 +00:00
Shaun Ruffell
44ee940137 dahdi: Remove unit parameter from dahdi_chan_poll.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9375 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:33:59 +00:00
Shaun Ruffell
c25fc5633f dahdi: Remove unit parameter from dahdi_ioctl_[get|set]gains.
Review: https://reviewboard.asterisk.org/r/905/

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

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9374 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-20 20:33:55 +00:00