diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-04-29 20:19:13 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-04-29 20:19:13 +0000 |
commit | 878abc56f013a9bd94a46bf1a009407e6c8ecceb (patch) | |
tree | d38e11f3cc2cdb3cc9357e9a1bee1f20c724f272 /xpp/xpp_usb.c | |
parent | 47bcd1d6d884db6f92c68772aad712579f1c3b16 (diff) |
xpp rev. 3814:
* Protocol no. 2.6: syncing improvements.
* Support for 8-port Astribank BRI.
* Firmware unloading now works:
rmmod xpp_usb; /etc/hotplug/usb/xpp_fxloader reset
* Defaults of kernel parameters are now part of parameter description.
* World-readable kernel parameters.
* No need for extra patch beyond bristuff for Astribank BRI.
* Default poll intervals changed: 500 in BRI and FXO.
* Allow changing FXS polls interval at run time.
* BRI initalization fixed on SUSE (path to logger).
* When using the SUSE zaptel rpm package, set modules_var=ZAPTEL_MODULES in
/etc/sysconfig/zaptel .
* zt_registration not verbose by default.
* xpp_sync warns if FXO is sync slave.
* Fixed genzaptelconf -z (zapscan output emulation).
* PCM fixes.
* Solves "multiple ticks" bug. No need for pcm_tasklets workaround.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2475 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpp_usb.c')
-rw-r--r-- | xpp/xpp_usb.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/xpp/xpp_usb.c b/xpp/xpp_usb.c index 30aa62b..3f0bfaa 100644 --- a/xpp/xpp_usb.c +++ b/xpp/xpp_usb.c @@ -48,7 +48,7 @@ static const char rcsid[] = "$Id$"; -DEF_PARM(int, print_dbg, 0, 0600, "Print DBG statements"); /* must be before zap_debug.h */ +DEF_PARM(int, print_dbg, 0, 0644, "Print DBG statements"); /* must be before zap_debug.h */ #include "zap_debug.h" @@ -137,6 +137,10 @@ typedef struct xpp_usb_bus { atomic_t pending_writes; /* submited but not out yet */ struct semaphore sem; /* locks this structure */ int counters[XUSB_COUNTER_MAX]; + + /* metrics */ + struct timeval last_tx; + unsigned int max_tx_delay; } xusb_t; static spinlock_t xusb_lock = SPIN_LOCK_UNLOCKED; @@ -256,7 +260,11 @@ static int xusb_xframe_send(xbus_t *xbus, xframe_t *xframe) xusb = xbus->priv; BUG_ON(!xusb); if(!xusb->present) { - NOTICE("tried to send packets to non-exitant USB device. Ignored\n"); + static int rate_limit; + + if((rate_limit++ % 5000) == 0) + ERR("%s: USB device not present. Dropping packets (#%d).\n", + xbus->busname, rate_limit); ret = -ENODEV; goto freepack; } @@ -267,8 +275,8 @@ static int xusb_xframe_send(xbus_t *xbus, xframe_t *xframe) static int rate_limit; if((rate_limit++ % 5000) == 0) - ERR("%s: %s: more than %d pending writes (%d). Dropping.\n", - __FUNCTION__, xbus->busname, MAX_PENDING_WRITES, rate_limit); + ERR("%s: USB device is totaly stuck. Dropping packets (#%d).\n", + xbus->busname, rate_limit); ret = -ENODEV; goto freepack; } @@ -297,6 +305,7 @@ static int xusb_xframe_send(xbus_t *xbus, xframe_t *xframe) ret = -EBADF; goto freepack; } + do_gettimeofday(&xusb->last_tx); atomic_inc(&xusb->pending_writes); freepack: xbus->ops->xframe_free(xbus, xframe); // FIXME: eventually will be done in the urb callback @@ -720,9 +729,24 @@ static void xpp_send_callback(USB_PASS_CB(urb)) { xusb_t *xusb = (xusb_t *)urb->context; xbus_t *xbus = xusb->xbus; + struct timeval now; + long usec_diff; BUG_ON(!xbus); atomic_dec(&xusb->pending_writes); + do_gettimeofday(&now); + usec_diff = + (now.tv_sec - xusb->last_tx.tv_sec)*1000*1000 + + (now.tv_usec - xusb->last_tx.tv_usec); + if(usec_diff > xusb->max_tx_delay) + xusb->max_tx_delay = usec_diff; + if(unlikely(usec_diff > 200)) { + static int rate_limit; + + if((rate_limit++ % 5003) == 0) + NOTICE("%s: Slagish USB. %ld usec to transmit a frame\n", + xbus->busname, usec_diff); + } /* sync/async unlink faults aren't errors */ if (urb->status && !(urb->status == -ENOENT || urb->status == -ECONNRESET)) { static int rate_limit; @@ -865,6 +889,8 @@ static int xusb_read_proc(char *page, char **start, off_t off, int count, int *e xusb->endpoints[XUSB_SEND].max_size ); len += sprintf(page + len, "\npending_writes=%d\n", atomic_read(&xusb->pending_writes)); + len += sprintf(page + len, "max_tx_delay=%d\n", xusb->max_tx_delay); + xusb->max_tx_delay = 0; #ifdef DEBUG_PCM_TIMING len += sprintf(page + len, "\nstamp_last_pcm_read=%lld accumulate_diff=%lld\n", stamp_last_pcm_read, accumulate_diff); #endif |