From c88eaa22e13bd4c092b367a28e57064659660466 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Thu, 2 Aug 2007 12:21:11 +0000 Subject: Merge xpp r4372: * Update to zaptel-1.2.18 and zaptel-1.4.3 (r4308 onward) * Fix a critical race with zaptel synchronization (r4362) * Added a /proc/xpp/cmds for statistics about command timing (r4360) * Fix a digit mapping bug with hardware dtmf detection (r4357) * In xpp/utils/Makefile add perl syntax checks to our scripts (r4337) * Better USB data error checking (r4336) * udev rules (xpp.rules) avoid false calls from wrong nodes (r4331) * Improve hardware detection and reporting in lszaptel, zaptel_hardware. zapconf is basically functional. * Leds are blinked synchronously on all Astribanks now (r4262) * Fix a BRI bug if OPTIMIZE_CHANMUTE was compiled into zaptel (r4258) (This feature was not yet accepted into official zaptel) * Removed compile warning about HZ != 1000 (r4218) * Firmware updates. * fpga_load now supports USB pathes without zeros (r4211) * XPD numbers have changed to '' (r4196) * Proper support for ZT_VMWI ioctl, if used in zaptel (r4092) * Fix FXO power denial detection (r4054) * FXO could accidentally go off-hook with some compilers (r4048) (From branches/1.2 r2732, r2735 - branches/1.4 2736) git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2813 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- xpp/xpp_usb.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'xpp/xpp_usb.c') diff --git a/xpp/xpp_usb.c b/xpp/xpp_usb.c index 8403777..9ad8f27 100644 --- a/xpp/xpp_usb.c +++ b/xpp/xpp_usb.c @@ -91,6 +91,7 @@ enum { XUSB_N_TX_FRAMES, XUSB_N_RX_ERRORS, XUSB_N_TX_ERRORS, + XUSB_N_RCV_ZERO_LEN, }; #define XUSB_COUNTER(xusb, counter) ((xusb)->counters[XUSB_N_ ## counter]) @@ -104,6 +105,7 @@ static struct xusb_counters { C_(TX_FRAMES), C_(RX_ERRORS), C_(TX_ERRORS), + C_(RCV_ZERO_LEN), }; #undef C_ @@ -164,7 +166,13 @@ static int xusb_release (struct inode *inode, struct file *file); static void xusb_write_bulk_callback (struct urb *urb, struct pt_regs *regs); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) +/* + * AsteriskNow kernel has backported the "lean" callback from 2.6.20 + * to 2.6.19 without any macro to notify of this fact -- how lovely. + * Debian-Etch and Centos5 are using 2.6.18 for now (lucky for us). + * Fedora6 jumped from 2.6.18 to 2.6.20. So far luck is on our side ;-) + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) #define USB_PASS_CB(u) struct urb *u, struct pt_regs *regs #else #define USB_PASS_CB(u) struct urb *u @@ -281,8 +289,6 @@ static int xusb_xframe_send(xbus_t *xbus, xframe_t *xframe) ret = -ENODEV; goto freepack; } - if (print_dbg) - dump_xframe("USB_FRAME_SEND", xbus, xframe); size = XFRAME_LEN(xframe); xusb_ep = &xusb->endpoints[XUSB_SEND]; urb = xpp_urb_new(xusb, XUSB_SEND, size); @@ -306,6 +312,8 @@ static int xusb_xframe_send(xbus_t *xbus, xframe_t *xframe) ret = -EBADF; goto freepack; } + if (print_dbg) + dump_xframe("USB_FRAME_SEND", xbus, xframe); do_gettimeofday(&xusb->last_tx); atomic_inc(&xusb->pending_writes); freepack: @@ -807,12 +815,20 @@ static void xpp_receive_callback(USB_PASS_CB(urb)) do_resubmit = 0; goto end; } + size = urb->actual_length; + if(size == 0) { + static int rate_limit; + + if((rate_limit++ % 5003) == 0) + NOTICE("%s: Received a zero length URBs (%d)\n", xbus->busname, rate_limit); + XUSB_COUNTER(xusb, RCV_ZERO_LEN)++; + goto end; + } xframe = xbus->ops->xframe_new(xbus, GFP_ATOMIC); if(!xframe) { ERR("%s: Not enough memory for packets. Dropping\n", __FUNCTION__); goto end; } - size = urb->actual_length; atomic_set(&xframe->frame_len, size); pack = (xpacket_t *)xframe->packets; memcpy(xframe->packets, urb->transfer_buffer, size); -- cgit v1.2.3