summaryrefslogtreecommitdiff
path: root/drivers/dahdi/dahdi-base.c
AgeCommit message (Collapse)Author
2012-10-04dahdi: Running without the Big Kernel Lock (BKL) is no longer experimental.Russ Meyerriecks
The warning was originally added in r9721 "dahdi: Experimentally remove dependency on the Big Kernel Lock." [1]. [1] http://svnview.digium.com/svn/dahdi?view=revision&revision=9721 Signed-off-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@10732 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04dahdi: Remove 'getlin_lastchunk' from struct dahdi_chan.Russ Meyerriecks
'getlin_lastchunk' has not been used since r65 "Version 0.1.6 from FTP" [1] One less thing to think about... [1] http://svnview.digium.com/svn/dahdi?view=revision&revision=65 Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10731 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04dahdi: Remove unused 'rxbufpolicy' and 'rxdisable' from dahdi_chan.Russ Meyerriecks
Since r5021 [1], first released in DAHDI-Linux 2.2.0, it's been impossible for user space to change the rxbufpolicy. This hasn't caused any problems and it's safe to remove a few more of the vestiges of the rxbufpolicy from the driver. This streamlines the code path in a few places and saves 8 bytes from the size of struct dahdi_chan. The user visible parts are maintained and will indicate DAHDI_POLICY_IMMEDIATE, like it has since 2.2.0. [1] http://svnview.digium.com/svn/dahdi?view=revision&revision=5021 Signed-off-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@10730 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04dahdi: Filter 'HWEC' from DAHDI_GETVERSION results if hwec is really not ↵Russ Meyerriecks
present. Internally in DAHDI there is always a hardware echocan factory registered and available. Having this factory always registered allows for DAHDI to work in a backward compatible fashion. Namely, by default DAHDI will always use a hardware echocan if one is available unless 'hwec_overrides_swec' dahdi module parameter is set to 0 on load. However, if there were no real hardware echocans available in the system dahdi would still report "Echo Canceller(s): HWEC" in the dahdi_cfg -v output since the hwec factory is always there. After this change dahdi_cfg will no longer report HWEC as one of the available echocans if there isn't a physical span present that actually has a hardware echocan. Internal-Issue-ID: DAHLIN-300 Signed-off-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@10727 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-09-21dahdi-base: Minor maint mode errorRuss Meyerriecks
The previous maint state was saved regardless if the base driver returned an error or not. This caused strange behavior in dahdi tools. Moved the maint state save to after the switch case to reflect this. https://issues.asterisk.org/jira/browse/DAHDI-984 Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10718 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23dahdi_ioctl_spanstat() backward compat hackTzafrir Cohen
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@10686 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23sysfs: refactor lineconfig string representationTzafrir Cohen
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@10685 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23sysfs: add a linecompat span attributeTzafrir Cohen
This way, dahdi_genconf may gather needed information without issuing ioctl()'s 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@10684 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23convert span->spantype to enumerated typeTzafrir Cohen
* This is a minimal convertion -- everything compiles and looks OK. * We print a warning for spans registering without a spantype. * Low-level drivers may later want (but not required) to fold their internal representations to this canonical representation -- it will save code and make it more readable. 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@10683 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-11dahdi: Fix compilation when CONFIG_DAHDI_WATCHDOG is defined.Shaun Ruffell
From: Mike Sinkovsky <msink@trikom.ru> Internal-Issue-ID: DAHLIN-288 Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10655 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03dahdi: Fix compilation when CONFIG_DAHDI_NET is defined.Shaun Ruffell
'irq' field was removed from dahdi_span in r10276 "dahdi: Remove dahdi_span.irq and move dahdi_span.irqmisses into dahdi_device." [1] which was first released in dahdi-linux 2.6.0. [1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10276 Reported-by: Pavel Selivanov Internal-Issue-ID: DAHLIN-278 Patches: hdlc.patch by Pavel Selivanov (license #5420) Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10634 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03dahdi: Fix compilation when CONFIG_DAHDI_ECHOCAN_PROCESS_TX is defined.Shaun Ruffell
'ec_state' was renamed to 'dahdi_echocan_state' in r6529 [1] but support for CONFIG_DAHDI_ECHOCAN_PROCESS_TX was first committed in r9442 [2]. So it appears that I never compiled tested this exact commit when it went in for the 2.5.0 release. [1] http://svnview.digium.com/svn/dahdi?view=revision&revision=6529 [2] http://svnview.digium.com/svn/dahdi?view=revision&revision=9442 Reported-by: Pavel Selivanov Internal-Issue-ID: DAHLIN-279 Patches: ec.patch uploaded by Pavel Selivanov (License #5420) [ edited the patch slightly for minor formatting ] Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10633 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03dahdi_dynamic: Do not call into dahdi_dynamic without holding reference.Shaun Ruffell
Instead of registering a function pointer, register a dahdi_dynamic_ops structure that contains the owner as well as the ioctl callback. This way dahdi.ko can bump up the reference count on dahdi_dynamic.ko before calling the ioctl callback. Also, use the registration mutex to guard against the module being unloaded between the time the structure pointer was checked, and the module reference is taken. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10623 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21Update Digium copyright on files changed since beginning of the year.Shaun Ruffell
In addition to updating the year, this also adds some boilerplate to dahdi-sysfs.c and dahdi-sysfs-chan.c that wasn't there previously. 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@10560 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21dahdi: Add dahdi_pci_disable_link_state for kernel < 2.6.25.Shaun Ruffell
Will allow the ASPM (Active State Power Management) state to be disabled on PCIe devices before kernel version 2.6.25. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10556 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15dahdi: Use monotonic clock for coretimer.Shaun Ruffell
DAHDI internal timing currently uses the "wall clock" to determine how much time is passing for mixing and timers. When the wall time changes, like when the system time is set via ntp or date, DAHDI currently will display a "Detected time shift" message since it believes there is too much audio to mix. There may also be audio problems if the wall time is shifting occasionally due to slewing of the clock. Now use a monotonic clock to determine how much real-time has passed for timing purposes. This makes DAHDI insensitive to any changes in the wall time on the system. This only applies when using DAHDI's internal timer like when there are not any telphony cards installed. There are still potential audio problems if the platform is unable to accurately determine the passage of time. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10482 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-13Remove support for kernels < 2.6.18Tzafrir Cohen
This patch removes support for kernel versions < 2.6.18, as those are not actively supported in any major Linux distribution (except RHEL4, which is in the "extended" support level of the product life cycle). This removes much of the more #ifdef-rich parts of the code. Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: 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@10472 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-22sysfs channels: cleanup device files handlingTzafrir Cohen
* Shortcut CLASS_DEV_CREATE/CLASS_DEV_DESTROY. No need to pass repetitive data (and NULL) on every call. * Create/remove fixed device files (ctl, timer, channel, pseudo) via generic code (fixed_devfiles_create()/fixed_devfiles_remove()) instead of repetitive code and flags. * Try to make all removal/cleanup functions idempotent, so we can safely call them on any failure without the need for multiple goto destinations. * Rename 'device_state_flags' to 'should_cleanup' and its member flags to a better/consistent naming. * Rename dahdi_sysfs_exit() to dahdi_sysfs_cleanup() and call it from a new proper dahdi_sysfs_exit() * In dahdi_sysfs_init(), handle dahdi_sysfs_chan_init() failures * Add dahdi_dbg() message before creating/removing all DEVICES objects. * Also move two KERN_INFO messages to a more correct locations: - The version reporting should be first (in dahdi-base.c) - The "Telephony... on major" reporting should be at the end of dahdi_sysfs_init() Signed-off-by: Oron Peled <oron.peled@xorcom.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@10464 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-09dahdi: build fix for Kernels < 2.6.16Tzafrir Cohen
* Fixes building for kernels < 2.6.16 (and some older Centos 4 ones). * Broken by http://svn.asterisk.org/svn/dahdi/linux/trunk@9721 (Jan-2011) Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10460 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-09code cleanup - refactor module_printk()Tzafrir Cohen
* Remove multiple definitions * Move canonical one to include/dahdi/kernel.h Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10458 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25show Master change to/from core timerTzafrir Cohen
show Master change to/from core timer if DEBUG_MAIN (GENERAL) flag is on. Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10451 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25A channel-less span should not crash dahdiTzafrir Cohen
* Always check span->channels before accessing span->chans[0] * Clean one dev_notice() text that accessed span->chans[0] * Check channels in basechan_show() sysfs attribute Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10450 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25A parent-less device should not crash dahdiTzafrir Cohen
* A parent-less device should not crash dahdi: - Access span->parent->dev instead of span->parent-dev.parent in soem cases. - Access span->parent->dev via new inline span_device() - Use span_device() in all dahdi_dev_{dbg,info}() * Allow low-level drivers to set their device name. - Drivers that don't use this feature get the default name based on the parent device name - Parent-less devices which don't set their name, fails to register with -EINVAL Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10449 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14DAHDI-linux: Fix "surprise removal" problemsTzafrir Cohen
* Added a nodev_*() file_operations that handle system calls from user-space after surprise device removal. Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-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@10381 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14dahdi: Return dahdi_span_ops.startup callback errors to userspace.Shaun Ruffell
Allows dahdi_cfg to return an error code if a board driver fails it's startup call for any reason. 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@10379 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07dahdi: Unregister dahdi_device from sysfs if we fail to auto assign spans.Shaun Ruffell
Otherwise, if the _dahdi_assign_span call fails, the dahdi_device will never be removed from the dahdi_devices virtual bus and the board drivers will not be reloadable. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10331 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07dahdi: Fix typo in previous commit which forced some spans to always fail ↵Shaun Ruffell
assignment. I misssed a small typo in r10328 "Extra debugging aids and messages" that would force any span that supports a hardware preechocan to always fail assignment with -EFAULT. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10330 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07Extra debugging aids and messagesTzafrir Cohen
* Added dahdi_dev_dbg() macro to print when we don't (yet) have a span number. * Added a new debug category: DAHDI_DBG_ASSIGN * Made sure error return code paths prints helpfull messages * Promote error messages from INFO to NOTICE * Change some errno values from EINVAL to EFAULT (internal errors not caused by user input) Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-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@10328 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-07bugfix: off-by-one in span assignmentTzafrir Cohen
The test in _check_spanno_and_basechan() was off by one (used '<' instead of '<=') 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@10327 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-02dahdi: First span registered becomes master by default.Shaun Ruffell
r10205 "dahdi: Check for master in DAHDI_STARTUP / resolves MeetMe regression." did not handle the case for the wcb4xxp driver since it would set DAHDI_FLAG_RUNNING as part of the probe. Therefore, the DAHDI_STARTUP ioctl was never processed for it, creating a situation where audio is missing on channels that are conferenced with channels on the BRI spans. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10304 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Give userspace a chance to respond to surprise removal.Tzafrir Cohen
* We try very hard to help asterisk understand that we unassign spans. * Implement disable_span(): - Set span + channels to DAHDI_ALARM_NOTOPEN - qevent DAHDI_EVENT_REMOVED * Use disable_span(): - in dahdi_unassign_span() and dahdi_unregister_device() - with long msleep() so asterisk has a chance to get the message - Out of the registration_mutex so we actually context switch. * Also return more POLLERR variants (POLLRDHUP is not portable, should be tested). * Also improve printk(), fix rate_limit increment (was missing) Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10285 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Remove dahdi_span.irq and move dahdi_span.irqmisses into dahdi_device.Tzafrir Cohen
'irqmisses' is more a function of the device and there are better ways to get to IRQ for a device than storing it in any DAHDI structures. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10276 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Expose dahdi devices in sysfs.Tzafrir Cohen
This exposes dahdi devices in sysfs and also exposes attributes that will allow user space to control the registration order in spans. This facilitates loading drivers out of order yet keeping consistent span/channel numbering, which in turn will eventually allow the blacklist for DAHDI drivers to be removed. The default behavior, controlled with the auto_register module parameter on dahdi is to number the spans / channels in order like is currently done. So this change does not introduce any new behavior by default. * Writing (anything) to this attribute returns the span to its unassigned state * Fix dahdi_chan_unreg() echocan refcount * Add safeguard against duplicate unassignment to _dahdi_unregister_span() * Remove the span from device_node list, only in dahdi_unregister_device() and not in dahdi_unregister_span() * Free allocated span->span_device in span_sysfs_remove() [is it safe?, didn't cause problem so far...] Signed-off-by: Shaun Ruffell <sruffell@digium.com> Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> dahdi: Add "hardware_id" dahdi_device attribute. - The "hardware_id" does not change with device location (e.g: when a PCI card is moved from one slot to another). - Not all devices have this attribute. It is legal for it to be NULL (that is the default for all low-level drivers that do not set it explicitly). - When "hardware_id" is NULL, the sysfs attribute value is "\n" Signed-off-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@10275 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Expose spans in sysfs.Tzafrir Cohen
This change will facilitate creating rules that will allow spans and channels to be accessed by named device files instead of by numbers. Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10274 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Register devices instead of individual spans.Tzafrir Cohen
Increasingly, spans are implemented by devices that support more than a single span. Introduce a 'struct dahdi_device' object which explicitly contains multiple spans. This will allow a cleaner representation of spans and devices in sysfs since order of arrival will not determine the layout of the devices. This also gives the core of dahdi a way to know the relationship between spans. This generalizes similar concepts that were previously xpp specific. The conversion of the xpp code was almost entirely done by Oron and Tzafrir. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10273 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: dahdi_is_analog_span() -> dahdi_is_digital_span()Tzafrir Cohen
* dahdi-base.c had a reverse is_analog_span() static function -- fixed. Signed-off-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@10272 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: Add error messages in dahdi_ioctl_chanconfig.Tzafrir Cohen
Provide more context to trouble shoot failures. 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@10271 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-10-26dahdi: start handling "surprise device removal".Tzafrir Cohen
This patch contains interim results while trying to make device removal work correctly: * XPP has protections to prevent dahdi unregistration while channels are open -- they are now removed, so we can unregister immediately. * Handle processes in poll_wait(): - Wake them during dahdi_chan_unreg() after the channel is gone (chan->channo = -1 or chan->file->private_data == NULL) - Test in every wait_event_interruptible() that the channel was not gone (chan->file->private_data) - Return correct values (POLLERR | POLLHUP) instead of some errno (would be important in the future if we modify asterisk to respond correctly to this condition. * Other issues: - If unregistered channel is being polled, than call msleep() before returning, to give other processes a chance (normally, asterisk has RT priority) - Call close_channel() from dahdi_chan_unreg() so it releases related tonezone * There is still a horrible race hidden by msleep(20) in dahdi_chan_unreg() force close channels from dahdi_chan_unreg(): * Mark them via DAHDI_FLAGBIT_OPEN * Call low-level driver close() method if available * What about other closing activities? Signed-off-by: Oron Peled <oron.peled@xorcom.com> Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10270 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-09-23dahdi: Check for master in DAHDI_STARTUP / resolves MeetMe regression.Shaun Ruffell
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-13dahdi: Decrease the initial coretimer delay to 4ms from 1 second.Shaun Ruffell
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-07-21dahdi: Drivers that do not support hwec should not report hwec is available.Shaun Ruffell
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-20get registration_mutex at free_pseudoTzafrir Cohen
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-12dahdi: Add dynamic dahdi parameter hwec_overrides_swec.Tzafrir Cohen
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-06-28dahdi: Always attach hwec to a channel if available.Shaun Ruffell
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-28Revert "dahdi: Group dahdi timers into "rates" for improved CPU utilization."Shaun Ruffell
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-28Revert "dahdi: If a timer is not configured then we should block indefinitely."Shaun Ruffell
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-02dahdi: Do not allow 'hwec' to be attached to channels that do not have one.Shaun Ruffell
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-02dahdi: Provide notification when preechocan buffer is created and destroyed.Shaun Ruffell
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-02dahdi: Update the dahdi_ec_chunk interface to support preec streams.Shaun Ruffell
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-02dahdi: Allow dahdi_span_ops.[chan|span]config and startup to block.Shaun Ruffell
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