summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcte12xp/base.c
AgeCommit message (Collapse)Author
2010-12-08wcte12xp: Use interruptible waits to decrease impact on load average.Shaun Ruffell
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-10-20wctdm24xxp, wcte12xp: Remove unused 'whichframe' parameter.Shaun Ruffell
'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-20dahdi: Atomically set/test if channel has associated network device.Shaun Ruffell
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-09-24Move test for DEFINE_SPINLOCK into include/dahdi/kernel.hShaun Ruffell
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-14wcte12xp: Remove unused 'unchannelized' global.Shaun Ruffell
Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9329 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-14wcte12xp: '4' -> 'VPM150M_ACTIVE'.Shaun Ruffell
Replacing magic number. Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9323 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-11wcte12xp: Remove unused functions from t1_span_ops.Shaun Ruffell
'open' and 'close' were already empty. 't1xxp_shutdown' only cleared DAHDI_FLAGBIT_RUNNING which is already done in dahdi-base.c after calling shutdown. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9318 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-09-10wcte11xp, wcte12xp: Fix a long-standing issue with shutdownKinsey Moore
Upon shutdown, both drivers would attempt to power down external interfaces, but never attempted to bring them back up when the span was restarted. Removing that code allows the driver to work properly until a better solution can be found. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9316 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-08-17wcte12xp: Clean up -vpm workqueue if there is not a VPMADT032 installed.Shaun Ruffell
DAHDI-681. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9145 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-08-17wcte12xp, wctdm24xxp: Add compile time option CONFIG_VOICEBUS_ECREFERENCE.Shaun Ruffell
Add compile time option to improve the reference signal provided to software echo cancelers. The intent here is for this functionality to become the default behavior but more testing and work on the edge cases is needed. It's being brought in now as a compile time option since there have been reports that it helps in some environments. Instead of using two buffers, which means that at best we're two milliseconds behind, use a circular buffer where audio data is written on the transmit side and read on the receive path. In this way high latency values will not interfere with the operation of software echo cancelers. DAHDI-291. DAHDI-387. This work was originally on: http://svn.asterisk.org/svn/dahdi/linux/team/sruffell/improved_ecreference@9143 and includes a generic kfifo replacement by Matt Fredrickson. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9144 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-29wct4xxp, wcte12xp: restrict signaling and line combinations to what actually ↵Kinsey Moore
works git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9056 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-29wct4xxp, wcte12xp: remove loobpack parameter, functionality provided by ↵Kinsey Moore
dahdi_maint git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9051 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-28wcte12xp: Add __user annotation in copy_to_user call.Shaun Ruffell
Quiets sparse. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9043 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-28wcte12xp: Trival formatting changes.Shaun Ruffell
Fixing up some of the formatting errors that crept in since the 2.3.0 release. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9040 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26dahdi: Move the 'owner' field from dahdi_span to dahdi_span_ops.Shaun Ruffell
One more thing that can be moved out of the per-span structure. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8986 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26dahdi: Move the callbacks in dahdi_span into its own structure.Shaun Ruffell
Part of preparation for adding additional callbacks to allow board drivers to advertise and support gathering pre-echocan data from hardware echocans. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8985 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26dahdi: Remove the 'pvt' member from dahdi_span.Shaun Ruffell
The vast majority of board drivers already keep the dahdi_span structure in a driver specific structure. The others were easily converted. This way board drivers can use the container_of macro to find what was previously pointed to by the "pvt" member of the span. One less thing to think about in the span structure. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8984 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26wcte12xp, wctdm24xxp: spin_lock_bh -> spin_lock_irqsaveShaun Ruffell
Will add an option to allow calling the deferred processing callback directly in the interrupt handler. It appears there are some systems which still are unable to process their tasklets in a timely fashion, especially if they get pushed out to the ksoftirqd daemon. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8981 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26wcte12xp: Do not call destory_workqueue if the workqueue was not yet created.Shaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8980 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-07-26wcte12xp, wctdm24xxp: Add shutdown handlers.Shaun Ruffell
Make the drivers a little more kexec friendly. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8979 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-05-03wcte12xp: Removed unnecessary instrumentationRuss Meyerriecks
Over-verbose instrumentation snuck in, on commit r8594 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8600 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-05-03wcte12xp: Fixes RBS/Clear mode not set correctly bugRuss Meyerriecks
(part 3) Fixes DAHDI-449 where dahdi_cfg would need to be run multiple times in order to properly set the rbs or clear mode of a channel. The prior logic was calling set_clear in the context of setting all channels to clear mode, even if the channel was intended to be in bit robbed mode. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8594 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-26wcte12xp, wctdm24xxp: Add vpm_firmware_version sysfs attribute.Shaun Ruffell
Currently only exported if CONFIG_VOICEBUS_SYSFS is defined in drivers/dahdi/voicebus.h. Reading from the 'vpm_firmware_version' attribute will poll the firmware on the VPMADT032 for it's current version. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8574 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-26wcte12xp: Add the voicebus_current_latency sysfs node.Shaun Ruffell
'voicebus_current_latency' is only exported when CONFIG_VOICEBUS_SYSFS is defined in voicebus.h. This is a debugging aide which enables determing the board specific latency without parsing through the kernel logs. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8573 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-26dahdi-base: Reverted a change from last patchRuss Meyerriecks
Removed a change to dahdi-base from last patch which might have caused compatibility with drivers other than the wcte12xp. wcte12xp: The channel clear/rbs function no longer reads the register first. It now uses the span's channel flags to determine each channels clear state. Also added various minor readability improvements. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8569 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-23dahdi-base: wcte12xp: Fixed Clear/RBS channel mode issueRuss Meyerriecks
Fixes DAHDI-449 where chanconfig was failing on the first call. It needed to be called twice in a row. This was due to the channel configuration using a non-relative channel number in its loop. Also re-added the register dumping ioctl for inspecting the framer's state. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8564 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Load the VPM in startup, not spanconfigShaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8489 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Check and dequeue/decipher the VPM commands atomicallyShaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8488 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Make sure the interrupt is stopped before freeing the vpmadt032Shaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8487 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Eliminate a trailing whitespace.Shaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8482 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Do not reconfigure the VPMADT032 if shutting down.Shaun Ruffell
If we try to unload the driver soon after a high latency event, it is possible to get stuck for several seconds reloading the firmware. DAHDI-573. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8481 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Do not restart the timer on alarm poll if shutting down.Shaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8480 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Expose the maximum latency as a module parameterShaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8479 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-06wcte12xp: Reprogram the VPM only when neccessary.Shaun Ruffell
Only program the VPM in spanconfig if it either is not setup, or if it fails a ping test. Also, if the channel config fails (but ping would otherwise work), force a reset / reconfiguration if the VPM module. DAHDI-573. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8478 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-05wcte12xp: Try to reconfigure the VPM if we fail to configure the channels.Shaun Ruffell
Also, fall back to any software echocan configured for this channel for new calls while we're in the middle of a recovery. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8473 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-04wcte12xp: Poll the VPM and reset it if necessary.Shaun Ruffell
When the transmit descriptor runs out completely, there (appears to be) a chance for a random command to be sent that results in the VPMADT032 to no longer respond, typically resulting in one way audio. This change introduces a poll of the VPM. If it fails the poll, it will be bypassed temporarily while the driver resets and reprograms it. Also, the VPM is initially programmed in the spanconfig callback instead of at driver load. This moves the potential for underruns until later in the boot process. DAHDI-573. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8468 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-04wcte12xp: Use ARRAY_SIZE in a couple more placesShaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8466 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-03wcte12xp, wtdm24xxp: Make sure the writes are retried.Shaun Ruffell
r8454 and r8460 introduced a change where writes are not retried when other module/framer commands are retried. This was an error and wasn't what was actually under test. This commit restores the behavior in wctdm24xxp and makes sure the vpm writes are retried in the wcte12xp. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8461 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-03wcte12xp, wctdm24xxp: Close a memory leak when processing VPM commands.Shaun Ruffell
Closes a memory leak when processing the VPM write commands introduced in r8454. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8460 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-03wcte12xp: Use our own workqueue for the timer and maint events.Shaun Ruffell
When the latency is large and register reads can take 100s of milliseconds, the alarm polling function could tie up one of the global workqueue threads long enough to interfere with other system operations. Most noticeably the console. DAHDI-573 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8455 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-04-03wcte12xp: Resend both framer and VPM commands when reads may have been lost.Shaun Ruffell
Latency conditions could cause the driver to misconfigure the VPM which would result in one way audio. DAHDI-572. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8454 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-24wcte12xp: Fix typo in last commit.Shaun Ruffell
Wouldn't compile on kernels >= 2.6.20. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8416 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-24wcte12xp: t1xxp_maint is also called with interrupts disabled from dahdi_ioctlShaun Ruffell
So just push all the maintenance mode processing off to the workqueue. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8415 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-24wcte12xp: t1xxp_maint can be called from interrupt context.Shaun Ruffell
Since t1xxp_maint can be called from interrupt context with the DAHDI_MAINT_LOOPSTOP cmd, push the processing of that command to a workqueue since it may sleep in the t1_getreg call. DAHDI-560. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8410 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-23wcte12xp: Fix potential race on command handling.Shaun Ruffell
If we timeout a command, don't free it right away unless we are the one who removed it from whatever list it was on. Also, increase the timeout (2 seconds wasn't enough when the firmware for the VPMOCT was being loaded on a system with 4K stacks) and check the return value from t1_getreg in case there were timeouts. DAHDI-560. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8400 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-22wcte12xp, wctdm24xxp: Do not keep individual free lists for VPM commands.Shaun Ruffell
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8375 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-08wct4xxp, wcte12xp: Fixed broken E1 and unsupported function bugsRuss Meyerriecks
* Fixed the bug where the card could not be brought out of local loopback in E1 mode. * Fixed a bunch of issues where the drivers didn't report unsupported maintenance functions correctly. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8291 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-08dahdi_maint: Added local loopback capability in E1 modesRuss Meyerriecks
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8279 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-08wct4xxp: wcte12xp: Revised maint clearingRuss Meyerriecks
Looping modes are now mutually exclusive. If two looping modes are enabled simultaneously it tends to hose up our framer chip. Now, all looping modes are cleared in the driver before any are set. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8274 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2010-03-04Fix issue with T1/E1 selection jumper always readingMike Spiceland
E1 selection. DAHDI-553 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8245 a0bf4364-ded3-4de4-8d8a-66a801d63aff